@@ -11206,7 +11206,7 @@ F: include/uapi/asm-generic/kvm*
F: include/uapi/linux/kvm*
F: tools/kvm/
F: tools/testing/selftests/kvm/
-F: virt/kvm/*
+F: virt/kvm/
KERNEL VIRTUAL MACHINE FOR ARM64 (KVM/arm64)
M: Marc Zyngier <maz@kernel.org>
@@ -18,7 +18,7 @@ ifdef CONFIG_HYPERV
kvm-y += kvm_onhyperv.o
endif
-kvm-$(CONFIG_X86_64) += mmu/tdp_pgtable.o mmu/tdp_iter.o mmu/tdp_mmu.o
+kvm-$(CONFIG_X86_64) += mmu/tdp_pgtable.o mmu/tdp_mmu.o
kvm-$(CONFIG_KVM_XEN) += xen.o
kvm-$(CONFIG_KVM_SMM) += smm.o
@@ -2,10 +2,10 @@
#include "mmu.h"
#include "mmu_internal.h"
-#include "tdp_iter.h"
#include "tdp_mmu.h"
#include "spte.h"
+#include <kvm/tdp_iter.h>
#include <kvm/tdp_pgtable.h>
#include <kvm/mmutrace.h>
@@ -2,10 +2,10 @@
#include <linux/kvm_types.h>
#include <kvm/tdp_pgtable.h>
+#include <kvm/tdp_iter.h>
#include "mmu.h"
#include "spte.h"
-#include "tdp_iter.h"
/* Removed SPTEs must not be misconstrued as shadow present PTEs. */
static_assert(!(REMOVED_TDP_PTE & SPTE_MMU_PRESENT_MASK));
similarity index 96%
rename from arch/x86/kvm/mmu/tdp_iter.h
rename to include/kvm/tdp_iter.h
@@ -1,14 +1,11 @@
// SPDX-License-Identifier: GPL-2.0
-#ifndef __KVM_X86_MMU_TDP_ITER_H
-#define __KVM_X86_MMU_TDP_ITER_H
+#ifndef __KVM_TDP_ITER_H
+#define __KVM_TDP_ITER_H
#include <linux/kvm_host.h>
#include <kvm/tdp_pgtable.h>
-#include "mmu.h"
-#include "spte.h"
-
/*
* TDP MMU SPTEs are RCU protected to allow paging structures (non-leaf SPTEs)
* to be zapped while holding mmu_lock for read, and to allow TLB flushes to be
@@ -117,4 +114,4 @@ void tdp_iter_start(struct tdp_iter *iter, struct kvm_mmu_page *root,
void tdp_iter_next(struct tdp_iter *iter);
void tdp_iter_restart(struct tdp_iter *iter);
-#endif /* __KVM_X86_MMU_TDP_ITER_H */
+#endif /* __KVM_TDP_ITER_H */
@@ -12,3 +12,5 @@ kvm-$(CONFIG_KVM_ASYNC_PF) += $(KVM)/async_pf.o
kvm-$(CONFIG_HAVE_KVM_IRQ_ROUTING) += $(KVM)/irqchip.o
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
similarity index 98%
rename from arch/x86/kvm/mmu/tdp_iter.c
rename to virt/kvm/mmu/tdp_iter.c
@@ -1,8 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
-#include "mmu_internal.h"
-#include "tdp_iter.h"
-#include "spte.h"
+#include <kvm/tdp_iter.h>
/*
* Recalculates the pointer to the SPTE for the current GFN and level and
Move arch/x86/kvm/mmu/tdp_iter.{c,h} to into common code so that it can be used by other architectures in the future. No functional change intended. Signed-off-by: David Matlack <dmatlack@google.com> --- MAINTAINERS | 2 +- arch/x86/kvm/Makefile | 2 +- arch/x86/kvm/mmu/tdp_mmu.c | 2 +- arch/x86/kvm/mmu/tdp_pgtable.c | 2 +- {arch/x86/kvm/mmu => include/kvm}/tdp_iter.h | 9 +++------ virt/kvm/Makefile.kvm | 2 ++ {arch/x86 => virt}/kvm/mmu/tdp_iter.c | 4 +--- 7 files changed, 10 insertions(+), 13 deletions(-) rename {arch/x86/kvm/mmu => include/kvm}/tdp_iter.h (96%) rename {arch/x86 => virt}/kvm/mmu/tdp_iter.c (98%)