Re: [PATCH v3 21/22] iommu/amd: Add translation DTE and VFctrl TransDevID helpers

From: Jason Gunthorpe

Date: Tue Jul 07 2026 - 10:58:40 EST


On Mon, Jun 29, 2026 at 03:35:34PM +0000, Suravee Suthikulpanit wrote:
> The hardware vIOMMU uses a per-VM translate device ID (TransDevID)
> to

per-viommu, the iommu drivers don't work with the concept of VM.

> index the host device table when guest IOMMU traffic needs GPA->SPA
> translation. The VF Control guest miscellaneous register tells the
> IOMMU which TransDevID to use; the corresponding device table entry
> (DTE) points at the nested IOMMU v1 page table that performs the walk
> from guest physical to system physical addresses.

A v1 page table is a "parent" not a nested

> @@ -213,7 +213,12 @@ void amd_iommu_update_dte(struct amd_iommu *iommu,
> struct dev_table_entry *new)
> {
> update_dte256(iommu, dev_data, new);
> - clone_aliases(iommu, dev_data->dev);
> + /*
> + * The dev_data for trans_devid does not have struct dev.
> + * So clone_aliases is not supported for translate-device-id.
> + */
> + if (dev_data->dev)
> + clone_aliases(iommu, dev_data->dev);

More junk from the ugly alias scheme :\ Maybe you should fix it

> +int amd_iommu_set_translate_dte(struct amd_iommu *iommu,
> + struct protection_domain *pdom,
> + u16 gid, u32 trans_devid)
> +{

This should probably accept a viommu struct instead of all these arguments.

Jason