iommu: Fix virtio-iommu probing
RFC 1/1 iommu: Fix virtio-iommu probing
Commit bcb81ac6ae3c ("iommu: Get DT/ACPI parsing into the proper probe path") broke virtio-iommu probing and no iommu group are produced anymore.
When probe_iommu_group() gets called viommu_probe_device() fails because viommu_get_by_fwnode(fwspec->iommu_fwnode) returns NULL. So it seems we need to restore the original iommu_probe_device call site in acpi_iommu_configure_id() to get a chance to probe the device again.
Maybe this defeats the whole purpose of the original commit but at least it fixes the virtio-iommu probing.
---
I also tested smmu probing and this seems to work fine.
--- drivers/acpi/scan.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/acpi/scan.c +7 -0
@@ -1632,6 +1632,13 @@ static int acpi_iommu_configure_id(struct device *dev, const u32 *id_in) err =viot_iommu_configure (dev);mutex_unlock (&iommu_probe_device_lock); +/* +* If we have reason to believe the IOMMU driver missed the initial +* iommu_probe_device() call for dev, replay it to get things in order. +*/ +if (!err && dev->bus) + err =iommu_probe_device (dev); +return err; }
Signature · 1 line
2.49.0
Quoted 6 lines · Eric Auger
Commit
bcb81ac6ae3c("iommu: Get DT/ACPI parsing into the proper probe path") broke virtio-iommu probing and no iommu group are produced anymore.When
probe_iommu_group()gets calledviommu_probe_device()fails becauseviommu_get_by_fwnode(fwspec->iommu_fwnode)returns NULL.
...which it's not supposed to. And *now* I remember, we never got this finished, did we?
Thanks,
Robin.
Quoted 36 lines
So it seems we need to restore the original
iommu_probe_devicecall site inacpi_iommu_configure_id()to get a chance to probe the device again.Maybe this defeats the whole purpose of the original commit but at least it fixes the virtio-iommu probing.
Fixes bcb81ac6ae3c ("iommu: Get DT/ACPI parsing into the proper probe path")Cc [email protected] # v6.15+Signed-off-by Eric Auger <[email protected]>---
I also tested smmu probing and this seems to work fine.
--- drivers/acpi/scan.c | 7 +++++++ 1 file changed, 7 insertions(+)drivers/acpi/scan.c +7
-0@@ -1632,6 +1632,13 @@ static int acpi_iommu_configure_id(struct device *dev, const u32 *id_in) err =viot_iommu_configure (dev);mutex_unlock (&iommu_probe_device_lock); +/* +* If we have reason to believe the IOMMU driver missed the initial +* iommu_probe_device() call for dev, replay it to get things in order. +*/ +if (!err && dev->bus) + err =iommu_probe_device (dev); +return err; }
Hi Robin
Quoted 10 lines · Robin Murphy
Quoted 6 lines · Eric Auger
Commit
bcb81ac6ae3c("iommu: Get DT/ACPI parsing into the proper probe path") broke virtio-iommu probing and no iommu group are produced anymore.When
probe_iommu_group()gets calledviommu_probe_device()fails becauseviommu_get_by_fwnode(fwspec->iommu_fwnode)returns NULL....which it's not supposed to. And *now* I remember, we never got this finished, did we?
Seems we did not ;-)
Quoted 3 lines
Unfortunately it does not fix my issue. Still no iommu group when booting with ACPI.
Thanks
Eric
Quoted 43 lines
Thanks,
Robin.Quoted 38 lines
So it seems we need to restore the original
iommu_probe_devicecall site inacpi_iommu_configure_id()to get a chance to probe the device again.Maybe this defeats the whole purpose of the original commit but at least it fixes the virtio-iommu probing.
Fixes bcb81ac6ae3c ("iommu: Get DT/ACPI parsing into the properprobe path")
Cc [email protected] # v6.15+Signed-off-by Eric Auger <[email protected]>---
I also tested smmu probing and this seems to work fine.
---
drivers/acpi/scan.c| 7 +++++++1 file changed, 7 insertions(+)drivers/acpi/scan.c +0
-0@@ -1632,6 +1632,13 @@ static int acpi_iommu_configure_id(struct device *dev, const u32 *id_in) err = viot_iommu_configure(dev); mutex_unlock(&iommu_probe_device_lock);+ /*
+ * If we have reason to believe the IOMMU driver missed the initial + *iommu_probe_device()call for dev, replay it to get things in order.
+ */
+ if (!err &&dev->bus)
+ err =iommu_probe_device(dev);
+
return err;
}
Quoted 13 lines · Eric Auger
Hi Robin
Quoted 10 lines · Robin Murphy
Quoted 6 lines · Eric Auger
Commit
bcb81ac6ae3c("iommu: Get DT/ACPI parsing into the proper probe path") broke virtio-iommu probing and no iommu group are produced anymore.When
probe_iommu_group()gets calledviommu_probe_device()fails becauseviommu_get_by_fwnode(fwspec->iommu_fwnode)returns NULL....which it's not supposed to. And *now* I remember, we never got this finished, did we?
Quoted 7 lines
Seems we did not ;-)
Quoted 3 lines
Unfortunately it does not fix my issue. Still no iommu group when booting with ACPI.
Indeed the evidence at the time suggested the patch isn't quite right as-is, but that is definitely the place which needs fixing. Since Jean-Philippe's occupied with more exciting things at the moment, do you happen to have an easy recipe for testing virtio-iommu so I can try debugging it myself?
Cheers,
Robin.
Quoted 48 lines
Thanks
Eric
Quoted 43 lines
Thanks,
Robin.Quoted 38 lines
So it seems we need to restore the original
iommu_probe_devicecall site inacpi_iommu_configure_id()to get a chance to probe the device again.Maybe this defeats the whole purpose of the original commit but at least it fixes the virtio-iommu probing.
Fixes bcb81ac6ae3c ("iommu: Get DT/ACPI parsing into the properprobe path")
Cc [email protected] # v6.15+Signed-off-by Eric Auger <[email protected]>---
I also tested smmu probing and this seems to work fine.
--- drivers/acpi/scan.c | 7 +++++++ 1 file changed, 7 insertions(+)drivers/acpi/scan.c +2
-0@@ -1632,6 +1632,13 @@ static int acpi_iommu_configure_id(struct device *dev, const u32 *id_in) err = viot_iommu_configure(dev); mutex_unlock(&iommu_probe_device_lock); + /* +* If we have reason to believe the IOMMU driver missed the initial +* iommu_probe_device() call for dev, replay it to get things in order.
+ */
+ if (!err &&dev->bus)
+ err =iommu_probe_device(dev);
+
return err;
}
Quoted 20 lines · Robin Murphy
Quoted 19 lines · Eric Auger
Hi Robin
Quoted 10 lines · Robin Murphy
Quoted 6 lines · Eric Auger
Commit
bcb81ac6ae3c("iommu: Get DT/ACPI parsing into the proper probe path") broke virtio-iommu probing and no iommu group are produced anymore.When
probe_iommu_group()gets calledviommu_probe_device()fails becauseviommu_get_by_fwnode(fwspec->iommu_fwnode)returns NULL....which it's not supposed to. And *now* I remember, we never got this finished, did we?
Seems we did not ;-)
Quoted 8 lines
Quoted 2 lines
Unfortunately it does not fix my issue. Still no iommu group when booting with ACPI.
Indeed the evidence at the time suggested the patch isn't quite right as-is, but that is definitely the place which needs fixing. Since Jean-Philippe's occupied with more exciting things at the moment, do you happen to have an easy recipe for testing virtio-iommu so I can try debugging it myself?
No easy recipe. on my end I am using qemu/kvm with a rhel guest and custom kernel. I guess it was integrated in kvmtool, wasn't it? I am just testing with protected virtio devices.
Thanks
Eric
Quoted 54 lines
Cheers,
Robin.Quoted 49 lines
Thanks
Eric
Quoted 44 lines
Thanks,
Robin.Quoted 39 lines
So it seems we need to restore the original
iommu_probe_devicecall site inacpi_iommu_configure_id()to get a chance to probe the device again.Maybe this defeats the whole purpose of the original commit but at least it fixes the virtio-iommu probing.
Fixes bcb81ac6ae3c ("iommu: Get DT/ACPI parsing into the properprobe path")
Cc [email protected] # v6.15+Signed-off-by Eric Auger <[email protected]>---
I also tested smmu probing and this seems to work fine.
---
drivers/acpi/scan.c| 7 +++++++1 file changed, 7 insertions(+)drivers/acpi/scan.c +0
-0@@ -1632,6 +1632,13 @@ static int acpi_iommu_configure_id(struct device *dev, const u32 *id_in) err = viot_iommu_configure(dev); mutex_unlock(&iommu_probe_device_lock);+ /*
+ * If we have reason to believe the IOMMU driver missed the initial
+ *iommu_probe_device()call for dev, replay it to get things in order.
+ */
+ if (!err &&dev->bus)
+ err =iommu_probe_device(dev);
+
return err;
}