RE: [PATCH v4 1/7] iommu/arm-smmu-v3: Add release_domain to attach prior to release_dev()

Tian, Kevin
2025-09-12T09:33:13Z

> From: Nicolin Chen <nicolinc@nvidia.com>
> Sent: Monday, September 1, 2025 7:32 AM
>
> +static int arm_smmu_attach_dev_release(struct iommu_domain *domain,
> + struct device *dev)
> +{
> + struct arm_smmu_master *master = dev_iommu_priv_get(dev);
> +
> + WARN_ON(master->iopf_refcount);
> +
> + /* Put the STE back to what arm_smmu_init_strtab() sets */
> + if (dev->iommu->require_direct)
> +
> arm_smmu_attach_dev_identity(&arm_smmu_identity_domain,
> dev);
> + else
> +
> arm_smmu_attach_dev_blocked(&arm_smmu_blocked_domain,
> dev);

it's a bit confusing that a BLOCKED domain type could turn to the
identity mode, though this movement doesn't change the original
behavior.

> +
> + return 0;
> +}
> +
> +static const struct iommu_domain_ops arm_smmu_release_ops = {
> + .attach_dev = arm_smmu_attach_dev_release,
> +};
> +
> +static struct iommu_domain arm_smmu_release_domain = {
> + .type = IOMMU_DOMAIN_BLOCKED,
> + .ops = &arm_smmu_release_ops,
> +};
> +