From e91e972ccfbaeba1d1416202ad1b667810a33e1f Mon Sep 17 00:00:00 2001 From: Fan Zhang Date: Thu, 12 Feb 2015 18:02:15 +0100 Subject: s390x/ipl: drop reipl parameters on resets Whenever a reboot initiated by the guest is done, the reipl parameters should remain valid. The disk configured by the guest is to be used for ipl'ing. External reboot/reset request (e.g. via virsh reset guest) should completely reset the guest to the initial state, and therefore also reset the reipl parameters, resulting in an ipl behaviour of the initially configured guest. This could be an external kernel or a disk. Reviewed-by: Cornelia Huck Reviewed-by: David Hildenbrand Acked-by: Christian Borntraeger Signed-off-by: Jens Freimann Signed-off-by: Fan Zhang Signed-off-by: Christian Borntraeger --- hw/s390x/ipl.c | 15 +++++++++++++++ hw/s390x/ipl.h | 1 + 2 files changed, 16 insertions(+) (limited to 'hw') diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c index 231713d..a1aa051 100644 --- a/hw/s390x/ipl.c +++ b/hw/s390x/ipl.c @@ -55,6 +55,7 @@ typedef struct S390IPLState { bool enforce_bios; IplParameterBlock iplb; bool iplb_valid; + bool reipl_requested; /*< public >*/ char *kernel; @@ -233,6 +234,15 @@ IplParameterBlock *s390_ipl_get_iplb(void) return &ipl->iplb; } +void s390_reipl_request(void) +{ + S390IPLState *ipl; + + ipl = S390_IPL(object_resolve_path(TYPE_S390_IPL, NULL)); + ipl->reipl_requested = true; + qemu_system_reset_request(); +} + static void s390_ipl_reset(DeviceState *dev) { S390IPLState *ipl = S390_IPL(dev); @@ -242,6 +252,11 @@ static void s390_ipl_reset(DeviceState *dev) env->psw.addr = ipl->start_addr; env->psw.mask = IPL_PSW_MASK; + if (!ipl->reipl_requested) { + ipl->iplb_valid = false; + } + ipl->reipl_requested = false; + if (!ipl->kernel || ipl->iplb_valid) { env->psw.addr = ipl->bios_start_addr; env->regs[7] = s390_update_iplstate(env, ipl); diff --git a/hw/s390x/ipl.h b/hw/s390x/ipl.h index f1d082f..70497bc 100644 --- a/hw/s390x/ipl.h +++ b/hw/s390x/ipl.h @@ -20,5 +20,6 @@ typedef struct IplParameterBlock { int s390_ipl_update_diag308(IplParameterBlock *iplb); IplParameterBlock *s390_ipl_get_iplb(void); +void s390_reipl_request(void); #endif -- cgit v1.1