@@ -18,7 +18,7 @@ ifdef CONFIG_HYPERV
kvm-y += kvm_onhyperv.o
endif
-kvm-$(CONFIG_X86_64) += mmu/tdp_pgtable.o mmu/tdp_mmu.o
+kvm-$(CONFIG_X86_64) += mmu/tdp_pgtable.o
kvm-$(CONFIG_KVM_XEN) += xen.o
kvm-$(CONFIG_KVM_SMM) += smm.o
@@ -19,7 +19,6 @@
#include "ioapic.h"
#include "mmu.h"
#include "mmu_internal.h"
-#include "tdp_mmu.h"
#include "x86.h"
#include "kvm_cache_regs.h"
#include "smm.h"
@@ -27,6 +26,8 @@
#include "cpuid.h"
#include "spte.h"
+#include <kvm/tdp_mmu.h>
+
#include <linux/kvm_host.h>
#include <linux/types.h>
#include <linux/string.h>
similarity index 94%
rename from arch/x86/kvm/mmu/tdp_mmu.h
rename to include/kvm/tdp_mmu.h
@@ -5,7 +5,11 @@
#include <linux/kvm_host.h>
-#include "spte.h"
+#include <kvm/mmu_types.h>
+#include <kvm/mmu.h>
+#include <kvm/tdp_iter.h>
+#include <kvm/tdp_pgtable.h>
+#include <kvm/mmutrace.h>
int kvm_mmu_init_tdp_mmu(struct kvm *kvm);
void kvm_mmu_uninit_tdp_mmu(struct kvm *kvm);
@@ -14,3 +14,4 @@ kvm-$(CONFIG_HAVE_KVM_DIRTY_RING) += $(KVM)/dirty_ring.o
kvm-$(CONFIG_HAVE_KVM_PFNCACHE) += $(KVM)/pfncache.o
kvm-$(CONFIG_HAVE_TDP_MMU) += $(KVM)/mmu/tdp_iter.o
+kvm-$(CONFIG_HAVE_TDP_MMU) += $(KVM)/mmu/tdp_mmu.o
similarity index 99%
rename from arch/x86/kvm/mmu/tdp_mmu.c
rename to virt/kvm/mmu/tdp_mmu.c
@@ -1,11 +1,9 @@
// SPDX-License-Identifier: GPL-2.0
-#include "mmu.h"
-#include "mmu_internal.h"
-#include "tdp_mmu.h"
-#include "spte.h"
-
+#include <kvm/mmu_types.h>
+#include <kvm/mmu.h>
#include <kvm/tdp_iter.h>
+#include <kvm/tdp_mmu.h>
#include <kvm/tdp_pgtable.h>
#include <kvm/mmutrace.h>
Move tdp_mmu.[ch] from arch/x86 and into the common code directories. This will allow other architectures to use the TDP MMU in the future. No functional change intended. Signed-off-by: David Matlack <dmatlack@google.com> --- arch/x86/kvm/Makefile | 2 +- arch/x86/kvm/mmu/mmu.c | 3 ++- {arch/x86/kvm/mmu => include/kvm}/tdp_mmu.h | 6 +++++- virt/kvm/Makefile.kvm | 1 + {arch/x86 => virt}/kvm/mmu/tdp_mmu.c | 8 +++----- 5 files changed, 12 insertions(+), 8 deletions(-) rename {arch/x86/kvm/mmu => include/kvm}/tdp_mmu.h (94%) rename {arch/x86 => virt}/kvm/mmu/tdp_mmu.c (99%)