Received: from mail.onstor.com (66.201.51.107) by exch1.onstor.net
 (10.0.0.225) with Microsoft SMTP Server id 8.1.311.2; Tue, 19 May 2009
 09:02:42 -0700
Received: from psmtp.com ([64.18.0.126]) by mail.onstor.com with Microsoft
 SMTPSVC(6.0.3790.3959);	 Tue, 19 May 2009 09:02:42 -0700
Received: from source ([213.58.128.207]) by exprod5mx240.postini.com
 ([64.18.4.11]) with SMTP;	Tue, 19 May 2009 10:02:42 MDT
Received: from localhost.localdomain ([127.0.0.1]:50214 "EHLO
	ftp.linux-mips.org" rhost-flags-OK-OK-OK-FAIL) by ftp.linux-mips.org	with
 ESMTP id S20022684AbZESQCZ (ORCPT	<rfc822;andy.sharp@onstor.com>); Tue, 19
 May 2009 17:02:25 +0100
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 19 May 2009 17:02:08
 +0100 (BST)
Received: from h5.dl5rb.org.uk ([81.2.74.5]:52565 "EHLO h5.dl5rb.org.uk"
	rhost-flags-OK-OK-OK-OK) by ftp.linux-mips.org with ESMTP	id
 S20024603AbZESQCB (ORCPT <rfc822;linux-mips@linux-mips.org>);	Tue, 19 May
 2009 17:02:01 +0100
Received: from h5.dl5rb.org.uk (localhost.localdomain [127.0.0.1])	by
 h5.dl5rb.org.uk (8.14.3/8.14.3) with ESMTP id n4JG1Jo8022498;	Tue, 19 May
 2009 17:01:20 +0100
Received: (from ralf@localhost)	by h5.dl5rb.org.uk (8.14.3/8.14.3/Submit) id
 n4JG1H5g022497;	Tue, 19 May 2009 17:01:17 +0100
From: Ralf Baechle <ralf@linux-mips.org>
To: yanh <yanh@lemote.com>
CC: Wu Zhangjin <wuzhangjin@gmail.com>, "linux-mips@linux-mips.org"
	<linux-mips@linux-mips.org>, Arnaud Patard <apatard@mandriva.com>,
	"loongson-dev@googlegroups.com" <loongson-dev@googlegroups.com>,
	"zhangfx@lemote.com" <zhangfx@lemote.com>, Philippe Vachon
	<philippe@cowpig.ca>, Zhang Le <r0bertz@gentoo.org>, Erwan Lerale
	<erwan@thiscow.com>
Sender: "linux-mips-bounce@linux-mips.org" <linux-mips-bounce@linux-mips.org>
Date: Tue, 19 May 2009 09:01:17 -0700
Subject: Re: [PATCH 26/30] loongson: flush irq write operation
Thread-Topic: [PATCH 26/30] loongson: flush irq write operation
Thread-Index: AcnYmz4KLEne0UqCTg6NMBJnLw2fng==
Message-ID: <20090519160117.GA19672@linux-mips.org>
References: <1242426527.10164.174.camel@falcon>
 <20090518163603.GA22779@linux-mips.org>
 <1242700637.4382.21.camel@localhost.localdomain>
In-Reply-To: <1242700637.4382.21.camel@localhost.localdomain>
Accept-Language: en-US
Content-Language: en-US
X-MS-Exchange-Organization-AuthAs: Internal
X-MS-Exchange-Organization-AuthMechanism: 0b
X-MS-Exchange-Organization-AuthSource: exch1.onstor.net
X-MS-Has-Attach:
X-Auto-Response-Suppress: All
X-MS-TNEF-Correlator:
x-originalarrivaltime: 19 May 2009 16:02:42.0629 (UTC)
 FILETIME=[3DDE7750:01C9D89B]
x-ems-stamp: 3KHxfIkPhNZJNyFqg7qpLw==
x-ems-proccessed: 2K3Xl1OQTInXD6xxuA8z3Q==
user-agent: Mutt/1.5.18 (2008-05-17)
errors-to: linux-mips-bounce@linux-mips.org
x-pstn-neptune: 0/0/0.00/0
x-pstn-levels: (S:99.90000/99.90000 CV: 7.8455 FC:95.5390 LC:95.5390
 R:95.9108 P:95.9108 M:97.0282 C:98.6951 )
x-list: linux-mips
x-archive-position: 22823
x-ecartis-version: Ecartis v1.0.0
x-original-sender: ralf@linux-mips.org
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0

On Tue, May 19, 2009 at 10:37:17AM +0800, yanh wrote:

> > The semantic of inX() / outX() is defined by the x86 architecture which
> > forbids posting I/O port writes.  In short I think this one is papering
> > over a bug in the outX() implementation.
> Yes, the outX should do a delayed write, however it does not.=20
> So our solution is making a read to flush the write.

Do you actually need all the inb() you added to get things to work or is

diff --git a/arch/mips/kernel/i8259.c b/arch/mips/kernel/i8259.c
index 01c0885..42d75d7 100644
--- a/arch/mips/kernel/i8259.c
+++ b/arch/mips/kernel/i8259.c
@@ -177,10 +177,12 @@ handle_real_irq:
 		outb(cached_slave_mask, PIC_SLAVE_IMR);
 		outb(0x60+(irq&7), PIC_SLAVE_CMD);/* 'Specific EOI' to slave */
 		outb(0x60+PIC_CASCADE_IR, PIC_MASTER_CMD); /* 'Specific EOI' to master-I=
RQ2 */
+		inb(PIC_MASTER_CMD);
 	} else {
 		inb(PIC_MASTER_IMR);	/* DUMMY - (do we need this?) */
 		outb(cached_master_mask, PIC_MASTER_IMR);
 		outb(0x60+irq, PIC_MASTER_CMD);	/* 'Specific EOI to master */
+		inb(PIC_MASTER_CMD);
 	}
 	smtc_im_ack_irq(irq);
 	spin_unlock_irqrestore(&i8259A_lock, flags);

sufficient to solve the problem?

  Ralf

