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

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