Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Paul Burton and committed by
Ralf Baechle
091bc3a4 8961b28f

+5
+5
arch/mips/mm/tlb-r4k.c
··· 19 19 #include <asm/cpu.h> 20 20 #include <asm/cpu-type.h> 21 21 #include <asm/bootinfo.h> 22 + #include <asm/hazards.h> 22 23 #include <asm/mmu_context.h> 23 24 #include <asm/pgtable.h> 24 25 #include <asm/tlb.h> ··· 487 486 * be set to fixed-size pages. 488 487 */ 489 488 write_c0_pagemask(PM_DEFAULT_MASK); 489 + back_to_back_c0_hazard(); 490 + if (read_c0_pagemask() != PM_DEFAULT_MASK) 491 + panic("MMU doesn't support PAGE_SIZE=0x%lx", PAGE_SIZE); 492 + 490 493 write_c0_wired(0); 491 494 if (current_cpu_type() == CPU_R10000 || 492 495 current_cpu_type() == CPU_R12000 ||