public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iommu/vt-d: Remove an unnecessary call set_dma_ops()
@ 2025-04-03 16:56 Petr Tesarik
  2025-04-09 15:44 ` Petr Tesařík
  0 siblings, 1 reply; 4+ messages in thread
From: Petr Tesarik @ 2025-04-03 16:56 UTC (permalink / raw)
  To: David Woodhouse, Lu Baolu, Joerg Roedel, Will Deacon,
	Robin Murphy
  Cc: Tom Murphy, iommu, linux-kernel, Petr Tesarik

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")
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
 drivers/iommu/intel/iommu.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index bf1f0c814348..b7e500451d4f 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -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,
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] iommu/vt-d: Remove an unnecessary call set_dma_ops()
  2025-04-03 16:56 [PATCH] iommu/vt-d: Remove an unnecessary call set_dma_ops() Petr Tesarik
@ 2025-04-09 15:44 ` Petr Tesařík
  2025-04-10  2:59   ` Baolu Lu
  0 siblings, 1 reply; 4+ messages in thread
From: Petr Tesařík @ 2025-04-09 15:44 UTC (permalink / raw)
  To: iommu
  Cc: Petr Tesarik, David Woodhouse, Lu Baolu, Joerg Roedel,
	Will Deacon, Robin Murphy, Tom Murphy, linux-kernel

On Thu,  3 Apr 2025 18:56:05 +0200
Petr Tesarik <ptesarik@suse.com> 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")
> Signed-off-by: Petr Tesarik <ptesarik@suse.com>

Does anyone agree? Or see any issues?

Petr T

> ---
>  drivers/iommu/intel/iommu.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
> index bf1f0c814348..b7e500451d4f 100644
> --- a/drivers/iommu/intel/iommu.c
> +++ b/drivers/iommu/intel/iommu.c
> @@ -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,


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] iommu/vt-d: Remove an unnecessary call set_dma_ops()
  2025-04-09 15:44 ` Petr Tesařík
@ 2025-04-10  2:59   ` Baolu Lu
  2025-04-10 11:33     ` Robin Murphy
  0 siblings, 1 reply; 4+ messages in thread
From: Baolu Lu @ 2025-04-10  2:59 UTC (permalink / raw)
  To: Petr Tesařík, iommu
  Cc: Petr Tesarik, David Woodhouse, Joerg Roedel, Will Deacon,
	Robin Murphy, Tom Murphy, linux-kernel

On 4/9/25 23:44, Petr Tesařík wrote:
> On Thu,  3 Apr 2025 18:56:05 +0200
> Petr Tesarik<ptesarik@suse.com> 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")
>> Signed-off-by: Petr Tesarik<ptesarik@suse.com>
> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] iommu/vt-d: Remove an unnecessary call set_dma_ops()
  2025-04-10  2:59   ` Baolu Lu
@ 2025-04-10 11:33     ` Robin Murphy
  0 siblings, 0 replies; 4+ messages in thread
From: Robin Murphy @ 2025-04-10 11:33 UTC (permalink / raw)
  To: Baolu Lu, Petr Tesařík, iommu
  Cc: Petr Tesarik, David Woodhouse, Joerg Roedel, Will Deacon,
	Tom Murphy, linux-kernel

On 10/04/2025 3:59 am, Baolu Lu wrote:
> On 4/9/25 23:44, Petr Tesařík wrote:
>> On Thu,  3 Apr 2025 18:56:05 +0200
>> Petr Tesarik<ptesarik@suse.com> 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")
>>> Signed-off-by: Petr Tesarik<ptesarik@suse.com>
>> Does anyone agree? Or see any issues?

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

Reviewed-by: Robin Murphy <robin.murphy@arm.com>

> 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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-04-10 11:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-03 16:56 [PATCH] iommu/vt-d: Remove an unnecessary call set_dma_ops() Petr Tesarik
2025-04-09 15:44 ` Petr Tesařík
2025-04-10  2:59   ` Baolu Lu
2025-04-10 11:33     ` Robin Murphy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox