* centralize SWIOTLB config symbol and misc other cleanups V2
@ 2018-04-23 17:04 Christoph Hellwig
2018-04-23 17:04 ` [PATCH 01/12] iommu-common: move to arch/sparc Christoph Hellwig
` (11 more replies)
0 siblings, 12 replies; 21+ messages in thread
From: Christoph Hellwig @ 2018-04-23 17:04 UTC (permalink / raw)
To: Konrad Rzeszutek Wilk, iommu
Cc: linux-mips, linux-pci, x86, linux-block, linux-mm, sparclinux,
linux-arm-kernel
Hi all,
this seris aims for a single defintion of the Kconfig symbol. To get
there various cleanups, mostly about config symbols are included as well.
Chances since V2 are a fixed s/Reviewed/Signed-Off/ for me, and a few
reviewed-by tags. I'd like to start merging this into the dma-mapping
tree rather sooner than later given that quite a bit of material for
this series depends on it.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 01/12] iommu-common: move to arch/sparc
2018-04-23 17:04 centralize SWIOTLB config symbol and misc other cleanups V2 Christoph Hellwig
@ 2018-04-23 17:04 ` Christoph Hellwig
2018-04-23 17:04 ` [PATCH 02/12] iommu-helper: unexport iommu_area_alloc Christoph Hellwig
` (10 subsequent siblings)
11 siblings, 0 replies; 21+ messages in thread
From: Christoph Hellwig @ 2018-04-23 17:04 UTC (permalink / raw)
To: Konrad Rzeszutek Wilk, iommu
Cc: linux-mips, linux-pci, x86, linux-block, linux-mm, sparclinux,
linux-arm-kernel
This code is only used by sparc, and all new iommu drivers should use the
drivers/iommu/ framework. Also remove the unused exports.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
---
{include/linux => arch/sparc/include/asm}/iommu-common.h | 0
arch/sparc/include/asm/iommu_64.h | 2 +-
arch/sparc/kernel/Makefile | 2 +-
{lib => arch/sparc/kernel}/iommu-common.c | 5 +----
arch/sparc/kernel/iommu.c | 2 +-
arch/sparc/kernel/ldc.c | 2 +-
arch/sparc/kernel/pci_sun4v.c | 2 +-
lib/Makefile | 2 +-
8 files changed, 7 insertions(+), 10 deletions(-)
rename {include/linux => arch/sparc/include/asm}/iommu-common.h (100%)
rename {lib => arch/sparc/kernel}/iommu-common.c (98%)
diff --git a/include/linux/iommu-common.h b/arch/sparc/include/asm/iommu-common.h
similarity index 100%
rename from include/linux/iommu-common.h
rename to arch/sparc/include/asm/iommu-common.h
diff --git a/arch/sparc/include/asm/iommu_64.h b/arch/sparc/include/asm/iommu_64.h
index 9ed6b54caa4b..0ef6dedf747e 100644
--- a/arch/sparc/include/asm/iommu_64.h
+++ b/arch/sparc/include/asm/iommu_64.h
@@ -17,7 +17,7 @@
#define IOPTE_WRITE 0x0000000000000002UL
#define IOMMU_NUM_CTXS 4096
-#include <linux/iommu-common.h>
+#include <asm/iommu-common.h>
struct iommu_arena {
unsigned long *map;
diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile
index 76cb57750dda..a284662b0e4c 100644
--- a/arch/sparc/kernel/Makefile
+++ b/arch/sparc/kernel/Makefile
@@ -59,7 +59,7 @@ obj-$(CONFIG_SPARC32) += leon_pmc.o
obj-$(CONFIG_SPARC64) += reboot.o
obj-$(CONFIG_SPARC64) += sysfs.o
-obj-$(CONFIG_SPARC64) += iommu.o
+obj-$(CONFIG_SPARC64) += iommu.o iommu-common.o
obj-$(CONFIG_SPARC64) += central.o
obj-$(CONFIG_SPARC64) += starfire.o
obj-$(CONFIG_SPARC64) += power.o
diff --git a/lib/iommu-common.c b/arch/sparc/kernel/iommu-common.c
similarity index 98%
rename from lib/iommu-common.c
rename to arch/sparc/kernel/iommu-common.c
index 55b00de106b5..59cb16691322 100644
--- a/lib/iommu-common.c
+++ b/arch/sparc/kernel/iommu-common.c
@@ -8,9 +8,9 @@
#include <linux/bitmap.h>
#include <linux/bug.h>
#include <linux/iommu-helper.h>
-#include <linux/iommu-common.h>
#include <linux/dma-mapping.h>
#include <linux/hash.h>
+#include <asm/iommu-common.h>
static unsigned long iommu_large_alloc = 15;
@@ -93,7 +93,6 @@ void iommu_tbl_pool_init(struct iommu_map_table *iommu,
p->hint = p->start;
p->end = num_entries;
}
-EXPORT_SYMBOL(iommu_tbl_pool_init);
unsigned long iommu_tbl_range_alloc(struct device *dev,
struct iommu_map_table *iommu,
@@ -224,7 +223,6 @@ unsigned long iommu_tbl_range_alloc(struct device *dev,
return n;
}
-EXPORT_SYMBOL(iommu_tbl_range_alloc);
static struct iommu_pool *get_pool(struct iommu_map_table *tbl,
unsigned long entry)
@@ -264,4 +262,3 @@ void iommu_tbl_range_free(struct iommu_map_table *iommu, u64 dma_addr,
bitmap_clear(iommu->map, entry, npages);
spin_unlock_irqrestore(&(pool->lock), flags);
}
-EXPORT_SYMBOL(iommu_tbl_range_free);
diff --git a/arch/sparc/kernel/iommu.c b/arch/sparc/kernel/iommu.c
index b08dc3416f06..40d008b0bd3e 100644
--- a/arch/sparc/kernel/iommu.c
+++ b/arch/sparc/kernel/iommu.c
@@ -14,7 +14,7 @@
#include <linux/errno.h>
#include <linux/iommu-helper.h>
#include <linux/bitmap.h>
-#include <linux/iommu-common.h>
+#include <asm/iommu-common.h>
#ifdef CONFIG_PCI
#include <linux/pci.h>
diff --git a/arch/sparc/kernel/ldc.c b/arch/sparc/kernel/ldc.c
index 86b625f9d8dc..c0fa3ef6cf01 100644
--- a/arch/sparc/kernel/ldc.c
+++ b/arch/sparc/kernel/ldc.c
@@ -16,7 +16,7 @@
#include <linux/list.h>
#include <linux/init.h>
#include <linux/bitmap.h>
-#include <linux/iommu-common.h>
+#include <asm/iommu-common.h>
#include <asm/hypervisor.h>
#include <asm/iommu.h>
diff --git a/arch/sparc/kernel/pci_sun4v.c b/arch/sparc/kernel/pci_sun4v.c
index 249367228c33..565d9ac883d0 100644
--- a/arch/sparc/kernel/pci_sun4v.c
+++ b/arch/sparc/kernel/pci_sun4v.c
@@ -16,7 +16,7 @@
#include <linux/export.h>
#include <linux/log2.h>
#include <linux/of_device.h>
-#include <linux/iommu-common.h>
+#include <asm/iommu-common.h>
#include <asm/iommu.h>
#include <asm/irq.h>
diff --git a/lib/Makefile b/lib/Makefile
index ce20696d5a92..94203b5eecd4 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -147,7 +147,7 @@ obj-$(CONFIG_AUDIT_GENERIC) += audit.o
obj-$(CONFIG_AUDIT_COMPAT_GENERIC) += compat_audit.o
obj-$(CONFIG_SWIOTLB) += swiotlb.o
-obj-$(CONFIG_IOMMU_HELPER) += iommu-helper.o iommu-common.o
+obj-$(CONFIG_IOMMU_HELPER) += iommu-helper.o
obj-$(CONFIG_FAULT_INJECTION) += fault-inject.o
obj-$(CONFIG_NOTIFIER_ERROR_INJECTION) += notifier-error-inject.o
obj-$(CONFIG_PM_NOTIFIER_ERROR_INJECT) += pm-notifier-error-inject.o
--
2.17.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 02/12] iommu-helper: unexport iommu_area_alloc
2018-04-23 17:04 centralize SWIOTLB config symbol and misc other cleanups V2 Christoph Hellwig
2018-04-23 17:04 ` [PATCH 01/12] iommu-common: move to arch/sparc Christoph Hellwig
@ 2018-04-23 17:04 ` Christoph Hellwig
2018-04-23 17:04 ` [PATCH 03/12] iommu-helper: mark iommu_is_span_boundary as inline Christoph Hellwig
` (9 subsequent siblings)
11 siblings, 0 replies; 21+ messages in thread
From: Christoph Hellwig @ 2018-04-23 17:04 UTC (permalink / raw)
To: Konrad Rzeszutek Wilk, iommu
Cc: x86, linux-block, linux-pci, linux-mm, linux-mips, sparclinux,
linux-arm-kernel
This function is only used by built-in code.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
---
lib/iommu-helper.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/lib/iommu-helper.c b/lib/iommu-helper.c
index 23633c0fda4a..ded1703e7e64 100644
--- a/lib/iommu-helper.c
+++ b/lib/iommu-helper.c
@@ -3,7 +3,6 @@
* IOMMU helper functions for the free area management
*/
-#include <linux/export.h>
#include <linux/bitmap.h>
#include <linux/bug.h>
@@ -38,4 +37,3 @@ unsigned long iommu_area_alloc(unsigned long *map, unsigned long size,
}
return -1;
}
-EXPORT_SYMBOL(iommu_area_alloc);
--
2.17.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 03/12] iommu-helper: mark iommu_is_span_boundary as inline
2018-04-23 17:04 centralize SWIOTLB config symbol and misc other cleanups V2 Christoph Hellwig
2018-04-23 17:04 ` [PATCH 01/12] iommu-common: move to arch/sparc Christoph Hellwig
2018-04-23 17:04 ` [PATCH 02/12] iommu-helper: unexport iommu_area_alloc Christoph Hellwig
@ 2018-04-23 17:04 ` Christoph Hellwig
2018-04-23 17:04 ` [PATCH 04/12] iommu-helper: move the IOMMU_HELPER config symbol to lib/ Christoph Hellwig
` (8 subsequent siblings)
11 siblings, 0 replies; 21+ messages in thread
From: Christoph Hellwig @ 2018-04-23 17:04 UTC (permalink / raw)
To: Konrad Rzeszutek Wilk, iommu
Cc: x86, linux-block, linux-pci, linux-mm, linux-mips, sparclinux,
linux-arm-kernel
This avoids selecting IOMMU_HELPER just for this function. And we only
use it once or twice in normal builds so this often even is a size
reduction.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
arch/alpha/Kconfig | 3 ---
arch/arm/Kconfig | 3 ---
arch/arm64/Kconfig | 3 ---
arch/ia64/Kconfig | 3 ---
arch/mips/cavium-octeon/Kconfig | 4 ----
arch/mips/loongson64/Kconfig | 4 ----
arch/mips/netlogic/Kconfig | 3 ---
arch/powerpc/Kconfig | 1 -
arch/unicore32/mm/Kconfig | 3 ---
arch/x86/Kconfig | 2 +-
drivers/parisc/Kconfig | 5 -----
include/linux/iommu-helper.h | 13 ++++++++++---
lib/iommu-helper.c | 12 +-----------
13 files changed, 12 insertions(+), 47 deletions(-)
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index b2022885ced8..3ff735a722af 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -345,9 +345,6 @@ config PCI_DOMAINS
config PCI_SYSCALL
def_bool PCI
-config IOMMU_HELPER
- def_bool PCI
-
config ALPHA_NONAME
bool
depends on ALPHA_BOOK1 || ALPHA_NONAME_CH
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index a7f8e7f4b88f..2f79222c5c02 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1781,9 +1781,6 @@ config SECCOMP
config SWIOTLB
def_bool y
-config IOMMU_HELPER
- def_bool SWIOTLB
-
config PARAVIRT
bool "Enable paravirtualization code"
help
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index eb2cf4938f6d..fbef5d3de83f 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -252,9 +252,6 @@ config SMP
config SWIOTLB
def_bool y
-config IOMMU_HELPER
- def_bool SWIOTLB
-
config KERNEL_MODE_NEON
def_bool y
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index bbe12a038d21..862c5160c09d 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -613,6 +613,3 @@ source "security/Kconfig"
source "crypto/Kconfig"
source "lib/Kconfig"
-
-config IOMMU_HELPER
- def_bool (IA64_HP_ZX1 || IA64_HP_ZX1_SWIOTLB || IA64_GENERIC || SWIOTLB)
diff --git a/arch/mips/cavium-octeon/Kconfig b/arch/mips/cavium-octeon/Kconfig
index b5eee1a57d6c..647ed158ac98 100644
--- a/arch/mips/cavium-octeon/Kconfig
+++ b/arch/mips/cavium-octeon/Kconfig
@@ -67,16 +67,12 @@ config CAVIUM_OCTEON_LOCK_L2_MEMCPY
help
Lock the kernel's implementation of memcpy() into L2.
-config IOMMU_HELPER
- bool
-
config NEED_SG_DMA_LENGTH
bool
config SWIOTLB
def_bool y
select DMA_DIRECT_OPS
- select IOMMU_HELPER
select NEED_SG_DMA_LENGTH
config OCTEON_ILM
diff --git a/arch/mips/loongson64/Kconfig b/arch/mips/loongson64/Kconfig
index 72af0c183969..5efb2e63878e 100644
--- a/arch/mips/loongson64/Kconfig
+++ b/arch/mips/loongson64/Kconfig
@@ -130,9 +130,6 @@ config LOONGSON_UART_BASE
default y
depends on EARLY_PRINTK || SERIAL_8250
-config IOMMU_HELPER
- bool
-
config NEED_SG_DMA_LENGTH
bool
@@ -141,7 +138,6 @@ config SWIOTLB
default y
depends on CPU_LOONGSON3
select DMA_DIRECT_OPS
- select IOMMU_HELPER
select NEED_SG_DMA_LENGTH
select NEED_DMA_MAP_STATE
diff --git a/arch/mips/netlogic/Kconfig b/arch/mips/netlogic/Kconfig
index 7fcfc7fe9f14..5c5ee0e05a17 100644
--- a/arch/mips/netlogic/Kconfig
+++ b/arch/mips/netlogic/Kconfig
@@ -83,9 +83,6 @@ endif
config NLM_COMMON
bool
-config IOMMU_HELPER
- bool
-
config NEED_SG_DMA_LENGTH
bool
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index c32a181a7cbb..43e3c8e4e7f4 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -484,7 +484,6 @@ config IOMMU_HELPER
config SWIOTLB
bool "SWIOTLB support"
default n
- select IOMMU_HELPER
---help---
Support for IO bounce buffering for systems without an IOMMU.
This allows us to DMA to the full physical address space on
diff --git a/arch/unicore32/mm/Kconfig b/arch/unicore32/mm/Kconfig
index e9154a59d561..3f105e00c432 100644
--- a/arch/unicore32/mm/Kconfig
+++ b/arch/unicore32/mm/Kconfig
@@ -44,9 +44,6 @@ config SWIOTLB
def_bool y
select DMA_DIRECT_OPS
-config IOMMU_HELPER
- def_bool SWIOTLB
-
config NEED_SG_DMA_LENGTH
def_bool SWIOTLB
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 00fcf81f2c56..cb2c7ecc1fea 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -931,7 +931,7 @@ config SWIOTLB
config IOMMU_HELPER
def_bool y
- depends on CALGARY_IOMMU || GART_IOMMU || SWIOTLB || AMD_IOMMU
+ depends on CALGARY_IOMMU || GART_IOMMU
config MAXSMP
bool "Enable Maximum number of SMP Processors and NUMA Nodes"
diff --git a/drivers/parisc/Kconfig b/drivers/parisc/Kconfig
index 3a102a84d637..5a48b5606110 100644
--- a/drivers/parisc/Kconfig
+++ b/drivers/parisc/Kconfig
@@ -103,11 +103,6 @@ config IOMMU_SBA
depends on PCI_LBA
default PCI_LBA
-config IOMMU_HELPER
- bool
- depends on IOMMU_SBA || IOMMU_CCIO
- default y
-
source "drivers/pcmcia/Kconfig"
endmenu
diff --git a/include/linux/iommu-helper.h b/include/linux/iommu-helper.h
index cb9a9248c8c0..70d01edcbf8b 100644
--- a/include/linux/iommu-helper.h
+++ b/include/linux/iommu-helper.h
@@ -2,6 +2,7 @@
#ifndef _LINUX_IOMMU_HELPER_H
#define _LINUX_IOMMU_HELPER_H
+#include <linux/bug.h>
#include <linux/kernel.h>
static inline unsigned long iommu_device_max_index(unsigned long size,
@@ -14,9 +15,15 @@ static inline unsigned long iommu_device_max_index(unsigned long size,
return size;
}
-extern int iommu_is_span_boundary(unsigned int index, unsigned int nr,
- unsigned long shift,
- unsigned long boundary_size);
+static inline int iommu_is_span_boundary(unsigned int index, unsigned int nr,
+ unsigned long shift, unsigned long boundary_size)
+{
+ BUG_ON(!is_power_of_2(boundary_size));
+
+ shift = (shift + index) & (boundary_size - 1);
+ return shift + nr > boundary_size;
+}
+
extern unsigned long iommu_area_alloc(unsigned long *map, unsigned long size,
unsigned long start, unsigned int nr,
unsigned long shift,
diff --git a/lib/iommu-helper.c b/lib/iommu-helper.c
index ded1703e7e64..92a9f243c0e2 100644
--- a/lib/iommu-helper.c
+++ b/lib/iommu-helper.c
@@ -4,17 +4,7 @@
*/
#include <linux/bitmap.h>
-#include <linux/bug.h>
-
-int iommu_is_span_boundary(unsigned int index, unsigned int nr,
- unsigned long shift,
- unsigned long boundary_size)
-{
- BUG_ON(!is_power_of_2(boundary_size));
-
- shift = (shift + index) & (boundary_size - 1);
- return shift + nr > boundary_size;
-}
+#include <linux/iommu-helper.h>
unsigned long iommu_area_alloc(unsigned long *map, unsigned long size,
unsigned long start, unsigned int nr,
--
2.17.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 04/12] iommu-helper: move the IOMMU_HELPER config symbol to lib/
2018-04-23 17:04 centralize SWIOTLB config symbol and misc other cleanups V2 Christoph Hellwig
` (2 preceding siblings ...)
2018-04-23 17:04 ` [PATCH 03/12] iommu-helper: mark iommu_is_span_boundary as inline Christoph Hellwig
@ 2018-04-23 17:04 ` Christoph Hellwig
2018-04-23 17:04 ` [PATCH 05/12] scatterlist: move the NEED_SG_DMA_LENGTH config symbol to lib/Kconfig Christoph Hellwig
` (7 subsequent siblings)
11 siblings, 0 replies; 21+ messages in thread
From: Christoph Hellwig @ 2018-04-23 17:04 UTC (permalink / raw)
To: Konrad Rzeszutek Wilk, iommu
Cc: x86, linux-block, linux-pci, linux-mm, linux-mips, sparclinux,
linux-arm-kernel
This way we have one central definition of it, and user can select it as
needed.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
---
arch/powerpc/Kconfig | 4 +---
arch/s390/Kconfig | 5 ++---
arch/sparc/Kconfig | 5 +----
arch/x86/Kconfig | 6 ++----
lib/Kconfig | 3 +++
5 files changed, 9 insertions(+), 14 deletions(-)
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 43e3c8e4e7f4..7698cf89af9c 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -223,6 +223,7 @@ config PPC
select HAVE_SYSCALL_TRACEPOINTS
select HAVE_VIRT_CPU_ACCOUNTING
select HAVE_IRQ_TIME_ACCOUNTING
+ select IOMMU_HELPER if PPC64
select IRQ_DOMAIN
select IRQ_FORCED_THREADING
select MODULES_USE_ELF_RELA
@@ -478,9 +479,6 @@ config MPROFILE_KERNEL
depends on PPC64 && CPU_LITTLE_ENDIAN
def_bool !DISABLE_MPROFILE_KERNEL
-config IOMMU_HELPER
- def_bool PPC64
-
config SWIOTLB
bool "SWIOTLB support"
default n
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 199ac3e4da1d..60c4ab854182 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -709,7 +709,9 @@ config QDIO
menuconfig PCI
bool "PCI support"
select PCI_MSI
+ select IOMMU_HELPER
select IOMMU_SUPPORT
+
help
Enable PCI support.
@@ -733,9 +735,6 @@ config PCI_DOMAINS
config HAS_IOMEM
def_bool PCI
-config IOMMU_HELPER
- def_bool PCI
-
config NEED_SG_DMA_LENGTH
def_bool PCI
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 8767e45f1b2b..44e0f3cd7988 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -67,6 +67,7 @@ config SPARC64
select HAVE_SYSCALL_TRACEPOINTS
select HAVE_CONTEXT_TRACKING
select HAVE_DEBUG_KMEMLEAK
+ select IOMMU_HELPER
select SPARSE_IRQ
select RTC_DRV_CMOS
select RTC_DRV_BQ4802
@@ -106,10 +107,6 @@ config ARCH_DMA_ADDR_T_64BIT
bool
default y if ARCH_ATU
-config IOMMU_HELPER
- bool
- default y if SPARC64
-
config STACKTRACE_SUPPORT
bool
default y if SPARC64
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index cb2c7ecc1fea..fe9713539166 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -871,6 +871,7 @@ config DMI
config GART_IOMMU
bool "Old AMD GART IOMMU support"
+ select IOMMU_HELPER
select SWIOTLB
depends on X86_64 && PCI && AMD_NB
---help---
@@ -892,6 +893,7 @@ config GART_IOMMU
config CALGARY_IOMMU
bool "IBM Calgary IOMMU support"
+ select IOMMU_HELPER
select SWIOTLB
depends on X86_64 && PCI
---help---
@@ -929,10 +931,6 @@ config SWIOTLB
with more than 3 GB of memory.
If unsure, say Y.
-config IOMMU_HELPER
- def_bool y
- depends on CALGARY_IOMMU || GART_IOMMU
-
config MAXSMP
bool "Enable Maximum number of SMP Processors and NUMA Nodes"
depends on X86_64 && SMP && DEBUG_KERNEL
diff --git a/lib/Kconfig b/lib/Kconfig
index 5fe577673b98..2f6908577534 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -429,6 +429,9 @@ config SGL_ALLOC
bool
default n
+config IOMMU_HELPER
+ bool
+
config DMA_DIRECT_OPS
bool
depends on HAS_DMA && (!64BIT || ARCH_DMA_ADDR_T_64BIT)
--
2.17.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 05/12] scatterlist: move the NEED_SG_DMA_LENGTH config symbol to lib/Kconfig
2018-04-23 17:04 centralize SWIOTLB config symbol and misc other cleanups V2 Christoph Hellwig
` (3 preceding siblings ...)
2018-04-23 17:04 ` [PATCH 04/12] iommu-helper: move the IOMMU_HELPER config symbol to lib/ Christoph Hellwig
@ 2018-04-23 17:04 ` Christoph Hellwig
2018-04-23 17:04 ` [PATCH 06/12] dma-mapping: move the NEED_DMA_MAP_STATE " Christoph Hellwig
` (6 subsequent siblings)
11 siblings, 0 replies; 21+ messages in thread
From: Christoph Hellwig @ 2018-04-23 17:04 UTC (permalink / raw)
To: Konrad Rzeszutek Wilk, iommu
Cc: x86, linux-block, linux-pci, linux-mm, linux-mips, sparclinux,
linux-arm-kernel
This way we have one central definition of it, and user can select it as
needed.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
---
arch/alpha/Kconfig | 4 +---
arch/arm/Kconfig | 3 ---
arch/arm64/Kconfig | 4 +---
arch/hexagon/Kconfig | 4 +---
arch/ia64/Kconfig | 4 +---
arch/mips/cavium-octeon/Kconfig | 3 ---
arch/mips/loongson64/Kconfig | 3 ---
arch/mips/netlogic/Kconfig | 3 ---
arch/parisc/Kconfig | 4 +---
arch/powerpc/Kconfig | 4 +---
arch/s390/Kconfig | 4 +---
arch/sh/Kconfig | 5 ++---
arch/sparc/Kconfig | 4 +---
arch/unicore32/mm/Kconfig | 5 +----
arch/x86/Kconfig | 4 +---
lib/Kconfig | 3 +++
16 files changed, 15 insertions(+), 46 deletions(-)
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 3ff735a722af..8e6a67ecf069 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -10,6 +10,7 @@ config ALPHA
select HAVE_OPROFILE
select HAVE_PCSPKR_PLATFORM
select HAVE_PERF_EVENTS
+ select NEED_SG_DMA_LENGTH
select VIRT_TO_BUS
select GENERIC_IRQ_PROBE
select AUTO_IRQ_AFFINITY if SMP
@@ -70,9 +71,6 @@ config ARCH_DMA_ADDR_T_64BIT
config NEED_DMA_MAP_STATE
def_bool y
-config NEED_SG_DMA_LENGTH
- def_bool y
-
config GENERIC_ISA_DMA
bool
default y
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 2f79222c5c02..602c8320282f 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -119,9 +119,6 @@ config ARM_HAS_SG_CHAIN
select ARCH_HAS_SG_CHAIN
bool
-config NEED_SG_DMA_LENGTH
- bool
-
config ARM_DMA_USE_IOMMU
bool
select ARM_HAS_SG_CHAIN
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index fbef5d3de83f..3b441c5587f1 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -133,6 +133,7 @@ config ARM64
select IRQ_FORCED_THREADING
select MODULES_USE_ELF_RELA
select MULTI_IRQ_HANDLER
+ select NEED_SG_DMA_LENGTH
select NO_BOOTMEM
select OF
select OF_EARLY_FLATTREE
@@ -243,9 +244,6 @@ config ARCH_DMA_ADDR_T_64BIT
config NEED_DMA_MAP_STATE
def_bool y
-config NEED_SG_DMA_LENGTH
- def_bool y
-
config SMP
def_bool y
diff --git a/arch/hexagon/Kconfig b/arch/hexagon/Kconfig
index 76d2f20d525e..37adb2003033 100644
--- a/arch/hexagon/Kconfig
+++ b/arch/hexagon/Kconfig
@@ -19,6 +19,7 @@ config HEXAGON
select GENERIC_IRQ_SHOW
select HAVE_ARCH_KGDB
select HAVE_ARCH_TRACEHOOK
+ select NEED_SG_DMA_LENGTH
select NO_IOPORT_MAP
select GENERIC_IOMAP
select GENERIC_SMP_IDLE_THREAD
@@ -63,9 +64,6 @@ config GENERIC_CSUM
config GENERIC_IRQ_PROBE
def_bool y
-config NEED_SG_DMA_LENGTH
- def_bool y
-
config RWSEM_GENERIC_SPINLOCK
def_bool n
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 862c5160c09d..333917676f7f 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -54,6 +54,7 @@ config IA64
select MODULES_USE_ELF_RELA
select ARCH_USE_CMPXCHG_LOCKREF
select HAVE_ARCH_AUDITSYSCALL
+ select NEED_SG_DMA_LENGTH
default y
help
The Itanium Processor Family is Intel's 64-bit successor to
@@ -84,9 +85,6 @@ config ARCH_DMA_ADDR_T_64BIT
config NEED_DMA_MAP_STATE
def_bool y
-config NEED_SG_DMA_LENGTH
- def_bool y
-
config SWIOTLB
bool
diff --git a/arch/mips/cavium-octeon/Kconfig b/arch/mips/cavium-octeon/Kconfig
index 647ed158ac98..5d73041547a7 100644
--- a/arch/mips/cavium-octeon/Kconfig
+++ b/arch/mips/cavium-octeon/Kconfig
@@ -67,9 +67,6 @@ config CAVIUM_OCTEON_LOCK_L2_MEMCPY
help
Lock the kernel's implementation of memcpy() into L2.
-config NEED_SG_DMA_LENGTH
- bool
-
config SWIOTLB
def_bool y
select DMA_DIRECT_OPS
diff --git a/arch/mips/loongson64/Kconfig b/arch/mips/loongson64/Kconfig
index 5efb2e63878e..641a1477031e 100644
--- a/arch/mips/loongson64/Kconfig
+++ b/arch/mips/loongson64/Kconfig
@@ -130,9 +130,6 @@ config LOONGSON_UART_BASE
default y
depends on EARLY_PRINTK || SERIAL_8250
-config NEED_SG_DMA_LENGTH
- bool
-
config SWIOTLB
bool "Soft IOMMU Support for All-Memory DMA"
default y
diff --git a/arch/mips/netlogic/Kconfig b/arch/mips/netlogic/Kconfig
index 5c5ee0e05a17..412351c5acc6 100644
--- a/arch/mips/netlogic/Kconfig
+++ b/arch/mips/netlogic/Kconfig
@@ -83,7 +83,4 @@ endif
config NLM_COMMON
bool
-config NEED_SG_DMA_LENGTH
- bool
-
endif
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index fc5a574c3482..89caea87556e 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -51,6 +51,7 @@ config PARISC
select GENERIC_CLOCKEVENTS
select ARCH_NO_COHERENT_DMA_MMAP
select CPU_NO_EFFICIENT_FFS
+ select NEED_SG_DMA_LENGTH
help
The PA-RISC microprocessor is designed by Hewlett-Packard and used
@@ -114,9 +115,6 @@ config STACKTRACE_SUPPORT
config NEED_DMA_MAP_STATE
def_bool y
-config NEED_SG_DMA_LENGTH
- def_bool y
-
config ISA_DMA_API
bool
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 7698cf89af9c..cc9a616d8934 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -227,6 +227,7 @@ config PPC
select IRQ_DOMAIN
select IRQ_FORCED_THREADING
select MODULES_USE_ELF_RELA
+ select NEED_SG_DMA_LENGTH
select NO_BOOTMEM
select OF
select OF_EARLY_FLATTREE
@@ -910,9 +911,6 @@ config ZONE_DMA
config NEED_DMA_MAP_STATE
def_bool (PPC64 || NOT_COHERENT_CACHE)
-config NEED_SG_DMA_LENGTH
- def_bool y
-
config GENERIC_ISA_DMA
bool
depends on ISA_DMA_API
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 60c4ab854182..f80c6b983159 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -711,6 +711,7 @@ menuconfig PCI
select PCI_MSI
select IOMMU_HELPER
select IOMMU_SUPPORT
+ select NEED_SG_DMA_LENGTH
help
Enable PCI support.
@@ -735,9 +736,6 @@ config PCI_DOMAINS
config HAS_IOMEM
def_bool PCI
-config NEED_SG_DMA_LENGTH
- def_bool PCI
-
config NEED_DMA_MAP_STATE
def_bool PCI
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 97fe29316476..e127e0cbe30f 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -50,6 +50,8 @@ config SUPERH
select HAVE_ARCH_AUDITSYSCALL
select HAVE_FUTEX_CMPXCHG if FUTEX
select HAVE_NMI
+ select NEED_SG_DMA_LENGTH
+
help
The SuperH is a RISC processor targeted for use in embedded systems
and consumer electronics; it was also used in the Sega Dreamcast
@@ -163,9 +165,6 @@ config DMA_NONCOHERENT
config NEED_DMA_MAP_STATE
def_bool DMA_NONCOHERENT
-config NEED_SG_DMA_LENGTH
- def_bool y
-
config PGTABLE_LEVELS
default 3 if X2TLB
default 2
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 44e0f3cd7988..e79badc8a682 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -44,6 +44,7 @@ config SPARC
select ARCH_HAS_SG_CHAIN
select CPU_NO_EFFICIENT_FFS
select LOCKDEP_SMALL if LOCKDEP
+ select NEED_SG_DMA_LENGTH
config SPARC32
def_bool !64BIT
@@ -146,9 +147,6 @@ config ZONE_DMA
config NEED_DMA_MAP_STATE
def_bool y
-config NEED_SG_DMA_LENGTH
- def_bool y
-
config GENERIC_ISA_DMA
bool
default y if SPARC32
diff --git a/arch/unicore32/mm/Kconfig b/arch/unicore32/mm/Kconfig
index 3f105e00c432..1d9fed0ada71 100644
--- a/arch/unicore32/mm/Kconfig
+++ b/arch/unicore32/mm/Kconfig
@@ -43,7 +43,4 @@ config CPU_TLB_SINGLE_ENTRY_DISABLE
config SWIOTLB
def_bool y
select DMA_DIRECT_OPS
-
-config NEED_SG_DMA_LENGTH
- def_bool SWIOTLB
-
+ select NEED_SG_DMA_LENGTH
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index fe9713539166..ead3babe4e79 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -183,6 +183,7 @@ config X86
select HAVE_UNSTABLE_SCHED_CLOCK
select HAVE_USER_RETURN_NOTIFIER
select IRQ_FORCED_THREADING
+ select NEED_SG_DMA_LENGTH
select PCI_LOCKLESS_CONFIG
select PERF_EVENTS
select RTC_LIB
@@ -239,9 +240,6 @@ config NEED_DMA_MAP_STATE
def_bool y
depends on X86_64 || INTEL_IOMMU || DMA_API_DEBUG || SWIOTLB
-config NEED_SG_DMA_LENGTH
- def_bool y
-
config GENERIC_ISA_DMA
def_bool y
depends on ISA_DMA_API
diff --git a/lib/Kconfig b/lib/Kconfig
index 2f6908577534..aeb7fae16bc2 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -429,6 +429,9 @@ config SGL_ALLOC
bool
default n
+config NEED_SG_DMA_LENGTH
+ bool
+
config IOMMU_HELPER
bool
--
2.17.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 06/12] dma-mapping: move the NEED_DMA_MAP_STATE config symbol to lib/Kconfig
2018-04-23 17:04 centralize SWIOTLB config symbol and misc other cleanups V2 Christoph Hellwig
` (4 preceding siblings ...)
2018-04-23 17:04 ` [PATCH 05/12] scatterlist: move the NEED_SG_DMA_LENGTH config symbol to lib/Kconfig Christoph Hellwig
@ 2018-04-23 17:04 ` Christoph Hellwig
2018-04-23 17:04 ` [PATCH 07/12] arch: remove the ARCH_PHYS_ADDR_T_64BIT config symbol Christoph Hellwig
` (5 subsequent siblings)
11 siblings, 0 replies; 21+ messages in thread
From: Christoph Hellwig @ 2018-04-23 17:04 UTC (permalink / raw)
To: Konrad Rzeszutek Wilk, iommu
Cc: x86, linux-block, linux-pci, linux-mm, linux-mips, sparclinux,
linux-arm-kernel
This way we have one central definition of it, and user can select it as
needed. Note that we now also always select it when CONFIG_DMA_API_DEBUG
is select, which fixes some incorrect checks in a few network drivers.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
---
arch/alpha/Kconfig | 4 +---
arch/arm/Kconfig | 4 +---
arch/arm64/Kconfig | 4 +---
arch/ia64/Kconfig | 4 +---
arch/mips/Kconfig | 3 ---
arch/parisc/Kconfig | 4 +---
arch/s390/Kconfig | 4 +---
arch/sh/Kconfig | 4 +---
arch/sparc/Kconfig | 4 +---
arch/unicore32/Kconfig | 4 +---
arch/x86/Kconfig | 6 ++----
drivers/iommu/Kconfig | 1 +
include/linux/dma-mapping.h | 2 +-
lib/Kconfig | 3 +++
lib/Kconfig.debug | 1 +
15 files changed, 17 insertions(+), 35 deletions(-)
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 8e6a67ecf069..1fd9645b0c67 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -10,6 +10,7 @@ config ALPHA
select HAVE_OPROFILE
select HAVE_PCSPKR_PLATFORM
select HAVE_PERF_EVENTS
+ select NEED_DMA_MAP_STATE
select NEED_SG_DMA_LENGTH
select VIRT_TO_BUS
select GENERIC_IRQ_PROBE
@@ -68,9 +69,6 @@ config ZONE_DMA
config ARCH_DMA_ADDR_T_64BIT
def_bool y
-config NEED_DMA_MAP_STATE
- def_bool y
-
config GENERIC_ISA_DMA
bool
default y
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 602c8320282f..aa1c187d756d 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -96,6 +96,7 @@ config ARM
select HAVE_VIRT_CPU_ACCOUNTING_GEN
select IRQ_FORCED_THREADING
select MODULES_USE_ELF_REL
+ select NEED_DMA_MAP_STATE
select NO_BOOTMEM
select OF_EARLY_FLATTREE if OF
select OF_RESERVED_MEM if OF
@@ -221,9 +222,6 @@ config ARCH_MAY_HAVE_PC_FDC
config ZONE_DMA
bool
-config NEED_DMA_MAP_STATE
- def_bool y
-
config ARCH_SUPPORTS_UPROBES
def_bool y
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 3b441c5587f1..940adfb9a2bc 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -133,6 +133,7 @@ config ARM64
select IRQ_FORCED_THREADING
select MODULES_USE_ELF_RELA
select MULTI_IRQ_HANDLER
+ select NEED_DMA_MAP_STATE
select NEED_SG_DMA_LENGTH
select NO_BOOTMEM
select OF
@@ -241,9 +242,6 @@ config HAVE_GENERIC_GUP
config ARCH_DMA_ADDR_T_64BIT
def_bool y
-config NEED_DMA_MAP_STATE
- def_bool y
-
config SMP
def_bool y
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 333917676f7f..0e42731adaf1 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -54,6 +54,7 @@ config IA64
select MODULES_USE_ELF_RELA
select ARCH_USE_CMPXCHG_LOCKREF
select HAVE_ARCH_AUDITSYSCALL
+ select NEED_DMA_MAP_STATE
select NEED_SG_DMA_LENGTH
default y
help
@@ -82,9 +83,6 @@ config MMU
config ARCH_DMA_ADDR_T_64BIT
def_bool y
-config NEED_DMA_MAP_STATE
- def_bool y
-
config SWIOTLB
bool
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 225c95da23ce..47d72c64d687 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -1122,9 +1122,6 @@ config DMA_NONCOHERENT
bool
select NEED_DMA_MAP_STATE
-config NEED_DMA_MAP_STATE
- bool
-
config SYS_HAS_EARLY_PRINTK
bool
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 89caea87556e..4d8f64d48597 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -51,6 +51,7 @@ config PARISC
select GENERIC_CLOCKEVENTS
select ARCH_NO_COHERENT_DMA_MMAP
select CPU_NO_EFFICIENT_FFS
+ select NEED_DMA_MAP_STATE
select NEED_SG_DMA_LENGTH
help
@@ -112,9 +113,6 @@ config PM
config STACKTRACE_SUPPORT
def_bool y
-config NEED_DMA_MAP_STATE
- def_bool y
-
config ISA_DMA_API
bool
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index f80c6b983159..89a007672f70 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -711,6 +711,7 @@ menuconfig PCI
select PCI_MSI
select IOMMU_HELPER
select IOMMU_SUPPORT
+ select NEED_DMA_MAP_STATE
select NEED_SG_DMA_LENGTH
help
@@ -736,9 +737,6 @@ config PCI_DOMAINS
config HAS_IOMEM
def_bool PCI
-config NEED_DMA_MAP_STATE
- def_bool PCI
-
config CHSC_SCH
def_tristate m
prompt "Support for CHSC subchannels"
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index e127e0cbe30f..9417f70e008e 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -50,6 +50,7 @@ config SUPERH
select HAVE_ARCH_AUDITSYSCALL
select HAVE_FUTEX_CMPXCHG if FUTEX
select HAVE_NMI
+ select NEED_DMA_MAP_STATE
select NEED_SG_DMA_LENGTH
help
@@ -162,9 +163,6 @@ config DMA_COHERENT
config DMA_NONCOHERENT
def_bool !DMA_COHERENT
-config NEED_DMA_MAP_STATE
- def_bool DMA_NONCOHERENT
-
config PGTABLE_LEVELS
default 3 if X2TLB
default 2
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index e79badc8a682..be770b511ddd 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -44,6 +44,7 @@ config SPARC
select ARCH_HAS_SG_CHAIN
select CPU_NO_EFFICIENT_FFS
select LOCKDEP_SMALL if LOCKDEP
+ select NEED_DMA_MAP_STATE
select NEED_SG_DMA_LENGTH
config SPARC32
@@ -144,9 +145,6 @@ config ZONE_DMA
bool
default y if SPARC32
-config NEED_DMA_MAP_STATE
- def_bool y
-
config GENERIC_ISA_DMA
bool
default y if SPARC32
diff --git a/arch/unicore32/Kconfig b/arch/unicore32/Kconfig
index 462e59a7ae78..82195714d20b 100644
--- a/arch/unicore32/Kconfig
+++ b/arch/unicore32/Kconfig
@@ -19,6 +19,7 @@ config UNICORE32
select ARCH_WANT_FRAME_POINTERS
select GENERIC_IOMAP
select MODULES_USE_ELF_REL
+ select NEED_DMA_MAP_STATE
help
UniCore-32 is 32-bit Instruction Set Architecture,
including a series of low-power-consumption RISC chip
@@ -61,9 +62,6 @@ config ARCH_MAY_HAVE_PC_FDC
config ZONE_DMA
def_bool y
-config NEED_DMA_MAP_STATE
- def_bool y
-
source "init/Kconfig"
source "kernel/Kconfig.freezer"
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index ead3babe4e79..a98a9b14fda2 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -28,6 +28,7 @@ config X86_64
select ARCH_USE_CMPXCHG_LOCKREF
select HAVE_ARCH_SOFT_DIRTY
select MODULES_USE_ELF_RELA
+ select NEED_DMA_MAP_STATE
select X86_DEV_DMA_OPS
select ARCH_HAS_SYSCALL_WRAPPER
@@ -236,10 +237,6 @@ config ARCH_MMAP_RND_COMPAT_BITS_MAX
config SBUS
bool
-config NEED_DMA_MAP_STATE
- def_bool y
- depends on X86_64 || INTEL_IOMMU || DMA_API_DEBUG || SWIOTLB
-
config GENERIC_ISA_DMA
def_bool y
depends on ISA_DMA_API
@@ -922,6 +919,7 @@ config CALGARY_IOMMU_ENABLED_BY_DEFAULT
# need this always selected by IOMMU for the VIA workaround
config SWIOTLB
def_bool y if X86_64
+ select NEED_DMA_MAP_STATE
---help---
Support for software bounce buffers used on x86-64 systems
which don't have a hardware IOMMU. Using this PCI devices
diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
index df171cb85822..5b714a062fa7 100644
--- a/drivers/iommu/Kconfig
+++ b/drivers/iommu/Kconfig
@@ -146,6 +146,7 @@ config INTEL_IOMMU
select DMA_DIRECT_OPS
select IOMMU_API
select IOMMU_IOVA
+ select NEED_DMA_MAP_STATE
select DMAR_TABLE
help
DMA remapping (DMAR) devices support enables independent address
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index f8ab1c0f589e..14269d25498b 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -839,7 +839,7 @@ static inline int dma_mmap_wc(struct device *dev,
#define dma_mmap_writecombine dma_mmap_wc
#endif
-#if defined(CONFIG_NEED_DMA_MAP_STATE) || defined(CONFIG_DMA_API_DEBUG)
+#ifdef CONFIG_NEED_DMA_MAP_STATE
#define DEFINE_DMA_UNMAP_ADDR(ADDR_NAME) dma_addr_t ADDR_NAME
#define DEFINE_DMA_UNMAP_LEN(LEN_NAME) __u32 LEN_NAME
#define dma_unmap_addr(PTR, ADDR_NAME) ((PTR)->ADDR_NAME)
diff --git a/lib/Kconfig b/lib/Kconfig
index aeb7fae16bc2..ce9fa962d59b 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -432,6 +432,9 @@ config SGL_ALLOC
config NEED_SG_DMA_LENGTH
bool
+config NEED_DMA_MAP_STATE
+ bool
+
config IOMMU_HELPER
bool
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index c40c7b734cd1..685ed2dd4384 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -1635,6 +1635,7 @@ config PROVIDE_OHCI1394_DMA_INIT
config DMA_API_DEBUG
bool "Enable debugging of DMA-API usage"
depends on HAVE_DMA_API_DEBUG
+ select NEED_DMA_MAP_STATE
help
Enable this option to debug the use of the DMA API by device drivers.
With this option you will be able to detect common bugs in device
--
2.17.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 07/12] arch: remove the ARCH_PHYS_ADDR_T_64BIT config symbol
2018-04-23 17:04 centralize SWIOTLB config symbol and misc other cleanups V2 Christoph Hellwig
` (5 preceding siblings ...)
2018-04-23 17:04 ` [PATCH 06/12] dma-mapping: move the NEED_DMA_MAP_STATE " Christoph Hellwig
@ 2018-04-23 17:04 ` Christoph Hellwig
2018-04-23 17:04 ` [PATCH 08/12] arch: define the ARCH_DMA_ADDR_T_64BIT config symbol in lib/Kconfig Christoph Hellwig
` (4 subsequent siblings)
11 siblings, 0 replies; 21+ messages in thread
From: Christoph Hellwig @ 2018-04-23 17:04 UTC (permalink / raw)
To: Konrad Rzeszutek Wilk, iommu
Cc: x86, linux-block, linux-pci, linux-mm, linux-mips, sparclinux,
linux-arm-kernel
Instead select the PHYS_ADDR_T_64BIT for 32-bit architectures that need a
64-bit phys_addr_t type directly.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
arch/arc/Kconfig | 4 +---
arch/arm/kernel/setup.c | 2 +-
arch/arm/mm/Kconfig | 4 +---
arch/arm64/Kconfig | 3 ---
arch/mips/Kconfig | 15 ++++++---------
arch/powerpc/Kconfig | 5 +----
arch/powerpc/platforms/Kconfig.cputype | 1 +
arch/riscv/Kconfig | 6 ++----
arch/x86/Kconfig | 5 +----
mm/Kconfig | 2 +-
10 files changed, 15 insertions(+), 32 deletions(-)
diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index d76bf4a83740..f94c61da682a 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -453,13 +453,11 @@ config ARC_HAS_PAE40
default n
depends on ISA_ARCV2
select HIGHMEM
+ select PHYS_ADDR_T_64BIT
help
Enable access to physical memory beyond 4G, only supported on
ARC cores with 40 bit Physical Addressing support
-config ARCH_PHYS_ADDR_T_64BIT
- def_bool ARC_HAS_PAE40
-
config ARCH_DMA_ADDR_T_64BIT
bool
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index fc40a2b40595..35ca494c028c 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -754,7 +754,7 @@ int __init arm_add_memory(u64 start, u64 size)
else
size -= aligned_start - start;
-#ifndef CONFIG_ARCH_PHYS_ADDR_T_64BIT
+#ifndef CONFIG_PHYS_ADDR_T_64BIT
if (aligned_start > ULONG_MAX) {
pr_crit("Ignoring memory at 0x%08llx outside 32-bit physical address space\n",
(long long)start);
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index 7f14acf67caf..2f77c6344ef1 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -661,6 +661,7 @@ config ARM_LPAE
bool "Support for the Large Physical Address Extension"
depends on MMU && CPU_32v7 && !CPU_32v6 && !CPU_32v5 && \
!CPU_32v4 && !CPU_32v3
+ select PHYS_ADDR_T_64BIT
help
Say Y if you have an ARMv7 processor supporting the LPAE page
table format and you would like to access memory beyond the
@@ -673,9 +674,6 @@ config ARM_PV_FIXUP
def_bool y
depends on ARM_LPAE && ARM_PATCH_PHYS_VIRT && ARCH_KEYSTONE
-config ARCH_PHYS_ADDR_T_64BIT
- def_bool ARM_LPAE
-
config ARCH_DMA_ADDR_T_64BIT
bool
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 940adfb9a2bc..b6aa33e642cc 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -152,9 +152,6 @@ config ARM64
config 64BIT
def_bool y
-config ARCH_PHYS_ADDR_T_64BIT
- def_bool y
-
config MMU
def_bool y
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 47d72c64d687..985388078872 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -132,7 +132,7 @@ config MIPS_GENERIC
config MIPS_ALCHEMY
bool "Alchemy processor based machines"
- select ARCH_PHYS_ADDR_T_64BIT
+ select PHYS_ADDR_T_64BIT
select CEVT_R4K
select CSRC_R4K
select IRQ_MIPS_CPU
@@ -890,7 +890,7 @@ config CAVIUM_OCTEON_SOC
bool "Cavium Networks Octeon SoC based boards"
select CEVT_R4K
select ARCH_HAS_PHYS_TO_DMA
- select ARCH_PHYS_ADDR_T_64BIT
+ select PHYS_ADDR_T_64BIT
select DMA_COHERENT
select SYS_SUPPORTS_64BIT_KERNEL
select SYS_SUPPORTS_BIG_ENDIAN
@@ -936,7 +936,7 @@ config NLM_XLR_BOARD
select SWAP_IO_SPACE
select SYS_SUPPORTS_32BIT_KERNEL
select SYS_SUPPORTS_64BIT_KERNEL
- select ARCH_PHYS_ADDR_T_64BIT
+ select PHYS_ADDR_T_64BIT
select SYS_SUPPORTS_BIG_ENDIAN
select SYS_SUPPORTS_HIGHMEM
select DMA_COHERENT
@@ -962,7 +962,7 @@ config NLM_XLP_BOARD
select HW_HAS_PCI
select SYS_SUPPORTS_32BIT_KERNEL
select SYS_SUPPORTS_64BIT_KERNEL
- select ARCH_PHYS_ADDR_T_64BIT
+ select PHYS_ADDR_T_64BIT
select GPIOLIB
select SYS_SUPPORTS_BIG_ENDIAN
select SYS_SUPPORTS_LITTLE_ENDIAN
@@ -1102,7 +1102,7 @@ config FW_CFE
bool
config ARCH_DMA_ADDR_T_64BIT
- def_bool (HIGHMEM && ARCH_PHYS_ADDR_T_64BIT) || 64BIT
+ def_bool (HIGHMEM && PHYS_ADDR_T_64BIT) || 64BIT
config ARCH_SUPPORTS_UPROBES
bool
@@ -1767,7 +1767,7 @@ config CPU_MIPS32_R5_XPA
depends on SYS_SUPPORTS_HIGHMEM
select XPA
select HIGHMEM
- select ARCH_PHYS_ADDR_T_64BIT
+ select PHYS_ADDR_T_64BIT
default n
help
Choose this option if you want to enable the Extended Physical
@@ -2399,9 +2399,6 @@ config SB1_PASS_2_1_WORKAROUNDS
default y
-config ARCH_PHYS_ADDR_T_64BIT
- bool
-
choice
prompt "SmartMIPS or microMIPS ASE support"
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index cc9a616d8934..b3d091d65e05 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -13,11 +13,8 @@ config 64BIT
bool
default y if PPC64
-config ARCH_PHYS_ADDR_T_64BIT
- def_bool PPC64 || PHYS_64BIT
-
config ARCH_DMA_ADDR_T_64BIT
- def_bool ARCH_PHYS_ADDR_T_64BIT
+ def_bool PHYS_ADDR_T_64BIT
config MMU
bool
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index 67d3125d0610..84b58abc08ee 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -222,6 +222,7 @@ config PTE_64BIT
config PHYS_64BIT
bool 'Large physical address support' if E500 || PPC_86xx
depends on (44x || E500 || PPC_86xx) && !PPC_83xx && !PPC_82xx
+ select PHYS_ADDR_T_64BIT
---help---
This option enables kernel support for larger than 32-bit physical
addresses. This feature may not be available on all cores.
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 23d8acca5c90..f52f86f43a4b 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -5,6 +5,8 @@
config RISCV
def_bool y
+ # even on 32-bit, physical (and DMA) addresses are > 32-bits
+ select PHYS_ADDR_T_64BIT
select OF
select OF_EARLY_FLATTREE
select OF_IRQ
@@ -38,10 +40,6 @@ config RISCV
config MMU
def_bool y
-# even on 32-bit, physical (and DMA) addresses are > 32-bits
-config ARCH_PHYS_ADDR_T_64BIT
- def_bool y
-
config ZONE_DMA32
bool
default y
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index a98a9b14fda2..8fccdaf02bb0 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1448,6 +1448,7 @@ config HIGHMEM
config X86_PAE
bool "PAE (Physical Address Extension) Support"
depends on X86_32 && !HIGHMEM4G
+ select PHYS_ADDR_T_64BIT
select SWIOTLB
---help---
PAE is required for NX support, and furthermore enables
@@ -1475,10 +1476,6 @@ config X86_5LEVEL
Say N if unsure.
-config ARCH_PHYS_ADDR_T_64BIT
- def_bool y
- depends on X86_64 || X86_PAE
-
config ARCH_DMA_ADDR_T_64BIT
def_bool y
depends on X86_64 || HIGHMEM64G
diff --git a/mm/Kconfig b/mm/Kconfig
index d5004d82a1d6..a3f0005ac212 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -266,7 +266,7 @@ config ARCH_ENABLE_THP_MIGRATION
bool
config PHYS_ADDR_T_64BIT
- def_bool 64BIT || ARCH_PHYS_ADDR_T_64BIT
+ def_bool 64BIT
config BOUNCE
bool "Enable bounce buffers"
--
2.17.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 08/12] arch: define the ARCH_DMA_ADDR_T_64BIT config symbol in lib/Kconfig
2018-04-23 17:04 centralize SWIOTLB config symbol and misc other cleanups V2 Christoph Hellwig
` (6 preceding siblings ...)
2018-04-23 17:04 ` [PATCH 07/12] arch: remove the ARCH_PHYS_ADDR_T_64BIT config symbol Christoph Hellwig
@ 2018-04-23 17:04 ` Christoph Hellwig
2018-04-23 17:04 ` [PATCH 09/12] PCI: remove CONFIG_PCI_BUS_ADDR_T_64BIT Christoph Hellwig
` (3 subsequent siblings)
11 siblings, 0 replies; 21+ messages in thread
From: Christoph Hellwig @ 2018-04-23 17:04 UTC (permalink / raw)
To: Konrad Rzeszutek Wilk, iommu
Cc: x86, linux-block, linux-pci, linux-mm, linux-mips, sparclinux,
linux-arm-kernel
Define this symbol if the architecture either uses 64-bit pointers or the
PHYS_ADDR_T_64BIT is set. This covers 95% of the old arch magic. We only
need an additional select for Xen on ARM (why anyway?), and we now always
set ARCH_DMA_ADDR_T_64BIT on mips boards with 64-bit physical addressing
instead of only doing it when highmem is set.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
arch/alpha/Kconfig | 3 ---
arch/arc/Kconfig | 3 ---
arch/arm/mach-axxia/Kconfig | 1 -
arch/arm/mach-bcm/Kconfig | 1 -
arch/arm/mach-exynos/Kconfig | 1 -
arch/arm/mach-highbank/Kconfig | 1 -
arch/arm/mach-rockchip/Kconfig | 1 -
arch/arm/mach-shmobile/Kconfig | 1 -
arch/arm/mach-tegra/Kconfig | 1 -
arch/arm/mm/Kconfig | 3 ---
arch/arm64/Kconfig | 3 ---
arch/ia64/Kconfig | 3 ---
arch/mips/Kconfig | 3 ---
arch/powerpc/Kconfig | 3 ---
arch/riscv/Kconfig | 3 ---
arch/s390/Kconfig | 3 ---
arch/sparc/Kconfig | 4 ----
arch/x86/Kconfig | 4 ----
lib/Kconfig | 3 +++
19 files changed, 3 insertions(+), 42 deletions(-)
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 1fd9645b0c67..aa7df1a36fd0 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -66,9 +66,6 @@ config ZONE_DMA
bool
default y
-config ARCH_DMA_ADDR_T_64BIT
- def_bool y
-
config GENERIC_ISA_DMA
bool
default y
diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index f94c61da682a..7498aca4b887 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -458,9 +458,6 @@ config ARC_HAS_PAE40
Enable access to physical memory beyond 4G, only supported on
ARC cores with 40 bit Physical Addressing support
-config ARCH_DMA_ADDR_T_64BIT
- bool
-
config ARC_KVADDR_SIZE
int "Kernel Virtual Address Space size (MB)"
range 0 512
diff --git a/arch/arm/mach-axxia/Kconfig b/arch/arm/mach-axxia/Kconfig
index bb2ce1c63fd9..d3eae6037913 100644
--- a/arch/arm/mach-axxia/Kconfig
+++ b/arch/arm/mach-axxia/Kconfig
@@ -2,7 +2,6 @@
config ARCH_AXXIA
bool "LSI Axxia platforms"
depends on ARCH_MULTI_V7 && ARM_LPAE
- select ARCH_DMA_ADDR_T_64BIT
select ARM_AMBA
select ARM_GIC
select ARM_TIMER_SP804
diff --git a/arch/arm/mach-bcm/Kconfig b/arch/arm/mach-bcm/Kconfig
index c2f3b0d216a4..c46a728df44e 100644
--- a/arch/arm/mach-bcm/Kconfig
+++ b/arch/arm/mach-bcm/Kconfig
@@ -211,7 +211,6 @@ config ARCH_BRCMSTB
select BRCMSTB_L2_IRQ
select BCM7120_L2_IRQ
select ARCH_HAS_HOLES_MEMORYMODEL
- select ARCH_DMA_ADDR_T_64BIT if ARM_LPAE
select ZONE_DMA if ARM_LPAE
select SOC_BRCMSTB
select SOC_BUS
diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index 647c319f9f5f..2ca405816846 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -112,7 +112,6 @@ config SOC_EXYNOS5440
bool "SAMSUNG EXYNOS5440"
default y
depends on ARCH_EXYNOS5
- select ARCH_DMA_ADDR_T_64BIT if ARM_LPAE
select HAVE_ARM_ARCH_TIMER
select AUTO_ZRELADDR
select PINCTRL_EXYNOS5440
diff --git a/arch/arm/mach-highbank/Kconfig b/arch/arm/mach-highbank/Kconfig
index 81110ec34226..5552968f07f8 100644
--- a/arch/arm/mach-highbank/Kconfig
+++ b/arch/arm/mach-highbank/Kconfig
@@ -1,7 +1,6 @@
config ARCH_HIGHBANK
bool "Calxeda ECX-1000/2000 (Highbank/Midway)"
depends on ARCH_MULTI_V7
- select ARCH_DMA_ADDR_T_64BIT if ARM_LPAE
select ARCH_HAS_HOLES_MEMORYMODEL
select ARCH_SUPPORTS_BIG_ENDIAN
select ARM_AMBA
diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index a4065966881a..fafd3d7f9f8c 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -3,7 +3,6 @@ config ARCH_ROCKCHIP
depends on ARCH_MULTI_V7
select PINCTRL
select PINCTRL_ROCKCHIP
- select ARCH_DMA_ADDR_T_64BIT if ARM_LPAE
select ARCH_HAS_RESET_CONTROLLER
select ARM_AMBA
select ARM_GIC
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index 280e7312a9e1..fe60cd09a5ca 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -29,7 +29,6 @@ config ARCH_RMOBILE
menuconfig ARCH_RENESAS
bool "Renesas ARM SoCs"
depends on ARCH_MULTI_V7 && MMU
- select ARCH_DMA_ADDR_T_64BIT if ARM_LPAE
select ARCH_SHMOBILE
select ARM_GIC
select GPIOLIB
diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig
index 1e0aeb47bac6..7f3b83e0d324 100644
--- a/arch/arm/mach-tegra/Kconfig
+++ b/arch/arm/mach-tegra/Kconfig
@@ -15,6 +15,5 @@ menuconfig ARCH_TEGRA
select RESET_CONTROLLER
select SOC_BUS
select ZONE_DMA if ARM_LPAE
- select ARCH_DMA_ADDR_T_64BIT if ARM_LPAE
help
This enables support for NVIDIA Tegra based systems.
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index 2f77c6344ef1..5a016bc80e26 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -674,9 +674,6 @@ config ARM_PV_FIXUP
def_bool y
depends on ARM_LPAE && ARM_PATCH_PHYS_VIRT && ARCH_KEYSTONE
-config ARCH_DMA_ADDR_T_64BIT
- bool
-
config ARM_THUMB
bool "Support Thumb user binaries" if !CPU_THUMBONLY && EXPERT
depends on CPU_THUMB_CAPABLE
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index b6aa33e642cc..4d924eb32e7f 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -236,9 +236,6 @@ config ZONE_DMA32
config HAVE_GENERIC_GUP
def_bool y
-config ARCH_DMA_ADDR_T_64BIT
- def_bool y
-
config SMP
def_bool y
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 0e42731adaf1..685d557eea48 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -80,9 +80,6 @@ config MMU
bool
default y
-config ARCH_DMA_ADDR_T_64BIT
- def_bool y
-
config SWIOTLB
bool
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 985388078872..e10cc5c7be69 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -1101,9 +1101,6 @@ config GPIO_TXX9
config FW_CFE
bool
-config ARCH_DMA_ADDR_T_64BIT
- def_bool (HIGHMEM && PHYS_ADDR_T_64BIT) || 64BIT
-
config ARCH_SUPPORTS_UPROBES
bool
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index b3d091d65e05..a4b2ac7c3d2e 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -13,9 +13,6 @@ config 64BIT
bool
default y if PPC64
-config ARCH_DMA_ADDR_T_64BIT
- def_bool PHYS_ADDR_T_64BIT
-
config MMU
bool
default y
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index f52f86f43a4b..17212ba54ee3 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -44,9 +44,6 @@ config ZONE_DMA32
bool
default y
-config ARCH_DMA_ADDR_T_64BIT
- def_bool y
-
config PAGE_OFFSET
hex
default 0xC0000000 if 32BIT && MAXPHYSMEM_2GB
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 89a007672f70..b794a2ab6d15 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -35,9 +35,6 @@ config GENERIC_BUG
config GENERIC_BUG_RELATIVE_POINTERS
def_bool y
-config ARCH_DMA_ADDR_T_64BIT
- def_bool y
-
config GENERIC_LOCKBREAK
def_bool y if SMP && PREEMPT
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index be770b511ddd..c1cfc17eb504 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -105,10 +105,6 @@ config ARCH_ATU
bool
default y if SPARC64
-config ARCH_DMA_ADDR_T_64BIT
- bool
- default y if ARCH_ATU
-
config STACKTRACE_SUPPORT
bool
default y if SPARC64
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 8fccdaf02bb0..07b031f99eb1 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1476,10 +1476,6 @@ config X86_5LEVEL
Say N if unsure.
-config ARCH_DMA_ADDR_T_64BIT
- def_bool y
- depends on X86_64 || HIGHMEM64G
-
config X86_DIRECT_GBPAGES
def_bool y
depends on X86_64 && !DEBUG_PAGEALLOC
diff --git a/lib/Kconfig b/lib/Kconfig
index ce9fa962d59b..1f12faf03819 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -435,6 +435,9 @@ config NEED_SG_DMA_LENGTH
config NEED_DMA_MAP_STATE
bool
+config ARCH_DMA_ADDR_T_64BIT
+ def_bool 64BIT || PHYS_ADDR_T_64BIT
+
config IOMMU_HELPER
bool
--
2.17.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 09/12] PCI: remove CONFIG_PCI_BUS_ADDR_T_64BIT
2018-04-23 17:04 centralize SWIOTLB config symbol and misc other cleanups V2 Christoph Hellwig
` (7 preceding siblings ...)
2018-04-23 17:04 ` [PATCH 08/12] arch: define the ARCH_DMA_ADDR_T_64BIT config symbol in lib/Kconfig Christoph Hellwig
@ 2018-04-23 17:04 ` Christoph Hellwig
2018-04-23 17:04 ` [PATCH 10/12] arm: don't build swiotlb by default Christoph Hellwig
` (2 subsequent siblings)
11 siblings, 0 replies; 21+ messages in thread
From: Christoph Hellwig @ 2018-04-23 17:04 UTC (permalink / raw)
To: Konrad Rzeszutek Wilk, iommu
Cc: x86, linux-block, linux-pci, linux-mm, linux-mips, sparclinux,
linux-arm-kernel
This symbol is now always identical to CONFIG_ARCH_DMA_ADDR_T_64BIT, so
remove it.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
---
drivers/pci/Kconfig | 4 ----
drivers/pci/bus.c | 4 ++--
include/linux/pci.h | 2 +-
3 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig
index 34b56a8f8480..29a487f31dae 100644
--- a/drivers/pci/Kconfig
+++ b/drivers/pci/Kconfig
@@ -5,10 +5,6 @@
source "drivers/pci/pcie/Kconfig"
-config PCI_BUS_ADDR_T_64BIT
- def_bool y if (ARCH_DMA_ADDR_T_64BIT || 64BIT)
- depends on PCI
-
config PCI_MSI
bool "Message Signaled Interrupts (MSI and MSI-X)"
depends on PCI
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c
index bc2ded4c451f..35b7fc87eac5 100644
--- a/drivers/pci/bus.c
+++ b/drivers/pci/bus.c
@@ -120,7 +120,7 @@ int devm_request_pci_bus_resources(struct device *dev,
EXPORT_SYMBOL_GPL(devm_request_pci_bus_resources);
static struct pci_bus_region pci_32_bit = {0, 0xffffffffULL};
-#ifdef CONFIG_PCI_BUS_ADDR_T_64BIT
+#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
static struct pci_bus_region pci_64_bit = {0,
(pci_bus_addr_t) 0xffffffffffffffffULL};
static struct pci_bus_region pci_high = {(pci_bus_addr_t) 0x100000000ULL,
@@ -230,7 +230,7 @@ int pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res,
resource_size_t),
void *alignf_data)
{
-#ifdef CONFIG_PCI_BUS_ADDR_T_64BIT
+#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
int rc;
if (res->flags & IORESOURCE_MEM_64) {
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 73178a2fcee0..55371cb827ad 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -670,7 +670,7 @@ int raw_pci_read(unsigned int domain, unsigned int bus, unsigned int devfn,
int raw_pci_write(unsigned int domain, unsigned int bus, unsigned int devfn,
int reg, int len, u32 val);
-#ifdef CONFIG_PCI_BUS_ADDR_T_64BIT
+#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
typedef u64 pci_bus_addr_t;
#else
typedef u32 pci_bus_addr_t;
--
2.17.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 10/12] arm: don't build swiotlb by default
2018-04-23 17:04 centralize SWIOTLB config symbol and misc other cleanups V2 Christoph Hellwig
` (8 preceding siblings ...)
2018-04-23 17:04 ` [PATCH 09/12] PCI: remove CONFIG_PCI_BUS_ADDR_T_64BIT Christoph Hellwig
@ 2018-04-23 17:04 ` Christoph Hellwig
2018-04-23 20:09 ` Konrad Rzeszutek Wilk
2018-04-23 17:04 ` [PATCH 11/12] swiotlb: move the SWIOTLB config symbol to lib/Kconfig Christoph Hellwig
2018-04-23 17:04 ` [PATCH 12/12] swiotlb: remove the CONFIG_DMA_DIRECT_OPS ifdefs Christoph Hellwig
11 siblings, 1 reply; 21+ messages in thread
From: Christoph Hellwig @ 2018-04-23 17:04 UTC (permalink / raw)
To: Konrad Rzeszutek Wilk, iommu
Cc: x86, linux-block, linux-pci, linux-mm, linux-mips, sparclinux,
linux-arm-kernel
swiotlb is only used as a library of helper for xen-swiotlb if Xen support
is enabled on arm, so don't build it by default.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
arch/arm/Kconfig | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index aa1c187d756d..90b81a3a28a7 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1774,7 +1774,7 @@ config SECCOMP
defined by each seccomp mode.
config SWIOTLB
- def_bool y
+ bool
config PARAVIRT
bool "Enable paravirtualization code"
@@ -1807,6 +1807,7 @@ config XEN
depends on MMU
select ARCH_DMA_ADDR_T_64BIT
select ARM_PSCI
+ select SWIOTLB
select SWIOTLB_XEN
select PARAVIRT
help
--
2.17.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 11/12] swiotlb: move the SWIOTLB config symbol to lib/Kconfig
2018-04-23 17:04 centralize SWIOTLB config symbol and misc other cleanups V2 Christoph Hellwig
` (9 preceding siblings ...)
2018-04-23 17:04 ` [PATCH 10/12] arm: don't build swiotlb by default Christoph Hellwig
@ 2018-04-23 17:04 ` Christoph Hellwig
2018-04-23 20:11 ` Konrad Rzeszutek Wilk
2018-04-23 23:52 ` Russell King - ARM Linux
2018-04-23 17:04 ` [PATCH 12/12] swiotlb: remove the CONFIG_DMA_DIRECT_OPS ifdefs Christoph Hellwig
11 siblings, 2 replies; 21+ messages in thread
From: Christoph Hellwig @ 2018-04-23 17:04 UTC (permalink / raw)
To: Konrad Rzeszutek Wilk, iommu
Cc: x86, linux-block, linux-pci, linux-mm, linux-mips, sparclinux,
linux-arm-kernel
This way we have one central definition of it, and user can select it as
needed. Note that we also add a second ARCH_HAS_SWIOTLB symbol to
indicate the architecture supports swiotlb at all, so that we can still
make the usage optional for a few architectures that want this feature
to be user selectable.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
arch/arm/Kconfig | 4 +---
arch/arm64/Kconfig | 5 ++---
arch/ia64/Kconfig | 9 +--------
arch/mips/Kconfig | 3 +++
arch/mips/cavium-octeon/Kconfig | 5 -----
arch/mips/loongson64/Kconfig | 8 --------
arch/powerpc/Kconfig | 9 ---------
arch/unicore32/mm/Kconfig | 5 -----
arch/x86/Kconfig | 14 +++-----------
lib/Kconfig | 15 +++++++++++++++
10 files changed, 25 insertions(+), 52 deletions(-)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 90b81a3a28a7..f91f69174630 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -106,6 +106,7 @@ config ARM
select REFCOUNT_FULL
select RTC_LIB
select SYS_SUPPORTS_APM_EMULATION
+ select ARCH_HAS_SWIOTLB
# Above selects are sorted alphabetically; please add new ones
# according to that. Thanks.
help
@@ -1773,9 +1774,6 @@ config SECCOMP
and the task is only allowed to execute a few safe syscalls
defined by each seccomp mode.
-config SWIOTLB
- bool
-
config PARAVIRT
bool "Enable paravirtualization code"
help
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 4d924eb32e7f..056bc7365adf 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -21,6 +21,7 @@ config ARM64
select ARCH_HAS_SG_CHAIN
select ARCH_HAS_STRICT_KERNEL_RWX
select ARCH_HAS_STRICT_MODULE_RWX
+ select ARCH_HAS_SWIOTLB
select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
select ARCH_HAVE_NMI_SAFE_CMPXCHG
select ARCH_INLINE_READ_LOCK if !PREEMPT
@@ -144,6 +145,7 @@ config ARM64
select POWER_SUPPLY
select REFCOUNT_FULL
select SPARSE_IRQ
+ select SWIOTLB
select SYSCTL_EXCEPTION_TRACE
select THREAD_INFO_IN_TASK
help
@@ -239,9 +241,6 @@ config HAVE_GENERIC_GUP
config SMP
def_bool y
-config SWIOTLB
- def_bool y
-
config KERNEL_MODE_NEON
def_bool y
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 685d557eea48..d396230913e6 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -56,6 +56,7 @@ config IA64
select HAVE_ARCH_AUDITSYSCALL
select NEED_DMA_MAP_STATE
select NEED_SG_DMA_LENGTH
+ select ARCH_HAS_SWIOTLB
default y
help
The Itanium Processor Family is Intel's 64-bit successor to
@@ -80,9 +81,6 @@ config MMU
bool
default y
-config SWIOTLB
- bool
-
config STACKTRACE_SUPPORT
def_bool y
@@ -139,7 +137,6 @@ config IA64_GENERIC
bool "generic"
select NUMA
select ACPI_NUMA
- select DMA_DIRECT_OPS
select SWIOTLB
select PCI_MSI
help
@@ -160,7 +157,6 @@ config IA64_GENERIC
config IA64_DIG
bool "DIG-compliant"
- select DMA_DIRECT_OPS
select SWIOTLB
config IA64_DIG_VTD
@@ -176,7 +172,6 @@ config IA64_HP_ZX1
config IA64_HP_ZX1_SWIOTLB
bool "HP-zx1/sx1000 with software I/O TLB"
- select DMA_DIRECT_OPS
select SWIOTLB
help
Build a kernel that runs on HP zx1 and sx1000 systems even when they
@@ -200,7 +195,6 @@ config IA64_SGI_UV
bool "SGI-UV"
select NUMA
select ACPI_NUMA
- select DMA_DIRECT_OPS
select SWIOTLB
help
Selecting this option will optimize the kernel for use on UV based
@@ -211,7 +205,6 @@ config IA64_SGI_UV
config IA64_HP_SIM
bool "Ski-simulator"
- select DMA_DIRECT_OPS
select SWIOTLB
depends on !PM
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index e10cc5c7be69..b6b4c1e154f8 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -912,6 +912,8 @@ config CAVIUM_OCTEON_SOC
select MIPS_NR_CPU_NR_MAP_1024
select BUILTIN_DTB
select MTD_COMPLEX_MAPPINGS
+ select ARCH_HAS_SWIOTLB
+ select SWIOTLB
select SYS_SUPPORTS_RELOCATABLE
help
This option supports all of the Octeon reference boards from Cavium
@@ -1367,6 +1369,7 @@ config CPU_LOONGSON3
select MIPS_PGD_C0_CONTEXT
select MIPS_L1_CACHE_SHIFT_6
select GPIOLIB
+ select ARCH_HAS_SWIOTLB
help
The Loongson 3 processor implements the MIPS64R2 instruction
set with many extensions.
diff --git a/arch/mips/cavium-octeon/Kconfig b/arch/mips/cavium-octeon/Kconfig
index 5d73041547a7..4984e462be30 100644
--- a/arch/mips/cavium-octeon/Kconfig
+++ b/arch/mips/cavium-octeon/Kconfig
@@ -67,11 +67,6 @@ config CAVIUM_OCTEON_LOCK_L2_MEMCPY
help
Lock the kernel's implementation of memcpy() into L2.
-config SWIOTLB
- def_bool y
- select DMA_DIRECT_OPS
- select NEED_SG_DMA_LENGTH
-
config OCTEON_ILM
tristate "Module to measure interrupt latency using Octeon CIU Timer"
help
diff --git a/arch/mips/loongson64/Kconfig b/arch/mips/loongson64/Kconfig
index 641a1477031e..c79e6a565572 100644
--- a/arch/mips/loongson64/Kconfig
+++ b/arch/mips/loongson64/Kconfig
@@ -130,14 +130,6 @@ config LOONGSON_UART_BASE
default y
depends on EARLY_PRINTK || SERIAL_8250
-config SWIOTLB
- bool "Soft IOMMU Support for All-Memory DMA"
- default y
- depends on CPU_LOONGSON3
- select DMA_DIRECT_OPS
- select NEED_SG_DMA_LENGTH
- select NEED_DMA_MAP_STATE
-
config PHYS48_TO_HT40
bool
default y if CPU_LOONGSON3
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index a4b2ac7c3d2e..1887f8f86a77 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -474,15 +474,6 @@ config MPROFILE_KERNEL
depends on PPC64 && CPU_LITTLE_ENDIAN
def_bool !DISABLE_MPROFILE_KERNEL
-config SWIOTLB
- bool "SWIOTLB support"
- default n
- ---help---
- Support for IO bounce buffering for systems without an IOMMU.
- This allows us to DMA to the full physical address space on
- platforms where the size of a physical address is larger
- than the bus address. Not all platforms support this.
-
config HOTPLUG_CPU
bool "Support for enabling/disabling CPUs"
depends on SMP && (PPC_PSERIES || \
diff --git a/arch/unicore32/mm/Kconfig b/arch/unicore32/mm/Kconfig
index 1d9fed0ada71..82759b6aba67 100644
--- a/arch/unicore32/mm/Kconfig
+++ b/arch/unicore32/mm/Kconfig
@@ -39,8 +39,3 @@ config CPU_TLB_SINGLE_ENTRY_DISABLE
default y
help
Say Y here to disable the TLB single entry operations.
-
-config SWIOTLB
- def_bool y
- select DMA_DIRECT_OPS
- select NEED_SG_DMA_LENGTH
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 07b031f99eb1..7a5fec800992 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -24,6 +24,7 @@ config X86_64
depends on 64BIT
# Options that are inherently 64-bit kernel only:
select ARCH_HAS_GIGANTIC_PAGE if (MEMORY_ISOLATION && COMPACTION) || CMA
+ select ARCH_HAS_SWIOTLB
select ARCH_SUPPORTS_INT128
select ARCH_USE_CMPXCHG_LOCKREF
select HAVE_ARCH_SOFT_DIRTY
@@ -677,6 +678,7 @@ config STA2X11
bool "STA2X11 Companion Chip Support"
depends on X86_32_NON_STANDARD && PCI
select ARCH_HAS_PHYS_TO_DMA
+ select ARCH_HAS_SWIOTLB
select X86_DEV_DMA_OPS
select X86_DMA_REMAP
select SWIOTLB
@@ -916,17 +918,6 @@ config CALGARY_IOMMU_ENABLED_BY_DEFAULT
Calgary anyway, pass 'iommu=calgary' on the kernel command line.
If unsure, say Y.
-# need this always selected by IOMMU for the VIA workaround
-config SWIOTLB
- def_bool y if X86_64
- select NEED_DMA_MAP_STATE
- ---help---
- Support for software bounce buffers used on x86-64 systems
- which don't have a hardware IOMMU. Using this PCI devices
- which can only access 32-bits of memory can be used on systems
- with more than 3 GB of memory.
- If unsure, say Y.
-
config MAXSMP
bool "Enable Maximum number of SMP Processors and NUMA Nodes"
depends on X86_64 && SMP && DEBUG_KERNEL
@@ -1448,6 +1439,7 @@ config HIGHMEM
config X86_PAE
bool "PAE (Physical Address Extension) Support"
depends on X86_32 && !HIGHMEM4G
+ select ARCH_HAS_SWIOTLB
select PHYS_ADDR_T_64BIT
select SWIOTLB
---help---
diff --git a/lib/Kconfig b/lib/Kconfig
index 1f12faf03819..01a37920949c 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -451,6 +451,21 @@ config DMA_VIRT_OPS
depends on HAS_DMA && (!64BIT || ARCH_DMA_ADDR_T_64BIT)
default n
+config ARCH_HAS_SWIOTLB
+ bool
+
+config SWIOTLB
+ bool "SWIOTLB support"
+ default ARCH_HAS_SWIOTLB
+ select DMA_DIRECT_OPS
+ select NEED_DMA_MAP_STATE
+ select NEED_SG_DMA_LENGTH
+ ---help---
+ Support for IO bounce buffering for systems without an IOMMU.
+ This allows us to DMA to the full physical address space on
+ platforms where the size of a physical address is larger
+ than the bus address. If unsure, say Y.
+
config CHECK_SIGNATURE
bool
--
2.17.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 12/12] swiotlb: remove the CONFIG_DMA_DIRECT_OPS ifdefs
2018-04-23 17:04 centralize SWIOTLB config symbol and misc other cleanups V2 Christoph Hellwig
` (10 preceding siblings ...)
2018-04-23 17:04 ` [PATCH 11/12] swiotlb: move the SWIOTLB config symbol to lib/Kconfig Christoph Hellwig
@ 2018-04-23 17:04 ` Christoph Hellwig
11 siblings, 0 replies; 21+ messages in thread
From: Christoph Hellwig @ 2018-04-23 17:04 UTC (permalink / raw)
To: Konrad Rzeszutek Wilk, iommu
Cc: x86, linux-block, linux-pci, linux-mm, linux-mips, sparclinux,
linux-arm-kernel
swiotlb now selects the DMA_DIRECT_OPS config symbol, so this will
always be true.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
lib/swiotlb.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/lib/swiotlb.c b/lib/swiotlb.c
index fece57566d45..6954f7ad200a 100644
--- a/lib/swiotlb.c
+++ b/lib/swiotlb.c
@@ -692,7 +692,6 @@ void swiotlb_tbl_sync_single(struct device *hwdev, phys_addr_t tlb_addr,
}
}
-#ifdef CONFIG_DMA_DIRECT_OPS
static inline bool dma_coherent_ok(struct device *dev, dma_addr_t addr,
size_t size)
{
@@ -764,7 +763,6 @@ static bool swiotlb_free_buffer(struct device *dev, size_t size,
DMA_ATTR_SKIP_CPU_SYNC);
return true;
}
-#endif
static void
swiotlb_full(struct device *dev, size_t size, enum dma_data_direction dir,
@@ -1045,7 +1043,6 @@ swiotlb_dma_supported(struct device *hwdev, u64 mask)
return __phys_to_dma(hwdev, io_tlb_end - 1) <= mask;
}
-#ifdef CONFIG_DMA_DIRECT_OPS
void *swiotlb_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
gfp_t gfp, unsigned long attrs)
{
@@ -1089,4 +1086,3 @@ const struct dma_map_ops swiotlb_dma_ops = {
.unmap_page = swiotlb_unmap_page,
.dma_supported = dma_direct_supported,
};
-#endif /* CONFIG_DMA_DIRECT_OPS */
--
2.17.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH 10/12] arm: don't build swiotlb by default
2018-04-23 17:04 ` [PATCH 10/12] arm: don't build swiotlb by default Christoph Hellwig
@ 2018-04-23 20:09 ` Konrad Rzeszutek Wilk
0 siblings, 0 replies; 21+ messages in thread
From: Konrad Rzeszutek Wilk @ 2018-04-23 20:09 UTC (permalink / raw)
To: Christoph Hellwig, sstabellini
Cc: linux-mips, linux-pci, x86, linux-block, linux-mm, iommu,
sparclinux, linux-arm-kernel
On Mon, Apr 23, 2018 at 07:04:17PM +0200, Christoph Hellwig wrote:
> swiotlb is only used as a library of helper for xen-swiotlb if Xen support
> is enabled on arm, so don't build it by default.
>
CCing Stefano
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> arch/arm/Kconfig | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index aa1c187d756d..90b81a3a28a7 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -1774,7 +1774,7 @@ config SECCOMP
> defined by each seccomp mode.
>
> config SWIOTLB
> - def_bool y
> + bool
>
> config PARAVIRT
> bool "Enable paravirtualization code"
> @@ -1807,6 +1807,7 @@ config XEN
> depends on MMU
> select ARCH_DMA_ADDR_T_64BIT
> select ARM_PSCI
> + select SWIOTLB
> select SWIOTLB_XEN
> select PARAVIRT
> help
> --
> 2.17.0
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 11/12] swiotlb: move the SWIOTLB config symbol to lib/Kconfig
2018-04-23 17:04 ` [PATCH 11/12] swiotlb: move the SWIOTLB config symbol to lib/Kconfig Christoph Hellwig
@ 2018-04-23 20:11 ` Konrad Rzeszutek Wilk
2018-04-23 23:52 ` Russell King - ARM Linux
1 sibling, 0 replies; 21+ messages in thread
From: Konrad Rzeszutek Wilk @ 2018-04-23 20:11 UTC (permalink / raw)
To: Christoph Hellwig, sstabellini
Cc: linux-mips, linux-pci, x86, linux-block, linux-mm, iommu,
sparclinux, linux-arm-kernel
On Mon, Apr 23, 2018 at 07:04:18PM +0200, Christoph Hellwig wrote:
> This way we have one central definition of it, and user can select it as
> needed. Note that we also add a second ARCH_HAS_SWIOTLB symbol to
> indicate the architecture supports swiotlb at all, so that we can still
> make the usage optional for a few architectures that want this feature
> to be user selectable.
If I follow this select business this will enable it on ARM and x86 by default.
As such:
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Thank you!
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> arch/arm/Kconfig | 4 +---
> arch/arm64/Kconfig | 5 ++---
> arch/ia64/Kconfig | 9 +--------
> arch/mips/Kconfig | 3 +++
> arch/mips/cavium-octeon/Kconfig | 5 -----
> arch/mips/loongson64/Kconfig | 8 --------
> arch/powerpc/Kconfig | 9 ---------
> arch/unicore32/mm/Kconfig | 5 -----
> arch/x86/Kconfig | 14 +++-----------
> lib/Kconfig | 15 +++++++++++++++
> 10 files changed, 25 insertions(+), 52 deletions(-)
>
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index 90b81a3a28a7..f91f69174630 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -106,6 +106,7 @@ config ARM
> select REFCOUNT_FULL
> select RTC_LIB
> select SYS_SUPPORTS_APM_EMULATION
> + select ARCH_HAS_SWIOTLB
> # Above selects are sorted alphabetically; please add new ones
> # according to that. Thanks.
> help
> @@ -1773,9 +1774,6 @@ config SECCOMP
> and the task is only allowed to execute a few safe syscalls
> defined by each seccomp mode.
>
> -config SWIOTLB
> - bool
> -
> config PARAVIRT
> bool "Enable paravirtualization code"
> help
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index 4d924eb32e7f..056bc7365adf 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -21,6 +21,7 @@ config ARM64
> select ARCH_HAS_SG_CHAIN
> select ARCH_HAS_STRICT_KERNEL_RWX
> select ARCH_HAS_STRICT_MODULE_RWX
> + select ARCH_HAS_SWIOTLB
> select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
> select ARCH_HAVE_NMI_SAFE_CMPXCHG
> select ARCH_INLINE_READ_LOCK if !PREEMPT
> @@ -144,6 +145,7 @@ config ARM64
> select POWER_SUPPLY
> select REFCOUNT_FULL
> select SPARSE_IRQ
> + select SWIOTLB
> select SYSCTL_EXCEPTION_TRACE
> select THREAD_INFO_IN_TASK
> help
> @@ -239,9 +241,6 @@ config HAVE_GENERIC_GUP
> config SMP
> def_bool y
>
> -config SWIOTLB
> - def_bool y
> -
> config KERNEL_MODE_NEON
> def_bool y
>
> diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
> index 685d557eea48..d396230913e6 100644
> --- a/arch/ia64/Kconfig
> +++ b/arch/ia64/Kconfig
> @@ -56,6 +56,7 @@ config IA64
> select HAVE_ARCH_AUDITSYSCALL
> select NEED_DMA_MAP_STATE
> select NEED_SG_DMA_LENGTH
> + select ARCH_HAS_SWIOTLB
> default y
> help
> The Itanium Processor Family is Intel's 64-bit successor to
> @@ -80,9 +81,6 @@ config MMU
> bool
> default y
>
> -config SWIOTLB
> - bool
> -
> config STACKTRACE_SUPPORT
> def_bool y
>
> @@ -139,7 +137,6 @@ config IA64_GENERIC
> bool "generic"
> select NUMA
> select ACPI_NUMA
> - select DMA_DIRECT_OPS
> select SWIOTLB
> select PCI_MSI
> help
> @@ -160,7 +157,6 @@ config IA64_GENERIC
>
> config IA64_DIG
> bool "DIG-compliant"
> - select DMA_DIRECT_OPS
> select SWIOTLB
>
> config IA64_DIG_VTD
> @@ -176,7 +172,6 @@ config IA64_HP_ZX1
>
> config IA64_HP_ZX1_SWIOTLB
> bool "HP-zx1/sx1000 with software I/O TLB"
> - select DMA_DIRECT_OPS
> select SWIOTLB
> help
> Build a kernel that runs on HP zx1 and sx1000 systems even when they
> @@ -200,7 +195,6 @@ config IA64_SGI_UV
> bool "SGI-UV"
> select NUMA
> select ACPI_NUMA
> - select DMA_DIRECT_OPS
> select SWIOTLB
> help
> Selecting this option will optimize the kernel for use on UV based
> @@ -211,7 +205,6 @@ config IA64_SGI_UV
>
> config IA64_HP_SIM
> bool "Ski-simulator"
> - select DMA_DIRECT_OPS
> select SWIOTLB
> depends on !PM
>
> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> index e10cc5c7be69..b6b4c1e154f8 100644
> --- a/arch/mips/Kconfig
> +++ b/arch/mips/Kconfig
> @@ -912,6 +912,8 @@ config CAVIUM_OCTEON_SOC
> select MIPS_NR_CPU_NR_MAP_1024
> select BUILTIN_DTB
> select MTD_COMPLEX_MAPPINGS
> + select ARCH_HAS_SWIOTLB
> + select SWIOTLB
> select SYS_SUPPORTS_RELOCATABLE
> help
> This option supports all of the Octeon reference boards from Cavium
> @@ -1367,6 +1369,7 @@ config CPU_LOONGSON3
> select MIPS_PGD_C0_CONTEXT
> select MIPS_L1_CACHE_SHIFT_6
> select GPIOLIB
> + select ARCH_HAS_SWIOTLB
> help
> The Loongson 3 processor implements the MIPS64R2 instruction
> set with many extensions.
> diff --git a/arch/mips/cavium-octeon/Kconfig b/arch/mips/cavium-octeon/Kconfig
> index 5d73041547a7..4984e462be30 100644
> --- a/arch/mips/cavium-octeon/Kconfig
> +++ b/arch/mips/cavium-octeon/Kconfig
> @@ -67,11 +67,6 @@ config CAVIUM_OCTEON_LOCK_L2_MEMCPY
> help
> Lock the kernel's implementation of memcpy() into L2.
>
> -config SWIOTLB
> - def_bool y
> - select DMA_DIRECT_OPS
> - select NEED_SG_DMA_LENGTH
> -
> config OCTEON_ILM
> tristate "Module to measure interrupt latency using Octeon CIU Timer"
> help
> diff --git a/arch/mips/loongson64/Kconfig b/arch/mips/loongson64/Kconfig
> index 641a1477031e..c79e6a565572 100644
> --- a/arch/mips/loongson64/Kconfig
> +++ b/arch/mips/loongson64/Kconfig
> @@ -130,14 +130,6 @@ config LOONGSON_UART_BASE
> default y
> depends on EARLY_PRINTK || SERIAL_8250
>
> -config SWIOTLB
> - bool "Soft IOMMU Support for All-Memory DMA"
> - default y
> - depends on CPU_LOONGSON3
> - select DMA_DIRECT_OPS
> - select NEED_SG_DMA_LENGTH
> - select NEED_DMA_MAP_STATE
> -
> config PHYS48_TO_HT40
> bool
> default y if CPU_LOONGSON3
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index a4b2ac7c3d2e..1887f8f86a77 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -474,15 +474,6 @@ config MPROFILE_KERNEL
> depends on PPC64 && CPU_LITTLE_ENDIAN
> def_bool !DISABLE_MPROFILE_KERNEL
>
> -config SWIOTLB
> - bool "SWIOTLB support"
> - default n
> - ---help---
> - Support for IO bounce buffering for systems without an IOMMU.
> - This allows us to DMA to the full physical address space on
> - platforms where the size of a physical address is larger
> - than the bus address. Not all platforms support this.
> -
> config HOTPLUG_CPU
> bool "Support for enabling/disabling CPUs"
> depends on SMP && (PPC_PSERIES || \
> diff --git a/arch/unicore32/mm/Kconfig b/arch/unicore32/mm/Kconfig
> index 1d9fed0ada71..82759b6aba67 100644
> --- a/arch/unicore32/mm/Kconfig
> +++ b/arch/unicore32/mm/Kconfig
> @@ -39,8 +39,3 @@ config CPU_TLB_SINGLE_ENTRY_DISABLE
> default y
> help
> Say Y here to disable the TLB single entry operations.
> -
> -config SWIOTLB
> - def_bool y
> - select DMA_DIRECT_OPS
> - select NEED_SG_DMA_LENGTH
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 07b031f99eb1..7a5fec800992 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -24,6 +24,7 @@ config X86_64
> depends on 64BIT
> # Options that are inherently 64-bit kernel only:
> select ARCH_HAS_GIGANTIC_PAGE if (MEMORY_ISOLATION && COMPACTION) || CMA
> + select ARCH_HAS_SWIOTLB
> select ARCH_SUPPORTS_INT128
> select ARCH_USE_CMPXCHG_LOCKREF
> select HAVE_ARCH_SOFT_DIRTY
> @@ -677,6 +678,7 @@ config STA2X11
> bool "STA2X11 Companion Chip Support"
> depends on X86_32_NON_STANDARD && PCI
> select ARCH_HAS_PHYS_TO_DMA
> + select ARCH_HAS_SWIOTLB
> select X86_DEV_DMA_OPS
> select X86_DMA_REMAP
> select SWIOTLB
> @@ -916,17 +918,6 @@ config CALGARY_IOMMU_ENABLED_BY_DEFAULT
> Calgary anyway, pass 'iommu=calgary' on the kernel command line.
> If unsure, say Y.
>
> -# need this always selected by IOMMU for the VIA workaround
> -config SWIOTLB
> - def_bool y if X86_64
> - select NEED_DMA_MAP_STATE
> - ---help---
> - Support for software bounce buffers used on x86-64 systems
> - which don't have a hardware IOMMU. Using this PCI devices
> - which can only access 32-bits of memory can be used on systems
> - with more than 3 GB of memory.
> - If unsure, say Y.
> -
> config MAXSMP
> bool "Enable Maximum number of SMP Processors and NUMA Nodes"
> depends on X86_64 && SMP && DEBUG_KERNEL
> @@ -1448,6 +1439,7 @@ config HIGHMEM
> config X86_PAE
> bool "PAE (Physical Address Extension) Support"
> depends on X86_32 && !HIGHMEM4G
> + select ARCH_HAS_SWIOTLB
> select PHYS_ADDR_T_64BIT
> select SWIOTLB
> ---help---
> diff --git a/lib/Kconfig b/lib/Kconfig
> index 1f12faf03819..01a37920949c 100644
> --- a/lib/Kconfig
> +++ b/lib/Kconfig
> @@ -451,6 +451,21 @@ config DMA_VIRT_OPS
> depends on HAS_DMA && (!64BIT || ARCH_DMA_ADDR_T_64BIT)
> default n
>
> +config ARCH_HAS_SWIOTLB
> + bool
> +
> +config SWIOTLB
> + bool "SWIOTLB support"
> + default ARCH_HAS_SWIOTLB
> + select DMA_DIRECT_OPS
> + select NEED_DMA_MAP_STATE
> + select NEED_SG_DMA_LENGTH
> + ---help---
> + Support for IO bounce buffering for systems without an IOMMU.
> + This allows us to DMA to the full physical address space on
> + platforms where the size of a physical address is larger
> + than the bus address. If unsure, say Y.
> +
> config CHECK_SIGNATURE
> bool
>
> --
> 2.17.0
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 11/12] swiotlb: move the SWIOTLB config symbol to lib/Kconfig
2018-04-23 17:04 ` [PATCH 11/12] swiotlb: move the SWIOTLB config symbol to lib/Kconfig Christoph Hellwig
2018-04-23 20:11 ` Konrad Rzeszutek Wilk
@ 2018-04-23 23:52 ` Russell King - ARM Linux
2018-04-24 6:55 ` Christoph Hellwig
1 sibling, 1 reply; 21+ messages in thread
From: Russell King - ARM Linux @ 2018-04-23 23:52 UTC (permalink / raw)
To: Christoph Hellwig
Cc: linux-mips, Konrad Rzeszutek Wilk, linux-pci, x86, linux-block,
linux-mm, iommu, sparclinux, linux-arm-kernel
On Mon, Apr 23, 2018 at 07:04:18PM +0200, Christoph Hellwig wrote:
> This way we have one central definition of it, and user can select it as
> needed. Note that we also add a second ARCH_HAS_SWIOTLB symbol to
> indicate the architecture supports swiotlb at all, so that we can still
> make the usage optional for a few architectures that want this feature
> to be user selectable.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Hmm, this looks like we end up with NEED_SG_DMA_LENGTH=y on ARM by
default, which probably isn't a good idea - ARM pre-dates the dma_length
parameter in scatterlists, and I don't think all code is guaranteed to
do the right thing if this is enabled.
For example, arch/arm/mach-rpc/dma.c doesn't use the dma_length
member of struct scatterlist.
--
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up
According to speedtest.net: 8.21Mbps down 510kbps up
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 11/12] swiotlb: move the SWIOTLB config symbol to lib/Kconfig
2018-04-23 23:52 ` Russell King - ARM Linux
@ 2018-04-24 6:55 ` Christoph Hellwig
2018-04-24 7:47 ` Russell King - ARM Linux
0 siblings, 1 reply; 21+ messages in thread
From: Christoph Hellwig @ 2018-04-24 6:55 UTC (permalink / raw)
To: Russell King - ARM Linux
Cc: linux-mips, Konrad Rzeszutek Wilk, linux-pci, x86, linux-block,
linux-mm, iommu, sparclinux, Christoph Hellwig, linux-arm-kernel
On Tue, Apr 24, 2018 at 12:52:05AM +0100, Russell King - ARM Linux wrote:
> On Mon, Apr 23, 2018 at 07:04:18PM +0200, Christoph Hellwig wrote:
> > This way we have one central definition of it, and user can select it as
> > needed. Note that we also add a second ARCH_HAS_SWIOTLB symbol to
> > indicate the architecture supports swiotlb at all, so that we can still
> > make the usage optional for a few architectures that want this feature
> > to be user selectable.
> >
> > Signed-off-by: Christoph Hellwig <hch@lst.de>
>
> Hmm, this looks like we end up with NEED_SG_DMA_LENGTH=y on ARM by
> default, which probably isn't a good idea - ARM pre-dates the dma_length
> parameter in scatterlists, and I don't think all code is guaranteed to
> do the right thing if this is enabled.
We shouldn't end up with NEED_SG_DMA_LENGTH=y on ARM by default.
It is only select by ARM_DMA_USE_IOMMU before the patch, and it will
now also be selected by SWIOTLB, which for arm is never used or seleted
directly by anything but xen-swiotlb.
Then again looking at the series there shouldn't be any need to
even select NEED_SG_DMA_LENGTH for swiotlb, as we'll never merge segments,
so I'll fix that up.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 11/12] swiotlb: move the SWIOTLB config symbol to lib/Kconfig
2018-04-24 6:55 ` Christoph Hellwig
@ 2018-04-24 7:47 ` Russell King - ARM Linux
2018-04-24 7:56 ` Christoph Hellwig
0 siblings, 1 reply; 21+ messages in thread
From: Russell King - ARM Linux @ 2018-04-24 7:47 UTC (permalink / raw)
To: Christoph Hellwig
Cc: linux-mips, Konrad Rzeszutek Wilk, linux-pci, x86, linux-block,
linux-mm, iommu, sparclinux, linux-arm-kernel
On Tue, Apr 24, 2018 at 08:55:49AM +0200, Christoph Hellwig wrote:
> On Tue, Apr 24, 2018 at 12:52:05AM +0100, Russell King - ARM Linux wrote:
> > On Mon, Apr 23, 2018 at 07:04:18PM +0200, Christoph Hellwig wrote:
> > > This way we have one central definition of it, and user can select it as
> > > needed. Note that we also add a second ARCH_HAS_SWIOTLB symbol to
> > > indicate the architecture supports swiotlb at all, so that we can still
> > > make the usage optional for a few architectures that want this feature
> > > to be user selectable.
> > >
> > > Signed-off-by: Christoph Hellwig <hch@lst.de>
> >
> > Hmm, this looks like we end up with NEED_SG_DMA_LENGTH=y on ARM by
> > default, which probably isn't a good idea - ARM pre-dates the dma_length
> > parameter in scatterlists, and I don't think all code is guaranteed to
> > do the right thing if this is enabled.
>
> We shouldn't end up with NEED_SG_DMA_LENGTH=y on ARM by default.
Your patch as sent would end up with:
ARM selects ARCH_HAS_SWIOTLB
SWIOTLB is defaulted to ARCH_HAS_SWIOTLB
SWIOTLB selects NEED_SG_DMA_LENGTH
due to:
@@ -106,6 +106,7 @@ config ARM
select REFCOUNT_FULL
select RTC_LIB
select SYS_SUPPORTS_APM_EMULATION
+ select ARCH_HAS_SWIOTLB
and:
+config SWIOTLB
+ bool "SWIOTLB support"
+ default ARCH_HAS_SWIOTLB
+ select NEED_SG_DMA_LENGTH
Therefore, the default state for SWIOTLB and hence NEED_SG_DMA_LENGTH
becomes 'y' on ARM, and any defconfig file that does not mention SWIOTLB
explicitly ends up with both these enabled.
> It is only select by ARM_DMA_USE_IOMMU before the patch, and it will
> now also be selected by SWIOTLB, which for arm is never used or seleted
> directly by anything but xen-swiotlb.
See above.
> Then again looking at the series there shouldn't be any need to
> even select NEED_SG_DMA_LENGTH for swiotlb, as we'll never merge segments,
> so I'll fix that up.
That would help to avoid any regressions along the lines I've spotted
by review.
It does look a bit weird though - patch 10 arranged stuff so that we
didn't end up with SWIOTLB always enabled, but this patch reintroduces
that with the allowance that the user can disable if so desired.
--
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up
According to speedtest.net: 8.21Mbps down 510kbps up
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 11/12] swiotlb: move the SWIOTLB config symbol to lib/Kconfig
2018-04-24 7:47 ` Russell King - ARM Linux
@ 2018-04-24 7:56 ` Christoph Hellwig
0 siblings, 0 replies; 21+ messages in thread
From: Christoph Hellwig @ 2018-04-24 7:56 UTC (permalink / raw)
To: Russell King - ARM Linux
Cc: linux-mips, Konrad Rzeszutek Wilk, linux-pci, x86, linux-block,
linux-mm, iommu, sparclinux, Christoph Hellwig, linux-arm-kernel
On Tue, Apr 24, 2018 at 08:47:27AM +0100, Russell King - ARM Linux wrote:
> Therefore, the default state for SWIOTLB and hence NEED_SG_DMA_LENGTH
> becomes 'y' on ARM, and any defconfig file that does not mention SWIOTLB
> explicitly ends up with both these enabled.
Indeed, sorry.
> It does look a bit weird though - patch 10 arranged stuff so that we
> didn't end up with SWIOTLB always enabled, but this patch reintroduces
> that with the allowance that the user can disable if so desired.
I am not very happy with that patch, but I have a hard time coming
up with something saner.
Bascially x86_64 and mips/loongson default to SWIOTLB=y but allow to
deselect it, powerpc has it optional without any real dependency
and defaults to n and everyone just selects it otherwise.
I suspect the right thing is to just have it always one for x86_64
and loongson and have a ppc-specific option to enable it on powerpc
so that we can always use select statements. I'll do that for the
next round.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 11/12] swiotlb: move the SWIOTLB config symbol to lib/Kconfig
2018-04-15 14:59 ` [PATCH 11/12] swiotlb: move the SWIOTLB config symbol to lib/Kconfig Christoph Hellwig
@ 2018-04-17 6:10 ` Anshuman Khandual
0 siblings, 0 replies; 21+ messages in thread
From: Anshuman Khandual @ 2018-04-17 6:10 UTC (permalink / raw)
To: Christoph Hellwig, Konrad Rzeszutek Wilk, iommu
Cc: linux-mips, linux-mm, linux-pci, x86, linux-block, linux-ide,
sparclinux, linux-arm-kernel
On 04/15/2018 08:29 PM, Christoph Hellwig wrote:
> This way we have one central definition of it, and user can select it as
> needed. Note that we also add a second ARCH_HAS_SWIOTLB symbol to
> indicate the architecture supports swiotlb at all, so that we can still
> make the usage optional for a few architectures that want this feature
> to be user selectable.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
snip
> +
> +config SWIOTLB
> + bool "SWIOTLB support"
> + default ARCH_HAS_SWIOTLB
> + select DMA_DIRECT_OPS
> + select NEED_DMA_MAP_STATE
> + select NEED_SG_DMA_LENGTH
> + ---help---
> + Support for IO bounce buffering for systems without an IOMMU.
> + This allows us to DMA to the full physical address space on
> + platforms where the size of a physical address is larger
> + than the bus address. If unsure, say Y.
> +
> config CHECK_SIGNATURE
> bool
Pulling DMA_DIRECT_OPS config option by default when SWIOTLB is enabled
makes sense. This option was also needed to be enabled separately even
to use swiotlb_dma_ops.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 11/12] swiotlb: move the SWIOTLB config symbol to lib/Kconfig
2018-04-15 14:59 centralize SWIOTLB config symbol and misc other cleanups Christoph Hellwig
@ 2018-04-15 14:59 ` Christoph Hellwig
2018-04-17 6:10 ` Anshuman Khandual
0 siblings, 1 reply; 21+ messages in thread
From: Christoph Hellwig @ 2018-04-15 14:59 UTC (permalink / raw)
To: Konrad Rzeszutek Wilk, iommu
Cc: x86, linux-block, linux-pci, linux-mm, linux-ide, linux-mips,
sparclinux, linux-arm-kernel
This way we have one central definition of it, and user can select it as
needed. Note that we also add a second ARCH_HAS_SWIOTLB symbol to
indicate the architecture supports swiotlb at all, so that we can still
make the usage optional for a few architectures that want this feature
to be user selectable.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
arch/arm/Kconfig | 4 +---
arch/arm64/Kconfig | 5 ++---
arch/ia64/Kconfig | 9 +--------
arch/mips/Kconfig | 3 +++
arch/mips/cavium-octeon/Kconfig | 5 -----
arch/mips/loongson64/Kconfig | 8 --------
arch/powerpc/Kconfig | 9 ---------
arch/unicore32/mm/Kconfig | 5 -----
arch/x86/Kconfig | 14 +++-----------
lib/Kconfig | 15 +++++++++++++++
10 files changed, 25 insertions(+), 52 deletions(-)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 90b81a3a28a7..f91f69174630 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -106,6 +106,7 @@ config ARM
select REFCOUNT_FULL
select RTC_LIB
select SYS_SUPPORTS_APM_EMULATION
+ select ARCH_HAS_SWIOTLB
# Above selects are sorted alphabetically; please add new ones
# according to that. Thanks.
help
@@ -1773,9 +1774,6 @@ config SECCOMP
and the task is only allowed to execute a few safe syscalls
defined by each seccomp mode.
-config SWIOTLB
- bool
-
config PARAVIRT
bool "Enable paravirtualization code"
help
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 4d924eb32e7f..056bc7365adf 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -21,6 +21,7 @@ config ARM64
select ARCH_HAS_SG_CHAIN
select ARCH_HAS_STRICT_KERNEL_RWX
select ARCH_HAS_STRICT_MODULE_RWX
+ select ARCH_HAS_SWIOTLB
select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
select ARCH_HAVE_NMI_SAFE_CMPXCHG
select ARCH_INLINE_READ_LOCK if !PREEMPT
@@ -144,6 +145,7 @@ config ARM64
select POWER_SUPPLY
select REFCOUNT_FULL
select SPARSE_IRQ
+ select SWIOTLB
select SYSCTL_EXCEPTION_TRACE
select THREAD_INFO_IN_TASK
help
@@ -239,9 +241,6 @@ config HAVE_GENERIC_GUP
config SMP
def_bool y
-config SWIOTLB
- def_bool y
-
config KERNEL_MODE_NEON
def_bool y
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 685d557eea48..d396230913e6 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -56,6 +56,7 @@ config IA64
select HAVE_ARCH_AUDITSYSCALL
select NEED_DMA_MAP_STATE
select NEED_SG_DMA_LENGTH
+ select ARCH_HAS_SWIOTLB
default y
help
The Itanium Processor Family is Intel's 64-bit successor to
@@ -80,9 +81,6 @@ config MMU
bool
default y
-config SWIOTLB
- bool
-
config STACKTRACE_SUPPORT
def_bool y
@@ -139,7 +137,6 @@ config IA64_GENERIC
bool "generic"
select NUMA
select ACPI_NUMA
- select DMA_DIRECT_OPS
select SWIOTLB
select PCI_MSI
help
@@ -160,7 +157,6 @@ config IA64_GENERIC
config IA64_DIG
bool "DIG-compliant"
- select DMA_DIRECT_OPS
select SWIOTLB
config IA64_DIG_VTD
@@ -176,7 +172,6 @@ config IA64_HP_ZX1
config IA64_HP_ZX1_SWIOTLB
bool "HP-zx1/sx1000 with software I/O TLB"
- select DMA_DIRECT_OPS
select SWIOTLB
help
Build a kernel that runs on HP zx1 and sx1000 systems even when they
@@ -200,7 +195,6 @@ config IA64_SGI_UV
bool "SGI-UV"
select NUMA
select ACPI_NUMA
- select DMA_DIRECT_OPS
select SWIOTLB
help
Selecting this option will optimize the kernel for use on UV based
@@ -211,7 +205,6 @@ config IA64_SGI_UV
config IA64_HP_SIM
bool "Ski-simulator"
- select DMA_DIRECT_OPS
select SWIOTLB
depends on !PM
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index e10cc5c7be69..b6b4c1e154f8 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -912,6 +912,8 @@ config CAVIUM_OCTEON_SOC
select MIPS_NR_CPU_NR_MAP_1024
select BUILTIN_DTB
select MTD_COMPLEX_MAPPINGS
+ select ARCH_HAS_SWIOTLB
+ select SWIOTLB
select SYS_SUPPORTS_RELOCATABLE
help
This option supports all of the Octeon reference boards from Cavium
@@ -1367,6 +1369,7 @@ config CPU_LOONGSON3
select MIPS_PGD_C0_CONTEXT
select MIPS_L1_CACHE_SHIFT_6
select GPIOLIB
+ select ARCH_HAS_SWIOTLB
help
The Loongson 3 processor implements the MIPS64R2 instruction
set with many extensions.
diff --git a/arch/mips/cavium-octeon/Kconfig b/arch/mips/cavium-octeon/Kconfig
index 5d73041547a7..4984e462be30 100644
--- a/arch/mips/cavium-octeon/Kconfig
+++ b/arch/mips/cavium-octeon/Kconfig
@@ -67,11 +67,6 @@ config CAVIUM_OCTEON_LOCK_L2_MEMCPY
help
Lock the kernel's implementation of memcpy() into L2.
-config SWIOTLB
- def_bool y
- select DMA_DIRECT_OPS
- select NEED_SG_DMA_LENGTH
-
config OCTEON_ILM
tristate "Module to measure interrupt latency using Octeon CIU Timer"
help
diff --git a/arch/mips/loongson64/Kconfig b/arch/mips/loongson64/Kconfig
index 641a1477031e..c79e6a565572 100644
--- a/arch/mips/loongson64/Kconfig
+++ b/arch/mips/loongson64/Kconfig
@@ -130,14 +130,6 @@ config LOONGSON_UART_BASE
default y
depends on EARLY_PRINTK || SERIAL_8250
-config SWIOTLB
- bool "Soft IOMMU Support for All-Memory DMA"
- default y
- depends on CPU_LOONGSON3
- select DMA_DIRECT_OPS
- select NEED_SG_DMA_LENGTH
- select NEED_DMA_MAP_STATE
-
config PHYS48_TO_HT40
bool
default y if CPU_LOONGSON3
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index b85a537421b8..beb28153fcb2 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -474,15 +474,6 @@ config MPROFILE_KERNEL
depends on PPC64 && CPU_LITTLE_ENDIAN
def_bool !DISABLE_MPROFILE_KERNEL
-config SWIOTLB
- bool "SWIOTLB support"
- default n
- ---help---
- Support for IO bounce buffering for systems without an IOMMU.
- This allows us to DMA to the full physical address space on
- platforms where the size of a physical address is larger
- than the bus address. Not all platforms support this.
-
config HOTPLUG_CPU
bool "Support for enabling/disabling CPUs"
depends on SMP && (PPC_PSERIES || \
diff --git a/arch/unicore32/mm/Kconfig b/arch/unicore32/mm/Kconfig
index 1d9fed0ada71..82759b6aba67 100644
--- a/arch/unicore32/mm/Kconfig
+++ b/arch/unicore32/mm/Kconfig
@@ -39,8 +39,3 @@ config CPU_TLB_SINGLE_ENTRY_DISABLE
default y
help
Say Y here to disable the TLB single entry operations.
-
-config SWIOTLB
- def_bool y
- select DMA_DIRECT_OPS
- select NEED_SG_DMA_LENGTH
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index a95eb9ef3311..063bef5f830f 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -24,6 +24,7 @@ config X86_64
depends on 64BIT
# Options that are inherently 64-bit kernel only:
select ARCH_HAS_GIGANTIC_PAGE if (MEMORY_ISOLATION && COMPACTION) || CMA
+ select ARCH_HAS_SWIOTLB
select ARCH_SUPPORTS_INT128
select ARCH_USE_CMPXCHG_LOCKREF
select HAVE_ARCH_SOFT_DIRTY
@@ -676,6 +677,7 @@ config STA2X11
bool "STA2X11 Companion Chip Support"
depends on X86_32_NON_STANDARD && PCI
select ARCH_HAS_PHYS_TO_DMA
+ select ARCH_HAS_SWIOTLB
select X86_DEV_DMA_OPS
select X86_DMA_REMAP
select SWIOTLB
@@ -915,17 +917,6 @@ config CALGARY_IOMMU_ENABLED_BY_DEFAULT
Calgary anyway, pass 'iommu=calgary' on the kernel command line.
If unsure, say Y.
-# need this always selected by IOMMU for the VIA workaround
-config SWIOTLB
- def_bool y if X86_64
- select NEED_DMA_MAP_STATE
- ---help---
- Support for software bounce buffers used on x86-64 systems
- which don't have a hardware IOMMU. Using this PCI devices
- which can only access 32-bits of memory can be used on systems
- with more than 3 GB of memory.
- If unsure, say Y.
-
config MAXSMP
bool "Enable Maximum number of SMP Processors and NUMA Nodes"
depends on X86_64 && SMP && DEBUG_KERNEL
@@ -1447,6 +1438,7 @@ config HIGHMEM
config X86_PAE
bool "PAE (Physical Address Extension) Support"
depends on X86_32 && !HIGHMEM4G
+ select ARCH_HAS_SWIOTLB
select PHYS_ADDR_T_64BIT
select SWIOTLB
---help---
diff --git a/lib/Kconfig b/lib/Kconfig
index 1f12faf03819..01a37920949c 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -451,6 +451,21 @@ config DMA_VIRT_OPS
depends on HAS_DMA && (!64BIT || ARCH_DMA_ADDR_T_64BIT)
default n
+config ARCH_HAS_SWIOTLB
+ bool
+
+config SWIOTLB
+ bool "SWIOTLB support"
+ default ARCH_HAS_SWIOTLB
+ select DMA_DIRECT_OPS
+ select NEED_DMA_MAP_STATE
+ select NEED_SG_DMA_LENGTH
+ ---help---
+ Support for IO bounce buffering for systems without an IOMMU.
+ This allows us to DMA to the full physical address space on
+ platforms where the size of a physical address is larger
+ than the bus address. If unsure, say Y.
+
config CHECK_SIGNATURE
bool
--
2.17.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
end of thread, other threads:[~2018-04-24 7:56 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-23 17:04 centralize SWIOTLB config symbol and misc other cleanups V2 Christoph Hellwig
2018-04-23 17:04 ` [PATCH 01/12] iommu-common: move to arch/sparc Christoph Hellwig
2018-04-23 17:04 ` [PATCH 02/12] iommu-helper: unexport iommu_area_alloc Christoph Hellwig
2018-04-23 17:04 ` [PATCH 03/12] iommu-helper: mark iommu_is_span_boundary as inline Christoph Hellwig
2018-04-23 17:04 ` [PATCH 04/12] iommu-helper: move the IOMMU_HELPER config symbol to lib/ Christoph Hellwig
2018-04-23 17:04 ` [PATCH 05/12] scatterlist: move the NEED_SG_DMA_LENGTH config symbol to lib/Kconfig Christoph Hellwig
2018-04-23 17:04 ` [PATCH 06/12] dma-mapping: move the NEED_DMA_MAP_STATE " Christoph Hellwig
2018-04-23 17:04 ` [PATCH 07/12] arch: remove the ARCH_PHYS_ADDR_T_64BIT config symbol Christoph Hellwig
2018-04-23 17:04 ` [PATCH 08/12] arch: define the ARCH_DMA_ADDR_T_64BIT config symbol in lib/Kconfig Christoph Hellwig
2018-04-23 17:04 ` [PATCH 09/12] PCI: remove CONFIG_PCI_BUS_ADDR_T_64BIT Christoph Hellwig
2018-04-23 17:04 ` [PATCH 10/12] arm: don't build swiotlb by default Christoph Hellwig
2018-04-23 20:09 ` Konrad Rzeszutek Wilk
2018-04-23 17:04 ` [PATCH 11/12] swiotlb: move the SWIOTLB config symbol to lib/Kconfig Christoph Hellwig
2018-04-23 20:11 ` Konrad Rzeszutek Wilk
2018-04-23 23:52 ` Russell King - ARM Linux
2018-04-24 6:55 ` Christoph Hellwig
2018-04-24 7:47 ` Russell King - ARM Linux
2018-04-24 7:56 ` Christoph Hellwig
2018-04-23 17:04 ` [PATCH 12/12] swiotlb: remove the CONFIG_DMA_DIRECT_OPS ifdefs Christoph Hellwig
-- strict thread matches above, loose matches on Subject: below --
2018-04-15 14:59 centralize SWIOTLB config symbol and misc other cleanups Christoph Hellwig
2018-04-15 14:59 ` [PATCH 11/12] swiotlb: move the SWIOTLB config symbol to lib/Kconfig Christoph Hellwig
2018-04-17 6:10 ` Anshuman Khandual
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).