Subject: Re: [PATCH v5 3/3] iommu/arm-smmu-v3: Allow ATS to be always on

From: Jason Gunthorpe <[email-masked]>
Date: Thu, 21 May 2026 10:44:09 -0300

On Wed, May 20, 2026 at 03:35:32PM -0700, Nicolin Chen wrote:
> @ -3870,13 +3870,15 @@ static int arm_smmu_blocking_set_dev_pasid(struct iommu_domain *new_domain,
>          * When the last user of the CD table goes away downgrade the STE back
>          * to a non-cd_table one, by re-attaching its sid_domain.
>          */
> -       if (!master->ats_always_on &&
> -           !arm_smmu_ssids_in_use(&master->cd_table)) {
> +       if (!arm_smmu_ssids_in_use(&master->cd_table)) {
>                 struct iommu_domain *sid_domain =
>                         iommu_driver_get_domain_for_dev(master->dev);
> +               bool ats_always_on = master->ats_always_on &&
> +                                    sid_domain->type != IOMMU_DOMAIN_BLOCKED;
> +               bool downgrade = sid_domain->type == IOMMU_DOMAIN_IDENTITY ||
> +                                sid_domain->type == IOMMU_DOMAIN_BLOCKED;
> 
> -               if (sid_domain->type == IOMMU_DOMAIN_IDENTITY ||
> -                   sid_domain->type == IOMMU_DOMAIN_BLOCKED)
> +               if (!ats_always_on && downgrade)
>                         sid_domain->ops->attach_dev(sid_domain, dev,
>                                                     sid_domain);

Only identity should remain with the CD S1DSS STE, BLOCKED should
attach the normal blocking domain still

Jason