OSDN Git Service

iommu-helper: mark iommu_is_span_boundary as inline
authorChristoph Hellwig <hch@lst.de>
Tue, 3 Apr 2018 13:41:07 +0000 (15:41 +0200)
committerChristoph Hellwig <hch@lst.de>
Wed, 9 May 2018 04:55:44 +0000 (06:55 +0200)
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>
13 files changed:
arch/alpha/Kconfig
arch/arm/Kconfig
arch/arm64/Kconfig
arch/ia64/Kconfig
arch/mips/cavium-octeon/Kconfig
arch/mips/loongson64/Kconfig
arch/mips/netlogic/Kconfig
arch/powerpc/Kconfig
arch/unicore32/mm/Kconfig
arch/x86/Kconfig
drivers/parisc/Kconfig
include/linux/iommu-helper.h
lib/iommu-helper.c

index b202288..3ff735a 100644 (file)
@@ -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
index c723d3e..6bbf7b9 100644 (file)
@@ -1780,9 +1780,6 @@ config SECCOMP
 config SWIOTLB
        def_bool y
 
-config IOMMU_HELPER
-       def_bool SWIOTLB
-
 config PARAVIRT
        bool "Enable paravirtualization code"
        help
index 2005e4b..a553deb 100644 (file)
@@ -251,9 +251,6 @@ config SMP
 config SWIOTLB
        def_bool y
 
-config IOMMU_HELPER
-       def_bool SWIOTLB
-
 config KERNEL_MODE_NEON
        def_bool y
 
index f55aec9..ec2a397 100644 (file)
@@ -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)
index b5eee1a..647ed15 100644 (file)
@@ -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
index 72af0c1..5efb2e6 100644 (file)
@@ -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
 
index 7fcfc7f..5c5ee0e 100644 (file)
@@ -83,9 +83,6 @@ endif
 config NLM_COMMON
        bool
 
-config IOMMU_HELPER
-       bool
-
 config NEED_SG_DMA_LENGTH
        bool
 
index d81e0d4..5cf611f 100644 (file)
@@ -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
index e9154a5..3f105e0 100644 (file)
@@ -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
 
index 13bf2c7..a43f21e 100644 (file)
@@ -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"
index 3a102a8..5a48b56 100644 (file)
@@ -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
index cb9a924..70d01ed 100644 (file)
@@ -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,
index ded1703..92a9f24 100644 (file)
@@ -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,