cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-spapr-Don-t-trigger-a-CAS-reboot-for-XICS-XIVE-mode-.patch

902636
From f2aeed761d2dad14920fa08c977dc45564886d9b Mon Sep 17 00:00:00 2001
902636
From: David Gibson <dgibson@redhat.com>
902636
Date: Fri, 3 Jan 2020 01:15:12 +0000
902636
Subject: [PATCH 1/5] spapr: Don't trigger a CAS reboot for XICS/XIVE mode
902636
 changeover
902636
MIME-Version: 1.0
902636
Content-Type: text/plain; charset=UTF-8
902636
Content-Transfer-Encoding: 8bit
902636
902636
RH-Author: David Gibson <dgibson@redhat.com>
902636
Message-id: <20200103011512.49129-2-dgibson@redhat.com>
902636
Patchwork-id: 93261
902636
O-Subject: [RHEL-AV-4.2 qemu-kvm PATCH 1/1] spapr: Don't trigger a CAS reboot for XICS/XIVE mode changeover
902636
Bugzilla: 1733893
902636
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
902636
RH-Acked-by: Thomas Huth <thuth@redhat.com>
902636
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
902636
902636
From: David Gibson <david@gibson.dropbear.id.au>
902636
902636
PAPR allows the interrupt controller used on a POWER9 machine (XICS or
902636
XIVE) to be selected by the guest operating system, by using the
902636
ibm,client-architecture-support (CAS) feature negotiation call.
902636
902636
Currently, if the guest selects an interrupt controller different from the
902636
one selected at initial boot, this causes the system to be reset with the
902636
new model and the boot starts again.  This means we run through the SLOF
902636
boot process twice, as well as any other bootloader (e.g. grub) in use
902636
before the OS calls CAS.  This can be confusing and/or inconvenient for
902636
users.
902636
902636
Thanks to two fairly recent changes, we no longer need this reboot.  1) we
902636
now completely regenerate the device tree when CAS is called (meaning we
902636
don't need special case updates for all the device tree changes caused by
902636
the interrupt controller mode change),  2) we now have explicit code paths
902636
to activate and deactivate the different interrupt controllers, rather than
902636
just implicitly calling those at machine reset time.
902636
902636
We can therefore eliminate the reboot for changing irq mode, simply by
902636
putting a call to spapr_irq_update_active_intc() before we call
902636
spapr_h_cas_compose_response() (which gives the updated device tree to
902636
the guest firmware and OS).
902636
902636
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
902636
Reviewed-by: Cedric Le Goater <clg@fr.ibm.com>
902636
Reviewed-by: Greg Kurz <groug@kaod.org>
902636
(cherry picked from commit 8deb8019d696c75e6ecaee7545026b62aba2f1bb)
902636
902636
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1733893
902636
902636
Signed-off-by: David Gibson <dgibson@redhat.com>
902636
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
902636
---
902636
 hw/ppc/spapr_hcall.c | 33 +++++++++++++--------------------
902636
 1 file changed, 13 insertions(+), 20 deletions(-)
902636
902636
diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c
902636
index 140f05c..05a7ca2 100644
902636
--- a/hw/ppc/spapr_hcall.c
902636
+++ b/hw/ppc/spapr_hcall.c
902636
@@ -1767,21 +1767,10 @@ static target_ulong h_client_architecture_support(PowerPCCPU *cpu,
902636
     }
902636
     spapr->cas_pre_isa3_guest = !spapr_ovec_test(ov1_guest, OV1_PPC_3_00);
902636
     spapr_ovec_cleanup(ov1_guest);
902636
-    if (!spapr->cas_reboot) {
902636
-        /* If spapr_machine_reset() did not set up a HPT but one is necessary
902636
-         * (because the guest isn't going to use radix) then set it up here. */
902636
-        if ((spapr->patb_entry & PATE1_GR) && !guest_radix) {
902636
-            /* legacy hash or new hash: */
902636
-            spapr_setup_hpt_and_vrma(spapr);
902636
-        }
902636
-        spapr->cas_reboot =
902636
-            (spapr_h_cas_compose_response(spapr, args[1], args[2],
902636
-                                          ov5_updates) != 0);
902636
-    }
902636
 
902636
     /*
902636
-     * Ensure the guest asks for an interrupt mode we support; otherwise
902636
-     * terminate the boot.
902636
+     * Ensure the guest asks for an interrupt mode we support;
902636
+     * otherwise terminate the boot.
902636
      */
902636
     if (guest_xive) {
902636
         if (!spapr->irq->xive) {
902636
@@ -1797,14 +1786,18 @@ static target_ulong h_client_architecture_support(PowerPCCPU *cpu,
902636
         }
902636
     }
902636
 
902636
-    /*
902636
-     * Generate a machine reset when we have an update of the
902636
-     * interrupt mode. Only required when the machine supports both
902636
-     * modes.
902636
-     */
902636
+    spapr_irq_update_active_intc(spapr);
902636
+
902636
     if (!spapr->cas_reboot) {
902636
-        spapr->cas_reboot = spapr_ovec_test(ov5_updates, OV5_XIVE_EXPLOIT)
902636
-            && spapr->irq->xics && spapr->irq->xive;
902636
+        /* If spapr_machine_reset() did not set up a HPT but one is necessary
902636
+         * (because the guest isn't going to use radix) then set it up here. */
902636
+        if ((spapr->patb_entry & PATE1_GR) && !guest_radix) {
902636
+            /* legacy hash or new hash: */
902636
+            spapr_setup_hpt_and_vrma(spapr);
902636
+        }
902636
+        spapr->cas_reboot =
902636
+            (spapr_h_cas_compose_response(spapr, args[1], args[2],
902636
+                                          ov5_updates) != 0);
902636
     }
902636
 
902636
     spapr_ovec_cleanup(ov5_updates);
902636
-- 
902636
1.8.3.1
902636