[PATCH 2/2] KVM: arm64: Remove superfluous aligning of gfn for dirty logging
From: Wei-Lin Chang
Date: Fri Jun 05 2026 - 11:50:20 EST
Stage-2 mapping size is forced to PAGE_SIZE when dirty logging is
enabled for a memslot, therefore we don't need to align it down to
a possibly larger vma size or THP adjusted size, they won't happen.
Signed-off-by: Wei-Lin Chang <weilin.chang@xxxxxxx>
---
arch/arm64/kvm/mmu.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c
index 06c46124d3e7..d1f6ff7c2943 100644
--- a/arch/arm64/kvm/mmu.c
+++ b/arch/arm64/kvm/mmu.c
@@ -2050,13 +2050,12 @@ static int kvm_s2_fault_map(const struct kvm_s2_fault_desc *s2fd,
/*
* Mark the page dirty only if the fault is handled successfully,
- * making sure we adjust the canonical IPA if the mapping size has
- * been updated (via a THP upgrade, for example).
+ * mapping size is forced to PAGE_SIZE if dirty logging is enabled,
+ * so we don't have to adjust the canonical IPA here.
*/
if (writable && !ret) {
- phys_addr_t ipa = gfn_to_gpa(get_canonical_gfn(s2fd, s2vi));
- ipa &= ~(mapping_size - 1);
- mark_page_dirty_in_slot(kvm, s2fd->memslot, gpa_to_gfn(ipa));
+ gfn_t canonical_gfn = get_canonical_gfn(s2fd, s2vi);
+ mark_page_dirty_in_slot(kvm, s2fd->memslot, canonical_gfn);
}
if (ret != -EAGAIN)
--
2.43.0