@@ -191,6 +191,7 @@ struct vm_save_area {
struct vm {
struct kvm_s390_sie_block *sblk;
struct vm_save_area save_area;
+ void *sca; /* System Control Area */
uint8_t *crycb; /* Crypto Control Block */
/* Ptr to first guest page */
uint8_t *guest_mem;
@@ -203,6 +204,7 @@ void sie(struct vm *vm);
void sie_expect_validity(void);
void sie_check_validity(uint16_t vir_exp);
void sie_handle_validity(struct vm *vm);
+void sie_guest_sca_create(struct vm *vm);
void sie_guest_create(struct vm *vm, uint64_t guest_mem, uint64_t guest_mem_len);
void sie_guest_destroy(struct vm *vm);
@@ -55,6 +55,16 @@ void sie(struct vm *vm)
vm->save_area.guest.grs[15] = vm->sblk->gg15;
}
+void sie_guest_sca_create(struct vm *vm)
+{
+ vm->sca = (struct esca_block *)alloc_page();
+
+ /* Let's start out with one page of ESCA for now */
+ vm->sblk->scaoh = ((uint64_t)vm->sca >> 32);
+ vm->sblk->scaol = (uint64_t)vm->sca & ~0x3fU;
+ vm->sblk->ecb2 |= ECB2_ESCA;
+}
+
/* Initializes the struct vm members like the SIE control block. */
void sie_guest_create(struct vm *vm, uint64_t guest_mem, uint64_t guest_mem_len)
{
@@ -80,4 +90,6 @@ void sie_guest_destroy(struct vm *vm)
{
free_page(vm->crycb);
free_page(vm->sblk);
+ if (vm->sblk->ecb2 & ECB2_ESCA)
+ free_page(vm->sca);
}