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:45 +0100
commite52f30e059f506f22e71e8e5894ca58104852ea4 (patch)
treed63eebec7492b2fce6116b4e0785923ed686f0e4
parent31d2e9ce17198ad8bdda083c3d0ed013b89d905a (diff)
KVM: PPC: Book3S HV: Fix guest r11 corruption with POWER9 TM
workarounds (bsc#1061840).
-rw-r--r--patches.arch/KVM-PPC-Book3S-HV-Fix-guest-r11-corruption-with-POWE.patch60
-rw-r--r--series.conf1
2 files changed, 61 insertions, 0 deletions
diff --git a/patches.arch/KVM-PPC-Book3S-HV-Fix-guest-r11-corruption-with-POWE.patch b/patches.arch/KVM-PPC-Book3S-HV-Fix-guest-r11-corruption-with-POWE.patch
new file mode 100644
index 0000000000..2ccd047a5e
--- /dev/null
+++ b/patches.arch/KVM-PPC-Book3S-HV-Fix-guest-r11-corruption-with-POWE.patch
@@ -0,0 +1,60 @@
+From f14040bca89258b8a1c71e2112e430462172ce93 Mon Sep 17 00:00:00 2001
+From: Michael Neuling <mikey@neuling.org>
+Date: Thu, 13 Sep 2018 15:33:47 +1000
+Subject: [PATCH] KVM: PPC: Book3S HV: Fix guest r11 corruption with POWER9 TM
+ workarounds
+
+References: bsc#1061840
+Patch-mainline: v4.19-rc6
+Git-commit: f14040bca89258b8a1c71e2112e430462172ce93
+
+When we come into the softpatch handler (0x1500), we use r11 to store
+the HSRR0 for later use by the denorm handler.
+
+We also use the softpatch handler for the TM workarounds for
+POWER9. Unfortunately, in kvmppc_interrupt_hv we later store r11 out
+to the vcpu assuming it's still what we got from userspace.
+
+This causes r11 to be corrupted in the VCPU and hence when we restore
+the guest, we get a corrupted r11. We've seen this when running TM
+tests inside guests on P9.
+
+This fixes the problem by only touching r11 in the denorm case.
+
+Fixes: 4bb3c7a020 ("KVM: PPC: Book3S HV: Work around transactional memory bugs in POWER9")
+Cc: <stable@vger.kernel.org> # 4.17+
+Test-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
+Reviewed-by: Paul Mackerras <paulus@ozlabs.org>
+Signed-off-by: Michael Neuling <mikey@neuling.org>
+Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
+Acked-by: Michal Suchanek <msuchanek@suse.de>
+---
+ arch/powerpc/kernel/exceptions-64s.S | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
+index ea04dfb8c092..2d8fc8c9da7a 100644
+--- a/arch/powerpc/kernel/exceptions-64s.S
++++ b/arch/powerpc/kernel/exceptions-64s.S
+@@ -1314,9 +1314,7 @@ EXC_REAL_BEGIN(denorm_exception_hv, 0x1500, 0x100)
+
+ #ifdef CONFIG_PPC_DENORMALISATION
+ mfspr r10,SPRN_HSRR1
+- mfspr r11,SPRN_HSRR0 /* save HSRR0 */
+ andis. r10,r10,(HSRR1_DENORM)@h /* denorm? */
+- addi r11,r11,-4 /* HSRR0 is next instruction */
+ bne+ denorm_assist
+ #endif
+
+@@ -1382,6 +1380,8 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_207S)
+ */
+ XVCPSGNDP32(32)
+ denorm_done:
++ mfspr r11,SPRN_HSRR0
++ subi r11,r11,4
+ mtspr SPRN_HSRR0,r11
+ mtcrf 0x80,r9
+ ld r9,PACA_EXGEN+EX_R9(r13)
+--
+2.13.7
+
diff --git a/series.conf b/series.conf
index 11e1c5c59b..f8d8178f40 100644
--- a/series.conf
+++ b/series.conf
@@ -18166,6 +18166,7 @@
patches.drivers/drm-mali-dp-Call-drm_crtc_vblank_reset-on-device-ini.patch
patches.fixes/0001-drm-amdgpu-Fix-vce-work-queue-was-not-cancelled-when.patch
patches.drivers/pinctrl-cannonlake-Fix-HOSTSW_OWN-register-offset-of.patch
+ patches.arch/KVM-PPC-Book3S-HV-Fix-guest-r11-corruption-with-POWE.patch
patches.arch/powerpc-Avoid-code-patching-freed-init-sections.patch
patches.arch/powerpc-powernv-ioda2-Reduce-upper-limit-for-DMA-win.patch
patches.arch/powerpc-pkeys-Fix-reading-of-ibm-processor-storage-k.patch