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

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