[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250806140412.GT184255@nvidia.com>
Date: Wed, 6 Aug 2025 11:04:12 -0300
From: Jason Gunthorpe <jgg@...dia.com>
To: Nicolin Chen <nicolinc@...dia.com>
Cc: will@...nel.org, joro@...tes.org, robin.murphy@....com,
linux-arm-kernel@...ts.infradead.org, iommu@...ts.linux.dev,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH rc] iommu/arm-smmu-v3: Fix smmu_domain->nr_ats_masters
decrement
On Thu, Jul 31, 2025 at 08:01:27PM -0700, Nicolin Chen wrote:
> The arm_smmu_attach_commit() updates master->ats_enabled before calling
> arm_smmu_remove_master_domain() that is supposed to clean up everything
> in the old domain, including the old domain's nr_ats_masters. So, it is
> supposed to use the old ats_enabled state of the device, not an updated
> state.
>
> This isn't a problem if switching between two domains where:
> - old ats_enabled = false; new ats_enabled = false
> - old ats_enabled = true; new ats_enabled = true
> but can fail cases where:
> - old ats_enabled = false; new ats_enabled = true
> (old domain should keep the counter but incorrectly decreased it)
> - old ats_enabled = true; new ats_enabled = false
> (old domain needed to decrease the counter but incorrectly missed it)
>
> Update master->ats_enabled after arm_smmu_remove_master_domain() to fix
> this.
>
> Fixes: 7497f4211f4f ("iommu/arm-smmu-v3: Make changing domains be hitless for ATS")
> Cc: stable@...r.kernel.org
> Signed-off-by: Nicolin Chen <nicolinc@...dia.com>
> ---
> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Jason Gunthorpe <jgg@...dia.com>
Jason
Powered by blists - more mailing lists