mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 02:50:49 +09:00
ANDROID: KVM: arm64: Split stage2_put_pte function
Refactor the code and add stage2_clear_pte(..) which removes the PTE without dropping the refcount for an entry. Bug: 222044487 Signed-off-by: Sebastian Ene <sebastianene@google.com> Change-Id: Ia2cb47f2ffad6faa5c6b4ec8a37bcbe61be0bc2f Signed-off-by: Quentin Perret <qperret@google.com>
This commit is contained in:
committed by
Quentin Perret
parent
901f361acc
commit
ca5e2707ba
@@ -662,6 +662,16 @@ static bool stage2_pte_is_counted(kvm_pte_t pte)
|
||||
return !!pte;
|
||||
}
|
||||
|
||||
static void stage2_clear_pte(kvm_pte_t *ptep, struct kvm_s2_mmu *mmu, u64 addr,
|
||||
u32 level)
|
||||
{
|
||||
if (!kvm_pte_valid(*ptep))
|
||||
return;
|
||||
|
||||
kvm_clear_pte(ptep);
|
||||
kvm_call_hyp(__kvm_tlb_flush_vmid_ipa, mmu, addr, level);
|
||||
}
|
||||
|
||||
static void stage2_put_pte(kvm_pte_t *ptep, struct kvm_s2_mmu *mmu, u64 addr,
|
||||
u32 level, struct kvm_pgtable_mm_ops *mm_ops)
|
||||
{
|
||||
@@ -669,11 +679,7 @@ static void stage2_put_pte(kvm_pte_t *ptep, struct kvm_s2_mmu *mmu, u64 addr,
|
||||
* Clear the existing PTE, and perform break-before-make with
|
||||
* TLB maintenance if it was valid.
|
||||
*/
|
||||
if (kvm_pte_valid(*ptep)) {
|
||||
kvm_clear_pte(ptep);
|
||||
kvm_call_hyp(__kvm_tlb_flush_vmid_ipa, mmu, addr, level);
|
||||
}
|
||||
|
||||
stage2_clear_pte(ptep, mmu, addr, level);
|
||||
mm_ops->put_page(ptep);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user