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

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