[PATCH 2/2] Fix page fault handling on Loongson 2

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

 



This bug was introduced by not fully covered Loongson/R4K schism of
Hit_Invalidate_I macro in commit 14bd8c082016cd1f67fdfd702e4cf6367869a712
(MIPS: Loongson: Get rid of Loongson 2 #ifdefery all over arch/mips).

The system paniced on first user space page fault, e.g. on executing
init, in blast_icache32_page().

Signed-off-by: Petr Písař <petr.pisar@xxxxxxxx>
---
 arch/mips/include/asm/r4kcache.h | 12 ++++++++++++
 arch/mips/mm/c-r4k.c             |  7 ++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/arch/mips/include/asm/r4kcache.h b/arch/mips/include/asm/r4kcache.h
index 34d1a19..b6f25a1 100644
--- a/arch/mips/include/asm/r4kcache.h
+++ b/arch/mips/include/asm/r4kcache.h
@@ -411,13 +411,25 @@ static inline void blast_##pfx##cache##lsize##_page_indexed(unsigned long page)
 }
 
 __BUILD_BLAST_CACHE(d, dcache, Index_Writeback_Inv_D, Hit_Writeback_Inv_D, 16)
+#if defined(CONFIG_CPU_LOONGSON2)
+__BUILD_BLAST_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I_Loongson23, 16)
+#else
 __BUILD_BLAST_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I, 16)
+#endif
 __BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 16)
 __BUILD_BLAST_CACHE(d, dcache, Index_Writeback_Inv_D, Hit_Writeback_Inv_D, 32)
+#if defined(CONFIG_CPU_LOONGSON2)
+__BUILD_BLAST_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I_Loongson23, 32)
+#else
 __BUILD_BLAST_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I, 32)
+#endif
 __BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 32)
 __BUILD_BLAST_CACHE(d, dcache, Index_Writeback_Inv_D, Hit_Writeback_Inv_D, 64)
+#if defined(CONFIG_CPU_LOONGSON2)
+__BUILD_BLAST_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I_Loongson23, 64)
+#else
 __BUILD_BLAST_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I, 64)
+#endif
 __BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 64)
 __BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 128)
 
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
index 1c2029d..c511fd7 100644
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -718,7 +718,12 @@ static void local_r4k_flush_cache_sigtramp(void * arg)
 			"1:\n\t"
 			".set pop"
 			:
-			: "i" (Hit_Invalidate_I));
+#if defined(CONFIG_CPU_LOONGSON2)
+			: "i" (Hit_Invalidate_I_Loongson23)
+#else
+			: "i" (Hit_Invalidate_I)
+#endif
+        );
 	}
 	if (MIPS_CACHE_SYNC_WAR)
 		__asm__ __volatile__ ("sync");
-- 
1.8.5.1



[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux