Message ID | 20221021063902.10878-6-frankja@linux.ibm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | s390x: PV fixups | expand |
On 10/21/22 08:39, Janosch Frank wrote: > Convert the sblk to non-PV when the PV guest is destroyed. > > Early return in uv_init() instead of running into the assert. This is > necessary since snippet_pv_init() will always call uv_init(). > > Signed-off-by: Janosch Frank <frankja@linux.ibm.com> > Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com> Reviewed-by: Steffen Eiden <seiden@linux.ibm.com> > --- > lib/s390x/uv.c | 11 ++++++++++- > 1 file changed, 10 insertions(+), 1 deletion(-) > > diff --git a/lib/s390x/uv.c b/lib/s390x/uv.c > index b2a43424..383271a5 100644 > --- a/lib/s390x/uv.c > +++ b/lib/s390x/uv.c > @@ -76,7 +76,8 @@ void uv_init(void) > int cc; > > /* Let's not do this twice */ > - assert(!initialized); > + if (initialized) > + return; > /* Query is done on initialization but let's check anyway */ > assert(uvcb_qui.header.rc == 1 || uvcb_qui.header.rc == 0x100); > > @@ -188,6 +189,14 @@ void uv_destroy_guest(struct vm *vm) > free_pages(vm->uv.conf_var_stor); > > free_pages((void *)(vm->uv.asce & PAGE_MASK)); > + memset(&vm->uv, 0, sizeof(vm->uv)); > + > + /* Convert the sblk back to non-PV */ > + vm->save_area.guest.asce = stctg(1); > + vm->sblk->sdf = 0; > + vm->sblk->sidad = 0; > + vm->sblk->pv_handle_cpu = 0; > + vm->sblk->pv_handle_config = 0; > } > > int uv_unpack(struct vm *vm, uint64_t addr, uint64_t len, uint64_t tweak)
diff --git a/lib/s390x/uv.c b/lib/s390x/uv.c index b2a43424..383271a5 100644 --- a/lib/s390x/uv.c +++ b/lib/s390x/uv.c @@ -76,7 +76,8 @@ void uv_init(void) int cc; /* Let's not do this twice */ - assert(!initialized); + if (initialized) + return; /* Query is done on initialization but let's check anyway */ assert(uvcb_qui.header.rc == 1 || uvcb_qui.header.rc == 0x100); @@ -188,6 +189,14 @@ void uv_destroy_guest(struct vm *vm) free_pages(vm->uv.conf_var_stor); free_pages((void *)(vm->uv.asce & PAGE_MASK)); + memset(&vm->uv, 0, sizeof(vm->uv)); + + /* Convert the sblk back to non-PV */ + vm->save_area.guest.asce = stctg(1); + vm->sblk->sdf = 0; + vm->sblk->sidad = 0; + vm->sblk->pv_handle_cpu = 0; + vm->sblk->pv_handle_config = 0; } int uv_unpack(struct vm *vm, uint64_t addr, uint64_t len, uint64_t tweak)