[PATCH 17/20] x86: provide a bad_dma_address symbol for i386

Previous thread: [PATCH 12/20] x86: move alloc and free coherent to common header by Glauber Costa on Tuesday, March 25, 2008 - 2:36 pm. (2 messages)

Next thread: [PATCH 14/20] x86: move dma_cache_sync to common header by Glauber Costa on Tuesday, March 25, 2008 - 2:36 pm. (4 messages)
From: Glauber Costa
Date: Tuesday, March 25, 2008 - 2:36 pm

Do it instead of using the conservative approach we're currently
doing. This is the way x86_64 does, and this patch makes this piece
of code the same between them, ready to be integrated

Signed-off-by: Glauber Costa <gcosta@redhat.com>
---
 include/asm-x86/dma-mapping_32.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/asm-x86/dma-mapping_32.h b/include/asm-x86/dma-mapping_32.h
index fd7246d..d0512c9 100644
--- a/include/asm-x86/dma-mapping_32.h
+++ b/include/asm-x86/dma-mapping_32.h
@@ -21,7 +21,7 @@ dma_get_cache_alignment(void)
 {
 	/* no easy way to get cache size on all x86, so return the
 	 * maximum possible, to be safe */
-	return (1 << INTERNODE_CACHE_SHIFT);
+	return boot_cpu_data.x86_clflush_size;
 }
 
 #define dma_is_consistent(d, h)	(1)
-- 
1.5.0.6

--

From: Glauber Costa
Date: Tuesday, March 25, 2008 - 2:36 pm

It's initially 0, since we don't expect any DMA there.

Signed-off-by: Glauber Costa <gcosta@redhat.com>
---
 arch/x86/kernel/pci-dma_32.c     |    4 ++++
 include/asm-x86/dma-mapping.h    |    2 ++
 include/asm-x86/dma-mapping_64.h |    1 -
 3 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/pci-dma_32.c b/arch/x86/kernel/pci-dma_32.c
index 453b4bd..55ab3c8 100644
--- a/arch/x86/kernel/pci-dma_32.c
+++ b/arch/x86/kernel/pci-dma_32.c
@@ -14,6 +14,10 @@
 #include <linux/module.h>
 #include <asm/io.h>
 
+/* For i386, we make it point to the NULL address */
+dma_addr_t bad_dma_address __read_mostly = 0x0;
+EXPORT_SYMBOL(bad_dma_address);
+
 struct dma_coherent_mem {
 	void		*virt_base;
 	u32		device_base;
diff --git a/include/asm-x86/dma-mapping.h b/include/asm-x86/dma-mapping.h
index 06eb448..908fcaa 100644
--- a/include/asm-x86/dma-mapping.h
+++ b/include/asm-x86/dma-mapping.h
@@ -10,6 +10,8 @@
 #include <asm/io.h>
 #include <asm/swiotlb.h>
 
+extern dma_addr_t bad_dma_address;
+
 struct dma_mapping_ops {
 	int             (*mapping_error)(dma_addr_t dma_addr);
 	void*           (*alloc_coherent)(struct device *dev, size_t size,
diff --git a/include/asm-x86/dma-mapping_64.h b/include/asm-x86/dma-mapping_64.h
index 9674dac..352bf41 100644
--- a/include/asm-x86/dma-mapping_64.h
+++ b/include/asm-x86/dma-mapping_64.h
@@ -1,7 +1,6 @@
 #ifndef _X8664_DMA_MAPPING_H
 #define _X8664_DMA_MAPPING_H 1
 
-extern dma_addr_t bad_dma_address;
 extern int iommu_merge;
 
 static inline int dma_mapping_error(dma_addr_t dma_addr)
-- 
1.5.0.6

--

From: Ingo Molnar
Date: Wednesday, March 26, 2008 - 12:09 am

please update the comment too. (just add a delta patch to your next 
series)

	Ingo
--

Previous thread: [PATCH 12/20] x86: move alloc and free coherent to common header by Glauber Costa on Tuesday, March 25, 2008 - 2:36 pm. (2 messages)

Next thread: [PATCH 14/20] x86: move dma_cache_sync to common header by Glauber Costa on Tuesday, March 25, 2008 - 2:36 pm. (4 messages)