Skip to content

Commit 452d622

Browse files
author
Marc Zyngier
committed
KVM: arm64: Restore missing ISB on nVHE __tlb_switch_to_guest
Commit a0e50aa ("KVM: arm64: Factor out stage 2 page table data from struct kvm") dropped the ISB after __load_guest_stage2(), only leaving the one that is required when the speculative AT workaround is in effect. As Andrew points it: "This alternative is 'backwards' to avoid a double ISB as there is one in __load_guest_stage2 when the workaround is active." Restore the missing ISB, conditionned on the AT workaround not being active. Fixes: a0e50aa ("KVM: arm64: Factor out stage 2 page table data from struct kvm") Reported-by: Andrew Scull <[email protected]> Reported-by: Thomas Tai <[email protected]> Signed-off-by: Marc Zyngier <[email protected]>
1 parent 620cf45 commit 452d622

File tree

1 file changed

+7
-0
lines changed
  • arch/arm64/kvm/hyp/nvhe

1 file changed

+7
-0
lines changed

arch/arm64/kvm/hyp/nvhe/tlb.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,14 @@ static void __tlb_switch_to_guest(struct kvm_s2_mmu *mmu,
3131
isb();
3232
}
3333

34+
/*
35+
* __load_guest_stage2() includes an ISB only when the AT
36+
* workaround is applied. Take care of the opposite condition,
37+
* ensuring that we always have an ISB, but not two ISBs back
38+
* to back.
39+
*/
3440
__load_guest_stage2(mmu);
41+
asm(ALTERNATIVE("isb", "nop", ARM64_WORKAROUND_SPECULATIVE_AT));
3542
}
3643

3744
static void __tlb_switch_to_host(struct tlb_inv_context *cxt)

0 commit comments

Comments
 (0)