[PATCH 21/27] iommu/arm-smmu-v3: Put the SVA mmu notifier in the smmu_domain
Jason Gunthorpe
jgg at nvidia.com
Wed Oct 25 06:56:26 PDT 2023
On Wed, Oct 11, 2023 at 08:25:57PM -0300, Jason Gunthorpe wrote:
> @@ -2752,12 +2715,21 @@ int arm_smmu_set_pasid(struct arm_smmu_master *master,
> return 0;
> }
>
> -void arm_smmu_remove_pasid(struct arm_smmu_master *master,
> - struct arm_smmu_domain *smmu_domain, ioasid_t id)
> +static void arm_smmu_remove_dev_pasid(struct device *dev, ioasid_t pasid)
> {
> + struct arm_smmu_master *master = dev_iommu_priv_get(dev);
> + struct arm_smmu_domain *smmu_domain;
> + struct iommu_domain *domain;
> +
> + domain = iommu_get_domain_for_dev_pasid(dev, pasid, IOMMU_DOMAIN_SVA);
> + if (WARN_ON(IS_ERR(domain)) || !domain)
> + return;
> +
> + smmu_domain = to_smmu_domain(domain);
> +
> mutex_lock(&arm_smmu_asid_lock);
> - arm_smmu_attach_remove(master, smmu_domain, id);
> - arm_smmu_clear_cd(master, id);
> + arm_smmu_attach_remove(master, smmu_domain, pasid);
> + arm_smmu_clear_cd(master, pasid);
> mutex_unlock(&arm_smmu_asid_lock);
This is missing the invalidation on clear_cd that the removed SVA code
had, it should be:
mutex_lock(&arm_smmu_asid_lock);
arm_smmu_clear_cd(master, pasid);
if (master->ats_enabled)
arm_smmu_atc_inv_master(master, pasid);
arm_smmu_attach_remove(master, smmu_domain, pasid);
mutex_unlock(&arm_smmu_asid_lock);
To avoid ATC incoherence
Jason
More information about the linux-arm-kernel
mailing list