yeahuh / rpms / qemu-kvm

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