Re: [PATCH v3 6/7] iommu/vt-d: Add support for static identity domain

Jason Gunthorpe
2024-08-06T17:18:55Z

On Tue, Aug 06, 2024 at 10:39:40AM +0800, Lu Baolu wrote:
> Software determines VT-d hardware support for passthrough translation by
> inspecting the capability register. If passthrough translation is not
> supported, the device is instructed to use DMA domain for its default
> domain.
>
> Add a global static identity domain with guaranteed attach semantics for
> IOMMUs that support passthrough translation mode.
>
> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
> ---
> drivers/iommu/intel/iommu.c | 102 ++++++++++++++++++++++++++++++++++++
> 1 file changed, 102 insertions(+)

Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>

> +static int identity_domain_attach_dev(struct iommu_domain *domain, struct device *dev)
> +{
> + struct device_domain_info *info = dev_iommu_priv_get(dev);
> + struct intel_iommu *iommu = info->iommu;
> + int ret;
> +
> + device_block_translation(dev);

Though it would be nice if this wasn't hitfull like this, someday..

Jason