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

From: Binbin Wu

Date: Mon Jun 08 2026 - 03:37:58 EST


On 5/22/2026 7:16 AM, Lisa Wang wrote:
> 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.

This sounds a bit confusing to me.
It's the kernel/KVM only support guest_memfd for private pages.
The restriction is not from the "TDX architecture".

Also, the short log is also a bit confusing.
Why describe the "first memory region" here?

>
> 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
>