[RFC PATCH 11/12] KVM: x86/mmu: Export kvm_is_mmio_pfn()
Xu Yilun
yilun.xu at linux.intel.com
Tue Jan 7 14:27:18 UTC 2025
From: Xu Yilun <yilun.xu at intel.com>
Export kvm_is_mmio_pfn() for KVM TDX to decide which seamcall should be
used to setup SEPT leaf entry.
TDX Module requires tdh_mem_page_aug() for memory page setup,
and tdh_mmio_map() for MMIO setup.
Signed-off-by: Yan Zhao <yan.y.zhao at intel.com>
Signed-off-by: Xu Yilun <yilun.xu at intel.com>
---
arch/x86/kvm/mmu.h | 1 +
arch/x86/kvm/mmu/spte.c | 3 ++-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kvm/mmu.h b/arch/x86/kvm/mmu.h
index e40097c7e8d4..23ff0e6c9ef6 100644
--- a/arch/x86/kvm/mmu.h
+++ b/arch/x86/kvm/mmu.h
@@ -102,6 +102,7 @@ void kvm_mmu_sync_roots(struct kvm_vcpu *vcpu);
void kvm_mmu_sync_prev_roots(struct kvm_vcpu *vcpu);
void kvm_mmu_track_write(struct kvm_vcpu *vcpu, gpa_t gpa, const u8 *new,
int bytes);
+bool kvm_is_mmio_pfn(kvm_pfn_t pfn);
static inline int kvm_mmu_reload(struct kvm_vcpu *vcpu)
{
diff --git a/arch/x86/kvm/mmu/spte.c b/arch/x86/kvm/mmu/spte.c
index e819d16655b6..0a9a81afba93 100644
--- a/arch/x86/kvm/mmu/spte.c
+++ b/arch/x86/kvm/mmu/spte.c
@@ -105,7 +105,7 @@ u64 make_mmio_spte(struct kvm_vcpu *vcpu, u64 gfn, unsigned int access)
return spte;
}
-static bool kvm_is_mmio_pfn(kvm_pfn_t pfn)
+bool kvm_is_mmio_pfn(kvm_pfn_t pfn)
{
if (pfn_valid(pfn))
return !is_zero_pfn(pfn) && PageReserved(pfn_to_page(pfn)) &&
@@ -125,6 +125,7 @@ static bool kvm_is_mmio_pfn(kvm_pfn_t pfn)
pfn_to_hpa(pfn + 1) - 1,
E820_TYPE_RAM);
}
+EXPORT_SYMBOL_GPL(kvm_is_mmio_pfn);
/*
* Returns true if the SPTE has bits that may be set without holding mmu_lock.
--
2.25.1
More information about the dri-devel
mailing list