Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Suchanek <msuchanek@suse.de>2018-10-31 13:27:38 +0100
committerMichal Suchanek <msuchanek@suse.de>2018-10-31 23:28:44 +0100
commitd9a3e02ba9ad9101b9c21f14c92eeb48d39014ed (patch)
tree7d952591618310947a65ee77ab8675c5bcd484d9
parent96e80128bf3f778b8a8a81b15c0f6b781af62d14 (diff)
KVM: PPC: Book3S HV: Don't truncate HPTE index in xlate function
(bsc#1061840).
-rw-r--r--patches.arch/KVM-PPC-Book3S-HV-Don-t-truncate-HPTE-index-in-xlate.patch47
-rw-r--r--series.conf1
2 files changed, 48 insertions, 0 deletions
diff --git a/patches.arch/KVM-PPC-Book3S-HV-Don-t-truncate-HPTE-index-in-xlate.patch b/patches.arch/KVM-PPC-Book3S-HV-Don-t-truncate-HPTE-index-in-xlate.patch
new file mode 100644
index 0000000000..0c6bbd2433
--- /dev/null
+++ b/patches.arch/KVM-PPC-Book3S-HV-Don-t-truncate-HPTE-index-in-xlate.patch
@@ -0,0 +1,47 @@
+From 46dec40fb741f00f1864580130779aeeaf24fb3d Mon Sep 17 00:00:00 2001
+From: Paul Mackerras <paulus@ozlabs.org>
+Date: Mon, 20 Aug 2018 16:05:45 +1000
+Subject: [PATCH] KVM: PPC: Book3S HV: Don't truncate HPTE index in xlate
+ function
+
+References: bsc#1061840
+Patch-mainline: v4.19-rc3
+Git-commit: 46dec40fb741f00f1864580130779aeeaf24fb3d
+
+This fixes a bug which causes guest virtual addresses to get translated
+to guest real addresses incorrectly when the guest is using the HPT MMU
+and has more than 256GB of RAM, or more specifically has a HPT larger
+than 2GB. This has showed up in testing as a failure of the host to
+emulate doorbell instructions correctly on POWER9 for HPT guests with
+more than 256GB of RAM.
+
+The bug is that the HPTE index in kvmppc_mmu_book3s_64_hv_xlate()
+is stored as an int, and in forming the HPTE address, the index gets
+shifted left 4 bits as an int before being signed-extended to 64 bits.
+The simple fix is to make the variable a long int, matching the
+return type of kvmppc_hv_find_lock_hpte(), which is what calculates
+the index.
+
+Fixes: 697d3899dcb4 ("KVM: PPC: Implement MMIO emulation support for Book3S HV guests")
+Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
+Acked-by: Michal Suchanek <msuchanek@suse.de>
+---
+ arch/powerpc/kvm/book3s_64_mmu_hv.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm/book3s_64_mmu_hv.c
+index 7f3a8cf5d66f..4c08f42f6406 100644
+--- a/arch/powerpc/kvm/book3s_64_mmu_hv.c
++++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c
+@@ -359,7 +359,7 @@ static int kvmppc_mmu_book3s_64_hv_xlate(struct kvm_vcpu *vcpu, gva_t eaddr,
+ unsigned long pp, key;
+ unsigned long v, orig_v, gr;
+ __be64 *hptep;
+- int index;
++ long int index;
+ int virtmode = vcpu->arch.shregs.msr & (data ? MSR_DR : MSR_IR);
+
+ if (kvm_is_radix(vcpu->kvm))
+--
+2.13.7
+
diff --git a/series.conf b/series.conf
index 00c2ecb9e1..0252ed0464 100644
--- a/series.conf
+++ b/series.conf
@@ -18016,6 +18016,7 @@
patches.arch/kvm-x86-default-to-not-allowing-emulation-retry-in-kvm_mmu_page_fault
patches.arch/kvm-x86-do-not-re-try-execute-after-failed-emulation-in-l2
patches.arch/KVM-PPC-Book3S-HV-Use-correct-pagesize-in-kvm_unmap_.patch
+ patches.arch/KVM-PPC-Book3S-HV-Don-t-truncate-HPTE-index-in-xlate.patch
patches.arch/x86-microcode-make-sure-boot_cpu_data-microcode-is-up-to-date
patches.arch/x86-microcode-update-the-new-microcode-revision-unconditionally
patches.arch/x86-process-don-t-mix-user-kernel-regs-in-64bit-_show_regs