@@ -5407,7 +5407,9 @@ static void kvm_zap_obsolete_pages(struct kvm *kvm)
*/
static void kvm_mmu_zap_all_fast(struct kvm *kvm)
{
+#ifdef CONFIG_X86_64
struct kvm_mmu_page *root;
+#endif /* CONFIG_X86_64 */
lockdep_assert_held(&kvm->slots_lock);
@@ -5424,6 +5426,7 @@ static void kvm_mmu_zap_all_fast(struct kvm *kvm)
kvm->arch.mmu_valid_gen = kvm->arch.mmu_valid_gen ? 0 : 1;
+#ifdef CONFIG_X86_64
if (is_tdp_mmu_enabled(kvm)) {
/*
* Mark each TDP MMU root as invalid so that other threads
@@ -5456,6 +5459,7 @@ static void kvm_mmu_zap_all_fast(struct kvm *kvm)
if (refcount_inc_not_zero(&root->tdp_mmu_root_count))
root->role.invalid = true;
}
+#endif /* CONFIG_X86_64 */
/*
* Notify all vcpus to reload its shadow page table and flush TLB.
@@ -5471,11 +5475,13 @@ static void kvm_mmu_zap_all_fast(struct kvm *kvm)
write_unlock(&kvm->mmu_lock);
+#ifdef CONFIG_X86_64
if (is_tdp_mmu_enabled(kvm)) {
read_lock(&kvm->mmu_lock);
kvm_tdp_mmu_zap_invalidated_roots(kvm);
read_unlock(&kvm->mmu_lock);
}
+#endif /* CONFIG_X86_64 */
}
static bool kvm_has_zapped_obsolete_pages(struct kvm *kvm)
The TDP MMU code in kvm_mmu_zap_all_fast is only needed with CONFIG_X86_64 and creates a build error without that setting. Since the TDP MMU can only be enabled with CONFIG_X86_64, wrap those code blocks in ifdefs. Fixes: 1336c692abad ("KVM: x86/mmu: Fast invalidation for TDP MMU") Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Ben Gardon <bgardon@google.com> --- arch/x86/kvm/mmu/mmu.c | 6 ++++++ 1 file changed, 6 insertions(+)