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, 28 Feb 2010
 08:37:26 -0700
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 o1SFbQFH000806	for
 <andy.sharp@lsi.com>; Sun, 28 Feb 2010 07:37:26 -0800
Received: from psmtp.com (na3sys009amx242.postini.com [74.125.149.126])	by
 mail2.lsil.com (8.12.11/8.12.11) with SMTP id o1SFWOUS014514	for
 <andy.sharp@lsi.com>; Sun, 28 Feb 2010 07:32:24 -0800 (PST)
Received: from source ([78.24.191.182]) by na3sys009amx242.postini.com
 ([74.125.148.14]) with SMTP;	Sun, 28 Feb 2010 15:37:25 GMT
Received: from localhost.localdomain ([127.0.0.1]:60885 "EHLO
        eddie.linux-mips.org" rhost-flags-OK-OK-OK-FAIL)        by
 eddie.linux-mips.org with ESMTP id S1492171Ab0B1PhX (ORCPT
        <rfc822;andy.sharp@lsi.com>); Sun, 28 Feb 2010 16:37:23 +0100
Received: with ECARTIS (v1.0.0; list linux-mips); Sun, 28 Feb 2010 16:37:05
 +0100 (CET)
Received: from Chamillionaire.breakpoint.cc ([85.10.199.196]:33638 "EHLO
        Chamillionaire.breakpoint.cc" rhost-flags-OK-OK-OK-OK)        by
 eddie.linux-mips.org with ESMTP id S1492278Ab0B1Pfs (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Sun, 28 Feb 2010 16:35:48 +0100
Received: id: bigeasy by Chamillionaire.breakpoint.cc authenticated by bigeasy
 with local        (easymta 1.00 BETA 1)        id 1NllBJ-0004M9-9F; Sun, 28
 Feb 2010 16:35:45 +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>, "David S. Miller"
	<davem@davemloft.net>, "linux-ide@vger.kernel.org"
	<linux-ide@vger.kernel.org>, Sebastian Andrzej Siewior
	<sebastian@breakpoint.cc>
Sender: "linux-mips-bounce@linux-mips.org" <linux-mips-bounce@linux-mips.org>
Date: Sun, 28 Feb 2010 08:35:39 -0700
Subject: [PATCH 1/3] mips/ide: flush dcache also if icache does not snoop
 dcache
Thread-Topic: [PATCH 1/3] mips/ide: flush dcache also if icache does not
 snoop dcache
Thread-Index: Acq4i+4WhBjfrJTwQ/2i3fG+I8Y8/Q==
Message-ID: <1267371341-16684-2-git-send-email-sebastian@breakpoint.cc>
References: <1267371341-16684-1-git-send-email-sebastian@breakpoint.cc>
In-Reply-To: <1267371341-16684-1-git-send-email-sebastian@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: 0/0/0.00/0
x-list: linux-mips
x-original-sender: sebastian@breakpoint.cc
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0

If this is not done then the new just read data which remains in dcache
will not make it into icache on time. Thus the CPU loads invalid data
and executes crap. The result is that the user is not able to execute
anything from its IDE based media while reading plain data is still
working well.
This problem has been reported as Debian #404951.

Cc: stable@kernel.org
Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
---
 arch/mips/include/asm/mach-generic/ide.h |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/mips/include/asm/mach-generic/ide.h b/arch/mips/include/a=
sm/mach-generic/ide.h
index 9c93a5b..e80e47f 100644
--- a/arch/mips/include/asm/mach-generic/ide.h
+++ b/arch/mips/include/asm/mach-generic/ide.h
@@ -23,7 +23,7 @@
 static inline void __ide_flush_prologue(void)
 {
 #ifdef CONFIG_SMP
-	if (cpu_has_dc_aliases)
+	if (cpu_has_dc_aliases || !cpu_has_ic_fills_f_dc)
 		preempt_disable();
 #endif
 }
@@ -31,14 +31,14 @@ static inline void __ide_flush_prologue(void)
 static inline void __ide_flush_epilogue(void)
 {
 #ifdef CONFIG_SMP
-	if (cpu_has_dc_aliases)
+	if (cpu_has_dc_aliases || !cpu_has_ic_fills_f_dc)
 		preempt_enable();
 #endif
 }
=20
 static inline void __ide_flush_dcache_range(unsigned long addr, unsigned l=
ong size)
 {
-	if (cpu_has_dc_aliases) {
+	if (cpu_has_dc_aliases || !cpu_has_ic_fills_f_dc) {
 		unsigned long end =3D addr + size;
=20
 		while (addr < end) {
--=20
1.6.6


