diff mbox series

[1/3] iommu/dma: Clean up Kconfig

Message ID 2e33c8bc2b1bb478157b7964bfed976cb7466139.1660668998.git.robin.murphy@arm.com
State Accepted
Commit de9f8a91eb32bb79149c4fc790df3b54ae710d18
Headers show
Series iommu/dma: Some housekeeping | expand

Commit Message

Robin Murphy Aug. 16, 2022, 5:28 p.m. UTC
Although iommu-dma is a per-architecture chonce, that is currently
implemented in a rather haphazard way. Selecting from the arch Kconfig
was the original logical approach, but is complicated by having to
manage dependencies; conversely, selecting from drivers ends up hiding
the architecture dependency *too* well. Instead, let's just have it
enable itself automatically when IOMMU API support is enabled for the
relevant architectures. It can't get much clearer than that.

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
---
 arch/arm64/Kconfig          | 1 -
 drivers/iommu/Kconfig       | 3 +--
 drivers/iommu/amd/Kconfig   | 1 -
 drivers/iommu/intel/Kconfig | 1 -
 4 files changed, 1 insertion(+), 5 deletions(-)

Comments

Catalin Marinas Sept. 2, 2022, 6:15 p.m. UTC | #1
On Tue, Aug 16, 2022 at 06:28:03PM +0100, Robin Murphy wrote:
> Although iommu-dma is a per-architecture chonce, that is currently
> implemented in a rather haphazard way. Selecting from the arch Kconfig
> was the original logical approach, but is complicated by having to
> manage dependencies; conversely, selecting from drivers ends up hiding
> the architecture dependency *too* well. Instead, let's just have it
> enable itself automatically when IOMMU API support is enabled for the
> relevant architectures. It can't get much clearer than that.
> 
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> ---
>  arch/arm64/Kconfig          | 1 -

For this change:

Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Jason Gunthorpe May 5, 2023, 2:50 p.m. UTC | #2
On Tue, Aug 16, 2022 at 06:28:03PM +0100, Robin Murphy wrote:
> Although iommu-dma is a per-architecture chonce, that is currently
> implemented in a rather haphazard way. Selecting from the arch Kconfig
> was the original logical approach, but is complicated by having to
> manage dependencies; conversely, selecting from drivers ends up hiding
> the architecture dependency *too* well. Instead, let's just have it
> enable itself automatically when IOMMU API support is enabled for the
> relevant architectures. It can't get much clearer than that.
> 
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> ---
>  arch/arm64/Kconfig          | 1 -
>  drivers/iommu/Kconfig       | 3 +--
>  drivers/iommu/amd/Kconfig   | 1 -
>  drivers/iommu/intel/Kconfig | 1 -
>  4 files changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index 571cc234d0b3..59af600445c2 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -209,7 +209,6 @@ config ARM64
>  	select HAVE_KPROBES
>  	select HAVE_KRETPROBES
>  	select HAVE_GENERIC_VDSO
> -	select IOMMU_DMA if IOMMU_SUPPORT
>  	select IRQ_DOMAIN
>  	select IRQ_FORCED_THREADING
>  	select KASAN_VMALLOC if KASAN
> diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
> index 5c5cb5bee8b6..1d99c2d984fb 100644
> --- a/drivers/iommu/Kconfig
> +++ b/drivers/iommu/Kconfig
> @@ -137,7 +137,7 @@ config OF_IOMMU
>  
>  # IOMMU-agnostic DMA-mapping layer
>  config IOMMU_DMA
> -	bool
> +	def_bool ARM64 || IA64 || X86

Robin, do you remember why you added IA64 here? What is the Itanimum
IOMMU driver?

Thanks,
Jason
Robin Murphy May 5, 2023, 2:53 p.m. UTC | #3
On 2023-05-05 15:50, Jason Gunthorpe wrote:
> On Tue, Aug 16, 2022 at 06:28:03PM +0100, Robin Murphy wrote:
>> Although iommu-dma is a per-architecture chonce, that is currently
>> implemented in a rather haphazard way. Selecting from the arch Kconfig
>> was the original logical approach, but is complicated by having to
>> manage dependencies; conversely, selecting from drivers ends up hiding
>> the architecture dependency *too* well. Instead, let's just have it
>> enable itself automatically when IOMMU API support is enabled for the
>> relevant architectures. It can't get much clearer than that.
>>
>> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
>> ---
>>   arch/arm64/Kconfig          | 1 -
>>   drivers/iommu/Kconfig       | 3 +--
>>   drivers/iommu/amd/Kconfig   | 1 -
>>   drivers/iommu/intel/Kconfig | 1 -
>>   4 files changed, 1 insertion(+), 5 deletions(-)
>>
>> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
>> index 571cc234d0b3..59af600445c2 100644
>> --- a/arch/arm64/Kconfig
>> +++ b/arch/arm64/Kconfig
>> @@ -209,7 +209,6 @@ config ARM64
>>   	select HAVE_KPROBES
>>   	select HAVE_KRETPROBES
>>   	select HAVE_GENERIC_VDSO
>> -	select IOMMU_DMA if IOMMU_SUPPORT
>>   	select IRQ_DOMAIN
>>   	select IRQ_FORCED_THREADING
>>   	select KASAN_VMALLOC if KASAN
>> diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
>> index 5c5cb5bee8b6..1d99c2d984fb 100644
>> --- a/drivers/iommu/Kconfig
>> +++ b/drivers/iommu/Kconfig
>> @@ -137,7 +137,7 @@ config OF_IOMMU
>>   
>>   # IOMMU-agnostic DMA-mapping layer
>>   config IOMMU_DMA
>> -	bool
>> +	def_bool ARM64 || IA64 || X86
> 
> Robin, do you remember why you added IA64 here? What is the Itanimum
> IOMMU driver?

config INTEL_IOMMU
	bool "Support for Intel IOMMU using DMA Remapping Devices"
	depends on PCI_MSI && ACPI && (X86 || IA64)

Yes, really :)

Robin.
Jason Gunthorpe May 5, 2023, 7:22 p.m. UTC | #4
On Fri, May 05, 2023 at 03:53:54PM +0100, Robin Murphy wrote:
> > > diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
> > > index 5c5cb5bee8b6..1d99c2d984fb 100644
> > > --- a/drivers/iommu/Kconfig
> > > +++ b/drivers/iommu/Kconfig
> > > @@ -137,7 +137,7 @@ config OF_IOMMU
> > >   # IOMMU-agnostic DMA-mapping layer
> > >   config IOMMU_DMA
> > > -	bool
> > > +	def_bool ARM64 || IA64 || X86
> > 
> > Robin, do you remember why you added IA64 here? What is the Itanimum
> > IOMMU driver?
> 
> config INTEL_IOMMU
> 	bool "Support for Intel IOMMU using DMA Remapping Devices"
> 	depends on PCI_MSI && ACPI && (X86 || IA64)
> 
> Yes, really :)

Wowo, thanks!

Jason
diff mbox series

Patch

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 571cc234d0b3..59af600445c2 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -209,7 +209,6 @@  config ARM64
 	select HAVE_KPROBES
 	select HAVE_KRETPROBES
 	select HAVE_GENERIC_VDSO
-	select IOMMU_DMA if IOMMU_SUPPORT
 	select IRQ_DOMAIN
 	select IRQ_FORCED_THREADING
 	select KASAN_VMALLOC if KASAN
diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
index 5c5cb5bee8b6..1d99c2d984fb 100644
--- a/drivers/iommu/Kconfig
+++ b/drivers/iommu/Kconfig
@@ -137,7 +137,7 @@  config OF_IOMMU
 
 # IOMMU-agnostic DMA-mapping layer
 config IOMMU_DMA
-	bool
+	def_bool ARM64 || IA64 || X86
 	select DMA_OPS
 	select IOMMU_API
 	select IOMMU_IOVA
@@ -476,7 +476,6 @@  config VIRTIO_IOMMU
 	depends on VIRTIO
 	depends on (ARM64 || X86)
 	select IOMMU_API
-	select IOMMU_DMA
 	select INTERVAL_TREE
 	select ACPI_VIOT if ACPI
 	help
diff --git a/drivers/iommu/amd/Kconfig b/drivers/iommu/amd/Kconfig
index a3cbafb603f5..9b5fc3356bf2 100644
--- a/drivers/iommu/amd/Kconfig
+++ b/drivers/iommu/amd/Kconfig
@@ -9,7 +9,6 @@  config AMD_IOMMU
 	select PCI_PASID
 	select IOMMU_API
 	select IOMMU_IOVA
-	select IOMMU_DMA
 	select IOMMU_IO_PGTABLE
 	depends on X86_64 && PCI && ACPI && HAVE_CMPXCHG_DOUBLE
 	help
diff --git a/drivers/iommu/intel/Kconfig b/drivers/iommu/intel/Kconfig
index 39a06d245f12..c48005147ac5 100644
--- a/drivers/iommu/intel/Kconfig
+++ b/drivers/iommu/intel/Kconfig
@@ -19,7 +19,6 @@  config INTEL_IOMMU
 	select DMAR_TABLE
 	select SWIOTLB
 	select IOASID
-	select IOMMU_DMA
 	select PCI_ATS
 	help
 	  DMA remapping (DMAR) devices support enables independent address