From 663daa42eaaff2b9c071764163005e04133af849 Mon Sep 17 00:00:00 2001
From: Cornelia Huck <cohuck@redhat.com>
Date: Wed, 17 Apr 2019 13:57:41 +0100
Subject: [PATCH 24/24] s390/ipl: fix ipl with -no-reboot
RH-Author: Cornelia Huck <cohuck@redhat.com>
Message-id: <20190417135741.25297-25-cohuck@redhat.com>
Patchwork-id: 85804
O-Subject: [RHEL-8.1.0 qemu-kvm PATCH v2 24/24] s390/ipl: fix ipl with -no-reboot
Bugzilla: 1699070
RH-Acked-by: David Hildenbrand <david@redhat.com>
RH-Acked-by: Thomas Huth <thuth@redhat.com>
RH-Acked-by: Jens Freimann <jfreimann@redhat.com>
From: Christian Borntraeger <borntraeger@de.ibm.com>
kexec/kdump as well as the bootloader use a subcode of diagnose 308
that is supposed to reset the I/O subsystem but not comprise a full
"reboot". With the latest refactoring this is now broken when
-no-reboot is used or when libvirt acts on a reboot QMP event, for
example a virt-install from iso images.
We need to mark these "subsystem resets" as special.
Fixes: a30fb811cbe9 (s390x: refactor reset/reipl handling)
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Message-Id: <20180622102928.173420-1-borntraeger@de.ibm.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
(cherry picked from commit 76ed4b18debfe597329d1f6a9eb2ec9ffa751ecd)
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
hw/s390x/ipl.c | 8 +++++++-
include/sysemu/sysemu.h | 4 ++++
vl.c | 4 ++--
3 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c
index ee6701e..21f64ad 100644
--- a/hw/s390x/ipl.c
+++ b/hw/s390x/ipl.c
@@ -541,7 +541,13 @@ void s390_ipl_reset_request(CPUState *cs, enum s390_reset reset_type)
ipl->iplb_valid = s390_gen_initial_iplb(ipl);
}
}
- qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
+ if (reset_type == S390_RESET_MODIFIED_CLEAR ||
+ reset_type == S390_RESET_LOAD_NORMAL) {
+ /* ignore -no-reboot, send no event */
+ qemu_system_reset_request(SHUTDOWN_CAUSE_SUBSYSTEM_RESET);
+ } else {
+ qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
+ }
/* as this is triggered by a CPU, make sure to exit the loop */
if (tcg_enabled()) {
cpu_loop_exit(cs);
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 2b42151..f20e4f5 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -44,6 +44,10 @@ typedef enum ShutdownCause {
turns that into a shutdown */
SHUTDOWN_CAUSE_GUEST_PANIC, /* Guest panicked, and command line turns
that into a shutdown */
+ SHUTDOWN_CAUSE_SUBSYSTEM_RESET,/* Partial guest reset that does not trigger
+ QMP events and ignores --no-reboot. This
+ is useful for sanitize hypercalls on s390
+ that are used during kexec/kdump/boot */
SHUTDOWN_CAUSE__MAX,
} ShutdownCause;
diff --git a/vl.c b/vl.c
index 9d32921..c778594 100644
--- a/vl.c
+++ b/vl.c
@@ -1751,7 +1751,7 @@ void qemu_system_reset(ShutdownCause reason)
} else {
qemu_devices_reset();
}
- if (reason) {
+ if (reason != SHUTDOWN_CAUSE_SUBSYSTEM_RESET) {
qapi_event_send_reset(shutdown_caused_by_guest(reason),
&error_abort);
}
@@ -1797,7 +1797,7 @@ void qemu_system_guest_panicked(GuestPanicInformation *info)
void qemu_system_reset_request(ShutdownCause reason)
{
- if (no_reboot) {
+ if (no_reboot && reason != SHUTDOWN_CAUSE_SUBSYSTEM_RESET) {
shutdown_requested = reason;
} else {
reset_requested = reason;
--
1.8.3.1