Subject: Re: Will it fix the cache problems?
To: Florian Stoehr <netbsd@wolfnode.de>
From: Christopher SEKIYA <wileyc@rezrov.net>
List: port-sgimips
Date: 12/14/2004 18:51:23
On Tue, Dec 14, 2004 at 10:33:22AM +0100, Florian Stoehr wrote:

> ...as encountered by someone elso on r5k and me on my Indigo2 ?

Not completely.  The commit to which you refer is the uncontroversial part
of the fix.

Attached is the controversial part.  The pmap hack is not correct, but it
fixed the panic on my r5ksc (revision 2.0).

This does not address the system coma issue; that is due to a CPU bug (pre-2.0),
and I'm unsure how to fix it right now.
-- 

-- Chris
	GPG key FEB9DE7F (91AF 4534 4529 4BCC 31A5  938E 023E EEFB FEB9 DE7F)

Index: sys/arch/mips/mips/pmap.c
===================================================================
RCS file: /cvsroot/src/sys/arch/mips/mips/pmap.c,v
retrieving revision 1.155
diff -u -r1.155 pmap.c
--- sys/arch/mips/mips/pmap.c	30 Dec 2003 12:33:16 -0000	1.155
+++ sys/arch/mips/mips/pmap.c	14 Dec 2004 09:48:20 -0000
@@ -1598,7 +1598,8 @@
 	 *
 	 * XXXJRT This is totally disgusting.
 	 */
-	if (MIPS_HAS_R4K_MMU && mips_sdcache_line_size == 0)
+	if (MIPS_HAS_R4K_MMU &&
+		(mips_sdcache_line_size == 0 || mips_pdcache_ways > 1))
 		mips_dcache_wbinv_range(MIPS_PHYS_TO_KSEG0(phys), NBPG);
 #endif	/* MIPS3_PLUS */
 }
@@ -1635,7 +1636,8 @@
 	 * It would probably be better to map the destination as a
 	 * write-through no allocate to reduce cache thrash.
 	 */
-	if (MIPS_HAS_R4K_MMU && mips_sdcache_line_size == 0) {
+	if (MIPS_HAS_R4K_MMU &&
+		(mips_sdcache_line_size == 0 || mips_pdcache_ways > 1)) {
 		/*XXX FIXME Not very sophisticated */
 		mips_flushcache_allpvh(src);
 /*		mips_flushcache_allpvh(dst); */
@@ -1657,7 +1659,8 @@
 	 *
 	 * XXXJRT -- This is totally disgusting.
 	 */
-	if (MIPS_HAS_R4K_MMU && mips_sdcache_line_size == 0) {
+	if (MIPS_HAS_R4K_MMU &&
+		(mips_sdcache_line_size == 0 || mips_pdcache_ways > 1)) {
 		mips_dcache_wbinv_range(MIPS_PHYS_TO_KSEG0(src), NBPG);
 		mips_dcache_wbinv_range(MIPS_PHYS_TO_KSEG0(dst), NBPG);
 	}
Index: sys/arch/sgimips/sgimips/machdep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/sgimips/sgimips/machdep.c,v
retrieving revision 1.88
diff -u -r1.88 machdep.c
--- sys/arch/sgimips/sgimips/machdep.c	13 Dec 2004 08:30:58 -0000	1.88
+++ sys/arch/sgimips/sgimips/machdep.c	14 Dec 2004 09:48:36 -0000
@@ -865,14 +865,7 @@
 #if defined(MIPS3)
 	case MIPS_R5000:
 	case MIPS_RM5200:
-#ifdef notyet
 		r5k_enable_sdcache();
-#else
-		mips3_cp0_config_write( (mips3_cp0_config_read())
-			& ~MIPS3_CONFIG_SE);
-		mips_sdcache_size = 0;
-		mips_sdcache_line_size = 0;
-#endif
 		break;
 #endif
 	}