Skip to contentSkip to conversation

Patch to make c-mips32.c compile when HW coherency is used

PATCH Hartvig Ekner 2 participants 2 messages Apr 1, 2003 MIPS

lore
Share & tools
lore
#0 lore raw

The patch totally removes the dma_cache functions and the function pointers when the kernel is compiled for HW coherency. Previously it didn't compile at all since the function pointers are non- existant in this case.

The same problem exists in all the other c-*.c files in arch/mips/mm, so maybe there is something which I don't understand?

/Hartvig

Index: c-mips32.c
===================================================================
RCS file: /home/cvs/linux/arch/mips/mm/c-mips32.c,v retrieving revision 1.3.2.17

c-mips32.c +11 -1
diff -u -r1.3.2.17 c-mips32.c
@@ -293,6 +293,9 @@
 /*
  * Writeback and invalidate the primary cache dcache before DMA.
  */
+
+#ifdef	CONFIG_NONCOHERENT_IO
+
 static void
 mips32_dma_cache_wback_inv_pc(unsigned long addr, unsigned long size)
 {
@@ -379,9 +382,12 @@
 static void
 mips32_dma_cache_wback(unsigned long addr, unsigned long size)
 {
-	panic("mips32_dma_cache called - should not happen.");
+	panic("mips32_dma_cache_wback called - should not happen.");
 }
 
+#endif
+
+
 /*
  * While we're protected against bad userland addresses we don't care
  * very much about what happens in that case.  Usually a segmentation
@@ -596,9 +602,11 @@
 
 	_flush_icache_page = mips32_flush_icache_page;
 
+#ifdef	CONFIG_NONCOHERENT_IO
 	_dma_cache_wback_inv = mips32_dma_cache_wback_inv_pc;
 	_dma_cache_wback = mips32_dma_cache_wback;
 	_dma_cache_inv = mips32_dma_cache_inv_pc;
+#endif
 }
 
 static void __init setup_scache_funcs(void)
@@ -613,9 +621,11 @@
 
 	_flush_icache_page = mips32_flush_icache_page_s;
 
+#ifdef	CONFIG_NONCOHERENT_IO
 	_dma_cache_wback_inv = mips32_dma_cache_wback_inv_sc;
 	_dma_cache_wback = mips32_dma_cache_wback;
 	_dma_cache_inv = mips32_dma_cache_inv_sc;
+#endif
 }
 
 typedef int (*probe_func_t)(unsigned long);
#1 lore raw
Quoted 7 lines · Hartvig Ekner

The patch totally removes the dma_cache functions and the function pointers when the kernel is compiled for HW coherency. Previously it didn't compile at all since the function pointers are non-existant in this case.

The same problem exists in all the other c-*.c files in arch/mips/mm, so maybe there is something which I don't understand?

The reason is trivial - to this date only two platforms do support hw coherency for I/O, the R10000-based Origin 200/2000 aka SGI IP27 and Sibyte SB1-based platforms.

Fortunately the number of coherent platforms is increasing. The extra hardware costs very little these days but it dramatically helping to guarantee system performance and correctness of system software.

Ralf