[PATCH] iommu: Don't warn prematurely about dodgy probes

Robin Murphy posted 1 patch 9 months, 1 week ago
drivers/iommu/iommu.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
[PATCH] iommu: Don't warn prematurely about dodgy probes
Posted by Robin Murphy 9 months, 1 week ago
The warning for suspect probe conditions inadvertently got moved too
early in a prior respin - it happened to work out OK for fwspecs, but in
general still needs to be after the ops->probe_device call so drivers
which filter devices for themselves have a chance do do that.

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
---
 drivers/iommu/iommu.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index c6d40abe577e..15a6b3c59ba6 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -437,12 +437,6 @@ static int iommu_init_device(struct device *dev)
 		ret = -ENODEV;
 		goto err_free;
 	}
-	/*
-	 * And if we do now see any replay calls, they would indicate someone
-	 * misusing the dma_configure path outside bus code.
-	 */
-	if (dev->driver)
-		dev_WARN(dev, "late IOMMU probe at driver bind, something fishy here!\n");
 
 	if (!try_module_get(ops->owner)) {
 		ret = -EINVAL;
@@ -565,6 +559,12 @@ static int __iommu_probe_device(struct device *dev, struct list_head *group_list
 	ret = iommu_init_device(dev);
 	if (ret)
 		return ret;
+	/*
+	 * And if we do now see any replay calls, they would indicate someone
+	 * misusing the dma_configure path outside bus code.
+	 */
+	if (dev->driver)
+		dev_WARN(dev, "late IOMMU probe at driver bind, something fishy here!\n");
 
 	group = dev->iommu_group;
 	gdev = iommu_group_alloc_device(group, dev);
-- 
2.39.2.101.g768bb238c484.dirty
Re: [PATCH] iommu: Don't warn prematurely about dodgy probes
Posted by Baolu Lu 9 months, 1 week ago
On 3/12/25 23:01, Robin Murphy wrote:
> The warning for suspect probe conditions inadvertently got moved too
> early in a prior respin - it happened to work out OK for fwspecs, but in
> general still needs to be after the ops->probe_device call so drivers
> which filter devices for themselves have a chance do do that.
> 
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>

Fixes: bcb81ac6ae3c ("iommu: Get DT/ACPI parsing into the proper probe 
path")

Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>

Thanks,
baolu
Re: [PATCH] iommu: Don't warn prematurely about dodgy probes
Posted by Joerg Roedel 9 months, 1 week ago
Hi Robin,

On Wed, Mar 12, 2025 at 03:01:31PM +0000, Robin Murphy wrote:
> The warning for suspect probe conditions inadvertently got moved too
> early in a prior respin - it happened to work out OK for fwspecs, but in
> general still needs to be after the ops->probe_device call so drivers
> which filter devices for themselves have a chance do do that.
> 
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> ---
>  drivers/iommu/iommu.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)

Added a fixes tag and applied it, thanks for handling this quickly.

Regards,

	Joerg