From kaz@zeugmasystems.com Wed Nov  1 02:09:04 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 01 Nov 2006 02:09:09 +0000 (GMT)
Received: from mail.zeugmasystems.com ([192.139.122.66]:65209 "EHLO
	zeugmasystems.com") by ftp.linux-mips.org with ESMTP
	id S20038894AbWKACJE convert rfc822-to-8bit (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Wed, 1 Nov 2006 02:09:04 +0000
X-MimeOLE: Produced By Microsoft Exchange V6.5
Content-class: urn:content-classes:message
MIME-Version: 1.0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 8BIT
Subject: Cannot run N32 binaries.
Date:	Tue, 31 Oct 2006 18:08:56 -0800
Message-ID: <66910A579C9312469A7DF9ADB54A8B7D44D290@exchange.ZeugmaSystems.local>
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
Thread-Topic: Cannot run N32 binaries.
Thread-Index: Acb9Wq/p0I7t9P5ESGWjkv8F0AtSQg==
From:	"Kaz Kylheku" <kaz@zeugmasystems.com>
To:	<linux-mips@linux-mips.org>
Return-Path: <kaz@zeugmasystems.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13127
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: kaz@zeugmasystems.com
Precedence: bulk
X-list: linux-mips

Before I start debugging this, I thought I'd poll the mailing list.

I've built an N32 root filesystem: all binaries and libs are "ELF 32-bit
N32 MSB MIPS-III ..."

The kernel (2.6.17.7, 64 bit) that I built does have:

CONFIG_MIPS32_N32=y

The filesystem doesn't boot: init cannot be found.
 
I copied the N32 filesystem into a subdirectory of an O32 filesystem in
order to have a look.

Basically, for any executable that I try to run, the error is: "No such
file or directory".

From ilya@total-knowledge.com Wed Nov  1 04:17:34 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 01 Nov 2006 04:17:36 +0000 (GMT)
Received: from alpha.total-knowledge.com ([205.217.158.170]:35774 "EHLO
	total-knowledge.com") by ftp.linux-mips.org with ESMTP
	id S20037602AbWKAERe (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 1 Nov 2006 04:17:34 +0000
Received: (qmail 31997 invoked from network); 31 Oct 2006 20:17:29 -0800
Received: from unknown (HELO ?192.168.0.236?) (ilya@209.157.142.202)
  by alpha.total-knowledge.com with ESMTPA; 31 Oct 2006 20:17:29 -0800
Message-ID: <45481FD5.3080302@total-knowledge.com>
Date:	Tue, 31 Oct 2006 20:17:25 -0800
From:	"Ilya A. Volynets-Evenbakh" <ilya@total-knowledge.com>
Organization: Total Knowledge
User-Agent: Thunderbird 1.5.0.7 (X11/20060918)
MIME-Version: 1.0
To:	Kaz Kylheku <kaz@zeugmasystems.com>
CC:	linux-mips@linux-mips.org
Subject: Re: Cannot run N32 binaries.
References: <66910A579C9312469A7DF9ADB54A8B7D44D290@exchange.ZeugmaSystems.local>
In-Reply-To: <66910A579C9312469A7DF9ADB54A8B7D44D290@exchange.ZeugmaSystems.local>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Return-Path: <ilya@total-knowledge.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13128
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: ilya@total-knowledge.com
Precedence: bulk
X-list: linux-mips

Could be looking for non-existant ld.so.1 (do you have N32 version of it
in /lib32?)

Kaz Kylheku wrote:
> Before I start debugging this, I thought I'd poll the mailing list.
>
> I've built an N32 root filesystem: all binaries and libs are "ELF 32-bit
> N32 MSB MIPS-III ..."
>
> The kernel (2.6.17.7, 64 bit) that I built does have:
>
> CONFIG_MIPS32_N32=y
>
> The filesystem doesn't boot: init cannot be found.
>  
> I copied the N32 filesystem into a subdirectory of an O32 filesystem in
> order to have a look.
>
> Basically, for any executable that I try to run, the error is: "No such
> file or directory".
>
>   

-- 
Ilya A. Volynets-Evenbakh
Total Knowledge. CTO
http://www.total-knowledge.com


From yoichi_yuasa@tripeaks.co.jp Wed Nov  1 09:40:25 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 01 Nov 2006 09:40:27 +0000 (GMT)
Received: from mo32.po.2iij.net ([210.128.50.17]:8995 "EHLO mo32.po.2iij.net")
	by ftp.linux-mips.org with ESMTP id S20039157AbWKAJkZ (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Wed, 1 Nov 2006 09:40:25 +0000
Received: by mo.po.2iij.net (mo32) id kA19eLt8048364; Wed, 1 Nov 2006 18:40:21 +0900 (JST)
Received: from localhost.localdomain (65.126.232.202.bf.2iij.net [202.232.126.65])
	by mbox.po.2iij.net (mbox33) id kA19eFRI099462
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT);
	Wed, 1 Nov 2006 18:40:16 +0900 (JST)
Date:	Wed, 1 Nov 2006 18:40:15 +0900
From:	Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
To:	Ralf Baechle <ralf@linux-mips.org>
Cc:	yoichi_yuasa@tripeaks.co.jp, linux-mips <linux-mips@linux-mips.org>
Subject: [PATCH][MIPS] remove extra definitions for pb1200
Message-Id: <20061101184015.3187ded8.yoichi_yuasa@tripeaks.co.jp>
Organization: TriPeaks Corporation
X-Mailer: Sylpheed version 1.0.4 (GTK+ 1.2.10; i386-pc-linux-gnu)
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Return-Path: <yoichi_yuasa@tripeaks.co.jp>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13129
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: yoichi_yuasa@tripeaks.co.jp
Precedence: bulk
X-list: linux-mips

Hi Ralf,

This patch has removed extra definitions.
These definitions are defined twice.

Yoichi

Signed-off-by: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>

diff -pruN -X mips/Documentation/dontdiff mips-orig/arch/mips/au1000/pb1200/board_setup.c mips/arch/mips/au1000/pb1200/board_setup.c
--- mips-orig/arch/mips/au1000/pb1200/board_setup.c	2006-11-01 14:58:06.339820500 +0900
+++ mips/arch/mips/au1000/pb1200/board_setup.c	2006-11-01 14:57:26.749346250 +0900
@@ -56,7 +56,7 @@
 
 extern char *prom_getcmdline(void);
 extern void _board_init_irq(void);
-extern void	(*board_init_irq)(void);
+extern void (*board_init_irq)(void);
 
 void board_reset (void)
 {
@@ -152,11 +152,7 @@ void __init board_setup(void)
 #endif
 
 	/* Setup Pb1200 External Interrupt Controller */
-	{
-		extern void (*board_init_irq)(void);
-		extern void _board_init_irq(void);
-		board_init_irq = _board_init_irq;
-	}
+	board_init_irq = _board_init_irq;
 }
 
 int

From yoichi_yuasa@tripeaks.co.jp Wed Nov  1 09:45:40 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 01 Nov 2006 09:45:41 +0000 (GMT)
Received: from mo31.po.2iij.net ([210.128.50.54]:29002 "EHLO mo31.po.2iij.net")
	by ftp.linux-mips.org with ESMTP id S20039157AbWKAJpk (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Wed, 1 Nov 2006 09:45:40 +0000
Received: by mo.po.2iij.net (mo31) id kA19jbJN090582; Wed, 1 Nov 2006 18:45:37 +0900 (JST)
Received: from localhost.localdomain (65.126.232.202.bf.2iij.net [202.232.126.65])
	by mbox.po.2iij.net (mbox32) id kA19jamt074809
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT);
	Wed, 1 Nov 2006 18:45:36 +0900 (JST)
Date:	Wed, 1 Nov 2006 18:45:36 +0900
From:	Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
To:	Ralf Baechle <ralf@linux-mips.org>
Cc:	yoichi_yuasa@tripeaks.co.jp, linux-mips <linux-mips@linux-mips.org>
Subject: [PATCH][MIPS] fix warning LOAD_VGA_FONT is not defined
Message-Id: <20061101184536.330411b1.yoichi_yuasa@tripeaks.co.jp>
Organization: TriPeaks Corporation
X-Mailer: Sylpheed version 1.0.4 (GTK+ 1.2.10; i386-pc-linux-gnu)
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Return-Path: <yoichi_yuasa@tripeaks.co.jp>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13130
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: yoichi_yuasa@tripeaks.co.jp
Precedence: bulk
X-list: linux-mips

Hi Ralf,

This patch has fixed the following warning.
 
arch/mips/qemu/q-vga.c:140:5: warning: "LOAD_VGA_FONT" is not defined

Yoichi

Signed-off-by: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>

diff -pruN -X mips/Documentation/dontdiff mips-orig/arch/mips/qemu/q-vga.c mips/arch/mips/qemu/q-vga.c
--- mips-orig/arch/mips/qemu/q-vga.c	2006-10-29 13:07:08.287301500 +0900
+++ mips/arch/mips/qemu/q-vga.c	2006-10-29 13:47:10.125974500 +0900
@@ -137,7 +137,7 @@ void __init qvga_init(void)
 	unsigned int h;
 	int i;
 
-#if LOAD_VGA_FONT
+#ifdef LOAD_VGA_FONT
 	qvga_load_font(vgafont16, 4096);
 #endif
 

From yoichi_yuasa@tripeaks.co.jp Wed Nov  1 09:55:26 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 01 Nov 2006 09:55:28 +0000 (GMT)
Received: from mo31.po.2iij.net ([210.128.50.54]:48147 "EHLO mo31.po.2iij.net")
	by ftp.linux-mips.org with ESMTP id S20039195AbWKAJz0 (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Wed, 1 Nov 2006 09:55:26 +0000
Received: by mo.po.2iij.net (mo31) id kA19tO7L095732; Wed, 1 Nov 2006 18:55:24 +0900 (JST)
Received: from localhost.localdomain (65.126.232.202.bf.2iij.net [202.232.126.65])
	by mbox.po.2iij.net (mbox32) id kA19tMD0090788
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT);
	Wed, 1 Nov 2006 18:55:22 +0900 (JST)
Date:	Wed, 1 Nov 2006 18:55:22 +0900
From:	Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
To:	Ralf Baechle <ralf@linux-mips.org>
Cc:	yoichi_yuasa@tripeaks.co.jp, linux-mips <linux-mips@linux-mips.org>
Subject: [PATCH][MIPS] fix warning mips-boards generic pci
Message-Id: <20061101185522.678913fb.yoichi_yuasa@tripeaks.co.jp>
Organization: TriPeaks Corporation
X-Mailer: Sylpheed version 1.0.4 (GTK+ 1.2.10; i386-pc-linux-gnu)
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Return-Path: <yoichi_yuasa@tripeaks.co.jp>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13131
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: yoichi_yuasa@tripeaks.co.jp
Precedence: bulk
X-list: linux-mips

Hi Ralf,

This patch has fixed the following warning.

arch/mips/mips-boards/generic/pci.c: In function `mips_pcibios_init':
arch/mips/mips-boards/generic/pci.c:227: warning: comparison of distinct pointer types lacks a cast
arch/mips/mips-boards/generic/pci.c:228: warning: comparison of distinct pointer types lacks a cast

Yoichi

Signed-off-by: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>

diff -pruN -X mips/Documentation/dontdiff mips-orig/arch/mips/mips-boards/generic/pci.c mips/arch/mips/mips-boards/generic/pci.c
--- mips-orig/arch/mips/mips-boards/generic/pci.c	2006-10-29 13:42:19.471809750 +0900
+++ mips/arch/mips/mips-boards/generic/pci.c	2006-10-29 13:48:04.077346250 +0900
@@ -90,7 +90,7 @@ static struct pci_controller msc_control
 void __init mips_pcibios_init(void)
 {
 	struct pci_controller *controller;
-	unsigned long start, end, map, start1, end1, map1, map2, map3, mask;
+	resource_size_t start, end, map, start1, end1, map1, map2, map3, mask;
 
 	switch (mips_revision_corid) {
 	case MIPS_REVISION_CORID_QED_RM5261:

From ralf@linux-mips.org Wed Nov  1 12:50:14 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 01 Nov 2006 12:50:15 +0000 (GMT)
Received: from localhost.localdomain ([127.0.0.1]:9871 "EHLO
	dl5rb.ham-radio-op.net") by ftp.linux-mips.org with ESMTP
	id S20039635AbWKAMuO (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 1 Nov 2006 12:50:14 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by dl5rb.ham-radio-op.net (8.13.8/8.13.8) with ESMTP id kA1Cob2Z014978;
	Wed, 1 Nov 2006 12:50:38 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.8/8.13.8/Submit) id kA1CoZwS014977;
	Wed, 1 Nov 2006 12:50:35 GMT
Date:	Wed, 1 Nov 2006 12:50:35 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
Cc:	linux-mips <linux-mips@linux-mips.org>
Subject: Re: [PATCH][MIPS] remove extra definitions for pb1200
Message-ID: <20061101125035.GA11655@linux-mips.org>
References: <20061101184015.3187ded8.yoichi_yuasa@tripeaks.co.jp>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20061101184015.3187ded8.yoichi_yuasa@tripeaks.co.jp>
User-Agent: Mutt/1.4.2.2i
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13132
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: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Wed, Nov 01, 2006 at 06:40:15PM +0900, Yoichi Yuasa wrote:

> This patch has removed extra definitions.
> These definitions are defined twice.

Thanks, queued for 2.6.20,

  Ralf

From ralf@linux-mips.org Wed Nov  1 12:51:44 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 01 Nov 2006 12:51:45 +0000 (GMT)
Received: from localhost.localdomain ([127.0.0.1]:32400 "EHLO
	dl5rb.ham-radio-op.net") by ftp.linux-mips.org with ESMTP
	id S20039648AbWKAMvo (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 1 Nov 2006 12:51:44 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by dl5rb.ham-radio-op.net (8.13.8/8.13.8) with ESMTP id kA1CqAle015030;
	Wed, 1 Nov 2006 12:52:10 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.8/8.13.8/Submit) id kA1CqASR015029;
	Wed, 1 Nov 2006 12:52:10 GMT
Date:	Wed, 1 Nov 2006 12:52:10 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
Cc:	linux-mips <linux-mips@linux-mips.org>
Subject: Re: [PATCH][MIPS] fix warning LOAD_VGA_FONT is not defined
Message-ID: <20061101125210.GB11655@linux-mips.org>
References: <20061101184536.330411b1.yoichi_yuasa@tripeaks.co.jp>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20061101184536.330411b1.yoichi_yuasa@tripeaks.co.jp>
User-Agent: Mutt/1.4.2.2i
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13133
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: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Wed, Nov 01, 2006 at 06:45:36PM +0900, Yoichi Yuasa wrote:

> arch/mips/qemu/q-vga.c:140:5: warning: "LOAD_VGA_FONT" is not defined

Applied,

  Ralf

From ralf@linux-mips.org Wed Nov  1 12:52:19 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 01 Nov 2006 12:52:21 +0000 (GMT)
Received: from localhost.localdomain ([127.0.0.1]:14245 "EHLO
	dl5rb.ham-radio-op.net") by ftp.linux-mips.org with ESMTP
	id S20039640AbWKAMwT (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 1 Nov 2006 12:52:19 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by dl5rb.ham-radio-op.net (8.13.8/8.13.8) with ESMTP id kA1Cqk34015049;
	Wed, 1 Nov 2006 12:52:46 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.8/8.13.8/Submit) id kA1Cqj9I015048;
	Wed, 1 Nov 2006 12:52:45 GMT
Date:	Wed, 1 Nov 2006 12:52:45 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
Cc:	linux-mips <linux-mips@linux-mips.org>
Subject: Re: [PATCH][MIPS] fix warning mips-boards generic pci
Message-ID: <20061101125245.GC11655@linux-mips.org>
References: <20061101185522.678913fb.yoichi_yuasa@tripeaks.co.jp>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20061101185522.678913fb.yoichi_yuasa@tripeaks.co.jp>
User-Agent: Mutt/1.4.2.2i
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13134
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: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Wed, Nov 01, 2006 at 06:55:22PM +0900, Yoichi Yuasa wrote:

> This patch has fixed the following warning.
> 
> arch/mips/mips-boards/generic/pci.c: In function `mips_pcibios_init':
> arch/mips/mips-boards/generic/pci.c:227: warning: comparison of distinct pointer types lacks a cast
> arch/mips/mips-boards/generic/pci.c:228: warning: comparison of distinct pointer types lacks a cast

Applied as well,

  Ralf

From macro@linux-mips.org Wed Nov  1 13:24:22 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 01 Nov 2006 13:24:28 +0000 (GMT)
Received: from pollux.ds.pg.gda.pl ([153.19.208.7]:35342 "EHLO
	pollux.ds.pg.gda.pl") by ftp.linux-mips.org with ESMTP
	id S20038643AbWKANYW (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 1 Nov 2006 13:24:22 +0000
Received: from localhost (localhost [127.0.0.1])
	by pollux.ds.pg.gda.pl (Postfix) with ESMTP id 6666AF5970;
	Wed,  1 Nov 2006 14:24:13 +0100 (CET)
X-Virus-Scanned: by amavisd-new at pollux.ds.pg.gda.pl
Received: from pollux.ds.pg.gda.pl ([127.0.0.1])
	by localhost (pollux.ds.pg.gda.pl [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id ZrZpi4uLvOPT; Wed,  1 Nov 2006 14:24:13 +0100 (CET)
Received: from piorun.ds.pg.gda.pl (piorun.ds.pg.gda.pl [153.19.208.8])
	by pollux.ds.pg.gda.pl (Postfix) with ESMTP id 1445FF5966;
	Wed,  1 Nov 2006 14:24:12 +0100 (CET)
Received: from blysk.ds.pg.gda.pl (macro@blysk.ds.pg.gda.pl [153.19.208.6])
	by piorun.ds.pg.gda.pl (8.13.8/8.13.1) with ESMTP id kA1DOHBE023574;
	Wed, 1 Nov 2006 14:24:22 +0100
Date:	Wed, 1 Nov 2006 13:24:13 +0000 (GMT)
From:	"Maciej W. Rozycki" <macro@linux-mips.org>
To:	Kaz Kylheku <kaz@zeugmasystems.com>
cc:	linux-mips@linux-mips.org
Subject: Re: Cannot run N32 binaries.
In-Reply-To: <66910A579C9312469A7DF9ADB54A8B7D44D290@exchange.ZeugmaSystems.local>
Message-ID: <Pine.LNX.4.64N.0611011314520.15824@blysk.ds.pg.gda.pl>
References: <66910A579C9312469A7DF9ADB54A8B7D44D290@exchange.ZeugmaSystems.local>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Virus-Scanned: ClamAV 0.88.5/2137/Wed Nov  1 09:39:47 2006 on piorun.ds.pg.gda.pl
X-Virus-Status:	Clean
Return-Path: <macro@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13135
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: macro@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Tue, 31 Oct 2006, Kaz Kylheku wrote:

> I've built an N32 root filesystem: all binaries and libs are "ELF 32-bit
> N32 MSB MIPS-III ..."
> 
> The kernel (2.6.17.7, 64 bit) that I built does have:
> 
> CONFIG_MIPS32_N32=y
> 
> The filesystem doesn't boot: init cannot be found.
[...]
> Basically, for any executable that I try to run, the error is: "No such
> file or directory".

 For a start you could try running a statically linked shell as your 
"init", like specifying "init=/bin/bash.static" at your kernel command 
line.  If that works, check that your shared libraries are where the 
shared loader expects them to be -- for n32 that could be "/lib32", 
"/usr/lib32", etc., but it depends on how it has been built.  Note you can 
invoke the loader manually to examine its behaviour (run it without 
arguments to get some help) and then there are a couple of LD_* 
environment variables that it recognizes that may aid you with figuring 
out what is wrong (you may have to look at the sources for how to use them 
though).

  Maciej

From kaz@zeugmasystems.com Wed Nov  1 16:32:35 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 01 Nov 2006 16:32:42 +0000 (GMT)
Received: from mail.zeugmasystems.com ([192.139.122.66]:45764 "EHLO
	zeugmasystems.com") by ftp.linux-mips.org with ESMTP
	id S20039173AbWKAQcf convert rfc822-to-8bit (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Wed, 1 Nov 2006 16:32:35 +0000
X-MimeOLE: Produced By Microsoft Exchange V6.5
Content-class: urn:content-classes:message
MIME-Version: 1.0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 8BIT
Subject: RE: Cannot run N32 binaries.
Date:	Wed, 1 Nov 2006 08:32:27 -0800
Message-ID: <66910A579C9312469A7DF9ADB54A8B7D44D2C5@exchange.ZeugmaSystems.local>
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
Thread-Topic: Cannot run N32 binaries.
Thread-Index: Acb9bKd0RJqzXaylRYertPgeqD+j7QAY/WpQ
From:	"Kaz Kylheku" <kaz@zeugmasystems.com>
To:	<linux-mips@linux-mips.org>
Return-Path: <kaz@zeugmasystems.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13136
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: kaz@zeugmasystems.com
Precedence: bulk
X-list: linux-mips

Ilya A. Volynets-Evenbakh wrote:
> Could be looking for non-existant ld.so.1 (do you have N32 
> version of it
> in /lib32?)

That is correct. If I make a /lib32 -> lib symbolic link, everything
runs.

I actually built the libs under /lib, but I did not realize that ld
simply writes a hard-coded path for the dynamic linker into executables.

That is to say, I built an all-n32 system, using /lib and /usr/lib.

This is elegant, but probably a bad idea, so I will go back to the
/lib32 scheme.


From anemo@mba.ocn.ne.jp Wed Nov  1 17:06:19 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 01 Nov 2006 17:06:26 +0000 (GMT)
Received: from mba.ocn.ne.jp ([210.190.142.172]:30960 "HELO smtp.mba.ocn.ne.jp")
	by ftp.linux-mips.org with SMTP id S20039292AbWKARGT (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Wed, 1 Nov 2006 17:06:19 +0000
Received: from localhost (p4119-ipad201funabasi.chiba.ocn.ne.jp [222.146.67.119])
	by smtp.mba.ocn.ne.jp (Postfix) with ESMTP id B0F4FA766
	for <linux-mips@linux-mips.org>; Thu,  2 Nov 2006 02:06:05 +0900 (JST)
Date:	Thu, 02 Nov 2006 02:08:36 +0900 (JST)
Message-Id: <20061102.020836.25912635.anemo@mba.ocn.ne.jp>
To:	linux-mips@linux-mips.org
Subject: [PATCH] mips irq cleanups
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
X-Fingerprint: 6ACA 1623 39BD 9A94 9B1A  B746 CA77 FE94 2874 D52F
X-Pgp-Public-Key: http://wwwkeys.pgp.net/pks/lookup?op=get&search=0x2874D52F
X-Mailer: Mew version 3.3 on Emacs 21.4 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Return-Path: <anemo@mba.ocn.ne.jp>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13137
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: anemo@mba.ocn.ne.jp
Precedence: bulk
X-list: linux-mips

This is a big irq cleanup patch.

* Use set_irq_chip() to register irq_chip.
* Initialize .mask, .unmask, .mask_ack field.  Functions for these
  method are already exist in most case.
* Do not initialize .startup, .shutdown, .enable, .disable fields if
  default routines provided by irq_chip_set_defaults() were suitable.
* Remove redundant irq_desc initializations.
* Remove unnecessary local_irq_save/local_irq_restore, spin_lock.

With this cleanup, it would be easy to switch to slightly lightwait
irq flow handlers (handle_level_irq(), etc.) instead of __do_IRQ().

Though whole this patch is quite large, changes in each irq_chip are
not quite simple.  Please review and test on your platform.  Thanks.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>

 arch/mips/au1000/common/irq.c                            |   63 +----
 arch/mips/ddb5xxx/ddb5477/irq_5477.c                     |   23 -
 arch/mips/dec/ecc-berr.c                                 |    6 
 arch/mips/dec/ioasic-irq.c                               |   72 +----
 arch/mips/dec/kn02-irq.c                                 |   53 ----
 arch/mips/emma2rh/common/irq_emma2rh.c                   |   34 --
 arch/mips/emma2rh/markeins/irq_markeins.c                |   55 ----
 arch/mips/gt64120/ev64120/irq.c                          |   40 ---
 arch/mips/jazz/irq.c                                     |   27 --
 arch/mips/jmr3927/rbhma3100/irq.c                        |   32 --
 arch/mips/kernel/i8259.c                                 |   21 -
 arch/mips/kernel/irq-msc01.c                             |   45 ---
 arch/mips/kernel/irq-mv6434x.c                           |   53 ----
 arch/mips/kernel/irq-rm7000.c                            |   53 ----
 arch/mips/kernel/irq-rm9000.c                            |   45 ---
 arch/mips/kernel/irq.c                                   |   13 -
 arch/mips/kernel/irq_cpu.c                               |   64 -----
 arch/mips/lasat/interrupt.c                              |   36 --
 arch/mips/mips-boards/atlas/atlas_int.c                  |   28 --
 arch/mips/momentum/ocelot_c/cpci-irq.c                   |   53 ----
 arch/mips/momentum/ocelot_c/uart-irq.c                   |   56 ----
 arch/mips/philips/pnx8550/common/int.c                   |   66 -----
 arch/mips/sgi-ip22/ip22-eisa.c                           |   33 --
 arch/mips/sgi-ip22/ip22-int.c                            |  109 +-------
 arch/mips/sgi-ip27/ip27-irq.c                            |   17 -
 arch/mips/sgi-ip27/ip27-timer.c                          |   27 --
 arch/mips/sgi-ip32/ip32-irq.c                            |  133 +---------
 arch/mips/sibyte/bcm1480/irq.c                           |   30 --
 arch/mips/sibyte/sb1250/irq.c                            |   30 --
 arch/mips/sni/irq.c                                      |   40 ---
 arch/mips/tx4927/common/tx4927_irq.c                     |  162 -------------
 arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c |  183 ---------------
 arch/mips/tx4938/common/irq.c                            |  113 ---------
 arch/mips/tx4938/toshiba_rbtx4938/irq.c                  |   53 ----
 arch/mips/vr41xx/common/icu.c                            |   46 ---
 arch/mips/vr41xx/nec-cmbvr4133/irq.c                     |   20 -
 include/asm-mips/dec/kn02.h                              |    2 
 37 files changed, 289 insertions(+), 1647 deletions(-)

diff --git a/arch/mips/au1000/common/irq.c b/arch/mips/au1000/common/irq.c
index 2abe132..9cf7b67 100644
--- a/arch/mips/au1000/common/irq.c
+++ b/arch/mips/au1000/common/irq.c
@@ -70,7 +70,6 @@ extern irq_cpustat_t irq_stat [NR_CPUS];
 extern void mips_timer_interrupt(void);
 
 static void setup_local_irq(unsigned int irq, int type, int int_req);
-static unsigned int startup_irq(unsigned int irq);
 static void end_irq(unsigned int irq_nr);
 static inline void mask_and_ack_level_irq(unsigned int irq_nr);
 static inline void mask_and_ack_rise_edge_irq(unsigned int irq_nr);
@@ -84,20 +83,6 @@ void	(*board_init_irq)(void);
 static DEFINE_SPINLOCK(irq_lock);
 
 
-static unsigned int startup_irq(unsigned int irq_nr)
-{
-	local_enable_irq(irq_nr);
-	return 0;
-}
-
-
-static void shutdown_irq(unsigned int irq_nr)
-{
-	local_disable_irq(irq_nr);
-	return;
-}
-
-
 inline void local_enable_irq(unsigned int irq_nr)
 {
 	if (irq_nr > AU1000_LAST_INTC0_INT) {
@@ -249,41 +234,37 @@ void restore_local_and_enable(int contro
 
 static struct irq_chip rise_edge_irq_type = {
 	.typename = "Au1000 Rise Edge",
-	.startup = startup_irq,
-	.shutdown = shutdown_irq,
-	.enable = local_enable_irq,
-	.disable = local_disable_irq,
 	.ack = mask_and_ack_rise_edge_irq,
+	.mask = local_disable_irq,
+	.mask_ack = mask_and_ack_rise_edge_irq,
+	.unmask = local_enable_irq,
 	.end = end_irq,
 };
 
 static struct irq_chip fall_edge_irq_type = {
 	.typename = "Au1000 Fall Edge",
-	.startup = startup_irq,
-	.shutdown = shutdown_irq,
-	.enable = local_enable_irq,
-	.disable = local_disable_irq,
 	.ack = mask_and_ack_fall_edge_irq,
+	.mask = local_disable_irq,
+	.mask_ack = mask_and_ack_fall_edge_irq,
+	.unmask = local_enable_irq,
 	.end = end_irq,
 };
 
 static struct irq_chip either_edge_irq_type = {
 	.typename = "Au1000 Rise or Fall Edge",
-	.startup = startup_irq,
-	.shutdown = shutdown_irq,
-	.enable = local_enable_irq,
-	.disable = local_disable_irq,
 	.ack = mask_and_ack_either_edge_irq,
+	.mask = local_disable_irq,
+	.mask_ack = mask_and_ack_either_edge_irq,
+	.unmask = local_enable_irq,
 	.end = end_irq,
 };
 
 static struct irq_chip level_irq_type = {
 	.typename = "Au1000 Level",
-	.startup = startup_irq,
-	.shutdown = shutdown_irq,
-	.enable = local_enable_irq,
-	.disable = local_disable_irq,
 	.ack = mask_and_ack_level_irq,
+	.mask = local_disable_irq,
+	.mask_ack = mask_and_ack_level_irq,
+	.unmask = local_enable_irq,
 	.end = end_irq,
 };
 
@@ -328,31 +309,31 @@ static void setup_local_irq(unsigned int
 				au_writel(1<<(irq_nr-32), IC1_CFG2CLR);
 				au_writel(1<<(irq_nr-32), IC1_CFG1CLR);
 				au_writel(1<<(irq_nr-32), IC1_CFG0SET);
-				irq_desc[irq_nr].chip = &rise_edge_irq_type;
+				set_irq_chip(irq_nr, &rise_edge_irq_type);
 				break;
 			case INTC_INT_FALL_EDGE: /* 0:1:0 */
 				au_writel(1<<(irq_nr-32), IC1_CFG2CLR);
 				au_writel(1<<(irq_nr-32), IC1_CFG1SET);
 				au_writel(1<<(irq_nr-32), IC1_CFG0CLR);
-				irq_desc[irq_nr].chip = &fall_edge_irq_type;
+				set_irq_chip(irq_nr, &fall_edge_irq_type);
 				break;
 			case INTC_INT_RISE_AND_FALL_EDGE: /* 0:1:1 */
 				au_writel(1<<(irq_nr-32), IC1_CFG2CLR);
 				au_writel(1<<(irq_nr-32), IC1_CFG1SET);
 				au_writel(1<<(irq_nr-32), IC1_CFG0SET);
-				irq_desc[irq_nr].chip = &either_edge_irq_type;
+				set_irq_chip(irq_nr, &either_edge_irq_type);
 				break;
 			case INTC_INT_HIGH_LEVEL: /* 1:0:1 */
 				au_writel(1<<(irq_nr-32), IC1_CFG2SET);
 				au_writel(1<<(irq_nr-32), IC1_CFG1CLR);
 				au_writel(1<<(irq_nr-32), IC1_CFG0SET);
-				irq_desc[irq_nr].chip = &level_irq_type;
+				set_irq_chip(irq_nr, &level_irq_type);
 				break;
 			case INTC_INT_LOW_LEVEL: /* 1:1:0 */
 				au_writel(1<<(irq_nr-32), IC1_CFG2SET);
 				au_writel(1<<(irq_nr-32), IC1_CFG1SET);
 				au_writel(1<<(irq_nr-32), IC1_CFG0CLR);
-				irq_desc[irq_nr].chip = &level_irq_type;
+				set_irq_chip(irq_nr, &level_irq_type);
 				break;
 			case INTC_INT_DISABLED: /* 0:0:0 */
 				au_writel(1<<(irq_nr-32), IC1_CFG0CLR);
@@ -380,31 +361,31 @@ static void setup_local_irq(unsigned int
 				au_writel(1<<irq_nr, IC0_CFG2CLR);
 				au_writel(1<<irq_nr, IC0_CFG1CLR);
 				au_writel(1<<irq_nr, IC0_CFG0SET);
-				irq_desc[irq_nr].chip = &rise_edge_irq_type;
+				set_irq_chip(irq_nr, &rise_edge_irq_type);
 				break;
 			case INTC_INT_FALL_EDGE: /* 0:1:0 */
 				au_writel(1<<irq_nr, IC0_CFG2CLR);
 				au_writel(1<<irq_nr, IC0_CFG1SET);
 				au_writel(1<<irq_nr, IC0_CFG0CLR);
-				irq_desc[irq_nr].chip = &fall_edge_irq_type;
+				set_irq_chip(irq_nr, &fall_edge_irq_type);
 				break;
 			case INTC_INT_RISE_AND_FALL_EDGE: /* 0:1:1 */
 				au_writel(1<<irq_nr, IC0_CFG2CLR);
 				au_writel(1<<irq_nr, IC0_CFG1SET);
 				au_writel(1<<irq_nr, IC0_CFG0SET);
-				irq_desc[irq_nr].chip = &either_edge_irq_type;
+				set_irq_chip(irq_nr, &either_edge_irq_type);
 				break;
 			case INTC_INT_HIGH_LEVEL: /* 1:0:1 */
 				au_writel(1<<irq_nr, IC0_CFG2SET);
 				au_writel(1<<irq_nr, IC0_CFG1CLR);
 				au_writel(1<<irq_nr, IC0_CFG0SET);
-				irq_desc[irq_nr].chip = &level_irq_type;
+				set_irq_chip(irq_nr, &level_irq_type);
 				break;
 			case INTC_INT_LOW_LEVEL: /* 1:1:0 */
 				au_writel(1<<irq_nr, IC0_CFG2SET);
 				au_writel(1<<irq_nr, IC0_CFG1SET);
 				au_writel(1<<irq_nr, IC0_CFG0CLR);
-				irq_desc[irq_nr].chip = &level_irq_type;
+				set_irq_chip(irq_nr, &level_irq_type);
 				break;
 			case INTC_INT_DISABLED: /* 0:0:0 */
 				au_writel(1<<irq_nr, IC0_CFG0CLR);
diff --git a/arch/mips/ddb5xxx/ddb5477/irq_5477.c b/arch/mips/ddb5xxx/ddb5477/irq_5477.c
index ba52705..96249aa 100644
--- a/arch/mips/ddb5xxx/ddb5477/irq_5477.c
+++ b/arch/mips/ddb5xxx/ddb5477/irq_5477.c
@@ -53,14 +53,6 @@ vrc5477_irq_disable(unsigned int irq)
 	ll_vrc5477_irq_disable(irq - vrc5477_irq_base);
 }
 
-static unsigned int vrc5477_irq_startup(unsigned int irq)
-{
-	vrc5477_irq_enable(irq);
-	return 0;
-}
-
-#define	vrc5477_irq_shutdown	vrc5477_irq_disable
-
 static void
 vrc5477_irq_ack(unsigned int irq)
 {
@@ -91,11 +83,10 @@ vrc5477_irq_end(unsigned int irq)
 
 struct irq_chip vrc5477_irq_controller = {
 	.typename = "vrc5477_irq",
-	.startup = vrc5477_irq_startup,
-	.shutdown = vrc5477_irq_shutdown,
-	.enable = vrc5477_irq_enable,
-	.disable = vrc5477_irq_disable,
 	.ack = vrc5477_irq_ack,
+	.mask = vrc5477_irq_disable,
+	.mask_ack = vrc5477_irq_ack,
+	.unmask = vrc5477_irq_enable,
 	.end = vrc5477_irq_end
 };
 
@@ -103,12 +94,8 @@ void __init vrc5477_irq_init(u32 irq_bas
 {
 	u32 i;
 
-	for (i= irq_base; i< irq_base+ NUM_5477_IRQ; i++) {
-		irq_desc[i].status = IRQ_DISABLED;
-		irq_desc[i].action = NULL;
-		irq_desc[i].depth = 1;
-		irq_desc[i].chip = &vrc5477_irq_controller;
-	}
+	for (i= irq_base; i< irq_base+ NUM_5477_IRQ; i++)
+		set_irq_chip(i, &vrc5477_irq_controller);
 
 	vrc5477_irq_base = irq_base;
 }
diff --git a/arch/mips/dec/ecc-berr.c b/arch/mips/dec/ecc-berr.c
index 3e374d0..c8430c0 100644
--- a/arch/mips/dec/ecc-berr.c
+++ b/arch/mips/dec/ecc-berr.c
@@ -18,7 +18,6 @@ #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
-#include <linux/spinlock.h>
 #include <linux/types.h>
 
 #include <asm/addrspace.h>
@@ -231,13 +230,10 @@ irqreturn_t dec_ecc_be_interrupt(int irq
 static inline void dec_kn02_be_init(void)
 {
 	volatile u32 *csr = (void *)CKSEG1ADDR(KN02_SLOT_BASE + KN02_CSR);
-	unsigned long flags;
 
 	kn0x_erraddr = (void *)CKSEG1ADDR(KN02_SLOT_BASE + KN02_ERRADDR);
 	kn0x_chksyn = (void *)CKSEG1ADDR(KN02_SLOT_BASE + KN02_CHKSYN);
 
-	spin_lock_irqsave(&kn02_lock, flags);
-
 	/* Preset write-only bits of the Control Register cache. */
 	cached_kn02_csr = *csr | KN02_CSR_LEDS;
 
@@ -247,8 +243,6 @@ static inline void dec_kn02_be_init(void
 	cached_kn02_csr |= KN02_CSR_CORRECT;
 	*csr = cached_kn02_csr;
 	iob();
-
-	spin_unlock_irqrestore(&kn02_lock, flags);
 }
 
 static inline void dec_kn03_be_init(void)
diff --git a/arch/mips/dec/ioasic-irq.c b/arch/mips/dec/ioasic-irq.c
index 41cd2a9..d0af08b 100644
--- a/arch/mips/dec/ioasic-irq.c
+++ b/arch/mips/dec/ioasic-irq.c
@@ -13,7 +13,6 @@
 
 #include <linux/init.h>
 #include <linux/irq.h>
-#include <linux/spinlock.h>
 #include <linux/types.h>
 
 #include <asm/dec/ioasic.h>
@@ -21,8 +20,6 @@ #include <asm/dec/ioasic_addrs.h>
 #include <asm/dec/ioasic_ints.h>
 
 
-static DEFINE_SPINLOCK(ioasic_lock);
-
 static int ioasic_irq_base;
 
 
@@ -52,65 +49,31 @@ static inline void clear_ioasic_irq(unsi
 	ioasic_write(IO_REG_SIR, sir);
 }
 
-static inline void enable_ioasic_irq(unsigned int irq)
-{
-	unsigned long flags;
-
-	spin_lock_irqsave(&ioasic_lock, flags);
-	unmask_ioasic_irq(irq);
-	spin_unlock_irqrestore(&ioasic_lock, flags);
-}
-
-static inline void disable_ioasic_irq(unsigned int irq)
-{
-	unsigned long flags;
-
-	spin_lock_irqsave(&ioasic_lock, flags);
-	mask_ioasic_irq(irq);
-	spin_unlock_irqrestore(&ioasic_lock, flags);
-}
-
-
-static inline unsigned int startup_ioasic_irq(unsigned int irq)
-{
-	enable_ioasic_irq(irq);
-	return 0;
-}
-
-#define shutdown_ioasic_irq disable_ioasic_irq
-
 static inline void ack_ioasic_irq(unsigned int irq)
 {
-	spin_lock(&ioasic_lock);
 	mask_ioasic_irq(irq);
-	spin_unlock(&ioasic_lock);
 	fast_iob();
 }
 
 static inline void end_ioasic_irq(unsigned int irq)
 {
 	if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
-		enable_ioasic_irq(irq);
+		unmask_ioasic_irq(irq);
 }
 
 static struct irq_chip ioasic_irq_type = {
 	.typename = "IO-ASIC",
-	.startup = startup_ioasic_irq,
-	.shutdown = shutdown_ioasic_irq,
-	.enable = enable_ioasic_irq,
-	.disable = disable_ioasic_irq,
 	.ack = ack_ioasic_irq,
+	.mask = mask_ioasic_irq,
+	.mask_ack = ack_ioasic_irq,
+	.unmask = unmask_ioasic_irq,
 	.end = end_ioasic_irq,
 };
 
 
-#define startup_ioasic_dma_irq startup_ioasic_irq
-
-#define shutdown_ioasic_dma_irq shutdown_ioasic_irq
-
-#define enable_ioasic_dma_irq enable_ioasic_irq
+#define unmask_ioasic_dma_irq unmask_ioasic_irq
 
-#define disable_ioasic_dma_irq disable_ioasic_irq
+#define mask_ioasic_dma_irq mask_ioasic_irq
 
 #define ack_ioasic_dma_irq ack_ioasic_irq
 
@@ -123,11 +86,10 @@ static inline void end_ioasic_dma_irq(un
 
 static struct irq_chip ioasic_dma_irq_type = {
 	.typename = "IO-ASIC-DMA",
-	.startup = startup_ioasic_dma_irq,
-	.shutdown = shutdown_ioasic_dma_irq,
-	.enable = enable_ioasic_dma_irq,
-	.disable = disable_ioasic_dma_irq,
 	.ack = ack_ioasic_dma_irq,
+	.mask = mask_ioasic_dma_irq,
+	.mask_ack = ack_ioasic_dma_irq,
+	.unmask = unmask_ioasic_dma_irq,
 	.end = end_ioasic_dma_irq,
 };
 
@@ -140,18 +102,10 @@ void __init init_ioasic_irqs(int base)
 	ioasic_write(IO_REG_SIMR, 0);
 	fast_iob();
 
-	for (i = base; i < base + IO_INR_DMA; i++) {
-		irq_desc[i].status = IRQ_DISABLED;
-		irq_desc[i].action = 0;
-		irq_desc[i].depth = 1;
-		irq_desc[i].chip = &ioasic_irq_type;
-	}
-	for (; i < base + IO_IRQ_LINES; i++) {
-		irq_desc[i].status = IRQ_DISABLED;
-		irq_desc[i].action = 0;
-		irq_desc[i].depth = 1;
-		irq_desc[i].chip = &ioasic_dma_irq_type;
-	}
+	for (i = base; i < base + IO_INR_DMA; i++)
+		set_irq_chip(i, &ioasic_irq_type);
+	for (; i < base + IO_IRQ_LINES; i++)
+		set_irq_chip(i, &ioasic_dma_irq_type);
 
 	ioasic_irq_base = base;
 }
diff --git a/arch/mips/dec/kn02-irq.c b/arch/mips/dec/kn02-irq.c
index 04a367a..c761d97 100644
--- a/arch/mips/dec/kn02-irq.c
+++ b/arch/mips/dec/kn02-irq.c
@@ -14,7 +14,6 @@
 
 #include <linux/init.h>
 #include <linux/irq.h>
-#include <linux/spinlock.h>
 #include <linux/types.h>
 
 #include <asm/dec/kn02.h>
@@ -29,7 +28,6 @@ #include <asm/dec/kn02.h>
  * There is no default value -- it has to be initialized.
  */
 u32 cached_kn02_csr;
-DEFINE_SPINLOCK(kn02_lock);
 
 
 static int kn02_irq_base;
@@ -53,54 +51,24 @@ static inline void mask_kn02_irq(unsigne
 	*csr = cached_kn02_csr;
 }
 
-static inline void enable_kn02_irq(unsigned int irq)
-{
-	unsigned long flags;
-
-	spin_lock_irqsave(&kn02_lock, flags);
-	unmask_kn02_irq(irq);
-	spin_unlock_irqrestore(&kn02_lock, flags);
-}
-
-static inline void disable_kn02_irq(unsigned int irq)
-{
-	unsigned long flags;
-
-	spin_lock_irqsave(&kn02_lock, flags);
-	mask_kn02_irq(irq);
-	spin_unlock_irqrestore(&kn02_lock, flags);
-}
-
-
-static unsigned int startup_kn02_irq(unsigned int irq)
-{
-	enable_kn02_irq(irq);
-	return 0;
-}
-
-#define shutdown_kn02_irq disable_kn02_irq
-
 static void ack_kn02_irq(unsigned int irq)
 {
-	spin_lock(&kn02_lock);
 	mask_kn02_irq(irq);
-	spin_unlock(&kn02_lock);
 	iob();
 }
 
 static void end_kn02_irq(unsigned int irq)
 {
 	if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
-		enable_kn02_irq(irq);
+		unmask_kn02_irq(irq);
 }
 
 static struct irq_chip kn02_irq_type = {
 	.typename = "KN02-CSR",
-	.startup = startup_kn02_irq,
-	.shutdown = shutdown_kn02_irq,
-	.enable = enable_kn02_irq,
-	.disable = disable_kn02_irq,
 	.ack = ack_kn02_irq,
+	.mask = mask_kn02_irq,
+	.mask_ack = ack_kn02_irq,
+	.unmask = unmask_kn02_irq,
 	.end = end_kn02_irq,
 };
 
@@ -109,22 +77,15 @@ void __init init_kn02_irqs(int base)
 {
 	volatile u32 *csr = (volatile u32 *)CKSEG1ADDR(KN02_SLOT_BASE +
 						       KN02_CSR);
-	unsigned long flags;
 	int i;
 
 	/* Mask interrupts. */
-	spin_lock_irqsave(&kn02_lock, flags);
 	cached_kn02_csr &= ~KN02_CSR_IOINTEN;
 	*csr = cached_kn02_csr;
 	iob();
-	spin_unlock_irqrestore(&kn02_lock, flags);
-
-	for (i = base; i < base + KN02_IRQ_LINES; i++) {
-		irq_desc[i].status = IRQ_DISABLED;
-		irq_desc[i].action = 0;
-		irq_desc[i].depth = 1;
-		irq_desc[i].chip = &kn02_irq_type;
-	}
+
+	for (i = base; i < base + KN02_IRQ_LINES; i++)
+		set_irq_chip(i, &kn02_irq_type);
 
 	kn02_irq_base = base;
 }
diff --git a/arch/mips/emma2rh/common/irq_emma2rh.c b/arch/mips/emma2rh/common/irq_emma2rh.c
index 197ed4c..bf1b83b 100644
--- a/arch/mips/emma2rh/common/irq_emma2rh.c
+++ b/arch/mips/emma2rh/common/irq_emma2rh.c
@@ -56,22 +56,6 @@ static void emma2rh_irq_disable(unsigned
 	ll_emma2rh_irq_disable(irq - emma2rh_irq_base);
 }
 
-static unsigned int emma2rh_irq_startup(unsigned int irq)
-{
-	emma2rh_irq_enable(irq);
-	return 0;
-}
-
-#define	emma2rh_irq_shutdown	emma2rh_irq_disable
-
-static void emma2rh_irq_ack(unsigned int irq)
-{
-	/* disable interrupt - some handler will re-enable the irq
-	 * and if the interrupt is leveled, we will have infinite loop
-	 */
-	ll_emma2rh_irq_disable(irq - emma2rh_irq_base);
-}
-
 static void emma2rh_irq_end(unsigned int irq)
 {
 	if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
@@ -80,25 +64,19 @@ static void emma2rh_irq_end(unsigned int
 
 struct irq_chip emma2rh_irq_controller = {
 	.typename = "emma2rh_irq",
-	.startup = emma2rh_irq_startup,
-	.shutdown = emma2rh_irq_shutdown,
-	.enable = emma2rh_irq_enable,
-	.disable = emma2rh_irq_disable,
-	.ack = emma2rh_irq_ack,
+	.ack = emma2rh_irq_disable,
+	.mask = emma2rh_irq_disable,
+	.mask_ack = emma2rh_irq_disable,
+	.unmask = emma2rh_irq_enable,
 	.end = emma2rh_irq_end,
-	.set_affinity = NULL	/* no affinity stuff for UP */
 };
 
 void emma2rh_irq_init(u32 irq_base)
 {
 	u32 i;
 
-	for (i = irq_base; i < irq_base + NUM_EMMA2RH_IRQ; i++) {
-		irq_desc[i].status = IRQ_DISABLED;
-		irq_desc[i].action = NULL;
-		irq_desc[i].depth = 1;
-		irq_desc[i].chip = &emma2rh_irq_controller;
-	}
+	for (i = irq_base; i < irq_base + NUM_EMMA2RH_IRQ; i++)
+		set_irq_chip(i, &emma2rh_irq_controller);
 
 	emma2rh_irq_base = irq_base;
 }
diff --git a/arch/mips/emma2rh/markeins/irq_markeins.c b/arch/mips/emma2rh/markeins/irq_markeins.c
index 0b36eb0..8e5f08a 100644
--- a/arch/mips/emma2rh/markeins/irq_markeins.c
+++ b/arch/mips/emma2rh/markeins/irq_markeins.c
@@ -48,19 +48,6 @@ static void emma2rh_sw_irq_disable(unsig
 	ll_emma2rh_sw_irq_disable(irq - emma2rh_sw_irq_base);
 }
 
-static unsigned int emma2rh_sw_irq_startup(unsigned int irq)
-{
-	emma2rh_sw_irq_enable(irq);
-	return 0;
-}
-
-#define emma2rh_sw_irq_shutdown emma2rh_sw_irq_disable
-
-static void emma2rh_sw_irq_ack(unsigned int irq)
-{
-	ll_emma2rh_sw_irq_disable(irq - emma2rh_sw_irq_base);
-}
-
 static void emma2rh_sw_irq_end(unsigned int irq)
 {
 	if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
@@ -69,25 +56,19 @@ static void emma2rh_sw_irq_end(unsigned 
 
 struct irq_chip emma2rh_sw_irq_controller = {
 	.typename = "emma2rh_sw_irq",
-	.startup = emma2rh_sw_irq_startup,
-	.shutdown = emma2rh_sw_irq_shutdown,
-	.enable = emma2rh_sw_irq_enable,
-	.disable = emma2rh_sw_irq_disable,
-	.ack = emma2rh_sw_irq_ack,
+	.ack = emma2rh_sw_irq_disable,
+	.mask = emma2rh_sw_irq_disable,
+	.mask_ack = emma2rh_sw_irq_disable,
+	.unmask = emma2rh_sw_irq_enable,
 	.end = emma2rh_sw_irq_end,
-	.set_affinity = NULL,
 };
 
 void emma2rh_sw_irq_init(u32 irq_base)
 {
 	u32 i;
 
-	for (i = irq_base; i < irq_base + NUM_EMMA2RH_IRQ_SW; i++) {
-		irq_desc[i].status = IRQ_DISABLED;
-		irq_desc[i].action = NULL;
-		irq_desc[i].depth = 2;
-		irq_desc[i].chip = &emma2rh_sw_irq_controller;
-	}
+	for (i = irq_base; i < irq_base + NUM_EMMA2RH_IRQ_SW; i++)
+		set_irq_chip(i, &emma2rh_sw_irq_controller);
 
 	emma2rh_sw_irq_base = irq_base;
 }
@@ -126,14 +107,6 @@ static void emma2rh_gpio_irq_disable(uns
 	ll_emma2rh_gpio_irq_disable(irq - emma2rh_gpio_irq_base);
 }
 
-static unsigned int emma2rh_gpio_irq_startup(unsigned int irq)
-{
-	emma2rh_gpio_irq_enable(irq);
-	return 0;
-}
-
-#define emma2rh_gpio_irq_shutdown emma2rh_gpio_irq_disable
-
 static void emma2rh_gpio_irq_ack(unsigned int irq)
 {
 	irq -= emma2rh_gpio_irq_base;
@@ -149,25 +122,19 @@ static void emma2rh_gpio_irq_end(unsigne
 
 struct irq_chip emma2rh_gpio_irq_controller = {
 	.typename = "emma2rh_gpio_irq",
-	.startup = emma2rh_gpio_irq_startup,
-	.shutdown = emma2rh_gpio_irq_shutdown,
-	.enable = emma2rh_gpio_irq_enable,
-	.disable = emma2rh_gpio_irq_disable,
 	.ack = emma2rh_gpio_irq_ack,
+	.mask = emma2rh_gpio_irq_disable,
+	.mask_ack = emma2rh_gpio_irq_ack,
+	.unmask = emma2rh_gpio_irq_enable,
 	.end = emma2rh_gpio_irq_end,
-	.set_affinity = NULL,
 };
 
 void emma2rh_gpio_irq_init(u32 irq_base)
 {
 	u32 i;
 
-	for (i = irq_base; i < irq_base + NUM_EMMA2RH_IRQ_GPIO; i++) {
-		irq_desc[i].status = IRQ_DISABLED;
-		irq_desc[i].action = NULL;
-		irq_desc[i].depth = 2;
-		irq_desc[i].chip = &emma2rh_gpio_irq_controller;
-	}
+	for (i = irq_base; i < irq_base + NUM_EMMA2RH_IRQ_GPIO; i++)
+		set_irq_chip(i, &emma2rh_gpio_irq_controller);
 
 	emma2rh_gpio_irq_base = irq_base;
 }
diff --git a/arch/mips/gt64120/ev64120/irq.c b/arch/mips/gt64120/ev64120/irq.c
index ed4d82b..b3e5796 100644
--- a/arch/mips/gt64120/ev64120/irq.c
+++ b/arch/mips/gt64120/ev64120/irq.c
@@ -66,38 +66,21 @@ asmlinkage void plat_irq_dispatch(void)
 
 static void disable_ev64120_irq(unsigned int irq_nr)
 {
-	unsigned long flags;
-
-	local_irq_save(flags);
 	if (irq_nr >= 8) {	// All PCI interrupts are on line 5 or 2
 		clear_c0_status(9 << 10);
 	} else {
 		clear_c0_status(1 << (irq_nr + 8));
 	}
-	local_irq_restore(flags);
 }
 
 static void enable_ev64120_irq(unsigned int irq_nr)
 {
-	unsigned long flags;
-
-	local_irq_save(flags);
 	if (irq_nr >= 8)	// All PCI interrupts are on line 5 or 2
 		set_c0_status(9 << 10);
 	else
 		set_c0_status(1 << (irq_nr + 8));
-	local_irq_restore(flags);
-}
-
-static unsigned int startup_ev64120_irq(unsigned int irq)
-{
-	enable_ev64120_irq(irq);
-	return 0;		/* Never anything pending  */
 }
 
-#define shutdown_ev64120_irq     disable_ev64120_irq
-#define mask_and_ack_ev64120_irq disable_ev64120_irq
-
 static void end_ev64120_irq(unsigned int irq)
 {
 	if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
@@ -106,13 +89,11 @@ static void end_ev64120_irq(unsigned int
 
 static struct irq_chip ev64120_irq_type = {
 	.typename	= "EV64120",
-	.startup	= startup_ev64120_irq,
-	.shutdown	= shutdown_ev64120_irq,
-	.enable		= enable_ev64120_irq,
-	.disable	= disable_ev64120_irq,
-	.ack		= mask_and_ack_ev64120_irq,
+	.ack		= disable_ev64120_irq,
+	.mask		= disable_ev64120_irq,
+	.mask_ack	= disable_ev64120_irq,
+	.unmask		= enable_ev64120_irq,
 	.end		= end_ev64120_irq,
-	.set_affinity	= NULL
 };
 
 void gt64120_irq_setup(void)
@@ -122,8 +103,6 @@ void gt64120_irq_setup(void)
 	 */
 	clear_c0_status(ST0_IM);
 
-	local_irq_disable();
-
 	/*
 	 * Enable timer.  Other interrupts will be enabled as they are
 	 * registered.
@@ -133,16 +112,5 @@ void gt64120_irq_setup(void)
 
 void __init arch_init_irq(void)
 {
-	int i;
-
-	/*  Let's initialize our IRQ descriptors  */
-	for (i = 0; i < NR_IRQS; i++) {
-		irq_desc[i].status = 0;
-		irq_desc[i].chip = &no_irq_chip;
-		irq_desc[i].action = NULL;
-		irq_desc[i].depth = 0;
-		spin_lock_init(&irq_desc[i].lock);
-	}
-
 	gt64120_irq_setup();
 }
diff --git a/arch/mips/jazz/irq.c b/arch/mips/jazz/irq.c
index d5bd6b3..4bbb6cb 100644
--- a/arch/mips/jazz/irq.c
+++ b/arch/mips/jazz/irq.c
@@ -28,14 +28,6 @@ static void enable_r4030_irq(unsigned in
 	spin_unlock_irqrestore(&r4030_lock, flags);
 }
 
-static unsigned int startup_r4030_irq(unsigned int irq)
-{
-	enable_r4030_irq(irq);
-	return 0; /* never anything pending */
-}
-
-#define shutdown_r4030_irq	disable_r4030_irq
-
 void disable_r4030_irq(unsigned int irq)
 {
 	unsigned int mask = ~(1 << (irq - JAZZ_PARALLEL_IRQ));
@@ -47,8 +39,6 @@ void disable_r4030_irq(unsigned int irq)
 	spin_unlock_irqrestore(&r4030_lock, flags);
 }
 
-#define mask_and_ack_r4030_irq disable_r4030_irq
-
 static void end_r4030_irq(unsigned int irq)
 {
 	if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
@@ -57,11 +47,10 @@ static void end_r4030_irq(unsigned int i
 
 static struct irq_chip r4030_irq_type = {
 	.typename = "R4030",
-	.startup = startup_r4030_irq,
-	.shutdown = shutdown_r4030_irq,
-	.enable = enable_r4030_irq,
-	.disable = disable_r4030_irq,
-	.ack = mask_and_ack_r4030_irq,
+	.ack = disable_r4030_irq,
+	.mask = disable_r4030_irq,
+	.mask_ack = disable_r4030_irq,
+	.unmask = enable_r4030_irq,
 	.end = end_r4030_irq,
 };
 
@@ -69,12 +58,8 @@ void __init init_r4030_ints(void)
 {
 	int i;
 
-	for (i = JAZZ_PARALLEL_IRQ; i <= JAZZ_TIMER_IRQ; i++) {
-		irq_desc[i].status     = IRQ_DISABLED;
-		irq_desc[i].action     = 0;
-		irq_desc[i].depth      = 1;
-		irq_desc[i].chip    = &r4030_irq_type;
-	}
+	for (i = JAZZ_PARALLEL_IRQ; i <= JAZZ_TIMER_IRQ; i++)
+		set_irq_chip(i, &r4030_irq_type);
 
 	r4030_write_reg16(JAZZ_IO_IRQ_ENABLE, 0);
 	r4030_read_reg16(JAZZ_IO_IRQ_SOURCE);		/* clear pending IRQs */
diff --git a/arch/mips/jmr3927/rbhma3100/irq.c b/arch/mips/jmr3927/rbhma3100/irq.c
index de4a238..3da49c5 100644
--- a/arch/mips/jmr3927/rbhma3100/irq.c
+++ b/arch/mips/jmr3927/rbhma3100/irq.c
@@ -90,17 +90,6 @@ static unsigned char irc_level[TX3927_NU
 static void jmr3927_irq_disable(unsigned int irq_nr);
 static void jmr3927_irq_enable(unsigned int irq_nr);
 
-static DEFINE_SPINLOCK(jmr3927_irq_lock);
-
-static unsigned int jmr3927_irq_startup(unsigned int irq)
-{
-	jmr3927_irq_enable(irq);
-
-	return 0;
-}
-
-#define	jmr3927_irq_shutdown	jmr3927_irq_disable
-
 static void jmr3927_irq_ack(unsigned int irq)
 {
 	if (irq == JMR3927_IRQ_IRC_TMR0)
@@ -118,9 +107,7 @@ static void jmr3927_irq_end(unsigned int
 static void jmr3927_irq_disable(unsigned int irq_nr)
 {
 	struct tb_irq_space* sp;
-	unsigned long flags;
 
-	spin_lock_irqsave(&jmr3927_irq_lock, flags);
 	for (sp = tb_irq_spaces; sp; sp = sp->next) {
 		if (sp->start_irqno <= irq_nr &&
 		    irq_nr < sp->start_irqno + sp->nr_irqs) {
@@ -130,15 +117,12 @@ static void jmr3927_irq_disable(unsigned
 			break;
 		}
 	}
-	spin_unlock_irqrestore(&jmr3927_irq_lock, flags);
 }
 
 static void jmr3927_irq_enable(unsigned int irq_nr)
 {
 	struct tb_irq_space* sp;
-	unsigned long flags;
 
-	spin_lock_irqsave(&jmr3927_irq_lock, flags);
 	for (sp = tb_irq_spaces; sp; sp = sp->next) {
 		if (sp->start_irqno <= irq_nr &&
 		    irq_nr < sp->start_irqno + sp->nr_irqs) {
@@ -148,7 +132,6 @@ static void jmr3927_irq_enable(unsigned 
 			break;
 		}
 	}
-	spin_unlock_irqrestore(&jmr3927_irq_lock, flags);
 }
 
 /*
@@ -457,11 +440,10 @@ #endif
 
 static struct irq_chip jmr3927_irq_controller = {
 	.typename = "jmr3927_irq",
-	.startup = jmr3927_irq_startup,
-	.shutdown = jmr3927_irq_shutdown,
-	.enable = jmr3927_irq_enable,
-	.disable = jmr3927_irq_disable,
 	.ack = jmr3927_irq_ack,
+	.mask = jmr3927_irq_disable,
+	.mask_ack = jmr3927_irq_ack,
+	.unmask = jmr3927_irq_enable,
 	.end = jmr3927_irq_end,
 };
 
@@ -469,12 +451,8 @@ void jmr3927_irq_init(u32 irq_base)
 {
 	u32 i;
 
-	for (i= irq_base; i< irq_base + JMR3927_NR_IRQ_IRC + JMR3927_NR_IRQ_IOC; i++) {
-		irq_desc[i].status = IRQ_DISABLED;
-		irq_desc[i].action = NULL;
-		irq_desc[i].depth = 1;
-		irq_desc[i].chip = &jmr3927_irq_controller;
-	}
+	for (i= irq_base; i< irq_base + JMR3927_NR_IRQ_IRC + JMR3927_NR_IRQ_IOC; i++)
+		set_irq_chip(i, &jmr3927_irq_controller);
 
 	jmr3927_irq_base = irq_base;
 }
diff --git a/arch/mips/kernel/i8259.c b/arch/mips/kernel/i8259.c
index 48e3418..2526c0c 100644
--- a/arch/mips/kernel/i8259.c
+++ b/arch/mips/kernel/i8259.c
@@ -40,21 +40,10 @@ static void end_8259A_irq (unsigned int 
 		enable_8259A_irq(irq);
 }
 
-#define shutdown_8259A_irq	disable_8259A_irq
-
 void mask_and_ack_8259A(unsigned int);
 
-static unsigned int startup_8259A_irq(unsigned int irq)
-{
-	enable_8259A_irq(irq);
-
-	return 0; /* never anything pending */
-}
-
 static struct irq_chip i8259A_irq_type = {
 	.typename = "XT-PIC",
-	.startup = startup_8259A_irq,
-	.shutdown = shutdown_8259A_irq,
 	.enable = enable_8259A_irq,
 	.disable = disable_8259A_irq,
 	.ack = mask_and_ack_8259A,
@@ -120,7 +109,7 @@ int i8259A_irq_pending(unsigned int irq)
 void make_8259A_irq(unsigned int irq)
 {
 	disable_irq_nosync(irq);
-	irq_desc[irq].chip = &i8259A_irq_type;
+	set_irq_chip(irq, &i8259A_irq_type);
 	enable_irq(irq);
 }
 
@@ -323,12 +312,8 @@ void __init init_i8259_irqs (void)
 
 	init_8259A(0);
 
-	for (i = 0; i < 16; i++) {
-		irq_desc[i].status = IRQ_DISABLED;
-		irq_desc[i].action = NULL;
-		irq_desc[i].depth = 1;
-		irq_desc[i].chip = &i8259A_irq_type;
-	}
+	for (i = 0; i < 16; i++)
+		set_irq_chip(i, &i8259A_irq_type);
 
 	setup_irq(2, &irq2);
 }
diff --git a/arch/mips/kernel/irq-msc01.c b/arch/mips/kernel/irq-msc01.c
index 650a80c..e1880b2 100644
--- a/arch/mips/kernel/irq-msc01.c
+++ b/arch/mips/kernel/irq-msc01.c
@@ -45,31 +45,6 @@ static inline void unmask_msc_irq(unsign
 }
 
 /*
- * Enables the IRQ on SOC-it
- */
-static void enable_msc_irq(unsigned int irq)
-{
-	unmask_msc_irq(irq);
-}
-
-/*
- * Initialize the IRQ on SOC-it
- */
-static unsigned int startup_msc_irq(unsigned int irq)
-{
-	unmask_msc_irq(irq);
-	return 0;
-}
-
-/*
- * Disables the IRQ on SOC-it
- */
-static void disable_msc_irq(unsigned int irq)
-{
-	mask_msc_irq(irq);
-}
-
-/*
  * Masks and ACKs an IRQ
  */
 static void level_mask_and_ack_msc_irq(unsigned int irq)
@@ -136,25 +111,21 @@ msc_bind_eic_interrupt (unsigned int irq
 		    (irq<<MSC01_IC_RAMW_ADDR_SHF) | (set<<MSC01_IC_RAMW_DATA_SHF));
 }
 
-#define shutdown_msc_irq	disable_msc_irq
-
 struct irq_chip msc_levelirq_type = {
 	.typename = "SOC-it-Level",
-	.startup = startup_msc_irq,
-	.shutdown = shutdown_msc_irq,
-	.enable = enable_msc_irq,
-	.disable = disable_msc_irq,
 	.ack = level_mask_and_ack_msc_irq,
+	.mask = mask_msc_irq,
+	.mask_ack = level_mask_and_ack_msc_irq,
+	.unmask = unmask_msc_irq,
 	.end = end_msc_irq,
 };
 
 struct irq_chip msc_edgeirq_type = {
 	.typename = "SOC-it-Edge",
-	.startup =startup_msc_irq,
-	.shutdown = shutdown_msc_irq,
-	.enable = enable_msc_irq,
-	.disable = disable_msc_irq,
 	.ack = edge_mask_and_ack_msc_irq,
+	.mask = mask_msc_irq,
+	.mask_ack = edge_mask_and_ack_msc_irq,
+	.unmask = unmask_msc_irq,
 	.end = end_msc_irq,
 };
 
@@ -175,14 +146,14 @@ void __init init_msc_irqs(unsigned int b
 
 		switch (imp->im_type) {
 		case MSC01_IRQ_EDGE:
-			irq_desc[base+n].chip = &msc_edgeirq_type;
+			set_irq_chip(base+n, &msc_edgeirq_type);
 			if (cpu_has_veic)
 				MSCIC_WRITE(MSC01_IC_SUP+n*8, MSC01_IC_SUP_EDGE_BIT);
 			else
 				MSCIC_WRITE(MSC01_IC_SUP+n*8, MSC01_IC_SUP_EDGE_BIT | imp->im_lvl);
 			break;
 		case MSC01_IRQ_LEVEL:
-			irq_desc[base+n].chip = &msc_levelirq_type;
+			set_irq_chip(base+n, &msc_levelirq_type);
 			if (cpu_has_veic)
 				MSCIC_WRITE(MSC01_IC_SUP+n*8, 0);
 			else
diff --git a/arch/mips/kernel/irq-mv6434x.c b/arch/mips/kernel/irq-mv6434x.c
index 37d1062..5012b9d 100644
--- a/arch/mips/kernel/irq-mv6434x.c
+++ b/arch/mips/kernel/irq-mv6434x.c
@@ -67,39 +67,6 @@ static inline void unmask_mv64340_irq(un
 }
 
 /*
- * Enables the IRQ on Marvell Chip
- */
-static void enable_mv64340_irq(unsigned int irq)
-{
-	unmask_mv64340_irq(irq);
-}
-
-/*
- * Initialize the IRQ on Marvell Chip
- */
-static unsigned int startup_mv64340_irq(unsigned int irq)
-{
-	unmask_mv64340_irq(irq);
-	return 0;
-}
-
-/*
- * Disables the IRQ on Marvell Chip
- */
-static void disable_mv64340_irq(unsigned int irq)
-{
-	mask_mv64340_irq(irq);
-}
-
-/*
- * Masks and ACKs an IRQ
- */
-static void mask_and_ack_mv64340_irq(unsigned int irq)
-{
-	mask_mv64340_irq(irq);
-}
-
-/*
  * End IRQ processing
  */
 static void end_mv64340_irq(unsigned int irq)
@@ -133,15 +100,12 @@ void ll_mv64340_irq(void)
 		do_IRQ(ls1bit32(irq_src_high) + irq_base + 32);
 }
 
-#define shutdown_mv64340_irq	disable_mv64340_irq
-
 struct irq_chip mv64340_irq_type = {
 	.typename = "MV-64340",
-	.startup = startup_mv64340_irq,
-	.shutdown = shutdown_mv64340_irq,
-	.enable = enable_mv64340_irq,
-	.disable = disable_mv64340_irq,
-	.ack = mask_and_ack_mv64340_irq,
+	.ack = mask_mv64340_irq,
+	.mask = mask_mv64340_irq,
+	.mask_ack = mask_mv64340_irq,
+	.unmask = unmask_mv64340_irq,
 	.end = end_mv64340_irq,
 };
 
@@ -149,13 +113,8 @@ void __init mv64340_irq_init(unsigned in
 {
 	int i;
 
-	/* Reset irq handlers pointers to NULL */
-	for (i = base; i < base + 64; i++) {
-		irq_desc[i].status = IRQ_DISABLED;
-		irq_desc[i].action = 0;
-		irq_desc[i].depth = 2;
-		irq_desc[i].chip = &mv64340_irq_type;
-	}
+	for (i = base; i < base + 64; i++)
+		set_irq_chip(i, &mv64340_irq_type);
 
 	irq_base = base;
 }
diff --git a/arch/mips/kernel/irq-rm7000.c b/arch/mips/kernel/irq-rm7000.c
index 6b54c71..6a297e3 100644
--- a/arch/mips/kernel/irq-rm7000.c
+++ b/arch/mips/kernel/irq-rm7000.c
@@ -29,42 +29,6 @@ static inline void mask_rm7k_irq(unsigne
 	clear_c0_intcontrol(0x100 << (irq - irq_base));
 }
 
-static inline void rm7k_cpu_irq_enable(unsigned int irq)
-{
-	unsigned long flags;
-
-	local_irq_save(flags);
-	unmask_rm7k_irq(irq);
-	local_irq_restore(flags);
-}
-
-static void rm7k_cpu_irq_disable(unsigned int irq)
-{
-	unsigned long flags;
-
-	local_irq_save(flags);
-	mask_rm7k_irq(irq);
-	local_irq_restore(flags);
-}
-
-static unsigned int rm7k_cpu_irq_startup(unsigned int irq)
-{
-	rm7k_cpu_irq_enable(irq);
-
-	return 0;
-}
-
-#define	rm7k_cpu_irq_shutdown	rm7k_cpu_irq_disable
-
-/*
- * While we ack the interrupt interrupts are disabled and thus we don't need
- * to deal with concurrency issues.  Same for rm7k_cpu_irq_end.
- */
-static void rm7k_cpu_irq_ack(unsigned int irq)
-{
-	mask_rm7k_irq(irq);
-}
-
 static void rm7k_cpu_irq_end(unsigned int irq)
 {
 	if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
@@ -73,11 +37,10 @@ static void rm7k_cpu_irq_end(unsigned in
 
 static struct irq_chip rm7k_irq_controller = {
 	.typename = "RM7000",
-	.startup = rm7k_cpu_irq_startup,
-	.shutdown = rm7k_cpu_irq_shutdown,
-	.enable = rm7k_cpu_irq_enable,
-	.disable = rm7k_cpu_irq_disable,
-	.ack = rm7k_cpu_irq_ack,
+	.ack = mask_rm7k_irq,
+	.mask = mask_rm7k_irq,
+	.mask_ack = mask_rm7k_irq,
+	.unmask = unmask_rm7k_irq,
 	.end = rm7k_cpu_irq_end,
 };
 
@@ -87,12 +50,8 @@ void __init rm7k_cpu_irq_init(int base)
 
 	clear_c0_intcontrol(0x00000f00);		/* Mask all */
 
-	for (i = base; i < base + 4; i++) {
-		irq_desc[i].status = IRQ_DISABLED;
-		irq_desc[i].action = NULL;
-		irq_desc[i].depth = 1;
-		irq_desc[i].chip = &rm7k_irq_controller;
-	}
+	for (i = base; i < base + 4; i++)
+		set_irq_chip(i, &rm7k_irq_controller);
 
 	irq_base = base;
 }
diff --git a/arch/mips/kernel/irq-rm9000.c b/arch/mips/kernel/irq-rm9000.c
index 62f011b..9775384 100644
--- a/arch/mips/kernel/irq-rm9000.c
+++ b/arch/mips/kernel/irq-rm9000.c
@@ -48,15 +48,6 @@ static void rm9k_cpu_irq_disable(unsigne
 	local_irq_restore(flags);
 }
 
-static unsigned int rm9k_cpu_irq_startup(unsigned int irq)
-{
-	rm9k_cpu_irq_enable(irq);
-
-	return 0;
-}
-
-#define	rm9k_cpu_irq_shutdown	rm9k_cpu_irq_disable
-
 /*
  * Performance counter interrupts are global on all processors.
  */
@@ -89,16 +80,6 @@ static void rm9k_perfcounter_irq_shutdow
 	on_each_cpu(local_rm9k_perfcounter_irq_shutdown, (void *) irq, 0, 1);
 }
 
-
-/*
- * While we ack the interrupt interrupts are disabled and thus we don't need
- * to deal with concurrency issues.  Same for rm9k_cpu_irq_end.
- */
-static void rm9k_cpu_irq_ack(unsigned int irq)
-{
-	mask_rm9k_irq(irq);
-}
-
 static void rm9k_cpu_irq_end(unsigned int irq)
 {
 	if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
@@ -107,11 +88,10 @@ static void rm9k_cpu_irq_end(unsigned in
 
 static struct irq_chip rm9k_irq_controller = {
 	.typename = "RM9000",
-	.startup = rm9k_cpu_irq_startup,
-	.shutdown = rm9k_cpu_irq_shutdown,
-	.enable = rm9k_cpu_irq_enable,
-	.disable = rm9k_cpu_irq_disable,
-	.ack = rm9k_cpu_irq_ack,
+	.ack = mask_rm9k_irq,
+	.mask = mask_rm9k_irq,
+	.mask_ack = mask_rm9k_irq,
+	.unmask = unmask_rm9k_irq,
 	.end = rm9k_cpu_irq_end,
 };
 
@@ -119,9 +99,10 @@ static struct irq_chip rm9k_perfcounter_
 	.typename = "RM9000",
 	.startup = rm9k_perfcounter_irq_startup,
 	.shutdown = rm9k_perfcounter_irq_shutdown,
-	.enable = rm9k_cpu_irq_enable,
-	.disable = rm9k_cpu_irq_disable,
-	.ack = rm9k_cpu_irq_ack,
+	.ack = mask_rm9k_irq,
+	.mask = mask_rm9k_irq,
+	.mask_ack = mask_rm9k_irq,
+	.unmask = unmask_rm9k_irq,
 	.end = rm9k_cpu_irq_end,
 };
 
@@ -135,15 +116,11 @@ void __init rm9k_cpu_irq_init(int base)
 
 	clear_c0_intcontrol(0x0000f000);		/* Mask all */
 
-	for (i = base; i < base + 4; i++) {
-		irq_desc[i].status = IRQ_DISABLED;
-		irq_desc[i].action = NULL;
-		irq_desc[i].depth = 1;
-		irq_desc[i].chip = &rm9k_irq_controller;
-	}
+	for (i = base; i < base + 4; i++)
+		set_irq_chip(i, &rm9k_irq_controller);
 
 	rm9000_perfcount_irq = base + 1;
-	irq_desc[rm9000_perfcount_irq].chip = &rm9k_perfcounter_irq;
+	set_irq_chip(rm9000_perfcount_irq, &rm9k_perfcounter_irq);
 
 	irq_base = base;
 }
diff --git a/arch/mips/kernel/irq.c b/arch/mips/kernel/irq.c
index dd24434..c9961d8 100644
--- a/arch/mips/kernel/irq.c
+++ b/arch/mips/kernel/irq.c
@@ -130,19 +130,6 @@ #endif
 
 void __init init_IRQ(void)
 {
-	int i;
-
-	for (i = 0; i < NR_IRQS; i++) {
-		irq_desc[i].status  = IRQ_DISABLED;
-		irq_desc[i].action  = NULL;
-		irq_desc[i].depth   = 1;
-		irq_desc[i].chip = &no_irq_chip;
-		spin_lock_init(&irq_desc[i].lock);
-#ifdef CONFIG_MIPS_MT_SMTC
-		irq_hwmask[i] = 0;
-#endif /* CONFIG_MIPS_MT_SMTC */
-	}
-
 	arch_init_irq();
 
 #ifdef CONFIG_KGDB
diff --git a/arch/mips/kernel/irq_cpu.c b/arch/mips/kernel/irq_cpu.c
index 9bb21c7..79fea0f 100644
--- a/arch/mips/kernel/irq_cpu.c
+++ b/arch/mips/kernel/irq_cpu.c
@@ -50,35 +50,6 @@ static inline void mask_mips_irq(unsigne
 	irq_disable_hazard();
 }
 
-static inline void mips_cpu_irq_enable(unsigned int irq)
-{
-	unsigned long flags;
-
-	local_irq_save(flags);
-	unmask_mips_irq(irq);
-	back_to_back_c0_hazard();
-	local_irq_restore(flags);
-}
-
-static void mips_cpu_irq_disable(unsigned int irq)
-{
-	unsigned long flags;
-
-	local_irq_save(flags);
-	mask_mips_irq(irq);
-	back_to_back_c0_hazard();
-	local_irq_restore(flags);
-}
-
-static unsigned int mips_cpu_irq_startup(unsigned int irq)
-{
-	mips_cpu_irq_enable(irq);
-
-	return 0;
-}
-
-#define	mips_cpu_irq_shutdown		mips_cpu_irq_disable
-
 /*
  * While we ack the interrupt interrupts are disabled and thus we don't need
  * to deal with concurrency issues.  Same for mips_cpu_irq_end.
@@ -96,11 +67,9 @@ static void mips_cpu_irq_end(unsigned in
 
 static struct irq_chip mips_cpu_irq_controller = {
 	.typename	= "MIPS",
-	.startup	= mips_cpu_irq_startup,
-	.shutdown	= mips_cpu_irq_shutdown,
-	.enable		= mips_cpu_irq_enable,
-	.disable	= mips_cpu_irq_disable,
 	.ack		= mips_cpu_irq_ack,
+	.mask		= mask_mips_irq,
+	.unmask		= unmask_mips_irq,
 	.end		= mips_cpu_irq_end,
 };
 
@@ -110,8 +79,6 @@ static struct irq_chip mips_cpu_irq_cont
 
 #define unmask_mips_mt_irq	unmask_mips_irq
 #define mask_mips_mt_irq	mask_mips_irq
-#define mips_mt_cpu_irq_enable	mips_cpu_irq_enable
-#define mips_mt_cpu_irq_disable	mips_cpu_irq_disable
 
 static unsigned int mips_mt_cpu_irq_startup(unsigned int irq)
 {
@@ -119,13 +86,11 @@ static unsigned int mips_mt_cpu_irq_star
 
 	clear_c0_cause(0x100 << (irq - mips_cpu_irq_base));
 	evpe(vpflags);
-	mips_mt_cpu_irq_enable(irq);
+	unmask_mips_mt_irq(irq);
 
 	return 0;
 }
 
-#define	mips_mt_cpu_irq_shutdown	mips_mt_cpu_irq_disable
-
 /*
  * While we ack the interrupt interrupts are disabled and thus we don't need
  * to deal with concurrency issues.  Same for mips_cpu_irq_end.
@@ -143,10 +108,9 @@ #define mips_mt_cpu_irq_end mips_cpu_irq
 static struct irq_chip mips_mt_cpu_irq_controller = {
 	.typename	= "MIPS",
 	.startup	= mips_mt_cpu_irq_startup,
-	.shutdown	= mips_mt_cpu_irq_shutdown,
-	.enable		= mips_mt_cpu_irq_enable,
-	.disable	= mips_mt_cpu_irq_disable,
 	.ack		= mips_mt_cpu_irq_ack,
+	.mask		= mask_mips_mt_irq,
+	.unmask		= unmask_mips_mt_irq,
 	.end		= mips_mt_cpu_irq_end,
 };
 
@@ -163,19 +127,11 @@ void __init mips_cpu_irq_init(int irq_ba
 	 * leave them uninitialized for other processors.
 	 */
 	if (cpu_has_mipsmt)
-		for (i = irq_base; i < irq_base + 2; i++) {
-			irq_desc[i].status = IRQ_DISABLED;
-			irq_desc[i].action = NULL;
-			irq_desc[i].depth = 1;
-			irq_desc[i].chip = &mips_mt_cpu_irq_controller;
-		}
-
-	for (i = irq_base + 2; i < irq_base + 8; i++) {
-		irq_desc[i].status = IRQ_DISABLED;
-		irq_desc[i].action = NULL;
-		irq_desc[i].depth = 1;
-		irq_desc[i].chip = &mips_cpu_irq_controller;
-	}
+		for (i = irq_base; i < irq_base + 2; i++)
+			set_irq_chip(i, &mips_mt_cpu_irq_controller);
+
+	for (i = irq_base + 2; i < irq_base + 8; i++)
+		set_irq_chip(i, &mips_cpu_irq_controller);
 
 	mips_cpu_irq_base = irq_base;
 }
diff --git a/arch/mips/lasat/interrupt.c b/arch/mips/lasat/interrupt.c
index a144a00..cac82af 100644
--- a/arch/mips/lasat/interrupt.c
+++ b/arch/mips/lasat/interrupt.c
@@ -36,33 +36,14 @@ static volatile int lasat_int_mask_shift
 
 void disable_lasat_irq(unsigned int irq_nr)
 {
-	unsigned long flags;
-
-	local_irq_save(flags);
 	*lasat_int_mask &= ~(1 << irq_nr) << lasat_int_mask_shift;
-	local_irq_restore(flags);
 }
 
 void enable_lasat_irq(unsigned int irq_nr)
 {
-	unsigned long flags;
-
-	local_irq_save(flags);
 	*lasat_int_mask |= (1 << irq_nr) << lasat_int_mask_shift;
-	local_irq_restore(flags);
 }
 
-static unsigned int startup_lasat_irq(unsigned int irq)
-{
-	enable_lasat_irq(irq);
-
-	return 0; /* never anything pending */
-}
-
-#define shutdown_lasat_irq	disable_lasat_irq
-
-#define mask_and_ack_lasat_irq disable_lasat_irq
-
 static void end_lasat_irq(unsigned int irq)
 {
 	if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
@@ -71,11 +52,10 @@ static void end_lasat_irq(unsigned int i
 
 static struct irq_chip lasat_irq_type = {
 	.typename = "Lasat",
-	.startup = startup_lasat_irq,
-	.shutdown = shutdown_lasat_irq,
-	.enable = enable_lasat_irq,
-	.disable = disable_lasat_irq,
-	.ack = mask_and_ack_lasat_irq,
+	.ack = disable_lasat_irq,
+	.mask = disable_lasat_irq,
+	.mask_ack = disable_lasat_irq,
+	.unmask = enable_lasat_irq,
 	.end = end_lasat_irq,
 };
 
@@ -152,10 +132,6 @@ void __init arch_init_irq(void)
 		panic("arch_init_irq: mips_machtype incorrect");
 	}
 
-	for (i = 0; i <= LASATINT_END; i++) {
-		irq_desc[i].status	= IRQ_DISABLED;
-		irq_desc[i].action	= 0;
-		irq_desc[i].depth	= 1;
-		irq_desc[i].chip	= &lasat_irq_type;
-	}
+	for (i = 0; i <= LASATINT_END; i++)
+		set_irq_chip(i, &lasat_irq_type);
 }
diff --git a/arch/mips/mips-boards/atlas/atlas_int.c b/arch/mips/mips-boards/atlas/atlas_int.c
index be624b8..7c71004 100644
--- a/arch/mips/mips-boards/atlas/atlas_int.c
+++ b/arch/mips/mips-boards/atlas/atlas_int.c
@@ -62,16 +62,6 @@ void enable_atlas_irq(unsigned int irq_n
 	iob();
 }
 
-static unsigned int startup_atlas_irq(unsigned int irq)
-{
-	enable_atlas_irq(irq);
-	return 0; /* never anything pending */
-}
-
-#define shutdown_atlas_irq	disable_atlas_irq
-
-#define mask_and_ack_atlas_irq disable_atlas_irq
-
 static void end_atlas_irq(unsigned int irq)
 {
 	if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
@@ -80,11 +70,10 @@ static void end_atlas_irq(unsigned int i
 
 static struct irq_chip atlas_irq_type = {
 	.typename = "Atlas",
-	.startup = startup_atlas_irq,
-	.shutdown = shutdown_atlas_irq,
-	.enable = enable_atlas_irq,
-	.disable = disable_atlas_irq,
-	.ack = mask_and_ack_atlas_irq,
+	.ack = disable_atlas_irq,
+	.mask = disable_atlas_irq,
+	.mask_ack = disable_atlas_irq,
+	.unmask = enable_atlas_irq,
 	.end = end_atlas_irq,
 };
 
@@ -217,13 +206,8 @@ static inline void init_atlas_irqs (int 
 	 */
 	atlas_hw0_icregs->intrsten = 0xffffffff;
 
-	for (i = ATLAS_INT_BASE; i <= ATLAS_INT_END; i++) {
-		irq_desc[i].status	= IRQ_DISABLED;
-		irq_desc[i].action	= 0;
-		irq_desc[i].depth	= 1;
-		irq_desc[i].chip	= &atlas_irq_type;
-		spin_lock_init(&irq_desc[i].lock);
-	}
+	for (i = ATLAS_INT_BASE; i <= ATLAS_INT_END; i++)
+		set_irq_chip(i, &atlas_irq_type);
 }
 
 static struct irqaction atlasirq = {
diff --git a/arch/mips/momentum/ocelot_c/cpci-irq.c b/arch/mips/momentum/ocelot_c/cpci-irq.c
index 47e3fa3..7723f09 100644
--- a/arch/mips/momentum/ocelot_c/cpci-irq.c
+++ b/arch/mips/momentum/ocelot_c/cpci-irq.c
@@ -66,39 +66,6 @@ static inline void unmask_cpci_irq(unsig
 }
 
 /*
- * Enables the IRQ in the FPGA
- */
-static void enable_cpci_irq(unsigned int irq)
-{
-	unmask_cpci_irq(irq);
-}
-
-/*
- * Initialize the IRQ in the FPGA
- */
-static unsigned int startup_cpci_irq(unsigned int irq)
-{
-	unmask_cpci_irq(irq);
-	return 0;
-}
-
-/*
- * Disables the IRQ in the FPGA
- */
-static void disable_cpci_irq(unsigned int irq)
-{
-	mask_cpci_irq(irq);
-}
-
-/*
- * Masks and ACKs an IRQ
- */
-static void mask_and_ack_cpci_irq(unsigned int irq)
-{
-	mask_cpci_irq(irq);
-}
-
-/*
  * End IRQ processing
  */
 static void end_cpci_irq(unsigned int irq)
@@ -125,15 +92,12 @@ void ll_cpci_irq(void)
 	do_IRQ(ls1bit8(irq_src) + CPCI_IRQ_BASE);
 }
 
-#define shutdown_cpci_irq	disable_cpci_irq
-
 struct irq_chip cpci_irq_type = {
 	.typename = "CPCI/FPGA",
-	.startup = startup_cpci_irq,
-	.shutdown = shutdown_cpci_irq,
-	.enable = enable_cpci_irq,
-	.disable = disable_cpci_irq,
-	.ack = mask_and_ack_cpci_irq,
+	.ack = mask_cpci_irq,
+	.mask = mask_cpci_irq,
+	.mask_ack = mask_cpci_irq,
+	.unmask = unmask_cpci_irq,
 	.end = end_cpci_irq,
 };
 
@@ -141,11 +105,6 @@ void cpci_irq_init(void)
 {
 	int i;
 
-	/* Reset irq handlers pointers to NULL */
-	for (i = CPCI_IRQ_BASE; i < (CPCI_IRQ_BASE + 8); i++) {
-		irq_desc[i].status = IRQ_DISABLED;
-		irq_desc[i].action = 0;
-		irq_desc[i].depth = 2;
-		irq_desc[i].chip = &cpci_irq_type;
-	}
+	for (i = CPCI_IRQ_BASE; i < (CPCI_IRQ_BASE + 8); i++)
+		set_irq_chip(i, &cpci_irq_type);
 }
diff --git a/arch/mips/momentum/ocelot_c/uart-irq.c b/arch/mips/momentum/ocelot_c/uart-irq.c
index 510257d..72faf81 100644
--- a/arch/mips/momentum/ocelot_c/uart-irq.c
+++ b/arch/mips/momentum/ocelot_c/uart-irq.c
@@ -60,39 +60,6 @@ static inline void unmask_uart_irq(unsig
 }
 
 /*
- * Enables the IRQ in the FPGA
- */
-static void enable_uart_irq(unsigned int irq)
-{
-	unmask_uart_irq(irq);
-}
-
-/*
- * Initialize the IRQ in the FPGA
- */
-static unsigned int startup_uart_irq(unsigned int irq)
-{
-	unmask_uart_irq(irq);
-	return 0;
-}
-
-/*
- * Disables the IRQ in the FPGA
- */
-static void disable_uart_irq(unsigned int irq)
-{
-	mask_uart_irq(irq);
-}
-
-/*
- * Masks and ACKs an IRQ
- */
-static void mask_and_ack_uart_irq(unsigned int irq)
-{
-	mask_uart_irq(irq);
-}
-
-/*
  * End IRQ processing
  */
 static void end_uart_irq(unsigned int irq)
@@ -118,28 +85,17 @@ void ll_uart_irq(void)
 	do_IRQ(ls1bit8(irq_src) + 74);
 }
 
-#define shutdown_uart_irq	disable_uart_irq
-
 struct irq_chip uart_irq_type = {
 	.typename = "UART/FPGA",
-	.startup = startup_uart_irq,
-	.shutdown = shutdown_uart_irq,
-	.enable = enable_uart_irq,
-	.disable = disable_uart_irq,
-	.ack = mask_and_ack_uart_irq,
+	.ack = mask_uart_irq,
+	.mask = mask_uart_irq,
+	.mask_ack = mask_uart_irq,
+	.unmask = unmask_uart_irq,
 	.end = end_uart_irq,
 };
 
 void uart_irq_init(void)
 {
-	/* Reset irq handlers pointers to NULL */
-	irq_desc[80].status = IRQ_DISABLED;
-	irq_desc[80].action = 0;
-	irq_desc[80].depth = 2;
-	irq_desc[80].chip = &uart_irq_type;
-
-	irq_desc[81].status = IRQ_DISABLED;
-	irq_desc[81].action = 0;
-	irq_desc[81].depth = 2;
-	irq_desc[81].chip = &uart_irq_type;
+	set_irq_chip(80, &uart_irq_type);
+	set_irq_chip(81, &uart_irq_type);
 }
diff --git a/arch/mips/philips/pnx8550/common/int.c b/arch/mips/philips/pnx8550/common/int.c
index 7106116..e4bf494 100644
--- a/arch/mips/philips/pnx8550/common/int.c
+++ b/arch/mips/philips/pnx8550/common/int.c
@@ -38,8 +38,6 @@ #include <asm/gdb-stub.h>
 #include <int.h>
 #include <uart.h>
 
-static DEFINE_SPINLOCK(irq_lock);
-
 /* default prio for interrupts */
 /* first one is a no-no so therefore always prio 0 (disabled) */
 static char gic_prio[PNX8550_INT_GIC_TOTINT] = {
@@ -149,38 +147,6 @@ static inline void unmask_irq(unsigned i
 	}
 }
 
-#define pnx8550_disable pnx8550_ack
-static void pnx8550_ack(unsigned int irq)
-{
-	unsigned long flags;
-
-	spin_lock_irqsave(&irq_lock, flags);
-	mask_irq(irq);
-	spin_unlock_irqrestore(&irq_lock, flags);
-}
-
-#define pnx8550_enable pnx8550_unmask
-static void pnx8550_unmask(unsigned int irq)
-{
-	unsigned long flags;
-
-	spin_lock_irqsave(&irq_lock, flags);
-	unmask_irq(irq);
-	spin_unlock_irqrestore(&irq_lock, flags);
-}
-
-static unsigned int startup_irq(unsigned int irq_nr)
-{
-	pnx8550_unmask(irq_nr);
-	return 0;
-}
-
-static void shutdown_irq(unsigned int irq_nr)
-{
-	pnx8550_ack(irq_nr);
-	return;
-}
-
 int pnx8550_set_gic_priority(int irq, int priority)
 {
 	int gic_irq = irq-PNX8550_INT_GIC_MIN;
@@ -192,26 +158,19 @@ int pnx8550_set_gic_priority(int irq, in
 	return prev_priority;
 }
 
-static inline void mask_and_ack_level_irq(unsigned int irq)
-{
-	pnx8550_disable(irq);
-	return;
-}
-
 static void end_irq(unsigned int irq)
 {
 	if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) {
-		pnx8550_enable(irq);
+		unmask_irq(irq);
 	}
 }
 
 static struct irq_chip level_irq_type = {
 	.typename =	"PNX Level IRQ",
-	.startup =	startup_irq,
-	.shutdown =	shutdown_irq,
-	.enable =	pnx8550_enable,
-	.disable =	pnx8550_disable,
-	.ack =		mask_and_ack_level_irq,
+	.ack =		mask_irq,
+	.mask =		mask_irq,
+	.mask_ack =	mask_irq,
+	.unmask =	unmask_irq,
 	.end =		end_irq,
 };
 
@@ -233,8 +192,8 @@ void __init arch_init_irq(void)
 	int configPR;
 
 	for (i = 0; i < PNX8550_INT_CP0_TOTINT; i++) {
-		irq_desc[i].chip = &level_irq_type;
-		pnx8550_ack(i);	/* mask the irq just in case  */
+		set_irq_chip(i, &level_irq_type);
+		mask_irq(i);	/* mask the irq just in case  */
 	}
 
 	/* init of GIC/IPC interrupts */
@@ -270,7 +229,7 @@ #endif
 		/* mask/priority is still 0 so we will not get any
 		 * interrupts until it is unmasked */
 
-		irq_desc[i].chip = &level_irq_type;
+		set_irq_chip(i, &level_irq_type);
 	}
 
 	/* Priority level 0 */
@@ -279,20 +238,19 @@ #endif
 	/* Set int vector table address */
 	PNX8550_GIC_VECTOR_0 = PNX8550_GIC_VECTOR_1 = 0;
 
-	irq_desc[MIPS_CPU_GIC_IRQ].chip = &level_irq_type;
+	set_irq_chip(MIPS_CPU_GIC_IRQ, &level_irq_type);
 	setup_irq(MIPS_CPU_GIC_IRQ, &gic_action);
 
 	/* init of Timer interrupts */
-	for (i = PNX8550_INT_TIMER_MIN; i <= PNX8550_INT_TIMER_MAX; i++) {
-		irq_desc[i].chip = &level_irq_type;
-	}
+	for (i = PNX8550_INT_TIMER_MIN; i <= PNX8550_INT_TIMER_MAX; i++)
+		set_irq_chip(i, &level_irq_type);
 
 	/* Stop Timer 1-3 */
 	configPR = read_c0_config7();
 	configPR |= 0x00000038;
 	write_c0_config7(configPR);
 
-	irq_desc[MIPS_CPU_TIMER_IRQ].chip = &level_irq_type;
+	set_irq_chip(MIPS_CPU_TIMER_IRQ, &level_irq_type);
 	setup_irq(MIPS_CPU_TIMER_IRQ, &timer_action);
 }
 
diff --git a/arch/mips/sgi-ip22/ip22-eisa.c b/arch/mips/sgi-ip22/ip22-eisa.c
index 0d18ed4..a1a9af6 100644
--- a/arch/mips/sgi-ip22/ip22-eisa.c
+++ b/arch/mips/sgi-ip22/ip22-eisa.c
@@ -95,16 +95,11 @@ static irqreturn_t ip22_eisa_intr(int ir
 
 static void enable_eisa1_irq(unsigned int irq)
 {
-	unsigned long flags;
 	u8 mask;
 
-	local_irq_save(flags);
-
 	mask = inb(EISA_INT1_MASK);
 	mask &= ~((u8) (1 << irq));
 	outb(mask, EISA_INT1_MASK);
-
-	local_irq_restore(flags);
 }
 
 static unsigned int startup_eisa1_irq(unsigned int irq)
@@ -130,8 +125,6 @@ static void disable_eisa1_irq(unsigned i
 	outb(mask, EISA_INT1_MASK);
 }
 
-#define shutdown_eisa1_irq	disable_eisa1_irq
-
 static void mask_and_ack_eisa1_irq(unsigned int irq)
 {
 	disable_eisa1_irq(irq);
@@ -148,25 +141,20 @@ static void end_eisa1_irq(unsigned int i
 static struct irq_chip ip22_eisa1_irq_type = {
 	.typename	= "IP22 EISA",
 	.startup	= startup_eisa1_irq,
-	.shutdown	= shutdown_eisa1_irq,
-	.enable		= enable_eisa1_irq,
-	.disable	= disable_eisa1_irq,
 	.ack		= mask_and_ack_eisa1_irq,
+	.mask		= disable_eisa1_irq,
+	.mask_ack	= mask_and_ack_eisa1_irq,
+	.unmask		= enable_eisa1_irq,
 	.end		= end_eisa1_irq,
 };
 
 static void enable_eisa2_irq(unsigned int irq)
 {
-	unsigned long flags;
 	u8 mask;
 
-	local_irq_save(flags);
-
 	mask = inb(EISA_INT2_MASK);
 	mask &= ~((u8) (1 << (irq - 8)));
 	outb(mask, EISA_INT2_MASK);
-
-	local_irq_restore(flags);
 }
 
 static unsigned int startup_eisa2_irq(unsigned int irq)
@@ -192,8 +180,6 @@ static void disable_eisa2_irq(unsigned i
 	outb(mask, EISA_INT2_MASK);
 }
 
-#define shutdown_eisa2_irq	disable_eisa2_irq
-
 static void mask_and_ack_eisa2_irq(unsigned int irq)
 {
 	disable_eisa2_irq(irq);
@@ -210,10 +196,10 @@ static void end_eisa2_irq(unsigned int i
 static struct irq_chip ip22_eisa2_irq_type = {
 	.typename	= "IP22 EISA",
 	.startup	= startup_eisa2_irq,
-	.shutdown	= shutdown_eisa2_irq,
-	.enable		= enable_eisa2_irq,
-	.disable	= disable_eisa2_irq,
 	.ack		= mask_and_ack_eisa2_irq,
+	.mask		= disable_eisa2_irq,
+	.mask_ack	= mask_and_ack_eisa2_irq,
+	.unmask		= enable_eisa2_irq,
 	.end		= end_eisa2_irq,
 };
 
@@ -275,13 +261,10 @@ #endif
 	outb(0, EISA_DMA2_WRITE_SINGLE);
 
 	for (i = SGINT_EISA; i < (SGINT_EISA + EISA_MAX_IRQ); i++) {
-		irq_desc[i].status = IRQ_DISABLED;
-		irq_desc[i].action = 0;
-		irq_desc[i].depth = 1;
 		if (i < (SGINT_EISA + 8))
-			irq_desc[i].chip = &ip22_eisa1_irq_type;
+			set_irq_chip(i, &ip22_eisa1_irq_type);
 		else
-			irq_desc[i].chip = &ip22_eisa2_irq_type;
+			set_irq_chip(i, &ip22_eisa2_irq_type);
 	}
 
 	/* Cannot use request_irq because of kmalloc not being ready at such
diff --git a/arch/mips/sgi-ip22/ip22-int.c b/arch/mips/sgi-ip22/ip22-int.c
index af51889..8e2074b 100644
--- a/arch/mips/sgi-ip22/ip22-int.c
+++ b/arch/mips/sgi-ip22/ip22-int.c
@@ -40,34 +40,17 @@ extern int ip22_eisa_init(void);
 
 static void enable_local0_irq(unsigned int irq)
 {
-	unsigned long flags;
-
-	local_irq_save(flags);
 	/* don't allow mappable interrupt to be enabled from setup_irq,
 	 * we have our own way to do so */
 	if (irq != SGI_MAP_0_IRQ)
 		sgint->imask0 |= (1 << (irq - SGINT_LOCAL0));
-	local_irq_restore(flags);
-}
-
-static unsigned int startup_local0_irq(unsigned int irq)
-{
-	enable_local0_irq(irq);
-	return 0;		/* Never anything pending  */
 }
 
 static void disable_local0_irq(unsigned int irq)
 {
-	unsigned long flags;
-
-	local_irq_save(flags);
 	sgint->imask0 &= ~(1 << (irq - SGINT_LOCAL0));
-	local_irq_restore(flags);
 }
 
-#define shutdown_local0_irq	disable_local0_irq
-#define mask_and_ack_local0_irq	disable_local0_irq
-
 static void end_local0_irq (unsigned int irq)
 {
 	if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
@@ -76,44 +59,26 @@ static void end_local0_irq (unsigned int
 
 static struct irq_chip ip22_local0_irq_type = {
 	.typename	= "IP22 local 0",
-	.startup	= startup_local0_irq,
-	.shutdown	= shutdown_local0_irq,
-	.enable		= enable_local0_irq,
-	.disable	= disable_local0_irq,
-	.ack		= mask_and_ack_local0_irq,
+	.ack		= disable_local0_irq,
+	.mask		= disable_local0_irq,
+	.mask_ack	= disable_local0_irq,
+	.unmask		= enable_local0_irq,
 	.end		= end_local0_irq,
 };
 
 static void enable_local1_irq(unsigned int irq)
 {
-	unsigned long flags;
-
-	local_irq_save(flags);
 	/* don't allow mappable interrupt to be enabled from setup_irq,
 	 * we have our own way to do so */
 	if (irq != SGI_MAP_1_IRQ)
 		sgint->imask1 |= (1 << (irq - SGINT_LOCAL1));
-	local_irq_restore(flags);
-}
-
-static unsigned int startup_local1_irq(unsigned int irq)
-{
-	enable_local1_irq(irq);
-	return 0;		/* Never anything pending  */
 }
 
 void disable_local1_irq(unsigned int irq)
 {
-	unsigned long flags;
-
-	local_irq_save(flags);
 	sgint->imask1 &= ~(1 << (irq - SGINT_LOCAL1));
-	local_irq_restore(flags);
 }
 
-#define shutdown_local1_irq	disable_local1_irq
-#define mask_and_ack_local1_irq	disable_local1_irq
-
 static void end_local1_irq (unsigned int irq)
 {
 	if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
@@ -122,44 +87,26 @@ static void end_local1_irq (unsigned int
 
 static struct irq_chip ip22_local1_irq_type = {
 	.typename	= "IP22 local 1",
-	.startup	= startup_local1_irq,
-	.shutdown	= shutdown_local1_irq,
-	.enable		= enable_local1_irq,
-	.disable	= disable_local1_irq,
-	.ack		= mask_and_ack_local1_irq,
+	.ack		= disable_local1_irq,
+	.mask		= disable_local1_irq,
+	.mask_ack	= disable_local1_irq,
+	.unmask		= enable_local1_irq,
 	.end		= end_local1_irq,
 };
 
 static void enable_local2_irq(unsigned int irq)
 {
-	unsigned long flags;
-
-	local_irq_save(flags);
 	sgint->imask0 |= (1 << (SGI_MAP_0_IRQ - SGINT_LOCAL0));
 	sgint->cmeimask0 |= (1 << (irq - SGINT_LOCAL2));
-	local_irq_restore(flags);
-}
-
-static unsigned int startup_local2_irq(unsigned int irq)
-{
-	enable_local2_irq(irq);
-	return 0;		/* Never anything pending  */
 }
 
 void disable_local2_irq(unsigned int irq)
 {
-	unsigned long flags;
-
-	local_irq_save(flags);
 	sgint->cmeimask0 &= ~(1 << (irq - SGINT_LOCAL2));
 	if (!sgint->cmeimask0)
 		sgint->imask0 &= ~(1 << (SGI_MAP_0_IRQ - SGINT_LOCAL0));
-	local_irq_restore(flags);
 }
 
-#define shutdown_local2_irq disable_local2_irq
-#define mask_and_ack_local2_irq	disable_local2_irq
-
 static void end_local2_irq (unsigned int irq)
 {
 	if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
@@ -168,44 +115,26 @@ static void end_local2_irq (unsigned int
 
 static struct irq_chip ip22_local2_irq_type = {
 	.typename	= "IP22 local 2",
-	.startup	= startup_local2_irq,
-	.shutdown	= shutdown_local2_irq,
-	.enable		= enable_local2_irq,
-	.disable	= disable_local2_irq,
-	.ack		= mask_and_ack_local2_irq,
+	.ack		= disable_local2_irq,
+	.mask		= disable_local2_irq,
+	.mask_ack	= disable_local2_irq,
+	.unmask		= enable_local2_irq,
 	.end		= end_local2_irq,
 };
 
 static void enable_local3_irq(unsigned int irq)
 {
-	unsigned long flags;
-
-	local_irq_save(flags);
 	sgint->imask1 |= (1 << (SGI_MAP_1_IRQ - SGINT_LOCAL1));
 	sgint->cmeimask1 |= (1 << (irq - SGINT_LOCAL3));
-	local_irq_restore(flags);
-}
-
-static unsigned int startup_local3_irq(unsigned int irq)
-{
-	enable_local3_irq(irq);
-	return 0;		/* Never anything pending  */
 }
 
 void disable_local3_irq(unsigned int irq)
 {
-	unsigned long flags;
-
-	local_irq_save(flags);
 	sgint->cmeimask1 &= ~(1 << (irq - SGINT_LOCAL3));
 	if (!sgint->cmeimask1)
 		sgint->imask1 &= ~(1 << (SGI_MAP_1_IRQ - SGINT_LOCAL1));
-	local_irq_restore(flags);
 }
 
-#define shutdown_local3_irq disable_local3_irq
-#define mask_and_ack_local3_irq	disable_local3_irq
-
 static void end_local3_irq (unsigned int irq)
 {
 	if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
@@ -214,11 +143,10 @@ static void end_local3_irq (unsigned int
 
 static struct irq_chip ip22_local3_irq_type = {
 	.typename	= "IP22 local 3",
-	.startup	= startup_local3_irq,
-	.shutdown	= shutdown_local3_irq,
-	.enable		= enable_local3_irq,
-	.disable	= disable_local3_irq,
-	.ack		= mask_and_ack_local3_irq,
+	.ack		= disable_local3_irq,
+	.mask		= disable_local3_irq,
+	.mask_ack	= disable_local3_irq,
+	.unmask		= enable_local3_irq,
 	.end		= end_local3_irq,
 };
 
@@ -430,10 +358,7 @@ void __init arch_init_irq(void)
 		else
 			handler		= &ip22_local3_irq_type;
 
-		irq_desc[i].status	= IRQ_DISABLED;
-		irq_desc[i].action	= 0;
-		irq_desc[i].depth	= 1;
-		irq_desc[i].chip	= handler;
+		set_irq_chip(i, handler);
 	}
 
 	/* vector handler. this register the IRQ as non-sharable */
diff --git a/arch/mips/sgi-ip27/ip27-irq.c b/arch/mips/sgi-ip27/ip27-irq.c
index f01ba1f..a73f537 100644
--- a/arch/mips/sgi-ip27/ip27-irq.c
+++ b/arch/mips/sgi-ip27/ip27-irq.c
@@ -332,11 +332,6 @@ static inline void disable_bridge_irq(un
 	intr_disconnect_level(cpu, swlevel);
 }
 
-static void mask_and_ack_bridge_irq(unsigned int irq)
-{
-	disable_bridge_irq(irq);
-}
-
 static void end_bridge_irq(unsigned int irq)
 {
 	if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)) &&
@@ -348,9 +343,10 @@ static struct irq_chip bridge_irq_type =
 	.typename	= "bridge",
 	.startup	= startup_bridge_irq,
 	.shutdown	= shutdown_bridge_irq,
-	.enable		= enable_bridge_irq,
-	.disable	= disable_bridge_irq,
-	.ack		= mask_and_ack_bridge_irq,
+	.ack		= disable_bridge_irq,
+	.mask		= disable_bridge_irq,
+	.mask_ack	= disable_bridge_irq,
+	.unmask		= enable_bridge_irq,
 	.end		= end_bridge_irq,
 };
 
@@ -379,10 +375,7 @@ void free_irqno(unsigned int irq)
 
 void __devinit register_bridge_irq(unsigned int irq)
 {
-	irq_desc[irq].status	= IRQ_DISABLED;
-	irq_desc[irq].action	= 0;
-	irq_desc[irq].depth	= 1;
-	irq_desc[irq].chip	= &bridge_irq_type;
+	set_irq_chip(irq, &bridge_irq_type);
 }
 
 int __devinit request_bridge_irq(struct bridge_controller *bc)
diff --git a/arch/mips/sgi-ip27/ip27-timer.c b/arch/mips/sgi-ip27/ip27-timer.c
index c965705..b76f86d 100644
--- a/arch/mips/sgi-ip27/ip27-timer.c
+++ b/arch/mips/sgi-ip27/ip27-timer.c
@@ -172,15 +172,6 @@ static __init unsigned long get_m48t35_t
         return mktime(year, month, date, hour, min, sec);
 }
 
-static unsigned int startup_rt_irq(unsigned int irq)
-{
-	return 0;
-}
-
-static void shutdown_rt_irq(unsigned int irq)
-{
-}
-
 static void enable_rt_irq(unsigned int irq)
 {
 }
@@ -189,21 +180,16 @@ static void disable_rt_irq(unsigned int 
 {
 }
 
-static void mask_and_ack_rt(unsigned int irq)
-{
-}
-
 static void end_rt_irq(unsigned int irq)
 {
 }
 
 static struct irq_chip rt_irq_type = {
 	.typename	= "SN HUB RT timer",
-	.startup	= startup_rt_irq,
-	.shutdown	= shutdown_rt_irq,
-	.enable		= enable_rt_irq,
-	.disable	= disable_rt_irq,
-	.ack		= mask_and_ack_rt,
+	.ack		= disable_rt_irq,
+	.mask		= disable_rt_irq,
+	.mask_ack	= disable_rt_irq,
+	.unmask		= enable_rt_irq,
 	.end		= end_rt_irq,
 };
 
@@ -223,10 +209,7 @@ void __init plat_timer_setup(struct irqa
 	if (irqno < 0)
 		panic("Can't allocate interrupt number for timer interrupt");
 
-	irq_desc[irqno].status	= IRQ_DISABLED;
-	irq_desc[irqno].action	= NULL;
-	irq_desc[irqno].depth	= 1;
-	irq_desc[irqno].chip	= &rt_irq_type;
+	set_irq_chip(irqno, &rt_irq_type);
 
 	/* over-write the handler, we use our own way */
 	irq->handler = no_action;
diff --git a/arch/mips/sgi-ip32/ip32-irq.c b/arch/mips/sgi-ip32/ip32-irq.c
index c9acadd..ae06386 100644
--- a/arch/mips/sgi-ip32/ip32-irq.c
+++ b/arch/mips/sgi-ip32/ip32-irq.c
@@ -113,12 +113,6 @@ #endif
  * is quite different anyway.
  */
 
-/*
- * IRQ spinlock - Ralf says not to disable CPU interrupts,
- * and I think he knows better.
- */
-static DEFINE_SPINLOCK(ip32_irq_lock);
-
 /* Some initial interrupts to set up */
 extern irqreturn_t crime_memerr_intr(int irq, void *dev_id);
 extern irqreturn_t crime_cpuerr_intr(int irq, void *dev_id);
@@ -138,12 +132,6 @@ static void enable_cpu_irq(unsigned int 
 	set_c0_status(STATUSF_IP7);
 }
 
-static unsigned int startup_cpu_irq(unsigned int irq)
-{
-	enable_cpu_irq(irq);
-	return 0;
-}
-
 static void disable_cpu_irq(unsigned int irq)
 {
 	clear_c0_status(STATUSF_IP7);
@@ -155,16 +143,12 @@ static void end_cpu_irq(unsigned int irq
 		enable_cpu_irq (irq);
 }
 
-#define shutdown_cpu_irq disable_cpu_irq
-#define mask_and_ack_cpu_irq disable_cpu_irq
-
 static struct irq_chip ip32_cpu_interrupt = {
 	.typename = "IP32 CPU",
-	.startup = startup_cpu_irq,
-	.shutdown = shutdown_cpu_irq,
-	.enable = enable_cpu_irq,
-	.disable = disable_cpu_irq,
-	.ack = mask_and_ack_cpu_irq,
+	.ack = disable_cpu_irq,
+	.mask = disable_cpu_irq,
+	.mask_ack = disable_cpu_irq,
+	.unmask = enable_cpu_irq,
 	.end = end_cpu_irq,
 };
 
@@ -177,45 +161,27 @@ static uint64_t crime_mask;
 
 static void enable_crime_irq(unsigned int irq)
 {
-	unsigned long flags;
-
-	spin_lock_irqsave(&ip32_irq_lock, flags);
 	crime_mask |= 1 << (irq - 1);
 	crime->imask = crime_mask;
-	spin_unlock_irqrestore(&ip32_irq_lock, flags);
-}
-
-static unsigned int startup_crime_irq(unsigned int irq)
-{
-	enable_crime_irq(irq);
-	return 0; /* This is probably not right; we could have pending irqs */
 }
 
 static void disable_crime_irq(unsigned int irq)
 {
-	unsigned long flags;
-
-	spin_lock_irqsave(&ip32_irq_lock, flags);
 	crime_mask &= ~(1 << (irq - 1));
 	crime->imask = crime_mask;
 	flush_crime_bus();
-	spin_unlock_irqrestore(&ip32_irq_lock, flags);
 }
 
 static void mask_and_ack_crime_irq(unsigned int irq)
 {
-	unsigned long flags;
-
 	/* Edge triggered interrupts must be cleared. */
 	if ((irq >= CRIME_GBE0_IRQ && irq <= CRIME_GBE3_IRQ)
 	    || (irq >= CRIME_RE_EMPTY_E_IRQ && irq <= CRIME_RE_IDLE_E_IRQ)
 	    || (irq >= CRIME_SOFT0_IRQ && irq <= CRIME_SOFT2_IRQ)) {
 	        uint64_t crime_int;
-		spin_lock_irqsave(&ip32_irq_lock, flags);
 		crime_int = crime->hard_int;
 		crime_int &= ~(1 << (irq - 1));
 		crime->hard_int = crime_int;
-		spin_unlock_irqrestore(&ip32_irq_lock, flags);
 	}
 	disable_crime_irq(irq);
 }
@@ -226,15 +192,12 @@ static void end_crime_irq(unsigned int i
 		enable_crime_irq(irq);
 }
 
-#define shutdown_crime_irq disable_crime_irq
-
 static struct irq_chip ip32_crime_interrupt = {
 	.typename = "IP32 CRIME",
-	.startup = startup_crime_irq,
-	.shutdown = shutdown_crime_irq,
-	.enable = enable_crime_irq,
-	.disable = disable_crime_irq,
 	.ack = mask_and_ack_crime_irq,
+	.mask = disable_crime_irq,
+	.mask_ack = mask_and_ack_crime_irq,
+	.unmask = enable_crime_irq,
 	.end = end_crime_irq,
 };
 
@@ -248,34 +211,20 @@ static unsigned long macepci_mask;
 
 static void enable_macepci_irq(unsigned int irq)
 {
-	unsigned long flags;
-
-	spin_lock_irqsave(&ip32_irq_lock, flags);
 	macepci_mask |= MACEPCI_CONTROL_INT(irq - 9);
 	mace->pci.control = macepci_mask;
 	crime_mask |= 1 << (irq - 1);
 	crime->imask = crime_mask;
-	spin_unlock_irqrestore(&ip32_irq_lock, flags);
-}
-
-static unsigned int startup_macepci_irq(unsigned int irq)
-{
-  	enable_macepci_irq (irq);
-	return 0;
 }
 
 static void disable_macepci_irq(unsigned int irq)
 {
-	unsigned long flags;
-
-	spin_lock_irqsave(&ip32_irq_lock, flags);
 	crime_mask &= ~(1 << (irq - 1));
 	crime->imask = crime_mask;
 	flush_crime_bus();
 	macepci_mask &= ~MACEPCI_CONTROL_INT(irq - 9);
 	mace->pci.control = macepci_mask;
 	flush_mace_bus();
-	spin_unlock_irqrestore(&ip32_irq_lock, flags);
 }
 
 static void end_macepci_irq(unsigned int irq)
@@ -284,16 +233,12 @@ static void end_macepci_irq(unsigned int
 		enable_macepci_irq(irq);
 }
 
-#define shutdown_macepci_irq disable_macepci_irq
-#define mask_and_ack_macepci_irq disable_macepci_irq
-
 static struct irq_chip ip32_macepci_interrupt = {
 	.typename = "IP32 MACE PCI",
-	.startup = startup_macepci_irq,
-	.shutdown = shutdown_macepci_irq,
-	.enable = enable_macepci_irq,
-	.disable = disable_macepci_irq,
-	.ack = mask_and_ack_macepci_irq,
+	.ack = disable_macepci_irq,
+	.mask = disable_macepci_irq,
+	.mask_ack = disable_macepci_irq,
+	.unmask = enable_macepci_irq,
 	.end = end_macepci_irq,
 };
 
@@ -339,7 +284,6 @@ static unsigned long maceisa_mask;
 static void enable_maceisa_irq (unsigned int irq)
 {
 	unsigned int crime_int = 0;
-	unsigned long flags;
 
 	DBG ("maceisa enable: %u\n", irq);
 
@@ -355,26 +299,16 @@ static void enable_maceisa_irq (unsigned
 		break;
 	}
 	DBG ("crime_int %08x enabled\n", crime_int);
-	spin_lock_irqsave(&ip32_irq_lock, flags);
 	crime_mask |= crime_int;
 	crime->imask = crime_mask;
 	maceisa_mask |= 1 << (irq - 33);
 	mace->perif.ctrl.imask = maceisa_mask;
-	spin_unlock_irqrestore(&ip32_irq_lock, flags);
-}
-
-static unsigned int startup_maceisa_irq(unsigned int irq)
-{
-	enable_maceisa_irq(irq);
-	return 0;
 }
 
 static void disable_maceisa_irq(unsigned int irq)
 {
 	unsigned int crime_int = 0;
-	unsigned long flags;
 
-	spin_lock_irqsave(&ip32_irq_lock, flags);
 	maceisa_mask &= ~(1 << (irq - 33));
         if(!(maceisa_mask & MACEISA_AUDIO_INT))
 		crime_int |= MACE_AUDIO_INT;
@@ -387,23 +321,20 @@ static void disable_maceisa_irq(unsigned
 	flush_crime_bus();
 	mace->perif.ctrl.imask = maceisa_mask;
 	flush_mace_bus();
-	spin_unlock_irqrestore(&ip32_irq_lock, flags);
 }
 
 static void mask_and_ack_maceisa_irq(unsigned int irq)
 {
-	unsigned long mace_int, flags;
+	unsigned long mace_int;
 
 	switch (irq) {
 	case MACEISA_PARALLEL_IRQ:
 	case MACEISA_SERIAL1_TDMAPR_IRQ:
 	case MACEISA_SERIAL2_TDMAPR_IRQ:
 		/* edge triggered */
-		spin_lock_irqsave(&ip32_irq_lock, flags);
 		mace_int = mace->perif.ctrl.istat;
 		mace_int &= ~(1 << (irq - 33));
 		mace->perif.ctrl.istat = mace_int;
-		spin_unlock_irqrestore(&ip32_irq_lock, flags);
 		break;
 	}
 	disable_maceisa_irq(irq);
@@ -415,15 +346,12 @@ static void end_maceisa_irq(unsigned irq
 		enable_maceisa_irq(irq);
 }
 
-#define shutdown_maceisa_irq disable_maceisa_irq
-
 static struct irq_chip ip32_maceisa_interrupt = {
 	.typename = "IP32 MACE ISA",
-	.startup = startup_maceisa_irq,
-	.shutdown = shutdown_maceisa_irq,
-	.enable = enable_maceisa_irq,
-	.disable = disable_maceisa_irq,
 	.ack = mask_and_ack_maceisa_irq,
+	.mask = disable_maceisa_irq,
+	.mask_ack = mask_and_ack_maceisa_irq,
+	.unmask = enable_maceisa_irq,
 	.end = end_maceisa_irq,
 };
 
@@ -433,29 +361,15 @@ static struct irq_chip ip32_maceisa_inte
 
 static void enable_mace_irq(unsigned int irq)
 {
-	unsigned long flags;
-
-	spin_lock_irqsave(&ip32_irq_lock, flags);
 	crime_mask |= 1 << (irq - 1);
 	crime->imask = crime_mask;
-	spin_unlock_irqrestore(&ip32_irq_lock, flags);
-}
-
-static unsigned int startup_mace_irq(unsigned int irq)
-{
-	enable_mace_irq(irq);
-	return 0;
 }
 
 static void disable_mace_irq(unsigned int irq)
 {
-	unsigned long flags;
-
-	spin_lock_irqsave(&ip32_irq_lock, flags);
 	crime_mask &= ~(1 << (irq - 1));
 	crime->imask = crime_mask;
 	flush_crime_bus();
-	spin_unlock_irqrestore(&ip32_irq_lock, flags);
 }
 
 static void end_mace_irq(unsigned int irq)
@@ -464,16 +378,12 @@ static void end_mace_irq(unsigned int ir
 		enable_mace_irq(irq);
 }
 
-#define shutdown_mace_irq disable_mace_irq
-#define mask_and_ack_mace_irq disable_mace_irq
-
 static struct irq_chip ip32_mace_interrupt = {
 	.typename = "IP32 MACE",
-	.startup = startup_mace_irq,
-	.shutdown = shutdown_mace_irq,
-	.enable = enable_mace_irq,
-	.disable = disable_mace_irq,
-	.ack = mask_and_ack_mace_irq,
+	.ack = disable_mace_irq,
+	.mask = disable_mace_irq,
+	.mask_ack = disable_mace_irq,
+	.unmask = enable_mace_irq,
 	.end = end_mace_irq,
 };
 
@@ -586,10 +496,7 @@ void __init arch_init_irq(void)
 		else
 			controller = &ip32_maceisa_interrupt;
 
-		irq_desc[irq].status = IRQ_DISABLED;
-		irq_desc[irq].action = 0;
-		irq_desc[irq].depth = 0;
-		irq_desc[irq].chip = controller;
+		set_irq_chip(irq, controller);
 	}
 	setup_irq(CRIME_MEMERR_IRQ, &memerr_irq);
 	setup_irq(CRIME_CPUERR_IRQ, &cpuerr_irq);
diff --git a/arch/mips/sibyte/bcm1480/irq.c b/arch/mips/sibyte/bcm1480/irq.c
index 8b1f414..2e8f6b2 100644
--- a/arch/mips/sibyte/bcm1480/irq.c
+++ b/arch/mips/sibyte/bcm1480/irq.c
@@ -45,11 +45,9 @@ #include <asm/sibyte/sb1250.h>
  */
 
 
-#define shutdown_bcm1480_irq	disable_bcm1480_irq
 static void end_bcm1480_irq(unsigned int irq);
 static void enable_bcm1480_irq(unsigned int irq);
 static void disable_bcm1480_irq(unsigned int irq);
-static unsigned int startup_bcm1480_irq(unsigned int irq);
 static void ack_bcm1480_irq(unsigned int irq);
 #ifdef CONFIG_SMP
 static void bcm1480_set_affinity(unsigned int irq, cpumask_t mask);
@@ -85,11 +83,10 @@ #endif
 
 static struct irq_chip bcm1480_irq_type = {
 	.typename = "BCM1480-IMR",
-	.startup = startup_bcm1480_irq,
-	.shutdown = shutdown_bcm1480_irq,
-	.enable = enable_bcm1480_irq,
-	.disable = disable_bcm1480_irq,
 	.ack = ack_bcm1480_irq,
+	.mask = disable_bcm1480_irq,
+	.mask_ack = ack_bcm1480_irq,
+	.unmask = enable_bcm1480_irq,
 	.end = end_bcm1480_irq,
 #ifdef CONFIG_SMP
 	.set_affinity = bcm1480_set_affinity
@@ -188,14 +185,6 @@ #endif
 
 /*****************************************************************************/
 
-static unsigned int startup_bcm1480_irq(unsigned int irq)
-{
-	bcm1480_unmask_irq(bcm1480_irq_owner[irq], irq);
-
-	return 0;		/* never anything pending */
-}
-
-
 static void disable_bcm1480_irq(unsigned int irq)
 {
 	bcm1480_mask_irq(bcm1480_irq_owner[irq], irq);
@@ -270,16 +259,9 @@ void __init init_bcm1480_irqs(void)
 {
 	int i;
 
-	for (i = 0; i < NR_IRQS; i++) {
-		irq_desc[i].status = IRQ_DISABLED;
-		irq_desc[i].action = 0;
-		irq_desc[i].depth = 1;
-		if (i < BCM1480_NR_IRQS) {
-			irq_desc[i].chip = &bcm1480_irq_type;
-			bcm1480_irq_owner[i] = 0;
-		} else {
-			irq_desc[i].chip = &no_irq_chip;
-		}
+	for (i = 0; i < BCM1480_NR_IRQS; i++) {
+		set_irq_chip(i, &bcm1480_irq_type);
+		bcm1480_irq_owner[i] = 0;
 	}
 }
 
diff --git a/arch/mips/sibyte/sb1250/irq.c b/arch/mips/sibyte/sb1250/irq.c
index d5d2677..82ce753 100644
--- a/arch/mips/sibyte/sb1250/irq.c
+++ b/arch/mips/sibyte/sb1250/irq.c
@@ -44,11 +44,9 @@ #include <asm/sibyte/sb1250.h>
  */
 
 
-#define shutdown_sb1250_irq	disable_sb1250_irq
 static void end_sb1250_irq(unsigned int irq);
 static void enable_sb1250_irq(unsigned int irq);
 static void disable_sb1250_irq(unsigned int irq);
-static unsigned int startup_sb1250_irq(unsigned int irq);
 static void ack_sb1250_irq(unsigned int irq);
 #ifdef CONFIG_SMP
 static void sb1250_set_affinity(unsigned int irq, cpumask_t mask);
@@ -70,11 +68,10 @@ #endif
 
 static struct irq_chip sb1250_irq_type = {
 	.typename = "SB1250-IMR",
-	.startup = startup_sb1250_irq,
-	.shutdown = shutdown_sb1250_irq,
-	.enable = enable_sb1250_irq,
-	.disable = disable_sb1250_irq,
 	.ack = ack_sb1250_irq,
+	.mask = disable_sb1250_irq,
+	.mask_ack = ack_sb1250_irq,
+	.unmask = enable_sb1250_irq,
 	.end = end_sb1250_irq,
 #ifdef CONFIG_SMP
 	.set_affinity = sb1250_set_affinity
@@ -163,14 +160,6 @@ #endif
 
 /*****************************************************************************/
 
-static unsigned int startup_sb1250_irq(unsigned int irq)
-{
-	sb1250_unmask_irq(sb1250_irq_owner[irq], irq);
-
-	return 0;		/* never anything pending */
-}
-
-
 static void disable_sb1250_irq(unsigned int irq)
 {
 	sb1250_mask_irq(sb1250_irq_owner[irq], irq);
@@ -239,16 +228,9 @@ void __init init_sb1250_irqs(void)
 {
 	int i;
 
-	for (i = 0; i < NR_IRQS; i++) {
-		irq_desc[i].status = IRQ_DISABLED;
-		irq_desc[i].action = 0;
-		irq_desc[i].depth = 1;
-		if (i < SB1250_NR_IRQS) {
-			irq_desc[i].chip = &sb1250_irq_type;
-			sb1250_irq_owner[i] = 0;
-		} else {
-			irq_desc[i].chip = &no_irq_chip;
-		}
+	for (i = 0; i < SB1250_NR_IRQS; i++) {
+		set_irq_chip(i, &sb1250_irq_type);
+		sb1250_irq_owner[i] = 0;
 	}
 }
 
diff --git a/arch/mips/sni/irq.c b/arch/mips/sni/irq.c
index 48fb74a..8511bcc 100644
--- a/arch/mips/sni/irq.c
+++ b/arch/mips/sni/irq.c
@@ -11,44 +11,25 @@ #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>
 #include <linux/kernel.h>
-#include <linux/spinlock.h>
 
 #include <asm/i8259.h>
 #include <asm/io.h>
 #include <asm/sni.h>
 
-DEFINE_SPINLOCK(pciasic_lock);
-
 static void enable_pciasic_irq(unsigned int irq)
 {
 	unsigned int mask = 1 << (irq - PCIMT_IRQ_INT2);
-	unsigned long flags;
 
-	spin_lock_irqsave(&pciasic_lock, flags);
 	*(volatile u8 *) PCIMT_IRQSEL |= mask;
-	spin_unlock_irqrestore(&pciasic_lock, flags);
-}
-
-static unsigned int startup_pciasic_irq(unsigned int irq)
-{
-	enable_pciasic_irq(irq);
-	return 0; /* never anything pending */
 }
 
-#define shutdown_pciasic_irq	disable_pciasic_irq
-
 void disable_pciasic_irq(unsigned int irq)
 {
 	unsigned int mask = ~(1 << (irq - PCIMT_IRQ_INT2));
-	unsigned long flags;
 
-	spin_lock_irqsave(&pciasic_lock, flags);
 	*(volatile u8 *) PCIMT_IRQSEL &= mask;
-	spin_unlock_irqrestore(&pciasic_lock, flags);
 }
 
-#define mask_and_ack_pciasic_irq disable_pciasic_irq
-
 static void end_pciasic_irq(unsigned int irq)
 {
 	if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
@@ -57,11 +38,10 @@ static void end_pciasic_irq(unsigned int
 
 static struct irq_chip pciasic_irq_type = {
 	.typename = "ASIC-PCI",
-	.startup = startup_pciasic_irq,
-	.shutdown = shutdown_pciasic_irq,
-	.enable = enable_pciasic_irq,
-	.disable = disable_pciasic_irq,
-	.ack = mask_and_ack_pciasic_irq,
+	.ack = disable_pciasic_irq,
+	.mask = disable_pciasic_irq,
+	.mask_ack = disable_pciasic_irq,
+	.unmask = enable_pciasic_irq,
 	.end = end_pciasic_irq,
 };
 
@@ -178,12 +158,8 @@ asmlinkage void plat_irq_dispatch(void)
 
 void __init init_pciasic(void)
 {
-	unsigned long flags;
-
-	spin_lock_irqsave(&pciasic_lock, flags);
 	* (volatile u8 *) PCIMT_IRQSEL =
 		IT_EISA | IT_INTA | IT_INTB | IT_INTC | IT_INTD;
-	spin_unlock_irqrestore(&pciasic_lock, flags);
 }
 
 /*
@@ -199,12 +175,8 @@ void __init arch_init_irq(void)
 	init_pciasic();
 
 	/* Actually we've got more interrupts to handle ...  */
-	for (i = PCIMT_IRQ_INT2; i <= PCIMT_IRQ_ETHERNET; i++) {
-		irq_desc[i].status     = IRQ_DISABLED;
-		irq_desc[i].action     = 0;
-		irq_desc[i].depth      = 1;
-		irq_desc[i].chip    = &pciasic_irq_type;
-	}
+	for (i = PCIMT_IRQ_INT2; i <= PCIMT_IRQ_ETHERNET; i++)
+		set_irq_chip(i, &pciasic_irq_type);
 
 	change_c0_status(ST0_IM, IE_IRQ1|IE_IRQ2|IE_IRQ3|IE_IRQ4);
 }
diff --git a/arch/mips/tx4927/common/tx4927_irq.c b/arch/mips/tx4927/common/tx4927_irq.c
index 8266a88..2c57ced 100644
--- a/arch/mips/tx4927/common/tx4927_irq.c
+++ b/arch/mips/tx4927/common/tx4927_irq.c
@@ -64,19 +64,13 @@ #define TX4927_IRQ_NEST3       ( 1 <<  8
 #define TX4927_IRQ_NEST4       ( 1 <<  9 )
 
 #define TX4927_IRQ_CP0_INIT     ( 1 << 10 )
-#define TX4927_IRQ_CP0_STARTUP  ( 1 << 11 )
-#define TX4927_IRQ_CP0_SHUTDOWN ( 1 << 12 )
 #define TX4927_IRQ_CP0_ENABLE   ( 1 << 13 )
 #define TX4927_IRQ_CP0_DISABLE  ( 1 << 14 )
-#define TX4927_IRQ_CP0_MASK     ( 1 << 15 )
 #define TX4927_IRQ_CP0_ENDIRQ   ( 1 << 16 )
 
 #define TX4927_IRQ_PIC_INIT     ( 1 << 20 )
-#define TX4927_IRQ_PIC_STARTUP  ( 1 << 21 )
-#define TX4927_IRQ_PIC_SHUTDOWN ( 1 << 22 )
 #define TX4927_IRQ_PIC_ENABLE   ( 1 << 23 )
 #define TX4927_IRQ_PIC_DISABLE  ( 1 << 24 )
-#define TX4927_IRQ_PIC_MASK     ( 1 << 25 )
 #define TX4927_IRQ_PIC_ENDIRQ   ( 1 << 26 )
 
 #define TX4927_IRQ_ALL         0xffffffff
@@ -87,18 +81,12 @@ static const u32 tx4927_irq_debug_flag =
 					  | TX4927_IRQ_INFO
 					  | TX4927_IRQ_WARN | TX4927_IRQ_EROR
 //                                       | TX4927_IRQ_CP0_INIT
-//                                       | TX4927_IRQ_CP0_STARTUP
-//                                       | TX4927_IRQ_CP0_SHUTDOWN
 //                                       | TX4927_IRQ_CP0_ENABLE
 //                                       | TX4927_IRQ_CP0_DISABLE
-//                                       | TX4927_IRQ_CP0_MASK
 //                                       | TX4927_IRQ_CP0_ENDIRQ
 //                                       | TX4927_IRQ_PIC_INIT
-//                                       | TX4927_IRQ_PIC_STARTUP
-//                                       | TX4927_IRQ_PIC_SHUTDOWN
 //                                       | TX4927_IRQ_PIC_ENABLE
 //                                       | TX4927_IRQ_PIC_DISABLE
-//                                       | TX4927_IRQ_PIC_MASK
 //                                       | TX4927_IRQ_PIC_ENDIRQ
 //                                       | TX4927_IRQ_INIT
 //                                       | TX4927_IRQ_NEST1
@@ -124,49 +112,36 @@ #endif
  * Forwad definitions for all pic's
  */
 
-static unsigned int tx4927_irq_cp0_startup(unsigned int irq);
-static void tx4927_irq_cp0_shutdown(unsigned int irq);
 static void tx4927_irq_cp0_enable(unsigned int irq);
 static void tx4927_irq_cp0_disable(unsigned int irq);
-static void tx4927_irq_cp0_mask_and_ack(unsigned int irq);
 static void tx4927_irq_cp0_end(unsigned int irq);
 
-static unsigned int tx4927_irq_pic_startup(unsigned int irq);
-static void tx4927_irq_pic_shutdown(unsigned int irq);
 static void tx4927_irq_pic_enable(unsigned int irq);
 static void tx4927_irq_pic_disable(unsigned int irq);
-static void tx4927_irq_pic_mask_and_ack(unsigned int irq);
 static void tx4927_irq_pic_end(unsigned int irq);
 
 /*
  * Kernel structs for all pic's
  */
 
-static DEFINE_SPINLOCK(tx4927_cp0_lock);
-static DEFINE_SPINLOCK(tx4927_pic_lock);
-
 #define TX4927_CP0_NAME "TX4927-CP0"
 static struct irq_chip tx4927_irq_cp0_type = {
 	.typename	= TX4927_CP0_NAME,
-	.startup	= tx4927_irq_cp0_startup,
-	.shutdown	= tx4927_irq_cp0_shutdown,
-	.enable		= tx4927_irq_cp0_enable,
-	.disable	= tx4927_irq_cp0_disable,
-	.ack		= tx4927_irq_cp0_mask_and_ack,
+	.ack		= tx4927_irq_cp0_disable,
+	.mask		= tx4927_irq_cp0_disable,
+	.mask_ack	= tx4927_irq_cp0_disable,
+	.unmask		= tx4927_irq_cp0_enable,
 	.end		= tx4927_irq_cp0_end,
-	.set_affinity	= NULL
 };
 
 #define TX4927_PIC_NAME "TX4927-PIC"
 static struct irq_chip tx4927_irq_pic_type = {
 	.typename	= TX4927_PIC_NAME,
-	.startup	= tx4927_irq_pic_startup,
-	.shutdown	= tx4927_irq_pic_shutdown,
-	.enable		= tx4927_irq_pic_enable,
-	.disable	= tx4927_irq_pic_disable,
-	.ack		= tx4927_irq_pic_mask_and_ack,
+	.ack		= tx4927_irq_pic_disable,
+	.mask		= tx4927_irq_pic_disable,
+	.mask_ack	= tx4927_irq_pic_disable,
+	.unmask		= tx4927_irq_pic_enable,
 	.end		= tx4927_irq_pic_end,
-	.set_affinity	= NULL
 };
 
 #define TX4927_PIC_ACTION(s) { no_action, 0, CPU_MASK_NONE, s, NULL, NULL }
@@ -211,8 +186,6 @@ tx4927_irq_cp0_modify(unsigned cp0_reg, 
 			break;
 		}
 	}
-
-	return;
 }
 
 static void __init tx4927_irq_cp0_init(void)
@@ -222,71 +195,22 @@ static void __init tx4927_irq_cp0_init(v
 	TX4927_IRQ_DPRINTK(TX4927_IRQ_CP0_INIT, "beg=%d end=%d\n",
 			   TX4927_IRQ_CP0_BEG, TX4927_IRQ_CP0_END);
 
-	for (i = TX4927_IRQ_CP0_BEG; i <= TX4927_IRQ_CP0_END; i++) {
-		irq_desc[i].status = IRQ_DISABLED;
-		irq_desc[i].action = 0;
-		irq_desc[i].depth = 1;
-		irq_desc[i].chip = &tx4927_irq_cp0_type;
-	}
-
-	return;
-}
-
-static unsigned int tx4927_irq_cp0_startup(unsigned int irq)
-{
-	TX4927_IRQ_DPRINTK(TX4927_IRQ_CP0_STARTUP, "irq=%d \n", irq);
-
-	tx4927_irq_cp0_enable(irq);
-
-	return (0);
-}
-
-static void tx4927_irq_cp0_shutdown(unsigned int irq)
-{
-	TX4927_IRQ_DPRINTK(TX4927_IRQ_CP0_SHUTDOWN, "irq=%d \n", irq);
-
-	tx4927_irq_cp0_disable(irq);
-
-	return;
+	for (i = TX4927_IRQ_CP0_BEG; i <= TX4927_IRQ_CP0_END; i++)
+		set_irq_chip(i, &tx4927_irq_cp0_type);
 }
 
 static void tx4927_irq_cp0_enable(unsigned int irq)
 {
-	unsigned long flags;
-
 	TX4927_IRQ_DPRINTK(TX4927_IRQ_CP0_ENABLE, "irq=%d \n", irq);
 
-	spin_lock_irqsave(&tx4927_cp0_lock, flags);
-
 	tx4927_irq_cp0_modify(CCP0_STATUS, 0, tx4927_irq_cp0_mask(irq));
-
-	spin_unlock_irqrestore(&tx4927_cp0_lock, flags);
-
-	return;
 }
 
 static void tx4927_irq_cp0_disable(unsigned int irq)
 {
-	unsigned long flags;
-
 	TX4927_IRQ_DPRINTK(TX4927_IRQ_CP0_DISABLE, "irq=%d \n", irq);
 
-	spin_lock_irqsave(&tx4927_cp0_lock, flags);
-
 	tx4927_irq_cp0_modify(CCP0_STATUS, tx4927_irq_cp0_mask(irq), 0);
-
-	spin_unlock_irqrestore(&tx4927_cp0_lock, flags);
-
-	return;
-}
-
-static void tx4927_irq_cp0_mask_and_ack(unsigned int irq)
-{
-	TX4927_IRQ_DPRINTK(TX4927_IRQ_CP0_MASK, "irq=%d \n", irq);
-
-	tx4927_irq_cp0_disable(irq);
-
-	return;
 }
 
 static void tx4927_irq_cp0_end(unsigned int irq)
@@ -296,8 +220,6 @@ static void tx4927_irq_cp0_end(unsigned 
 	if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) {
 		tx4927_irq_cp0_enable(irq);
 	}
-
-	return;
 }
 
 /*
@@ -418,94 +340,38 @@ static void tx4927_irq_pic_modify(unsign
 	val &= (~clr_bits);
 	val |= (set_bits);
 	TX4927_WR(pic_reg, val);
-
-	return;
 }
 
 static void __init tx4927_irq_pic_init(void)
 {
-	unsigned long flags;
 	int i;
 
 	TX4927_IRQ_DPRINTK(TX4927_IRQ_PIC_INIT, "beg=%d end=%d\n",
 			   TX4927_IRQ_PIC_BEG, TX4927_IRQ_PIC_END);
 
-	for (i = TX4927_IRQ_PIC_BEG; i <= TX4927_IRQ_PIC_END; i++) {
-		irq_desc[i].status = IRQ_DISABLED;
-		irq_desc[i].action = 0;
-		irq_desc[i].depth = 2;
-		irq_desc[i].chip = &tx4927_irq_pic_type;
-	}
+	for (i = TX4927_IRQ_PIC_BEG; i <= TX4927_IRQ_PIC_END; i++)
+		set_irq_chip(i, &tx4927_irq_pic_type);
 
 	setup_irq(TX4927_IRQ_NEST_PIC_ON_CP0, &tx4927_irq_pic_action);
 
-	spin_lock_irqsave(&tx4927_pic_lock, flags);
-
 	TX4927_WR(0xff1ff640, 0x6);	/* irq level mask -- only accept hightest */
 	TX4927_WR(0xff1ff600, TX4927_RD(0xff1ff600) | 0x1);	/* irq enable */
-
-	spin_unlock_irqrestore(&tx4927_pic_lock, flags);
-
-	return;
-}
-
-static unsigned int tx4927_irq_pic_startup(unsigned int irq)
-{
-	TX4927_IRQ_DPRINTK(TX4927_IRQ_PIC_STARTUP, "irq=%d\n", irq);
-
-	tx4927_irq_pic_enable(irq);
-
-	return (0);
-}
-
-static void tx4927_irq_pic_shutdown(unsigned int irq)
-{
-	TX4927_IRQ_DPRINTK(TX4927_IRQ_PIC_SHUTDOWN, "irq=%d\n", irq);
-
-	tx4927_irq_pic_disable(irq);
-
-	return;
 }
 
 static void tx4927_irq_pic_enable(unsigned int irq)
 {
-	unsigned long flags;
-
 	TX4927_IRQ_DPRINTK(TX4927_IRQ_PIC_ENABLE, "irq=%d\n", irq);
 
-	spin_lock_irqsave(&tx4927_pic_lock, flags);
-
 	tx4927_irq_pic_modify(tx4927_irq_pic_addr(irq), 0,
 			      tx4927_irq_pic_mask(irq));
-
-	spin_unlock_irqrestore(&tx4927_pic_lock, flags);
-
-	return;
 }
 
 static void tx4927_irq_pic_disable(unsigned int irq)
 {
-	unsigned long flags;
-
 	TX4927_IRQ_DPRINTK(TX4927_IRQ_PIC_DISABLE, "irq=%d\n", irq);
 
-	spin_lock_irqsave(&tx4927_pic_lock, flags);
-
 	tx4927_irq_pic_modify(tx4927_irq_pic_addr(irq),
 			      tx4927_irq_pic_mask(irq), 0);
-
-	spin_unlock_irqrestore(&tx4927_pic_lock, flags);
-
-	return;
-}
-
-static void tx4927_irq_pic_mask_and_ack(unsigned int irq)
-{
-	TX4927_IRQ_DPRINTK(TX4927_IRQ_PIC_MASK, "irq=%d\n", irq);
-
-	tx4927_irq_pic_disable(irq);
-
-	return;
 }
 
 static void tx4927_irq_pic_end(unsigned int irq)
@@ -515,8 +381,6 @@ static void tx4927_irq_pic_end(unsigned 
 	if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) {
 		tx4927_irq_pic_enable(irq);
 	}
-
-	return;
 }
 
 /*
@@ -533,8 +397,6 @@ void __init tx4927_irq_init(void)
 	tx4927_irq_pic_init();
 
 	TX4927_IRQ_DPRINTK(TX4927_IRQ_INIT, "+\n");
-
-	return;
 }
 
 static int tx4927_irq_nested(void)
diff --git a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c
index 0c3c3f6..1040ab3 100644
--- a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c
+++ b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c
@@ -151,16 +151,11 @@ #define TOSHIBA_RBTX4927_IRQ_WARN       
 #define TOSHIBA_RBTX4927_IRQ_EROR          ( 1 <<  2 )
 
 #define TOSHIBA_RBTX4927_IRQ_IOC_INIT      ( 1 << 10 )
-#define TOSHIBA_RBTX4927_IRQ_IOC_STARTUP   ( 1 << 11 )
-#define TOSHIBA_RBTX4927_IRQ_IOC_SHUTDOWN  ( 1 << 12 )
 #define TOSHIBA_RBTX4927_IRQ_IOC_ENABLE    ( 1 << 13 )
 #define TOSHIBA_RBTX4927_IRQ_IOC_DISABLE   ( 1 << 14 )
-#define TOSHIBA_RBTX4927_IRQ_IOC_MASK      ( 1 << 15 )
 #define TOSHIBA_RBTX4927_IRQ_IOC_ENDIRQ    ( 1 << 16 )
 
 #define TOSHIBA_RBTX4927_IRQ_ISA_INIT      ( 1 << 20 )
-#define TOSHIBA_RBTX4927_IRQ_ISA_STARTUP   ( 1 << 21 )
-#define TOSHIBA_RBTX4927_IRQ_ISA_SHUTDOWN  ( 1 << 22 )
 #define TOSHIBA_RBTX4927_IRQ_ISA_ENABLE    ( 1 << 23 )
 #define TOSHIBA_RBTX4927_IRQ_ISA_DISABLE   ( 1 << 24 )
 #define TOSHIBA_RBTX4927_IRQ_ISA_MASK      ( 1 << 25 )
@@ -175,15 +170,10 @@ static const u32 toshiba_rbtx4927_irq_de
     (TOSHIBA_RBTX4927_IRQ_NONE | TOSHIBA_RBTX4927_IRQ_INFO |
      TOSHIBA_RBTX4927_IRQ_WARN | TOSHIBA_RBTX4927_IRQ_EROR
 //                                                 | TOSHIBA_RBTX4927_IRQ_IOC_INIT
-//                                                 | TOSHIBA_RBTX4927_IRQ_IOC_STARTUP
-//                                                 | TOSHIBA_RBTX4927_IRQ_IOC_SHUTDOWN
 //                                                 | TOSHIBA_RBTX4927_IRQ_IOC_ENABLE
 //                                                 | TOSHIBA_RBTX4927_IRQ_IOC_DISABLE
-//                                                 | TOSHIBA_RBTX4927_IRQ_IOC_MASK
 //                                                 | TOSHIBA_RBTX4927_IRQ_IOC_ENDIRQ
 //                                                 | TOSHIBA_RBTX4927_IRQ_ISA_INIT
-//                                                 | TOSHIBA_RBTX4927_IRQ_ISA_STARTUP
-//                                                 | TOSHIBA_RBTX4927_IRQ_ISA_SHUTDOWN
 //                                                 | TOSHIBA_RBTX4927_IRQ_ISA_ENABLE
 //                                                 | TOSHIBA_RBTX4927_IRQ_ISA_DISABLE
 //                                                 | TOSHIBA_RBTX4927_IRQ_ISA_MASK
@@ -231,35 +221,25 @@ extern void disable_8259A_irq(unsigned i
 extern void mask_and_ack_8259A(unsigned int irq);
 #endif
 
-static unsigned int toshiba_rbtx4927_irq_ioc_startup(unsigned int irq);
-static void toshiba_rbtx4927_irq_ioc_shutdown(unsigned int irq);
 static void toshiba_rbtx4927_irq_ioc_enable(unsigned int irq);
 static void toshiba_rbtx4927_irq_ioc_disable(unsigned int irq);
-static void toshiba_rbtx4927_irq_ioc_mask_and_ack(unsigned int irq);
 static void toshiba_rbtx4927_irq_ioc_end(unsigned int irq);
 
 #ifdef CONFIG_TOSHIBA_FPCIB0
-static unsigned int toshiba_rbtx4927_irq_isa_startup(unsigned int irq);
-static void toshiba_rbtx4927_irq_isa_shutdown(unsigned int irq);
 static void toshiba_rbtx4927_irq_isa_enable(unsigned int irq);
 static void toshiba_rbtx4927_irq_isa_disable(unsigned int irq);
 static void toshiba_rbtx4927_irq_isa_mask_and_ack(unsigned int irq);
 static void toshiba_rbtx4927_irq_isa_end(unsigned int irq);
 #endif
 
-static DEFINE_SPINLOCK(toshiba_rbtx4927_ioc_lock);
-
-
 #define TOSHIBA_RBTX4927_IOC_NAME "RBTX4927-IOC"
 static struct irq_chip toshiba_rbtx4927_irq_ioc_type = {
 	.typename = TOSHIBA_RBTX4927_IOC_NAME,
-	.startup = toshiba_rbtx4927_irq_ioc_startup,
-	.shutdown = toshiba_rbtx4927_irq_ioc_shutdown,
-	.enable = toshiba_rbtx4927_irq_ioc_enable,
-	.disable = toshiba_rbtx4927_irq_ioc_disable,
-	.ack = toshiba_rbtx4927_irq_ioc_mask_and_ack,
+	.ack = toshiba_rbtx4927_irq_ioc_disable,
+	.mask = toshiba_rbtx4927_irq_ioc_disable,
+	.mask_ack = toshiba_rbtx4927_irq_ioc_disable,
+	.unmask = toshiba_rbtx4927_irq_ioc_enable,
 	.end = toshiba_rbtx4927_irq_ioc_end,
-	.set_affinity = NULL
 };
 #define TOSHIBA_RBTX4927_IOC_INTR_ENAB 0xbc002000
 #define TOSHIBA_RBTX4927_IOC_INTR_STAT 0xbc002006
@@ -269,13 +249,11 @@ #ifdef CONFIG_TOSHIBA_FPCIB0
 #define TOSHIBA_RBTX4927_ISA_NAME "RBTX4927-ISA"
 static struct irq_chip toshiba_rbtx4927_irq_isa_type = {
 	.typename = TOSHIBA_RBTX4927_ISA_NAME,
-	.startup = toshiba_rbtx4927_irq_isa_startup,
-	.shutdown = toshiba_rbtx4927_irq_isa_shutdown,
-	.enable = toshiba_rbtx4927_irq_isa_enable,
-	.disable = toshiba_rbtx4927_irq_isa_disable,
 	.ack = toshiba_rbtx4927_irq_isa_mask_and_ack,
+	.mask = toshiba_rbtx4927_irq_isa_disable,
+	.mask_ack = toshiba_rbtx4927_irq_isa_mask_and_ack,
+	.unmask = toshiba_rbtx4927_irq_isa_enable,
 	.end = toshiba_rbtx4927_irq_isa_end,
-	.set_affinity = NULL
 };
 #endif
 
@@ -363,58 +341,15 @@ static void __init toshiba_rbtx4927_irq_
 				     TOSHIBA_RBTX4927_IRQ_IOC_END);
 
 	for (i = TOSHIBA_RBTX4927_IRQ_IOC_BEG;
-	     i <= TOSHIBA_RBTX4927_IRQ_IOC_END; i++) {
-		irq_desc[i].status = IRQ_DISABLED;
-		irq_desc[i].action = 0;
-		irq_desc[i].depth = 3;
-		irq_desc[i].chip = &toshiba_rbtx4927_irq_ioc_type;
-	}
+	     i <= TOSHIBA_RBTX4927_IRQ_IOC_END; i++)
+		set_irq_chip(i, &toshiba_rbtx4927_irq_ioc_type);
 
 	setup_irq(TOSHIBA_RBTX4927_IRQ_NEST_IOC_ON_PIC,
 		  &toshiba_rbtx4927_irq_ioc_action);
-
-	return;
 }
 
-static unsigned int toshiba_rbtx4927_irq_ioc_startup(unsigned int irq)
-{
-	TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_IOC_STARTUP,
-				     "irq=%d\n", irq);
-
-	if (irq < TOSHIBA_RBTX4927_IRQ_IOC_BEG
-	    || irq > TOSHIBA_RBTX4927_IRQ_IOC_END) {
-		TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_EROR,
-					     "bad irq=%d\n", irq);
-		panic("\n");
-	}
-
-	toshiba_rbtx4927_irq_ioc_enable(irq);
-
-	return (0);
-}
-
-
-static void toshiba_rbtx4927_irq_ioc_shutdown(unsigned int irq)
-{
-	TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_IOC_SHUTDOWN,
-				     "irq=%d\n", irq);
-
-	if (irq < TOSHIBA_RBTX4927_IRQ_IOC_BEG
-	    || irq > TOSHIBA_RBTX4927_IRQ_IOC_END) {
-		TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_EROR,
-					     "bad irq=%d\n", irq);
-		panic("\n");
-	}
-
-	toshiba_rbtx4927_irq_ioc_disable(irq);
-
-	return;
-}
-
-
 static void toshiba_rbtx4927_irq_ioc_enable(unsigned int irq)
 {
-	unsigned long flags;
 	volatile unsigned char v;
 
 	TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_IOC_ENABLE,
@@ -427,21 +362,14 @@ static void toshiba_rbtx4927_irq_ioc_ena
 		panic("\n");
 	}
 
-	spin_lock_irqsave(&toshiba_rbtx4927_ioc_lock, flags);
-
 	v = TX4927_RD08(TOSHIBA_RBTX4927_IOC_INTR_ENAB);
 	v |= (1 << (irq - TOSHIBA_RBTX4927_IRQ_IOC_BEG));
 	TOSHIBA_RBTX4927_WR08(TOSHIBA_RBTX4927_IOC_INTR_ENAB, v);
-
-	spin_unlock_irqrestore(&toshiba_rbtx4927_ioc_lock, flags);
-
-	return;
 }
 
 
 static void toshiba_rbtx4927_irq_ioc_disable(unsigned int irq)
 {
-	unsigned long flags;
 	volatile unsigned char v;
 
 	TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_IOC_DISABLE,
@@ -454,36 +382,11 @@ static void toshiba_rbtx4927_irq_ioc_dis
 		panic("\n");
 	}
 
-	spin_lock_irqsave(&toshiba_rbtx4927_ioc_lock, flags);
-
 	v = TX4927_RD08(TOSHIBA_RBTX4927_IOC_INTR_ENAB);
 	v &= ~(1 << (irq - TOSHIBA_RBTX4927_IRQ_IOC_BEG));
 	TOSHIBA_RBTX4927_WR08(TOSHIBA_RBTX4927_IOC_INTR_ENAB, v);
-
-	spin_unlock_irqrestore(&toshiba_rbtx4927_ioc_lock, flags);
-
-	return;
 }
 
-
-static void toshiba_rbtx4927_irq_ioc_mask_and_ack(unsigned int irq)
-{
-	TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_IOC_MASK,
-				     "irq=%d\n", irq);
-
-	if (irq < TOSHIBA_RBTX4927_IRQ_IOC_BEG
-	    || irq > TOSHIBA_RBTX4927_IRQ_IOC_END) {
-		TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_EROR,
-					     "bad irq=%d\n", irq);
-		panic("\n");
-	}
-
-	toshiba_rbtx4927_irq_ioc_disable(irq);
-
-	return;
-}
-
-
 static void toshiba_rbtx4927_irq_ioc_end(unsigned int irq)
 {
 	TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_IOC_ENDIRQ,
@@ -499,8 +402,6 @@ static void toshiba_rbtx4927_irq_ioc_end
 	if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) {
 		toshiba_rbtx4927_irq_ioc_enable(irq);
 	}
-
-	return;
 }
 
 
@@ -520,13 +421,8 @@ static void __init toshiba_rbtx4927_irq_
 				     TOSHIBA_RBTX4927_IRQ_ISA_END);
 
 	for (i = TOSHIBA_RBTX4927_IRQ_ISA_BEG;
-	     i <= TOSHIBA_RBTX4927_IRQ_ISA_END; i++) {
-		irq_desc[i].status = IRQ_DISABLED;
-		irq_desc[i].action = 0;
-		irq_desc[i].depth =
-		    ((i < TOSHIBA_RBTX4927_IRQ_ISA_MID) ? (4) : (5));
-		irq_desc[i].chip = &toshiba_rbtx4927_irq_isa_type;
-	}
+	     i <= TOSHIBA_RBTX4927_IRQ_ISA_END; i++)
+		set_irq_chip(i, &toshiba_rbtx4927_irq_isa_type);
 
 	setup_irq(TOSHIBA_RBTX4927_IRQ_NEST_ISA_ON_IOC,
 		  &toshiba_rbtx4927_irq_isa_master);
@@ -537,48 +433,6 @@ static void __init toshiba_rbtx4927_irq_
 	outb(0x0A, 0x20);
 	outb(0x0A, 0xA0);
 
-	return;
-}
-#endif
-
-
-#ifdef CONFIG_TOSHIBA_FPCIB0
-static unsigned int toshiba_rbtx4927_irq_isa_startup(unsigned int irq)
-{
-	TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_ISA_STARTUP,
-				     "irq=%d\n", irq);
-
-	if (irq < TOSHIBA_RBTX4927_IRQ_ISA_BEG
-	    || irq > TOSHIBA_RBTX4927_IRQ_ISA_END) {
-		TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_EROR,
-					     "bad irq=%d\n", irq);
-		panic("\n");
-	}
-
-	toshiba_rbtx4927_irq_isa_enable(irq);
-
-	return (0);
-}
-#endif
-
-
-#ifdef CONFIG_TOSHIBA_FPCIB0
-static void toshiba_rbtx4927_irq_isa_shutdown(unsigned int irq)
-{
-	TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_ISA_SHUTDOWN,
-				     "irq=%d\n", irq);
-
-	if (irq < TOSHIBA_RBTX4927_IRQ_ISA_BEG
-	    || irq > TOSHIBA_RBTX4927_IRQ_ISA_END) {
-		TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_EROR,
-					     "bad irq=%d\n", irq);
-		panic("\n");
-	}
-
-	toshiba_rbtx4927_irq_isa_disable(irq);
-
-	return;
-}
 #endif
 
 
@@ -596,8 +450,6 @@ static void toshiba_rbtx4927_irq_isa_ena
 	}
 
 	enable_8259A_irq(irq);
-
-	return;
 }
 #endif
 
@@ -616,8 +468,6 @@ static void toshiba_rbtx4927_irq_isa_dis
 	}
 
 	disable_8259A_irq(irq);
-
-	return;
 }
 #endif
 
@@ -636,8 +486,6 @@ static void toshiba_rbtx4927_irq_isa_mas
 	}
 
 	mask_and_ack_8259A(irq);
-
-	return;
 }
 #endif
 
@@ -658,8 +506,6 @@ static void toshiba_rbtx4927_irq_isa_end
 	if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) {
 		toshiba_rbtx4927_irq_isa_enable(irq);
 	}
-
-	return;
 }
 #endif
 
@@ -668,8 +514,6 @@ void __init arch_init_irq(void)
 {
 	extern void tx4927_irq_init(void);
 
-	local_irq_disable();
-
 	tx4927_irq_init();
 	toshiba_rbtx4927_irq_ioc_init();
 #ifdef CONFIG_TOSHIBA_FPCIB0
@@ -681,8 +525,6 @@ #ifdef CONFIG_TOSHIBA_FPCIB0
 #endif
 
 	wbflush();
-
-	return;
 }
 
 void toshiba_rbtx4927_irq_dump(char *key)
@@ -715,7 +557,6 @@ #ifdef TOSHIBA_RBTX4927_IRQ_DEBUG
 		}
 	}
 #endif
-	return;
 }
 
 void toshiba_rbtx4927_irq_dump_pics(char *s)
@@ -780,6 +621,4 @@ void toshiba_rbtx4927_irq_dump_pics(char
 				     level5_s);
 	TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_INFO, "[%s]\n",
 				     s);
-
-	return;
 }
diff --git a/arch/mips/tx4938/common/irq.c b/arch/mips/tx4938/common/irq.c
index 77fe245..19c9ee9 100644
--- a/arch/mips/tx4938/common/irq.c
+++ b/arch/mips/tx4938/common/irq.c
@@ -37,48 +37,36 @@ #include <asm/tx4938/rbtx4938.h>
 /* Forwad definitions for all pic's                                               */
 /**********************************************************************************/
 
-static unsigned int tx4938_irq_cp0_startup(unsigned int irq);
-static void tx4938_irq_cp0_shutdown(unsigned int irq);
 static void tx4938_irq_cp0_enable(unsigned int irq);
 static void tx4938_irq_cp0_disable(unsigned int irq);
-static void tx4938_irq_cp0_mask_and_ack(unsigned int irq);
 static void tx4938_irq_cp0_end(unsigned int irq);
 
-static unsigned int tx4938_irq_pic_startup(unsigned int irq);
-static void tx4938_irq_pic_shutdown(unsigned int irq);
 static void tx4938_irq_pic_enable(unsigned int irq);
 static void tx4938_irq_pic_disable(unsigned int irq);
-static void tx4938_irq_pic_mask_and_ack(unsigned int irq);
 static void tx4938_irq_pic_end(unsigned int irq);
 
 /**********************************************************************************/
 /* Kernel structs for all pic's                                                   */
 /**********************************************************************************/
-DEFINE_SPINLOCK(tx4938_cp0_lock);
-DEFINE_SPINLOCK(tx4938_pic_lock);
 
 #define TX4938_CP0_NAME "TX4938-CP0"
 static struct irq_chip tx4938_irq_cp0_type = {
 	.typename = TX4938_CP0_NAME,
-	.startup = tx4938_irq_cp0_startup,
-	.shutdown = tx4938_irq_cp0_shutdown,
-	.enable = tx4938_irq_cp0_enable,
-	.disable = tx4938_irq_cp0_disable,
-	.ack = tx4938_irq_cp0_mask_and_ack,
+	.ack = tx4938_irq_cp0_disable,
+	.mask = tx4938_irq_cp0_disable,
+	.mask_ack = tx4938_irq_cp0_disable,
+	.unmask = tx4938_irq_cp0_enable,
 	.end = tx4938_irq_cp0_end,
-	.set_affinity = NULL
 };
 
 #define TX4938_PIC_NAME "TX4938-PIC"
 static struct irq_chip tx4938_irq_pic_type = {
 	.typename = TX4938_PIC_NAME,
-	.startup = tx4938_irq_pic_startup,
-	.shutdown = tx4938_irq_pic_shutdown,
-	.enable = tx4938_irq_pic_enable,
-	.disable = tx4938_irq_pic_disable,
-	.ack = tx4938_irq_pic_mask_and_ack,
+	.ack = tx4938_irq_pic_disable,
+	.mask = tx4938_irq_pic_disable,
+	.mask_ack = tx4938_irq_pic_disable,
+	.unmask = tx4938_irq_pic_enable,
 	.end = tx4938_irq_pic_end,
-	.set_affinity = NULL
 };
 
 static struct irqaction tx4938_irq_pic_action = {
@@ -99,56 +87,20 @@ tx4938_irq_cp0_init(void)
 {
 	int i;
 
-	for (i = TX4938_IRQ_CP0_BEG; i <= TX4938_IRQ_CP0_END; i++) {
-		irq_desc[i].status = IRQ_DISABLED;
-		irq_desc[i].action = 0;
-		irq_desc[i].depth = 1;
-		irq_desc[i].chip = &tx4938_irq_cp0_type;
-	}
-}
-
-static unsigned int
-tx4938_irq_cp0_startup(unsigned int irq)
-{
-	tx4938_irq_cp0_enable(irq);
-
-	return 0;
-}
-
-static void
-tx4938_irq_cp0_shutdown(unsigned int irq)
-{
-	tx4938_irq_cp0_disable(irq);
+	for (i = TX4938_IRQ_CP0_BEG; i <= TX4938_IRQ_CP0_END; i++)
+		set_irq_chip(i, &tx4938_irq_cp0_type);
 }
 
 static void
 tx4938_irq_cp0_enable(unsigned int irq)
 {
-	unsigned long flags;
-
-	spin_lock_irqsave(&tx4938_cp0_lock, flags);
-
 	set_c0_status(tx4938_irq_cp0_mask(irq));
-
-	spin_unlock_irqrestore(&tx4938_cp0_lock, flags);
 }
 
 static void
 tx4938_irq_cp0_disable(unsigned int irq)
 {
-	unsigned long flags;
-
-	spin_lock_irqsave(&tx4938_cp0_lock, flags);
-
 	clear_c0_status(tx4938_irq_cp0_mask(irq));
-
-	spin_unlock_irqrestore(&tx4938_cp0_lock, flags);
-}
-
-static void
-tx4938_irq_cp0_mask_and_ack(unsigned int irq)
-{
-	tx4938_irq_cp0_disable(irq);
 }
 
 static void
@@ -290,70 +242,29 @@ tx4938_irq_pic_modify(unsigned pic_reg, 
 static void __init
 tx4938_irq_pic_init(void)
 {
-	unsigned long flags;
 	int i;
 
-	for (i = TX4938_IRQ_PIC_BEG; i <= TX4938_IRQ_PIC_END; i++) {
-		irq_desc[i].status = IRQ_DISABLED;
-		irq_desc[i].action = 0;
-		irq_desc[i].depth = 2;
-		irq_desc[i].chip = &tx4938_irq_pic_type;
-	}
+	for (i = TX4938_IRQ_PIC_BEG; i <= TX4938_IRQ_PIC_END; i++)
+		set_irq_chip(i, &tx4938_irq_pic_type);
 
 	setup_irq(TX4938_IRQ_NEST_PIC_ON_CP0, &tx4938_irq_pic_action);
 
-	spin_lock_irqsave(&tx4938_pic_lock, flags);
-
 	TX4938_WR(0xff1ff640, 0x6);	/* irq level mask -- only accept hightest */
 	TX4938_WR(0xff1ff600, TX4938_RD(0xff1ff600) | 0x1);	/* irq enable */
-
-	spin_unlock_irqrestore(&tx4938_pic_lock, flags);
-}
-
-static unsigned int
-tx4938_irq_pic_startup(unsigned int irq)
-{
-	tx4938_irq_pic_enable(irq);
-
-	return 0;
-}
-
-static void
-tx4938_irq_pic_shutdown(unsigned int irq)
-{
-	tx4938_irq_pic_disable(irq);
 }
 
 static void
 tx4938_irq_pic_enable(unsigned int irq)
 {
-	unsigned long flags;
-
-	spin_lock_irqsave(&tx4938_pic_lock, flags);
-
 	tx4938_irq_pic_modify(tx4938_irq_pic_addr(irq), 0,
 			      tx4938_irq_pic_mask(irq));
-
-	spin_unlock_irqrestore(&tx4938_pic_lock, flags);
 }
 
 static void
 tx4938_irq_pic_disable(unsigned int irq)
 {
-	unsigned long flags;
-
-	spin_lock_irqsave(&tx4938_pic_lock, flags);
-
 	tx4938_irq_pic_modify(tx4938_irq_pic_addr(irq),
 			      tx4938_irq_pic_mask(irq), 0);
-
-	spin_unlock_irqrestore(&tx4938_pic_lock, flags);
-}
-
-static void
-tx4938_irq_pic_mask_and_ack(unsigned int irq)
-{
-	tx4938_irq_pic_disable(irq);
 }
 
 static void
diff --git a/arch/mips/tx4938/toshiba_rbtx4938/irq.c b/arch/mips/tx4938/toshiba_rbtx4938/irq.c
index 102e473..2735ffe 100644
--- a/arch/mips/tx4938/toshiba_rbtx4938/irq.c
+++ b/arch/mips/tx4938/toshiba_rbtx4938/irq.c
@@ -87,25 +87,18 @@ #include <asm/wbflush.h>
 #include <linux/bootmem.h>
 #include <asm/tx4938/rbtx4938.h>
 
-static unsigned int toshiba_rbtx4938_irq_ioc_startup(unsigned int irq);
-static void toshiba_rbtx4938_irq_ioc_shutdown(unsigned int irq);
 static void toshiba_rbtx4938_irq_ioc_enable(unsigned int irq);
 static void toshiba_rbtx4938_irq_ioc_disable(unsigned int irq);
-static void toshiba_rbtx4938_irq_ioc_mask_and_ack(unsigned int irq);
 static void toshiba_rbtx4938_irq_ioc_end(unsigned int irq);
 
-DEFINE_SPINLOCK(toshiba_rbtx4938_ioc_lock);
-
 #define TOSHIBA_RBTX4938_IOC_NAME "RBTX4938-IOC"
 static struct irq_chip toshiba_rbtx4938_irq_ioc_type = {
 	.typename = TOSHIBA_RBTX4938_IOC_NAME,
-	.startup = toshiba_rbtx4938_irq_ioc_startup,
-	.shutdown = toshiba_rbtx4938_irq_ioc_shutdown,
-	.enable = toshiba_rbtx4938_irq_ioc_enable,
-	.disable = toshiba_rbtx4938_irq_ioc_disable,
-	.ack = toshiba_rbtx4938_irq_ioc_mask_and_ack,
+	.ack = toshiba_rbtx4938_irq_ioc_disable,
+	.mask = toshiba_rbtx4938_irq_ioc_disable,
+	.mask_ack = toshiba_rbtx4938_irq_ioc_disable,
+	.unmask = toshiba_rbtx4938_irq_ioc_enable,
 	.end = toshiba_rbtx4938_irq_ioc_end,
-	.set_affinity = NULL
 };
 
 #define TOSHIBA_RBTX4938_IOC_INTR_ENAB 0xb7f02000
@@ -142,69 +135,35 @@ toshiba_rbtx4938_irq_ioc_init(void)
 	int i;
 
 	for (i = TOSHIBA_RBTX4938_IRQ_IOC_BEG;
-	     i <= TOSHIBA_RBTX4938_IRQ_IOC_END; i++) {
-		irq_desc[i].status = IRQ_DISABLED;
-		irq_desc[i].action = 0;
-		irq_desc[i].depth = 3;
-		irq_desc[i].chip = &toshiba_rbtx4938_irq_ioc_type;
-	}
+	     i <= TOSHIBA_RBTX4938_IRQ_IOC_END; i++)
+		set_irq_chip(i, &toshiba_rbtx4938_irq_ioc_type);
 
 	setup_irq(RBTX4938_IRQ_IOCINT,
 		  &toshiba_rbtx4938_irq_ioc_action);
 }
 
-static unsigned int
-toshiba_rbtx4938_irq_ioc_startup(unsigned int irq)
-{
-	toshiba_rbtx4938_irq_ioc_enable(irq);
-
-	return 0;
-}
-
-static void
-toshiba_rbtx4938_irq_ioc_shutdown(unsigned int irq)
-{
-	toshiba_rbtx4938_irq_ioc_disable(irq);
-}
-
 static void
 toshiba_rbtx4938_irq_ioc_enable(unsigned int irq)
 {
-	unsigned long flags;
 	volatile unsigned char v;
 
-	spin_lock_irqsave(&toshiba_rbtx4938_ioc_lock, flags);
-
 	v = TX4938_RD08(TOSHIBA_RBTX4938_IOC_INTR_ENAB);
 	v |= (1 << (irq - TOSHIBA_RBTX4938_IRQ_IOC_BEG));
 	TX4938_WR08(TOSHIBA_RBTX4938_IOC_INTR_ENAB, v);
 	mmiowb();
 	TX4938_RD08(TOSHIBA_RBTX4938_IOC_INTR_ENAB);
-
-	spin_unlock_irqrestore(&toshiba_rbtx4938_ioc_lock, flags);
 }
 
 static void
 toshiba_rbtx4938_irq_ioc_disable(unsigned int irq)
 {
-	unsigned long flags;
 	volatile unsigned char v;
 
-	spin_lock_irqsave(&toshiba_rbtx4938_ioc_lock, flags);
-
 	v = TX4938_RD08(TOSHIBA_RBTX4938_IOC_INTR_ENAB);
 	v &= ~(1 << (irq - TOSHIBA_RBTX4938_IRQ_IOC_BEG));
 	TX4938_WR08(TOSHIBA_RBTX4938_IOC_INTR_ENAB, v);
 	mmiowb();
 	TX4938_RD08(TOSHIBA_RBTX4938_IOC_INTR_ENAB);
-
-	spin_unlock_irqrestore(&toshiba_rbtx4938_ioc_lock, flags);
-}
-
-static void
-toshiba_rbtx4938_irq_ioc_mask_and_ack(unsigned int irq)
-{
-	toshiba_rbtx4938_irq_ioc_disable(irq);
 }
 
 static void
diff --git a/arch/mips/vr41xx/common/icu.c b/arch/mips/vr41xx/common/icu.c
index c215c0d..33d70a6 100644
--- a/arch/mips/vr41xx/common/icu.c
+++ b/arch/mips/vr41xx/common/icu.c
@@ -417,14 +417,7 @@ void vr41xx_disable_bcuint(void)
 
 EXPORT_SYMBOL(vr41xx_disable_bcuint);
 
-static unsigned int startup_sysint1_irq(unsigned int irq)
-{
-	icu1_set(MSYSINT1REG, 1 << SYSINT1_IRQ_TO_PIN(irq));
-
-	return 0; /* never anything pending */
-}
-
-static void shutdown_sysint1_irq(unsigned int irq)
+static void disable_sysint1_irq(unsigned int irq)
 {
 	icu1_clear(MSYSINT1REG, 1 << SYSINT1_IRQ_TO_PIN(irq));
 }
@@ -434,9 +427,6 @@ static void enable_sysint1_irq(unsigned 
 	icu1_set(MSYSINT1REG, 1 << SYSINT1_IRQ_TO_PIN(irq));
 }
 
-#define disable_sysint1_irq	shutdown_sysint1_irq
-#define ack_sysint1_irq		shutdown_sysint1_irq
-
 static void end_sysint1_irq(unsigned int irq)
 {
 	if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
@@ -445,22 +435,14 @@ static void end_sysint1_irq(unsigned int
 
 static struct irq_chip sysint1_irq_type = {
 	.typename	= "SYSINT1",
-	.startup	= startup_sysint1_irq,
-	.shutdown	= shutdown_sysint1_irq,
-	.enable		= enable_sysint1_irq,
-	.disable	= disable_sysint1_irq,
-	.ack		= ack_sysint1_irq,
+	.ack		= disable_sysint1_irq,
+	.mask		= disable_sysint1_irq,
+	.mask_ack	= disable_sysint1_irq,
+	.unmask		= enable_sysint1_irq,
 	.end		= end_sysint1_irq,
 };
 
-static unsigned int startup_sysint2_irq(unsigned int irq)
-{
-	icu2_set(MSYSINT2REG, 1 << SYSINT2_IRQ_TO_PIN(irq));
-
-	return 0; /* never anything pending */
-}
-
-static void shutdown_sysint2_irq(unsigned int irq)
+static void disable_sysint2_irq(unsigned int irq)
 {
 	icu2_clear(MSYSINT2REG, 1 << SYSINT2_IRQ_TO_PIN(irq));
 }
@@ -470,9 +452,6 @@ static void enable_sysint2_irq(unsigned 
 	icu2_set(MSYSINT2REG, 1 << SYSINT2_IRQ_TO_PIN(irq));
 }
 
-#define disable_sysint2_irq	shutdown_sysint2_irq
-#define ack_sysint2_irq		shutdown_sysint2_irq
-
 static void end_sysint2_irq(unsigned int irq)
 {
 	if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
@@ -481,11 +460,10 @@ static void end_sysint2_irq(unsigned int
 
 static struct irq_chip sysint2_irq_type = {
 	.typename	= "SYSINT2",
-	.startup	= startup_sysint2_irq,
-	.shutdown	= shutdown_sysint2_irq,
-	.enable		= enable_sysint2_irq,
-	.disable	= disable_sysint2_irq,
-	.ack		= ack_sysint2_irq,
+	.ack		= disable_sysint2_irq,
+	.mask		= disable_sysint2_irq,
+	.mask_ack	= disable_sysint2_irq,
+	.unmask		= enable_sysint2_irq,
 	.end		= end_sysint2_irq,
 };
 
@@ -723,10 +701,10 @@ static int __init vr41xx_icu_init(void)
 	icu2_write(MGIUINTHREG, 0xffff);
 
 	for (i = SYSINT1_IRQ_BASE; i <= SYSINT1_IRQ_LAST; i++)
-		irq_desc[i].chip = &sysint1_irq_type;
+		set_irq_chip(i, &sysint1_irq_type);
 
 	for (i = SYSINT2_IRQ_BASE; i <= SYSINT2_IRQ_LAST; i++)
-		irq_desc[i].chip = &sysint2_irq_type;
+		set_irq_chip(i, &sysint2_irq_type);
 
 	cascade_irq(INT0_IRQ, icu_get_irq);
 	cascade_irq(INT1_IRQ, icu_get_irq);
diff --git a/arch/mips/vr41xx/nec-cmbvr4133/irq.c b/arch/mips/vr41xx/nec-cmbvr4133/irq.c
index 2483487..a039bb7 100644
--- a/arch/mips/vr41xx/nec-cmbvr4133/irq.c
+++ b/arch/mips/vr41xx/nec-cmbvr4133/irq.c
@@ -30,17 +30,6 @@ extern void init_8259A(int hoge);
 
 extern int vr4133_rockhopper;
 
-static unsigned int startup_i8259_irq(unsigned int irq)
-{
-	enable_8259A_irq(irq - I8259_IRQ_BASE);
-	return 0;
-}
-
-static void shutdown_i8259_irq(unsigned int irq)
-{
-	disable_8259A_irq(irq - I8259_IRQ_BASE);
-}
-
 static void enable_i8259_irq(unsigned int irq)
 {
 	enable_8259A_irq(irq - I8259_IRQ_BASE);
@@ -64,11 +53,10 @@ static void end_i8259_irq(unsigned int i
 
 static struct irq_chip i8259_irq_type = {
 	.typename       = "XT-PIC",
-	.startup        = startup_i8259_irq,
-	.shutdown       = shutdown_i8259_irq,
-	.enable         = enable_i8259_irq,
-	.disable        = disable_i8259_irq,
 	.ack            = ack_i8259_irq,
+	.mask		= disable_i8259_irq,
+	.mask_ack	= ack_i8259_irq,
+	.unmask		= enable_i8259_irq,
 	.end            = end_i8259_irq,
 };
 
@@ -104,7 +92,7 @@ void __init rockhopper_init_irq(void)
 	}
 
 	for (i = I8259_IRQ_BASE; i <= I8259_IRQ_LAST; i++)
-		irq_desc[i].chip = &i8259_irq_type;
+		set_irq_chip(i, &i8259_irq_type);
 
 	setup_irq(I8259_SLAVE_IRQ, &i8259_slave_cascade);
 
diff --git a/include/asm-mips/dec/kn02.h b/include/asm-mips/dec/kn02.h
index 8319ad7..93430b5 100644
--- a/include/asm-mips/dec/kn02.h
+++ b/include/asm-mips/dec/kn02.h
@@ -82,11 +82,9 @@ #define KN02_IRQ_ALL		0xff
 
 #ifndef __ASSEMBLY__
 
-#include <linux/spinlock.h>
 #include <linux/types.h>
 
 extern u32 cached_kn02_csr;
-extern spinlock_t kn02_lock;
 extern void init_kn02_irqs(int base);
 #endif
 

From wim@iguana.be Wed Nov  1 18:46:45 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 01 Nov 2006 18:46:51 +0000 (GMT)
Received: from outmx009.isp.belgacom.be ([195.238.5.4]:45759 "EHLO
	outmx009.isp.belgacom.be") by ftp.linux-mips.org with ESMTP
	id S20039636AbWKASqp (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 1 Nov 2006 18:46:45 +0000
Received: from outmx009.isp.belgacom.be (localhost [127.0.0.1])
        by outmx009.isp.belgacom.be (8.12.11.20060308/8.12.11/Skynet-OUT-2.22) with ESMTP id kA1IkbsG029833;
	Wed, 1 Nov 2006 19:46:38 +0100
        (envelope-from <wim@iguana.be>)
Received: from infomag.iguana.be (25.55-136-217.adsl-dyn.isp.belgacom.be [217.136.55.25])
        by outmx009.isp.belgacom.be (8.12.11.20060308/8.12.11/Skynet-OUT-2.22) with ESMTP id kA1IkYON029809;
	Wed, 1 Nov 2006 19:46:35 +0100
        (envelope-from <wim@iguana.be>)
Received: from infomag.iguana.be (localhost.localdomain [127.0.0.1])
	by infomag.iguana.be (8.13.7/8.12.11) with ESMTP id kA1IkaGc008080;
	Wed, 1 Nov 2006 19:46:36 +0100
Received: (from wim@localhost)
	by infomag.iguana.be (8.13.7/8.13.7/Submit) id kA1IkXnA008079;
	Wed, 1 Nov 2006 19:46:33 +0100
Date:	Wed, 1 Nov 2006 19:46:33 +0100
From:	Wim Van Sebroeck <wim@iguana.be>
To:	Thomas Koeller <thomas@koeller.dyndns.org>,
	Ralf Baechle <ralf@linux-mips.org>,
	Dave Jones <davej@redhat.com>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Sam Ravnborg <sam@ravnborg.org>,
	"Randy. Dunlap" <rdunlap@xenotime.net>,
	Alexey Dobriyan <adobriyan@gmail.com>
Cc:	linux-kernel@vger.kernel.org, linux-mips@linux-mips.org
Subject: Re: [PATCH] Added MIPS RM9K watchdog driver
Message-ID: <20061101184633.GA7056@infomag.infomag.iguana.be>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.4.2.1i
Return-Path: <wim@iguana.be>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13138
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: wim@iguana.be
Precedence: bulk
X-list: linux-mips

Hi All,

Can you all review the following watchdog driver? I want to include
it in my linux-2.6-watchdog-mm tree, but would appreciate it if you
could have all a look at it again.

Thomas: I moved start and stop code into seperate functions. I also
deleted the #include <rm9k_wdt.h> because the file doesn't exist.
Note that the shutdown function of the platform_device_driver is
similar to a reboot notifier.

Thanks in advance,
Wim.

--------------------------------------------------------------------------------
/*
 *  Watchdog implementation for GPI h/w found on PMC-Sierra RM9xxx
 *  chips.
 *
 *  Copyright (C) 2004 by Basler Vision Technologies AG
 *  Author: Thomas Koeller <thomas.koeller@baslerweb.com>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include <linux/platform_device.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/interrupt.h>
#include <linux/fs.h>
#include <linux/reboot.h>
#include <linux/notifier.h>
#include <linux/miscdevice.h>
#include <linux/watchdog.h>
#include <asm/io.h>
#include <asm/atomic.h>
#include <asm/processor.h>
#include <asm/uaccess.h>
#include <asm/system.h>
#include <asm/rm9k-ocd.h>


#define CLOCK                  125000000
#define MAX_TIMEOUT_SECONDS    32
#define CPCCR                  0x0080
#define CPGIG1SR               0x0044
#define CPGIG1ER               0x0054



/* Function prototypes */
static int __init wdt_gpi_probe(struct device *);
static int __exit wdt_gpi_remove(struct device *);
static void wdt_gpi_start(void);
static void wdt_gpi_stop(void);
static void wdt_gpi_set_timeout(unsigned int);
static int wdt_gpi_open(struct inode *, struct file *);
static int wdt_gpi_release(struct inode *, struct file *);
static ssize_t wdt_gpi_write(struct file *, const char __user *, size_t, loff_t *);
static long wdt_gpi_ioctl(struct file *, unsigned int, unsigned long);
static const struct resource *wdt_gpi_get_resource(struct platform_device *, const char *, unsigned int);
static int wdt_gpi_notify(struct notifier_block *, unsigned long, void *);
static irqreturn_t wdt_gpi_irqhdl(int, void *, struct pt_regs *);




static const char wdt_gpi_name[] = "wdt_gpi";
static atomic_t opencnt;
static int expect_close;
static int locked = 0;



/* These are set from device resources */
static void __iomem * wd_regs;
static unsigned int wd_irq, wd_ctr;



/* Module arguments */
static int timeout = MAX_TIMEOUT_SECONDS;
module_param(timeout, int, 0444);
static unsigned long resetaddr = 0xbffdc200;
module_param(resetaddr, ulong, 0444);
static unsigned long flagaddr = 0xbffdc104;
module_param(flagaddr, ulong, 0444);
static int powercycle = 0;
module_param(powercycle, bool, 0444);

static int nowayout = WATCHDOG_NOWAYOUT;
module_param(nowayout, bool, 0444);



static struct file_operations fops = {
	.owner		= THIS_MODULE,
	.open		= wdt_gpi_open,
	.release	= wdt_gpi_release,
	.write		= wdt_gpi_write,
	.unlocked_ioctl	= wdt_gpi_ioctl,
};

static struct miscdevice miscdev = {
	.minor		= WATCHDOG_MINOR,
	.name		= wdt_gpi_name,
	.fops		= &fops,
};

static struct device_driver wdt_gpi_driver = {
	.name		= (char *) wdt_gpi_name,
	.bus		= &platform_bus_type,
	.owner		= THIS_MODULE,
	.probe		= wdt_gpi_probe,
	.remove		= __exit_p(wdt_gpi_remove),
	.shutdown	= NULL,
	.suspend	= NULL,
	.resume		= NULL,
};

static struct notifier_block wdt_gpi_shutdown = {
	.notifier_call	= wdt_gpi_notify,
};



static const struct resource *
wdt_gpi_get_resource(struct platform_device *pdv, const char *name,
		      unsigned int type)
{
	char buf[80];
	if (snprintf(buf, sizeof buf, "%s_0", name) >= sizeof buf)
		return NULL;
	return platform_get_resource_byname(pdv, type, buf);
}



/* No hotplugging on the platform bus - use __init */
static int __init wdt_gpi_probe(struct device *dev)
{
	int res;
	struct platform_device * const pdv = to_platform_device(dev);
	const struct resource
		* const rr = wdt_gpi_get_resource(pdv, WDT_RESOURCE_REGS,
						  IORESOURCE_MEM),
		* const ri = wdt_gpi_get_resource(pdv, WDT_RESOURCE_IRQ,
						  IORESOURCE_IRQ),
		* const rc = wdt_gpi_get_resource(pdv, WDT_RESOURCE_COUNTER,
						  0);

	if (unlikely(!rr || !ri || !rc))
		return -ENXIO;

	wd_regs = ioremap_nocache(rr->start, rr->end + 1 - rr->start);
	if (unlikely(!wd_regs))
		return -ENOMEM;
	wd_irq = ri->start;
	wd_ctr = rc->start;
	res = misc_register(&miscdev);
	if (res)
		iounmap(wd_regs);
	else
		register_reboot_notifier(&wdt_gpi_shutdown);
	return res;
}



static int __exit wdt_gpi_remove(struct device *dev)
{
	int res;

	unregister_reboot_notifier(&wdt_gpi_shutdown);
	res = misc_deregister(&miscdev);
	iounmap(wd_regs);
	wd_regs = NULL;
	return res;
}


static void wdt_gpi_start(void)
{
	u32 reg;

	lock_titan_regs();
	reg = titan_readl(CPGIG1ER);
	titan_writel(reg | (0x100 << wd_ctr), CPGIG1ER);
	iob();
	unlock_titan_regs();
}

static void wdt_gpi_stop(void)
{
	u32 reg;

	lock_titan_regs();
	reg = titan_readl(CPCCR) & ~(0xf << (wd_ctr * 4));
	titan_writel(reg, CPCCR);
	reg = titan_readl(CPGIG1ER);
	titan_writel(reg & ~(0x100 << wd_ctr), CPGIG1ER);
	iob();
	unlock_titan_regs();
}

static void wdt_gpi_set_timeout(unsigned int to)
{
	u32 reg;
	const u32 wdval = (to * CLOCK) & ~0x0000000f;

	lock_titan_regs();
	reg = titan_readl(CPCCR) & ~(0xf << (wd_ctr * 4));
	titan_writel(reg, CPCCR);
	wmb();
	__raw_writel(wdval, wd_regs + 0x0000);
	wmb();
	titan_writel(reg | (0x2 << (wd_ctr * 4)), CPCCR);
	wmb();
	titan_writel(reg | (0x5 << (wd_ctr * 4)), CPCCR);
	iob();
	unlock_titan_regs();
}



static int wdt_gpi_open(struct inode *inode, struct file *file)
{
	int res;

	if (unlikely(0 > atomic_dec_if_positive(&opencnt)))
		return -EBUSY;

	expect_close = 0;
	if (locked) {
		module_put(THIS_MODULE);
		free_irq(wd_irq, &miscdev);
		locked = 0;
	}

	res = request_irq(wd_irq, wdt_gpi_irqhdl, SA_SHIRQ | SA_INTERRUPT,
			  wdt_gpi_name, &miscdev);
	if (unlikely(res))
		return res;

	wdt_gpi_set_timeout(timeout);
	wdt_gpi_start();

	printk(KERN_INFO "%s: watchdog started, timeout = %u seconds\n",
		wdt_gpi_name, timeout);
	return nonseekable_open(inode, file);
}



static int wdt_gpi_release(struct inode *i, struct file *f)
{
	if (nowayout) {
		printk(KERN_NOTICE "%s: no way out - watchdog left running\n",
			wdt_gpi_name);
		__module_get(THIS_MODULE);
		locked = 1;
	} else {
		if (expect_close) {
			wdt_gpi_stop();
			free_irq(wd_irq, &miscdev);
			printk(KERN_INFO "%s: watchdog stopped\n", wdt_gpi_name);
		} else {
			printk(KERN_NOTICE "%s: unexpected close() -"
				" watchdog left running\n",
				wdt_gpi_name);
			wdt_gpi_set_timeout(timeout);
			__module_get(THIS_MODULE);
			locked = 1;
		}
	}

	atomic_inc(&opencnt);
	return 0;
}



static ssize_t
wdt_gpi_write(struct file *f, const char __user *d, size_t s, loff_t *o)
{
	char val;

	wdt_gpi_set_timeout(timeout);
	expect_close = (s > 0) && !get_user(val, d) && (val == 'V');
	return s ? 1 : 0;
}



static long
wdt_gpi_ioctl(struct file *f, unsigned int cmd, unsigned long arg)
{
	long res = -ENOTTY;
	const long size = _IOC_SIZE(cmd);
	int stat;
	static struct watchdog_info wdinfo = {
		.identity               = "RM9xxx/GPI watchdog",
		.firmware_version       = 0,
		.options                = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING
	};

	if (unlikely(_IOC_TYPE(cmd) != WATCHDOG_IOCTL_BASE))
		return -ENOTTY;

	if ((_IOC_DIR(cmd) & _IOC_READ)
	    && !access_ok(VERIFY_WRITE, arg, size))
		return -EFAULT;

	if ((_IOC_DIR(cmd) & _IOC_WRITE)
	    && !access_ok(VERIFY_READ, arg, size))
		return -EFAULT;

	expect_close = 0;

	switch (cmd) {
	case WDIOC_GETSUPPORT:
		wdinfo.options = nowayout ?
			WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING :
			WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE;
		res = __copy_to_user((void __user *)arg, &wdinfo, size) ?
			-EFAULT : size;
		break;

	case WDIOC_GETSTATUS:
		break;

	case WDIOC_GETBOOTSTATUS:
		stat = (*(volatile char *) flagaddr & 0x01)
			? WDIOF_CARDRESET : 0;
		res = __copy_to_user((void __user *)arg, &stat, size) ?
			-EFAULT : size;
		break;

	case WDIOC_SETOPTIONS:
		break;

	case WDIOC_KEEPALIVE:
		wdt_gpi_set_timeout(timeout);
		res = size;
		break;

	case WDIOC_SETTIMEOUT:
		{
			int val;
			if (unlikely(__copy_from_user(&val, (const void __user *) arg,
					size))) {
				res = -EFAULT;
				break;
			}

			if (val > 32)
				val = 32;
			timeout = val;
			wdt_gpi_set_timeout(val);
			res = size;
			printk("%s: timeout set to %u seconds\n",
				wdt_gpi_name, timeout);
		}
		break;

	case WDIOC_GETTIMEOUT:
		res = __copy_to_user((void __user *) arg, &timeout, size) ?
			-EFAULT : size;
		break;
	}

	return res;
}




static irqreturn_t wdt_gpi_irqhdl(int irq, void *ctxt, struct pt_regs *regs)
{
	if (!unlikely(__raw_readl(wd_regs + 0x0008) & 0x1))
		return IRQ_NONE;
	__raw_writel(0x1, wd_regs + 0x0008);


	printk(KERN_WARNING "%s: watchdog expired - resetting system\n",
		wdt_gpi_name);

	*(volatile char *) flagaddr |= 0x01;
	*(volatile char *) resetaddr = powercycle ? 0x01 : 0x2;
	iob();
	while (1)
		cpu_relax();
}



static int
wdt_gpi_notify(struct notifier_block *this, unsigned long code, void *unused)
{
	if(code == SYS_DOWN || code == SYS_HALT) {
		wdt_gpi_stop();
	}
	return NOTIFY_DONE;
}



static int __init wdt_gpi_init_module(void)
{
	atomic_set(&opencnt, 1);
	if (timeout > MAX_TIMEOUT_SECONDS)
		timeout = MAX_TIMEOUT_SECONDS;
	return driver_register(&wdt_gpi_driver);
}



static void __exit wdt_gpi_cleanup_module(void)
{
	driver_unregister(&wdt_gpi_driver);
}

module_init(wdt_gpi_init_module);
module_exit(wdt_gpi_cleanup_module);



MODULE_AUTHOR("Thomas Koeller <thomas.koeller@baslerweb.com>");
MODULE_DESCRIPTION("Basler eXcite watchdog driver for gpi devices");
MODULE_VERSION("0.1");
MODULE_LICENSE("GPL");
MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds");
MODULE_PARM_DESC(resetaddr, "Address to write to to force a reset");
MODULE_PARM_DESC(flagaddr, "Address to write to boot flags to");
MODULE_PARM_DESC(nowayout, "Watchdog cannot be disabled once started");
MODULE_PARM_DESC(powercycle, "Cycle power if watchdog expires");

From ralf@linux-mips.org Wed Nov  1 18:47:31 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 01 Nov 2006 18:47:32 +0000 (GMT)
Received: from localhost.localdomain ([127.0.0.1]:8084 "EHLO
	dl5rb.ham-radio-op.net") by ftp.linux-mips.org with ESMTP
	id S20039636AbWKASrb (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 1 Nov 2006 18:47:31 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by dl5rb.ham-radio-op.net (8.13.8/8.13.8) with ESMTP id kA1IluTC028108;
	Wed, 1 Nov 2006 18:47:56 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.8/8.13.8/Submit) id kA1Iltdm028107;
	Wed, 1 Nov 2006 18:47:55 GMT
Date:	Wed, 1 Nov 2006 18:47:55 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc:	linux-mips@linux-mips.org
Subject: Re: [PATCH] mips irq cleanups
Message-ID: <20061101184755.GC4736@linux-mips.org>
References: <20061102.020836.25912635.anemo@mba.ocn.ne.jp>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20061102.020836.25912635.anemo@mba.ocn.ne.jp>
User-Agent: Mutt/1.4.2.2i
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13139
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: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Thu, Nov 02, 2006 at 02:08:36AM +0900, Atsushi Nemoto wrote:

> This is a big irq cleanup patch.

>  37 files changed, 289 insertions(+), 1647 deletions(-)

Very nice.  I gave it a shot on a Malta and it works just fine.

  Ralf

From ralf@linux-mips.org Wed Nov  1 18:50:14 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 01 Nov 2006 18:50:16 +0000 (GMT)
Received: from localhost.localdomain ([127.0.0.1]:7318 "EHLO
	dl5rb.ham-radio-op.net") by ftp.linux-mips.org with ESMTP
	id S20039636AbWKASuO (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 1 Nov 2006 18:50:14 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by dl5rb.ham-radio-op.net (8.13.8/8.13.8) with ESMTP id kA1Iocj0028234;
	Wed, 1 Nov 2006 18:50:38 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.8/8.13.8/Submit) id kA1Ioa5N028233;
	Wed, 1 Nov 2006 18:50:36 GMT
Date:	Wed, 1 Nov 2006 18:50:36 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	Wim Van Sebroeck <wim@iguana.be>
Cc:	Thomas Koeller <thomas@koeller.dyndns.org>,
	Dave Jones <davej@redhat.com>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Sam Ravnborg <sam@ravnborg.org>,
	"Randy. Dunlap" <rdunlap@xenotime.net>,
	Alexey Dobriyan <adobriyan@gmail.com>,
	linux-kernel@vger.kernel.org, linux-mips@linux-mips.org
Subject: Re: [PATCH] Added MIPS RM9K watchdog driver
Message-ID: <20061101185036.GD4736@linux-mips.org>
References: <20061101184633.GA7056@infomag.infomag.iguana.be>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20061101184633.GA7056@infomag.infomag.iguana.be>
User-Agent: Mutt/1.4.2.2i
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13140
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: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Wed, Nov 01, 2006 at 07:46:33PM +0100, Wim Van Sebroeck wrote:

> Thomas: I moved start and stop code into seperate functions. I also
> deleted the #include <rm9k_wdt.h> because the file doesn't exist.

You just didn't see it, include/asm-mips/mach-excite/rm9k_wdt.h.

  Ralf

From wim@iguana.be Wed Nov  1 19:11:26 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 01 Nov 2006 19:11:31 +0000 (GMT)
Received: from outmx014.isp.belgacom.be ([195.238.4.69]:56043 "EHLO
	outmx014.isp.belgacom.be") by ftp.linux-mips.org with ESMTP
	id S20037530AbWKATL0 (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 1 Nov 2006 19:11:26 +0000
Received: from outmx014.isp.belgacom.be (localhost [127.0.0.1])
        by outmx014.isp.belgacom.be (8.12.11.20060308/8.12.11/Skynet-OUT-2.22) with ESMTP id kA1JBE8H023381;
	Wed, 1 Nov 2006 20:11:15 +0100
        (envelope-from <wim@iguana.be>)
Received: from infomag.iguana.be (25.55-136-217.adsl-dyn.isp.belgacom.be [217.136.55.25])
        by outmx014.isp.belgacom.be (8.12.11.20060308/8.12.11/Skynet-OUT-2.22) with ESMTP id kA1JBBKT023341;
	Wed, 1 Nov 2006 20:11:11 +0100
        (envelope-from <wim@iguana.be>)
Received: from infomag.iguana.be (localhost.localdomain [127.0.0.1])
	by infomag.iguana.be (8.13.7/8.12.11) with ESMTP id kA1JBD4A008231;
	Wed, 1 Nov 2006 20:11:13 +0100
Received: (from wim@localhost)
	by infomag.iguana.be (8.13.7/8.13.7/Submit) id kA1JBCpA008230;
	Wed, 1 Nov 2006 20:11:12 +0100
Date:	Wed, 1 Nov 2006 20:11:12 +0100
From:	Wim Van Sebroeck <wim@iguana.be>
To:	Ralf Baechle <ralf@linux-mips.org>
Cc:	Thomas Koeller <thomas@koeller.dyndns.org>,
	Dave Jones <davej@redhat.com>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Sam Ravnborg <sam@ravnborg.org>,
	"Randy. Dunlap" <rdunlap@xenotime.net>,
	Alexey Dobriyan <adobriyan@gmail.com>,
	linux-kernel@vger.kernel.org, linux-mips@linux-mips.org
Subject: Re: [PATCH] Added MIPS RM9K watchdog driver
Message-ID: <20061101191112.GB7056@infomag.infomag.iguana.be>
References: <20061101184633.GA7056@infomag.infomag.iguana.be> <20061101185036.GD4736@linux-mips.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20061101185036.GD4736@linux-mips.org>
User-Agent: Mutt/1.4.2.1i
Return-Path: <wim@iguana.be>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13141
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: wim@iguana.be
Precedence: bulk
X-list: linux-mips

Hi Ralf,

> > Thomas: I moved start and stop code into seperate functions. I also
> > deleted the #include <rm9k_wdt.h> because the file doesn't exist.
> 
> You just didn't see it, include/asm-mips/mach-excite/rm9k_wdt.h.

Thanks, didn't see it indeed :-). I'll include that again.
Any other remarks still?

Greetings,
Wim.


From Trevor_Hamm@pmc-sierra.com Wed Nov  1 20:06:45 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 01 Nov 2006 20:06:54 +0000 (GMT)
Received: from mother.pmc-sierra.com ([216.241.224.12]:30163 "HELO
	mother.pmc-sierra.bc.ca") by ftp.linux-mips.org with SMTP
	id S20037738AbWKAUGp (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 1 Nov 2006 20:06:45 +0000
Received: (qmail 25640 invoked by uid 101); 1 Nov 2006 20:06:34 -0000
Received: from unknown (HELO ogyruan.pmc-sierra.bc.ca) (216.241.226.236)
  by mother.pmc-sierra.com with SMTP; 1 Nov 2006 20:06:34 -0000
Received: from bby1exi01.pmc_nt.nt.pmc-sierra.bc.ca (bby1exi01.pmc-sierra.bc.ca [216.241.231.251])
	by ogyruan.pmc-sierra.bc.ca (8.13.3/8.12.7) with ESMTP id kA1K6PPd022922
	for <linux-mips@linux-mips.org>; Wed, 1 Nov 2006 12:06:34 -0800
Received: by bby1exi01.pmc-sierra.bc.ca with Internet Mail Service (5.5.2657.72)
	id <VY7RV4BN>; Wed, 1 Nov 2006 12:06:25 -0800
Message-ID: <E8C8A5231DDE104C816ADF532E0639120194F4B2@bby1exm07.pmc_nt.nt.pmc-sierra.bc.ca>
From:	Trevor Hamm <Trevor_Hamm@pmc-sierra.com>
To:	"'linux-mips@linux-mips.org'" <linux-mips@linux-mips.org>
Subject: Problems booting Linux 2.6.18.1 on MIPS34K core
Date:	Wed, 1 Nov 2006 12:06:15 -0800 
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2657.72)
Content-Type: text/plain
Return-Path: <Trevor_Hamm@pmc-sierra.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13142
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: Trevor_Hamm@pmc-sierra.com
Precedence: bulk
X-list: linux-mips

Since upgrading our Linux kernel from 2.6.17 to 2.6.18.1, we've had problems booting a board using the MIPS 34K core.  The kernel is configured for UP (no SMP or SMTC).  The boot hangs right around the time when /sbin/init is executed (after the "Freeing unused kernel memory" message).  This only happens when booting right after power-cycling the board.  The boot succeeds after a reset.

My investigation shows this behaviour was introduced between 2.6.17.10 and 2.6.17.12 (2.6.17.11 failed to build, so I didn't test that version).  In fact, the patch below, applied against 2.6.17.10, is sufficient to cause the boot problem.  The bulk of this patch includes a fix from Aug. 31, 2006 for dcache aliasing on fork.  If I exclude the dcache aliasing fix from this patch, the boot problem apparently disappears.

Some more interesting details:
- We're using a squashfs root filesystem in RAM (squashfs 3.1-r2).  We have not been able to reproduce with cramfs.
- /sbin/init is from util-linux 2.12r.  We have not been able to reproduce with sysvinit 2.86.
- When using a EJTAG probe to trace what the kernel is doing at this time it appears to be looping through do_signal(), work_notifysig(), do_notify_resume().

Any insight into possible causes for this lock-up would be greatly appreciated.

Thanks,
Trevor

2.6.17.10-2.6.17.12 patch
=========================

diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index 6344be4..ff59d8e 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -648,6 +648,10 @@ #endif /* CONFIG_MIPS_MT_FPAFF */
 	sys	sys_splice		4
 	sys	sys_sync_file_range	7	/* 4305 */
 	sys	sys_tee			4
+	sys	sys_vmsplice		4
+	sys	sys_ni_syscall		0
+	sys	sys_set_robust_list	2
+	sys	sys_get_robust_list	3
 	.endm
 
 	/* We pre-compute the number of _instruction_ bytes needed to
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S
index 12d96c7..9de0778 100644
--- a/arch/mips/kernel/scall64-64.S
+++ b/arch/mips/kernel/scall64-64.S
@@ -463,3 +463,7 @@ sys_call_table:
 	PTR	sys_splice
 	PTR	sys_sync_file_range
 	PTR	sys_tee				/* 5265 */
+	PTR	sys_vmsplice
+	PTR	sys_ni_syscall
+	PTR	sys_set_robust_list
+	PTR	sys_get_robust_list
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index 6856985..13e36b6 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -389,3 +389,7 @@ EXPORT(sysn32_call_table)
 	PTR	sys_splice
 	PTR	sys_sync_file_range
 	PTR	sys_tee
+	PTR	sys_vmsplice			/* 6270 */
+	PTR	sys_ni_syscall
+	PTR	compat_sys_set_robust_list
+	PTR	compat_sys_get_robust_list
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index 0e63293..e6c8d1a 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -511,4 +511,8 @@ sys_call_table:
 	PTR	sys_splice
 	PTR	sys32_sync_file_range		/* 4305 */
 	PTR	sys_tee
+	PTR	sys_vmsplice
+	PTR	sys_ni_syscall
+	PTR	compat_sys_set_robust_list
+	PTR	compat_sys_get_robust_list	/* 4310 */
 	.size	sys_call_table,.-sys_call_table
diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c
index 5e8a18a..b280f51 100644
--- a/arch/mips/kernel/syscall.c
+++ b/arch/mips/kernel/syscall.c
@@ -117,6 +117,22 @@ unsigned long arch_get_unmapped_area(str
 	}
 }
 
+int mips_mmap_check(unsigned long addr, unsigned long len,
+	unsigned long flags)
+{
+#ifdef CONFIG_MIPS32_COMPAT
+	if (current->thread.mflags & MF_32BIT_ADDR) {
+		if (len > TASK_SIZE32)
+			return -EINVAL;
+		if (flags & MAP_FIXED &&
+		    (addr >= TASK_SIZE32 || addr + len >= TASK_SIZE32))
+			return -EINVAL;
+	}
+#endif
+
+	return 0;
+}
+
 /* common code for old and new mmaps */
 static inline unsigned long
 do_mmap2(unsigned long addr, unsigned long len, unsigned long prot,
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
index de327b1..e18c39b 100644
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -456,7 +456,7 @@ static inline void local_r4k_flush_cache
 		}
 	}
 	if (exec) {
-		if (cpu_has_vtag_icache) {
+		if (cpu_has_vtag_icache && mm == current->active_mm) {
 			int cpu = smp_processor_id();
 
 			if (cpu_context(cpu, mm) != 0)
@@ -580,7 +580,7 @@ static inline void local_r4k_flush_icach
 	 * We're not sure of the virtual address(es) involved here, so
 	 * we have to flush the entire I-cache.
 	 */
-	if (cpu_has_vtag_icache) {
+	if (cpu_has_vtag_icache && vma->vm_mm == current->active_mm) {
 		int cpu = smp_processor_id();
 
 		if (cpu_context(cpu, vma->vm_mm) != 0)
diff --git a/arch/mips/mm/c-sb1.c b/arch/mips/mm/c-sb1.c
index 87c417f..7849678 100644
--- a/arch/mips/mm/c-sb1.c
+++ b/arch/mips/mm/c-sb1.c
@@ -156,6 +156,26 @@ static inline void __sb1_flush_icache_al
 }
 
 /*
+ * Invalidate a range of the icache.  The addresses are virtual, and
+ * the cache is virtually indexed and tagged.  However, we don't
+ * necessarily have the right ASID context, so use index ops instead
+ * of hit ops.
+ */
+static inline void __sb1_flush_icache_range(unsigned long start,
+	unsigned long end)
+{
+	start &= ~(icache_line_size - 1);
+	end = (end + icache_line_size - 1) & ~(icache_line_size - 1);
+
+	while (start != end) {
+		cache_set_op(Index_Invalidate_I, start & icache_index_mask);
+		start += icache_line_size;
+	}
+	mispredict();
+	sync();
+}
+
+/*
  * Flush the icache for a given physical page.  Need to writeback the
  * dcache first, then invalidate the icache.  If the page isn't
  * executable, nothing is required.
@@ -174,8 +194,11 @@ #endif
 	/*
 	 * Bumping the ASID is probably cheaper than the flush ...
 	 */
-	if (cpu_context(cpu, vma->vm_mm) != 0)
-		drop_mmu_context(vma->vm_mm, cpu);
+	if (vma->vm_mm == current->active_mm) {
+		if (cpu_context(cpu, vma->vm_mm) != 0)
+			drop_mmu_context(vma->vm_mm, cpu);
+	} else
+		__sb1_flush_icache_range(addr, addr + PAGE_SIZE);
 }
 
 #ifdef CONFIG_SMP
@@ -211,26 +234,6 @@ void sb1_flush_cache_page(struct vm_area
 	__attribute__((alias("local_sb1_flush_cache_page")));
 #endif
 
-/*
- * Invalidate a range of the icache.  The addresses are virtual, and
- * the cache is virtually indexed and tagged.  However, we don't
- * necessarily have the right ASID context, so use index ops instead
- * of hit ops.
- */
-static inline void __sb1_flush_icache_range(unsigned long start,
-	unsigned long end)
-{
-	start &= ~(icache_line_size - 1);
-	end = (end + icache_line_size - 1) & ~(icache_line_size - 1);
-
-	while (start != end) {
-		cache_set_op(Index_Invalidate_I, start & icache_index_mask);
-		start += icache_line_size;
-	}
-	mispredict();
-	sync();
-}
-
 
 /*
  * Invalidate all caches on this CPU
@@ -327,9 +330,12 @@ #endif
 	 * If there's a context, bump the ASID (cheaper than a flush,
 	 * since we don't know VAs!)
 	 */
-	if (cpu_context(cpu, vma->vm_mm) != 0) {
-		drop_mmu_context(vma->vm_mm, cpu);
-	}
+	if (vma->vm_mm == current->active_mm) {
+		if (cpu_context(cpu, vma->vm_mm) != 0)
+			drop_mmu_context(vma->vm_mm, cpu);
+	} else
+		__sb1_flush_icache_range(start, start + PAGE_SIZE);
+
 }
 
 #ifdef CONFIG_SMP
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 33f6e1c..9068eb3 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -31,11 +31,39 @@ #include <asm/bootinfo.h>
 #include <asm/cachectl.h>
 #include <asm/cpu.h>
 #include <asm/dma.h>
+#include <asm/kmap_types.h>
 #include <asm/mmu_context.h>
 #include <asm/sections.h>
 #include <asm/pgtable.h>
 #include <asm/pgalloc.h>
 #include <asm/tlb.h>
+#include <asm/fixmap.h>
+
+/* CP0 hazard avoidance. */
+#define BARRIER __asm__ __volatile__(".set noreorder\n\t" \
+				     "nop; nop; nop; nop; nop; nop;\n\t" \
+				     ".set reorder\n\t")
+
+/* Atomicity and interruptability */
+#ifdef CONFIG_MIPS_MT_SMTC
+
+#include <asm/mipsmtregs.h>
+
+#define ENTER_CRITICAL(flags) \
+	{ \
+	unsigned int mvpflags; \
+	local_irq_save(flags);\
+	mvpflags = dvpe()
+#define EXIT_CRITICAL(flags) \
+	evpe(mvpflags); \
+	local_irq_restore(flags); \
+	}
+#else
+
+#define ENTER_CRITICAL(flags) local_irq_save(flags)
+#define EXIT_CRITICAL(flags) local_irq_restore(flags)
+
+#endif /* CONFIG_MIPS_MT_SMTC */
 
 DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
 
@@ -81,13 +109,183 @@ unsigned long setup_zero_pages(void)
 	return 1UL << order;
 }
 
-#ifdef CONFIG_HIGHMEM
-pte_t *kmap_pte;
-pgprot_t kmap_prot;
+/*
+ * These are almost like kmap_atomic / kunmap_atmic except they take an
+ * additional address argument as the hint.
+ */
 
 #define kmap_get_fixmap_pte(vaddr)					\
 	pte_offset_kernel(pmd_offset(pud_offset(pgd_offset_k(vaddr), (vaddr)), (vaddr)), (vaddr))
 
+#ifdef CONFIG_MIPS_MT_SMTC
+static pte_t *kmap_coherent_pte;
+static void __init kmap_coherent_init(void)
+{
+	unsigned long vaddr;
+
+	/* cache the first coherent kmap pte */
+	vaddr = __fix_to_virt(FIX_CMAP_BEGIN);
+	kmap_coherent_pte = kmap_get_fixmap_pte(vaddr);
+}
+#else
+static inline void kmap_coherent_init(void) {}
+#endif
+
+static inline void *kmap_coherent(struct page *page, unsigned long addr)
+{
+	enum fixed_addresses idx;
+	unsigned long vaddr, flags, entrylo;
+	unsigned long old_ctx;
+	pte_t pte;
+	unsigned int tlbidx;
+
+	inc_preempt_count();
+	idx = (addr >> PAGE_SHIFT) & (FIX_N_COLOURS - 1);
+#ifdef CONFIG_MIPS_MT_SMTC
+	idx += FIX_N_COLOURS * smp_processor_id();
+#endif
+	vaddr = __fix_to_virt(FIX_CMAP_END - idx);
+	pte = mk_pte(page, PAGE_KERNEL);
+#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1)
+	entrylo = pte.pte_high;
+#else
+	entrylo = pte_val(pte) >> 6;
+#endif
+
+	ENTER_CRITICAL(flags);
+	old_ctx = read_c0_entryhi();
+	write_c0_entryhi(vaddr & (PAGE_MASK << 1));
+	write_c0_entrylo0(entrylo);
+	write_c0_entrylo1(entrylo);
+#ifdef CONFIG_MIPS_MT_SMTC
+	set_pte(kmap_coherent_pte - (FIX_CMAP_END - idx), pte);
+	/* preload TLB instead of local_flush_tlb_one() */
+	mtc0_tlbw_hazard();
+	tlb_probe();
+	BARRIER;
+	tlbidx = read_c0_index();
+	mtc0_tlbw_hazard();
+	if (tlbidx < 0)
+		tlb_write_random();
+	else
+		tlb_write_indexed();
+#else
+	tlbidx = read_c0_wired();
+	write_c0_wired(tlbidx + 1);
+	write_c0_index(tlbidx);
+	mtc0_tlbw_hazard();
+	tlb_write_indexed();
+#endif
+	tlbw_use_hazard();
+	write_c0_entryhi(old_ctx);
+	EXIT_CRITICAL(flags);
+
+	return (void*) vaddr;
+}
+
+#define UNIQUE_ENTRYHI(idx) (CKSEG0 + ((idx) << (PAGE_SHIFT + 1)))
+
+static inline void kunmap_coherent(struct page *page)
+{
+#ifndef CONFIG_MIPS_MT_SMTC
+	unsigned int wired;
+	unsigned long flags, old_ctx;
+
+	ENTER_CRITICAL(flags);
+	old_ctx = read_c0_entryhi();
+	wired = read_c0_wired() - 1;
+	write_c0_wired(wired);
+	write_c0_index(wired);
+	write_c0_entryhi(UNIQUE_ENTRYHI(wired));
+	write_c0_entrylo0(0);
+	write_c0_entrylo1(0);
+	mtc0_tlbw_hazard();
+	tlb_write_indexed();
+	write_c0_entryhi(old_ctx);
+	EXIT_CRITICAL(flags);
+#endif
+	dec_preempt_count();
+	preempt_check_resched();
+}
+
+void copy_user_highpage(struct page *to, struct page *from,
+	unsigned long vaddr, struct vm_area_struct *vma)
+{
+	void *vfrom, *vto;
+
+	vto = kmap_atomic(to, KM_USER1);
+	if (cpu_has_dc_aliases) {
+		vfrom = kmap_coherent(from, vaddr);
+		copy_page(vto, vfrom);
+		kunmap_coherent(from);
+	} else {
+		vfrom = kmap_atomic(from, KM_USER0);
+		copy_page(vto, vfrom);
+		kunmap_atomic(vfrom, KM_USER0);
+	}
+	if (((vma->vm_flags & VM_EXEC) && !cpu_has_ic_fills_f_dc) ||
+	    pages_do_alias((unsigned long)vto, vaddr & PAGE_MASK))
+		flush_data_cache_page((unsigned long)vto);
+	kunmap_atomic(vto, KM_USER1);
+	/* Make sure this page is cleared on other CPU's too before using it */
+	smp_wmb();
+}
+
+EXPORT_SYMBOL(copy_user_highpage);
+
+void copy_user_page(void *vto, void *vfrom, unsigned long vaddr,
+	struct page *to)
+{
+	if (cpu_has_dc_aliases) {
+		struct page *from = virt_to_page(vfrom);
+		vfrom = kmap_coherent(from, vaddr);
+		copy_page(vto, vfrom);
+		kunmap_coherent(from);
+	} else
+		copy_page(vto, vfrom);
+	if (!cpu_has_ic_fills_f_dc ||
+	    pages_do_alias((unsigned long)vto, vaddr & PAGE_MASK))
+		flush_data_cache_page((unsigned long)vto);
+}
+
+EXPORT_SYMBOL(copy_user_page);
+
+void copy_to_user_page(struct vm_area_struct *vma,
+	struct page *page, unsigned long vaddr, void *dst, const void *src,
+	unsigned long len)
+{
+	if (cpu_has_dc_aliases) {
+		void *vto = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK);
+		memcpy(vto, src, len);
+		kunmap_coherent(page);
+	} else
+		memcpy(dst, src, len);
+	if ((vma->vm_flags & VM_EXEC) && !cpu_has_ic_fills_f_dc)
+		flush_cache_page(vma, vaddr, page_to_pfn(page));
+}
+
+EXPORT_SYMBOL(copy_to_user_page);
+
+void copy_from_user_page(struct vm_area_struct *vma,
+	struct page *page, unsigned long vaddr, void *dst, const void *src,
+	unsigned long len)
+{
+	if (cpu_has_dc_aliases) {
+		void *vfrom =
+			kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK);
+		memcpy(dst, vfrom, len);
+		kunmap_coherent(page);
+	} else
+		memcpy(dst, src, len);
+}
+
+EXPORT_SYMBOL(copy_from_user_page);
+
+
+#ifdef CONFIG_HIGHMEM
+pte_t *kmap_pte;
+pgprot_t kmap_prot;
+
 static void __init kmap_init(void)
 {
 	unsigned long kmap_vstart;
@@ -98,11 +296,12 @@ static void __init kmap_init(void)
 
 	kmap_prot = PAGE_KERNEL;
 }
+#endif /* CONFIG_HIGHMEM */
 
-#ifdef CONFIG_32BIT
 void __init fixrange_init(unsigned long start, unsigned long end,
 	pgd_t *pgd_base)
 {
+#if defined(CONFIG_HIGHMEM) || defined(CONFIG_MIPS_MT_SMTC)
 	pgd_t *pgd;
 	pud_t *pud;
 	pmd_t *pmd;
@@ -123,7 +322,7 @@ void __init fixrange_init(unsigned long 
 			for (; (k < PTRS_PER_PMD) && (vaddr != end); pmd++, k++) {
 				if (pmd_none(*pmd)) {
 					pte = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE);
-					set_pmd(pmd, __pmd(pte));
+					set_pmd(pmd, __pmd((unsigned long)pte));
 					if (pte != pte_offset_kernel(pmd, 0))
 						BUG();
 				}
@@ -133,9 +332,8 @@ void __init fixrange_init(unsigned long 
 		}
 		j = 0;
 	}
+#endif
 }
-#endif /* CONFIG_32BIT */
-#endif /* CONFIG_HIGHMEM */
 
 #ifndef CONFIG_NEED_MULTIPLE_NODES
 extern void pagetable_init(void);
@@ -150,6 +348,7 @@ void __init paging_init(void)
 #ifdef CONFIG_HIGHMEM
 	kmap_init();
 #endif
+	kmap_coherent_init();
 
 	max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
 	low = max_low_pfn;
diff --git a/arch/mips/mm/pgtable-32.c b/arch/mips/mm/pgtable-32.c
index 4a3c491..9977f03 100644
--- a/arch/mips/mm/pgtable-32.c
+++ b/arch/mips/mm/pgtable-32.c
@@ -32,9 +32,10 @@ void pgd_init(unsigned long page)
 
 void __init pagetable_init(void)
 {
-#ifdef CONFIG_HIGHMEM
 	unsigned long vaddr;
-	pgd_t *pgd, *pgd_base;
+	pgd_t *pgd_base;
+#ifdef CONFIG_HIGHMEM
+	pgd_t *pgd;
 	pud_t *pud;
 	pmd_t *pmd;
 	pte_t *pte;
@@ -45,7 +46,6 @@ #endif
 	pgd_init((unsigned long)swapper_pg_dir
 		 + sizeof(pgd_t) * USER_PTRS_PER_PGD);
 
-#ifdef CONFIG_HIGHMEM
 	pgd_base = swapper_pg_dir;
 
 	/*
@@ -54,6 +54,7 @@ #ifdef CONFIG_HIGHMEM
 	vaddr = __fix_to_virt(__end_of_fixed_addresses - 1) & PMD_MASK;
 	fixrange_init(vaddr, 0, pgd_base);
 
+#ifdef CONFIG_HIGHMEM
 	/*
 	 * Permanent kmaps:
 	 */
diff --git a/arch/mips/mm/pgtable-64.c b/arch/mips/mm/pgtable-64.c
index 44b5e97..8d600d3 100644
--- a/arch/mips/mm/pgtable-64.c
+++ b/arch/mips/mm/pgtable-64.c
@@ -8,6 +8,7 @@
  */
 #include <linux/init.h>
 #include <linux/mm.h>
+#include <asm/fixmap.h>
 #include <asm/pgtable.h>
 
 void pgd_init(unsigned long page)
@@ -52,7 +53,17 @@ void pmd_init(unsigned long addr, unsign
 
 void __init pagetable_init(void)
 {
+	unsigned long vaddr;
+	pgd_t *pgd_base;
+
 	/* Initialize the entire pgd.  */
 	pgd_init((unsigned long)swapper_pg_dir);
 	pmd_init((unsigned long)invalid_pmd_table, (unsigned long)invalid_pte_table);
+
+	pgd_base = swapper_pg_dir;
+	/*
+	 * Fixed mappings:
+	 */
+	vaddr = __fix_to_virt(__end_of_fixed_addresses - 1) & PMD_MASK;
+	fixrange_init(vaddr, 0, pgd_base);
 }
diff --git a/arch/mips/pci/ops-au1000.c b/arch/mips/pci/ops-au1000.c
index be14201..25e6fad 100644
--- a/arch/mips/pci/ops-au1000.c
+++ b/arch/mips/pci/ops-au1000.c
@@ -111,7 +111,7 @@ #if defined( CONFIG_SOC_AU1500 ) || defi
 	if (first_cfg) {
 		/* reserve a wired entry for pci config accesses */
 		first_cfg = 0;
-		pci_cfg_vm = get_vm_area(0x2000, 0);
+		pci_cfg_vm = get_vm_area(0x2000, VM_IOREMAP);
 		if (!pci_cfg_vm)
 			panic (KERN_ERR "PCI unable to get vm area\n");
 		pci_cfg_wired_entry = read_c0_wired();
diff --git a/include/asm-mips/cacheflush.h b/include/asm-mips/cacheflush.h
index 36416fd..d10517c 100644
--- a/include/asm-mips/cacheflush.h
+++ b/include/asm-mips/cacheflush.h
@@ -57,24 +57,13 @@ extern void (*flush_icache_range)(unsign
 #define flush_cache_vmap(start, end)		flush_cache_all()
 #define flush_cache_vunmap(start, end)		flush_cache_all()
 
-static inline void copy_to_user_page(struct vm_area_struct *vma,
+extern void copy_to_user_page(struct vm_area_struct *vma,
 	struct page *page, unsigned long vaddr, void *dst, const void *src,
-	unsigned long len)
-{
-	if (cpu_has_dc_aliases)
-		flush_cache_page(vma, vaddr, page_to_pfn(page));
-	memcpy(dst, src, len);
-	__flush_icache_page(vma, page);
-}
+	unsigned long len);
 
-static inline void copy_from_user_page(struct vm_area_struct *vma,
+extern void copy_from_user_page(struct vm_area_struct *vma,
 	struct page *page, unsigned long vaddr, void *dst, const void *src,
-	unsigned long len)
-{
-	if (cpu_has_dc_aliases)
-		flush_cache_page(vma, vaddr, page_to_pfn(page));
-	memcpy(dst, src, len);
-}
+	unsigned long len);
 
 extern void (*flush_cache_sigtramp)(unsigned long addr);
 extern void (*flush_icache_all)(void);
diff --git a/include/asm-mips/fixmap.h b/include/asm-mips/fixmap.h
index 73a3028..4878926 100644
--- a/include/asm-mips/fixmap.h
+++ b/include/asm-mips/fixmap.h
@@ -46,8 +46,16 @@ #endif
  * fix-mapped?
  */
 enum fixed_addresses {
+#define FIX_N_COLOURS 8
+	FIX_CMAP_BEGIN,
+#ifdef CONFIG_MIPS_MT_SMTC
+	FIX_CMAP_END = FIX_CMAP_BEGIN + (FIX_N_COLOURS * NR_CPUS),
+#else
+	FIX_CMAP_END = FIX_CMAP_BEGIN + FIX_N_COLOURS,
+#endif
 #ifdef CONFIG_HIGHMEM
-	FIX_KMAP_BEGIN,	/* reserved pte's for temporary kernel mappings */
+	/* reserved pte's for temporary kernel mappings */
+	FIX_KMAP_BEGIN = FIX_CMAP_END + 1,
 	FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1,
 #endif
 	__end_of_fixed_addresses
@@ -70,7 +78,7 @@ #define set_fixmap_nocache(idx, phys) \
  * the start of the fixmap, and leave one page empty
  * at the top of mem..
  */
-#define FIXADDR_TOP	(0xffffe000UL)
+#define FIXADDR_TOP    ((unsigned long)(long)(int)0xfffe0000)
 #define FIXADDR_SIZE	(__end_of_fixed_addresses << PAGE_SHIFT)
 #define FIXADDR_START	(FIXADDR_TOP - FIXADDR_SIZE)
 
diff --git a/include/asm-mips/mman.h b/include/asm-mips/mman.h
index 046cf68..e39c01b 100644
--- a/include/asm-mips/mman.h
+++ b/include/asm-mips/mman.h
@@ -75,4 +75,13 @@ #define MADV_DOFORK	11		/* do inherit ac
 #define MAP_ANON	MAP_ANONYMOUS
 #define MAP_FILE	0
 
+#ifdef __KERNEL__
+
+#define arch_mmap_check mips_mmap_check
+
+extern int mips_mmap_check(unsigned long addr, unsigned long len,
+	unsigned long flags);
+
+#endif
+
 #endif /* _ASM_MMAN_H */
diff --git a/include/asm-mips/page.h b/include/asm-mips/page.h
index c014279..152e573 100644
--- a/include/asm-mips/page.h
+++ b/include/asm-mips/page.h
@@ -39,8 +39,6 @@ #define PAGE_MASK       (~((1 << PAGE_SH
 #ifdef __KERNEL__
 #ifndef __ASSEMBLY__
 
-#include <asm/cpu-features.h>
-
 extern void clear_page(void * page);
 extern void copy_page(void * to, void * from);
 
@@ -64,16 +62,13 @@ static inline void clear_user_page(void 
 		flush_data_cache_page((unsigned long)addr);
 }
 
-static inline void copy_user_page(void *vto, void *vfrom, unsigned long vaddr,
-	struct page *to)
-{
-	extern void (*flush_data_cache_page)(unsigned long addr);
+extern void copy_user_page(void *vto, void *vfrom, unsigned long vaddr,
+	struct page *to);
+struct vm_area_struct;
+extern void copy_user_highpage(struct page *to, struct page *from,
+	unsigned long vaddr, struct vm_area_struct *vma);
 
-	copy_page(vto, vfrom);
-	if (!cpu_has_ic_fills_f_dc ||
-	    pages_do_alias((unsigned long)vto, vaddr & PAGE_MASK))
-		flush_data_cache_page((unsigned long)vto);
-}
+#define __HAVE_ARCH_COPY_USER_HIGHPAGE
 
 /*
  * These are used to make use of C type-checking..
@@ -82,15 +77,17 @@ #ifdef CONFIG_64BIT_PHYS_ADDR
   #ifdef CONFIG_CPU_MIPS32
     typedef struct { unsigned long pte_low, pte_high; } pte_t;
     #define pte_val(x)    ((x).pte_low | ((unsigned long long)(x).pte_high << 32))
+    #define __pte(x)      ({ pte_t __pte = {(x), ((unsigned long long)(x)) >> 32}; __pte; })
   #else
      typedef struct { unsigned long long pte; } pte_t;
      #define pte_val(x)	((x).pte)
+     #define __pte(x)	((pte_t) { (x) } )
   #endif
 #else
 typedef struct { unsigned long pte; } pte_t;
 #define pte_val(x)	((x).pte)
-#endif
 #define __pte(x)	((pte_t) { (x) } )
+#endif
 
 /*
  * For 3-level pagetables we defines these ourselves, for 2-level the
diff --git a/include/asm-mips/spinlock.h b/include/asm-mips/spinlock.h
index 669b8e3..4c1a1b5 100644
--- a/include/asm-mips/spinlock.h
+++ b/include/asm-mips/spinlock.h
@@ -239,7 +239,51 @@ static inline void __raw_write_unlock(ra
 	: "memory");
 }
 
-#define __raw_read_trylock(lock) generic__raw_read_trylock(lock)
+static inline int __raw_read_trylock(raw_rwlock_t *rw)
+{
+	unsigned int tmp;
+	int ret;
+
+	if (R10000_LLSC_WAR) {
+		__asm__ __volatile__(
+		"	.set	noreorder	# __raw_read_trylock	\n"
+		"	li	%2, 0					\n"
+		"1:	ll	%1, %3					\n"
+		"	bnez	%1, 2f					\n"
+		"	 addu	%1, 1					\n"
+		"	sc	%1, %0					\n"
+		"	beqzl	%1, 1b					\n"
+		"	.set	reorder					\n"
+#ifdef CONFIG_SMP
+		"	 sync						\n"
+#endif
+		"	li	%2, 1					\n"
+		"2:							\n"
+		: "=m" (rw->lock), "=&r" (tmp), "=&r" (ret)
+		: "m" (rw->lock)
+		: "memory");
+	} else {
+		__asm__ __volatile__(
+		"	.set	noreorder	# __raw_read_trylock	\n"
+		"	li	%2, 0					\n"
+		"1:	ll	%1, %3					\n"
+		"	bnez	%1, 2f					\n"
+		"	 addu	%1, 1					\n"
+		"	sc	%1, %0					\n"
+		"	beqz	%1, 1b					\n"
+		"	.set	reorder					\n"
+#ifdef CONFIG_SMP
+		"	 sync						\n"
+#endif
+		"	li	%2, 1					\n"
+		"2:							\n"
+		: "=m" (rw->lock), "=&r" (tmp), "=&r" (ret)
+		: "m" (rw->lock)
+		: "memory");
+	}
+
+	return ret;
+}
 
 static inline int __raw_write_trylock(raw_rwlock_t *rw)
 {
@@ -283,4 +327,5 @@ static inline int __raw_write_trylock(ra
 	return ret;
 }
 
+
 #endif /* _ASM_SPINLOCK_H */
diff --git a/include/asm-mips/unistd.h b/include/asm-mips/unistd.h
index 13fe6e8..2031601 100644
--- a/include/asm-mips/unistd.h
+++ b/include/asm-mips/unistd.h
@@ -327,16 +327,20 @@ #define __NR_unshare			(__NR_Linux + 303
 #define __NR_splice			(__NR_Linux + 304)
 #define __NR_sync_file_range		(__NR_Linux + 305)
 #define __NR_tee			(__NR_Linux + 306)
+#define __NR_vmsplice			(__NR_Linux + 307)
+#define __NR_move_pages			(__NR_Linux + 308)
+#define __NR_set_robust_list		(__NR_Linux + 309)
+#define __NR_get_robust_list		(__NR_Linux + 310)
 
 /*
  * Offset of the last Linux o32 flavoured syscall
  */
-#define __NR_Linux_syscalls		306
+#define __NR_Linux_syscalls		310
 
 #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
 
 #define __NR_O32_Linux			4000
-#define __NR_O32_Linux_syscalls		306
+#define __NR_O32_Linux_syscalls		310
 
 #if _MIPS_SIM == _MIPS_SIM_ABI64
 
@@ -610,16 +614,20 @@ #define __NR_unshare			(__NR_Linux + 262
 #define __NR_splice			(__NR_Linux + 263)
 #define __NR_sync_file_range		(__NR_Linux + 264)
 #define __NR_tee			(__NR_Linux + 265)
+#define __NR_vmsplice			(__NR_Linux + 266)
+#define __NR_move_pages			(__NR_Linux + 267)
+#define __NR_set_robust_list		(__NR_Linux + 268)
+#define __NR_get_robust_list		(__NR_Linux + 269)
 
 /*
  * Offset of the last Linux 64-bit flavoured syscall
  */
-#define __NR_Linux_syscalls		265
+#define __NR_Linux_syscalls		269
 
 #endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
 
 #define __NR_64_Linux			5000
-#define __NR_64_Linux_syscalls		265
+#define __NR_64_Linux_syscalls		269
 
 #if _MIPS_SIM == _MIPS_SIM_NABI32
 
@@ -897,16 +905,20 @@ #define __NR_unshare			(__NR_Linux + 266
 #define __NR_splice			(__NR_Linux + 267)
 #define __NR_sync_file_range		(__NR_Linux + 268)
 #define __NR_tee			(__NR_Linux + 269)
+#define __NR_vmsplice			(__NR_Linux + 270)
+#define __NR_move_pages			(__NR_Linux + 271)
+#define __NR_set_robust_list		(__NR_Linux + 272)
+#define __NR_get_robust_list		(__NR_Linux + 273)
 
 /*
  * Offset of the last N32 flavoured syscall
  */
-#define __NR_Linux_syscalls		269
+#define __NR_Linux_syscalls		273
 
 #endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */
 
 #define __NR_N32_Linux			6000
-#define __NR_N32_Linux_syscalls		269
+#define __NR_N32_Linux_syscalls		273
 
 #ifndef __ASSEMBLY__
 
diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index 892c4ea..26e49a1 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -90,7 +90,10 @@ static inline void memclear_highpage_flu
 	kunmap_atomic(kaddr, KM_USER0);
 }
 
-static inline void copy_user_highpage(struct page *to, struct page *from, unsigned long vaddr)
+#ifndef __HAVE_ARCH_COPY_USER_HIGHPAGE
+
+static inline void copy_user_highpage(struct page *to, struct page *from,
+	unsigned long vaddr, struct vm_area_struct *vma)
 {
 	char *vfrom, *vto;
 
@@ -103,6 +106,8 @@ static inline void copy_user_highpage(st
 	smp_wmb();
 }
 
+#endif
+
 static inline void copy_highpage(struct page *to, struct page *from)
 {
 	char *vfrom, *vto;
diff --git a/mm/memory.c b/mm/memory.c
index 0ec7bc6..3acd848 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1394,7 +1394,8 @@ static inline pte_t maybe_mkwrite(pte_t 
 	return pte;
 }
 
-static inline void cow_user_page(struct page *dst, struct page *src, unsigned long va)
+static inline void cow_user_page(struct page *dst, struct page *src,
+	unsigned long va, struct vm_area_struct *vma)
 {
 	/*
 	 * If the source page was a PFN mapping, we don't have
@@ -1418,7 +1419,7 @@ static inline void cow_user_page(struct 
 		return;
 		
 	}
-	copy_user_highpage(dst, src, va);
+	copy_user_highpage(dst, src, va, vma);
 }
 
 /*
@@ -1483,7 +1484,7 @@ gotten:
 		new_page = alloc_page_vma(GFP_HIGHUSER, vma, address);
 		if (!new_page)
 			goto oom;
-		cow_user_page(new_page, old_page, address);
+		cow_user_page(new_page, old_page, address, vma);
 	}
 
 	/*
@@ -2082,7 +2083,7 @@ retry:
 		page = alloc_page_vma(GFP_HIGHUSER, vma, address);
 		if (!page)
 			goto oom;
-		copy_user_highpage(page, new_page, address);
+		copy_user_highpage(page, new_page, address, vma);
 		page_cache_release(new_page);
 		new_page = page;
 		anon = 1;


From sam@ravnborg.org Wed Nov  1 20:44:17 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 01 Nov 2006 20:44:20 +0000 (GMT)
Received: from pasmtpb.tele.dk ([80.160.77.98]:5020 "EHLO pasmtpB.tele.dk")
	by ftp.linux-mips.org with ESMTP id S20038534AbWKAUoR (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Wed, 1 Nov 2006 20:44:17 +0000
Received: from ravnborg.org (0x535d98d8.vgnxx8.adsl-dhcp.tele.dk [83.93.152.216])
	by pasmtpB.tele.dk (Postfix) with ESMTP id D6208E30DBC;
	Wed,  1 Nov 2006 21:43:53 +0100 (CET)
Received: by ravnborg.org (Postfix, from userid 500)
	id 9EE38580D2; Wed,  1 Nov 2006 21:43:53 +0100 (CET)
Date:	Wed, 1 Nov 2006 21:43:53 +0100
From:	Sam Ravnborg <sam@ravnborg.org>
To:	Wim Van Sebroeck <wim@iguana.be>
Cc:	Thomas Koeller <thomas@koeller.dyndns.org>,
	Ralf Baechle <ralf@linux-mips.org>,
	Dave Jones <davej@redhat.com>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	"Randy. Dunlap" <rdunlap@xenotime.net>,
	Alexey Dobriyan <adobriyan@gmail.com>,
	linux-kernel@vger.kernel.org, linux-mips@linux-mips.org
Subject: Re: [PATCH] Added MIPS RM9K watchdog driver
Message-ID: <20061101204353.GA691@uranus.ravnborg.org>
References: <20061101184633.GA7056@infomag.infomag.iguana.be>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20061101184633.GA7056@infomag.infomag.iguana.be>
User-Agent: Mutt/1.4.2.1i
Return-Path: <sam@ravnborg.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13143
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: sam@ravnborg.org
Precedence: bulk
X-list: linux-mips

Hi Wim.

Not much of my area so only some nitpicking stuff.

> /*
>  *  Watchdog implementation for GPI h/w found on PMC-Sierra RM9xxx
>  *  chips.
>  *
>  *  Copyright (C) 2004 by Basler Vision Technologies AG
>  *  Author: Thomas Koeller <thomas.koeller@baslerweb.com>
>  *
>  *  This program is free software; you can redistribute it and/or modify
We have COPYING in top level directory. No need to include GPL here.

> #define CPGIG1ER               0x0054
> 
> 
> 
> /* Function prototypes */

Too many empty lines. Get it down to 2. Seen on many places.

> static int __init wdt_gpi_probe(struct device *);
> static int __exit wdt_gpi_remove(struct device *);

> static void wdt_gpi_start(void);
> static void wdt_gpi_stop(void);
> static void wdt_gpi_set_timeout(unsigned int);
3 prototpyes not needed

> static int wdt_gpi_open(struct inode *, struct file *);
> static int wdt_gpi_release(struct inode *, struct file *);
> static ssize_t wdt_gpi_write(struct file *, const char __user *, size_t, loff_t *);
> static long wdt_gpi_ioctl(struct file *, unsigned int, unsigned long);
> static const struct resource *wdt_gpi_get_resource(struct platform_device *, const char *, unsigned int);
80 char coloum
Prototype not needed.

> /* These are set from device resources */
> static void __iomem * wd_regs;
Good to see code annotated.
I assume sparse did not give any warnings on this code?

> /* Module arguments */
> static int timeout = MAX_TIMEOUT_SECONDS;
> module_param(timeout, int, 0444);
> static unsigned long resetaddr = 0xbffdc200;
> module_param(resetaddr, ulong, 0444);
> static unsigned long flagaddr = 0xbffdc104;
> module_param(flagaddr, ulong, 0444);
> static int powercycle = 0;
> module_param(powercycle, bool, 0444);
> 
> static int nowayout = WATCHDOG_NOWAYOUT;
> module_param(nowayout, bool, 0444);

Locate parameter descriptions clode to parameter definition - not in
 bottom of file.

> static struct device_driver wdt_gpi_driver = {
> 	.name		= (char *) wdt_gpi_name,
If this cast is really needed then struct device_driver ought to be updated?

> static int __init wdt_gpi_probe(struct device *dev)
> {
> 	int res;
> 	struct platform_device * const pdv = to_platform_device(dev);
> 	const struct resource
> 		* const rr = wdt_gpi_get_resource(pdv, WDT_RESOURCE_REGS,
> 						  IORESOURCE_MEM),
> 		* const ri = wdt_gpi_get_resource(pdv, WDT_RESOURCE_IRQ,
> 						  IORESOURCE_IRQ),
> 		* const rc = wdt_gpi_get_resource(pdv, WDT_RESOURCE_COUNTER,

Separate variable definition and assignment => nicer code.

> static long
> wdt_gpi_ioctl(struct file *f, unsigned int cmd, unsigned long arg)
> {

arg is a __user pointer - why hide this fact?

> 		res = __copy_to_user((void __user *)arg, &wdinfo, size) ?
> 			-EFAULT : size;
then you get rid of this cast.
And code this as if () else
Using ?: is just ugly here.

> 	case WDIOC_GETBOOTSTATUS:
> 		stat = (*(volatile char *) flagaddr & 0x01)
> 			? WDIOF_CARDRESET : 0;

Use of volatile almost always indicate a bug.
Please explain why volatile is needed and consider the other options.

> 			printk("%s: timeout set to %u seconds\n",
> 				wdt_gpi_name, timeout);

I just noticed this pringk miss a <KERNEL_DEBUG> or similar specifier.
I guess this is all of them.


> 	if (!unlikely(__raw_readl(wd_regs + 0x0008) & 0x1))
> 		return IRQ_NONE;
> 	__raw_writel(0x1, wd_regs + 0x0008);
Magics suchs as '0x0008' deserve a comment.

> 	*(volatile char *) flagaddr |= 0x01;
> 	*(volatile char *) resetaddr = powercycle ? 0x01 : 0x2;

volatile again...

> MODULE_AUTHOR("Thomas Koeller <thomas.koeller@baslerweb.com>");
> MODULE_DESCRIPTION("Basler eXcite watchdog driver for gpi devices");
> MODULE_VERSION("0.1");
> MODULE_LICENSE("GPL");
> MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
These five tags belongs in the start of the file.

> MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds");
> MODULE_PARM_DESC(resetaddr, "Address to write to to force a reset");
> MODULE_PARM_DESC(flagaddr, "Address to write to boot flags to");
> MODULE_PARM_DESC(nowayout, "Watchdog cannot be disabled once started");
> MODULE_PARM_DESC(powercycle, "Cycle power if watchdog expires");
Same here - but already noted.

	Sam


From tim.bird@am.sony.com Wed Nov  1 22:42:35 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 01 Nov 2006 22:42:41 +0000 (GMT)
Received: from mail8.fw-bc.sony.com ([160.33.98.75]:65506 "EHLO
	mail8.fw-bc.sony.com") by ftp.linux-mips.org with ESMTP
	id S20038932AbWKAWmf (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 1 Nov 2006 22:42:35 +0000
Received: from mail3.sjc.in.sel.sony.com (mail3.sjc.in.sel.sony.com [43.134.1.211])
	by mail8.fw-bc.sony.com (8.12.11/8.12.11) with ESMTP id kA1MgNlP014361;
	Wed, 1 Nov 2006 22:42:23 GMT
Received: from [43.134.85.135] ([43.134.85.135])
	by mail3.sjc.in.sel.sony.com (8.12.11/8.12.11) with ESMTP id kA1MgMDL013205;
	Wed, 1 Nov 2006 22:42:22 GMT
Message-ID: <45492407.7090606@am.sony.com>
Date:	Wed, 01 Nov 2006 14:47:35 -0800
From:	Tim Bird <tim.bird@am.sony.com>
User-Agent: Thunderbird 1.5.0.4 (X11/20060614)
MIME-Version: 1.0
To:	CE Linux Developers List <celinux-dev@tree.celinuxforum.org>,
	linux-mips@linux-mips.org
Subject: MIPS processors gain GNU/Linux binary prelinker
X-Enigmail-Version: 0.94.0.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Return-Path: <tim.bird@am.sony.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13144
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: tim.bird@am.sony.com
Precedence: bulk
X-list: linux-mips

FYI - For those interested in bootup time improvements on MIPS
processors, here is some information about the recently
developed MIPS prelinking feature, done by CodeSourcery
and MIPS Technologies.

http://www.linuxdevices.com/news/NS6220941326.html

This press release does not mention CELF, but it should
be noted that the first public demonstration of this
technology was performed (I believe) at the recent CELF technical
jamboree, in Tokyo Japan, held just last Friday (Oct 27).

See http://tree.celinuxforum.org/CelfPubWiki/JapanTechnicalJamboree11
for information about the jamboree.  The presentation about
this technology which was delivered at the meeting is at:

http://tree.celinuxforum.org/CelfPubWiki/JapanTechnicalJamboree11?action=AttachFile&do=get&target=MIPS-Prelinker.pdf

MIPS and CodeSourcery brought a demo so we got to do
some actual speed comparisons live at the event.  It was fun!

Regards,
 -- Tim

=============================
Tim Bird
Architecture Group Chair, CE Linux Forum
Senior Staff Engineer, Sony Electronics
=============================

From anemo@mba.ocn.ne.jp Thu Nov  2 02:19:35 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 02 Nov 2006 02:19:37 +0000 (GMT)
Received: from topsns2.toshiba-tops.co.jp ([202.230.225.126]:2627 "EHLO
	topsns2.toshiba-tops.co.jp") by ftp.linux-mips.org with ESMTP
	id S20039076AbWKBCTf (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Thu, 2 Nov 2006 02:19:35 +0000
Received: from topsms.toshiba-tops.co.jp by topsns2.toshiba-tops.co.jp
          via smtpd (for ftp.linux-mips.org [194.74.144.162]) with ESMTP; Thu, 2 Nov 2006 11:19:34 +0900
Received: from topsms.toshiba-tops.co.jp (localhost.localdomain [127.0.0.1])
	by localhost.toshiba-tops.co.jp (Postfix) with ESMTP id 627D141C67;
	Thu,  2 Nov 2006 11:19:27 +0900 (JST)
Received: from srd2sd.toshiba-tops.co.jp (srd2sd.toshiba-tops.co.jp [172.17.28.2])
	by topsms.toshiba-tops.co.jp (Postfix) with ESMTP id 554D5417CA;
	Thu,  2 Nov 2006 11:19:27 +0900 (JST)
Received: from localhost (fragile [172.17.28.65])
	by srd2sd.toshiba-tops.co.jp (8.12.10/8.12.10) with ESMTP id kA22JQW0029257;
	Thu, 2 Nov 2006 11:19:26 +0900 (JST)
	(envelope-from anemo@mba.ocn.ne.jp)
Date:	Thu, 02 Nov 2006 11:19:26 +0900 (JST)
Message-Id: <20061102.111926.25910639.nemoto@toshiba-tops.co.jp>
To:	Trevor_Hamm@pmc-sierra.com
Cc:	linux-mips@linux-mips.org
Subject: Re: Problems booting Linux 2.6.18.1 on MIPS34K core
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
In-Reply-To: <E8C8A5231DDE104C816ADF532E0639120194F4B2@bby1exm07.pmc_nt.nt.pmc-sierra.bc.ca>
References: <E8C8A5231DDE104C816ADF532E0639120194F4B2@bby1exm07.pmc_nt.nt.pmc-sierra.bc.ca>
X-Fingerprint: 6ACA 1623 39BD 9A94 9B1A  B746 CA77 FE94 2874 D52F
X-Pgp-Public-Key: http://wwwkeys.pgp.net/pks/lookup?op=get&search=0x2874D52F
X-Mailer: Mew version 3.3 on Emacs 21.3 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Return-Path: <anemo@mba.ocn.ne.jp>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13145
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: anemo@mba.ocn.ne.jp
Precedence: bulk
X-list: linux-mips

On Wed, 1 Nov 2006 12:06:15 -0800 , Trevor Hamm <Trevor_Hamm@pmc-sierra.com> wrote:
> My investigation shows this behaviour was introduced between
> 2.6.17.10 and 2.6.17.12 (2.6.17.11 failed to build, so I didn't test
> that version).  In fact, the patch below, applied against 2.6.17.10,
> is sufficient to cause the boot problem.  The bulk of this patch
> includes a fix from Aug. 31, 2006 for dcache aliasing on fork.  If I
> exclude the dcache aliasing fix from this patch, the boot problem
> apparently disappears.
> 
> Some more interesting details:
> - We're using a squashfs root filesystem in RAM (squashfs 3.1-r2).
>   We have not been able to reproduce with cramfs.

If dcache aliasing patch caused this problem, it might be due to
missing flush_dcache_page() in squashfs.

With a quick look at squashfs/inode.c, it seems flush_dcache_page() is
needed at end of squashfs_symlink_readpage() as other functions.
Could you try it?

skip_read:
	memset(pageaddr + bytes, 0, PAGE_CACHE_SIZE - bytes);
	kunmap(page);
	flush_dcache_page(page);	/* THIS */
	SetPageUptodate(page);
	unlock_page(page);

---
Atsushi Nemoto

From anemo@mba.ocn.ne.jp Thu Nov  2 02:51:56 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 02 Nov 2006 02:51:58 +0000 (GMT)
Received: from topsns2.toshiba-tops.co.jp ([202.230.225.126]:48575 "EHLO
	topsns2.toshiba-tops.co.jp") by ftp.linux-mips.org with ESMTP
	id S20039081AbWKBCv4 (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Thu, 2 Nov 2006 02:51:56 +0000
Received: from topsms.toshiba-tops.co.jp by topsns2.toshiba-tops.co.jp
          via smtpd (for ftp.linux-mips.org [194.74.144.162]) with ESMTP; Thu, 2 Nov 2006 11:51:55 +0900
Received: from topsms.toshiba-tops.co.jp (localhost.localdomain [127.0.0.1])
	by localhost.toshiba-tops.co.jp (Postfix) with ESMTP id B4B5441A10;
	Thu,  2 Nov 2006 11:51:53 +0900 (JST)
Received: from srd2sd.toshiba-tops.co.jp (srd2sd.toshiba-tops.co.jp [172.17.28.2])
	by topsms.toshiba-tops.co.jp (Postfix) with ESMTP id A9782204D2;
	Thu,  2 Nov 2006 11:51:53 +0900 (JST)
Received: from localhost (fragile [172.17.28.65])
	by srd2sd.toshiba-tops.co.jp (8.12.10/8.12.10) with ESMTP id kA22prW0029341;
	Thu, 2 Nov 2006 11:51:53 +0900 (JST)
	(envelope-from anemo@mba.ocn.ne.jp)
Date:	Thu, 02 Nov 2006 11:51:53 +0900 (JST)
Message-Id: <20061102.115153.25475422.nemoto@toshiba-tops.co.jp>
To:	ralf@linux-mips.org
Cc:	linux-mips@linux-mips.org
Subject: Re: [PATCH] mips irq cleanups
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
In-Reply-To: <20061101184755.GC4736@linux-mips.org>
References: <20061102.020836.25912635.anemo@mba.ocn.ne.jp>
	<20061101184755.GC4736@linux-mips.org>
X-Fingerprint: 6ACA 1623 39BD 9A94 9B1A  B746 CA77 FE94 2874 D52F
X-Pgp-Public-Key: http://wwwkeys.pgp.net/pks/lookup?op=get&search=0x2874D52F
X-Mailer: Mew version 3.3 on Emacs 21.3 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Return-Path: <anemo@mba.ocn.ne.jp>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13146
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: anemo@mba.ocn.ne.jp
Precedence: bulk
X-list: linux-mips

On Wed, 1 Nov 2006 18:47:55 +0000, Ralf Baechle <ralf@linux-mips.org> wrote:
> >  37 files changed, 289 insertions(+), 1647 deletions(-)
> 
> Very nice.  I gave it a shot on a Malta and it works just fine.

Thanks!  For most level type irq chips (which initialize .ack, .mask
and .mask_ack rountine with same function), it should be easy to
migrate to new irq flow handler:

1. replace set_irq_chip() with set_irq_chip_and_handler(..., handle_level_irq)
2. use generic_handle_irq() instead of __do_IRQ()

I'm still not sure for per-cpu type irq chips and egdg type irq chips,
especially i8259.  The i8259 seems not suitable for handle_edge_irq or
handle_level_irq yet.  The irq handling on SMP seems another maze ...

---
Atsushi Nemoto

From rdunlap@xenotime.net Thu Nov  2 06:15:43 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 02 Nov 2006 06:15:45 +0000 (GMT)
Received: from xenotime.net ([66.160.160.81]:51121 "HELO xenotime.net")
	by ftp.linux-mips.org with SMTP id S20038467AbWKBGPn (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Thu, 2 Nov 2006 06:15:43 +0000
Received: from midway.site ([71.117.236.95]) by xenotime.net for <linux-mips@linux-mips.org>; Wed, 1 Nov 2006 22:15:38 -0800
Date:	Wed, 1 Nov 2006 22:11:25 -0800
From:	Randy Dunlap <rdunlap@xenotime.net>
To:	Wim Van Sebroeck <wim@iguana.be>
Cc:	Thomas Koeller <thomas@koeller.dyndns.org>,
	Ralf Baechle <ralf@linux-mips.org>,
	Dave Jones <davej@redhat.com>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Sam Ravnborg <sam@ravnborg.org>,
	Alexey Dobriyan <adobriyan@gmail.com>,
	linux-kernel@vger.kernel.org, linux-mips@linux-mips.org
Subject: Re: [PATCH] Added MIPS RM9K watchdog driver
Message-Id: <20061101221125.73505baa.rdunlap@xenotime.net>
In-Reply-To: <20061101184633.GA7056@infomag.infomag.iguana.be>
References: <20061101184633.GA7056@infomag.infomag.iguana.be>
Organization: YPO4
X-Mailer: Sylpheed version 2.2.9 (GTK+ 2.8.10; x86_64-unknown-linux-gnu)
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Return-Path: <rdunlap@xenotime.net>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13147
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: rdunlap@xenotime.net
Precedence: bulk
X-list: linux-mips

On Wed, 1 Nov 2006 19:46:33 +0100 Wim Van Sebroeck wrote:

> /* Function prototypes */
> static int __init wdt_gpi_probe(struct device *);
> static int __exit wdt_gpi_remove(struct device *);
> static void wdt_gpi_start(void);
> static void wdt_gpi_stop(void);
> static void wdt_gpi_set_timeout(unsigned int);
> static int wdt_gpi_open(struct inode *, struct file *);
> static int wdt_gpi_release(struct inode *, struct file *);
> static ssize_t wdt_gpi_write(struct file *, const char __user *, size_t, loff_t *);
> static long wdt_gpi_ioctl(struct file *, unsigned int, unsigned long);
> static const struct resource *wdt_gpi_get_resource(struct platform_device *, const char *, unsigned int);

Some lines too long (stay <= 80 columns).

> static int wdt_gpi_notify(struct notifier_block *, unsigned long, void *);
> static irqreturn_t wdt_gpi_irqhdl(int, void *, struct pt_regs *);
> 
> 
> 
> 
> static const char wdt_gpi_name[] = "wdt_gpi";
> static atomic_t opencnt;
> static int expect_close;
> static int locked = 0;

Don't need to init to 0.

> /* Module arguments */
> static int timeout = MAX_TIMEOUT_SECONDS;
> module_param(timeout, int, 0444);
> static unsigned long resetaddr = 0xbffdc200;
> module_param(resetaddr, ulong, 0444);
> static unsigned long flagaddr = 0xbffdc104;
> module_param(flagaddr, ulong, 0444);
> static int powercycle = 0;

no need to init to 0.

> module_param(powercycle, bool, 0444);
> 
> static int nowayout = WATCHDOG_NOWAYOUT;
> module_param(nowayout, bool, 0444);
> 
> 
> 
> /* No hotplugging on the platform bus - use __init */
> static int __init wdt_gpi_probe(struct device *dev)
> {
> 	int res;
> 	struct platform_device * const pdv = to_platform_device(dev);
> 	const struct resource
> 		* const rr = wdt_gpi_get_resource(pdv, WDT_RESOURCE_REGS,
> 						  IORESOURCE_MEM),
> 		* const ri = wdt_gpi_get_resource(pdv, WDT_RESOURCE_IRQ,
> 						  IORESOURCE_IRQ),
> 		* const rc = wdt_gpi_get_resource(pdv, WDT_RESOURCE_COUNTER,
> 						  0);
> 
> 	if (unlikely(!rr || !ri || !rc))
> 		return -ENXIO;
> 
> 	wd_regs = ioremap_nocache(rr->start, rr->end + 1 - rr->start);
> 	if (unlikely(!wd_regs))
> 		return -ENOMEM;

There's no way to return the resources on failure?

> 	wd_irq = ri->start;
> 	wd_ctr = rc->start;
> 	res = misc_register(&miscdev);
> 	if (res)
> 		iounmap(wd_regs);
> 	else
> 		register_reboot_notifier(&wdt_gpi_shutdown);
> 	return res;
> }
> 
> 
> 
> static int wdt_gpi_open(struct inode *inode, struct file *file)
> {
> 	int res;
> 
> 	if (unlikely(0 > atomic_dec_if_positive(&opencnt)))

Style: Instead of
		if (constant op function_or_variable)
we prefer
		if (function_or_variable op constant)


> 		return -EBUSY;
> 
> 	expect_close = 0;
> 	if (locked) {
> 		module_put(THIS_MODULE);
> 		free_irq(wd_irq, &miscdev);
> 		locked = 0;
> 	}
> 
> 	res = request_irq(wd_irq, wdt_gpi_irqhdl, SA_SHIRQ | SA_INTERRUPT,
> 			  wdt_gpi_name, &miscdev);
> 	if (unlikely(res))
> 		return res;
> 
> 	wdt_gpi_set_timeout(timeout);
> 	wdt_gpi_start();
> 
> 	printk(KERN_INFO "%s: watchdog started, timeout = %u seconds\n",
> 		wdt_gpi_name, timeout);
> 	return nonseekable_open(inode, file);
> }
> 
> 
> 
> 
> static long
> wdt_gpi_ioctl(struct file *f, unsigned int cmd, unsigned long arg)
> {
> 	long res = -ENOTTY;
> 	const long size = _IOC_SIZE(cmd);
> 	int stat;
> 	static struct watchdog_info wdinfo = {
> 		.identity               = "RM9xxx/GPI watchdog",
> 		.firmware_version       = 0,
> 		.options                = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING
> 	};
> 
> 	if (unlikely(_IOC_TYPE(cmd) != WATCHDOG_IOCTL_BASE))
> 		return -ENOTTY;
> 
> 	if ((_IOC_DIR(cmd) & _IOC_READ)
> 	    && !access_ok(VERIFY_WRITE, arg, size))
> 		return -EFAULT;
> 
> 	if ((_IOC_DIR(cmd) & _IOC_WRITE)
> 	    && !access_ok(VERIFY_READ, arg, size))
> 		return -EFAULT;
> 
> 	expect_close = 0;
> 
> 	switch (cmd) {
> 	case WDIOC_GETSUPPORT:
> 		wdinfo.options = nowayout ?
> 			WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING :
> 			WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE;
> 		res = __copy_to_user((void __user *)arg, &wdinfo, size) ?
> 			-EFAULT : size;
> 		break;
> 
> 	case WDIOC_GETSTATUS:
> 		break;
> 
> 	case WDIOC_GETBOOTSTATUS:
> 		stat = (*(volatile char *) flagaddr & 0x01)
> 			? WDIOF_CARDRESET : 0;
> 		res = __copy_to_user((void __user *)arg, &stat, size) ?
> 			-EFAULT : size;
> 		break;
> 
> 	case WDIOC_SETOPTIONS:
> 		break;
> 
> 	case WDIOC_KEEPALIVE:
> 		wdt_gpi_set_timeout(timeout);
> 		res = size;
> 		break;
> 
> 	case WDIOC_SETTIMEOUT:
> 		{
> 			int val;
> 			if (unlikely(__copy_from_user(&val, (const void __user *) arg,
> 					size))) {
> 				res = -EFAULT;
> 				break;
> 			}
> 
> 			if (val > 32)
> 				val = 32;

There's a #defined constant for that "32".
Please use it.

> 			timeout = val;
> 			wdt_gpi_set_timeout(val);
> 			res = size;
> 			printk("%s: timeout set to %u seconds\n",
> 				wdt_gpi_name, timeout);
> 		}
> 		break;
> 
> 	case WDIOC_GETTIMEOUT:
> 		res = __copy_to_user((void __user *) arg, &timeout, size) ?
> 			-EFAULT : size;
> 		break;
> 	}
> 
> 	return res;
> }
> 
> 
> 
> 
> static irqreturn_t wdt_gpi_irqhdl(int irq, void *ctxt, struct pt_regs *regs)
> {
> 	if (!unlikely(__raw_readl(wd_regs + 0x0008) & 0x1))
> 		return IRQ_NONE;
> 	__raw_writel(0x1, wd_regs + 0x0008);
> 
> 
> 	printk(KERN_WARNING "%s: watchdog expired - resetting system\n",
> 		wdt_gpi_name);

I would expect a KERN_ALERT or KERN_EMERG or KERN_CRIT there...

> 
> 	*(volatile char *) flagaddr |= 0x01;
> 	*(volatile char *) resetaddr = powercycle ? 0x01 : 0x2;
> 	iob();
> 	while (1)
> 		cpu_relax();
> }
> 
> 
> 
> static int
> wdt_gpi_notify(struct notifier_block *this, unsigned long code, void *unused)
> {
> 	if(code == SYS_DOWN || code == SYS_HALT) {

Space between if and (.

> 		wdt_gpi_stop();
> 	}

No braces around one-statement blocks.

> 	return NOTIFY_DONE;
> }

---
~Randy

From aurelien@aurel32.net Thu Nov  2 07:41:06 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 02 Nov 2006 07:41:09 +0000 (GMT)
Received: from farad.aurel32.net ([82.232.2.251]:28350 "EHLO farad.aurel32.net")
	by ftp.linux-mips.org with ESMTP id S20038467AbWKBHlG (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Thu, 2 Nov 2006 07:41:06 +0000
Received: from [2001:618:400:fc13:2d0:59ff:fe4a:19a9] (helo=henry.aurel32.net)
	by farad.aurel32.net with esmtpsa (TLS-1.0:RSA_AES_256_CBC_SHA:32)
	(Exim 4.50)
	id 1GfXC5-0007VK-Pi; Thu, 02 Nov 2006 08:40:57 +0100
Received: from aurel32 by henry.aurel32.net with local (Exim 4.63)
	(envelope-from <aurelien@aurel32.net>)
	id 1Gf08b-0005Vo-MY; Tue, 31 Oct 2006 21:23:09 +0100
Date:	Tue, 31 Oct 2006 21:23:09 +0100
From:	Aurelien Jarno <aurelien@aurel32.net>
To:	qemu-devel@nongnu.org
Cc:	linux-mips@linux-mips.org
Subject: [PATCH] QEMU: improvement of the initrd support for mips(el)
Message-ID: <20061031202309.GA16619@henry.aurel32.net>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="a8Wt8u1KmwUX3Y2C"
Content-Disposition: inline
X-Mailer: Mutt 1.5.13 (2006-08-11)
User-Agent: Mutt/1.5.13 (2006-08-11)
Return-Path: <aurelien@aurel32.net>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13148
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: aurelien@aurel32.net
Precedence: bulk
X-list: linux-mips


--a8Wt8u1KmwUX3Y2C
Content-Type: text/plain; charset=iso-8859-15
Content-Disposition: inline

Hi,

The attached patch improves the initrd support of the mips(el) platform
by passing the initrd size and location via the kernel command line. This
removes the need to pass them manually.

Thanks,
Aurelien

-- 
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian GNU/Linux developer | Electrical Engineer
 `. `'   aurel32@debian.org         | aurelien@aurel32.net
   `-    people.debian.org/~aurel32 | www.aurel32.net

--a8Wt8u1KmwUX3Y2C
Content-Type: text/plain; charset=iso-8859-15
Content-Disposition: attachment; filename="mips-qemu-initrd.patch"

--- hw/mips_r4k.c.orig	2006-10-30 23:28:58.000000000 +0100
+++ hw/mips_r4k.c	2006-10-31 14:59:33.000000000 +0100
@@ -121,7 +121,7 @@
     unsigned long bios_offset;
     int ret;
     CPUState *env;
-    long kernel_size;
+    long kernel_size, initrd_size;
     int i;
 
     env = cpu_init();
@@ -163,10 +163,11 @@
 	}
 
         /* load initrd */
+        initrd_size = 0;
         if (initrd_filename) {
-            if (load_image(initrd_filename,
-			   phys_ram_base + INITRD_LOAD_ADDR + VIRT_TO_PHYS_ADDEND)
-		== (target_ulong) -1) {
+            initrd_size = load_image(initrd_filename,
+                                     phys_ram_base + INITRD_LOAD_ADDR + VIRT_TO_PHYS_ADDEND);
+            if (initrd_size == (target_ulong) -1) {
                 fprintf(stderr, "qemu: could not load initial ram disk '%s'\n", 
                         initrd_filename);
                 exit(1);
@@ -174,7 +175,17 @@
         }
 
 	/* Store command line.  */
-        strcpy (phys_ram_base + (16 << 20) - 256, kernel_cmdline);
+        if (initrd_size > 0) {
+            ret = sprintf(phys_ram_base + (16 << 20) - 256, 
+                          "rd_start=0x%08x rd_size=%li ",
+                          INITRD_LOAD_ADDR,
+                          initrd_size);
+            strcpy (phys_ram_base + (16 << 20) - 256 + ret, kernel_cmdline);
+	}
+	else {
+            strcpy (phys_ram_base + (16 << 20) - 256, kernel_cmdline);
+	}
+
         /* FIXME: little endian support */
         *(int *)(phys_ram_base + (16 << 20) - 260) = tswap32 (0x12345678);
         *(int *)(phys_ram_base + (16 << 20) - 264) = tswap32 (ram_size);

--a8Wt8u1KmwUX3Y2C--

From yoichi_yuasa@tripeaks.co.jp Thu Nov  2 08:38:45 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 02 Nov 2006 08:38:47 +0000 (GMT)
Received: from mo32.po.2iij.net ([210.128.50.17]:1577 "EHLO mo32.po.2iij.net")
	by ftp.linux-mips.org with ESMTP id S20038812AbWKBIip (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Thu, 2 Nov 2006 08:38:45 +0000
Received: by mo.po.2iij.net (mo32) id kA28cggn034290; Thu, 2 Nov 2006 17:38:42 +0900 (JST)
Received: from localhost.localdomain (65.126.232.202.bf.2iij.net [202.232.126.65])
	by mbox.po.2iij.net (mbox31) id kA28cfOx049462
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT);
	Thu, 2 Nov 2006 17:38:41 +0900 (JST)
Date:	Thu, 2 Nov 2006 17:38:41 +0900
From:	Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
To:	anemo@mba.ocn.ne.jp
Cc:	yoichi_yuasa@tripeaks.co.jp, linux-mips@linux-mips.org,
	Ralf Baechle <ralf@linux-mips.org>
Subject: Re: [PATCH] mips irq cleanups
Message-Id: <20061102173841.7af31765.yoichi_yuasa@tripeaks.co.jp>
In-Reply-To: <20061101184755.GC4736@linux-mips.org>
References: <20061102.020836.25912635.anemo@mba.ocn.ne.jp>
	<20061101184755.GC4736@linux-mips.org>
Organization: TriPeaks Corporation
X-Mailer: Sylpheed version 1.0.4 (GTK+ 1.2.10; i386-pc-linux-gnu)
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Return-Path: <yoichi_yuasa@tripeaks.co.jp>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13149
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: yoichi_yuasa@tripeaks.co.jp
Precedence: bulk
X-list: linux-mips

On Wed, 1 Nov 2006 18:47:55 +0000
Ralf Baechle <ralf@linux-mips.org> wrote:

> On Thu, Nov 02, 2006 at 02:08:36AM +0900, Atsushi Nemoto wrote:
> 
> > This is a big irq cleanup patch.
> 
> >  37 files changed, 289 insertions(+), 1647 deletions(-)
> 
> Very nice.  I gave it a shot on a Malta and it works just fine.

It works fine on vr41xx and cobalt too.
Cobalt is using i8259.

Thanks for your work,

Yoichi


From macro@linux-mips.org Thu Nov  2 11:39:16 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 02 Nov 2006 11:39:23 +0000 (GMT)
Received: from pollux.ds.pg.gda.pl ([153.19.208.7]:59399 "EHLO
	pollux.ds.pg.gda.pl") by ftp.linux-mips.org with ESMTP
	id S20039014AbWKBLjQ (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Thu, 2 Nov 2006 11:39:16 +0000
Received: from localhost (localhost [127.0.0.1])
	by pollux.ds.pg.gda.pl (Postfix) with ESMTP id 81349F5945;
	Thu,  2 Nov 2006 12:39:08 +0100 (CET)
X-Virus-Scanned: by amavisd-new at pollux.ds.pg.gda.pl
Received: from pollux.ds.pg.gda.pl ([127.0.0.1])
	by localhost (pollux.ds.pg.gda.pl [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id Q3AMumYVMIbW; Thu,  2 Nov 2006 12:39:08 +0100 (CET)
Received: from piorun.ds.pg.gda.pl (piorun.ds.pg.gda.pl [153.19.208.8])
	by pollux.ds.pg.gda.pl (Postfix) with ESMTP id 34513E1C73;
	Thu,  2 Nov 2006 12:39:08 +0100 (CET)
Received: from blysk.ds.pg.gda.pl (macro@blysk.ds.pg.gda.pl [153.19.208.6])
	by piorun.ds.pg.gda.pl (8.13.8/8.13.1) with ESMTP id kA2BdF6P012855;
	Thu, 2 Nov 2006 12:39:15 +0100
Date:	Thu, 2 Nov 2006 11:39:12 +0000 (GMT)
From:	"Maciej W. Rozycki" <macro@linux-mips.org>
To:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
cc:	linux-mips@linux-mips.org
Subject: Re: [PATCH] mips irq cleanups
In-Reply-To: <20061102.020836.25912635.anemo@mba.ocn.ne.jp>
Message-ID: <Pine.LNX.4.64N.0611021134030.7700@blysk.ds.pg.gda.pl>
References: <20061102.020836.25912635.anemo@mba.ocn.ne.jp>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Virus-Scanned: ClamAV 0.88.5/2146/Thu Nov  2 07:58:29 2006 on piorun.ds.pg.gda.pl
X-Virus-Status:	Clean
Return-Path: <macro@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13150
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: macro@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Thu, 2 Nov 2006, Atsushi Nemoto wrote:

> Though whole this patch is quite large, changes in each irq_chip are
> not quite simple.  Please review and test on your platform.  Thanks.

 You have removed a couple of spinlocks protecting accesses to some 
resources on the DECstation.  This makes me suspicious -- after all I put 
all of them there for a reason, e.g. to make sure shadow variables are 
consistent with write-only registers.  But perhaps you had a valid reason 
to believe with your changes in place they are no needed anymore.  I'll 
have a closer look as soon as possible and will let you know if the 
changes are fine.  Thanks for your work.

 But for now it's a NAK for the DECstation part.

  Maciej

From anemo@mba.ocn.ne.jp Thu Nov  2 13:36:09 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 02 Nov 2006 13:36:18 +0000 (GMT)
Received: from mba.ocn.ne.jp ([210.190.142.172]:20956 "HELO smtp.mba.ocn.ne.jp")
	by ftp.linux-mips.org with SMTP id S20039216AbWKBNgJ (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Thu, 2 Nov 2006 13:36:09 +0000
Received: from localhost (p8101-ipad207funabasi.chiba.ocn.ne.jp [222.145.90.101])
	by smtp.mba.ocn.ne.jp (Postfix) with ESMTP
	id 6B9D2AE6B; Thu,  2 Nov 2006 22:36:05 +0900 (JST)
Date:	Thu, 02 Nov 2006 22:38:36 +0900 (JST)
Message-Id: <20061102.223836.59465708.anemo@mba.ocn.ne.jp>
To:	macro@linux-mips.org
Cc:	linux-mips@linux-mips.org
Subject: Re: [PATCH] mips irq cleanups
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
In-Reply-To: <Pine.LNX.4.64N.0611021134030.7700@blysk.ds.pg.gda.pl>
References: <20061102.020836.25912635.anemo@mba.ocn.ne.jp>
	<Pine.LNX.4.64N.0611021134030.7700@blysk.ds.pg.gda.pl>
X-Fingerprint: 6ACA 1623 39BD 9A94 9B1A  B746 CA77 FE94 2874 D52F
X-Pgp-Public-Key: http://wwwkeys.pgp.net/pks/lookup?op=get&search=0x2874D52F
X-Mailer: Mew version 3.3 on Emacs 21.4 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Return-Path: <anemo@mba.ocn.ne.jp>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13151
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: anemo@mba.ocn.ne.jp
Precedence: bulk
X-list: linux-mips

On Thu, 2 Nov 2006 11:39:12 +0000 (GMT), "Maciej W. Rozycki" <macro@linux-mips.org> wrote:
>  You have removed a couple of spinlocks protecting accesses to some 
> resources on the DECstation.  This makes me suspicious -- after all I put 
> all of them there for a reason, e.g. to make sure shadow variables are 
> consistent with write-only registers.  But perhaps you had a valid reason 
> to believe with your changes in place they are no needed anymore.  I'll 
> have a closer look as soon as possible and will let you know if the 
> changes are fine.  Thanks for your work.
> 
>  But for now it's a NAK for the DECstation part.

Thanks you your review.

Yes, I removed ioasic_lock and kn02_lock.  These were used in:

dec_kn02_be_init
enable_ioasic_irq
disable_ioasic_irq
ack_ioasic_irq
enable_kn02_irq
disable_kn02_irq
ack_kn02_irq
init_kn02_irqs

IIUC All of these are called interrupt disabled.  These callers are in
lowlevel interrupt context, or having irq_desc lock with
spin_lock_irqsave, or in early stage of bootstrap.  And DECstation is
not SMP system, so no further protection would be needed.

---
Atsushi Nemoto

From anemo@mba.ocn.ne.jp Thu Nov  2 13:36:47 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 02 Nov 2006 13:36:54 +0000 (GMT)
Received: from mba.ocn.ne.jp ([210.190.142.172]:59882 "HELO smtp.mba.ocn.ne.jp")
	by ftp.linux-mips.org with SMTP id S20039158AbWKBNgr (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Thu, 2 Nov 2006 13:36:47 +0000
Received: from localhost (p8101-ipad207funabasi.chiba.ocn.ne.jp [222.145.90.101])
	by smtp.mba.ocn.ne.jp (Postfix) with ESMTP
	id CB22BA296; Thu,  2 Nov 2006 22:36:42 +0900 (JST)
Date:	Thu, 02 Nov 2006 22:39:14 +0900 (JST)
Message-Id: <20061102.223914.25476860.anemo@mba.ocn.ne.jp>
To:	yoichi_yuasa@tripeaks.co.jp
Cc:	linux-mips@linux-mips.org, ralf@linux-mips.org
Subject: Re: [PATCH] mips irq cleanups
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
In-Reply-To: <20061102173841.7af31765.yoichi_yuasa@tripeaks.co.jp>
References: <20061102.020836.25912635.anemo@mba.ocn.ne.jp>
	<20061101184755.GC4736@linux-mips.org>
	<20061102173841.7af31765.yoichi_yuasa@tripeaks.co.jp>
X-Fingerprint: 6ACA 1623 39BD 9A94 9B1A  B746 CA77 FE94 2874 D52F
X-Pgp-Public-Key: http://wwwkeys.pgp.net/pks/lookup?op=get&search=0x2874D52F
X-Mailer: Mew version 3.3 on Emacs 21.4 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Return-Path: <anemo@mba.ocn.ne.jp>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13152
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: anemo@mba.ocn.ne.jp
Precedence: bulk
X-list: linux-mips

On Thu, 2 Nov 2006 17:38:41 +0900, Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp> wrote:
> It works fine on vr41xx and cobalt too.
> Cobalt is using i8259.

Good news! Thanks.
---
Atsushi Nemoto

From ralf@linux-mips.org Thu Nov  2 13:44:11 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 02 Nov 2006 13:44:13 +0000 (GMT)
Received: from localhost.localdomain ([127.0.0.1]:45494 "EHLO
	dl5rb.ham-radio-op.net") by ftp.linux-mips.org with ESMTP
	id S20039228AbWKBNoL (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Thu, 2 Nov 2006 13:44:11 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by dl5rb.ham-radio-op.net (8.13.8/8.13.8) with ESMTP id kA2DibVF017990;
	Thu, 2 Nov 2006 13:44:37 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.8/8.13.8/Submit) id kA2DiaiG017989;
	Thu, 2 Nov 2006 13:44:36 GMT
Date:	Thu, 2 Nov 2006 13:44:36 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc:	linux-mips@linux-mips.org
Subject: Re: [PATCH] mips irq cleanups
Message-ID: <20061102134436.GD16883@linux-mips.org>
References: <20061102.020836.25912635.anemo@mba.ocn.ne.jp> <20061101184755.GC4736@linux-mips.org> <20061102.115153.25475422.nemoto@toshiba-tops.co.jp>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20061102.115153.25475422.nemoto@toshiba-tops.co.jp>
User-Agent: Mutt/1.4.2.2i
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13153
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: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Thu, Nov 02, 2006 at 11:51:53AM +0900, Atsushi Nemoto wrote:

> 1. replace set_irq_chip() with set_irq_chip_and_handler(..., handle_level_irq)
> 2. use generic_handle_irq() instead of __do_IRQ()

Another beneft of the new generic interrupt code will be for weird
multiplex devices like IOC3 which basically want to be treated as if they
have an interrupt controller on the PCI card itself.  The latest code now
enables the IOC3 metadriver to support that in a portable way.  The only
thing that's still missing is a portable way to allocate an interrupt
number.

> I'm still not sure for per-cpu type irq chips and egdg type irq chips,
> especially i8259.  The i8259 seems not suitable for handle_edge_irq or
> handle_level_irq yet.  The irq handling on SMP seems another maze ...

One step after another.

  Ralf

From ralf@linux-mips.org Thu Nov  2 14:04:28 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 02 Nov 2006 14:04:29 +0000 (GMT)
Received: from localhost.localdomain ([127.0.0.1]:18669 "EHLO
	dl5rb.ham-radio-op.net") by ftp.linux-mips.org with ESMTP
	id S20039228AbWKBOE2 (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Thu, 2 Nov 2006 14:04:28 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by dl5rb.ham-radio-op.net (8.13.8/8.13.8) with ESMTP id kA2E4rDe018478;
	Thu, 2 Nov 2006 14:04:53 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.8/8.13.8/Submit) id kA2E4prK018477;
	Thu, 2 Nov 2006 14:04:51 GMT
Date:	Thu, 2 Nov 2006 14:04:51 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	Randy Dunlap <rdunlap@xenotime.net>
Cc:	Wim Van Sebroeck <wim@iguana.be>,
	Thomas Koeller <thomas@koeller.dyndns.org>,
	Dave Jones <davej@redhat.com>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Sam Ravnborg <sam@ravnborg.org>,
	Alexey Dobriyan <adobriyan@gmail.com>,
	linux-kernel@vger.kernel.org, linux-mips@linux-mips.org
Subject: Re: [PATCH] Added MIPS RM9K watchdog driver
Message-ID: <20061102140450.GE16883@linux-mips.org>
References: <20061101184633.GA7056@infomag.infomag.iguana.be> <20061101221125.73505baa.rdunlap@xenotime.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20061101221125.73505baa.rdunlap@xenotime.net>
User-Agent: Mutt/1.4.2.2i
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13154
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: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Wed, Nov 01, 2006 at 10:11:25PM -0800, Randy Dunlap wrote:

> > 	wd_regs = ioremap_nocache(rr->start, rr->end + 1 - rr->start);
> > 	if (unlikely(!wd_regs))
> > 		return -ENOMEM;
> 
> There's no way to return the resources on failure?

MIPS drivers (and this one is specific to a particular MIPS SOC) are
generally a bit sloopy about checking of return values of ioremap because
ioremap is only doing some address arithmetic but no allocations that
actually could fail.  So for 64-bit kernels or addresses below 0x20000000
on a 32-bit system ioremap cannot fail.  In the same cases ioremap happens
to be a no-op because where nothing was allocated nothing needs to be
freed.

> > 			if (unlikely(__copy_from_user(&val, (const void __user *) arg,

Note to self, __copy_from_user and gang are generally assume to not
return an error so it might be a good idea to move that unlikely() into
the macro definitions.

  Ralf

From gstupp@cisco.com Mon Nov  6 14:42:55 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 06 Nov 2006 14:43:01 +0000 (GMT)
Received: from ams-iport-1.cisco.com ([144.254.224.140]:28990 "EHLO
	ams-iport-1.cisco.com") by ftp.linux-mips.org with ESMTP
	id S20038498AbWKFOmz convert rfc822-to-8bit (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Mon, 6 Nov 2006 14:42:55 +0000
Received: from ams-dkim-1.cisco.com ([144.254.224.138])
  by ams-iport-1.cisco.com with ESMTP; 06 Nov 2006 15:42:42 +0100
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: Ah4FALjWTkWQ/uCKY2dsb2JhbACMQBQPKg
X-IronPort-AV: i="4.09,391,1157320800"; 
   d="scan'208"; a="117491114:sNHT1670059248"
Received: from ams-core-1.cisco.com (ams-core-1.cisco.com [144.254.224.150])
	by ams-dkim-1.cisco.com (8.12.11.20060308/8.12.11) with ESMTP id kA6EgbkS032147
	for <linux-mips@linux-mips.org>; Mon, 6 Nov 2006 15:42:37 +0100
Received: from xbh-ams-331.emea.cisco.com (xbh-ams-331.cisco.com [144.254.231.71])
	by ams-core-1.cisco.com (8.12.10/8.12.6) with ESMTP id kA6EgZ4Z013558
	for <linux-mips@linux-mips.org>; Mon, 6 Nov 2006 15:42:37 +0100 (MET)
Received: from xmb-ams-33b.cisco.com ([144.254.231.86]) by xbh-ams-331.emea.cisco.com with Microsoft SMTPSVC(6.0.3790.1830);
	 Mon, 6 Nov 2006 15:42:35 +0100
X-MimeOLE: Produced By Microsoft Exchange V6.5
Content-class: urn:content-classes:message
MIME-Version: 1.0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 8BIT
Subject: Sync operation in atomic_add_return()
Date:	Mon, 6 Nov 2006 15:42:32 +0100
Message-ID: <E98CBCB9ACC07244969BE4541EC0A78303137105@xmb-ams-33b.emea.cisco.com>
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
Thread-Topic: Sync operation in atomic_add_return()
Thread-Index: AccBscqczM/yLc/WQ56lzFz+PK98Aw==
From:	"Gideon Stupp \(gstupp\)" <gstupp@cisco.com>
To:	<linux-mips@linux-mips.org>
X-OriginalArrivalTime: 06 Nov 2006 14:42:35.0245 (UTC) FILETIME=[CC5721D0:01C701B1]
DKIM-Signature:	a=rsa-sha1; q=dns; l=238; t=1162824157; x=1163688157;
	c=relaxed/simple; s=amsdkim1002; h=Content-Type:From:Subject:Content-Transfer-Encoding:MIME-Version;
	d=cisco.com; i=gstupp@cisco.com; z=From:=22Gideon=20Stupp=20\(gstupp\)=22=20<gstupp@cisco.com>
	|Subject:Sync=20operation=20in=20atomic_add_return();
	X=v=3Dcisco.com=3B=20h=3DrA689xsvf+eeyP6dQ0ll9jEY8OU=3D; b=V9BwL6QiSKOdZVbxqTwfwoiHZJPtSM2//QDR9JpOT1sPkssECddqxb8AZ77NE/G9u6Vb8dgq
	omfwn/CLHocotMijhYimOWcRUUhLVX3ZdN/VftlXObussOil+YfGcIPO;
Authentication-Results:	ams-dkim-1; header.From=gstupp@cisco.com; dkim=pass (
	sig from cisco.com verified; ); 
Return-Path: <gstupp@cisco.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13155
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: gstupp@cisco.com
Precedence: bulk
X-list: linux-mips

Hi,
I am trying to figure out why there is a sync operation in
linux/include/asm-mips/atomic.h:atomic_add_return(). 
I believe it was added in the linux-2.4.19 patch, but can't trace the
reason. Can anyone help?

Thanks, Gideon.

From kaz@zeugmasystems.com Mon Nov  6 18:18:02 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 06 Nov 2006 18:18:09 +0000 (GMT)
Received: from mail.zeugmasystems.com ([192.139.122.66]:23690 "EHLO
	zeugmasystems.com") by ftp.linux-mips.org with ESMTP
	id S20038545AbWKFSSC convert rfc822-to-8bit (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Mon, 6 Nov 2006 18:18:02 +0000
X-MimeOLE: Produced By Microsoft Exchange V6.5
Content-class: urn:content-classes:message
MIME-Version: 1.0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 8BIT
Subject: RE: Sync operation in atomic_add_return()
Date:	Mon, 6 Nov 2006 10:17:53 -0800
Message-ID: <66910A579C9312469A7DF9ADB54A8B7D44D837@exchange.ZeugmaSystems.local>
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
Thread-Topic: Sync operation in atomic_add_return()
Thread-Index: AccBscqczM/yLc/WQ56lzFz+PK98AwAHKqog
From:	"Kaz Kylheku" <kaz@zeugmasystems.com>
To:	<linux-mips@linux-mips.org>
Return-Path: <kaz@zeugmasystems.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13156
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: kaz@zeugmasystems.com
Precedence: bulk
X-list: linux-mips

Gideon Stupp wrote:
> Hi,
> I am trying to figure out why there is a sync operation in
> linux/include/asm-mips/atomic.h:atomic_add_return(). 
> I believe it was added in the linux-2.4.19 patch, but can't trace the
> reason. Can anyone help?

Is it just unwarranted paranoia? There does not appear to be a need for
the sync within the atomic_add_return code itself.

But it might be that the code which calls this function needs the sync.

Without looking at any code whatsoever, here is a general hypothesis.

In what situation might you /care/ about the return value of an atomic
add?

Suppose atomic increments and decrements are being used for reference
counting. If you know that you hold the reference to an object, you can
call atomic_add to increase the reference count without caring about the
return value, and no sync is needed in that situation.

Suppose, however, that atomic_add is used to pick up a reference.
Suppose you have a pool of ``dead'' objects with reference counts of
zero, and want to recycle an object from such a pool. You might use
atomic_add_return to examine the reference counts of the objects in this
pool one by one until you get a 1 return. You might get something other
than a 1 return if racing against another processor which is tryiing to
pick up the same object.

In this situation, if you successfully get the object, you do want to do
a sync, since the object is being handed off between two processors.
Before the object was put into the pool, its fields were updated, since
it was being cleaned up. You would not want the new owner, by chance, to
observe stale values of those fields.

I.e., to put it briefly, atomic_add_return can have "acquire" semantics.


From anemo@mba.ocn.ne.jp Tue Nov  7 09:23:09 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 07 Nov 2006 09:23:14 +0000 (GMT)
Received: from topsns2.toshiba-tops.co.jp ([202.230.225.126]:14764 "EHLO
	topsns2.toshiba-tops.co.jp") by ftp.linux-mips.org with ESMTP
	id S20037661AbWKGJXJ (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 7 Nov 2006 09:23:09 +0000
Received: from topsms.toshiba-tops.co.jp by topsns2.toshiba-tops.co.jp
          via smtpd (for ftp.linux-mips.org [194.74.144.162]) with ESMTP; Tue, 7 Nov 2006 18:23:07 +0900
Received: from topsms.toshiba-tops.co.jp (localhost.localdomain [127.0.0.1])
	by localhost.toshiba-tops.co.jp (Postfix) with ESMTP id 7C4F9203FD;
	Tue,  7 Nov 2006 18:23:03 +0900 (JST)
Received: from srd2sd.toshiba-tops.co.jp (srd2sd.toshiba-tops.co.jp [172.17.28.2])
	by topsms.toshiba-tops.co.jp (Postfix) with ESMTP id A72AB2029C;
	Tue,  7 Nov 2006 18:02:45 +0900 (JST)
Received: from localhost (fragile [172.17.28.65])
	by srd2sd.toshiba-tops.co.jp (8.12.10/8.12.10) with ESMTP id kA792iW0052786;
	Tue, 7 Nov 2006 18:02:44 +0900 (JST)
	(envelope-from anemo@mba.ocn.ne.jp)
Date:	Tue, 07 Nov 2006 18:02:44 +0900 (JST)
Message-Id: <20061107.180244.95062957.nemoto@toshiba-tops.co.jp>
To:	linux-mips@linux-mips.org
Cc:	ralf@linux-mips.org, dpervushin@ru.mvista.com,
	creese@caviumnetworks.com
Subject: [PATCH] Use SYSVIPC_COMPAT to fix various problems on N32
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
X-Fingerprint: 6ACA 1623 39BD 9A94 9B1A  B746 CA77 FE94 2874 D52F
X-Pgp-Public-Key: http://wwwkeys.pgp.net/pks/lookup?op=get&search=0x2874D52F
X-Mailer: Mew version 3.3 on Emacs 21.3 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Return-Path: <anemo@mba.ocn.ne.jp>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13157
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: anemo@mba.ocn.ne.jp
Precedence: bulk
X-list: linux-mips

N32 SysV IPC system calls should use 32-bit compatible code.
arch/mips/kernel/linux32.c have similar compatible code for O32, but
ipc/compat.c seems more complete.  We can use it for both N32 and O32.

This patch should fix these problems (and other possible problems):

http://www.linux-mips.org/cgi-bin/mesg.cgi?a=linux-mips&i=1149188824.6986.6.camel%40diimka-laptop
http://www.linux-mips.org/cgi-bin/mesg.cgi?a=linux-mips&i=44C6B829.8050508%40caviumnetworks.com

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>

 arch/mips/Kconfig              |    5 
 arch/mips/kernel/linux32.c     |  578 +----------------------------------------
 arch/mips/kernel/scall64-n32.S |   14 
 include/asm-mips/compat.h      |   68 ++++
 4 files changed, 103 insertions(+), 562 deletions(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 5f2f77f..7cc9adb 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -1920,6 +1920,11 @@ config COMPAT
 	depends on MIPS32_COMPAT
 	default y
 
+config SYSVIPC_COMPAT
+	bool
+	depends on COMPAT && SYSVIPC
+	default y
+
 config MIPS32_O32
 	bool "Kernel support for o32 binaries"
 	depends on MIPS32_COMPAT
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index 7a3ebbe..6cd62ac 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -382,531 +382,6 @@ asmlinkage int sys32_sched_rr_get_interv
 	return ret;
 }
 
-struct msgbuf32 { s32 mtype; char mtext[1]; };
-
-struct ipc_perm32
-{
-	key_t    	  key;
-        __compat_uid_t  uid;
-        __compat_gid_t  gid;
-        __compat_uid_t  cuid;
-        __compat_gid_t  cgid;
-        compat_mode_t	mode;
-        unsigned short  seq;
-};
-
-struct ipc64_perm32 {
-	key_t key;
-	__compat_uid_t uid;
-	__compat_gid_t gid;
-	__compat_uid_t cuid;
-	__compat_gid_t cgid;
-	compat_mode_t	mode;
-	unsigned short	seq;
-	unsigned short __pad1;
-	unsigned int __unused1;
-	unsigned int __unused2;
-};
-
-struct semid_ds32 {
-        struct ipc_perm32 sem_perm;               /* permissions .. see ipc.h */
-        compat_time_t   sem_otime;              /* last semop time */
-        compat_time_t   sem_ctime;              /* last change time */
-        u32 sem_base;              /* ptr to first semaphore in array */
-        u32 sem_pending;          /* pending operations to be processed */
-        u32 sem_pending_last;    /* last pending operation */
-        u32 undo;                  /* undo requests on this array */
-        unsigned short  sem_nsems;              /* no. of semaphores in array */
-};
-
-struct semid64_ds32 {
-	struct ipc64_perm32	sem_perm;
-	compat_time_t	sem_otime;
-	compat_time_t	sem_ctime;
-	unsigned int		sem_nsems;
-	unsigned int		__unused1;
-	unsigned int		__unused2;
-};
-
-struct msqid_ds32
-{
-        struct ipc_perm32 msg_perm;
-        u32 msg_first;
-        u32 msg_last;
-        compat_time_t   msg_stime;
-        compat_time_t   msg_rtime;
-        compat_time_t   msg_ctime;
-        u32 wwait;
-        u32 rwait;
-        unsigned short msg_cbytes;
-        unsigned short msg_qnum;
-        unsigned short msg_qbytes;
-        compat_ipc_pid_t msg_lspid;
-        compat_ipc_pid_t msg_lrpid;
-};
-
-struct msqid64_ds32 {
-	struct ipc64_perm32 msg_perm;
-	compat_time_t msg_stime;
-	unsigned int __unused1;
-	compat_time_t msg_rtime;
-	unsigned int __unused2;
-	compat_time_t msg_ctime;
-	unsigned int __unused3;
-	unsigned int msg_cbytes;
-	unsigned int msg_qnum;
-	unsigned int msg_qbytes;
-	compat_pid_t msg_lspid;
-	compat_pid_t msg_lrpid;
-	unsigned int __unused4;
-	unsigned int __unused5;
-};
-
-struct shmid_ds32 {
-        struct ipc_perm32       shm_perm;
-        int                     shm_segsz;
-        compat_time_t		shm_atime;
-        compat_time_t		shm_dtime;
-        compat_time_t		shm_ctime;
-        compat_ipc_pid_t    shm_cpid;
-        compat_ipc_pid_t    shm_lpid;
-        unsigned short          shm_nattch;
-};
-
-struct shmid64_ds32 {
-	struct ipc64_perm32	shm_perm;
-	compat_size_t		shm_segsz;
-	compat_time_t		shm_atime;
-	compat_time_t		shm_dtime;
-	compat_time_t shm_ctime;
-	compat_pid_t shm_cpid;
-	compat_pid_t shm_lpid;
-	unsigned int shm_nattch;
-	unsigned int __unused1;
-	unsigned int __unused2;
-};
-
-struct ipc_kludge32 {
-	u32 msgp;
-	s32 msgtyp;
-};
-
-static int
-do_sys32_semctl(int first, int second, int third, void __user *uptr)
-{
-	union semun fourth;
-	u32 pad;
-	int err, err2;
-	struct semid64_ds s;
-	mm_segment_t old_fs;
-
-	if (!uptr)
-		return -EINVAL;
-	err = -EFAULT;
-	if (get_user (pad, (u32 __user *)uptr))
-		return err;
-	if ((third & ~IPC_64) == SETVAL)
-		fourth.val = (int)pad;
-	else
-		fourth.__pad = (void __user *)A(pad);
-	switch (third & ~IPC_64) {
-	case IPC_INFO:
-	case IPC_RMID:
-	case IPC_SET:
-	case SEM_INFO:
-	case GETVAL:
-	case GETPID:
-	case GETNCNT:
-	case GETZCNT:
-	case GETALL:
-	case SETVAL:
-	case SETALL:
-		err = sys_semctl (first, second, third, fourth);
-		break;
-
-	case IPC_STAT:
-	case SEM_STAT:
-		fourth.__pad = (struct semid64_ds __user *)&s;
-		old_fs = get_fs();
-		set_fs(KERNEL_DS);
-		err = sys_semctl(first, second, third | IPC_64, fourth);
-		set_fs(old_fs);
-
-		if (third & IPC_64) {
-			struct semid64_ds32 __user *usp64 = (struct semid64_ds32 __user *) A(pad);
-
-			if (!access_ok(VERIFY_WRITE, usp64, sizeof(*usp64))) {
-				err = -EFAULT;
-				break;
-			}
-			err2 = __put_user(s.sem_perm.key, &usp64->sem_perm.key);
-			err2 |= __put_user(s.sem_perm.uid, &usp64->sem_perm.uid);
-			err2 |= __put_user(s.sem_perm.gid, &usp64->sem_perm.gid);
-			err2 |= __put_user(s.sem_perm.cuid, &usp64->sem_perm.cuid);
-			err2 |= __put_user(s.sem_perm.cgid, &usp64->sem_perm.cgid);
-			err2 |= __put_user(s.sem_perm.mode, &usp64->sem_perm.mode);
-			err2 |= __put_user(s.sem_perm.seq, &usp64->sem_perm.seq);
-			err2 |= __put_user(s.sem_otime, &usp64->sem_otime);
-			err2 |= __put_user(s.sem_ctime, &usp64->sem_ctime);
-			err2 |= __put_user(s.sem_nsems, &usp64->sem_nsems);
-		} else {
-			struct semid_ds32 __user *usp32 = (struct semid_ds32 __user *) A(pad);
-
-			if (!access_ok(VERIFY_WRITE, usp32, sizeof(*usp32))) {
-				err = -EFAULT;
-				break;
-			}
-			err2 = __put_user(s.sem_perm.key, &usp32->sem_perm.key);
-			err2 |= __put_user(s.sem_perm.uid, &usp32->sem_perm.uid);
-			err2 |= __put_user(s.sem_perm.gid, &usp32->sem_perm.gid);
-			err2 |= __put_user(s.sem_perm.cuid, &usp32->sem_perm.cuid);
-			err2 |= __put_user(s.sem_perm.cgid, &usp32->sem_perm.cgid);
-			err2 |= __put_user(s.sem_perm.mode, &usp32->sem_perm.mode);
-			err2 |= __put_user(s.sem_perm.seq, &usp32->sem_perm.seq);
-			err2 |= __put_user(s.sem_otime, &usp32->sem_otime);
-			err2 |= __put_user(s.sem_ctime, &usp32->sem_ctime);
-			err2 |= __put_user(s.sem_nsems, &usp32->sem_nsems);
-		}
-		if (err2)
-			err = -EFAULT;
-		break;
-
-	default:
-		err = - EINVAL;
-		break;
-	}
-
-	return err;
-}
-
-static int
-do_sys32_msgsnd (int first, int second, int third, void __user *uptr)
-{
-	struct msgbuf32 __user *up = (struct msgbuf32 __user *)uptr;
-	struct msgbuf *p;
-	mm_segment_t old_fs;
-	int err;
-
-	if (second < 0)
-		return -EINVAL;
-	p = kmalloc (second + sizeof (struct msgbuf)
-				    + 4, GFP_USER);
-	if (!p)
-		return -ENOMEM;
-	err = get_user (p->mtype, &up->mtype);
-	if (err)
-		goto out;
-	err |= __copy_from_user (p->mtext, &up->mtext, second);
-	if (err)
-		goto out;
-	old_fs = get_fs ();
-	set_fs (KERNEL_DS);
-	err = sys_msgsnd (first, (struct msgbuf __user *)p, second, third);
-	set_fs (old_fs);
-out:
-	kfree (p);
-
-	return err;
-}
-
-static int
-do_sys32_msgrcv (int first, int second, int msgtyp, int third,
-		 int version, void __user *uptr)
-{
-	struct msgbuf32 __user *up;
-	struct msgbuf *p;
-	mm_segment_t old_fs;
-	int err;
-
-	if (!version) {
-		struct ipc_kludge32 __user *uipck = (struct ipc_kludge32 __user *)uptr;
-		struct ipc_kludge32 ipck;
-
-		err = -EINVAL;
-		if (!uptr)
-			goto out;
-		err = -EFAULT;
-		if (copy_from_user (&ipck, uipck, sizeof (struct ipc_kludge32)))
-			goto out;
-		uptr = (void __user *)AA(ipck.msgp);
-		msgtyp = ipck.msgtyp;
-	}
-
-	if (second < 0)
-		return -EINVAL;
-	err = -ENOMEM;
-	p = kmalloc (second + sizeof (struct msgbuf) + 4, GFP_USER);
-	if (!p)
-		goto out;
-	old_fs = get_fs ();
-	set_fs (KERNEL_DS);
-	err = sys_msgrcv (first, (struct msgbuf __user *)p, second + 4, msgtyp, third);
-	set_fs (old_fs);
-	if (err < 0)
-		goto free_then_out;
-	up = (struct msgbuf32 __user *)uptr;
-	if (put_user (p->mtype, &up->mtype) ||
-	    __copy_to_user (&up->mtext, p->mtext, err))
-		err = -EFAULT;
-free_then_out:
-	kfree (p);
-out:
-	return err;
-}
-
-static int
-do_sys32_msgctl (int first, int second, void __user *uptr)
-{
-	int err = -EINVAL, err2;
-	struct msqid64_ds m;
-	struct msqid_ds32 __user *up32 = (struct msqid_ds32 __user *)uptr;
-	struct msqid64_ds32 __user *up64 = (struct msqid64_ds32 __user *)uptr;
-	mm_segment_t old_fs;
-
-	switch (second & ~IPC_64) {
-	case IPC_INFO:
-	case IPC_RMID:
-	case MSG_INFO:
-		err = sys_msgctl (first, second, (struct msqid_ds __user *)uptr);
-		break;
-
-	case IPC_SET:
-		if (second & IPC_64) {
-			if (!access_ok(VERIFY_READ, up64, sizeof(*up64))) {
-				err = -EFAULT;
-				break;
-			}
-			err = __get_user(m.msg_perm.uid, &up64->msg_perm.uid);
-			err |= __get_user(m.msg_perm.gid, &up64->msg_perm.gid);
-			err |= __get_user(m.msg_perm.mode, &up64->msg_perm.mode);
-			err |= __get_user(m.msg_qbytes, &up64->msg_qbytes);
-		} else {
-			if (!access_ok(VERIFY_READ, up32, sizeof(*up32))) {
-				err = -EFAULT;
-				break;
-			}
-			err = __get_user(m.msg_perm.uid, &up32->msg_perm.uid);
-			err |= __get_user(m.msg_perm.gid, &up32->msg_perm.gid);
-			err |= __get_user(m.msg_perm.mode, &up32->msg_perm.mode);
-			err |= __get_user(m.msg_qbytes, &up32->msg_qbytes);
-		}
-		if (err)
-			break;
-		old_fs = get_fs();
-		set_fs(KERNEL_DS);
-		err = sys_msgctl(first, second | IPC_64, (struct msqid_ds __user *)&m);
-		set_fs(old_fs);
-		break;
-
-	case IPC_STAT:
-	case MSG_STAT:
-		old_fs = get_fs();
-		set_fs(KERNEL_DS);
-		err = sys_msgctl(first, second | IPC_64, (struct msqid_ds __user *)&m);
-		set_fs(old_fs);
-		if (second & IPC_64) {
-			if (!access_ok(VERIFY_WRITE, up64, sizeof(*up64))) {
-				err = -EFAULT;
-				break;
-			}
-			err2 = __put_user(m.msg_perm.key, &up64->msg_perm.key);
-			err2 |= __put_user(m.msg_perm.uid, &up64->msg_perm.uid);
-			err2 |= __put_user(m.msg_perm.gid, &up64->msg_perm.gid);
-			err2 |= __put_user(m.msg_perm.cuid, &up64->msg_perm.cuid);
-			err2 |= __put_user(m.msg_perm.cgid, &up64->msg_perm.cgid);
-			err2 |= __put_user(m.msg_perm.mode, &up64->msg_perm.mode);
-			err2 |= __put_user(m.msg_perm.seq, &up64->msg_perm.seq);
-			err2 |= __put_user(m.msg_stime, &up64->msg_stime);
-			err2 |= __put_user(m.msg_rtime, &up64->msg_rtime);
-			err2 |= __put_user(m.msg_ctime, &up64->msg_ctime);
-			err2 |= __put_user(m.msg_cbytes, &up64->msg_cbytes);
-			err2 |= __put_user(m.msg_qnum, &up64->msg_qnum);
-			err2 |= __put_user(m.msg_qbytes, &up64->msg_qbytes);
-			err2 |= __put_user(m.msg_lspid, &up64->msg_lspid);
-			err2 |= __put_user(m.msg_lrpid, &up64->msg_lrpid);
-			if (err2)
-				err = -EFAULT;
-		} else {
-			if (!access_ok(VERIFY_WRITE, up32, sizeof(*up32))) {
-				err = -EFAULT;
-				break;
-			}
-			err2 = __put_user(m.msg_perm.key, &up32->msg_perm.key);
-			err2 |= __put_user(m.msg_perm.uid, &up32->msg_perm.uid);
-			err2 |= __put_user(m.msg_perm.gid, &up32->msg_perm.gid);
-			err2 |= __put_user(m.msg_perm.cuid, &up32->msg_perm.cuid);
-			err2 |= __put_user(m.msg_perm.cgid, &up32->msg_perm.cgid);
-			err2 |= __put_user(m.msg_perm.mode, &up32->msg_perm.mode);
-			err2 |= __put_user(m.msg_perm.seq, &up32->msg_perm.seq);
-			err2 |= __put_user(m.msg_stime, &up32->msg_stime);
-			err2 |= __put_user(m.msg_rtime, &up32->msg_rtime);
-			err2 |= __put_user(m.msg_ctime, &up32->msg_ctime);
-			err2 |= __put_user(m.msg_cbytes, &up32->msg_cbytes);
-			err2 |= __put_user(m.msg_qnum, &up32->msg_qnum);
-			err2 |= __put_user(m.msg_qbytes, &up32->msg_qbytes);
-			err2 |= __put_user(m.msg_lspid, &up32->msg_lspid);
-			err2 |= __put_user(m.msg_lrpid, &up32->msg_lrpid);
-			if (err2)
-				err = -EFAULT;
-		}
-		break;
-	}
-
-	return err;
-}
-
-static int
-do_sys32_shmat (int first, int second, int third, int version, void __user *uptr)
-{
-	unsigned long raddr;
-	u32 __user *uaddr = (u32 __user *)A((u32)third);
-	int err = -EINVAL;
-
-	if (version == 1)
-		return err;
-	err = do_shmat (first, uptr, second, &raddr);
-	if (err)
-		return err;
-	err = put_user (raddr, uaddr);
-	return err;
-}
-
-struct shm_info32 {
-	int used_ids;
-	u32 shm_tot, shm_rss, shm_swp;
-	u32 swap_attempts, swap_successes;
-};
-
-static int
-do_sys32_shmctl (int first, int second, void __user *uptr)
-{
-	struct shmid64_ds32 __user *up64 = (struct shmid64_ds32 __user *)uptr;
-	struct shmid_ds32 __user *up32 = (struct shmid_ds32 __user *)uptr;
-	struct shm_info32 __user *uip = (struct shm_info32 __user *)uptr;
-	int err = -EFAULT, err2;
-	struct shmid64_ds s64;
-	mm_segment_t old_fs;
-	struct shm_info si;
-	struct shmid_ds s;
-
-	switch (second & ~IPC_64) {
-	case IPC_INFO:
-		second = IPC_INFO; /* So that we don't have to translate it */
-	case IPC_RMID:
-	case SHM_LOCK:
-	case SHM_UNLOCK:
-		err = sys_shmctl(first, second, (struct shmid_ds __user *)uptr);
-		break;
-	case IPC_SET:
-		if (second & IPC_64) {
-			err = get_user(s.shm_perm.uid, &up64->shm_perm.uid);
-			err |= get_user(s.shm_perm.gid, &up64->shm_perm.gid);
-			err |= get_user(s.shm_perm.mode, &up64->shm_perm.mode);
-		} else {
-			err = get_user(s.shm_perm.uid, &up32->shm_perm.uid);
-			err |= get_user(s.shm_perm.gid, &up32->shm_perm.gid);
-			err |= get_user(s.shm_perm.mode, &up32->shm_perm.mode);
-		}
-		if (err)
-			break;
-		old_fs = get_fs();
-		set_fs(KERNEL_DS);
-		err = sys_shmctl(first, second & ~IPC_64, (struct shmid_ds __user *)&s);
-		set_fs(old_fs);
-		break;
-
-	case IPC_STAT:
-	case SHM_STAT:
-		old_fs = get_fs();
-		set_fs(KERNEL_DS);
-		err = sys_shmctl(first, second | IPC_64, (void __user *) &s64);
-		set_fs(old_fs);
-		if (err < 0)
-			break;
-		if (second & IPC_64) {
-			if (!access_ok(VERIFY_WRITE, up64, sizeof(*up64))) {
-				err = -EFAULT;
-				break;
-			}
-			err2 = __put_user(s64.shm_perm.key, &up64->shm_perm.key);
-			err2 |= __put_user(s64.shm_perm.uid, &up64->shm_perm.uid);
-			err2 |= __put_user(s64.shm_perm.gid, &up64->shm_perm.gid);
-			err2 |= __put_user(s64.shm_perm.cuid, &up64->shm_perm.cuid);
-			err2 |= __put_user(s64.shm_perm.cgid, &up64->shm_perm.cgid);
-			err2 |= __put_user(s64.shm_perm.mode, &up64->shm_perm.mode);
-			err2 |= __put_user(s64.shm_perm.seq, &up64->shm_perm.seq);
-			err2 |= __put_user(s64.shm_atime, &up64->shm_atime);
-			err2 |= __put_user(s64.shm_dtime, &up64->shm_dtime);
-			err2 |= __put_user(s64.shm_ctime, &up64->shm_ctime);
-			err2 |= __put_user(s64.shm_segsz, &up64->shm_segsz);
-			err2 |= __put_user(s64.shm_nattch, &up64->shm_nattch);
-			err2 |= __put_user(s64.shm_cpid, &up64->shm_cpid);
-			err2 |= __put_user(s64.shm_lpid, &up64->shm_lpid);
-		} else {
-			if (!access_ok(VERIFY_WRITE, up32, sizeof(*up32))) {
-				err = -EFAULT;
-				break;
-			}
-			err2 = __put_user(s64.shm_perm.key, &up32->shm_perm.key);
-			err2 |= __put_user(s64.shm_perm.uid, &up32->shm_perm.uid);
-			err2 |= __put_user(s64.shm_perm.gid, &up32->shm_perm.gid);
-			err2 |= __put_user(s64.shm_perm.cuid, &up32->shm_perm.cuid);
-			err2 |= __put_user(s64.shm_perm.cgid, &up32->shm_perm.cgid);
-			err2 |= __put_user(s64.shm_perm.mode, &up32->shm_perm.mode);
-			err2 |= __put_user(s64.shm_perm.seq, &up32->shm_perm.seq);
-			err2 |= __put_user(s64.shm_atime, &up32->shm_atime);
-			err2 |= __put_user(s64.shm_dtime, &up32->shm_dtime);
-			err2 |= __put_user(s64.shm_ctime, &up32->shm_ctime);
-			err2 |= __put_user(s64.shm_segsz, &up32->shm_segsz);
-			err2 |= __put_user(s64.shm_nattch, &up32->shm_nattch);
-			err2 |= __put_user(s64.shm_cpid, &up32->shm_cpid);
-			err2 |= __put_user(s64.shm_lpid, &up32->shm_lpid);
-		}
-		if (err2)
-			err = -EFAULT;
-		break;
-
-	case SHM_INFO:
-		old_fs = get_fs();
-		set_fs(KERNEL_DS);
-		err = sys_shmctl(first, second, (void __user *)&si);
-		set_fs(old_fs);
-		if (err < 0)
-			break;
-		err2 = put_user(si.used_ids, &uip->used_ids);
-		err2 |= __put_user(si.shm_tot, &uip->shm_tot);
-		err2 |= __put_user(si.shm_rss, &uip->shm_rss);
-		err2 |= __put_user(si.shm_swp, &uip->shm_swp);
-		err2 |= __put_user(si.swap_attempts, &uip->swap_attempts);
-		err2 |= __put_user (si.swap_successes, &uip->swap_successes);
-		if (err2)
-			err = -EFAULT;
-		break;
-
-	default:
-		err = -EINVAL;
-		break;
-	}
-
-	return err;
-}
-
-static int sys32_semtimedop(int semid, struct sembuf __user *tsems, int nsems,
-                            const struct compat_timespec __user *timeout32)
-{
-	struct compat_timespec t32;
-	struct timespec __user *t64 = compat_alloc_user_space(sizeof(*t64));
-
-	if (copy_from_user(&t32, timeout32, sizeof(t32)))
-		return -EFAULT;
-
-	if (put_user(t32.tv_sec, &t64->tv_sec) ||
-	    put_user(t32.tv_nsec, &t64->tv_nsec))
-		return -EFAULT;
-
-	return sys_semtimedop(semid, tsems, nsems, t64);
-}
-
 asmlinkage long
 sys32_ipc (u32 call, int first, int second, int third, u32 ptr, u32 fifth)
 {
@@ -918,48 +393,43 @@ sys32_ipc (u32 call, int first, int seco
 	switch (call) {
 	case SEMOP:
 		/* struct sembuf is the same on 32 and 64bit :)) */
-		err = sys_semtimedop (first, (struct sembuf __user *)AA(ptr), second,
-		                      NULL);
+		err = sys_semtimedop(first, compat_ptr(ptr), second, NULL);
 		break;
 	case SEMTIMEDOP:
-		err = sys32_semtimedop (first, (struct sembuf __user *)AA(ptr), second,
-		                      (const struct compat_timespec __user *)AA(fifth));
+		err = compat_sys_semtimedop(first, compat_ptr(ptr), second,
+					    compat_ptr(fifth));
 		break;
 	case SEMGET:
-		err = sys_semget (first, second, third);
+		err = sys_semget(first, second, third);
 		break;
 	case SEMCTL:
-		err = do_sys32_semctl (first, second, third,
-				       (void __user *)AA(ptr));
+		err = compat_sys_semctl(first, second, third, compat_ptr(ptr));
 		break;
-
 	case MSGSND:
-		err = do_sys32_msgsnd (first, second, third,
-				       (void __user *)AA(ptr));
+		err = compat_sys_msgsnd(first, second, third, compat_ptr(ptr));
 		break;
 	case MSGRCV:
-		err = do_sys32_msgrcv (first, second, fifth, third,
-				       version, (void __user *)AA(ptr));
+		err = compat_sys_msgrcv(first, second, fifth, third,
+					version, compat_ptr(ptr));
 		break;
 	case MSGGET:
-		err = sys_msgget ((key_t) first, second);
+		err = sys_msgget((key_t) first, second);
 		break;
 	case MSGCTL:
-		err = do_sys32_msgctl (first, second, (void __user *)AA(ptr));
+		err = compat_sys_msgctl(first, second, compat_ptr(ptr));
 		break;
-
 	case SHMAT:
-		err = do_sys32_shmat (first, second, third,
-				      version, (void __user *)AA(ptr));
+		err = compat_sys_shmat(first, second, third, version,
+				       compat_ptr(ptr));
 		break;
 	case SHMDT:
-		err = sys_shmdt ((char __user *)A(ptr));
+		err = sys_shmdt(compat_ptr(ptr));
 		break;
 	case SHMGET:
-		err = sys_shmget (first, (unsigned)second, third);
+		err = sys_shmget(first, (unsigned)second, third);
 		break;
 	case SHMCTL:
-		err = do_sys32_shmctl (first, second, (void __user *)AA(ptr));
+		err = compat_sys_shmctl(first, second, compat_ptr(ptr));
 		break;
 	default:
 		err = -EINVAL;
@@ -969,18 +439,16 @@ sys32_ipc (u32 call, int first, int seco
 	return err;
 }
 
-asmlinkage long sys32_shmat(int shmid, char __user *shmaddr,
-			  int shmflg, int32_t __user *addr)
+#ifdef CONFIG_MIPS32_N32
+asmlinkage long sys32_semctl(int semid, int semnum, int cmd, union semun arg)
 {
-	unsigned long raddr;
-	int err;
-
-	err = do_shmat(shmid, shmaddr, shmflg, &raddr);
-	if (err)
-		return err;
-
-	return put_user(raddr, addr);
+	/* compat_sys_semctl expects a pointer to union semun */
+	u32 __user *uptr = compat_alloc_user_space(sizeof(u32));
+	if (put_user(ptr_to_compat(arg.__pad), uptr))
+		return -EFAULT;
+	return compat_sys_semctl(semid, semnum, cmd, uptr);
 }
+#endif
 
 struct sysctl_args32
 {
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index 0da5ca2..01c3d7c 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -149,8 +149,8 @@ EXPORT(sysn32_call_table)
 	PTR	sys_mincore
 	PTR	sys_madvise
 	PTR	sys_shmget
-	PTR	sys32_shmat
-	PTR	sys_shmctl			/* 6030 */
+	PTR	sys_shmat
+	PTR	compat_sys_shmctl			/* 6030 */
 	PTR	sys_dup
 	PTR	sys_dup2
 	PTR	sys_pause
@@ -184,12 +184,12 @@ EXPORT(sysn32_call_table)
 	PTR	sys32_newuname
 	PTR	sys_semget
 	PTR	sys_semop
-	PTR	sys_semctl
+	PTR	sys32_semctl
 	PTR	sys_shmdt			/* 6065 */
 	PTR	sys_msgget
-	PTR	sys_msgsnd
-	PTR	sys_msgrcv
-	PTR	sys_msgctl
+	PTR	compat_sys_msgsnd
+	PTR	compat_sys_msgrcv
+	PTR	compat_sys_msgctl
 	PTR	compat_sys_fcntl		/* 6070 */
 	PTR	sys_flock
 	PTR	sys_fsync
@@ -335,7 +335,7 @@ EXPORT(sysn32_call_table)
 	PTR	compat_sys_fcntl64
 	PTR	sys_set_tid_address
 	PTR	sys_restart_syscall
-	PTR	sys_semtimedop			/* 6215 */
+	PTR	compat_sys_semtimedop			/* 6215 */
 	PTR	sys_fadvise64_64
 	PTR	compat_sys_statfs64
 	PTR	compat_sys_fstatfs64
diff --git a/include/asm-mips/compat.h b/include/asm-mips/compat.h
index 900f472..55a0152 100644
--- a/include/asm-mips/compat.h
+++ b/include/asm-mips/compat.h
@@ -32,6 +32,7 @@ typedef struct {
 	s32	val[2];
 } compat_fsid_t;
 typedef s32		compat_timer_t;
+typedef s32		compat_key_t;
 
 typedef s32		compat_int_t;
 typedef s32		compat_long_t;
@@ -146,4 +147,71 @@ static inline void __user *compat_alloc_
 	return (void __user *) (regs->regs[29] - len);
 }
 
+struct compat_ipc64_perm {
+	compat_key_t key;
+	__compat_uid32_t uid;
+	__compat_gid32_t gid;
+	__compat_uid32_t cuid;
+	__compat_gid32_t cgid;
+	compat_mode_t mode;
+	unsigned short seq;
+	unsigned short __pad2;
+	compat_ulong_t __unused1;
+	compat_ulong_t __unused2;
+};
+
+struct compat_semid64_ds {
+	struct compat_ipc64_perm sem_perm;
+	compat_time_t	sem_otime;
+	compat_time_t	sem_ctime;
+	compat_ulong_t	sem_nsems;
+	compat_ulong_t	__unused1;
+	compat_ulong_t	__unused2;
+};
+
+struct compat_msqid64_ds {
+	struct compat_ipc64_perm msg_perm;
+#ifndef CONFIG_CPU_LITTLE_ENDIAN
+	compat_ulong_t	__unused1;
+#endif
+	compat_time_t	msg_stime;
+#ifdef CONFIG_CPU_LITTLE_ENDIAN
+	compat_ulong_t	__unused1;
+#endif
+#ifndef CONFIG_CPU_LITTLE_ENDIAN
+	compat_ulong_t	__unused2;
+#endif
+	compat_time_t	msg_rtime;
+#ifdef CONFIG_CPU_LITTLE_ENDIAN
+	compat_ulong_t	__unused2;
+#endif
+#ifndef CONFIG_CPU_LITTLE_ENDIAN
+	compat_ulong_t	__unused3;
+#endif
+	compat_time_t	msg_ctime;
+#ifdef CONFIG_CPU_LITTLE_ENDIAN
+	compat_ulong_t	__unused3;
+#endif
+	compat_ulong_t	msg_cbytes;
+	compat_ulong_t	msg_qnum;
+	compat_ulong_t	msg_qbytes;
+	compat_pid_t	msg_lspid;
+	compat_pid_t	msg_lrpid;
+	compat_ulong_t	__unused4;
+	compat_ulong_t	__unused5;
+};
+
+struct compat_shmid64_ds {
+	struct compat_ipc64_perm shm_perm;
+	compat_size_t	shm_segsz;
+	compat_time_t	shm_atime;
+	compat_time_t	shm_dtime;
+	compat_time_t	shm_ctime;
+	compat_pid_t	shm_cpid;
+	compat_pid_t	shm_lpid;
+	compat_ulong_t	shm_nattch;
+	compat_ulong_t	__unused1;
+	compat_ulong_t	__unused2;
+};
+
 #endif /* _ASM_COMPAT_H */

From ths@networkno.de Tue Nov  7 14:04:37 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 07 Nov 2006 14:04:53 +0000 (GMT)
Received: from phoenix.bawue.net ([193.7.176.60]:24265 "EHLO mail.bawue.net")
	by ftp.linux-mips.org with ESMTP id S20037855AbWKGOEh (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Tue, 7 Nov 2006 14:04:37 +0000
Received: from lagash (intrt.mips-uk.com [194.74.144.130])
	(using TLSv1 with cipher AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.bawue.net (Postfix) with ESMTP id 75CFFB81C8;
	Tue,  7 Nov 2006 15:05:05 +0100 (CET)
Received: from ths by lagash with local (Exim 4.63)
	(envelope-from <ths@networkno.de>)
	id 1GhRZ7-0000an-Qu; Tue, 07 Nov 2006 14:04:37 +0000
Date:	Tue, 7 Nov 2006 14:04:37 +0000
To:	Tim Bird <tim.bird@am.sony.com>
Cc:	CE Linux Developers List <celinux-dev@tree.celinuxforum.org>,
	linux-mips@linux-mips.org
Subject: Re: MIPS processors gain GNU/Linux binary prelinker
Message-ID: <20061107140437.GD19541@networkno.de>
References: <45492407.7090606@am.sony.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <45492407.7090606@am.sony.com>
User-Agent: Mutt/1.5.13 (2006-08-11)
From:	Thiemo Seufer <ths@networkno.de>
Return-Path: <ths@networkno.de>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13158
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: ths@networkno.de
Precedence: bulk
X-list: linux-mips

Tim Bird wrote:
> FYI - For those interested in bootup time improvements on MIPS
> processors, here is some information about the recently
> developed MIPS prelinking feature, done by CodeSourcery
> and MIPS Technologies.

The patches are showing up piecemeal now on the various mailing lists,
I also dumped a debian-styleish patchset at
ftp://ftp.linux-mips.org/pub/linux/mips/people/ths/mips-prelinker-patches-debian/


Thiemo

From ralf@linux-mips.org Tue Nov  7 15:31:25 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 07 Nov 2006 15:31:27 +0000 (GMT)
Received: from localhost.localdomain ([127.0.0.1]:24007 "EHLO
	dl5rb.ham-radio-op.net") by ftp.linux-mips.org with ESMTP
	id S20038548AbWKGPbZ (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 7 Nov 2006 15:31:25 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by dl5rb.ham-radio-op.net (8.13.8/8.13.8) with ESMTP id kA7FVp4u030765;
	Tue, 7 Nov 2006 15:31:51 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.8/8.13.8/Submit) id kA7FVo20030764;
	Tue, 7 Nov 2006 15:31:50 GMT
Date:	Tue, 7 Nov 2006 15:31:50 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	Nicolas Kaiser <nikai@nikai.net>
Cc:	linux-mips@linux-mips.org
Subject: Re: [PATCH][TRIVIAL] arch/mips: double inclusions
Message-ID: <20061107153150.GA22438@linux-mips.org>
References: <20061107095624.48577377@lucky.kitzblitz>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20061107095624.48577377@lucky.kitzblitz>
User-Agent: Mutt/1.4.2.2i
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13159
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: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Tue, Nov 07, 2006 at 09:56:24AM +0100, Nicolas Kaiser wrote:

> double inclusions in arch/mips

This patch already seems a while old so there were a few rejects.  Patches
are like fish, ship while fresh to make penguins happy ;-)  Anyway, I
fixed it up.

Did you use a script to generate these patches?  If so I'd be interested.

Thanks,

  Ralf

From barrioskmc@gmail.com Wed Nov  8 06:04:46 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 08 Nov 2006 06:04:54 +0000 (GMT)
Received: from wx-out-0506.google.com ([66.249.82.228]:56704 "EHLO
	wx-out-0506.google.com") by ftp.linux-mips.org with ESMTP
	id S20037590AbWKHGEq (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 8 Nov 2006 06:04:46 +0000
Received: by wx-out-0506.google.com with SMTP id h30so1524341wxd
        for <linux-mips@linux-mips.org>; Tue, 07 Nov 2006 22:04:44 -0800 (PST)
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws;
        s=beta; d=gmail.com;
        h=received:from:to:cc:subject:date:message-id:mime-version:content-type:content-transfer-encoding:x-mailer:thread-index:x-mimeole:in-reply-to;
        b=oZe9LVrWR1cVw4jzc80adAvBBc3oIjPejjZPmi6H2heQNFLX2XEw6xAlJDXLAFNYckCC9E8aoz3GFkUCt+OUvGAGXww3MnRQ9pCdxASWpubL+pnXQCn0KOBfN6xosAZaLrGy1wwSHmxXERHFZuxHdeKc7M/B8eJWRB0QivPfvRA=
Received: by 10.70.76.13 with SMTP id y13mr8747086wxa.1162965884717;
        Tue, 07 Nov 2006 22:04:44 -0800 (PST)
Received: from barrioswinxp ( [210.94.41.89])
        by mx.google.com with ESMTP id i16sm9715937wxd.2006.11.07.22.04.43;
        Tue, 07 Nov 2006 22:04:44 -0800 (PST)
From:	=?ks_c_5601-1987?B?sei5zsL5?= <barrioskmc@gmail.com>
To:	"'Thiemo Seufer'" <ths@networkno.de>,
	"'Tim Bird'" <tim.bird@am.sony.com>
Cc:	<linux-mips@linux-mips.org>
Subject: RE: MIPS processors gain GNU/Linux binary prelinker
Date:	Wed, 8 Nov 2006 15:04:41 +0900
Message-ID: <000801c702fb$c96e89e0$0202fea9@swcenter.sec.samsung.co.kr>
MIME-Version: 1.0
Content-Type: text/plain;
	charset="ks_c_5601-1987"
Content-Transfer-Encoding: 7bit
X-Mailer: Microsoft Office Outlook 11
Thread-Index: AccCdlPhiEMmXaCGSkSTiB1vXSyW8wAhUCMA
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962
In-Reply-To: <20061107140437.GD19541@networkno.de>
Return-Path: <barrioskmc@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13160
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: barrioskmc@gmail.com
Precedence: bulk
X-list: linux-mips

Who know anymore about prelink for mips architecture? 
Let me know prelink for mips detaily.
Thanks in advance.


-----Original Message-----
From: linux-mips-bounce@linux-mips.org [mailto:linux-mips-bounce@linux-mips.
org] On Behalf Of Thiemo Seufer
Sent: Tuesday, November 07, 2006 11:05 PM
To: Tim Bird
Cc: CE Linux Developers List; linux-mips@linux-mips.org
Subject: Re: MIPS processors gain GNU/Linux binary prelinker

Tim Bird wrote:
> FYI - For those interested in bootup time improvements on MIPS
> processors, here is some information about the recently
> developed MIPS prelinking feature, done by CodeSourcery
> and MIPS Technologies.

The patches are showing up piecemeal now on the various mailing lists,
I also dumped a debian-styleish patchset at
ftp://ftp.linux-mips.org/pub/linux/mips/people/ths/mips-prelinker-patches-
debian/


Thiemo


From hewei.fu@siemens.com Wed Nov  8 08:42:03 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 08 Nov 2006 08:42:08 +0000 (GMT)
Received: from david.siemens.com.cn ([194.138.202.53]:61391 "EHLO
	david.siemens.com.cn") by ftp.linux-mips.org with ESMTP
	id S20038547AbWKHImD convert rfc822-to-8bit (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Wed, 8 Nov 2006 08:42:03 +0000
Received: from ns.siemens.com.cn (ns.siemens.com.cn [194.138.237.52])
	by david.siemens.com.cn (8.11.7/8.11.7) with ESMTP id kA88fkR10203;
	Wed, 8 Nov 2006 16:41:46 +0800 (CST)
Received: from pekw905a.cn001.siemens.net (localhost [127.0.0.1])
	by ns.siemens.com.cn (8.11.7/8.11.7) with ESMTP id kA88fjX03554;
	Wed, 8 Nov 2006 16:41:45 +0800 (CST)
Received: from PEKW934A.cn001.siemens.net ([139.24.236.66]) by pekw905a.cn001.siemens.net with Microsoft SMTPSVC(6.0.3790.1830);
	 Wed, 8 Nov 2006 16:41:44 +0800
Content-class: urn:content-classes:message
MIME-Version: 1.0
Content-Type: text/plain;
	charset="ks_c_5601-1987"
Content-Transfer-Encoding: 8BIT
X-MimeOLE: Produced By Microsoft Exchange V6.5
Subject: RE: MIPS processors gain GNU/Linux binary prelinker
Date:	Wed, 8 Nov 2006 16:41:42 +0800
Message-ID: <96E7D5519FC3D741BEE27AB88C738797012FA7E2@PEKW934A.cn001.siemens.net>
In-Reply-To: <000801c702fb$c96e89e0$0202fea9@swcenter.sec.samsung.co.kr>
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
Thread-Topic: MIPS processors gain GNU/Linux binary prelinker
Thread-Index: AccCdlPhiEMmXaCGSkSTiB1vXSyW8wAhUCMAAAWFESA=
From:	"Fu, He Wei PSE NKG" <hewei.fu@siemens.com>
To:	=?ks_c_5601-1987?B?sei5zsL5?= <barrioskmc@gmail.com>,
	"Thiemo Seufer" <ths@networkno.de>,
	"Tim Bird" <tim.bird@am.sony.com>
Cc:	<linux-mips@linux-mips.org>
X-OriginalArrivalTime: 08 Nov 2006 08:41:44.0688 (UTC) FILETIME=[B86DCF00:01C70311]
Return-Path: <hewei.fu@siemens.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13161
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: hewei.fu@siemens.com
Precedence: bulk
X-list: linux-mips

http://people.redhat.com/jakub/prelink.pdf
I don¡¯t know whether is it useful? 

-----Original Message-----
From: linux-mips-bounce@linux-mips.org [mailto:linux-mips-bounce@linux-mips.org] On Behalf Of ???
Sent: Wednesday, November 08, 2006 2:05 PM
To: 'Thiemo Seufer'; 'Tim Bird'
Cc: linux-mips@linux-mips.org
Subject: RE: MIPS processors gain GNU/Linux binary prelinker

Who know anymore about prelink for mips architecture? 
Let me know prelink for mips detaily.
Thanks in advance.


-----Original Message-----
From: linux-mips-bounce@linux-mips.org [mailto:linux-mips-bounce@linux-mips.
org] On Behalf Of Thiemo Seufer
Sent: Tuesday, November 07, 2006 11:05 PM
To: Tim Bird
Cc: CE Linux Developers List; linux-mips@linux-mips.org
Subject: Re: MIPS processors gain GNU/Linux binary prelinker

Tim Bird wrote:
> FYI - For those interested in bootup time improvements on MIPS
> processors, here is some information about the recently
> developed MIPS prelinking feature, done by CodeSourcery
> and MIPS Technologies.

The patches are showing up piecemeal now on the various mailing lists,
I also dumped a debian-styleish patchset at
ftp://ftp.linux-mips.org/pub/linux/mips/people/ths/mips-prelinker-patches-
debian/


Thiemo



From tim.bird@am.sony.com Wed Nov  8 17:13:16 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 08 Nov 2006 17:13:22 +0000 (GMT)
Received: from mail8.fw-bc.sony.com ([160.33.98.75]:47822 "EHLO
	mail8.fw-bc.sony.com") by ftp.linux-mips.org with ESMTP
	id S20039846AbWKHRNQ (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 8 Nov 2006 17:13:16 +0000
Received: from mail3.sjc.in.sel.sony.com (mail3.sjc.in.sel.sony.com [43.134.1.211])
	by mail8.fw-bc.sony.com (8.12.11/8.12.11) with ESMTP id kA8HCrUF003452;
	Wed, 8 Nov 2006 17:12:57 GMT
Received: from [43.134.85.135] ([43.134.85.135])
	by mail3.sjc.in.sel.sony.com (8.12.11/8.12.11) with ESMTP id kA8HCrQh022880;
	Wed, 8 Nov 2006 17:12:53 GMT
Message-ID: <45521167.9010603@am.sony.com>
Date:	Wed, 08 Nov 2006 09:18:31 -0800
From:	Tim Bird <tim.bird@am.sony.com>
User-Agent: Thunderbird 1.5.0.4 (X11/20060614)
MIME-Version: 1.0
To:	=?UTF-8?B?77+9?= <barrioskmc@gmail.com>
CC:	"'Thiemo Seufer'" <ths@networkno.de>, linux-mips@linux-mips.org
Subject: Re: MIPS processors gain GNU/Linux binary prelinker
References: <000801c702fb$c96e89e0$0202fea9@swcenter.sec.samsung.co.kr>
In-Reply-To: <000801c702fb$c96e89e0$0202fea9@swcenter.sec.samsung.co.kr>
X-Enigmail-Version: 0.94.0.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Return-Path: <tim.bird@am.sony.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13162
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: tim.bird@am.sony.com
Precedence: bulk
X-list: linux-mips

ï¿½ wrote:
> Who know anymore about prelink for mips architecture? 
> Let me know prelink for mips detaily.
> Thanks in advance.

There's a white paper available.  See the linuxdevices article
for a link to it:

http://www.linuxdevices.com/news/NS6220941326.html

> 
> -----Original Message-----
> From: linux-mips-bounce@linux-mips.org [mailto:linux-mips-bounce@linux-mips.
> org] On Behalf Of Thiemo Seufer
> Sent: Tuesday, November 07, 2006 11:05 PM
> To: Tim Bird
> Cc: CE Linux Developers List; linux-mips@linux-mips.org
> Subject: Re: MIPS processors gain GNU/Linux binary prelinker
> 
> Tim Bird wrote:
>> FYI - For those interested in bootup time improvements on MIPS
>> processors, here is some information about the recently
>> developed MIPS prelinking feature, done by CodeSourcery
>> and MIPS Technologies.
> 
> The patches are showing up piecemeal now on the various mailing lists,
> I also dumped a debian-styleish patchset at
> ftp://ftp.linux-mips.org/pub/linux/mips/people/ths/mips-prelinker-patches-
> debian/
> 
> 
> Thiemo
> 
> 


-- 
=============================
Tim Bird
Architecture Group Chair, CE Linux Forum
Senior Staff Engineer, Sony Electronics
=============================

From Trevor_Hamm@pmc-sierra.com Wed Nov  8 19:10:06 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 08 Nov 2006 19:10:13 +0000 (GMT)
Received: from father.pmc-sierra.com ([216.241.224.13]:44242 "HELO
	father.pmc-sierra.bc.ca") by ftp.linux-mips.org with SMTP
	id S20038516AbWKHTKG (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 8 Nov 2006 19:10:06 +0000
Received: (qmail 13552 invoked by uid 101); 8 Nov 2006 19:09:53 -0000
Received: from unknown (HELO ogmios.pmc-sierra.bc.ca) (216.241.226.59)
  by father.pmc-sierra.com with SMTP; 8 Nov 2006 19:09:53 -0000
Received: from bby1exi01.pmc_nt.nt.pmc-sierra.bc.ca (bby1exi01.pmc-sierra.bc.ca [216.241.231.251])
	by ogmios.pmc-sierra.bc.ca (8.13.3/8.12.7) with ESMTP id kA8J9hn4000592;
	Wed, 8 Nov 2006 11:09:47 -0800
Received: by bby1exi01.pmc-sierra.bc.ca with Internet Mail Service (5.5.2657.72)
	id <VY7R80VW>; Wed, 8 Nov 2006 11:09:43 -0800
Message-ID: <E8C8A5231DDE104C816ADF532E0639120194F4C6@bby1exm07.pmc_nt.nt.pmc-sierra.bc.ca>
From:	Trevor Hamm <Trevor_Hamm@pmc-sierra.com>
To:	"'Atsushi Nemoto'" <anemo@mba.ocn.ne.jp>
Cc:	linux-mips@linux-mips.org
Subject: RE: Problems booting Linux 2.6.18.1 on MIPS34K core
Date:	Wed, 8 Nov 2006 11:09:37 -0800 
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2657.72)
Content-Type: text/plain
Return-Path: <Trevor_Hamm@pmc-sierra.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13163
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: Trevor_Hamm@pmc-sierra.com
Precedence: bulk
X-list: linux-mips

 

> -----Original Message-----
> From: Atsushi Nemoto [mailto:anemo@mba.ocn.ne.jp] 
> Sent: Wednesday, November 01, 2006 8:19 PM
> To: Trevor Hamm
> Cc: linux-mips@linux-mips.org
> Subject: Re: Problems booting Linux 2.6.18.1 on MIPS34K core
> 
> If dcache aliasing patch caused this problem, it might be due to
> missing flush_dcache_page() in squashfs.
> 
> With a quick look at squashfs/inode.c, it seems flush_dcache_page() is
> needed at end of squashfs_symlink_readpage() as other functions.
> Could you try it?
> 
> skip_read:
> 	memset(pageaddr + bytes, 0, PAGE_CACHE_SIZE - bytes);
> 	kunmap(page);
> 	flush_dcache_page(page);	/* THIS */
> 	SetPageUptodate(page);
> 	unlock_page(page);
> 
> ---
> Atsushi Nemoto
> 

Thanks for the suggestion Atsushi.  Unfortunately, this did not solve the problem.

I recently got my hands on a FS2 EJTAG probe, and with it was able to find the "exact" instruction causing the fault.  Which instruction is dependent on the particular linux image I'm using at the time, but usually happens while running /lib/ld-uClibc-0.9.28.so when starting up /sbin/init.  Typically what happens is that the program reads a pointer value out of memory (which returns 0 or some other random value), then when a later instruction attempts to use that address to load in a value, that's where it goes into an endless loop of TLBS or AdEL exceptions.  When I examine the memory contents where the program loads this pointer value from, after power-up both the main memory and cache appear to be loaded with random values, but after software reset the cache at least has values that look more like valid program addresses.

So just for fun, I built a linux image to use a write-through caching policy, and it boots from power-up every time.

With this information, I would conclude the problem is due to cache management, either in the way we're initializing the cache, or something else in the squashfs code.  Or is there another explanation that I'm overlooking?

Thanks,
Trevor

From ralf@linux-mips.org Wed Nov  8 19:23:58 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 08 Nov 2006 19:23:59 +0000 (GMT)
Received: from localhost.localdomain ([127.0.0.1]:53961 "EHLO
	dl5rb.ham-radio-op.net") by ftp.linux-mips.org with ESMTP
	id S20039502AbWKHTX6 (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 8 Nov 2006 19:23:58 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by dl5rb.ham-radio-op.net (8.13.8/8.13.8) with ESMTP id kA8JOMsf008430;
	Wed, 8 Nov 2006 19:24:23 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.8/8.13.8/Submit) id kA8JOKeG008429;
	Wed, 8 Nov 2006 19:24:20 GMT
Date:	Wed, 8 Nov 2006 19:24:20 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	Trevor Hamm <Trevor_Hamm@pmc-sierra.com>
Cc:	"'Atsushi Nemoto'" <anemo@mba.ocn.ne.jp>, linux-mips@linux-mips.org
Subject: Re: Problems booting Linux 2.6.18.1 on MIPS34K core
Message-ID: <20061108192420.GA8080@linux-mips.org>
References: <E8C8A5231DDE104C816ADF532E0639120194F4C6@bby1exm07.pmc_nt.nt.pmc-sierra.bc.ca>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <E8C8A5231DDE104C816ADF532E0639120194F4C6@bby1exm07.pmc_nt.nt.pmc-sierra.bc.ca>
User-Agent: Mutt/1.4.2.2i
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13164
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: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Wed, Nov 08, 2006 at 11:09:37AM -0800, Trevor Hamm wrote:

> So just for fun, I built a linux image to use a write-through caching policy, and it boots from power-up every time.
> 
> With this information, I would conclude the problem is due to cache management, either in the way we're initializing the cache, or something else in the squashfs code.  Or is there another explanation that I'm overlooking?

Does your processor have cache aliases?

  Ralf

From Trevor_Hamm@pmc-sierra.com Wed Nov  8 19:51:27 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 08 Nov 2006 19:51:32 +0000 (GMT)
Received: from father.pmc-sierra.com ([216.241.224.13]:50396 "HELO
	father.pmc-sierra.bc.ca") by ftp.linux-mips.org with SMTP
	id S20039625AbWKHTv1 (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 8 Nov 2006 19:51:27 +0000
Received: (qmail 27195 invoked by uid 101); 8 Nov 2006 19:51:15 -0000
Received: from unknown (HELO ogmios.pmc-sierra.bc.ca) (216.241.226.59)
  by father.pmc-sierra.com with SMTP; 8 Nov 2006 19:51:15 -0000
Received: from bby1exi01.pmc_nt.nt.pmc-sierra.bc.ca (bby1exi01.pmc-sierra.bc.ca [216.241.231.251])
	by ogmios.pmc-sierra.bc.ca (8.13.3/8.12.7) with ESMTP id kA8JpEkZ017838;
	Wed, 8 Nov 2006 11:51:14 -0800
Received: by bby1exi01.pmc-sierra.bc.ca with Internet Mail Service (5.5.2657.72)
	id <VY7R9BZT>; Wed, 8 Nov 2006 11:51:14 -0800
Message-ID: <E8C8A5231DDE104C816ADF532E0639120194F4C8@bby1exm07.pmc_nt.nt.pmc-sierra.bc.ca>
From:	Trevor Hamm <Trevor_Hamm@pmc-sierra.com>
To:	"'Ralf Baechle'" <ralf@linux-mips.org>
Cc:	"'Atsushi Nemoto'" <anemo@mba.ocn.ne.jp>, linux-mips@linux-mips.org
Subject: RE: Problems booting Linux 2.6.18.1 on MIPS34K core
Date:	Wed, 8 Nov 2006 11:51:08 -0800 
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2657.72)
Content-Type: text/plain
Return-Path: <Trevor_Hamm@pmc-sierra.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13165
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: Trevor_Hamm@pmc-sierra.com
Precedence: bulk
X-list: linux-mips

 

> -----Original Message-----
> From: Ralf Baechle [mailto:ralf@linux-mips.org] 
> Sent: Wednesday, November 08, 2006 1:24 PM
> To: Trevor Hamm
> Cc: 'Atsushi Nemoto'; linux-mips@linux-mips.org
> Subject: Re: Problems booting Linux 2.6.18.1 on MIPS34K core
> 
> On Wed, Nov 08, 2006 at 11:09:37AM -0800, Trevor Hamm wrote:
> 
> > So just for fun, I built a linux image to use a 
> write-through caching policy, and it boots from power-up every time.
> > 
> > With this information, I would conclude the problem is due 
> to cache management, either in the way we're initializing the 
> cache, or something else in the squashfs code.  Or is there 
> another explanation that I'm overlooking?
> 
> Does your processor have cache aliases?
> 
>   Ralf
> 

Yes, we've got 64kB, 4-way caches using 4kB page size.

Trevor

From anemo@mba.ocn.ne.jp Thu Nov  9 01:58:00 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 09 Nov 2006 01:58:04 +0000 (GMT)
Received: from topsns2.toshiba-tops.co.jp ([202.230.225.126]:44845 "EHLO
	topsns2.toshiba-tops.co.jp") by ftp.linux-mips.org with ESMTP
	id S20038597AbWKIB6A (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Thu, 9 Nov 2006 01:58:00 +0000
Received: from topsms.toshiba-tops.co.jp by topsns2.toshiba-tops.co.jp
          via smtpd (for ftp.linux-mips.org [194.74.144.162]) with ESMTP; Thu, 9 Nov 2006 10:57:59 +0900
Received: from topsms.toshiba-tops.co.jp (localhost.localdomain [127.0.0.1])
	by localhost.toshiba-tops.co.jp (Postfix) with ESMTP id 2B9B123ECE;
	Thu,  9 Nov 2006 10:57:55 +0900 (JST)
Received: from srd2sd.toshiba-tops.co.jp (srd2sd.toshiba-tops.co.jp [172.17.28.2])
	by topsms.toshiba-tops.co.jp (Postfix) with ESMTP id 1817620377;
	Thu,  9 Nov 2006 10:57:55 +0900 (JST)
Received: from localhost (fragile [172.17.28.65])
	by srd2sd.toshiba-tops.co.jp (8.12.10/8.12.10) with ESMTP id kA91vqW0061048;
	Thu, 9 Nov 2006 10:57:52 +0900 (JST)
	(envelope-from anemo@mba.ocn.ne.jp)
Date:	Thu, 09 Nov 2006 10:57:52 +0900 (JST)
Message-Id: <20061109.105752.25910642.nemoto@toshiba-tops.co.jp>
To:	Trevor_Hamm@pmc-sierra.com
Cc:	linux-mips@linux-mips.org
Subject: Re: Problems booting Linux 2.6.18.1 on MIPS34K core
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
In-Reply-To: <E8C8A5231DDE104C816ADF532E0639120194F4C6@bby1exm07.pmc_nt.nt.pmc-sierra.bc.ca>
References: <E8C8A5231DDE104C816ADF532E0639120194F4C6@bby1exm07.pmc_nt.nt.pmc-sierra.bc.ca>
X-Fingerprint: 6ACA 1623 39BD 9A94 9B1A  B746 CA77 FE94 2874 D52F
X-Pgp-Public-Key: http://wwwkeys.pgp.net/pks/lookup?op=get&search=0x2874D52F
X-Mailer: Mew version 3.3 on Emacs 21.3 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Return-Path: <anemo@mba.ocn.ne.jp>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13166
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: anemo@mba.ocn.ne.jp
Precedence: bulk
X-list: linux-mips

On Wed, 8 Nov 2006 11:09:37 -0800 , Trevor Hamm <Trevor_Hamm@pmc-sierra.com> wrote:
> So just for fun, I built a linux image to use a write-through
> caching policy, and it boots from power-up every time.
> 
> With this information, I would conclude the problem is due to cache
> management, either in the way we're initializing the cache, or
> something else in the squashfs code.  Or is there another
> explanation that I'm overlooking?

Hmm, could you try init=/bin/sh?  If the shell invoked successfully it
might be COW issue.  In this case, could you try deleting
__HAVE_ARCH_COPY_USER_HIGHPAGE in include/asm-mips/page.h?

If init=/bin/sh not worked, COW is irrelevant and something would be
wrong around flush_dcache_page/update_mmu_cache.  But no idea now ...

---
Atsushi Nemoto

From barrioskmc@gmail.com Thu Nov  9 05:57:02 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 09 Nov 2006 05:57:08 +0000 (GMT)
Received: from wx-out-0506.google.com ([66.249.82.231]:50026 "EHLO
	wx-out-0506.google.com") by ftp.linux-mips.org with ESMTP
	id S20038429AbWKIF5C (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Thu, 9 Nov 2006 05:57:02 +0000
Received: by wx-out-0506.google.com with SMTP id t14so87860wxc
        for <linux-mips@linux-mips.org>; Wed, 08 Nov 2006 21:56:59 -0800 (PST)
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws;
        s=beta; d=gmail.com;
        h=received:from:to:cc:subject:date:message-id:mime-version:content-type:content-transfer-encoding:x-mailer:x-mimeole:thread-index;
        b=KOHDpw4dHbqED4SYLukXkX3/yKvBwrXFaCLp47he32mhz+tCzo6s7/E27N93bwBEFQIc0Dk7aikvNt9dKiXuXgGJCoH1IGhiW5m2UcdjMUxPLPzqrdczyHEMN9wuOuBmM5dK/vkbDlKSq+T/9ZTOmHHXzP7i/M3sh1IaUEjvwbY=
Received: by 10.70.32.10 with SMTP id f10mr23288wxf.1163051819558;
        Wed, 08 Nov 2006 21:56:59 -0800 (PST)
Received: from barrioswinxp ( [210.94.41.89])
        by mx.google.com with ESMTP id h13sm521630wxd.2006.11.08.21.56.57;
        Wed, 08 Nov 2006 21:56:58 -0800 (PST)
From:	=?ks_c_5601-1987?B?sei5zsL5?= <barrioskmc@gmail.com>
To:	<linux-mips@linux-mips.org>
Cc:	<ralf@linux-mips.org>
Subject: upgrade toolchain(gcc-4.1)
Date:	Thu, 9 Nov 2006 14:56:55 +0900
Message-ID: <000f01c703c3$de5d7000$45a6580a@swcenter.sec.samsung.co.kr>
MIME-Version: 1.0
Content-Type: text/plain;
	charset="ks_c_5601-1987"
Content-Transfer-Encoding: 7bit
X-Mailer: Microsoft Office Outlook 11
X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2962
Thread-index: AccCdlPhiEMmXaCGSkSTiB1vXSyW8wAhUCMAADG9wlA=
Return-Path: <barrioskmc@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13167
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: barrioskmc@gmail.com
Precedence: bulk
X-list: linux-mips


Hi all. 
Currently I use gcc-3.4.4 in my mips board. 
I want to update my toolchain(gcc, glibc, binutil etc.. ) to latest new
toolchains( for example, gcc-4.1)
But, in http://www.linux-mips.org/wiki/Toolchains, Roll-your-own is
obsolete. Also, There isn't description about glibc. 
Thanks for sharing your information. 
Best Regards.


From ralf@linux-mips.org Thu Nov  9 12:07:48 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 09 Nov 2006 12:07:50 +0000 (GMT)
Received: from localhost.localdomain ([127.0.0.1]:62849 "EHLO
	dl5rb.ham-radio-op.net") by ftp.linux-mips.org with ESMTP
	id S20037506AbWKIMHs (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Thu, 9 Nov 2006 12:07:48 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by dl5rb.ham-radio-op.net (8.13.8/8.13.8) with ESMTP id kA9C8CXx017972;
	Thu, 9 Nov 2006 12:08:12 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.8/8.13.8/Submit) id kA9C8BEc017971;
	Thu, 9 Nov 2006 12:08:11 GMT
Date:	Thu, 9 Nov 2006 12:08:11 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	=?utf-8?B?sei5zsL5?= <barrioskmc@gmail.com>
Cc:	linux-mips@linux-mips.org
Subject: Re: upgrade toolchain(gcc-4.1)
Message-ID: <20061109120811.GA17860@linux-mips.org>
References: <000f01c703c3$de5d7000$45a6580a@swcenter.sec.samsung.co.kr>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <000f01c703c3$de5d7000$45a6580a@swcenter.sec.samsung.co.kr>
User-Agent: Mutt/1.4.2.2i
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13168
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: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Thu, Nov 09, 2006 at 02:56:55PM +0900, ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ wrote:
> From:	ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ <barrioskmc@gmail.com>

> Hi all. 
> Currently I use gcc-3.4.4 in my mips board. 
> I want to update my toolchain(gcc, glibc, binutil etc.. ) to latest new
> toolchains( for example, gcc-4.1)
> But, in http://www.linux-mips.org/wiki/Toolchains, Roll-your-own is
> obsolete. Also, There isn't description about glibc. 

Updating glibc is a little non-trivial due to compatibility issues, extra
patches requires, version dependencies to the build environment and other
constraints so I deciede to drop the glibc documentation when I replaced
the old MIPS Howto document with the current size.

The good news are that the glibc world is getting somewhat simpler again
so maybe it's time to re-introduce some glibc documentation.

That said glibc will probably always stay somewhat non-trivial and most
people are probably best off by just using binaries.

  Ralf

From Trevor_Hamm@pmc-sierra.com Thu Nov  9 17:20:27 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 09 Nov 2006 17:20:32 +0000 (GMT)
Received: from mother.pmc-sierra.com ([216.241.224.12]:18099 "HELO
	mother.pmc-sierra.bc.ca") by ftp.linux-mips.org with SMTP
	id S20037722AbWKIRU0 (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Thu, 9 Nov 2006 17:20:26 +0000
Received: (qmail 5561 invoked by uid 101); 9 Nov 2006 17:20:15 -0000
Received: from unknown (HELO ogyruan.pmc-sierra.bc.ca) (216.241.226.236)
  by mother.pmc-sierra.com with SMTP; 9 Nov 2006 17:20:15 -0000
Received: from bby1exi01.pmc_nt.nt.pmc-sierra.bc.ca (bby1exi01.pmc-sierra.bc.ca [216.241.231.251])
	by ogyruan.pmc-sierra.bc.ca (8.13.3/8.12.7) with ESMTP id kA9HKFhG010411;
	Thu, 9 Nov 2006 09:20:15 -0800
Received: by bby1exi01.pmc-sierra.bc.ca with Internet Mail Service (5.5.2657.72)
	id <VY7R0LRT>; Thu, 9 Nov 2006 09:20:15 -0800
Message-ID: <E8C8A5231DDE104C816ADF532E0639120194F4CC@bby1exm07.pmc_nt.nt.pmc-sierra.bc.ca>
From:	Trevor Hamm <Trevor_Hamm@pmc-sierra.com>
To:	"'Atsushi Nemoto'" <anemo@mba.ocn.ne.jp>
Cc:	linux-mips@linux-mips.org
Subject: RE: Problems booting Linux 2.6.18.1 on MIPS34K core
Date:	Thu, 9 Nov 2006 09:20:12 -0800 
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2657.72)
Content-Type: text/plain
Return-Path: <Trevor_Hamm@pmc-sierra.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13169
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: Trevor_Hamm@pmc-sierra.com
Precedence: bulk
X-list: linux-mips

 

> -----Original Message-----
> From: Atsushi Nemoto [mailto:anemo@mba.ocn.ne.jp] 
> Sent: Wednesday, November 08, 2006 7:58 PM
> To: Trevor Hamm
> Cc: linux-mips@linux-mips.org
> Subject: Re: Problems booting Linux 2.6.18.1 on MIPS34K core
> 
> Hmm, could you try init=/bin/sh?  If the shell invoked successfully it
> might be COW issue.  

Yes, /bin/sh works.  I've also run different /sbin/init programs successfully (sysvinit, busybox; I think I mentioned sysvinit worked in my original post).  It's just with simpleinit from util-linux 2.12r that we've seen this issue.

> In this case, could you try deleting
> __HAVE_ARCH_COPY_USER_HIGHPAGE in include/asm-mips/page.h?
> 

Okay, I did this, but /sbin/init still hangs in the same place.  I also had to delete the copy_user_highpage function in arch/mips/mm/init.c to get the kernel to build.  It's now using the copy_user_highpage from include/linux/highmem.h.  I assume this was your intention?

Thanks,
Trevor

From kaz@zeugmasystems.com Thu Nov  9 19:12:00 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 09 Nov 2006 19:12:04 +0000 (GMT)
Received: from mail.zeugmasystems.com ([192.139.122.66]:54507 "EHLO
	zeugmasystems.com") by ftp.linux-mips.org with ESMTP
	id S20037733AbWKITMA convert rfc822-to-8bit (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Thu, 9 Nov 2006 19:12:00 +0000
X-MimeOLE: Produced By Microsoft Exchange V6.5
Content-class: urn:content-classes:message
MIME-Version: 1.0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 8BIT
Subject: swarm IDE fix: missing probing
Date:	Thu, 9 Nov 2006 11:11:50 -0800
Message-ID: <66910A579C9312469A7DF9ADB54A8B7D44DDBE@exchange.ZeugmaSystems.local>
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
Thread-Topic: swarm IDE fix: missing probing
Thread-Index: AccEMuj6vdk2mz7kRWqmadbYRgo3Cw==
From:	"Kaz Kylheku" <kaz@zeugmasystems.com>
To:	<linux-mips@linux-mips.org>
Return-Path: <kaz@zeugmasystems.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13170
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: kaz@zeugmasystems.com
Precedence: bulk
X-list: linux-mips

This patch is needed to bring up the compact flash IDE drive.

I think it's missing under 2.6.18 as well.


Index: linux-2.6.17.7/drivers/ide/mips/swarm.c
===================================================================
--- linux-2.6.17.7.orig/drivers/ide/mips/swarm.c	2006-11-09
12:55:20.000000000 -0800
+++ linux-2.6.17.7/drivers/ide/mips/swarm.c	2006-11-09
12:56:30.432607488 -0800
@@ -127,6 +127,7 @@
 	memcpy(hwif->io_ports, hwif->hw.io_ports,
sizeof(hwif->io_ports));
 	hwif->irq = hwif->hw.irq;
 
+	probe_hwif_init(hwif);
 	dev_set_drvdata(dev, hwif);
 
 	return 0;

From anemo@mba.ocn.ne.jp Fri Nov 10 03:16:31 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 10 Nov 2006 03:16:35 +0000 (GMT)
Received: from topsns2.toshiba-tops.co.jp ([202.230.225.126]:50768 "EHLO
	topsns2.toshiba-tops.co.jp") by ftp.linux-mips.org with ESMTP
	id S20038424AbWKJDQb (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Fri, 10 Nov 2006 03:16:31 +0000
Received: from topsms.toshiba-tops.co.jp by topsns2.toshiba-tops.co.jp
          via smtpd (for ftp.linux-mips.org [194.74.144.162]) with ESMTP; Fri, 10 Nov 2006 12:16:29 +0900
Received: from topsms.toshiba-tops.co.jp (localhost.localdomain [127.0.0.1])
	by localhost.toshiba-tops.co.jp (Postfix) with ESMTP id C9D8C205E9;
	Fri, 10 Nov 2006 12:16:26 +0900 (JST)
Received: from srd2sd.toshiba-tops.co.jp (srd2sd.toshiba-tops.co.jp [172.17.28.2])
	by topsms.toshiba-tops.co.jp (Postfix) with ESMTP id B69F02048B;
	Fri, 10 Nov 2006 12:16:26 +0900 (JST)
Received: from localhost (fragile [172.17.28.65])
	by srd2sd.toshiba-tops.co.jp (8.12.10/8.12.10) with ESMTP id kAA3GNW0066099;
	Fri, 10 Nov 2006 12:16:24 +0900 (JST)
	(envelope-from anemo@mba.ocn.ne.jp)
Date:	Fri, 10 Nov 2006 12:16:23 +0900 (JST)
Message-Id: <20061110.121623.26097731.nemoto@toshiba-tops.co.jp>
To:	Trevor_Hamm@pmc-sierra.com
Cc:	linux-mips@linux-mips.org
Subject: Re: Problems booting Linux 2.6.18.1 on MIPS34K core
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
In-Reply-To: <E8C8A5231DDE104C816ADF532E0639120194F4CC@bby1exm07.pmc_nt.nt.pmc-sierra.bc.ca>
References: <E8C8A5231DDE104C816ADF532E0639120194F4CC@bby1exm07.pmc_nt.nt.pmc-sierra.bc.ca>
X-Fingerprint: 6ACA 1623 39BD 9A94 9B1A  B746 CA77 FE94 2874 D52F
X-Pgp-Public-Key: http://wwwkeys.pgp.net/pks/lookup?op=get&search=0x2874D52F
X-Mailer: Mew version 3.3 on Emacs 21.3 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Return-Path: <anemo@mba.ocn.ne.jp>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13171
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: anemo@mba.ocn.ne.jp
Precedence: bulk
X-list: linux-mips

On Thu, 9 Nov 2006 09:20:12 -0800 , Trevor Hamm <Trevor_Hamm@pmc-sierra.com> wrote:
> > Hmm, could you try init=/bin/sh?  If the shell invoked successfully it
> > might be COW issue.  
> 
>  Yes, /bin/sh works.  I've also run different /sbin/init programs
> successfully (sysvinit, busybox; I think I mentioned sysvinit worked
> in my original post).  It's just with simpleinit from util-linux
> 2.12r that we've seen this issue.

Oh, I had missed that point.  And I realize you said the fault was
happend in /sbin/init itself.  So it should not be COW issue.

> > In this case, could you try deleting
> > __HAVE_ARCH_COPY_USER_HIGHPAGE in include/asm-mips/page.h?
> 
> Okay, I did this, but /sbin/init still hangs in the same place.  I
> also had to delete the copy_user_highpage function in
> arch/mips/mm/init.c to get the kernel to build.  It's now using the
> copy_user_highpage from include/linux/highmem.h.  I assume this was
> your intention?

Yes, then copy_user_highpage would not be guilty.  Your trial
confirmed this.  Thanks anyway.

So now I doubt flush_dcache_page/update_mmu_cache change caused your
problem, which was happen during 2.6.17.8 and 2.6.17.9.  This is a bit
inconsistent from your analysis (2.6.17.10 was OK), but in general
cache troubles are very sensitive anyway...


Could you confirm that removing whole "if (mapping ..." block from
__flush_dcache_page can hide your problem?

Or if you changed a line in __update_cache():

	int exec = (vma->vm_flags & VM_EXEC) && !cpu_has_ic_fills_f_dc;

to

	int exec = 1;

then your problem still happen?


---
Atsushi Nemoto

From ralf@linux-mips.org Fri Nov 10 13:36:53 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 10 Nov 2006 13:36:55 +0000 (GMT)
Received: from localhost.localdomain ([127.0.0.1]:12419 "EHLO
	dl5rb.ham-radio-op.net") by ftp.linux-mips.org with ESMTP
	id S20038555AbWKJNgx (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Fri, 10 Nov 2006 13:36:53 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by dl5rb.ham-radio-op.net (8.13.8/8.13.8) with ESMTP id kAADbJfX017324;
	Fri, 10 Nov 2006 13:37:20 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.8/8.13.8/Submit) id kAADbJs0017323;
	Fri, 10 Nov 2006 13:37:19 GMT
Date:	Fri, 10 Nov 2006 13:37:19 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	"Gideon Stupp (gstupp)" <gstupp@cisco.com>
Cc:	linux-mips@linux-mips.org
Subject: Re: Sync operation in atomic_add_return()
Message-ID: <20061110133719.GA10119@linux-mips.org>
References: <E98CBCB9ACC07244969BE4541EC0A78303137105@xmb-ams-33b.emea.cisco.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <E98CBCB9ACC07244969BE4541EC0A78303137105@xmb-ams-33b.emea.cisco.com>
User-Agent: Mutt/1.4.2.2i
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13172
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: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Mon, Nov 06, 2006 at 03:42:32PM +0100, Gideon Stupp (gstupp) wrote:

> I am trying to figure out why there is a sync operation in
> linux/include/asm-mips/atomic.h:atomic_add_return(). 
> I believe it was added in the linux-2.4.19 patch, but can't trace the
> reason. Can anyone help?

MIPS is a weakly ordered architecture.  In theory.  So those syncs are
required to ensure proper global ordering.  In practice only the Sibyte
SB1 and RM9000 CMPs are documented to be weakly ordered but I've never
actually observed a single reordering related bug on any MIPS
multiprocessor which may either mean no reordering happens in practice
or I'm a genious managed to fix all reordering related bugs before they
could strike.  I tend to assume the latter ;-)  On a uniprocessor these
syncs are definately not needed and I have a patch to remove the sync
for uniprocessor kernels and known to be strongly ordered SMPs waiting
for 2.6.20.

  Ralf

From ralf@linux-mips.org Fri Nov 10 13:50:14 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 10 Nov 2006 13:50:16 +0000 (GMT)
Received: from localhost.localdomain ([127.0.0.1]:47281 "EHLO
	dl5rb.ham-radio-op.net") by ftp.linux-mips.org with ESMTP
	id S20038555AbWKJNuO (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Fri, 10 Nov 2006 13:50:14 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by dl5rb.ham-radio-op.net (8.13.8/8.13.8) with ESMTP id kAADof1a017482;
	Fri, 10 Nov 2006 13:50:41 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.8/8.13.8/Submit) id kAADoetw017481;
	Fri, 10 Nov 2006 13:50:40 GMT
Date:	Fri, 10 Nov 2006 13:50:40 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	Kaz Kylheku <kaz@zeugmasystems.com>
Cc:	linux-mips@linux-mips.org
Subject: Re: Sync operation in atomic_add_return()
Message-ID: <20061110135040.GB10119@linux-mips.org>
References: <66910A579C9312469A7DF9ADB54A8B7D44D837@exchange.ZeugmaSystems.local>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <66910A579C9312469A7DF9ADB54A8B7D44D837@exchange.ZeugmaSystems.local>
User-Agent: Mutt/1.4.2.2i
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13173
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: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Mon, Nov 06, 2006 at 10:17:53AM -0800, Kaz Kylheku wrote:

> > Hi,
> > I am trying to figure out why there is a sync operation in
> > linux/include/asm-mips/atomic.h:atomic_add_return(). 
> > I believe it was added in the linux-2.4.19 patch, but can't trace the
> > reason. Can anyone help?
> 
> Is it just unwarranted paranoia? There does not appear to be a need for
> the sync within the atomic_add_return code itself.

atomic_*_return() are used as synchronization points so must imply a
memory barrier on MP.

> But it might be that the code which calls this function needs the sync.
> 
> Without looking at any code whatsoever, here is a general hypothesis.
> 
> In what situation might you /care/ about the return value of an atomic
> add?
> 
> Suppose atomic increments and decrements are being used for reference
> counting. If you know that you hold the reference to an object, you can
> call atomic_add to increase the reference count without caring about the
> return value, and no sync is needed in that situation.

For example the networking code does basically:

static inline void sock_put(struct sock *sk)
{
	if (atomic_add_and_test(-11, &sk->sk_refcnt) == 0)
		sk_free(sk);
}

> Suppose, however, that atomic_add is used to pick up a reference.
> Suppose you have a pool of ``dead'' objects with reference counts of
> zero, and want to recycle an object from such a pool. You might use
> atomic_add_return to examine the reference counts of the objects in this
> pool one by one until you get a 1 return. You might get something other
> than a 1 return if racing against another processor which is tryiing to
> pick up the same object.
> 
> In this situation, if you successfully get the object, you do want to do
> a sync, since the object is being handed off between two processors.
> Before the object was put into the pool, its fields were updated, since
> it was being cleaned up. You would not want the new owner, by chance, to
> observe stale values of those fields.
> 
> I.e., to put it briefly, atomic_add_return can have "acquire" semantics.

Correct - and depending on its use it may also have release semantics.
This applies to all atomic_*_return() functions not just atomic_add_return.

  Ralf

From sshtylyov@ru.mvista.com Fri Nov 10 18:40:18 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 10 Nov 2006 18:40:22 +0000 (GMT)
Received: from h155.mvista.com ([63.81.120.155]:34003 "EHLO imap.sh.mvista.com")
	by ftp.linux-mips.org with ESMTP id S20038621AbWKJSkS (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Fri, 10 Nov 2006 18:40:18 +0000
Received: from [192.168.1.248] (unknown [10.150.0.9])
	by imap.sh.mvista.com (Postfix) with ESMTP
	id BF4B03EBE; Fri, 10 Nov 2006 10:39:53 -0800 (PST)
Message-ID: <4554C770.10106@ru.mvista.com>
Date:	Fri, 10 Nov 2006 21:39:44 +0300
From:	Sergei Shtylyov <sshtylyov@ru.mvista.com>
Organization: MontaVista Software Inc.
User-Agent: Mozilla/5.0 (X11; U; Linux i686; rv:1.7.2) Gecko/20040803
X-Accept-Language: ru, en-us, en-gb
MIME-Version: 1.0
To:	Linux-MIPS <linux-mips@linux-mips.org>
Cc:	compudj@krystal.dyndns.org, tt-dev@shafik.org
Subject: [Fwd: [Ltt-dev] MIPS atomic operations, "sync"]
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Return-Path: <sshtylyov@ru.mvista.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13174
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: sshtylyov@ru.mvista.com
Precedence: bulk
X-list: linux-mips

Forwarding to the correct mail list...

-------- Original Message --------
Subject: [Ltt-dev] MIPS atomic operations, "sync"
Date: Fri, 10 Nov 2006 13:36:53 -0500
From: Mathieu Desnoyers <compudj@krystal.dyndns.org>
To: lkml@vger.kernel.org, ltt-dev@shafik.org

Hi,

I am currently creating a "LOCK" prefix free and memory barrier free version
of atomic.h to fulfill my tracer (LTTng) needs, which is to atomically update
per-cpu data and have a minimal performance loss.

I just came across the MIPS atomic.h and system.h implementations in 2.6.18
which brings a question :

Why are the primitives in include/asm-mips/atomic.h using the "sync"
instruction even in the UP case ? system.h cmpxchg only uses the sync in the
SMP case.

Mathieu


OpenPGP public key:              http://krystal.dyndns.org:8080/key/compudj.gpg
Key fingerprint:     8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68
_______________________________________________
Ltt-dev mailing list
Ltt-dev@listserv.shafik.org
http://listserv.shafik.org/mailman/listinfo/ltt-dev



From kaz@zeugmasystems.com Fri Nov 10 21:51:46 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 10 Nov 2006 21:51:51 +0000 (GMT)
Received: from mail.zeugmasystems.com ([192.139.122.66]:9298 "EHLO
	zeugmasystems.com") by ftp.linux-mips.org with ESMTP
	id S20038695AbWKJVvq convert rfc822-to-8bit (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Fri, 10 Nov 2006 21:51:46 +0000
X-MimeOLE: Produced By Microsoft Exchange V6.5
Content-class: urn:content-classes:message
MIME-Version: 1.0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 8BIT
Subject: RE: [Fwd: [Ltt-dev] MIPS atomic operations, "sync"]
Date:	Fri, 10 Nov 2006 13:51:38 -0800
Message-ID: <66910A579C9312469A7DF9ADB54A8B7D4822E5@exchange.ZeugmaSystems.local>
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
Thread-Topic: [Fwd: [Ltt-dev] MIPS atomic operations, "sync"]
Thread-Index: AccE99Zx9YPIosZXSVyRUJ1HYRLqigAGg3iw
From:	"Kaz Kylheku" <kaz@zeugmasystems.com>
To:	"Sergei Shtylyov" <sshtylyov@ru.mvista.com>,
	"Linux-MIPS" <linux-mips@linux-mips.org>
Cc:	<compudj@krystal.dyndns.org>, <tt-dev@shafik.org>
Return-Path: <kaz@zeugmasystems.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13175
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: kaz@zeugmasystems.com
Precedence: bulk
X-list: linux-mips

Sergei Shtylyov wrote:
> I just came across the MIPS atomic.h and system.h 
> implementations in 2.6.18
> which brings a question :
> 
> Why are the primitives in include/asm-mips/atomic.h using the "sync"
> instruction even in the UP case ? system.h cmpxchg only uses 
> the sync in the
> SMP case.

There was just a discussion about this in the mailing list. Check the
archive.

Ralf Baechle mentioned that he has a patch to remove the syncs from
uniprocessor code, so that would seem to answer your question.

Thread subject line: "Sync operation in atomic_add_return()".

From anemo@mba.ocn.ne.jp Sat Nov 11 15:07:58 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Sat, 11 Nov 2006 15:08:03 +0000 (GMT)
Received: from mba.ocn.ne.jp ([210.190.142.172]:47063 "HELO smtp.mba.ocn.ne.jp")
	by ftp.linux-mips.org with SMTP id S20038846AbWKKPH6 (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Sat, 11 Nov 2006 15:07:58 +0000
Received: from localhost (p7022-ipad11funabasi.chiba.ocn.ne.jp [219.162.42.22])
	by smtp.mba.ocn.ne.jp (Postfix) with ESMTP
	id 9F3DFB80A; Sun, 12 Nov 2006 00:07:52 +0900 (JST)
Date:	Sun, 12 Nov 2006 00:10:28 +0900 (JST)
Message-Id: <20061112.001028.41198601.anemo@mba.ocn.ne.jp>
To:	linux-mips@linux-mips.org
Cc:	ralf@linux-mips.org, sshtylyov@ru.mvista.com
Subject: [PATCH] mips hpt cleanup: make clocksource_mips public
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
X-Fingerprint: 6ACA 1623 39BD 9A94 9B1A  B746 CA77 FE94 2874 D52F
X-Pgp-Public-Key: http://wwwkeys.pgp.net/pks/lookup?op=get&search=0x2874D52F
X-Mailer: Mew version 3.3 on Emacs 21.4 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Return-Path: <anemo@mba.ocn.ne.jp>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13176
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: anemo@mba.ocn.ne.jp
Precedence: bulk
X-list: linux-mips

Note: This patch can be applied after the patch titled:
"[PATCH] mips hpt cleanup: get rid of mips_hpt_init"
in lmo linux-queue tree (or 2.6.19-rc5-mm1).


Make clocksource_mips public and get rid of mips_hpt_read,
mips_hpt_mask.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>

 arch/mips/dec/time.c                |    4 +--
 arch/mips/jmr3927/rbhma3100/setup.c |    4 +--
 arch/mips/kernel/time.c             |   42 +++++++++++++-----------------------
 arch/mips/sgi-ip27/ip27-timer.c     |    4 +--
 arch/mips/sibyte/bcm1480/time.c     |    4 +--
 arch/mips/sibyte/sb1250/time.c      |    8 +++---
 include/asm-mips/time.h             |    8 +++---
 7 files changed, 32 insertions(+), 42 deletions(-)

diff --git a/arch/mips/dec/time.c b/arch/mips/dec/time.c
index 69e424e..8b7e0c1 100644
--- a/arch/mips/dec/time.c
+++ b/arch/mips/dec/time.c
@@ -151,7 +151,7 @@ static void dec_timer_ack(void)
 	CMOS_READ(RTC_REG_C);			/* Ack the RTC interrupt.  */
 }
 
-static unsigned int dec_ioasic_hpt_read(void)
+static cycle_t dec_ioasic_hpt_read(void)
 {
 	/*
 	 * The free-running counter is 32-bit which is good for about
@@ -171,7 +171,7 @@ void __init dec_time_init(void)
 
 	if (!cpu_has_counter && IOASIC)
 		/* For pre-R4k systems we use the I/O ASIC's counter.  */
-		mips_hpt_read = dec_ioasic_hpt_read;
+		clocksource_mips.read = dec_ioasic_hpt_read;
 
 	/* Set up the rate of periodic DS1287 interrupts.  */
 	CMOS_WRITE(RTC_REF_CLCK_32KHZ | (16 - __ffs(HZ)), RTC_REG_A);
diff --git a/arch/mips/jmr3927/rbhma3100/setup.c b/arch/mips/jmr3927/rbhma3100/setup.c
index 16e5dfe..138f25e 100644
--- a/arch/mips/jmr3927/rbhma3100/setup.c
+++ b/arch/mips/jmr3927/rbhma3100/setup.c
@@ -170,7 +170,7 @@ static void jmr3927_machine_power_off(vo
 	while (1);
 }
 
-static unsigned int jmr3927_hpt_read(void)
+static cycle_t jmr3927_hpt_read(void)
 {
 	/* We assume this function is called xtime_lock held. */
 	return jiffies * (JMR3927_TIMER_CLK / HZ) + jmr3927_tmrptr->trr;
@@ -182,7 +182,7 @@ extern void rtc_ds1742_init(unsigned lon
 #endif
 static void __init jmr3927_time_init(void)
 {
-	mips_hpt_read = jmr3927_hpt_read;
+	clocksource_mips.read = jmr3927_hpt_read;
 	mips_hpt_frequency = JMR3927_TIMER_CLK;
 #ifdef USE_RTC_DS1742
 	if (jmr3927_have_nvram()) {
diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c
index 111d1ba..11aab6d 100644
--- a/arch/mips/kernel/time.c
+++ b/arch/mips/kernel/time.c
@@ -11,7 +11,6 @@
  * Free Software Foundation;  either version 2 of the  License, or (at your
  * option) any later version.
  */
-#include <linux/clocksource.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
@@ -83,7 +82,7 @@ static void null_timer_ack(void) { /* no
 /*
  * Null high precision timer functions for systems lacking one.
  */
-static unsigned int null_hpt_read(void)
+static cycle_t null_hpt_read(void)
 {
 	return 0;
 }
@@ -112,7 +111,7 @@ #endif
 /*
  * High precision timer functions for a R4k-compatible timer.
  */
-static unsigned int c0_hpt_read(void)
+static cycle_t c0_hpt_read(void)
 {
 	return read_c0_count();
 }
@@ -126,8 +125,6 @@ static void __init c0_hpt_timer_init(voi
 
 int (*mips_timer_state)(void);
 void (*mips_timer_ack)(void);
-unsigned int (*mips_hpt_read)(void);
-unsigned int mips_hpt_mask = 0xffffffff;
 
 /* last time when xtime and rtc are sync'ed up */
 static long last_rtc_update;
@@ -269,8 +266,7 @@ static struct irqaction timer_irqaction 
 
 static unsigned int __init calibrate_hpt(void)
 {
-	u64 frequency;
-	u32 hpt_start, hpt_end, hpt_count, hz;
+	cycle_t frequency, hpt_start, hpt_end, hpt_count, hz;
 
 	const int loops = HZ / 10;
 	int log_2_loops = 0;
@@ -296,28 +292,23 @@ static unsigned int __init calibrate_hpt
 	 * during the calculated number of periods between timer
 	 * interrupts.
 	 */
-	hpt_start = mips_hpt_read();
+	hpt_start = clocksource_mips.read();
 	do {
 		while (mips_timer_state());
 		while (!mips_timer_state());
 	} while (--i);
-	hpt_end = mips_hpt_read();
+	hpt_end = clocksource_mips.read();
 
-	hpt_count = (hpt_end - hpt_start) & mips_hpt_mask;
+	hpt_count = (hpt_end - hpt_start) & clocksource_mips.mask;
 	hz = HZ;
-	frequency = (u64)hpt_count * (u64)hz;
+	frequency = hpt_count * hz;
 
 	return frequency >> log_2_loops;
 }
 
-static cycle_t read_mips_hpt(void)
-{
-	return (cycle_t)mips_hpt_read();
-}
-
-static struct clocksource clocksource_mips = {
+struct clocksource clocksource_mips = {
 	.name		= "MIPS",
-	.read		= read_mips_hpt,
+	.mask		= 0xffffffff,
 	.is_continuous	= 1,
 };
 
@@ -326,7 +317,7 @@ static void __init init_mips_clocksource
 	u64 temp;
 	u32 shift;
 
-	if (!mips_hpt_frequency || mips_hpt_read == null_hpt_read)
+	if (!mips_hpt_frequency || clocksource_mips.read == null_hpt_read)
 		return;
 
 	/* Calclate a somewhat reasonable rating value */
@@ -340,7 +331,6 @@ static void __init init_mips_clocksource
 	}
 	clocksource_mips.shift = shift;
 	clocksource_mips.mult = (u32)temp;
-	clocksource_mips.mask = mips_hpt_mask;
 
 	clocksource_register(&clocksource_mips);
 }
@@ -360,19 +350,19 @@ void __init time_init(void)
 	                        -xtime.tv_sec, -xtime.tv_nsec);
 
 	/* Choose appropriate high precision timer routines.  */
-	if (!cpu_has_counter && !mips_hpt_read)
+	if (!cpu_has_counter && !clocksource_mips.read)
 		/* No high precision timer -- sorry.  */
-		mips_hpt_read = null_hpt_read;
+		clocksource_mips.read = null_hpt_read;
 	else if (!mips_hpt_frequency && !mips_timer_state) {
 		/* A high precision timer of unknown frequency.  */
-		if (!mips_hpt_read)
+		if (!clocksource_mips.read)
 			/* No external high precision timer -- use R4k.  */
-			mips_hpt_read = c0_hpt_read;
+			clocksource_mips.read = c0_hpt_read;
 	} else {
 		/* We know counter frequency.  Or we can get it.  */
-		if (!mips_hpt_read) {
+		if (!clocksource_mips.read) {
 			/* No external high precision timer -- use R4k.  */
-			mips_hpt_read = c0_hpt_read;
+			clocksource_mips.read = c0_hpt_read;
 
 			if (!mips_timer_state) {
 				/* No external timer interrupt -- use R4k.  */
diff --git a/arch/mips/sgi-ip27/ip27-timer.c b/arch/mips/sgi-ip27/ip27-timer.c
index 5e82a26..7106d54 100644
--- a/arch/mips/sgi-ip27/ip27-timer.c
+++ b/arch/mips/sgi-ip27/ip27-timer.c
@@ -239,14 +239,14 @@ void __init plat_timer_setup(struct irqa
 	setup_irq(irqno, &rt_irqaction);
 }
 
-static unsigned int ip27_hpt_read(void)
+static cycle_t ip27_hpt_read(void)
 {
 	return REMOTE_HUB_L(cputonasid(0), PI_RT_COUNT);
 }
 
 void __init ip27_time_init(void)
 {
-	mips_hpt_read = ip27_hpt_read;
+	clocksource_mips.read = ip27_hpt_read;
 	mips_hpt_frequency = CYCLES_PER_SEC;
 	xtime.tv_sec = get_m48t35_time();
 	xtime.tv_nsec = 0;
diff --git a/arch/mips/sibyte/bcm1480/time.c b/arch/mips/sibyte/bcm1480/time.c
index e136bde..26b5c29 100644
--- a/arch/mips/sibyte/bcm1480/time.c
+++ b/arch/mips/sibyte/bcm1480/time.c
@@ -119,7 +119,7 @@ void bcm1480_timer_interrupt(void)
 	}
 }
 
-static unsigned int bcm1480_hpt_read(void)
+static cycle_t bcm1480_hpt_read(void)
 {
 	/* We assume this function is called xtime_lock held. */
 	unsigned long count =
@@ -129,6 +129,6 @@ static unsigned int bcm1480_hpt_read(voi
 
 void __init bcm1480_hpt_setup(void)
 {
-	mips_hpt_read = bcm1480_hpt_read;
+	clocksource_mips.read = bcm1480_hpt_read;
 	mips_hpt_frequency = BCM1480_HPT_VALUE;
 }
diff --git a/arch/mips/sibyte/sb1250/time.c b/arch/mips/sibyte/sb1250/time.c
index bcb74f2..2efffe1 100644
--- a/arch/mips/sibyte/sb1250/time.c
+++ b/arch/mips/sibyte/sb1250/time.c
@@ -51,7 +51,7 @@ #define SB1250_HPT_VALUE	M_SCD_TIMER_CNT
 
 extern int sb1250_steal_irq(int irq);
 
-static unsigned int sb1250_hpt_read(void);
+static cycle_t sb1250_hpt_read(void);
 
 void __init sb1250_hpt_setup(void)
 {
@@ -66,8 +66,8 @@ void __init sb1250_hpt_setup(void)
 			     IOADDR(A_SCD_TIMER_REGISTER(SB1250_HPT_NUM, R_SCD_TIMER_CFG)));
 
 		mips_hpt_frequency = V_SCD_TIMER_FREQ;
-		mips_hpt_read = sb1250_hpt_read;
-		mips_hpt_mask = M_SCD_TIMER_INIT;
+		clocksource_mips.read = sb1250_hpt_read;
+		clocksource_mips.mask = M_SCD_TIMER_INIT;
 	}
 }
 
@@ -143,7 +143,7 @@ void sb1250_timer_interrupt(void)
  * The HPT is free running from SB1250_HPT_VALUE down to 0 then starts over
  * again.
  */
-static unsigned int sb1250_hpt_read(void)
+static cycle_t sb1250_hpt_read(void)
 {
 	unsigned int count;
 
diff --git a/include/asm-mips/time.h b/include/asm-mips/time.h
index b58665e..a632cef 100644
--- a/include/asm-mips/time.h
+++ b/include/asm-mips/time.h
@@ -21,6 +21,7 @@ #include <linux/linkage.h>
 #include <linux/ptrace.h>
 #include <linux/rtc.h>
 #include <linux/spinlock.h>
+#include <linux/clocksource.h>
 
 extern spinlock_t rtc_lock;
 
@@ -44,11 +45,10 @@ extern int (*mips_timer_state)(void);
 extern void (*mips_timer_ack)(void);
 
 /*
- * High precision timer functions.
- * If mips_hpt_read is NULL, an R4k-compatible timer setup is attempted.
+ * High precision timer clocksource.
+ * If .read is NULL, an R4k-compatible timer setup is attempted.
  */
-extern unsigned int (*mips_hpt_read)(void);
-extern unsigned int mips_hpt_mask;
+extern struct clocksource clocksource_mips;
 
 /*
  * to_tm() converts system time back to (year, mon, day, hour, min, sec).

From anemo@mba.ocn.ne.jp Sat Nov 11 15:10:54 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Sat, 11 Nov 2006 15:10:59 +0000 (GMT)
Received: from mba.ocn.ne.jp ([210.190.142.172]:59335 "HELO smtp.mba.ocn.ne.jp")
	by ftp.linux-mips.org with SMTP id S20038851AbWKKPKy (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Sat, 11 Nov 2006 15:10:54 +0000
Received: from localhost (p7022-ipad11funabasi.chiba.ocn.ne.jp [219.162.42.22])
	by smtp.mba.ocn.ne.jp (Postfix) with ESMTP
	id 913C4980E; Sun, 12 Nov 2006 00:10:50 +0900 (JST)
Date:	Sun, 12 Nov 2006 00:13:26 +0900 (JST)
Message-Id: <20061112.001326.108739901.anemo@mba.ocn.ne.jp>
To:	sshtylyov@ru.mvista.com
Cc:	linux-mips@linux-mips.org, ralf@linux-mips.org
Subject: Re: [PATCH] rest of works for migration to GENERIC_TIME
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
In-Reply-To: <453CE22A.5090700@ru.mvista.com>
References: <453CD3ED.8020005@ru.mvista.com>
	<20061024.003845.71086839.anemo@mba.ocn.ne.jp>
	<453CE22A.5090700@ru.mvista.com>
X-Fingerprint: 6ACA 1623 39BD 9A94 9B1A  B746 CA77 FE94 2874 D52F
X-Pgp-Public-Key: http://wwwkeys.pgp.net/pks/lookup?op=get&search=0x2874D52F
X-Mailer: Mew version 3.3 on Emacs 21.4 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Return-Path: <anemo@mba.ocn.ne.jp>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13177
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: anemo@mba.ocn.ne.jp
Precedence: bulk
X-list: linux-mips

On Mon, 23 Oct 2006 19:39:22 +0400, Sergei Shtylyov <sshtylyov@ru.mvista.com> wrote:
>     Only 3 files in the current arch/mips/ actually, excluding time.c and the 
> header file (to make it visible).
> 
> > think it would be better to do it on next -rc1 stage.
> 
>     AKA never. ;-)

A patch is ready :)

---
Atsushi Nemoto

From anemo@mba.ocn.ne.jp Sat Nov 11 16:02:25 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Sat, 11 Nov 2006 16:02:27 +0000 (GMT)
Received: from mba.ocn.ne.jp ([210.190.142.172]:50423 "HELO smtp.mba.ocn.ne.jp")
	by ftp.linux-mips.org with SMTP id S20038917AbWKKQCZ (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Sat, 11 Nov 2006 16:02:25 +0000
Received: from localhost (p7022-ipad11funabasi.chiba.ocn.ne.jp [219.162.42.22])
	by smtp.mba.ocn.ne.jp (Postfix) with ESMTP
	id BD430B729; Sun, 12 Nov 2006 01:02:20 +0900 (JST)
Date:	Sun, 12 Nov 2006 01:04:57 +0900 (JST)
Message-Id: <20061112.010457.29576510.anemo@mba.ocn.ne.jp>
To:	linux-mips@linux-mips.org
Cc:	ralf@linux-mips.org
Subject: Re: [PATCH] mips irq cleanups
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
In-Reply-To: <20061102.020836.25912635.anemo@mba.ocn.ne.jp>
References: <20061102.020836.25912635.anemo@mba.ocn.ne.jp>
X-Fingerprint: 6ACA 1623 39BD 9A94 9B1A  B746 CA77 FE94 2874 D52F
X-Pgp-Public-Key: http://wwwkeys.pgp.net/pks/lookup?op=get&search=0x2874D52F
X-Mailer: Mew version 3.3 on Emacs 21.4 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Return-Path: <anemo@mba.ocn.ne.jp>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13178
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: anemo@mba.ocn.ne.jp
Precedence: bulk
X-list: linux-mips

On Thu, 02 Nov 2006 02:08:36 +0900 (JST), Atsushi Nemoto <anemo@mba.ocn.ne.jp> wrote:
> This is a big irq cleanup patch.
> 
> * Use set_irq_chip() to register irq_chip.
> * Initialize .mask, .unmask, .mask_ack field.  Functions for these
>   method are already exist in most case.
> * Do not initialize .startup, .shutdown, .enable, .disable fields if
>   default routines provided by irq_chip_set_defaults() were suitable.
> * Remove redundant irq_desc initializations.
> * Remove unnecessary local_irq_save/local_irq_restore, spin_lock.

I missed some cleanups in irq_cpu.c.  Here is a patch against the
patch.  I can send revised whole patch if you want.


Subject: [PATCH] mips irq cleanups (missing bits in irq_cpu.c)

remove unneeded mips_cpu_irq_ack and initialize .mask_ack of
mips_cpu_irq_controller and mips_mt_cpu_irq_controller.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>

diff --git a/arch/mips/kernel/irq_cpu.c b/arch/mips/kernel/irq_cpu.c
index 79fea0f..3b7cfa4 100644
--- a/arch/mips/kernel/irq_cpu.c
+++ b/arch/mips/kernel/irq_cpu.c
@@ -50,15 +50,6 @@ static inline void mask_mips_irq(unsigne
 	irq_disable_hazard();
 }
 
-/*
- * While we ack the interrupt interrupts are disabled and thus we don't need
- * to deal with concurrency issues.  Same for mips_cpu_irq_end.
- */
-static void mips_cpu_irq_ack(unsigned int irq)
-{
-	mask_mips_irq(irq);
-}
-
 static void mips_cpu_irq_end(unsigned int irq)
 {
 	if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
@@ -67,8 +58,9 @@ static void mips_cpu_irq_end(unsigned in
 
 static struct irq_chip mips_cpu_irq_controller = {
 	.typename	= "MIPS",
-	.ack		= mips_cpu_irq_ack,
+	.ack		= mask_mips_irq,
 	.mask		= mask_mips_irq,
+	.mask_ack	= mask_mips_irq,
 	.unmask		= unmask_mips_irq,
 	.end		= mips_cpu_irq_end,
 };
@@ -110,6 +102,7 @@ static struct irq_chip mips_mt_cpu_irq_c
 	.startup	= mips_mt_cpu_irq_startup,
 	.ack		= mips_mt_cpu_irq_ack,
 	.mask		= mask_mips_mt_irq,
+	.mask_ack	= mips_mt_cpu_irq_ack,
 	.unmask		= unmask_mips_mt_irq,
 	.end		= mips_mt_cpu_irq_end,
 };

From gstupp@cisco.com Sun Nov 12 06:47:32 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Sun, 12 Nov 2006 06:47:37 +0000 (GMT)
Received: from ams-iport-1.cisco.com ([144.254.224.140]:47400 "EHLO
	ams-iport-1.cisco.com") by ftp.linux-mips.org with ESMTP
	id S20037586AbWKLGrc convert rfc822-to-8bit (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Sun, 12 Nov 2006 06:47:32 +0000
Received: from ams-dkim-2.cisco.com ([144.254.224.139])
  by ams-iport-1.cisco.com with ESMTP; 12 Nov 2006 07:46:47 +0100
X-IronPort-AV: i="4.09,414,1157320800"; 
   d="scan'208"; a="119401187:sNHT53480120"
Received: from ams-core-1.cisco.com (ams-core-1.cisco.com [144.254.224.150])
	by ams-dkim-2.cisco.com (8.12.11/8.12.11) with ESMTP id kAC6kkoX028070;
	Sun, 12 Nov 2006 07:46:46 +0100
Received: from xbh-ams-331.emea.cisco.com (xbh-ams-331.cisco.com [144.254.231.71])
	by ams-core-1.cisco.com (8.12.10/8.12.6) with ESMTP id kAC6kf4Z024956;
	Sun, 12 Nov 2006 07:46:42 +0100 (MET)
Received: from xmb-ams-33b.cisco.com ([144.254.231.86]) by xbh-ams-331.emea.cisco.com with Microsoft SMTPSVC(6.0.3790.1830);
	 Sun, 12 Nov 2006 07:46:41 +0100
X-MimeOLE: Produced By Microsoft Exchange V6.5
Content-class: urn:content-classes:message
MIME-Version: 1.0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 8BIT
Subject: RE: Sync operation in atomic_add_return()
Date:	Sun, 12 Nov 2006 07:46:39 +0100
Message-ID: <E98CBCB9ACC07244969BE4541EC0A7830317CEE5@xmb-ams-33b.emea.cisco.com>
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
Thread-Topic: Sync operation in atomic_add_return()
Thread-Index: AccBscqczM/yLc/WQ56lzFz+PK98AwAHKqogARW5gcA=
From:	"Gideon Stupp \(gstupp\)" <gstupp@cisco.com>
To:	"Kaz Kylheku" <kaz@zeugmasystems.com>
Cc:	<linux-mips@linux-mips.org>
X-OriginalArrivalTime: 12 Nov 2006 06:46:41.0400 (UTC) FILETIME=[4F66A780:01C70626]
DKIM-Signature:	v=0.5; a=rsa-sha256; q=dns/txt; l=2477; t=1163314006; x=1164178006;
	c=relaxed/simple; s=amsdkim2001;
	h=Content-Type:From:Subject:Content-Transfer-Encoding:MIME-Version;
	d=cisco.com; i=gstupp@cisco.com;
	z=From:=20=22Gideon=20Stupp=20\(gstupp\)=22=20<gstupp@cisco.com>
	|Subject:=20RE=3A=20Sync=20operation=20in=20atomic_add_return()
	|Sender:=20;
	bh=raNmksd1EaNylGSTfql4VzTlIp0fCc9Pp4PMg8aQVF0=;
	b=NnYbUoSayt8Qa0Zv18ENFNGp4nUtykXwtpiRIDSn5pXNHcDlT08em/rCUyCGUdISBeCHdnyX
	Dq/aa/c967kwroIRIJYY9loeW/uP4otcJq+RitbUKQcplOy6tvBJOov6;
Authentication-Results:	ams-dkim-2; header.From=gstupp@cisco.com; dkim=pass (
	sig from cisco.com/amsdkim2001 verified; ); 
Return-Path: <gstupp@cisco.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13179
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: gstupp@cisco.com
Precedence: bulk
X-list: linux-mips

> -----Original Message-----
> From: linux-mips-bounce@linux-mips.org 
> [mailto:linux-mips-bounce@linux-mips.org] On Behalf Of Kaz Kylheku
> Sent: Monday, November 06, 2006 8:18 PM
> To: linux-mips@linux-mips.org
> Subject: RE: Sync operation in atomic_add_return()
> 
> Gideon Stupp wrote:
> > Hi,
> > I am trying to figure out why there is a sync operation in 
> > linux/include/asm-mips/atomic.h:atomic_add_return().
> > I believe it was added in the linux-2.4.19 patch, but can't 
> trace the 
> > reason. Can anyone help?
> 
> Is it just unwarranted paranoia? There does not appear to be 
> a need for the sync within the atomic_add_return code itself.
> 
> But it might be that the code which calls this function needs 
> the sync.
> 
> Without looking at any code whatsoever, here is a general hypothesis.
> 
> In what situation might you /care/ about the return value of 
> an atomic add?
> 
> Suppose atomic increments and decrements are being used for 
> reference counting. If you know that you hold the reference 
> to an object, you can call atomic_add to increase the 
> reference count without caring about the return value, and no 
> sync is needed in that situation.
> 
> Suppose, however, that atomic_add is used to pick up a reference.
> Suppose you have a pool of ``dead'' objects with reference 
> counts of zero, and want to recycle an object from such a 
> pool. You might use atomic_add_return to examine the 
> reference counts of the objects in this pool one by one until 
> you get a 1 return. You might get something other than a 1 
> return if racing against another processor which is tryiing 
> to pick up the same object.
> 
> In this situation, if you successfully get the object, you do 
> want to do a sync, since the object is being handed off 
> between two processors.
> Before the object was put into the pool, its fields were 
> updated, since it was being cleaned up. You would not want 
> the new owner, by chance, to observe stale values of those fields.
> 
> I.e., to put it briefly, atomic_add_return can have "acquire" 
> semantics.
> 

Thanks for the reply.  I also checked the Alpha implementation ( the
only other architecture I know of with non serializing atomic operations
) and indeed there is an explicit smp_mb() in atomic_add_return() and
nowhere else.  So I guess this is the convention.

Gideon.

From sshtylyov@ru.mvista.com Sun Nov 12 19:22:24 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Sun, 12 Nov 2006 19:22:29 +0000 (GMT)
Received: from h155.mvista.com ([63.81.120.155]:29170 "EHLO imap.sh.mvista.com")
	by ftp.linux-mips.org with ESMTP id S20038477AbWKLTWY (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Sun, 12 Nov 2006 19:22:24 +0000
Received: from [192.168.1.248] (unknown [10.150.0.9])
	by imap.sh.mvista.com (Postfix) with ESMTP
	id 67DF63EBE; Sun, 12 Nov 2006 11:22:02 -0800 (PST)
Message-ID: <455774BD.6010706@ru.mvista.com>
Date:	Sun, 12 Nov 2006 22:23:41 +0300
From:	Sergei Shtylyov <sshtylyov@ru.mvista.com>
Organization: MontaVista Software Inc.
User-Agent: Mozilla/5.0 (X11; U; Linux i686; rv:1.7.2) Gecko/20040803
X-Accept-Language: ru, en-us, en-gb
MIME-Version: 1.0
To:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc:	linux-mips@linux-mips.org, ralf@linux-mips.org
Subject: Re: [PATCH] mips hpt cleanup: make clocksource_mips public
References: <20061112.001028.41198601.anemo@mba.ocn.ne.jp>
In-Reply-To: <20061112.001028.41198601.anemo@mba.ocn.ne.jp>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Return-Path: <sshtylyov@ru.mvista.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13180
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: sshtylyov@ru.mvista.com
Precedence: bulk
X-list: linux-mips

Hello.

Atsushi Nemoto wrote:
> Note: This patch can be applied after the patch titled:
> "[PATCH] mips hpt cleanup: get rid of mips_hpt_init"
> in lmo linux-queue tree (or 2.6.19-rc5-mm1).

> Make clocksource_mips public and get rid of mips_hpt_read,
> mips_hpt_mask.

    Good to see it. :-)
    I have a suggestion though...

> Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>

>  arch/mips/dec/time.c                |    4 +--
>  arch/mips/jmr3927/rbhma3100/setup.c |    4 +--
>  arch/mips/kernel/time.c             |   42 +++++++++++++-----------------------
>  arch/mips/sgi-ip27/ip27-timer.c     |    4 +--
>  arch/mips/sibyte/bcm1480/time.c     |    4 +--
>  arch/mips/sibyte/sb1250/time.c      |    8 +++---
>  include/asm-mips/time.h             |    8 +++---
>  7 files changed, 32 insertions(+), 42 deletions(-)

> diff --git a/arch/mips/dec/time.c b/arch/mips/dec/time.c
> index 69e424e..8b7e0c1 100644
> --- a/arch/mips/dec/time.c
> +++ b/arch/mips/dec/time.c
> @@ -151,7 +151,7 @@ static void dec_timer_ack(void)
>  	CMOS_READ(RTC_REG_C);			/* Ack the RTC interrupt.  */
>  }
>  
> -static unsigned int dec_ioasic_hpt_read(void)
> +static cycle_t dec_ioasic_hpt_read(void)
>  {
>  	/*
>  	 * The free-running counter is 32-bit which is good for about
> @@ -171,7 +171,7 @@ void __init dec_time_init(void)
>  
>  	if (!cpu_has_counter && IOASIC)
>  		/* For pre-R4k systems we use the I/O ASIC's counter.  */
> -		mips_hpt_read = dec_ioasic_hpt_read;
> +		clocksource_mips.read = dec_ioasic_hpt_read;

    I'd like to see clocksource_mips.name overriden there as well.

>  	/* Set up the rate of periodic DS1287 interrupts.  */
>  	CMOS_WRITE(RTC_REF_CLCK_32KHZ | (16 - __ffs(HZ)), RTC_REG_A);
> diff --git a/arch/mips/jmr3927/rbhma3100/setup.c b/arch/mips/jmr3927/rbhma3100/setup.c
> index 16e5dfe..138f25e 100644
> --- a/arch/mips/jmr3927/rbhma3100/setup.c
> +++ b/arch/mips/jmr3927/rbhma3100/setup.c
> @@ -170,7 +170,7 @@ static void jmr3927_machine_power_off(vo
>  	while (1);
>  }
>  
> -static unsigned int jmr3927_hpt_read(void)
> +static cycle_t jmr3927_hpt_read(void)
>  {
>  	/* We assume this function is called xtime_lock held. */
>  	return jiffies * (JMR3927_TIMER_CLK / HZ) + jmr3927_tmrptr->trr;
> @@ -182,7 +182,7 @@ extern void rtc_ds1742_init(unsigned lon
>  #endif
>  static void __init jmr3927_time_init(void)
>  {
> -	mips_hpt_read = jmr3927_hpt_read;
> +	clocksource_mips.read = jmr3927_hpt_read;

    And the same here as well as this is TX3927-specific timer.

>  	mips_hpt_frequency = JMR3927_TIMER_CLK;
>  #ifdef USE_RTC_DS1742
>  	if (jmr3927_have_nvram()) {
[...]
> diff --git a/arch/mips/sgi-ip27/ip27-timer.c b/arch/mips/sgi-ip27/ip27-timer.c
> index 5e82a26..7106d54 100644
> --- a/arch/mips/sgi-ip27/ip27-timer.c
> +++ b/arch/mips/sgi-ip27/ip27-timer.c
> @@ -239,14 +239,14 @@ void __init plat_timer_setup(struct irqa
>  	setup_irq(irqno, &rt_irqaction);
>  }
>  
> -static unsigned int ip27_hpt_read(void)
> +static cycle_t ip27_hpt_read(void)
>  {
>  	return REMOTE_HUB_L(cputonasid(0), PI_RT_COUNT);
>  }
>  
>  void __init ip27_time_init(void)
>  {
> -	mips_hpt_read = ip27_hpt_read;
> +	clocksource_mips.read = ip27_hpt_read;

    Again, would be good to override clocksource_mips.name here...

>  	mips_hpt_frequency = CYCLES_PER_SEC;
>  	xtime.tv_sec = get_m48t35_time();
>  	xtime.tv_nsec = 0;
> diff --git a/arch/mips/sibyte/bcm1480/time.c b/arch/mips/sibyte/bcm1480/time.c
> index e136bde..26b5c29 100644
> --- a/arch/mips/sibyte/bcm1480/time.c
> +++ b/arch/mips/sibyte/bcm1480/time.c
> @@ -119,7 +119,7 @@ void bcm1480_timer_interrupt(void)
>  	}
>  }
>  
> -static unsigned int bcm1480_hpt_read(void)
> +static cycle_t bcm1480_hpt_read(void)
>  {
>  	/* We assume this function is called xtime_lock held. */
>  	unsigned long count =
> @@ -129,6 +129,6 @@ static unsigned int bcm1480_hpt_read(voi
>  
>  void __init bcm1480_hpt_setup(void)
>  {
> -	mips_hpt_read = bcm1480_hpt_read;
> +	clocksource_mips.read = bcm1480_hpt_read;

    Here...

>  	mips_hpt_frequency = BCM1480_HPT_VALUE;
>  }
> diff --git a/arch/mips/sibyte/sb1250/time.c b/arch/mips/sibyte/sb1250/time.c
> index bcb74f2..2efffe1 100644
> --- a/arch/mips/sibyte/sb1250/time.c
> +++ b/arch/mips/sibyte/sb1250/time.c
> @@ -51,7 +51,7 @@ #define SB1250_HPT_VALUE	M_SCD_TIMER_CNT
>  
>  extern int sb1250_steal_irq(int irq);
>  
> -static unsigned int sb1250_hpt_read(void);
> +static cycle_t sb1250_hpt_read(void);
>  
>  void __init sb1250_hpt_setup(void)
>  {
> @@ -66,8 +66,8 @@ void __init sb1250_hpt_setup(void)
>  			     IOADDR(A_SCD_TIMER_REGISTER(SB1250_HPT_NUM, R_SCD_TIMER_CFG)));
>  
>  		mips_hpt_frequency = V_SCD_TIMER_FREQ;
> -		mips_hpt_read = sb1250_hpt_read;
> -		mips_hpt_mask = M_SCD_TIMER_INIT;
> +		clocksource_mips.read = sb1250_hpt_read;
> +		clocksource_mips.mask = M_SCD_TIMER_INIT;

    And here as well...

>  	}
>  }
>  

WBR, Sergei

From ralf@linux-mips.org Sun Nov 12 19:27:13 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Sun, 12 Nov 2006 19:27:15 +0000 (GMT)
Received: from localhost.localdomain ([127.0.0.1]:28876 "EHLO
	dl5rb.ham-radio-op.net") by ftp.linux-mips.org with ESMTP
	id S20038472AbWKLT1N (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Sun, 12 Nov 2006 19:27:13 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by dl5rb.ham-radio-op.net (8.13.8/8.13.8) with ESMTP id kACJRZdr018924;
	Sun, 12 Nov 2006 19:27:36 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.8/8.13.8/Submit) id kACJRVK5018923;
	Sun, 12 Nov 2006 19:27:31 GMT
Date:	Sun, 12 Nov 2006 19:27:31 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>, linux-mips@linux-mips.org
Subject: Re: [PATCH] mips hpt cleanup: make clocksource_mips public
Message-ID: <20061112192731.GA16599@linux-mips.org>
References: <20061112.001028.41198601.anemo@mba.ocn.ne.jp> <455774BD.6010706@ru.mvista.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <455774BD.6010706@ru.mvista.com>
User-Agent: Mutt/1.4.2.2i
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13181
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: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Sun, Nov 12, 2006 at 10:23:41PM +0300, Sergei Shtylyov wrote:

> > 	if (!cpu_has_counter && IOASIC)
> > 		/* For pre-R4k systems we use the I/O ASIC's counter.  */
> >-		mips_hpt_read = dec_ioasic_hpt_read;
> >+		clocksource_mips.read = dec_ioasic_hpt_read;
> 
>    I'd like to see clocksource_mips.name overriden there as well.

> > #endif
> > static void __init jmr3927_time_init(void)
> > {
> >-	mips_hpt_read = jmr3927_hpt_read;
> >+	clocksource_mips.read = jmr3927_hpt_read;
> 
>    And the same here as well as this is TX3927-specific timer.
...

The whole MIPS clocksource is only a stop gap solution until all platforms
have provided their own clocksource drivers.

  Ralf

From Mile.Davidovic@micronasnit.com Mon Nov 13 09:16:45 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 13 Nov 2006 09:16:49 +0000 (GMT)
Received: from krt.tmd.ns.ac.yu ([147.91.177.65]:58402 "HELO krt.neobee.net")
	by ftp.linux-mips.org with SMTP id S20037799AbWKMJQp (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Mon, 13 Nov 2006 09:16:45 +0000
Received: from localhost (localhost [127.0.0.1])
	by krt.neobee.net (Postfix) with ESMTP id 47463FCC53
	for <linux-mips@linux-mips.org>; Mon, 13 Nov 2006 10:16:39 +0100 (CET)
Received: from krt.neobee.net ([127.0.0.1])
 by localhost (krt.neobee.net [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id 02019-03 for <linux-mips@linux-mips.org>;
 Mon, 13 Nov 2006 10:16:38 +0100 (CET)
Received: from had (unknown [192.168.0.92])
	by krt.neobee.net (Postfix) with ESMTP id 8E57AFCC52
	for <linux-mips@linux-mips.org>; Mon, 13 Nov 2006 10:16:38 +0100 (CET)
From:	"Mile Davidovic" <Mile.Davidovic@micronasnit.com>
To:	<linux-mips@linux-mips.org>
Subject: Uncached mmap
Date:	Mon, 13 Nov 2006 10:18:52 +0100
Message-ID: <001201c70704$bc731230$5c00a8c0@niit.micronasnit.com>
MIME-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Mailer: Microsoft Office Outlook 11
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962
Thread-Index: AccHBLwkgp9Y/8vEQMebBTkgYIALGw==
Return-Path: <Mile.Davidovic@micronasnit.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13182
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: Mile.Davidovic@micronasnit.com
Precedence: bulk
X-list: linux-mips

Hello to all,
I am working on fb device and I have general questions regarding cache/uncache
access to MIPS memory. 

User space application use mmap access for r/w access to fb device. If fb use
cached memory, user space application has to call cacheflush to flush contents
instruction and/or data cache. In this case there are no limitations regarding
byte access to this memory. Is this correct statement?

If fb use uncached memory, there is no need for cacheflush call in user space
application but limitation is access to mmap uncached memory. There is no byte
access to uncached mmaped memory. Is this correct statement?


Many thanks in advance.
Best regards Mile


From ralf@linux-mips.org Mon Nov 13 12:32:09 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 13 Nov 2006 12:32:11 +0000 (GMT)
Received: from localhost.localdomain ([127.0.0.1]:52948 "EHLO
	dl5rb.ham-radio-op.net") by ftp.linux-mips.org with ESMTP
	id S20038324AbWKMMcJ (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Mon, 13 Nov 2006 12:32:09 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by dl5rb.ham-radio-op.net (8.13.8/8.13.8) with ESMTP id kADCWYTB020584;
	Mon, 13 Nov 2006 12:32:34 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.8/8.13.8/Submit) id kADCWX5k020583;
	Mon, 13 Nov 2006 12:32:33 GMT
Date:	Mon, 13 Nov 2006 12:32:33 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	Mile Davidovic <Mile.Davidovic@micronasnit.com>
Cc:	linux-mips@linux-mips.org
Subject: Re: Uncached mmap
Message-ID: <20061113123233.GA20337@linux-mips.org>
References: <001201c70704$bc731230$5c00a8c0@niit.micronasnit.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <001201c70704$bc731230$5c00a8c0@niit.micronasnit.com>
User-Agent: Mutt/1.4.2.2i
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13183
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: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Mon, Nov 13, 2006 at 10:18:52AM +0100, Mile Davidovic wrote:

> Hello to all,
> I am working on fb device and I have general questions regarding cache/uncache
> access to MIPS memory. 
> 
> User space application use mmap access for r/w access to fb device. If fb use
> cached memory, user space application has to call cacheflush to flush contents
> instruction and/or data cache. In this case there are no limitations regarding
> byte access to this memory. Is this correct statement?

Yes.

With caching bus transfers from and to the device happen at the full width
of the bus, so a device won't see byte accesses ever.

> If fb use uncached memory, there is no need for cacheflush call in user space
> application but limitation is access to mmap uncached memory.

Correct.

> There is no byte access to uncached mmaped memory. Is this correct statement?

Definately wrong.  For example alot of mmapped I/O devices use uncached
byte accesses.

This stament if of course limited to the CPU's part of the system.  Devices
may have their specific restrictions on access size and its not uncommon to
have such restrictions though that would seem unlikely for framebuffer
memory.

If your particular CPU support it you may want to use cache mode "uncached
accellerated" for a framebuffer.  It should deliver significtn performance
gains yet avoid the need for cache flushes.

  Ralf

From anemo@mba.ocn.ne.jp Mon Nov 13 13:35:30 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 13 Nov 2006 13:35:35 +0000 (GMT)
Received: from mba.ocn.ne.jp ([210.190.142.172]:26362 "HELO smtp.mba.ocn.ne.jp")
	by ftp.linux-mips.org with SMTP id S20038440AbWKMNfa (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Mon, 13 Nov 2006 13:35:30 +0000
Received: from localhost (p3040-ipad01funabasi.chiba.ocn.ne.jp [61.207.77.40])
	by smtp.mba.ocn.ne.jp (Postfix) with ESMTP
	id 01468B7EE; Mon, 13 Nov 2006 22:35:23 +0900 (JST)
Date:	Mon, 13 Nov 2006 22:38:00 +0900 (JST)
Message-Id: <20061113.223800.98359482.anemo@mba.ocn.ne.jp>
To:	sshtylyov@ru.mvista.com
Cc:	linux-mips@linux-mips.org, ralf@linux-mips.org
Subject: Re: [PATCH] mips hpt cleanup: make clocksource_mips public
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
In-Reply-To: <455774BD.6010706@ru.mvista.com>
References: <20061112.001028.41198601.anemo@mba.ocn.ne.jp>
	<455774BD.6010706@ru.mvista.com>
X-Fingerprint: 6ACA 1623 39BD 9A94 9B1A  B746 CA77 FE94 2874 D52F
X-Pgp-Public-Key: http://wwwkeys.pgp.net/pks/lookup?op=get&search=0x2874D52F
X-Mailer: Mew version 3.3 on Emacs 21.4 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Return-Path: <anemo@mba.ocn.ne.jp>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13184
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: anemo@mba.ocn.ne.jp
Precedence: bulk
X-list: linux-mips

On Sun, 12 Nov 2006 22:23:41 +0300, Sergei Shtylyov <sshtylyov@ru.mvista.com> wrote:
>     Good to see it. :-)
>     I have a suggestion though...

Thank you for review.

> > -		mips_hpt_read = dec_ioasic_hpt_read;
> > +		clocksource_mips.read = dec_ioasic_hpt_read;
> 
>     I'd like to see clocksource_mips.name overriden there as well.

Yes now it is possible without touching generic code.  You can do it
if you wanted.  I do not have strong feeling for custom name :)

Main purpose of this patch is to remove mips_hpt_read (which saves a
few cycles).

---
Atsushi Nemoto

From sshtylyov@ru.mvista.com Mon Nov 13 13:43:23 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 13 Nov 2006 13:43:28 +0000 (GMT)
Received: from h155.mvista.com ([63.81.120.155]:18444 "EHLO imap.sh.mvista.com")
	by ftp.linux-mips.org with ESMTP id S20038444AbWKMNnX (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Mon, 13 Nov 2006 13:43:23 +0000
Received: from [192.168.1.248] (unknown [10.150.0.9])
	by imap.sh.mvista.com (Postfix) with ESMTP
	id 802913EBE; Mon, 13 Nov 2006 05:43:16 -0800 (PST)
Message-ID: <455876D7.2010501@ru.mvista.com>
Date:	Mon, 13 Nov 2006 16:44:55 +0300
From:	Sergei Shtylyov <sshtylyov@ru.mvista.com>
Organization: MontaVista Software Inc.
User-Agent: Mozilla/5.0 (X11; U; Linux i686; rv:1.7.2) Gecko/20040803
X-Accept-Language: ru, en-us, en-gb
MIME-Version: 1.0
To:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc:	linux-mips@linux-mips.org, ralf@linux-mips.org
Subject: Re: [PATCH] mips hpt cleanup: make clocksource_mips public
References: <20061112.001028.41198601.anemo@mba.ocn.ne.jp>	<455774BD.6010706@ru.mvista.com> <20061113.223800.98359482.anemo@mba.ocn.ne.jp>
In-Reply-To: <20061113.223800.98359482.anemo@mba.ocn.ne.jp>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Return-Path: <sshtylyov@ru.mvista.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13185
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: sshtylyov@ru.mvista.com
Precedence: bulk
X-list: linux-mips

Hello.

Atsushi Nemoto wrote:

>>>-		mips_hpt_read = dec_ioasic_hpt_read;
>>>+		clocksource_mips.read = dec_ioasic_hpt_read;
>>
>>    I'd like to see clocksource_mips.name overriden there as well.

    And also I forgot about that clocksource continuity thing: TX3927 and 
other clocksource making use of jiffies should not be considered countinous. 
This is not an issue though, till GENERIC_CLOCKEVENTS are ported to these 
platforms...

> Yes now it is possible without touching generic code.  You can do it
> if you wanted.  I do not have strong feeling for custom name :)

   Well, it seems Ralf wants this to be converted into serveral clocksources 
eventually...

> ---
> Atsushi Nemoto

WBR, Sergei

From steve.carren@gmail.com Mon Nov 13 15:06:48 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 13 Nov 2006 15:06:52 +0000 (GMT)
Received: from nf-out-0910.google.com ([64.233.182.188]:6920 "EHLO
	nf-out-0910.google.com") by ftp.linux-mips.org with ESMTP
	id S20038493AbWKMPGs (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Mon, 13 Nov 2006 15:06:48 +0000
Received: by nf-out-0910.google.com with SMTP id l24so2027776nfc
        for <linux-mips@linux-mips.org>; Mon, 13 Nov 2006 07:06:45 -0800 (PST)
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws;
        s=beta; d=gmail.com;
        h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition;
        b=Eu++uvNEvkff4Q0Fu9ylYc+DdRK0jnSKrjK6lGJeoAslGFrA65my2mO1ttsnpQw65v8cEcPaDoJ7yYcDEp52atx7RhEqRjExmYqBGf8/FdM+wjQnv9MJvvBVOQFrOijQAaW4kOtVWUe39ANeEdaKruo+GSAczEN4qEgl30mwEFI=
Received: by 10.48.142.8 with SMTP id p8mr9992481nfd.1163430404743;
        Mon, 13 Nov 2006 07:06:44 -0800 (PST)
Received: by 10.48.163.3 with HTTP; Mon, 13 Nov 2006 07:06:44 -0800 (PST)
Message-ID: <2e134a330611130706u4b8da444w469b88e96d3c55f0@mail.gmail.com>
Date:	Mon, 13 Nov 2006 10:06:44 -0500
From:	"s c" <steve.carren@gmail.com>
To:	linux-mips@linux-mips.org
Subject: au1500 USB does not recover from flash drive removal during operations
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Return-Path: <steve.carren@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13186
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: steve.carren@gmail.com
Precedence: bulk
X-list: linux-mips

Hello All,

I was testing the USB capabilities of the au1500 and discovered that
when a USB flash drive is removed during a copy operation twice, the
USB host controller/root hub will no longer detect if the device is
plugged in a third time.  I am assuming there is a bug in the au1xxx
parts of the USB drivers because Linux has been able to handle this
case for some time with the standard  EHCI/OHCI/UHCI host controllers.

I am testing using the dbau1500 development board and the 2.6.12
kernel with the fs in ram.

I would be interested if anyone has experienced anything similar with
the au1500 and the 2.6.12 or other (earlier or later) kernels.

The test goes something like this:

Plug in the USB drive - it gets detected.

(it does not seem to matter whether the drive is mounted or not, I
tested both ways.)

At the command prompt:
#dd if=/dev/zero of=/dev/sda bs=1k count=50k

after some time un-plug the drive.

Error messages (too many to post)

Repeat

Third time device is not detected.

I did not want to post a huge list of error messages, but I did notice
differences between the first and second try.

In the first, I got a lot of "rejecting I/O to device being removed"
from scsi, while after the second removal I did not. Instead I got a
lot of "Buffer I/O error on device sda" from scsi.

I am actively looking in to the problem and wanted to post to the list
in case someone else had come across this behaviour. I could list the
error messages if anyone is interested.

Any feedback would be appreciated.

Thanks

From Mile.Davidovic@micronasnit.com Mon Nov 13 15:27:54 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 13 Nov 2006 15:27:58 +0000 (GMT)
Received: from krt.tmd.ns.ac.yu ([147.91.177.65]:10595 "HELO krt.neobee.net")
	by ftp.linux-mips.org with SMTP id S20037875AbWKMP1y (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Mon, 13 Nov 2006 15:27:54 +0000
Received: from localhost (localhost [127.0.0.1])
	by krt.neobee.net (Postfix) with ESMTP id BBCD5A5F7B;
	Mon, 13 Nov 2006 16:27:50 +0100 (CET)
Received: from krt.neobee.net ([127.0.0.1])
 by localhost (krt.neobee.net [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id 14023-06; Mon, 13 Nov 2006 16:27:47 +0100 (CET)
Received: from had (unknown [192.168.0.92])
	by krt.neobee.net (Postfix) with ESMTP id 87C388F3D8;
	Mon, 13 Nov 2006 16:27:47 +0100 (CET)
From:	"Mile Davidovic" <Mile.Davidovic@micronasnit.com>
To:	<linux-mips@linux-mips.org>
Cc:	"'Ralf Baechle'" <ralf@linux-mips.org>
Subject: RE: Uncached mmap
Date:	Mon, 13 Nov 2006 16:30:26 +0100
Message-ID: <002101c70738$a4974ad0$5c00a8c0@niit.micronasnit.com>
MIME-Version: 1.0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Mailer: Microsoft Office Outlook 11
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962
Thread-Index: AccHH9YOr1x418tdT9Clo10n00/ztgAA+0+Q
In-Reply-To: <20061113123233.GA20337@linux-mips.org>
Return-Path: <Mile.Davidovic@micronasnit.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13187
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: Mile.Davidovic@micronasnit.com
Precedence: bulk
X-list: linux-mips


Hello again,
first I want to thank You for Your fast answer. I work on MIPS 4Kec with linux
kernel in version 2.6.15 from linux-mips (gcc 4.0.3 and gcc 3.4.3).

>> There is no byte access to uncached mmaped memory. Is this correct statement?
>Definately wrong.  For example alot of mmapped I/O devices use uncached
>byte accesses.

Ok, in that case I have problem with byte access on mmaped uncached memory. 
Reason for previous post is next:
If I write bytes to mmaped uncached memory like:
...
ptr = (unsigned char*)mmap(0,lineSize,PROT_READ|PROT_WRITE,MAP_SHARED,fd0,0);
...
for (i = 0; i < 12; i++) 
   *ptr++ = 0xaa;

this loop will not write all bytes correctly (every 4 bytes will have 0xaa as
value), here is dump from Lauterbach debugger:
___address__|_0________4________8________C________0123456789ABCDEF
  D:83660000|>FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF ................
  D:83660010| 000000AA 000000AA 000000AA 0000AA02 ................

and if I use bigger loop
for (i = 0; i < 20; i++) 
   *ptr++ = 0xaa;
My linux will be crashed on 13 write. So, this is reason why I thought that
byte access is not allowed on mmaped uncached memory. 

Is it possible that problem with byte access is related with device mmap
function?

>This stament if of course limited to the CPU's part of the system.  Devices
>may have their specific restrictions on access size and its not uncommon to
>have such restrictions though that would seem unlikely for framebuffer
>memory.

Ok, I understood this.

>If your particular CPU support it you may want to use cache mode "uncached
>accellerated" for a framebuffer.  It should deliver significtn performance
>gains yet avoid the need for cache flushes.



Thanks in advance
Mile


From ashlesha@kenati.com Mon Nov 13 20:58:40 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 13 Nov 2006 20:58:50 +0000 (GMT)
Received: from [69.90.147.196] ([69.90.147.196]:55427 "EHLO mail.kenati.com")
	by ftp.linux-mips.org with ESMTP id S20040370AbWKMSfi (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Mon, 13 Nov 2006 18:35:38 +0000
Received: from [192.168.1.169] (adsl-71-130-109-177.dsl.snfc21.pacbell.net [71.130.109.177])
	by mail.kenati.com (Postfix) with ESMTP id AC99BE4052
	for <linux-mips@linux-mips.org>; Mon, 13 Nov 2006 12:02:40 -0800 (PST)
Subject: Portmap on the Encore M3
From:	Ashlesha Shintre <ashlesha@kenati.com>
Reply-To: ashlesha@kenati.com
To:	linux-mips@linux-mips.org
Content-Type: text/plain
Date:	Mon, 13 Nov 2006 10:46:47 -0800
Message-Id: <1163443607.6532.9.camel@sandbar.kenati.com>
Mime-Version: 1.0
X-Mailer: Evolution 2.4.2.1 
Content-Transfer-Encoding: 7bit
Return-Path: <ashlesha@kenati.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13188
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: ashlesha@kenati.com
Precedence: bulk
X-list: linux-mips

Hi,

I get the following error after the NFS is mounted and the kernel frees
136k of memory:



> >
> RPC: sendmsg returned error 128.
> <4>nfs: RPC call returned error 128 
> 

I m trying to boot the 2.6.14.6 kernel onto the Encore M3 board that has
the MIPS AU1500 processor on it.

The .config file contains the following line: CONFIG_PORTMAP=y
The server from which the NFS is mounted is also running the portmap
daemon..

Is there a way to check if the portmap server is functioning properly?


Also:

- The BogoMIPS value is 7186 which seems too low for the AU1500 -- how
can I check that the timer interrupt is being handled correctly?  The
AU1500 has 2 counters which are used to generate a clock

- On the serial console I can only see messages upto this point:


> 16.35 BogoMIPS (lpj=8176)
> calibrate delay done
> anon vma init done
> Mount-cache hash table entries: 512
> Checking for 'wait' instruction...  unavailable.
> NET: Registered protocol family 16
> size of au1xxx platform devices is 1

After this, the serial console 'hangs' -- I can see the RPC error from the log buffer, accessed from the JTAG port..
--Please give any suggestions as to where I should start looking to narrow down and figure out the problem..

Thank you!
Ashlesha.

Kenati Technologies
Suite #220 
800 W California Ave
Sunnyvale 
94086 CA



From anemo@mba.ocn.ne.jp Mon Nov 13 21:00:16 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 13 Nov 2006 21:00:28 +0000 (GMT)
Received: from mba.ocn.ne.jp ([210.190.142.172]:45537 "HELO smtp.mba.ocn.ne.jp")
	by ftp.linux-mips.org with SMTP id S20039106AbWKMQKw (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Mon, 13 Nov 2006 16:10:52 +0000
Received: from localhost (p3040-ipad01funabasi.chiba.ocn.ne.jp [61.207.77.40])
	by smtp.mba.ocn.ne.jp (Postfix) with ESMTP
	id EB736AE71; Tue, 14 Nov 2006 01:10:40 +0900 (JST)
Date:	Tue, 14 Nov 2006 01:13:18 +0900 (JST)
Message-Id: <20061114.011318.99611303.anemo@mba.ocn.ne.jp>
To:	linux-mips@linux-mips.org
Cc:	ralf@linux-mips.org
Subject: [PATCH] use generic_handle_irq, handle_level_irq, handle_percpu_irq
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
X-Fingerprint: 6ACA 1623 39BD 9A94 9B1A  B746 CA77 FE94 2874 D52F
X-Pgp-Public-Key: http://wwwkeys.pgp.net/pks/lookup?op=get&search=0x2874D52F
X-Mailer: Mew version 3.3 on Emacs 21.4 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Return-Path: <anemo@mba.ocn.ne.jp>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13189
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: anemo@mba.ocn.ne.jp
Precedence: bulk
X-list: linux-mips

Note: This patch can be applied after the patch titled:
"[PATCH] mips irq cleanups"
in lmo linux-queue tree (or 2.6.19-rc5-mm1) and the patch titled:
"[PATCH] do_IRQ cleanup"
(http://www.linux-mips.org/archives/linux-mips/2006-10/msg00348.html)


Further incorporation of generic irq framework.  Replacing __do_IRQ()
by proper flow handler would make the irq handling path a bit simpler
and faster.

* use generic_handle_irq() instead of __do_IRQ().
* use handle_level_irq for obvious level-type irq chips.
* use handle_percpu_irq for irqs marked as IRQ_PER_CPU.
* setup .eoi routine for irq chips possibly used with handle_percpu_irq.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>

 arch/mips/dec/ioasic-irq.c                               |    6 ++++--
 arch/mips/dec/kn02-irq.c                                 |    2 +-
 arch/mips/emma2rh/common/irq_emma2rh.c                   |    3 ++-
 arch/mips/emma2rh/markeins/irq_markeins.c                |    3 ++-
 arch/mips/jazz/irq.c                                     |    2 +-
 arch/mips/kernel/irq-msc01.c                             |    2 ++
 arch/mips/kernel/irq-mv6434x.c                           |    3 ++-
 arch/mips/kernel/irq-rm7000.c                            |    3 ++-
 arch/mips/kernel/irq-rm9000.c                            |    6 ++++--
 arch/mips/kernel/irq_cpu.c                               |    5 ++++-
 arch/mips/kernel/smp-mt.c                                |    2 ++
 arch/mips/kernel/smtc.c                                  |    1 +
 arch/mips/lasat/interrupt.c                              |    2 +-
 arch/mips/mips-boards/atlas/atlas_int.c                  |    3 ++-
 arch/mips/mips-boards/generic/time.c                     |    3 ++-
 arch/mips/mips-boards/sim/sim_time.c                     |    3 ++-
 arch/mips/momentum/ocelot_c/cpci-irq.c                   |    2 +-
 arch/mips/momentum/ocelot_c/uart-irq.c                   |    4 ++--
 arch/mips/philips/pnx8550/common/int.c                   |   12 +++++++-----
 arch/mips/sgi-ip22/ip22-int.c                            |    2 +-
 arch/mips/sgi-ip27/ip27-irq.c                            |    2 +-
 arch/mips/sgi-ip27/ip27-timer.c                          |    3 ++-
 arch/mips/tx4927/common/tx4927_irq.c                     |    6 ++++--
 arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c |    3 ++-
 arch/mips/tx4938/common/irq.c                            |    6 ++++--
 arch/mips/tx4938/toshiba_rbtx4938/irq.c                  |    3 ++-
 arch/mips/vr41xx/common/icu.c                            |    6 ++++--
 include/asm-mips/irq.h                                   |    2 +-
 28 files changed, 65 insertions(+), 35 deletions(-)

diff --git a/arch/mips/dec/ioasic-irq.c b/arch/mips/dec/ioasic-irq.c
index d0af08b..269b22b 100644
--- a/arch/mips/dec/ioasic-irq.c
+++ b/arch/mips/dec/ioasic-irq.c
@@ -103,9 +103,11 @@ void __init init_ioasic_irqs(int base)
 	fast_iob();
 
 	for (i = base; i < base + IO_INR_DMA; i++)
-		set_irq_chip(i, &ioasic_irq_type);
+		set_irq_chip_and_handler(i, &ioasic_irq_type,
+					 handle_level_irq);
 	for (; i < base + IO_IRQ_LINES; i++)
-		set_irq_chip(i, &ioasic_dma_irq_type);
+		set_irq_chip_and_handler(i, &ioasic_dma_irq_type,
+					 handle_level_irq);
 
 	ioasic_irq_base = base;
 }
diff --git a/arch/mips/dec/kn02-irq.c b/arch/mips/dec/kn02-irq.c
index c761d97..5a9be4c 100644
--- a/arch/mips/dec/kn02-irq.c
+++ b/arch/mips/dec/kn02-irq.c
@@ -85,7 +85,7 @@ void __init init_kn02_irqs(int base)
 	iob();
 
 	for (i = base; i < base + KN02_IRQ_LINES; i++)
-		set_irq_chip(i, &kn02_irq_type);
+		set_irq_chip_and_handler(i, &kn02_irq_type, handle_level_irq);
 
 	kn02_irq_base = base;
 }
diff --git a/arch/mips/emma2rh/common/irq_emma2rh.c b/arch/mips/emma2rh/common/irq_emma2rh.c
index bf1b83b..59b9829 100644
--- a/arch/mips/emma2rh/common/irq_emma2rh.c
+++ b/arch/mips/emma2rh/common/irq_emma2rh.c
@@ -76,7 +76,8 @@ void emma2rh_irq_init(u32 irq_base)
 	u32 i;
 
 	for (i = irq_base; i < irq_base + NUM_EMMA2RH_IRQ; i++)
-		set_irq_chip(i, &emma2rh_irq_controller);
+		set_irq_chip_and_handler(i, &emma2rh_irq_controller,
+					 handle_level_irq);
 
 	emma2rh_irq_base = irq_base;
 }
diff --git a/arch/mips/emma2rh/markeins/irq_markeins.c b/arch/mips/emma2rh/markeins/irq_markeins.c
index 8e5f08a..3ac4e40 100644
--- a/arch/mips/emma2rh/markeins/irq_markeins.c
+++ b/arch/mips/emma2rh/markeins/irq_markeins.c
@@ -68,7 +68,8 @@ void emma2rh_sw_irq_init(u32 irq_base)
 	u32 i;
 
 	for (i = irq_base; i < irq_base + NUM_EMMA2RH_IRQ_SW; i++)
-		set_irq_chip(i, &emma2rh_sw_irq_controller);
+		set_irq_chip_and_handler(i, &emma2rh_sw_irq_controller,
+					 handle_level_irq);
 
 	emma2rh_sw_irq_base = irq_base;
 }
diff --git a/arch/mips/jazz/irq.c b/arch/mips/jazz/irq.c
index 4bbb6cb..5c4f50c 100644
--- a/arch/mips/jazz/irq.c
+++ b/arch/mips/jazz/irq.c
@@ -59,7 +59,7 @@ void __init init_r4030_ints(void)
 	int i;
 
 	for (i = JAZZ_PARALLEL_IRQ; i <= JAZZ_TIMER_IRQ; i++)
-		set_irq_chip(i, &r4030_irq_type);
+		set_irq_chip_and_handler(i, &r4030_irq_type, handle_level_irq);
 
 	r4030_write_reg16(JAZZ_IO_IRQ_ENABLE, 0);
 	r4030_read_reg16(JAZZ_IO_IRQ_SOURCE);		/* clear pending IRQs */
diff --git a/arch/mips/kernel/irq-msc01.c b/arch/mips/kernel/irq-msc01.c
index e1880b2..bcaad66 100644
--- a/arch/mips/kernel/irq-msc01.c
+++ b/arch/mips/kernel/irq-msc01.c
@@ -117,6 +117,7 @@ struct irq_chip msc_levelirq_type = {
 	.mask = mask_msc_irq,
 	.mask_ack = level_mask_and_ack_msc_irq,
 	.unmask = unmask_msc_irq,
+	.eoi = unmask_msc_irq,
 	.end = end_msc_irq,
 };
 
@@ -126,6 +127,7 @@ struct irq_chip msc_edgeirq_type = {
 	.mask = mask_msc_irq,
 	.mask_ack = edge_mask_and_ack_msc_irq,
 	.unmask = unmask_msc_irq,
+	.eoi = unmask_msc_irq,
 	.end = end_msc_irq,
 };
 
diff --git a/arch/mips/kernel/irq-mv6434x.c b/arch/mips/kernel/irq-mv6434x.c
index 5012b9d..6cfb31c 100644
--- a/arch/mips/kernel/irq-mv6434x.c
+++ b/arch/mips/kernel/irq-mv6434x.c
@@ -114,7 +114,8 @@ void __init mv64340_irq_init(unsigned in
 	int i;
 
 	for (i = base; i < base + 64; i++)
-		set_irq_chip(i, &mv64340_irq_type);
+		set_irq_chip_and_handler(i, &mv64340_irq_type,
+					 handle_level_irq);
 
 	irq_base = base;
 }
diff --git a/arch/mips/kernel/irq-rm7000.c b/arch/mips/kernel/irq-rm7000.c
index 6a297e3..ddcc2a5 100644
--- a/arch/mips/kernel/irq-rm7000.c
+++ b/arch/mips/kernel/irq-rm7000.c
@@ -51,7 +51,8 @@ void __init rm7k_cpu_irq_init(int base)
 	clear_c0_intcontrol(0x00000f00);		/* Mask all */
 
 	for (i = base; i < base + 4; i++)
-		set_irq_chip(i, &rm7k_irq_controller);
+		set_irq_chip_and_handler(i, &rm7k_irq_controller,
+					 handle_level_irq);
 
 	irq_base = base;
 }
diff --git a/arch/mips/kernel/irq-rm9000.c b/arch/mips/kernel/irq-rm9000.c
index 9775384..ba6440c 100644
--- a/arch/mips/kernel/irq-rm9000.c
+++ b/arch/mips/kernel/irq-rm9000.c
@@ -117,10 +117,12 @@ void __init rm9k_cpu_irq_init(int base)
 	clear_c0_intcontrol(0x0000f000);		/* Mask all */
 
 	for (i = base; i < base + 4; i++)
-		set_irq_chip(i, &rm9k_irq_controller);
+		set_irq_chip_and_handler(i, &rm9k_irq_controller,
+					 handle_level_irq);
 
 	rm9000_perfcount_irq = base + 1;
-	set_irq_chip(rm9000_perfcount_irq, &rm9k_perfcounter_irq);
+	set_irq_chip_and_handler(rm9000_perfcount_irq, &rm9k_perfcounter_irq,
+				 handle_level_irq);
 
 	irq_base = base;
 }
diff --git a/arch/mips/kernel/irq_cpu.c b/arch/mips/kernel/irq_cpu.c
index 3b7cfa4..be5ac23 100644
--- a/arch/mips/kernel/irq_cpu.c
+++ b/arch/mips/kernel/irq_cpu.c
@@ -62,6 +62,7 @@ static struct irq_chip mips_cpu_irq_cont
 	.mask		= mask_mips_irq,
 	.mask_ack	= mask_mips_irq,
 	.unmask		= unmask_mips_irq,
+	.eoi		= unmask_mips_irq,
 	.end		= mips_cpu_irq_end,
 };
 
@@ -104,6 +105,7 @@ static struct irq_chip mips_mt_cpu_irq_c
 	.mask		= mask_mips_mt_irq,
 	.mask_ack	= mips_mt_cpu_irq_ack,
 	.unmask		= unmask_mips_mt_irq,
+	.eoi		= unmask_mips_mt_irq,
 	.end		= mips_mt_cpu_irq_end,
 };
 
@@ -124,7 +126,8 @@ void __init mips_cpu_irq_init(int irq_ba
 			set_irq_chip(i, &mips_mt_cpu_irq_controller);
 
 	for (i = irq_base + 2; i < irq_base + 8; i++)
-		set_irq_chip(i, &mips_cpu_irq_controller);
+		set_irq_chip_and_handler(i, &mips_cpu_irq_controller,
+					 handle_level_irq);
 
 	mips_cpu_irq_base = irq_base;
 }
diff --git a/arch/mips/kernel/smp-mt.c b/arch/mips/kernel/smp-mt.c
index 2ac19a6..1ee689c 100644
--- a/arch/mips/kernel/smp-mt.c
+++ b/arch/mips/kernel/smp-mt.c
@@ -278,7 +278,9 @@ void __init plat_prepare_cpus(unsigned i
 
 	/* need to mark IPI's as IRQ_PER_CPU */
 	irq_desc[cpu_ipi_resched_irq].status |= IRQ_PER_CPU;
+	set_irq_handler(cpu_ipi_resched_irq, handle_percpu_irq);
 	irq_desc[cpu_ipi_call_irq].status |= IRQ_PER_CPU;
+	set_irq_handler(cpu_ipi_call_irq, handle_percpu_irq);
 }
 
 /*
diff --git a/arch/mips/kernel/smtc.c b/arch/mips/kernel/smtc.c
index 3b78caf..802febe 100644
--- a/arch/mips/kernel/smtc.c
+++ b/arch/mips/kernel/smtc.c
@@ -1009,6 +1009,7 @@ void setup_cross_vpe_interrupts(void)
 	setup_irq_smtc(cpu_ipi_irq, &irq_ipi, (0x100 << MIPS_CPU_IPI_IRQ));
 
 	irq_desc[cpu_ipi_irq].status |= IRQ_PER_CPU;
+	set_irq_handler(cpu_ipi_irq, handle_percpu_irq);
 }
 
 /*
diff --git a/arch/mips/lasat/interrupt.c b/arch/mips/lasat/interrupt.c
index cac82af..4a84a7b 100644
--- a/arch/mips/lasat/interrupt.c
+++ b/arch/mips/lasat/interrupt.c
@@ -133,5 +133,5 @@ void __init arch_init_irq(void)
 	}
 
 	for (i = 0; i <= LASATINT_END; i++)
-		set_irq_chip(i, &lasat_irq_type);
+		set_irq_chip_and_handler(i, &lasat_irq_type, handle_level_irq);
 }
diff --git a/arch/mips/mips-boards/atlas/atlas_int.c b/arch/mips/mips-boards/atlas/atlas_int.c
index 7c71004..43dba6c 100644
--- a/arch/mips/mips-boards/atlas/atlas_int.c
+++ b/arch/mips/mips-boards/atlas/atlas_int.c
@@ -74,6 +74,7 @@ static struct irq_chip atlas_irq_type = 
 	.mask = disable_atlas_irq,
 	.mask_ack = disable_atlas_irq,
 	.unmask = enable_atlas_irq,
+	.eoi = enable_atlas_irq,
 	.end = end_atlas_irq,
 };
 
@@ -207,7 +208,7 @@ static inline void init_atlas_irqs (int 
 	atlas_hw0_icregs->intrsten = 0xffffffff;
 
 	for (i = ATLAS_INT_BASE; i <= ATLAS_INT_END; i++)
-		set_irq_chip(i, &atlas_irq_type);
+		set_irq_chip_and_handler(i, &atlas_irq_type, handle_level_irq);
 }
 
 static struct irqaction atlasirq = {
diff --git a/arch/mips/mips-boards/generic/time.c b/arch/mips/mips-boards/generic/time.c
index d817c60..5249a88 100644
--- a/arch/mips/mips-boards/generic/time.c
+++ b/arch/mips/mips-boards/generic/time.c
@@ -287,7 +287,8 @@ #ifdef CONFIG_SMP
 	   on seperate cpu's the first one tries to handle the second interrupt.
 	   The effect is that the int remains disabled on the second cpu.
 	   Mark the interrupt with IRQ_PER_CPU to avoid any confusion */
-	irq_desc[mips_cpu_timer_irq].status |= IRQ_PER_CPU;
+	irq_desc[mips_cpu_timer_irq].flags |= IRQ_PER_CPU;
+	set_irq_handler(mips_cpu_timer_irq, handle_percpu_irq);
 #endif
 
         /* to generate the first timer interrupt */
diff --git a/arch/mips/mips-boards/sim/sim_time.c b/arch/mips/mips-boards/sim/sim_time.c
index 24a4ed0..f2d998d 100644
--- a/arch/mips/mips-boards/sim/sim_time.c
+++ b/arch/mips/mips-boards/sim/sim_time.c
@@ -203,7 +203,8 @@ #ifdef CONFIG_SMP
 	   on seperate cpu's the first one tries to handle the second interrupt.
 	   The effect is that the int remains disabled on the second cpu.
 	   Mark the interrupt with IRQ_PER_CPU to avoid any confusion */
-	irq_desc[mips_cpu_timer_irq].status |= IRQ_PER_CPU;
+	irq_desc[mips_cpu_timer_irq].flags |= IRQ_PER_CPU;
+	set_irq_handler(mips_cpu_timer_irq, handle_percpu_irq);
 #endif
 
 	/* to generate the first timer interrupt */
diff --git a/arch/mips/momentum/ocelot_c/cpci-irq.c b/arch/mips/momentum/ocelot_c/cpci-irq.c
index 7723f09..e5a4a0a 100644
--- a/arch/mips/momentum/ocelot_c/cpci-irq.c
+++ b/arch/mips/momentum/ocelot_c/cpci-irq.c
@@ -106,5 +106,5 @@ void cpci_irq_init(void)
 	int i;
 
 	for (i = CPCI_IRQ_BASE; i < (CPCI_IRQ_BASE + 8); i++)
-		set_irq_chip(i, &cpci_irq_type);
+		set_irq_chip_and_handler(i, &cpci_irq_type, handle_level_irq);
 }
diff --git a/arch/mips/momentum/ocelot_c/uart-irq.c b/arch/mips/momentum/ocelot_c/uart-irq.c
index 72faf81..0029f00 100644
--- a/arch/mips/momentum/ocelot_c/uart-irq.c
+++ b/arch/mips/momentum/ocelot_c/uart-irq.c
@@ -96,6 +96,6 @@ struct irq_chip uart_irq_type = {
 
 void uart_irq_init(void)
 {
-	set_irq_chip(80, &uart_irq_type);
-	set_irq_chip(81, &uart_irq_type);
+	set_irq_chip_and_handler(80, &uart_irq_type, handle_level_irq);
+	set_irq_chip_and_handler(81, &uart_irq_type, handle_level_irq);
 }
diff --git a/arch/mips/philips/pnx8550/common/int.c b/arch/mips/philips/pnx8550/common/int.c
index e4bf494..0dc2393 100644
--- a/arch/mips/philips/pnx8550/common/int.c
+++ b/arch/mips/philips/pnx8550/common/int.c
@@ -192,7 +192,7 @@ void __init arch_init_irq(void)
 	int configPR;
 
 	for (i = 0; i < PNX8550_INT_CP0_TOTINT; i++) {
-		set_irq_chip(i, &level_irq_type);
+		set_irq_chip_and_handler(i, &level_irq_type, handle_level_irq);
 		mask_irq(i);	/* mask the irq just in case  */
 	}
 
@@ -229,7 +229,7 @@ #endif
 		/* mask/priority is still 0 so we will not get any
 		 * interrupts until it is unmasked */
 
-		set_irq_chip(i, &level_irq_type);
+		set_irq_chip_and_handler(i, &level_irq_type, handle_level_irq);
 	}
 
 	/* Priority level 0 */
@@ -238,19 +238,21 @@ #endif
 	/* Set int vector table address */
 	PNX8550_GIC_VECTOR_0 = PNX8550_GIC_VECTOR_1 = 0;
 
-	set_irq_chip(MIPS_CPU_GIC_IRQ, &level_irq_type);
+	set_irq_chip_and_handler(MIPS_CPU_GIC_IRQ, &level_irq_type,
+				 handle_level_irq);
 	setup_irq(MIPS_CPU_GIC_IRQ, &gic_action);
 
 	/* init of Timer interrupts */
 	for (i = PNX8550_INT_TIMER_MIN; i <= PNX8550_INT_TIMER_MAX; i++)
-		set_irq_chip(i, &level_irq_type);
+		set_irq_chip_and_handler(i, &level_irq_type, handle_level_irq);
 
 	/* Stop Timer 1-3 */
 	configPR = read_c0_config7();
 	configPR |= 0x00000038;
 	write_c0_config7(configPR);
 
-	set_irq_chip(MIPS_CPU_TIMER_IRQ, &level_irq_type);
+	set_irq_chip_and_handler(MIPS_CPU_TIMER_IRQ, &level_irq_type,
+				 handle_level_irq);
 	setup_irq(MIPS_CPU_TIMER_IRQ, &timer_action);
 }
 
diff --git a/arch/mips/sgi-ip22/ip22-int.c b/arch/mips/sgi-ip22/ip22-int.c
index 8e2074b..c7b1380 100644
--- a/arch/mips/sgi-ip22/ip22-int.c
+++ b/arch/mips/sgi-ip22/ip22-int.c
@@ -358,7 +358,7 @@ void __init arch_init_irq(void)
 		else
 			handler		= &ip22_local3_irq_type;
 
-		set_irq_chip(i, handler);
+		set_irq_chip_and_handler(i, handler, handle_level_irq);
 	}
 
 	/* vector handler. this register the IRQ as non-sharable */
diff --git a/arch/mips/sgi-ip27/ip27-irq.c b/arch/mips/sgi-ip27/ip27-irq.c
index 8243202..5f8835b 100644
--- a/arch/mips/sgi-ip27/ip27-irq.c
+++ b/arch/mips/sgi-ip27/ip27-irq.c
@@ -352,7 +352,7 @@ static struct irq_chip bridge_irq_type =
 
 void __devinit register_bridge_irq(unsigned int irq)
 {
-	set_irq_chip(irq, &bridge_irq_type);
+	set_irq_chip_and_handler(irq, &bridge_irq_type, handle_level_irq);
 }
 
 int __devinit request_bridge_irq(struct bridge_controller *bc)
diff --git a/arch/mips/sgi-ip27/ip27-timer.c b/arch/mips/sgi-ip27/ip27-timer.c
index 86ba7fc..e5441c3 100644
--- a/arch/mips/sgi-ip27/ip27-timer.c
+++ b/arch/mips/sgi-ip27/ip27-timer.c
@@ -190,6 +190,7 @@ static struct irq_chip rt_irq_type = {
 	.mask		= disable_rt_irq,
 	.mask_ack	= disable_rt_irq,
 	.unmask		= enable_rt_irq,
+	.eoi		= enable_rt_irq,
 	.end		= end_rt_irq,
 };
 
@@ -207,7 +208,7 @@ void __init plat_timer_setup(struct irqa
 	if (irqno < 0)
 		panic("Can't allocate interrupt number for timer interrupt");
 
-	set_irq_chip(irqno, &rt_irq_type);
+	set_irq_chip_and_handler(irqno, &rt_irq_type, handle_percpu_irq);
 
 	/* over-write the handler, we use our own way */
 	irq->handler = no_action;
diff --git a/arch/mips/tx4927/common/tx4927_irq.c b/arch/mips/tx4927/common/tx4927_irq.c
index 2c57ced..21873de 100644
--- a/arch/mips/tx4927/common/tx4927_irq.c
+++ b/arch/mips/tx4927/common/tx4927_irq.c
@@ -196,7 +196,8 @@ static void __init tx4927_irq_cp0_init(v
 			   TX4927_IRQ_CP0_BEG, TX4927_IRQ_CP0_END);
 
 	for (i = TX4927_IRQ_CP0_BEG; i <= TX4927_IRQ_CP0_END; i++)
-		set_irq_chip(i, &tx4927_irq_cp0_type);
+		set_irq_chip_and_handler(i, &tx4927_irq_cp0_type,
+					 handle_level_irq);
 }
 
 static void tx4927_irq_cp0_enable(unsigned int irq)
@@ -350,7 +351,8 @@ static void __init tx4927_irq_pic_init(v
 			   TX4927_IRQ_PIC_BEG, TX4927_IRQ_PIC_END);
 
 	for (i = TX4927_IRQ_PIC_BEG; i <= TX4927_IRQ_PIC_END; i++)
-		set_irq_chip(i, &tx4927_irq_pic_type);
+		set_irq_chip_and_handler(i, &tx4927_irq_pic_type,
+					 handle_level_irq);
 
 	setup_irq(TX4927_IRQ_NEST_PIC_ON_CP0, &tx4927_irq_pic_action);
 
diff --git a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c
index 1040ab3..85c8493 100644
--- a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c
+++ b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c
@@ -342,7 +342,8 @@ static void __init toshiba_rbtx4927_irq_
 
 	for (i = TOSHIBA_RBTX4927_IRQ_IOC_BEG;
 	     i <= TOSHIBA_RBTX4927_IRQ_IOC_END; i++)
-		set_irq_chip(i, &toshiba_rbtx4927_irq_ioc_type);
+		set_irq_chip_and_handler(i, &toshiba_rbtx4927_irq_ioc_type,
+					 handle_level_irq);
 
 	setup_irq(TOSHIBA_RBTX4927_IRQ_NEST_IOC_ON_PIC,
 		  &toshiba_rbtx4927_irq_ioc_action);
diff --git a/arch/mips/tx4938/common/irq.c b/arch/mips/tx4938/common/irq.c
index 19c9ee9..42e1276 100644
--- a/arch/mips/tx4938/common/irq.c
+++ b/arch/mips/tx4938/common/irq.c
@@ -88,7 +88,8 @@ tx4938_irq_cp0_init(void)
 	int i;
 
 	for (i = TX4938_IRQ_CP0_BEG; i <= TX4938_IRQ_CP0_END; i++)
-		set_irq_chip(i, &tx4938_irq_cp0_type);
+		set_irq_chip_and_handler(i, &tx4938_irq_cp0_type,
+					 handle_level_irq);
 }
 
 static void
@@ -245,7 +246,8 @@ tx4938_irq_pic_init(void)
 	int i;
 
 	for (i = TX4938_IRQ_PIC_BEG; i <= TX4938_IRQ_PIC_END; i++)
-		set_irq_chip(i, &tx4938_irq_pic_type);
+		set_irq_chip_and_handler(i, &tx4938_irq_pic_type,
+					 handle_level_irq);
 
 	setup_irq(TX4938_IRQ_NEST_PIC_ON_CP0, &tx4938_irq_pic_action);
 
diff --git a/arch/mips/tx4938/toshiba_rbtx4938/irq.c b/arch/mips/tx4938/toshiba_rbtx4938/irq.c
index 2735ffe..8c87a35 100644
--- a/arch/mips/tx4938/toshiba_rbtx4938/irq.c
+++ b/arch/mips/tx4938/toshiba_rbtx4938/irq.c
@@ -136,7 +136,8 @@ toshiba_rbtx4938_irq_ioc_init(void)
 
 	for (i = TOSHIBA_RBTX4938_IRQ_IOC_BEG;
 	     i <= TOSHIBA_RBTX4938_IRQ_IOC_END; i++)
-		set_irq_chip(i, &toshiba_rbtx4938_irq_ioc_type);
+		set_irq_chip_and_handler(i, &toshiba_rbtx4938_irq_ioc_type,
+					 handle_level_irq);
 
 	setup_irq(RBTX4938_IRQ_IOCINT,
 		  &toshiba_rbtx4938_irq_ioc_action);
diff --git a/arch/mips/vr41xx/common/icu.c b/arch/mips/vr41xx/common/icu.c
index 33d70a6..54b92a7 100644
--- a/arch/mips/vr41xx/common/icu.c
+++ b/arch/mips/vr41xx/common/icu.c
@@ -701,10 +701,12 @@ static int __init vr41xx_icu_init(void)
 	icu2_write(MGIUINTHREG, 0xffff);
 
 	for (i = SYSINT1_IRQ_BASE; i <= SYSINT1_IRQ_LAST; i++)
-		set_irq_chip(i, &sysint1_irq_type);
+		set_irq_chip_and_handler(i, &sysint1_irq_type,
+					 handle_level_irq);
 
 	for (i = SYSINT2_IRQ_BASE; i <= SYSINT2_IRQ_LAST; i++)
-		set_irq_chip(i, &sysint2_irq_type);
+		set_irq_chip_and_handler(i, &sysint2_irq_type,
+					 handle_level_irq);
 
 	cascade_irq(INT0_IRQ, icu_get_irq);
 	cascade_irq(INT1_IRQ, icu_get_irq);
diff --git a/include/asm-mips/irq.h b/include/asm-mips/irq.h
index 4724d3f..6765708 100644
--- a/include/asm-mips/irq.h
+++ b/include/asm-mips/irq.h
@@ -53,7 +53,7 @@ #define do_IRQ(irq)							\
 do {									\
 	irq_enter();							\
 	__DO_IRQ_SMTC_HOOK();						\
-	__do_IRQ((irq));						\
+	generic_handle_irq(irq);					\
 	irq_exit();							\
 } while (0)
 

From ralf@linux-mips.org Mon Nov 13 21:02:01 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 13 Nov 2006 21:02:05 +0000 (GMT)
Received: from localhost.localdomain ([127.0.0.1]:22169 "EHLO
	dl5rb.ham-radio-op.net") by ftp.linux-mips.org with ESMTP
	id S20039435AbWKMQke (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Mon, 13 Nov 2006 16:40:34 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by dl5rb.ham-radio-op.net (8.13.8/8.13.8) with ESMTP id kADGet5H006551;
	Mon, 13 Nov 2006 16:40:57 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.8/8.13.8/Submit) id kADGes1c006550;
	Mon, 13 Nov 2006 16:40:54 GMT
Date:	Mon, 13 Nov 2006 16:40:54 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	Mile Davidovic <Mile.Davidovic@micronasnit.com>
Cc:	linux-mips@linux-mips.org
Subject: Re: Uncached mmap
Message-ID: <20061113164054.GA31476@linux-mips.org>
References: <20061113123233.GA20337@linux-mips.org> <002101c70738$a4974ad0$5c00a8c0@niit.micronasnit.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <002101c70738$a4974ad0$5c00a8c0@niit.micronasnit.com>
User-Agent: Mutt/1.4.2.2i
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13190
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: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Mon, Nov 13, 2006 at 04:30:26PM +0100, Mile Davidovic wrote:

> ptr = (unsigned char*)mmap(0,lineSize,PROT_READ|PROT_WRITE,MAP_SHARED,fd0,0);
> ...
> for (i = 0; i < 12; i++) 
>    *ptr++ = 0xaa;
> 
> this loop will not write all bytes correctly (every 4 bytes will have 0xaa as
> value), here is dump from Lauterbach debugger:
> ___address__|_0________4________8________C________0123456789ABCDEF
>   D:83660000|>FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF ................
>   D:83660010| 000000AA 000000AA 000000AA 0000AA02 ................

Is 83660000 a proper physical address or a virtual address?  A common
mistake is mapping a KSEG _virtual_ address to a userspace _virtual_
address.  Obviously mapping anything virtual to something else virtual
doesn't work ...

> and if I use bigger loop
> for (i = 0; i < 20; i++) 
>    *ptr++ = 0xaa;
> My linux will be crashed on 13 write. So, this is reason why I thought that
> byte access is not allowed on mmaped uncached memory. 

Let me guess, you filled up some write queue which now is waiting for
an acknowledge which never arrives.

> Is it possible that problem with byte access is related with device mmap
> function?

That is fairly simple code.

  Ralf

From ralf@linux-mips.org Mon Nov 13 23:37:40 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 13 Nov 2006 23:37:41 +0000 (GMT)
Received: from localhost.localdomain ([127.0.0.1]:6365 "EHLO
	dl5rb.ham-radio-op.net") by ftp.linux-mips.org with ESMTP
	id S20038515AbWKMXhk (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Mon, 13 Nov 2006 23:37:40 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by dl5rb.ham-radio-op.net (8.13.8/8.13.8) with ESMTP id kADNc3vP017398;
	Mon, 13 Nov 2006 23:38:03 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.8/8.13.8/Submit) id kADNc3CV017397;
	Mon, 13 Nov 2006 23:38:03 GMT
Date:	Mon, 13 Nov 2006 23:38:03 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	Ashlesha Shintre <ashlesha@kenati.com>
Cc:	linux-mips@linux-mips.org
Subject: Re: Portmap on the Encore M3
Message-ID: <20061113233802.GA17130@linux-mips.org>
References: <1163443607.6532.9.camel@sandbar.kenati.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <1163443607.6532.9.camel@sandbar.kenati.com>
User-Agent: Mutt/1.4.2.2i
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13191
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: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Mon, Nov 13, 2006 at 10:46:47AM -0800, Ashlesha Shintre wrote:

> > RPC: sendmsg returned error 128.
> > <4>nfs: RPC call returned error 128 

128 = ENETUNREACH.

> I m trying to boot the 2.6.14.6 kernel onto the Encore M3 board that has
> the MIPS AU1500 processor on it.

For more information [1] about 2.6.14 kernels see http://tinyurl.com/hjexx ;-)

> The .config file contains the following line: CONFIG_PORTMAP=y
> The server from which the NFS is mounted is also running the portmap
> daemon..
> 
> Is there a way to check if the portmap server is functioning properly?
> 
> 
> Also:
> 
> - The BogoMIPS value is 7186 which seems too low for the AU1500 -- how
> can I check that the timer interrupt is being handled correctly?  The
> AU1500 has 2 counters which are used to generate a clock
> 
> - On the serial console I can only see messages upto this point:
> 
> 
> > 16.35 BogoMIPS (lpj=8176)

Sounds about right if your CPU clock hapens to be 8MHz so probably not.
Chances the counter was missprogrammed.  Or are you running uncached?
Uncached will completly devastate performance.

> > calibrate delay done
> > anon vma init done
> > Mount-cache hash table entries: 512
> > Checking for 'wait' instruction...  unavailable.
> > NET: Registered protocol family 16
> > size of au1xxx platform devices is 1
> 
> After this, the serial console 'hangs' -- I can see the RPC error from the log buffer, accessed from the JTAG port..
> --Please give any suggestions as to where I should start looking to narrow down and figure out the problem..

At about this point the actual console driver is registered and takes
over from the early console driver - whatever that may be in your case.
So seems the early console driver is fine but the actual console driver
(that is serial driver) is falling over.

  Ralf

[1] Okay, I'm just trying to convince people to upgrade :-)

From ashlesha@kenati.com Tue Nov 14 01:52:03 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Nov 2006 01:52:08 +0000 (GMT)
Received: from [69.90.147.196] ([69.90.147.196]:53191 "EHLO mail.kenati.com")
	by ftp.linux-mips.org with ESMTP id S20038516AbWKNBwD (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Tue, 14 Nov 2006 01:52:03 +0000
Received: from [192.168.1.169] (adsl-71-130-109-177.dsl.snfc21.pacbell.net [71.130.109.177])
	by mail.kenati.com (Postfix) with ESMTP id 5F4D6E4052;
	Mon, 13 Nov 2006 19:19:03 -0800 (PST)
Subject: Re: Portmap on the Encore M3
From:	Ashlesha Shintre <ashlesha@kenati.com>
Reply-To: ashlesha@kenati.com
To:	Ralf Baechle <ralf@linux-mips.org>
Cc:	linux-mips@linux-mips.org
In-Reply-To: <20061113233802.GA17130@linux-mips.org>
References: <1163443607.6532.9.camel@sandbar.kenati.com>
	 <20061113233802.GA17130@linux-mips.org>
Content-Type: text/plain
Date:	Mon, 13 Nov 2006 18:03:07 -0800
Message-Id: <1163469787.6532.26.camel@sandbar.kenati.com>
Mime-Version: 1.0
X-Mailer: Evolution 2.4.2.1 
Content-Transfer-Encoding: 7bit
Return-Path: <ashlesha@kenati.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13192
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: ashlesha@kenati.com
Precedence: bulk
X-list: linux-mips

On Mon, 2006-11-13 at 23:38 +0000, Ralf Baechle wrote:
> On Mon, Nov 13, 2006 at 10:46:47AM -0800, Ashlesha Shintre wrote:
> 
> > > RPC: sendmsg returned error 128.
> > > <4>nfs: RPC call returned error 128 
> 
> 128 = ENETUNREACH.
Thank you -
> 
> > I m trying to boot the 2.6.14.6 kernel onto the Encore M3 board that has
> > the MIPS AU1500 processor on it.
> 
> For more information [1] about 2.6.14 kernels see http://tinyurl.com/hjexx ;-)
> 
> > The .config file contains the following line: CONFIG_PORTMAP=y
> > The server from which the NFS is mounted is also running the portmap
> > daemon..
> > 
> > Is there a way to check if the portmap server is functioning properly?
> > 
> > 
> > Also:
> > 
> > - The BogoMIPS value is 7186 which seems too low for the AU1500 -- how
> > can I check that the timer interrupt is being handled correctly?  The
> > AU1500 has 2 counters which are used to generate a clock
> > 
> > - On the serial console I can only see messages upto this point:
> > 
> > 
> > > 16.35 BogoMIPS (lpj=8176)
> 
> Sounds about right if your CPU clock hapens to be 8MHz so probably not.
> Chances the counter was missprogrammed.  Or are you running uncached?
> Uncached will completly devastate performance.
> 

For the AU1500 processor, the CPU Clock is derived from the PLL whose
input is 12MHz.. Upon reading the value of the SYS_CPUPLL register in
the calibrate_delay function, I found out that the multiplying factor is
40, thus, the CPU Clock frequency is 480MHz.. Thus the lpj should be
approximately 480000 -- right?

Also I dont know what you mean by "running uncached"?

> > > calibrate delay done
> > > anon vma init done
> > > Mount-cache hash table entries: 512
> > > Checking for 'wait' instruction...  unavailable.
> > > NET: Registered protocol family 16
> > > size of au1xxx platform devices is 1
> > 
> > After this, the serial console 'hangs' -- I can see the RPC error from the log buffer, accessed from the JTAG port..
> > --Please give any suggestions as to where I should start looking to narrow down and figure out the problem..
> 
> At about this point the actual console driver is registered and takes
> over from the early console driver - whatever that may be in your case.
> So seems the early console driver is fine but the actual console driver
> (that is serial driver) is falling over.
> 
Thanks a lot, I will check the problem with the serial driver -- i m
using the 8250.c serial driver..

There is no early console init funciton:  The board has a serial port on
a VIA 686B Southbridge on the PCI bus -- so to get the kernel messages
on the console, before initialising the serial driver I just write a TLB
entry giving the address of the VIA on the PCI bus --

So maybe deleting this TLB entry before serial driver initialisation
might work at this point...I will try that next -

>   Ralf
> 
> [1] Okay, I'm just trying to convince people to upgrade :-)
I will convey your message to my boss :-)

Thanks again,
Ashlesha.



From Mile.Davidovic@micronasnit.com Tue Nov 14 10:56:21 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Nov 2006 10:56:26 +0000 (GMT)
Received: from krt.tmd.ns.ac.yu ([147.91.177.65]:17769 "HELO krt.neobee.net")
	by ftp.linux-mips.org with SMTP id S20037749AbWKNK4V (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Tue, 14 Nov 2006 10:56:21 +0000
Received: from localhost (localhost [127.0.0.1])
	by krt.neobee.net (Postfix) with ESMTP id 129B7282DA;
	Tue, 14 Nov 2006 11:55:58 +0100 (CET)
Received: from krt.neobee.net ([127.0.0.1])
 by localhost (krt.neobee.net [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id 28235-04; Tue, 14 Nov 2006 11:55:57 +0100 (CET)
Received: from had (unknown [192.168.0.92])
	by krt.neobee.net (Postfix) with ESMTP id 742CB2828B;
	Tue, 14 Nov 2006 11:55:57 +0100 (CET)
From:	"Mile Davidovic" <Mile.Davidovic@micronasnit.com>
To:	<linux-mips@linux-mips.org>
Cc:	"'Ralf Baechle'" <ralf@linux-mips.org>
Subject: RE: Uncached mmap
Date:	Tue, 14 Nov 2006 11:58:12 +0100
Message-ID: <013c01c707db$c70cde10$5c00a8c0@niit.micronasnit.com>
MIME-Version: 1.0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Mailer: Microsoft Office Outlook 11
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962
thread-index: AccHZ7TR8/4yl5a4Tr+t5fPHfq8UQgAbY4UQ
In-Reply-To: <20061113164054.GA31476@linux-mips.org>
Return-Path: <Mile.Davidovic@micronasnit.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13193
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: Mile.Davidovic@micronasnit.com
Precedence: bulk
X-list: linux-mips

Hello all again,

> ptr = (unsigned char*)mmap(0,lineSize,PROT_READ|PROT_WRITE,MAP_SHARED,fd0,0);
> ...
> for (i = 0; i < 12; i++) 
>    *ptr++ = 0xaa;
> 
> this loop will not write all bytes correctly (every 4 bytes will have 0xaa as
> value), here is dump from Lauterbach debugger:
> ___address__|_0________4________8________C________0123456789ABCDEF
>   D:83660000|>FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF ................
>   D:83660010| 000000AA 000000AA 000000AA 0000AA02 ................

Is 83660000 a proper physical address or a virtual address?  A common
mistake is mapping a KSEG _virtual_ address to a userspace _virtual_
address.  Obviously mapping anything virtual to something else virtual
doesn't work ...

Ok, physical address for fb mmap is 0x03660000, mmap return 0x2aaa8000 to user
space application and ptr is shifted for 16 bytes (only for test purpose), so
loop will start writing from 0x2aaa8010, with Lauterbach I can check only
0x83660000 or 0xA3660000 address and both are different then expected. Also
small test loop also show that values on 0x2aaa8010 are not ok.
Also if I write/read to this memory as u32 everything work as expected.

I also have here IDT board with 79RC32K438 (4Kc core) and I will same test.

> My linux will be crashed on 13 write. So, this is reason why I thought that
> byte access is not allowed on mmaped uncached memory. 

Let me guess, you filled up some write queue which now is waiting for
an acknowledge which never arrives.

Unfortunately no, linux stopped and ejtag debugger is dead. 


> Is it possible that problem with byte access is related with device mmap
> function?

That is fairly simple code.

  Ralf


From Mile.Davidovic@micronasnit.com Tue Nov 14 11:05:27 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Nov 2006 11:05:31 +0000 (GMT)
Received: from krt.tmd.ns.ac.yu ([147.91.177.65]:34923 "HELO krt.neobee.net")
	by ftp.linux-mips.org with SMTP id S20038487AbWKNLF1 (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Tue, 14 Nov 2006 11:05:27 +0000
Received: from localhost (localhost [127.0.0.1])
	by krt.neobee.net (Postfix) with ESMTP id 6FEDA10025E;
	Tue, 14 Nov 2006 12:05:11 +0100 (CET)
Received: from krt.neobee.net ([127.0.0.1])
 by localhost (krt.neobee.net [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id 28021-09; Tue, 14 Nov 2006 12:05:10 +0100 (CET)
Received: from had (unknown [192.168.0.92])
	by krt.neobee.net (Postfix) with ESMTP id EEB04100256;
	Tue, 14 Nov 2006 12:05:09 +0100 (CET)
From:	"Mile Davidovic" <Mile.Davidovic@micronasnit.com>
To:	"'Mile Davidovic'" <Mile.Davidovic@micronasnit.com>,
	<linux-mips@linux-mips.org>
Cc:	"'Ralf Baechle'" <ralf@linux-mips.org>
Subject: RE: Uncached mmap
Date:	Tue, 14 Nov 2006 12:07:24 +0100
Message-ID: <013e01c707dd$10680d90$5c00a8c0@niit.micronasnit.com>
MIME-Version: 1.0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Mailer: Microsoft Office Outlook 11
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962
thread-index: AccHZ7TR8/4yl5a4Tr+t5fPHfq8UQgAbY4UQAAHWH7A=
In-Reply-To: <013c01c707db$c70cde10$5c00a8c0@niit.micronasnit.com>
Return-Path: <Mile.Davidovic@micronasnit.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13194
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: Mile.Davidovic@micronasnit.com
Precedence: bulk
X-list: linux-mips

Hello again,
I just want to make apologies for bothering, I contacted our vendor and it seems
that uncached DRAM byte accesses on their core (based on MIPS 4Kec) are
impossible. 
Thanks a lot for Your effort.

Best regards Mile

Hello all again,

> ptr = (unsigned char*)mmap(0,lineSize,PROT_READ|PROT_WRITE,MAP_SHARED,fd0,0);
> ...
> for (i = 0; i < 12; i++) 
>    *ptr++ = 0xaa;
> 
> this loop will not write all bytes correctly (every 4 bytes will have 0xaa as
> value), here is dump from Lauterbach debugger:
> ___address__|_0________4________8________C________0123456789ABCDEF
>   D:83660000|>FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF ................
>   D:83660010| 000000AA 000000AA 000000AA 0000AA02 ................

Is 83660000 a proper physical address or a virtual address?  A common
mistake is mapping a KSEG _virtual_ address to a userspace _virtual_
address.  Obviously mapping anything virtual to something else virtual
doesn't work ...

Ok, physical address for fb mmap is 0x03660000, mmap return 0x2aaa8000 to user
space application and ptr is shifted for 16 bytes (only for test purpose), so
loop will start writing from 0x2aaa8010, with Lauterbach I can check only
0x83660000 or 0xA3660000 address and both are different then expected. Also
small test loop also show that values on 0x2aaa8010 are not ok.
Also if I write/read to this memory as u32 everything work as expected.

I also have here IDT board with 79RC32K438 (4Kc core) and I will same test.

> My linux will be crashed on 13 write. So, this is reason why I thought that
> byte access is not allowed on mmaped uncached memory. 

Let me guess, you filled up some write queue which now is waiting for
an acknowledge which never arrives.

Unfortunately no, linux stopped and ejtag debugger is dead. 


> Is it possible that problem with byte access is related with device mmap
> function?

That is fairly simple code.

  Ralf



From chandu.nitw@gmail.com Tue Nov 14 11:28:57 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Nov 2006 11:29:04 +0000 (GMT)
Received: from ug-out-1314.google.com ([66.249.92.172]:34058 "EHLO
	ug-out-1314.google.com") by ftp.linux-mips.org with ESMTP
	id S20038592AbWKNL25 (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 14 Nov 2006 11:28:57 +0000
Received: by ug-out-1314.google.com with SMTP id 40so1473127uga
        for <linux-mips@linux-mips.org>; Tue, 14 Nov 2006 03:28:46 -0800 (PST)
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws;
        s=beta; d=gmail.com;
        h=received:message-id:date:from:to:subject:mime-version:content-type;
        b=nquYPsQGdAvSZt7LfwE0fa2z75TqRDKAXecBJDrDGfU6wgHJW6g2q8YdGTRa0jtGi+FJSwBBIyU3pgrBCebQlp+WOiK82cwnX4VyAFo/UO2XEcHXbJS8FXjr9VIeLpmB7AxQ6SF+DHOH2jaV3H4+khnvf0IyKVrRzzg6Sl+K6Pw=
Received: by 10.78.193.19 with SMTP id q19mr930248huf.1163503726453;
        Tue, 14 Nov 2006 03:28:46 -0800 (PST)
Received: by 10.78.141.4 with HTTP; Tue, 14 Nov 2006 03:28:46 -0800 (PST)
Message-ID: <69a573da0611140328w16138465lfa7a6268981867e@mail.gmail.com>
Date:	Tue, 14 Nov 2006 16:58:46 +0530
From:	"chandrashekar mogilicherla" <chandu.nitw@gmail.com>
To:	linux-mips@linux-mips.org
Subject: process created when pthread_create is used ??????????
MIME-Version: 1.0
Content-Type: multipart/alternative; 
	boundary="----=_Part_93427_33498053.1163503726316"
Return-Path: <chandu.nitw@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13195
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: chandu.nitw@gmail.com
Precedence: bulk
X-list: linux-mips

------=_Part_93427_33498053.1163503726316
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Iam using fedora core 2.6.11 kernel on mips machine ,

"process is getting created when i try to create thread using pthread
library."

Can anybody explain what is happening  out  there

Thanking you in advance,
Chandra shekar

------=_Part_93427_33498053.1163503726316
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Iam using fedora core 2.6.11 kernel on mips machine ,<br>
<br>
&quot;process is getting created when i try to create thread using pthread library.&quot;<br>
<br>
Can anybody explain what is happening&nbsp; out&nbsp; there <br>
<br>
Thanking you in advance,<br>
Chandra shekar<br>

------=_Part_93427_33498053.1163503726316--

From ralf@linux-mips.org Tue Nov 14 12:54:58 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Nov 2006 12:55:01 +0000 (GMT)
Received: from localhost.localdomain ([127.0.0.1]:17874 "EHLO
	dl5rb.ham-radio-op.net") by ftp.linux-mips.org with ESMTP
	id S20038639AbWKNMy6 (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 14 Nov 2006 12:54:58 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by dl5rb.ham-radio-op.net (8.13.8/8.13.8) with ESMTP id kAECtEs7029013;
	Tue, 14 Nov 2006 12:55:15 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.8/8.13.8/Submit) id kAECtEoW029012;
	Tue, 14 Nov 2006 12:55:14 GMT
Date:	Tue, 14 Nov 2006 12:55:14 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	chandrashekar mogilicherla <chandu.nitw@gmail.com>
Cc:	linux-mips@linux-mips.org
Subject: Re: process created when pthread_create is used ??????????
Message-ID: <20061114125514.GA28579@linux-mips.org>
References: <69a573da0611140328w16138465lfa7a6268981867e@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <69a573da0611140328w16138465lfa7a6268981867e@mail.gmail.com>
User-Agent: Mutt/1.4.2.2i
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13196
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: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Tue, Nov 14, 2006 at 04:58:46PM +0530, chandrashekar mogilicherla wrote:

> Iam using fedora core 2.6.11 kernel on mips machine ,

Interesting, I wonder where you got that Fedora port from?

> "process is getting created when i try to create thread using pthread
> library."
> 
> Can anybody explain what is happening  out  there

On a kernel level thread and process are almost identical things which is
why they look the same in ps output.  The fine differences are more
special properties such as a having a private address space.

  Ralf

From ralf@linux-mips.org Tue Nov 14 13:04:38 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Nov 2006 13:04:40 +0000 (GMT)
Received: from localhost.localdomain ([127.0.0.1]:25022 "EHLO
	dl5rb.ham-radio-op.net") by ftp.linux-mips.org with ESMTP
	id S20038654AbWKNNEi (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 14 Nov 2006 13:04:38 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by dl5rb.ham-radio-op.net (8.13.8/8.13.8) with ESMTP id kAED53RL029227;
	Tue, 14 Nov 2006 13:05:03 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.8/8.13.8/Submit) id kAED53Pi029226;
	Tue, 14 Nov 2006 13:05:03 GMT
Date:	Tue, 14 Nov 2006 13:05:03 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	Ashlesha Shintre <ashlesha@kenati.com>
Cc:	linux-mips@linux-mips.org
Subject: Re: Portmap on the Encore M3
Message-ID: <20061114130503.GB28579@linux-mips.org>
References: <1163443607.6532.9.camel@sandbar.kenati.com> <20061113233802.GA17130@linux-mips.org> <1163469787.6532.26.camel@sandbar.kenati.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <1163469787.6532.26.camel@sandbar.kenati.com>
User-Agent: Mutt/1.4.2.2i
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13197
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: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Mon, Nov 13, 2006 at 06:03:07PM -0800, Ashlesha Shintre wrote:

> > > > 16.35 BogoMIPS (lpj=8176)
> > 
> > Sounds about right if your CPU clock hapens to be 8MHz so probably not.
> > Chances the counter was missprogrammed.  Or are you running uncached?
> > Uncached will completly devastate performance.
> > 
> 
> For the AU1500 processor, the CPU Clock is derived from the PLL whose
> input is 12MHz.. Upon reading the value of the SYS_CPUPLL register in
> the calibrate_delay function, I found out that the multiplying factor is
> 40, thus, the CPU Clock frequency is 480MHz.. Thus the lpj should be
> approximately 480000 -- right?

From a CPU core like the Alchemy core I would more expect half of that
number, 240000.  That is if HZ is 1000 which I believe it was still
hardwired for kernels of the vintage you're running.

> Also I dont know what you mean by "running uncached"?

CONFIG_MIPS_UNCACHED which disables all processor caches.  Bad idea.

> Thanks a lot, I will check the problem with the serial driver -- i m
> using the 8250.c serial driver..

Use CONFIG_SERIAL_AU1X00.

  Ralf

From ralf@linux-mips.org Tue Nov 14 13:12:24 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Nov 2006 13:12:27 +0000 (GMT)
Received: from localhost.localdomain ([127.0.0.1]:64643 "EHLO
	dl5rb.ham-radio-op.net") by ftp.linux-mips.org with ESMTP
	id S20038656AbWKNNMY (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 14 Nov 2006 13:12:24 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by dl5rb.ham-radio-op.net (8.13.8/8.13.8) with ESMTP id kAEDCjte029323;
	Tue, 14 Nov 2006 13:12:45 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.8/8.13.8/Submit) id kAEDCjWw029322;
	Tue, 14 Nov 2006 13:12:45 GMT
Date:	Tue, 14 Nov 2006 13:12:45 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	s c <steve.carren@gmail.com>
Cc:	linux-mips@linux-mips.org
Subject: Re: au1500 USB does not recover from flash drive removal during operations
Message-ID: <20061114131244.GC28579@linux-mips.org>
References: <2e134a330611130706u4b8da444w469b88e96d3c55f0@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <2e134a330611130706u4b8da444w469b88e96d3c55f0@mail.gmail.com>
User-Agent: Mutt/1.4.2.2i
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13198
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: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Mon, Nov 13, 2006 at 10:06:44AM -0500, s c wrote:

I suggest you take this to a specific USB list or linux-kernel.  The
behavious you describe does not seem to be MIPS-specific.

  Ralf

From barrioskmc@gmail.com Tue Nov 14 15:18:54 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Nov 2006 15:18:58 +0000 (GMT)
Received: from nz-out-0102.google.com ([64.233.162.201]:64530 "EHLO
	nz-out-0102.google.com") by ftp.linux-mips.org with ESMTP
	id S20038702AbWKNPSu (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 14 Nov 2006 15:18:50 +0000
Received: by nz-out-0102.google.com with SMTP id m7so1092425nzf
        for <linux-mips@linux-mips.org>; Tue, 14 Nov 2006 07:18:41 -0800 (PST)
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws;
        s=beta; d=gmail.com;
        h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition;
        b=FpZt3VTpjjsKkNVCFGuZk3cdPT6pRx2QyHnrqD4h9OY1sL5RWEMSHBJeA5M4FbsHCZX1biA1AEubNiFgj71Tsct+bAod+D3JjWYjIVpUJBF+FHZi5IS8K0zO66smD3vhKtlJ0FKqnW6PDitO/fpyheu0zdzkivV2YiPwcbNBLVM=
Received: by 10.65.213.4 with SMTP id p4mr1280486qbq.1163517520941;
        Tue, 14 Nov 2006 07:18:40 -0800 (PST)
Received: by 10.65.150.16 with HTTP; Tue, 14 Nov 2006 07:18:40 -0800 (PST)
Message-ID: <44c63dc40611140718q4e8bc417w15438b2e0222ef15@mail.gmail.com>
Date:	Wed, 15 Nov 2006 00:18:40 +0900
From:	barrios <barrioskmc@gmail.com>
To:	linux-mips@linux-mips.org
Subject: timing measure in dynamic linker
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Return-Path: <barrioskmc@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13199
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: barrioskmc@gmail.com
Precedence: bulk
X-list: linux-mips

I want to measure relocation and symbol look up time for startup program.
So, I looked following code at glibc/elf/rtld.c.

#ifndef HP_TIMING_NONAVAIL
   print_statistics (&rtld_total_time);
#else
   print_statistics (NULL);
#endif

I think that glibc can't support time stamp counter register in mips
architecture. So not implemented HP_TIMING_XXX functions.

How can I measure relocation and symbol lookup time in dynamic linker ?
Welcome to any answers.
Best Regards.

From ralf@linux-mips.org Tue Nov 14 16:59:43 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Nov 2006 16:59:45 +0000 (GMT)
Received: from localhost.localdomain ([127.0.0.1]:38357 "EHLO
	dl5rb.ham-radio-op.net") by ftp.linux-mips.org with ESMTP
	id S20038718AbWKNQ7n (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 14 Nov 2006 16:59:43 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by dl5rb.ham-radio-op.net (8.13.8/8.13.8) with ESMTP id kAEH07Z6005523;
	Tue, 14 Nov 2006 17:00:07 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.8/8.13.8/Submit) id kAEH0694005522;
	Tue, 14 Nov 2006 17:00:06 GMT
Date:	Tue, 14 Nov 2006 17:00:06 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc:	linux-mips@linux-mips.org
Subject: Re: [PATCH] remove redundant r4k_blast_icache() calls
Message-ID: <20061114170006.GA27072@linux-mips.org>
References: <20060822.211547.92587044.nemoto@toshiba-tops.co.jp>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20060822.211547.92587044.nemoto@toshiba-tops.co.jp>
User-Agent: Mutt/1.4.2.2i
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13200
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: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Tue, Aug 22, 2006 at 09:15:47PM +0900, Atsushi Nemoto wrote:

> @@ -385,7 +382,6 @@ static inline void local_r4k_flush_cache
>  		return;
>  
>  	r4k_blast_dcache();
> -	r4k_blast_icache();
>  
>  	/*
>  	 * Kludge alert.  For obscure reasons R4000SC and R4400SC go nuts if we

R4000 / R4400 SC and MC indexed S-cache ops also affected the primary
caches so this code ends unnecessarily blowing away the D-cache twice.

  Ralf

From ralf@linux-mips.org Tue Nov 14 17:45:44 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Nov 2006 17:45:46 +0000 (GMT)
Received: from localhost.localdomain ([127.0.0.1]:26569 "EHLO
	dl5rb.ham-radio-op.net") by ftp.linux-mips.org with ESMTP
	id S20038798AbWKNRpo (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 14 Nov 2006 17:45:44 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by dl5rb.ham-radio-op.net (8.13.8/8.13.8) with ESMTP id kAEHk9o4006209;
	Tue, 14 Nov 2006 17:46:09 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.8/8.13.8/Submit) id kAEHk82X006208;
	Tue, 14 Nov 2006 17:46:08 GMT
Date:	Tue, 14 Nov 2006 17:46:08 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc:	linux-mips@linux-mips.org
Subject: Re: [PATCH] rewrite restore_fp_context/save_fp_context
Message-ID: <20061114174608.GA5740@linux-mips.org>
References: <20060208.015250.130239257.anemo@mba.ocn.ne.jp> <20060411.185449.126141341.nemoto@toshiba-tops.co.jp> <20060620.003746.78731943.anemo@mba.ocn.ne.jp> <20060829.225631.41630441.anemo@mba.ocn.ne.jp>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20060829.225631.41630441.anemo@mba.ocn.ne.jp>
User-Agent: Mutt/1.4.2.2i
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13201
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: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Tue, Aug 29, 2006 at 10:56:31PM +0900, Atsushi Nemoto wrote:

> The setup_sigcontect()/restore_sigcontext() might sleep on
> put_user()/get_user() with preemption disabled (i.e. atomic context).
> Sleeping in atomic context is not allowed.  This patch fixes this
> problem by rewriting restore_fp_context()/save_fp_context().

So with this patch applied the context will be copied around twice, first
save the fp registers to memory then copied from memory to userspace and
as the result the non-preemptible kernel will suffer from fixing the
preemptible ...

To me it looks like the real problem that setup_sigcontext and
restore_sigcontext need to disable preemption.  And the reason for that
is probably that 87d54649f67d8ffe0a8d8176de8c210a6c4bb4a7 around 2.6.9
took the wrong.  The better fix would probably have been to allow
at least some fp instructions from kernel mode.  The sole reason for
the die_if_kernel() call is to tell people attempting to put FPU code
into the kernel that they're screwing up.

  Ralf

From ashlesha@kenati.com Tue Nov 14 18:16:52 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Nov 2006 18:16:57 +0000 (GMT)
Received: from [69.90.147.196] ([69.90.147.196]:6574 "EHLO mail.kenati.com")
	by ftp.linux-mips.org with ESMTP id S20038886AbWKNSQw (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Tue, 14 Nov 2006 18:16:52 +0000
Received: from [192.168.1.169] (adsl-71-130-109-177.dsl.snfc21.pacbell.net [71.130.109.177])
	by mail.kenati.com (Postfix) with ESMTP id 0E66BE4053;
	Tue, 14 Nov 2006 11:44:08 -0800 (PST)
Subject: Re: Portmap on the Encore M3
From:	Ashlesha Shintre <ashlesha@kenati.com>
Reply-To: ashlesha@kenati.com
To:	Ralf Baechle <ralf@linux-mips.org>
Cc:	linux-mips@linux-mips.org
In-Reply-To: <20061114130503.GB28579@linux-mips.org>
References: <1163443607.6532.9.camel@sandbar.kenati.com>
	 <20061113233802.GA17130@linux-mips.org>
	 <1163469787.6532.26.camel@sandbar.kenati.com>
	 <20061114130503.GB28579@linux-mips.org>
Content-Type: text/plain
Date:	Tue, 14 Nov 2006 10:28:10 -0800
Message-Id: <1163528890.6513.4.camel@sandbar.kenati.com>
Mime-Version: 1.0
X-Mailer: Evolution 2.4.2.1 
Content-Transfer-Encoding: 7bit
Return-Path: <ashlesha@kenati.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13202
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: ashlesha@kenati.com
Precedence: bulk
X-list: linux-mips





> Use CONFIG_SERIAL_AU1X00.

--But I want to use standard 16550 compatible serial port, controlled by
the Super I/O Controller on the VIA Southbridge.. The
CONFIG_SERIAL_AU1x00 will not be able to drive this port will it?

Thanks
Ashlesha.


From ralf@linux-mips.org Tue Nov 14 19:11:32 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Nov 2006 19:11:34 +0000 (GMT)
Received: from localhost.localdomain ([127.0.0.1]:59348 "EHLO
	dl5rb.ham-radio-op.net") by ftp.linux-mips.org with ESMTP
	id S20038715AbWKNTLc (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 14 Nov 2006 19:11:32 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by dl5rb.ham-radio-op.net (8.13.8/8.13.8) with ESMTP id kAEJBviq007358;
	Tue, 14 Nov 2006 19:11:57 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.8/8.13.8/Submit) id kAEJBu15007357;
	Tue, 14 Nov 2006 19:11:56 GMT
Date:	Tue, 14 Nov 2006 19:11:56 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	Ashlesha Shintre <ashlesha@kenati.com>
Cc:	linux-mips@linux-mips.org
Subject: Re: Portmap on the Encore M3
Message-ID: <20061114191156.GA7299@linux-mips.org>
References: <1163443607.6532.9.camel@sandbar.kenati.com> <20061113233802.GA17130@linux-mips.org> <1163469787.6532.26.camel@sandbar.kenati.com> <20061114130503.GB28579@linux-mips.org> <1163528890.6513.4.camel@sandbar.kenati.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <1163528890.6513.4.camel@sandbar.kenati.com>
User-Agent: Mutt/1.4.2.2i
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13203
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: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Tue, Nov 14, 2006 at 10:28:10AM -0800, Ashlesha Shintre wrote:

> > Use CONFIG_SERIAL_AU1X00.
> 
> --But I want to use standard 16550 compatible serial port, controlled by
> the Super I/O Controller on the VIA Southbridge.. The
> CONFIG_SERIAL_AU1x00 will not be able to drive this port will it?

Ah, no.  But that's an unusual configuration.  In general Alchemy
systems only use the on-chip UART which is 8250-ish but just different
enough that in older Linux versions we used to have a separate
driver for it.

  Ralf

From ralf@linux-mips.org Tue Nov 14 19:50:03 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Nov 2006 19:50:04 +0000 (GMT)
Received: from localhost.localdomain ([127.0.0.1]:45293 "EHLO
	dl5rb.ham-radio-op.net") by ftp.linux-mips.org with ESMTP
	id S20038725AbWKNTuD (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 14 Nov 2006 19:50:03 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by dl5rb.ham-radio-op.net (8.13.8/8.13.8) with ESMTP id kAEJoRNQ020227;
	Tue, 14 Nov 2006 19:50:27 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.8/8.13.8/Submit) id kAEJoQuv020226;
	Tue, 14 Nov 2006 19:50:26 GMT
Date:	Tue, 14 Nov 2006 19:50:26 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc:	linux-mips@linux-mips.org
Subject: Re: [PATCH] mips irq cleanups
Message-ID: <20061114195026.GA16512@linux-mips.org>
References: <20061102.020836.25912635.anemo@mba.ocn.ne.jp> <20061112.010457.29576510.anemo@mba.ocn.ne.jp>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20061112.010457.29576510.anemo@mba.ocn.ne.jp>
User-Agent: Mutt/1.4.2.2i
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13204
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: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Sun, Nov 12, 2006 at 01:04:57AM +0900, Atsushi Nemoto wrote:

> I missed some cleanups in irq_cpu.c.  Here is a patch against the
> patch.  I can send revised whole patch if you want.

I folded it into the previous one.

  Ralf

From Trevor_Hamm@pmc-sierra.com Tue Nov 14 21:48:01 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Nov 2006 21:48:07 +0000 (GMT)
Received: from mother.pmc-sierra.com ([216.241.224.12]:8932 "HELO
	mother.pmc-sierra.bc.ca") by ftp.linux-mips.org with SMTP
	id S20038781AbWKNVsB (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 14 Nov 2006 21:48:01 +0000
Received: (qmail 11875 invoked by uid 101); 14 Nov 2006 21:47:46 -0000
Received: from unknown (HELO ogmios.pmc-sierra.bc.ca) (216.241.226.59)
  by mother.pmc-sierra.com with SMTP; 14 Nov 2006 21:47:46 -0000
Received: from bby1exi01.pmc_nt.nt.pmc-sierra.bc.ca (bby1exi01.pmc-sierra.bc.ca [216.241.231.251])
	by ogmios.pmc-sierra.bc.ca (8.13.3/8.12.7) with ESMTP id kAELljN7023611;
	Tue, 14 Nov 2006 13:47:45 -0800
Received: by bby1exi01.pmc-sierra.bc.ca with Internet Mail Service (5.5.2657.72)
	id <VY7S189C>; Tue, 14 Nov 2006 13:47:45 -0800
Message-ID: <E8C8A5231DDE104C816ADF532E0639120194F4CD@bby1exm07.pmc_nt.nt.pmc-sierra.bc.ca>
From:	Trevor Hamm <Trevor_Hamm@pmc-sierra.com>
To:	"'Atsushi Nemoto'" <anemo@mba.ocn.ne.jp>
Cc:	linux-mips@linux-mips.org
Subject: RE: Problems booting Linux 2.6.18.1 on MIPS34K core
Date:	Tue, 14 Nov 2006 13:47:41 -0800
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2657.72)
Content-Type: text/plain
Return-Path: <Trevor_Hamm@pmc-sierra.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13205
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: Trevor_Hamm@pmc-sierra.com
Precedence: bulk
X-list: linux-mips

 

> -----Original Message-----
> From: Atsushi Nemoto [mailto:anemo@mba.ocn.ne.jp] 
> Sent: Thursday, November 09, 2006 9:16 PM
> To: Trevor Hamm
> Cc: linux-mips@linux-mips.org
> Subject: Re: Problems booting Linux 2.6.18.1 on MIPS34K core
> 
> Could you confirm that removing whole "if (mapping ..." block from
> __flush_dcache_page can hide your problem?
> 

Yes, removing this block seems to hide the problem.  I can boot completely to a login prompt.

> Or if you changed a line in __update_cache():
> 
> 	int exec = (vma->vm_flags & VM_EXEC) && !cpu_has_ic_fills_f_dc;
> 
> to
> 
> 	int exec = 1;
> 
> then your problem still happen?
> 

Yes, with this change, the boot-up problem persists.

Thanks,
Trevor

From anemo@mba.ocn.ne.jp Wed Nov 15 14:04:01 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 15 Nov 2006 14:04:06 +0000 (GMT)
Received: from mba.ocn.ne.jp ([210.190.142.172]:15857 "HELO smtp.mba.ocn.ne.jp")
	by ftp.linux-mips.org with SMTP id S20038671AbWKOOEB (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Wed, 15 Nov 2006 14:04:01 +0000
Received: from localhost (p6123-ipad25funabasi.chiba.ocn.ne.jp [220.104.84.123])
	by smtp.mba.ocn.ne.jp (Postfix) with ESMTP
	id B2B13BA42; Wed, 15 Nov 2006 23:03:55 +0900 (JST)
Date:	Wed, 15 Nov 2006 23:06:33 +0900 (JST)
Message-Id: <20061115.230633.41198511.anemo@mba.ocn.ne.jp>
To:	Trevor_Hamm@pmc-sierra.com
Cc:	linux-mips@linux-mips.org
Subject: Re: Problems booting Linux 2.6.18.1 on MIPS34K core
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
In-Reply-To: <E8C8A5231DDE104C816ADF532E0639120194F4CD@bby1exm07.pmc_nt.nt.pmc-sierra.bc.ca>
References: <E8C8A5231DDE104C816ADF532E0639120194F4CD@bby1exm07.pmc_nt.nt.pmc-sierra.bc.ca>
X-Fingerprint: 6ACA 1623 39BD 9A94 9B1A  B746 CA77 FE94 2874 D52F
X-Pgp-Public-Key: http://wwwkeys.pgp.net/pks/lookup?op=get&search=0x2874D52F
X-Mailer: Mew version 3.3 on Emacs 21.4 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Return-Path: <anemo@mba.ocn.ne.jp>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13206
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: anemo@mba.ocn.ne.jp
Precedence: bulk
X-list: linux-mips

On Tue, 14 Nov 2006 13:47:41 -0800, Trevor Hamm <Trevor_Hamm@pmc-sierra.com> wrote:
> > Could you confirm that removing whole "if (mapping ..." block from
> > __flush_dcache_page can hide your problem?
> 
> Yes, removing this block seems to hide the problem.  I can boot
> completely to a login prompt.

Thank you for testing.  So we can omit "missing fludh_dcache_page()" case.

> > Or if you changed a line in __update_cache():
> > 
> > 	int exec = (vma->vm_flags & VM_EXEC) && !cpu_has_ic_fills_f_dc;
> > 
> > to
> > 
> > 	int exec = 1;
> > 
> > then your problem still happen?
> 
> Yes, with this change, the boot-up problem persists.

Then, I can imagine three (hardly possible) case:

A.  PG_dcache_dirty bit was cleared accidently.

B.  The page is accessed by user process without page_mapping()

C.  kernel forgot to call update_mmu_cache() at somewhere.

If case A, removing "&& Page_dcache_dirty(page)" condition from
__update_cache() will hide your problem.  If case B, calling
flush_dcache_page() unconditionally in __update_cache() will hide your
problem.

Anyway for now I can not see why this can happen...

Just for confirm:
1. This can happen on latest lmo git tree or 2.6.19-rc5.
2. UP kernel.
3. No L2 cache.
4. icache and dcache are both virtually indexed and physically tagged.
All correct?

---
Atsushi Nemoto

From anemo@mba.ocn.ne.jp Wed Nov 15 15:14:50 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 15 Nov 2006 15:14:56 +0000 (GMT)
Received: from mba.ocn.ne.jp ([210.190.142.172]:26823 "HELO smtp.mba.ocn.ne.jp")
	by ftp.linux-mips.org with SMTP id S20038917AbWKOPOu (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Wed, 15 Nov 2006 15:14:50 +0000
Received: from localhost (p6123-ipad25funabasi.chiba.ocn.ne.jp [220.104.84.123])
	by smtp.mba.ocn.ne.jp (Postfix) with ESMTP
	id 0972BBA89; Thu, 16 Nov 2006 00:14:47 +0900 (JST)
Date:	Thu, 16 Nov 2006 00:17:25 +0900 (JST)
Message-Id: <20061116.001725.75185058.anemo@mba.ocn.ne.jp>
To:	ralf@linux-mips.org
Cc:	linux-mips@linux-mips.org
Subject: Re: [PATCH] rewrite restore_fp_context/save_fp_context
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
In-Reply-To: <20061114174608.GA5740@linux-mips.org>
	<20041012.191154.90115222.nemoto@toshiba-tops.co.jp>
References: <20060620.003746.78731943.anemo@mba.ocn.ne.jp>
	<20060829.225631.41630441.anemo@mba.ocn.ne.jp>
	<20061114174608.GA5740@linux-mips.org>
X-Fingerprint: 6ACA 1623 39BD 9A94 9B1A  B746 CA77 FE94 2874 D52F
X-Pgp-Public-Key: http://wwwkeys.pgp.net/pks/lookup?op=get&search=0x2874D52F
X-Mailer: Mew version 3.3 on Emacs 21.4 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Return-Path: <anemo@mba.ocn.ne.jp>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13207
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: anemo@mba.ocn.ne.jp
Precedence: bulk
X-list: linux-mips

On Tue, 14 Nov 2006 17:46:08 +0000, Ralf Baechle <ralf@linux-mips.org> wrote:
> So with this patch applied the context will be copied around twice, first
> save the fp registers to memory then copied from memory to userspace and
> as the result the non-preemptible kernel will suffer from fixing the
> preemptible ...

Yes, it is true if the signaled process owned FPU at the time.  I
thought in many case the signaled process does not own FPU, but I
might be too optimistic indeed.

> To me it looks like the real problem that setup_sigcontext and
> restore_sigcontext need to disable preemption.  And the reason for that
> is probably that 87d54649f67d8ffe0a8d8176de8c210a6c4bb4a7 around 2.6.9
> took the wrong.  The better fix would probably have been to allow
> at least some fp instructions from kernel mode.  The sole reason for
> the die_if_kernel() call is to tell people attempting to put FPU code
> into the kernel that they're screwing up.

Hmm.  Two yeas ago I tried this approach to fix fpu-emulator issues
and gave up :) It was a bit complex more than it looked.  Here is
excerption:

On Tue, 12 Oct 2004 19:11:54 +0900 (JST), Atsushi Nemoto <anemo@mba.ocn.ne.jp> wrote:
> jsun> In terms of being simple, allowing kernel mode FPU trap is
> jsun> definitely simpler.
> 
> jsun> If you can't find any pitfalls of this approach it is actually
> jsun> robust.  The new FPU code is already greatly simplified.  It is
> jsun> possible kernel FPU trap is not that evil anymore (assuming
> jsun> kernel continues voluntarily not using FPU).
> 
> Hmm... OK, I agree enabling FPU trap in kernel seems simple.  I tried
> it today but it did not work unfortunately.  Just modifying a
> following line in traps.c was not enough.
> 
> 	die_if_kernel("do_cpu invoked from kernel context!", regs);
> 
> One point I found is do_cpu() must enable CU1 bit in pt_regs also.
> Another problem is that resume(), own_fpu() and lose_fpu() manipulate
> CU1 bit in only first level kernel stack (KSTK_STATUS(current)).
> current->thread.cp0_status may be manipulated also.  Modifying
> resume() looks too dangerous to me.

But it might be a good time to try again.  Do you think modifying
resume() etc. is OK?

---
Atsushi Nemoto

From Trevor_Hamm@pmc-sierra.com Wed Nov 15 19:24:12 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 15 Nov 2006 19:24:17 +0000 (GMT)
Received: from mother.pmc-sierra.com ([216.241.224.12]:50940 "HELO
	mother.pmc-sierra.bc.ca") by ftp.linux-mips.org with SMTP
	id S20038663AbWKOTYM (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 15 Nov 2006 19:24:12 +0000
Received: (qmail 3622 invoked by uid 101); 15 Nov 2006 19:24:01 -0000
Received: from unknown (HELO ogyruan.pmc-sierra.bc.ca) (216.241.226.236)
  by mother.pmc-sierra.com with SMTP; 15 Nov 2006 19:24:01 -0000
Received: from bby1exi01.pmc_nt.nt.pmc-sierra.bc.ca (bby1exi01.pmc-sierra.bc.ca [216.241.231.251])
	by ogyruan.pmc-sierra.bc.ca (8.13.3/8.12.7) with ESMTP id kAFJO1hg004859;
	Wed, 15 Nov 2006 11:24:01 -0800
Received: by bby1exi01.pmc-sierra.bc.ca with Internet Mail Service (5.5.2657.72)
	id <VY7SGYY9>; Wed, 15 Nov 2006 11:24:00 -0800
Message-ID: <E8C8A5231DDE104C816ADF532E0639120194F4D0@bby1exm07.pmc_nt.nt.pmc-sierra.bc.ca>
From:	Trevor Hamm <Trevor_Hamm@pmc-sierra.com>
To:	"'Atsushi Nemoto'" <anemo@mba.ocn.ne.jp>
Cc:	linux-mips@linux-mips.org
Subject: RE: Problems booting Linux 2.6.18.1 on MIPS34K core
Date:	Wed, 15 Nov 2006 11:23:58 -0800
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2657.72)
Content-Type: text/plain
Return-Path: <Trevor_Hamm@pmc-sierra.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13208
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: Trevor_Hamm@pmc-sierra.com
Precedence: bulk
X-list: linux-mips

 

> -----Original Message-----
> From: linux-mips-bounce@linux-mips.org 
> [mailto:linux-mips-bounce@linux-mips.org] On Behalf Of Atsushi Nemoto
> Sent: Wednesday, November 15, 2006 8:07 AM
> To: Trevor Hamm
> Cc: linux-mips@linux-mips.org
> Subject: Re: Problems booting Linux 2.6.18.1 on MIPS34K core
> 
> Then, I can imagine three (hardly possible) case:
> 
> A.  PG_dcache_dirty bit was cleared accidently.
> 
> B.  The page is accessed by user process without page_mapping()
> 
> C.  kernel forgot to call update_mmu_cache() at somewhere.
> 
> If case A, removing "&& Page_dcache_dirty(page)" condition from
> __update_cache() will hide your problem.  If case B, calling
> flush_dcache_page() unconditionally in __update_cache() will hide your
> problem.
> 
> Anyway for now I can not see why this can happen...
> 

I've been doing more probing with our FS2 probe, and now have a much better understanding of what is going on.  I used the probe to step through the copy_user_highpage() function while it's copying in the page which seems to be corrupted.  What I found seems to suggest a problem with cache aliases.  In copy_user_highpage(), it calls copy_page() with "vfrom" computed from the new kmap_coherent() function:
	if (cpu_has_dc_aliases) {
		vfrom = kmap_coherent(from, vaddr);
		copy_page(vto, vfrom);
		kunmap_coherent(from);
	}

In my case, for the page of interest:
 	vaddr = 0x2aaecb5c
	vfrom = 0xfffdc000
	Phys. address of this page is 0x011ca000

When I examine the data in this page from both 0x011ca000 and 0xfffdc000, the contents are close to identical.  When I look at the page through address 0x811ca000, I get completely different data, but it's the data I expect to see.  So this tells me that data I want in the page is still in the dcache, but aliased address 0xfffdc000 cannot get at it.  It just so happens that this aliasing is still occurring on the re-boot following a software reset, but some event between the lock-up and re-boot caused the cache contents to be written back into main memory, so the aliased page is getting the correct data by accident on the re-boot.  If I flush the entire dcache with the FS2 probe just before entering copy_page(), the board boots from power-up without any issues.

The log entry for the patch which introduced the kmap_coherent() function explains that the patch was a fix for dcache aliasing, yet it seems to be introducing a dcache alias here.  Any idea why?

> Just for confirm:
> 1. This can happen on latest lmo git tree or 2.6.19-rc5.
> 2. UP kernel.
> 3. No L2 cache.
> 4. icache and dcache are both virtually indexed and physically tagged.
> All correct?
> 

Except for #1 which I haven't tried (we need to get this working with 2.6.18), all correct.  The caches are 64k, 4-way.

Thanks,
Trevor

From ashlesha@kenati.com Wed Nov 15 22:13:21 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 15 Nov 2006 22:13:26 +0000 (GMT)
Received: from [69.90.147.196] ([69.90.147.196]:18348 "EHLO mail.kenati.com")
	by ftp.linux-mips.org with ESMTP id S20039009AbWKOWNV (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Wed, 15 Nov 2006 22:13:21 +0000
Received: from [192.168.1.169] (adsl-71-130-109-177.dsl.snfc21.pacbell.net [71.130.109.177])
	by mail.kenati.com (Postfix) with ESMTP id 3D859E4053;
	Wed, 15 Nov 2006 15:40:44 -0800 (PST)
Subject: Re: Portmap on the Encore M3
From:	Ashlesha Shintre <ashlesha@kenati.com>
Reply-To: ashlesha@kenati.com
To:	Ralf Baechle <ralf@linux-mips.org>
Cc:	linux-mips@linux-mips.org
In-Reply-To: <20061114191156.GA7299@linux-mips.org>
References: <1163443607.6532.9.camel@sandbar.kenati.com>
	 <20061113233802.GA17130@linux-mips.org>
	 <1163469787.6532.26.camel@sandbar.kenati.com>
	 <20061114130503.GB28579@linux-mips.org>
	 <1163528890.6513.4.camel@sandbar.kenati.com>
	 <20061114191156.GA7299@linux-mips.org>
Content-Type: text/plain
Date:	Wed, 15 Nov 2006 14:24:41 -0800
Message-Id: <1163629481.7321.4.camel@sandbar.kenati.com>
Mime-Version: 1.0
X-Mailer: Evolution 2.4.2.1 
Content-Transfer-Encoding: 7bit
Return-Path: <ashlesha@kenati.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13209
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: ashlesha@kenati.com
Precedence: bulk
X-list: linux-mips

Hi,

I m trying to understand exactly how the serial driver works -- and also
the early console initialisation.  I m reading the following websites:

An article called Serial consoles and console drivers by Alassandro
Rubini at http://www.linux.it/~rubini/docs/sercons/sercons.html 

the serial driver Wiki at :
http://www.linux-mips.org/wiki/Serial_Driver_and_Console
and links given on this wiki..

However I havent found a resource that talks about these two processes,
early serial console initialisation and invocation of the serial driver,
in enough detail to give an idea about the processes set into action
when messages are put out to the console..

Can you point me to any other useful links on this issue?

Thank you.
Regards,

Ashlesha.

On Tue, 2006-11-14 at 19:11 +0000, Ralf Baechle wrote:
> On Tue, Nov 14, 2006 at 10:28:10AM -0800, Ashlesha Shintre wrote:
> 
> > > Use CONFIG_SERIAL_AU1X00.
> > 
> > --But I want to use standard 16550 compatible serial port, controlled by
> > the Super I/O Controller on the VIA Southbridge.. The
> > CONFIG_SERIAL_AU1x00 will not be able to drive this port will it?
> 
> Ah, no.  But that's an unusual configuration.  In general Alchemy
> systems only use the on-chip UART which is 8250-ish but just different
> enough that in older Linux versions we used to have a separate
> driver for it.
> 
>   Ralf


From Trevor_Hamm@pmc-sierra.com Wed Nov 15 23:09:52 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 15 Nov 2006 23:09:57 +0000 (GMT)
Received: from mother.pmc-sierra.com ([216.241.224.12]:56769 "HELO
	mother.pmc-sierra.bc.ca") by ftp.linux-mips.org with SMTP
	id S20039023AbWKOXJw (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 15 Nov 2006 23:09:52 +0000
Received: (qmail 11900 invoked by uid 101); 15 Nov 2006 23:09:41 -0000
Received: from unknown (HELO ogyruan.pmc-sierra.bc.ca) (216.241.226.236)
  by mother.pmc-sierra.com with SMTP; 15 Nov 2006 23:09:41 -0000
Received: from bby1exi01.pmc_nt.nt.pmc-sierra.bc.ca (bby1exi01.pmc-sierra.bc.ca [216.241.231.251])
	by ogyruan.pmc-sierra.bc.ca (8.13.3/8.12.7) with ESMTP id kAFN9bUX027040;
	Wed, 15 Nov 2006 15:09:41 -0800
Received: by bby1exi01.pmc-sierra.bc.ca with Internet Mail Service (5.5.2657.72)
	id <VY7SHD0K>; Wed, 15 Nov 2006 15:09:37 -0800
Message-ID: <E8C8A5231DDE104C816ADF532E0639120194F4D2@bby1exm07.pmc_nt.nt.pmc-sierra.bc.ca>
From:	Trevor Hamm <Trevor_Hamm@pmc-sierra.com>
To:	"'Atsushi Nemoto'" <anemo@mba.ocn.ne.jp>
Cc:	linux-mips@linux-mips.org
Subject: RE: Problems booting Linux 2.6.18.1 on MIPS34K core
Date:	Wed, 15 Nov 2006 15:09:34 -0800
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2657.72)
Content-Type: text/plain
Return-Path: <Trevor_Hamm@pmc-sierra.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13210
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: Trevor_Hamm@pmc-sierra.com
Precedence: bulk
X-list: linux-mips

 

> -----Original Message-----
> From: linux-mips-bounce@linux-mips.org 
> [mailto:linux-mips-bounce@linux-mips.org] On Behalf Of Atsushi Nemoto
> Sent: Wednesday, November 15, 2006 8:07 AM
> To: Trevor Hamm
> Cc: linux-mips@linux-mips.org
> Subject: Re: Problems booting Linux 2.6.18.1 on MIPS34K core
> 
> Then, I can imagine three (hardly possible) case:
> 
> A.  PG_dcache_dirty bit was cleared accidently.
> 
> B.  The page is accessed by user process without page_mapping()
> 
> C.  kernel forgot to call update_mmu_cache() at somewhere.
> 
> If case A, removing "&& Page_dcache_dirty(page)" condition from
> __update_cache() will hide your problem.  If case B, calling
> flush_dcache_page() unconditionally in __update_cache() will hide your
> problem.
> 
> Anyway for now I can not see why this can happen...
> 

Okay, so after writing up that long explanation, reading through some more kernel code, and re-reading what you wrote above, I realize that all I've done was to verify what you've already suspected all along -- that a flush_dcache_page on this page somehow doesn't flush the page.  This is my first time studying the cache/memory management code in Linux 2.6; thanks for being so patient with me :-)

I tried the remedies you suggested for Case A and B, but neither one produces a kernel which can boot from power-up.  So far, the only work-around that works is calling flush_data_cache_page unconditionally from __flush_dcache_page.  This would imply that Case C is the culprit.  I'll see what I can do to verify this.

Thanks,
Trevor

From wyh817@gmail.com Thu Nov 16 01:27:45 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 16 Nov 2006 01:27:50 +0000 (GMT)
Received: from nf-out-0910.google.com ([64.233.182.189]:8594 "EHLO
	nf-out-0910.google.com") by ftp.linux-mips.org with ESMTP
	id S20039045AbWKPB1p (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Thu, 16 Nov 2006 01:27:45 +0000
Received: by nf-out-0910.google.com with SMTP id l24so821750nfc
        for <linux-mips@linux-mips.org>; Wed, 15 Nov 2006 17:27:45 -0800 (PST)
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws;
        s=beta; d=gmail.com;
        h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition;
        b=e5PjfRCGa/YyOBmd0WkdSb95voiK/Svm4aMQdkGQ9p1kPdMZKmzHZT8Nk0O6burroK4vLVK2uOc2qBsGSljFa6dnAYbAuJSH2bIWfPsJzQhFQWMo+Mkdsou3MbqnB53dQYRs91DLs/XRu6tZ1Vr8qbiST3xl+z3Jy2N62DGfkgQ=
Received: by 10.49.1.12 with SMTP id d12mr1770563nfi.1163640464866;
        Wed, 15 Nov 2006 17:27:44 -0800 (PST)
Received: by 10.48.217.19 with HTTP; Wed, 15 Nov 2006 17:27:44 -0800 (PST)
Message-ID: <71a06cc90611151727k32422c9bg75eb993fee821e12@mail.gmail.com>
Date:	Thu, 16 Nov 2006 09:27:44 +0800
From:	WhiteFox <wyh817@gmail.com>
To:	linux-mips@linux-mips.org
Subject: A promble about driver
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Return-Path: <wyh817@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13211
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: wyh817@gmail.com
Precedence: bulk
X-list: linux-mips

i wrote a simple driver in broadcom7111(use MIPSs3000),it works in the topbox.
the linux kernel is 2.4.25
the compiler is uclibc-3.3.5
when i insmod the driver,it say:unresolved symbol _gp_disp
what is this mean?
thak you

my code  is:

#define MODULE
#include <linux/module.h>
int init_module(void)
{
  printk("<1>Hello,world\n");
  return 0;
}
void cleanup_module(void)
{
  printk("<1>Good Bye\n");
}

From anemo@mba.ocn.ne.jp Fri Nov 17 10:13:20 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 17 Nov 2006 10:13:24 +0000 (GMT)
Received: from topsns2.toshiba-tops.co.jp ([202.230.225.126]:33173 "EHLO
	topsns2.toshiba-tops.co.jp") by ftp.linux-mips.org with ESMTP
	id S20037715AbWKQKNU (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Fri, 17 Nov 2006 10:13:20 +0000
Received: from topsms.toshiba-tops.co.jp by topsns2.toshiba-tops.co.jp
          via smtpd (for ftp.linux-mips.org [194.74.144.162]) with ESMTP; Fri, 17 Nov 2006 19:13:18 +0900
Received: from topsms.toshiba-tops.co.jp (localhost.localdomain [127.0.0.1])
	by localhost.toshiba-tops.co.jp (Postfix) with ESMTP id B4FAF202AC;
	Fri, 17 Nov 2006 19:13:15 +0900 (JST)
Received: from srd2sd.toshiba-tops.co.jp (srd2sd.toshiba-tops.co.jp [172.17.28.2])
	by topsms.toshiba-tops.co.jp (Postfix) with ESMTP id A0F20201D2;
	Fri, 17 Nov 2006 19:13:15 +0900 (JST)
Received: from localhost (fragile [172.17.28.65])
	by srd2sd.toshiba-tops.co.jp (8.12.10/8.12.10) with ESMTP id kAHADEW0000881;
	Fri, 17 Nov 2006 19:13:14 +0900 (JST)
	(envelope-from anemo@mba.ocn.ne.jp)
Date:	Fri, 17 Nov 2006 19:13:14 +0900 (JST)
Message-Id: <20061117.191314.88700615.nemoto@toshiba-tops.co.jp>
To:	Trevor_Hamm@pmc-sierra.com
Cc:	linux-mips@linux-mips.org
Subject: Re: Problems booting Linux 2.6.18.1 on MIPS34K core
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
In-Reply-To: <E8C8A5231DDE104C816ADF532E0639120194F4D0@bby1exm07.pmc_nt.nt.pmc-sierra.bc.ca>
References: <E8C8A5231DDE104C816ADF532E0639120194F4D0@bby1exm07.pmc_nt.nt.pmc-sierra.bc.ca>
X-Fingerprint: 6ACA 1623 39BD 9A94 9B1A  B746 CA77 FE94 2874 D52F
X-Pgp-Public-Key: http://wwwkeys.pgp.net/pks/lookup?op=get&search=0x2874D52F
X-Mailer: Mew version 3.3 on Emacs 21.3 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Return-Path: <anemo@mba.ocn.ne.jp>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13212
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: anemo@mba.ocn.ne.jp
Precedence: bulk
X-list: linux-mips

On Wed, 15 Nov 2006 11:23:58 -0800, Trevor Hamm <Trevor_Hamm@pmc-sierra.com> wrote:
> > Just for confirm:
> > 1. This can happen on latest lmo git tree or 2.6.19-rc5.
> > 2. UP kernel.
> > 3. No L2 cache.
> > 4. icache and dcache are both virtually indexed and physically tagged.
> > All correct?
> > 
> 
> Except for #1 which I haven't tried (we need to get this working
> with 2.6.18), all correct.  The caches are 64k, 4-way.

Thanks.  I re-read your report and wonder why this happens only on
power-up time.

If flush_data_cache_page or update_mmu_cache were broken, the problem
can happen on every restart.

The entire icache/dcache should be cleared at end of r4k_cache_init()
at least.  MIPS34K could have some magical state (lock bit or
something) which is not initialized by local_r4k___flush_cache_all()?

---
Atsushi Nemoto

From imipak@yahoo.com Fri Nov 17 21:49:21 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 17 Nov 2006 21:49:26 +0000 (GMT)
Received: from web31506.mail.mud.yahoo.com ([68.142.198.135]:46202 "HELO
	web31506.mail.mud.yahoo.com") by ftp.linux-mips.org with SMTP
	id S20027627AbWKQVtV (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Fri, 17 Nov 2006 21:49:21 +0000
Received: (qmail 53078 invoked by uid 60001); 17 Nov 2006 21:49:10 -0000
Message-ID: <20061117214910.53076.qmail@web31506.mail.mud.yahoo.com>
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws;
  s=s1024; d=yahoo.com;
  h=X-YMail-OSG:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID;
  b=p0oVwz3X9Z8yKgiDf/IVRvqCXniAWt287rBxNMCcB6mmXjPDzlje1Z3NLbfWOnS4O6YFOmHSI9t4tv8RuBsdq3XQokh57BxJdkXwFTIIrfkZjQnPr80qV7ZVTtvgwwKq+PHnVC/MITvJTgQ7p0fvyF3mG0f5fZZXq1xSMVO0CdM=;
X-YMail-OSG: xAOyE2kVM1lm7PbDfAXyySyw4z.6__YHCWjaEzsTY2978hD6vPPiyP8p.jdad67IM0e39wGVu48Dzmfi15H.PoT5fAJ.g3vv61l9Xte7jCjJ6aB7P2o54bOHze.jSAODNIqAvo492QFDumx_OH7spR3TNf7WaAI3jA--
Received: from [70.103.67.194] by web31506.mail.mud.yahoo.com via HTTP; Fri, 17 Nov 2006 13:49:09 PST
Date:	Fri, 17 Nov 2006 13:49:09 -0800 (PST)
From:	Jonathan Day <imipak@yahoo.com>
Subject: Getting a data bus error on SB1 board
To:	linux-mips@linux-mips.org
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Return-Path: <imipak@yahoo.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13213
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: imipak@yahoo.com
Precedence: bulk
X-list: linux-mips

Hi,

I'm using the latest (ok, 17th November, 10am pacific
time) git tree on the Broadcom BCM91250 that I've
always had problems with/nightmares about.

I'm getting a data bus error and am wondering if there
are any un-gitted patches circulating that fix the
problem and/or can diagnose better what is going on.

After turning on ALL of the debugging Linux has to
offer (and then some), this is the part of the boot
log that shows what is happening:

[42949373.640000] Good, all 218 testcases passed! |
[42949373.650000] ---------------------------------
[42949373.650000] Dentry cache hash table entries:
32768 (order: 6, 262144 bytes)
[42949373.660000] Inode-cache hash table entries:
16384 (order: 5, 131072 bytes)
[42949373.700000] Memory: 247296k/260764k available
(3030k kernel code, 13152k reserved, 1123k data, 232k
init, 0k highmem)
[42949373.960000] Mount-cache hash table entries: 256
[42949373.970000] Checking for 'wait' instruction... 
unavailable.
[42949373.970000] Checking for the multiply/shift
bug... no.
[42949373.980000] Checking for the daddi bug... no.
[42949373.980000] Checking for the daddiu bug... no.
[42949373.990000] CPU revision is: 03040102
[42949373.990000] FPU revision is: 000f0102
[42949373.990000] Primary instruction cache 32kB,
4-way, linesize 32 bytes.
[42949373.990000] Primary data cache 32kB, 4-way,
linesize 32 bytes.
[42949373.990000] Synthesized TLB refill handler (40
instructions).
[42949374.240000] Brought up 2 CPUs
[42949374.270000] migration_cost=10000
[42949374.290000] NET: Registered protocol family 16
[42949374.330000] Generic PHY: Registered new driver
[42949374.340000] SCSI subsystem initialized
[42949374.340000] usbcore: registered new interface
driver usbfs
[42949374.350000] usbcore: registered new interface
driver hub
[42949374.360000] usbcore: registered new device
driver usb
[42949374.380000] NET: Registered protocol family 2
[42949374.500000] IP route cache hash table entries:
2048 (order: 2, 16384 bytes)
[42949374.500000] TCP established hash table entries:
8192 (order: 6, 458752 bytes)
[42949374.520000] TCP bind hash table entries: 4096
(order: 5, 229376 bytes)
[42949374.530000] TCP: Hash tables configured
(established 8192 bind 4096)
[42949374.530000] TCP reno registered
[42949374.550000] Initializing RT-Tester: OK
[42949374.550000] audit: initializing netlink socket
(disabled)
[42949374.560000] audit(1163791574.600:1): initialized
[42949374.570000] io scheduler noop registered
[42949374.570000] io scheduler anticipatory registered
[42949374.580000] io scheduler deadline registered
(default)
[42949374.590000] io scheduler cfq registered
[42949375.160000] RAMDISK driver initialized: 1 RAM
disks of 4096K size 1024 blocksize
[42949375.170000] eth0: enabling TCP rcv checksum
[42949375.170000] eth0: SiByte Ethernet at 0x10064000,
address: 00:02:4C:FD:0D:3C
[42949375.180000] eth1: enabling TCP rcv checksum
[42949375.190000] eth1: SiByte Ethernet at 0x10065000,
address: 00:02:4C:FD:0D:3D
[42949375.200000] physmap platform flash device:
01000000 at 1fc00000
[42949375.210000] physmap-flash.0: Found 1 x16 devices
at 0x0 in 8-bit bank
[42949375.210000] DBE physical address: 0020000020
[42949375.220000] Data bus error, epc ==
ffffffff802da0bc, ra == ffffffff802da6d0
[42949375.230000] Oops[#1]:
[42949375.230000] Cpu 1
[42949375.230000] $ 0   : 0000000000000000
0000000014001fe0 0000000000000000 0000000000400020
[42949375.240000] $ 4   : a800000000b2e770
0000000000400000 0000000000000001 0000000000000001
[42949375.250000] $ 8   : 0000000000000001
0000000000000001 0000000000000002 a80000000fe27b23
[42949375.260000] $12   : 000000000000000a
0000000000000000 0000000000000000 ffffffff80406ef8
[42949375.260000] $16   : a800000000b2e770
a80000000fe27c50 0000000000000001 0000000000400000
[42949375.270000] $20   : ffffffff80480d70
0000000000400000 ffffffff8047dd80 ffffffff80481388
[42949375.280000] $24   : 0000000000000030
0000000000000000
[42949375.290000] $28   : a80000000fe24000
a80000000fe27bb0 a80000000fe27bb0 ffffffff802da6d0
[42949375.300000] Hi    : 0000000000000000
[42949375.300000] Lo    : 0000000000000001
[42949375.300000] epc   : ffffffff802da0bc
qry_present+0x2ac/0x420     Not tainted
[42949375.310000] ra    : ffffffff802da6d0
cfi_probe_chip+0x460/0x17d0
[42949375.320000] Status: 14001fe3    KX SX UX KERNEL
EXL IE
[42949375.320000] Cause : 8080001c
[42949375.330000] PrId  : 03040102
[42949375.330000] Modules linked in:
[42949375.330000] Process swapper (pid: 1,
threadinfo=a80000000fe24000, task=a80000000fe20e08)
[42949375.340000] Stack : 0000000000000000
ffffffff80481370 0000000000200000 0000000000000051
[42949375.350000]         0000000000000052
0000000000000059 a80000000fe27bf0 a80000000fe27b23
[42949375.360000]         a800000000b2cb58
00000000000000d0 0000000000000003 a800000000b2cb58
[42949375.360000]         0000000000000001
a800000000b2e770 ffffffff80480d70 0000000000000008
[42949375.370000]         ffffffff8047dd80
ffffffff80481388 a80000000fe27c50 ffffffff802e31b8
[42949375.380000]         0000000000000000
0000000000000000 0000000100000002 0000000100000000
[42949375.390000]         0000000000000000
0000000000000000 a800000000aff668 000000ad00000049
[42949375.400000]         0000000100000000
0000000000000015 0000000000000000 a80000000fe27cc0
[42949375.410000]         ffffffff80480d40
ffffffff80428288 a800000000b2e770 ffffffff80481370
[42949375.410000]         ffffffff80481150
ffffffff80481498 ffffffff8047dd80 ffffffff80481388
[42949375.420000]         ...
[42949375.420000] Call Trace:
[42949375.430000] [<ffffffff802da0bc>]
qry_present+0x2ac/0x420
[42949375.430000] [<ffffffff802da6d0>]
cfi_probe_chip+0x460/0x17d0
[42949375.440000] [<ffffffff802e31b8>]
mtd_do_chip_probe+0x1d4/0x48c
[42949375.440000] [<ffffffff802da25c>]
cfi_probe+0x2c/0x40
[42949375.450000] [<ffffffff802d9d64>]
do_map_probe+0x7c/0x128
[42949375.460000] [<ffffffff802e37f4>]
physmap_flash_probe+0x1f8/0x324
[42949375.460000] [<ffffffff802bdd2c>]
platform_drv_probe+0x20/0x34
[42949375.470000] [<ffffffff802bb418>]
really_probe+0x94/0x1d4
[42949375.470000] [<ffffffff802bb65c>]
driver_probe_device+0x104/0x124
[42949375.480000] [<ffffffff802bb690>]
__device_attach+0x14/0x28
[42949375.480000] [<ffffffff802ba1e0>]
bus_for_each_drv+0x5c/0xb0
[42949375.490000] [<ffffffff802bb760>]
device_attach+0xbc/0x110
[42949375.500000] [<ffffffff802ba0b8>]
bus_attach_device+0x40/0x94
[42949375.500000] [<ffffffff802b8588>]
device_add+0x40c/0x5d4
[42949375.510000] [<ffffffff802be39c>]
platform_device_add+0x1b4/0x218
[42949375.510000] [<ffffffff802be428>]
platform_device_register+0x28/0x40
[42949375.520000] [<ffffffff8053453c>]
physmap_init+0x58/0x74
[42949375.530000] [<ffffffff8010071c>]
init+0x2bc/0x68c
[42949375.530000] [<ffffffff8010523c>]
kernel_thread_helper+0x14/0x1c
[42949375.540000]
[42949375.540000]
[42949375.540000] Code: dc820018  0043102d  90420000
<080b6840> 304600ff  24020002  14c20006  24020004 
dc820018
[42949375.550000] Kernel panic - not syncing:
Attempted to kill init!
[42949375.560000]  BUG: warning at
kernel/lockdep.c:1822/trace_hardirqs_on()
[42949375.560000] Rebooting in 5 seconds..Call Trace:
[42949375.560000] [<ffffffff80109ffc>]
dump_stack+0x10/0x54
[42949375.560000] [<ffffffff8016226c>]
trace_hardirqs_on+0x190/0x290
[42949375.560000] [<ffffffff8010cb04>]
stop_this_cpu+0x64/0x7c
[42949375.560000] [<ffffffff8010d1f0>]
smp_call_function_interrupt+0x90/0xf0
[42949375.560000] [<ffffffff801020d8>]
sb1250_mailbox_interrupt+0xdc/0xf8
[42949375.560000] [<ffffffff80101934>]
plat_irq_dispatch+0x54/0x1ec
[42949375.560000] [<ffffffff801027e0>]
ret_from_irq+0x0/0x4
[42949375.560000] [<ffffffff801052c0>]
cpu_idle+0x40/0x7c
[42949375.560000] [<ffffffff80100b48>]
rest_init+0x5c/0x74
[42949375.560000] [<ffffffff8051000c>]
start_kernel+0x660/0x688
[42949375.560000]



 
____________________________________________________________________________________
Sponsored Link

Online degrees - find the right program to advance your career.
Www.nextag.com

From mark.e.mason@broadcom.com Fri Nov 17 23:32:53 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 17 Nov 2006 23:32:55 +0000 (GMT)
Received: from mms1.broadcom.com ([216.31.210.17]:47366 "EHLO
	mms1.broadcom.com") by ftp.linux-mips.org with ESMTP
	id S20037618AbWKQXcx convert rfc822-to-8bit (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Fri, 17 Nov 2006 23:32:53 +0000
Received: from 10.10.64.154 by mms1.broadcom.com with ESMTP (Broadcom
 SMTP Relay (Email Firewall v6.3.0)); Fri, 17 Nov 2006 15:32:36 -0800
X-Server-Uuid: D7CB97D3-6392-476F-BE46-AB3D6F515C9A
Received: by mail-irva-10.broadcom.com (Postfix, from userid 47) id
 A7D382B1; Fri, 17 Nov 2006 15:32:35 -0800 (PST)
Received: from mail-irva-8.broadcom.com (mail-irva-8 [10.10.64.221]) by
 mail-irva-10.broadcom.com (Postfix) with ESMTP id E14582B1; Fri, 17 Nov
 2006 15:32:34 -0800 (PST)
Received: from mail-sj1-12.sj.broadcom.com (mail-sj1-12.sj.broadcom.com
 [10.16.128.215]) by mail-irva-8.broadcom.com (MOS 3.7.5a-GA) with ESMTP
 id ELT57731; Fri, 17 Nov 2006 15:32:34 -0800 (PST)
Received: from NT-SJCA-0750.brcm.ad.broadcom.com (nt-sjca-0750
 [10.16.192.220]) by mail-sj1-12.sj.broadcom.com (Postfix) with ESMTP id
 53C4520501; Fri, 17 Nov 2006 15:32:34 -0800 (PST)
X-MimeOLE: Produced By Microsoft Exchange V6.5
Content-class: urn:content-classes:message
MIME-Version: 1.0
Subject: RE: Getting a data bus error on SB1 board
Date:	Fri, 17 Nov 2006 15:32:32 -0800
Message-ID: <7E000E7F06B05C49BDBB769ADAF44D07014C11FD@NT-SJCA-0750.brcm.ad.broadcom.com>
In-Reply-To: <20061117214910.53076.qmail@web31506.mail.mud.yahoo.com>
Thread-Topic: Getting a data bus error on SB1 board
Thread-Index: AccKkny6uG5k+GC5Ry6EclyIfeZhqQADcoIQ
From:	"Mark E Mason" <mark.e.mason@broadcom.com>
To:	"Jonathan Day" <imipak@yahoo.com>, linux-mips@linux-mips.org
X-WSS-ID: 694099183807205881-03-01
Content-Type: text/plain;
 charset=us-ascii
Content-Transfer-Encoding: 8BIT
Return-Path: <mark.e.mason@broadcom.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13214
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: mark.e.mason@broadcom.com
Precedence: bulk
X-list: linux-mips

Hello Jon,

A couple of questions:

1) What revision of 1250 is on the board?
2) What version of CFE are you running?
3) Is this always repeatable?
4) Have you been able to try it on more than one 1250 board?

If you're using Bn silicon - could you email me your kernel image, and
I'll try it here on mine.

Thanks,
Mark 

> -----Original Message-----
> From: linux-mips-bounce@linux-mips.org 
> [mailto:linux-mips-bounce@linux-mips.org] On Behalf Of Jonathan Day
> Sent: Friday, November 17, 2006 1:49 PM
> To: linux-mips@linux-mips.org
> Subject: Getting a data bus error on SB1 board
> 
> Hi,
> 
> I'm using the latest (ok, 17th November, 10am pacific
> time) git tree on the Broadcom BCM91250 that I've
> always had problems with/nightmares about.
> 
> I'm getting a data bus error and am wondering if there
> are any un-gitted patches circulating that fix the
> problem and/or can diagnose better what is going on.
> 
> After turning on ALL of the debugging Linux has to
> offer (and then some), this is the part of the boot
> log that shows what is happening:
> 
> [42949373.640000] Good, all 218 testcases passed! |
> [42949373.650000] ---------------------------------
> [42949373.650000] Dentry cache hash table entries:
> 32768 (order: 6, 262144 bytes)
> [42949373.660000] Inode-cache hash table entries:
> 16384 (order: 5, 131072 bytes)
> [42949373.700000] Memory: 247296k/260764k available
> (3030k kernel code, 13152k reserved, 1123k data, 232k
> init, 0k highmem)
> [42949373.960000] Mount-cache hash table entries: 256
> [42949373.970000] Checking for 'wait' instruction... 
> unavailable.
> [42949373.970000] Checking for the multiply/shift
> bug... no.
> [42949373.980000] Checking for the daddi bug... no.
> [42949373.980000] Checking for the daddiu bug... no.
> [42949373.990000] CPU revision is: 03040102
> [42949373.990000] FPU revision is: 000f0102
> [42949373.990000] Primary instruction cache 32kB,
> 4-way, linesize 32 bytes.
> [42949373.990000] Primary data cache 32kB, 4-way,
> linesize 32 bytes.
> [42949373.990000] Synthesized TLB refill handler (40
> instructions).
> [42949374.240000] Brought up 2 CPUs
> [42949374.270000] migration_cost=10000
> [42949374.290000] NET: Registered protocol family 16
> [42949374.330000] Generic PHY: Registered new driver
> [42949374.340000] SCSI subsystem initialized
> [42949374.340000] usbcore: registered new interface
> driver usbfs
> [42949374.350000] usbcore: registered new interface
> driver hub
> [42949374.360000] usbcore: registered new device
> driver usb
> [42949374.380000] NET: Registered protocol family 2
> [42949374.500000] IP route cache hash table entries:
> 2048 (order: 2, 16384 bytes)
> [42949374.500000] TCP established hash table entries:
> 8192 (order: 6, 458752 bytes)
> [42949374.520000] TCP bind hash table entries: 4096
> (order: 5, 229376 bytes)
> [42949374.530000] TCP: Hash tables configured
> (established 8192 bind 4096)
> [42949374.530000] TCP reno registered
> [42949374.550000] Initializing RT-Tester: OK
> [42949374.550000] audit: initializing netlink socket
> (disabled)
> [42949374.560000] audit(1163791574.600:1): initialized
> [42949374.570000] io scheduler noop registered
> [42949374.570000] io scheduler anticipatory registered
> [42949374.580000] io scheduler deadline registered
> (default)
> [42949374.590000] io scheduler cfq registered
> [42949375.160000] RAMDISK driver initialized: 1 RAM
> disks of 4096K size 1024 blocksize
> [42949375.170000] eth0: enabling TCP rcv checksum
> [42949375.170000] eth0: SiByte Ethernet at 0x10064000,
> address: 00:02:4C:FD:0D:3C
> [42949375.180000] eth1: enabling TCP rcv checksum
> [42949375.190000] eth1: SiByte Ethernet at 0x10065000,
> address: 00:02:4C:FD:0D:3D
> [42949375.200000] physmap platform flash device:
> 01000000 at 1fc00000
> [42949375.210000] physmap-flash.0: Found 1 x16 devices
> at 0x0 in 8-bit bank
> [42949375.210000] DBE physical address: 0020000020
> [42949375.220000] Data bus error, epc ==
> ffffffff802da0bc, ra == ffffffff802da6d0
> [42949375.230000] Oops[#1]:
> [42949375.230000] Cpu 1
> [42949375.230000] $ 0   : 0000000000000000
> 0000000014001fe0 0000000000000000 0000000000400020
> [42949375.240000] $ 4   : a800000000b2e770
> 0000000000400000 0000000000000001 0000000000000001
> [42949375.250000] $ 8   : 0000000000000001
> 0000000000000001 0000000000000002 a80000000fe27b23
> [42949375.260000] $12   : 000000000000000a
> 0000000000000000 0000000000000000 ffffffff80406ef8
> [42949375.260000] $16   : a800000000b2e770
> a80000000fe27c50 0000000000000001 0000000000400000
> [42949375.270000] $20   : ffffffff80480d70
> 0000000000400000 ffffffff8047dd80 ffffffff80481388
> [42949375.280000] $24   : 0000000000000030
> 0000000000000000
> [42949375.290000] $28   : a80000000fe24000
> a80000000fe27bb0 a80000000fe27bb0 ffffffff802da6d0
> [42949375.300000] Hi    : 0000000000000000
> [42949375.300000] Lo    : 0000000000000001
> [42949375.300000] epc   : ffffffff802da0bc
> qry_present+0x2ac/0x420     Not tainted
> [42949375.310000] ra    : ffffffff802da6d0
> cfi_probe_chip+0x460/0x17d0
> [42949375.320000] Status: 14001fe3    KX SX UX KERNEL
> EXL IE
> [42949375.320000] Cause : 8080001c
> [42949375.330000] PrId  : 03040102
> [42949375.330000] Modules linked in:
> [42949375.330000] Process swapper (pid: 1,
> threadinfo=a80000000fe24000, task=a80000000fe20e08)
> [42949375.340000] Stack : 0000000000000000
> ffffffff80481370 0000000000200000 0000000000000051
> [42949375.350000]         0000000000000052
> 0000000000000059 a80000000fe27bf0 a80000000fe27b23
> [42949375.360000]         a800000000b2cb58
> 00000000000000d0 0000000000000003 a800000000b2cb58
> [42949375.360000]         0000000000000001
> a800000000b2e770 ffffffff80480d70 0000000000000008
> [42949375.370000]         ffffffff8047dd80
> ffffffff80481388 a80000000fe27c50 ffffffff802e31b8
> [42949375.380000]         0000000000000000
> 0000000000000000 0000000100000002 0000000100000000
> [42949375.390000]         0000000000000000
> 0000000000000000 a800000000aff668 000000ad00000049
> [42949375.400000]         0000000100000000
> 0000000000000015 0000000000000000 a80000000fe27cc0
> [42949375.410000]         ffffffff80480d40
> ffffffff80428288 a800000000b2e770 ffffffff80481370
> [42949375.410000]         ffffffff80481150
> ffffffff80481498 ffffffff8047dd80 ffffffff80481388
> [42949375.420000]         ...
> [42949375.420000] Call Trace:
> [42949375.430000] [<ffffffff802da0bc>]
> qry_present+0x2ac/0x420
> [42949375.430000] [<ffffffff802da6d0>]
> cfi_probe_chip+0x460/0x17d0
> [42949375.440000] [<ffffffff802e31b8>]
> mtd_do_chip_probe+0x1d4/0x48c
> [42949375.440000] [<ffffffff802da25c>]
> cfi_probe+0x2c/0x40
> [42949375.450000] [<ffffffff802d9d64>]
> do_map_probe+0x7c/0x128
> [42949375.460000] [<ffffffff802e37f4>]
> physmap_flash_probe+0x1f8/0x324
> [42949375.460000] [<ffffffff802bdd2c>]
> platform_drv_probe+0x20/0x34
> [42949375.470000] [<ffffffff802bb418>]
> really_probe+0x94/0x1d4
> [42949375.470000] [<ffffffff802bb65c>]
> driver_probe_device+0x104/0x124
> [42949375.480000] [<ffffffff802bb690>]
> __device_attach+0x14/0x28
> [42949375.480000] [<ffffffff802ba1e0>]
> bus_for_each_drv+0x5c/0xb0
> [42949375.490000] [<ffffffff802bb760>]
> device_attach+0xbc/0x110
> [42949375.500000] [<ffffffff802ba0b8>]
> bus_attach_device+0x40/0x94
> [42949375.500000] [<ffffffff802b8588>]
> device_add+0x40c/0x5d4
> [42949375.510000] [<ffffffff802be39c>]
> platform_device_add+0x1b4/0x218
> [42949375.510000] [<ffffffff802be428>]
> platform_device_register+0x28/0x40
> [42949375.520000] [<ffffffff8053453c>]
> physmap_init+0x58/0x74
> [42949375.530000] [<ffffffff8010071c>]
> init+0x2bc/0x68c
> [42949375.530000] [<ffffffff8010523c>]
> kernel_thread_helper+0x14/0x1c
> [42949375.540000]
> [42949375.540000]
> [42949375.540000] Code: dc820018  0043102d  90420000
> <080b6840> 304600ff  24020002  14c20006  24020004 
> dc820018
> [42949375.550000] Kernel panic - not syncing:
> Attempted to kill init!
> [42949375.560000]  BUG: warning at
> kernel/lockdep.c:1822/trace_hardirqs_on()
> [42949375.560000] Rebooting in 5 seconds..Call Trace:
> [42949375.560000] [<ffffffff80109ffc>]
> dump_stack+0x10/0x54
> [42949375.560000] [<ffffffff8016226c>]
> trace_hardirqs_on+0x190/0x290
> [42949375.560000] [<ffffffff8010cb04>]
> stop_this_cpu+0x64/0x7c
> [42949375.560000] [<ffffffff8010d1f0>]
> smp_call_function_interrupt+0x90/0xf0
> [42949375.560000] [<ffffffff801020d8>]
> sb1250_mailbox_interrupt+0xdc/0xf8
> [42949375.560000] [<ffffffff80101934>]
> plat_irq_dispatch+0x54/0x1ec
> [42949375.560000] [<ffffffff801027e0>]
> ret_from_irq+0x0/0x4
> [42949375.560000] [<ffffffff801052c0>]
> cpu_idle+0x40/0x7c
> [42949375.560000] [<ffffffff80100b48>]
> rest_init+0x5c/0x74
> [42949375.560000] [<ffffffff8051000c>]
> start_kernel+0x660/0x688
> [42949375.560000]
> 
> 
> 
>  
> ______________________________________________________________
> ______________________
> Sponsored Link
> 
> Online degrees - find the right program to advance your career.
> Www.nextag.com
> 
> 
> 


From manoje@broadcom.com Sat Nov 18 00:50:47 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Sat, 18 Nov 2006 00:50:51 +0000 (GMT)
Received: from mms1.broadcom.com ([216.31.210.17]:21767 "EHLO
	mms1.broadcom.com") by ftp.linux-mips.org with ESMTP
	id S20037697AbWKRAur convert rfc822-to-8bit (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Sat, 18 Nov 2006 00:50:47 +0000
Received: from 10.10.64.154 by mms1.broadcom.com with ESMTP (Broadcom
 SMTP Relay (Email Firewall v6.3.0)); Fri, 17 Nov 2006 16:50:30 -0800
X-Server-Uuid: D7CB97D3-6392-476F-BE46-AB3D6F515C9A
Received: by mail-irva-10.broadcom.com (Postfix, from userid 47) id
 DB5D12AF; Fri, 17 Nov 2006 16:50:29 -0800 (PST)
Received: from mail-irva-8.broadcom.com (mail-irva-8 [10.10.64.221]) by
 mail-irva-10.broadcom.com (Postfix) with ESMTP id B3EED2AE; Fri, 17 Nov
 2006 16:50:29 -0800 (PST)
Received: from mail-sj1-12.sj.broadcom.com (mail-sj1-12.sj.broadcom.com
 [10.16.128.215]) by mail-irva-8.broadcom.com (MOS 3.7.5a-GA) with ESMTP
 id ELT82946; Fri, 17 Nov 2006 16:50:29 -0800 (PST)
Received: from NT-SJCA-0750.brcm.ad.broadcom.com (nt-sjca-0750
 [10.16.192.220]) by mail-sj1-12.sj.broadcom.com (Postfix) with ESMTP id
 3C75620501; Fri, 17 Nov 2006 16:50:29 -0800 (PST)
Received: from NT-SJCA-0752.brcm.ad.broadcom.com ([10.16.192.222]) by
 NT-SJCA-0750.brcm.ad.broadcom.com with Microsoft
 SMTPSVC(6.0.3790.1830); Fri, 17 Nov 2006 16:50:29 -0800
X-MimeOLE: Produced By Microsoft Exchange V6.5
Content-class: urn:content-classes:message
MIME-Version: 1.0
Subject: RE: Getting a data bus error on SB1 board
Date:	Fri, 17 Nov 2006 16:50:27 -0800
Message-ID: <710F16C36810444CA2F5821E5EAB7F23103E44@NT-SJCA-0752.brcm.ad.broadcom.com>
In-Reply-To: <20061117214910.53076.qmail@web31506.mail.mud.yahoo.com>
Thread-Topic: Getting a data bus error on SB1 board
Thread-Index: AccKklcCE/Q8cer0QcWFWCJkPDjRtQAFekRA
From:	"Manoj Ekbote" <manoje@broadcom.com>
To:	"Jonathan Day" <imipak@yahoo.com>, linux-mips@linux-mips.org
X-OriginalArrivalTime: 18 Nov 2006 00:50:29.0068 (UTC)
 FILETIME=[8AFA18C0:01C70AAB]
X-WSS-ID: 6940875C3807237149-01-01
Content-Type: text/plain;
 charset=us-ascii
Content-Transfer-Encoding: 8BIT
Return-Path: <manoje@broadcom.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13215
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: manoje@broadcom.com
Precedence: bulk
X-list: linux-mips

Hi,

The latest source boots on the SWARM board that I have. I am using NFS
to boot. 

/manoj

>-----Original Message-----
>From: linux-mips-bounce@linux-mips.org 
>[mailto:linux-mips-bounce@linux-mips.org] On Behalf Of Jonathan Day
>Sent: Friday, November 17, 2006 1:49 PM
>To: linux-mips@linux-mips.org
>Subject: Getting a data bus error on SB1 board
>
>Hi,
>
>I'm using the latest (ok, 17th November, 10am pacific
>time) git tree on the Broadcom BCM91250 that I've always had 
>problems with/nightmares about.
>
>I'm getting a data bus error and am wondering if there are any 
>un-gitted patches circulating that fix the problem and/or can 
>diagnose better what is going on.
>
>After turning on ALL of the debugging Linux has to offer (and 
>then some), this is the part of the boot log that shows what 
>is happening:
>
>[42949373.640000] Good, all 218 testcases passed! | 
>[42949373.650000] --------------------------------- 
>[42949373.650000] Dentry cache hash table entries:
>32768 (order: 6, 262144 bytes)
>[42949373.660000] Inode-cache hash table entries:
>16384 (order: 5, 131072 bytes)
>[42949373.700000] Memory: 247296k/260764k available (3030k 
>kernel code, 13152k reserved, 1123k data, 232k init, 0k 
>highmem) [42949373.960000] Mount-cache hash table entries: 256 
>[42949373.970000] Checking for 'wait' instruction... 
>unavailable.
>[42949373.970000] Checking for the multiply/shift bug... no.
>[42949373.980000] Checking for the daddi bug... no.
>[42949373.980000] Checking for the daddiu bug... no.
>[42949373.990000] CPU revision is: 03040102 [42949373.990000] 
>FPU revision is: 000f0102 [42949373.990000] Primary 
>instruction cache 32kB, 4-way, linesize 32 bytes.
>[42949373.990000] Primary data cache 32kB, 4-way, linesize 32 bytes.
>[42949373.990000] Synthesized TLB refill handler (40 instructions).
>[42949374.240000] Brought up 2 CPUs
>[42949374.270000] migration_cost=10000
>[42949374.290000] NET: Registered protocol family 16 
>[42949374.330000] Generic PHY: Registered new driver 
>[42949374.340000] SCSI subsystem initialized [42949374.340000] 
>usbcore: registered new interface driver usbfs 
>[42949374.350000] usbcore: registered new interface driver hub 
>[42949374.360000] usbcore: registered new device driver usb 
>[42949374.380000] NET: Registered protocol family 2 
>[42949374.500000] IP route cache hash table entries:
>2048 (order: 2, 16384 bytes)
>[42949374.500000] TCP established hash table entries:
>8192 (order: 6, 458752 bytes)
>[42949374.520000] TCP bind hash table entries: 4096
>(order: 5, 229376 bytes)
>[42949374.530000] TCP: Hash tables configured (established 
>8192 bind 4096) [42949374.530000] TCP reno registered 
>[42949374.550000] Initializing RT-Tester: OK [42949374.550000] 
>audit: initializing netlink socket
>(disabled)
>[42949374.560000] audit(1163791574.600:1): initialized 
>[42949374.570000] io scheduler noop registered 
>[42949374.570000] io scheduler anticipatory registered 
>[42949374.580000] io scheduler deadline registered
>(default)
>[42949374.590000] io scheduler cfq registered 
>[42949375.160000] RAMDISK driver initialized: 1 RAM disks of 
>4096K size 1024 blocksize [42949375.170000] eth0: enabling TCP 
>rcv checksum [42949375.170000] eth0: SiByte Ethernet at 0x10064000,
>address: 00:02:4C:FD:0D:3C
>[42949375.180000] eth1: enabling TCP rcv checksum 
>[42949375.190000] eth1: SiByte Ethernet at 0x10065000,
>address: 00:02:4C:FD:0D:3D
>[42949375.200000] physmap platform flash device:
>01000000 at 1fc00000
>[42949375.210000] physmap-flash.0: Found 1 x16 devices at 0x0 
>in 8-bit bank [42949375.210000] DBE physical address: 
>0020000020 [42949375.220000] Data bus error, epc == 
>ffffffff802da0bc, ra == ffffffff802da6d0 [42949375.230000] Oops[#1]:
>[42949375.230000] Cpu 1
>[42949375.230000] $ 0   : 0000000000000000
>0000000014001fe0 0000000000000000 0000000000400020
>[42949375.240000] $ 4   : a800000000b2e770
>0000000000400000 0000000000000001 0000000000000001
>[42949375.250000] $ 8   : 0000000000000001
>0000000000000001 0000000000000002 a80000000fe27b23
>[42949375.260000] $12   : 000000000000000a
>0000000000000000 0000000000000000 ffffffff80406ef8
>[42949375.260000] $16   : a800000000b2e770
>a80000000fe27c50 0000000000000001 0000000000400000
>[42949375.270000] $20   : ffffffff80480d70
>0000000000400000 ffffffff8047dd80 ffffffff80481388
>[42949375.280000] $24   : 0000000000000030
>0000000000000000
>[42949375.290000] $28   : a80000000fe24000
>a80000000fe27bb0 a80000000fe27bb0 ffffffff802da6d0
>[42949375.300000] Hi    : 0000000000000000
>[42949375.300000] Lo    : 0000000000000001
>[42949375.300000] epc   : ffffffff802da0bc
>qry_present+0x2ac/0x420     Not tainted
>[42949375.310000] ra    : ffffffff802da6d0
>cfi_probe_chip+0x460/0x17d0
>[42949375.320000] Status: 14001fe3    KX SX UX KERNEL
>EXL IE
>[42949375.320000] Cause : 8080001c
>[42949375.330000] PrId  : 03040102
>[42949375.330000] Modules linked in:
>[42949375.330000] Process swapper (pid: 1, 
>threadinfo=a80000000fe24000, task=a80000000fe20e08) 
>[42949375.340000] Stack : 0000000000000000 ffffffff80481370 
>0000000000200000 0000000000000051
>[42949375.350000]         0000000000000052
>0000000000000059 a80000000fe27bf0 a80000000fe27b23
>[42949375.360000]         a800000000b2cb58
>00000000000000d0 0000000000000003 a800000000b2cb58
>[42949375.360000]         0000000000000001
>a800000000b2e770 ffffffff80480d70 0000000000000008
>[42949375.370000]         ffffffff8047dd80
>ffffffff80481388 a80000000fe27c50 ffffffff802e31b8
>[42949375.380000]         0000000000000000
>0000000000000000 0000000100000002 0000000100000000
>[42949375.390000]         0000000000000000
>0000000000000000 a800000000aff668 000000ad00000049
>[42949375.400000]         0000000100000000
>0000000000000015 0000000000000000 a80000000fe27cc0
>[42949375.410000]         ffffffff80480d40
>ffffffff80428288 a800000000b2e770 ffffffff80481370
>[42949375.410000]         ffffffff80481150
>ffffffff80481498 ffffffff8047dd80 ffffffff80481388
>[42949375.420000]         ...
>[42949375.420000] Call Trace:
>[42949375.430000] [<ffffffff802da0bc>]
>qry_present+0x2ac/0x420
>[42949375.430000] [<ffffffff802da6d0>]
>cfi_probe_chip+0x460/0x17d0
>[42949375.440000] [<ffffffff802e31b8>]
>mtd_do_chip_probe+0x1d4/0x48c
>[42949375.440000] [<ffffffff802da25c>]
>cfi_probe+0x2c/0x40
>[42949375.450000] [<ffffffff802d9d64>]
>do_map_probe+0x7c/0x128
>[42949375.460000] [<ffffffff802e37f4>]
>physmap_flash_probe+0x1f8/0x324
>[42949375.460000] [<ffffffff802bdd2c>]
>platform_drv_probe+0x20/0x34
>[42949375.470000] [<ffffffff802bb418>]
>really_probe+0x94/0x1d4
>[42949375.470000] [<ffffffff802bb65c>]
>driver_probe_device+0x104/0x124
>[42949375.480000] [<ffffffff802bb690>]
>__device_attach+0x14/0x28
>[42949375.480000] [<ffffffff802ba1e0>]
>bus_for_each_drv+0x5c/0xb0
>[42949375.490000] [<ffffffff802bb760>]
>device_attach+0xbc/0x110
>[42949375.500000] [<ffffffff802ba0b8>]
>bus_attach_device+0x40/0x94
>[42949375.500000] [<ffffffff802b8588>]
>device_add+0x40c/0x5d4
>[42949375.510000] [<ffffffff802be39c>]
>platform_device_add+0x1b4/0x218
>[42949375.510000] [<ffffffff802be428>]
>platform_device_register+0x28/0x40
>[42949375.520000] [<ffffffff8053453c>]
>physmap_init+0x58/0x74
>[42949375.530000] [<ffffffff8010071c>]
>init+0x2bc/0x68c
>[42949375.530000] [<ffffffff8010523c>]
>kernel_thread_helper+0x14/0x1c
>[42949375.540000]
>[42949375.540000]
>[42949375.540000] Code: dc820018  0043102d  90420000 
><080b6840> 304600ff  24020002  14c20006  24020004
>dc820018
>[42949375.550000] Kernel panic - not syncing:
>Attempted to kill init!
>[42949375.560000]  BUG: warning at
>kernel/lockdep.c:1822/trace_hardirqs_on()
>[42949375.560000] Rebooting in 5 seconds..Call Trace:
>[42949375.560000] [<ffffffff80109ffc>]
>dump_stack+0x10/0x54
>[42949375.560000] [<ffffffff8016226c>]
>trace_hardirqs_on+0x190/0x290
>[42949375.560000] [<ffffffff8010cb04>]
>stop_this_cpu+0x64/0x7c
>[42949375.560000] [<ffffffff8010d1f0>]
>smp_call_function_interrupt+0x90/0xf0
>[42949375.560000] [<ffffffff801020d8>]
>sb1250_mailbox_interrupt+0xdc/0xf8
>[42949375.560000] [<ffffffff80101934>]
>plat_irq_dispatch+0x54/0x1ec
>[42949375.560000] [<ffffffff801027e0>]
>ret_from_irq+0x0/0x4
>[42949375.560000] [<ffffffff801052c0>]
>cpu_idle+0x40/0x7c
>[42949375.560000] [<ffffffff80100b48>]
>rest_init+0x5c/0x74
>[42949375.560000] [<ffffffff8051000c>]
>start_kernel+0x660/0x688
>[42949375.560000]
>
>
>
> 
>_______________________________________________________________
>_____________________
>Sponsored Link
>
>Online degrees - find the right program to advance your career.
>Www.nextag.com
>
>
>


From anemo@mba.ocn.ne.jp Sat Nov 18 14:24:42 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Sat, 18 Nov 2006 14:24:49 +0000 (GMT)
Received: from mba.ocn.ne.jp ([210.190.142.172]:63208 "HELO smtp.mba.ocn.ne.jp")
	by ftp.linux-mips.org with SMTP id S20038418AbWKROYm (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Sat, 18 Nov 2006 14:24:42 +0000
Received: from localhost (p8201-ipad202funabasi.chiba.ocn.ne.jp [222.146.79.201])
	by smtp.mba.ocn.ne.jp (Postfix) with ESMTP
	id 93DE8B700; Sat, 18 Nov 2006 23:24:37 +0900 (JST)
Date:	Sat, 18 Nov 2006 23:27:17 +0900 (JST)
Message-Id: <20061118.232717.07456069.anemo@mba.ocn.ne.jp>
To:	ralf@linux-mips.org
Cc:	linux-mips@linux-mips.org
Subject: Re: [PATCH] rewrite restore_fp_context/save_fp_context
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
In-Reply-To: <20061116.001725.75185058.anemo@mba.ocn.ne.jp>
References: <20060829.225631.41630441.anemo@mba.ocn.ne.jp>
	<20061114174608.GA5740@linux-mips.org>
	<20061116.001725.75185058.anemo@mba.ocn.ne.jp>
X-Fingerprint: 6ACA 1623 39BD 9A94 9B1A  B746 CA77 FE94 2874 D52F
X-Pgp-Public-Key: http://wwwkeys.pgp.net/pks/lookup?op=get&search=0x2874D52F
X-Mailer: Mew version 3.3 on Emacs 21.4 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Return-Path: <anemo@mba.ocn.ne.jp>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13216
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: anemo@mba.ocn.ne.jp
Precedence: bulk
X-list: linux-mips

On Thu, 16 Nov 2006 00:17:25 +0900 (JST), Atsushi Nemoto <anemo@mba.ocn.ne.jp> wrote:
> > So with this patch applied the context will be copied around twice, first
> > save the fp registers to memory then copied from memory to userspace and
> > as the result the non-preemptible kernel will suffer from fixing the
> > preemptible ...
> 
> Yes, it is true if the signaled process owned FPU at the time.  I
> thought in many case the signaled process does not own FPU, but I
> might be too optimistic indeed.

Correction: This problem is not only preemptible kernel.
save_fp_context() might sleep on access to user stack, so it might
lose fpu ownership.  Then subsequent FP instruction cause CpU
exception in kernel code.

> > To me it looks like the real problem that setup_sigcontext and
> > restore_sigcontext need to disable preemption.  And the reason for that
> > is probably that 87d54649f67d8ffe0a8d8176de8c210a6c4bb4a7 around 2.6.9
> > took the wrong.  The better fix would probably have been to allow
> > at least some fp instructions from kernel mode.  The sole reason for
> > the die_if_kernel() call is to tell people attempting to put FPU code
> > into the kernel that they're screwing up.
> 
> Hmm.  Two yeas ago I tried this approach to fix fpu-emulator issues
> and gave up :) It was a bit complex more than it looked.  Here is
> excerption:
> ...
> 
> But it might be a good time to try again.  Do you think modifying
> resume() etc. is OK?

It still a bit complex more than it looked :)

Allowing CpU exception for CP1 in kernel can fix some problem, but it
is somewhat fragile I think.  For example, I first thought the last
part of setup_sigcontext() would become something like this:

	err |= __put_user(!!used_math(), &sc->sc_used_math);

	/*
	 * Save FPU state to signal context.  Signal handler will "inherit"
	 * current FPU state.
	 */
	if (used_math())
		err |= save_fp_context(sc);
	return err;

If save_fp_context cause CpU exception, kernel will handle it
correctly and take fpu owner ship.  Very simple.

BUT it would _not_ work!

In kernel we can not assume C0_STATUS.CU1==0 if is_fpu_owner()==0.
This is because we might lose fpu ownership in middle of
C0_STATUS manipulation such as local_irq_disable(), etc.

local_irq_disable:
	mfc0	$1,$12
	ori	$1,0x1f
	xori	$1,0x1f
	mtc0	$1,$12

If the task was preempted on the ORI instruction, the task's
TIF_USEDFPU flag and CU1 bit in saved user stack will be cleared.
When the task restart from ORI instruction, C0_STATUS.CU1 bit will
have been cleared too, but $1 register still hold old C0_STATUS value.
Then the MTC0 instruction will set C0_STATUS.CU1 without restoring
real FPU context.

So, we still should very careful to using fp instruction in kernel
even if the instruction did not change the fpu state.  The last part
of setup_sigcontext() should become something like this:

	err |= __put_user(!!used_math(), &sc->sc_used_math);

	/*
	 * Save FPU state to signal context.  Signal handler will "inherit"
	 * current FPU state.
	 */
	if (used_math()) {
		preempt_disable();
		if (!is_fpu_owner()) {
			own_fpu();
			restore_fp(current);
		}
		preempt_enable();
		err |= save_fp_context(sc);
	}
	return err;

Still somewhat ugly but the original problem (calling save_fp_context
in atomic context) seems fixed.

I still investigating and for now I think allowing CpU exception for
CP1 in kernel _unconditionally_ is very fragile.  Maybe something like
TIF_ALLOW_FP_IN_KERNEL flag to enable/disable that feature might be
worth to consider.

---
Atsushi Nemoto

From anemo@mba.ocn.ne.jp Sun Nov 19 13:51:27 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Sun, 19 Nov 2006 13:51:32 +0000 (GMT)
Received: from mba.ocn.ne.jp ([210.190.142.172]:38085 "HELO smtp.mba.ocn.ne.jp")
	by ftp.linux-mips.org with SMTP id S20038590AbWKSNv1 (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Sun, 19 Nov 2006 13:51:27 +0000
Received: from localhost (p2074-ipad202funabasi.chiba.ocn.ne.jp [222.146.73.74])
	by smtp.mba.ocn.ne.jp (Postfix) with ESMTP
	id 25F0EA6A4; Sun, 19 Nov 2006 22:51:22 +0900 (JST)
Date:	Sun, 19 Nov 2006 22:54:03 +0900 (JST)
Message-Id: <20061119.225403.93019610.anemo@mba.ocn.ne.jp>
To:	ralf@linux-mips.org
Cc:	linux-mips@linux-mips.org
Subject: Re: [PATCH] rewrite restore_fp_context/save_fp_context
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
In-Reply-To: <20061118.232717.07456069.anemo@mba.ocn.ne.jp>
References: <20061114174608.GA5740@linux-mips.org>
	<20061116.001725.75185058.anemo@mba.ocn.ne.jp>
	<20061118.232717.07456069.anemo@mba.ocn.ne.jp>
X-Fingerprint: 6ACA 1623 39BD 9A94 9B1A  B746 CA77 FE94 2874 D52F
X-Pgp-Public-Key: http://wwwkeys.pgp.net/pks/lookup?op=get&search=0x2874D52F
X-Mailer: Mew version 3.3 on Emacs 21.4 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Return-Path: <anemo@mba.ocn.ne.jp>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13217
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: anemo@mba.ocn.ne.jp
Precedence: bulk
X-list: linux-mips

On Sat, 18 Nov 2006 23:27:17 +0900 (JST), Atsushi Nemoto <anemo@mba.ocn.ne.jp> wrote:
> So, we still should very careful to using fp instruction in kernel
> even if the instruction did not change the fpu state.  The last part
> of setup_sigcontext() should become something like this:
> 
> 	err |= __put_user(!!used_math(), &sc->sc_used_math);
> 
> 	/*
> 	 * Save FPU state to signal context.  Signal handler will "inherit"
> 	 * current FPU state.
> 	 */
> 	if (used_math()) {
> 		preempt_disable();
> 		if (!is_fpu_owner()) {
> 			own_fpu();
> 			restore_fp(current);
> 		}
> 		preempt_enable();
> 		err |= save_fp_context(sc);
> 	}
> 	return err;

Unfortunately, still this is not safe.  preempt_enable() might call
local_irq_enable() so it might lose fpu ownership without clearing CU1
bit...

So something like this ugly check should be needed.

 		preempt_disable();
 		if (!is_fpu_owner()) {
 			own_fpu();
 			restore_fp(current);
 		}
 		preempt_enable();
		/* make sure CU1 and FPU ownership are consistent */
		if (!__is_fpu_owner() && (read_c0_status() & ST0_CU1))
			__disable_fpu();
 		err |= save_fp_context(sc);


From tbm@cyrius.com Sun Nov 19 15:00:32 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Sun, 19 Nov 2006 15:00:36 +0000 (GMT)
Received: from sorrow.cyrius.com ([65.19.161.204]:27915 "EHLO
	sorrow.cyrius.com") by ftp.linux-mips.org with ESMTP
	id S20038617AbWKSPAc (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Sun, 19 Nov 2006 15:00:32 +0000
Received: by sorrow.cyrius.com (Postfix, from userid 10)
	id AEB8664D3D; Sun, 19 Nov 2006 15:00:22 +0000 (UTC)
Received: by deprecation.cyrius.com (Postfix, from userid 1000)
	id B8A9254BEB; Sun, 19 Nov 2006 14:59:58 +0000 (GMT)
Date:	Sun, 19 Nov 2006 14:59:58 +0000
From:	Martin Michlmayr <tbm@cyrius.com>
To:	Ralf Baechle <ralf@linux-mips.org>, linux-mips@linux-mips.org
Subject: Fix long IDE detection delay by not scanning non-existent channels
Message-ID: <20061119145958.GA5935@deprecation.cyrius.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.5.13 (2006-08-11)
Return-Path: <tbm@cyrius.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13218
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: tbm@cyrius.com
Precedence: bulk
X-list: linux-mips

Ralf, please consider this patch.  It's being used successfully in
Debian and has been acked by Alan Cox.


From: Peter Horton <pdh@colonel-panic.org>

Fix long delay during Cobalt boot whilst scanning non-existent
interfaces. The logic is copied from i386 i.e. we only scan 2 legacy
ports if we have PCI IDE.

Signed-off-by: Peter Horton <pdh@colonel-panic.org>
Acked-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Martin Michlmayr <tbm@cyrius.com>

--- linux.git.orig/include/asm-mips/mach-generic/ide.h	2006-01-24 22:07:36.000000000 +0000
+++ linux.git/include/asm-mips/mach-generic/ide.h	2006-01-24 23:41:19.000000000 +0000
@@ -30,7 +30,7 @@
 
 #define IDE_ARCH_OBSOLETE_DEFAULTS
 
-static __inline__ int ide_probe_legacy(void)
+static __inline__ int ide_legacy_ports(void)
 {
 #ifdef CONFIG_PCI
 	struct pci_dev *dev;
@@ -38,11 +38,11 @@
 	    (dev = pci_get_class(PCI_CLASS_BRIDGE_ISA << 8, NULL)) != NULL) {
 		pci_dev_put(dev);
 
-		return 1;
+		return 2;
 	}
 	return 0;
 #elif defined(CONFIG_EISA) || defined(CONFIG_ISA)
-	return 1;
+	return 6;
 #else
 	return 0;
 #endif
@@ -50,30 +50,26 @@
 
 static __inline__ int ide_default_irq(unsigned long base)
 {
-	if (ide_probe_legacy())
-		switch (base) {
-		case 0x1f0:
-			return 14;
-		case 0x170:
-			return 15;
-		case 0x1e8:
-			return 11;
-		case 0x168:
-			return 10;
-		case 0x1e0:
-			return 8;
-		case 0x160:
-			return 12;
-		default:
-			return 0;
-		}
-	else
-		return 0;
+	switch (base) {
+	case 0x1f0:
+		return 14;
+	case 0x170:
+		return 15;
+	case 0x1e8:
+		return 11;
+	case 0x168:
+		return 10;
+	case 0x1e0:
+		return 8;
+	case 0x160:
+		return 12;
+	}
+	return 0;
 }
 
 static __inline__ unsigned long ide_default_io_base(int index)
 {
-	if (ide_probe_legacy())
+	if (index < ide_legacy_ports())
 		switch (index) {
 		case 0:
 			return 0x1f0;
@@ -87,11 +83,8 @@
 			return 0x1e0;
 		case 5:
 			return 0x160;
-		default:
-			return 0;
-		}
-	else
-		return 0;
+	}
+	return 0;
 }
 
 #define IDE_ARCH_OBSOLETE_INIT


-- 
Martin Michlmayr
http://www.cyrius.com/

From tbm@cyrius.com Sun Nov 19 15:00:59 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Sun, 19 Nov 2006 15:01:03 +0000 (GMT)
Received: from sorrow.cyrius.com ([65.19.161.204]:28171 "EHLO
	sorrow.cyrius.com") by ftp.linux-mips.org with ESMTP
	id S20038619AbWKSPAd (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Sun, 19 Nov 2006 15:00:33 +0000
Received: by sorrow.cyrius.com (Postfix, from userid 10)
	id 9516564D3F; Sun, 19 Nov 2006 15:00:21 +0000 (UTC)
Received: by deprecation.cyrius.com (Postfix, from userid 1000)
	id 5781F54E76; Sun, 19 Nov 2006 14:58:43 +0000 (GMT)
Date:	Sun, 19 Nov 2006 14:58:43 +0000
From:	Martin Michlmayr <tbm@cyrius.com>
To:	Ralf Baechle <ralf@linux-mips.org>, linux-mips@linux-mips.org
Cc:	ths@networkno.de
Subject: Add -mfix7000 to CONFIG_SGI_IP22
Message-ID: <20061119145843.GA5387@deprecation.cyrius.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.5.13 (2006-08-11)
Return-Path: <tbm@cyrius.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13219
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: tbm@cyrius.com
Precedence: bulk
X-list: linux-mips

What was the rationale to add that to CONFIG_SGI_IP22?  Shouldn't it
be added to CONFIG_SGI_IP32, i.e. O2?

From: Thiemo Seufer <ths@networkno.de>

Add -mfix7000 to CONFIG_SGI_IP22

Signed-off-by: Thiemo Seufer <ths@networkno.de>
Signed-off-by: Martin Michlmayr <tbm@cyrius.com>

--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -478,7 +478,7 @@ load-$(CONFIG_PNX8550_JBS)	+= 0xffffffff
 # address by 8kb.
 #
 core-$(CONFIG_SGI_IP22)		+= arch/mips/sgi-ip22/
-cflags-$(CONFIG_SGI_IP22)	+= -Iinclude/asm-mips/mach-ip22
+cflags-$(CONFIG_SGI_IP22)	+= -Iinclude/asm-mips/mach-ip22 -Wa,-mfix7000
 ifdef CONFIG_32BIT
 load-$(CONFIG_SGI_IP22)		+= 0xffffffff88002000
 endif

-- 
Martin Michlmayr
http://www.cyrius.com/

From ralf@linux-mips.org Sun Nov 19 16:34:18 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Sun, 19 Nov 2006 16:34:19 +0000 (GMT)
Received: from localhost.localdomain ([127.0.0.1]:52451 "EHLO
	dl5rb.ham-radio-op.net") by ftp.linux-mips.org with ESMTP
	id S20038721AbWKSQeS (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Sun, 19 Nov 2006 16:34:18 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by dl5rb.ham-radio-op.net (8.13.8/8.13.8) with ESMTP id kAJGYFtY012350;
	Sun, 19 Nov 2006 16:34:15 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.8/8.13.8/Submit) id kAJGYD5A012349;
	Sun, 19 Nov 2006 17:34:13 +0100
Date:	Sun, 19 Nov 2006 17:34:13 +0100
From:	Ralf Baechle <ralf@linux-mips.org>
To:	Martin Michlmayr <tbm@cyrius.com>
Cc:	linux-mips@linux-mips.org, ths@networkno.de
Subject: Re: Add -mfix7000 to CONFIG_SGI_IP22
Message-ID: <20061119163413.GB6240@linux-mips.org>
References: <20061119145843.GA5387@deprecation.cyrius.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20061119145843.GA5387@deprecation.cyrius.com>
User-Agent: Mutt/1.4.2.2i
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13220
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: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Sun, Nov 19, 2006 at 02:58:43PM +0000, Martin Michlmayr wrote:

> What was the rationale to add that to CONFIG_SGI_IP22?  Shouldn't it
> be added to CONFIG_SGI_IP32, i.e. O2?

Indeed.

And a workaround for what CPU bug is that supposed to be anyway?  My errata
don't document anything that looks like what -mfix7000 claims to fix.

  Ralf

From ralf@linux-mips.org Sun Nov 19 21:14:14 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Sun, 19 Nov 2006 21:14:16 +0000 (GMT)
Received: from localhost.localdomain ([127.0.0.1]:52704 "EHLO
	dl5rb.ham-radio-op.net") by ftp.linux-mips.org with ESMTP
	id S20039147AbWKSVOO (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Sun, 19 Nov 2006 21:14:14 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by dl5rb.ham-radio-op.net (8.13.8/8.13.8) with ESMTP id kAJLEBka018413;
	Sun, 19 Nov 2006 21:14:11 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.8/8.13.8/Submit) id kAJLE92q018412;
	Sun, 19 Nov 2006 22:14:09 +0100
Date:	Sun, 19 Nov 2006 22:14:09 +0100
From:	Ralf Baechle <ralf@linux-mips.org>
To:	Martin Michlmayr <tbm@cyrius.com>
Cc:	linux-mips@linux-mips.org, ths@networkno.de
Subject: Re: Add -mfix7000 to CONFIG_SGI_IP22
Message-ID: <20061119211409.GA12669@linux-mips.org>
References: <20061119145843.GA5387@deprecation.cyrius.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20061119145843.GA5387@deprecation.cyrius.com>
User-Agent: Mutt/1.4.2.2i
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13221
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: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Sun, Nov 19, 2006 at 02:58:43PM +0000, Martin Michlmayr wrote:

Thanks to gcc doing scheduling itself this patch has actually become a
dysfunctional placebo -> /dev/null.

  Ralf

From mano@roarinelk.homelinux.net Mon Nov 20 09:40:54 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 20 Nov 2006 09:40:59 +0000 (GMT)
Received: from fnoeppeil48.netpark.at ([217.175.205.176]:21520 "EHLO
	roarinelk.homelinux.net") by ftp.linux-mips.org with ESMTP
	id S20037611AbWKTJky (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Mon, 20 Nov 2006 09:40:54 +0000
Received: (qmail 13519 invoked by uid 1000); 20 Nov 2006 10:40:53 +0100
Date:	Mon, 20 Nov 2006 10:40:53 +0100
From:	Manuel Lauss <mano@roarinelk.homelinux.net>
To:	linux-mips@linux-mips.org
Subject: au1xmmc.c: does it work?
Message-ID: <20061120094053.GA13509@roarinelk.homelinux.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.5.11
Return-Path: <mano@roarinelk.homelinux.net>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13222
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: mano@roarinelk.homelinux.net
Precedence: bulk
X-list: linux-mips

Hello folks,

I'm trying to get the au1x mmc driver working on a Au1200 board.
I insert a known working card, and the mmc cmd trace suggests
CMD9 (send CSD) times out. Before I go about to trace the
problem I'd like to know if other people see this problem too
or if it's specific to my system.
(Au1200, 2.6.19-rc6)

Thanks!

-- 
 ml.

From freddy@dusktilldawn.nl Mon Nov 20 10:49:36 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 20 Nov 2006 10:49:41 +0000 (GMT)
Received: from tool.snarl.nl ([213.84.251.124]:54923 "EHLO tool.snarl.nl")
	by ftp.linux-mips.org with ESMTP id S20037841AbWKTKtg (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Mon, 20 Nov 2006 10:49:36 +0000
Received: from localhost (tool.local.snarl.nl [127.0.0.1])
	by tool.snarl.nl (Postfix) with ESMTP id 04A245DF94;
	Mon, 20 Nov 2006 11:49:23 +0100 (CET)
Received: from tool.snarl.nl ([127.0.0.1])
	by localhost (tool.local.snarl.nl [127.0.0.1]) (amavisd-new, port 10024)
	with LMTP id XFi8m+FP1vdq; Mon, 20 Nov 2006 11:49:22 +0100 (CET)
Received: by tool.snarl.nl (Postfix, from userid 1000)
	id 936755DF3D; Mon, 20 Nov 2006 11:49:22 +0100 (CET)
Date:	Mon, 20 Nov 2006 11:49:22 +0100
From:	Freddy Spierenburg <freddy@dusktilldawn.nl>
To:	Manuel Lauss <mano@roarinelk.homelinux.net>
Cc:	linux-mips@linux-mips.org
Subject: Re: au1xmmc.c: does it work?
Message-ID: <20061120104922.GC32045@dusktilldawn.nl>
References: <20061120094053.GA13509@roarinelk.homelinux.net>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="UPT3ojh+0CqEDtpF"
Content-Disposition: inline
In-Reply-To: <20061120094053.GA13509@roarinelk.homelinux.net>
X-User-Agent-Feature: All mail clients suck. This one just sucks less.
X-GPG-Key: http://snarl.nl/~freddy/keys/freddyPublicKey.gpg
User-Agent: Mutt/1.5.13 (2006-08-11)
Return-Path: <freddy@dusktilldawn.nl>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13223
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: freddy@dusktilldawn.nl
Precedence: bulk
X-list: linux-mips


--UPT3ojh+0CqEDtpF
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi Manuel,

On Mon, Nov 20, 2006 at 10:40:53AM +0100, Manuel Lauss wrote:
> I insert a known working card, and the mmc cmd trace suggests
> CMD9 (send CSD) times out.

Are you working with a real MMC card or with an SD-card?

I myself am not able to get several SD-cards working, even though
SD-cards should be able to talk the MMC-protocol (AFAIK).

What I do have is several MMC-cards working properly, but I have
to add a small side note. I am using the AU1100 processor on our
own designed board. This AU1100 processor has a different DMA
controller than the AU1200 and AU1500. Unfortunaly the mmc driver
is written to use the DMA driver for the AU1200/AU1500 controller
and not the DMA driver for the AU1100. This is why I have a
slightly altered version of the au1xmmc driver. This version is
currently using pio mode instead of DMA. In the future I want it
to correcly use the right DMA driver depending on the processor,
but time constrains keep me at this moment from doing that. Also
it is a little bit addapted for our own hardware, which is like I
mentioned before not the DBAu1100 development board.

If you have trouble with MMC-cards too I'm more than willing to
send you the patch, but it probably needs some tweaking on your
part. That's why I do not yet attach it to this mail. Just ask
me personally for it if you want to try it out.


> Before I go about to trace the problem I'd like to know if
> other people see this problem too or if it's specific to my
> system.

With the SD-cards the driver indeed got no answer on the CMD9
request. So yes, I have the same problem on the AU1100 with the
2.6.16 kernel.


--=20
$ cat ~/.signature
Freddy Spierenburg <freddy@dusktilldawn.nl>  http://freddy.snarl.nl/
GnuPG: 0x7941D1E1=3DC948 5851 26D2 FA5C 39F1  E588 6F17 FD5D 7941 D1E1
$ # Please read http://www.ietf.org/rfc/rfc2015.txt before complain!

--UPT3ojh+0CqEDtpF
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)

iD8DBQFFYYgxbxf9XXlB0eERAiXiAKDhMMt6qF7qgBpjgvpEMn8uFVep9gCg8jvL
7WiewsBHkuWQ0EfYNCA2nWo=
=q12V
-----END PGP SIGNATURE-----

--UPT3ojh+0CqEDtpF--

From david_mccullough@au.securecomputing.com Mon Nov 20 11:31:42 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 20 Nov 2006 11:31:46 +0000 (GMT)
Received: from rex.snapgear.com ([203.143.235.140]:13700 "EHLO
	cyberguard.com.au") by ftp.linux-mips.org with ESMTP
	id S20037841AbWKTLbm (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Mon, 20 Nov 2006 11:31:42 +0000
Received: from localhost (localhost.localdomain [127.0.0.1])
	by hex.internal.moreton.com.au (Postfix) with ESMTP id 331B5EBA59
	for <linux-mips@linux-mips.org>; Mon, 20 Nov 2006 21:31:33 +1000 (EST)
Received: from hex.internal.moreton.com.au ([127.0.0.1])
	by localhost (bne.snapgear.com [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id 22815-10 for <linux-mips@linux-mips.org>;
	Mon, 20 Nov 2006 21:31:31 +1000 (EST)
Received: from beast (davidm0.sw.moreton.com.au [10.46.1.20])
	by hex.internal.moreton.com.au (Postfix) with ESMTP
	for <linux-mips@linux-mips.org>; Mon, 20 Nov 2006 21:31:31 +1000 (EST)
Received: by beast (Postfix, from userid 1012)
	id C9731161C056; Mon, 20 Nov 2006 21:31:50 +1000 (EST)
Date:	Mon, 20 Nov 2006 21:31:50 +1000
From:	David McCullough <david_mccullough@au.securecomputing.com>
To:	linux-mips@linux-mips.org
Subject: a1500 Performance query ?
Message-ID: <20061120113150.GA15277@au.securecomputing.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.5.11
X-Virus-Scanned: amavisd-new at snapgear.com
Return-Path: <david_mccullough@au.securecomputing.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13224
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: david_mccullough@au.securecomputing.com
Precedence: bulk
X-list: linux-mips


Hi all,

I just put together a 2.6.18 image on an older Bosporus board (400MHz
au1500) and I am a bit disappointed with the networking performance.
The few stats I have seen suggest that it should easily be doing 100Mbps
of networking throughput, but I am seeing less than 60Mbps using either
the onboard NIC's or a dual Intel e1000.

I am running a fairly stock 2.6.18 compiled with mipsel-linux-gcc version 3.4.6.
Full netfilter firewall setup doing a through box (all kernel mode) test.

The original BSP came with 2.4.21 and gcc 3.2.1 (mips_fp_le-gcc?) if that
is significant.

Linux reports CPU of 396MHz,  CPUPLL and POWERCTRL registers are set for full
speed and the RAM is running at the right speed (checked with an analyser).

I expected the board to perform much better and figured something obvious
must be wrong. Hopefully someone who knows these boards better has some
ideas :-)

Thanks,
Davidm

-- 
David McCullough,  david_mccullough@securecomputing.com,   Ph:+61 734352815
Secure Computing - SnapGear  http://www.uCdot.org http://www.cyberguard.com

From mano@roarinelk.homelinux.net Mon Nov 20 12:01:50 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 20 Nov 2006 12:01:54 +0000 (GMT)
Received: from fnoeppeil48.netpark.at ([217.175.205.176]:44047 "EHLO
	roarinelk.homelinux.net") by ftp.linux-mips.org with ESMTP
	id S20038189AbWKTMBu (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Mon, 20 Nov 2006 12:01:50 +0000
Received: (qmail 13754 invoked by uid 1000); 20 Nov 2006 13:01:48 +0100
Date:	Mon, 20 Nov 2006 13:01:48 +0100
From:	Manuel Lauss <mano@roarinelk.homelinux.net>
To:	Freddy Spierenburg <freddy@dusktilldawn.nl>
Cc:	linux-mips@linux-mips.org
Subject: Re: au1xmmc.c: does it work?
Message-ID: <20061120120148.GA13740@roarinelk.homelinux.net>
References: <20061120094053.GA13509@roarinelk.homelinux.net> <20061120104922.GC32045@dusktilldawn.nl>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20061120104922.GC32045@dusktilldawn.nl>
User-Agent: Mutt/1.5.11
Return-Path: <mano@roarinelk.homelinux.net>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13225
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: mano@roarinelk.homelinux.net
Precedence: bulk
X-list: linux-mips

Hi Freddy,

On Mon, Nov 20, 2006 at 11:49:22AM +0100, Freddy Spierenburg wrote:
> On Mon, Nov 20, 2006 at 10:40:53AM +0100, Manuel Lauss wrote:
> > I insert a known working card, and the mmc cmd trace suggests
> > CMD9 (send CSD) times out.
> 
> Are you working with a real MMC card or with an SD-card?

SD cards so far. MMC seems broken in a different way.

> I myself am not able to get several SD-cards working, even though
> SD-cards should be able to talk the MMC-protocol (AFAIK).

From what I understand, SD is a superset of the MMC command set.

> What I do have is several MMC-cards working properly, but I have
> to add a small side note. I am using the AU1100 processor on our
> own designed board. This AU1100 processor has a different DMA
> controller than the AU1200 and AU1500. 

It does not get so far to actually transfer data

> If you have trouble with MMC-cards too I'm more than willing to
> send you the patch, but it probably needs some tweaking on your
> part. That's why I do not yet attach it to this mail. Just ask
> me personally for it if you want to try it out.

Yes, please. I'd like to give it a spin
 
> > Before I go about to trace the problem I'd like to know if
> > other people see this problem too or if it's specific to my
> > system.
> 
> With the SD-cards the driver indeed got no answer on the CMD9
> request. So yes, I have the same problem on the AU1100 with the
> 2.6.16 kernel.

I'll see what I can do ti fix this.

Thanks,

-- 
 ml.

From freddy@dusktilldawn.nl Mon Nov 20 12:37:47 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 20 Nov 2006 12:37:51 +0000 (GMT)
Received: from tool.snarl.nl ([213.84.251.124]:32397 "EHLO tool.snarl.nl")
	by ftp.linux-mips.org with ESMTP id S20038492AbWKTMhr (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Mon, 20 Nov 2006 12:37:47 +0000
Received: from localhost (tool.local.snarl.nl [127.0.0.1])
	by tool.snarl.nl (Postfix) with ESMTP id 76F485DF94;
	Mon, 20 Nov 2006 13:37:41 +0100 (CET)
Received: from tool.snarl.nl ([127.0.0.1])
	by localhost (tool.local.snarl.nl [127.0.0.1]) (amavisd-new, port 10024)
	with LMTP id wjRuNv4U2gX6; Mon, 20 Nov 2006 13:37:41 +0100 (CET)
Received: by tool.snarl.nl (Postfix, from userid 1000)
	id 041045DF3D; Mon, 20 Nov 2006 13:37:41 +0100 (CET)
Date:	Mon, 20 Nov 2006 13:37:40 +0100
From:	Freddy Spierenburg <freddy@dusktilldawn.nl>
To:	Manuel Lauss <mano@roarinelk.homelinux.net>
Cc:	linux-mips@linux-mips.org
Subject: Re: au1xmmc.c: does it work?
Message-ID: <20061120123740.GE32045@dusktilldawn.nl>
References: <20061120094053.GA13509@roarinelk.homelinux.net> <20061120104922.GC32045@dusktilldawn.nl> <20061120120148.GA13740@roarinelk.homelinux.net>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="GV0iVqYguTV4Q9ER"
Content-Disposition: inline
In-Reply-To: <20061120120148.GA13740@roarinelk.homelinux.net>
X-User-Agent-Feature: All mail clients suck. This one just sucks less.
X-GPG-Key: http://snarl.nl/~freddy/keys/freddyPublicKey.gpg
User-Agent: Mutt/1.5.13 (2006-08-11)
Return-Path: <freddy@dusktilldawn.nl>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13226
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: freddy@dusktilldawn.nl
Precedence: bulk
X-list: linux-mips


--GV0iVqYguTV4Q9ER
Content-Type: multipart/mixed; boundary="idY8LE8SD6/8DnRI"
Content-Disposition: inline


--idY8LE8SD6/8DnRI
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi Manuel,

On Mon, Nov 20, 2006 at 01:01:48PM +0100, Manuel Lauss wrote:
> On Mon, Nov 20, 2006 at 11:49:22AM +0100, Freddy Spierenburg wrote:
> > Are you working with a real MMC card or with an SD-card?
>=20
> SD cards so far. MMC seems broken in a different way.

Broke in a different way? I can positively confirm that I have a
512MB and 1GB MMC-card working with the patch I hereby send to
you.

I've also tried a DaneElec 1GB and Kingston 1GB SD-card and
SanDisk 128MB MicroSD-card. All failed.


> Yes, please. I'd like to give it a spin

Please find it attached.


--=20
$ cat ~/.signature
Freddy Spierenburg <freddy@dusktilldawn.nl>  http://freddy.snarl.nl/
GnuPG: 0x7941D1E1=3DC948 5851 26D2 FA5C 39F1  E588 6F17 FD5D 7941 D1E1
$ # Please read http://www.ietf.org/rfc/rfc2015.txt before complain!

--idY8LE8SD6/8DnRI
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="mmc.patch"
Content-Transfer-Encoding: quoted-printable

diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 7bddcc4..328039d 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -22,7 +22,7 @@ #
 # Select the object file format to substitute into the linker script.
 #
 ifdef CONFIG_CPU_LITTLE_ENDIAN
-32bit-tool-prefix	=3D mipsel-linux-
+32bit-tool-prefix	=3D mipsel-linux-gnu-
 64bit-tool-prefix	=3D mips64el-linux-
 32bit-bfd		=3D elf32-tradlittlemips
 64bit-bfd		=3D elf64-tradlittlemips
diff --git a/arch/mips/au1000/common/clocks.c b/arch/mips/au1000/common/clo=
cks.c
index 3ce6cac..b1f5524 100644
--- a/arch/mips/au1000/common/clocks.c
+++ b/arch/mips/au1000/common/clocks.c
@@ -46,6 +46,7 @@ unsigned int get_au1x00_speed(void)
 {
 	return au1x00_clock;
 }
+EXPORT_SYMBOL(get_au1x00_speed);
=20
=20
=20
diff --git a/arch/mips/au1000/common/platform.c b/arch/mips/au1000/common/p=
latform.c
index 48d3f54..65376ef 100644
--- a/arch/mips/au1000/common/platform.c
+++ b/arch/mips/au1000/common/platform.c
@@ -72,6 +72,38 @@ static struct platform_device au1100_lcd
 	.num_resources  =3D ARRAY_SIZE(au1100_lcd_resources),
 	.resource       =3D au1100_lcd_resources,
 };
+
+static struct resource au1xxx_mmc_resources[] =3D {
+	[0] =3D {
+		.start          =3D SD0_PHYS_ADDR,
+		.end            =3D SD0_PHYS_ADDR + 0x40,
+		.flags          =3D IORESOURCE_MEM,
+	},
+	[1] =3D {
+		.start		=3D SD1_PHYS_ADDR,
+		.end 		=3D SD1_PHYS_ADDR + 0x40,
+		.flags		=3D IORESOURCE_MEM,
+	},
+	[2] =3D {
+		.start          =3D AU1100_SD_INT,
+		.end            =3D AU1100_SD_INT,
+		.flags          =3D IORESOURCE_IRQ,
+	}
+};
+
+static u64 au1xxx_mmc_dmamask =3D  ~(u32)0;
+
+static struct platform_device au1xxx_mmc_device =3D {
+	.name =3D "au1xxx-mmc",
+	.id =3D 0,
+	.dev =3D {
+		.dma_mask               =3D &au1xxx_mmc_dmamask,
+		.coherent_dma_mask      =3D 0xffffffff,
+	},
+	.num_resources  =3D ARRAY_SIZE(au1xxx_mmc_resources),
+	.resource       =3D au1xxx_mmc_resources,
+};
+
 #endif
=20
 #ifdef CONFIG_SOC_AU1200
@@ -276,6 +308,7 @@ static struct platform_device *au1xxx_pl
 	&au1x00_pcmcia_device,
 #ifdef CONFIG_FB_AU1100
 	&au1100_lcd_device,
+	&au1xxx_mmc_device,
 #endif
 #ifdef CONFIG_SOC_AU1200
 #if 0	/* fixme */
diff --git a/drivers/mmc/au1xmmc.c b/drivers/mmc/au1xmmc.c
index 8d84b04..be21e7c 100644
--- a/drivers/mmc/au1xmmc.c
+++ b/drivers/mmc/au1xmmc.c
@@ -47,6 +47,7 @@ #include <linux/mmc/protocol.h>
 #include <asm/io.h>
 #include <asm/mach-au1x00/au1000.h>
 #include <asm/mach-au1x00/au1xxx_dbdma.h>
+#include <asm/mach-au1x00/au1xxx_gpio.h>
 #include <asm/mach-au1x00/au1100_mmc.h>
 #include <asm/scatterlist.h>
=20
@@ -55,8 +56,13 @@ #include "au1xmmc.h"
=20
 #define DRIVER_NAME "au1xxx-mmc"
=20
+/* Set this for Dare processor board adjustments */
+//#define MMC_DARE_PROCESSOR_BOARD
+/* DMA isn't implemented yet: */
+//#define MMC_DARE_DMA_IMPLEMENTED
+
 /* Set this to enable special debugging macros */
-/* #define MMC_DEBUG */
+#define MMC_DEBUG
=20
 #ifdef MMC_DEBUG
 #define DEBUG(fmt, idx, args...) printk("au1xx(%d): DEBUG: " fmt, idx, ##a=
rgs)
@@ -66,17 +72,9 @@ #endif
=20
 const struct {
 	u32 iobase;
-	u32 tx_devid, rx_devid;
-	u16 bcsrpwr;
-	u16 bcsrstatus;
 	u16 wpstatus;
 } au1xmmc_card_table[] =3D {
-	{ SD0_BASE, DSCR_CMD0_SDMS_TX0, DSCR_CMD0_SDMS_RX0,
-	  BCSR_BOARD_SD0PWR, BCSR_INT_SD0INSERT, BCSR_STATUS_SD0WP },
-#ifndef CONFIG_MIPS_DB1200
-	{ SD1_BASE, DSCR_CMD0_SDMS_TX1, DSCR_CMD0_SDMS_RX1,
-	  BCSR_BOARD_DS1PWR, BCSR_INT_SD1INSERT, BCSR_STATUS_SD1WP }
-#endif
+	{ SD0_BASE, BCSR_BOARD_SD0_WP },
 };
=20
 #define AU1XMMC_CONTROLLER_COUNT \
@@ -84,7 +82,11 @@ #define AU1XMMC_CONTROLLER_COUNT \
=20
 /* This array stores pointers for the hosts (used by the IRQ handler) */
 struct au1xmmc_host *au1xmmc_hosts[AU1XMMC_CONTROLLER_COUNT];
+#ifdef MMC_DARE_DMA_IMPLEMENTED
 static int dma =3D 1;
+#else
+static int dma =3D 0; /* DMA isn't implemented yet in this driver */
+#endif
=20
 #ifdef MODULE
 MODULE_PARM(dma, "i");
@@ -139,25 +141,33 @@ static inline void SEND_STOP(struct au1x
=20
 static void au1xmmc_set_power(struct au1xmmc_host *host, int state)
 {
-
-	u32 val =3D au1xmmc_card_table[host->id].bcsrpwr;
-
-	bcsr->board &=3D ~val;
-	if (state) bcsr->board |=3D val;
-
-	au_sync_delay(1);
+#ifdef MMC_DARE_PROCESSOR_BOARD
+	state =3D 1; /* Force gpio high for card detection */
+	au1xxx_gpio_write(19, state ? 1 : 0);
+#else /* db1100 board */
+	mmc_power(host->id, state);
+#endif
 }
=20
 static inline int au1xmmc_card_inserted(struct au1xmmc_host *host)
 {
-	return (bcsr->sig_status & au1xmmc_card_table[host->id].bcsrstatus)
-		? 1 : 0;
+	int res =3D 0;
+	/* Note: card inserted checks at read-only switch,
+	 * if a card is set to read-only, it won't be recognized */
+#ifdef MMC_DARE_PROCESSOR_BOARD
+	/* Note: removing power (gpio19 low), makes it look like
+	 * the card has been removed */
+	res =3D au1xxx_gpio_read(19);
+#else /* db1100 board */
+	mmc_card_inserted(host->id, &res);
+#endif
+	return res;
 }
=20
 static inline int au1xmmc_card_readonly(struct au1xmmc_host *host)
 {
-	return (bcsr->status & au1xmmc_card_table[host->id].wpstatus)
-		? 1 : 0;
+	/* Not implemented */
+	return 0;
 }
=20
 static void au1xmmc_finish_request(struct au1xmmc_host *host)
@@ -177,8 +187,6 @@ static void au1xmmc_finish_request(struc
=20
 	host->status =3D HOST_S_IDLE;
=20
-	bcsr->disk_leds |=3D (1 << 8);
-
 	mmc_request_done(host->mmc, mrq);
 }
=20
@@ -531,6 +539,7 @@ static void au1xmmc_cmd_complete(struct=20
=20
 	host->status =3D HOST_S_DATA;
=20
+	#ifdef MMC_DARE_DMA_IMPLEMENTED
 	if (host->flags & HOST_F_DMA) {
 		u32 channel =3D DMA_CHANNEL(host);
=20
@@ -545,6 +554,7 @@ static void au1xmmc_cmd_complete(struct=20
=20
 		au1xxx_dbdma_start(channel);
 	}
+	#endif
 }
=20
 static void au1xmmc_set_clock(struct au1xmmc_host *host, int rate)
@@ -599,6 +609,7 @@ au1xmmc_prepare_data(struct au1xmmc_host
=20
 	au_writel((1 << data->blksz_bits) - 1, HOST_BLKSIZE(host));
=20
+	#ifdef MMC_DARE_DMA_IMPLEMENTED
 	if (host->flags & HOST_F_DMA) {
 		int i;
 		u32 channel =3D DMA_CHANNEL(host);
@@ -616,12 +627,14 @@ au1xmmc_prepare_data(struct au1xmmc_host
 				flags =3D DDMA_FLAGS_IE;
=20
     			if (host->flags & HOST_F_XMIT){
+				ret =3D 0;
       				ret =3D au1xxx_dbdma_put_source_flags(channel,
 					(void *) (page_address(sg->page) +
 						  sg->offset),
 					len, flags);
 			}
     			else {
+				ret =3D 0;
       				ret =3D au1xxx_dbdma_put_dest_flags(channel,
 					(void *) (page_address(sg->page) +
 						  sg->offset),
@@ -634,7 +647,9 @@ au1xmmc_prepare_data(struct au1xmmc_host
 			datalen -=3D len;
 		}
 	}
-	else {
+	else
+	#endif
+	{
 		host->pio.index =3D 0;
 		host->pio.offset =3D 0;
 		host->pio.len =3D datalen;
@@ -648,9 +663,11 @@ au1xmmc_prepare_data(struct au1xmmc_host
=20
 	return MMC_ERR_NONE;
=20
+#ifdef MMC_DARE_DMA_IMPLEMENTED
  dataerr:
 	dma_unmap_sg(mmc_dev(host->mmc),data->sg,data->sg_len,host->dma.dir);
 	return MMC_ERR_TIMEOUT;
+#endif
 }
=20
 /* static void au1xmmc_request
@@ -669,8 +686,6 @@ static void au1xmmc_request(struct mmc_h
 	host->mrq =3D mrq;
 	host->status =3D HOST_S_CMD;
=20
-	bcsr->disk_leds &=3D ~(1 << 8);
-
 	if (mrq->data) {
 		FLUSH_FIFO(host);
 		ret =3D au1xmmc_prepare_data(host, mrq->data);
@@ -737,6 +752,7 @@ static void au1xmmc_set_ios(struct mmc_h
 	}
 }
=20
+#ifdef MMC_DARE_DMA_IMPLEMENTED
 static void au1xmmc_dma_callback(int irq, void *dev_id, struct pt_regs *re=
gs)
 {
 	struct au1xmmc_host *host =3D (struct au1xmmc_host *) dev_id;
@@ -751,6 +767,7 @@ static void au1xmmc_dma_callback(int irq
=20
 	tasklet_schedule(&host->data_task);
 }
+#endif
=20
 #define STATUS_TIMEOUT (SD_STATUS_RAT | SD_STATUS_DT)
 #define STATUS_DATA_IN  (SD_STATUS_NE)
@@ -845,14 +862,16 @@ static void au1xmmc_poll_event(unsigned=20
 	mod_timer(&host->timer, jiffies + AU1XMMC_DETECT_TIMEOUT);
 }
=20
+#ifdef MMC_DARE_DMA_IMPLEMENTED
 static dbdev_tab_t au1xmmc_mem_dbdev =3D
 {
 	DSCR_CMD0_ALWAYS, DEV_FLAGS_ANYUSE, 0, 8, 0x00000000, 0, 0
 };
+#endif
=20
 static void au1xmmc_init_dma(struct au1xmmc_host *host)
 {
-
+#ifdef MMC_DARE_DMA_IMPLEMENTED
 	u32 rxchan, txchan;
=20
 	int txid =3D au1xmmc_card_table[host->id].tx_devid;
@@ -879,6 +898,7 @@ static void au1xmmc_init_dma(struct au1x
=20
 	host->tx_chan =3D txchan;
 	host->rx_chan =3D rxchan;
+#endif
 }
=20
 struct mmc_host_ops au1xmmc_ops =3D {
@@ -985,8 +1005,10 @@ static int __devexit au1xmmc_remove(stru
=20
 		mmc_remove_host(host->mmc);
=20
+		#ifdef MMC_DARE_DMA_IMPLEMENTED
 		au1xxx_dbdma_chan_free(host->tx_chan);
 		au1xxx_dbdma_chan_free(host->rx_chan);
+		#endif
=20
 		au_writel(0x0, HOST_ENABLE(host));
 		au_sync();
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
diff --git a/include/asm-mips/mach-au1x00/au1xxx.h b/include/asm-mips/mach-=
au1x00/au1xxx.h
diff --git a/include/asm-mips/mach-db1x00/db1x00.h b/include/asm-mips/mach-=
db1x00/db1x00.h
index 7b28b23..5912361 100644
--- a/include/asm-mips/mach-db1x00/db1x00.h
+++ b/include/asm-mips/mach-db1x00/db1x00.h
@@ -177,6 +177,24 @@ #define mmc_power_on(_n_) \
 		} \
 	} while (0)
=20
+/*
+ * Remove power from card slot(s).
+ */
+#define mmc_power(_n_, state) \
+	do { \
+		BCSR * const bcsr =3D (BCSR *)0xAE000000; \
+		unsigned long mmc_pwr, board_specific; \
+		if ((_n_)) { \
+			mmc_pwr =3D BCSR_BOARD_SD1_PWR; \
+		} else { \
+			mmc_pwr =3D BCSR_BOARD_SD0_PWR; \
+		} \
+		board_specific =3D au_readl((unsigned long)(&bcsr->specific)); \
+		board_specific &=3D ~mmc_pwr; \
+		board_specific |=3D (state ? mmc_pwr : 0); \
+		au_writel(board_specific, (int)(&bcsr->specific)); \
+		au_sync(); \
+	} while (0)
=20
 /* NAND defines */
 /* Timing values as described in databook, * ns value stripped of
diff --git a/include/asm-mips/mach-pb1x00/pb1100.h b/include/asm-mips/mach-=
pb1x00/pb1100.h

--idY8LE8SD6/8DnRI--

--GV0iVqYguTV4Q9ER
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)

iD8DBQFFYaGUbxf9XXlB0eERAkKTAKCzIzAEuqJD33vurntcFsua7t4UewCeOvGn
E1qxC8zg5wjKHTejlUhlKDk=
=K4U1
-----END PGP SIGNATURE-----

--GV0iVqYguTV4Q9ER--

From mano@roarinelk.homelinux.net Mon Nov 20 13:22:28 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 20 Nov 2006 13:22:32 +0000 (GMT)
Received: from fnoeppeil48.netpark.at ([217.175.205.176]:37129 "EHLO
	roarinelk.homelinux.net") by ftp.linux-mips.org with ESMTP
	id S20038521AbWKTNW2 (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Mon, 20 Nov 2006 13:22:28 +0000
Received: (qmail 13854 invoked by uid 1000); 20 Nov 2006 14:22:26 +0100
Date:	Mon, 20 Nov 2006 14:22:26 +0100
From:	Manuel Lauss <mano@roarinelk.homelinux.net>
To:	Freddy Spierenburg <freddy@dusktilldawn.nl>
Cc:	linux-mips@linux-mips.org
Subject: Re: au1xmmc.c: does it work?
Message-ID: <20061120132226.GB13740@roarinelk.homelinux.net>
References: <20061120094053.GA13509@roarinelk.homelinux.net> <20061120104922.GC32045@dusktilldawn.nl> <20061120120148.GA13740@roarinelk.homelinux.net> <20061120123740.GE32045@dusktilldawn.nl>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20061120123740.GE32045@dusktilldawn.nl>
User-Agent: Mutt/1.5.11
Return-Path: <mano@roarinelk.homelinux.net>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13227
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: mano@roarinelk.homelinux.net
Precedence: bulk
X-list: linux-mips

On Mon, Nov 20, 2006 at 01:37:40PM +0100, Freddy Spierenburg wrote:
> Hi Manuel,
> 
> On Mon, Nov 20, 2006 at 01:01:48PM +0100, Manuel Lauss wrote:
> > On Mon, Nov 20, 2006 at 11:49:22AM +0100, Freddy Spierenburg wrote:
> > > Are you working with a real MMC card or with an SD-card?
> > 
> > SD cards so far. MMC seems broken in a different way.
> 
> Broke in a different way? I can positively confirm that I have a
> 512MB and 1GB MMC-card working with the patch I hereby send to
> you.

continuously issues CMD2 and CMD3 messages to the card, and
lots of "au1xx(0): DEBUG: PENDING - 03000090" messages.
 
> I've also tried a DaneElec 1GB and Kingston 1GB SD-card and
> SanDisk 128MB MicroSD-card. All failed.
> 
> 
> > Yes, please. I'd like to give it a spin
> 
> Please find it attached.

Thank you. You only removed parts of the Db/Pb board specific
stuff and disabled DMA, correct?

-- 
 ml.

From freddy@dusktilldawn.nl Mon Nov 20 14:18:13 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 20 Nov 2006 14:18:21 +0000 (GMT)
Received: from tool.snarl.nl ([213.84.251.124]:18830 "EHLO tool.snarl.nl")
	by ftp.linux-mips.org with ESMTP id S20038759AbWKTOSN (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Mon, 20 Nov 2006 14:18:13 +0000
Received: from localhost (tool.local.snarl.nl [127.0.0.1])
	by tool.snarl.nl (Postfix) with ESMTP id AD4095E00E
	for <linux-mips@linux-mips.org>; Mon, 20 Nov 2006 15:18:07 +0100 (CET)
X-Quarantine-ID: <nxjF7iXQxzgs>
X-Amavis-Alert:	BAD HEADER MIME error: error: part did not end with expected
	boundary
Received: from tool.snarl.nl ([127.0.0.1])
	by localhost (tool.local.snarl.nl [127.0.0.1]) (amavisd-new, port 10024)
	with LMTP id nxjF7iXQxzgs for <linux-mips@linux-mips.org>;
	Mon, 20 Nov 2006 15:18:06 +0100 (CET)
Received: by tool.snarl.nl (Postfix, from userid 1000)
	id 7724F5DF3D; Mon, 20 Nov 2006 15:18:06 +0100 (CET)
Resent-From: freddy@dusktilldawn.nl
Resent-Date: Mon, 20 Nov 2006 15:18:06 +0100
Resent-Message-ID: <20061120141806.GH32045@dusktilldawn.nl>
Resent-To: linux-mips@linux-mips.org
Date:	Mon, 20 Nov 2006 15:16:07 +0100
From:	Freddy Spierenburg <freddy@dusktilldawn.nl>
To:	Manuel Lauss <mano@roarinelk.homelinux.net>
Cc:	linux-mips@linux-mips.org
Subject: Re: au1xmmc.c: does it work?
Message-ID: <20061120141607.GG32045@dusktilldawn.nl>
References: <20061120094053.GA13509@roarinelk.homelinux.net> <20061120104922.GC32045@dusktilldawn.nl> <20061120120148.GA13740@roarinelk.homelinux.net> <20061120123740.GE32045@dusktilldawn.nl> <20061120132226.GB13740@roarinelk.homelinux.net>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="IbVRjBtIbJdbeK1C"
Content-Disposition: inline
In-Reply-To: <20061120132226.GB13740@roarinelk.homelinux.net>
X-User-Agent-Feature: All mail clients suck. This one just sucks less.
X-GPG-Key: http://snarl.nl/~freddy/keys/freddyPublicKey.gpg
User-Agent: Mutt/1.5.13 (2006-08-11)
Return-Path: <freddy@dusktilldawn.nl>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13228
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: freddy@dusktilldawn.nl
Precedence: bulk
X-list: linux-mips

ntent-Length: 1585
Lines: 52


--IbVRjBtIbJdbeK1C
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi Manuel,

On Mon, Nov 20, 2006 at 02:22:26PM +0100, Manuel Lauss wrote:
> > Broke in a different way?
>=20
> continuously issues CMD2 and CMD3 messages to the card, and
> lots of "au1xx(0): DEBUG: PENDING - 03000090" messages.

I now too see those PENDING messages, which I failed to notice
more early. Actually I have tried this patch last friday for the
first time and since it worked right away did not notice all
those messages.


> You only removed parts of the Db/Pb board specific stuff and
> disabled DMA, correct?

I did not wrote the patch myself, so I can't tell you without
seriously looking into it myself. As far as I know your statement
should be correct, but only carefull looking into it will provide
the true answer. And that's where I do not have time for right
now. I should not even be writing this email I guess. :)

Good luck!


--=20
$ cat ~/.signature
Freddy Spierenburg <freddy@dusktilldawn.nl>  http://freddy.snarl.nl/
GnuPG: 0x7941D1E1=3DC948 5851 26D2 FA5C 39F1  E588 6F17 FD5D 7941 D1E1
$ # Please read http://www.ietf.org/rfc/rfc2015.txt before complain!

--IbVRjBtIbJdbeK1C
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)

iD8DBQFFYbinbxf9XXlB0eERAo/yAJoDQEY45xceTnf/oyRP5ltKuoIsiwCg9sJK
/RANsTrznfcDoWbRLPUVS9g=
=qIP0
-----END PGP SIGNATU

From ashlesha@kenati.com Mon Nov 20 23:29:39 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 20 Nov 2006 23:29:44 +0000 (GMT)
Received: from [69.90.147.196] ([69.90.147.196]:40086 "EHLO mail.kenati.com")
	by ftp.linux-mips.org with ESMTP id S20038925AbWKTX3j (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Mon, 20 Nov 2006 23:29:39 +0000
Received: from [192.168.1.169] (adsl-71-130-109-177.dsl.snfc21.pacbell.net [71.130.109.177])
	by mail.kenati.com (Postfix) with ESMTP id 40B16E4051;
	Mon, 20 Nov 2006 16:57:39 -0800 (PST)
Subject: LPJ value on the AU1500
From:	Ashlesha Shintre <ashlesha@kenati.com>
Reply-To: ashlesha@kenati.com
To:	ralf@linux-mips.org
Cc:	linux-mips@linux-mips.org
In-Reply-To: <1163469787.6532.26.camel@sandbar.kenati.com>
References: <1163443607.6532.9.camel@sandbar.kenati.com>
	 <20061113233802.GA17130@linux-mips.org>
	 <1163469787.6532.26.camel@sandbar.kenati.com>
Content-Type: text/plain
Date:	Mon, 20 Nov 2006 15:41:17 -0800
Message-Id: <1164066077.7726.6.camel@sandbar.kenati.com>
Mime-Version: 1.0
X-Mailer: Evolution 2.4.2.1 
Content-Transfer-Encoding: 7bit
Return-Path: <ashlesha@kenati.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13229
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: ashlesha@kenati.com
Precedence: bulk
X-list: linux-mips

On the Encore M3 board that has the AU1500 MIPS processor on it, 
the BogoMIPS value should be 240,000 as per the cpu_syspll register

However the loops_per_jiffy variable is defined as an unsigned long in
the init/main.c making it impossible to achieve this value of 240K...

Assuming that unsigned long means that a total of 4 bytes are allocated
to this variable..Am I looking at the wrong value?
The value that I get at boot time is lpj=8192.

Thanks for your help,
Ashlesha.


On Mon, 2006-11-13 at 18:03 -0800, Ashlesha Shintre wrote:
> On Mon, 2006-11-13 at 23:38 +0000, Ralf Baechle wrote:
> > On Mon, Nov 13, 2006 at 10:46:47AM -0800, Ashlesha Shintre wrote:
> > 
> > > > RPC: sendmsg returned error 128.
> > > > <4>nfs: RPC call returned error 128 
> > 
> > 128 = ENETUNREACH.
> Thank you -
> > 
> > > I m trying to boot the 2.6.14.6 kernel onto the Encore M3 board that has
> > > the MIPS AU1500 processor on it.
> > 
> > For more information [1] about 2.6.14 kernels see http://tinyurl.com/hjexx ;-)
> > 
> > > The .config file contains the following line: CONFIG_PORTMAP=y
> > > The server from which the NFS is mounted is also running the portmap
> > > daemon..
> > > 
> > > Is there a way to check if the portmap server is functioning properly?
> > > 
> > > 
> > > Also:
> > > 
> > > - The BogoMIPS value is 7186 which seems too low for the AU1500 -- how
> > > can I check that the timer interrupt is being handled correctly?  The
> > > AU1500 has 2 counters which are used to generate a clock
> > > 
> > > - On the serial console I can only see messages upto this point:
> > > 
> > > 
> > > > 16.35 BogoMIPS (lpj=8176)
> > 
> > Sounds about right if your CPU clock hapens to be 8MHz so probably not.
> > Chances the counter was missprogrammed.  Or are you running uncached?
> > Uncached will completly devastate performance.
> > 
> 
> For the AU1500 processor, the CPU Clock is derived from the PLL whose
> input is 12MHz.. Upon reading the value of the SYS_CPUPLL register in
> the calibrate_delay function, I found out that the multiplying factor is
> 40, thus, the CPU Clock frequency is 480MHz.. Thus the lpj should be
> approximately 480000 -- right?
> 
> Also I dont know what you mean by "running uncached"?
> 
> > > > calibrate delay done
> > > > anon vma init done
> > > > Mount-cache hash table entries: 512
> > > > Checking for 'wait' instruction...  unavailable.
> > > > NET: Registered protocol family 16
> > > > size of au1xxx platform devices is 1
> > > 
> > > After this, the serial console 'hangs' -- I can see the RPC error from the log buffer, accessed from the JTAG port..
> > > --Please give any suggestions as to where I should start looking to narrow down and figure out the problem..
> > 
> > At about this point the actual console driver is registered and takes
> > over from the early console driver - whatever that may be in your case.
> > So seems the early console driver is fine but the actual console driver
> > (that is serial driver) is falling over.
> > 
> Thanks a lot, I will check the problem with the serial driver -- i m
> using the 8250.c serial driver..
> 
> There is no early console init funciton:  The board has a serial port on
> a VIA 686B Southbridge on the PCI bus -- so to get the kernel messages
> on the console, before initialising the serial driver I just write a TLB
> entry giving the address of the VIA on the PCI bus --
> 
> So maybe deleting this TLB entry before serial driver initialisation
> might work at this point...I will try that next -
> 
> >   Ralf
> > 
> > [1] Okay, I'm just trying to convince people to upgrade :-)
> I will convey your message to my boss :-)
> 
> Thanks again,
> Ashlesha.
> 
> 
> 


From sshtylyov@ru.mvista.com Tue Nov 21 15:30:10 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 21 Nov 2006 15:30:15 +0000 (GMT)
Received: from h155.mvista.com ([63.81.120.155]:60128 "EHLO imap.sh.mvista.com")
	by ftp.linux-mips.org with ESMTP id S20039054AbWKUPaK (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Tue, 21 Nov 2006 15:30:10 +0000
Received: from [192.168.1.248] (unknown [10.150.0.9])
	by imap.sh.mvista.com (Postfix) with ESMTP
	id 82E3B3EBE; Tue, 21 Nov 2006 07:29:51 -0800 (PST)
Message-ID: <45631BD2.4090509@ru.mvista.com>
Date:	Tue, 21 Nov 2006 18:31:30 +0300
From:	Sergei Shtylyov <sshtylyov@ru.mvista.com>
Organization: MontaVista Software Inc.
User-Agent: Mozilla/5.0 (X11; U; Linux i686; rv:1.7.2) Gecko/20040803
X-Accept-Language: ru, en-us, en-gb
MIME-Version: 1.0
To:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc:	linux-mips@linux-mips.org, ralf@linux-mips.org
Subject: Re: [PATCH] use generic_handle_irq, handle_level_irq, handle_percpu_irq
References: <20061114.011318.99611303.anemo@mba.ocn.ne.jp>
In-Reply-To: <20061114.011318.99611303.anemo@mba.ocn.ne.jp>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Return-Path: <sshtylyov@ru.mvista.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13230
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: sshtylyov@ru.mvista.com
Precedence: bulk
X-list: linux-mips

Hello.

Atsushi Nemoto wrote:

> Note: This patch can be applied after the patch titled:
> "[PATCH] mips irq cleanups"
> in lmo linux-queue tree (or 2.6.19-rc5-mm1) and the patch titled:
> "[PATCH] do_IRQ cleanup"
> (http://www.linux-mips.org/archives/linux-mips/2006-10/msg00348.html)

> Further incorporation of generic irq framework.  Replacing __do_IRQ()
> by proper flow handler would make the irq handling path a bit simpler
> and faster.

> * use generic_handle_irq() instead of __do_IRQ().
> * use handle_level_irq for obvious level-type irq chips.
> * use handle_percpu_irq for irqs marked as IRQ_PER_CPU.
> * setup .eoi routine for irq chips possibly used with handle_percpu_irq.
> 
> Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>

[...]

> diff --git a/arch/mips/kernel/irq-msc01.c b/arch/mips/kernel/irq-msc01.c
> index e1880b2..bcaad66 100644
> --- a/arch/mips/kernel/irq-msc01.c
> +++ b/arch/mips/kernel/irq-msc01.c
> @@ -117,6 +117,7 @@ struct irq_chip msc_levelirq_type = {
>  	.mask = mask_msc_irq,
>  	.mask_ack = level_mask_and_ack_msc_irq,
>  	.unmask = unmask_msc_irq,
> +	.eoi = unmask_msc_irq,
>  	.end = end_msc_irq,
>  };

    You don't have to define eoi() method for the level flow. And you don't 
need end() method anymore.

> @@ -126,6 +127,7 @@ struct irq_chip msc_edgeirq_type = {
>  	.mask = mask_msc_irq,
>  	.mask_ack = edge_mask_and_ack_msc_irq,
>  	.unmask = unmask_msc_irq,
> +	.eoi = unmask_msc_irq,
>  	.end = end_msc_irq,
>  };

    The same about the edge flow...

> diff --git a/arch/mips/kernel/irq_cpu.c b/arch/mips/kernel/irq_cpu.c
> index 3b7cfa4..be5ac23 100644
> --- a/arch/mips/kernel/irq_cpu.c
> +++ b/arch/mips/kernel/irq_cpu.c
> @@ -62,6 +62,7 @@ static struct irq_chip mips_cpu_irq_cont
>  	.mask		= mask_mips_irq,
>  	.mask_ack	= mask_mips_irq,
>  	.unmask		= unmask_mips_irq,
> +	.eoi		= unmask_mips_irq,
>  	.end		= mips_cpu_irq_end,
>  };

    The same about the level flow and eoi() and end() here...

> @@ -104,6 +105,7 @@ static struct irq_chip mips_mt_cpu_irq_c
>  	.mask		= mask_mips_mt_irq,
>  	.mask_ack	= mips_mt_cpu_irq_ack,
>  	.unmask		= unmask_mips_mt_irq,
> +	.eoi		= unmask_mips_mt_irq,
>  	.end		= mips_mt_cpu_irq_end,
>  };
>  
> @@ -124,7 +126,8 @@ void __init mips_cpu_irq_init(int irq_ba
>  			set_irq_chip(i, &mips_mt_cpu_irq_controller);
>  
>  	for (i = irq_base + 2; i < irq_base + 8; i++)
> -		set_irq_chip(i, &mips_cpu_irq_controller);
> +		set_irq_chip_and_handler(i, &mips_cpu_irq_controller,
> +					 handle_level_irq);

    BTW, isn't IRQ7 per-CPU?

>  	mips_cpu_irq_base = irq_base;
>  }
> diff --git a/arch/mips/mips-boards/atlas/atlas_int.c b/arch/mips/mips-boards/atlas/atlas_int.c
> index 7c71004..43dba6c 100644
> --- a/arch/mips/mips-boards/atlas/atlas_int.c
> +++ b/arch/mips/mips-boards/atlas/atlas_int.c
> @@ -74,6 +74,7 @@ static struct irq_chip atlas_irq_type = 
>  	.mask = disable_atlas_irq,
>  	.mask_ack = disable_atlas_irq,
>  	.unmask = enable_atlas_irq,
> +	.eoi = enable_atlas_irq,
>  	.end = end_atlas_irq,
>  };

    The same about the level flow and eoi() and end() here too...

> @@ -207,7 +208,7 @@ static inline void init_atlas_irqs (int 
>  	atlas_hw0_icregs->intrsten = 0xffffffff;
>  
>  	for (i = ATLAS_INT_BASE; i <= ATLAS_INT_END; i++)
> -		set_irq_chip(i, &atlas_irq_type);
> +		set_irq_chip_and_handler(i, &atlas_irq_type, handle_level_irq);
>  }
>  
>  static struct irqaction atlasirq = {

WBR, Sergei

From Mile.Davidovic@micronasnit.com Wed Nov 22 10:52:08 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 22 Nov 2006 10:52:12 +0000 (GMT)
Received: from krt.tmd.ns.ac.yu ([147.91.177.65]:2055 "HELO krt.neobee.net")
	by ftp.linux-mips.org with SMTP id S20038501AbWKVKwI (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Wed, 22 Nov 2006 10:52:08 +0000
Received: from localhost (localhost [127.0.0.1])
	by krt.neobee.net (Postfix) with ESMTP id 42BD1E5378
	for <linux-mips@linux-mips.org>; Wed, 22 Nov 2006 11:52:03 +0100 (CET)
Received: from krt.neobee.net ([127.0.0.1])
 by localhost (krt.neobee.net [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id 25475-07 for <linux-mips@linux-mips.org>;
 Wed, 22 Nov 2006 11:52:01 +0100 (CET)
Received: from had (unknown [192.168.0.92])
	by krt.neobee.net (Postfix) with ESMTP id 3D88AE5377
	for <linux-mips@linux-mips.org>; Wed, 22 Nov 2006 11:52:01 +0100 (CET)
From:	"Mile Davidovic" <Mile.Davidovic@micronasnit.com>
To:	<linux-mips@linux-mips.org>
Subject: RE: How to build the glibc for MIPS?
Date:	Wed, 22 Nov 2006 11:54:19 +0100
Message-ID: <005501c70e24$8f7a7fd0$5c00a8c0@niit.micronasnit.com>
MIME-Version: 1.0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Mailer: Microsoft Office Outlook 11
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962
Thread-Index: AcbjWprI+4gIydQbSFat1vNz8Pp3SAqybeKg
In-Reply-To: <20060929000233.GG3394@linux-mips.org>
Return-Path: <Mile.Davidovic@micronasnit.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13231
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: Mile.Davidovic@micronasnit.com
Precedence: bulk
X-list: linux-mips

Hello to all,
is it possible to get quick howto for building glibc? 

> -----Original Message-----
> From: linux-mips-bounce@linux-mips.org [mailto:linux-mips-bounce@linux-
> mips.org] On Behalf Of Ralf Baechle
> Sent: Friday, September 29, 2006 02:03
> To: Neo
> Cc: linux-mips@linux-mips.org
> Subject: Re: How to build the glibc for MIPS?
> 
> On Thu, Sep 28, 2006 at 05:58:03PM -0500, Neo wrote:
> 
> > I have successfully built the cross toolchain excluding glibc following
> > the steps of www.linux-mips.org. Now, I am wondering how to build the
> > glibc for MIPS. The websites provided by linux-mips are not accessible
> > any more or they cannot be built successfully.
> 
> Are you refering to the instructions in the old MIPS-HOWTO document?
> I've asked LDP to remove it because it was so obsolete.  Building glibc
> has fortunately become much easier these days; it's mostly a question of
> getting the build environment right.
> 
>   Ralf



From ralf@linux-mips.org Wed Nov 22 12:05:56 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 22 Nov 2006 12:05:58 +0000 (GMT)
Received: from localhost.localdomain ([127.0.0.1]:20951 "EHLO
	dl5rb.ham-radio-op.net") by ftp.linux-mips.org with ESMTP
	id S20038539AbWKVMF4 (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 22 Nov 2006 12:05:56 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by dl5rb.ham-radio-op.net (8.13.8/8.13.8) with ESMTP id kAMC5ssn032334;
	Wed, 22 Nov 2006 12:05:55 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.8/8.13.8/Submit) id kAMC5qh0032333;
	Wed, 22 Nov 2006 12:05:52 GMT
Date:	Wed, 22 Nov 2006 12:05:52 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>, linux-mips@linux-mips.org
Subject: Re: [PATCH] use generic_handle_irq, handle_level_irq, handle_percpu_irq
Message-ID: <20061122120552.GA27782@linux-mips.org>
References: <20061114.011318.99611303.anemo@mba.ocn.ne.jp> <45631BD2.4090509@ru.mvista.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <45631BD2.4090509@ru.mvista.com>
User-Agent: Mutt/1.4.2.2i
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13232
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: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Tue, Nov 21, 2006 at 06:31:30PM +0300, Sergei Shtylyov wrote:

> >@@ -104,6 +105,7 @@ static struct irq_chip mips_mt_cpu_irq_c
> > 	.mask		= mask_mips_mt_irq,
> > 	.mask_ack	= mips_mt_cpu_irq_ack,
> > 	.unmask		= unmask_mips_mt_irq,
> >+	.eoi		= unmask_mips_mt_irq,
> > 	.end		= mips_mt_cpu_irq_end,
> > };
> > 
> >@@ -124,7 +126,8 @@ void __init mips_cpu_irq_init(int irq_ba
> > 			set_irq_chip(i, &mips_mt_cpu_irq_controller);
> > 
> > 	for (i = irq_base + 2; i < irq_base + 8; i++)
> >-		set_irq_chip(i, &mips_cpu_irq_controller);
> >+		set_irq_chip_and_handler(i, &mips_cpu_irq_controller,
> >+					 handle_level_irq);
> 
>    BTW, isn't IRQ7 per-CPU?

Yes and no.  On many CPUs IRQ 7 can be configured at reset time as either
the count / compare interrupt or a CPU interrupt just like the others.
It always used to be a normal CPU interrupt for R2000 class CPUs.

  Ralf

From sjhill@real.realitydiluted.com Wed Nov 22 12:55:34 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 22 Nov 2006 12:55:38 +0000 (GMT)
Received: from real.realitydiluted.com ([66.43.201.61]:15553 "EHLO
	real.realitydiluted.com") by ftp.linux-mips.org with ESMTP
	id S20038551AbWKVMze (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 22 Nov 2006 12:55:34 +0000
Received: from sjhill by real.realitydiluted.com with local (Exim 4.63)
	(envelope-from <sjhill@real.realitydiluted.com>)
	id 1Gmrdc-00022B-7R; Wed, 22 Nov 2006 06:55:40 -0600
Date:	Wed, 22 Nov 2006 06:55:40 -0600
To:	Mile Davidovic <Mile.Davidovic@micronasnit.com>
Cc:	linux-mips@linux-mips.org
Subject: Re: How to build the glibc for MIPS?
Message-ID: <20061122125540.GA7751@real.realitydiluted.com>
References: <20060929000233.GG3394@linux-mips.org> <005501c70e24$8f7a7fd0$5c00a8c0@niit.micronasnit.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <005501c70e24$8f7a7fd0$5c00a8c0@niit.micronasnit.com>
User-Agent: Mutt/1.5.13 (2006-08-11)
From:	sjhill@real.realitydiluted.com
Return-Path: <sjhill@real.realitydiluted.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13233
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: sjhill@real.realitydiluted.com
Precedence: bulk
X-list: linux-mips

> Hello to all,
> is it possible to get quick howto for building glibc? 
> 
Go here:

	http://kegel.com/crosstool/

and look at the scripts.

-Steve

From anemo@mba.ocn.ne.jp Wed Nov 22 13:17:21 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 22 Nov 2006 13:17:27 +0000 (GMT)
Received: from mba.ocn.ne.jp ([210.190.142.172]:24815 "HELO smtp.mba.ocn.ne.jp")
	by ftp.linux-mips.org with SMTP id S20038553AbWKVNRV (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Wed, 22 Nov 2006 13:17:21 +0000
Received: from localhost (p8044-ipad210funabasi.chiba.ocn.ne.jp [58.88.127.44])
	by smtp.mba.ocn.ne.jp (Postfix) with ESMTP
	id 6968CB7F7; Wed, 22 Nov 2006 22:17:16 +0900 (JST)
Date:	Wed, 22 Nov 2006 22:19:57 +0900 (JST)
Message-Id: <20061122.221957.74752404.anemo@mba.ocn.ne.jp>
To:	sshtylyov@ru.mvista.com
Cc:	linux-mips@linux-mips.org, ralf@linux-mips.org
Subject: Re: [PATCH] use generic_handle_irq, handle_level_irq,
 handle_percpu_irq
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
In-Reply-To: <45631BD2.4090509@ru.mvista.com>
References: <20061114.011318.99611303.anemo@mba.ocn.ne.jp>
	<45631BD2.4090509@ru.mvista.com>
X-Fingerprint: 6ACA 1623 39BD 9A94 9B1A  B746 CA77 FE94 2874 D52F
X-Pgp-Public-Key: http://wwwkeys.pgp.net/pks/lookup?op=get&search=0x2874D52F
X-Mailer: Mew version 3.3 on Emacs 21.4 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Return-Path: <anemo@mba.ocn.ne.jp>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13234
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: anemo@mba.ocn.ne.jp
Precedence: bulk
X-list: linux-mips

On Tue, 21 Nov 2006 18:31:30 +0300, Sergei Shtylyov <sshtylyov@ru.mvista.com> wrote:
> > diff --git a/arch/mips/kernel/irq-msc01.c b/arch/mips/kernel/irq-msc01.c
> > index e1880b2..bcaad66 100644
> > --- a/arch/mips/kernel/irq-msc01.c
> > +++ b/arch/mips/kernel/irq-msc01.c
> > @@ -117,6 +117,7 @@ struct irq_chip msc_levelirq_type = {
> >  	.mask = mask_msc_irq,
> >  	.mask_ack = level_mask_and_ack_msc_irq,
> >  	.unmask = unmask_msc_irq,
> > +	.eoi = unmask_msc_irq,
> >  	.end = end_msc_irq,
> >  };
> 
>     You don't have to define eoi() method for the level flow. And you don't 
> need end() method anymore.

Yes, .eoi is not used level flow handler, but I thought this irq chip
is possibly used with handle_percpu_irq flow handler.  And I kept .end
method for old __do_IRQ users.

---
Atsushi Nemoto

From mano@roarinelk.homelinux.net Wed Nov 22 13:51:33 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 22 Nov 2006 13:51:37 +0000 (GMT)
Received: from fnoeppeil48.netpark.at ([217.175.205.176]:44047 "EHLO
	roarinelk.homelinux.net") by ftp.linux-mips.org with ESMTP
	id S20039055AbWKVNvd (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 22 Nov 2006 13:51:33 +0000
Received: (qmail 18160 invoked by uid 1000); 22 Nov 2006 14:51:32 +0100
Date:	Wed, 22 Nov 2006 14:51:32 +0100
From:	Manuel Lauss <mano@roarinelk.homelinux.net>
To:	linux-mips@linux-mips.org
Subject: [PATCH] make au1xxx-ide compile again
Message-ID: <20061122135132.GA18144@roarinelk.homelinux.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.5.11
Return-Path: <mano@roarinelk.homelinux.net>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13235
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: mano@roarinelk.homelinux.net
Precedence: bulk
X-list: linux-mips


The Au1xx IDE controller driver doesn't compile:

  CC      drivers/ide/mips/au1xxx-ide.o
/linux-2.6.19-rc6-work/drivers/ide/mips/au1xxx-ide.c:480: error: conflicting types for 'auide_ddma_tx_callback'
include2/asm/mach-au1x00/au1xxx_ide.h:174: error: previous declaration of 'auide_ddma_tx_callback' was here
/linux-2.6.19-rc6-work/drivers/ide/mips/au1xxx-ide.c:486: error: conflicting types for 'auide_ddma_rx_callback'
include2/asm/mach-au1x00/au1xxx_ide.h:176: error: previous declaration of 'auide_ddma_rx_callback' was here

Signed-off-by: Manuel Lauss <mano@roarinelk.homelinux.net>

--- linux-2.6.19-rc6-base/include/asm-mips/mach-au1x00/au1xxx_ide.h	2006-11-16 11:14:28.370553000 +0100
+++ linux-2.6.19-rc6-work/include/asm-mips/mach-au1x00/au1xxx_ide.h	2006-11-22 14:41:33.006773000 +0100
@@ -170,10 +170,8 @@ int __init auide_probe(void);
         static int auide_dma_host_on(ide_drive_t *drive);
         static int auide_dma_lostirq(ide_drive_t *drive);
         static int auide_dma_on(ide_drive_t *drive);
-        static void auide_ddma_tx_callback(int irq, void *param,
-                                           struct pt_regs *regs);
-        static void auide_ddma_rx_callback(int irq, void *param,
-                                           struct pt_regs *regs);
+        static void auide_ddma_tx_callback(int irq, void *param);
+        static void auide_ddma_rx_callback(int irq, void *param);
         static int auide_dma_off_quietly(ide_drive_t *drive);
 #endif /* end CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA */
 

From ashlesha@kenati.com Wed Nov 22 19:30:55 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 22 Nov 2006 19:31:00 +0000 (GMT)
Received: from [69.90.147.196] ([69.90.147.196]:4772 "EHLO mail.kenati.com")
	by ftp.linux-mips.org with ESMTP id S20039197AbWKVTaz (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Wed, 22 Nov 2006 19:30:55 +0000
Received: from [192.168.1.169] (adsl-71-130-109-177.dsl.snfc21.pacbell.net [71.130.109.177])
	by mail.kenati.com (Postfix) with ESMTP id 270C6E401B
	for <linux-mips@linux-mips.org>; Wed, 22 Nov 2006 12:59:09 -0800 (PST)
Subject: request_module: runaway loop modprobe net-pf-1
From:	Ashlesha Shintre <ashlesha@kenati.com>
Reply-To: ashlesha@kenati.com
To:	linux-mips@linux-mips.org
Content-Type: text/plain
Date:	Wed, 22 Nov 2006 11:42:39 -0800
Message-Id: <1164224559.6511.4.camel@sandbar.kenati.com>
Mime-Version: 1.0
X-Mailer: Evolution 2.4.2.1 
Content-Transfer-Encoding: 7bit
Return-Path: <ashlesha@kenati.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13236
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: ashlesha@kenati.com
Precedence: bulk
X-list: linux-mips

Hi,

During boot up on the Encore M3 board (AU1500 MIPS) of the 2.6.14.6
kernel, the process stops after the NFS filesystem has been mounted,
memory freed  and spits out the following message:


> request_module: runaway loop modprobe net-pf-1

I can ping to the board and see that the control periodically goes back
to the flush_local_tlb_all function in the arch/mips/mm/tlb-r4k.c file
and prints a line that I have put in..

What does the net-pf-1 mean?

Thanks
Ashlesha.


From sjhill@real.realitydiluted.com Wed Nov 22 19:38:32 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 22 Nov 2006 19:38:36 +0000 (GMT)
Received: from real.realitydiluted.com ([66.43.201.61]:51617 "EHLO
	real.realitydiluted.com") by ftp.linux-mips.org with ESMTP
	id S20039197AbWKVTic (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 22 Nov 2006 19:38:32 +0000
Received: from sjhill by real.realitydiluted.com with local (Exim 4.63)
	(envelope-from <sjhill@real.realitydiluted.com>)
	id 1Gmxve-0002QS-EC; Wed, 22 Nov 2006 13:38:42 -0600
Date:	Wed, 22 Nov 2006 13:38:42 -0600
To:	Ashlesha Shintre <ashlesha@kenati.com>
Cc:	linux-mips@linux-mips.org
Subject: Re: request_module: runaway loop modprobe net-pf-1
Message-ID: <20061122193842.GA9307@real.realitydiluted.com>
References: <1164224559.6511.4.camel@sandbar.kenati.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <1164224559.6511.4.camel@sandbar.kenati.com>
User-Agent: Mutt/1.5.13 (2006-08-11)
From:	sjhill@real.realitydiluted.com
Return-Path: <sjhill@real.realitydiluted.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13237
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: sjhill@real.realitydiluted.com
Precedence: bulk
X-list: linux-mips

> During boot up on the Encore M3 board (AU1500 MIPS) of the 2.6.14.6
> kernel, the process stops after the NFS filesystem has been mounted,
> memory freed  and spits out the following message:
> 
> 
> > request_module: runaway loop modprobe net-pf-1
> 
If I had to guess, you have a big endian kernel and you used a little
endian filesystem or the converse.

-Steve

From Trevor_Hamm@pmc-sierra.com Wed Nov 22 20:31:27 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 22 Nov 2006 20:31:34 +0000 (GMT)
Received: from father.pmc-sierra.com ([216.241.224.13]:20170 "HELO
	father.pmc-sierra.bc.ca") by ftp.linux-mips.org with SMTP
	id S20039265AbWKVUb1 (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 22 Nov 2006 20:31:27 +0000
Received: (qmail 28969 invoked by uid 101); 22 Nov 2006 20:31:20 -0000
Received: from unknown (HELO ogmios.pmc-sierra.bc.ca) (216.241.226.59)
  by father.pmc-sierra.com with SMTP; 22 Nov 2006 20:31:20 -0000
Received: from bby1exi01.pmc_nt.nt.pmc-sierra.bc.ca (bby1exi01.pmc-sierra.bc.ca [216.241.231.251])
	by ogmios.pmc-sierra.bc.ca (8.13.3/8.12.7) with ESMTP id kAMKVIJT011933;
	Wed, 22 Nov 2006 12:31:19 -0800
Received: by bby1exi01.pmc-sierra.bc.ca with Internet Mail Service (5.5.2657.72)
	id <VY7SPBTG>; Wed, 22 Nov 2006 12:31:18 -0800
Message-ID: <E8C8A5231DDE104C816ADF532E0639120194F4EB@bby1exm07.pmc_nt.nt.pmc-sierra.bc.ca>
From:	Trevor Hamm <Trevor_Hamm@pmc-sierra.com>
To:	"'Atsushi Nemoto'" <anemo@mba.ocn.ne.jp>
Cc:	linux-mips@linux-mips.org
Subject: RE: Problems booting Linux 2.6.18.1 on MIPS34K core
Date:	Wed, 22 Nov 2006 12:31:10 -0800
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2657.72)
Content-Type: text/plain
Return-Path: <Trevor_Hamm@pmc-sierra.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13238
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: Trevor_Hamm@pmc-sierra.com
Precedence: bulk
X-list: linux-mips

 

> -----Original Message-----
> From: linux-mips-bounce@linux-mips.org 
> [mailto:linux-mips-bounce@linux-mips.org] On Behalf Of Atsushi Nemoto
> Sent: Friday, November 17, 2006 4:13 AM
> To: Trevor Hamm
> Cc: linux-mips@linux-mips.org
> Subject: Re: Problems booting Linux 2.6.18.1 on MIPS34K core
> 
> Thanks.  I re-read your report and wonder why this happens only on
> power-up time.
> 
> If flush_data_cache_page or update_mmu_cache were broken, the problem
> can happen on every restart.
>

This page does eventually get flushed to main memory on the first boot, but unfortunately the call to __update_cache() happens after this page was copied through copy_user_highpage().

The source of the problem seems to be with squashfs.  When I compare booting a kernel using squashfs to one using cramfs (which always seems to boot successfully on power-up), both are reading the troublesome page from /lib/ld-uClibc.so, and both are calling flush_dcache_page() on this page.  But in the case of cramfs, flush_dcache_page() causes an immediate cache flush of that page (mapping_mapped(mapping) in __flush_dcache_page() is returning non-zero), while squashfs just marks the page as dirty and defers the cache flush (mapping_mapped(mapping) is returning zero).  I have no idea what causes this difference in behaviour, but right now it appears to be a bug in squashfs rather than the linux-mips kernel.

Trevor

From ralf@linux-mips.org Wed Nov 22 21:58:13 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 22 Nov 2006 21:58:17 +0000 (GMT)
Received: from localhost.localdomain ([127.0.0.1]:4554 "EHLO
	dl5rb.ham-radio-op.net") by ftp.linux-mips.org with ESMTP
	id S20039336AbWKVV6N (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 22 Nov 2006 21:58:13 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by dl5rb.ham-radio-op.net (8.13.8/8.13.8) with ESMTP id kAMLw8jw009243;
	Wed, 22 Nov 2006 21:58:09 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.8/8.13.8/Submit) id kAMLw4Tc009242;
	Wed, 22 Nov 2006 21:58:04 GMT
Date:	Wed, 22 Nov 2006 21:58:04 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	Trevor Hamm <Trevor_Hamm@pmc-sierra.com>
Cc:	"'Atsushi Nemoto'" <anemo@mba.ocn.ne.jp>, linux-mips@linux-mips.org
Subject: Re: Problems booting Linux 2.6.18.1 on MIPS34K core
Message-ID: <20061122215803.GA8819@linux-mips.org>
References: <E8C8A5231DDE104C816ADF532E0639120194F4EB@bby1exm07.pmc_nt.nt.pmc-sierra.bc.ca>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <E8C8A5231DDE104C816ADF532E0639120194F4EB@bby1exm07.pmc_nt.nt.pmc-sierra.bc.ca>
User-Agent: Mutt/1.4.2.2i
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13239
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: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Wed, Nov 22, 2006 at 12:31:10PM -0800, Trevor Hamm wrote:

> The source of the problem seems to be with squashfs.  When I compare booting a kernel using squashfs to one using cramfs (which always seems to boot successfully on power-up), both are reading the troublesome page from /lib/ld-uClibc.so, and both are calling flush_dcache_page() on this page.  But in the case of cramfs, flush_dcache_page() causes an immediate cache flush of that page (mapping_mapped(mapping) in __flush_dcache_page() is returning non-zero), while squashfs just marks the page as dirty and defers the cache flush (mapping_mapped(mapping) is returning zero).  I have no idea what causes this difference in behaviour, but right now it appears to be a bug in squashfs rather than the linux-mips kernel.

There are a few other potencial and real bugs me and Atsushi have found
in squashfs.  Guess there is a reason why it's not yet in the kernel ...
I'm still waiting for feedback from the squashfs author.

  Ralf

From ralf@linux-mips.org Wed Nov 22 22:17:17 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 22 Nov 2006 22:17:19 +0000 (GMT)
Received: from localhost.localdomain ([127.0.0.1]:17356 "EHLO
	dl5rb.ham-radio-op.net") by ftp.linux-mips.org with ESMTP
	id S20039344AbWKVWRR (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 22 Nov 2006 22:17:17 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by dl5rb.ham-radio-op.net (8.13.8/8.13.8) with ESMTP id kAMMHCe5009458;
	Wed, 22 Nov 2006 22:17:14 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.8/8.13.8/Submit) id kAMMHCJQ009457;
	Wed, 22 Nov 2006 22:17:12 GMT
Date:	Wed, 22 Nov 2006 22:17:12 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	Ashlesha Shintre <ashlesha@kenati.com>
Cc:	linux-mips@linux-mips.org
Subject: Re: request_module: runaway loop modprobe net-pf-1
Message-ID: <20061122221712.GB8819@linux-mips.org>
References: <1164224559.6511.4.camel@sandbar.kenati.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <1164224559.6511.4.camel@sandbar.kenati.com>
User-Agent: Mutt/1.4.2.2i
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13240
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: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Wed, Nov 22, 2006 at 11:42:39AM -0800, Ashlesha Shintre wrote:

> During boot up on the Encore M3 board (AU1500 MIPS) of the 2.6.14.6
> kernel, the process stops after the NFS filesystem has been mounted,
> memory freed  and spits out the following message:
> 
> 
> > request_module: runaway loop modprobe net-pf-1

The kernel tried to open UNIX domain socket but because support is not
compiled it will load the module instead.  Now, glibc-based programs
happen to try to connect to nscd via a UNIX domain socket on startup
and the whole show starts all over.  After a few iterations the kernel
gets tired of the whole game and prints this friendly message.

> What does the net-pf-1 mean?

net-pf-1 is PF_UNIX, see the definitions in include/linux/socket.h.  So
you should set CONFIG_UNIX to y.  Building it as a module won't work
as you just found :).

  Ralf

From david_mccullough@au.securecomputing.com Wed Nov 22 22:42:39 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 22 Nov 2006 22:42:45 +0000 (GMT)
Received: from rex.snapgear.com ([203.143.235.140]:56791 "EHLO
	cyberguard.com.au") by ftp.linux-mips.org with ESMTP
	id S20039404AbWKVWmj (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 22 Nov 2006 22:42:39 +0000
Received: from localhost (localhost.localdomain [127.0.0.1])
	by hex.internal.moreton.com.au (Postfix) with ESMTP id BAF1FEBA0C;
	Thu, 23 Nov 2006 08:42:29 +1000 (EST)
Received: from hex.internal.moreton.com.au ([127.0.0.1])
	by localhost (bne.snapgear.com [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id 01494-07; Thu, 23 Nov 2006 08:42:28 +1000 (EST)
Received: from beast (davidm0.sw.moreton.com.au [10.46.1.20])
	by hex.internal.moreton.com.au (Postfix) with ESMTP;
	Thu, 23 Nov 2006 08:42:28 +1000 (EST)
Received: by beast (Postfix, from userid 1012)
	id B1C65161C05D; Thu, 23 Nov 2006 08:43:01 +1000 (EST)
Date:	Thu, 23 Nov 2006 08:43:01 +1000
From:	David McCullough <david_mccullough@au.securecomputing.com>
To:	Ralf Baechle <ralf@linux-mips.org>
Cc:	Trevor Hamm <Trevor_Hamm@pmc-sierra.com>,
	'Atsushi Nemoto' <anemo@mba.ocn.ne.jp>,
	linux-mips@linux-mips.org
Subject: Re: Problems booting Linux 2.6.18.1 on MIPS34K core
Message-ID: <20061122224301.GA27309@au.securecomputing.com>
References: <E8C8A5231DDE104C816ADF532E0639120194F4EB@bby1exm07.pmc_nt.nt.pmc-sierra.bc.ca> <20061122215803.GA8819@linux-mips.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20061122215803.GA8819@linux-mips.org>
User-Agent: Mutt/1.5.11
X-Virus-Scanned: amavisd-new at snapgear.com
Return-Path: <david_mccullough@au.securecomputing.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13241
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: david_mccullough@au.securecomputing.com
Precedence: bulk
X-list: linux-mips


Jivin Ralf Baechle lays it down ...
> On Wed, Nov 22, 2006 at 12:31:10PM -0800, Trevor Hamm wrote:
> 
> > The source of the problem seems to be with squashfs.  When I compare booting a kernel using squashfs to one using cramfs (which always seems to boot successfully on power-up), both are reading the troublesome page from /lib/ld-uClibc.so, and both are calling flush_dcache_page() on this page.  But in the case of cramfs, flush_dcache_page() causes an immediate cache flush of that page (mapping_mapped(mapping) in __flush_dcache_page() is returning non-zero), while squashfs just marks the page as dirty and defers the cache flush (mapping_mapped(mapping) is returning zero).  I have no idea what causes this difference in behaviour, but right now it appears to be a bug in squashfs rather than the linux-mips kernel.
> 
> There are a few other potencial and real bugs me and Atsushi have found
> in squashfs.  Guess there is a reason why it's not yet in the kernel ...
> I'm still waiting for feedback from the squashfs author.

Not sure if it helps much,  but we run squashfs (with 7zip patch) on
ARM9, ARM10, SuperH and x86 without problems.  I haven't had any issues
with it so far on the au1500 either,

Cheers,
Davidm

-- 
David McCullough,  david_mccullough@securecomputing.com,   Ph:+61 734352815
Secure Computing - SnapGear  http://www.uCdot.org http://www.cyberguard.com

From ashlesha@kenati.com Wed Nov 22 23:32:50 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 22 Nov 2006 23:32:56 +0000 (GMT)
Received: from [69.90.147.196] ([69.90.147.196]:35213 "EHLO mail.kenati.com")
	by ftp.linux-mips.org with ESMTP id S20039410AbWKVXcu (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Wed, 22 Nov 2006 23:32:50 +0000
Received: from [192.168.1.169] (adsl-71-130-109-177.dsl.snfc21.pacbell.net [71.130.109.177])
	by mail.kenati.com (Postfix) with ESMTP id 9F9A0E401A;
	Wed, 22 Nov 2006 17:01:05 -0800 (PST)
Subject: Re: request_module: runaway loop modprobe net-pf-1
From:	Ashlesha Shintre <ashlesha@kenati.com>
Reply-To: ashlesha@kenati.com
To:	Ralf Baechle <ralf@linux-mips.org>
Cc:	linux-mips@linux-mips.org
In-Reply-To: <20061122221712.GB8819@linux-mips.org>
References: <1164224559.6511.4.camel@sandbar.kenati.com>
	 <20061122221712.GB8819@linux-mips.org>
Content-Type: text/plain
Date:	Wed, 22 Nov 2006 15:44:35 -0800
Message-Id: <1164239075.6511.13.camel@sandbar.kenati.com>
Mime-Version: 1.0
X-Mailer: Evolution 2.4.2.1 
Content-Transfer-Encoding: 7bit
Return-Path: <ashlesha@kenati.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13242
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: ashlesha@kenati.com
Precedence: bulk
X-list: linux-mips

On Wed, 2006-11-22 at 22:17 +0000, Ralf Baechle wrote:
> On Wed, Nov 22, 2006 at 11:42:39AM -0800, Ashlesha Shintre wrote:
> 
> > During boot up on the Encore M3 board (AU1500 MIPS) of the 2.6.14.6
> > kernel, the process stops after the NFS filesystem has been mounted,
> > memory freed  and spits out the following message:
> > 
> > 
> > > request_module: runaway loop modprobe net-pf-1
> 
> The kernel tried to open UNIX domain socket but because support is not
> compiled it will load the module instead.  Now, glibc-based programs
> happen to try to connect to nscd via a UNIX domain socket on startup
> and the whole show starts all over.  After a few iterations the kernel
> gets tired of the whole game and prints this friendly message.
> 
> > What does the net-pf-1 mean?
> 
> net-pf-1 is PF_UNIX, see the definitions in include/linux/socket.h.  So
> you should set CONFIG_UNIX to y.  

Thanks for your reply Ralf, but I dont see he CONFIG_UNIX option in my
Makefile, so I created one, but still get the same error!
is there anything else that i should try?

Thanks again,
Ashlesha.
> Building it as a module won't work
> as you just found :).
> 
>   Ralf


From mlachwani@mvista.com Thu Nov 23 00:10:27 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 23 Nov 2006 00:10:31 +0000 (GMT)
Received: from gateway-1237.mvista.com ([63.81.120.158]:16845 "EHLO
	gateway-1237.mvista.com") by ftp.linux-mips.org with ESMTP
	id S20039407AbWKWAK1 (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Thu, 23 Nov 2006 00:10:27 +0000
Received: from [10.0.0.139] (prometheus.mvista.com [10.0.0.139])
	by hermes.mvista.com (Postfix) with ESMTP
	id DBDB11C08B; Wed, 22 Nov 2006 16:10:02 -0800 (PST)
Message-ID: <4564E6DA.1030504@mvista.com>
Date:	Wed, 22 Nov 2006 16:10:02 -0800
From:	mlachwani <mlachwani@mvista.com>
User-Agent: Thunderbird 1.5.0.8 (X11/20061025)
MIME-Version: 1.0
To:	ashlesha@kenati.com
Cc:	Ralf Baechle <ralf@linux-mips.org>, linux-mips@linux-mips.org
Subject: Re: request_module: runaway loop modprobe net-pf-1
References: <1164224559.6511.4.camel@sandbar.kenati.com>	 <20061122221712.GB8819@linux-mips.org> <1164239075.6511.13.camel@sandbar.kenati.com>
In-Reply-To: <1164239075.6511.13.camel@sandbar.kenati.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Return-Path: <mlachwani@mvista.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13243
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: mlachwani@mvista.com
Precedence: bulk
X-list: linux-mips

CONFIG_UNIX is defined in net/unix/Kconfig or simply do a "make 
menuconfig" and search for UNIX.

It depends on CONFIG_NET. Check your .config ...

thanks,
Manish Lachwani


Ashlesha Shintre wrote:
> On Wed, 2006-11-22 at 22:17 +0000, Ralf Baechle wrote:
>   
>> On Wed, Nov 22, 2006 at 11:42:39AM -0800, Ashlesha Shintre wrote:
>>
>>     
>>> During boot up on the Encore M3 board (AU1500 MIPS) of the 2.6.14.6
>>> kernel, the process stops after the NFS filesystem has been mounted,
>>> memory freed  and spits out the following message:
>>>
>>>
>>>       
>>>> request_module: runaway loop modprobe net-pf-1
>>>>         
>> The kernel tried to open UNIX domain socket but because support is not
>> compiled it will load the module instead.  Now, glibc-based programs
>> happen to try to connect to nscd via a UNIX domain socket on startup
>> and the whole show starts all over.  After a few iterations the kernel
>> gets tired of the whole game and prints this friendly message.
>>
>>     
>>> What does the net-pf-1 mean?
>>>       
>> net-pf-1 is PF_UNIX, see the definitions in include/linux/socket.h.  So
>> you should set CONFIG_UNIX to y.  
>>     
>
> Thanks for your reply Ralf, but I dont see he CONFIG_UNIX option in my
> Makefile, so I created one, but still get the same error!
> is there anything else that i should try?
>
> Thanks again,
> Ashlesha.
>   
>> Building it as a module won't work
>> as you just found :).
>>
>>   Ralf
>>     
>
>
>   


From zzh.hust@gmail.com Thu Nov 23 00:53:20 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 23 Nov 2006 00:53:24 +0000 (GMT)
Received: from nf-out-0910.google.com ([64.233.182.188]:35738 "EHLO
	nf-out-0910.google.com") by ftp.linux-mips.org with ESMTP
	id S20039426AbWKWAxU (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Thu, 23 Nov 2006 00:53:20 +0000
Received: by nf-out-0910.google.com with SMTP id l24so680038nfc
        for <linux-mips@linux-mips.org>; Wed, 22 Nov 2006 16:53:20 -0800 (PST)
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws;
        s=beta; d=gmail.com;
        h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition;
        b=FgOvS+PiSpRrNnWKIHRNdeEw/3QTt38q7HBD1zG/qRFtWpmlY1M7lqHja+aAAV5qc1r5eL85y5L3FaCWSuiHzsRCG2ZXq/pDb+31j+0uvDtk+2SoQk+xBtARzf7vYE9IkHCr19kbPJ432B4gT9D6zTanxWMy++WNo85I8+fN+aM=
Received: by 10.82.126.5 with SMTP id y5mr1342401buc.1164243199778;
        Wed, 22 Nov 2006 16:53:19 -0800 (PST)
Received: by 10.82.178.4 with HTTP; Wed, 22 Nov 2006 16:53:19 -0800 (PST)
Message-ID: <50c9a2250611221653p255b2c0em218f69c32897147a@mail.gmail.com>
Date:	Thu, 23 Nov 2006 08:53:19 +0800
From:	zhuzhenhua <zzh.hust@gmail.com>
To:	linux-mips <linux-mips@linux-mips.org>
Subject: about r4k_dma_cache_inv and r4k_dma_cache_wback_inv in c-r4k.c
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Return-Path: <zzh.hust@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13244
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: zzh.hust@gmail.com
Precedence: bulk
X-list: linux-mips

i see they all call 			
flush_dcache_line(a);	/* Hit_Writeback_Inv_D */

why didn't the r4k_dma_cache_inv call
 invalidate_dcache_line(unsigned long addr)        /* Hit_Invalidate_D */;


Best Regards
zhuzhenhua

From ashlesha@kenati.com Thu Nov 23 01:44:06 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 23 Nov 2006 01:44:11 +0000 (GMT)
Received: from [69.90.147.196] ([69.90.147.196]:8157 "EHLO mail.kenati.com")
	by ftp.linux-mips.org with ESMTP id S20039432AbWKWBoG (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Thu, 23 Nov 2006 01:44:06 +0000
Received: from [192.168.1.169] (adsl-71-130-109-177.dsl.snfc21.pacbell.net [71.130.109.177])
	by mail.kenati.com (Postfix) with ESMTP id 3E1A3E401A;
	Wed, 22 Nov 2006 19:12:24 -0800 (PST)
Subject: init cannot spawn shell
From:	Ashlesha Shintre <ashlesha@kenati.com>
Reply-To: ashlesha@kenati.com
To:	mlachwani <mlachwani@mvista.com>, ralf@linux-mips.org,
	sjhill@real.realitydiluted.com
Cc:	linux-mips@linux-mips.org
In-Reply-To: <4564E6DA.1030504@mvista.com>
References: <1164224559.6511.4.camel@sandbar.kenati.com>
	 <20061122221712.GB8819@linux-mips.org>
	 <1164239075.6511.13.camel@sandbar.kenati.com> <4564E6DA.1030504@mvista.com>
Content-Type: text/plain
Date:	Wed, 22 Nov 2006 17:55:53 -0800
Message-Id: <1164246953.6511.25.camel@sandbar.kenati.com>
Mime-Version: 1.0
X-Mailer: Evolution 2.4.2.1 
Content-Transfer-Encoding: 7bit
Return-Path: <ashlesha@kenati.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13245
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: ashlesha@kenati.com
Precedence: bulk
X-list: linux-mips


Hi,

So the ">>>> request_module: runaway loop modprobe net-pf-1" problem is
now solved, I dont get the same error again --
Thank you Ralf, Manish and Steve for your prompt responses..

However, the kernel gets stuck now after mounting the filesystem and
freeing memory.  It does not execute the shell.  When I give a boot
argument such as init=/bin/sh, it attempts to kill init.

I m sure that the endianness is not an issue - everything is big endian.

I statically compiled a hello world program and instead of the rcS
script in the init.d directory, put in this entry in the inittab

sys::sysinit:/etc/init.d/hello

however, I dont see "Hello World" on the console! -- meaning the problem
is in userspace?

Any ideas on how to debug this situation?

Thanks,
Ashlesha.


On Wed, 2006-11-22 at 16:10 -0800, mlachwani wrote:
> CONFIG_UNIX is defined in net/unix/Kconfig or simply do a "make 
> menuconfig" and search for UNIX.
> 
> It depends on CONFIG_NET. Check your .config ...
> 
> thanks,
> Manish Lachwani
> 
> 
> Ashlesha Shintre wrote:
> > On Wed, 2006-11-22 at 22:17 +0000, Ralf Baechle wrote:
> >   
> >> On Wed, Nov 22, 2006 at 11:42:39AM -0800, Ashlesha Shintre wrote:
> >>
> >>     
> >>> During boot up on the Encore M3 board (AU1500 MIPS) of the 2.6.14.6
> >>> kernel, the process stops after the NFS filesystem has been mounted,
> >>> memory freed  and spits out the following message:
> >>>
> >>>
> >>>       
> >>>> request_module: runaway loop modprobe net-pf-1
> >>>>         
> >> The kernel tried to open UNIX domain socket but because support is not
> >> compiled it will load the module instead.  Now, glibc-based programs
> >> happen to try to connect to nscd via a UNIX domain socket on startup
> >> and the whole show starts all over.  After a few iterations the kernel
> >> gets tired of the whole game and prints this friendly message.
> >>
> >>     
> >>> What does the net-pf-1 mean?
> >>>       
> >> net-pf-1 is PF_UNIX, see the definitions in include/linux/socket.h.  So
> >> you should set CONFIG_UNIX to y.  
> >>     
> >
> > Thanks for your reply Ralf, but I dont see he CONFIG_UNIX option in my
> > Makefile, so I created one, but still get the same error!
> > is there anything else that i should try?
> >
> > Thanks again,
> > Ashlesha.
> >   
> >> Building it as a module won't work
> >> as you just found :).
> >>
> >>   Ralf
> >>     
> >
> >
> >   
> 


From Andre.Messerschmidt@infineon.com Thu Nov 23 06:45:35 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 23 Nov 2006 06:45:39 +0000 (GMT)
Received: from smtp1.infineon.com ([217.10.60.22]:3704 "EHLO
	smtp1.infineon.com") by ftp.linux-mips.org with ESMTP
	id S20037961AbWKWGpf convert rfc822-to-8bit (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Thu, 23 Nov 2006 06:45:35 +0000
Received: from unknown (HELO mucse312.eu.infineon.com) ([172.23.30.12])
  by smtp1.infineon.com with ESMTP; 23 Nov 2006 07:45:29 +0100
X-SBRS:	None
Received: from mucse307.eu.infineon.com ([172.23.30.7]) by mucse312.eu.infineon.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.1830);
	 Thu, 23 Nov 2006 07:45:28 +0100
X-MimeOLE: Produced By Microsoft Exchange V6.5
Content-class: urn:content-classes:message
MIME-Version: 1.0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 8BIT
Subject: RE: init cannot spawn shell
Date:	Thu, 23 Nov 2006 07:45:25 +0100
Message-ID: <B0956DED3DE3CD47BF0398D4E0ECE59F011B70C9@mucse307.eu.infineon.com>
In-Reply-To: <1164246953.6511.25.camel@sandbar.kenati.com>
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
Thread-Topic: init cannot spawn shell
Thread-Index: AccOoPLXatL7OO9KTTyBLahSUZKDuAAKWwBg
From:	<Andre.Messerschmidt@infineon.com>
To:	<ashlesha@kenati.com>
Cc:	<linux-mips@linux-mips.org>
X-OriginalArrivalTime: 23 Nov 2006 06:45:28.0313 (UTC) FILETIME=[F661B690:01C70ECA]
Return-Path: <Andre.Messerschmidt@infineon.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13246
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: Andre.Messerschmidt@infineon.com
Precedence: bulk
X-list: linux-mips

Hi,
 

> I m sure that the endianness is not an issue - everything is big 
> endian.

We had some problem in the past, where the reverse endianess bit was
set, that would result in a crash when the system starts init. Not sure
what bootloader you are using, but maybe it is worth checking the RE bit
in CP0.STATUS, since otherwise your userspace applications will run in
little endian.

Regards
Andre

From ralf@linux-mips.org Thu Nov 23 14:09:24 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 23 Nov 2006 14:09:26 +0000 (GMT)
Received: from localhost.localdomain ([127.0.0.1]:13769 "EHLO
	dl5rb.ham-radio-op.net") by ftp.linux-mips.org with ESMTP
	id S20038840AbWKWOJY (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Thu, 23 Nov 2006 14:09:24 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by dl5rb.ham-radio-op.net (8.13.8/8.13.8) with ESMTP id kANE9FbX028874;
	Thu, 23 Nov 2006 14:09:17 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.8/8.13.8/Submit) id kANE9EIu028873;
	Thu, 23 Nov 2006 14:09:14 GMT
Date:	Thu, 23 Nov 2006 14:09:14 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	Andre.Messerschmidt@infineon.com
Cc:	ashlesha@kenati.com, linux-mips@linux-mips.org
Subject: Re: init cannot spawn shell
Message-ID: <20061123140914.GA24273@linux-mips.org>
References: <1164246953.6511.25.camel@sandbar.kenati.com> <B0956DED3DE3CD47BF0398D4E0ECE59F011B70C9@mucse307.eu.infineon.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <B0956DED3DE3CD47BF0398D4E0ECE59F011B70C9@mucse307.eu.infineon.com>
User-Agent: Mutt/1.4.2.2i
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13247
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: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Thu, Nov 23, 2006 at 07:45:25AM +0100, Andre.Messerschmidt@infineon.com wrote:

> > I m sure that the endianness is not an issue - everything is big 
> > endian.
> 
> We had some problem in the past, where the reverse endianess bit was
> set, that would result in a crash when the system starts init. Not sure
> what bootloader you are using, but maybe it is worth checking the RE bit
> in CP0.STATUS, since otherwise your userspace applications will run in
> little endian.

This was fixed in February for 2.6.16 already.  Also Ashleha is using
a different CPU ...

  Ralf

From sshtylyov@ru.mvista.com Thu Nov 23 15:41:24 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 23 Nov 2006 15:41:29 +0000 (GMT)
Received: from h155.mvista.com ([63.81.120.155]:51993 "EHLO imap.sh.mvista.com")
	by ftp.linux-mips.org with ESMTP id S20039443AbWKWPlY (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Thu, 23 Nov 2006 15:41:24 +0000
Received: from [192.168.1.248] (unknown [10.150.0.9])
	by imap.sh.mvista.com (Postfix) with ESMTP
	id 5BA7A3EBE; Thu, 23 Nov 2006 07:41:01 -0800 (PST)
Message-ID: <4565C16E.3090803@ru.mvista.com>
Date:	Thu, 23 Nov 2006 18:42:38 +0300
From:	Sergei Shtylyov <sshtylyov@ru.mvista.com>
Organization: MontaVista Software Inc.
User-Agent: Mozilla/5.0 (X11; U; Linux i686; rv:1.7.2) Gecko/20040803
X-Accept-Language: ru, en-us, en-gb
MIME-Version: 1.0
To:	Ralf Baechle <ralf@linux-mips.org>
Cc:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>, linux-mips@linux-mips.org
Subject: Re: [PATCH] use generic_handle_irq, handle_level_irq, handle_percpu_irq
References: <20061114.011318.99611303.anemo@mba.ocn.ne.jp> <45631BD2.4090509@ru.mvista.com> <20061122120552.GA27782@linux-mips.org>
In-Reply-To: <20061122120552.GA27782@linux-mips.org>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Return-Path: <sshtylyov@ru.mvista.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13248
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: sshtylyov@ru.mvista.com
Precedence: bulk
X-list: linux-mips

Hello.

Ralf Baechle wrote:

>>>@@ -104,6 +105,7 @@ static struct irq_chip mips_mt_cpu_irq_c
>>>	.mask		= mask_mips_mt_irq,
>>>	.mask_ack	= mips_mt_cpu_irq_ack,
>>>	.unmask		= unmask_mips_mt_irq,
>>>+	.eoi		= unmask_mips_mt_irq,
>>>	.end		= mips_mt_cpu_irq_end,
>>>};
>>>
>>>@@ -124,7 +126,8 @@ void __init mips_cpu_irq_init(int irq_ba
>>>			set_irq_chip(i, &mips_mt_cpu_irq_controller);
>>>
>>>	for (i = irq_base + 2; i < irq_base + 8; i++)
>>>-		set_irq_chip(i, &mips_cpu_irq_controller);
>>>+		set_irq_chip_and_handler(i, &mips_cpu_irq_controller,
>>>+					 handle_level_irq);
>>
>>   BTW, isn't IRQ7 per-CPU?

> Yes and no.  On many CPUs IRQ 7 can be configured at reset time as either
> the count / compare interrupt or a CPU interrupt just like the others.
> It always used to be a normal CPU interrupt for R2000 class CPUs.

    Nevertheless, IRQ7 having percpu flow when it's known to be from 
count/compare would make the timer stuff faster, I assume...

>   Ralf

WBR, Sergei

From anemo@mba.ocn.ne.jp Thu Nov 23 16:15:03 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 23 Nov 2006 16:15:09 +0000 (GMT)
Received: from mba.ocn.ne.jp ([210.190.142.172]:49625 "HELO smtp.mba.ocn.ne.jp")
	by ftp.linux-mips.org with SMTP id S20038834AbWKWQPD (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Thu, 23 Nov 2006 16:15:03 +0000
Received: from localhost (p2128-ipad34funabasi.chiba.ocn.ne.jp [124.85.59.128])
	by smtp.mba.ocn.ne.jp (Postfix) with ESMTP
	id 737ECA56B; Fri, 24 Nov 2006 01:14:58 +0900 (JST)
Date:	Fri, 24 Nov 2006 01:17:40 +0900 (JST)
Message-Id: <20061124.011740.108740210.anemo@mba.ocn.ne.jp>
To:	sshtylyov@ru.mvista.com
Cc:	ralf@linux-mips.org, linux-mips@linux-mips.org
Subject: Re: [PATCH] use generic_handle_irq, handle_level_irq,
 handle_percpu_irq
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
In-Reply-To: <4565C16E.3090803@ru.mvista.com>
References: <45631BD2.4090509@ru.mvista.com>
	<20061122120552.GA27782@linux-mips.org>
	<4565C16E.3090803@ru.mvista.com>
X-Fingerprint: 6ACA 1623 39BD 9A94 9B1A  B746 CA77 FE94 2874 D52F
X-Pgp-Public-Key: http://wwwkeys.pgp.net/pks/lookup?op=get&search=0x2874D52F
X-Mailer: Mew version 3.3 on Emacs 21.4 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Return-Path: <anemo@mba.ocn.ne.jp>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13249
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: anemo@mba.ocn.ne.jp
Precedence: bulk
X-list: linux-mips

On Thu, 23 Nov 2006 18:42:38 +0300, Sergei Shtylyov <sshtylyov@ru.mvista.com> wrote:
> >>   BTW, isn't IRQ7 per-CPU?
> 
> > Yes and no.  On many CPUs IRQ 7 can be configured at reset time as either
> > the count / compare interrupt or a CPU interrupt just like the others.
> > It always used to be a normal CPU interrupt for R2000 class CPUs.
> 
>     Nevertheless, IRQ7 having percpu flow when it's known to be from 
> count/compare would make the timer stuff faster, I assume...

It would be faster indeed, but note that handle_percpu_irq() depends
on CONFIG_SMP for now.

---
Atsushi Nemoto

From macro@linux-mips.org Fri Nov 24 14:47:20 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 24 Nov 2006 14:47:26 +0000 (GMT)
Received: from pollux.ds.pg.gda.pl ([153.19.208.7]:56591 "EHLO
	pollux.ds.pg.gda.pl") by ftp.linux-mips.org with ESMTP
	id S20038960AbWKXOrU (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Fri, 24 Nov 2006 14:47:20 +0000
Received: from localhost (localhost [127.0.0.1])
	by pollux.ds.pg.gda.pl (Postfix) with ESMTP id 55DF3F5980;
	Fri, 24 Nov 2006 15:47:07 +0100 (CET)
X-Virus-Scanned: by amavisd-new at pollux.ds.pg.gda.pl
Received: from pollux.ds.pg.gda.pl ([127.0.0.1])
	by localhost (pollux.ds.pg.gda.pl [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id IGh27U2AS+j0; Fri, 24 Nov 2006 15:47:06 +0100 (CET)
Received: from piorun.ds.pg.gda.pl (piorun.ds.pg.gda.pl [153.19.208.8])
	by pollux.ds.pg.gda.pl (Postfix) with ESMTP id DC1DBF5971;
	Fri, 24 Nov 2006 15:47:06 +0100 (CET)
Received: from blysk.ds.pg.gda.pl (macro@blysk.ds.pg.gda.pl [153.19.208.6])
	by piorun.ds.pg.gda.pl (8.13.8/8.13.8) with ESMTP id kAOElHat014530;
	Fri, 24 Nov 2006 15:47:18 +0100
Date:	Fri, 24 Nov 2006 14:47:13 +0000 (GMT)
From:	"Maciej W. Rozycki" <macro@linux-mips.org>
To:	Andrew Morton <akpm@osdl.org>
cc:	linux-kernel@vger.kernel.org, linux-mips@linux-mips.org
Subject: [PATCH 2.6.18] dz: Fixes to make it work
Message-ID: <Pine.LNX.4.64N.0611241420500.20948@blysk.ds.pg.gda.pl>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Virus-Scanned: ClamAV 0.88.6/2239/Fri Nov 24 11:59:19 2006 on piorun.ds.pg.gda.pl
X-Virus-Status:	Clean
Return-Path: <macro@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13250
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: macro@linux-mips.org
Precedence: bulk
X-list: linux-mips

 This a set of fixes mostly to make the driver actually work:

1. Actually select the line for setting parameters and receiver 
   disable/enable.
2. Select the line for receive and transmit interrupt handling correctly.
3. Report the transmitter empty state correctly.
4. Set the I/O type of ports correctly.
5. Perform polled transmission correctly.
6. Don't fix the console line at ttyS3.
7. Magic SysRq support.
8. Various small bits here and there.

Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
---
 Tested with a DECstation 2100 (thanks Flo for making this possible).

 Please apply.

  Maciej

patch-2.6.18-dz-13
diff -up --recursive --new-file linux-2.6.18.macro/drivers/char/decserial.c linux-2.6.18/drivers/char/decserial.c
--- linux-2.6.18.macro/drivers/char/decserial.c	2006-09-20 03:42:06.000000000 +0000
+++ linux-2.6.18/drivers/char/decserial.c	2006-11-23 18:29:38.000000000 +0000
@@ -23,20 +23,12 @@
 extern int zs_init(void);
 #endif
 
-#ifdef CONFIG_DZ
-extern int dz_init(void);
-#endif
-
 #ifdef CONFIG_SERIAL_CONSOLE
 
 #ifdef CONFIG_ZS
 extern void zs_serial_console_init(void);
 #endif
 
-#ifdef CONFIG_DZ
-extern void dz_serial_console_init(void);
-#endif
-
 #endif
 
 /* rs_init - starts up the serial interface -
@@ -46,23 +38,11 @@ extern void dz_serial_console_init(void)
 
 int __init rs_init(void)
 {
-
-#if defined(CONFIG_ZS) && defined(CONFIG_DZ)
+#ifdef ONFIG_ZS
     if (IOASIC)
 	return zs_init();
-    else
-	return dz_init();
-#else
-
-#ifdef CONFIG_ZS
-    return zs_init();
-#endif
-
-#ifdef CONFIG_DZ
-    return dz_init();
-#endif
-
 #endif
+    return -ENXIO;
 }
 
 __initcall(rs_init);
@@ -76,21 +56,9 @@ __initcall(rs_init);
  */
 static int __init decserial_console_init(void)
 {
-#if defined(CONFIG_ZS) && defined(CONFIG_DZ)
+#ifdef CONFIG_ZS
     if (IOASIC)
 	zs_serial_console_init();
-    else
-	dz_serial_console_init();
-#else
-
-#ifdef CONFIG_ZS
-    zs_serial_console_init();
-#endif
-
-#ifdef CONFIG_DZ
-    dz_serial_console_init();
-#endif
-
 #endif
     return 0;
 }
diff -up --recursive --new-file linux-2.6.18.macro/drivers/serial/dz.c linux-2.6.18/drivers/serial/dz.c
--- linux-2.6.18.macro/drivers/serial/dz.c	2006-09-20 03:42:06.000000000 +0000
+++ linux-2.6.18/drivers/serial/dz.c	2006-11-23 18:27:06.000000000 +0000
@@ -1,11 +1,13 @@
 /*
- * dz.c: Serial port driver for DECStations equiped
+ * dz.c: Serial port driver for DECstations equipped
  *       with the DZ chipset.
  *
  * Copyright (C) 1998 Olivier A. D. Lebaillif
  *
  * Email: olivier.lebaillif@ifrsys.com
  *
+ * Copyright (C) 2004, 2006  Maciej W. Rozycki
+ *
  * [31-AUG-98] triemer
  * Changed IRQ to use Harald's dec internals interrupts.h
  * removed base_addr code - moving address assignment to setup.c
@@ -26,10 +28,16 @@
 
 #undef DEBUG_DZ
 
+#if defined(CONFIG_SERIAL_DZ_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
+#define SUPPORT_SYSRQ
+#endif
+
+#include <linux/delay.h>
 #include <linux/module.h>
 #include <linux/interrupt.h>
 #include <linux/init.h>
 #include <linux/console.h>
+#include <linux/sysrq.h>
 #include <linux/tty.h>
 #include <linux/tty_flip.h>
 #include <linux/serial_core.h>
@@ -45,14 +53,10 @@
 #include <asm/system.h>
 #include <asm/uaccess.h>
 
-#define CONSOLE_LINE (3)	/* for definition of struct console */
-
 #include "dz.h"
 
-#define DZ_INTR_DEBUG 1
-
 static char *dz_name = "DECstation DZ serial driver version ";
-static char *dz_version = "1.02";
+static char *dz_version = "1.03";
 
 struct dz_port {
 	struct uart_port	port;
@@ -61,22 +65,6 @@ struct dz_port {
 
 static struct dz_port dz_ports[DZ_NB_PORT];
 
-#ifdef DEBUG_DZ
-/*
- * debugging code to send out chars via prom
- */
-static void debug_console(const char *s, int count)
-{
-	unsigned i;
-
-	for (i = 0; i < count; i++) {
-		if (*s == 10)
-			prom_printf("%c", 13);
-		prom_printf("%c", *s++);
-	}
-}
-#endif
-
 /*
  * ------------------------------------------------------------
  * dz_in () and dz_out ()
@@ -90,6 +78,7 @@ static inline unsigned short dz_in(struc
 {
 	volatile unsigned short *addr =
 		(volatile unsigned short *) (dport->port.membase + offset);
+
 	return *addr;
 }
 
@@ -98,6 +87,7 @@ static inline void dz_out(struct dz_port
 {
 	volatile unsigned short *addr =
 		(volatile unsigned short *) (dport->port.membase + offset);
+
 	*addr = value;
 }
 
@@ -144,7 +134,7 @@ static void dz_stop_rx(struct uart_port 
 
 	spin_lock_irqsave(&dport->port.lock, flags);
 	dport->cflag &= ~DZ_CREAD;
-	dz_out(dport, DZ_LPR, dport->cflag);
+	dz_out(dport, DZ_LPR, dport->cflag | dport->port.line);
 	spin_unlock_irqrestore(&dport->port.lock, flags);
 }
 
@@ -155,14 +145,14 @@ static void dz_enable_ms(struct uart_por
 
 /*
  * ------------------------------------------------------------
- * Here starts the interrupt handling routines.  All of the
- * following subroutines are declared as inline and are folded
- * into dz_interrupt.  They were separated out for readability's
- * sake.
  *
- * Note: rs_interrupt() is a "fast" interrupt, which means that it
+ * Here start the interrupt handling routines.  All of the following
+ * subroutines are declared as inline and are folded into
+ * dz_interrupt.  They were separated out for readability's sake.
+ *
+ * Note: dz_interrupt() is a "fast" interrupt, which means that it
  * runs with interrupts turned off.  People who may want to modify
- * rs_interrupt() should try to keep the interrupt handler as fast as
+ * dz_interrupt() should try to keep the interrupt handler as fast as
  * possible.  After you are done making modifications, it is not a bad
  * idea to do:
  *
@@ -180,92 +170,74 @@ static void dz_enable_ms(struct uart_por
  * This routine deals with inputs from any lines.
  * ------------------------------------------------------------
  */
-static inline void dz_receive_chars(struct dz_port *dport)
+static inline void dz_receive_chars(struct dz_port *dport_in,
+				    struct pt_regs *regs)
 {
+	struct dz_port *dport;
 	struct tty_struct *tty = NULL;
 	struct uart_icount *icount;
-	int ignore = 0;
-	unsigned short status, tmp;
+	int lines_rx[DZ_NB_PORT] = { [0 ... DZ_NB_PORT - 1] = 0 };
+	unsigned short status;
 	unsigned char ch, flag;
+	int i;
 
-	/* this code is going to be a problem...
-	   the call to tty_flip_buffer is going to need
-	   to be rethought...
-	 */
-	do {
-		status = dz_in(dport, DZ_RBUF);
-
-		/* punt so we don't get duplicate characters */
-		if (!(status & DZ_DVAL))
-			goto ignore_char;
-
+	while ((status = dz_in(dport_in, DZ_RBUF)) & DZ_DVAL) {
+		dport = &dz_ports[LINE(status)];
+		tty = dport->port.info->tty;	/* point to the proper dev */
 
-		ch = UCHAR(status);	/* grab the char */
-		flag = TTY_NORMAL;
+		ch = UCHAR(status);		/* grab the char */
 
-#if 0
-		if (info->is_console) {
-			if (ch == 0)
-				return;		/* it's a break ... */
-		}
-#endif
-
-		tty = dport->port.info->tty;/* now tty points to the proper dev */
 		icount = &dport->port.icount;
-
-		if (!tty)
-			break;
-
 		icount->rx++;
 
-		/* keep track of the statistics */
-		if (status & (DZ_OERR | DZ_FERR | DZ_PERR)) {
-			if (status & DZ_PERR)	/* parity error */
-				icount->parity++;
-			else if (status & DZ_FERR)	/* frame error */
-				icount->frame++;
-			if (status & DZ_OERR)	/* overrun error */
-				icount->overrun++;
-
-			/*  check to see if we should ignore the character
-			   and mask off conditions that should be ignored
+		flag = TTY_NORMAL;
+		if (status & DZ_FERR) {		/* frame error */
+			/*
+			 * There is no separate BREAK status bit, so
+			 * treat framing errors as BREAKs for Magic SysRq
+			 * and SAK; normally, otherwise.
 			 */
-
-			if (status & dport->port.ignore_status_mask) {
-				if (++ignore > 100)
-					break;
-				goto ignore_char;
-			}
-			/* mask off the error conditions we want to ignore */
-			tmp = status & dport->port.read_status_mask;
-
-			if (tmp & DZ_PERR) {
-				flag = TTY_PARITY;
-#ifdef DEBUG_DZ
-				debug_console("PERR\n", 5);
-#endif
-			} else if (tmp & DZ_FERR) {
+			if (uart_handle_break(&dport->port))
+				continue;
+			if (dport->port.flags & UPF_SAK)
+				flag = TTY_BREAK;
+			else
 				flag = TTY_FRAME;
-#ifdef DEBUG_DZ
-				debug_console("FERR\n", 5);
-#endif
-			}
-			if (tmp & DZ_OERR) {
-#ifdef DEBUG_DZ
-				debug_console("OERR\n", 5);
-#endif
-				tty_insert_flip_char(tty, ch, flag);
-				ch = 0;
-				flag = TTY_OVERRUN;
-			}
+		} else if (status & DZ_OERR)	/* overrun error */
+			flag = TTY_OVERRUN;
+		else if (status & DZ_PERR)	/* parity error */
+			flag = TTY_PARITY;
+
+		/* keep track of the statistics */
+		switch (flag) {
+		case TTY_FRAME:
+			icount->frame++;
+			break;
+		case TTY_PARITY:
+			icount->parity++;
+			break;
+		case TTY_OVERRUN:
+			icount->overrun++;
+			break;
+		case TTY_BREAK:
+			icount->brk++;
+			break;
+		default:
+			break;
 		}
-		tty_insert_flip_char(tty, ch, flag);
-	      ignore_char:
-			;
-	} while (status & DZ_DVAL);
 
-	if (tty)
-		tty_flip_buffer_push(tty);
+		if (uart_handle_sysrq_char(&dport->port, ch, regs))
+			continue;
+
+		if ((status & dport->port.ignore_status_mask) == 0) {
+			uart_insert_char(&dport->port,
+					 status, DZ_OERR, ch, flag);
+			lines_rx[LINE(status)] = 1;
+		}
+	}
+	for (i = 0; i < DZ_NB_PORT; i++)
+		if (lines_rx[i])
+			tty_flip_buffer_push(dz_ports[i].port.info->tty);
 }
 
 /*
@@ -275,26 +247,32 @@ static inline void dz_receive_chars(stru
  * This routine deals with outputs to any lines.
  * ------------------------------------------------------------
  */
-static inline void dz_transmit_chars(struct dz_port *dport)
+static inline void dz_transmit_chars(struct dz_port *dport_in)
 {
-	struct circ_buf *xmit = &dport->port.info->xmit;
+	struct dz_port *dport;
+	struct circ_buf *xmit;
+	unsigned short status;
 	unsigned char tmp;
 
-	if (dport->port.x_char) {	/* XON/XOFF chars */
+	status = dz_in(dport_in, DZ_CSR);
+	dport = &dz_ports[LINE(status)];
+	xmit = &dport->port.info->xmit;
+
+	if (dport->port.x_char) {		/* XON/XOFF chars */
 		dz_out(dport, DZ_TDR, dport->port.x_char);
 		dport->port.icount.tx++;
 		dport->port.x_char = 0;
 		return;
 	}
-	/* if nothing to do or stopped or hardware stopped */
+	/* If nothing to do or stopped or hardware stopped. */
 	if (uart_circ_empty(xmit) || uart_tx_stopped(&dport->port)) {
 		dz_stop_tx(&dport->port);
 		return;
 	}
 
 	/*
-	 * if something to do ... (rember the dz has no output fifo so we go
-	 * one char at a time :-<
+	 * If something to do... (remember the dz has no output fifo,
+	 * so we go one char at a time) :-<
 	 */
 	tmp = xmit->buf[xmit->tail];
 	xmit->tail = (xmit->tail + 1) & (DZ_XMIT_SIZE - 1);
@@ -304,23 +282,29 @@ static inline void dz_transmit_chars(str
 	if (uart_circ_chars_pending(xmit) < DZ_WAKEUP_CHARS)
 		uart_write_wakeup(&dport->port);
 
-	/* Are we done */
+	/* Are we are done. */
 	if (uart_circ_empty(xmit))
 		dz_stop_tx(&dport->port);
 }
 
 /*
  * ------------------------------------------------------------
- * check_modem_status ()
+ * check_modem_status()
  *
- * Only valid for the MODEM line duh !
+ * DS 3100 & 5100: Only valid for the MODEM line, duh!
+ * DS 5000/200: Valid for the MODEM and PRINTER line.
  * ------------------------------------------------------------
  */
 static inline void check_modem_status(struct dz_port *dport)
 {
+	/*
+	 * FIXME:
+	 * 1. No status change interrupt; use a timer.
+	 * 2. Handle the 3100/5000 as appropriate. --macro
+	 */
 	unsigned short status;
 
-	/* if not ne modem line just return */
+	/* If not the modem line just return.  */
 	if (dport->port.line != DZ_MODEM)
 		return;
 
@@ -341,21 +325,18 @@ static inline void check_modem_status(st
  */
 static irqreturn_t dz_interrupt(int irq, void *dev, struct pt_regs *regs)
 {
-	struct dz_port *dport;
+	struct dz_port *dport = (struct dz_port *)dev;
 	unsigned short status;
 
 	/* get the reason why we just got an irq */
-	status = dz_in((struct dz_port *)dev, DZ_CSR);
-	dport = &dz_ports[LINE(status)];
+	status = dz_in(dport, DZ_CSR);
 
-	if (status & DZ_RDONE)
-		dz_receive_chars(dport);
+	if ((status & (DZ_RDONE | DZ_RIE)) == (DZ_RDONE | DZ_RIE))
+		dz_receive_chars(dport, regs);
 
-	if (status & DZ_TRDY)
+	if ((status & (DZ_TRDY | DZ_TIE)) == (DZ_TRDY | DZ_TIE))
 		dz_transmit_chars(dport);
 
-	/* FIXME: what about check modem status??? --rmk */
-
 	return IRQ_HANDLED;
 }
 
@@ -367,13 +348,13 @@ static irqreturn_t dz_interrupt(int irq,
 
 static unsigned int dz_get_mctrl(struct uart_port *uport)
 {
+	/*
+	 * FIXME: Handle the 3100/5000 as appropriate. --macro
+	 */
 	struct dz_port *dport = (struct dz_port *)uport;
 	unsigned int mctrl = TIOCM_CAR | TIOCM_DSR | TIOCM_CTS;
 
 	if (dport->port.line == DZ_MODEM) {
-		/*
-		 * CHECKME: This is a guess from the other code... --rmk
-		 */
 		if (dz_in(dport, DZ_MSR) & DZ_MODEM_DSR)
 			mctrl &= ~TIOCM_DSR;
 	}
@@ -383,6 +364,9 @@ static unsigned int dz_get_mctrl(struct 
 
 static void dz_set_mctrl(struct uart_port *uport, unsigned int mctrl)
 {
+	/*
+	 * FIXME: Handle the 3100/5000 as appropriate. --macro
+	 */
 	struct dz_port *dport = (struct dz_port *)uport;
 	unsigned short tmp;
 
@@ -409,13 +393,6 @@ static int dz_startup(struct uart_port *
 	unsigned long flags;
 	unsigned short tmp;
 
-	/* The dz lines for the mouse/keyboard must be
-	 * opened using their respective drivers.
-	 */
-	if ((dport->port.line == DZ_KEYBOARD) ||
-	    (dport->port.line == DZ_MOUSE))
-		return -ENODEV;
-
 	spin_lock_irqsave(&dport->port.lock, flags);
 
 	/* enable the interrupt and the scanning */
@@ -442,7 +419,8 @@ static void dz_shutdown(struct uart_port
 }
 
 /*
- * get_lsr_info - get line status register info
+ * -------------------------------------------------------------------
+ * dz_tx_empty() -- get the transmitter empty status
  *
  * Purpose: Let user call ioctl() to get info when the UART physically
  *          is emptied.  On bus types like RS485, the transmitter must
@@ -450,21 +428,28 @@ static void dz_shutdown(struct uart_port
  *          the transmit shift register is empty, not be done when the
  *          transmit holding register is empty.  This functionality
  *          allows an RS485 driver to be written in user space.
+ * -------------------------------------------------------------------
  */
 static unsigned int dz_tx_empty(struct uart_port *uport)
 {
 	struct dz_port *dport = (struct dz_port *)uport;
-	unsigned short status = dz_in(dport, DZ_LPR);
+	unsigned short tmp, mask = 1 << dport->port.line;
 
-	/* FIXME: this appears to be obviously broken --rmk. */
-	return status ? TIOCSER_TEMT : 0;
+	tmp = dz_in(dport, DZ_TCR);
+	tmp &= mask;
+
+	return tmp ? 0 : TIOCSER_TEMT;
 }
 
 static void dz_break_ctl(struct uart_port *uport, int break_state)
 {
+	/*
+	 * FIXME: Can't access BREAK bits in TDR easily;
+	 * reuse the code for polled TX. --macro
+	 */
 	struct dz_port *dport = (struct dz_port *)uport;
 	unsigned long flags;
-	unsigned short tmp, mask = 1 << uport->line;
+	unsigned short tmp, mask = 1 << dport->port.line;
 
 	spin_lock_irqsave(&uport->lock, flags);
 	tmp = dz_in(dport, DZ_TCR);
@@ -561,7 +546,7 @@ static void dz_set_termios(struct uart_p
 
 	spin_lock_irqsave(&dport->port.lock, flags);
 
-	dz_out(dport, DZ_LPR, cflag);
+	dz_out(dport, DZ_LPR, cflag | dport->port.line);
 	dport->cflag = cflag;
 
 	/* setup accept flag */
@@ -650,7 +635,7 @@ static void __init dz_init_ports(void)
 	for (i = 0, dport = dz_ports; i < DZ_NB_PORT; i++, dport++) {
 		spin_lock_init(&dport->port.lock);
 		dport->port.membase	= (char *) base;
-		dport->port.iotype	= UPIO_PORT;
+		dport->port.iotype	= UPIO_MEM;
 		dport->port.irq		= dec_interrupt[DEC_IRQ_DZ11];
 		dport->port.line	= i;
 		dport->port.fifosize	= 1;
@@ -662,10 +647,7 @@ static void __init dz_init_ports(void)
 static void dz_reset(struct dz_port *dport)
 {
 	dz_out(dport, DZ_CSR, DZ_CLR);
-
 	while (dz_in(dport, DZ_CSR) & DZ_CLR);
-		/* FIXME: cpu_relax? */
-
 	iob();
 
 	/* enable scanning */
@@ -673,26 +655,55 @@ static void dz_reset(struct dz_port *dpo
 }
 
 #ifdef CONFIG_SERIAL_DZ_CONSOLE
+/*
+ * -------------------------------------------------------------------
+ * dz_console_putchar() -- transmit a character
+ *
+ * Polled transmission.  This is tricky.  We need to mask transmit
+ * interrupts so that they do not interfere, enable the transmitter
+ * for the line requested and then wait till the transmit scanner
+ * requests data for this line.  But it may request data for another
+ * line first, in which case we have to disable its transmitter and
+ * repeat waiting till our line pops up.  Only then the character may
+ * be transmitted.  Finally, the state of the transmitter mask is
+ * restored.  Welcome to the world of PDP-11!
+ * -------------------------------------------------------------------
+ */
 static void dz_console_putchar(struct uart_port *uport, int ch)
 {
 	struct dz_port *dport = (struct dz_port *)uport;
 	unsigned long flags;
-	int loops = 2500;
-	unsigned short tmp = (unsigned char)ch;
-	/* this code sends stuff out to serial device - spinning its
-	   wheels and waiting. */
+	unsigned short csr, tcr, trdy, mask;
+	int loops = 10000;
 
 	spin_lock_irqsave(&dport->port.lock, flags);
+	csr = dz_in(dport, DZ_CSR);
+	dz_out(dport, DZ_CSR, csr & ~DZ_TIE);
+	tcr = dz_in(dport, DZ_TCR);
+	tcr |= 1 << dport->port.line;
+	mask = tcr;
+	dz_out(dport, DZ_TCR, mask);
+	iob();
+	spin_unlock_irqrestore(&dport->port.lock, flags);
 
-	/* spin our wheels */
-	while (((dz_in(dport, DZ_CSR) & DZ_TRDY) != DZ_TRDY) && loops--)
-		/* FIXME: cpu_relax, udelay? --rmk */
-		;
+	while (loops--) {
+		trdy = dz_in(dport, DZ_CSR);
+		if (!(trdy & DZ_TRDY))
+			continue;
+		trdy = (trdy & DZ_TLINE) >> 8;
+		if (trdy == dport->port.line)
+			break;
+		mask &= ~(1 << trdy);
+		dz_out(dport, DZ_TCR, mask);
+		iob();
+		udelay(2);
+	}
 
-	/* Actually transmit the character. */
-	dz_out(dport, DZ_TDR, tmp);
+	if (loops)				/* Cannot send otherwise. */
+		dz_out(dport, DZ_TDR, ch);
 
-	spin_unlock_irqrestore(&dport->port.lock, flags);
+	dz_out(dport, DZ_TCR, tcr);
+	dz_out(dport, DZ_CSR, csr);
 }
 
 /*
@@ -703,11 +714,11 @@ static void dz_console_putchar(struct ua
  * The console must be locked when we get here.
  * -------------------------------------------------------------------
  */
-static void dz_console_print(struct console *cons,
+static void dz_console_print(struct console *co,
 			     const char *str,
 			     unsigned int count)
 {
-	struct dz_port *dport = &dz_ports[CONSOLE_LINE];
+	struct dz_port *dport = &dz_ports[co->index];
 #ifdef DEBUG_DZ
 	prom_printf((char *) str);
 #endif
@@ -716,49 +727,43 @@ static void dz_console_print(struct cons
 
 static int __init dz_console_setup(struct console *co, char *options)
 {
-	struct dz_port *dport = &dz_ports[CONSOLE_LINE];
+	struct dz_port *dport = &dz_ports[co->index];
 	int baud = 9600;
 	int bits = 8;
 	int parity = 'n';
 	int flow = 'n';
-	int ret;
-	unsigned short mask, tmp;
 
 	if (options)
 		uart_parse_options(options, &baud, &parity, &bits, &flow);
 
 	dz_reset(dport);
 
-	ret = uart_set_options(&dport->port, co, baud, parity, bits, flow);
-	if (ret == 0) {
-		mask = 1 << dport->port.line;
-		tmp = dz_in(dport, DZ_TCR);	/* read the TX flag */
-		if (!(tmp & mask)) {
-			tmp |= mask;		/* set the TX flag */
-			dz_out(dport, DZ_TCR, tmp);
-		}
-	}
-
-	return ret;
+	return uart_set_options(&dport->port, co, baud, parity, bits, flow);
 }
 
-static struct console dz_sercons =
-{
+static struct uart_driver dz_reg;
+static struct console dz_sercons = {
 	.name	= "ttyS",
 	.write	= dz_console_print,
 	.device	= uart_console_device,
 	.setup	= dz_console_setup,
-	.flags	= CON_CONSDEV | CON_PRINTBUFFER,
-	.index	= CONSOLE_LINE,
+	.flags	= CON_PRINTBUFFER,
+	.index	= -1,
+	.data	= &dz_reg,
 };
 
-void __init dz_serial_console_init(void)
+static int __init dz_serial_console_init(void)
 {
-	dz_init_ports();
-
-	register_console(&dz_sercons);
+	if (!IOASIC) {
+		dz_init_ports();
+		register_console(&dz_sercons);
+		return 0;
+	} else
+		return -ENXIO;
 }
 
+console_initcall(dz_serial_console_init);
+
 #define SERIAL_DZ_CONSOLE	&dz_sercons
 #else
 #define SERIAL_DZ_CONSOLE	NULL
@@ -767,35 +772,29 @@ void __init dz_serial_console_init(void)
 static struct uart_driver dz_reg = {
 	.owner			= THIS_MODULE,
 	.driver_name		= "serial",
-	.dev_name		= "ttyS%d",
+	.dev_name		= "ttyS",
 	.major			= TTY_MAJOR,
 	.minor			= 64,
 	.nr			= DZ_NB_PORT,
 	.cons			= SERIAL_DZ_CONSOLE,
 };
 
-int __init dz_init(void)
+static int __init dz_init(void)
 {
-	unsigned long flags;
 	int ret, i;
 
+	if (IOASIC)
+		return -ENXIO;
+
 	printk("%s%s\n", dz_name, dz_version);
 
 	dz_init_ports();
 
-	save_flags(flags);
-	cli();
-
 #ifndef CONFIG_SERIAL_DZ_CONSOLE
 	/* reset the chip */
 	dz_reset(&dz_ports[0]);
 #endif
 
-	/* order matters here... the trick is that flags
-	   is updated... in request_irq - to immediatedly obliterate
-	   it is unwise. */
-	restore_flags(flags);
-
 	if (request_irq(dz_ports[0].port.irq, dz_interrupt,
 			IRQF_DISABLED, "DZ", &dz_ports[0]))
 		panic("Unable to register DZ interrupt");
@@ -810,5 +809,7 @@ int __init dz_init(void)
 	return ret;
 }
 
+module_init(dz_init);
+
 MODULE_DESCRIPTION("DECstation DZ serial driver");
 MODULE_LICENSE("GPL");
diff -up --recursive --new-file linux-2.6.18.macro/drivers/serial/dz.h linux-2.6.18/drivers/serial/dz.h
--- linux-2.6.18.macro/drivers/serial/dz.h	2006-09-20 03:42:06.000000000 +0000
+++ linux-2.6.18/drivers/serial/dz.h	2006-11-23 18:27:06.000000000 +0000
@@ -1,20 +1,22 @@
 /*
- * dz.h: Serial port driver for DECStations equiped 
+ * dz.h: Serial port driver for DECstations equipped 
  *       with the DZ chipset.
  *
  * Copyright (C) 1998 Olivier A. D. Lebaillif 
  *             
  * Email: olivier.lebaillif@ifrsys.com
  *
+ * Copyright (C) 2004, 2006  Maciej W. Rozycki
  */
 #ifndef DZ_SERIAL_H
 #define DZ_SERIAL_H
 
 /*
- * Definitions for the Control and Status Received.
+ * Definitions for the Control and Status Register.
  */
 #define DZ_TRDY        0x8000                 /* Transmitter empty */
-#define DZ_TIE         0x4000                 /* Transmitter Interrupt Enable */
+#define DZ_TIE         0x4000                 /* Transmitter Interrupt Enbl */
+#define DZ_TLINE       0x0300                 /* Transmitter Line Number */
 #define DZ_RDONE       0x0080                 /* Receiver data ready */
 #define DZ_RIE         0x0040                 /* Receive Interrupt Enable */
 #define DZ_MSE         0x0020                 /* Master Scan Enable */
@@ -22,32 +24,44 @@
 #define DZ_MAINT       0x0008                 /* Loop Back Mode */
 
 /*
- * Definitions for the Received buffer. 
+ * Definitions for the Receiver Buffer Register. 
  */
-#define DZ_RBUF_MASK   0x00FF                 /* Data Mask in the Receive Buffer */
-#define DZ_LINE_MASK   0x0300                 /* Line Mask in the Receive Buffer */
+#define DZ_RBUF_MASK   0x00FF                 /* Data Mask */
+#define DZ_LINE_MASK   0x0300                 /* Line Mask */
 #define DZ_DVAL        0x8000                 /* Valid Data indicator */
 #define DZ_OERR        0x4000                 /* Overrun error indicator */
 #define DZ_FERR        0x2000                 /* Frame error indicator */
 #define DZ_PERR        0x1000                 /* Parity error indicator */
 
-#define LINE(x) (x & DZ_LINE_MASK) >> 8       /* Get the line number from the input buffer */
-#define UCHAR(x) (unsigned char)(x & DZ_RBUF_MASK)
+#define LINE(x) ((x & DZ_LINE_MASK) >> 8)     /* Get the line number
+                                                 from the input buffer */
+#define UCHAR(x) ((unsigned char)(x & DZ_RBUF_MASK))
 
 /*
- * Definitions for the Transmit Register.
+ * Definitions for the Transmit Control Register.
  */
 #define DZ_LINE_KEYBOARD 0x0001
 #define DZ_LINE_MOUSE    0x0002
 #define DZ_LINE_MODEM    0x0004
 #define DZ_LINE_PRINTER  0x0008
 
+#define DZ_MODEM_RTS     0x0800               /* RTS for the modem line (2) */
 #define DZ_MODEM_DTR     0x0400               /* DTR for the modem line (2) */
+#define DZ_PRINT_RTS     0x0200               /* RTS for the prntr line (3) */
+#define DZ_PRINT_DTR     0x0100               /* DTR for the prntr line (3) */
+#define DZ_LNENB         0x000f               /* Transmitter Line Enable */
 
 /*
  * Definitions for the Modem Status Register.
  */
+#define DZ_MODEM_RI      0x0800               /* RI for the modem line (2) */
+#define DZ_MODEM_CD      0x0400               /* CD for the modem line (2) */
 #define DZ_MODEM_DSR     0x0200               /* DSR for the modem line (2) */
+#define DZ_MODEM_CTS     0x0100               /* CTS for the modem line (2) */
+#define DZ_PRINT_RI      0x0008               /* RI for the printer line (3) */
+#define DZ_PRINT_CD      0x0004               /* CD for the printer line (3) */
+#define DZ_PRINT_DSR     0x0002               /* DSR for the prntr line (3) */
+#define DZ_PRINT_CTS     0x0001               /* CTS for the prntr line (3) */
 
 /*
  * Definitions for the Transmit Data Register.

From macro@linux-mips.org Fri Nov 24 14:52:17 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 24 Nov 2006 14:52:23 +0000 (GMT)
Received: from pollux.ds.pg.gda.pl ([153.19.208.7]:14859 "EHLO
	pollux.ds.pg.gda.pl") by ftp.linux-mips.org with ESMTP
	id S20038960AbWKXOwR (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Fri, 24 Nov 2006 14:52:17 +0000
Received: from localhost (localhost [127.0.0.1])
	by pollux.ds.pg.gda.pl (Postfix) with ESMTP id 43337F5987;
	Fri, 24 Nov 2006 15:52:05 +0100 (CET)
X-Virus-Scanned: by amavisd-new at pollux.ds.pg.gda.pl
Received: from pollux.ds.pg.gda.pl ([127.0.0.1])
	by localhost (pollux.ds.pg.gda.pl [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id diXc75vT83VX; Fri, 24 Nov 2006 15:52:04 +0100 (CET)
Received: from piorun.ds.pg.gda.pl (piorun.ds.pg.gda.pl [153.19.208.8])
	by pollux.ds.pg.gda.pl (Postfix) with ESMTP id 79A04F5980;
	Fri, 24 Nov 2006 15:52:04 +0100 (CET)
Received: from blysk.ds.pg.gda.pl (macro@blysk.ds.pg.gda.pl [153.19.208.6])
	by piorun.ds.pg.gda.pl (8.13.8/8.13.8) with ESMTP id kAOEqEbO016377;
	Fri, 24 Nov 2006 15:52:14 +0100
Date:	Fri, 24 Nov 2006 14:52:10 +0000 (GMT)
From:	"Maciej W. Rozycki" <macro@linux-mips.org>
To:	Andrew Morton <akpm@osdl.org>, Jeff Garzik <jgarzik@pobox.com>
cc:	netdev@vger.kernel.org, linux-mips@linux-mips.org
Subject: [PATCH 2.6.18] declance: Fix PMAX and PMAD support
Message-ID: <Pine.LNX.4.64N.0611241447200.20948@blysk.ds.pg.gda.pl>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Virus-Scanned: ClamAV 0.88.6/2239/Fri Nov 24 11:59:19 2006 on piorun.ds.pg.gda.pl
X-Virus-Status:	Clean
Return-Path: <macro@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13251
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: macro@linux-mips.org
Precedence: bulk
X-list: linux-mips

 The shared buffer used by the LANCE on the PMAX only supports halfword 
(16-bit) accesses.  And the PMAD has the buffer wired differently.  This 
is a change to fix these issues.

Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
---
 Tested with a DECstation 2100 (thanks Flo for making this possible) and a 
DECstation 5000/133 (both the PMAD and the onboard LANCE).

 Please apply.

  Maciej

patch-mips-2.6.18-20060920-pmax-lance-10
diff -up --recursive --new-file linux-mips-2.6.18-20060920.macro/drivers/net/declance.c linux-mips-2.6.18-20060920/drivers/net/declance.c
--- linux-mips-2.6.18-20060920.macro/drivers/net/declance.c	2006-09-20 20:50:22.000000000 +0000
+++ linux-mips-2.6.18-20060920/drivers/net/declance.c	2006-11-23 02:55:34.000000000 +0000
@@ -40,6 +40,10 @@
  *
  *      v0.009: Module support fixes, multiple interfaces support, various
  *              bits. macro
+ *
+ *      v0.010: Fixes for the PMAD mapping of the LANCE buffer and for the
+ *              PMAX requirement to only use halfword accesses to the
+ *              buffer. macro
  */
 
 #include <linux/crc32.h>
@@ -54,6 +58,7 @@
 #include <linux/spinlock.h>
 #include <linux/stddef.h>
 #include <linux/string.h>
+#include <linux/types.h>
 
 #include <asm/addrspace.h>
 #include <asm/system.h>
@@ -67,7 +72,7 @@
 #include <asm/dec/tc.h>
 
 static char version[] __devinitdata =
-"declance.c: v0.009 by Linux MIPS DECstation task force\n";
+"declance.c: v0.010 by Linux MIPS DECstation task force\n";
 
 MODULE_AUTHOR("Linux MIPS DECstation task force");
 MODULE_DESCRIPTION("DEC LANCE (DECstation onboard, PMAD-xx) driver");
@@ -110,24 +115,25 @@ MODULE_LICENSE("GPL");
 #define	LE_C3_BCON	0x1	/* Byte control */
 
 /* Receive message descriptor 1 */
-#define LE_R1_OWN       0x80	/* Who owns the entry */
-#define LE_R1_ERR       0x40	/* Error: if FRA, OFL, CRC or BUF is set */
-#define LE_R1_FRA       0x20	/* FRA: Frame error */
-#define LE_R1_OFL       0x10	/* OFL: Frame overflow */
-#define LE_R1_CRC       0x08	/* CRC error */
-#define LE_R1_BUF       0x04	/* BUF: Buffer error */
-#define LE_R1_SOP       0x02	/* Start of packet */
-#define LE_R1_EOP       0x01	/* End of packet */
-#define LE_R1_POK       0x03	/* Packet is complete: SOP + EOP */
-
-#define LE_T1_OWN       0x80	/* Lance owns the packet */
-#define LE_T1_ERR       0x40	/* Error summary */
-#define LE_T1_EMORE     0x10	/* Error: more than one retry needed */
-#define LE_T1_EONE      0x08	/* Error: one retry needed */
-#define LE_T1_EDEF      0x04	/* Error: deferred */
-#define LE_T1_SOP       0x02	/* Start of packet */
-#define LE_T1_EOP       0x01	/* End of packet */
-#define LE_T1_POK	0x03	/* Packet is complete: SOP + EOP */
+#define LE_R1_OWN	0x8000	/* Who owns the entry */
+#define LE_R1_ERR	0x4000	/* Error: if FRA, OFL, CRC or BUF is set */
+#define LE_R1_FRA	0x2000	/* FRA: Frame error */
+#define LE_R1_OFL	0x1000	/* OFL: Frame overflow */
+#define LE_R1_CRC	0x0800	/* CRC error */
+#define LE_R1_BUF	0x0400	/* BUF: Buffer error */
+#define LE_R1_SOP	0x0200	/* Start of packet */
+#define LE_R1_EOP	0x0100	/* End of packet */
+#define LE_R1_POK	0x0300	/* Packet is complete: SOP + EOP */
+
+/* Transmit message descriptor 1 */
+#define LE_T1_OWN	0x8000	/* Lance owns the packet */
+#define LE_T1_ERR	0x4000	/* Error summary */
+#define LE_T1_EMORE	0x1000	/* Error: more than one retry needed */
+#define LE_T1_EONE	0x0800	/* Error: one retry needed */
+#define LE_T1_EDEF	0x0400	/* Error: deferred */
+#define LE_T1_SOP	0x0200	/* Start of packet */
+#define LE_T1_EOP	0x0100	/* End of packet */
+#define LE_T1_POK	0x0300	/* Packet is complete: SOP + EOP */
 
 #define LE_T3_BUF       0x8000	/* Buffer error */
 #define LE_T3_UFL       0x4000	/* Error underflow */
@@ -156,69 +162,57 @@ MODULE_LICENSE("GPL");
 #undef TEST_HITS
 #define ZERO 0
 
-/* The DS2000/3000 have a linear 64 KB buffer.
-
- * The PMAD-AA has 128 kb buffer on-board. 
+/*
+ * The DS2100/3100 have a linear 64 kB buffer which supports halfword
+ * accesses only.  Each halfword of the buffer is word-aligned in the
+ * CPU address space.
+ *
+ * The PMAD-AA has a 128 kB buffer on-board. 
  *
- * The IOASIC LANCE devices use a shared memory region. This region as seen 
- * from the CPU is (max) 128 KB long and has to be on an 128 KB boundary.
- * The LANCE sees this as a 64 KB long continuous memory region.
+ * The IOASIC LANCE devices use a shared memory region.  This region
+ * as seen from the CPU is (max) 128 kB long and has to be on an 128 kB
+ * boundary.  The LANCE sees this as a 64 kB long continuous memory
+ * region.
  *
- * The LANCE's DMA address is used as an index in this buffer and DMA takes
- * place in bursts of eight 16-Bit words which are packed into four 32-Bit words
- * by the IOASIC. This leads to a strange padding: 16 bytes of valid data followed
- * by a 16 byte gap :-(.
+ * The LANCE's DMA address is used as an index in this buffer and DMA
+ * takes place in bursts of eight 16-bit words which are packed into
+ * four 32-bit words by the IOASIC.  This leads to a strange padding:
+ * 16 bytes of valid data followed by a 16 byte gap :-(.
  */
 
 struct lance_rx_desc {
 	unsigned short rmd0;		/* low address of packet */
-	short gap0;
-	unsigned char rmd1_hadr;	/* high address of packet */
-	unsigned char rmd1_bits;	/* descriptor bits */
-	short gap1;
+	unsigned short rmd1;		/* high address of packet
+					   and descriptor bits */
 	short length;			/* 2s complement (negative!)
 					   of buffer length */
-	short gap2;
 	unsigned short mblength;	/* actual number of bytes received */
-	short gap3;
 };
 
 struct lance_tx_desc {
 	unsigned short tmd0;		/* low address of packet */
-	short gap0;
-	unsigned char tmd1_hadr;	/* high address of packet */
-	unsigned char tmd1_bits;	/* descriptor bits */
-	short gap1;
+	unsigned short tmd1;		/* high address of packet
+					   and descriptor bits */
 	short length;			/* 2s complement (negative!)
 					   of buffer length */
-	short gap2;
 	unsigned short misc;
-	short gap3;
 };
 
 
 /* First part of the LANCE initialization block, described in databook. */
 struct lance_init_block {
 	unsigned short mode;		/* pre-set mode (reg. 15) */
-	short gap0;
 
-	unsigned char phys_addr[12];	/* physical ethernet address
-					   only 0, 1, 4, 5, 8, 9 are valid
-					   2, 3, 6, 7, 10, 11 are gaps */
-	unsigned short filter[8];	/* multicast filter
-					   only 0, 2, 4, 6 are valid
-					   1, 3, 5, 7 are gaps */
+	unsigned short phys_addr[3];	/* physical ethernet address */
+	unsigned short filter[4];	/* multicast filter */
 
 	/* Receive and transmit ring base, along with extra bits. */
 	unsigned short rx_ptr;		/* receive descriptor addr */
-	short gap1;
 	unsigned short rx_len;		/* receive len and high addr */
-	short gap2;
 	unsigned short tx_ptr;		/* transmit descriptor addr */
-	short gap3;
 	unsigned short tx_len;		/* transmit len and high addr */
-	short gap4;
-	short gap5[8];
+
+	short gap[4];
 
 	/* The buffer descriptors */
 	struct lance_rx_desc brx_ring[RX_RING_SIZE];
@@ -226,15 +220,28 @@ struct lance_init_block {
 };
 
 #define BUF_OFFSET_CPU sizeof(struct lance_init_block)
-#define BUF_OFFSET_LNC (sizeof(struct lance_init_block)>>1)
+#define BUF_OFFSET_LNC sizeof(struct lance_init_block)
 
-#define libdesc_offset(rt, elem) \
-((__u32)(((unsigned long)(&(((struct lance_init_block *)0)->rt[elem])))))
+#define shift_off(off, type)						\
+	(type == ASIC_LANCE || type == PMAX_LANCE ? off << 1 : off)
 
-/*
- * This works *only* for the ring descriptors
- */
-#define LANCE_ADDR(x) (CPHYSADDR(x) >> 1)
+#define lib_off(rt, type)						\
+	shift_off(offsetof(struct lance_init_block, rt), type)
+
+#define lib_ptr(ib, rt, type) 						\
+	((volatile u16 *)((u8 *)(ib) + lib_off(rt, type)))
+
+#define rds_off(rt, type)						\
+	shift_off(offsetof(struct lance_rx_desc, rt), type)
+
+#define rds_ptr(rd, rt, type) 						\
+	((volatile u16 *)((u8 *)(rd) + rds_off(rt, type)))
+
+#define tds_off(rt, type)						\
+	shift_off(offsetof(struct lance_tx_desc, rt), type)
+
+#define tds_ptr(td, rt, type) 						\
+	((volatile u16 *)((u8 *)(td) + tds_off(rt, type)))
 
 struct lance_private {
 	struct net_device *next;
@@ -242,7 +249,6 @@ struct lance_private {
 	int slot;
 	int dma_irq;
 	volatile struct lance_regs *ll;
-	volatile struct lance_init_block *init_block;
 
 	spinlock_t	lock;
 
@@ -260,8 +266,8 @@ struct lance_private {
 	char *tx_buf_ptr_cpu[TX_RING_SIZE];
 
 	/* Pointers to the ring buffers as seen from the LANCE */
-	char *rx_buf_ptr_lnc[RX_RING_SIZE];
-	char *tx_buf_ptr_lnc[TX_RING_SIZE];
+	uint rx_buf_ptr_lnc[RX_RING_SIZE];
+	uint tx_buf_ptr_lnc[TX_RING_SIZE];
 };
 
 #define TX_BUFFS_AVAIL ((lp->tx_old<=lp->tx_new)?\
@@ -294,7 +300,7 @@ static inline void writereg(volatile uns
 static void load_csrs(struct lance_private *lp)
 {
 	volatile struct lance_regs *ll = lp->ll;
-	int leptr;
+	uint leptr;
 
 	/* The address space as seen from the LANCE
 	 * begins at address 0. HK
@@ -316,12 +322,14 @@ static void load_csrs(struct lance_priva
  * Our specialized copy routines
  *
  */
-void cp_to_buf(const int type, void *to, const void *from, int len)
+static void cp_to_buf(const int type, void *to, const void *from, int len)
 {
 	unsigned short *tp, *fp, clen;
 	unsigned char *rtp, *rfp;
 
-	if (type == PMAX_LANCE) {
+	if (type == PMAD_LANCE) {
+		memcpy(to, from, len);
+	} else if (type == PMAX_LANCE) {
 		clen = len >> 1;
 		tp = (unsigned short *) to;
 		fp = (unsigned short *) from;
@@ -370,12 +378,14 @@ void cp_to_buf(const int type, void *to,
 	iob();
 }
 
-void cp_from_buf(const int type, void *to, const void *from, int len)
+static void cp_from_buf(const int type, void *to, const void *from, int len)
 {
 	unsigned short *tp, *fp, clen;
 	unsigned char *rtp, *rfp;
 
-	if (type == PMAX_LANCE) {
+	if (type == PMAD_LANCE) {
+		memcpy(to, from, len);
+	} else if (type == PMAX_LANCE) {
 		clen = len >> 1;
 		tp = (unsigned short *) to;
 		fp = (unsigned short *) from;
@@ -431,12 +441,10 @@ void cp_from_buf(const int type, void *t
 static void lance_init_ring(struct net_device *dev)
 {
 	struct lance_private *lp = netdev_priv(dev);
-	volatile struct lance_init_block *ib;
-	int leptr;
+	volatile u16 *ib = (volatile u16 *)dev->mem_start;
+	uint leptr;
 	int i;
 
-	ib = (struct lance_init_block *) (dev->mem_start);
-
 	/* Lock out other processes while setting up hardware */
 	netif_stop_queue(dev);
 	lp->rx_new = lp->tx_new = 0;
@@ -445,55 +453,64 @@ static void lance_init_ring(struct net_d
 	/* Copy the ethernet address to the lance init block.
 	 * XXX bit 0 of the physical address registers has to be zero
 	 */
-	ib->phys_addr[0] = dev->dev_addr[0];
-	ib->phys_addr[1] = dev->dev_addr[1];
-	ib->phys_addr[4] = dev->dev_addr[2];
-	ib->phys_addr[5] = dev->dev_addr[3];
-	ib->phys_addr[8] = dev->dev_addr[4];
-	ib->phys_addr[9] = dev->dev_addr[5];
+	*lib_ptr(ib, phys_addr[0], lp->type) = (dev->dev_addr[1] << 8) |
+				     dev->dev_addr[0];
+	*lib_ptr(ib, phys_addr[1], lp->type) = (dev->dev_addr[3] << 8) |
+				     dev->dev_addr[2];
+	*lib_ptr(ib, phys_addr[2], lp->type) = (dev->dev_addr[5] << 8) |
+				     dev->dev_addr[4];
 	/* Setup the initialization block */
 
 	/* Setup rx descriptor pointer */
-	leptr = LANCE_ADDR(libdesc_offset(brx_ring, 0));
-	ib->rx_len = (LANCE_LOG_RX_BUFFERS << 13) | (leptr >> 16);
-	ib->rx_ptr = leptr;
+	leptr = offsetof(struct lance_init_block, brx_ring);
+	*lib_ptr(ib, rx_len, lp->type) = (LANCE_LOG_RX_BUFFERS << 13) |
+					 (leptr >> 16);
+	*lib_ptr(ib, rx_ptr, lp->type) = leptr;
 	if (ZERO)
-		printk("RX ptr: %8.8x(%8.8x)\n", leptr, libdesc_offset(brx_ring, 0));
+		printk("RX ptr: %8.8x(%8.8x)\n",
+		       leptr, lib_off(brx_ring, lp->type));
 
 	/* Setup tx descriptor pointer */
-	leptr = LANCE_ADDR(libdesc_offset(btx_ring, 0));
-	ib->tx_len = (LANCE_LOG_TX_BUFFERS << 13) | (leptr >> 16);
-	ib->tx_ptr = leptr;
+	leptr = offsetof(struct lance_init_block, btx_ring);
+	*lib_ptr(ib, tx_len, lp->type) = (LANCE_LOG_TX_BUFFERS << 13) |
+					 (leptr >> 16);
+	*lib_ptr(ib, tx_ptr, lp->type) = leptr;
 	if (ZERO)
-		printk("TX ptr: %8.8x(%8.8x)\n", leptr, libdesc_offset(btx_ring, 0));
+		printk("TX ptr: %8.8x(%8.8x)\n",
+		       leptr, lib_off(btx_ring, lp->type));
 
 	if (ZERO)
 		printk("TX rings:\n");
 
 	/* Setup the Tx ring entries */
 	for (i = 0; i < TX_RING_SIZE; i++) {
-		leptr = (int) lp->tx_buf_ptr_lnc[i];
-		ib->btx_ring[i].tmd0 = leptr;
-		ib->btx_ring[i].tmd1_hadr = leptr >> 16;
-		ib->btx_ring[i].tmd1_bits = 0;
-		ib->btx_ring[i].length = 0xf000;	/* The ones required by tmd2 */
-		ib->btx_ring[i].misc = 0;
+		leptr = lp->tx_buf_ptr_lnc[i];
+		*lib_ptr(ib, btx_ring[i].tmd0, lp->type) = leptr;
+		*lib_ptr(ib, btx_ring[i].tmd1, lp->type) = (leptr >> 16) &
+							   0xff;
+		*lib_ptr(ib, btx_ring[i].length, lp->type) = 0xf000;
+						/* The ones required by tmd2 */
+		*lib_ptr(ib, btx_ring[i].misc, lp->type) = 0;
 		if (i < 3 && ZERO)
-			printk("%d: 0x%8.8x(0x%8.8x)\n", i, leptr, (int) lp->tx_buf_ptr_cpu[i]);
+			printk("%d: 0x%8.8x(0x%8.8x)\n",
+			       i, leptr, (uint)lp->tx_buf_ptr_cpu[i]);
 	}
 
 	/* Setup the Rx ring entries */
 	if (ZERO)
 		printk("RX rings:\n");
 	for (i = 0; i < RX_RING_SIZE; i++) {
-		leptr = (int) lp->rx_buf_ptr_lnc[i];
-		ib->brx_ring[i].rmd0 = leptr;
-		ib->brx_ring[i].rmd1_hadr = leptr >> 16;
-		ib->brx_ring[i].rmd1_bits = LE_R1_OWN;
-		ib->brx_ring[i].length = -RX_BUFF_SIZE | 0xf000;
-		ib->brx_ring[i].mblength = 0;
+		leptr = lp->rx_buf_ptr_lnc[i];
+		*lib_ptr(ib, brx_ring[i].rmd0, lp->type) = leptr;
+		*lib_ptr(ib, brx_ring[i].rmd1, lp->type) = ((leptr >> 16) &
+							    0xff) |
+							   LE_R1_OWN;
+		*lib_ptr(ib, brx_ring[i].length, lp->type) = -RX_BUFF_SIZE |
+							     0xf000;
+		*lib_ptr(ib, brx_ring[i].mblength, lp->type) = 0;
 		if (i < 3 && ZERO)
-			printk("%d: 0x%8.8x(0x%8.8x)\n", i, leptr, (int) lp->rx_buf_ptr_cpu[i]);
+			printk("%d: 0x%8.8x(0x%8.8x)\n",
+			       i, leptr, (uint)lp->rx_buf_ptr_cpu[i]);
 	}
 	iob();
 }
@@ -511,11 +528,13 @@ static int init_restart_lance(struct lan
 		udelay(10);
 	}
 	if ((i == 100) || (ll->rdp & LE_C0_ERR)) {
-		printk("LANCE unopened after %d ticks, csr0=%4.4x.\n", i, ll->rdp);
+		printk("LANCE unopened after %d ticks, csr0=%4.4x.\n",
+		       i, ll->rdp);
 		return -1;
 	}
 	if ((ll->rdp & LE_C0_ERR)) {
-		printk("LANCE unopened after %d ticks, csr0=%4.4x.\n", i, ll->rdp);
+		printk("LANCE unopened after %d ticks, csr0=%4.4x.\n",
+		       i, ll->rdp);
 		return -1;
 	}
 	writereg(&ll->rdp, LE_C0_IDON);
@@ -528,12 +547,11 @@ static int init_restart_lance(struct lan
 static int lance_rx(struct net_device *dev)
 {
 	struct lance_private *lp = netdev_priv(dev);
-	volatile struct lance_init_block *ib;
-	volatile struct lance_rx_desc *rd = 0;
-	unsigned char bits;
-	int len = 0;
-	struct sk_buff *skb = 0;
-	ib = (struct lance_init_block *) (dev->mem_start);
+	volatile u16 *ib = (volatile u16 *)dev->mem_start;
+	volatile u16 *rd;
+	unsigned short bits;
+	int entry, len;
+	struct sk_buff *skb;
 
 #ifdef TEST_HITS
 	{
@@ -542,19 +560,22 @@ static int lance_rx(struct net_device *d
 		printk("[");
 		for (i = 0; i < RX_RING_SIZE; i++) {
 			if (i == lp->rx_new)
-				printk("%s", ib->brx_ring[i].rmd1_bits &
+				printk("%s", *lib_ptr(ib, brx_ring[i].rmd1,
+						      lp->type) &
 					     LE_R1_OWN ? "_" : "X");
 			else
-				printk("%s", ib->brx_ring[i].rmd1_bits &
+				printk("%s", *lib_ptr(ib, brx_ring[i].rmd1,
+						      lp->type) &
 					     LE_R1_OWN ? "." : "1");
 		}
 		printk("]");
 	}
 #endif
 
-	for (rd = &ib->brx_ring[lp->rx_new];
-	     !((bits = rd->rmd1_bits) & LE_R1_OWN);
-	     rd = &ib->brx_ring[lp->rx_new]) {
+	for (rd = lib_ptr(ib, brx_ring[lp->rx_new], lp->type);
+	     !((bits = *rds_ptr(rd, rmd1, lp->type)) & LE_R1_OWN);
+	     rd = lib_ptr(ib, brx_ring[lp->rx_new], lp->type)) {
+		entry = lp->rx_new;
 
 		/* We got an incomplete frame? */
 		if ((bits & LE_R1_POK) != LE_R1_POK) {
@@ -575,16 +596,18 @@ static int lance_rx(struct net_device *d
 			if (bits & LE_R1_EOP)
 				lp->stats.rx_errors++;
 		} else {
-			len = (rd->mblength & 0xfff) - 4;
+			len = (*rds_ptr(rd, mblength, lp->type) & 0xfff) - 4;
 			skb = dev_alloc_skb(len + 2);
 
 			if (skb == 0) {
 				printk("%s: Memory squeeze, deferring packet.\n",
 				       dev->name);
 				lp->stats.rx_dropped++;
-				rd->mblength = 0;
-				rd->rmd1_bits = LE_R1_OWN;
-				lp->rx_new = (lp->rx_new + 1) & RX_RING_MOD_MASK;
+				*rds_ptr(rd, mblength, lp->type) = 0;
+				*rds_ptr(rd, rmd1, lp->type) =
+					((lp->rx_buf_ptr_lnc[entry] >> 16) &
+					 0xff) | LE_R1_OWN;
+				lp->rx_new = (entry + 1) & RX_RING_MOD_MASK;
 				return 0;
 			}
 			lp->stats.rx_bytes += len;
@@ -594,8 +617,7 @@ static int lance_rx(struct net_device *d
 			skb_put(skb, len);	/* make room */
 
 			cp_from_buf(lp->type, skb->data,
-				    (char *)lp->rx_buf_ptr_cpu[lp->rx_new],
-				    len);
+				    (char *)lp->rx_buf_ptr_cpu[entry], len);
 
 			skb->protocol = eth_type_trans(skb, dev);
 			netif_rx(skb);
@@ -604,10 +626,12 @@ static int lance_rx(struct net_device *d
 		}
 
 		/* Return the packet to the pool */
-		rd->mblength = 0;
-		rd->length = -RX_BUFF_SIZE | 0xf000;
-		rd->rmd1_bits = LE_R1_OWN;
-		lp->rx_new = (lp->rx_new + 1) & RX_RING_MOD_MASK;
+		*rds_ptr(rd, mblength, lp->type) = 0;
+		*rds_ptr(rd, length, lp->type) = -RX_BUFF_SIZE | 0xf000;
+		*rds_ptr(rd, rmd1, lp->type) = LE_R1_OWN;
+		*rds_ptr(rd, rmd1, lp->type) =
+			((lp->rx_buf_ptr_lnc[entry] >> 16) & 0xff) | LE_R1_OWN;
+		lp->rx_new = (entry + 1) & RX_RING_MOD_MASK;
 	}
 	return 0;
 }
@@ -615,24 +639,24 @@ static int lance_rx(struct net_device *d
 static void lance_tx(struct net_device *dev)
 {
 	struct lance_private *lp = netdev_priv(dev);
-	volatile struct lance_init_block *ib;
+	volatile u16 *ib = (volatile u16 *)dev->mem_start;
 	volatile struct lance_regs *ll = lp->ll;
-	volatile struct lance_tx_desc *td;
+	volatile u16 *td;
 	int i, j;
 	int status;
-	ib = (struct lance_init_block *) (dev->mem_start);
+
 	j = lp->tx_old;
 
 	spin_lock(&lp->lock);
 
 	for (i = j; i != lp->tx_new; i = j) {
-		td = &ib->btx_ring[i];
+		td = lib_ptr(ib, btx_ring[i], lp->type);
 		/* If we hit a packet not owned by us, stop */
-		if (td->tmd1_bits & LE_T1_OWN)
+		if (*tds_ptr(td, tmd1, lp->type) & LE_T1_OWN)
 			break;
 
-		if (td->tmd1_bits & LE_T1_ERR) {
-			status = td->misc;
+		if (*tds_ptr(td, tmd1, lp->type) & LE_T1_ERR) {
+			status = *tds_ptr(td, misc, lp->type);
 
 			lp->stats.tx_errors++;
 			if (status & LE_T3_RTY)
@@ -667,18 +691,19 @@ static void lance_tx(struct net_device *
 				init_restart_lance(lp);
 				goto out;
 			}
-		} else if ((td->tmd1_bits & LE_T1_POK) == LE_T1_POK) {
+		} else if ((*tds_ptr(td, tmd1, lp->type) & LE_T1_POK) ==
+			   LE_T1_POK) {
 			/*
 			 * So we don't count the packet more than once.
 			 */
-			td->tmd1_bits &= ~(LE_T1_POK);
+			*tds_ptr(td, tmd1, lp->type) &= ~(LE_T1_POK);
 
 			/* One collision before packet was sent. */
-			if (td->tmd1_bits & LE_T1_EONE)
+			if (*tds_ptr(td, tmd1, lp->type) & LE_T1_EONE)
 				lp->stats.collisions++;
 
 			/* More than one collision, be optimistic. */
-			if (td->tmd1_bits & LE_T1_EMORE)
+			if (*tds_ptr(td, tmd1, lp->type) & LE_T1_EMORE)
 				lp->stats.collisions += 2;
 
 			lp->stats.tx_packets++;
@@ -754,7 +779,7 @@ struct net_device *last_dev = 0;
 
 static int lance_open(struct net_device *dev)
 {
-	volatile struct lance_init_block *ib = (struct lance_init_block *) (dev->mem_start);
+	volatile u16 *ib = (volatile u16 *)dev->mem_start;
 	struct lance_private *lp = netdev_priv(dev);
 	volatile struct lance_regs *ll = lp->ll;
 	int status = 0;
@@ -771,11 +796,11 @@ static int lance_open(struct net_device 
 	 *
 	 * BTW it is common bug in all lance drivers! --ANK
 	 */
-	ib->mode = 0;
-	ib->filter [0] = 0;
-	ib->filter [2] = 0;
-	ib->filter [4] = 0;
-	ib->filter [6] = 0;
+	*lib_ptr(ib, mode, lp->type) = 0;
+	*lib_ptr(ib, filter[0], lp->type) = 0;
+	*lib_ptr(ib, filter[1], lp->type) = 0;
+	*lib_ptr(ib, filter[2], lp->type) = 0;
+	*lib_ptr(ib, filter[3], lp->type) = 0;
 
 	lance_init_ring(dev);
 	load_csrs(lp);
@@ -876,12 +901,10 @@ static int lance_start_xmit(struct sk_bu
 {
 	struct lance_private *lp = netdev_priv(dev);
 	volatile struct lance_regs *ll = lp->ll;
-	volatile struct lance_init_block *ib = (struct lance_init_block *) (dev->mem_start);
-	int entry, skblen, len;
-
-	skblen = skb->len;
+	volatile u16 *ib = (volatile u16 *)dev->mem_start;
+	int entry, len;
 
-	len = skblen;
+	len = skb->len;
 	
 	if (len < ETH_ZLEN) {
 		if (skb_padto(skb, ETH_ZLEN))
@@ -891,23 +914,17 @@ static int lance_start_xmit(struct sk_bu
 
 	lp->stats.tx_bytes += len;
 
-	entry = lp->tx_new & TX_RING_MOD_MASK;
-	ib->btx_ring[entry].length = (-len);
-	ib->btx_ring[entry].misc = 0;
+	entry = lp->tx_new;
+	*lib_ptr(ib, btx_ring[entry].length, lp->type) = (-len);
+	*lib_ptr(ib, btx_ring[entry].misc, lp->type) = 0;
 
-	cp_to_buf(lp->type, (char *)lp->tx_buf_ptr_cpu[entry], skb->data,
-		  skblen);
-
-	/* Clear the slack of the packet, do I need this? */
-	/* For a firewall it's a good idea - AC */
-/*
-   if (len != skblen)
-   memset ((char *) &ib->tx_buf [entry][skblen], 0, (len - skblen) << 1);
- */
+	cp_to_buf(lp->type, (char *)lp->tx_buf_ptr_cpu[entry], skb->data, len);
 
 	/* Now, give the packet to the lance */
-	ib->btx_ring[entry].tmd1_bits = (LE_T1_POK | LE_T1_OWN);
-	lp->tx_new = (lp->tx_new + 1) & TX_RING_MOD_MASK;
+	*lib_ptr(ib, btx_ring[entry].tmd1, lp->type) =
+		((lp->tx_buf_ptr_lnc[entry] >> 16) & 0xff) |
+		(LE_T1_POK | LE_T1_OWN);
+	lp->tx_new = (entry + 1) & TX_RING_MOD_MASK;
 
 	if (TX_BUFFS_AVAIL <= 0)
 		netif_stop_queue(dev);
@@ -932,8 +949,8 @@ static struct net_device_stats *lance_ge
 
 static void lance_load_multicast(struct net_device *dev)
 {
-	volatile struct lance_init_block *ib = (struct lance_init_block *) (dev->mem_start);
-	volatile u16 *mcast_table = (u16 *) & ib->filter;
+	struct lance_private *lp = netdev_priv(dev);
+	volatile u16 *ib = (volatile u16 *)dev->mem_start;
 	struct dev_mc_list *dmi = dev->mc_list;
 	char *addrs;
 	int i;
@@ -941,17 +958,17 @@ static void lance_load_multicast(struct 
 
 	/* set all multicast bits */
 	if (dev->flags & IFF_ALLMULTI) {
-		ib->filter[0] = 0xffff;
-		ib->filter[2] = 0xffff;
-		ib->filter[4] = 0xffff;
-		ib->filter[6] = 0xffff;
+		*lib_ptr(ib, filter[0], lp->type) = 0xffff;
+		*lib_ptr(ib, filter[1], lp->type) = 0xffff;
+		*lib_ptr(ib, filter[2], lp->type) = 0xffff;
+		*lib_ptr(ib, filter[3], lp->type) = 0xffff;
 		return;
 	}
 	/* clear the multicast filter */
-	ib->filter[0] = 0;
-	ib->filter[2] = 0;
-	ib->filter[4] = 0;
-	ib->filter[6] = 0;
+	*lib_ptr(ib, filter[0], lp->type) = 0;
+	*lib_ptr(ib, filter[1], lp->type) = 0;
+	*lib_ptr(ib, filter[2], lp->type) = 0;
+	*lib_ptr(ib, filter[3], lp->type) = 0;
 
 	/* Add addresses */
 	for (i = 0; i < dev->mc_count; i++) {
@@ -964,7 +981,7 @@ static void lance_load_multicast(struct 
 
 		crc = ether_crc_le(ETH_ALEN, addrs);
 		crc = crc >> 26;
-		mcast_table[2 * (crc >> 4)] |= 1 << (crc & 0xf);
+		*lib_ptr(ib, filter[crc >> 4], lp->type) |= 1 << (crc & 0xf);
 	}
 	return;
 }
@@ -972,11 +989,9 @@ static void lance_load_multicast(struct 
 static void lance_set_multicast(struct net_device *dev)
 {
 	struct lance_private *lp = netdev_priv(dev);
-	volatile struct lance_init_block *ib;
+	volatile u16 *ib = (volatile u16 *)dev->mem_start;
 	volatile struct lance_regs *ll = lp->ll;
 
-	ib = (struct lance_init_block *) (dev->mem_start);
-
 	if (!netif_running(dev))
 		return;
 
@@ -994,9 +1009,9 @@ static void lance_set_multicast(struct n
 	lance_init_ring(dev);
 
 	if (dev->flags & IFF_PROMISC) {
-		ib->mode |= LE_MO_PROM;
+		*lib_ptr(ib, mode, lp->type) |= LE_MO_PROM;
 	} else {
-		ib->mode &= ~LE_MO_PROM;
+		*lib_ptr(ib, mode, lp->type) &= ~LE_MO_PROM;
 		lance_load_multicast(dev);
 	}
 	load_csrs(lp);
@@ -1075,20 +1090,20 @@ static int __init dec_lance_init(const i
 		 */
 		for (i = 0; i < RX_RING_SIZE; i++) {
 			lp->rx_buf_ptr_cpu[i] =
-				(char *)(dev->mem_start + BUF_OFFSET_CPU +
+				(char *)(dev->mem_start + 2 * BUF_OFFSET_CPU +
 					 2 * i * RX_BUFF_SIZE);
 			lp->rx_buf_ptr_lnc[i] =
-				(char *)(BUF_OFFSET_LNC + i * RX_BUFF_SIZE);
+				(BUF_OFFSET_LNC + i * RX_BUFF_SIZE);
 		}
 		for (i = 0; i < TX_RING_SIZE; i++) {
 			lp->tx_buf_ptr_cpu[i] =
-				(char *)(dev->mem_start + BUF_OFFSET_CPU +
+				(char *)(dev->mem_start + 2 * BUF_OFFSET_CPU +
 					 2 * RX_RING_SIZE * RX_BUFF_SIZE +
 					 2 * i * TX_BUFF_SIZE);
 			lp->tx_buf_ptr_lnc[i] =
-				(char *)(BUF_OFFSET_LNC +
-					 RX_RING_SIZE * RX_BUFF_SIZE +
-					 i * TX_BUFF_SIZE);
+				(BUF_OFFSET_LNC +
+				 RX_RING_SIZE * RX_BUFF_SIZE +
+				 i * TX_BUFF_SIZE);
 		}
 
 		/* Setup I/O ASIC LANCE DMA.  */
@@ -1102,6 +1117,7 @@ static int __init dec_lance_init(const i
 		claim_tc_card(slot);
 
 		dev->mem_start = CKSEG1ADDR(get_tc_base_addr(slot));
+		dev->mem_end = dev->mem_start + 0x100000;
 		dev->base_addr = dev->mem_start + 0x100000;
 		dev->irq = get_tc_irq_nr(slot);
 		esar_base = dev->mem_start + 0x1c0002;
@@ -1112,7 +1128,7 @@ static int __init dec_lance_init(const i
 				(char *)(dev->mem_start + BUF_OFFSET_CPU +
 					 i * RX_BUFF_SIZE);
 			lp->rx_buf_ptr_lnc[i] =
-				(char *)(BUF_OFFSET_LNC + i * RX_BUFF_SIZE);
+				(BUF_OFFSET_LNC + i * RX_BUFF_SIZE);
 		}
 		for (i = 0; i < TX_RING_SIZE; i++) {
 			lp->tx_buf_ptr_cpu[i] =
@@ -1120,9 +1136,9 @@ static int __init dec_lance_init(const i
 					 RX_RING_SIZE * RX_BUFF_SIZE +
 					 i * TX_BUFF_SIZE);
 			lp->tx_buf_ptr_lnc[i] =
-				(char *)(BUF_OFFSET_LNC +
-					 RX_RING_SIZE * RX_BUFF_SIZE +
-					 i * TX_BUFF_SIZE);
+				(BUF_OFFSET_LNC +
+				 RX_RING_SIZE * RX_BUFF_SIZE +
+				 i * TX_BUFF_SIZE);
 		}
 
 		break;
@@ -1132,6 +1148,7 @@ static int __init dec_lance_init(const i
 		dev->irq = dec_interrupt[DEC_IRQ_LANCE];
 		dev->base_addr = CKSEG1ADDR(KN01_SLOT_BASE + KN01_LANCE);
 		dev->mem_start = CKSEG1ADDR(KN01_SLOT_BASE + KN01_LANCE_MEM);
+		dev->mem_end = dev->mem_start + KN01_SLOT_SIZE;
 		esar_base = CKSEG1ADDR(KN01_SLOT_BASE + KN01_ESAR + 1);
 		lp->dma_irq = -1;
 
@@ -1140,20 +1157,20 @@ static int __init dec_lance_init(const i
 		 */
 		for (i = 0; i < RX_RING_SIZE; i++) {
 			lp->rx_buf_ptr_cpu[i] =
-				(char *)(dev->mem_start + BUF_OFFSET_CPU +
+				(char *)(dev->mem_start + 2 * BUF_OFFSET_CPU +
 					 2 * i * RX_BUFF_SIZE);
 			lp->rx_buf_ptr_lnc[i] =
-				(char *)(BUF_OFFSET_LNC + i * RX_BUFF_SIZE);
+				(BUF_OFFSET_LNC + i * RX_BUFF_SIZE);
 		}
 		for (i = 0; i < TX_RING_SIZE; i++) {
 			lp->tx_buf_ptr_cpu[i] =
-				(char *)(dev->mem_start + BUF_OFFSET_CPU +
+				(char *)(dev->mem_start + 2 * BUF_OFFSET_CPU +
 					 2 * RX_RING_SIZE * RX_BUFF_SIZE +
 					 2 * i * TX_BUFF_SIZE);
 			lp->tx_buf_ptr_lnc[i] =
-				(char *)(BUF_OFFSET_LNC +
-					 RX_RING_SIZE * RX_BUFF_SIZE +
-					 i * TX_BUFF_SIZE);
+				(BUF_OFFSET_LNC +
+				 RX_RING_SIZE * RX_BUFF_SIZE +
+				 i * TX_BUFF_SIZE);
 		}
 
 		break;

From anemo@mba.ocn.ne.jp Fri Nov 24 15:00:55 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 24 Nov 2006 15:01:00 +0000 (GMT)
Received: from mba.ocn.ne.jp ([210.190.142.172]:23283 "HELO smtp.mba.ocn.ne.jp")
	by ftp.linux-mips.org with SMTP id S20038978AbWKXPAz (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Fri, 24 Nov 2006 15:00:55 +0000
Received: from localhost (p6014-ipad01funabasi.chiba.ocn.ne.jp [61.207.80.14])
	by smtp.mba.ocn.ne.jp (Postfix) with ESMTP
	id 996B7B7AC; Sat, 25 Nov 2006 00:00:50 +0900 (JST)
Date:	Sat, 25 Nov 2006 00:03:34 +0900 (JST)
Message-Id: <20061125.000334.75185150.anemo@mba.ocn.ne.jp>
To:	linux-mips@linux-mips.org
Cc:	ralf@linux-mips.org
Subject: [PATCH 0/3] fix and cleanup FPU ownership management
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
X-Fingerprint: 6ACA 1623 39BD 9A94 9B1A  B746 CA77 FE94 2874 D52F
X-Pgp-Public-Key: http://wwwkeys.pgp.net/pks/lookup?op=get&search=0x2874D52F
X-Mailer: Mew version 3.3 on Emacs 21.4 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Return-Path: <anemo@mba.ocn.ne.jp>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13252
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: anemo@mba.ocn.ne.jp
Precedence: bulk
X-list: linux-mips

This patchset fixes several potential problem related FPU ownership
management.  The main problem is
save_fp_contect()/restore_fp_context() might sleep on accessing user
stack and therefore might lose FPU ownership in middle of them.

The first patch ("do_fpe() cleanup") is just a cleanup to preparation.

The second patch ("Allow CpU exception in kernel partially") is main
part.  This is an alternative of the patch posted before:
http://www.linux-mips.org/cgi-bin/mesg.cgi?a=linux-mips&i=20060829.225631.41630441.anemo%40mba.ocn.ne.jp

The third patch ("Cleanup FPU ownership management") is an another
cleanup and get rid of most preempt_disable()/preempt_enable() pairs
around.


Please review.  Thank you.

---
Atsushi Nemoto

From anemo@mba.ocn.ne.jp Fri Nov 24 15:01:23 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 24 Nov 2006 15:01:26 +0000 (GMT)
Received: from mba.ocn.ne.jp ([210.190.142.172]:18934 "HELO smtp.mba.ocn.ne.jp")
	by ftp.linux-mips.org with SMTP id S20038979AbWKXPBF (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Fri, 24 Nov 2006 15:01:05 +0000
Received: from localhost (p6014-ipad01funabasi.chiba.ocn.ne.jp [61.207.80.14])
	by smtp.mba.ocn.ne.jp (Postfix) with ESMTP
	id 552D1B989; Sat, 25 Nov 2006 00:01:00 +0900 (JST)
Date:	Sat, 25 Nov 2006 00:03:44 +0900 (JST)
Message-Id: <20061125.000344.03977447.anemo@mba.ocn.ne.jp>
To:	linux-mips@linux-mips.org
Cc:	ralf@linux-mips.org
Subject: [PATCH 1/3] do_fpe() cleanup
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
X-Fingerprint: 6ACA 1623 39BD 9A94 9B1A  B746 CA77 FE94 2874 D52F
X-Pgp-Public-Key: http://wwwkeys.pgp.net/pks/lookup?op=get&search=0x2874D52F
X-Mailer: Mew version 3.3 on Emacs 21.4 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Return-Path: <anemo@mba.ocn.ne.jp>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13253
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: anemo@mba.ocn.ne.jp
Precedence: bulk
X-list: linux-mips

If we had already lost FPU before disabling preempt, we do not have to
own it at all.  And we do not prevent preemption when managing saved
FCR31 if we did not have FPU ownership.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
---
 traps.c |   22 ++++++++--------------
 1 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index 9fda1b8..b18aeb6 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -614,16 +614,6 @@ asmlinkage void do_fpe(struct pt_regs *r
 	if (fcr31 & FPU_CSR_UNI_X) {
 		int sig;
 
-		preempt_disable();
-
-#ifdef CONFIG_PREEMPT
-		if (!is_fpu_owner()) {
-			/* We might lose fpu before disabling preempt... */
-			own_fpu();
-			BUG_ON(!used_math());
-			restore_fp(current);
-		}
-#endif
 		/*
 		 * Unimplemented operation exception.  If we've got the full
 		 * software emulator on-board, let's use it...
@@ -634,7 +624,11 @@ #endif
 		 * register operands before invoking the emulator, which seems
 		 * a bit extreme for what should be an infrequent event.
 		 */
-		save_fp(current);
+		preempt_disable();
+
+		/* We might have lost fpu before disabling preempt... */
+		if (is_fpu_owner())
+			save_fp(current);
 		/* Ensure 'resume' not overwrite saved fp context again. */
 		lose_fpu();
 
@@ -643,15 +637,15 @@ #endif
 		/* Run the emulator */
 		sig = fpu_emulator_cop1Handler (regs, &current->thread.fpu, 1);
 
-		preempt_disable();
-
-		own_fpu();	/* Using the FPU again.  */
 		/*
 		 * We can't allow the emulated instruction to leave any of
 		 * the cause bit set in $fcr31.
 		 */
 		current->thread.fpu.fcr31 &= ~FPU_CSR_ALL_X;
 
+		preempt_disable();
+
+		own_fpu();	/* Using the FPU again.  */
 		/* Restore the hardware register state */
 		restore_fp(current);
 

From anemo@mba.ocn.ne.jp Fri Nov 24 15:01:49 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 24 Nov 2006 15:01:55 +0000 (GMT)
Received: from mba.ocn.ne.jp ([210.190.142.172]:33020 "HELO smtp.mba.ocn.ne.jp")
	by ftp.linux-mips.org with SMTP id S20038980AbWKXPBY (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Fri, 24 Nov 2006 15:01:24 +0000
Received: from localhost (p6014-ipad01funabasi.chiba.ocn.ne.jp [61.207.80.14])
	by smtp.mba.ocn.ne.jp (Postfix) with ESMTP
	id 8968CB97A; Sat, 25 Nov 2006 00:01:20 +0900 (JST)
Date:	Sat, 25 Nov 2006 00:04:04 +0900 (JST)
Message-Id: <20061125.000404.30186881.anemo@mba.ocn.ne.jp>
To:	linux-mips@linux-mips.org
Cc:	ralf@linux-mips.org
Subject: [PATCH 2/3] Allow CpU exception in kernel partially
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
X-Fingerprint: 6ACA 1623 39BD 9A94 9B1A  B746 CA77 FE94 2874 D52F
X-Pgp-Public-Key: http://wwwkeys.pgp.net/pks/lookup?op=get&search=0x2874D52F
X-Mailer: Mew version 3.3 on Emacs 21.4 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Return-Path: <anemo@mba.ocn.ne.jp>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13254
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: anemo@mba.ocn.ne.jp
Precedence: bulk
X-list: linux-mips

The save_fp_context()/restore_fp_context() might sleep on accessing
user staack and therefore might lose FPU ownership in middle of them.
Also we should not disable preempt around these functions.  This patch
files this problem by allowing CpU exception in kernel partially.

* Introduce TIF_ALLOW_FP_IN_KERNEL thread flag.  If the flag was set,
  CpU exception handler enables CU1 bit in interrupted kernel context
  and returns without enabling interrupt (preempt) to make sure keep
  FPU ownership until resume.
* Introduce enable_fp_in_kernel() and disable_fp_in_kernel().  While
  we might lost FPU ownership in middle of CP0_STATUS manipulation
  (for example local_irq_disable()), we can not assume CU1 bit always
  reflects TIF_USEDFPU.  Therefore enable_fp_in_kernel() must drop CU1
  bit if TIF_USEDFPU was cleared.
* The resume() function must drop CU1 bit in CP0_STATUS which are to
  be saved.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
---
 arch/mips/kernel/r2300_switch.S  |   10 ++++++----
 arch/mips/kernel/r4k_switch.S    |   10 ++++++----
 arch/mips/kernel/signal-common.h |   10 +++++++---
 arch/mips/kernel/signal32.c      |   10 +++++++---
 arch/mips/kernel/traps.c         |   17 +++++++++++++++--
 include/asm-mips/fpu.h           |   16 ++++++++++++++++
 include/asm-mips/thread_info.h   |    1 +
 7 files changed, 58 insertions(+), 16 deletions(-)

diff --git a/arch/mips/kernel/r2300_switch.S b/arch/mips/kernel/r2300_switch.S
index 656bde2..28c2e2e 100644
--- a/arch/mips/kernel/r2300_switch.S
+++ b/arch/mips/kernel/r2300_switch.S
@@ -49,8 +49,7 @@ LEAF(resume)
 #ifndef CONFIG_CPU_HAS_LLSC
 	sw      zero, ll_bit
 #endif
-	mfc0	t1, CP0_STATUS
-	sw	t1, THREAD_STATUS(a0)
+	mfc0	t2, CP0_STATUS
 	cpu_save_nonscratch a0
 	sw	ra, THREAD_REG31(a0)
 
@@ -60,8 +59,8 @@ #endif
 	lw	t3, TASK_THREAD_INFO(a0)
 	lw	t0, TI_FLAGS(t3)
 	li	t1, _TIF_USEDFPU
-	and	t2, t0, t1
-	beqz	t2, 1f
+	and	t1, t0
+	beqz	t1, 1f
 	nor	t1, zero, t1
 
 	and	t0, t0, t1
@@ -74,10 +73,13 @@ #endif
 	li	t1, ~ST0_CU1
 	and	t0, t0, t1
 	sw	t0, ST_OFF(t3)
+	/* clear thread_struct CU1 bit */
+	and	t2, t1
 
 	fpu_save_single a0, t0			# clobbers t0
 
 1:
+	sw	t2, THREAD_STATUS(a0)
 	/*
 	 * The order of restoring the registers takes care of the race
 	 * updating $28, $29 and kernelsp without disabling ints.
diff --git a/arch/mips/kernel/r4k_switch.S b/arch/mips/kernel/r4k_switch.S
index cc566cf..c7698fd 100644
--- a/arch/mips/kernel/r4k_switch.S
+++ b/arch/mips/kernel/r4k_switch.S
@@ -48,8 +48,7 @@ #define ST_OFF (_THREAD_SIZE - 32 - PT_S
 #ifndef CONFIG_CPU_HAS_LLSC
 	sw	zero, ll_bit
 #endif
-	mfc0	t1, CP0_STATUS
-	LONG_S	t1, THREAD_STATUS(a0)
+	mfc0	t2, CP0_STATUS
 	cpu_save_nonscratch a0
 	LONG_S	ra, THREAD_REG31(a0)
 
@@ -59,8 +58,8 @@ #endif
 	PTR_L	t3, TASK_THREAD_INFO(a0)
 	LONG_L	t0, TI_FLAGS(t3)
 	li	t1, _TIF_USEDFPU
-	and	t2, t0, t1
-	beqz	t2, 1f
+	and	t1, t0
+	beqz	t1, 1f
 	nor	t1, zero, t1
 
 	and	t0, t0, t1
@@ -73,10 +72,13 @@ #endif
 	li	t1, ~ST0_CU1
 	and	t0, t0, t1
 	LONG_S	t0, ST_OFF(t3)
+	/* clear thread_struct CU1 bit */
+	and	t2, t1
 
 	fpu_save_double a0 t0 t1		# c0_status passed in t0
 						# clobbers t1
 1:
+	LONG_S	t2, THREAD_STATUS(a0)
 
 	/*
 	 * The order of restoring the registers takes care of the race
diff --git a/arch/mips/kernel/signal-common.h b/arch/mips/kernel/signal-common.h
index b1f09d5..b9051a0 100644
--- a/arch/mips/kernel/signal-common.h
+++ b/arch/mips/kernel/signal-common.h
@@ -57,9 +57,11 @@ #undef save_gp_reg
 		own_fpu();
 		restore_fp(current);
 	}
-	err |= save_fp_context(sc);
 
 	preempt_enable();
+	enable_fp_in_kernel();
+	err |= save_fp_context(sc);
+	disable_fp_in_kernel();
 
 out:
 	return err;
@@ -112,14 +114,16 @@ #undef restore_gp_reg
 	if (used_math()) {
 		/* restore fpu context if we have used it before */
 		own_fpu();
+		preempt_enable();
+		enable_fp_in_kernel();
 		err |= restore_fp_context(sc);
+		disable_fp_in_kernel();
 	} else {
 		/* signal handler may have used FPU.  Give it up. */
 		lose_fpu();
+		preempt_enable();
 	}
 
-	preempt_enable();
-
 	return err;
 }
 
diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c
index c86a5dd..4d291b5 100644
--- a/arch/mips/kernel/signal32.c
+++ b/arch/mips/kernel/signal32.c
@@ -372,14 +372,16 @@ #undef restore_gp_reg
 	if (used_math()) {
 		/* restore fpu context if we have used it before */
 		own_fpu();
+		preempt_enable();
+		enable_fp_in_kernel();
 		err |= restore_fp_context32(sc);
+		disable_fp_in_kernel();
 	} else {
 		/* signal handler may have used FPU.  Give it up. */
 		lose_fpu();
+		preempt_enable();
 	}
 
-	preempt_enable();
-
 	return err;
 }
 
@@ -603,9 +605,11 @@ #undef save_gp_reg
 		own_fpu();
 		restore_fp(current);
 	}
-	err |= save_fp_context32(sc);
 
 	preempt_enable();
+	enable_fp_in_kernel();
+	err |= save_fp_context32(sc);
+	disable_fp_in_kernel();
 
 out:
 	return err;
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index b18aeb6..182646d 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -759,12 +759,11 @@ asmlinkage void do_cpu(struct pt_regs *r
 {
 	unsigned int cpid;
 
-	die_if_kernel("do_cpu invoked from kernel context!", regs);
-
 	cpid = (regs->cp0_cause >> CAUSEB_CE) & 3;
 
 	switch (cpid) {
 	case 0:
+		die_if_kernel("do_cpu invoked from kernel context!", regs);
 		if (!cpu_has_llsc)
 			if (!simulate_llsc(regs))
 				return;
@@ -775,6 +774,9 @@ asmlinkage void do_cpu(struct pt_regs *r
 		break;
 
 	case 1:
+		if (!test_thread_flag(TIF_ALLOW_FP_IN_KERNEL))
+			die_if_kernel("do_cpu invoked from kernel context!",
+				      regs);
 		preempt_disable();
 
 		own_fpu();
@@ -787,6 +789,17 @@ asmlinkage void do_cpu(struct pt_regs *r
 
 		if (cpu_has_fpu) {
 			preempt_enable();
+			if (test_thread_flag(TIF_ALLOW_FP_IN_KERNEL)) {
+				local_irq_disable();
+				if (cpu_has_fpu)
+					regs->cp0_status |= ST0_CU1;
+				/*
+				 * We must return without enabling
+				 * interrupts to ensure keep FPU
+				 * ownership until resume.
+				 */
+				return;
+			}
 		} else {
 			int sig;
 			preempt_enable();
diff --git a/include/asm-mips/fpu.h b/include/asm-mips/fpu.h
index efef843..40536a2 100644
--- a/include/asm-mips/fpu.h
+++ b/include/asm-mips/fpu.h
@@ -68,6 +68,8 @@ do {									\
 	/* We don't care about the c0 hazard here  */			\
 } while (0)
 
+#define __fpu_enabled()	(read_c0_status() & ST0_CU1)
+
 #define enable_fpu()							\
 do {									\
 	if (cpu_has_fpu)						\
@@ -144,4 +146,18 @@ static inline fpureg_t *get_fpu_regs(str
 	return tsk->thread.fpu.fpr;
 }
 
+static inline void enable_fp_in_kernel(void)
+{
+	set_thread_flag(TIF_ALLOW_FP_IN_KERNEL);
+	/* make sure CU1 and FPU ownership are consistent */
+	if (!__is_fpu_owner() && __fpu_enabled())
+		__disable_fpu();
+}
+
+static inline void disable_fp_in_kernel(void)
+{
+	BUG_ON(!__is_fpu_owner() && __fpu_enabled());
+	clear_thread_flag(TIF_ALLOW_FP_IN_KERNEL);
+}
+
 #endif /* _ASM_FPU_H */
diff --git a/include/asm-mips/thread_info.h b/include/asm-mips/thread_info.h
index e475c45..8210a84 100644
--- a/include/asm-mips/thread_info.h
+++ b/include/asm-mips/thread_info.h
@@ -118,6 +118,7 @@ #define TIF_RESTORE_SIGMASK	9	/* restore
 #define TIF_USEDFPU		16	/* FPU was used by this task this quantum (SMP) */
 #define TIF_POLLING_NRFLAG	17	/* true if poll_idle() is polling TIF_NEED_RESCHED */
 #define TIF_MEMDIE		18
+#define TIF_ALLOW_FP_IN_KERNEL	19
 #define TIF_SYSCALL_TRACE	31	/* syscall trace active */
 
 #define _TIF_SYSCALL_TRACE	(1<<TIF_SYSCALL_TRACE)

From anemo@mba.ocn.ne.jp Fri Nov 24 15:02:18 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 24 Nov 2006 15:02:24 +0000 (GMT)
Received: from mba.ocn.ne.jp ([210.190.142.172]:20418 "HELO smtp.mba.ocn.ne.jp")
	by ftp.linux-mips.org with SMTP id S20038617AbWKXPBk (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Fri, 24 Nov 2006 15:01:40 +0000
Received: from localhost (p6014-ipad01funabasi.chiba.ocn.ne.jp [61.207.80.14])
	by smtp.mba.ocn.ne.jp (Postfix) with ESMTP
	id 8AAF2B980; Sat, 25 Nov 2006 00:01:36 +0900 (JST)
Date:	Sat, 25 Nov 2006 00:04:20 +0900 (JST)
Message-Id: <20061125.000420.78705565.anemo@mba.ocn.ne.jp>
To:	linux-mips@linux-mips.org
Cc:	ralf@linux-mips.org
Subject: [PATCH 3/3] Cleanup FPU ownership management
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
X-Fingerprint: 6ACA 1623 39BD 9A94 9B1A  B746 CA77 FE94 2874 D52F
X-Pgp-Public-Key: http://wwwkeys.pgp.net/pks/lookup?op=get&search=0x2874D52F
X-Mailer: Mew version 3.3 on Emacs 21.4 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Return-Path: <anemo@mba.ocn.ne.jp>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13255
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: anemo@mba.ocn.ne.jp
Precedence: bulk
X-list: linux-mips

Currently preempt_disable/preempt_enable are scattered in FPU
ownership management code.  This patch makes own_fpu() and lost_fpu()
can save/restore FPU context in itself and make these functions (and
init_fpu() too) preempt-proof.  This makes the FPU management codes
much readable.  Also this patch introduce raw_cpu_has_fpu macro which
is to be used if the caller did not need atomic context.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
---
 arch/mips/kernel/signal-common.h |   17 +++--------------
 arch/mips/kernel/signal32.c      |   17 +++--------------
 arch/mips/kernel/traps.c         |   29 ++++++-----------------------
 include/asm-mips/cpu-features.h  |    3 +++
 include/asm-mips/cpu-info.h      |    1 +
 include/asm-mips/fpu.h           |   30 +++++++++++++++++++++++-------
 6 files changed, 39 insertions(+), 58 deletions(-)

diff --git a/arch/mips/kernel/signal-common.h b/arch/mips/kernel/signal-common.h
index b9051a0..2e077bc 100644
--- a/arch/mips/kernel/signal-common.h
+++ b/arch/mips/kernel/signal-common.h
@@ -51,14 +51,7 @@ #undef save_gp_reg
 	 * Save FPU state to signal context.  Signal handler will "inherit"
 	 * current FPU state.
 	 */
-	preempt_disable();
-
-	if (!is_fpu_owner()) {
-		own_fpu();
-		restore_fp(current);
-	}
-
-	preempt_enable();
+	own_fpu(1);
 	enable_fp_in_kernel();
 	err |= save_fp_context(sc);
 	disable_fp_in_kernel();
@@ -109,19 +102,15 @@ #undef restore_gp_reg
 	err |= __get_user(used_math, &sc->sc_used_math);
 	conditional_used_math(used_math);
 
-	preempt_disable();
-
 	if (used_math()) {
 		/* restore fpu context if we have used it before */
-		own_fpu();
-		preempt_enable();
+		own_fpu(0);
 		enable_fp_in_kernel();
 		err |= restore_fp_context(sc);
 		disable_fp_in_kernel();
 	} else {
 		/* signal handler may have used FPU.  Give it up. */
-		lose_fpu();
-		preempt_enable();
+		lose_fpu(0);
 	}
 
 	return err;
diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c
index 4d291b5..aab37e6 100644
--- a/arch/mips/kernel/signal32.c
+++ b/arch/mips/kernel/signal32.c
@@ -367,19 +367,15 @@ #undef restore_gp_reg
 	err |= __get_user(used_math, &sc->sc_used_math);
 	conditional_used_math(used_math);
 
-	preempt_disable();
-
 	if (used_math()) {
 		/* restore fpu context if we have used it before */
-		own_fpu();
-		preempt_enable();
+		own_fpu(0);
 		enable_fp_in_kernel();
 		err |= restore_fp_context32(sc);
 		disable_fp_in_kernel();
 	} else {
 		/* signal handler may have used FPU.  Give it up. */
-		lose_fpu();
-		preempt_enable();
+		lose_fpu(0);
 	}
 
 	return err;
@@ -599,14 +595,7 @@ #undef save_gp_reg
 	 * Save FPU state to signal context.  Signal handler will "inherit"
 	 * current FPU state.
 	 */
-	preempt_disable();
-
-	if (!is_fpu_owner()) {
-		own_fpu();
-		restore_fp(current);
-	}
-
-	preempt_enable();
+	own_fpu(1);
 	enable_fp_in_kernel();
 	err |= save_fp_context32(sc);
 	disable_fp_in_kernel();
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index 182646d..ab94113 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -624,15 +624,8 @@ asmlinkage void do_fpe(struct pt_regs *r
 		 * register operands before invoking the emulator, which seems
 		 * a bit extreme for what should be an infrequent event.
 		 */
-		preempt_disable();
-
-		/* We might have lost fpu before disabling preempt... */
-		if (is_fpu_owner())
-			save_fp(current);
 		/* Ensure 'resume' not overwrite saved fp context again. */
-		lose_fpu();
-
-		preempt_enable();
+		lose_fpu(1);
 
 		/* Run the emulator */
 		sig = fpu_emulator_cop1Handler (regs, &current->thread.fpu, 1);
@@ -643,13 +636,8 @@ asmlinkage void do_fpe(struct pt_regs *r
 		 */
 		current->thread.fpu.fcr31 &= ~FPU_CSR_ALL_X;
 
-		preempt_disable();
-
-		own_fpu();	/* Using the FPU again.  */
 		/* Restore the hardware register state */
-		restore_fp(current);
-
-		preempt_enable();
+		own_fpu(1);	/* Using the FPU again.  */
 
 		/* If something went wrong, signal */
 		if (sig)
@@ -777,18 +765,14 @@ asmlinkage void do_cpu(struct pt_regs *r
 		if (!test_thread_flag(TIF_ALLOW_FP_IN_KERNEL))
 			die_if_kernel("do_cpu invoked from kernel context!",
 				      regs);
-		preempt_disable();
-
-		own_fpu();
 		if (used_math()) {	/* Using the FPU again.  */
-			restore_fp(current);
+			own_fpu(1);
 		} else {			/* First time FPU user.  */
 			init_fpu();
 			set_used_math();
 		}
 
-		if (cpu_has_fpu) {
-			preempt_enable();
+		if (raw_cpu_has_fpu) {
 			if (test_thread_flag(TIF_ALLOW_FP_IN_KERNEL)) {
 				local_irq_disable();
 				if (cpu_has_fpu)
@@ -802,7 +786,6 @@ asmlinkage void do_cpu(struct pt_regs *r
 			}
 		} else {
 			int sig;
-			preempt_enable();
 			sig = fpu_emulator_cop1Handler(regs,
 						&current->thread.fpu, 0);
 			if (sig)
@@ -1268,14 +1251,14 @@ extern asmlinkage int fpu_emulator_resto
 #ifdef CONFIG_SMP
 static int smp_save_fp_context(struct sigcontext *sc)
 {
-	return cpu_has_fpu
+	return raw_cpu_has_fpu
 	       ? _save_fp_context(sc)
 	       : fpu_emulator_save_context(sc);
 }
 
 static int smp_restore_fp_context(struct sigcontext *sc)
 {
-	return cpu_has_fpu
+	return raw_cpu_has_fpu
 	       ? _restore_fp_context(sc)
 	       : fpu_emulator_restore_context(sc);
 }
diff --git a/include/asm-mips/cpu-features.h b/include/asm-mips/cpu-features.h
index eadca26..5e4bed1 100644
--- a/include/asm-mips/cpu-features.h
+++ b/include/asm-mips/cpu-features.h
@@ -40,6 +40,9 @@ #define cpu_has_sb1_cache	(cpu_data[0].o
 #endif
 #ifndef cpu_has_fpu
 #define cpu_has_fpu		(current_cpu_data.options & MIPS_CPU_FPU)
+#define raw_cpu_has_fpu		(raw_current_cpu_data.options & MIPS_CPU_FPU)
+#else
+#define raw_cpu_has_fpu		cpu_has_fpu
 #endif
 #ifndef cpu_has_32fpr
 #define cpu_has_32fpr		(cpu_data[0].options & MIPS_CPU_32FPR)
diff --git a/include/asm-mips/cpu-info.h b/include/asm-mips/cpu-info.h
index a2f0c8e..6250da5 100644
--- a/include/asm-mips/cpu-info.h
+++ b/include/asm-mips/cpu-info.h
@@ -87,6 +87,7 @@ #endif /* CONFIG_MIPS_MT */
 
 extern struct cpuinfo_mips cpu_data[];
 #define current_cpu_data cpu_data[smp_processor_id()]
+#define raw_current_cpu_data cpu_data[raw_smp_processor_id()]
 
 extern void cpu_probe(void);
 extern void cpu_report(void);
diff --git a/include/asm-mips/fpu.h b/include/asm-mips/fpu.h
index 40536a2..dfecb7b 100644
--- a/include/asm-mips/fpu.h
+++ b/include/asm-mips/fpu.h
@@ -95,31 +95,47 @@ static inline int is_fpu_owner(void)
 	return cpu_has_fpu && __is_fpu_owner();
 }
 
-static inline void own_fpu(void)
+static inline void __own_fpu(void)
 {
-	if (cpu_has_fpu) {
-		__enable_fpu();
-		KSTK_STATUS(current) |= ST0_CU1;
-		set_thread_flag(TIF_USEDFPU);
+	__enable_fpu();
+	KSTK_STATUS(current) |= ST0_CU1;
+	set_thread_flag(TIF_USEDFPU);
+}
+
+static inline void own_fpu(int restore)
+{
+	preempt_disable();
+	if (cpu_has_fpu && !__is_fpu_owner()) {
+		__own_fpu();
+		if (restore)
+			_restore_fp(current);
 	}
+	preempt_enable();
 }
 
-static inline void lose_fpu(void)
+static inline void lose_fpu(int save)
 {
-	if (cpu_has_fpu) {
+	preempt_disable();
+	if (is_fpu_owner()) {
+		if (save)
+			_save_fp(current);
 		KSTK_STATUS(current) &= ~ST0_CU1;
 		clear_thread_flag(TIF_USEDFPU);
 		__disable_fpu();
 	}
+	preempt_enable();
 }
 
 static inline void init_fpu(void)
 {
+	preempt_disable();
 	if (cpu_has_fpu) {
+		__own_fpu();
 		_init_fpu();
 	} else {
 		fpu_emulator_init_fpu();
 	}
+	preempt_enable();
 }
 
 static inline void save_fp(struct task_struct *tsk)

From ths@networkno.de Fri Nov 24 15:11:49 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 24 Nov 2006 15:11:55 +0000 (GMT)
Received: from phoenix.bawue.net ([193.7.176.60]:20695 "EHLO mail.bawue.net")
	by ftp.linux-mips.org with ESMTP id S20038979AbWKXPLt (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Fri, 24 Nov 2006 15:11:49 +0000
Received: from lagash (intrt.mips-uk.com [194.74.144.130])
	(using TLSv1 with cipher AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.bawue.net (Postfix) with ESMTP id 37861B8D4C;
	Fri, 24 Nov 2006 16:13:24 +0100 (CET)
Received: from ths by lagash with local (Exim 4.63)
	(envelope-from <ths@networkno.de>)
	id 1Gncij-0000Fu-75; Fri, 24 Nov 2006 15:12:05 +0000
Date:	Fri, 24 Nov 2006 15:12:05 +0000
To:	"Maciej W. Rozycki" <macro@linux-mips.org>
Cc:	Andrew Morton <akpm@osdl.org>, linux-kernel@vger.kernel.org,
	linux-mips@linux-mips.org
Subject: Re: [PATCH 2.6.18] dz: Fixes to make it work
Message-ID: <20061124151205.GA927@networkno.de>
References: <Pine.LNX.4.64N.0611241420500.20948@blysk.ds.pg.gda.pl>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <Pine.LNX.4.64N.0611241420500.20948@blysk.ds.pg.gda.pl>
User-Agent: Mutt/1.5.13 (2006-08-11)
From:	Thiemo Seufer <ths@networkno.de>
Return-Path: <ths@networkno.de>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13256
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: ths@networkno.de
Precedence: bulk
X-list: linux-mips

Maciej W. Rozycki wrote:
>  This a set of fixes mostly to make the driver actually work:
> 
> 1. Actually select the line for setting parameters and receiver 
>    disable/enable.
> 2. Select the line for receive and transmit interrupt handling correctly.
> 3. Report the transmitter empty state correctly.
> 4. Set the I/O type of ports correctly.
> 5. Perform polled transmission correctly.
> 6. Don't fix the console line at ttyS3.
> 7. Magic SysRq support.
> 8. Various small bits here and there.
> 
> Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
> ---
>  Tested with a DECstation 2100 (thanks Flo for making this possible).
> 
>  Please apply.
> 
>   Maciej
> 
> patch-2.6.18-dz-13
> diff -up --recursive --new-file linux-2.6.18.macro/drivers/char/decserial.c linux-2.6.18/drivers/char/decserial.c
> --- linux-2.6.18.macro/drivers/char/decserial.c	2006-09-20 03:42:06.000000000 +0000
> +++ linux-2.6.18/drivers/char/decserial.c	2006-11-23 18:29:38.000000000 +0000
> @@ -23,20 +23,12 @@
>  extern int zs_init(void);
>  #endif
>  
> -#ifdef CONFIG_DZ
> -extern int dz_init(void);
> -#endif
> -
>  #ifdef CONFIG_SERIAL_CONSOLE
>  
>  #ifdef CONFIG_ZS
>  extern void zs_serial_console_init(void);
>  #endif
>  
> -#ifdef CONFIG_DZ
> -extern void dz_serial_console_init(void);
> -#endif
> -
>  #endif
>  
>  /* rs_init - starts up the serial interface -
> @@ -46,23 +38,11 @@ extern void dz_serial_console_init(void)
>  
>  int __init rs_init(void)
>  {
> -
> -#if defined(CONFIG_ZS) && defined(CONFIG_DZ)
> +#ifdef ONFIG_ZS
          ^
Minor typo. :-)

From anemo@mba.ocn.ne.jp Sat Nov 25 16:04:46 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Sat, 25 Nov 2006 16:04:51 +0000 (GMT)
Received: from mba.ocn.ne.jp ([210.190.142.172]:55260 "HELO smtp.mba.ocn.ne.jp")
	by ftp.linux-mips.org with SMTP id S20039419AbWKYQEq (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Sat, 25 Nov 2006 16:04:46 +0000
Received: from localhost (p1028-ipad201funabasi.chiba.ocn.ne.jp [222.146.64.28])
	by smtp.mba.ocn.ne.jp (Postfix) with ESMTP
	id 4CCA8BA66; Sun, 26 Nov 2006 01:04:39 +0900 (JST)
Date:	Sun, 26 Nov 2006 01:07:23 +0900 (JST)
Message-Id: <20061126.010723.108305134.anemo@mba.ocn.ne.jp>
To:	linux-mips@linux-mips.org
Cc:	ralf@linux-mips.org
Subject: Re: [PATCH 0/3] fix and cleanup FPU ownership management
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
In-Reply-To: <20061125.000334.75185150.anemo@mba.ocn.ne.jp>
References: <20061125.000334.75185150.anemo@mba.ocn.ne.jp>
X-Fingerprint: 6ACA 1623 39BD 9A94 9B1A  B746 CA77 FE94 2874 D52F
X-Pgp-Public-Key: http://wwwkeys.pgp.net/pks/lookup?op=get&search=0x2874D52F
X-Mailer: Mew version 3.3 on Emacs 21.4 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Return-Path: <anemo@mba.ocn.ne.jp>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13257
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: anemo@mba.ocn.ne.jp
Precedence: bulk
X-list: linux-mips

On Sat, 25 Nov 2006 00:03:34 +0900 (JST), Atsushi Nemoto <anemo@mba.ocn.ne.jp> wrote:
> The first patch ("do_fpe() cleanup") is just a cleanup to preparation.
> 
> The second patch ("Allow CpU exception in kernel partially") is main
> part.  This is an alternative of the patch posted before:
> http://www.linux-mips.org/cgi-bin/mesg.cgi?a=linux-mips&i=20060829.225631.41630441.anemo%40mba.ocn.ne.jp
> 
> The third patch ("Cleanup FPU ownership management") is an another
> cleanup and get rid of most preempt_disable()/preempt_enable() pairs
> around.

As the second patch shows, enabling CpU exception in kernel is
somewhat tricky and fragile (and add an additional instruction in
resume() code).

I still think the other one (a patch titled "rewrite
restore_fp_context/save_fp_context") might be better.  It is simple
and does not add additional overhead for most cases, I suppose.

If you took the other one, the first patch in this patchset is still
can be applied too as is, and some part of the third patch is still
useful.  Here is an alternative of the third patch which can be used
with the "rewrite restore_fp_context/save_fp_context" patch.


Subject: Cleanup FPU ownership management

Currently preempt_disable/preempt_enable are scattered in FPU
ownership management code.  This patch makes own_fpu() and lost_fpu()
can save/restore FPU context in itself and make these functions (and
init_fpu() too) preempt-proof.  This makes the FPU management codes
much readable.  Also this patch introduce raw_cpu_has_fpu macro which
is to be used if the caller did not need atomic context.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
---
 arch/mips/kernel/signal-common.h |   13 ++-----------
 arch/mips/kernel/signal32.c      |   13 ++-----------
 arch/mips/kernel/traps.c         |   26 ++++----------------------
 include/asm-mips/cpu-features.h  |    3 +++
 include/asm-mips/cpu-info.h      |    1 +
 include/asm-mips/fpu.h           |   25 ++++++++++++++++++++-----
 6 files changed, 32 insertions(+), 49 deletions(-)

diff --git a/arch/mips/kernel/signal-common.h b/arch/mips/kernel/signal-common.h
index 5c431fb..d033027 100644
--- a/arch/mips/kernel/signal-common.h
+++ b/arch/mips/kernel/signal-common.h
@@ -85,14 +85,7 @@ #undef save_gp_reg
 	 * Save FPU state to signal context.  Signal handler will "inherit"
 	 * current FPU state.
 	 */
-	preempt_disable();
-	if (is_fpu_owner()) {
-		/* save current context to task_struct */
-		save_fp(current);
-		lose_fpu();
-	}
-	preempt_enable();
-
+	lose_fpu(1);
 	err |= save_fp_context(sc);
 out:
 	return err;
@@ -141,9 +134,7 @@ #undef restore_gp_reg
 	conditional_used_math(used_math);
 
 	/* signal handler may have used FPU.  Give it up. */
-	preempt_disable();
-	lose_fpu();
-	preempt_enable();
+	lose_fpu(0);
 
 	if (used_math()) {
 		/* restore fpu context if we have used it before */
diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c
index 30f5f0f..1ca9223 100644
--- a/arch/mips/kernel/signal32.c
+++ b/arch/mips/kernel/signal32.c
@@ -400,9 +400,7 @@ #undef restore_gp_reg
 	conditional_used_math(used_math);
 
 	/* signal handler may have used FPU.  Give it up. */
-	preempt_disable();
-	lose_fpu();
-	preempt_enable();
+	lose_fpu(0);
 
 	if (used_math()) {
 		/* restore fpu context if we have used it before */
@@ -626,14 +624,7 @@ #undef save_gp_reg
 	 * Save FPU state to signal context.  Signal handler will "inherit"
 	 * current FPU state.
 	 */
-	preempt_disable();
-	if (is_fpu_owner()) {
-		/* save current context to task_struct */
-		save_fp(current);
-		lose_fpu();
-	}
-	preempt_enable();
-
+	lose_fpu(1);
 	err |= save_fp_context32(sc);
 out:
 	return err;
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index 886ed13..03b80da 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -624,15 +624,8 @@ asmlinkage void do_fpe(struct pt_regs *r
 		 * register operands before invoking the emulator, which seems
 		 * a bit extreme for what should be an infrequent event.
 		 */
-		preempt_disable();
-
-		/* We might have lost fpu before disabling preempt... */
-		if (is_fpu_owner())
-			save_fp(current);
 		/* Ensure 'resume' not overwrite saved fp context again. */
-		lose_fpu();
-
-		preempt_enable();
+		lose_fpu(1);
 
 		/* Run the emulator */
 		sig = fpu_emulator_cop1Handler (regs, &current->thread.fpu, 1);
@@ -643,13 +636,8 @@ asmlinkage void do_fpe(struct pt_regs *r
 		 */
 		current->thread.fpu.fcr31 &= ~FPU_CSR_ALL_X;
 
-		preempt_disable();
-
-		own_fpu();	/* Using the FPU again.  */
 		/* Restore the hardware register state */
-		restore_fp(current);
-
-		preempt_enable();
+		own_fpu();	/* Using the FPU again.  */
 
 		/* If something went wrong, signal */
 		if (sig)
@@ -775,21 +763,15 @@ asmlinkage void do_cpu(struct pt_regs *r
 		break;
 
 	case 1:
-		preempt_disable();
-
-		own_fpu();
 		if (used_math()) {	/* Using the FPU again.  */
-			restore_fp(current);
+			own_fpu();
 		} else {			/* First time FPU user.  */
 			init_fpu();
 			set_used_math();
 		}
 
-		if (cpu_has_fpu) {
-			preempt_enable();
-		} else {
+		if (!raw_cpu_has_fpu) {
 			int sig;
-			preempt_enable();
 			sig = fpu_emulator_cop1Handler(regs,
 						&current->thread.fpu, 0);
 			if (sig)
diff --git a/include/asm-mips/cpu-features.h b/include/asm-mips/cpu-features.h
index eadca26..5e4bed1 100644
--- a/include/asm-mips/cpu-features.h
+++ b/include/asm-mips/cpu-features.h
@@ -40,6 +40,9 @@ #define cpu_has_sb1_cache	(cpu_data[0].o
 #endif
 #ifndef cpu_has_fpu
 #define cpu_has_fpu		(current_cpu_data.options & MIPS_CPU_FPU)
+#define raw_cpu_has_fpu		(raw_current_cpu_data.options & MIPS_CPU_FPU)
+#else
+#define raw_cpu_has_fpu		cpu_has_fpu
 #endif
 #ifndef cpu_has_32fpr
 #define cpu_has_32fpr		(cpu_data[0].options & MIPS_CPU_32FPR)
diff --git a/include/asm-mips/cpu-info.h b/include/asm-mips/cpu-info.h
index a2f0c8e..6250da5 100644
--- a/include/asm-mips/cpu-info.h
+++ b/include/asm-mips/cpu-info.h
@@ -87,6 +87,7 @@ #endif /* CONFIG_MIPS_MT */
 
 extern struct cpuinfo_mips cpu_data[];
 #define current_cpu_data cpu_data[smp_processor_id()]
+#define raw_current_cpu_data cpu_data[raw_smp_processor_id()]
 
 extern void cpu_probe(void);
 extern void cpu_report(void);
diff --git a/include/asm-mips/fpu.h b/include/asm-mips/fpu.h
index 979839c..538dabc 100644
--- a/include/asm-mips/fpu.h
+++ b/include/asm-mips/fpu.h
@@ -84,31 +84,46 @@ static inline int is_fpu_owner(void)
 	return cpu_has_fpu && __is_fpu_owner();
 }
 
+static inline void __own_fpu(void)
+{
+	__enable_fpu();
+	KSTK_STATUS(current) |= ST0_CU1;
+	set_thread_flag(TIF_USEDFPU);
+}
+
 static inline void own_fpu(void)
 {
+	preempt_disable();
 	if (cpu_has_fpu) {
-		__enable_fpu();
-		KSTK_STATUS(current) |= ST0_CU1;
-		set_thread_flag(TIF_USEDFPU);
+		__own_fpu();
+		_restore_fp(current);
 	}
+	preempt_enable();
 }
 
-static inline void lose_fpu(void)
+static inline void lose_fpu(int save)
 {
-	if (cpu_has_fpu) {
+	preempt_disable();
+	if (cpu_has_fpu && __is_fpu_owner()) {
+		if (save)
+			_save_fp(current);
 		KSTK_STATUS(current) &= ~ST0_CU1;
 		clear_thread_flag(TIF_USEDFPU);
 		__disable_fpu();
 	}
+	preempt_enable();
 }
 
 static inline void init_fpu(void)
 {
+	preempt_disable();
 	if (cpu_has_fpu) {
+		__own_fpu();
 		_init_fpu();
 	} else {
 		fpu_emulator_init_fpu();
 	}
+	preempt_enable();
 }
 
 static inline void save_fp(struct task_struct *tsk)

From jooa3000@gmail.com Sun Nov 26 22:46:18 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Sun, 26 Nov 2006 22:46:22 +0000 (GMT)
Received: from ug-out-1314.google.com ([66.249.92.173]:59845 "EHLO
	ug-out-1314.google.com") by ftp.linux-mips.org with ESMTP
	id S20037637AbWKZWqS (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Sun, 26 Nov 2006 22:46:18 +0000
Received: by ug-out-1314.google.com with SMTP id 40so1073062uga
        for <linux-mips@linux-mips.org>; Sun, 26 Nov 2006 14:46:17 -0800 (PST)
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws;
        s=beta; d=gmail.com;
        h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition;
        b=tSMciPfm/lbiIGo1HF+9yVBq7MCeFk8LRHXyDtHIwhsyqeEVbk79d5H2UWFudVaNYRjPFDb6OhkLS7EiTAu3ZFI52ScdF9mOQILXTPsb7FPKL1GROZMJXleI0DqdD9uyuKfDDnUKn7uhxCfmhWDPuEAYVq4j5YHOPPhCwpWmcVA=
Received: by 10.67.103.7 with SMTP id f7mr11269243ugm.1164581177242;
        Sun, 26 Nov 2006 14:46:17 -0800 (PST)
Received: by 10.67.100.15 with HTTP; Sun, 26 Nov 2006 14:46:16 -0800 (PST)
Message-ID: <598f0650611261446k145aa973nade5595d056bdc28@mail.gmail.com>
Date:	Mon, 27 Nov 2006 00:46:16 +0200
From:	"Andras Joo" <jooa3000@gmail.com>
To:	linux-mips@linux-mips.org
Subject: ndv8601: boy, this is phantom
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Return-Path: <jooa3000@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13258
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: jooa3000@gmail.com
Precedence: bulk
X-list: linux-mips

Hi all,

I'm looking for information about the Mediamatics (National
Semiconductor) ndv8601.
This is a dvd-player SoC, with some nice features. I have it in a
Mivoc DSX-8500 dvd player which, btw, is a phantom too. The problem is
that so far I was unable to locate any useful information about
it/them. The Mivoc's site doesn't exist, and on Natsemi's I can't find
anything but some features list. I searched their site, in datasheet
archives and google, but there is only a general description of the
chip, or the player. OK, they are a little old, but still. I'd like to
port/run Linux to/on it, but the single useful information I found is
that it has a MIPS core. That's all. Hence I'm here.
If someone has some info about these I'd really appreciate it.
Actually, about any of the ndv84xx, ndv85xx or ndv86xx families of
chips. I think, if I could retrieve the firmware from the flash it
would help, but not knowing the pinout I am unable to locate the EJTAG
port (if it has any). Any ideas?

Best regards,
Joo Andras

From Bill.Azer@drs-ss.com Mon Nov 27 19:27:57 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 27 Nov 2006 19:28:01 +0000 (GMT)
Received: from smtp-out.sigp.net ([63.237.78.44]:59624 "EHLO smtp-out.sigp.net")
	by ftp.linux-mips.org with ESMTP id S20038640AbWK0T15 (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Mon, 27 Nov 2006 19:27:57 +0000
Received: from gamd-ex-001.ss.drs.master (gamd-ex-001.ss.drs.master [172.22.132.94])
	by smtp-out.sigp.net (8.13.8/8.13.8) with ESMTP id kARJRqdp028577
	for <linux-mips@linux-mips.org>; Mon, 27 Nov 2006 14:27:56 -0500 (EST)
X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0
Content-class: urn:content-classes:message
MIME-Version: 1.0
Content-Type: multipart/alternative;
	boundary="----_=_NextPart_001_01C7125A.2CF9AD24"
Subject: pci_ids.h
Date:	Mon, 27 Nov 2006 14:27:50 -0500
Message-ID: <DEB94D90ABFC8240851346CFD4ACFF14C5590E@gamd-ex-001.ss.drs.master>
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
Thread-Topic: pci_ids.h
Thread-Index: AccSWiCdE5H9e5YHTRqc16t9lcN3kw==
From:	"Azer, William" <Bill.Azer@drs-ss.com>
To:	<linux-mips@linux-mips.org>
Return-Path: <Bill.Azer@drs-ss.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13259
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: Bill.Azer@drs-ss.com
Precedence: bulk
X-list: linux-mips

This is a multi-part message in MIME format.

------_=_NextPart_001_01C7125A.2CF9AD24
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Hi all,

=20

I am using the Tundra Tsi148 device and the Tundra PCI vendor code has
been de-listed in "include/linux/pci_ids.h" and it is still listed in
"/usr/share/misc/pci.ids" (with more detail) used by lspci.

=20

Is there any reason why this may have been?

=20

Thx in advance,

=20

Bill


------_=_NextPart_001_01C7125A.2CF9AD24
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns=3D"http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<meta name=3DGenerator content=3D"Microsoft Word 11 (filtered medium)">
<style>
<!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman";}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{color:purple;
	text-decoration:underline;}
span.EmailStyle17
	{mso-style-type:personal-compose;
	font-family:Arial;
	color:windowtext;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
	{page:Section1;}
-->
</style>

</head>

<body lang=3DEN-US link=3Dblue vlink=3Dpurple>

<div class=3DSection1>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>Hi all,<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>I am using the Tundra Tsi148 device and the Tundra =
PCI
vendor code has been de-listed in &#8220;include/linux/pci_ids.h&#8221; =
and it
is still listed in &#8220;/usr/share/misc/pci.ids&#8221; (with more =
detail)
used by lspci.<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>Is there any reason why this may have =
been?<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>Thx in advance,<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>Bill<o:p></o:p></span></font></p>

</div>

</body>

</html>

------_=_NextPart_001_01C7125A.2CF9AD24--

From ralf@linux-mips.org Mon Nov 27 19:44:34 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 27 Nov 2006 19:44:35 +0000 (GMT)
Received: from localhost.localdomain ([127.0.0.1]:897 "EHLO
	dl5rb.ham-radio-op.net") by ftp.linux-mips.org with ESMTP
	id S20038630AbWK0Toe (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Mon, 27 Nov 2006 19:44:34 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by dl5rb.ham-radio-op.net (8.13.8/8.13.8) with ESMTP id kARJiP80022257;
	Mon, 27 Nov 2006 19:44:26 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.8/8.13.8/Submit) id kARJiH7F022256;
	Mon, 27 Nov 2006 19:44:17 GMT
Date:	Mon, 27 Nov 2006 19:44:17 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	"Azer, William" <Bill.Azer@drs-ss.com>
Cc:	linux-mips@linux-mips.org
Subject: Re: pci_ids.h
Message-ID: <20061127194417.GA22048@linux-mips.org>
References: <DEB94D90ABFC8240851346CFD4ACFF14C5590E@gamd-ex-001.ss.drs.master>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <DEB94D90ABFC8240851346CFD4ACFF14C5590E@gamd-ex-001.ss.drs.master>
User-Agent: Mutt/1.4.2.2i
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13260
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: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Mon, Nov 27, 2006 at 02:27:50PM -0500, Azer, William wrote:

> I am using the Tundra Tsi148 device and the Tundra PCI vendor code has
> been de-listed in "include/linux/pci_ids.h" and it is still listed in
> "/usr/share/misc/pci.ids" (with more detail) used by lspci.
> 
> Is there any reason why this may have been?

All PCI device and vendor IDs that are not being used by in-kernel drivers
have been deleted from pci_ids.h.  pci.ids is a separate project from the
kernel and not affected by this decission.

  Ralf

From Philippedeswert@scarlet.be Mon Nov 27 21:21:34 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 27 Nov 2006 21:21:39 +0000 (GMT)
Received: from mail.kolumbus.fi ([193.229.0.46]:40923 "EHLO mail.kolumbus.fi")
	by ftp.linux-mips.org with ESMTP id S20038850AbWK0VVe (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Mon, 27 Nov 2006 21:21:34 +0000
Received: from [192.168.0.105] (a81-197-111-57.elisa-laajakaista.fi [81.197.111.57])
	by emh06.mail.saunalahti.fi (Postfix) with ESMTP id 3659EE5374;
	Mon, 27 Nov 2006 23:21:30 +0200 (EET)
Subject: looking for community speakers for the embedded room at Fosdem
From:	Philippe De Swert <Philippedeswert@scarlet.be>
To:	kernel-discuss@handhelds.org
Content-Type: text/plain
Date:	Mon, 27 Nov 2006 23:24:23 +0200
Message-Id: <1164662663.6203.213.camel@localhost.localdomain>
Mime-Version: 1.0
X-Mailer: Evolution 2.6.3 
Content-Transfer-Encoding: 7bit
Return-Path: <Philippedeswert@scarlet.be>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13261
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: Philippedeswert@scarlet.be
Precedence: bulk
X-list: linux-mips

Hello all!

At the end of february it will be time for the FOSDEM conference
( http://www.fosdem.org ) again. For this we are looking for people in
the community that are willing to present something they have been
dealing with in the free embedded software. The call for papers is as
follows:

CALL FOR PAPERS for the 5th EMBEDDED track at FOSDEM 2007
=========================================================

sat 24 - sun 25 February 2007, Brussels

Call for papers
----------------

The 2007 edition of FOSDEM (Free and Open Source Developers' European
Meeting; http://www.fosdem.org) will take place in Brussels, Belgium 
on 24 and 25 February 2007. For the fifth time, a track on Embedded 
Systems and Operating Systems will be organized. The fourth edition 
was quite succesful and attracted up to 150 attendants for certain
topics.

For last year's program see:
http://www.embedded-kernel-track.org/2006/papers.html

The use of Free Software in the infrastructure of Embedded Systems 
is booming, e.g. by the use of Linux, uClinux, eCos, RedBoot, RTEMS 
and many other Free Software components. More companies are supporting
Embedded Free Software every day because of the reliability and cheap
licensing. This can be confirmed from looking at some high profile
releases of embedded GNU/Linux systems. Some examples are the Nokia 770,
some models of Motorola's smartphones and Archos media players. Not to 
forget the popular TomTom navigation system, the numerous SOHO routers 
and NAS devices based on linux.

Operating System development has always been a very important topic in
Free Software.
As embedded and real-time systems typically have special OS
requirements, we organise this Free Embedded and OS development track at
FOSDEM to give people the opportunity to present their (or their teams)
achievements.

This track at FOSDEM provides a remarkable opportunity to present and
discuss the ongoing work in these areas, and we invite developers to 
present their current projects. Technical topics of the conference 
include but are not limited to :

* OS Development : kernel architecture and implementation, libraries,
power 
   management, TIPC, boot time and memory usage optimizations
  (e.g. Linux, BSD, uClinux, uClibc, newlib, slob allocator,...)

* Practical experiences in implementing Free Software in embedded
systems  (e.g. reverse engineering, porting  to (and adapting of)
commercial devices like the Ipaq, linksys WRT54G, nlsu2 .... )

* Toolchain, performance testing and build environment 
  (e.g. crosstool, emdebian, openembedded, PTX dist, packaging,
scratchbox, Eclipse, Valgrind,...)

* GUIs for embedded systems
  (Gtk, Qt-(embedded), GPE, Qtopia, UI design with touchscreen, 
   Hildon GUI extensions, OpenMoko, OpenGL ES, ...)

* Multimedia applications for embedded systems
  (e.g. integer only decoders, Opieplayer, gstreamer... )

* Real-time extensions, nanokernels and hardware virtualization software
  (e.g. RTAI, Adeos, KURT, L4, Qemu, User Mode Linux, VirtualLogix,
   high resolution timers, ...)
 
* Hard real-time OS's
  (eCos, RTEMS, Real Time Linux,...)

* Open hardware, DSP, softcores and general hardware management
  (e.g opencores.org, OpenRISC, leonSparc, FPGA's, specific design
restrictions for free systems, DSP, Power management...)

* Safety and security certifications applied to Free software
   (e.g. security measures in Embedded systems, TPM, SELinux
    for embedded, TrustZone, ...)

* Tools and techniques for programming multicore systems

* Free software licenses and embedded systems

Authors that wish to present a topic are requested to submit their
abstracts online to embedded@fosdem.org before 14/01/2007. Notification
of receipt will be sent within 48 hours. Authors wishing to submit a
full paper (between 6 and 12 A4 pages), can do so in PS or PDF format.

The Program Committee will evaluate the abstracts and consists of:

* Geert Uytterhoeven, Sony NSCE, Belgium
* Peter De Schrijver (p2), Essensium, Belgium
* Philippe De Swert, Nokia (OSSO), Finland
* Klaas van Gend, MontaVista Software, The Netherlands




From ashlesha@kenati.com Tue Nov 28 01:56:41 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 28 Nov 2006 01:56:46 +0000 (GMT)
Received: from [69.90.147.196] ([69.90.147.196]:54958 "EHLO mail.kenati.com")
	by ftp.linux-mips.org with ESMTP id S20039273AbWK1B4l (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Tue, 28 Nov 2006 01:56:41 +0000
Received: from [192.168.1.169] (adsl-71-130-109-177.dsl.snfc21.pacbell.net [71.130.109.177])
	by mail.kenati.com (Postfix) with ESMTP id BDCE315D4003
	for <linux-mips@linux-mips.org>; Mon, 27 Nov 2006 19:25:35 -0800 (PST)
Subject: Big Endian Hello world instead of init?
From:	Ashlesha Shintre <ashlesha@kenati.com>
Reply-To: ashlesha@kenati.com
To:	linux-mips@linux-mips.org
Content-Type: text/plain
Date:	Mon, 27 Nov 2006 18:08:50 -0800
Message-Id: <1164679730.6538.14.camel@sandbar.kenati.com>
Mime-Version: 1.0
X-Mailer: Evolution 2.4.2.1 
Content-Transfer-Encoding: 7bit
Return-Path: <ashlesha@kenati.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13262
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: ashlesha@kenati.com
Precedence: bulk
X-list: linux-mips

Hi,

Process No. 1, the init process is not being spawned right by the
2.6.14.6 kernel for some reason on my board (Encore M3 with the AU1500
processor).  Hence in order to check whether the problem lies in user
space or kernel space, I compiled and linked the following hello world
program statically.  The board is Big Endian.  Thus, when I compile the
hello world program, I need to use a compiler option that will generate
Big Endian code -- is that correct?  The option being -EB.

Code:

#include<stdio.h>
int main()
{
	printf("Hello World\n");
	return 0;
}

I get the following message after the file system is mounted via NFS and
memory freed by the kernel:

> Failed to execute /bin/hello


Thanks,
Ashlesha.


From chandu.nitw@gmail.com Tue Nov 28 07:11:04 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 28 Nov 2006 07:11:08 +0000 (GMT)
Received: from ug-out-1314.google.com ([66.249.92.173]:60853 "EHLO
	ug-out-1314.google.com") by ftp.linux-mips.org with ESMTP
	id S20038715AbWK1HLE (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 28 Nov 2006 07:11:04 +0000
Received: by ug-out-1314.google.com with SMTP id 40so1490365uga
        for <linux-mips@linux-mips.org>; Mon, 27 Nov 2006 23:10:51 -0800 (PST)
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws;
        s=beta; d=gmail.com;
        h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references;
        b=CBD/wnY00vJ8iDKf+Zuxh2oC2e1vkjreK6NYbSKX7kGHnrhERVhUHoBSh5RlHGhzOtATKkRvJJVGVTTGpwhjoXWIITSRVFOHwFgiQCUmCZ/uk1DMvIGXlcGmLx/SKcLvmscTIRh99fjNfBQZqfdQdj0rHkaUrbB9yeO5nLFH1IQ=
Received: by 10.78.149.15 with SMTP id w15mr624143hud.1164697850709;
        Mon, 27 Nov 2006 23:10:50 -0800 (PST)
Received: by 10.78.141.4 with HTTP; Mon, 27 Nov 2006 23:10:50 -0800 (PST)
Message-ID: <69a573da0611272310y6a1b79adx5876c28dc756fabb@mail.gmail.com>
Date:	Tue, 28 Nov 2006 12:40:50 +0530
From:	"chandrashekar mogilicherla" <chandu.nitw@gmail.com>
To:	linux-mips@linux-mips.org, Puneet <puneet.goel@samsung.com>
Subject: USB keyboard not getting handled???????
In-Reply-To: <69a573da0611272302h78e87f10w7d1bbb3037946172@mail.gmail.com>
MIME-Version: 1.0
Content-Type: multipart/alternative; 
	boundary="----=_Part_3741_24166097.1164697850680"
References: <69a573da0611272302h78e87f10w7d1bbb3037946172@mail.gmail.com>
Return-Path: <chandu.nitw@gmail.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13263
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: chandu.nitw@gmail.com
Precedence: bulk
X-list: linux-mips

------=_Part_3741_24166097.1164697850680
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Iam using a device with linux 2.6.11 kernel running on mips arch.
I have got a problem trying to enable usb keyboard  on my device.
When i enable following options in kernel config
         USB_CONFIG
           ohci, ehci
          hid or boot hid
          keyboard in input devices

USB keyboard is detected . It is shown in /proc/bus/usb/devices , drivers
are loaded. But keyboard is not working.

Following is the mesg log i get when i enabled usb feaures in kernel,
------------------------------------------------------------------------------------------------
In ehci_hcd_au1xxx_drv_probe
drivers/usb/host/ehci-au1xxx.c: starting Au1xxx EHCI USB Controller
drivers/usb/host/ehci-au1xxx.c: Clock to USB host has been enabled
au1xxx-ehci au1xxx-ehci0: reset hcs_params 0x1212 dbg=0 cc=1 pcc=2 ordered
ports=2
au1xxx-ehci au1xxx-ehci0: reset hcc_params 0012 thresh 1 uframes
256/512/1024
ehci_hcd (Au1xxx) at 0xb4020200, irq 29
au1xxx-ehci au1xxx-ehci0: new USB bus registered, assigned bus number 1
au1xxx-ehci au1xxx-ehci0: reset command 080002 (park)=0 ithresh=8
period=1024 Reset HALT
au1xxx-ehci au1xxx-ehci0: init command 010009 (park)=0 ithresh=1 period=256
RUN
au1xxx-ehci au1xxx-ehci0: USB 0.0 initialized, EHCI 1.00, driver 10 Dec 2004
usb usb1: new device strings: Mfr=3, Product=2, SerialNumber=1
usb usb1: default language 0x0409
usb usb1: Product: Au1xxx EHCI
usb usb1: Manufacturer: Linux 2.6.11 ehci_hcd
usb usb1: SerialNumber: au1xxx
usb usb1: hotplug
usb usb1: adding 1-0:1.0 (config #1, interface 0)
usb 1-0:1.0: hotplug
hub 1-0:1.0: usb_probe_interface
hub 1-0:1.0: usb_probe_interface - got id
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
hub 1-0:1.0: standalone hub
hub 1-0:1.0: individual port power switching
hub 1-0:1.0: individual port over-current protection
hub 1-0:1.0: Single TT
hub 1-0:1.0: TT requires at most 8 FS bit times
hub 1-0:1.0: power on to power good time: 20ms
hub 1-0:1.0: local power source is good
hub 1-0:1.0: enabling power on all ports
2004 Nov 08 USB 1.1 'Open' Host Controller (OHCI) Driver (Au1xxx)
block sizes: ed 64 td 64
hub 1-0:1.0: state 5 ports 2 chg 0006 evt 0007
au1xxx-ehci au1xxx-ehci0: GetStatus port 1 status 001403 POWER sig=k  CSC
CONNECT
hub 1-0:1.0: port 1, status 0501, change 0001, 480 Mb/s
In ohci_hcd_au1xxx_drv_probe
drivers/usb/host/ohci-au1xxx.c: starting Au1xxx OHCI USB Controller
drivers/usb/host/ohci-au1xxx.c: Clock to USB host has been enabled
ohci_hcd (Au1xxx) at 0xb4020100, irq 29
au1xxx-ohci au1xxx-ohci0: new USB bus registered, assigned bus number 2
au1xxx-ohci au1xxx-ohci0: ohci_au1xxx_start, ohci:86e9fcf0
au1xxx-ohci au1xxx-ohci0: resetting from state 'reset', control = 0x0
au1xxx-ohci au1xxx-ohci0: OHCI controller state
au1xxx-ohci au1xxx-ohci0: OHCI 1.0, with legacy support registers
au1xxx-ohci au1xxx-ohci0: control 0x083 HCFS=operational CBSR=3
au1xxx-ohci au1xxx-ohci0: cmdstatus 0x00000 SOC=0
au1xxx-ohci au1xxx-ohci0: intrstatus 0x00000044 RHSC SF
au1xxx-ohci au1xxx-ohci0: intrenable 0x8000001a MIE UE RD WDH
au1xxx-ohci au1xxx-ohci0: hcca frame #0021
au1xxx-ohci au1xxx-ohci0: roothub.a 10000202 POTPGT=16 NPS NDP=2
au1xxx-ohci au1xxx-ohci0: roothub.b 00000000 PPCM=0000 DR=0000
au1xxx-ohci au1xxx-ohci0: roothub.status 00008000 DRWE
au1xxx-ohci au1xxx-ohci0: roothub.portstatus [0] 0x00000100 PPS
au1xxx-ohci au1xxx-ohci0: roothub.portstatus [1] 0x00000100 PPS
usb usb2: new device strings: Mfr=3, Product=2, SerialNumber=1
usb usb2: default language 0x0409
usb usb2: Product: Au1xxx OHCI
usb usb2: Manufacturer: Linux 2.6.11 ohci_hcd
usb usb2: SerialNumber: au1xxx
usb usb2: hotplug
usb usb2: adding 2-0:1.0 (config #1, interface 0)
usb 2-0:1.0: hotplug
hub 2-0:1.0: usb_probe_interface
hub 2-0:1.0: usb_probe_interface - got id
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 2 ports detected
hub 2-0:1.0: standalone hub
hub 2-0:1.0: no power switching (usb 1.0)
hub 2-0:1.0: global over-current protection
hub 2-0:1.0: power on to power good time: 32ms
hub 2-0:1.0: local power source is good
hub 2-0:1.0: no over-current condition exists
hub 1-0:1.0: debounce: port 1: total 100ms stable 100ms status 0x501
au1xxx-ehci au1xxx-ehci0: port 1 low speed --> companion
au1xxx-ohci au1xxx-ohci0: created debug files
Initializing USB Mass Storage driver...
au1xxx-ehci au1xxx-ehci0: GetStatus port 1 status 003002 POWER OWNER
sig=se0  CSC
hub 1-0:1.0: port 2, status 0100, change 0000, 12 Mb/s
hub 2-0:1.0: state 5 ports 2 chg 0006 evt 0007
usbcore: registered new driver usb-storage
USB Mass Storage support registered.
au1xxx-ohci au1xxx-ohci0: GetStatus roothub.portstatus [0] = 0x00010301 CSC
LSDA PPS CCS
hub 2-0:1.0: port 1, status 0301, change 0001, 1.5 Mb/s
hub 2-0:1.0: debounce: port 1: total 100ms stable 100ms status 0x301
au1xxx-ohci au1xxx-ohci0: GetStatus roothub.portstatus [0] = 0x00100303 PRSC
LSDA PPS PES CCS
usb 2-1: new low speed USB device using au1xxx-ohci and address 2
ghzhang: USB inserted
au1xxx-ohci au1xxx-ohci0: GetStatus roothub.portstatus [0] = 0x00100303 PRSC
LSDA PPS PES CCS
usb 2-1: skipped 1 descriptor after interface
usb 2-1: new device strings: Mfr=1, Product=2, SerialNumber=0
usb 2-1: default language 0x0409
usb 2-1: Product: HP Basic USB Keyboard
usb 2-1: Manufacturer: CHICONY
usb 2-1: hotplug
usb 2-1: adding 2-1:1.0 (config #1, interface 0)
usb 2-1:1.0: hotplug
hub 2-0:1.0: port 2, status 0100, change 0000, 12 Mb/s
hub 2-0:1.0: state 5 ports 2 chg 0000 evt 0002
usbhid 2-1:1.0: usb_probe_interface
usbhid 2-1:1.0: usb_probe_interface - got id
input: USB HID v1.10 Keyboard [CHICONY HP Basic USB Keyboard] on
usb-au1xxx-1
usbcore: registered new driver usbhid
drivers/usb/input/hid-core.c: v2.0:USB HID core driver
drivers/usb/net/rtl8150.c: rtl8150 based usb-ethernet driver v0.6.2(2004/08/27)
usbcore: registered new driver rtl8150
usbcore: registered new driver usblcd
drivers/usb/misc/usblcd.c: USBLCD Driver Version 1.04 (C) Adams IT Services
http://www.usblcd.de
drivers/usb/misc/usblcd.c: USBLCD support registered.
usbcore: registered new driver usbled
usbcore: registered new driver usbtest

-----------------------------------------------------------------------------------------------------
cat /proc/bus/input/devices

I: Bus=0003 Vendor=03f0 Product=0024 Version=0300
N: Name="CHICONY HP Basic USB Keyboard"
P: Phys=usb-au1xxx-1/input0
H: Handlers=event0
B: EV=120013
B: KEY=10000 7 ff87207a c14057ff febeffdf ffefffff ffffffff fffffffe
B: MSC=10
B: LED=7
----------------------------------------------------------------------------

CAN ANYBODY HELP ME IN THIS REGARD,

Is there anything to do with "keybdev" and "/sbin/hotplug"?????

Both of these are not present on my system

Thanking you in advance,
M.Chandrashekar

------=_Part_3741_24166097.1164697850680
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

<br><span class="gmail_quote"></span>Iam using a device with linux 2.6.11 kernel running on mips arch.<br>I have got a problem trying to enable usb keyboard&nbsp; on my device.<br>
When i enable following options in kernel config<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; USB_CONFIG<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ohci, ehci<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hid or boot hid<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; keyboard in input devices<br>
<br>
USB keyboard is detected . It is shown in /proc/bus/usb/devices , drivers are loaded. But keyboard is not working. <br>
<br>
Following is the mesg log i get when i enabled usb feaures in kernel,<br>
------------------------------------------------------------------------------------------------<br>
In ehci_hcd_au1xxx_drv_probe<br>
drivers/usb/host/ehci-au1xxx.c: starting Au1xxx EHCI USB Controller<br>
drivers/usb/host/ehci-au1xxx.c: Clock to USB host has been enabled<br>
au1xxx-ehci au1xxx-ehci0: reset hcs_params 0x1212 dbg=0 cc=1 pcc=2 ordered ports=2<br>
au1xxx-ehci au1xxx-ehci0: reset hcc_params 0012 thresh 1 uframes 256/512/1024<br>
ehci_hcd (Au1xxx) at 0xb4020200, irq 29<br>
au1xxx-ehci au1xxx-ehci0: new USB bus registered, assigned bus number 1<br>
au1xxx-ehci au1xxx-ehci0: reset command 080002 (park)=0 ithresh=8 period=1024 Reset HALT<br>
au1xxx-ehci au1xxx-ehci0: init command 010009 (park)=0 ithresh=1 period=256 RUN<br>
au1xxx-ehci au1xxx-ehci0: USB 0.0 initialized, EHCI 1.00, driver 10 Dec 2004<br>
usb usb1: new device strings: Mfr=3, Product=2, SerialNumber=1<br>
usb usb1: default language 0x0409<br>
usb usb1: Product: Au1xxx EHCI<br>
usb usb1: Manufacturer: Linux 2.6.11 ehci_hcd<br>
usb usb1: SerialNumber: au1xxx<br>
usb usb1: hotplug<br>
usb usb1: adding 1-0:1.0 (config #1, interface 0)<br>
usb 1-0:1.0: hotplug<br>
hub 1-0:1.0: usb_probe_interface<br>
hub 1-0:1.0: usb_probe_interface - got id<br>
hub 1-0:1.0: USB hub found<br>
hub 1-0:1.0: 2 ports detected<br>
hub 1-0:1.0: standalone hub<br>
hub 1-0:1.0: individual port power switching<br>
hub 1-0:1.0: individual port over-current protection<br>
hub 1-0:1.0: Single TT<br>
hub 1-0:1.0: TT requires at most 8 FS bit times<br>
hub 1-0:1.0: power on to power good time: 20ms<br>
hub 1-0:1.0: local power source is good<br>
hub 1-0:1.0: enabling power on all ports<br>
2004 Nov 08 USB 1.1 'Open' Host Controller (OHCI) Driver (Au1xxx)<br>
block sizes: ed 64 td 64<br>
hub 1-0:1.0: state 5 ports 2 chg 0006 evt 0007<br>
au1xxx-ehci au1xxx-ehci0: GetStatus port 1 status 001403 POWER sig=k&nbsp; CSC CONNECT<br>
hub 1-0:1.0: port 1, status 0501, change 0001, 480 Mb/s<br>
In ohci_hcd_au1xxx_drv_probe<br>
drivers/usb/host/ohci-au1xxx.c: starting Au1xxx OHCI USB Controller<br>
drivers/usb/host/ohci-au1xxx.c: Clock to USB host has been enabled<br>
ohci_hcd (Au1xxx) at 0xb4020100, irq 29<br>
au1xxx-ohci au1xxx-ohci0: new USB bus registered, assigned bus number 2<br>
au1xxx-ohci au1xxx-ohci0: ohci_au1xxx_start, ohci:86e9fcf0<br>
au1xxx-ohci au1xxx-ohci0: resetting from state 'reset', control = 0x0<br>
au1xxx-ohci au1xxx-ohci0: OHCI controller state<br>
au1xxx-ohci au1xxx-ohci0: OHCI 1.0, with legacy support registers<br>
au1xxx-ohci au1xxx-ohci0: control 0x083 HCFS=operational CBSR=3<br>
au1xxx-ohci au1xxx-ohci0: cmdstatus 0x00000 SOC=0<br>
au1xxx-ohci au1xxx-ohci0: intrstatus 0x00000044 RHSC SF<br>
au1xxx-ohci au1xxx-ohci0: intrenable 0x8000001a MIE UE RD WDH<br>
au1xxx-ohci au1xxx-ohci0: hcca frame #0021<br>
au1xxx-ohci au1xxx-ohci0: roothub.a 10000202 POTPGT=16 NPS NDP=2<br>
au1xxx-ohci au1xxx-ohci0: roothub.b 00000000 PPCM=0000 DR=0000<br>
au1xxx-ohci au1xxx-ohci0: roothub.status 00008000 DRWE<br>
au1xxx-ohci au1xxx-ohci0: roothub.portstatus [0] 0x00000100 PPS<br>
au1xxx-ohci au1xxx-ohci0: roothub.portstatus [1] 0x00000100 PPS<br>
usb usb2: new device strings: Mfr=3, Product=2, SerialNumber=1<br>
usb usb2: default language 0x0409<br>
usb usb2: Product: Au1xxx OHCI<br>
usb usb2: Manufacturer: Linux 2.6.11 ohci_hcd<br>
usb usb2: SerialNumber: au1xxx<br>
usb usb2: hotplug<br>
usb usb2: adding 2-0:1.0 (config #1, interface 0)<br>
usb 2-0:1.0: hotplug<br>
hub 2-0:1.0: usb_probe_interface<br>
hub 2-0:1.0: usb_probe_interface - got id<br>
hub 2-0:1.0: USB hub found<br>
hub 2-0:1.0: 2 ports detected<br>
hub 2-0:1.0: standalone hub<br>
hub 2-0:1.0: no power switching (usb 1.0)<br>
hub 2-0:1.0: global over-current protection<br>
hub 2-0:1.0: power on to power good time: 32ms<br>
hub 2-0:1.0: local power source is good<br>
hub 2-0:1.0: no over-current condition exists<br>
hub 1-0:1.0: debounce: port 1: total 100ms stable 100ms status 0x501<br>
au1xxx-ehci au1xxx-ehci0: port 1 low speed --&gt; companion<br>
au1xxx-ohci au1xxx-ohci0: created debug files<br>
Initializing USB Mass Storage driver...<br>
au1xxx-ehci au1xxx-ehci0: GetStatus port 1 status 003002 POWER OWNER sig=se0&nbsp; CSC<br>
hub 1-0:1.0: port 2, status 0100, change 0000, 12 Mb/s<br>
hub 2-0:1.0: state 5 ports 2 chg 0006 evt 0007<br>
usbcore: registered new driver usb-storage<br>
USB Mass Storage support registered.<br>
au1xxx-ohci au1xxx-ohci0: GetStatus roothub.portstatus [0] = 0x00010301 CSC LSDA PPS CCS<br>
hub 2-0:1.0: port 1, status 0301, change 0001, 1.5 Mb/s<br>
hub 2-0:1.0: debounce: port 1: total 100ms stable 100ms status 0x301<br>
au1xxx-ohci au1xxx-ohci0: GetStatus roothub.portstatus [0] = 0x00100303 PRSC LSDA PPS PES CCS<br>
usb 2-1: new low speed USB device using au1xxx-ohci and address 2<br>
ghzhang: USB inserted<br>
au1xxx-ohci au1xxx-ohci0: GetStatus roothub.portstatus [0] = 0x00100303 PRSC LSDA PPS PES CCS<br>
usb 2-1: skipped 1 descriptor after interface<br>
usb 2-1: new device strings: Mfr=1, Product=2, SerialNumber=0<br>
usb 2-1: default language 0x0409<br>
usb 2-1: Product: HP Basic USB Keyboard<br>
usb 2-1: Manufacturer: CHICONY<br>
usb 2-1: hotplug<br>
usb 2-1: adding 2-1:1.0 (config #1, interface 0)<br>
usb 2-1:1.0: hotplug<br>
hub 2-0:1.0: port 2, status 0100, change 0000, 12 Mb/s<br>
hub 2-0:1.0: state 5 ports 2 chg 0000 evt 0002<br>
usbhid 2-1:1.0: usb_probe_interface<br>
usbhid 2-1:1.0: usb_probe_interface - got id<br>
input: USB HID v1.10 Keyboard [CHICONY HP Basic USB Keyboard] on usb-au1xxx-1<br>
usbcore: registered new driver usbhid<br>
drivers/usb/input/hid-core.c: v2.0:USB HID core driver<br>
drivers/usb/net/rtl8150.c: rtl8150 based usb-ethernet driver v0.6.2 (2004/08/27)<br>
usbcore: registered new driver rtl8150<br>
usbcore: registered new driver usblcd<br>
drivers/usb/misc/usblcd.c: USBLCD Driver Version 1.04 (C) Adams IT Services <a href="http://www.usblcd.de" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.usblcd.de</a><br>
drivers/usb/misc/usblcd.c: USBLCD support registered.<br>
usbcore: registered new driver usbled<br>
usbcore: registered new driver usbtest<br>
<br>
-----------------------------------------------------------------------------------------------------<br>
cat /proc/bus/input/devices<br>
<br>
I: Bus=0003 Vendor=03f0 Product=0024 Version=0300<br>
N: Name=&quot;CHICONY HP Basic USB Keyboard&quot;<br>
P: Phys=usb-au1xxx-1/input0<br>
H: Handlers=event0<br>
B: EV=120013<br>
B: KEY=10000 7 ff87207a c14057ff febeffdf ffefffff ffffffff fffffffe<br>
B: MSC=10<br>
B: LED=7<br>
----------------------------------------------------------------------------<br>
<br>
CAN ANYBODY HELP ME IN THIS REGARD,<br>
<br>
Is there anything to do with &quot;keybdev&quot; and &quot;/sbin/hotplug&quot;?????<br>
<br>
Both of these are not present on my system<br>
<br>
Thanking you in advance,<br>
M.Chandrashekar<br>

------=_Part_3741_24166097.1164697850680--

From hemanth.venkatesh@wipro.com Tue Nov 28 08:30:06 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 28 Nov 2006 08:30:10 +0000 (GMT)
Received: from wip-ec-wd.wipro.com ([203.91.193.32]:21439 "EHLO
	wip-ec-wd.wipro.com") by ftp.linux-mips.org with ESMTP
	id S20038748AbWK1IaG (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 28 Nov 2006 08:30:06 +0000
Received: from wip-ec-wd.wipro.com (localhost.wipro.com [127.0.0.1])
	by localhost (Postfix) with ESMTP id 4220520611
	for <linux-mips@linux-mips.org>; Tue, 28 Nov 2006 13:53:55 +0530 (IST)
Received: from blr-ec-bh01.wipro.com (blr-ec-bh01.wipro.com [10.201.50.91])
	by wip-ec-wd.wipro.com (Postfix) with ESMTP id 2B360205D9
	for <linux-mips@linux-mips.org>; Tue, 28 Nov 2006 13:53:55 +0530 (IST)
Received: from blr-m2-msg.wipro.com ([10.116.50.99]) by blr-ec-bh01.wipro.com with Microsoft SMTPSVC(6.0.3790.1830);
	 Tue, 28 Nov 2006 14:00:18 +0530
X-MimeOLE: Produced By Microsoft Exchange V6.5
Content-class: urn:content-classes:message
MIME-Version: 1.0
Content-Type: multipart/alternative;
	boundary="----_=_NextPart_001_01C712C7.701BA5A8"
Subject: RE: USB keyboard not getting handled???????
Date:	Tue, 28 Nov 2006 13:58:55 +0530
Message-ID: <2156B1E923F1A147AABDF4D9FDEAB4CB28A7A2@blr-m2-msg.wipro.com>
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
Thread-Topic: USB keyboard not getting handled???????
Thread-Index: AccSveU+J6QaaCpBQduvmsOzvJmKBgAAFnDA
From:	<hemanth.venkatesh@wipro.com>
To:	<chandu.nitw@gmail.com>, <linux-mips@linux-mips.org>,
	<puneet.goel@samsung.com>
X-OriginalArrivalTime: 28 Nov 2006 08:30:18.0521 (UTC) FILETIME=[6FB40890:01C712C7]
Return-Path: <hemanth.venkatesh@wipro.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13264
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: hemanth.venkatesh@wipro.com
Precedence: bulk
X-list: linux-mips

This is a multi-part message in MIME format.

------_=_NextPart_001_01C712C7.701BA5A8
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

We faced a similar problem on 2.6.14 kernel (on AU1100 board) where the
keyboard is detected, but the keystrokes don't appear on the serial
console. Our thinking was that additional support/application is
required to interface with the HID driver, to re-direct keystrokes onto
console. =20

=20

Hemanth

=20

________________________________

From: linux-mips-bounce@linux-mips.org
[mailto:linux-mips-bounce@linux-mips.org] On Behalf Of chandrashekar
mogilicherla
Sent: Tuesday, November 28, 2006 12:41 PM
To: linux-mips@linux-mips.org; Puneet
Subject: USB keyboard not getting handled???????

=20


Iam using a device with linux 2.6.11 kernel running on mips arch.
I have got a problem trying to enable usb keyboard  on my device.
When i enable following options in kernel config
         USB_CONFIG
           ohci, ehci
          hid or boot hid
          keyboard in input devices

USB keyboard is detected . It is shown in /proc/bus/usb/devices ,
drivers are loaded. But keyboard is not working.=20

Following is the mesg log i get when i enabled usb feaures in kernel,
------------------------------------------------------------------------
------------------------
In ehci_hcd_au1xxx_drv_probe
drivers/usb/host/ehci-au1xxx.c: starting Au1xxx EHCI USB Controller
drivers/usb/host/ehci-au1xxx.c: Clock to USB host has been enabled
au1xxx-ehci au1xxx-ehci0: reset hcs_params 0x1212 dbg=3D0 cc=3D1 pcc=3D2
ordered ports=3D2
au1xxx-ehci au1xxx-ehci0: reset hcc_params 0012 thresh 1 uframes
256/512/1024
ehci_hcd (Au1xxx) at 0xb4020200, irq 29
au1xxx-ehci au1xxx-ehci0: new USB bus registered, assigned bus number 1
au1xxx-ehci au1xxx-ehci0: reset command 080002 (park)=3D0 ithresh=3D8
period=3D1024 Reset HALT
au1xxx-ehci au1xxx-ehci0: init command 010009 (park)=3D0 ithresh=3D1
period=3D256 RUN
au1xxx-ehci au1xxx-ehci0: USB 0.0 initialized, EHCI 1.00, driver 10 Dec
2004
usb usb1: new device strings: Mfr=3D3, Product=3D2, SerialNumber=3D1
usb usb1: default language 0x0409
usb usb1: Product: Au1xxx EHCI
usb usb1: Manufacturer: Linux 2.6.11 ehci_hcd
usb usb1: SerialNumber: au1xxx
usb usb1: hotplug
usb usb1: adding 1-0:1.0 (config #1, interface 0)
usb 1-0:1.0: hotplug
hub 1-0:1.0: usb_probe_interface
hub 1-0:1.0: usb_probe_interface - got id
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
hub 1-0:1.0: standalone hub
hub 1-0:1.0: individual port power switching
hub 1-0:1.0: individual port over-current protection
hub 1-0:1.0: Single TT
hub 1-0:1.0: TT requires at most 8 FS bit times
hub 1-0:1.0: power on to power good time: 20ms
hub 1-0:1.0: local power source is good
hub 1-0:1.0: enabling power on all ports
2004 Nov 08 USB 1.1 'Open' Host Controller (OHCI) Driver (Au1xxx)
block sizes: ed 64 td 64
hub 1-0:1.0: state 5 ports 2 chg 0006 evt 0007
au1xxx-ehci au1xxx-ehci0: GetStatus port 1 status 001403 POWER sig=3Dk
CSC CONNECT
hub 1-0:1.0: port 1, status 0501, change 0001, 480 Mb/s
In ohci_hcd_au1xxx_drv_probe
drivers/usb/host/ohci-au1xxx.c: starting Au1xxx OHCI USB Controller
drivers/usb/host/ohci-au1xxx.c: Clock to USB host has been enabled
ohci_hcd (Au1xxx) at 0xb4020100, irq 29
au1xxx-ohci au1xxx-ohci0: new USB bus registered, assigned bus number 2
au1xxx-ohci au1xxx-ohci0: ohci_au1xxx_start, ohci:86e9fcf0
au1xxx-ohci au1xxx-ohci0: resetting from state 'reset', control =3D 0x0
au1xxx-ohci au1xxx-ohci0: OHCI controller state
au1xxx-ohci au1xxx-ohci0: OHCI 1.0, with legacy support registers
au1xxx-ohci au1xxx-ohci0: control 0x083 HCFS=3Doperational CBSR=3D3
au1xxx-ohci au1xxx-ohci0: cmdstatus 0x00000 SOC=3D0
au1xxx-ohci au1xxx-ohci0: intrstatus 0x00000044 RHSC SF
au1xxx-ohci au1xxx-ohci0: intrenable 0x8000001a MIE UE RD WDH
au1xxx-ohci au1xxx-ohci0: hcca frame #0021
au1xxx-ohci au1xxx-ohci0: roothub.a 10000202 POTPGT=3D16 NPS NDP=3D2
au1xxx-ohci au1xxx-ohci0: roothub.b 00000000 PPCM=3D0000 DR=3D0000
au1xxx-ohci au1xxx-ohci0: roothub.status 00008000 DRWE
au1xxx-ohci au1xxx-ohci0: roothub.portstatus [0] 0x00000100 PPS
au1xxx-ohci au1xxx-ohci0: roothub.portstatus [1] 0x00000100 PPS
usb usb2: new device strings: Mfr=3D3, Product=3D2, SerialNumber=3D1
usb usb2: default language 0x0409
usb usb2: Product: Au1xxx OHCI
usb usb2: Manufacturer: Linux 2.6.11 ohci_hcd
usb usb2: SerialNumber: au1xxx
usb usb2: hotplug
usb usb2: adding 2-0:1.0 (config #1, interface 0)
usb 2-0:1.0: hotplug
hub 2-0:1.0: usb_probe_interface
hub 2-0:1.0: usb_probe_interface - got id
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 2 ports detected
hub 2-0:1.0: standalone hub
hub 2-0:1.0: no power switching (usb 1.0)
hub 2-0:1.0: global over-current protection
hub 2-0:1.0: power on to power good time: 32ms
hub 2-0:1.0: local power source is good
hub 2-0:1.0: no over-current condition exists
hub 1-0:1.0: debounce: port 1: total 100ms stable 100ms status 0x501
au1xxx-ehci au1xxx-ehci0: port 1 low speed --> companion
au1xxx-ohci au1xxx-ohci0: created debug files
Initializing USB Mass Storage driver...
au1xxx-ehci au1xxx-ehci0: GetStatus port 1 status 003002 POWER OWNER
sig=3Dse0  CSC
hub 1-0:1.0: port 2, status 0100, change 0000, 12 Mb/s
hub 2-0:1.0: state 5 ports 2 chg 0006 evt 0007
usbcore: registered new driver usb-storage
USB Mass Storage support registered.
au1xxx-ohci au1xxx-ohci0: GetStatus roothub.portstatus [0] =3D =
0x00010301
CSC LSDA PPS CCS
hub 2-0:1.0: port 1, status 0301, change 0001, 1.5 Mb/s
hub 2-0:1.0: debounce: port 1: total 100ms stable 100ms status 0x301
au1xxx-ohci au1xxx-ohci0: GetStatus roothub.portstatus [0] =3D =
0x00100303
PRSC LSDA PPS PES CCS
usb 2-1: new low speed USB device using au1xxx-ohci and address 2
ghzhang: USB inserted
au1xxx-ohci au1xxx-ohci0: GetStatus roothub.portstatus [0] =3D =
0x00100303
PRSC LSDA PPS PES CCS
usb 2-1: skipped 1 descriptor after interface
usb 2-1: new device strings: Mfr=3D1, Product=3D2, SerialNumber=3D0
usb 2-1: default language 0x0409
usb 2-1: Product: HP Basic USB Keyboard
usb 2-1: Manufacturer: CHICONY
usb 2-1: hotplug
usb 2-1: adding 2-1:1.0 (config #1, interface 0)
usb 2-1:1.0: hotplug
hub 2-0:1.0: port 2, status 0100, change 0000, 12 Mb/s
hub 2-0:1.0: state 5 ports 2 chg 0000 evt 0002
usbhid 2-1:1.0: usb_probe_interface
usbhid 2-1:1.0: usb_probe_interface - got id
input: USB HID v1.10 Keyboard [CHICONY HP Basic USB Keyboard] on
usb-au1xxx-1
usbcore: registered new driver usbhid
drivers/usb/input/hid-core.c: v2.0:USB HID core driver
drivers/usb/net/rtl8150.c: rtl8150 based usb-ethernet driver v0.6.2
(2004/08/27)
usbcore: registered new driver rtl8150
usbcore: registered new driver usblcd
drivers/usb/misc/usblcd.c: USBLCD Driver Version 1.04 (C) Adams IT
Services http://www.usblcd.de
drivers/usb/misc/usblcd.c: USBLCD support registered.
usbcore: registered new driver usbled
usbcore: registered new driver usbtest

------------------------------------------------------------------------
-----------------------------
cat /proc/bus/input/devices

I: Bus=3D0003 Vendor=3D03f0 Product=3D0024 Version=3D0300
N: Name=3D"CHICONY HP Basic USB Keyboard"
P: Phys=3Dusb-au1xxx-1/input0
H: Handlers=3Devent0
B: EV=3D120013
B: KEY=3D10000 7 ff87207a c14057ff febeffdf ffefffff ffffffff fffffffe
B: MSC=3D10
B: LED=3D7
------------------------------------------------------------------------
----

CAN ANYBODY HELP ME IN THIS REGARD,

Is there anything to do with "keybdev" and "/sbin/hotplug"?????

Both of these are not present on my system

Thanking you in advance,
M.Chandrashekar


------_=_NextPart_001_01C712C7.701BA5A8
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" =
xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns=3D"http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dus-ascii">
<meta name=3DGenerator content=3D"Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
	{font-family:"MS Mincho";
	panose-1:2 2 6 9 4 2 5 8 3 4;}
@font-face
	{font-family:Tahoma;
	panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
	{font-family:"\@MS Mincho";
	panose-1:0 0 0 0 0 0 0 0 0 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman";}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{color:blue;
	text-decoration:underline;}
span.EmailStyle18
	{mso-style-type:personal-reply;
	font-family:Arial;
	color:navy;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
	{page:Section1;}
-->
</style>

</head>

<body lang=3DEN-US link=3Dblue vlink=3Dblue>

<div class=3DSection1>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>We faced a similar problem on =
2.6.14
kernel (on AU1100 board) where the keyboard is detected, but the =
keystrokes
don&#8217;t appear on the serial console. Our thinking was that =
additional
support/application is required to interface with the HID driver, to =
re-direct
keystrokes onto console. &nbsp;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>Hemanth<o:p></o:p></span></font></p>=


<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<div>

<div class=3DMsoNormal align=3Dcenter style=3D'text-align:center'><font =
size=3D3
face=3D"Times New Roman"><span style=3D'font-size:12.0pt'>

<hr size=3D2 width=3D"100%" align=3Dcenter tabindex=3D-1>

</span></font></div>

<p class=3DMsoNormal><b><font size=3D2 face=3DTahoma><span =
style=3D'font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font =
size=3D2
face=3DTahoma><span style=3D'font-size:10.0pt;font-family:Tahoma'> =
linux-mips-bounce@linux-mips.org
[mailto:linux-mips-bounce@linux-mips.org] <b><span =
style=3D'font-weight:bold'>On
Behalf Of </span></b>chandrashekar mogilicherla<br>
<b><span style=3D'font-weight:bold'>Sent:</span></b> Tuesday, November =
28, 2006
12:41 PM<br>
<b><span style=3D'font-weight:bold'>To:</span></b> =
linux-mips@linux-mips.org;
Puneet<br>
<b><span style=3D'font-weight:bold'>Subject:</span></b> USB keyboard not =
getting
handled???????</span></font><o:p></o:p></p>

</div>

<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:
12.0pt'><br>
Iam using a device with linux 2.6.11 kernel running on mips arch.<br>
I have got a problem trying to enable usb keyboard&nbsp; on my =
device.<br>
When i enable following options in kernel config<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; USB_CONFIG<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ohci, =
ehci<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hid or boot =
hid<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; keyboard in input
devices<br>
<br>
USB keyboard is detected . It is shown in /proc/bus/usb/devices , =
drivers are
loaded. But keyboard is not working. <br>
<br>
Following is the mesg log i get when i enabled usb feaures in =
kernel,<br>
-------------------------------------------------------------------------=
-----------------------<br>
In ehci_hcd_au1xxx_drv_probe<br>
drivers/usb/host/ehci-au1xxx.c: starting Au1xxx EHCI USB Controller<br>
drivers/usb/host/ehci-au1xxx.c: Clock to USB host has been enabled<br>
au1xxx-ehci au1xxx-ehci0: reset hcs_params 0x1212 dbg=3D0 cc=3D1 pcc=3D2 =
ordered
ports=3D2<br>
au1xxx-ehci au1xxx-ehci0: reset hcc_params 0012 thresh 1 uframes =
256/512/1024<br>
ehci_hcd (Au1xxx) at 0xb4020200, irq 29<br>
au1xxx-ehci au1xxx-ehci0: new USB bus registered, assigned bus number =
1<br>
au1xxx-ehci au1xxx-ehci0: reset command 080002 (park)=3D0 ithresh=3D8 =
period=3D1024
Reset HALT<br>
au1xxx-ehci au1xxx-ehci0: init command 010009 (park)=3D0 ithresh=3D1 =
period=3D256 RUN<br>
au1xxx-ehci au1xxx-ehci0: USB 0.0 initialized, EHCI 1.00, driver 10 Dec =
2004<br>
usb usb1: new device strings: Mfr=3D3, Product=3D2, SerialNumber=3D1<br>
usb usb1: default language 0x0409<br>
usb usb1: Product: Au1xxx EHCI<br>
usb usb1: Manufacturer: Linux 2.6.11 ehci_hcd<br>
usb usb1: SerialNumber: au1xxx<br>
usb usb1: hotplug<br>
usb usb1: adding 1-0:1.0 (config #1, interface 0)<br>
usb 1-0:1.0: hotplug<br>
hub 1-0:1.0: usb_probe_interface<br>
hub 1-0:1.0: usb_probe_interface - got id<br>
hub 1-0:1.0: USB hub found<br>
hub 1-0:1.0: 2 ports detected<br>
hub 1-0:1.0: standalone hub<br>
hub 1-0:1.0: individual port power switching<br>
hub 1-0:1.0: individual port over-current protection<br>
hub 1-0:1.0: Single TT<br>
hub 1-0:1.0: TT requires at most 8 FS bit times<br>
hub 1-0:1.0: power on to power good time: 20ms<br>
hub 1-0:1.0: local power source is good<br>
hub 1-0:1.0: enabling power on all ports<br>
2004 Nov 08 USB 1.1 'Open' Host Controller (OHCI) Driver (Au1xxx)<br>
block sizes: ed 64 td 64<br>
hub 1-0:1.0: state 5 ports 2 chg 0006 evt 0007<br>
au1xxx-ehci au1xxx-ehci0: GetStatus port 1 status 001403 POWER =
sig=3Dk&nbsp; CSC
CONNECT<br>
hub 1-0:1.0: port 1, status 0501, change 0001, 480 Mb/s<br>
In ohci_hcd_au1xxx_drv_probe<br>
drivers/usb/host/ohci-au1xxx.c: starting Au1xxx OHCI USB Controller<br>
drivers/usb/host/ohci-au1xxx.c: Clock to USB host has been enabled<br>
ohci_hcd (Au1xxx) at 0xb4020100, irq 29<br>
au1xxx-ohci au1xxx-ohci0: new USB bus registered, assigned bus number =
2<br>
au1xxx-ohci au1xxx-ohci0: ohci_au1xxx_start, ohci:86e9fcf0<br>
au1xxx-ohci au1xxx-ohci0: resetting from state 'reset', control =3D =
0x0<br>
au1xxx-ohci au1xxx-ohci0: OHCI controller state<br>
au1xxx-ohci au1xxx-ohci0: OHCI 1.0, with legacy support registers<br>
au1xxx-ohci au1xxx-ohci0: control 0x083 HCFS=3Doperational CBSR=3D3<br>
au1xxx-ohci au1xxx-ohci0: cmdstatus 0x00000 SOC=3D0<br>
au1xxx-ohci au1xxx-ohci0: intrstatus 0x00000044 RHSC SF<br>
au1xxx-ohci au1xxx-ohci0: intrenable 0x8000001a MIE UE RD WDH<br>
au1xxx-ohci au1xxx-ohci0: hcca frame #0021<br>
au1xxx-ohci au1xxx-ohci0: roothub.a 10000202 POTPGT=3D16 NPS NDP=3D2<br>
au1xxx-ohci au1xxx-ohci0: roothub.b 00000000 PPCM=3D0000 DR=3D0000<br>
au1xxx-ohci au1xxx-ohci0: roothub.status 00008000 DRWE<br>
au1xxx-ohci au1xxx-ohci0: roothub.portstatus [0] 0x00000100 PPS<br>
au1xxx-ohci au1xxx-ohci0: roothub.portstatus [1] 0x00000100 PPS<br>
usb usb2: new device strings: Mfr=3D3, Product=3D2, SerialNumber=3D1<br>
usb usb2: default language 0x0409<br>
usb usb2: Product: Au1xxx OHCI<br>
usb usb2: Manufacturer: Linux 2.6.11 ohci_hcd<br>
usb usb2: SerialNumber: au1xxx<br>
usb usb2: hotplug<br>
usb usb2: adding 2-0:1.0 (config #1, interface 0)<br>
usb 2-0:1.0: hotplug<br>
hub 2-0:1.0: usb_probe_interface<br>
hub 2-0:1.0: usb_probe_interface - got id<br>
hub 2-0:1.0: USB hub found<br>
hub 2-0:1.0: 2 ports detected<br>
hub 2-0:1.0: standalone hub<br>
hub 2-0:1.0: no power switching (usb 1.0)<br>
hub 2-0:1.0: global over-current protection<br>
hub 2-0:1.0: power on to power good time: 32ms<br>
hub 2-0:1.0: local power source is good<br>
hub 2-0:1.0: no over-current condition exists<br>
hub 1-0:1.0: debounce: port 1: total 100ms stable 100ms status 0x501<br>
au1xxx-ehci au1xxx-ehci0: port 1 low speed --&gt; companion<br>
au1xxx-ohci au1xxx-ohci0: created debug files<br>
Initializing USB Mass Storage driver...<br>
au1xxx-ehci au1xxx-ehci0: GetStatus port 1 status 003002 POWER OWNER
sig=3Dse0&nbsp; CSC<br>
hub 1-0:1.0: port 2, status 0100, change 0000, 12 Mb/s<br>
hub 2-0:1.0: state 5 ports 2 chg 0006 evt 0007<br>
usbcore: registered new driver usb-storage<br>
USB Mass Storage support registered.<br>
au1xxx-ohci au1xxx-ohci0: GetStatus roothub.portstatus [0] =3D =
0x00010301 CSC
LSDA PPS CCS<br>
hub 2-0:1.0: port 1, status 0301, change 0001, 1.5 Mb/s<br>
hub 2-0:1.0: debounce: port 1: total 100ms stable 100ms status 0x301<br>
au1xxx-ohci au1xxx-ohci0: GetStatus roothub.portstatus [0] =3D =
0x00100303 PRSC
LSDA PPS PES CCS<br>
usb 2-1: new low speed USB device using au1xxx-ohci and address 2<br>
ghzhang: USB inserted<br>
au1xxx-ohci au1xxx-ohci0: GetStatus roothub.portstatus [0] =3D =
0x00100303 PRSC
LSDA PPS PES CCS<br>
usb 2-1: skipped 1 descriptor after interface<br>
usb 2-1: new device strings: Mfr=3D1, Product=3D2, SerialNumber=3D0<br>
usb 2-1: default language 0x0409<br>
usb 2-1: Product: HP Basic USB Keyboard<br>
usb 2-1: Manufacturer: CHICONY<br>
usb 2-1: hotplug<br>
usb 2-1: adding 2-1:1.0 (config #1, interface 0)<br>
usb 2-1:1.0: hotplug<br>
hub 2-0:1.0: port 2, status 0100, change 0000, 12 Mb/s<br>
hub 2-0:1.0: state 5 ports 2 chg 0000 evt 0002<br>
usbhid 2-1:1.0: usb_probe_interface<br>
usbhid 2-1:1.0: usb_probe_interface - got id<br>
input: USB HID v1.10 Keyboard [CHICONY HP Basic USB Keyboard] on =
usb-au1xxx-1<br>
usbcore: registered new driver usbhid<br>
drivers/usb/input/hid-core.c: v2.0:USB HID core driver<br>
drivers/usb/net/rtl8150.c: rtl8150 based usb-ethernet driver v0.6.2
(2004/08/27)<br>
usbcore: registered new driver rtl8150<br>
usbcore: registered new driver usblcd<br>
drivers/usb/misc/usblcd.c: USBLCD Driver Version 1.04 (C) Adams IT =
Services <a
href=3D"http://www.usblcd.de" =
target=3D"_blank">http://www.usblcd.de</a><br>
drivers/usb/misc/usblcd.c: USBLCD support registered.<br>
usbcore: registered new driver usbled<br>
usbcore: registered new driver usbtest<br>
<br>
-------------------------------------------------------------------------=
----------------------------<br>
cat /proc/bus/input/devices<br>
<br>
I: Bus=3D0003 Vendor=3D03f0 Product=3D0024 Version=3D0300<br>
N: Name=3D&quot;CHICONY HP Basic USB Keyboard&quot;<br>
P: Phys=3Dusb-au1xxx-1/input0<br>
H: Handlers=3Devent0<br>
B: EV=3D120013<br>
B: KEY=3D10000 7 ff87207a c14057ff febeffdf ffefffff ffffffff =
fffffffe<br>
B: MSC=3D10<br>
B: LED=3D7<br>
-------------------------------------------------------------------------=
---<br>
<br>
CAN ANYBODY HELP ME IN THIS REGARD,<br>
<br>
Is there anything to do with &quot;keybdev&quot; and =
&quot;/sbin/hotplug&quot;?????<br>
<br>
Both of these are not present on my system<br>
<br>
Thanking you in advance,<br>
M.Chandrashekar<o:p></o:p></span></font></p>

</div>

</body>

</html>

------_=_NextPart_001_01C712C7.701BA5A8--

From macro@linux-mips.org Tue Nov 28 13:20:57 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 28 Nov 2006 13:21:03 +0000 (GMT)
Received: from pollux.ds.pg.gda.pl ([153.19.208.7]:43536 "EHLO
	pollux.ds.pg.gda.pl") by ftp.linux-mips.org with ESMTP
	id S20038988AbWK1NU5 (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 28 Nov 2006 13:20:57 +0000
Received: from localhost (localhost [127.0.0.1])
	by pollux.ds.pg.gda.pl (Postfix) with ESMTP id 46A52E1C9B;
	Tue, 28 Nov 2006 14:20:44 +0100 (CET)
X-Virus-Scanned: by amavisd-new at pollux.ds.pg.gda.pl
Received: from pollux.ds.pg.gda.pl ([127.0.0.1])
	by localhost (pollux.ds.pg.gda.pl [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id VjfQPSHKw8hW; Tue, 28 Nov 2006 14:20:43 +0100 (CET)
Received: from piorun.ds.pg.gda.pl (piorun.ds.pg.gda.pl [153.19.208.8])
	by pollux.ds.pg.gda.pl (Postfix) with ESMTP id 55579E1C8B;
	Tue, 28 Nov 2006 14:20:43 +0100 (CET)
Received: from blysk.ds.pg.gda.pl (macro@blysk.ds.pg.gda.pl [153.19.208.6])
	by piorun.ds.pg.gda.pl (8.13.8/8.13.8) with ESMTP id kASDKnpc017129;
	Tue, 28 Nov 2006 14:20:50 +0100
Date:	Tue, 28 Nov 2006 13:20:45 +0000 (GMT)
From:	"Maciej W. Rozycki" <macro@linux-mips.org>
To:	Andrew Morton <akpm@osdl.org>, Thiemo Seufer <ths@networkno.de>
cc:	linux-kernel@vger.kernel.org, linux-mips@linux-mips.org
Subject: Re: [PATCH 2.6.18] dz: Fixes to make it work
In-Reply-To: <20061124151205.GA927@networkno.de>
Message-ID: <Pine.LNX.4.64N.0611281304450.9362@blysk.ds.pg.gda.pl>
References: <Pine.LNX.4.64N.0611241420500.20948@blysk.ds.pg.gda.pl>
 <20061124151205.GA927@networkno.de>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Virus-Scanned: ClamAV 0.88.6/2252/Mon Nov 27 19:47:11 2006 on piorun.ds.pg.gda.pl
X-Virus-Status:	Clean
Return-Path: <macro@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13265
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: macro@linux-mips.org
Precedence: bulk
X-list: linux-mips

 This a set of fixes mostly to make the driver actually work:

1. Actually select the line for setting parameters and receiver
   disable/enable.
2. Select the line for receive and transmit interrupt handling correctly.
3. Report the transmitter empty state correctly.
4. Set the I/O type of ports correctly.
5. Perform polled transmission correctly.
6. Don't fix the console line at ttyS3.
7. Magic SysRq support.
8. Various small bits here and there.

Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
---
On Fri, 24 Nov 2006, Thiemo Seufer wrote:

> > @@ -46,23 +38,11 @@ extern void dz_serial_console_init(void)
> >  
> >  int __init rs_init(void)
> >  {
> > -
> > -#if defined(CONFIG_ZS) && defined(CONFIG_DZ)
> > +#ifdef ONFIG_ZS
>           ^
> Minor typo. :-)

 Thanks for spotting it.

 Tested with a DECstation 2100 (thanks Flo for making this possible) and a 
DECstation 5000/200 (thanks Karel).

 Please apply.

  Maciej

patch-2.6.18-dz-14
diff -up --recursive --new-file linux-2.6.18.macro/drivers/char/decserial.c linux-2.6.18/drivers/char/decserial.c
--- linux-2.6.18.macro/drivers/char/decserial.c	2006-09-20 03:42:06.000000000 +0000
+++ linux-2.6.18/drivers/char/decserial.c	2006-11-23 18:29:38.000000000 +0000
@@ -23,20 +23,12 @@
 extern int zs_init(void);
 #endif
 
-#ifdef CONFIG_DZ
-extern int dz_init(void);
-#endif
-
 #ifdef CONFIG_SERIAL_CONSOLE
 
 #ifdef CONFIG_ZS
 extern void zs_serial_console_init(void);
 #endif
 
-#ifdef CONFIG_DZ
-extern void dz_serial_console_init(void);
-#endif
-
 #endif
 
 /* rs_init - starts up the serial interface -
@@ -46,23 +38,11 @@ extern void dz_serial_console_init(void)
 
 int __init rs_init(void)
 {
-
-#if defined(CONFIG_ZS) && defined(CONFIG_DZ)
+#ifdef CONFIG_ZS
     if (IOASIC)
 	return zs_init();
-    else
-	return dz_init();
-#else
-
-#ifdef CONFIG_ZS
-    return zs_init();
-#endif
-
-#ifdef CONFIG_DZ
-    return dz_init();
-#endif
-
 #endif
+    return -ENXIO;
 }
 
 __initcall(rs_init);
@@ -76,21 +56,9 @@ __initcall(rs_init);
  */
 static int __init decserial_console_init(void)
 {
-#if defined(CONFIG_ZS) && defined(CONFIG_DZ)
+#ifdef CONFIG_ZS
     if (IOASIC)
 	zs_serial_console_init();
-    else
-	dz_serial_console_init();
-#else
-
-#ifdef CONFIG_ZS
-    zs_serial_console_init();
-#endif
-
-#ifdef CONFIG_DZ
-    dz_serial_console_init();
-#endif
-
 #endif
     return 0;
 }
diff -up --recursive --new-file linux-2.6.18.macro/drivers/serial/dz.c linux-2.6.18/drivers/serial/dz.c
--- linux-2.6.18.macro/drivers/serial/dz.c	2006-09-20 03:42:06.000000000 +0000
+++ linux-2.6.18/drivers/serial/dz.c	2006-11-23 18:27:06.000000000 +0000
@@ -1,11 +1,13 @@
 /*
- * dz.c: Serial port driver for DECStations equiped
+ * dz.c: Serial port driver for DECstations equipped
  *       with the DZ chipset.
  *
  * Copyright (C) 1998 Olivier A. D. Lebaillif
  *
  * Email: olivier.lebaillif@ifrsys.com
  *
+ * Copyright (C) 2004, 2006  Maciej W. Rozycki
+ *
  * [31-AUG-98] triemer
  * Changed IRQ to use Harald's dec internals interrupts.h
  * removed base_addr code - moving address assignment to setup.c
@@ -26,10 +28,16 @@
 
 #undef DEBUG_DZ
 
+#if defined(CONFIG_SERIAL_DZ_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
+#define SUPPORT_SYSRQ
+#endif
+
+#include <linux/delay.h>
 #include <linux/module.h>
 #include <linux/interrupt.h>
 #include <linux/init.h>
 #include <linux/console.h>
+#include <linux/sysrq.h>
 #include <linux/tty.h>
 #include <linux/tty_flip.h>
 #include <linux/serial_core.h>
@@ -45,14 +53,10 @@
 #include <asm/system.h>
 #include <asm/uaccess.h>
 
-#define CONSOLE_LINE (3)	/* for definition of struct console */
-
 #include "dz.h"
 
-#define DZ_INTR_DEBUG 1
-
 static char *dz_name = "DECstation DZ serial driver version ";
-static char *dz_version = "1.02";
+static char *dz_version = "1.03";
 
 struct dz_port {
 	struct uart_port	port;
@@ -61,22 +65,6 @@ struct dz_port {
 
 static struct dz_port dz_ports[DZ_NB_PORT];
 
-#ifdef DEBUG_DZ
-/*
- * debugging code to send out chars via prom
- */
-static void debug_console(const char *s, int count)
-{
-	unsigned i;
-
-	for (i = 0; i < count; i++) {
-		if (*s == 10)
-			prom_printf("%c", 13);
-		prom_printf("%c", *s++);
-	}
-}
-#endif
-
 /*
  * ------------------------------------------------------------
  * dz_in () and dz_out ()
@@ -90,6 +78,7 @@ static inline unsigned short dz_in(struc
 {
 	volatile unsigned short *addr =
 		(volatile unsigned short *) (dport->port.membase + offset);
+
 	return *addr;
 }
 
@@ -98,6 +87,7 @@ static inline void dz_out(struct dz_port
 {
 	volatile unsigned short *addr =
 		(volatile unsigned short *) (dport->port.membase + offset);
+
 	*addr = value;
 }
 
@@ -144,7 +134,7 @@ static void dz_stop_rx(struct uart_port 
 
 	spin_lock_irqsave(&dport->port.lock, flags);
 	dport->cflag &= ~DZ_CREAD;
-	dz_out(dport, DZ_LPR, dport->cflag);
+	dz_out(dport, DZ_LPR, dport->cflag | dport->port.line);
 	spin_unlock_irqrestore(&dport->port.lock, flags);
 }
 
@@ -155,14 +145,14 @@ static void dz_enable_ms(struct uart_por
 
 /*
  * ------------------------------------------------------------
- * Here starts the interrupt handling routines.  All of the
- * following subroutines are declared as inline and are folded
- * into dz_interrupt.  They were separated out for readability's
- * sake.
  *
- * Note: rs_interrupt() is a "fast" interrupt, which means that it
+ * Here start the interrupt handling routines.  All of the following
+ * subroutines are declared as inline and are folded into
+ * dz_interrupt.  They were separated out for readability's sake.
+ *
+ * Note: dz_interrupt() is a "fast" interrupt, which means that it
  * runs with interrupts turned off.  People who may want to modify
- * rs_interrupt() should try to keep the interrupt handler as fast as
+ * dz_interrupt() should try to keep the interrupt handler as fast as
  * possible.  After you are done making modifications, it is not a bad
  * idea to do:
  *
@@ -180,92 +170,74 @@ static void dz_enable_ms(struct uart_por
  * This routine deals with inputs from any lines.
  * ------------------------------------------------------------
  */
-static inline void dz_receive_chars(struct dz_port *dport)
+static inline void dz_receive_chars(struct dz_port *dport_in,
+				    struct pt_regs *regs)
 {
+	struct dz_port *dport;
 	struct tty_struct *tty = NULL;
 	struct uart_icount *icount;
-	int ignore = 0;
-	unsigned short status, tmp;
+	int lines_rx[DZ_NB_PORT] = { [0 ... DZ_NB_PORT - 1] = 0 };
+	unsigned short status;
 	unsigned char ch, flag;
+	int i;
 
-	/* this code is going to be a problem...
-	   the call to tty_flip_buffer is going to need
-	   to be rethought...
-	 */
-	do {
-		status = dz_in(dport, DZ_RBUF);
-
-		/* punt so we don't get duplicate characters */
-		if (!(status & DZ_DVAL))
-			goto ignore_char;
-
+	while ((status = dz_in(dport_in, DZ_RBUF)) & DZ_DVAL) {
+		dport = &dz_ports[LINE(status)];
+		tty = dport->port.info->tty;	/* point to the proper dev */
 
-		ch = UCHAR(status);	/* grab the char */
-		flag = TTY_NORMAL;
+		ch = UCHAR(status);		/* grab the char */
 
-#if 0
-		if (info->is_console) {
-			if (ch == 0)
-				return;		/* it's a break ... */
-		}
-#endif
-
-		tty = dport->port.info->tty;/* now tty points to the proper dev */
 		icount = &dport->port.icount;
-
-		if (!tty)
-			break;
-
 		icount->rx++;
 
-		/* keep track of the statistics */
-		if (status & (DZ_OERR | DZ_FERR | DZ_PERR)) {
-			if (status & DZ_PERR)	/* parity error */
-				icount->parity++;
-			else if (status & DZ_FERR)	/* frame error */
-				icount->frame++;
-			if (status & DZ_OERR)	/* overrun error */
-				icount->overrun++;
-
-			/*  check to see if we should ignore the character
-			   and mask off conditions that should be ignored
+		flag = TTY_NORMAL;
+		if (status & DZ_FERR) {		/* frame error */
+			/*
+			 * There is no separate BREAK status bit, so
+			 * treat framing errors as BREAKs for Magic SysRq
+			 * and SAK; normally, otherwise.
 			 */
-
-			if (status & dport->port.ignore_status_mask) {
-				if (++ignore > 100)
-					break;
-				goto ignore_char;
-			}
-			/* mask off the error conditions we want to ignore */
-			tmp = status & dport->port.read_status_mask;
-
-			if (tmp & DZ_PERR) {
-				flag = TTY_PARITY;
-#ifdef DEBUG_DZ
-				debug_console("PERR\n", 5);
-#endif
-			} else if (tmp & DZ_FERR) {
+			if (uart_handle_break(&dport->port))
+				continue;
+			if (dport->port.flags & UPF_SAK)
+				flag = TTY_BREAK;
+			else
 				flag = TTY_FRAME;
-#ifdef DEBUG_DZ
-				debug_console("FERR\n", 5);
-#endif
-			}
-			if (tmp & DZ_OERR) {
-#ifdef DEBUG_DZ
-				debug_console("OERR\n", 5);
-#endif
-				tty_insert_flip_char(tty, ch, flag);
-				ch = 0;
-				flag = TTY_OVERRUN;
-			}
+		} else if (status & DZ_OERR)	/* overrun error */
+			flag = TTY_OVERRUN;
+		else if (status & DZ_PERR)	/* parity error */
+			flag = TTY_PARITY;
+
+		/* keep track of the statistics */
+		switch (flag) {
+		case TTY_FRAME:
+			icount->frame++;
+			break;
+		case TTY_PARITY:
+			icount->parity++;
+			break;
+		case TTY_OVERRUN:
+			icount->overrun++;
+			break;
+		case TTY_BREAK:
+			icount->brk++;
+			break;
+		default:
+			break;
 		}
-		tty_insert_flip_char(tty, ch, flag);
-	      ignore_char:
-			;
-	} while (status & DZ_DVAL);
 
-	if (tty)
-		tty_flip_buffer_push(tty);
+		if (uart_handle_sysrq_char(&dport->port, ch, regs))
+			continue;
+
+		if ((status & dport->port.ignore_status_mask) == 0) {
+			uart_insert_char(&dport->port,
+					 status, DZ_OERR, ch, flag);
+			lines_rx[LINE(status)] = 1;
+		}
+	}
+	for (i = 0; i < DZ_NB_PORT; i++)
+		if (lines_rx[i])
+			tty_flip_buffer_push(dz_ports[i].port.info->tty);
 }
 
 /*
@@ -275,26 +247,32 @@ static inline void dz_receive_chars(stru
  * This routine deals with outputs to any lines.
  * ------------------------------------------------------------
  */
-static inline void dz_transmit_chars(struct dz_port *dport)
+static inline void dz_transmit_chars(struct dz_port *dport_in)
 {
-	struct circ_buf *xmit = &dport->port.info->xmit;
+	struct dz_port *dport;
+	struct circ_buf *xmit;
+	unsigned short status;
 	unsigned char tmp;
 
-	if (dport->port.x_char) {	/* XON/XOFF chars */
+	status = dz_in(dport_in, DZ_CSR);
+	dport = &dz_ports[LINE(status)];
+	xmit = &dport->port.info->xmit;
+
+	if (dport->port.x_char) {		/* XON/XOFF chars */
 		dz_out(dport, DZ_TDR, dport->port.x_char);
 		dport->port.icount.tx++;
 		dport->port.x_char = 0;
 		return;
 	}
-	/* if nothing to do or stopped or hardware stopped */
+	/* If nothing to do or stopped or hardware stopped. */
 	if (uart_circ_empty(xmit) || uart_tx_stopped(&dport->port)) {
 		dz_stop_tx(&dport->port);
 		return;
 	}
 
 	/*
-	 * if something to do ... (rember the dz has no output fifo so we go
-	 * one char at a time :-<
+	 * If something to do... (remember the dz has no output fifo,
+	 * so we go one char at a time) :-<
 	 */
 	tmp = xmit->buf[xmit->tail];
 	xmit->tail = (xmit->tail + 1) & (DZ_XMIT_SIZE - 1);
@@ -304,23 +282,29 @@ static inline void dz_transmit_chars(str
 	if (uart_circ_chars_pending(xmit) < DZ_WAKEUP_CHARS)
 		uart_write_wakeup(&dport->port);
 
-	/* Are we done */
+	/* Are we are done. */
 	if (uart_circ_empty(xmit))
 		dz_stop_tx(&dport->port);
 }
 
 /*
  * ------------------------------------------------------------
- * check_modem_status ()
+ * check_modem_status()
  *
- * Only valid for the MODEM line duh !
+ * DS 3100 & 5100: Only valid for the MODEM line, duh!
+ * DS 5000/200: Valid for the MODEM and PRINTER line.
  * ------------------------------------------------------------
  */
 static inline void check_modem_status(struct dz_port *dport)
 {
+	/*
+	 * FIXME:
+	 * 1. No status change interrupt; use a timer.
+	 * 2. Handle the 3100/5000 as appropriate. --macro
+	 */
 	unsigned short status;
 
-	/* if not ne modem line just return */
+	/* If not the modem line just return.  */
 	if (dport->port.line != DZ_MODEM)
 		return;
 
@@ -341,21 +325,18 @@ static inline void check_modem_status(st
  */
 static irqreturn_t dz_interrupt(int irq, void *dev, struct pt_regs *regs)
 {
-	struct dz_port *dport;
+	struct dz_port *dport = (struct dz_port *)dev;
 	unsigned short status;
 
 	/* get the reason why we just got an irq */
-	status = dz_in((struct dz_port *)dev, DZ_CSR);
-	dport = &dz_ports[LINE(status)];
+	status = dz_in(dport, DZ_CSR);
 
-	if (status & DZ_RDONE)
-		dz_receive_chars(dport);
+	if ((status & (DZ_RDONE | DZ_RIE)) == (DZ_RDONE | DZ_RIE))
+		dz_receive_chars(dport, regs);
 
-	if (status & DZ_TRDY)
+	if ((status & (DZ_TRDY | DZ_TIE)) == (DZ_TRDY | DZ_TIE))
 		dz_transmit_chars(dport);
 
-	/* FIXME: what about check modem status??? --rmk */
-
 	return IRQ_HANDLED;
 }
 
@@ -367,13 +348,13 @@ static irqreturn_t dz_interrupt(int irq,
 
 static unsigned int dz_get_mctrl(struct uart_port *uport)
 {
+	/*
+	 * FIXME: Handle the 3100/5000 as appropriate. --macro
+	 */
 	struct dz_port *dport = (struct dz_port *)uport;
 	unsigned int mctrl = TIOCM_CAR | TIOCM_DSR | TIOCM_CTS;
 
 	if (dport->port.line == DZ_MODEM) {
-		/*
-		 * CHECKME: This is a guess from the other code... --rmk
-		 */
 		if (dz_in(dport, DZ_MSR) & DZ_MODEM_DSR)
 			mctrl &= ~TIOCM_DSR;
 	}
@@ -383,6 +364,9 @@ static unsigned int dz_get_mctrl(struct 
 
 static void dz_set_mctrl(struct uart_port *uport, unsigned int mctrl)
 {
+	/*
+	 * FIXME: Handle the 3100/5000 as appropriate. --macro
+	 */
 	struct dz_port *dport = (struct dz_port *)uport;
 	unsigned short tmp;
 
@@ -409,13 +393,6 @@ static int dz_startup(struct uart_port *
 	unsigned long flags;
 	unsigned short tmp;
 
-	/* The dz lines for the mouse/keyboard must be
-	 * opened using their respective drivers.
-	 */
-	if ((dport->port.line == DZ_KEYBOARD) ||
-	    (dport->port.line == DZ_MOUSE))
-		return -ENODEV;
-
 	spin_lock_irqsave(&dport->port.lock, flags);
 
 	/* enable the interrupt and the scanning */
@@ -442,7 +419,8 @@ static void dz_shutdown(struct uart_port
 }
 
 /*
- * get_lsr_info - get line status register info
+ * -------------------------------------------------------------------
+ * dz_tx_empty() -- get the transmitter empty status
  *
  * Purpose: Let user call ioctl() to get info when the UART physically
  *          is emptied.  On bus types like RS485, the transmitter must
@@ -450,21 +428,28 @@ static void dz_shutdown(struct uart_port
  *          the transmit shift register is empty, not be done when the
  *          transmit holding register is empty.  This functionality
  *          allows an RS485 driver to be written in user space.
+ * -------------------------------------------------------------------
  */
 static unsigned int dz_tx_empty(struct uart_port *uport)
 {
 	struct dz_port *dport = (struct dz_port *)uport;
-	unsigned short status = dz_in(dport, DZ_LPR);
+	unsigned short tmp, mask = 1 << dport->port.line;
 
-	/* FIXME: this appears to be obviously broken --rmk. */
-	return status ? TIOCSER_TEMT : 0;
+	tmp = dz_in(dport, DZ_TCR);
+	tmp &= mask;
+
+	return tmp ? 0 : TIOCSER_TEMT;
 }
 
 static void dz_break_ctl(struct uart_port *uport, int break_state)
 {
+	/*
+	 * FIXME: Can't access BREAK bits in TDR easily;
+	 * reuse the code for polled TX. --macro
+	 */
 	struct dz_port *dport = (struct dz_port *)uport;
 	unsigned long flags;
-	unsigned short tmp, mask = 1 << uport->line;
+	unsigned short tmp, mask = 1 << dport->port.line;
 
 	spin_lock_irqsave(&uport->lock, flags);
 	tmp = dz_in(dport, DZ_TCR);
@@ -561,7 +546,7 @@ static void dz_set_termios(struct uart_p
 
 	spin_lock_irqsave(&dport->port.lock, flags);
 
-	dz_out(dport, DZ_LPR, cflag);
+	dz_out(dport, DZ_LPR, cflag | dport->port.line);
 	dport->cflag = cflag;
 
 	/* setup accept flag */
@@ -650,7 +635,7 @@ static void __init dz_init_ports(void)
 	for (i = 0, dport = dz_ports; i < DZ_NB_PORT; i++, dport++) {
 		spin_lock_init(&dport->port.lock);
 		dport->port.membase	= (char *) base;
-		dport->port.iotype	= UPIO_PORT;
+		dport->port.iotype	= UPIO_MEM;
 		dport->port.irq		= dec_interrupt[DEC_IRQ_DZ11];
 		dport->port.line	= i;
 		dport->port.fifosize	= 1;
@@ -662,10 +647,7 @@ static void __init dz_init_ports(void)
 static void dz_reset(struct dz_port *dport)
 {
 	dz_out(dport, DZ_CSR, DZ_CLR);
-
 	while (dz_in(dport, DZ_CSR) & DZ_CLR);
-		/* FIXME: cpu_relax? */
-
 	iob();
 
 	/* enable scanning */
@@ -673,26 +655,55 @@ static void dz_reset(struct dz_port *dpo
 }
 
 #ifdef CONFIG_SERIAL_DZ_CONSOLE
+/*
+ * -------------------------------------------------------------------
+ * dz_console_putchar() -- transmit a character
+ *
+ * Polled trasmission.  This is tricky.  We need to mask transmit
+ * interrupts so that they do not interfere, enable the transmitter
+ * for the line requested and then wait till the transmit scanner
+ * requests data for this line.  But it may request data for another
+ * line first, in which case we have to disable its transmitter and
+ * repeat waiting till our line pops up.  Only then the character may
+ * be transmitted.  Finally, the state of the transmitter mask is
+ * restored.  Welcome to the world of PDP-11!
+ * -------------------------------------------------------------------
+ */
 static void dz_console_putchar(struct uart_port *uport, int ch)
 {
 	struct dz_port *dport = (struct dz_port *)uport;
 	unsigned long flags;
-	int loops = 2500;
-	unsigned short tmp = (unsigned char)ch;
-	/* this code sends stuff out to serial device - spinning its
-	   wheels and waiting. */
+	unsigned short csr, tcr, trdy, mask;
+	int loops = 10000;
 
 	spin_lock_irqsave(&dport->port.lock, flags);
+	csr = dz_in(dport, DZ_CSR);
+	dz_out(dport, DZ_CSR, csr & ~DZ_TIE);
+	tcr = dz_in(dport, DZ_TCR);
+	tcr |= 1 << dport->port.line;
+	mask = tcr;
+	dz_out(dport, DZ_TCR, mask);
+	iob();
+	spin_unlock_irqrestore(&dport->port.lock, flags);
 
-	/* spin our wheels */
-	while (((dz_in(dport, DZ_CSR) & DZ_TRDY) != DZ_TRDY) && loops--)
-		/* FIXME: cpu_relax, udelay? --rmk */
-		;
+	while (loops--) {
+		trdy = dz_in(dport, DZ_CSR);
+		if (!(trdy & DZ_TRDY))
+			continue;
+		trdy = (trdy & DZ_TLINE) >> 8;
+		if (trdy == dport->port.line)
+			break;
+		mask &= ~(1 << trdy);
+		dz_out(dport, DZ_TCR, mask);
+		iob();
+		udelay(2);
+	}
 
-	/* Actually transmit the character. */
-	dz_out(dport, DZ_TDR, tmp);
+	if (loops)				/* Cannot send otherwise. */
+		dz_out(dport, DZ_TDR, ch);
 
-	spin_unlock_irqrestore(&dport->port.lock, flags);
+	dz_out(dport, DZ_TCR, tcr);
+	dz_out(dport, DZ_CSR, csr);
 }
 
 /*
@@ -703,11 +714,11 @@ static void dz_console_putchar(struct ua
  * The console must be locked when we get here.
  * -------------------------------------------------------------------
  */
-static void dz_console_print(struct console *cons,
+static void dz_console_print(struct console *co,
 			     const char *str,
 			     unsigned int count)
 {
-	struct dz_port *dport = &dz_ports[CONSOLE_LINE];
+	struct dz_port *dport = &dz_ports[co->index];
 #ifdef DEBUG_DZ
 	prom_printf((char *) str);
 #endif
@@ -716,49 +727,43 @@ static void dz_console_print(struct cons
 
 static int __init dz_console_setup(struct console *co, char *options)
 {
-	struct dz_port *dport = &dz_ports[CONSOLE_LINE];
+	struct dz_port *dport = &dz_ports[co->index];
 	int baud = 9600;
 	int bits = 8;
 	int parity = 'n';
 	int flow = 'n';
-	int ret;
-	unsigned short mask, tmp;
 
 	if (options)
 		uart_parse_options(options, &baud, &parity, &bits, &flow);
 
 	dz_reset(dport);
 
-	ret = uart_set_options(&dport->port, co, baud, parity, bits, flow);
-	if (ret == 0) {
-		mask = 1 << dport->port.line;
-		tmp = dz_in(dport, DZ_TCR);	/* read the TX flag */
-		if (!(tmp & mask)) {
-			tmp |= mask;		/* set the TX flag */
-			dz_out(dport, DZ_TCR, tmp);
-		}
-	}
-
-	return ret;
+	return uart_set_options(&dport->port, co, baud, parity, bits, flow);
 }
 
-static struct console dz_sercons =
-{
+static struct uart_driver dz_reg;
+static struct console dz_sercons = {
 	.name	= "ttyS",
 	.write	= dz_console_print,
 	.device	= uart_console_device,
 	.setup	= dz_console_setup,
-	.flags	= CON_CONSDEV | CON_PRINTBUFFER,
-	.index	= CONSOLE_LINE,
+	.flags	= CON_PRINTBUFFER,
+	.index	= -1,
+	.data	= &dz_reg,
 };
 
-void __init dz_serial_console_init(void)
+static int __init dz_serial_console_init(void)
 {
-	dz_init_ports();
-
-	register_console(&dz_sercons);
+	if (!IOASIC) {
+		dz_init_ports();
+		register_console(&dz_sercons);
+		return 0;
+	} else
+		return -ENXIO;
 }
 
+console_initcall(dz_serial_console_init);
+
 #define SERIAL_DZ_CONSOLE	&dz_sercons
 #else
 #define SERIAL_DZ_CONSOLE	NULL
@@ -767,35 +772,29 @@ void __init dz_serial_console_init(void)
 static struct uart_driver dz_reg = {
 	.owner			= THIS_MODULE,
 	.driver_name		= "serial",
-	.dev_name		= "ttyS%d",
+	.dev_name		= "ttyS",
 	.major			= TTY_MAJOR,
 	.minor			= 64,
 	.nr			= DZ_NB_PORT,
 	.cons			= SERIAL_DZ_CONSOLE,
 };
 
-int __init dz_init(void)
+static int __init dz_init(void)
 {
-	unsigned long flags;
 	int ret, i;
 
+	if (IOASIC)
+		return -ENXIO;
+
 	printk("%s%s\n", dz_name, dz_version);
 
 	dz_init_ports();
 
-	save_flags(flags);
-	cli();
-
 #ifndef CONFIG_SERIAL_DZ_CONSOLE
 	/* reset the chip */
 	dz_reset(&dz_ports[0]);
 #endif
 
-	/* order matters here... the trick is that flags
-	   is updated... in request_irq - to immediatedly obliterate
-	   it is unwise. */
-	restore_flags(flags);
-
 	if (request_irq(dz_ports[0].port.irq, dz_interrupt,
 			IRQF_DISABLED, "DZ", &dz_ports[0]))
 		panic("Unable to register DZ interrupt");
@@ -810,5 +809,7 @@ int __init dz_init(void)
 	return ret;
 }
 
+module_init(dz_init);
+
 MODULE_DESCRIPTION("DECstation DZ serial driver");
 MODULE_LICENSE("GPL");
diff -up --recursive --new-file linux-2.6.18.macro/drivers/serial/dz.h linux-2.6.18/drivers/serial/dz.h
--- linux-2.6.18.macro/drivers/serial/dz.h	2006-09-20 03:42:06.000000000 +0000
+++ linux-2.6.18/drivers/serial/dz.h	2006-11-23 18:27:06.000000000 +0000
@@ -1,20 +1,22 @@
 /*
- * dz.h: Serial port driver for DECStations equiped 
+ * dz.h: Serial port driver for DECstations equipped 
  *       with the DZ chipset.
  *
  * Copyright (C) 1998 Olivier A. D. Lebaillif 
  *             
  * Email: olivier.lebaillif@ifrsys.com
  *
+ * Copyright (C) 2004, 2006  Maciej W. Rozycki
  */
 #ifndef DZ_SERIAL_H
 #define DZ_SERIAL_H
 
 /*
- * Definitions for the Control and Status Received.
+ * Definitions for the Control and Status Register.
  */
 #define DZ_TRDY        0x8000                 /* Transmitter empty */
-#define DZ_TIE         0x4000                 /* Transmitter Interrupt Enable */
+#define DZ_TIE         0x4000                 /* Transmitter Interrupt Enbl */
+#define DZ_TLINE       0x0300                 /* Transmitter Line Number */
 #define DZ_RDONE       0x0080                 /* Receiver data ready */
 #define DZ_RIE         0x0040                 /* Receive Interrupt Enable */
 #define DZ_MSE         0x0020                 /* Master Scan Enable */
@@ -22,32 +24,44 @@
 #define DZ_MAINT       0x0008                 /* Loop Back Mode */
 
 /*
- * Definitions for the Received buffer. 
+ * Definitions for the Receiver Buffer Register. 
  */
-#define DZ_RBUF_MASK   0x00FF                 /* Data Mask in the Receive Buffer */
-#define DZ_LINE_MASK   0x0300                 /* Line Mask in the Receive Buffer */
+#define DZ_RBUF_MASK   0x00FF                 /* Data Mask */
+#define DZ_LINE_MASK   0x0300                 /* Line Mask */
 #define DZ_DVAL        0x8000                 /* Valid Data indicator */
 #define DZ_OERR        0x4000                 /* Overrun error indicator */
 #define DZ_FERR        0x2000                 /* Frame error indicator */
 #define DZ_PERR        0x1000                 /* Parity error indicator */
 
-#define LINE(x) (x & DZ_LINE_MASK) >> 8       /* Get the line number from the input buffer */
-#define UCHAR(x) (unsigned char)(x & DZ_RBUF_MASK)
+#define LINE(x) ((x & DZ_LINE_MASK) >> 8)     /* Get the line number
+                                                 from the input buffer */
+#define UCHAR(x) ((unsigned char)(x & DZ_RBUF_MASK))
 
 /*
- * Definitions for the Transmit Register.
+ * Definitions for the Transmit Control Register.
  */
 #define DZ_LINE_KEYBOARD 0x0001
 #define DZ_LINE_MOUSE    0x0002
 #define DZ_LINE_MODEM    0x0004
 #define DZ_LINE_PRINTER  0x0008
 
+#define DZ_MODEM_RTS     0x0800               /* RTS for the modem line (2) */
 #define DZ_MODEM_DTR     0x0400               /* DTR for the modem line (2) */
+#define DZ_PRINT_RTS     0x0200               /* RTS for the prntr line (3) */
+#define DZ_PRINT_DTR     0x0100               /* DTR for the prntr line (3) */
+#define DZ_LNENB         0x000f               /* Transmitter Line Enable */
 
 /*
  * Definitions for the Modem Status Register.
  */
+#define DZ_MODEM_RI      0x0800               /* RI for the modem line (2) */
+#define DZ_MODEM_CD      0x0400               /* CD for the modem line (2) */
 #define DZ_MODEM_DSR     0x0200               /* DSR for the modem line (2) */
+#define DZ_MODEM_CTS     0x0100               /* CTS for the modem line (2) */
+#define DZ_PRINT_RI      0x0008               /* RI for the printer line (3) */
+#define DZ_PRINT_CD      0x0004               /* CD for the printer line (3) */
+#define DZ_PRINT_DSR     0x0002               /* DSR for the prntr line (3) */
+#define DZ_PRINT_CTS     0x0001               /* CTS for the prntr line (3) */
 
 /*
  * Definitions for the Transmit Data Register.

From phil@sicortex.com Tue Nov 28 14:50:39 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 28 Nov 2006 14:50:45 +0000 (GMT)
Received: from static-71-243-124-123.bos.east.verizon.net ([71.243.124.123]:46579
	"EHLO mail1.sicortex.com") by ftp.linux-mips.org with ESMTP
	id S20040187AbWK1Ouj (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 28 Nov 2006 14:50:39 +0000
Received: from [192.168.1.9] (213-66-54-131-o837.telia.com [213.66.54.131])
	(using SSLv3 with cipher RC4-MD5 (128/128 bits))
	(No client certificate requested)
	by mail1.sicortex.com (Postfix) with ESMTP id 03162BBC5;
	Tue, 28 Nov 2006 09:50:28 -0500 (EST)
Subject: Re: [Perfctr-devel] 2.6.19-rc6-git10 new perfmon code base +
	libpfm + pfmon
From:	"Philip J. Mucci" <phil@sicortex.com>
To:	eranian@hpl.hp.com
Cc:	perfmon@napali.hpl.hp.com, linux-mips@linux-mips.org
In-Reply-To: <20061127143705.GC24980@frankl.hpl.hp.com>
References: <20061127143705.GC24980@frankl.hpl.hp.com>
Content-Type: multipart/mixed; boundary="=-NKNOX+KaNlfzWAaDtSaM"
Date:	Tue, 28 Nov 2006 15:50:27 +0100
Message-Id: <1164725427.2316.109.camel@localhost.localdomain>
Mime-Version: 1.0
X-Mailer: Evolution 2.6.3 (2.6.3-1.fc5.5) 
Return-Path: <phil@sicortex.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13266
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: phil@sicortex.com
Precedence: bulk
X-list: linux-mips


--=-NKNOX+KaNlfzWAaDtSaM
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hi folks,

Linux-MIPS users will need the following patch to add the 'cpu'
directories to sysfs.

Phil


On Mon, 2006-11-27 at 06:37 -0800, Stephane Eranian wrote:
> Hello,
> 
> I have released another version of the perfmon new code base package.
> This version of the kernel patch is relative to 2.6.19-rc6-git10.
> 
> This is a major update because it completes the changes requested 
> during the code review on LKML. As a consequence, the kernel interface
> is NOT backward compatible with previous v2.2 versions. This release has
> the v2.3 version number. Backward compatibility with v2.0 is maintained
> on Itanium processors.
> 
> The kernel patch is split between infrastructure work and perfmon2 proper.
> The infrastructure contains the following changes which will be integrated
> into mainline before perfmon2 is. Those changes should appear in 2.6.20.
> They are provided in the base.diff file.
> 
> The infrastructure changes include:
> 	- x86_64: fix idle_notifier to cover all interrupts entry/exit for idle thread
> 	- i386  : add idle notifier (copy of x86_64 notifier)
> 	- ia64  : idle notifier (copy of x86_64 notifier)
> 	- i386  : add X86_FEATURE_ceforge.net, linux-kernel@vger.kernel.orgq,X86_FEATURE_PEBS to cpufeature.h
> 	- x86_64:  add X86_FEATURE_BTS,X86_FEATURE_PEBS to cpufeature.h
> 	- i386  : add PMU related MSR definitions to msr.h
> 	- x86_64: NMI watchdog uses PERFCTR1 to allow PEBS on Intel Core (requires PERFCTR0)
> 	- all   : remove unused carta_random32.h
> 
> 
> The perfmon2 kernel changes the release to v2.3 and includes the following changes:
> 	- updated to 2.6.19-rc6-git10 
> 	- sampling format identified with clear text string, not UUID anymore
> 	- pfm_create_context() returns file descriptor
> 	- sampling format name passed as argument
> 	- struct pfarg_ctx_t simplified
> 	- using random32() instead of carta_random32() (now obsolete)
> 	- in struct pfarg_pmd, reg_random_seed is obsolete
> 	- added support for Intel Core processors (Core 2 Duo)
> 	- unified PEBS support between P4 and Intel Core
> 	- fix bugs with munmap() of sampling buffer
> 	- changed sysfs to handle new naming for sampling formats
> 	- change rsvd_mask logic in PMU description modules
> 	- make idle notifier registration lazy (only when needed)
> 	- rewritten NMI integration using die_notifier()
> 	- NMI watchdog support and auto-detection for AMD K8, Intel Core
> 	- fix potential issues with locking/irq masking using LockDep checker
> 	- cleaned MIPS PMU description table setup
> 	- various MIPS bugs fixes (Phil Mucci, Manoj Ekbote)
> 	- various PowerPC updates  include PPC32 description table (Phil Mucci)
> 
> Due to problems with the git10 tree, the MIPS kernel does not compile regardless of
> perfmon2. A new patch will be generated once this problem is removed.
> 
> I have also released a new libpfm, libpfm-3.2-061127, with lots of
> changes. Here are some of the most important ones:
> 
> 	- added support for Intel Core (Core 2 Duo)
> 	- updated all example, header files to perfmon v2.3
> 	- updated man pages
> 	- Intel Core PEBS example
> 	- fixed rtop on 32-bit platforms
> 	- various MIPS updates (Phil Mucci)
> 	- big-endian support for MIPS
> 	- various Makefile improvements
> 
> Also a new version of pfmon, pfmon-3.2-061127, with a lot
> of changes as well:
> 	- updated to perfmon v2.3 interface
> 	- support for Intel Core processors (Core 2 Duo)
> 	- support for Intel Core PEBS as a sampling format
> 	- complete rewrite of system-wide  core loops to avoid race conditions with signals
> 	- added --print-interval to print intermediate deltas in system-wide mode
> 	- better handling of perfmon errors
> 	- corrected Montecito checks for L2D_CANCEL events
> 	- factorized 'detailed' sampling format for all arch
> 	- inst-hist default formats for all arch
> 	- corrected sampling buffer auto-sizing based on resource limit constraints
> 	- updated online documentation
> 	
> This version of pfmon requires libpfm-3.2-061127.
> 
> You can get a more detailed log of changes the the CVS tree.
> 
> You can grab the new packages at our web site:
> 
> 	 http://perfmon2.sf.net
> 
> Enjoy,
> 
> PS: I will post a kernel patch to LKML and a diffstat on the perfmon mailing list.
> -- 
> 
> -Stephane
> 
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Perfctr-devel mailing list
> Perfctr-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/perfctr-devel

--=-NKNOX+KaNlfzWAaDtSaM
Content-Disposition: inline
Content-Description: Attached message
Content-Type: message/rfc822

Return-Path: <phil@sicortex.com>
X-Original-To: mucci@cs.utk.edu
Received: from ka.cs.utk.edu (ka.cs.utk.edu [160.36.56.221]) by
	yomega.cs.utk.edu (Postfix) with ESMTP id B50008D03F for
	<mucci@cs.utk.edu>; Tue, 28 Nov 2006 09:45:59 -0500 (EST)
Received: from localhost (localhost [127.0.0.1]) by ka.cs.utk.edu (Postfix)
	with ESMTP id F01D62F27B for <mucci@cs.utk.edu>; Tue, 28 Nov 2006 09:47:17
	-0500 (EST)
X-Virus-Scanned: by amavisd-new with ClamAV and SpamAssasin at cs.utk.edu
X-Spam-Score: -0.648
X-Spam-Level: 
X-Spam-Status: No, score=-0.648 tagged_above=-100 required=5
	tests=[BAYES_00=-2.599, FORGED_RCVD_HELO=0.135, MISSING_SUBJECT=1.816]
Received: from ka.cs.utk.edu ([127.0.0.1]) by localhost (ka.cs.utk.edu
	[127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Amv1QlkI8q3X for
	<mucci@cs.utk.edu>; Tue, 28 Nov 2006 09:47:13 -0500 (EST)
Received: from mail.sicortex.com
	(static-71-243-124-123.bos.east.verizon.net [71.243.124.123]) by
	ka.cs.utk.edu (Postfix) with ESMTP id 2151A2F275 for <mucci@cs.utk.edu>;
	Tue, 28 Nov 2006 09:47:10 -0500 (EST)
Received: from intranet.sicortex.com (intranet.sicortex.com [10.0.0.20]) by
	mail.sicortex.com (Postfix) with ESMTP id 1CBB8830C5 for
	<mucci@cs.utk.edu>; Tue, 28 Nov 2006 09:47:10 -0500 (EST)
Received: by intranet.sicortex.com (Postfix, from userid 1018) id
	04AF39A1BF; Tue, 28 Nov 2006 09:47:09 -0500 (EST)
Date: Tue, 28 Nov 2006 09:47:09 -0500
To: mucci@cs.utk.edu
Message-ID: <456C4BED.mailP0811VGTG@intranet.sicortex.com>
User-Agent: nail 11.4 8/29/04
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
From: phil@sicortex.com (Phil Mucci)
X-Evolution-Source: imap://mucci@imap.cs.utk.edu/
Subject: No Subject
Content-Transfer-Encoding: 7bit

Index: perfmon/perfmon_sysfs.c
===================================================================
--- perfmon/perfmon_sysfs.c	(.../perfmon2-post-sf-pre-fixup)	(revision 27882)
+++ perfmon/perfmon_sysfs.c	(.../perfmon2-post-sf-post-fixup)	(revision 27882)
@@ -79,6 +79,10 @@
 
 static struct kobject pfm_kernel_kobj, pfm_kernel_fmt_kobj;
 
+/* Remove this after mips get topology.c files */
+
+struct cpu sysfs_cpus[NR_CPUS];
+
 static void pfm_reset_stats(int cpu)
 {
 	struct pfm_stats *st;
@@ -400,6 +404,19 @@
 	int done_kobj_fmt = 0, done_kobj_kernel = 0;
 	int i, cpu = -1;
 	
+	/* This is a hack to be removed */
+
+        for_each_present_cpu(i) {
+          ret = register_cpu(&sysfs_cpus[i],i,NULL);
+          if (ret)
+            {
+              PFM_INFO("cannot register cpu %d: %d\n",i,ret);
+              goto error;
+            }
+        }
+
+	/* End hack */
+
 	ret = subsystem_register(&pfm_fmt_subsys);
 	if (ret) {
 		PFM_INFO("cannot register pfm_fmt_subsys: %d", ret);

--=-NKNOX+KaNlfzWAaDtSaM--


From hjl@lucon.org Tue Nov 28 17:40:23 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 28 Nov 2006 17:40:29 +0000 (GMT)
Received: from smtp101.sbc.mail.mud.yahoo.com ([68.142.198.200]:43380 "HELO
	smtp101.sbc.mail.mud.yahoo.com") by ftp.linux-mips.org with SMTP
	id S20040223AbWK1RkX (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 28 Nov 2006 17:40:23 +0000
Received: (qmail 50326 invoked from network); 28 Nov 2006 17:40:15 -0000
Received: from unknown (HELO lucon.org) (hjjean@sbcglobal.net@75.0.162.249 with login)
  by smtp101.sbc.mail.mud.yahoo.com with SMTP; 28 Nov 2006 17:40:15 -0000
X-YMail-OSG: 9rhRlIgVM1mdSxZO2Aia5Hr8TeN04Z54AB0mbI2ZPL4Q0VPLUH9qRF007S25wKbLgChoryEPMJTF3aKixazB3V7wTjT.hEnBv35Cb891pAVUhws2sU0KyA--
Received: by lucon.org (Postfix, from userid 500)
	id 814F346EEEC; Tue, 28 Nov 2006 09:40:13 -0800 (PST)
Date:	Tue, 28 Nov 2006 09:40:13 -0800
From:	"H. J. Lu" <hjl@lucon.org>
To:	linux-gcc@vger.kernel.org
Cc:	gcc@gcc.gnu.org, GNU C Library <libc-alpha@sources.redhat.com>,
	Mat Hostetter <mat@lcs.mit.edu>, Warner Losh <imp@village.org>,
	linux-mips@linux-mips.org, Ralf Baechle <ralf@linux-mips.org>,
	Linas Vepstas <linas@linas.org>, linux-vax@pergamentum.com
Subject: The Linux binutils 2.17.50.0.7 is released
Message-ID: <20061128174013.GA14147@lucon.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.4.2.2i
Return-Path: <hjl@lucon.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13267
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: hjl@lucon.org
Precedence: bulk
X-list: linux-mips

This is the beta release of binutils 2.17.50.0.7 for Linux, which is
based on binutils 2006 1020 in CVS on sourceware.org plus various
changes. It is purely for Linux.

Starting from the 2.17.50.0.7 release, the default output section LMA
(load memory address) has changed for allocatable sections from being
equal to VMA (virtual memory address), to keeping the difference between
LMA and VMA the same as the previous output section in the same region.

For

.data.init_task : { *(.data.init_task) }

LMA of .data.init_task section is equal to its VMA with the old linker.
With the new linker, it depends on the previous output section. You
can use

.data.init_task : AT (ADDR(.data.init_task)) { *(.data.init_task) }

to ensure that LMA of .data.init_task section is always equal to its
VMA. The linker script in the older 2.6 x86-64 kernel depends on the
old behavior.  You can add AT (ADDR(section)) to force LMA of
.data.init_task section equal to its VMA. It will work with both old
and new linkers. The x86-64 kernel linker script in kernel 2.6.13 and
above is OK.

The new x86_64 assembler no longer accepts

	monitor %eax,%ecx,%edx

You should use

	monitor %rax,%ecx,%edx

or
	monitor

which works with both old and new x86_64 assemblers. They should
generate the same opcode.

The new i386/x86_64 assemblers no longer accept instructions for moving
between a segment register and a 32bit memory location, i.e.,

	movl (%eax),%ds
	movl %ds,(%eax)

To generate instructions for moving between a segment register and a
16bit memory location without the 16bit operand size prefix, 0x66,

	mov (%eax),%ds
	mov %ds,(%eax)

should be used. It will work with both new and old assemblers. The
assembler starting from 2.16.90.0.1 will also support

	movw (%eax),%ds
	movw %ds,(%eax)

without the 0x66 prefix. Patches for 2.4 and 2.6 Linux kernels are
available at

http://www.kernel.org/pub/linux/devel/binutils/linux-2.4-seg-4.patch
http://www.kernel.org/pub/linux/devel/binutils/linux-2.6-seg-5.patch

The ia64 assembler is now defaulted to tune for Itanium 2 processors.
To build a kernel for Itanium 1 processors, you will need to add

ifeq ($(CONFIG_ITANIUM),y)
	CFLAGS += -Wa,-mtune=itanium1
	AFLAGS += -Wa,-mtune=itanium1
endif

to arch/ia64/Makefile in your kernel source tree.

Please report any bugs related to binutils 2.17.50.0.7 to hjl@lucon.org

and

http://www.sourceware.org/bugzilla/

If you don't use

# rpmbuild -ta binutils-xx.xx.xx.xx.xx.tar.bz2

to compile the Linux binutils, please read patches/README in source
tree to apply Linux patches if there are any.

Changes from binutils 2.17.50.0.6:

1. Update from binutils 2006 1127.
2. Properly set ELF output segment address when the first section in
input segment is removed.
3. Better merging of CIEs in linker .eh_frame optimizations.
4. Support .cfi_personality and .cfi_lsda assembler directives.
5. Fix an ARM linker crash. PR 3532.
6. Fix various PPC64 ELF bugs.
7. Mark discarded debug info more thoroughly in linker output.
8. Fix various MIPS ELF bugs.
9. Fix readelf to display program interpreter path > 64 chars. PR 3384.
10. Add support for PowerPC SPU.
11. Properly handle cloned symbols used in relocations in assembler. PR
3469.
12. Update opcode for POPCNT in amdfam10 architecture.


Changes from binutils 2.17.50.0.5:

1. Update from binutils 2006 1020.
2. Don't make debug symbol dynamic. PR 3290.
3. Don't page align empty SHF_ALLOC sections, which leads to very large
executables. PR 3314.
4. Use a different section index for section relative symbols against
removed empty sections.
5. Fix a few ELF EH frame handling bugs.
6. Don't ignore relocation overflow on branches to undefweaks for
x86-64. PR 3283.
7. Rename MNI to SSSE3.
8. Properly append symbol list for --dynamic-list.
lists.
9. Various ARM ELF fixes.
10. Correct 64bit library search path for Linux/x86 linker with 64bit
support.
11. Fix ELF linker to copy OS/PROC specific flags from input section to
output section.
12. Fix DW_FORM_ref_addr handling in linker dwarf reader. PR 3191.
13. Fix ELF indirect symbol handling. PR 3351.
14. Fix PT_GNU_RELRO segment handling for SHF_TLS sections. Don't add
PT_GNU_RELRO segment when there are no relro sections. PR 3281.
15. Various MIPS ELF fixes.
16. Various Sparc ELF fixes.
17. Various Xtensa ELF fixes.

Changes from binutils 2.17.50.0.4:

1. Update from binutils 2006 0927.
2. Fix linker regressions of section address and section relative symbol
with empty output section. PR 3223/3267.
3. Fix "strings -T". PR 3257.
4. Fix "objcopy --only-keep-debug". PR 3262.
5. Add Intell iwmmxt2 support.
6. Fix an x86 disassembler bug. PR 3100.

Changes from binutils 2.17.50.0.3:

1. Update from binutils 2006 0924.
2. Speed up linker on .o files with debug info on linkonce sections.
PR 3111.
3. Added x86-64 PE support.
4. Fix objcopy/strip on .o files with section groups. PR 3181.
5. Fix "ld --hash-style=gnu" crash with gcc 3.4.6. PR 3197.
6. Fix "strip --strip-debug" on .o files generated with
"gcc -feliminate-dwarf2-dups". PR 3186.
7. Fix "ld -r" on .o files generated with "gcc -feliminate-dwarf2-dups".
PR 3249.
8. Add --dynamic-list to linker to make global symbols dynamic.
9. Fix magic number for EFI ia64. PR 3171.
10. Remove PT_NULL segment for "ld -z relro". PR 3015.
11. Make objcopy to perserve the file formats in archive elements.
PR 3110.
12. Optimize x86-64 assembler and fix disassembler for
"add32 mov xx,$eax". PR 3235.
13. Improve linker diagnostics. PR 3107.
14. Fix "ld --sort-section name". PR 3009.
15. Updated an x86 disassembler bug. PR 3000.
16. Various updates for PPC, ARM, MIPS, SH, Xtensa.
17. Added Score support.

Changes from binutils 2.17.50.0.2:

1. Update from binutils 2006 0715.
2. Add --hash-style to ELF linker with DT_GNU_HASH and SHT_GNU_HASH.
3. Fix a visibility bug in ELF linker (PR 2884).
4. Properly fix the i386 TLS linker bug (PR 2513).
5. Add assembler and dissassembler support for Pentium Pro nops.
6. Optimize x86 nops for Pentium Pro and above.
7. Add -march=/-mtune= to x86 assembler.
8. Fix an ELF linker with TLS common symbols.
9. Improve program header allocation in ELF linker.
10. Improve MIPS, M68K and ARM support.
11. Fix an ELF linker crash when reporting alignment change (PR 2735).
12. Remove unused ELF section symbols (PR 2723).
13. Add --localize-hidden to objcopy.
14. Add AMD SSE4a and ABM new instruction support.
15. Properly handle illegal x86 instructions in group 11 (PR 2829).
16. Add "-z max-page-size=" and "-z common-page-size=" to ELF linker.
17. Fix objcopy for .tbss sections.

Changes from binutils 2.17.50.0.1:

1. Update from binutils 2006 0526.
2. Change the x86-64 maximum page size to 2MB.
3. Support --enable-targets=all for 64bit target and host (PR 1485).
4. Properly update CIE/FDE length and align section for .eh_frame
section (PR 2655/2657).
5. Properly handle removed ELF section symbols.
6. Fix an ELF linker regression introduced on 2006-04-21.
7. Fix an segfault in PPC ELF linker (PR 2658).
8. Speed up the ELF linker by caching the result of kept section check.
9. Properly create stabs section for ELF.
10. Preserve ELF program header when copying ELF files.
11. Properly handle ELF SHN_LOPROC/SHN_HIOS when checking section
index (PR 2607).
12. Misc mips updates.
13. Misc arm updates.
14. Misc xtensa updates.
15. Fix an alpha assembler warning (PR 2598).
16. Fix assembler buffer overflow.
17. Properly disassemble sgdt/sidt for x86-64.

Changes from binutils 2.16.91.0.7:

1. Update from binutils 2006 0427.
2. Fix an objcopy regression (PR 2593).
3. Reduce ar memory usage (PR 2467).
4. Allow application specific ELF sections (PR 2537).
5. Fix an i386 TLS linker bug (PR 2513).
6. Speed up ia64 linker by 1300X in some cases (PR 2442).
7. Check illegal immediate register operand in i386 assembler (PR
2533).
8. Fix a strings bug (PR 2584).
9. Better handle corrupted ELF files (PR 2257).
10. Fix a MIPS linker bug (PR 2267).

Changes from binutils 2.16.91.0.6:

1. Update from binutils 2006 0317.
2. Support Intel Merom New Instructions in assembler/disassembler.
3. Support Intel new instructions in Montecito.
4. Fix linker "--as-needed" (PR 2434).
5. Fix linker "-s" regression (PR 2462).
6. Fix REP prefix for string instructions in x86 disassembler
(PR 2428).
7. Fix the weak undefined symbols in PIE (PR 2218).
8. Fix 2 DWARF reader bugs (PRs 2443, 2338).
9. Improve ELF linker error message (PR 2322).
10. Avoid abort with dynamic symbols in >64K sections (PR 2411).
11. Handle mismatched symbol types for executables (PR 2404).
12. Avoid a linker linkonce regression (PR 2342).

Changes from binutils 2.16.91.0.5:

1. Update from binutils 2006 0212.
2. Correct Linux linker search order for DT_NEEDED entries (PR 2290).
3. Fix the x86-64 disassembler for control/debug register moves.
4. Properly handle ELF strip/objcopy with unmodified program header
(PR 2258).
5. Improve ELF linker error handling when there are not enough room for
program headers (PR 2322).
6. Properly handle weak undefined symbols in PIE (PR 2218).
7. Support new i386/x86-64 TLS relocations.
8. Fix addr2line for linux kernel (PR 2096).
9. Fix an assembler memory leak with --statistics.
10. Avoid an ia64 assembler regression (PR 2117).

Changes from binutils 2.16.91.0.4:

1. Update from binutils 2005 1219.
2. Fix a MIPS linker regression (PR 1932).
3. Fix an objcopy bug for ia64 (PR 1991).
4. Fix a linker crash on bad input (PR 2008).
5. Fix 64bit monitor and mwait (PR 1874).

Changes from binutils 2.16.91.0.3:

1. Update from binutils 2005 1111.
2. Fix ELF orphan section handling (PR 1467)
3. Fix ELF section attribute handleing (PR 1487).
4. Fix IA64 unwind info dump for relocatable files. (PR 1436).
5. Add DWARF info dump to objdump.
6. Fix SHF_LINK_ORDER handling (PR 1321).
7. Don't allow "ld --just-symbols" on DSO (PR 1263).
8. Fix a "ld -u" crash on TLS symbol (PR 1301).
9. Fix an IA64 linker crash (PR 1247).
10. Fix a MIPS linker bug (PR 1150).
11. Fix a M68K linker bug (PR 1775).
12. Fix an ELF symbol versioning linker bug (PR 1540).
13. Improve linker error handling (PR 1208).
14. Add new SPARC processors to SunOS for objcopy (PR 1472).
15. Add "@file" to read options from a file.
16. Add assembler weakref support.

Changes from binutils 2.16.91.0.2:

1. Update from binutils 2005 0821.
2. Support x86-64 medium model.
3. Fix "objdump -S --adjust-vma=xxx" (PR 1179).
4. Reduce R_IA64_NONE relocations from R_IA64_LDXMOV relaxation.
5. Fix x86 linker regression for dosemu.
6. Add "readelf -t/--section-details" to display section details.
7. Fix "as -al=file" regression (PR 1118).

Changes from binutils 2.16.91.0.1:

1. Update from binutils 2005 0720.
2. Add Intel VMX support.
3. Add AMD SVME support.
4. Add x86-64 new relocations for medium model.
5. Fix a PIE regression (PR 975).
6. Fix an x86_64 signed 32bit displacement regression.
7. Fix PPC PLT (PR 1004). 
8. Improve empty section removal.

Changes from binutils 2.16.90.0.3:

1. Update from binutils 2005 0622.
2. Fix a linker versioning bug exposed by gcc 4 (PR 1022/1023/1025).
3. Optimize ia64 br->brl relaxation (PR 834).
4. Improve linker empty section removal.
5. Fix DWARF 2 line number reporting (PR 990).
6. Fix DWARF 2 line number reporting regression on assembly file (PR
1000).

Changes from binutils 2.16.90.0.2:

1. Update from binutils 2005 0510.
2. Update ia64 assembler to support comdat group section generated by
gcc 4 (PR 940).
3. Fix a linker crash on bad input (PR 939).
4. Fix a sh64 assembler regression (PR 936).
5. Support linker script on executable (PR 882).
6. Fix the linker -pie regression (PR 878).
7. Fix an x86_64 disassembler bug (PR 843).
8. Fix a PPC linker regression.
9. Misc speed up.

Changes from binutils 2.16.90.0.1:

1. Update from binutils 2005 0429.
2. Fix an ELF linker regression (PR 815).
3. Fix an empty section removal related bug.
4. Fix an ia64 linker regression (PR 855).
5. Don't allow local symbol to be equated common/undefined symbols (PR
857).
6. Fix the ia64 linker to handle local dynamic symbol error reporting.
7. Make non-debugging reference to discarded section an error (PR 858).
8. Support Sparc/TLS.
9. Support rpm build with newer rpm.
10. Fix an alpha linker regression.
11. Fix the non-gcc build regression.

Changes from binutils 2.15.94.0.2.2:

1. Update from binutils 2005 0408.
2. The i386/x86_64 assemblers no longer accept instructions for moving
between a segment register and a 32bit memory location.
3. The x86_64 assembler now allows movq between a segment register and
a 64bit general purpose register.
4. 20x Speed up linker for input files with >64K sections.
5. Properly report ia64 linker relaxation failures.
6. Support tuning ia64 assembler for Itanium 2 processors.
7. Linker will remove empty unused output sections.
8. Add -N to readelf to display full section names.
9. Fix the ia64 linker to support linkonce text sections without unwind
sections.
10. More unwind directive checkings in the ia64 assembler.
11. Speed up linker with wildcard handling.
12. Fix readelf to properly dump .debug_ranges and .debug_loc sections.

Changes from binutils 2.15.94.0.2:

1. Fix greater than 64K section support in linker.
2. Properly handle i386 and x86_64 protected symbols in linker.
3. Fix readelf for LEB128 on 64bit hosts.
4. Speed up readelf for section group process.
5. Include ia64 texinfo pages.
6. Change ia64 assembler to check hint.b for Montecito.
7. Improve relaxation failure report in ia64 linker.
8. Fix ia64 linker to allow relax backward branch in the same section.

Changes from binutils 2.15.94.0.1:

1. Update from binutils 2004 1220.
2. Fix strip for TLS symbol references.

Changes from binutils 2.15.92.0.2:

1. Update from binutils 2004 1121.
2. Put ia64 .ctors/.dtors sections next to small data section for
Intel ia64 compiler.
3. Fix -Bdynamic/-Bstatic handling for linker script.
4. Provide more information on relocation overflow.
5. Add --sort-section to linker.
6. Support icc 8.1 unwind info in readelf.
7. Fix the infinite loop bug on bad input in the ia64 assembler.
8. Fix ia64 SECREL relocation in linker.
9. Fix a section group memory leak in readelf.

Changes from binutils 2.15.91.0.2:

1. Update from binutils 2004 0927.
2. Work around a section header bug in Intel ia64 compiler.
3. Fix an unwind directive bug in the ia64 assembler.
4. Fix various PPC bugs.
5. Update ARM support.
6. Fix an x86-64 linker warning while building Linux kernel.

Changes from binutils 2.15.91.0.1:

1. Update from binutils 2004 0727.
2. Fix the x86_64 linker to prevent non-PIC code in shared library.
3. Fix the ia64 linker to warn the relotable files which can't be
relaxed.
4. Fix the comdat group support. Allow mix single-member comdat group
with linkonce section.
5. Added --add-needed/--no-add-needed options to linker.
6. Fix the SHF_LINK_ORDER support.
7. Fix the ia64 assembler for multiple sections with the same name and
SHT_IA_64_UNWIND sections.
8. Fix the ia64 assembler for merge section and relaxation.

Changes from binutils 2.15.90.0.3:

1. Update from binutils 2004 0527.
2. Fix -x auto option in the ia64 assembler.
3. Add the AR check in the ia64 assembler.
4. Fix the section group support.
5. Add a new -z relro linker option.
6. Fix an exception section placement bug in linker.
7. Add .serialize.data and .serialize.instruction to the ia64
assembler.

Changes from binutils 2.15.90.0.2:

1. Update from binutils 2004 0415.
2. Fix the linker for weak undefined symbol handling.
3. Fix the ELF/Sparc and ELF/Sparc64 linker for statically linking PIC
code.

Changes from binutils 2.15.90.0.1.1:

1. Update from binutils 2004 0412.
2. Add --as-needed/--no-as-needed to linker.
3. Fix -z defs in linker.
4. Always reserve the memory for ia64 dynamic linker.
5. Fix a race condition in ia64 lazy binding.

Changes from binutils 2.15.90.0.1:

1. Fixed an ia64 assembler bug.
2. Install the assembler man page.

Changes from binutils 2.14.90.0.8:

1. Update from binutils 2004 0303.
2. Fixed linker for undefined symbols with non-default visibility.
3. Sped up linker weakdef symbol handling.
4. Fixed mixing ELF32 and ELF64 object files in archive.
5. Added ia64 linker brl optimization.
6. Fixed ia64 linker to disallow invalid dynamic relocations.
7. Fixed DT_TEXTREL handling in ia64 linker.
8. Fixed alignment handling in ia64 assembler.
9. Improved ia64 assembler unwind table handling. 

Changes from binutils 2.14.90.0.7:

1. Update from binutils 2004 0114.
2. Fixed an ia64 assembler unwind table bug. 
3. Better handle IPF linker relaxation overflow.
4. Fixed misc PPC bugs.

Changes from binutils 2.14.90.0.6:

1. Update from binutils 2003 1029.
2. Allow type changes for undefined symbols.
3. Fix EH frame optimization.
4. Fix the check for undefined versioned symbol with wildcard.
5. Support generating code for Itanium.
6. Detect and warn bad symbol index.
7. Update IPF assemebler DV check.

Changes from binutils 2.14.90.0.5:

1. Update from binutils 2003 0820.
2. No longer use section names for ELF section types nor flags.
3. Fix some ELF/IA64 linker bugs.
4. Fix some ELF/ppc bugs.
5. Add archive support to readelf.

Changes from binutils 2.14.90.0.4.1:

1. Update from binutils 2003 0722.
2. Fix an ELF/mips linker bug.
3. Fix an ELF/hpppa linker bug.
4. Fix an ELF/ia64 assembler bug.
5. Fix a linkonce support with C++ debug.
6. A new working C++ demangler.
7. Various alpha, mips, ia64, ... bug fixes.
8. Support for the current gcc and glibc.

Changes from binutils 2.14.90.0.4:
 
1. Fix an ia64 assembler hint@pause bug.
2. Support Intel Prescott New Instructions.

Changes from binutils 2.14.90.0.3:

1. Work around the brain dead libtool.

Changes from binutils 2.14.90.0.2:

1. Update from binutils 2003 0523.
2. Fix 2 ELF visibility bugs.
3. Fix ELF/ppc linker bugs.

Changes from binutils 2.14.90.0.1:

1. Update from binutils 2003 0515.
2. Fix various ELF visibility bugs.
3. Fix some ia64 linker bugs.
4. Add more IAS compatibilities to ia64 assembler.

Changes from binutils 2.13.90.0.20:

1. Update from binutils 2003 0505.
2. Fix various ELF visibility bugs.
3. Fix some ia64 linker bugs.
4. Fix some ia64 assembler bugs.
5. Add some IAS compatibilities to ia64 assembler.
6. Fix ELF common symbol alignment.
7. Fix ELF weak symbol handling.

Changes from binutils 2.13.90.0.18:

1. Update from binutils 2003 0319.
2. Fix an ia64 linker brl relaxation bug.
3. Fix some ELF/ppc linker bugs.

Changes from binutils 2.13.90.0.16:

1. Update from binutils 2003 0121.
2. Fix an ia64 gas bug.
3. Fix some TLS bugs.
4. Fix some ELF/ppc bugs.
5. Fix an ELF/m68k bug.

2. Include /usr/bin/c++filt.
Changes from binutils 2.13.90.0.14:

1. Update from binutils 2002 1126.
2. Include /usr/bin/c++filt.
3. Fix "ld -r" with execption handling.

Changes from binutils 2.13.90.0.10:

1. Update from binutils 2002 1114.
2. Fix ELF/alpha bugs.
3. Fix an ELF/i386 assembler bug.

Changes from binutils 2.13.90.0.4:

1. Update from binutils 2002 1010.
2. More ELF/PPC linker bug fixes.
3. Fix an ELF/alpha linker bug.
4. Fix an ELF/sparc linker bug to support Solaris.
5. More TLS updates.

Changes from binutils 2.13.90.0.3:

1. Update from binutils 2002 0814.
2. Fix symbol versioning bugs for gcc 3.2.
3. Fix mips gas.

Changes from binutils 2.13.90.0.2:

1. Update from binutils 2002 0809.
2. Fix a mips gas compatibility bug.
3. Fix an x86 TLS bfd bug.
4. Fix an x86 PIC gas bug.
5. Improve symbol versioning support.

The file list:

1. binutils-2.17.50.0.7.tar.bz2. Source code.
2. binutils-2.17.50.0.6-2.17.50.0.7.diff.bz2. Patch against the
   previous beta source code.
3. binutils-2.17.50.0.7-1.i386.rpm. IA-32 binary RPM for RedHat EL 4.
4. binutils-2.17.50.0.7-1.ia64.rpm. IA-64 binary RPM for RedHat EL 4.
5. binutils-2.17.50.0.7-1.x86_64.rpm. X64_64 binary RPM for RedHat
   EL 4.

There is no separate source rpm. You can do

# rpmbuild -ta binutils-2.17.50.0.7.tar.bz2

to create both binary and source rpms.

The primary sites for the beta Linux binutils are:

1. http://www.kernel.org/pub/linux/devel/binutils/

Thanks.


H.J. Lu
hjl@lucon.org
11/27/2006

From ralf@linux-mips.org Tue Nov 28 18:20:59 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 28 Nov 2006 18:21:01 +0000 (GMT)
Received: from localhost.localdomain ([127.0.0.1]:47760 "EHLO
	dl5rb.ham-radio-op.net") by ftp.linux-mips.org with ESMTP
	id S20040230AbWK1SU7 (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 28 Nov 2006 18:20:59 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by dl5rb.ham-radio-op.net (8.13.8/8.13.8) with ESMTP id kASIKp1h020518;
	Tue, 28 Nov 2006 18:20:51 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.8/8.13.8/Submit) id kASIKnCw020517;
	Tue, 28 Nov 2006 18:20:49 GMT
Date:	Tue, 28 Nov 2006 18:20:49 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	"Philip J. Mucci" <phil@sicortex.com>
Cc:	eranian@hpl.hp.com, perfmon@napali.hpl.hp.com,
	linux-mips@linux-mips.org
Subject: Re: [Perfctr-devel] 2.6.19-rc6-git10 new perfmon code base + libpfm + pfmon
Message-ID: <20061128182049.GA19304@linux-mips.org>
References: <20061127143705.GC24980@frankl.hpl.hp.com> <1164725427.2316.109.camel@localhost.localdomain>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <1164725427.2316.109.camel@localhost.localdomain>
User-Agent: Mutt/1.4.2.2i
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13268
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: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Tue, Nov 28, 2006 at 03:50:27PM +0100, Philip J. Mucci wrote:

> Linux-MIPS users will need the following patch to add the 'cpu'
> directories to sysfs.

This patch is to some file which doesn't even exist in standard
kernels.  Nor should it be done in the perfmon code if it did exist in
the stock kernel.

> Index: perfmon/perfmon_sysfs.c
> ===================================================================
> --- perfmon/perfmon_sysfs.c	(.../perfmon2-post-sf-pre-fixup)	(revision 27882)
> +++ perfmon/perfmon_sysfs.c	(.../perfmon2-post-sf-post-fixup)	(revision 27882)
> @@ -79,6 +79,10 @@
>  
>  static struct kobject pfm_kernel_kobj, pfm_kernel_fmt_kobj;
>  
> +/* Remove this after mips get topology.c files */

Why should there be one?  I guess you were looking for topology_init
which exists since Febuary 20 / linux-2.6.16-rc5 and does register all
CPUs.

> +struct cpu sysfs_cpus[NR_CPUS];
> +
>  static void pfm_reset_stats(int cpu)
>  {
>  	struct pfm_stats *st;
> @@ -400,6 +404,19 @@
>  	int done_kobj_fmt = 0, done_kobj_kernel = 0;
>  	int i, cpu = -1;
>  	
> +	/* This is a hack to be removed */
> +
> +        for_each_present_cpu(i) {
> +          ret = register_cpu(&sysfs_cpus[i],i,NULL);
> +          if (ret)
> +            {
> +              PFM_INFO("cannot register cpu %d: %d\n",i,ret);
> +              goto error;
> +            }
> +        }
> +
> +	/* End hack */

Formatting style, see Documentation/CodingStyle.

  Ralf

From mucci@cs.utk.edu Tue Nov 28 19:05:28 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 28 Nov 2006 19:05:34 +0000 (GMT)
Received: from ka.cs.utk.edu ([160.36.56.221]:47032 "EHLO ka.cs.utk.edu")
	by ftp.linux-mips.org with ESMTP id S20040229AbWK1TF2 (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Tue, 28 Nov 2006 19:05:28 +0000
Received: from localhost (localhost [127.0.0.1])
	by ka.cs.utk.edu (Postfix) with ESMTP id D903C2F291;
	Tue, 28 Nov 2006 14:05:16 -0500 (EST)
X-Virus-Scanned: by amavisd-new with ClamAV and SpamAssasin at cs.utk.edu
Received: from ka.cs.utk.edu ([127.0.0.1])
	by localhost (ka.cs.utk.edu [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id O74EQyG4h4ob; Tue, 28 Nov 2006 14:05:07 -0500 (EST)
Received: from [192.168.1.9] (213-66-54-131-o837.telia.com [213.66.54.131])
	by ka.cs.utk.edu (Postfix) with ESMTP id 83D1E2F22E;
	Tue, 28 Nov 2006 14:05:06 -0500 (EST)
Subject: Re: [Perfctr-devel] 2.6.19-rc6-git10 new perfmon code base +
	libpfm + pfmon
From:	"Philip J. Mucci" <mucci@cs.utk.edu>
To:	Ralf Baechle <ralf@linux-mips.org>
Cc:	eranian@hpl.hp.com, perfmon@napali.hpl.hp.com,
	linux-mips@linux-mips.org
In-Reply-To: <20061128182049.GA19304@linux-mips.org>
References: <20061127143705.GC24980@frankl.hpl.hp.com>
	 <1164725427.2316.109.camel@localhost.localdomain>
	 <20061128182049.GA19304@linux-mips.org>
Content-Type: text/plain
Date:	Tue, 28 Nov 2006 20:05:02 +0100
Message-Id: <1164740702.2316.151.camel@localhost.localdomain>
Mime-Version: 1.0
X-Mailer: Evolution 2.6.3 (2.6.3-1.fc5.5) 
Content-Transfer-Encoding: 7bit
Return-Path: <mucci@cs.utk.edu>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13269
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: mucci@cs.utk.edu
Precedence: bulk
X-list: linux-mips

Hi Ralf,

Forgive me, I thought Stefane had posted the announcement of the new
perfmon kernel substrate on Linux/MIPS list. I see now that he did not,
so it's likely that the below patch has little meaning to you folks. I
do know however, that there are some broadcom folks tracking this work.

This is not meant to be a patch for the Linux/MIPS tree, but rather the
perfmon2 patch when applied to Linus' latest GIT tree. This hack (marked
as such) gets around a NULL pointer dereference upon boot. I make no
claims other than that it lets the MIPS folks play with the perfmon2
implementation.

Phil

On Tue, 2006-11-28 at 18:20 +0000, Ralf Baechle wrote:
> On Tue, Nov 28, 2006 at 03:50:27PM +0100, Philip J. Mucci wrote:
> 
> > Linux-MIPS users will need the following patch to add the 'cpu'
> > directories to sysfs.
> 
> This patch is to some file which doesn't even exist in standard
> kernels.  Nor should it be done in the perfmon code if it did exist in
> the stock kernel.
> 
> > Index: perfmon/perfmon_sysfs.c
> > ===================================================================
> > --- perfmon/perfmon_sysfs.c	(.../perfmon2-post-sf-pre-fixup)	(revision 27882)
> > +++ perfmon/perfmon_sysfs.c	(.../perfmon2-post-sf-post-fixup)	(revision 27882)
> > @@ -79,6 +79,10 @@
> >  
> >  static struct kobject pfm_kernel_kobj, pfm_kernel_fmt_kobj;
> >  
> > +/* Remove this after mips get topology.c files */
> 
> Why should there be one?  I guess you were looking for topology_init
> which exists since Febuary 20 / linux-2.6.16-rc5 and does register all
> CPUs.
> 
> > +struct cpu sysfs_cpus[NR_CPUS];
> > +
> >  static void pfm_reset_stats(int cpu)
> >  {
> >  	struct pfm_stats *st;
> > @@ -400,6 +404,19 @@
> >  	int done_kobj_fmt = 0, done_kobj_kernel = 0;
> >  	int i, cpu = -1;
> >  	
> > +	/* This is a hack to be removed */
> > +
> > +        for_each_present_cpu(i) {
> > +          ret = register_cpu(&sysfs_cpus[i],i,NULL);
> > +          if (ret)
> > +            {
> > +              PFM_INFO("cannot register cpu %d: %d\n",i,ret);
> > +              goto error;
> > +            }
> > +        }
> > +
> > +	/* End hack */
> 
> Formatting style, see Documentation/CodingStyle.
> 
>   Ralf


From ralf@linux-mips.org Wed Nov 29 16:04:50 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 29 Nov 2006 16:04:52 +0000 (GMT)
Received: from localhost.localdomain ([127.0.0.1]:29379 "EHLO
	dl5rb.ham-radio-op.net") by ftp.linux-mips.org with ESMTP
	id S20040307AbWK2QEu (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 29 Nov 2006 16:04:50 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by dl5rb.ham-radio-op.net (8.13.8/8.13.8) with ESMTP id kATG4iLJ015289;
	Wed, 29 Nov 2006 16:04:44 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.8/8.13.8/Submit) id kATG4ZEW015283;
	Wed, 29 Nov 2006 16:04:35 GMT
Date:	Wed, 29 Nov 2006 16:04:35 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	"Philip J. Mucci" <mucci@cs.utk.edu>
Cc:	eranian@hpl.hp.com, perfmon@napali.hpl.hp.com,
	linux-mips@linux-mips.org
Subject: Re: [Perfctr-devel] 2.6.19-rc6-git10 new perfmon code base + libpfm + pfmon
Message-ID: <20061129160434.GA15230@linux-mips.org>
References: <20061127143705.GC24980@frankl.hpl.hp.com> <1164725427.2316.109.camel@localhost.localdomain> <20061128182049.GA19304@linux-mips.org> <1164740702.2316.151.camel@localhost.localdomain>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <1164740702.2316.151.camel@localhost.localdomain>
User-Agent: Mutt/1.4.2.2i
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13270
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: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Tue, Nov 28, 2006 at 08:05:02PM +0100, Philip J. Mucci wrote:

> Forgive me, I thought Stefane had posted the announcement of the new
> perfmon kernel substrate on Linux/MIPS list. I see now that he did not,
> so it's likely that the below patch has little meaning to you folks. I
> do know however, that there are some broadcom folks tracking this work.
> 
> This is not meant to be a patch for the Linux/MIPS tree, but rather the
> perfmon2 patch when applied to Linus' latest GIT tree. This hack (marked
> as such) gets around a NULL pointer dereference upon boot. I make no
> claims other than that it lets the MIPS folks play with the perfmon2
> implementation.

So following our private mail exchange I've checked in below fix.

  Ralf

commit 83eee867cf914c968933e8bc3acf7a3fe58ceaed
Author: Ralf Baechle <ralf@linux-mips.org>
Date:   Wed Nov 29 15:04:08 2006 +0000

[MIPS] Do topology_init even on uniprocessor kernels.

Otherwise CPU 0 doesn't show up in sysfs which breaks some software.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
index cd9cec9..6bfbbed 100644
--- a/arch/mips/kernel/Makefile
+++ b/arch/mips/kernel/Makefile
@@ -6,7 +6,7 @@ extra-y		:= head.o init_task.o vmlinux.l
 
 obj-y		+= cpu-probe.o branch.o entry.o genex.o irq.o process.o \
 		   ptrace.o reset.o semaphore.o setup.o signal.o syscall.o \
-		   time.o traps.o unaligned.o
+		   time.o topology.o traps.o unaligned.o
 
 binfmt_irix-objs	:= irixelf.o irixinv.o irixioctl.o irixsig.o	\
 			   irix5sys.o sysirix.o
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index db80957..49db516 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -463,28 +463,5 @@ void flush_tlb_one(unsigned long vaddr)
 	smp_on_each_tlb(flush_tlb_one_ipi, (void *) vaddr);
 }
 
-static DEFINE_PER_CPU(struct cpu, cpu_devices);
-
-static int __init topology_init(void)
-{
-	int i, ret;
-
-#ifdef CONFIG_NUMA
-	for_each_online_node(i)
-		register_one_node(i);
-#endif /* CONFIG_NUMA */
-
-	for_each_present_cpu(i) {
-		ret = register_cpu(&per_cpu(cpu_devices, i), i);
-		if (ret)
-			printk(KERN_WARNING "topology_init: register_cpu %d "
-			       "failed (%d)\n", i, ret);
-	}
-
-	return 0;
-}
-
-subsys_initcall(topology_init);
-
 EXPORT_SYMBOL(flush_tlb_page);
 EXPORT_SYMBOL(flush_tlb_one);
diff --git a/arch/mips/kernel/topology.c b/arch/mips/kernel/topology.c
new file mode 100644
index 0000000..660e44e
--- /dev/null
+++ b/arch/mips/kernel/topology.c
@@ -0,0 +1,29 @@
+#include <linux/cpu.h>
+#include <linux/cpumask.h>
+#include <linux/init.h>
+#include <linux/node.h>
+#include <linux/nodemask.h>
+#include <linux/percpu.h>
+
+static DEFINE_PER_CPU(struct cpu, cpu_devices);
+
+static int __init topology_init(void)
+{
+	int i, ret;
+
+#ifdef CONFIG_NUMA
+	for_each_online_node(i)
+		register_one_node(i);
+#endif /* CONFIG_NUMA */
+
+	for_each_present_cpu(i) {
+		ret = register_cpu(&per_cpu(cpu_devices, i), i);
+		if (ret)
+			printk(KERN_WARNING "topology_init: register_cpu %d "
+			       "failed (%d)\n", i, ret);
+	}
+
+	return 0;
+}
+
+subsys_initcall(topology_init);

From m.kozlowski@tuxland.pl Wed Nov 29 19:31:14 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 29 Nov 2006 19:31:19 +0000 (GMT)
Received: from xdsl-664.zgora.dialog.net.pl ([81.168.226.152]:45072 "EHLO
	tuxland.pl") by ftp.linux-mips.org with ESMTP id S20027650AbWK2TbO
	(ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 29 Nov 2006 19:31:14 +0000
Received: from [192.168.1.3] (xdsl-664.zgora.dialog.net.pl [81.168.226.152])
	by tuxland.pl (Postfix) with ESMTP id 1701C6EE9A;
	Wed, 29 Nov 2006 20:30:58 +0100 (CET)
Received: from [192.168.1.3] ([192.168.1.3])
	by tuxland.pl (AISK); Wed, 29 Nov 2006 20:30:57 +0100 (CET)
From:	Mariusz Kozlowski <m.kozlowski@tuxland.pl>
To:	ralf@linux-mips.org
Subject: [PATCH] mips tx4927 missing brace fix
Date:	Wed, 29 Nov 2006 20:30:35 +0100
User-Agent: KMail/1.9.5
Cc:	linux-mips@linux-mips.org, linux-kernel@vger.kernel.org
MIME-Version: 1.0
Content-Type: text/plain;
  charset="iso-8859-2"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200611292030.36170.m.kozlowski@tuxland.pl>
Return-Path: <m.kozlowski@tuxland.pl>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13271
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: m.kozlowski@tuxland.pl
Precedence: bulk
X-list: linux-mips

Hello,

	This patch adds missing brace at the end of toshiba_rbtx4927_irq_isa_init().

Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>

 arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-2.6.19-rc6-mm2-a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c	2006-11-28 12:16:25.000000000 +0100
+++ linux-2.6.19-rc6-mm2-b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c	2006-11-29 16:07:11.000000000 +0100
@@ -433,7 +433,7 @@ static void __init toshiba_rbtx4927_irq_
 	/* make sure we are looking at IRR (not ISR) */
 	outb(0x0A, 0x20);
 	outb(0x0A, 0xA0);
-
+}
 #endif
 
 


-- 
Regards,

	Mariusz Kozlowski

From ralf@linux-mips.org Wed Nov 29 19:43:51 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 29 Nov 2006 19:43:53 +0000 (GMT)
Received: from localhost.localdomain ([127.0.0.1]:54994 "EHLO
	dl5rb.ham-radio-op.net") by ftp.linux-mips.org with ESMTP
	id S20027689AbWK2Tnv (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 29 Nov 2006 19:43:51 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by dl5rb.ham-radio-op.net (8.13.8/8.13.8) with ESMTP id kATJhkDC027446;
	Wed, 29 Nov 2006 19:43:46 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.8/8.13.8/Submit) id kATJhkC8027445;
	Wed, 29 Nov 2006 19:43:46 GMT
Date:	Wed, 29 Nov 2006 19:43:46 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	Mariusz Kozlowski <m.kozlowski@tuxland.pl>
Cc:	linux-mips@linux-mips.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mips tx4927 missing brace fix
Message-ID: <20061129194346.GA20892@linux-mips.org>
References: <200611292030.36170.m.kozlowski@tuxland.pl>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <200611292030.36170.m.kozlowski@tuxland.pl>
User-Agent: Mutt/1.4.2.2i
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13272
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: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Wed, Nov 29, 2006 at 08:30:35PM +0100, Mariusz Kozlowski wrote:

> 	This patch adds missing brace at the end of toshiba_rbtx4927_irq_isa_init().

Thanks Mariusz!  Applied,

  Ralf

From anemo@mba.ocn.ne.jp Thu Nov 30 00:56:51 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 30 Nov 2006 00:56:55 +0000 (GMT)
Received: from topsns2.toshiba-tops.co.jp ([202.230.225.126]:28275 "EHLO
	topsns2.toshiba-tops.co.jp") by ftp.linux-mips.org with ESMTP
	id S20037517AbWK3A4v (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Thu, 30 Nov 2006 00:56:51 +0000
Received: from topsms.toshiba-tops.co.jp by topsns2.toshiba-tops.co.jp
          via smtpd (for ftp.linux-mips.org [194.74.144.162]) with ESMTP; Thu, 30 Nov 2006 09:56:49 +0900
Received: from topsms.toshiba-tops.co.jp (localhost.localdomain [127.0.0.1])
	by localhost.toshiba-tops.co.jp (Postfix) with ESMTP id 370F223ED1;
	Thu, 30 Nov 2006 09:56:46 +0900 (JST)
Received: from srd2sd.toshiba-tops.co.jp (srd2sd.toshiba-tops.co.jp [172.17.28.2])
	by topsms.toshiba-tops.co.jp (Postfix) with ESMTP id 22BF820846;
	Thu, 30 Nov 2006 09:56:46 +0900 (JST)
Received: from localhost (fragile [172.17.28.65])
	by srd2sd.toshiba-tops.co.jp (8.12.10/8.12.10) with ESMTP id kAU0uhW0057256;
	Thu, 30 Nov 2006 09:56:44 +0900 (JST)
	(envelope-from anemo@mba.ocn.ne.jp)
Date:	Thu, 30 Nov 2006 09:56:43 +0900 (JST)
Message-Id: <20061130.095643.74752511.nemoto@toshiba-tops.co.jp>
To:	ralf@linux-mips.org
Cc:	m.kozlowski@tuxland.pl, linux-mips@linux-mips.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mips tx4927 missing brace fix
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
In-Reply-To: <20061129194346.GA20892@linux-mips.org>
References: <200611292030.36170.m.kozlowski@tuxland.pl>
	<20061129194346.GA20892@linux-mips.org>
X-Fingerprint: 6ACA 1623 39BD 9A94 9B1A  B746 CA77 FE94 2874 D52F
X-Pgp-Public-Key: http://wwwkeys.pgp.net/pks/lookup?op=get&search=0x2874D52F
X-Mailer: Mew version 3.3 on Emacs 21.3 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Return-Path: <anemo@mba.ocn.ne.jp>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13273
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: anemo@mba.ocn.ne.jp
Precedence: bulk
X-list: linux-mips

On Wed, 29 Nov 2006 19:43:46 +0000, Ralf Baechle <ralf@linux-mips.org> wrote:
> On Wed, Nov 29, 2006 at 08:30:35PM +0100, Mariusz Kozlowski wrote:
> 
> > 	This patch adds missing brace at the end of toshiba_rbtx4927_irq_isa_init().
> 
> Thanks Mariusz!  Applied,

Oh, that was my fault.  Thank you.  I see the fix was folded into
linux-queue tree.  Thanks.

---
Atsushi Nemoto

From ralf@linux-mips.org Thu Nov 30 01:06:43 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 30 Nov 2006 01:06:45 +0000 (GMT)
Received: from localhost.localdomain ([127.0.0.1]:63642 "EHLO
	dl5rb.ham-radio-op.net") by ftp.linux-mips.org with ESMTP
	id S20037528AbWK3BGn (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Thu, 30 Nov 2006 01:06:43 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by dl5rb.ham-radio-op.net (8.13.8/8.13.8) with ESMTP id kAU15JF8022010;
	Thu, 30 Nov 2006 01:05:19 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.8/8.13.8/Submit) id kAU15GRO022009;
	Thu, 30 Nov 2006 01:05:16 GMT
Date:	Thu, 30 Nov 2006 01:05:16 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc:	m.kozlowski@tuxland.pl, linux-mips@linux-mips.org
Subject: Re: [PATCH] mips tx4927 missing brace fix
Message-ID: <20061130010516.GA17608@linux-mips.org>
References: <200611292030.36170.m.kozlowski@tuxland.pl> <20061129194346.GA20892@linux-mips.org> <20061130.095643.74752511.nemoto@toshiba-tops.co.jp>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20061130.095643.74752511.nemoto@toshiba-tops.co.jp>
User-Agent: Mutt/1.4.2.2i
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13274
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: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Thu, Nov 30, 2006 at 09:56:43AM +0900, Atsushi Nemoto wrote:

> > Thanks Mariusz!  Applied,
> 
> Oh, that was my fault.  Thank you.  I see the fix was folded into
> linux-queue tree.  Thanks.

Yes, that's what I usually do with fixes that reach me before the
patches have actually been applied to the tree.  There was another
thing which broke the Malta build and I'm building a few more kernels.

And for those who still haven't noticed, 2.6.19 is out, so the race for
2.6.20 has begun.  Send patches!

  Ralf

From m.kozlowski@tuxland.pl Thu Nov 30 09:17:07 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 30 Nov 2006 09:17:11 +0000 (GMT)
Received: from xdsl-664.zgora.dialog.net.pl ([81.168.226.152]:7182 "EHLO
	tuxland.pl") by ftp.linux-mips.org with ESMTP id S20037612AbWK3JRH
	(ORCPT <rfc822;linux-mips@linux-mips.org>);
	Thu, 30 Nov 2006 09:17:07 +0000
Received: from [192.168.1.3] (xdsl-664.zgora.dialog.net.pl [81.168.226.152])
	by tuxland.pl (Postfix) with ESMTP id 81CCF6EE9A;
	Thu, 30 Nov 2006 10:16:48 +0100 (CET)
Received: from [192.168.1.3] ([192.168.1.3])
	by tuxland.pl (AISK); Thu, 30 Nov 2006 10:16:47 +0100 (CET)
From:	Mariusz Kozlowski <m.kozlowski@tuxland.pl>
To:	ralf@linux-mips.org
Subject: [PATCH] mips: klconfig add missing bracket
Date:	Thu, 30 Nov 2006 10:16:29 +0100
User-Agent: KMail/1.9.5
Cc:	linux-mips@linux-mips.org, linux-kernel@vger.kernel.org
MIME-Version: 1.0
Content-Type: text/plain;
  charset="iso-8859-2"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200611301016.29505.m.kozlowski@tuxland.pl>
Return-Path: <m.kozlowski@tuxland.pl>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13275
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: m.kozlowski@tuxland.pl
Precedence: bulk
X-list: linux-mips

Hello,

	This patch adds missing bracket.

 include/asm-mips/sn/klconfig.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-2.6.19-rc6-mm2-a/include/asm-mips/sn/klconfig.h	2006-11-16 05:03:40.000000000 +0100
+++ linux-2.6.19-rc6-mm2-b/include/asm-mips/sn/klconfig.h	2006-11-30 00:58:32.000000000 +0100
@@ -176,7 +176,7 @@ typedef struct kl_config_hdr {
 /* --- New Macros for the changed kl_config_hdr_t structure --- */
 
 #define PTR_CH_MALLOC_HDR(_k)   ((klc_malloc_hdr_t *)\
-			(unsigned long)_k + (_k->ch_malloc_hdr_off)))
+			((unsigned long)_k + (_k->ch_malloc_hdr_off)))
 
 #define KL_CONFIG_CH_MALLOC_HDR(_n)   PTR_CH_MALLOC_HDR(KL_CONFIG_HDR(_n))
 


-- 
Regards,

	Mariusz Kozlowski

From ralf@linux-mips.org Thu Nov 30 11:59:47 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 30 Nov 2006 11:59:48 +0000 (GMT)
Received: from localhost.localdomain ([127.0.0.1]:21453 "EHLO
	dl5rb.ham-radio-op.net") by ftp.linux-mips.org with ESMTP
	id S20037631AbWK3L7r (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Thu, 30 Nov 2006 11:59:47 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by dl5rb.ham-radio-op.net (8.13.8/8.13.8) with ESMTP id kAUBxj0K009771;
	Thu, 30 Nov 2006 11:59:45 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.8/8.13.8/Submit) id kAUBxisk009770;
	Thu, 30 Nov 2006 11:59:44 GMT
Date:	Thu, 30 Nov 2006 11:59:44 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	Mariusz Kozlowski <m.kozlowski@tuxland.pl>
Cc:	linux-mips@linux-mips.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mips: klconfig add missing bracket
Message-ID: <20061130115944.GA9564@linux-mips.org>
References: <200611301016.29505.m.kozlowski@tuxland.pl>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <200611301016.29505.m.kozlowski@tuxland.pl>
User-Agent: Mutt/1.4.2.2i
Return-Path: <ralf@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13276
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: ralf@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Thu, Nov 30, 2006 at 10:16:29AM +0100, Mariusz Kozlowski wrote:

The patch is ok but please add a Signed-off-by: line to every patch you
send, See Documentation/SubmittingPatches for what this is about.

  Ralf

From m.kozlowski@tuxland.pl Thu Nov 30 12:06:22 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 30 Nov 2006 12:06:26 +0000 (GMT)
Received: from xdsl-664.zgora.dialog.net.pl ([81.168.226.152]:15118 "EHLO
	tuxland.pl") by ftp.linux-mips.org with ESMTP id S20037631AbWK3MGW
	(ORCPT <rfc822;linux-mips@linux-mips.org>);
	Thu, 30 Nov 2006 12:06:22 +0000
Received: from [192.168.1.3] (xdsl-664.zgora.dialog.net.pl [81.168.226.152])
	by tuxland.pl (Postfix) with ESMTP id DE6996EE9A;
	Thu, 30 Nov 2006 13:06:07 +0100 (CET)
Received: from [192.168.1.3] ([192.168.1.3])
	by tuxland.pl (AISK); Thu, 30 Nov 2006 13:06:07 +0100 (CET)
From:	Mariusz Kozlowski <m.kozlowski@tuxland.pl>
To:	Ralf Baechle <ralf@linux-mips.org>
Subject: Re: [PATCH] mips: klconfig add missing bracket
Date:	Thu, 30 Nov 2006 13:05:48 +0100
User-Agent: KMail/1.9.5
Cc:	linux-mips@linux-mips.org, linux-kernel@vger.kernel.org
References: <200611301016.29505.m.kozlowski@tuxland.pl> <20061130115944.GA9564@linux-mips.org>
In-Reply-To: <20061130115944.GA9564@linux-mips.org>
MIME-Version: 1.0
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200611301305.49442.m.kozlowski@tuxland.pl>
Return-Path: <m.kozlowski@tuxland.pl>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13277
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: m.kozlowski@tuxland.pl
Precedence: bulk
X-list: linux-mips

> The patch is ok but please add a Signed-off-by: line to every patch you
> send, See Documentation/SubmittingPatches for what this is about.

Right. Must have ovelooked that. Second try:

	This patch adds missing bracket.

Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>

 include/asm-mips/sn/klconfig.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-2.6.19-rc6-mm2-a/include/asm-mips/sn/klconfig.h	2006-11-16 05:03:40.000000000 +0100
+++ linux-2.6.19-rc6-mm2-b/include/asm-mips/sn/klconfig.h	2006-11-30 00:58:32.000000000 +0100
@@ -176,7 +176,7 @@ typedef struct kl_config_hdr {
 /* --- New Macros for the changed kl_config_hdr_t structure --- */
 
 #define PTR_CH_MALLOC_HDR(_k)   ((klc_malloc_hdr_t *)\
-			(unsigned long)_k + (_k->ch_malloc_hdr_off)))
+			((unsigned long)_k + (_k->ch_malloc_hdr_off)))
 
 #define KL_CONFIG_CH_MALLOC_HDR(_n)   PTR_CH_MALLOC_HDR(KL_CONFIG_HDR(_n))
 


-- 
Regards,

	Mariusz Kozlowski

From macro@linux-mips.org Thu Nov 30 13:06:24 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 30 Nov 2006 13:06:30 +0000 (GMT)
Received: from pollux.ds.pg.gda.pl ([153.19.208.7]:13318 "EHLO
	pollux.ds.pg.gda.pl") by ftp.linux-mips.org with ESMTP
	id S20037693AbWK3NGY (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Thu, 30 Nov 2006 13:06:24 +0000
Received: from localhost (localhost [127.0.0.1])
	by pollux.ds.pg.gda.pl (Postfix) with ESMTP id 544DCE1C9C;
	Thu, 30 Nov 2006 14:06:11 +0100 (CET)
X-Virus-Scanned: by amavisd-new at pollux.ds.pg.gda.pl
Received: from pollux.ds.pg.gda.pl ([127.0.0.1])
	by localhost (pollux.ds.pg.gda.pl [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id tRPpp4yz8kqj; Thu, 30 Nov 2006 14:06:10 +0100 (CET)
Received: from piorun.ds.pg.gda.pl (piorun.ds.pg.gda.pl [153.19.208.8])
	by pollux.ds.pg.gda.pl (Postfix) with ESMTP id 99FADE1C61;
	Thu, 30 Nov 2006 14:06:10 +0100 (CET)
Received: from blysk.ds.pg.gda.pl (macro@blysk.ds.pg.gda.pl [153.19.208.6])
	by piorun.ds.pg.gda.pl (8.13.8/8.13.8) with ESMTP id kAUD6ItH009407;
	Thu, 30 Nov 2006 14:06:18 +0100
Date:	Thu, 30 Nov 2006 13:06:15 +0000 (GMT)
From:	"Maciej W. Rozycki" <macro@linux-mips.org>
To:	Andrew Morton <akpm@osdl.org>, Jeff Garzik <jgarzik@pobox.com>
cc:	netdev@vger.kernel.org, linux-mips@linux-mips.org
Subject: [PATCH 2.6.18] declance: Fix RX ownership handover
Message-ID: <Pine.LNX.4.64N.0611301257300.1757@blysk.ds.pg.gda.pl>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Virus-Scanned: ClamAV 0.88.6/2263/Thu Nov 30 07:51:08 2006 on piorun.ds.pg.gda.pl
X-Virus-Status:	Clean
Return-Path: <macro@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13278
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: macro@linux-mips.org
Precedence: bulk
X-list: linux-mips

 The change for PMAD support introduced a bug, where the ownership of RX 
descriptors was given back to the LANCE in the wrong way.  Occasional 
lockups would happen as a result.  This is a fix for this problem.

Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
---
 Tested with the onboard LANCE of a DECstation 5000/133.

 Please apply.

  Maciej

patch-mips-2.6.18-20060920-pmax-lance-rx-fix-0
diff -up --recursive --new-file linux-mips-2.6.18-20060920.macro/drivers/net/declance.c linux-mips-2.6.18-20060920/drivers/net/declance.c
--- linux-mips-2.6.18-20060920.macro/drivers/net/declance.c	2006-11-23 02:55:34.000000000 +0000
+++ linux-mips-2.6.18-20060920/drivers/net/declance.c	2006-11-30 02:26:34.000000000 +0000
@@ -628,7 +628,6 @@ static int lance_rx(struct net_device *d
 		/* Return the packet to the pool */
 		*rds_ptr(rd, mblength, lp->type) = 0;
 		*rds_ptr(rd, length, lp->type) = -RX_BUFF_SIZE | 0xf000;
-		*rds_ptr(rd, rmd1, lp->type) = LE_R1_OWN;
 		*rds_ptr(rd, rmd1, lp->type) =
 			((lp->rx_buf_ptr_lnc[entry] >> 16) & 0xff) | LE_R1_OWN;
 		lp->rx_new = (entry + 1) & RX_RING_MOD_MASK;

From macro@linux-mips.org Thu Nov 30 13:15:13 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 30 Nov 2006 13:15:21 +0000 (GMT)
Received: from pollux.ds.pg.gda.pl ([153.19.208.7]:41481 "EHLO
	pollux.ds.pg.gda.pl") by ftp.linux-mips.org with ESMTP
	id S20037670AbWK3NPN (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Thu, 30 Nov 2006 13:15:13 +0000
Received: from localhost (localhost [127.0.0.1])
	by pollux.ds.pg.gda.pl (Postfix) with ESMTP id A82F7F5946;
	Thu, 30 Nov 2006 14:14:59 +0100 (CET)
X-Virus-Scanned: by amavisd-new at pollux.ds.pg.gda.pl
Received: from pollux.ds.pg.gda.pl ([127.0.0.1])
	by localhost (pollux.ds.pg.gda.pl [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id G82bNkTXLVEX; Thu, 30 Nov 2006 14:14:59 +0100 (CET)
Received: from piorun.ds.pg.gda.pl (piorun.ds.pg.gda.pl [153.19.208.8])
	by pollux.ds.pg.gda.pl (Postfix) with ESMTP id 660E6E1C61;
	Thu, 30 Nov 2006 14:14:59 +0100 (CET)
Received: from blysk.ds.pg.gda.pl (macro@blysk.ds.pg.gda.pl [153.19.208.6])
	by piorun.ds.pg.gda.pl (8.13.8/8.13.8) with ESMTP id kAUDF84R012388;
	Thu, 30 Nov 2006 14:15:08 +0100
Date:	Thu, 30 Nov 2006 13:15:05 +0000 (GMT)
From:	"Maciej W. Rozycki" <macro@linux-mips.org>
To:	Andrew Morton <akpm@osdl.org>, Jeff Garzik <jgarzik@pobox.com>
cc:	netdev@vger.kernel.org, linux-mips@linux-mips.org
Subject: [PATCH 2.6.18] declance: Support the I/O ASIC LANCE w/o TURBOchannel
Message-ID: <Pine.LNX.4.64N.0611301306460.1757@blysk.ds.pg.gda.pl>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Virus-Scanned: ClamAV 0.88.6/2263/Thu Nov 30 07:51:08 2006 on piorun.ds.pg.gda.pl
X-Virus-Status:	Clean
Return-Path: <macro@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13279
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: macro@linux-mips.org
Precedence: bulk
X-list: linux-mips

 The onboard LANCE of I/O ASIC systems is not a TURBOchannel device, at 
least from the software point of view.  Therefore it does not rely on any 
kernel TURBOchannel bus services and can be supported even if support for 
TURBOchannel has not been enabled in the configuration.

Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
---
 Tested with the onboard LANCE of a DECstation 5000/133.

 Please apply.

  Maciej

patch-mips-2.6.18-20060920-declance-tc-0
diff -up --recursive --new-file linux-mips-2.6.18-20060920.macro/drivers/net/declance.c linux-mips-2.6.18-20060920/drivers/net/declance.c
--- linux-mips-2.6.18-20060920.macro/drivers/net/declance.c	2006-11-23 02:55:34.000000000 +0000
+++ linux-mips-2.6.18-20060920/drivers/net/declance.c	2006-11-30 02:31:19.000000000 +0000
@@ -1068,7 +1068,6 @@ static int __init dec_lance_init(const i
 	lp->type = type;
 	lp->slot = slot;
 	switch (type) {
-#ifdef CONFIG_TC
 	case ASIC_LANCE:
 		dev->base_addr = CKSEG1ADDR(dec_kn_slot_base + IOASIC_LANCE);
 
@@ -1112,7 +1111,7 @@ static int __init dec_lance_init(const i
 			     CPHYSADDR(dev->mem_start) << 3);
 
 		break;
-
+#ifdef CONFIG_TC
 	case PMAD_LANCE:
 		claim_tc_card(slot);
 
@@ -1143,7 +1142,6 @@ static int __init dec_lance_init(const i
 
 		break;
 #endif
-
 	case PMAX_LANCE:
 		dev->irq = dec_interrupt[DEC_IRQ_LANCE];
 		dev->base_addr = CKSEG1ADDR(KN01_SLOT_BASE + KN01_LANCE);
@@ -1298,10 +1296,8 @@ static int __init dec_lance_probe(void)
 	/* Then handle onboard devices. */
 	if (dec_interrupt[DEC_IRQ_LANCE] >= 0) {
 		if (dec_interrupt[DEC_IRQ_LANCE_MERR] >= 0) {
-#ifdef CONFIG_TC
 			if (dec_lance_init(ASIC_LANCE, -1) >= 0)
 				count++;
-#endif
 		} else if (!TURBOCHANNEL) {
 			if (dec_lance_init(PMAX_LANCE, -1) >= 0)
 				count++;

From macro@linux-mips.org Thu Nov 30 18:07:53 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 30 Nov 2006 18:07:58 +0000 (GMT)
Received: from pollux.ds.pg.gda.pl ([153.19.208.7]:4102 "EHLO
	pollux.ds.pg.gda.pl") by ftp.linux-mips.org with ESMTP
	id S20037721AbWK3SHx (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Thu, 30 Nov 2006 18:07:53 +0000
Received: from localhost (localhost [127.0.0.1])
	by pollux.ds.pg.gda.pl (Postfix) with ESMTP id 86771F5968;
	Thu, 30 Nov 2006 19:07:36 +0100 (CET)
X-Virus-Scanned: by amavisd-new at pollux.ds.pg.gda.pl
Received: from pollux.ds.pg.gda.pl ([127.0.0.1])
	by localhost (pollux.ds.pg.gda.pl [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id 3i5UWlCnytpy; Thu, 30 Nov 2006 19:07:36 +0100 (CET)
Received: from piorun.ds.pg.gda.pl (piorun.ds.pg.gda.pl [153.19.208.8])
	by pollux.ds.pg.gda.pl (Postfix) with ESMTP id 1B94DF5946;
	Thu, 30 Nov 2006 19:07:36 +0100 (CET)
Received: from blysk.ds.pg.gda.pl (macro@blysk.ds.pg.gda.pl [153.19.208.6])
	by piorun.ds.pg.gda.pl (8.13.8/8.13.8) with ESMTP id kAUI7nG2001218;
	Thu, 30 Nov 2006 19:07:49 +0100
Date:	Thu, 30 Nov 2006 18:07:45 +0000 (GMT)
From:	"Maciej W. Rozycki" <macro@linux-mips.org>
To:	Andy Fleming <afleming@freescale.com>
cc:	Andrew Morton <akpm@osdl.org>, Jeff Garzik <jgarzik@pobox.com>,
	Ralf Baechle <ralf@linux-mips.org>, netdev@vger.kernel.org,
	linux-mips@linux-mips.org
Subject: Re: [patch 3/6] 2.6.18: sb1250-mac: Phylib IRQ handling fixes
In-Reply-To: <Pine.LNX.4.64N.0610231752440.4426@blysk.ds.pg.gda.pl>
Message-ID: <Pine.LNX.4.64N.0611301757200.1757@blysk.ds.pg.gda.pl>
References: <Pine.LNX.4.64N.0610031509380.4642@blysk.ds.pg.gda.pl>
 <E2ACBAE3-B0E1-4D90-BF25-6981543090C4@freescale.com>
 <Pine.LNX.4.64N.0610231752440.4426@blysk.ds.pg.gda.pl>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Virus-Scanned: ClamAV 0.88.6/2263/Thu Nov 30 07:51:08 2006 on piorun.ds.pg.gda.pl
X-Virus-Status:	Clean
Return-Path: <macro@linux-mips.org>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@linux-mips.org
Original-Recipient: rfc822;linux-mips@linux-mips.org
X-archive-position: 13280
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: macro@linux-mips.org
Precedence: bulk
X-list: linux-mips

On Mon, 23 Oct 2006, Maciej W. Rozycki wrote:

> > I'm not too enthusiastic about requiring the ethernet drivers to call
> > phy_disconnect in a separate thread after "close" is called.  Assuming there's
> > not some sort of "squash work queue" function that can be invoked with
> > rtnl_lock held, I think phy_disconnect should schedule itself to flush the
> > queue.  This would also require that mdiobus_unregister hold off on freeing
> > phydevs if any of the phys were still waiting for pending flush_pending calls
> > to finish.  Which would, in turn, require mdiobus_unregister to schedule
> > cleaning up memory for some later time.
> 
>  This could work, indeed.
> 
> > I'm not enthusiastic about that implementation, either, but it maintains the
> > abstractions I consider important for this code.  The ethernet driver should
> > not need to know what structures the PHY lib uses to implement its interrupt
> > handling, and how to work around their failings, IMHO.
> 
>  Agreed.

 So what's the plan?

 Here's a new version of the patch that addresses your other concerns.

  Maciej

patch-mips-2.6.18-20060920-phy-irq-18
diff -up --recursive --new-file linux-mips-2.6.18-20060920.macro/drivers/net/phy/phy.c linux-mips-2.6.18-20060920/drivers/net/phy/phy.c
--- linux-mips-2.6.18-20060920.macro/drivers/net/phy/phy.c	2006-08-05 04:58:46.000000000 +0000
+++ linux-mips-2.6.18-20060920/drivers/net/phy/phy.c	2006-11-30 17:58:37.000000000 +0000
@@ -7,6 +7,7 @@
  * Author: Andy Fleming
  *
  * Copyright (c) 2004 Freescale Semiconductor, Inc.
+ * Copyright (c) 2006  Maciej W. Rozycki
  *
  * This program is free software; you can redistribute  it and/or modify it
  * under  the terms of  the GNU General  Public License as published by the
@@ -32,6 +33,8 @@
 #include <linux/mii.h>
 #include <linux/ethtool.h>
 #include <linux/phy.h>
+#include <linux/timer.h>
+#include <linux/workqueue.h>
 
 #include <asm/io.h>
 #include <asm/irq.h>
@@ -484,6 +487,9 @@ static irqreturn_t phy_interrupt(int irq
 {
 	struct phy_device *phydev = phy_dat;
 
+	if (PHY_HALTED == phydev->state)
+		return IRQ_NONE;		/* It can't be ours.  */
+
 	/* The MDIO bus is not allowed to be written in interrupt
 	 * context, so we need to disable the irq here.  A work
 	 * queue will write the PHY to disable and clear the
@@ -577,6 +583,13 @@ int phy_stop_interrupts(struct phy_devic
 	if (err)
 		phy_error(phydev);
 
+	/*
+	 * Finish any pending work; we might have been scheduled
+	 * to be called from keventd ourselves, though.
+	 */
+	if (!current_is_keventd())
+		flush_scheduled_work();
+
 	free_irq(phydev->irq, phydev);
 
 	return err;
@@ -596,14 +609,17 @@ static void phy_change(void *data)
 		goto phy_err;
 
 	spin_lock(&phydev->lock);
+
 	if ((PHY_RUNNING == phydev->state) || (PHY_NOLINK == phydev->state))
 		phydev->state = PHY_CHANGELINK;
-	spin_unlock(&phydev->lock);
 
 	enable_irq(phydev->irq);
 
 	/* Reenable interrupts */
-	err = phy_config_interrupt(phydev, PHY_INTERRUPT_ENABLED);
+	if (PHY_HALTED != phydev->state)
+		err = phy_config_interrupt(phydev, PHY_INTERRUPT_ENABLED);
+
+	spin_unlock(&phydev->lock);
 
 	if (err)
 		goto irq_enable_err;
@@ -624,15 +640,15 @@ void phy_stop(struct phy_device *phydev)
 	if (PHY_HALTED == phydev->state)
 		goto out_unlock;
 
-	if (phydev->irq != PHY_POLL) {
-		/* Clear any pending interrupts */
-		phy_clear_interrupt(phydev);
+	phydev->state = PHY_HALTED;
 
+	if (phydev->irq != PHY_POLL) {
 		/* Disable PHY Interrupts */
 		phy_config_interrupt(phydev, PHY_INTERRUPT_DISABLED);
-	}
 
-	phydev->state = PHY_HALTED;
+		/* Clear any pending interrupts */
+		phy_clear_interrupt(phydev);
+	}
 
 out_unlock:
 	spin_unlock(&phydev->lock);

