]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - queue-4.9/powerpc-fsl-flush-branch-predictor-when-entering-kvm.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / queue-4.9 / powerpc-fsl-flush-branch-predictor-when-entering-kvm.patch
CommitLineData
45d80ddf
SL
1From 93d143d2fdba4f9cc44f4b4dcc91fc8265ed4563 Mon Sep 17 00:00:00 2001
2From: Diana Craciun <diana.craciun@nxp.com>
3Date: Thu, 11 Apr 2019 21:46:25 +1000
4Subject: powerpc/fsl: Flush branch predictor when entering KVM
5
6commit e7aa61f47b23afbec41031bc47ca8d6cb6516abc upstream.
7
8Switching from the guest to host is another place
9where the speculative accesses can be exploited.
10Flush the branch predictor when entering KVM.
11
12Signed-off-by: Diana Craciun <diana.craciun@nxp.com>
13Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
14Signed-off-by: Sasha Levin <sashal@kernel.org>
15---
16 arch/powerpc/kvm/bookehv_interrupts.S | 4 ++++
17 1 file changed, 4 insertions(+)
18
19diff --git a/arch/powerpc/kvm/bookehv_interrupts.S b/arch/powerpc/kvm/bookehv_interrupts.S
20index 81bd8a07aa51..612b7f6a887f 100644
21--- a/arch/powerpc/kvm/bookehv_interrupts.S
22+++ b/arch/powerpc/kvm/bookehv_interrupts.S
23@@ -75,6 +75,10 @@
24 PPC_LL r1, VCPU_HOST_STACK(r4)
25 PPC_LL r2, HOST_R2(r1)
26
27+START_BTB_FLUSH_SECTION
28+ BTB_FLUSH(r10)
29+END_BTB_FLUSH_SECTION
30+
31 mfspr r10, SPRN_PID
32 lwz r8, VCPU_HOST_PID(r4)
33 PPC_LL r11, VCPU_SHARED(r4)
34--
352.19.1
36