Received: from milmhbs1.lsil.com (147.145.21.209) by coscas01.lsi.com
 (172.21.36.60) with Microsoft SMTP Server id 8.1.393.1; Sun, 21 Mar 2010
 05:03:52 -0600
Received: from mail1.lsil.com (mail1.lsil.com [147.145.40.21])	by
 milmhbs1.lsil.com (8.12.11/8.12.11) with ESMTP id o2LB3orN009422	for
 <andy.sharp@lsi.com>; Sun, 21 Mar 2010 04:03:52 -0700
Received: from psmtp.com (na3sys009amx192.postini.com [74.125.149.173])	by
 mail1.lsil.com (8.12.11/8.12.11) with SMTP id o2LB3MvM026188	for
 <andy.sharp@lsi.com>; Sun, 21 Mar 2010 04:03:49 -0700 (PDT)
Received: from source ([78.24.191.182]) by na3sys009amx192.postini.com
 ([74.125.148.14]) with SMTP;	Sun, 21 Mar 2010 11:03:49 GMT
Received: from localhost.localdomain ([127.0.0.1]:46775 "EHLO
        eddie.linux-mips.org" rhost-flags-OK-OK-OK-FAIL)        by
 eddie.linux-mips.org with ESMTP id S1492295Ab0CULDE (ORCPT
        <rfc822;andy.sharp@lsi.com>); Sun, 21 Mar 2010 12:03:04 +0100
Received: with ECARTIS (v1.0.0; list linux-mips); Sun, 21 Mar 2010 12:02:46
 +0100 (CET)
Received: from Chamillionaire.breakpoint.cc ([85.10.199.196]:56209 "EHLO
        Chamillionaire.breakpoint.cc" rhost-flags-OK-OK-OK-OK)        by
 eddie.linux-mips.org with ESMTP id S1491204Ab0CULCn (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Sun, 21 Mar 2010 12:02:43 +0100
Received: id: bigeasy by Chamillionaire.breakpoint.cc with local
        (easymta 1.00 BETA 1)        id 1NtIvZ-0006es-GP; Sun, 21 Mar 2010
 12:02:41 +0100
From: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
To: Ralf Baechle <ralf@linux-mips.org>
CC: "linux-mips@linux-mips.org" <linux-mips@linux-mips.org>
Sender: "linux-mips-bounce@linux-mips.org" <linux-mips-bounce@linux-mips.org>
Date: Sun, 21 Mar 2010 05:02:41 -0600
Subject: [PATCH] mips/mm: fix module support on SiByte
Thread-Topic: [PATCH] mips/mm: fix module support on SiByte
Thread-Index: AcrI5jF4WpxcwdA+RLGkSA44/FVvkQ==
Message-ID: <20100321110241.GA25569@Chamillionaire.breakpoint.cc>
Accept-Language: en-US
Content-Language: en-US
X-MS-Exchange-Organization-AuthAs: Anonymous
X-MS-Exchange-Organization-AuthSource: coscas01.lsi.com
X-MS-Has-Attach:
X-Auto-Response-Suppress: All
X-MS-TNEF-Correlator:
x-scanned-by: MIMEDefang 2.39
errors-to: linux-mips-bounce@linux-mips.org
x-pstn-levels: (S:99.90000/99.90000 CV:99.9000 FC:95.5390 LC:95.5390
 R:95.9108 P:95.9108 M:97.0282 C:98.6951 )
x-pstn-settings: 3 (1.0000:1.0000) s cv gt3 gt2 gt1 r p m c 
x-pstn-addresses: from <sebastian@breakpoint.cc> [22/1] 
x-pstn-neptune: 1/1/1.00/84
user-agent: Mutt/1.5.20 (2009-06-14)
x-list: linux-mips
x-original-sender: sebastian@breakpoint.cc
Content-Type: text/plain; charset="iso-8859-15"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0

Since commit 656be92f aka "Load modules to CKSEG0 if
CONFIG_BUILD_ELF64=3Dn" module support is broken on 64bit. Since then
modules arr loaded into 32bit compat adresses which are sign extended
64bit addresses. The SiByte war handler was not updated and those
addresses were not recognized by the TLB hadling.
This patch fixes this by shifting away the upper bits including the R
and Fill bits. Now we compare VPN2 of C0_ENTRYHI against the matching
bits at C0_BADVADDR.

Cc: <stable@kernel.org>
Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
---
 arch/mips/mm/tlbex.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c
index badcf5e..47faeb4 100644
--- a/arch/mips/mm/tlbex.c
+++ b/arch/mips/mm/tlbex.c
@@ -745,6 +745,10 @@ static void __cpuinit build_r4000_tlb_refill_handler(v=
oid)
 		UASM_i_MFC0(&p, K1, C0_ENTRYHI);
 		uasm_i_xor(&p, K0, K0, K1);
 		UASM_i_SRL(&p, K0, K0, PAGE_SHIFT + 1);
+#ifdef CONFIG_64BIT
+		/* Make sure we have here just VPN2 */
+		uasm_i_dsll32(&p, K0, K0, PAGE_SHIFT + 1 + 24 - 32);
+#endif
 		uasm_il_bnez(&p, &r, K0, label_leave);
 		/* No need for uasm_i_nop */
 	}
@@ -1264,6 +1268,10 @@ static void __cpuinit build_r4000_tlb_load_handler(v=
oid)
 		UASM_i_MFC0(&p, K1, C0_ENTRYHI);
 		uasm_i_xor(&p, K0, K0, K1);
 		UASM_i_SRL(&p, K0, K0, PAGE_SHIFT + 1);
+#ifdef CONFIG_64BIT
+		/* Make sure we have here just VPN2 */
+		uasm_i_dsll32(&p, K0, K0, PAGE_SHIFT + 1 + 24 - 32);
+#endif
 		uasm_il_bnez(&p, &r, K0, label_leave);
 		/* No need for uasm_i_nop */
 	}
--=20
1.6.6


