Re: [PATCH v4 1/7] KVM: x86/mmu: Track TDP MMU NX huge pages separately

From: James Houghton
Date: Mon Jun 16 2025 - 14:04:36 EST


> All errors (new ones prefixed by >>):
>
> arch/x86/kvm/mmu/mmu.c: In function 'kvm_recover_nx_huge_pages':
> >> arch/x86/kvm/mmu/mmu.c:7609:38: error: 'KVM_TDP_MMU' undeclared (first use in this function)
> 7609 | else if (mmu_type == KVM_TDP_MMU)
> | ^~~~~~~~~~~
> arch/x86/kvm/mmu/mmu.c:7609:38: note: each undeclared identifier is reported only once for each function it appears in

Sorry for not trying to build on i386. :(

Fixup for this, as Sean originally had[1]:

[1]: https://lore.kernel.org/kvm/ZyJCjJx2lxnEnDwa@xxxxxxxxxx/

diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 9df15c9717771..d544a269c1920 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -1358,6 +1358,10 @@ enum kvm_mmu_type {
KVM_NR_MMU_TYPES,
};

+#ifndef CONFIG_X86_64
+#define KVM_TDP_MMU -1
+#endif
+
struct kvm_arch {
unsigned long n_used_mmu_pages;
unsigned long n_requested_mmu_pages;