ANDROID: KVM: arm64: Split stage2_put_pte function
Refactor the code and introduce stage2_unmap_clear_pte which removes the page table entry without dropping the refcount of the page table page. This will be used later when we modify the refcounting mechanism so that we will be able to clear the entries without dropping the refcount. Change-Id: I4a159b78bd17ff53ce063309b4b02ebb2d1c192d Bug: 357781595 Signed-off-by: Sebastian Ene <sebastianene@google.com>
This commit is contained in:
committed by
Keir Fraser
parent
295bedfe31
commit
b7b3b15f91
@@ -864,17 +864,10 @@ static bool stage2_unmap_defer_tlb_flush(struct kvm_pgtable *pgt)
|
||||
return system_supports_tlb_range() && stage2_has_fwb(pgt);
|
||||
}
|
||||
|
||||
static void stage2_unmap_put_pte(const struct kvm_pgtable_visit_ctx *ctx,
|
||||
struct kvm_s2_mmu *mmu,
|
||||
struct kvm_pgtable_mm_ops *mm_ops)
|
||||
static void stage2_unmap_clear_pte(const struct kvm_pgtable_visit_ctx *ctx,
|
||||
struct kvm_s2_mmu *mmu)
|
||||
{
|
||||
struct kvm_pgtable *pgt = ctx->arg;
|
||||
|
||||
/*
|
||||
* Clear the existing PTE, and perform break-before-make if it was
|
||||
* valid. Depending on the system support, defer the TLB maintenance
|
||||
* for the same until the entire unmap walk is completed.
|
||||
*/
|
||||
if (kvm_pte_valid(ctx->old)) {
|
||||
kvm_clear_pte(ctx->ptep);
|
||||
|
||||
@@ -886,7 +879,18 @@ static void stage2_unmap_put_pte(const struct kvm_pgtable_visit_ctx *ctx,
|
||||
ctx->level);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void stage2_unmap_put_pte(const struct kvm_pgtable_visit_ctx *ctx,
|
||||
struct kvm_s2_mmu *mmu,
|
||||
struct kvm_pgtable_mm_ops *mm_ops)
|
||||
{
|
||||
/*
|
||||
* Clear the existing PTE, and perform break-before-make if it was
|
||||
* valid. Depending on the system support, defer the TLB maintenance
|
||||
* for the same until the entire unmap walk is completed.
|
||||
*/
|
||||
stage2_unmap_clear_pte(ctx, mmu);
|
||||
mm_ops->put_page(ctx->ptep);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user