[PATCH 1/3] KVM: arm64: nv: Print nested mmu info in kvm_ptdump_guest_show()
From: Wei-Lin Chang
Date: Tue Jun 23 2026 - 10:26:29 EST
To prepare for creating per nested mmu ptdump file, extend
kvm_ptdump_guest_show() so that it differentiates canonical and nested
mmus. If the mmu is nested and valid, print VTCR, VTTBR, s2 enabled
information in addition to the ptdump.
Also switch to a lock guard for mmu_lock.
Signed-off-by: Wei-Lin Chang <weilin.chang@xxxxxxx>
---
arch/arm64/kvm/ptdump.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/kvm/ptdump.c b/arch/arm64/kvm/ptdump.c
index c9140e22abcf..2a6afe67646a 100644
--- a/arch/arm64/kvm/ptdump.c
+++ b/arch/arm64/kvm/ptdump.c
@@ -155,9 +155,16 @@ static int kvm_ptdump_guest_show(struct seq_file *m, void *unused)
.seq = m,
};
- write_lock(&kvm->mmu_lock);
+ guard(write_lock)(&kvm->mmu_lock);
+ if (kvm_is_nested_s2_mmu(kvm, mmu)) {
+ if (!kvm_s2_mmu_valid(mmu)) {
+ seq_puts(m, "invalid nested mmu\n");
+ return 0;
+ }
+ seq_printf(m, "0x%016llx 0x%016llx %d\n", mmu->tlb_vttbr,
+ mmu->tlb_vtcr, mmu->nested_stage2_enabled ? 1 : 0);
+ }
ret = kvm_pgtable_walk(mmu->pgt, 0, BIT(mmu->pgt->ia_bits), &walker);
- write_unlock(&kvm->mmu_lock);
return ret;
}
--
2.43.0