diff options
author | Christoph Hellwig <hch@lst.de> | 2018-04-03 09:41:07 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2018-05-09 00:55:44 -0400 |
commit | 79c1879ee5473e3404469b07f9bccfe6d0814b93 (patch) | |
tree | 7dfd4e224cd8bf1e4790ba8505fd25569f019155 | |
parent | 33782714dc53cfb9b8b02e852f3d239e5820cf42 (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/Kconfig | 3 | ||||
-rw-r--r-- | arch/arm/Kconfig | 3 | ||||
-rw-r--r-- | arch/arm64/Kconfig | 3 | ||||
-rw-r--r-- | arch/ia64/Kconfig | 3 | ||||
-rw-r--r-- | arch/mips/cavium-octeon/Kconfig | 4 | ||||
-rw-r--r-- | arch/mips/loongson64/Kconfig | 4 | ||||
-rw-r--r-- | arch/mips/netlogic/Kconfig | 3 | ||||
-rw-r--r-- | arch/powerpc/Kconfig | 1 | ||||
-rw-r--r-- | arch/unicore32/mm/Kconfig | 3 | ||||
-rw-r--r-- | arch/x86/Kconfig | 2 | ||||
-rw-r--r-- | drivers/parisc/Kconfig | 5 | ||||
-rw-r--r-- | include/linux/iommu-helper.h | 13 | ||||
-rw-r--r-- | 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 | |||
345 | config PCI_SYSCALL | 345 | config PCI_SYSCALL |
346 | def_bool PCI | 346 | def_bool PCI |
347 | 347 | ||
348 | config IOMMU_HELPER | ||
349 | def_bool PCI | ||
350 | |||
351 | config ALPHA_NONAME | 348 | config 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 | |||
1780 | config SWIOTLB | 1780 | config SWIOTLB |
1781 | def_bool y | 1781 | def_bool y |
1782 | 1782 | ||
1783 | config IOMMU_HELPER | ||
1784 | def_bool SWIOTLB | ||
1785 | |||
1786 | config PARAVIRT | 1783 | config 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 | |||
251 | config SWIOTLB | 251 | config SWIOTLB |
252 | def_bool y | 252 | def_bool y |
253 | 253 | ||
254 | config IOMMU_HELPER | ||
255 | def_bool SWIOTLB | ||
256 | |||
257 | config KERNEL_MODE_NEON | 254 | config 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" | |||
612 | source "crypto/Kconfig" | 612 | source "crypto/Kconfig" |
613 | 613 | ||
614 | source "lib/Kconfig" | 614 | source "lib/Kconfig" |
615 | |||
616 | config 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 | ||
70 | config IOMMU_HELPER | ||
71 | bool | ||
72 | |||
73 | config NEED_SG_DMA_LENGTH | 70 | config NEED_SG_DMA_LENGTH |
74 | bool | 71 | bool |
75 | 72 | ||
76 | config SWIOTLB | 73 | config 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 | ||
82 | config OCTEON_ILM | 78 | 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 | |||
130 | default y | 130 | default y |
131 | depends on EARLY_PRINTK || SERIAL_8250 | 131 | depends on EARLY_PRINTK || SERIAL_8250 |
132 | 132 | ||
133 | config IOMMU_HELPER | ||
134 | bool | ||
135 | |||
136 | config NEED_SG_DMA_LENGTH | 133 | config 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 | |||
83 | config NLM_COMMON | 83 | config NLM_COMMON |
84 | bool | 84 | bool |
85 | 85 | ||
86 | config IOMMU_HELPER | ||
87 | bool | ||
88 | |||
89 | config NEED_SG_DMA_LENGTH | 86 | config 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 | |||
483 | config SWIOTLB | 483 | config 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 | ||
47 | config IOMMU_HELPER | ||
48 | def_bool SWIOTLB | ||
49 | |||
50 | config NEED_SG_DMA_LENGTH | 47 | config 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 | ||
935 | config IOMMU_HELPER | 935 | config 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 | ||
939 | config MAXSMP | 939 | config 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 | ||
106 | config IOMMU_HELPER | ||
107 | bool | ||
108 | depends on IOMMU_SBA || IOMMU_CCIO | ||
109 | default y | ||
110 | |||
111 | source "drivers/pcmcia/Kconfig" | 106 | source "drivers/pcmcia/Kconfig" |
112 | 107 | ||
113 | endmenu | 108 | 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 @@ | |||
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 | ||
7 | static inline unsigned long iommu_device_max_index(unsigned long size, | 8 | 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, | |||
14 | return size; | 15 | return size; |
15 | } | 16 | } |
16 | 17 | ||
17 | extern int iommu_is_span_boundary(unsigned int index, unsigned int nr, | 18 | static 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 | |||
20 | extern unsigned long iommu_area_alloc(unsigned long *map, unsigned long size, | 27 | extern 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 | |||
9 | int 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 | ||
19 | unsigned long iommu_area_alloc(unsigned long *map, unsigned long size, | 9 | unsigned long iommu_area_alloc(unsigned long *map, unsigned long size, |
20 | unsigned long start, unsigned int nr, | 10 | unsigned long start, unsigned int nr, |