From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752099AbbGMQNW (ORCPT ); Mon, 13 Jul 2015 12:13:22 -0400 Received: from mailapp01.imgtec.com ([195.59.15.196]:34177 "EHLO mailapp01.imgtec.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751292AbbGMQNV (ORCPT ); Mon, 13 Jul 2015 12:13:21 -0400 From: Paul Burton To: CC: Paul Burton , "Steven J. Hill" , Joshua Kinard , , =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= , James Hogan , Markos Chandras , Ralf Baechle Subject: [PATCH] MIPS: tlb-r4k: panic if the MMU doesn't support PAGE_SIZE Date: Mon, 13 Jul 2015 17:12:44 +0100 Message-ID: <1436803964-29820-1-git-send-email-paul.burton@imgtec.com> X-Mailer: git-send-email 2.4.5 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.100.200.70] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- arch/mips/mm/tlb-r4k.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/mips/mm/tlb-r4k.c b/arch/mips/mm/tlb-r4k.c index 08318ec..4330315 100644 --- a/arch/mips/mm/tlb-r4k.c +++ b/arch/mips/mm/tlb-r4k.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -486,6 +487,10 @@ static void r4k_tlb_configure(void) * be set to fixed-size pages. */ write_c0_pagemask(PM_DEFAULT_MASK); + back_to_back_c0_hazard(); + if (read_c0_pagemask() != PM_DEFAULT_MASK) + panic("MMU doesn't support PAGE_SIZE=0x%lx", PAGE_SIZE); + write_c0_wired(0); if (current_cpu_type() == CPU_R10000 || current_cpu_type() == CPU_R12000 || -- 2.4.5