[PATCH v6 02/25] iommu: Add IOMMU_DOMAIN_PLATFORM

Jason Gunthorpe jgg at nvidia.com
Sat Aug 12 04:28:34 PDT 2023


On Sat, Aug 12, 2023 at 09:36:33AM +0800, Baolu Lu wrote:
> > @@ -290,6 +295,7 @@ struct iommu_ops {
> >   	unsigned long pgsize_bitmap;
> >   	struct module *owner;
> >   	struct iommu_domain *identity_domain;
> > +	struct iommu_domain *default_domain;
> 
> I am imaging whether we can merge above two pointers into a single one.
> It is either an IDENTITY or PLATFORM domain and the core will choose it
> as the default domain of a group if iommu_group_alloc_default_domain()
> fails to allocate one through the iommu dev_ops.

I think that would be the wrong direction..

identity_domain is a pointer that is always, ALWAYS an identity
domain. It is the shortcut for drivers (and all drivers should do
this) that implement a global static identity domain.

default_domain is a shortcut to avoid implementing the entire flow
around def_domain_type/domain_alloc for special cases. For this patch
the specialc ase is the IOMMU_DOMAIN_PLATFORM.

We'll probably also get a blocking_domain pointer here too.

All of this is removing the type multiplexor in alloc_domain so we can
so  alloc_domain_paging()

> Probably we could give it a more meaningful name? For example,
> supplemental_domain or rescue_domain?

But that isn't what it is for, default_domain is the operational
domain for attached drivers..

Jason



More information about the Linux-rockchip mailing list