Received: from mail.onstor.com ([66.201.51.107]) by onstor-exch02.onstor.net with Microsoft SMTPSVC(6.0.3790.1830);
	 Tue, 5 Aug 2008 03:38:12 -0700
Received: from chiesmta2-1.messageone.com ([216.203.30.55]) by mail.onstor.com with Microsoft SMTPSVC(6.0.3790.1830);
	 Tue, 5 Aug 2008 03:38:12 -0700
Received: from ftp.linux-mips.org (ftp.linux-mips.org [213.58.128.207])
	by chiesmta2-1.messageone.com (8.13.8/8.13.8) with ESMTP id m75AcApX010365
	for <andy.sharp@onstor.com>; Tue, 5 Aug 2008 05:38:11 -0500
Received: from localhost.localdomain ([127.0.0.1]:2485 "EHLO
	ftp.linux-mips.org") by ftp.linux-mips.org with ESMTP
	id S20022056AbYHEKh4 (ORCPT <rfc822;andy.sharp@onstor.com>);
	Tue, 5 Aug 2008 11:37:56 +0100
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 05 Aug 2008 11:37:39 +0100 (BST)
Received: from smtp.gentoo.org ([140.211.166.183]:31695 "EHLO smtp.gentoo.org")
	by ftp.linux-mips.org with ESMTP id S20021826AbYHEKhb (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Tue, 5 Aug 2008 11:37:31 +0100
Received: by smtp.gentoo.org (Postfix, from userid 2204)
	id 7369A67343; Tue,  5 Aug 2008 10:37:28 +0000 (UTC)
Date: 	Tue, 5 Aug 2008 10:37:28 +0000
From: Ricardo Mendoza <ricmm@gentoo.org>
To: linux-mips@linux-mips.org
Cc: ralf@linux-mips.org, yoichi_yuasa@tripeaks.co.jp, ricmm@gentoo.org
Subject: [PATCH] cevt-r4k.c irq ack optimization
Message-ID: <20080805103728.GA4628@woodpecker.gentoo.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.5.16 (2007-06-09)
X-archive-position: 20099
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: ricmm@gentoo.org
Precedence: bulk
X-list: 	linux-mips
X-MessageOne-Virus-Version: vendor=fsecure engine=4.65.7161:2.4.4,1.2.40,4.0.164 definitions=2008-08-04_08:2008-07-30,2008-08-04,2008-08-04 signatures=0
X-MessageOne-Virus-Scanned: Clean
X-MessageOne-Envelope-Sender: linux-mips-bounce@linux-mips.org
X-MessageOne-Spam-Details: rule=m773emszm_notspam policy=m773emszm score=0 spamscore=0 ipscore=0 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx engine=3.1.0-0805090000 definitions=main-0808050020
X-MessageOne-Spam-Score: 0
X-MessageOne-Spam-Bar: 
Return-Path: linux-mips-bounce@linux-mips.org
X-OriginalArrivalTime: 05 Aug 2008 10:38:12.0321 (UTC) FILETIME=[5C1AFD10:01C8F6E7]

Hello Ralf,

Whereas current implementation works, the modification below can protect
us from problems such as the pipeline hazards in vr41xx cpus without any
added extra code length. Also, I beleive Yoichi posted something similar
a few months ago.

Please apply.


     Ricardo

---

Ack the IRQ by writing to c0_compare it's own value rather than the
c0_count value. This prevents issues caused by pipeline hazards, on
vr41xx for example.

Signed-off-by: Ricardo Mendoza <ricmm@gentoo.org>
---
 arch/mips/kernel/cevt-r4k.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/mips/kernel/cevt-r4k.c b/arch/mips/kernel/cevt-r4k.c
index 24a2d90..16e079c 100644
--- a/arch/mips/kernel/cevt-r4k.c
+++ b/arch/mips/kernel/cevt-r4k.c
@@ -186,7 +186,7 @@ static int c0_compare_int_usable(void)
 	 * IP7 already pending?  Try to clear it by acking the timer.
 	 */
 	if (c0_compare_int_pending()) {
-		write_c0_compare(read_c0_count());
+		c0_timer_ack();
 		irq_disable_hazard();
 		if (c0_compare_int_pending())
 			return 0;
@@ -208,7 +208,7 @@ static int c0_compare_int_usable(void)
 	if (!c0_compare_int_pending())
 		return 0;
 
-	write_c0_compare(read_c0_count());
+	c0_timer_ack();
 	irq_disable_hazard();
 	if (c0_compare_int_pending())
 		return 0;

