linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iommu-common: only compile lib/iommu_common.c for Sparc64
@ 2015-09-17  8:40 Andre Przywara
  2015-09-17 18:38 ` David Miller
  0 siblings, 1 reply; 11+ messages in thread
From: Andre Przywara @ 2015-09-17  8:40 UTC (permalink / raw)
  To: linux-arm-kernel

Though the file lib/iommu_common.c resides in a common directory, the
code in there is actually only used by Sparc(64).
The recent change of DMA_ERROR_CODE in the ARM tree now generates a
compiler warning when compiled with LPAE support (where dma_addr_t is
u64, but unsigned long is still u32):
*********
In file included from /src/linux/include/linux/dma-mapping.h:86:0,
                 from /src/linux/lib/iommu-common.c:11:
/src/linux/lib/iommu-common.c: In function 'iommu_tbl_range_alloc':
/src/linux/arch/arm/include/asm/dma-mapping.h:16:24: warning: large
integer implicitly truncated to unsigned type [-Woverflow]
 #define DMA_ERROR_CODE (~(dma_addr_t)0x0)
                        ^
/src/linux/lib/iommu-common.c:127:10: note: in expansion of macro
'DMA_ERROR_CODE'
   return DMA_ERROR_CODE;
          ^
*********

It seems the types used in this file are not really correct, but a
fix isn't trivial.
So for the time being restrict this code to be compiled only when we
actually need it.
Compile tested on Sparc, Sparc64, PPC64, ARM, ARM64, x86.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
---
 arch/sparc/Kconfig | 3 +++
 lib/Makefile       | 3 ++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 56442d2..1cedb7e 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -93,6 +93,9 @@ config IOMMU_HELPER
 	bool
 	default y if SPARC64
 
+config IOMMU_TBL_HELPER
+	def_bool y if IOMMU_HELPER
+
 config STACKTRACE_SUPPORT
 	bool
 	default y if SPARC64
diff --git a/lib/Makefile b/lib/Makefile
index 13a7c6a..82944a1 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -113,7 +113,8 @@ obj-$(CONFIG_AUDIT_GENERIC) += audit.o
 obj-$(CONFIG_AUDIT_COMPAT_GENERIC) += compat_audit.o
 
 obj-$(CONFIG_SWIOTLB) += swiotlb.o
-obj-$(CONFIG_IOMMU_HELPER) += iommu-helper.o iommu-common.o
+obj-$(CONFIG_IOMMU_HELPER) += iommu-helper.o
+obj-$(CONFIG_IOMMU_TBL_HELPER) += iommu-common.o
 obj-$(CONFIG_FAULT_INJECTION) += fault-inject.o
 obj-$(CONFIG_NOTIFIER_ERROR_INJECTION) += notifier-error-inject.o
 obj-$(CONFIG_CPU_NOTIFIER_ERROR_INJECT) += cpu-notifier-error-inject.o
-- 
2.5.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2015-11-04 16:38 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-17  8:40 [PATCH] iommu-common: only compile lib/iommu_common.c for Sparc64 Andre Przywara
2015-09-17 18:38 ` David Miller
2015-09-18  9:03   ` Andre Przywara
2015-09-18  9:09     ` [PATCH] iommu-common: fix return type of iommu_tbl_range_alloc() Andre Przywara
2015-10-21 19:12       ` Geert Uytterhoeven
2015-10-21 19:56         ` Sowmini Varadhan
2015-09-18 17:09     ` [PATCH] iommu-common: only compile lib/iommu_common.c for Sparc64 David Miller
2015-09-18 17:28       ` Andre Przywara
2015-09-21 17:17         ` [PATCH] sparc(64)/iommu: fixup iommu_tbl_range_alloc() types Andre Przywara
2015-10-05  9:54           ` Andre Przywara
2015-11-04 16:38             ` David Miller

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).