Re: BUG: "iommu: Retire bus ops" breaks omap-iommu and omap3isp

From: Robin Murphy
Date: Tue Oct 08 2024 - 08:12:04 EST


On 07/10/2024 1:15 pm, Jason Gunthorpe wrote:
On Sun, Oct 06, 2024 at 09:40:00AM +0200, H. Nikolaus Schaller wrote:
Hi,

I found that the camera on our OMAP3 based system (GTA04) stopped working with v6.8-rc1.
There was no bug in the camera driver but the OMAP3 ISP (image signal processor) emits

[ 14.963684] omap3isp 480bc000.isp: failed to create ARM IOMMU mapping
[ 15.010192] omap3isp 480bc000.isp: unable to attach to IOMMU
[ 15.023376] omap3isp 480bc000.isp: isp_xclk_set_rate: cam_xclka set to 24685714 Hz (div 7)
[ 15.065399] omap3isp: probe of 480bc000.isp failed with error -12

Deeper analyses lead to this patch breaking operation. It is not fixed up to v6.12-rc1.

What seems to happen (in 6.8-rc1 code):

- omap_iommu_probe() passes &omap_iommu_ops to iommu_device_register()
- iommu_device_register() stores the ops in iommu->ops (only)
- __iommu_probe_device tries to read the ops from some fw_spec but not iommu->ops

Maybe like this?

@@ -1233,6 +1233,12 @@ static int omap_iommu_probe(struct platform_device *pdev)
err = iommu_device_register(&obj->iommu, &omap_iommu_ops, &pdev->dev);

Nope, just s/&pdev->dev/NULL/ here. Apologies for overlooking this.

Thanks,
Robin.

if (err)
goto out_sysfs;
+ /*
+ * omap has a DT reprensetation but can't use the common DT
+ * code. Setting fwnode to NULL causes probe to be called for
+ * every device.
+ */
+ obj->iommu.fwnode = NULL;
obj->has_iommu_driver = true;
}

Jason