Re: [PATCH v2 3/4] iommu: Keep dev->iommu state consistent

From: Jason Gunthorpe
Date: Wed Mar 05 2025 - 13:15:20 EST


On Fri, Feb 28, 2025 at 03:46:32PM +0000, Robin Murphy wrote:
> @@ -127,6 +128,7 @@ int of_iommu_configure(struct device *dev, struct device_node *master_np,
> mutex_unlock(&iommu_probe_device_lock);
> return 0;
> }
> + dev_iommu_present = dev->iommu;

I feel like this deserves a comment..

Maybe it is:

/*
* If of_iommu_configure is called outside the iommu probe path
* dev->iommu should be NULL and it needs to remain as NULL
* If it is called within the probe path then the dev->iommu
* was setup by iommu_init_device() and must not be changed.
*/

And I think the commit message should explain what consistent
means.. AFAICT you are going for !dev->iommu means no probe has
succeed / dev->iommu means a probe is ongoing in this call chain or
it has succeeded?

Otherwise:

Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx>

Jason