aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@ozlabs.org>2021-02-11 17:09:45 +1100
committerPaul Mackerras <paulus@ozlabs.org>2021-02-11 17:19:42 +1100
commitab950e1acd2175eae825cfcbac621c0625ad2a86 (patch)
tree615f801305caa785a9230cda64d75df408f09930
parenta722076e947023a0d6ffca79661324c45ff30641 (diff)
downloadpowerpc-ab950e1acd2175eae825cfcbac621c0625ad2a86.tar.gz
KVM: PPC: Book3S HV: Ensure radix guest has no SLB entries
Commit 68ad28a4cdd4 ("KVM: PPC: Book3S HV: Fix radix guest SLB side channel") changed the older guest entry path, with the side effect that vcpu->arch.slb_max no longer gets cleared for a radix guest. This means that a HPT guest which loads some SLB entries, switches to radix mode, runs the guest using the old guest entry path (e.g., because the indep_threads_mode module parameter has been set to false), and then switches back to HPT mode would now see the old SLB entries being present, whereas previously it would have seen no SLB entries. To avoid changing guest-visible behaviour, this adds a store instruction to clear vcpu->arch.slb_max for a radix guest using the old guest entry path. Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
-rw-r--r--arch/powerpc/kvm/book3s_hv_rmhandlers.S6
1 files changed, 5 insertions, 1 deletions
diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
index 426bdc59fde24d..0bc1c8248050be 100644
--- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S
+++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
@@ -1539,8 +1539,12 @@ guest_exit_cont: /* r9 = vcpu, r12 = trap, r13 = paca */
.endr
b guest_bypass
-0: /* Sanitise radix guest SLB, see guest_exit_short_path comment. */
+0: /*
+ * Sanitise radix guest SLB, see guest_exit_short_path comment.
+ * We clear vcpu->arch.slb_max to match earlier behaviour.
+ */
li r0,0
+ stw r0,VCPU_SLB_MAX(r9)
slbmte r0,r0
li r4,1
slbmte r0,r4