diff mbox series

[04/11] powerpc/fsl: Emulate SPRN_BUCSR register

Message ID 1544623390-18710-5-git-send-email-diana.craciun@nxp.com (mailing list archive)
State Accepted
Commit 98518c4d8728656db349f875fcbbc7c126d4c973
Headers show
Series powerpc/fsl: NXP PowerPC Spectre variant 2 workarounds | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success next/apply_patch Successfully applied
snowpatch_ozlabs/checkpatch success total: 0 errors, 0 warnings, 0 checks, 11 lines checked

Commit Message

Diana Craciun Dec. 12, 2018, 2:03 p.m. UTC
In order to flush the branch predictor the guest kernel
performs writes to the BUCSR register which is hypervisor
privilleged. However, the branch predictor is flushed at
each KVM entry, so the branch predictor has been already
flushed, so just return as soon as possible to guest.

Signed-off-by: Diana Craciun <diana.craciun@nxp.com>
---
 arch/powerpc/kvm/e500_emulate.c | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox series

Patch

diff --git a/arch/powerpc/kvm/e500_emulate.c b/arch/powerpc/kvm/e500_emulate.c
index 3f8189e..d0eb670 100644
--- a/arch/powerpc/kvm/e500_emulate.c
+++ b/arch/powerpc/kvm/e500_emulate.c
@@ -276,6 +276,11 @@  int kvmppc_core_emulate_mtspr_e500(struct kvm_vcpu *vcpu, int sprn, ulong spr_va
 		 */
 		vcpu->arch.pwrmgtcr0 = spr_val;
 		break;
+		/* if we are here, it means that we have already flushed the
+		 * branch predictor, so just return to guest
+		 */
+	case SPRN_BUCSR:
+		break;
 
 	/* extra exceptions */
 #ifdef CONFIG_SPE_POSSIBLE