[PATCH v2 1/2] iommu: add support for drivers that manage iommu explicitly
Rob Clark
robdclark at gmail.com
Tue Sep 10 15:34:13 UTC 2019
On Tue, Sep 10, 2019 at 1:14 AM Joerg Roedel <joro at 8bytes.org> wrote:
>
> On Fri, Sep 06, 2019 at 02:44:01PM -0700, Rob Clark wrote:
> > @@ -674,7 +674,7 @@ int iommu_group_add_device(struct iommu_group *group, struct device *dev)
> >
> > mutex_lock(&group->mutex);
> > list_add_tail(&device->list, &group->devices);
> > - if (group->domain)
> > + if (group->domain && !(dev->driver && dev->driver->driver_manages_iommu))
>
> Hmm, this code usually runs at enumeration time when no driver is
> attached to the device. Actually it would be pretty dangerous when this
> code runs while a driver is attached to the device. How does that change
> make things work for you?
>
I was seeing this get called via the path driver_probe_device() ->
platform_dma_configure() -> of_dma_configure() -> of_iommu_configure()
-> iommu_probe_device() -> ...
The only cases I was seeing where dev->driver is NULL where a few
places that drivers call of_dma_configure() on their own sub-devices.
But maybe there are some other paths that I did not notice?
BR,
-R
More information about the dri-devel
mailing list