[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250107142719.179636-12-yilun.xu@linux.intel.com>
Date: Tue, 7 Jan 2025 22:27:18 +0800
From: Xu Yilun <yilun.xu@...ux.intel.com>
To: kvm@...r.kernel.org,
dri-devel@...ts.freedesktop.org,
linux-media@...r.kernel.org,
linaro-mm-sig@...ts.linaro.org,
sumit.semwal@...aro.org,
christian.koenig@....com,
pbonzini@...hat.com,
seanjc@...gle.com,
alex.williamson@...hat.com,
jgg@...dia.com,
vivek.kasireddy@...el.com,
dan.j.williams@...el.com,
aik@....com
Cc: yilun.xu@...el.com,
yilun.xu@...ux.intel.com,
linux-coco@...ts.linux.dev,
linux-kernel@...r.kernel.org,
lukas@...ner.de,
yan.y.zhao@...el.com,
daniel.vetter@...ll.ch,
leon@...nel.org,
baolu.lu@...ux.intel.com,
zhenzhong.duan@...el.com,
tao1.su@...el.com
Subject: [RFC PATCH 11/12] KVM: x86/mmu: Export kvm_is_mmio_pfn()
From: Xu Yilun <yilun.xu@...el.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@...el.com>
Signed-off-by: Xu Yilun <yilun.xu@...el.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
Powered by blists - more mailing lists