Re: [PATCH v4 07/13] iommu/arm-smmu-v3: Keep track of attached ssids

From: Nicolin Chen
Date: Wed Jul 12 2023 - 22:09:33 EST


On Wed, Jun 21, 2023 at 02:37:19PM +0800, Michael Shavit wrote:

> +/* List of {masters, ssid} that a domain is attached to */
> +struct arm_smmu_attached_domain {
> + struct list_head domain_head;
> + struct arm_smmu_domain *domain;
> + struct arm_smmu_master *master;
> + int ssid;
> +};
> +
> /* SMMU private data for each master */
> struct arm_smmu_master {
> struct arm_smmu_device *smmu;
> struct device *dev;
> - struct arm_smmu_domain *domain;
> + struct arm_smmu_attached_domain non_pasid_domain;
> struct list_head domain_head;
> struct arm_smmu_stream *streams;
> struct arm_smmu_s1_cfg owned_s1_cfg;
> @@ -724,8 +732,8 @@ struct arm_smmu_domain {
>
> struct iommu_domain domain;
>
> - struct list_head devices;
> - spinlock_t devices_lock;
> + struct list_head attached_domains;
> + spinlock_t attached_domains_lock;

Yea, I think that this arm_smmu_attached_domain is similar to
the "subdomain" that I was talking about in the previous reply,
though having a list of attached domains under a domain doesn't
feel very clear.

Perhaps it would be good to have some renaming and kdoc too.

And since we have a group of subdomains that are simply indexed
by ssids, perhaps we can add an xarray to store a subdomain ptr
along with an ssid, replacing the list?

Thanks
Nicolin