s390x: lib: sie: Add struct vm (de)initialization functions
Before I start copying the same code over and over lets move this into
the library.
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
diff --git a/s390x/mvpg-sie.c b/s390x/mvpg-sie.c
index 2ac91ee..71ae4f8 100644
--- a/s390x/mvpg-sie.c
+++ b/s390x/mvpg-sie.c
@@ -110,22 +110,7 @@
/* The first two pages are the lowcore */
guest_instr = guest + PAGE_SIZE * 2;
- vm.sblk = alloc_page();
-
- vm.sblk->cpuflags = CPUSTAT_ZARCH | CPUSTAT_RUNNING;
- vm.sblk->prefix = 0;
- /*
- * Pageable guest with the same ASCE as the test programm, but
- * the guest memory 0x0 is offset to start at the allocated
- * guest pages and end after 1MB.
- *
- * It's not pretty but faster and easier than managing guest ASCEs.
- */
- vm.sblk->mso = (u64)guest;
- vm.sblk->msl = (u64)guest;
- vm.sblk->ihcpu = 0xffff;
-
- vm.sblk->crycbd = (uint64_t)alloc_page();
+ sie_guest_create(&vm, (uint64_t)guest, HPAGE_SIZE);
vm.sblk->gpsw.addr = PAGE_SIZE * 4;
vm.sblk->gpsw.mask = 0x0000000180000000ULL;
@@ -150,6 +135,7 @@
setup_guest();
test_mvpg();
test_mvpg_pei();
+ sie_guest_destroy(&vm);
done:
report_prefix_pop();