Re: [RFC PATCH 03/15] x86/tdx: Add TDG.TDI.RD module call wrapper for TDX Connect

From: Edgecombe, Rick P

Date: Tue Nov 03 2026 - 16:05:39 EST


On Tue, 2026-11-03 at 13:11 +0000, Duan, Zhenzhong wrote:
> > ...you are going to have justify the whole tdx_mcall_tdi_to_errno() thing
> > first
> > as discussed in the other patch.
>
> Well, tdx_mcall_tdi_to_errno() just translates TDX module status codes
> nto Linux errno values. -EBUSY is the one that can indicate contention;
> other errors are passed back to userspace.

Uhhh... You said you would justify why a wider solution is needed:
https://lore.kernel.org/all/IA3PR11MB9136DB533731D579798D3AFC92922@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/

So before you figure out which patch to put it in, probably figure out whether
to have it.

>
> I went through the locks taken by each TDCALL and SEAMCALL and checked
> which operations can contend in the current flow. I found one case we
> need to handle now: concurrent TDG.TDI.MMIO.ACCEPT calls for TDIs under
> the same IOMMU can contend for its exclusive lock.
>
> A future TDG.TDI.RD read of the attestation-info-hash field could also
> contend for the IOMMU lock. We don't need to handle that until we add
> guest attestation.
>
> Since retries are only needed for TDG.MMIO.ACCEPT and, later, that specific
> TDG.TDI.RD field, I think it's cleaner to do retry in those call sites
> rather than in wrapper.