powerpc/fsl: Flush branch predictor when entering KVM
authorDiana Craciun <diana.craciun@nxp.com>
Wed, 12 Dec 2018 14:03:07 +0000 (16:03 +0200)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 20 Dec 2018 11:59:03 +0000 (22:59 +1100)
Switching from the guest to host is another place
where the speculative accesses can be exploited.
Flush the branch predictor when entering KVM.

Signed-off-by: Diana Craciun <diana.craciun@nxp.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/kvm/bookehv_interrupts.S

index 051af7d973275ae9294e60f62d45f7932186cdce..4e5081e584098b38f64a8774b7e64b6352e1f674 100644 (file)
        PPC_LL  r1, VCPU_HOST_STACK(r4)
        PPC_LL  r2, HOST_R2(r1)
 
+START_BTB_FLUSH_SECTION
+       BTB_FLUSH(r10)
+END_BTB_FLUSH_SECTION
+
        mfspr   r10, SPRN_PID
        lwz     r8, VCPU_HOST_PID(r4)
        PPC_LL  r11, VCPU_SHARED(r4)