Port-mips archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

R5000SC issues and fix



hi!

I dropped an R5000SC into the Indy and it just .. hung and then
powered off after the kernel was handed the IP.

After a whole lot of fun digging, I narrowed it down to the dcache
wbinv in the cache setup path and that led me to a 2020 change which
broke things on this system:

===
commit f86ae8229690c251a562e5bd34efd02d230c471d
Author: tsutsui <tsutsui%NetBSD.org@localhost>
Date:   Sun Jun 14 15:12:56 2020 +0000

    Use proper "page" alignments for R5k Page Invalidate(S) op.  PR/55139
===

Simply reverting the math change done fixes it, ie:

===
diff --git a/sys/arch/mips/include/cache_r5k.h
b/sys/arch/mips/include/cache_r5k.h
index a59fa18fdc02..6bdf9bd688c2 100644
--- a/sys/arch/mips/include/cache_r5k.h
+++ b/sys/arch/mips/include/cache_r5k.h
@@ -68,6 +68,11 @@ void r5k_sdcache_wb_range(register_t, vsize_t);
 #define        R5K_SC_PAGESIZE         (R5K_SC_LINESIZE * 128)
 #define        R5K_SC_PAGEMASK         (R5K_SC_PAGESIZE - 1)

+#if 0
 #define        mips_r5k_round_page(x)  (((x) + (register_t)R5K_SC_PAGEMASK) \
                                    & (register_t)R5K_SC_PAGEMASK)
 #define        mips_r5k_trunc_page(x)  ((x) & (register_t)R5K_SC_PAGEMASK)
+#else
+#define        mips_r5k_round_page(x)  round_line(x, PAGE_SIZE)
+#define        mips_r5k_trunc_page(x)  trunc_line(x, PAGE_SIZE)
+#endif
===

Here's the before and after shot with my local debugging to
demonstrate the issue during boot;

===
r5k_sdcache_wbinv_range: called; va=80000000 size=80000
r5k_sdcache_wbinv_range: post trunc; va=0
r5k_sdcache_wbinv_range: pre flush; va=0, eva=fff, pagesize=4096
===

(hang)

versus:

===
[   1.0000000] r5k_sdcache_wbinv_range: called; va=80000000 size=80000
[   1.0000000] r5k_sdcache_wbinv_range: post trunc; va=80000000
[   1.0000000] r5k_sdcache_wbinv_range: pre flush; va=80000000,
eva=80080000, pagesize=4096
...
[   1.0000000] cpu0 at mainbus0: MIPS R5000 CPU (0x2310) Rev. 1.0 with
built-in FPU Rev. 1.0
===

I'll go open a PR tomorrow morning, but I figure i should flag it here
before i forget the details!



-adrian


Home | Main Index | Thread Index | Old Index