aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Burton <paul.burton@imgtec.com>2015-07-13 12:12:44 -0400
committerRalf Baechle <ralf@linux-mips.org>2016-04-03 04:39:26 -0400
commit091bc3a4049cb0cb28b8e3e71d8738387b91a007 (patch)
treecd102c6a2e4ec7e8d1c467723467066cbc62bcc0
parent8961b28f09dd2b5bb67738968e38a4d40a5b11bc (diff)
MIPS: tlb-r4k: panic if the MMU doesn't support PAGE_SIZE
After writing the appropriate mask to the cop0 PageMask register, read the register back & check it matches what we want. If it doesn't then the MMU does not support the page size the kernel is configured for and we're better off bailing than continuing to do odd things with TLB exceptions. Signed-off-by: Paul Burton <paul.burton@imgtec.com> Cc: Steven J. Hill <Steven.Hill@imgtec.com> Cc: Joshua Kinard <kumba@gentoo.org> Cc: Rafał Miłecki <zajec5@gmail.com> Cc: James Hogan <james.hogan@imgtec.com> Cc: Markos Chandras <markos.chandras@imgtec.com> Cc: linux-mips@linux-mips.org Cc: linux-kernel@vger.kernel.org Patchwork: https://patchwork.linux-mips.org/patch/10691/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r--arch/mips/mm/tlb-r4k.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/mips/mm/tlb-r4k.c b/arch/mips/mm/tlb-r4k.c
index 5037d5868cef..c17d7627f872 100644
--- a/arch/mips/mm/tlb-r4k.c
+++ b/arch/mips/mm/tlb-r4k.c
@@ -19,6 +19,7 @@
19#include <asm/cpu.h> 19#include <asm/cpu.h>
20#include <asm/cpu-type.h> 20#include <asm/cpu-type.h>
21#include <asm/bootinfo.h> 21#include <asm/bootinfo.h>
22#include <asm/hazards.h>
22#include <asm/mmu_context.h> 23#include <asm/mmu_context.h>
23#include <asm/pgtable.h> 24#include <asm/pgtable.h>
24#include <asm/tlb.h> 25#include <asm/tlb.h>
@@ -486,6 +487,10 @@ static void r4k_tlb_configure(void)
486 * be set to fixed-size pages. 487 * be set to fixed-size pages.
487 */ 488 */
488 write_c0_pagemask(PM_DEFAULT_MASK); 489 write_c0_pagemask(PM_DEFAULT_MASK);
490 back_to_back_c0_hazard();
491 if (read_c0_pagemask() != PM_DEFAULT_MASK)
492 panic("MMU doesn't support PAGE_SIZE=0x%lx", PAGE_SIZE);
493
489 write_c0_wired(0); 494 write_c0_wired(0);
490 if (current_cpu_type() == CPU_R10000 || 495 if (current_cpu_type() == CPU_R10000 ||
491 current_cpu_type() == CPU_R12000 || 496 current_cpu_type() == CPU_R12000 ||