thebeanogamer / rpms / qemu-kvm

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