summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2018-04-03 09:41:07 -0400
committerChristoph Hellwig <hch@lst.de>2018-05-09 00:55:44 -0400
commit79c1879ee5473e3404469b07f9bccfe6d0814b93 (patch)
tree7dfd4e224cd8bf1e4790ba8505fd25569f019155
parent33782714dc53cfb9b8b02e852f3d239e5820cf42 (diff)
iommu-helper: mark iommu_is_span_boundary as inline
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>
-rw-r--r--arch/alpha/Kconfig3
-rw-r--r--arch/arm/Kconfig3
-rw-r--r--arch/arm64/Kconfig3
-rw-r--r--arch/ia64/Kconfig3
-rw-r--r--arch/mips/cavium-octeon/Kconfig4
-rw-r--r--arch/mips/loongson64/Kconfig4
-rw-r--r--arch/mips/netlogic/Kconfig3
-rw-r--r--arch/powerpc/Kconfig1
-rw-r--r--arch/unicore32/mm/Kconfig3
-rw-r--r--arch/x86/Kconfig2
-rw-r--r--drivers/parisc/Kconfig5
-rw-r--r--include/linux/iommu-helper.h13
-rw-r--r--lib/iommu-helper.c12
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
345config PCI_SYSCALL 345config PCI_SYSCALL
346 def_bool PCI 346 def_bool PCI
347 347
348config IOMMU_HELPER
349 def_bool PCI
350
351config ALPHA_NONAME 348config ALPHA_NONAME
352 bool 349 bool
353 depends on ALPHA_BOOK1 || ALPHA_NONAME_CH 350 depends on ALPHA_BOOK1 || ALPHA_NONAME_CH
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index c723d3e375e8..6bbf7b928b4f 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1780,9 +1780,6 @@ config SECCOMP
1780config SWIOTLB 1780config SWIOTLB
1781 def_bool y 1781 def_bool y
1782 1782
1783config IOMMU_HELPER
1784 def_bool SWIOTLB
1785
1786config PARAVIRT 1783config PARAVIRT
1787 bool "Enable paravirtualization code" 1784 bool "Enable paravirtualization code"
1788 help 1785 help
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 2005e4baaada..a553deb60fc2 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -251,9 +251,6 @@ config SMP
251config SWIOTLB 251config SWIOTLB
252 def_bool y 252 def_bool y
253 253
254config IOMMU_HELPER
255 def_bool SWIOTLB
256
257config KERNEL_MODE_NEON 254config KERNEL_MODE_NEON
258 def_bool y 255 def_bool y
259 256
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index f55aec969cfa..ec2a39741f91 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -612,6 +612,3 @@ source "security/Kconfig"
612source "crypto/Kconfig" 612source "crypto/Kconfig"
613 613
614source "lib/Kconfig" 614source "lib/Kconfig"
615
616config IOMMU_HELPER
617 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
67 help 67 help
68 Lock the kernel's implementation of memcpy() into L2. 68 Lock the kernel's implementation of memcpy() into L2.
69 69
70config IOMMU_HELPER
71 bool
72
73config NEED_SG_DMA_LENGTH 70config NEED_SG_DMA_LENGTH
74 bool 71 bool
75 72
76config SWIOTLB 73config SWIOTLB
77 def_bool y 74 def_bool y
78 select DMA_DIRECT_OPS 75 select DMA_DIRECT_OPS
79 select IOMMU_HELPER
80 select NEED_SG_DMA_LENGTH 76 select NEED_SG_DMA_LENGTH
81 77
82config OCTEON_ILM 78config 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
130 default y 130 default y
131 depends on EARLY_PRINTK || SERIAL_8250 131 depends on EARLY_PRINTK || SERIAL_8250
132 132
133config IOMMU_HELPER
134 bool
135
136config NEED_SG_DMA_LENGTH 133config NEED_SG_DMA_LENGTH
137 bool 134 bool
138 135
@@ -141,7 +138,6 @@ config SWIOTLB
141 default y 138 default y
142 depends on CPU_LOONGSON3 139 depends on CPU_LOONGSON3
143 select DMA_DIRECT_OPS 140 select DMA_DIRECT_OPS
144 select IOMMU_HELPER
145 select NEED_SG_DMA_LENGTH 141 select NEED_SG_DMA_LENGTH
146 select NEED_DMA_MAP_STATE 142 select NEED_DMA_MAP_STATE
147 143
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
83config NLM_COMMON 83config NLM_COMMON
84 bool 84 bool
85 85
86config IOMMU_HELPER
87 bool
88
89config NEED_SG_DMA_LENGTH 86config NEED_SG_DMA_LENGTH
90 bool 87 bool
91 88
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index d81e0d4f1f68..5cf611f799be 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -483,7 +483,6 @@ config IOMMU_HELPER
483config SWIOTLB 483config SWIOTLB
484 bool "SWIOTLB support" 484 bool "SWIOTLB support"
485 default n 485 default n
486 select IOMMU_HELPER
487 ---help--- 486 ---help---
488 Support for IO bounce buffering for systems without an IOMMU. 487 Support for IO bounce buffering for systems without an IOMMU.
489 This allows us to DMA to the full physical address space on 488 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
44 def_bool y 44 def_bool y
45 select DMA_DIRECT_OPS 45 select DMA_DIRECT_OPS
46 46
47config IOMMU_HELPER
48 def_bool SWIOTLB
49
50config NEED_SG_DMA_LENGTH 47config NEED_SG_DMA_LENGTH
51 def_bool SWIOTLB 48 def_bool SWIOTLB
52 49
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 13bf2c727524..a43f21e7cfc5 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -934,7 +934,7 @@ config SWIOTLB
934 934
935config IOMMU_HELPER 935config IOMMU_HELPER
936 def_bool y 936 def_bool y
937 depends on CALGARY_IOMMU || GART_IOMMU || SWIOTLB || AMD_IOMMU 937 depends on CALGARY_IOMMU || GART_IOMMU
938 938
939config MAXSMP 939config MAXSMP
940 bool "Enable Maximum number of SMP Processors and NUMA Nodes" 940 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
103 depends on PCI_LBA 103 depends on PCI_LBA
104 default PCI_LBA 104 default PCI_LBA
105 105
106config IOMMU_HELPER
107 bool
108 depends on IOMMU_SBA || IOMMU_CCIO
109 default y
110
111source "drivers/pcmcia/Kconfig" 106source "drivers/pcmcia/Kconfig"
112 107
113endmenu 108endmenu
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 @@
2#ifndef _LINUX_IOMMU_HELPER_H 2#ifndef _LINUX_IOMMU_HELPER_H
3#define _LINUX_IOMMU_HELPER_H 3#define _LINUX_IOMMU_HELPER_H
4 4
5#include <linux/bug.h>
5#include <linux/kernel.h> 6#include <linux/kernel.h>
6 7
7static inline unsigned long iommu_device_max_index(unsigned long size, 8static 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,
14 return size; 15 return size;
15} 16}
16 17
17extern int iommu_is_span_boundary(unsigned int index, unsigned int nr, 18static inline int iommu_is_span_boundary(unsigned int index, unsigned int nr,
18 unsigned long shift, 19 unsigned long shift, unsigned long boundary_size)
19 unsigned long boundary_size); 20{
21 BUG_ON(!is_power_of_2(boundary_size));
22
23 shift = (shift + index) & (boundary_size - 1);
24 return shift + nr > boundary_size;
25}
26
20extern unsigned long iommu_area_alloc(unsigned long *map, unsigned long size, 27extern unsigned long iommu_area_alloc(unsigned long *map, unsigned long size,
21 unsigned long start, unsigned int nr, 28 unsigned long start, unsigned int nr,
22 unsigned long shift, 29 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 @@
4 */ 4 */
5 5
6#include <linux/bitmap.h> 6#include <linux/bitmap.h>
7#include <linux/bug.h> 7#include <linux/iommu-helper.h>
8
9int iommu_is_span_boundary(unsigned int index, unsigned int nr,
10 unsigned long shift,
11 unsigned long boundary_size)
12{
13 BUG_ON(!is_power_of_2(boundary_size));
14
15 shift = (shift + index) & (boundary_size - 1);
16 return shift + nr > boundary_size;
17}
18 8
19unsigned long iommu_area_alloc(unsigned long *map, unsigned long size, 9unsigned long iommu_area_alloc(unsigned long *map, unsigned long size,
20 unsigned long start, unsigned int nr, 10 unsigned long start, unsigned int nr,