Re: [PATCH v3 1/9] x86/virt/tdx: Add SEAMCALL wrappers for IOMMU setup/clear
From: Xiaoyao Li
Date: Wed Dec 02 2026 - 02:26:55 EST
On 11/24/2026 1:46 PM, Baolu Lu wrote:
>>> + u64 *tdx_iommu_id)
>>> +{
>>> + struct tdx_module_args args = {
>>> + .rcx = reg_base,
>>> + .rdx = __pa(param),
>>> + };
>>> + u64 ret;
>>> +
>>> + /*
>>> + * Retry only on TDX_INTERRUPTED_RESUMABLE:
>>> + *
>>> + * - TDX_INTERRUPTED_RESUMABLE guarantees forward progress between
>>> + * calls.
>>> + * - On TDX_INTERRUPTED_RESUMABLE, all registers except RAX remain
>>> + * unchanged.
>>> + *
>>> + * The ABI spec also allows retrying on TDX_OPERAND_BUSY, but that
>>> + * status doesn't guarantee forward progress, so retrying could spin
>>> + * forever. The host serializes all TDH.IOMMU.SETUP and
>>> + * TDH.IOMMU.CLEAR calls for an IOMMU, so the TDX module should never
>>> + * report the operand as busy.
>>
>> Many SEAMCALLs return TDX_OPERAND_BUSY, and this is the generally expected
>> handling. I don't think we don't need the comment if nothing special.
>
> I'd like to keep a shorter note. It's the usual handling for TDX folks,
> but people outside TDX may read this path too.
Can we check in what cases it returns TDX_OPERAND_BUSY? Can some SEAMCALLs other
than TDH.IOMMU.SETUP/CLEAR contend resources with TDH.IOMMU.SETUP/CLEAR and can
lead to TDX_OPERAND_BUSY? If so, the statement of "the host serializes all
TDH.IOMMU.SETUP and TDH.IOMMU.CLEAR calls for an IOMMU, so the TDX module should
never report the operand as busy" is not true.