From: Christoph Hellwig <hch@lst.de>
To: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
iommu@lists.linux-foundation.org
Cc: sstabellini@kernel.org, x86@kernel.org,
linux-pci@vger.kernel.org, linux-mm@kvack.org,
linux-mips@linux-mips.org, sparclinux@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: [PATCH 03/13] iommu-helper: mark iommu_is_span_boundary as inline
Date: Wed, 25 Apr 2018 07:15:29 +0200 [thread overview]
Message-ID: <20180425051539.1989-4-hch@lst.de> (raw)
In-Reply-To: <20180425051539.1989-1-hch@lst.de>
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
next prev parent reply other threads:[~2018-04-25 5:16 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-25 5:15 centralize SWIOTLB config symbol and misc other cleanups V3 Christoph Hellwig
2018-04-25 5:15 ` [PATCH 01/13] iommu-common: move to arch/sparc Christoph Hellwig
2018-04-25 14:58 ` David Miller
2018-04-25 5:15 ` [PATCH 02/13] iommu-helper: unexport iommu_area_alloc Christoph Hellwig
2018-04-25 5:15 ` Christoph Hellwig [this message]
2018-04-25 5:15 ` [PATCH 04/13] iommu-helper: move the IOMMU_HELPER config symbol to lib/ Christoph Hellwig
2018-04-25 5:15 ` [PATCH 05/13] scatterlist: move the NEED_SG_DMA_LENGTH config symbol to lib/Kconfig Christoph Hellwig
2018-04-25 5:15 ` [PATCH 06/13] dma-mapping: move the NEED_DMA_MAP_STATE " Christoph Hellwig
2018-04-25 5:15 ` [PATCH 07/13] arch: remove the ARCH_PHYS_ADDR_T_64BIT config symbol Christoph Hellwig
2018-05-02 20:11 ` James Hogan
2018-04-25 5:15 ` [PATCH 08/13] arch: define the ARCH_DMA_ADDR_T_64BIT config symbol in lib/Kconfig Christoph Hellwig
2018-05-02 22:09 ` James Hogan
2018-04-25 5:15 ` [PATCH 09/13] PCI: remove CONFIG_PCI_BUS_ADDR_T_64BIT Christoph Hellwig
2018-04-25 5:15 ` [PATCH 10/13] arm: don't build swiotlb by default Christoph Hellwig
2018-04-25 5:15 ` [PATCH 11/13] mips,unicore32: swiotlb doesn't need sg->dma_length Christoph Hellwig
2018-05-02 22:20 ` James Hogan
2018-05-03 3:56 ` Christoph Hellwig
2018-05-03 6:47 ` James Hogan
2018-04-25 5:15 ` [PATCH 12/13] swiotlb: move the SWIOTLB config symbol to lib/Kconfig Christoph Hellwig
2018-04-25 5:15 ` [PATCH 13/13] swiotlb: remove the CONFIG_DMA_DIRECT_OPS ifdefs Christoph Hellwig
2018-05-02 12:46 ` centralize SWIOTLB config symbol and misc other cleanups V3 Christoph Hellwig
2018-05-09 5:03 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180425051539.1989-4-hch@lst.de \
--to=hch@lst.de \
--cc=iommu@lists.linux-foundation.org \
--cc=konrad.wilk@oracle.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mips@linux-mips.org \
--cc=linux-mm@kvack.org \
--cc=linux-pci@vger.kernel.org \
--cc=sparclinux@vger.kernel.org \
--cc=sstabellini@kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).