Blame SOURCES/kvm-target-ppc-Move-setting-of-patb_entry-on-hash-table-.patch

9bac43
From 57adfa908abbf97d98a19724447565731f3f825f Mon Sep 17 00:00:00 2001
9bac43
From: Suraj Jitindar Singh <sursingh@redhat.com>
9bac43
Date: Tue, 5 Dec 2017 05:55:18 +0100
9bac43
Subject: [PATCH 13/21] target/ppc: Move setting of patb_entry on hash table
9bac43
 init
9bac43
9bac43
RH-Author: Suraj Jitindar Singh <sursingh@redhat.com>
9bac43
Message-id: <1512453319-16676-2-git-send-email-sursingh@redhat.com>
9bac43
Patchwork-id: 78134
9bac43
O-Subject: [RHEL7.5 qemu-kvm-rhev PATCH 1/2] target/ppc: Move setting of patb_entry on hash table init
9bac43
Bugzilla: 1517051
9bac43
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
9bac43
RH-Acked-by: David Gibson <dgibson@redhat.com>
9bac43
RH-Acked-by: Thomas Huth <thuth@redhat.com>
9bac43
9bac43
From: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
9bac43
9bac43
The patb_entry is used to store the location of the process table in
9bac43
guest memory. The msb is also used to indicate the mmu mode of the
9bac43
guest, that is patb_entry & 1 << 63 ? radix_mode : hash_mode.
9bac43
9bac43
Currently we set this to zero in spapr_setup_hpt_and_vrma() since if
9bac43
this function gets called then we know we're hash. However some code
9bac43
paths, such as setting up the hpt on incoming migration of a hash guest,
9bac43
call spapr_reallocate_hpt() directly bypassing this higher level
9bac43
function. Since we assume radix if the host is capable this results in
9bac43
the msb in patb_entry being left set so in spapr_post_load() we call
9bac43
kvmppc_configure_v3_mmu() and tell the host we're radix which as
9bac43
expected means addresses cannot be translated once we actually run the cpu.
9bac43
9bac43
To fix this move the zeroing of patb_entry into spapr_reallocate_hpt().
9bac43
9bac43
Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
9bac43
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
9bac43
(cherry picked from commit ee4d9ecc3675af1e68a9c00a8b338641898d613e)
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.c | 4 ++--
9bac43
 1 file changed, 2 insertions(+), 2 deletions(-)
9bac43
9bac43
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
9bac43
index 8623996..e3dce84 100644
9bac43
--- a/hw/ppc/spapr.c
9bac43
+++ b/hw/ppc/spapr.c
9bac43
@@ -1356,6 +1356,8 @@ void spapr_reallocate_hpt(sPAPRMachineState *spapr, int shift,
9bac43
             DIRTY_HPTE(HPTE(spapr->htab, i));
9bac43
         }
9bac43
     }
9bac43
+    /* We're setting up a hash table, so that means we're not radix */
9bac43
+    spapr->patb_entry = 0;
9bac43
 }
9bac43
 
9bac43
 void spapr_setup_hpt_and_vrma(sPAPRMachineState *spapr)
9bac43
@@ -1375,8 +1377,6 @@ void spapr_setup_hpt_and_vrma(sPAPRMachineState *spapr)
9bac43
         spapr->rma_size = kvmppc_rma_size(spapr_node0_size(),
9bac43
                                           spapr->htab_shift);
9bac43
     }
9bac43
-    /* We're setting up a hash table, so that means we're not radix */
9bac43
-    spapr->patb_entry = 0;
9bac43
 }
9bac43
 
9bac43
 static void find_unknown_sysbus_device(SysBusDevice *sbdev, void *opaque)
9bac43
-- 
9bac43
1.8.3.1
9bac43