Re: [PATCH v10 5/5] KVM: arm64: Register ptdump with debugfs on guest creation
From: Marc Zyngier <maz@kernel.org>
Date: 2024-09-10 20:27:50
Also in:
kvmarm, lkml
On Mon, 09 Sep 2024 13:47:21 +0100, Sebastian Ene [off-list ref] wrote:
quoted hunk ↗ jump to hunk
While arch/*/mem/ptdump handles the kernel pagetable dumping code, introduce KVM/ptdump to show the guest stage-2 pagetables. The separation is necessary because most of the definitions from the stage-2 pagetable reside in the KVM path and we will be invoking functionality specific to KVM. Introduce the PTDUMP_STAGE2_DEBUGFS config. When a guest is created, register a new file entry under the guest debugfs dir which allows userspace to show the contents of the guest stage-2 pagetables when accessed. Signed-off-by: Sebastian Ene <redacted> Reviewed-by: Vincent Donnefort <redacted> --- arch/arm64/include/asm/kvm_host.h | 6 + arch/arm64/kvm/Kconfig | 17 ++ arch/arm64/kvm/Makefile | 1 + arch/arm64/kvm/arm.c | 1 + arch/arm64/kvm/ptdump.c | 268 ++++++++++++++++++++++++++++++ 5 files changed, 293 insertions(+) create mode 100644 arch/arm64/kvm/ptdump.cdiff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h index a33f5996ca9f..4acd589f086b 100644 --- a/arch/arm64/include/asm/kvm_host.h +++ b/arch/arm64/include/asm/kvm_host.h@@ -1473,4 +1473,10 @@ void kvm_set_vm_id_reg(struct kvm *kvm, u32 reg, u64 val); (pa + pi + pa3) == 1; \ }) +#ifdef CONFIG_PTDUMP_STAGE2_DEBUGFS +void kvm_s2_ptdump_create_debugfs(struct kvm *kvm); +#else +static inline void kvm_s2_ptdump_create_debugfs(struct kvm *kvm) {} +#endif /* CONFIG_PTDUMP_STAGE2_DEBUGFS */ +
I made the executive decision to move this to kvm_mmu.h, as this is slightly more logical. Thanks, M. -- Without deviation from the norm, progress is not possible.