]> Git Repo - linux.git/commitdiff
KVM: arm64: Don't pass a TLBI level hint when zapping table entries
authorWill Deacon <[email protected]>
Wed, 27 Mar 2024 12:48:51 +0000 (12:48 +0000)
committerOliver Upton <[email protected]>
Mon, 1 Apr 2024 08:30:45 +0000 (01:30 -0700)
The TLBI level hints are for leaf entries only, so take care not to pass
them incorrectly after clearing a table entry.

Cc: Gavin Shan <[email protected]>
Cc: Marc Zyngier <[email protected]>
Cc: Quentin Perret <[email protected]>
Fixes: 82bb02445de5 ("KVM: arm64: Implement kvm_pgtable_hyp_unmap() at EL2")
Fixes: 6d9d2115c480 ("KVM: arm64: Add support for stage-2 map()/unmap() in generic page-table")
Signed-off-by: Will Deacon <[email protected]>
Reviewed-by: Shaoqin Huang <[email protected]>
Reviewed-by: Marc Zyngier <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Oliver Upton <[email protected]>
arch/arm64/kvm/hyp/pgtable.c

index de0b667ba29625dea9e72011d5376c6c3362f53c..a40dafc43bb642abde9d55f5009165d4417229da 100644 (file)
@@ -528,7 +528,7 @@ static int hyp_unmap_walker(const struct kvm_pgtable_visit_ctx *ctx,
 
                kvm_clear_pte(ctx->ptep);
                dsb(ishst);
-               __tlbi_level(vae2is, __TLBI_VADDR(ctx->addr, 0), ctx->level);
+               __tlbi_level(vae2is, __TLBI_VADDR(ctx->addr, 0), TLBI_TTL_UNKNOWN);
        } else {
                if (ctx->end - ctx->addr < granule)
                        return -EINVAL;
@@ -896,10 +896,12 @@ static void stage2_unmap_put_pte(const struct kvm_pgtable_visit_ctx *ctx,
        if (kvm_pte_valid(ctx->old)) {
                kvm_clear_pte(ctx->ptep);
 
-               if (!stage2_unmap_defer_tlb_flush(pgt) ||
-                   kvm_pte_table(ctx->old, ctx->level)) {
-                       kvm_call_hyp(__kvm_tlb_flush_vmid_ipa, mmu,
-                                       ctx->addr, ctx->level);
+               if (kvm_pte_table(ctx->old, ctx->level)) {
+                       kvm_call_hyp(__kvm_tlb_flush_vmid_ipa, mmu, ctx->addr,
+                                    TLBI_TTL_UNKNOWN);
+               } else if (!stage2_unmap_defer_tlb_flush(pgt)) {
+                       kvm_call_hyp(__kvm_tlb_flush_vmid_ipa, mmu, ctx->addr,
+                                    ctx->level);
                }
        }
 
This page took 0.06143 seconds and 4 git commands to generate.