Re: [PATCH v2 4/4] coco/tdx-host: Initialize trusted DMA on all capable IOMMUs

From: Jason Gunthorpe

Date: Fri Oct 16 2026 - 11:44:06 EST


On Fri, Oct 16, 2026 at 03:03:23PM +0800, Baolu Lu wrote:
> On 10/16/2026 1:37 AM, Jason Gunthorpe wrote:
> > On Thu, Oct 15, 2026 at 04:31:31PM +0800, Xu Yilun wrote:
> >
> > > An alternative could be, bringing up one IOMMU when an associated
> > > device requests link encryption. Then a no-tdx-support iommu fails the
> > > encryption request naturally.
> > That is what ARM is planning to do. I think it is reasonable to
> > trigger creation of the secure iommu when the TSM is connected to TDX.
> >
> > Fail connect if the iommu could not be created.
>
> Yes, agreed. The Intel iommu driver could use per-device interfaces,
> just as ARM is planning. There are some differences, though.
>
> ARM's interaction with the iommu driver in viommu_init() appears to
> consist of two steps:
>
> - arm_smmu_get_realm_params(dev, &params): get and validate the
> physical iommu information from the arm-smmu-v3 driver;
> - cca_psmmu_get(&params): activate the physical smmu for Realm use.

Okay, I haven't looked, not sure what is in cca_psmmu_get() yet

> So the Intel iommu driver will probably end up with interfaces like:
>
> - dmar_tdxcs_iommu_init(struct device *dev, ...);
> - dmar_tdxcs_iommu_release(struct device *dev, ...);
>
> These would be called from the connect and disconnect callbacks of
> the TDX link ops:

It seems OK

It sounds like you will have a one time init of the secure iommu at
the time the first PCI device wants to use the TSM? It seems like no
problem.

Jason