fixup! KVM: arm64: Support TLB invalidation in guest context
Signed-off-by: Will Deacon <will@kernel.org>
diff --git a/arch/arm64/kvm/hyp/nvhe/tlb.c b/arch/arm64/kvm/hyp/nvhe/tlb.c
index fc9b1882..05a66b2 100644
--- a/arch/arm64/kvm/hyp/nvhe/tlb.c
+++ b/arch/arm64/kvm/hyp/nvhe/tlb.c
@@ -29,24 +29,6 @@ static void enter_vmid_context(struct kvm_s2_mmu *mmu,
cxt->mmu = NULL;
/*
- * If we're already in the desired context, then there's nothing
- * to do.
- */
- if (vcpu) {
- /* We're in guest context */
- if (mmu == vcpu->arch.hw_mmu || WARN_ON(mmu != host_s2_mmu))
- return;
-
- cxt->mmu = vcpu->arch.hw_mmu;
- } else {
- /* We're in host context */
- if (mmu == host_s2_mmu)
- return;
-
- cxt->mmu = host_s2_mmu;
- }
-
- /*
* We have two requirements:
*
* - ensure that the page table updates are visible to all
@@ -68,6 +50,24 @@ static void enter_vmid_context(struct kvm_s2_mmu *mmu,
else
dsb(ish);
+ /*
+ * If we're already in the desired context, then there's nothing
+ * to do.
+ */
+ if (vcpu) {
+ /* We're in guest context */
+ if (mmu == vcpu->arch.hw_mmu || WARN_ON(mmu != host_s2_mmu))
+ return;
+
+ cxt->mmu = vcpu->arch.hw_mmu;
+ } else {
+ /* We're in host context */
+ if (mmu == host_s2_mmu)
+ return;
+
+ cxt->mmu = host_s2_mmu;
+ }
+
if (cpus_have_final_cap(ARM64_WORKAROUND_SPECULATIVE_AT)) {
u64 val;