[PATCH v3 23/25] iommu: Add ops->domain_alloc_paging()

Jason Gunthorpe jgg at nvidia.com
Sat Jun 10 22:03:52 AEST 2023


On Sat, Jun 10, 2023 at 05:08:31PM +0800, Baolu Lu wrote:
> > @@ -1992,8 +1993,13 @@ static struct iommu_domain *__iommu_domain_alloc(const struct iommu_ops *ops,
> >   	if (alloc_type == IOMMU_DOMAIN_IDENTITY && ops->identity_domain)
> >   		return ops->identity_domain;
> > +	else if (type & __IOMMU_DOMAIN_PAGING) {
> > +		domain = ops->domain_alloc_paging(dev);
> 
> This might be problematic because not all IOMMU drivers implement this
> callback now. In the missing cases, the code will always result in a
> null pointer reference issue?

Ah, thank you that is a rebasing error :(

> >   struct iommu_domain *iommu_domain_alloc(const struct bus_type *bus)
> >   {
> >   	if (bus == NULL || bus->iommu_ops == NULL)
> >   		return NULL;
> > -	return __iommu_domain_alloc(bus->iommu_ops, IOMMU_DOMAIN_UNMANAGED);
> > +	return __iommu_domain_alloc(bus->iommu_ops, NULL,
> > +				    IOMMU_DOMAIN_UNMANAGED);
> 
> Suppose that iommu_domain_alloc() is always called from device drivers
> where device pointer is always available. Is it possible to convert it
> to a real device pointer?

Yes, Robin has a series for that

Jason


More information about the Linuxppc-dev mailing list