diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig index b2022885ced8ab05f9f1837b2c6cfde62f37a249..3ff735a722afd7db3b25b78855b202f3396ab631 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 c723d3e375e8c29d7e65e844eeee13e52d64f706..6bbf7b928b4fb914c09606077d9421b7bd15cf9c 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1780,9 +1780,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 2005e4baaada0fed91ceab42f7f375ae274a1a04..a553deb60fc292851b699bbaa5d67ee3edcd853d 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -251,9 +251,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 f55aec969cfa4f2babba04040a19fb3631eb629f..ec2a39741f910e8d7a234ca7aec64ae0890154c1 100644 --- a/arch/ia64/Kconfig +++ b/arch/ia64/Kconfig @@ -612,6 +612,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 b5eee1a57d6cf78120162896fffe6db9936e1440..647ed158ac9889c84f5f55795419022230963d2f 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 72af0c18396983df62327d5a4dcf000bf557d326..5efb2e63878ef4e6a26084ecc3a1007a182d682d 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 7fcfc7fe9f1410b24bb0696888c101c6300f45ef..5c5ee0e05a17df075924c66416cb9721e8658282 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 d81e0d4f1f68400daa1c97c5d19bd8bb2b54ba01..5cf611f799be9cc92607bcbeb7f5c87e6df4b01f 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -483,7 +483,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 e9154a59d56127227caf14973a50d3f72a384178..3f105e00c432847976c7c3c8696bcc8623306946 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 13bf2c7275249a162a34298cd01be168921645c1..a43f21e7cfc540e3f1ec268b982670d202c2cd23 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -934,7 +934,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 3a102a84d637e7fecb7c8e81b8cb3c4d64d3cbfe..5a48b56061106790cb4933fb56d3a772332739eb 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 cb9a9248c8c0c52656b8976293d0689349fee8c0..70d01edcbf8becdfa2d633722841f7729d957f83 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 #include 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 ded1703e7e6425d7ee186e7c04695d270eb1609f..92a9f243c0e25d79eb002ea77de8015b0a917090 100644 --- a/lib/iommu-helper.c +++ b/lib/iommu-helper.c @@ -4,17 +4,7 @@ */ #include -#include - -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 unsigned long iommu_area_alloc(unsigned long *map, unsigned long size, unsigned long start, unsigned int nr,