Skip to contentSkip to conversation

iommu/vt-d: Remove an unnecessary call set_dma_ops()

PATCH In review Petr Tesarik 4 participants 4 messages Apr 3, 2025 – Apr 10, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iommu/vt-d: Remove an unnecessary call set_dma_ops()

Do not touch per-device DMA ops when the driver has been converted to use the dma-iommu API.

Fixes c588072bba6b ("iommu/vt-d: Convert intel iommu driver to the iommu ops")
---
 drivers/iommu/intel/iommu.c | 1 -
 1 file changed, 1 deletion(-)
drivers/iommu/intel/iommu.c +0 -1
index bf1f0c814348..b7e500451d4f 100644
@@ -3789,7 +3789,6 @@ static void intel_iommu_release_device(struct device *dev)
 	intel_pasid_free_table(dev);
 	intel_iommu_debugfs_remove_dev(info);
 	kfree(info);
-	set_dma_ops(dev, NULL);
 }
 
 static void intel_iommu_get_resv_regions(struct device *device,
Signature · 1 line
2.48.1
#1 lore raw
Quoted 5 lines · On Thu, 3 Apr 2025 18:56:05 +0200 Petr Tesarik <[email protected]> wrote:

Do not touch per-device DMA ops when the driver has been converted to use the dma-iommu API.

Fixes c588072bba6b ("iommu/vt-d: Convert intel iommu driver to the iommu ops")

Does anyone agree? Or see any issues?

Petr T

Quoted 16 lines
---
 drivers/iommu/intel/iommu.c | 1 -
 1 file changed, 1 deletion(-)
drivers/iommu/intel/iommu.c +0 -1
index bf1f0c814348..b7e500451d4f 100644
@@ -3789,7 +3789,6 @@ static void intel_iommu_release_device(struct device *dev)
 	intel_pasid_free_table(dev);
 	intel_iommu_debugfs_remove_dev(info);
 	kfree(info);
-	set_dma_ops(dev, NULL);
 }
 
 static void intel_iommu_get_resv_regions(struct device *device,
maintainer
#2 lore raw
Quoted 9 lines · Petr Tesařík
Quoted 5 lines · On Thu, 3 Apr 2025 18:56:05 +0200 Petr Tesarik<[email protected]> wrote:

Do not touch per-device DMA ops when the driver has been converted to use the dma-iommu API.

Fixes c588072bba6b ("iommu/vt-d: Convert intel iommu driver to the iommu ops")

Does anyone agree? Or see any issues?

This change looks good to me. The iommu driver should not call set_dma_ops() anyway. I will queue this for v6.15-rc.

I ever wondered whether we could clean up dev->dma_iommu when the device is released by the iommu core. But, iommu_release_device() is only called in the device removal path, so keeping dev->dma_iommu set doesn't impose any functional impact AFAICS.

Thanks,
baolu

reviewer Reviewed-by
#3 lore raw
Quoted 10 lines · Baolu Lu
Quoted 9 lines · Petr Tesařík
Quoted 5 lines · On Thu,  3 Apr 2025 18:56:05 +0200 Petr Tesarik<[email protected]> wrote:

Do not touch per-device DMA ops when the driver has been converted to use the dma-iommu API.

Fixes c588072bba6b ("iommu/vt-d: Convert intel iommu driver to the iommu ops")

Does anyone agree? Or see any issues?

At least it definitely serves no purpose since b5c58b2fdc42 ("dma-mapping: direct calls for dma-iommu"). FWIW,

Quoted 7 lines

This change looks good to me. The iommu driver should not call set_dma_ops() anyway. I will queue this for v6.15-rc.

I ever wondered whether we could clean up dev->dma_iommu when the device is released by the iommu core. But, iommu_release_device() is only called in the device removal path, so keeping dev->dma_iommu set doesn't impose any functional impact AFAICS.

Funnily enough I've just been looking at that - I'd long held the same assumption, but I'd been forgetting the edge case that's always been there if bus_set_iommu(), and now iommu_device_register(), failed and groups and default domains were torn down for existing devices. So in fact it seems Intel was one of the few drivers/architectures managing to do the right thing before :)

Cheers,
Robin.