Blame SOURCES/kvm-target-ppc-correct-htab-shift-for-hash-on-radix.patch

4a2fec
From c1ed391fd7e14e16387f8d5e320b13157851db9a Mon Sep 17 00:00:00 2001
4a2fec
From: Suraj Jitindar Singh <sursingh@redhat.com>
4a2fec
Date: Fri, 24 Nov 2017 00:58:16 +0100
4a2fec
Subject: [PATCH 11/15] target/ppc: correct htab shift for hash on radix
4a2fec
4a2fec
RH-Author: Suraj Jitindar Singh <sursingh@redhat.com>
4a2fec
Message-id: <1511485097-25676-2-git-send-email-sursingh@redhat.com>
4a2fec
Patchwork-id: 77845
4a2fec
O-Subject: [RHEL7.5 qemu-kvm-rhev PATCH 1/2] target/ppc: correct htab shift for hash on radix
4a2fec
Bugzilla: 1396120
4a2fec
RH-Acked-by: David Gibson <dgibson@redhat.com>
4a2fec
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
4a2fec
RH-Acked-by: Thomas Huth <thuth@redhat.com>
4a2fec
4a2fec
From: Sam Bobroff <sam.bobroff@au1.ibm.com>
4a2fec
4a2fec
KVM HV will soon support running a guest in hash mode on a POWER9 host
4a2fec
running in radix mode (see [1]), however the guest currently fails to
4a2fec
boot.
4a2fec
4a2fec
This is because the "htab_shift" value (the size of the MMU's hash
4a2fec
table) is added to the device tree before KVM has had a chance to
4a2fec
change it. If the host is in hash mode, KVM does not need to change it
4a2fec
and so the problem is not seen, but when the host is in radix mode a
4a2fec
change is required and we see a problem.
4a2fec
4a2fec
To fix this, move the call spapr_setup_hpt_and_vrma() (where
4a2fec
htab_shift could be changed) up a little so that it's called before
4a2fec
spapr_h_cas_compose_response() (where htab_shift is added to the
4a2fec
device tree).
4a2fec
4a2fec
Signed-off-by: Sam Bobroff <sam.bobroff@au1.ibm.com>
4a2fec
4a2fec
[1] See http://www.spinics.net/lists/kvm-ppc/msg13057.html
4a2fec
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
4a2fec
4a2fec
(cherry picked from commit e05fba5004676cd0fa7c47b623cb0a14ad1feed8)
4a2fec
4a2fec
Signed-off-by: Suraj Jitindar Singh <sursingh@redhat.com>
4a2fec
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
4a2fec
---
4a2fec
 hw/ppc/spapr_hcall.c | 13 ++++++-------
4a2fec
 1 file changed, 6 insertions(+), 7 deletions(-)
4a2fec
4a2fec
diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c
4a2fec
index 92f1e21..b503299 100644
4a2fec
--- a/hw/ppc/spapr_hcall.c
4a2fec
+++ b/hw/ppc/spapr_hcall.c
4a2fec
@@ -1609,6 +1609,12 @@ static target_ulong h_client_architecture_support(PowerPCCPU *cpu,
4a2fec
     spapr->cas_legacy_guest_workaround = !spapr_ovec_test(ov1_guest,
4a2fec
                                                           OV1_PPC_3_00);
4a2fec
     if (!spapr->cas_reboot) {
4a2fec
+        /* If ppc_spapr_reset() did not set up a HPT but one is necessary
4a2fec
+         * (because the guest isn't going to use radix) then set it up here. */
4a2fec
+        if ((spapr->patb_entry & PATBE1_GR) && !guest_radix) {
4a2fec
+            /* legacy hash or new hash: */
4a2fec
+            spapr_setup_hpt_and_vrma(spapr);
4a2fec
+        }
4a2fec
         spapr->cas_reboot =
4a2fec
             (spapr_h_cas_compose_response(spapr, args[1], args[2],
4a2fec
                                           ov5_updates) != 0);
4a2fec
@@ -1617,13 +1623,6 @@ static target_ulong h_client_architecture_support(PowerPCCPU *cpu,
4a2fec
 
4a2fec
     if (spapr->cas_reboot) {
4a2fec
         qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
4a2fec
-    } else {
4a2fec
-        /* If ppc_spapr_reset() did not set up a HPT but one is necessary
4a2fec
-         * (because the guest isn't going to use radix) then set it up here. */
4a2fec
-        if ((spapr->patb_entry & PATBE1_GR) && !guest_radix) {
4a2fec
-            /* legacy hash or new hash: */
4a2fec
-            spapr_setup_hpt_and_vrma(spapr);
4a2fec
-        }
4a2fec
     }
4a2fec
 
4a2fec
     return H_SUCCESS;
4a2fec
-- 
4a2fec
1.8.3.1
4a2fec