[PATCH v13 12/22] KVM: selftests: Back the first memory region with guest_memfd for TDX

From: Lisa Wang

Date: Thu May 21 2026 - 19:19:39 EST


Force GUEST_MEMFD for the primary memory region of TDX VMs.

TDX must use guest_memfd for private pages as there is no alternative
mechanism supported by the TDX architecture.

Signed-off-by: Lisa Wang <wyihan@xxxxxxxxxx>
---
tools/testing/selftests/kvm/lib/kvm_util.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c
index d1befa3f4b30..9a29540fff40 100644
--- a/tools/testing/selftests/kvm/lib/kvm_util.c
+++ b/tools/testing/selftests/kvm/lib/kvm_util.c
@@ -472,7 +472,7 @@ void kvm_set_files_rlimit(u32 nr_vcpus)
static bool is_guest_memfd_required(struct vm_shape shape)
{
#ifdef __x86_64__
- return shape.type == KVM_X86_SNP_VM;
+ return (shape.type == KVM_X86_SNP_VM || shape.type == KVM_X86_TDX_VM);
#else
return false;
#endif

--
2.54.0.746.g67dd491aae-goog