RE: [RFC PATCH 14/15] x86/tdx: Add TDG.DMAR.ACCEPT module call wrapper for TDX Connect

From: Duan, Zhenzhong

Date: Wed Oct 28 2026 - 01:58:27 EST




>-----Original Message-----
>From: Li, Xiaoyao <xiaoyao.li@xxxxxxxxx>
>Subject: Re: [RFC PATCH 14/15] x86/tdx: Add TDG.DMAR.ACCEPT module call
>wrapper for TDX Connect
>
>On 9/24/2026 12:10 PM, Zhenzhong Duan wrote:
>> TDG.DMAR.ACCEPT updates the PASID table entry of the TDI as present to
>> allow DMA access to the TD private memory.
>>
>> For TDG.DMAR.ACCEPT, the R8-R15 input registers are reserved and must
>> be zero. Use a zero-initialized argument structure with __tdcall_saved()
>> so the complete TDCALL input register set is loaded with the required
>> values.
>>
>> Translate TDX module return codes into Linux errno values.
>>
>> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@xxxxxxxxx>
>> ---
>> arch/x86/coco/tdx/tdx_connect.c | 28 ++++++++++++++++++++++++++++
>> arch/x86/include/asm/shared/tdx.h | 1 +
>> arch/x86/include/asm/tdx.h | 1 +
>> 3 files changed, 30 insertions(+)
>>
>> diff --git a/arch/x86/coco/tdx/tdx_connect.c
>b/arch/x86/coco/tdx/tdx_connect.c
>> index 3ef10b1df401..a03b1da9a52a 100644
>> --- a/arch/x86/coco/tdx/tdx_connect.c
>> +++ b/arch/x86/coco/tdx/tdx_connect.c
>> @@ -136,3 +136,31 @@ int tdx_mcall_tdi_start(u64 func_id, u64
>exp_bind_session)
>> return tdx_mcall_tdi_to_errno(ret);
>> }
>> EXPORT_SYMBOL_FOR_MODULES(tdx_mcall_tdi_start, "tdx-guest");
>> +
>> +/**
>> + * tdx_mcall_dmar_accept() - Accept PASID table entry of a TDI instance
>> + * @func_id: Function identifier specifying the TDI instance
>> + * @target: DMAR target, 0 for non-partitioned TD or L1, 1-3 for L2 VM1-
>VM3,
>> + * other value reserved
>> + *
>
>Linux doesn't support TD partition and the next patch just hard codes it to
>0.
>We can drop it entirely for simplicity.

Make sense, will do.

Thanks
Zhenzhong