Re: [RFC PATCH v1 1/8] iommu/arm-smmu-v3: Add list of installed_smmus

Jason Gunthorpe
2023-08-17T19:06:46Z

On Fri, Aug 18, 2023 at 02:16:23AM +0800, Michael Shavit wrote:
> diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h
> index 83d2790b701e7..a9202d2045537 100644
> --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h
> +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h
> @@ -690,12 +690,20 @@ struct arm_smmu_stream {
> struct rb_node node;
> };
>
> +/* List of smmu devices that a domain is installed to */
> +struct arm_smmu_installed_smmu {
> + struct list_head list;

'installed_smmus_item'

> + /* List of masters that the domain is attached to*/
> + struct list_head devices;
> + struct arm_smmu_device *smmu;
> +};

Ah, if you have this struct you could just put

u32 cache_tag; // ASID or VMID depending on domain type

And make both allocators local to the instance.

AFAIK the only specific thing that needs a global ASID is the SVA BTM
stuff and it already has code to handle collisions, it can just run
that code per-instance.

> /* SMMU private data for each master */
> struct arm_smmu_master {
> struct arm_smmu_device *smmu;
> struct device *dev;
> struct arm_smmu_domain *domain;
> - struct list_head domain_head;
> + struct list_head list;

What is list for now?

Jason