Re: [PATCH v2 4/4] iommu: Get DT/ACPI parsing into the proper probe path
From: Jason Gunthorpe
Date: Wed Mar 05 2025 - 13:29:27 EST
On Fri, Feb 28, 2025 at 03:46:33PM +0000, Robin Murphy wrote:
> + if (!dev->driver && dev->bus->dma_configure) {
> + mutex_unlock(&iommu_probe_device_lock);
> + dev->bus->dma_configure(dev);
> + mutex_lock(&iommu_probe_device_lock);
> + }
I think it would be very nice to get rid of the lock/unlock.. It makes
me nervous that we continue on assuming dev->iommu was freshly
allocated..
setup the dev->iommu partially, then drop the lock.
There is only one other caller in:
static int really_probe(struct device *dev, const struct device_driver *drv)
{
if (dev->bus->dma_configure) {
ret = dev->bus->dma_configure(dev);
if (ret)
goto pinctrl_bind_failed;
}
Is it feasible to make it so the caller has to hold the
iommu_probe_device_lock prior to calling the op?
That would require moving the locking inside of_dma_configure to less
inside, and using a new iommu_probe_device() wrapper.
However, if you plan to turn this inside out soonish then it would not
be worth the bother.
Anyhow:
Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx>
Jason