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; Mon, 7 Sep 2009
 12:25:30 -0600
Received: from mail2.lsil.com (mail2.lsil.com [147.145.40.22])	by
 milmhbs1.lsil.com (8.12.11/8.12.11) with ESMTP id n87IPRkD010105	for
 <andy.sharp@lsi.com>; Mon, 7 Sep 2009 11:25:28 -0700
Received: from psmtp.com (exprod7mx217.postini.com [64.18.2.144])	by
 mail2.lsil.com (8.12.11/8.12.11) with SMTP id n87IM8Y0028062	for
 <andy.sharp@lsi.com>; Mon, 7 Sep 2009 11:22:10 -0700 (PDT)
Received: from source ([78.24.191.182]) by exprod7mx217.postini.com
 ([64.18.6.14]) with SMTP;	Mon, 07 Sep 2009 18:25:26 GMT
Received: from localhost.localdomain ([127.0.0.1]:53178 "EHLO
	eddie.linux-mips.org" rhost-flags-OK-OK-OK-FAIL) by ftp.linux-mips.org	with
 ESMTP id S1493457AbZIGSZD (ORCPT <rfc822;andy.sharp@lsi.com>);	Mon, 7 Sep
 2009 20:25:03 +0200
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 07 Sep 2009 20:24:46
 +0200 (CEST)
Received: from [65.98.92.6] ([65.98.92.6]:4175 "EHLO b32.net"
	rhost-flags-FAIL-FAIL-OK-OK) by ftp.linux-mips.org with ESMTP	id
 S1493455AbZIGSYi (ORCPT <rfc822;linux-mips@linux-mips.org>);	Mon, 7 Sep 2009
 20:24:38 +0200
Received: (qmail 30898 invoked from network); 7 Sep 2009 18:24:35 -0000
Received: from unknown (HELO two) (127.0.0.1)  by 127.0.0.1 with SMTP; 7 Sep
 2009 18:24:35 -0000
Received: by two (sSMTP sendmail emulation); Mon, 07 Sep 2009 11:24:35 -0700
From: Kevin Cernekee <cernekee@gmail.com>
To: "ralf@linux-mips.org" <ralf@linux-mips.org>
CC: "linux-mips@linux-mips.org" <linux-mips@linux-mips.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Sender: "linux-mips-bounce@linux-mips.org" <linux-mips-bounce@linux-mips.org>
Date: Mon, 7 Sep 2009 12:11:31 -0600
Subject: [PATCHv2] MIPS: Machine check exception in kmap_coherent()
Thread-Topic: [PATCHv2] MIPS: Machine check exception in kmap_coherent()
Thread-Index: Acov6JS9MAGdb1ZTRrCkqggh5Gp2ng==
Message-ID: <2c228c5e48509b7c8296a6c50af3ad73@localhost>
References: <20090907102613.GA25295@linux-mips.org>
In-Reply-To: <20090907102613.GA25295@linux-mips.org>
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-neptune: 0/0/0.00/0
x-pstn-levels: (S:74.70340/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 <cernekee@gmail.com> [db-null] 
user-agent: vim 7.1
x-archive-position: 23992
x-ecartis-version: Ecartis v1.0.0
x-original-sender: cernekee@gmail.com
x-list: linux-mips
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0

Create an extra set of fixmap entries for use in interrupt handlers.
This prevents fixmap VA conflicts between copy_user_highpage() running
in user context, and local_r4k_flush_cache_page() invoked from an SMP
IPI.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
---
 arch/mips/include/asm/fixmap.h |    4 ++--
 arch/mips/mm/init.c            |    6 +++++-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/arch/mips/include/asm/fixmap.h b/arch/mips/include/asm/fixmap.=
h
index 0f5caa1..dd924b9 100644
--- a/arch/mips/include/asm/fixmap.h
+++ b/arch/mips/include/asm/fixmap.h
@@ -48,9 +48,9 @@ enum fixed_addresses {
 #define FIX_N_COLOURS 8
 	FIX_CMAP_BEGIN,
 #ifdef CONFIG_MIPS_MT_SMTC
-	FIX_CMAP_END =3D FIX_CMAP_BEGIN + (FIX_N_COLOURS * NR_CPUS),
+	FIX_CMAP_END =3D FIX_CMAP_BEGIN + (FIX_N_COLOURS * NR_CPUS * 2),
 #else
-	FIX_CMAP_END =3D FIX_CMAP_BEGIN + FIX_N_COLOURS,
+	FIX_CMAP_END =3D FIX_CMAP_BEGIN + (FIX_N_COLOURS * 2),
 #endif
 #ifdef CONFIG_HIGHMEM
 	/* reserved pte's for temporary kernel mappings */
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 0e82050..43ebe65 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -27,6 +27,7 @@
 #include <linux/swap.h>
 #include <linux/proc_fs.h>
 #include <linux/pfn.h>
+#include <linux/hardirq.h>
=20
 #include <asm/asm-offsets.h>
 #include <asm/bootinfo.h>
@@ -132,7 +133,10 @@ void *kmap_coherent(struct page *page, unsigned long a=
ddr)
 	inc_preempt_count();
 	idx =3D (addr >> PAGE_SHIFT) & (FIX_N_COLOURS - 1);
 #ifdef CONFIG_MIPS_MT_SMTC
-	idx +=3D FIX_N_COLOURS * smp_processor_id();
+	idx +=3D FIX_N_COLOURS * smp_processor_id() +
+		(in_interrupt() ? (FIX_N_COLOURS * NR_CPUS) : 0);
+#else
+	idx +=3D in_interrupt() ? FIX_N_COLOURS : 0;
 #endif
 	vaddr =3D __fix_to_virt(FIX_CMAP_END - idx);
 	pte =3D mk_pte(page, PAGE_KERNEL);
--=20
1.6.3.1


