Re: [RFC PATCH v2 40/69] KVM: Export kvm_is_reserved_pfn() for use by TDX

From: Paolo Bonzini
Date: Tue Jul 06 2021 - 10:34:13 EST


On 03/07/21 00:04, isaku.yamahata@xxxxxxxxx wrote:
From: Sean Christopherson <sean.j.christopherson@xxxxxxxxx>

TDX will use kvm_is_reserved_pfn() to prevent installing a reserved PFN
int SEPT. Or rather, to prevent such an attempt, as reserved PFNs are
not covered by TDMRs.

Signed-off-by: Sean Christopherson <sean.j.christopherson@xxxxxxxxx>
Signed-off-by: Isaku Yamahata <isaku.yamahata@xxxxxxxxx>
---
virt/kvm/kvm_main.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 8b075b5e7303..dd6492b526c9 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -188,6 +188,7 @@ bool kvm_is_reserved_pfn(kvm_pfn_t pfn)
return true;
}
+EXPORT_SYMBOL_GPL(kvm_is_reserved_pfn);
bool kvm_is_transparent_hugepage(kvm_pfn_t pfn)
{


As before, there's no problem in squashing this in the patch that introduces the use of kvm_is_reserved_pfn. You could also move kvm_is_reserved_pfn and kvm_is_zone_device_pfn to a .h file.

Paolo