]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.9.169/powerpc-fsl-emulate-sprn_bucsr-register.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.9.169 / powerpc-fsl-emulate-sprn_bucsr-register.patch
1 From 512465f78c9e1a6ee0a66b4cfdb30b77936ba6db Mon Sep 17 00:00:00 2001
2 From: Diana Craciun <diana.craciun@nxp.com>
3 Date: Thu, 11 Apr 2019 21:46:21 +1000
4 Subject: powerpc/fsl: Emulate SPRN_BUCSR register
5
6 commit 98518c4d8728656db349f875fcbbc7c126d4c973 upstream.
7
8 In order to flush the branch predictor the guest kernel performs
9 writes to the BUCSR register which is hypervisor privilleged. However,
10 the branch predictor is flushed at each KVM entry, so the branch
11 predictor has been already flushed, so just return as soon as possible
12 to guest.
13
14 Signed-off-by: Diana Craciun <diana.craciun@nxp.com>
15 [mpe: Tweak comment formatting]
16 Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
17 Signed-off-by: Sasha Levin <sashal@kernel.org>
18 ---
19 arch/powerpc/kvm/e500_emulate.c | 7 +++++++
20 1 file changed, 7 insertions(+)
21
22 diff --git a/arch/powerpc/kvm/e500_emulate.c b/arch/powerpc/kvm/e500_emulate.c
23 index 990db69a1d0b..fa88f641ac03 100644
24 --- a/arch/powerpc/kvm/e500_emulate.c
25 +++ b/arch/powerpc/kvm/e500_emulate.c
26 @@ -277,6 +277,13 @@ int kvmppc_core_emulate_mtspr_e500(struct kvm_vcpu *vcpu, int sprn, ulong spr_va
27 vcpu->arch.pwrmgtcr0 = spr_val;
28 break;
29
30 + case SPRN_BUCSR:
31 + /*
32 + * If we are here, it means that we have already flushed the
33 + * branch predictor, so just return to guest.
34 + */
35 + break;
36 +
37 /* extra exceptions */
38 #ifdef CONFIG_SPE_POSSIBLE
39 case SPRN_IVOR32:
40 --
41 2.19.1
42