lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <60eae1275eab92e527ac19f40b56f703fd6c6c5a.1329387617.git.rubini@gnudd.com>
Date:	Thu, 16 Feb 2012 11:40:27 +0100
From:	Alessandro Rubini <rubini@...dd.com>
To:	linux-kernel@...r.kernel.org
Cc:	giancarlo.asnaghi@...com, alan@...ux.intel.com,
	andrzej.p@...sung.com, mingo@...e.hu, jbarnes@...tuousgeek.org
Subject: [PATCH 3/3] x86: introduce CONFIG_X86_DMA_REMAP

The default functions phys_to_dma, dma_to_phys implement identity
mapping as fast inline functions.  Some systems, however, need a
custom function to implement its own mapping between CPU addresses and
device addresses. This option is needed to support the sta2x11 I/O Hub,
whose support has been accepted but won't compile without this patch.

Signed-off-by: Alessandro Rubini <rubini@...dd.com>
Acked-by: Giancarlo Asnaghi <giancarlo.asnaghi@...com>
Cc: Alan Cox <alan@...ux.intel.com>
---
 arch/x86/Kconfig                   |    5 +++++
 arch/x86/include/asm/dma-mapping.h |    7 +++++++
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 5bb23c3..5426833 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -512,6 +512,7 @@ config STA2X11
 	depends on X86_32_NON_STANDARD && PCI
 	select SWIOTLB
 	select X86_DEV_DMA_OPS
+	select X86_DMA_REMAP
 	select MFD_STA2X11
 	select ARCH_REQUIRE_GPIOLIB
 	default n
@@ -2255,6 +2256,10 @@ config X86_DEV_DMA_OPS
 	bool
 	depends on X86_64 || STA2X11
 
+config X86_DMA_REMAP
+	bool
+	depends on STA2X11
+
 source "net/Kconfig"
 
 source "drivers/Kconfig"
diff --git a/arch/x86/include/asm/dma-mapping.h b/arch/x86/include/asm/dma-mapping.h
index 09aa473..61c0bd2 100644
--- a/arch/x86/include/asm/dma-mapping.h
+++ b/arch/x86/include/asm/dma-mapping.h
@@ -62,6 +62,12 @@ extern void *dma_generic_alloc_coherent(struct device *dev, size_t size,
 					dma_addr_t *dma_addr, gfp_t flag,
 					struct dma_attrs *attrs);
 
+#ifdef CONFIG_X86_DMA_REMAP /* Platform code defines bridge-specific code */
+extern bool dma_capable(struct device *dev, dma_addr_t addr, size_t size);
+extern dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr);
+extern phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr);
+#else
+
 static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)
 {
 	if (!dev->dma_mask)
@@ -79,6 +85,7 @@ static inline phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr)
 {
 	return daddr;
 }
+#endif /* CONFIG_X86_DMA_REMAP */
 
 static inline void
 dma_cache_sync(struct device *dev, void *vaddr, size_t size,
-- 
1.7.7.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ