Re: [PATCH] iommu/amd: allow identity domain during device release

From: Jason Gunthorpe

Date: Fri Oct 09 2026 - 16:04:37 EST


On Thu, Oct 08, 2026 at 01:25:27PM -0700, Kevin Mitchell wrote:
> @@ -2548,11 +2548,17 @@ static struct iommu_device *amd_iommu_probe_device(struct device *dev)
> return iommu_dev;
> }
>
> +static struct protection_domain identity_domain;
> +
> static void amd_iommu_release_device(struct device *dev)
> {
> struct iommu_dev_data *dev_data = dev_iommu_priv_get(dev);
>
> - WARN_ON(dev_data->domain);
> + /*
> + * Devices with direct mapped regions are attached to the
> + * identity_domain as their release_domain.
> + */
> + WARN_ON(dev_data->domain && dev_data->domain != &identity_domain);

At this point I think you can probably just delete this WARN_ON
instead of trying to fiddle it like this.

Ultimately the dev_data->domain should not be set by the identity
domain, Vasant said he was going to work on that clean up..

Jason