From anemo@mba.ocn.ne.jp Wed Feb  1 06:26:57 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 01 Feb 2006 06:27:20 +0000 (GMT)
Received: from topsns.toshiba-tops.co.jp ([202.230.225.5]:39947 "HELO
	topsns.toshiba-tops.co.jp") by ftp.linux-mips.org with SMTP
	id S8133551AbWBAG04 (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 1 Feb 2006 06:26:56 +0000
Received: from inside-ms1.toshiba-tops.co.jp by topsns.toshiba-tops.co.jp
          via smtpd (for ftp.linux-mips.org [194.74.144.162]) with SMTP; 1 Feb 2006 06:31:58 UT
Received: from topsms.toshiba-tops.co.jp (localhost.localdomain [127.0.0.1])
	by localhost.toshiba-tops.co.jp (Postfix) with ESMTP id 908112036A;
	Wed,  1 Feb 2006 15:31: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 82B522036E;
	Wed,  1 Feb 2006 15:31: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 k116Vs4D012929;
	Wed, 1 Feb 2006 15:31:55 +0900 (JST)
	(envelope-from anemo@mba.ocn.ne.jp)
Date:	Wed, 01 Feb 2006 15:31:54 +0900 (JST)
Message-Id: <20060201.153154.108306076.nemoto@toshiba-tops.co.jp>
To:	linux-mips@linux-mips.org
Cc:	ralf@linux-mips.org
Subject: Re: [PATCH] local_r4k_flush_cache_page fix
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
In-Reply-To: <20060201.000356.25911337.anemo@mba.ocn.ne.jp>
References: <20060201.000356.25911337.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: 10263
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, 01 Feb 2006 00:03:56 +0900 (JST), Atsushi Nemoto <anemo@mba.ocn.ne.jp> said:
anemo> If dcache_size != icache_size or dcache_size != scache_size,
anemo> icache/scache does not flushed properly.  Use correct cache
anemo> size to calculate index value for scache/icache.

BTW, I wonder if current code (with or without this patch) works
properly for physically indexed cache.  Though I do not know if there
were physically indexed icache, there are certainly physically indexed
dcache (ex. MIPS 20KC).

For those physically indexed caches, we should use 'pfn' argument
passed to flush_cache_page ?

---
Atsushi Nemoto

From mita@miraclelinux.com Wed Feb  1 08:58:23 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 01 Feb 2006 08:58:42 +0000 (GMT)
Received: from ns.miraclelinux.com ([219.118.163.66]:2634 "EHLO
	mail01.miraclelinux.com") by ftp.linux-mips.org with ESMTP
	id S8133645AbWBAI6X (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 1 Feb 2006 08:58:23 +0000
Received: from mail01 (localhost.localdomain [127.0.0.1])
	by mail01.miraclelinux.com (Postfix) with ESMTP
	id 8B29F31C205; Wed,  1 Feb 2006 18:03:23 +0900 (JST)
Received: from localhost.localdomain (sshgate.miraclelinux.com [])
	by mail01.miraclelinux.com ([10.1.0.10]);
	Wed, 01 Feb 2006 09:03:23 +0000
Received: by localhost.localdomain (Postfix, from userid 1000)
	id 011884201E0; Wed,  1 Feb 2006 18:03:22 +0900 (JST)
Message-Id: <20060201090322.900876000@localhost.localdomain>
References: <20060201090224.536581000@localhost.localdomain>
Date:	Wed, 01 Feb 2006 18:02:32 +0900
From:	Akinobu Mita <mita@miraclelinux.com>
To:	linux-kernel@vger.kernel.org
Cc:	Russell King <rmk@arm.linux.org.uk>, Ian Molton <spyro@f2s.com>,
	David Howells <dhowells@redhat.com>,
	Hirokazu Takata <takata@linux-m32r.org>,
	Greg Ungerer <gerg@uclinux.org>, linux-mips@linux-mips.org,
	parisc-linux@parisc-linux.org, sparclinux@vger.kernel.org,
	ultralinux@vger.kernel.org,
	Miles Bader <uclinux-v850@lsi.nec.co.jp>,
	Akinobu Mita <mita@miraclelinux.com>
Subject: [patch 08/44] generic ffz()
Content-Disposition: inline; filename=ffz-bitops.patch
Return-Path: <mita@miraclelinux.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: 10264
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: mita@miraclelinux.com
Precedence: bulk
X-list: linux-mips

This patch introduces the C-language equivalent of the function:

unsigned long ffz(unsigned long word);

In include/asm-generic/bitops/ffz.h

This code largely copied from:
include/asm-parisc/bitops.h

Signed-off-by: Akinobu Mita <mita@miraclelinux.com>
 include/asm-generic/bitops/ffz.h |   12 ++++++++++++
 1 files changed, 12 insertions(+)

Index: 2.6-git/include/asm-generic/bitops/ffz.h
===================================================================
--- /dev/null
+++ 2.6-git/include/asm-generic/bitops/ffz.h
@@ -0,0 +1,12 @@
+#ifndef _ASM_GENERIC_BITOPS_FFZ_H_
+#define _ASM_GENERIC_BITOPS_FFZ_H_
+
+/*
+ * ffz - find first zero in word.
+ * @word: The word to search
+ *
+ * Undefined if no zero exists, so code should check against ~0UL first.
+ */
+#define ffz(x)  __ffs(~(x))
+
+#endif /* _ASM_GENERIC_BITOPS_FFZ_H_ */

--

From mita@miraclelinux.com Wed Feb  1 08:59:09 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 01 Feb 2006 08:59:42 +0000 (GMT)
Received: from ns.miraclelinux.com ([219.118.163.66]:9290 "EHLO
	mail01.miraclelinux.com") by ftp.linux-mips.org with ESMTP
	id S8133644AbWBAI6X (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 1 Feb 2006 08:58:23 +0000
Received: from mail01 (localhost.localdomain [127.0.0.1])
	by mail01.miraclelinux.com (Postfix) with ESMTP
	id 6E41131C209; Wed,  1 Feb 2006 18:03:24 +0900 (JST)
Received: from localhost.localdomain (sshgate.miraclelinux.com [])
	by mail01.miraclelinux.com ([10.1.0.10]);
	Wed, 01 Feb 2006 09:03:24 +0000
Received: by localhost.localdomain (Postfix, from userid 1000)
	id 354824201E3; Wed,  1 Feb 2006 18:03:23 +0900 (JST)
Message-Id: <20060201090323.100733000@localhost.localdomain>
References: <20060201090224.536581000@localhost.localdomain>
Date:	Wed, 01 Feb 2006 18:02:33 +0900
From:	Akinobu Mita <mita@miraclelinux.com>
To:	linux-kernel@vger.kernel.org
Cc:	Richard Henderson <rth@twiddle.net>,
	Ivan Kokshaysky <ink@jurassic.park.msu.ru>,
	Russell King <rmk@arm.linux.org.uk>,
	Ian Molton <spyro@f2s.com>, dev-etrax@axis.com,
	Yoshinori Sato <ysato@users.sourceforge.jp>,
	Hirokazu Takata <takata@linux-m32r.org>,
	Greg Ungerer <gerg@uclinux.org>, linux-mips@linux-mips.org,
	linux390@de.ibm.com, linuxsh-dev@lists.sourceforge.net,
	linuxsh-shmedia-dev@lists.sourceforge.net,
	sparclinux@vger.kernel.org, ultralinux@vger.kernel.org,
	Miles Bader <uclinux-v850@lsi.nec.co.jp>,
	Akinobu Mita <mita@miraclelinux.com>
Subject: [patch 09/44] generic fls()
Content-Disposition: inline; filename=fls-bitops.patch
Return-Path: <mita@miraclelinux.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: 10265
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: mita@miraclelinux.com
Precedence: bulk
X-list: linux-mips

This patch introduces the C-language equivalent of the function:
int fls(int x);

In include/asm-generic/bitops/fls.h

This code largely copied from:
include/linux/bitops.h

Signed-off-by: Akinobu Mita <mita@miraclelinux.com>
 include/asm-generic/bitops/fls.h |   41 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 41 insertions(+)

Index: 2.6-git/include/asm-generic/bitops/fls.h
===================================================================
--- /dev/null
+++ 2.6-git/include/asm-generic/bitops/fls.h
@@ -0,0 +1,41 @@
+#ifndef _ASM_GENERIC_BITOPS_FLS_H_
+#define _ASM_GENERIC_BITOPS_FLS_H_
+
+/**
+ * fls - find last (most-significant) bit set
+ * @x: the word to search
+ *
+ * This is defined the same way as ffs.
+ * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32.
+ */
+
+static __inline__ int fls(int x)
+{
+	int r = 32;
+
+	if (!x)
+		return 0;
+	if (!(x & 0xffff0000u)) {
+		x <<= 16;
+		r -= 16;
+	}
+	if (!(x & 0xff000000u)) {
+		x <<= 8;
+		r -= 8;
+	}
+	if (!(x & 0xf0000000u)) {
+		x <<= 4;
+		r -= 4;
+	}
+	if (!(x & 0xc0000000u)) {
+		x <<= 2;
+		r -= 2;
+	}
+	if (!(x & 0x80000000u)) {
+		x <<= 1;
+		r -= 1;
+	}
+	return r;
+}
+
+#endif /* _ASM_GENERIC_BITOPS_FLS_H_ */

--

From mita@miraclelinux.com Wed Feb  1 09:00:10 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 01 Feb 2006 09:00:42 +0000 (GMT)
Received: from ns.miraclelinux.com ([219.118.163.66]:63049 "EHLO
	mail01.miraclelinux.com") by ftp.linux-mips.org with ESMTP
	id S8133401AbWBAI6Y (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 1 Feb 2006 08:58:24 +0000
Received: from mail01 (localhost.localdomain [127.0.0.1])
	by mail01.miraclelinux.com (Postfix) with ESMTP
	id C270931C203; Wed,  1 Feb 2006 18:03:22 +0900 (JST)
Received: from localhost.localdomain (sshgate.miraclelinux.com [])
	by mail01.miraclelinux.com ([10.1.0.10]);
	Wed, 01 Feb 2006 09:03:22 +0000
Received: by localhost.localdomain (Postfix, from userid 1000)
	id 2BA974201E0; Wed,  1 Feb 2006 18:03:22 +0900 (JST)
Message-Id: <20060201090322.062243000@localhost.localdomain>
References: <20060201090224.536581000@localhost.localdomain>
Date:	Wed, 01 Feb 2006 18:02:28 +0900
From:	Akinobu Mita <mita@miraclelinux.com>
To:	linux-kernel@vger.kernel.org
Cc:	dev-etrax@axis.com, David Howells <dhowells@redhat.com>,
	Yoshinori Sato <ysato@users.sourceforge.jp>,
	linux-ia64@vger.kernel.org,
	Hirokazu Takata <takata@linux-m32r.org>,
	linux-m68k@lists.linux-m68k.org, Greg Ungerer <gerg@uclinux.org>,
	linux-mips@linux-mips.org, linux390@de.ibm.com,
	linuxsh-dev@lists.sourceforge.net,
	linuxsh-shmedia-dev@lists.sourceforge.net,
	sparclinux@vger.kernel.org, ultralinux@vger.kernel.org,
	Miles Bader <uclinux-v850@lsi.nec.co.jp>,
	Chris Zankel <chris@zankel.net>,
	Akinobu Mita <mita@miraclelinux.com>
Subject: [patch 04/44] use non atomic operations for minix_*_bit() and ext2_*_bit()
Content-Disposition: inline; filename=use-non-atomic.patch
Return-Path: <mita@miraclelinux.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: 10266
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: mita@miraclelinux.com
Precedence: bulk
X-list: linux-mips

Bitmap functions for the minix filesystem and the ext2 filesystem do not
require the atomic guarantees except ext2_set_bit_atomic() and
ext2_clear_bit_atomic().

But these are defined by using atomic bit operations on several architectures.
(cris, frv, h8300, ia64, m32r, m68k, m68knommu, mips, s390, sh, sh64, sparc,
 sparc64, v850, and xtensa)

This patch switches to non atomic bit operation.

Signed-off-by: Akinobu Mita <mita@miraclelinux.com>

 include/asm-cris/bitops.h      |    8 ++++----
 include/asm-frv/bitops.h       |   14 +++++++-------
 include/asm-h8300/bitops.h     |    6 +++---
 include/asm-ia64/bitops.h      |   10 +++++-----
 include/asm-m32r/bitops.h      |    2 +-
 include/asm-m68k/bitops.h      |   10 +++++-----
 include/asm-m68knommu/bitops.h |    6 +++---
 include/asm-mips/bitops.h      |    6 +++---
 include/asm-s390/bitops.h      |   10 +++++-----
 include/asm-sh/bitops.h        |   16 +++++-----------
 include/asm-sh64/bitops.h      |   16 +++++-----------
 include/asm-sparc/bitops.h     |    6 +++---
 include/asm-sparc64/bitops.h   |    6 +++---
 include/asm-v850/bitops.h      |   10 +++++-----
 include/asm-xtensa/bitops.h    |    6 +++---
 15 files changed, 60 insertions(+), 72 deletions(-)

Index: 2.6-git/include/asm-h8300/bitops.h
===================================================================
--- 2.6-git.orig/include/asm-h8300/bitops.h
+++ 2.6-git/include/asm-h8300/bitops.h
@@ -397,9 +397,9 @@ found_middle:
 }
 
 /* Bitmap functions for the minix filesystem.  */
-#define minix_test_and_set_bit(nr,addr) test_and_set_bit(nr,addr)
-#define minix_set_bit(nr,addr) set_bit(nr,addr)
-#define minix_test_and_clear_bit(nr,addr) test_and_clear_bit(nr,addr)
+#define minix_test_and_set_bit(nr,addr) __test_and_set_bit(nr,addr)
+#define minix_set_bit(nr,addr) __set_bit(nr,addr)
+#define minix_test_and_clear_bit(nr,addr) __test_and_clear_bit(nr,addr)
 #define minix_test_bit(nr,addr) test_bit(nr,addr)
 #define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
 
Index: 2.6-git/include/asm-ia64/bitops.h
===================================================================
--- 2.6-git.orig/include/asm-ia64/bitops.h
+++ 2.6-git/include/asm-ia64/bitops.h
@@ -394,18 +394,18 @@ extern int __find_next_bit(const void *a
 
 #define __clear_bit(nr, addr)		clear_bit(nr, addr)
 
-#define ext2_set_bit			test_and_set_bit
+#define ext2_set_bit			__test_and_set_bit
 #define ext2_set_bit_atomic(l,n,a)	test_and_set_bit(n,a)
-#define ext2_clear_bit			test_and_clear_bit
+#define ext2_clear_bit			__test_and_clear_bit
 #define ext2_clear_bit_atomic(l,n,a)	test_and_clear_bit(n,a)
 #define ext2_test_bit			test_bit
 #define ext2_find_first_zero_bit	find_first_zero_bit
 #define ext2_find_next_zero_bit		find_next_zero_bit
 
 /* Bitmap functions for the minix filesystem.  */
-#define minix_test_and_set_bit(nr,addr)		test_and_set_bit(nr,addr)
-#define minix_set_bit(nr,addr)			set_bit(nr,addr)
-#define minix_test_and_clear_bit(nr,addr)	test_and_clear_bit(nr,addr)
+#define minix_test_and_set_bit(nr,addr)		__test_and_set_bit(nr,addr)
+#define minix_set_bit(nr,addr)			__set_bit(nr,addr)
+#define minix_test_and_clear_bit(nr,addr)	__test_and_clear_bit(nr,addr)
 #define minix_test_bit(nr,addr)			test_bit(nr,addr)
 #define minix_find_first_zero_bit(addr,size)	find_first_zero_bit(addr,size)
 
Index: 2.6-git/include/asm-mips/bitops.h
===================================================================
--- 2.6-git.orig/include/asm-mips/bitops.h
+++ 2.6-git/include/asm-mips/bitops.h
@@ -956,9 +956,9 @@ found_middle:
  * FIXME: These assume that Minix uses the native byte/bitorder.
  * This limits the Minix filesystem's value for data exchange very much.
  */
-#define minix_test_and_set_bit(nr,addr) test_and_set_bit(nr,addr)
-#define minix_set_bit(nr,addr) set_bit(nr,addr)
-#define minix_test_and_clear_bit(nr,addr) test_and_clear_bit(nr,addr)
+#define minix_test_and_set_bit(nr,addr) __test_and_set_bit(nr,addr)
+#define minix_set_bit(nr,addr) __set_bit(nr,addr)
+#define minix_test_and_clear_bit(nr,addr) __test_and_clear_bit(nr,addr)
 #define minix_test_bit(nr,addr) test_bit(nr,addr)
 #define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
 
Index: 2.6-git/include/asm-s390/bitops.h
===================================================================
--- 2.6-git.orig/include/asm-s390/bitops.h
+++ 2.6-git/include/asm-s390/bitops.h
@@ -871,11 +871,11 @@ static inline int sched_find_first_bit(u
  */
 
 #define ext2_set_bit(nr, addr)       \
-	test_and_set_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr)
+	__test_and_set_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr)
 #define ext2_set_bit_atomic(lock, nr, addr)       \
 	test_and_set_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr)
 #define ext2_clear_bit(nr, addr)     \
-	test_and_clear_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr)
+	__test_and_clear_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr)
 #define ext2_clear_bit_atomic(lock, nr, addr)     \
 	test_and_clear_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr)
 #define ext2_test_bit(nr, addr)      \
@@ -1014,11 +1014,11 @@ ext2_find_next_zero_bit(void *vaddr, uns
 /* Bitmap functions for the minix filesystem.  */
 /* FIXME !!! */
 #define minix_test_and_set_bit(nr,addr) \
-	test_and_set_bit(nr,(unsigned long *)addr)
+	__test_and_set_bit(nr,(unsigned long *)addr)
 #define minix_set_bit(nr,addr) \
-	set_bit(nr,(unsigned long *)addr)
+	__set_bit(nr,(unsigned long *)addr)
 #define minix_test_and_clear_bit(nr,addr) \
-	test_and_clear_bit(nr,(unsigned long *)addr)
+	__test_and_clear_bit(nr,(unsigned long *)addr)
 #define minix_test_bit(nr,addr) \
 	test_bit(nr,(unsigned long *)addr)
 #define minix_find_first_zero_bit(addr,size) \
Index: 2.6-git/include/asm-sh/bitops.h
===================================================================
--- 2.6-git.orig/include/asm-sh/bitops.h
+++ 2.6-git/include/asm-sh/bitops.h
@@ -339,8 +339,8 @@ static inline int sched_find_first_bit(c
 }
 
 #ifdef __LITTLE_ENDIAN__
-#define ext2_set_bit(nr, addr) test_and_set_bit((nr), (addr))
-#define ext2_clear_bit(nr, addr) test_and_clear_bit((nr), (addr))
+#define ext2_set_bit(nr, addr) __test_and_set_bit((nr), (addr))
+#define ext2_clear_bit(nr, addr) __test_and_clear_bit((nr), (addr))
 #define ext2_test_bit(nr, addr) test_bit((nr), (addr))
 #define ext2_find_first_zero_bit(addr, size) find_first_zero_bit((addr), (size))
 #define ext2_find_next_zero_bit(addr, size, offset) \
@@ -349,30 +349,24 @@ static inline int sched_find_first_bit(c
 static __inline__ int ext2_set_bit(int nr, volatile void * addr)
 {
 	int		mask, retval;
-	unsigned long	flags;
 	volatile unsigned char	*ADDR = (unsigned char *) addr;
 
 	ADDR += nr >> 3;
 	mask = 1 << (nr & 0x07);
-	local_irq_save(flags);
 	retval = (mask & *ADDR) != 0;
 	*ADDR |= mask;
-	local_irq_restore(flags);
 	return retval;
 }
 
 static __inline__ int ext2_clear_bit(int nr, volatile void * addr)
 {
 	int		mask, retval;
-	unsigned long	flags;
 	volatile unsigned char	*ADDR = (unsigned char *) addr;
 
 	ADDR += nr >> 3;
 	mask = 1 << (nr & 0x07);
-	local_irq_save(flags);
 	retval = (mask & *ADDR) != 0;
 	*ADDR &= ~mask;
-	local_irq_restore(flags);
 	return retval;
 }
 
@@ -459,9 +453,9 @@ found_middle:
 	})
 
 /* Bitmap functions for the minix filesystem.  */
-#define minix_test_and_set_bit(nr,addr) test_and_set_bit(nr,addr)
-#define minix_set_bit(nr,addr) set_bit(nr,addr)
-#define minix_test_and_clear_bit(nr,addr) test_and_clear_bit(nr,addr)
+#define minix_test_and_set_bit(nr,addr) __test_and_set_bit(nr,addr)
+#define minix_set_bit(nr,addr) __set_bit(nr,addr)
+#define minix_test_and_clear_bit(nr,addr) __test_and_clear_bit(nr,addr)
 #define minix_test_bit(nr,addr) test_bit(nr,addr)
 #define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
 
Index: 2.6-git/include/asm-sh64/bitops.h
===================================================================
--- 2.6-git.orig/include/asm-sh64/bitops.h
+++ 2.6-git/include/asm-sh64/bitops.h
@@ -382,8 +382,8 @@ static inline int sched_find_first_bit(u
 #define hweight8(x) generic_hweight8(x)
 
 #ifdef __LITTLE_ENDIAN__
-#define ext2_set_bit(nr, addr) test_and_set_bit((nr), (addr))
-#define ext2_clear_bit(nr, addr) test_and_clear_bit((nr), (addr))
+#define ext2_set_bit(nr, addr) __test_and_set_bit((nr), (addr))
+#define ext2_clear_bit(nr, addr) __test_and_clear_bit((nr), (addr))
 #define ext2_test_bit(nr, addr) test_bit((nr), (addr))
 #define ext2_find_first_zero_bit(addr, size) find_first_zero_bit((addr), (size))
 #define ext2_find_next_zero_bit(addr, size, offset) \
@@ -392,30 +392,24 @@ static inline int sched_find_first_bit(u
 static __inline__ int ext2_set_bit(int nr, volatile void * addr)
 {
 	int		mask, retval;
-	unsigned long	flags;
 	volatile unsigned char	*ADDR = (unsigned char *) addr;
 
 	ADDR += nr >> 3;
 	mask = 1 << (nr & 0x07);
-	local_irq_save(flags);
 	retval = (mask & *ADDR) != 0;
 	*ADDR |= mask;
-	local_irq_restore(flags);
 	return retval;
 }
 
 static __inline__ int ext2_clear_bit(int nr, volatile void * addr)
 {
 	int		mask, retval;
-	unsigned long	flags;
 	volatile unsigned char	*ADDR = (unsigned char *) addr;
 
 	ADDR += nr >> 3;
 	mask = 1 << (nr & 0x07);
-	local_irq_save(flags);
 	retval = (mask & *ADDR) != 0;
 	*ADDR &= ~mask;
-	local_irq_restore(flags);
 	return retval;
 }
 
@@ -502,9 +496,9 @@ found_middle:
 	})
 
 /* Bitmap functions for the minix filesystem.  */
-#define minix_test_and_set_bit(nr,addr) test_and_set_bit(nr,addr)
-#define minix_set_bit(nr,addr) set_bit(nr,addr)
-#define minix_test_and_clear_bit(nr,addr) test_and_clear_bit(nr,addr)
+#define minix_test_and_set_bit(nr,addr) __test_and_set_bit(nr,addr)
+#define minix_set_bit(nr,addr) __set_bit(nr,addr)
+#define minix_test_and_clear_bit(nr,addr) __test_and_clear_bit(nr,addr)
 #define minix_test_bit(nr,addr) test_bit(nr,addr)
 #define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
 
Index: 2.6-git/include/asm-sparc/bitops.h
===================================================================
--- 2.6-git.orig/include/asm-sparc/bitops.h
+++ 2.6-git/include/asm-sparc/bitops.h
@@ -523,11 +523,11 @@ found_middle:
 
 /* Bitmap functions for the minix filesystem.  */
 #define minix_test_and_set_bit(nr,addr)	\
-	test_and_set_bit((nr),(unsigned long *)(addr))
+	__test_and_set_bit((nr),(unsigned long *)(addr))
 #define minix_set_bit(nr,addr)		\
-	set_bit((nr),(unsigned long *)(addr))
+	__set_bit((nr),(unsigned long *)(addr))
 #define minix_test_and_clear_bit(nr,addr) \
-	test_and_clear_bit((nr),(unsigned long *)(addr))
+	__test_and_clear_bit((nr),(unsigned long *)(addr))
 #define minix_test_bit(nr,addr)		\
 	test_bit((nr),(unsigned long *)(addr))
 #define minix_find_first_zero_bit(addr,size) \
Index: 2.6-git/include/asm-sparc64/bitops.h
===================================================================
--- 2.6-git.orig/include/asm-sparc64/bitops.h
+++ 2.6-git/include/asm-sparc64/bitops.h
@@ -280,11 +280,11 @@ extern unsigned long find_next_zero_le_b
 
 /* Bitmap functions for the minix filesystem.  */
 #define minix_test_and_set_bit(nr,addr)	\
-	test_and_set_bit((nr),(unsigned long *)(addr))
+	__test_and_set_bit((nr),(unsigned long *)(addr))
 #define minix_set_bit(nr,addr)	\
-	set_bit((nr),(unsigned long *)(addr))
+	__set_bit((nr),(unsigned long *)(addr))
 #define minix_test_and_clear_bit(nr,addr) \
-	test_and_clear_bit((nr),(unsigned long *)(addr))
+	__test_and_clear_bit((nr),(unsigned long *)(addr))
 #define minix_test_bit(nr,addr)	\
 	test_bit((nr),(unsigned long *)(addr))
 #define minix_find_first_zero_bit(addr,size) \
Index: 2.6-git/include/asm-v850/bitops.h
===================================================================
--- 2.6-git.orig/include/asm-v850/bitops.h
+++ 2.6-git/include/asm-v850/bitops.h
@@ -336,18 +336,18 @@ static inline int sched_find_first_bit(u
 #define hweight16(x) 			generic_hweight16 (x)
 #define hweight8(x) 			generic_hweight8 (x)
 
-#define ext2_set_bit			test_and_set_bit
+#define ext2_set_bit			__test_and_set_bit
 #define ext2_set_bit_atomic(l,n,a)      test_and_set_bit(n,a)
-#define ext2_clear_bit			test_and_clear_bit
+#define ext2_clear_bit			__test_and_clear_bit
 #define ext2_clear_bit_atomic(l,n,a)    test_and_clear_bit(n,a)
 #define ext2_test_bit			test_bit
 #define ext2_find_first_zero_bit	find_first_zero_bit
 #define ext2_find_next_zero_bit		find_next_zero_bit
 
 /* Bitmap functions for the minix filesystem.  */
-#define minix_test_and_set_bit		test_and_set_bit
-#define minix_set_bit			set_bit
-#define minix_test_and_clear_bit	test_and_clear_bit
+#define minix_test_and_set_bit		__test_and_set_bit
+#define minix_set_bit			__set_bit
+#define minix_test_and_clear_bit	__test_and_clear_bit
 #define minix_test_bit 			test_bit
 #define minix_find_first_zero_bit 	find_first_zero_bit
 
Index: 2.6-git/include/asm-xtensa/bitops.h
===================================================================
--- 2.6-git.orig/include/asm-xtensa/bitops.h
+++ 2.6-git/include/asm-xtensa/bitops.h
@@ -436,9 +436,9 @@ static inline int sched_find_first_bit(c
 
 /* Bitmap functions for the minix filesystem.  */
 
-#define minix_test_and_set_bit(nr,addr) test_and_set_bit(nr,addr)
-#define minix_set_bit(nr,addr) set_bit(nr,addr)
-#define minix_test_and_clear_bit(nr,addr) test_and_clear_bit(nr,addr)
+#define minix_test_and_set_bit(nr,addr) __test_and_set_bit(nr,addr)
+#define minix_set_bit(nr,addr) __set_bit(nr,addr)
+#define minix_test_and_clear_bit(nr,addr) __test_and_clear_bit(nr,addr)
 #define minix_test_bit(nr,addr) test_bit(nr,addr)
 #define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
 
Index: 2.6-git/include/asm-m32r/bitops.h
===================================================================
--- 2.6-git.orig/include/asm-m32r/bitops.h
+++ 2.6-git/include/asm-m32r/bitops.h
@@ -575,7 +575,7 @@ found_middle:
  */
 
 #ifdef __LITTLE_ENDIAN__
-#define ext2_set_bit			test_and_set_bit
+#define ext2_set_bit			__test_and_set_bit
 #define ext2_clear_bit			__test_and_clear_bit
 #define ext2_test_bit			test_bit
 #define ext2_find_first_zero_bit	find_first_zero_bit
Index: 2.6-git/include/asm-cris/bitops.h
===================================================================
--- 2.6-git.orig/include/asm-cris/bitops.h
+++ 2.6-git/include/asm-cris/bitops.h
@@ -352,17 +352,17 @@ found_middle:
 #define find_first_bit(addr, size) \
         find_next_bit((addr), (size), 0)
 
-#define ext2_set_bit                 test_and_set_bit
+#define ext2_set_bit                 __test_and_set_bit
 #define ext2_set_bit_atomic(l,n,a)   test_and_set_bit(n,a)
-#define ext2_clear_bit               test_and_clear_bit
+#define ext2_clear_bit               __test_and_clear_bit
 #define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a)
 #define ext2_test_bit                test_bit
 #define ext2_find_first_zero_bit     find_first_zero_bit
 #define ext2_find_next_zero_bit      find_next_zero_bit
 
 /* Bitmap functions for the minix filesystem.  */
-#define minix_set_bit(nr,addr) test_and_set_bit(nr,addr)
-#define minix_clear_bit(nr,addr) test_and_clear_bit(nr,addr)
+#define minix_set_bit(nr,addr) __test_and_set_bit(nr,addr)
+#define minix_clear_bit(nr,addr) __test_and_clear_bit(nr,addr)
 #define minix_test_bit(nr,addr) test_bit(nr,addr)
 #define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
 
Index: 2.6-git/include/asm-frv/bitops.h
===================================================================
--- 2.6-git.orig/include/asm-frv/bitops.h
+++ 2.6-git/include/asm-frv/bitops.h
@@ -259,11 +259,11 @@ static inline int sched_find_first_bit(c
 #define hweight16(x) generic_hweight16(x)
 #define hweight8(x) generic_hweight8(x)
 
-#define ext2_set_bit(nr, addr)		test_and_set_bit  ((nr) ^ 0x18, (addr))
-#define ext2_clear_bit(nr, addr)	test_and_clear_bit((nr) ^ 0x18, (addr))
+#define ext2_set_bit(nr, addr)		__test_and_set_bit  ((nr) ^ 0x18, (addr))
+#define ext2_clear_bit(nr, addr)	__test_and_clear_bit((nr) ^ 0x18, (addr))
 
-#define ext2_set_bit_atomic(lock,nr,addr)	ext2_set_bit((nr), addr)
-#define ext2_clear_bit_atomic(lock,nr,addr)	ext2_clear_bit((nr), addr)
+#define ext2_set_bit_atomic(lock,nr,addr)	test_and_set_bit  ((nr) ^ 0x18, (addr))
+#define ext2_clear_bit_atomic(lock,nr,addr)	test_and_clear_bit((nr) ^ 0x18, (addr))
 
 static inline int ext2_test_bit(int nr, const volatile void * addr)
 {
@@ -331,9 +331,9 @@ found_middle:
 }
 
 /* Bitmap functions for the minix filesystem.  */
-#define minix_test_and_set_bit(nr,addr)		ext2_set_bit(nr,addr)
-#define minix_set_bit(nr,addr)			ext2_set_bit(nr,addr)
-#define minix_test_and_clear_bit(nr,addr)	ext2_clear_bit(nr,addr)
+#define minix_test_and_set_bit(nr,addr)		__test_and_set_bit  ((nr) ^ 0x18, (addr))
+#define minix_set_bit(nr,addr)			__set_bit((nr) ^ 0x18, (addr))
+#define minix_test_and_clear_bit(nr,addr)	__test_and_clear_bit((nr) ^ 0x18, (addr))
 #define minix_test_bit(nr,addr)			ext2_test_bit(nr,addr)
 #define minix_find_first_zero_bit(addr,size)	ext2_find_first_zero_bit(addr,size)
 
Index: 2.6-git/include/asm-m68k/bitops.h
===================================================================
--- 2.6-git.orig/include/asm-m68k/bitops.h
+++ 2.6-git/include/asm-m68k/bitops.h
@@ -365,9 +365,9 @@ static inline int minix_find_first_zero_
 	return ((p - addr) << 4) + (res ^ 31);
 }
 
-#define minix_test_and_set_bit(nr, addr)	test_and_set_bit((nr) ^ 16, (unsigned long *)(addr))
-#define minix_set_bit(nr,addr)			set_bit((nr) ^ 16, (unsigned long *)(addr))
-#define minix_test_and_clear_bit(nr, addr)	test_and_clear_bit((nr) ^ 16, (unsigned long *)(addr))
+#define minix_test_and_set_bit(nr, addr)	__test_and_set_bit((nr) ^ 16, (unsigned long *)(addr))
+#define minix_set_bit(nr,addr)			__set_bit((nr) ^ 16, (unsigned long *)(addr))
+#define minix_test_and_clear_bit(nr, addr)	__test_and_clear_bit((nr) ^ 16, (unsigned long *)(addr))
 
 static inline int minix_test_bit(int nr, const void *vaddr)
 {
@@ -377,9 +377,9 @@ static inline int minix_test_bit(int nr,
 
 /* Bitmap functions for the ext2 filesystem. */
 
-#define ext2_set_bit(nr, addr)			test_and_set_bit((nr) ^ 24, (unsigned long *)(addr))
+#define ext2_set_bit(nr, addr)			__test_and_set_bit((nr) ^ 24, (unsigned long *)(addr))
 #define ext2_set_bit_atomic(lock, nr, addr)	test_and_set_bit((nr) ^ 24, (unsigned long *)(addr))
-#define ext2_clear_bit(nr, addr)		test_and_clear_bit((nr) ^ 24, (unsigned long *)(addr))
+#define ext2_clear_bit(nr, addr)		__test_and_clear_bit((nr) ^ 24, (unsigned long *)(addr))
 #define ext2_clear_bit_atomic(lock, nr, addr)	test_and_clear_bit((nr) ^ 24, (unsigned long *)(addr))
 
 static inline int ext2_test_bit(int nr, const void *vaddr)
Index: 2.6-git/include/asm-m68knommu/bitops.h
===================================================================
--- 2.6-git.orig/include/asm-m68knommu/bitops.h
+++ 2.6-git/include/asm-m68knommu/bitops.h
@@ -476,9 +476,9 @@ found_middle:
 }
 
 /* Bitmap functions for the minix filesystem.  */
-#define minix_test_and_set_bit(nr,addr) test_and_set_bit(nr,addr)
-#define minix_set_bit(nr,addr) set_bit(nr,addr)
-#define minix_test_and_clear_bit(nr,addr) test_and_clear_bit(nr,addr)
+#define minix_test_and_set_bit(nr,addr) __test_and_set_bit(nr,addr)
+#define minix_set_bit(nr,addr) __set_bit(nr,addr)
+#define minix_test_and_clear_bit(nr,addr) __test_and_clear_bit(nr,addr)
 #define minix_test_bit(nr,addr) test_bit(nr,addr)
 #define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
 

--

From mita@miraclelinux.com Wed Feb  1 09:01:10 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 01 Feb 2006 09:01:30 +0000 (GMT)
Received: from ns.miraclelinux.com ([219.118.163.66]:63561 "EHLO
	mail01.miraclelinux.com") by ftp.linux-mips.org with ESMTP
	id S8133646AbWBAI6Z (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 1 Feb 2006 08:58:25 +0000
Received: from mail01 (localhost.localdomain [127.0.0.1])
	by mail01.miraclelinux.com (Postfix) with ESMTP
	id 5C4D631C208; Wed,  1 Feb 2006 18:03:23 +0900 (JST)
Received: from localhost.localdomain (sshgate.miraclelinux.com [])
	by mail01.miraclelinux.com ([10.1.0.10]);
	Wed, 01 Feb 2006 09:03:23 +0000
Received: by localhost.localdomain (Postfix, from userid 1000)
	id C55614201E1; Wed,  1 Feb 2006 18:03:22 +0900 (JST)
Message-Id: <20060201090322.698909000@localhost.localdomain>
References: <20060201090224.536581000@localhost.localdomain>
Date:	Wed, 01 Feb 2006 18:02:31 +0900
From:	Akinobu Mita <mita@miraclelinux.com>
To:	linux-kernel@vger.kernel.org
Cc:	Russell King <rmk@arm.linux.org.uk>, Ian Molton <spyro@f2s.com>,
	David Howells <dhowells@redhat.com>,
	Hirokazu Takata <takata@linux-m32r.org>,
	Greg Ungerer <gerg@uclinux.org>, linux-mips@linux-mips.org,
	linuxsh-dev@lists.sourceforge.net,
	linuxsh-shmedia-dev@lists.sourceforge.net,
	sparclinux@vger.kernel.org, ultralinux@vger.kernel.org,
	Miles Bader <uclinux-v850@lsi.nec.co.jp>,
	Akinobu Mita <mita@miraclelinux.com>
Subject: [patch 07/44] generic __ffs()
Content-Disposition: inline; filename=__ffs-bitops.patch
Return-Path: <mita@miraclelinux.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: 10267
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: mita@miraclelinux.com
Precedence: bulk
X-list: linux-mips

This patch introduces the C-language equivalent of the function:
unsigned long __ffs(unsigned long word);

In include/asm-generic/bitops/__ffs.h

This code largely copied from:
include/asm-sparc/bitops.h

Signed-off-by: Akinobu Mita <mita@miraclelinux.com>
 include/asm-generic/bitops/__ffs.h |   43 +++++++++++++++++++++++++++++++++++++
 1 files changed, 43 insertions(+)

Index: 2.6-git/include/asm-generic/bitops/__ffs.h
===================================================================
--- /dev/null
+++ 2.6-git/include/asm-generic/bitops/__ffs.h
@@ -0,0 +1,43 @@
+#ifndef _ASM_GENERIC_BITOPS___FFS_H_
+#define _ASM_GENERIC_BITOPS___FFS_H_
+
+#include <asm/types.h>
+
+/**
+ * __ffs - find first bit in word.
+ * @word: The word to search
+ *
+ * Undefined if no bit exists, so code should check against 0 first.
+ */
+static inline unsigned long __ffs(unsigned long word)
+{
+	int num = 0;
+
+#if BITS_PER_LONG == 64
+	if ((word & 0xffffffff) == 0) {
+		num += 32;
+		word >>= 32;
+	}
+#endif
+	if ((word & 0xffff) == 0) {
+		num += 16;
+		word >>= 16;
+	}
+	if ((word & 0xff) == 0) {
+		num += 8;
+		word >>= 8;
+	}
+	if ((word & 0xf) == 0) {
+		num += 4;
+		word >>= 4;
+	}
+	if ((word & 0x3) == 0) {
+		num += 2;
+		word >>= 2;
+	}
+	if ((word & 0x1) == 0)
+		num += 1;
+	return num;
+}
+
+#endif /* _ASM_GENERIC_BITOPS___FFS_H_ */

--

From mita@miraclelinux.com Wed Feb  1 09:01:57 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 01 Feb 2006 09:02:26 +0000 (GMT)
Received: from ns.miraclelinux.com ([219.118.163.66]:63305 "EHLO
	mail01.miraclelinux.com") by ftp.linux-mips.org with ESMTP
	id S8133647AbWBAI6Z (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 1 Feb 2006 08:58:25 +0000
Received: from mail01 (localhost.localdomain [127.0.0.1])
	by mail01.miraclelinux.com (Postfix) with ESMTP
	id 481B131C204; Wed,  1 Feb 2006 18:03:23 +0900 (JST)
Received: from localhost.localdomain (sshgate.miraclelinux.com [])
	by mail01.miraclelinux.com ([10.1.0.10]);
	Wed, 01 Feb 2006 09:03:23 +0000
Received: by localhost.localdomain (Postfix, from userid 1000)
	id 8BC2B4201E2; Wed,  1 Feb 2006 18:03:22 +0900 (JST)
Message-Id: <20060201090322.422243000@localhost.localdomain>
References: <20060201090224.536581000@localhost.localdomain>
Date:	Wed, 01 Feb 2006 18:02:30 +0900
From:	Akinobu Mita <mita@miraclelinux.com>
To:	linux-kernel@vger.kernel.org
Cc:	Richard Henderson <rth@twiddle.net>,
	Ivan Kokshaysky <ink@jurassic.park.msu.ru>,
	Russell King <rmk@arm.linux.org.uk>,
	Ian Molton <spyro@f2s.com>, dev-etrax@axis.com,
	linux-ia64@vger.kernel.org,
	Hirokazu Takata <takata@linux-m32r.org>,
	linux-mips@linux-mips.org, parisc-linux@parisc-linux.org,
	linuxppc-dev@ozlabs.org, linuxsh-dev@lists.sourceforge.net,
	linuxsh-shmedia-dev@lists.sourceforge.net,
	sparclinux@vger.kernel.org, ultralinux@vger.kernel.org,
	Chris Zankel <chris@zankel.net>,
	Akinobu Mita <mita@miraclelinux.com>
Subject: [patch 06/44] generic __{,test_and_}{set,clear,change}_bit() and test_bit()
Content-Disposition: inline; filename=non-atomic-bitops.h
Return-Path: <mita@miraclelinux.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: 10268
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: mita@miraclelinux.com
Precedence: bulk
X-list: linux-mips

This patch introduces the C-language equivalents of the functions below:

void __set_bit(int nr, volatile unsigned long *addr);
void __clear_bit(int nr, volatile unsigned long *addr);
void __change_bit(int nr, volatile unsigned long *addr);
int __test_and_set_bit(int nr, volatile unsigned long *addr);
int __test_and_clear_bit(int nr, volatile unsigned long *addr);
int __test_and_change_bit(int nr, volatile unsigned long *addr);
int test_bit(int nr, const volatile unsigned long *addr);

In include/asm-generic/bitops/non-atomic.h

This code largely copied from:
asm-powerpc/bitops.h

Signed-off-by: Akinobu Mita <mita@miraclelinux.com>
 include/asm-generic/bitops/non-atomic.h |  111 ++++++++++++++++++++++++++++++++
 1 files changed, 111 insertions(+)

Index: 2.6-git/include/asm-generic/bitops/non-atomic.h
===================================================================
--- /dev/null
+++ 2.6-git/include/asm-generic/bitops/non-atomic.h
@@ -0,0 +1,111 @@
+#ifndef _ASM_GENERIC_BITOPS_NON_ATOMIC_H_
+#define _ASM_GENERIC_BITOPS_NON_ATOMIC_H_
+
+#include <asm/types.h>
+
+#define BITOP_MASK(nr)		(1UL << ((nr) % BITS_PER_LONG))
+#define BITOP_WORD(nr)		((nr) / BITS_PER_LONG)
+
+/**
+ * __set_bit - Set a bit in memory
+ * @nr: the bit to set
+ * @addr: the address to start counting from
+ *
+ * Unlike set_bit(), this function is non-atomic and may be reordered.
+ * If it's called on the same region of memory simultaneously, the effect
+ * may be that only one operation succeeds.
+ */
+static __inline__ void __set_bit(int nr, volatile unsigned long *addr)
+{
+	unsigned long mask = BITOP_MASK(nr);
+	unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
+
+	*p  |= mask;
+}
+
+static __inline__ void __clear_bit(int nr, volatile unsigned long *addr)
+{
+	unsigned long mask = BITOP_MASK(nr);
+	unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
+
+	*p &= ~mask;
+}
+
+/**
+ * __change_bit - Toggle a bit in memory
+ * @nr: the bit to change
+ * @addr: the address to start counting from
+ *
+ * Unlike change_bit(), this function is non-atomic and may be reordered.
+ * If it's called on the same region of memory simultaneously, the effect
+ * may be that only one operation succeeds.
+ */
+static __inline__ void __change_bit(int nr, volatile unsigned long *addr)
+{
+	unsigned long mask = BITOP_MASK(nr);
+	unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
+
+	*p ^= mask;
+}
+
+/**
+ * __test_and_set_bit - Set a bit and return its old value
+ * @nr: Bit to set
+ * @addr: Address to count from
+ *
+ * This operation is non-atomic and can be reordered.  
+ * If two examples of this operation race, one can appear to succeed
+ * but actually fail.  You must protect multiple accesses with a lock.
+ */
+static __inline__ int __test_and_set_bit(int nr, volatile unsigned long *addr)
+{
+	unsigned long mask = BITOP_MASK(nr);
+	unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
+	unsigned long old = *p;
+
+	*p = old | mask;
+	return (old & mask) != 0;
+}
+
+/**
+ * __test_and_clear_bit - Clear a bit and return its old value
+ * @nr: Bit to clear
+ * @addr: Address to count from
+ *
+ * This operation is non-atomic and can be reordered.  
+ * If two examples of this operation race, one can appear to succeed
+ * but actually fail.  You must protect multiple accesses with a lock.
+ */
+static __inline__ int __test_and_clear_bit(int nr, volatile unsigned long *addr)
+{
+	unsigned long mask = BITOP_MASK(nr);
+	unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
+	unsigned long old = *p;
+
+	*p = old & ~mask;
+	return (old & mask) != 0;
+}
+
+/* WARNING: non atomic and it can be reordered! */
+static __inline__ int __test_and_change_bit(int nr,
+					    volatile unsigned long *addr)
+{
+	unsigned long mask = BITOP_MASK(nr);
+	unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
+	unsigned long old = *p;
+
+	*p = old ^ mask;
+	return (old & mask) != 0;
+}
+
+/**
+ * test_bit - Determine whether a bit is set
+ * @nr: bit number to test
+ * @addr: Address to start counting from
+ */
+static __inline__ int test_bit(int nr, __const__ volatile unsigned long *addr)
+{
+	return 1UL & (addr[BITOP_WORD(nr)] >> (nr & (BITS_PER_LONG-1)));
+}
+
+#endif /* _ASM_GENERIC_BITOPS_NON_ATOMIC_H_ */

--

From mita@miraclelinux.com Wed Feb  1 09:02:55 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 01 Feb 2006 09:03:21 +0000 (GMT)
Received: from ns.miraclelinux.com ([219.118.163.66]:58954 "EHLO
	mail01.miraclelinux.com") by ftp.linux-mips.org with ESMTP
	id S8133655AbWBAI60 (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 1 Feb 2006 08:58:26 +0000
Received: from mail01 (localhost.localdomain [127.0.0.1])
	by mail01.miraclelinux.com (Postfix) with ESMTP
	id F2B7731C1F3; Wed,  1 Feb 2006 18:03:24 +0900 (JST)
Received: from localhost.localdomain (sshgate.miraclelinux.com [])
	by mail01.miraclelinux.com ([10.1.0.10]);
	Wed, 01 Feb 2006 09:03:24 +0000
Received: by localhost.localdomain (Postfix, from userid 1000)
	id 1EADC4201E0; Wed,  1 Feb 2006 18:03:23 +0900 (JST)
Message-Id: <20060201090323.294297000@localhost.localdomain>
References: <20060201090224.536581000@localhost.localdomain>
Date:	Wed, 01 Feb 2006 18:02:34 +0900
From:	Akinobu Mita <mita@miraclelinux.com>
To:	linux-kernel@vger.kernel.org
Cc:	Richard Henderson <rth@twiddle.net>,
	Ivan Kokshaysky <ink@jurassic.park.msu.ru>,
	Russell King <rmk@arm.linux.org.uk>,
	Ian Molton <spyro@f2s.com>, dev-etrax@axis.com,
	David Howells <dhowells@redhat.com>,
	Yoshinori Sato <ysato@users.sourceforge.jp>,
	Linus Torvalds <torvalds@osdl.org>, linux-ia64@vger.kernel.org,
	Hirokazu Takata <takata@linux-m32r.org>,
	linux-m68k@lists.linux-m68k.org, Greg Ungerer <gerg@uclinux.org>,
	linux-mips@linux-mips.org, parisc-linux@parisc-linux.org,
	linuxppc-dev@ozlabs.org, linux390@de.ibm.com,
	linuxsh-dev@lists.sourceforge.net,
	linuxsh-shmedia-dev@lists.sourceforge.net,
	sparclinux@vger.kernel.org, ultralinux@vger.kernel.org,
	Miles Bader <uclinux-v850@lsi.nec.co.jp>,
	Andi Kleen <ak@suse.de>, Chris Zankel <chris@zankel.net>,
	Akinobu Mita <mita@miraclelinux.com>
Subject: [patch 10/44] generic fls64()
Content-Disposition: inline; filename=fls64.patch
Return-Path: <mita@miraclelinux.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: 10269
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: mita@miraclelinux.com
Precedence: bulk
X-list: linux-mips

This patch introduces the C-language equivalent of the function:
int fls64(__u64 x);

In include/asm-generic/bitops/fls64.h

This code largely copied from:
include/linux/bitops.h

Signed-off-by: Akinobu Mita <mita@miraclelinux.com>
 include/asm-generic/bitops/fls64.h |   12 ++++++++++++
 1 files changed, 12 insertions(+)

Index: 2.6-git/include/asm-generic/bitops/fls64.h
===================================================================
--- /dev/null
+++ 2.6-git/include/asm-generic/bitops/fls64.h
@@ -0,0 +1,12 @@
+#ifndef _ASM_GENERIC_BITOPS_FLS64_H_
+#define _ASM_GENERIC_BITOPS_FLS64_H_
+
+static inline int fls64(__u64 x)
+{
+	__u32 h = x >> 32;
+	if (h)
+		return fls(x) + 32;
+	return fls(x);
+}
+
+#endif /* _ASM_GENERIC_BITOPS_FLS64_H_ */

--

From mita@miraclelinux.com Wed Feb  1 09:03:51 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 01 Feb 2006 09:04:16 +0000 (GMT)
Received: from ns.miraclelinux.com ([219.118.163.66]:59722 "EHLO
	mail01.miraclelinux.com") by ftp.linux-mips.org with ESMTP
	id S8133654AbWBAI60 (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 1 Feb 2006 08:58:26 +0000
Received: from mail01 (localhost.localdomain [127.0.0.1])
	by mail01.miraclelinux.com (Postfix) with ESMTP
	id 4559231C20D; Wed,  1 Feb 2006 18:03:26 +0900 (JST)
Received: from localhost.localdomain (sshgate.miraclelinux.com [])
	by mail01.miraclelinux.com ([10.1.0.10]);
	Wed, 01 Feb 2006 09:03:26 +0000
Received: by localhost.localdomain (Postfix, from userid 1000)
	id D11134201E2; Wed,  1 Feb 2006 18:03:25 +0900 (JST)
Message-Id: <20060201090325.696670000@localhost.localdomain>
References: <20060201090224.536581000@localhost.localdomain>
Date:	Wed, 01 Feb 2006 18:02:37 +0900
From:	Akinobu Mita <mita@miraclelinux.com>
To:	linux-kernel@vger.kernel.org
Cc:	Greg Ungerer <gerg@uclinux.org>, linux-mips@linux-mips.org,
	sparclinux@vger.kernel.org, ultralinux@vger.kernel.org,
	Akinobu Mita <mita@miraclelinux.com>
Subject: [patch 13/44] generic ffs()
Content-Disposition: inline; filename=ffs-bitops.patch
Return-Path: <mita@miraclelinux.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: 10270
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: mita@miraclelinux.com
Precedence: bulk
X-list: linux-mips

This patch introduces the C-language equivalent of the function:
int ffs(int x);

In include/asm-generic/bitops/ffs.h

This code largely copied from:
include/linux/bitops.h

Signed-off-by: Akinobu Mita <mita@miraclelinux.com>
 include/asm-generic/bitops/ffs.h |   41 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 41 insertions(+)

Index: 2.6-git/include/asm-generic/bitops/ffs.h
===================================================================
--- /dev/null
+++ 2.6-git/include/asm-generic/bitops/ffs.h
@@ -0,0 +1,41 @@
+#ifndef _ASM_GENERIC_BITOPS_FFS_H_
+#define _ASM_GENERIC_BITOPS_FFS_H_
+
+/**
+ * ffs - find first bit set
+ * @x: the word to search
+ *
+ * This is defined the same way as
+ * the libc and compiler builtin ffs routines, therefore
+ * differs in spirit from the above ffz (man ffs).
+ */
+static inline int ffs(int x)
+{
+	int r = 1;
+
+	if (!x)
+		return 0;
+	if (!(x & 0xffff)) {
+		x >>= 16;
+		r += 16;
+	}
+	if (!(x & 0xff)) {
+		x >>= 8;
+		r += 8;
+	}
+	if (!(x & 0xf)) {
+		x >>= 4;
+		r += 4;
+	}
+	if (!(x & 3)) {
+		x >>= 2;
+		r += 2;
+	}
+	if (!(x & 1)) {
+		x >>= 1;
+		r += 1;
+	}
+	return r;
+}
+
+#endif /* _ASM_GENERIC_BITOPS_FFS_H_ */

--

From mita@miraclelinux.com Wed Feb  1 09:04:46 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 01 Feb 2006 09:05:14 +0000 (GMT)
Received: from ns.miraclelinux.com ([219.118.163.66]:59210 "EHLO
	mail01.miraclelinux.com") by ftp.linux-mips.org with ESMTP
	id S8133648AbWBAI60 (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 1 Feb 2006 08:58:26 +0000
Received: from mail01 (localhost.localdomain [127.0.0.1])
	by mail01.miraclelinux.com (Postfix) with ESMTP
	id 0293E31C202; Wed,  1 Feb 2006 18:03:26 +0900 (JST)
Received: from localhost.localdomain (sshgate.miraclelinux.com [])
	by mail01.miraclelinux.com ([10.1.0.10]);
	Wed, 01 Feb 2006 09:03:25 +0000
Received: by localhost.localdomain (Postfix, from userid 1000)
	id 6C2654201E0; Wed,  1 Feb 2006 18:03:25 +0900 (JST)
Message-Id: <20060201090324.373982000@localhost.localdomain>
References: <20060201090224.536581000@localhost.localdomain>
Date:	Wed, 01 Feb 2006 18:02:35 +0900
From:	Akinobu Mita <mita@miraclelinux.com>
To:	linux-kernel@vger.kernel.org
Cc:	Richard Henderson <rth@twiddle.net>,
	Ivan Kokshaysky <ink@jurassic.park.msu.ru>, dev-etrax@axis.com,
	David Howells <dhowells@redhat.com>,
	Yoshinori Sato <ysato@users.sourceforge.jp>,
	linux-ia64@vger.kernel.org,
	Hirokazu Takata <takata@linux-m32r.org>,
	Greg Ungerer <gerg@uclinux.org>, linux-mips@linux-mips.org,
	parisc-linux@parisc-linux.org, linuxsh-dev@lists.sourceforge.net,
	linuxsh-shmedia-dev@lists.sourceforge.net,
	sparclinux@vger.kernel.org, ultralinux@vger.kernel.org,
	Miles Bader <uclinux-v850@lsi.nec.co.jp>,
	Chris Zankel <chris@zankel.net>,
	Akinobu Mita <mita@miraclelinux.com>
Subject: [patch 11/44] generic find_{next,first}{,_zero}_bit()
Content-Disposition: inline; filename=find-bitops.patch
Return-Path: <mita@miraclelinux.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: 10271
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: mita@miraclelinux.com
Precedence: bulk
X-list: linux-mips

This patch introduces the C-language equivalents of the functions below:

unsigned logn find_next_bit(const unsigned long *addr, unsigned long size,
                            unsigned long offset);
unsigned long find_next_zero_bit(const unsigned long *addr, unsigned long size,
                                 unsigned long offset);
unsigned long find_first_zero_bit(const unsigned long *addr,
                                  unsigned long size);
unsigned long find_first_bit(const unsigned long *addr, unsigned long size);

In include/asm-generic/bitops/find.h

This code largely copied from:
arch/powerpc/lib/bitops.c

Signed-off-by: Akinobu Mita <mita@miraclelinux.com>
 include/asm-generic/bitops/find.h |   99 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 99 insertions(+)

Index: 2.6-git/include/asm-generic/bitops/find.h
===================================================================
--- /dev/null
+++ 2.6-git/include/asm-generic/bitops/find.h
@@ -0,0 +1,99 @@
+#ifndef _ASM_GENERIC_BITOPS_FIND_H_
+#define _ASM_GENERIC_BITOPS_FIND_H_
+
+#include <asm/types.h>
+
+#define BITOP_WORD(nr)		((nr) / BITS_PER_LONG)
+
+/**
+ * find_next_bit - find the next set bit in a memory region
+ * @addr: The address to base the search on
+ * @offset: The bitnumber to start searching at
+ * @size: The maximum size to search
+ */
+static inline unsigned long find_next_bit(const unsigned long *addr,
+				unsigned long size, unsigned long offset)
+{
+	const unsigned long *p = addr + BITOP_WORD(offset);
+	unsigned long result = offset & ~(BITS_PER_LONG-1);
+	unsigned long tmp;
+
+	if (offset >= size)
+		return size;
+	size -= result;
+	offset %= BITS_PER_LONG;
+	if (offset) {
+		tmp = *(p++);
+		tmp &= (~0UL << offset);
+		if (size < BITS_PER_LONG)
+			goto found_first;
+		if (tmp)
+			goto found_middle;
+		size -= BITS_PER_LONG;
+		result += BITS_PER_LONG;
+	}
+	while (size & ~(BITS_PER_LONG-1)) {
+		if ((tmp = *(p++)))
+			goto found_middle;
+		result += BITS_PER_LONG;
+		size -= BITS_PER_LONG;
+	}
+	if (!size)
+		return result;
+	tmp = *p;
+
+found_first:
+	tmp &= (~0UL >> (BITS_PER_LONG - size));
+	if (tmp == 0UL)		/* Are any bits set? */
+		return result + size;	/* Nope. */
+found_middle:
+	return result + __ffs(tmp);
+}
+
+/*
+ * This implementation of find_{first,next}_zero_bit was stolen from
+ * Linus' asm-alpha/bitops.h.
+ */
+static inline unsigned long find_next_zero_bit(const unsigned long *addr,
+				unsigned long size, unsigned long offset)
+{
+	const unsigned long *p = addr + BITOP_WORD(offset);
+	unsigned long result = offset & ~(BITS_PER_LONG-1);
+	unsigned long tmp;
+
+	if (offset >= size)
+		return size;
+	size -= result;
+	offset %= BITS_PER_LONG;
+	if (offset) {
+		tmp = *(p++);
+		tmp |= ~0UL >> (BITS_PER_LONG - offset);
+		if (size < BITS_PER_LONG)
+			goto found_first;
+		if (~tmp)
+			goto found_middle;
+		size -= BITS_PER_LONG;
+		result += BITS_PER_LONG;
+	}
+	while (size & ~(BITS_PER_LONG-1)) {
+		if (~(tmp = *(p++)))
+			goto found_middle;
+		result += BITS_PER_LONG;
+		size -= BITS_PER_LONG;
+	}
+	if (!size)
+		return result;
+	tmp = *p;
+
+found_first:
+	tmp |= ~0UL << size;
+	if (tmp == ~0UL)	/* Are any bits zero? */
+		return result + size;	/* Nope. */
+found_middle:
+	return result + ffz(tmp);
+}
+
+#define find_first_zero_bit(addr, size) find_next_zero_bit((addr), (size), 0)
+#define find_first_bit(addr, size) find_next_bit((addr), (size), 0)
+
+#endif /*_ASM_GENERIC_BITOPS_FIND_H_ */

--

From mita@miraclelinux.com Wed Feb  1 09:05:47 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 01 Feb 2006 09:06:20 +0000 (GMT)
Received: from ns.miraclelinux.com ([219.118.163.66]:59466 "EHLO
	mail01.miraclelinux.com") by ftp.linux-mips.org with ESMTP
	id S8133653AbWBAI60 (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 1 Feb 2006 08:58:26 +0000
Received: from mail01 (localhost.localdomain [127.0.0.1])
	by mail01.miraclelinux.com (Postfix) with ESMTP
	id 71C6B31C20A; Wed,  1 Feb 2006 18:03:26 +0900 (JST)
Received: from localhost.localdomain (sshgate.miraclelinux.com [])
	by mail01.miraclelinux.com ([10.1.0.10]);
	Wed, 01 Feb 2006 09:03:26 +0000
Received: by localhost.localdomain (Postfix, from userid 1000)
	id A01254201E1; Wed,  1 Feb 2006 18:03:25 +0900 (JST)
Message-Id: <20060201090325.497639000@localhost.localdomain>
References: <20060201090224.536581000@localhost.localdomain>
Date:	Wed, 01 Feb 2006 18:02:36 +0900
From:	Akinobu Mita <mita@miraclelinux.com>
To:	linux-kernel@vger.kernel.org
Cc:	Russell King <rmk@arm.linux.org.uk>, Ian Molton <spyro@f2s.com>,
	dev-etrax@axis.com, David Howells <dhowells@redhat.com>,
	Yoshinori Sato <ysato@users.sourceforge.jp>,
	Linus Torvalds <torvalds@osdl.org>, linux-ia64@vger.kernel.org,
	Hirokazu Takata <takata@linux-m32r.org>,
	linux-m68k@lists.linux-m68k.org, Greg Ungerer <gerg@uclinux.org>,
	linux-mips@linux-mips.org, parisc-linux@parisc-linux.org,
	linuxppc-dev@ozlabs.org, linux390@de.ibm.com,
	linuxsh-dev@lists.sourceforge.net,
	linuxsh-shmedia-dev@lists.sourceforge.net,
	sparclinux@vger.kernel.org, ultralinux@vger.kernel.org,
	Miles Bader <uclinux-v850@lsi.nec.co.jp>,
	Andi Kleen <ak@suse.de>, Chris Zankel <chris@zankel.net>,
	Akinobu Mita <mita@miraclelinux.com>
Subject: [patch 12/44] generic sched_find_first_bit()
Content-Disposition: inline; filename=sched-bitops.patch
Return-Path: <mita@miraclelinux.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: 10272
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: mita@miraclelinux.com
Precedence: bulk
X-list: linux-mips

This patch introduces the C-language equivalent of the function:
int sched_find_first_bit(const unsigned long *b);

In include/asm-generic/bitops/sched.h

This code largely copied from:
include/asm-powerpc/bitops.h

Signed-off-by: Akinobu Mita <mita@miraclelinux.com>
 include/asm-generic/bitops/sched.h |   36 ++++++++++++++++++++++++++++++++++++
 1 files changed, 36 insertions(+)

Index: 2.6-git/include/asm-generic/bitops/sched.h
===================================================================
--- /dev/null
+++ 2.6-git/include/asm-generic/bitops/sched.h
@@ -0,0 +1,36 @@
+#ifndef _ASM_GENERIC_BITOPS_SCHED_H_
+#define _ASM_GENERIC_BITOPS_SCHED_H_
+
+#include <linux/compiler.h>	/* unlikely() */
+#include <asm/types.h>
+
+/*
+ * Every architecture must define this function. It's the fastest
+ * way of searching a 140-bit bitmap where the first 100 bits are
+ * unlikely to be set. It's guaranteed that at least one of the 140
+ * bits is cleared.
+ */
+static inline int sched_find_first_bit(const unsigned long *b)
+{
+#if BITS_PER_LONG == 64
+	if (unlikely(b[0]))
+		return __ffs(b[0]);
+	if (unlikely(b[1]))
+		return __ffs(b[1]) + 64;
+	return __ffs(b[2]) + 128;
+#elif BITS_PER_LONG == 32
+	if (unlikely(b[0]))
+		return __ffs(b[0]);
+	if (unlikely(b[1]))
+		return __ffs(b[1]) + 32;
+	if (unlikely(b[2]))
+		return __ffs(b[2]) + 64;
+	if (b[3])
+		return __ffs(b[3]) + 96;
+	return __ffs(b[4]) + 128;
+#else
+#error BITS_PER_LONG not defined
+#endif
+}
+
+#endif /* _ASM_GENERIC_BITOPS_SCHED_H_ */

--

From mita@miraclelinux.com Wed Feb  1 09:06:56 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 01 Feb 2006 09:07:25 +0000 (GMT)
Received: from ns.miraclelinux.com ([219.118.163.66]:61002 "EHLO
	mail01.miraclelinux.com") by ftp.linux-mips.org with ESMTP
	id S8133658AbWBAI60 (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 1 Feb 2006 08:58:26 +0000
Received: from mail01 (localhost.localdomain [127.0.0.1])
	by mail01.miraclelinux.com (Postfix) with ESMTP
	id F2FBD31C20F; Wed,  1 Feb 2006 18:03:26 +0900 (JST)
Received: from localhost.localdomain (sshgate.miraclelinux.com [])
	by mail01.miraclelinux.com ([10.1.0.10]);
	Wed, 01 Feb 2006 09:03:26 +0000
Received: by localhost.localdomain (Postfix, from userid 1000)
	id 6E7884201E2; Wed,  1 Feb 2006 18:03:26 +0900 (JST)
Message-Id: <20060201090326.300490000@localhost.localdomain>
References: <20060201090224.536581000@localhost.localdomain>
Date:	Wed, 01 Feb 2006 18:02:40 +0900
From:	Akinobu Mita <mita@miraclelinux.com>
To:	linux-kernel@vger.kernel.org
Cc:	Yoshinori Sato <ysato@users.sourceforge.jp>,
	Hirokazu Takata <takata@linux-m32r.org>,
	linux-mips@linux-mips.org, linuxsh-dev@lists.sourceforge.net,
	linuxsh-shmedia-dev@lists.sourceforge.net,
	sparclinux@vger.kernel.org, Akinobu Mita <mita@miraclelinux.com>
Subject: [patch 16/44] generic ext2_{set,clear}_bit_atomic()
Content-Disposition: inline; filename=ext2-atomic-bitops.patch
Return-Path: <mita@miraclelinux.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: 10273
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: mita@miraclelinux.com
Precedence: bulk
X-list: linux-mips

This patch introduces the C-language equivalents of the functions below:

int ext2_set_bit_atomic(int nr, volatile unsigned long *addr);
int ext2_clear_bit_atomic(int nr, volatile unsigned long *addr);

In include/asm-generic/bitops/ext2-atomic.h

This code largely copied from:
include/asm-sparc/bitops.h

Signed-off-by: Akinobu Mita <mita@miraclelinux.com>
 include/asm-generic/bitops/ext2-atomic.h |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+)

Index: 2.6-git/include/asm-generic/bitops/ext2-atomic.h
===================================================================
--- /dev/null
+++ 2.6-git/include/asm-generic/bitops/ext2-atomic.h
@@ -0,0 +1,22 @@
+#ifndef _ASM_GENERIC_BITOPS_EXT2_ATOMIC_H_
+#define _ASM_GENERIC_BITOPS_EXT2_ATOMIC_H_
+
+#define ext2_set_bit_atomic(lock, nr, addr)		\
+	({						\
+		int ret;				\
+		spin_lock(lock);			\
+		ret = ext2_set_bit((nr), (unsigned long *)(addr)); \
+		spin_unlock(lock);			\
+		ret;					\
+	})
+
+#define ext2_clear_bit_atomic(lock, nr, addr)		\
+	({						\
+		int ret;				\
+		spin_lock(lock);			\
+		ret = ext2_clear_bit((nr), (unsigned long *)(addr)); \
+		spin_unlock(lock);			\
+		ret;					\
+	})
+
+#endif /* _ASM_GENERIC_BITOPS_EXT2_ATOMIC_H_ */

--

From mita@miraclelinux.com Wed Feb  1 09:08:02 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 01 Feb 2006 09:08:34 +0000 (GMT)
Received: from ns.miraclelinux.com ([219.118.163.66]:61770 "EHLO
	mail01.miraclelinux.com") by ftp.linux-mips.org with ESMTP
	id S8133659AbWBAI61 (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 1 Feb 2006 08:58:27 +0000
Received: from mail01 (localhost.localdomain [127.0.0.1])
	by mail01.miraclelinux.com (Postfix) with ESMTP
	id 3AC1D31C20C; Wed,  1 Feb 2006 18:03:27 +0900 (JST)
Received: from localhost.localdomain (sshgate.miraclelinux.com [])
	by mail01.miraclelinux.com ([10.1.0.10]);
	Wed, 01 Feb 2006 09:03:27 +0000
Received: by localhost.localdomain (Postfix, from userid 1000)
	id 0DD7A4201E3; Wed,  1 Feb 2006 18:03:26 +0900 (JST)
Message-Id: <20060201090325.905071000@localhost.localdomain>
References: <20060201090224.536581000@localhost.localdomain>
Date:	Wed, 01 Feb 2006 18:02:38 +0900
From:	Akinobu Mita <mita@miraclelinux.com>
To:	linux-kernel@vger.kernel.org
Cc:	Richard Henderson <rth@twiddle.net>,
	Ivan Kokshaysky <ink@jurassic.park.msu.ru>,
	Russell King <rmk@arm.linux.org.uk>,
	Ian Molton <spyro@f2s.com>, dev-etrax@axis.com,
	David Howells <dhowells@redhat.com>,
	Yoshinori Sato <ysato@users.sourceforge.jp>,
	Linus Torvalds <torvalds@osdl.org>, linux-ia64@vger.kernel.org,
	Hirokazu Takata <takata@linux-m32r.org>,
	linux-m68k@lists.linux-m68k.org, Greg Ungerer <gerg@uclinux.org>,
	linux-mips@linux-mips.org, parisc-linux@parisc-linux.org,
	linuxppc-dev@ozlabs.org, linux390@de.ibm.com,
	linuxsh-dev@lists.sourceforge.net,
	linuxsh-shmedia-dev@lists.sourceforge.net,
	sparclinux@vger.kernel.org, ultralinux@vger.kernel.org,
	Miles Bader <uclinux-v850@lsi.nec.co.jp>,
	Andi Kleen <ak@suse.de>, Chris Zankel <chris@zankel.net>,
	Akinobu Mita <mita@miraclelinux.com>
Subject: [patch 14/44] generic hweight{64,32,16,8}()
Content-Disposition: inline; filename=hweight-bitops.patch
Return-Path: <mita@miraclelinux.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: 10274
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: mita@miraclelinux.com
Precedence: bulk
X-list: linux-mips


This patch introduces the C-language equivalents of the functions below:

unsigned int hweight32(unsigned int w);
unsigned int hweight16(unsigned int w);
unsigned int hweight8(unsigned int w);
unsigned long hweight64(__u64 w);

In include/asm-generic/bitops/hweight.h

This code largely copied from:
include/linux/bitops.h

Signed-off-by: Akinobu Mita <mita@miraclelinux.com>
 include/asm-generic/bitops/hweight.h |   54 +++++++++++++++++++++++++++++++++++
 1 files changed, 54 insertions(+)

Index: 2.6-git/include/asm-generic/bitops/hweight.h
===================================================================
--- /dev/null
+++ 2.6-git/include/asm-generic/bitops/hweight.h
@@ -0,0 +1,54 @@
+#ifndef _ASM_GENERIC_BITOPS_HWEIGHT_H_
+#define _ASM_GENERIC_BITOPS_HWEIGHT_H_
+
+#include <asm/types.h>
+
+/**
+ * hweightN - returns the hamming weight of a N-bit word
+ * @x: the word to weigh
+ *
+ * The Hamming Weight of a number is the total number of bits set in it.
+ */
+
+static inline unsigned int hweight32(unsigned int w)
+{
+        unsigned int res = (w & 0x55555555) + ((w >> 1) & 0x55555555);
+        res = (res & 0x33333333) + ((res >> 2) & 0x33333333);
+        res = (res & 0x0F0F0F0F) + ((res >> 4) & 0x0F0F0F0F);
+        res = (res & 0x00FF00FF) + ((res >> 8) & 0x00FF00FF);
+        return (res & 0x0000FFFF) + ((res >> 16) & 0x0000FFFF);
+}
+
+static inline unsigned int hweight16(unsigned int w)
+{
+        unsigned int res = (w & 0x5555) + ((w >> 1) & 0x5555);
+        res = (res & 0x3333) + ((res >> 2) & 0x3333);
+        res = (res & 0x0F0F) + ((res >> 4) & 0x0F0F);
+        return (res & 0x00FF) + ((res >> 8) & 0x00FF);
+}
+
+static inline unsigned int hweight8(unsigned int w)
+{
+        unsigned int res = (w & 0x55) + ((w >> 1) & 0x55);
+        res = (res & 0x33) + ((res >> 2) & 0x33);
+        return (res & 0x0F) + ((res >> 4) & 0x0F);
+}
+
+static inline unsigned long hweight64(__u64 w)
+{
+#if BITS_PER_LONG == 32
+	return hweight32((unsigned int)(w >> 32)) + hweight32((unsigned int)w);
+#elif BITS_PER_LONG == 64
+	u64 res;
+	res = (w & 0x5555555555555555ul) + ((w >> 1) & 0x5555555555555555ul);
+	res = (res & 0x3333333333333333ul) + ((res >> 2) & 0x3333333333333333ul);
+	res = (res & 0x0F0F0F0F0F0F0F0Ful) + ((res >> 4) & 0x0F0F0F0F0F0F0F0Ful);
+	res = (res & 0x00FF00FF00FF00FFul) + ((res >> 8) & 0x00FF00FF00FF00FFul);
+	res = (res & 0x0000FFFF0000FFFFul) + ((res >> 16) & 0x0000FFFF0000FFFFul);
+	return (res & 0x00000000FFFFFFFFul) + ((res >> 32) & 0x00000000FFFFFFFFul);
+#else
+#error BITS_PER_LONG not defined
+#endif
+}
+
+#endif /* _ASM_GENERIC_BITOPS_HWEIGHT_H_ */

--

From mita@miraclelinux.com Wed Feb  1 09:09:12 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 01 Feb 2006 09:09:40 +0000 (GMT)
Received: from ns.miraclelinux.com ([219.118.163.66]:60746 "EHLO
	mail01.miraclelinux.com") by ftp.linux-mips.org with ESMTP
	id S8133657AbWBAI61 (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 1 Feb 2006 08:58:27 +0000
Received: from mail01 (localhost.localdomain [127.0.0.1])
	by mail01.miraclelinux.com (Postfix) with ESMTP
	id E67B431C20E; Wed,  1 Feb 2006 18:03:26 +0900 (JST)
Received: from localhost.localdomain (sshgate.miraclelinux.com [])
	by mail01.miraclelinux.com ([10.1.0.10]);
	Wed, 01 Feb 2006 09:03:26 +0000
Received: by localhost.localdomain (Postfix, from userid 1000)
	id 40E2E4201E0; Wed,  1 Feb 2006 18:03:26 +0900 (JST)
Message-Id: <20060201090326.139510000@localhost.localdomain>
References: <20060201090224.536581000@localhost.localdomain>
Date:	Wed, 01 Feb 2006 18:02:39 +0900
From:	Akinobu Mita <mita@miraclelinux.com>
To:	linux-kernel@vger.kernel.org
Cc:	Richard Henderson <rth@twiddle.net>,
	Ivan Kokshaysky <ink@jurassic.park.msu.ru>, dev-etrax@axis.com,
	David Howells <dhowells@redhat.com>,
	Yoshinori Sato <ysato@users.sourceforge.jp>,
	Linus Torvalds <torvalds@osdl.org>, linux-ia64@vger.kernel.org,
	Hirokazu Takata <takata@linux-m32r.org>,
	linux-m68k@lists.linux-m68k.org, linux-mips@linux-mips.org,
	parisc-linux@parisc-linux.org, linuxsh-dev@lists.sourceforge.net,
	linuxsh-shmedia-dev@lists.sourceforge.net,
	sparclinux@vger.kernel.org, ultralinux@vger.kernel.org,
	Miles Bader <uclinux-v850@lsi.nec.co.jp>,
	Andi Kleen <ak@suse.de>, Chris Zankel <chris@zankel.net>,
	Akinobu Mita <mita@miraclelinux.com>
Subject: [patch 15/44] generic ext2_{set,clear,test,find_first_zero,find_next_zero}_bit()
Content-Disposition: inline; filename=ext2-non-atomic-bitops.patch
Return-Path: <mita@miraclelinux.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: 10275
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: mita@miraclelinux.com
Precedence: bulk
X-list: linux-mips

This patch introduces the C-language equivalents of the functions below:

int ext2_set_bit(int nr, volatile unsigned long *addr);
int ext2_clear_bit(int nr, volatile unsigned long *addr);
int ext2_test_bit(int nr, const volatile unsigned long *addr);
unsigned long ext2_find_first_zero_bit(const unsigned long *addr,
                                       unsigned long size);
unsinged long ext2_find_next_zero_bit(const unsigned long *addr,
                                      unsigned long size);

In include/asm-generic/bitops/ext2-non-atomic.h

This code largely copied from:

include/asm-powerpc/bitops.h
include/asm-parisc/bitops.h

Signed-off-by: Akinobu Mita <mita@miraclelinux.com>
 include/asm-generic/bitops/ext2-non-atomic.h |   18 +++
 include/asm-generic/bitops/le.h              |  126 +++++++++++++++++++++++++++
 2 files changed, 144 insertions(+)

Index: 2.6-git/include/asm-generic/bitops/ext2-non-atomic.h
===================================================================
--- /dev/null
+++ 2.6-git/include/asm-generic/bitops/ext2-non-atomic.h
@@ -0,0 +1,18 @@
+#ifndef _ASM_GENERIC_BITOPS_EXT2_NON_ATOMIC_H_
+#define _ASM_GENERIC_BITOPS_EXT2_NON_ATOMIC_H_
+
+#include <asm-generic/bitops/le.h>
+
+#define ext2_set_bit(nr,addr)	\
+	generic___test_and_set_le_bit((nr),(unsigned long *)(addr))
+#define ext2_clear_bit(nr,addr)	\
+	generic___test_and_clear_le_bit((nr),(unsigned long *)(addr))
+
+#define ext2_test_bit(nr,addr)	\
+	generic_test_le_bit((nr),(unsigned long *)(addr))
+#define ext2_find_first_zero_bit(addr, size) \
+	generic_find_first_zero_le_bit((unsigned long *)(addr), (size))
+#define ext2_find_next_zero_bit(addr, size, off) \
+	generic_find_next_zero_le_bit((unsigned long *)(addr), (size), (off))
+
+#endif /* _ASM_GENERIC_BITOPS_EXT2_NON_ATOMIC_H_ */
Index: 2.6-git/include/asm-generic/bitops/le.h
===================================================================
--- /dev/null
+++ 2.6-git/include/asm-generic/bitops/le.h
@@ -0,0 +1,126 @@
+#ifndef _ASM_GENERIC_BITOPS_LE_H_
+#define _ASM_GENERIC_BITOPS_LE_H_
+
+#include <asm/types.h>
+#include <asm/byteorder.h>
+
+#define BITOP_WORD(nr)		((nr) / BITS_PER_LONG)
+#define BITOP_LE_SWIZZLE	((BITS_PER_LONG-1) & ~0x7)
+
+#if defined(__LITTLE_ENDIAN)
+
+static __inline__ int generic_test_le_bit(unsigned long nr,
+				  __const__ unsigned long *addr)
+{
+	__const__ unsigned char	*tmp = (__const__ unsigned char *) addr;
+	return (tmp[nr >> 3] >> (nr & 7)) & 1;
+}
+
+#define generic___set_le_bit(nr, addr) __set_bit(nr, addr)
+#define generic___clear_le_bit(nr, addr) __clear_bit(nr, addr)
+
+#define generic_test_and_set_le_bit(nr, addr) test_and_set_bit(nr, addr)
+#define generic_test_and_clear_le_bit(nr, addr) test_and_clear_bit(nr, addr)
+
+#define generic___test_and_set_le_bit(nr, addr) __test_and_set_bit(nr, addr)
+#define generic___test_and_clear_le_bit(nr, addr) __test_and_clear_bit(nr, addr)
+
+#define generic_find_next_zero_le_bit(addr, size, offset) find_next_zero_bit(addr, size, offset)
+
+#elif defined(__BIG_ENDIAN)
+
+static __inline__ int generic_test_le_bit(unsigned long nr,
+				  __const__ unsigned long *addr)
+{
+	__const__ unsigned char	*tmp = (__const__ unsigned char *) addr;
+	return (tmp[nr >> 3] >> (nr & 7)) & 1;
+}
+
+#define generic___set_le_bit(nr, addr) \
+	__set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
+#define generic___clear_le_bit(nr, addr) \
+	__clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
+
+#define generic_test_and_set_le_bit(nr, addr) \
+	test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
+#define generic_test_and_clear_le_bit(nr, addr) \
+	test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
+
+#define generic___test_and_set_le_bit(nr, addr) \
+	__test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
+#define generic___test_and_clear_le_bit(nr, addr) \
+	__test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
+
+/* include/linux/byteorder does not support "unsigned long" type */
+static inline unsigned long ext2_swabp(const unsigned long * x)
+{
+#if BITS_PER_LONG == 64
+	return (unsigned long) __swab64p((u64 *) x);
+#elif BITS_PER_LONG == 32
+	return (unsigned long) __swab32p((u32 *) x);
+#else
+#error BITS_PER_LONG not defined
+#endif
+}
+
+/* include/linux/byteorder doesn't support "unsigned long" type */
+static inline unsigned long ext2_swab(const unsigned long y)
+{
+#if BITS_PER_LONG == 64
+	return (unsigned long) __swab64((u64) y);
+#elif BITS_PER_LONG == 32
+	return (unsigned long) __swab32((u32) y);
+#else
+#error BITS_PER_LONG not defined
+#endif
+}
+
+static __inline__ unsigned long generic_find_next_zero_le_bit(const unsigned long *addr,
+				unsigned long size, unsigned long offset)
+{
+	const unsigned long *p = addr + BITOP_WORD(offset);
+	unsigned long result = offset & ~(BITS_PER_LONG - 1);
+	unsigned long tmp;
+
+	if (offset >= size)
+		return size;
+	size -= result;
+	offset &= (BITS_PER_LONG - 1UL);
+	if (offset) {
+		tmp = ext2_swabp(p++);
+		tmp |= (~0UL >> (BITS_PER_LONG - offset));
+		if (size < BITS_PER_LONG)
+			goto found_first;
+		if (~tmp)
+			goto found_middle;
+		size -= BITS_PER_LONG;
+		result += BITS_PER_LONG;
+	}
+
+	while (size & ~(BITS_PER_LONG - 1)) {
+		if (~(tmp = *(p++)))
+			goto found_middle_swap;
+		result += BITS_PER_LONG;
+		size -= BITS_PER_LONG;
+	}
+	if (!size)
+		return result;
+	tmp = ext2_swabp(p);
+found_first:
+	tmp |= ~0UL << size;
+	if (tmp == ~0UL)	/* Are any bits zero? */
+		return result + size; /* Nope. Skip ffz */
+found_middle:
+	return result + ffz(tmp);
+
+found_middle_swap:
+	return result + ffz(ext2_swab(tmp));
+}
+#else
+#error "Please fix <asm/byteorder.h>"
+#endif
+
+#define generic_find_first_zero_le_bit(addr, size) \
+        generic_find_next_zero_le_bit((addr), (size), 0)
+
+#endif /* _ASM_GENERIC_BITOPS_LE_H_ */

--

From mita@miraclelinux.com Wed Feb  1 09:10:20 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 01 Feb 2006 09:10:49 +0000 (GMT)
Received: from ns.miraclelinux.com ([219.118.163.66]:62026 "EHLO
	mail01.miraclelinux.com") by ftp.linux-mips.org with ESMTP
	id S8133677AbWBAI61 (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 1 Feb 2006 08:58:27 +0000
Received: from mail01 (localhost.localdomain [127.0.0.1])
	by mail01.miraclelinux.com (Postfix) with ESMTP
	id D96E731C213; Wed,  1 Feb 2006 18:03:27 +0900 (JST)
Received: from localhost.localdomain (sshgate.miraclelinux.com [])
	by mail01.miraclelinux.com ([10.1.0.10]);
	Wed, 01 Feb 2006 09:03:27 +0000
Received: by localhost.localdomain (Postfix, from userid 1000)
	id BEB724201E1; Wed,  1 Feb 2006 18:03:26 +0900 (JST)
Message-Id: <20060201090326.484695000@localhost.localdomain>
References: <20060201090224.536581000@localhost.localdomain>
Date:	Wed, 01 Feb 2006 18:02:41 +0900
From:	Akinobu Mita <mita@miraclelinux.com>
To:	linux-kernel@vger.kernel.org
Cc:	Richard Henderson <rth@twiddle.net>,
	Ivan Kokshaysky <ink@jurassic.park.msu.ru>, dev-etrax@axis.com,
	David Howells <dhowells@redhat.com>,
	Yoshinori Sato <ysato@users.sourceforge.jp>,
	Linus Torvalds <torvalds@osdl.org>, linux-ia64@vger.kernel.org,
	Hirokazu Takata <takata@linux-m32r.org>,
	Greg Ungerer <gerg@uclinux.org>, linux-mips@linux-mips.org,
	linux390@de.ibm.com, linuxsh-dev@lists.sourceforge.net,
	linuxsh-shmedia-dev@lists.sourceforge.net,
	sparclinux@vger.kernel.org, ultralinux@vger.kernel.org,
	Miles Bader <uclinux-v850@lsi.nec.co.jp>,
	Andi Kleen <ak@suse.de>, Chris Zankel <chris@zankel.net>,
	Akinobu Mita <mita@miraclelinux.com>
Subject: [patch 17/44] generic minix_{test,set,test_and_clear,test,find_first_zero}_bit()
Content-Disposition: inline; filename=minix-bitops.patch
Return-Path: <mita@miraclelinux.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: 10276
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: mita@miraclelinux.com
Precedence: bulk
X-list: linux-mips

This patch introduces the C-language equivalents of the functions below:

int minix_test_and_set_bit(int nr, volatile unsigned long *addr);
int minix_set_bit(int nr, volatile unsigned long *addr);
int minix_test_and_clear_bit(int nr, volatile unsigned long *addr);
int minix_test_bit(int nr, const volatile unsigned long *addr);
unsigned long minix_find_first_zero_bit(const unsigned long *addr,
                                        unsigned long size);

In include/asm-generic/bitops/minix.h
   and include/asm-generic/bitops/minix-le.h

This code largely copied from:
include/asm-sparc/bitops.h

Signed-off-by: Akinobu Mita <mita@miraclelinux.com>

 include/asm-generic/bitops/minix-le.h |   17 +++++++++++++++++
 include/asm-generic/bitops/minix.h    |   15 +++++++++++++++
 2 files changed, 32 insertions(+)

Index: 2.6-git/include/asm-generic/bitops/minix.h
===================================================================
--- /dev/null
+++ 2.6-git/include/asm-generic/bitops/minix.h
@@ -0,0 +1,15 @@
+#ifndef _ASM_GENERIC_BITOPS_MINIX_H_
+#define _ASM_GENERIC_BITOPS_MINIX_H_
+
+#define minix_test_and_set_bit(nr,addr)	\
+	__test_and_set_bit((nr),(unsigned long *)(addr))
+#define minix_set_bit(nr,addr)		\
+	__set_bit((nr),(unsigned long *)(addr))
+#define minix_test_and_clear_bit(nr,addr) \
+	__test_and_clear_bit((nr),(unsigned long *)(addr))
+#define minix_test_bit(nr,addr)		\
+	test_bit((nr),(unsigned long *)(addr))
+#define minix_find_first_zero_bit(addr,size) \
+	find_first_zero_bit((unsigned long *)(addr),(size))
+
+#endif /* _ASM_GENERIC_BITOPS_MINIX_H_ */
Index: 2.6-git/include/asm-generic/bitops/minix-le.h
===================================================================
--- /dev/null
+++ 2.6-git/include/asm-generic/bitops/minix-le.h
@@ -0,0 +1,17 @@
+#ifndef _ASM_GENERIC_BITOPS_MINIX_LE_H_
+#define _ASM_GENERIC_BITOPS_MINIX_LE_H_
+
+#include <asm-generic/bitops/le.h>
+
+#define minix_test_and_set_bit(nr,addr)	\
+	generic___test_and_set_le_bit((nr),(unsigned long *)(addr))
+#define minix_set_bit(nr,addr)		\
+	generic___set_le_bit((nr),(unsigned long *)(addr))
+#define minix_test_and_clear_bit(nr,addr) \
+	generic___test_and_clear_le_bit((nr),(unsigned long *)(addr))
+#define minix_test_bit(nr,addr)		\
+	generic_test_le_bit((nr),(unsigned long *)(addr))
+#define minix_find_first_zero_bit(addr,size) \
+	generic_find_first_zero_le_bit((unsigned long *)(addr),(size))
+
+#endif /* _ASM_GENERIC_BITOPS_MINIX_LE_H_ */

--

From mita@miraclelinux.com Wed Feb  1 09:11:24 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 01 Feb 2006 09:11:58 +0000 (GMT)
Received: from ns.miraclelinux.com ([219.118.163.66]:7499 "EHLO
	mail01.miraclelinux.com") by ftp.linux-mips.org with ESMTP
	id S8133698AbWBAI6b (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 1 Feb 2006 08:58:31 +0000
Received: from mail01 (localhost.localdomain [127.0.0.1])
	by mail01.miraclelinux.com (Postfix) with ESMTP
	id 97FB931C20F; Wed,  1 Feb 2006 18:03:33 +0900 (JST)
Received: from localhost.localdomain (sshgate.miraclelinux.com [])
	by mail01.miraclelinux.com ([10.1.0.10]);
	Wed, 01 Feb 2006 09:03:33 +0000
Received: by localhost.localdomain (Postfix, from userid 1000)
	id 5653B4201E1; Wed,  1 Feb 2006 18:03:33 +0900 (JST)
Message-Id: <20060201090333.239681000@localhost.localdomain>
References: <20060201090224.536581000@localhost.localdomain>
Date:	Wed, 01 Feb 2006 18:02:53 +0900
From:	Akinobu Mita <mita@miraclelinux.com>
To:	linux-kernel@vger.kernel.org
Cc:	linux-mips@linux-mips.org, Akinobu Mita <mita@miraclelinux.com>
Subject: [patch 29/44] mips: use generic bitops
Content-Disposition: inline; filename=mips.patch
Return-Path: <mita@miraclelinux.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: 10277
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: mita@miraclelinux.com
Precedence: bulk
X-list: linux-mips

- remove __{,test_and_}{set,clear,change}_bit() and test_bit()

- unless defined(CONFIG_CPU_MIPS32) or defined(CONFIG_CPU_MIPS64)

  - remove __ffs()
  - remove ffs()
  - remove ffz()
  - remove fls()

- remove fls64()
- remove find_{next,first}{,_zero}_bit()
- remove sched_find_first_bit()
- remove generic_hweight64()
- remove generic_hweight{32,16,8}()
- remove ext2_{set,clear,test,find_first_zero,find_next_zero}_bit()
- remove ext2_{set,clear}_bit_atomic()
- remove minix_{test,set,test_and_clear,test,find_first_zero}_bit()

Signed-off-by: Akinobu Mita <mita@miraclelinux.com>
 include/asm-mips/bitops.h |  456 +---------------------------------------------
 1 files changed, 17 insertions(+), 439 deletions(-)

Index: 2.6-git/include/asm-mips/bitops.h
===================================================================
--- 2.6-git.orig/include/asm-mips/bitops.h
+++ 2.6-git/include/asm-mips/bitops.h
@@ -105,22 +105,6 @@ static inline void set_bit(unsigned long
 }
 
 /*
- * __set_bit - Set a bit in memory
- * @nr: the bit to set
- * @addr: the address to start counting from
- *
- * Unlike set_bit(), this function is non-atomic and may be reordered.
- * If it's called on the same region of memory simultaneously, the effect
- * may be that only one operation succeeds.
- */
-static inline void __set_bit(unsigned long nr, volatile unsigned long * addr)
-{
-	unsigned long * m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
-
-	*m |= 1UL << (nr & SZLONG_MASK);
-}
-
-/*
  * clear_bit - Clears a bit in memory
  * @nr: Bit to clear
  * @addr: Address to start counting from
@@ -169,22 +153,6 @@ static inline void clear_bit(unsigned lo
 }
 
 /*
- * __clear_bit - Clears a bit in memory
- * @nr: Bit to clear
- * @addr: Address to start counting from
- *
- * Unlike clear_bit(), this function is non-atomic and may be reordered.
- * If it's called on the same region of memory simultaneously, the effect
- * may be that only one operation succeeds.
- */
-static inline void __clear_bit(unsigned long nr, volatile unsigned long * addr)
-{
-	unsigned long * m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
-
-	*m &= ~(1UL << (nr & SZLONG_MASK));
-}
-
-/*
  * change_bit - Toggle a bit in memory
  * @nr: Bit to change
  * @addr: Address to start counting from
@@ -235,22 +203,6 @@ static inline void change_bit(unsigned l
 }
 
 /*
- * __change_bit - Toggle a bit in memory
- * @nr: the bit to change
- * @addr: the address to start counting from
- *
- * Unlike change_bit(), this function is non-atomic and may be reordered.
- * If it's called on the same region of memory simultaneously, the effect
- * may be that only one operation succeeds.
- */
-static inline void __change_bit(unsigned long nr, volatile unsigned long * addr)
-{
-	unsigned long * m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
-
-	*m ^= 1UL << (nr & SZLONG_MASK);
-}
-
-/*
  * test_and_set_bit - Set a bit and return its old value
  * @nr: Bit to set
  * @addr: Address to count from
@@ -321,30 +273,6 @@ static inline int test_and_set_bit(unsig
 }
 
 /*
- * __test_and_set_bit - Set a bit and return its old value
- * @nr: Bit to set
- * @addr: Address to count from
- *
- * This operation is non-atomic and can be reordered.
- * If two examples of this operation race, one can appear to succeed
- * but actually fail.  You must protect multiple accesses with a lock.
- */
-static inline int __test_and_set_bit(unsigned long nr,
-	volatile unsigned long *addr)
-{
-	volatile unsigned long *a = addr;
-	unsigned long mask;
-	int retval;
-
-	a += nr >> SZLONG_LOG;
-	mask = 1UL << (nr & SZLONG_MASK);
-	retval = (mask & *a) != 0;
-	*a |= mask;
-
-	return retval;
-}
-
-/*
  * test_and_clear_bit - Clear a bit and return its old value
  * @nr: Bit to clear
  * @addr: Address to count from
@@ -417,30 +345,6 @@ static inline int test_and_clear_bit(uns
 }
 
 /*
- * __test_and_clear_bit - Clear a bit and return its old value
- * @nr: Bit to clear
- * @addr: Address to count from
- *
- * This operation is non-atomic and can be reordered.
- * If two examples of this operation race, one can appear to succeed
- * but actually fail.  You must protect multiple accesses with a lock.
- */
-static inline int __test_and_clear_bit(unsigned long nr,
-	volatile unsigned long * addr)
-{
-	volatile unsigned long *a = addr;
-	unsigned long mask;
-	int retval;
-
-	a += (nr >> SZLONG_LOG);
-	mask = 1UL << (nr & SZLONG_MASK);
-	retval = ((mask & *a) != 0);
-	*a &= ~mask;
-
-	return retval;
-}
-
-/*
  * test_and_change_bit - Change a bit and return its old value
  * @nr: Bit to change
  * @addr: Address to count from
@@ -509,43 +413,11 @@ static inline int test_and_change_bit(un
 	}
 }
 
-/*
- * __test_and_change_bit - Change a bit and return its old value
- * @nr: Bit to change
- * @addr: Address to count from
- *
- * This operation is non-atomic and can be reordered.
- * If two examples of this operation race, one can appear to succeed
- * but actually fail.  You must protect multiple accesses with a lock.
- */
-static inline int __test_and_change_bit(unsigned long nr,
-	volatile unsigned long *addr)
-{
-	volatile unsigned long *a = addr;
-	unsigned long mask;
-	int retval;
-
-	a += (nr >> SZLONG_LOG);
-	mask = 1UL << (nr & SZLONG_MASK);
-	retval = ((mask & *a) != 0);
-	*a ^= mask;
-
-	return retval;
-}
-
 #undef __bi_flags
 #undef __bi_local_irq_save
 #undef __bi_local_irq_restore
 
-/*
- * test_bit - Determine whether a bit is set
- * @nr: bit number to test
- * @addr: Address to start counting from
- */
-static inline int test_bit(unsigned long nr, const volatile unsigned long *addr)
-{
-	return 1UL & (addr[nr >> SZLONG_LOG] >> (nr & SZLONG_MASK));
-}
+#include <asm-generic/bitops/non-atomic.h>
 
 /*
  * Return the bit position (0..63) of the most significant 1 bit in a word
@@ -580,6 +452,8 @@ static inline int __ilog2(unsigned long 
 	return 63 - lz;
 }
 
+#if defined(CONFIG_CPU_MIPS32) || defined(CONFIG_CPU_MIPS64)
+
 /*
  * __ffs - find first bit in word.
  * @word: The word to search
@@ -589,31 +463,7 @@ static inline int __ilog2(unsigned long 
  */
 static inline unsigned long __ffs(unsigned long word)
 {
-#if defined(CONFIG_CPU_MIPS32) || defined(CONFIG_CPU_MIPS64)
 	return __ilog2(word & -word);
-#else
-	int b = 0, s;
-
-#ifdef CONFIG_32BIT
-	s = 16; if (word << 16 != 0) s = 0; b += s; word >>= s;
-	s =  8; if (word << 24 != 0) s = 0; b += s; word >>= s;
-	s =  4; if (word << 28 != 0) s = 0; b += s; word >>= s;
-	s =  2; if (word << 30 != 0) s = 0; b += s; word >>= s;
-	s =  1; if (word << 31 != 0) s = 0; b += s;
-
-	return b;
-#endif
-#ifdef CONFIG_64BIT
-	s = 32; if (word << 32 != 0) s = 0; b += s; word >>= s;
-	s = 16; if (word << 48 != 0) s = 0; b += s; word >>= s;
-	s =  8; if (word << 56 != 0) s = 0; b += s; word >>= s;
-	s =  4; if (word << 60 != 0) s = 0; b += s; word >>= s;
-	s =  2; if (word << 62 != 0) s = 0; b += s; word >>= s;
-	s =  1; if (word << 63 != 0) s = 0; b += s;
-
-	return b;
-#endif
-#endif
 }
 
 /*
@@ -652,33 +502,7 @@ static inline unsigned long ffz(unsigned
  */
 static inline unsigned long flz(unsigned long word)
 {
-#if defined(CONFIG_CPU_MIPS32) || defined(CONFIG_CPU_MIPS64)
 	return __ilog2(~word);
-#else
-#ifdef CONFIG_32BIT
-	int r = 31, s;
-	word = ~word;
-	s = 16; if ((word & 0xffff0000)) s = 0; r -= s; word <<= s;
-	s = 8;  if ((word & 0xff000000)) s = 0; r -= s; word <<= s;
-	s = 4;  if ((word & 0xf0000000)) s = 0; r -= s; word <<= s;
-	s = 2;  if ((word & 0xc0000000)) s = 0; r -= s; word <<= s;
-	s = 1;  if ((word & 0x80000000)) s = 0; r -= s;
-
-	return r;
-#endif
-#ifdef CONFIG_64BIT
-	int r = 63, s;
-	word = ~word;
-	s = 32; if ((word & 0xffffffff00000000UL)) s = 0; r -= s; word <<= s;
-	s = 16; if ((word & 0xffff000000000000UL)) s = 0; r -= s; word <<= s;
-	s = 8;  if ((word & 0xff00000000000000UL)) s = 0; r -= s; word <<= s;
-	s = 4;  if ((word & 0xf000000000000000UL)) s = 0; r -= s; word <<= s;
-	s = 2;  if ((word & 0xc000000000000000UL)) s = 0; r -= s; word <<= s;
-	s = 1;  if ((word & 0x8000000000000000UL)) s = 0; r -= s;
-
-	return r;
-#endif
-#endif
 }
 
 /*
@@ -695,272 +519,26 @@ static inline unsigned long fls(unsigned
 
 	return flz(~word) + 1;
 }
-#define fls64(x)   generic_fls64(x)
 
-/*
- * find_next_zero_bit - find the first zero bit in a memory region
- * @addr: The address to base the search on
- * @offset: The bitnumber to start searching at
- * @size: The maximum size to search
- */
-static inline unsigned long find_next_zero_bit(const unsigned long *addr,
-	unsigned long size, unsigned long offset)
-{
-	const unsigned long *p = addr + (offset >> SZLONG_LOG);
-	unsigned long result = offset & ~SZLONG_MASK;
-	unsigned long tmp;
-
-	if (offset >= size)
-		return size;
-	size -= result;
-	offset &= SZLONG_MASK;
-	if (offset) {
-		tmp = *(p++);
-		tmp |= ~0UL >> (_MIPS_SZLONG-offset);
-		if (size < _MIPS_SZLONG)
-			goto found_first;
-		if (~tmp)
-			goto found_middle;
-		size -= _MIPS_SZLONG;
-		result += _MIPS_SZLONG;
-	}
-	while (size & ~SZLONG_MASK) {
-		if (~(tmp = *(p++)))
-			goto found_middle;
-		result += _MIPS_SZLONG;
-		size -= _MIPS_SZLONG;
-	}
-	if (!size)
-		return result;
-	tmp = *p;
-
-found_first:
-	tmp |= ~0UL << size;
-	if (tmp == ~0UL)		/* Are any bits zero? */
-		return result + size;	/* Nope. */
-found_middle:
-	return result + ffz(tmp);
-}
-
-#define find_first_zero_bit(addr, size) \
-	find_next_zero_bit((addr), (size), 0)
-
-/*
- * find_next_bit - find the next set bit in a memory region
- * @addr: The address to base the search on
- * @offset: The bitnumber to start searching at
- * @size: The maximum size to search
- */
-static inline unsigned long find_next_bit(const unsigned long *addr,
-	unsigned long size, unsigned long offset)
-{
-	const unsigned long *p = addr + (offset >> SZLONG_LOG);
-	unsigned long result = offset & ~SZLONG_MASK;
-	unsigned long tmp;
-
-	if (offset >= size)
-		return size;
-	size -= result;
-	offset &= SZLONG_MASK;
-	if (offset) {
-		tmp = *(p++);
-		tmp &= ~0UL << offset;
-		if (size < _MIPS_SZLONG)
-			goto found_first;
-		if (tmp)
-			goto found_middle;
-		size -= _MIPS_SZLONG;
-		result += _MIPS_SZLONG;
-	}
-	while (size & ~SZLONG_MASK) {
-		if ((tmp = *(p++)))
-			goto found_middle;
-		result += _MIPS_SZLONG;
-		size -= _MIPS_SZLONG;
-	}
-	if (!size)
-		return result;
-	tmp = *p;
-
-found_first:
-	tmp &= ~0UL >> (_MIPS_SZLONG - size);
-	if (tmp == 0UL)			/* Are any bits set? */
-		return result + size;	/* Nope. */
-found_middle:
-	return result + __ffs(tmp);
-}
-
-/*
- * find_first_bit - find the first set bit in a memory region
- * @addr: The address to start the search at
- * @size: The maximum size to search
- *
- * Returns the bit-number of the first set bit, not the number of the byte
- * containing a bit.
- */
-#define find_first_bit(addr, size) \
-	find_next_bit((addr), (size), 0)
-
-#ifdef __KERNEL__
-
-/*
- * Every architecture must define this function. It's the fastest
- * way of searching a 140-bit bitmap where the first 100 bits are
- * unlikely to be set. It's guaranteed that at least one of the 140
- * bits is cleared.
- */
-static inline int sched_find_first_bit(const unsigned long *b)
-{
-#ifdef CONFIG_32BIT
-	if (unlikely(b[0]))
-		return __ffs(b[0]);
-	if (unlikely(b[1]))
-		return __ffs(b[1]) + 32;
-	if (unlikely(b[2]))
-		return __ffs(b[2]) + 64;
-	if (b[3])
-		return __ffs(b[3]) + 96;
-	return __ffs(b[4]) + 128;
-#endif
-#ifdef CONFIG_64BIT
-	if (unlikely(b[0]))
-		return __ffs(b[0]);
-	if (unlikely(b[1]))
-		return __ffs(b[1]) + 64;
-	return __ffs(b[2]) + 128;
-#endif
-}
-
-/*
- * hweightN - returns the hamming weight of a N-bit word
- * @x: the word to weigh
- *
- * The Hamming Weight of a number is the total number of bits set in it.
- */
-
-#define hweight64(x)	generic_hweight64(x)
-#define hweight32(x)	generic_hweight32(x)
-#define hweight16(x)	generic_hweight16(x)
-#define hweight8(x)	generic_hweight8(x)
-
-static inline int __test_and_set_le_bit(unsigned long nr, unsigned long *addr)
-{
-	unsigned char	*ADDR = (unsigned char *) addr;
-	int		mask, retval;
-
-	ADDR += nr >> 3;
-	mask = 1 << (nr & 0x07);
-	retval = (mask & *ADDR) != 0;
-	*ADDR |= mask;
-
-	return retval;
-}
-
-static inline int __test_and_clear_le_bit(unsigned long nr, unsigned long *addr)
-{
-	unsigned char	*ADDR = (unsigned char *) addr;
-	int		mask, retval;
-
-	ADDR += nr >> 3;
-	mask = 1 << (nr & 0x07);
-	retval = (mask & *ADDR) != 0;
-	*ADDR &= ~mask;
-
-	return retval;
-}
-
-static inline int test_le_bit(unsigned long nr, const unsigned long * addr)
-{
-	const unsigned char	*ADDR = (const unsigned char *) addr;
-	int			mask;
+#else
 
-	ADDR += nr >> 3;
-	mask = 1 << (nr & 0x07);
+#include <asm-generic/bitops/__ffs.h>
+#include <asm-generic/bitops/ffs.h>
+#include <asm-generic/bitops/ffz.h>
+#include <asm-generic/bitops/fls.h>
 
-	return ((mask & *ADDR) != 0);
-}
+#endif /*defined(CONFIG_CPU_MIPS32) || defined(CONFIG_CPU_MIPS64) */
 
-static inline unsigned long find_next_zero_le_bit(unsigned long *addr,
-	unsigned long size, unsigned long offset)
-{
-	unsigned long *p = ((unsigned long *) addr) + (offset >> SZLONG_LOG);
-	unsigned long result = offset & ~SZLONG_MASK;
-	unsigned long tmp;
+#include <asm-generic/bitops/fls64.h>
+#include <asm-generic/bitops/find.h>
 
-	if (offset >= size)
-		return size;
-	size -= result;
-	offset &= SZLONG_MASK;
-	if (offset) {
-		tmp = cpu_to_lelongp(p++);
-		tmp |= ~0UL >> (_MIPS_SZLONG-offset); /* bug or feature ? */
-		if (size < _MIPS_SZLONG)
-			goto found_first;
-		if (~tmp)
-			goto found_middle;
-		size -= _MIPS_SZLONG;
-		result += _MIPS_SZLONG;
-	}
-	while (size & ~SZLONG_MASK) {
-		if (~(tmp = cpu_to_lelongp(p++)))
-			goto found_middle;
-		result += _MIPS_SZLONG;
-		size -= _MIPS_SZLONG;
-	}
-	if (!size)
-		return result;
-	tmp = cpu_to_lelongp(p);
-
-found_first:
-	tmp |= ~0UL << size;
-	if (tmp == ~0UL)		/* Are any bits zero? */
-		return result + size;	/* Nope. */
-
-found_middle:
-	return result + ffz(tmp);
-}
-
-#define find_first_zero_le_bit(addr, size) \
-	find_next_zero_le_bit((addr), (size), 0)
-
-#define ext2_set_bit(nr,addr) \
-	__test_and_set_le_bit((nr),(unsigned long*)addr)
-#define ext2_clear_bit(nr, addr) \
-	__test_and_clear_le_bit((nr),(unsigned long*)addr)
- #define ext2_set_bit_atomic(lock, nr, addr)		\
-({							\
-	int ret;					\
-	spin_lock(lock);				\
-	ret = ext2_set_bit((nr), (addr));		\
-	spin_unlock(lock);				\
-	ret;						\
-})
-
-#define ext2_clear_bit_atomic(lock, nr, addr)		\
-({							\
-	int ret;					\
-	spin_lock(lock);				\
-	ret = ext2_clear_bit((nr), (addr));		\
-	spin_unlock(lock);				\
-	ret;						\
-})
-#define ext2_test_bit(nr, addr)	test_le_bit((nr),(unsigned long*)addr)
-#define ext2_find_first_zero_bit(addr, size) \
-	find_first_zero_le_bit((unsigned long*)addr, size)
-#define ext2_find_next_zero_bit(addr, size, off) \
-	find_next_zero_le_bit((unsigned long*)addr, size, off)
+#ifdef __KERNEL__
 
-/*
- * Bitmap functions for the minix filesystem.
- *
- * FIXME: These assume that Minix uses the native byte/bitorder.
- * This limits the Minix filesystem's value for data exchange very much.
- */
-#define minix_test_and_set_bit(nr,addr) __test_and_set_bit(nr,addr)
-#define minix_set_bit(nr,addr) __set_bit(nr,addr)
-#define minix_test_and_clear_bit(nr,addr) __test_and_clear_bit(nr,addr)
-#define minix_test_bit(nr,addr) test_bit(nr,addr)
-#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
+#include <asm-generic/bitops/sched.h>
+#include <asm-generic/bitops/hweight.h>
+#include <asm-generic/bitops/ext2-non-atomic.h>
+#include <asm-generic/bitops/ext2-atomic.h>
+#include <asm-generic/bitops/minix.h>
 
 #endif /* __KERNEL__ */
 

--

From ak@suse.de Wed Feb  1 09:12:37 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 01 Feb 2006 09:13:04 +0000 (GMT)
Received: from cantor2.suse.de ([195.135.220.15]:37020 "EHLO mx2.suse.de")
	by ftp.linux-mips.org with ESMTP id S8133646AbWBAJCP (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Wed, 1 Feb 2006 09:02:15 +0000
Received: from Relay2.suse.de (mail2.suse.de [195.135.221.8])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mx2.suse.de (Postfix) with ESMTP id 45F721C591;
	Wed,  1 Feb 2006 10:07:15 +0100 (CET)
From:	Andi Kleen <ak@suse.de>
To:	Akinobu Mita <mita@miraclelinux.com>
Subject: Re: [patch 14/44] generic hweight{64,32,16,8}()
Date:	Wed, 1 Feb 2006 10:06:07 +0100
User-Agent: KMail/1.8.2
Cc:	linux-kernel@vger.kernel.org, Richard Henderson <rth@twiddle.net>,
	Ivan Kokshaysky <ink@jurassic.park.msu.ru>,
	Russell King <rmk@arm.linux.org.uk>,
	Ian Molton <spyro@f2s.com>, dev-etrax@axis.com,
	David Howells <dhowells@redhat.com>,
	Yoshinori Sato <ysato@users.sourceforge.jp>,
	Linus Torvalds <torvalds@osdl.org>, linux-ia64@vger.kernel.org,
	Hirokazu Takata <takata@linux-m32r.org>,
	linux-m68k@lists.linux-m68k.org, Greg Ungerer <gerg@uclinux.org>,
	linux-mips@linux-mips.org, parisc-linux@parisc-linux.org,
	linuxppc-dev@ozlabs.org, linux390@de.ibm.com,
	linuxsh-dev@lists.sourceforge.net,
	linuxsh-shmedia-dev@lists.sourceforge.net,
	sparclinux@vger.kernel.org, ultralinux@vger.kernel.org,
	Miles Bader <uclinux-v850@lsi.nec.co.jp>,
	Chris Zankel <chris@zankel.net>
References: <20060201090224.536581000@localhost.localdomain> <20060201090325.905071000@localhost.localdomain>
In-Reply-To: <20060201090325.905071000@localhost.localdomain>
MIME-Version: 1.0
Content-Type: text/plain;
  charset="utf-8"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200602011006.09596.ak@suse.de>
Return-Path: <ak@suse.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: 10278
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: ak@suse.de
Precedence: bulk
X-list: linux-mips

On Wednesday 01 February 2006 10:02, Akinobu Mita wrote:

> +static inline unsigned int hweight32(unsigned int w)
> +{
> +        unsigned int res = (w & 0x55555555) + ((w >> 1) & 0x55555555);
> +        res = (res & 0x33333333) + ((res >> 2) & 0x33333333);
> +        res = (res & 0x0F0F0F0F) + ((res >> 4) & 0x0F0F0F0F);
> +        res = (res & 0x00FF00FF) + ((res >> 8) & 0x00FF00FF);
> +        return (res & 0x0000FFFF) + ((res >> 16) & 0x0000FFFF);
> +}

How large are these functions on x86? Maybe it would be better to not inline them,
but put it into some C file out of line.

-Andi

From mjt@tls.msk.ru Wed Feb  1 09:21:13 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 01 Feb 2006 09:21:33 +0000 (GMT)
Received: from hobbit.corpit.ru ([81.13.94.6]:45920 "EHLO hobbit.corpit.ru")
	by ftp.linux-mips.org with ESMTP id S8133742AbWBAJVM (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Wed, 1 Feb 2006 09:21:12 +0000
Received: from localhost (localhost [127.0.0.1])
	by hobbit.corpit.ru (Postfix) with ESMTP id 39BB82A7F1;
	Wed,  1 Feb 2006 12:26:07 +0300 (MSK)
	(envelope-from mjt@tls.msk.ru)
Received: from [192.168.1.1] (paltus.tls.msk.ru [192.168.1.1])
	by hobbit.corpit.ru (Postfix) with ESMTP;
	Wed,  1 Feb 2006 12:26:07 +0300 (MSK)
	(envelope-from mjt@tls.msk.ru)
Message-ID: <43E07EB2.4020409@tls.msk.ru>
Date:	Wed, 01 Feb 2006 12:26:10 +0300
From:	Michael Tokarev <mjt@tls.msk.ru>
User-Agent: Debian Thunderbird 1.0.2 (X11/20051002)
X-Accept-Language: en-us, en
MIME-Version: 1.0
To:	Andi Kleen <ak@suse.de>
CC:	Akinobu Mita <mita@miraclelinux.com>, linux-kernel@vger.kernel.org,
	Richard Henderson <rth@twiddle.net>,
	Ivan Kokshaysky <ink@jurassic.park.msu.ru>,
	Russell King <rmk@arm.linux.org.uk>,
	Ian Molton <spyro@f2s.com>, dev-etrax@axis.com,
	David Howells <dhowells@redhat.com>,
	Yoshinori Sato <ysato@users.sourceforge.jp>,
	Linus Torvalds <torvalds@osdl.org>, linux-ia64@vger.kernel.org,
	Hirokazu Takata <takata@linux-m32r.org>,
	linux-m68k@lists.linux-m68k.org, Greg Ungerer <gerg@uclinux.org>,
	linux-mips@linux-mips.org, parisc-linux@parisc-linux.org,
	linuxppc-dev@ozlabs.org, linux390@de.ibm.com,
	linuxsh-dev@lists.sourceforge.net,
	linuxsh-shmedia-dev@lists.sourceforge.net,
	sparclinux@vger.kernel.org, ultralinux@vger.kernel.org,
	Miles Bader <uclinux-v850@lsi.nec.co.jp>,
	Chris Zankel <chris@zankel.net>
Subject: Re: [patch 14/44] generic hweight{64,32,16,8}()
References: <20060201090224.536581000@localhost.localdomain> <20060201090325.905071000@localhost.localdomain> <200602011006.09596.ak@suse.de>
In-Reply-To: <200602011006.09596.ak@suse.de>
X-Enigmail-Version: 0.91.0.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Return-Path: <mjt@tls.msk.ru>
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: 10279
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: mjt@tls.msk.ru
Precedence: bulk
X-list: linux-mips

Andi Kleen wrote:
> On Wednesday 01 February 2006 10:02, Akinobu Mita wrote:
> 
>>+static inline unsigned int hweight32(unsigned int w)
[]
> How large are these functions on x86? Maybe it would be better to not inline them,
> but put it into some C file out of line.

hweight8	47 bytes
hweight16	76 bytes
hweight32	97 bytes
hweight64	56 bytes (NOT inlining hweight32)
hweight64	197 bytes (inlining hweight32)

Those are when compiled as separate non-inlined functions,
with pushl %ebp and ret.

/mjt

From ak@suse.de Wed Feb  1 10:43:21 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 01 Feb 2006 10:43:39 +0000 (GMT)
Received: from cantor.suse.de ([195.135.220.2]:59810 "EHLO mx1.suse.de")
	by ftp.linux-mips.org with ESMTP id S8133648AbWBAKnV (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Wed, 1 Feb 2006 10:43:21 +0000
Received: from Relay1.suse.de (mail2.suse.de [195.135.221.8])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mx1.suse.de (Postfix) with ESMTP id 030B5E7D1;
	Wed,  1 Feb 2006 11:48:22 +0100 (CET)
From:	Andi Kleen <ak@suse.de>
To:	Michael Tokarev <mjt@tls.msk.ru>
Subject: Re: [patch 14/44] generic hweight{64,32,16,8}()
Date:	Wed, 1 Feb 2006 11:24:27 +0100
User-Agent: KMail/1.8.2
Cc:	Akinobu Mita <mita@miraclelinux.com>, linux-kernel@vger.kernel.org,
	Richard Henderson <rth@twiddle.net>,
	Ivan Kokshaysky <ink@jurassic.park.msu.ru>,
	Russell King <rmk@arm.linux.org.uk>,
	Ian Molton <spyro@f2s.com>, dev-etrax@axis.com,
	David Howells <dhowells@redhat.com>,
	Yoshinori Sato <ysato@users.sourceforge.jp>,
	Linus Torvalds <torvalds@osdl.org>, linux-ia64@vger.kernel.org,
	Hirokazu Takata <takata@linux-m32r.org>,
	linux-m68k@lists.linux-m68k.org, Greg Ungerer <gerg@uclinux.org>,
	linux-mips@linux-mips.org, parisc-linux@parisc-linux.org,
	linuxppc-dev@ozlabs.org, linux390@de.ibm.com,
	linuxsh-dev@lists.sourceforge.net,
	linuxsh-shmedia-dev@lists.sourceforge.net,
	sparclinux@vger.kernel.org, ultralinux@vger.kernel.org,
	Miles Bader <uclinux-v850@lsi.nec.co.jp>,
	Chris Zankel <chris@zankel.net>
References: <20060201090224.536581000@localhost.localdomain> <200602011006.09596.ak@suse.de> <43E07EB2.4020409@tls.msk.ru>
In-Reply-To: <43E07EB2.4020409@tls.msk.ru>
MIME-Version: 1.0
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200602011124.29423.ak@suse.de>
Return-Path: <ak@suse.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: 10280
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: ak@suse.de
Precedence: bulk
X-list: linux-mips

On Wednesday 01 February 2006 10:26, Michael Tokarev wrote:
> Andi Kleen wrote:
> > On Wednesday 01 February 2006 10:02, Akinobu Mita wrote:
> > 
> >>+static inline unsigned int hweight32(unsigned int w)
> []
> > How large are these functions on x86? Maybe it would be better to not inline them,
> > but put it into some C file out of line.
> 
> hweight8	47 bytes
> hweight16	76 bytes
> hweight32	97 bytes
> hweight64	56 bytes (NOT inlining hweight32)
> hweight64	197 bytes (inlining hweight32)
> 
> Those are when compiled as separate non-inlined functions,
> with pushl %ebp and ret.

This would argue for moving them out of line.

-Andi

From zippel@linux-m68k.org Wed Feb  1 11:24:09 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 01 Feb 2006 11:24:28 +0000 (GMT)
Received: from scrub.xs4all.nl ([194.109.195.176]:61914 "EHLO scrub.xs4all.nl")
	by ftp.linux-mips.org with ESMTP id S8133658AbWBALYJ (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Wed, 1 Feb 2006 11:24:09 +0000
Received: from roman (helo=localhost)
	by scrub.xs4all.nl with local-esmtp (Exim 3.36 #1 (Debian))
	id 1F4G9C-0006bi-00; Wed, 01 Feb 2006 12:27:38 +0100
Date:	Wed, 1 Feb 2006 12:27:38 +0100 (CET)
From:	Roman Zippel <zippel@linux-m68k.org>
X-X-Sender: roman@scrub.home
To:	Akinobu Mita <mita@miraclelinux.com>
cc:	linux-kernel@vger.kernel.org, Richard Henderson <rth@twiddle.net>,
	Ivan Kokshaysky <ink@jurassic.park.msu.ru>, dev-etrax@axis.com,
	David Howells <dhowells@redhat.com>,
	Yoshinori Sato <ysato@users.sourceforge.jp>,
	Linus Torvalds <torvalds@osdl.org>, linux-ia64@vger.kernel.org,
	Hirokazu Takata <takata@linux-m32r.org>,
	linux-m68k@vger.kernel.org, linux-mips@linux-mips.org,
	parisc-linux@parisc-linux.org, linuxsh-dev@lists.sourceforge.net,
	linuxsh-shmedia-dev@lists.sourceforge.net,
	sparclinux@vger.kernel.org, ultralinux@vger.kernel.org,
	Miles Bader <uclinux-v850@lsi.nec.co.jp>,
	Andi Kleen <ak@suse.de>, Chris Zankel <chris@zankel.net>
Subject: Re: [patch 15/44] generic ext2_{set,clear,test,find_first_zero,find_next_zero}_bit()
In-Reply-To: <20060201090326.139510000@localhost.localdomain>
Message-ID: <Pine.LNX.4.61.0602011214270.12293@scrub.home>
References: <20060201090224.536581000@localhost.localdomain>
 <20060201090326.139510000@localhost.localdomain>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Return-Path: <zippel@linux-m68k.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: 10281
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: zippel@linux-m68k.org
Precedence: bulk
X-list: linux-mips

Hi,

On Wed, 1 Feb 2006, Akinobu Mita wrote:

> +static __inline__ int generic_test_le_bit(unsigned long nr,
> +				  __const__ unsigned long *addr)
> +{
> +	__const__ unsigned char	*tmp = (__const__ unsigned char *) addr;
> +	return (tmp[nr >> 3] >> (nr & 7)) & 1;
> +}

The underscores are not needed.

For the inline version I would prefer this version:

{
	const unsigned char *tmp = (const unsigned char *)addr;
	return (tmp[nr >> 3] & (unsigned char)(1 << (nr & 7))) != 0;
}

Although this would be a good alternative as well:

{
	return (addr[nr >> 5] & (1 << ((nr ^ 24) & 31))) != 0;
}

bye, Roman

From anemo@mba.ocn.ne.jp Wed Feb  1 16:21:53 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 01 Feb 2006 16:22:11 +0000 (GMT)
Received: from mba.ocn.ne.jp ([210.190.142.172]:40183 "HELO smtp.mba.ocn.ne.jp")
	by ftp.linux-mips.org with SMTP id S8133730AbWBAQVw (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Wed, 1 Feb 2006 16:21:52 +0000
Received: from localhost (p6192-ipad212funabasi.chiba.ocn.ne.jp [58.91.170.192])
	by smtp.mba.ocn.ne.jp (Postfix) with ESMTP
	id 6E0B38422; Thu,  2 Feb 2006 01:26:54 +0900 (JST)
Date:	Thu, 02 Feb 2006 01:26:34 +0900 (JST)
Message-Id: <20060202.012634.08076945.anemo@mba.ocn.ne.jp>
To:	linux-mips@linux-mips.org
Cc:	ralf@linux-mips.org
Subject: [PATCH] fix minor sparse warnings
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: 10282
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

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

diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c
index e8e43bd..aaec478 100644
--- a/arch/mips/kernel/signal.c
+++ b/arch/mips/kernel/signal.c
@@ -340,7 +340,7 @@ int setup_rt_frame(struct k_sigaction * 
 
 	/* Create the ucontext.  */
 	err |= __put_user(0, &frame->rs_uc.uc_flags);
-	err |= __put_user(0, &frame->rs_uc.uc_link);
+	err |= __put_user(NULL, &frame->rs_uc.uc_link);
 	err |= __put_user((void *)current->sas_ss_sp,
 	                  &frame->rs_uc.uc_stack.ss_sp);
 	err |= __put_user(sas_ss_flags(regs->regs[29]),
diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c
index 7c2241e..136260c 100644
--- a/arch/mips/kernel/signal32.c
+++ b/arch/mips/kernel/signal32.c
@@ -456,7 +456,7 @@ int copy_siginfo_to_user32(compat_siginf
 			err |= __put_user(from->si_uid, &to->si_uid);
 			break;
 		case __SI_FAULT >> 16:
-			err |= __put_user((long)from->si_addr, &to->si_addr);
+			err |= __put_user((unsigned long)from->si_addr, &to->si_addr);
 			break;
 		case __SI_POLL >> 16:
 			err |= __put_user(from->si_band, &to->si_band);
diff --git a/arch/mips/kernel/signal_n32.c b/arch/mips/kernel/signal_n32.c
index 3d2f8e3..9156863 100644
--- a/arch/mips/kernel/signal_n32.c
+++ b/arch/mips/kernel/signal_n32.c
@@ -48,6 +48,8 @@
 #define __NR_N32_rt_sigreturn		6211
 #define __NR_N32_restart_syscall	6214
 
+#define DEBUG_SIG 0
+
 #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
 
 /* IRIX compatible stack_t  */

From anemo@mba.ocn.ne.jp Wed Feb  1 16:24:33 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 01 Feb 2006 16:24:51 +0000 (GMT)
Received: from mba.ocn.ne.jp ([210.190.142.172]:16094 "HELO smtp.mba.ocn.ne.jp")
	by ftp.linux-mips.org with SMTP id S3458481AbWBAQYd (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Wed, 1 Feb 2006 16:24:33 +0000
Received: from localhost (p6192-ipad212funabasi.chiba.ocn.ne.jp [58.91.170.192])
	by smtp.mba.ocn.ne.jp (Postfix) with ESMTP
	id 95CAFA3E4; Thu,  2 Feb 2006 01:29:34 +0900 (JST)
Date:	Thu, 02 Feb 2006 01:29:14 +0900 (JST)
Message-Id: <20060202.012914.63131159.anemo@mba.ocn.ne.jp>
To:	linux-mips@linux-mips.org
Cc:	ralf@linux-mips.org
Subject: [PATCH] fix dump_tlb.c warning and 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: 10283
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

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

diff --git a/arch/mips/lib-32/dump_tlb.c b/arch/mips/lib-32/dump_tlb.c
index 47d7229..7d4c318 100644
--- a/arch/mips/lib-32/dump_tlb.c
+++ b/arch/mips/lib-32/dump_tlb.c
@@ -156,29 +156,26 @@ void dump_list_process(struct task_struc
 	printk("task->mm             == %8p\n", t->mm);
 	//printk("tasks->mm.pgd        == %08x\n", (unsigned int) t->mm->pgd);
 
-	if (addr > KSEG0)
+	if (addr > KSEG0) {
 		page_dir = pgd_offset_k(0);
-	else if (t->mm) {
-		page_dir = pgd_offset(t->mm, 0);
-		printk("page_dir == %08x\n", (unsigned int) page_dir);
-	} else
-		printk("Current thread has no mm\n");
-
-	if (addr > KSEG0)
 		pgd = pgd_offset_k(addr);
-	else if (t->mm) {
+	} else if (t->mm) {
+		page_dir = pgd_offset(t->mm, 0);
 		pgd = pgd_offset(t->mm, addr);
-		printk("pgd == %08x, ", (unsigned int) pgd);
-		pud = pud_offset(pgd, addr);
-		printk("pud == %08x, ", (unsigned int) pud);
-
-		pmd = pmd_offset(pud, addr);
-		printk("pmd == %08x, ", (unsigned int) pmd);
-
-		pte = pte_offset(pmd, addr);
-		printk("pte == %08x, ", (unsigned int) pte);
-	} else
+	} else {
 		printk("Current thread has no mm\n");
+		return;
+	}
+	printk("page_dir == %08x\n", (unsigned int) page_dir);
+	printk("pgd == %08x, ", (unsigned int) pgd);
+	pud = pud_offset(pgd, addr);
+	printk("pud == %08x, ", (unsigned int) pud);
+
+	pmd = pmd_offset(pud, addr);
+	printk("pmd == %08x, ", (unsigned int) pmd);
+
+	pte = pte_offset(pmd, addr);
+	printk("pte == %08x, ", (unsigned int) pte);
 
 	page = *pte;
 #ifdef CONFIG_64BIT_PHYS_ADDR

From anemo@mba.ocn.ne.jp Wed Feb  1 16:33:03 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 01 Feb 2006 16:33:22 +0000 (GMT)
Received: from mba.ocn.ne.jp ([210.190.142.172]:38870 "HELO smtp.mba.ocn.ne.jp")
	by ftp.linux-mips.org with SMTP id S3458482AbWBAQdD (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Wed, 1 Feb 2006 16:33:03 +0000
Received: from localhost (p6192-ipad212funabasi.chiba.ocn.ne.jp [58.91.170.192])
	by smtp.mba.ocn.ne.jp (Postfix) with ESMTP
	id 38357A41A; Thu,  2 Feb 2006 01:38:07 +0900 (JST)
Date:	Thu, 02 Feb 2006 01:37:46 +0900 (JST)
Message-Id: <20060202.013746.36924107.anemo@mba.ocn.ne.jp>
To:	linux-mips@linux-mips.org
Cc:	ralf@linux-mips.org
Subject: Re: [PATCH] local_r4k_flush_cache_page fix
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
In-Reply-To: <20060201.153154.108306076.nemoto@toshiba-tops.co.jp>
References: <20060201.000356.25911337.anemo@mba.ocn.ne.jp>
	<20060201.153154.108306076.nemoto@toshiba-tops.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: 10284
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, 01 Feb 2006 15:31:54 +0900 (JST), Atsushi Nemoto <anemo@mba.ocn.ne.jp> said:

anemo> BTW, I wonder if current code (with or without this patch)
anemo> works properly for physically indexed cache.  Though I do not
anemo> know if there were physically indexed icache, there are
anemo> certainly physically indexed dcache (ex. MIPS 20KC).

anemo> For those physically indexed caches, we should use 'pfn'
anemo> argument passed to flush_cache_page ?

I'm thinking of introducing MIPS_CACHE_PINDEX and 'cpu_has_pindex_dcache'.

I guess secondary cache is also physically indexed.  Is there any
virtually indexed secondary cache ?

---
Atsushi Nemoto

From drow@nevyn.them.org Wed Feb  1 16:39:20 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 01 Feb 2006 16:39:38 +0000 (GMT)
Received: from nevyn.them.org ([66.93.172.17]:1720 "EHLO nevyn.them.org")
	by ftp.linux-mips.org with ESMTP id S3458481AbWBAQjU (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Wed, 1 Feb 2006 16:39:20 +0000
Received: from drow by nevyn.them.org with local (Exim 4.54)
	id 1F4L5k-0001K6-OF; Wed, 01 Feb 2006 11:44:24 -0500
Date:	Wed, 1 Feb 2006 11:44:24 -0500
From:	Daniel Jacobowitz <dan@debian.org>
To:	"Maciej W. Rozycki" <macro@linux-mips.org>
Cc:	Johannes Stezenbach <js@linuxtv.org>, linux-mips@linux-mips.org
Subject: Re: gdb vs. gdbserver with -mips3 / 32bitmode userspace
Message-ID: <20060201164423.GA4891@nevyn.them.org>
References: <20060131171508.GB6341@linuxtv.org> <Pine.LNX.4.64N.0601311724340.31371@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.0601311724340.31371@blysk.ds.pg.gda.pl>
User-Agent: Mutt/1.5.8i
Return-Path: <drow@nevyn.them.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: 10285
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: dan@debian.org
Precedence: bulk
X-list: linux-mips

On Tue, Jan 31, 2006 at 05:36:13PM +0000, Maciej W. Rozycki wrote:
> On Tue, 31 Jan 2006, Johannes Stezenbach wrote:
> 
> > I think (maybe in error ;-), that all binaries compiled for
> > a 32bit ABI, but a 64bit ISA, have this flag set, as the kernel
> > will refuse to execute 64bt code (i.e. not o32 or n32 ABI). Therefore,
> > shouldn't gdb also evaluate this flag when deciding about the ISA
> > register size?
> 
>  O32 implies 32-bit registers no matter what ISA is specified (while 
> o32/MIPS-III is effectively o32/MIPS-II, o32/MIPS-IV makes a difference), 
> therefore it's a bug.  You should try sending your proposal to 
> <gdb-patches@sources.redhat.com> instead.  But I smell the problem is 
> elsewhere -- mips_isa_regsize() shouldn't be called for the "cooked" 
> registers and these are ones you should only see under Linux or, as a 
> matter of fact, any hosted environment.  See mips_register_type() for a 
> start.

All of this code is flat-out wrong, as far as I'm concerned.  I have a
project underway which will fix it, as a nice side effect.

GDB is trying to do something confusing, but admirable, here.  When
you're running on a 64-bit system the full 64 bits are always there:
even if the binary only uses half of them (is this true in Linux?  I
don't remember if the relevant control bits get fudged, it's been a
while; it's definitely true on some other systems).  Thus it's possible
for a bogus instruction to corrupt the top half of a register, leading
to otherwise inexplicable problems.

So if the remote stub knows about 64-bit registers, it should report
them to GDB, and GDB should accept and display them, and still handle
32-bit frames.  If the remote stub doesn't, then there's no option but
to report the 32-bit registers.

Really, GDB ought to (and soon will I hope) autodetect which ones were
sent.

-- 
Daniel Jacobowitz
CodeSourcery

From macro@linux-mips.org Wed Feb  1 16:48:52 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 01 Feb 2006 16:49:09 +0000 (GMT)
Received: from pollux.ds.pg.gda.pl ([153.19.208.7]:22033 "EHLO
	pollux.ds.pg.gda.pl") by ftp.linux-mips.org with ESMTP
	id S3458481AbWBAQsw (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 1 Feb 2006 16:48:52 +0000
Received: from localhost (localhost [127.0.0.1])
	by pollux.ds.pg.gda.pl (Postfix) with ESMTP id 7FE06F59F6;
	Wed,  1 Feb 2006 17:53:53 +0100 (CET)
Received: from pollux.ds.pg.gda.pl ([127.0.0.1])
 by localhost (pollux [127.0.0.1]) (amavisd-new, port 10024) with ESMTP
 id 07299-01; Wed,  1 Feb 2006 17:53:53 +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 37487E1CAE;
	Wed,  1 Feb 2006 17:53:53 +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.3/8.13.1) with ESMTP id k11Grfx3028924;
	Wed, 1 Feb 2006 17:53:41 +0100
Date:	Wed, 1 Feb 2006 16:53:55 +0000 (GMT)
From:	"Maciej W. Rozycki" <macro@linux-mips.org>
To:	Daniel Jacobowitz <dan@debian.org>
Cc:	Johannes Stezenbach <js@linuxtv.org>, linux-mips@linux-mips.org
Subject: Re: gdb vs. gdbserver with -mips3 / 32bitmode userspace
In-Reply-To: <20060201164423.GA4891@nevyn.them.org>
Message-ID: <Pine.LNX.4.64N.0602011649430.6677@blysk.ds.pg.gda.pl>
References: <20060131171508.GB6341@linuxtv.org>
 <Pine.LNX.4.64N.0601311724340.31371@blysk.ds.pg.gda.pl>
 <20060201164423.GA4891@nevyn.them.org>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Virus-Scanned: ClamAV 0.87.1/1264/Wed Feb  1 13:38:31 2006 on piorun.ds.pg.gda.pl
X-Virus-Status:	Clean
X-Virus-Scanned: by amavisd-new at pollux.ds.pg.gda.pl
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: 10286
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 Wed, 1 Feb 2006, Daniel Jacobowitz wrote:

> All of this code is flat-out wrong, as far as I'm concerned.  I have a
> project underway which will fix it, as a nice side effect.

 Great!.

> GDB is trying to do something confusing, but admirable, here.  When
> you're running on a 64-bit system the full 64 bits are always there:
> even if the binary only uses half of them (is this true in Linux?  I
> don't remember if the relevant control bits get fudged, it's been a
> while; it's definitely true on some other systems).  Thus it's possible
> for a bogus instruction to corrupt the top half of a register, leading
> to otherwise inexplicable problems.

 Well, cp0.status.ux is always set with a 64-bit kernel.  It is not with a 
32-bit one.  A binary marked as o32/MIPS-III will work with either as long 
as 64-bit operations are not used.  For implementations that provide the 
cp0.status.xx bit, it is always set so that at least 32-bit MIPS-IV 
instructions work.

  Maciej

From uhler@mips.com Wed Feb  1 17:23:09 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 01 Feb 2006 17:23:28 +0000 (GMT)
Received: from 209-232-97-206.ded.pacbell.net ([209.232.97.206]:31965 "EHLO
	dns0.mips.com") by ftp.linux-mips.org with ESMTP id S3458489AbWBARXI convert rfc822-to-8bit
	(ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 1 Feb 2006 17:23:08 +0000
Received: from mercury.mips.com (sbcns-dmz [209.232.97.193])
	by dns0.mips.com (8.12.11/8.12.11) with ESMTP id k11HRSEB027413;
	Wed, 1 Feb 2006 09:27:33 -0800 (PST)
Received: from laptopuhler4 ([192.168.2.16])
	by mercury.mips.com (8.12.9/8.12.11) with ESMTP id k11HRQYr029004;
	Wed, 1 Feb 2006 09:27:27 -0800 (PST)
From:	"Michael Uhler" <uhler@mips.com>
To:	"'Daniel Jacobowitz'" <dan@debian.org>,
	"'Maciej W. Rozycki'" <macro@linux-mips.org>
Cc:	"'Johannes Stezenbach'" <js@linuxtv.org>,
	<linux-mips@linux-mips.org>
Subject: RE: gdb vs. gdbserver with -mips3 / 32bitmode userspace
Date:	Wed, 1 Feb 2006 09:26:57 -0800
Organization: MIPS Technologies, Inc.
Message-ID: <005901c62754$b414dc80$bb14a8c0@MIPS.COM>
MIME-Version: 1.0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 8BIT
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook, Build 10.0.6626
In-Reply-To: <20060201164423.GA4891@nevyn.them.org>
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
Importance: Normal
X-Scanned-By: MIMEDefang 2.39
Return-Path: <uhler@mips.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: 10287
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: uhler@mips.com
Precedence: bulk
X-list: linux-mips

Daniel,

The O/S maybe doing something different, but the architecture has 3 bits in
Status: KX, SX, and UX that enable access to the address space above 32
bits.  With these bits off, an attempt to access these addresses causes an
exception.  So while 32-bit apps have the full 64-bit address space, most of
it is inaccessible to the 32-bit app.

There's a table in Chapter 4 of the MIPS64 Privileged Architecture Spec on
our web page that describes exactly what address references are gated by
what bit.

I notice the original question was about MIPS III.  There were certain early
chips that had problems with access control on the extended segments, so
it's possible that there could be implementation-specific problems.


/gmu
---
Michael Uhler, Chief Technology Officer
MIPS Technologies, Inc.   Email: uhler@mips.com
1225 Charleston Road      Voice:  (650)567-5025   FAX:   (650)567-5225
Mountain View, CA 94043   Mobile: (650)868-6870   Admin: (650)567-5085


> -----Original Message-----
> From: linux-mips-bounce@linux-mips.org 
> [mailto:linux-mips-bounce@linux-mips.org] On Behalf Of Daniel 
> Jacobowitz
> Sent: Wednesday, February 01, 2006 8:44 AM
> To: Maciej W. Rozycki
> Cc: Johannes Stezenbach; linux-mips@linux-mips.org
> Subject: Re: gdb vs. gdbserver with -mips3 / 32bitmode userspace
> 
> 
> On Tue, Jan 31, 2006 at 05:36:13PM +0000, Maciej W. Rozycki wrote:
> > On Tue, 31 Jan 2006, Johannes Stezenbach wrote:
> > 
> > > I think (maybe in error ;-), that all binaries compiled 
> for a 32bit 
> > > ABI, but a 64bit ISA, have this flag set, as the kernel 
> will refuse 
> > > to execute 64bt code (i.e. not o32 or n32 ABI). 
> Therefore, shouldn't 
> > > gdb also evaluate this flag when deciding about the ISA register 
> > > size?
> > 
> >  O32 implies 32-bit registers no matter what ISA is specified (while
> > o32/MIPS-III is effectively o32/MIPS-II, o32/MIPS-IV makes 
> a difference), 
> > therefore it's a bug.  You should try sending your proposal to 
> > <gdb-patches@sources.redhat.com> instead.  But I smell the 
> problem is 
> > elsewhere -- mips_isa_regsize() shouldn't be called for the 
> "cooked" 
> > registers and these are ones you should only see under 
> Linux or, as a 
> > matter of fact, any hosted environment.  See 
> mips_register_type() for a 
> > start.
> 
> All of this code is flat-out wrong, as far as I'm concerned.  
> I have a project underway which will fix it, as a nice side effect.
> 
> GDB is trying to do something confusing, but admirable, here. 
>  When you're running on a 64-bit system the full 64 bits are 
> always there: even if the binary only uses half of them (is 
> this true in Linux?  I don't remember if the relevant control 
> bits get fudged, it's been a while; it's definitely true on 
> some other systems).  Thus it's possible for a bogus 
> instruction to corrupt the top half of a register, leading to 
> otherwise inexplicable problems.
> 
> So if the remote stub knows about 64-bit registers, it should 
> report them to GDB, and GDB should accept and display them, 
> and still handle 32-bit frames.  If the remote stub doesn't, 
> then there's no option but to report the 32-bit registers.
> 
> Really, GDB ought to (and soon will I hope) autodetect which 
> ones were sent.
> 
> -- 
> Daniel Jacobowitz
> CodeSourcery
> 
> 


From js@linuxtv.org Wed Feb  1 19:02:05 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 01 Feb 2006 19:02:31 +0000 (GMT)
Received: from allen.werkleitz.de ([80.190.251.108]:64966 "EHLO
	allen.werkleitz.de") by ftp.linux-mips.org with ESMTP
	id S3458570AbWBATCF (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 1 Feb 2006 19:02:05 +0000
Received: from p54be9954.dip0.t-ipconnect.de ([84.190.153.84] helo=void.local)
	by allen.werkleitz.de with esmtpsa (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA1:24)
	(Exim 4.60)
	(envelope-from <js@linuxtv.org>)
	id 1F4NJm-0007Tt-EY; Wed, 01 Feb 2006 20:07:08 +0100
Received: from js by void.local with local (Exim 3.35 #1 (Debian))
	id 1F4NJl-0005eR-00; Wed, 01 Feb 2006 20:07:01 +0100
Date:	Wed, 1 Feb 2006 20:07:01 +0100
From:	Johannes Stezenbach <js@linuxtv.org>
To:	Thiemo Seufer <ths@networkno.de>,
	"Maciej W. Rozycki" <macro@linux-mips.org>,
	linux-mips@linux-mips.org
Message-ID: <20060201190701.GA20411@linuxtv.org>
Mail-Followup-To: Johannes Stezenbach <js@linuxtv.org>,
	Thiemo Seufer <ths@networkno.de>,
	"Maciej W. Rozycki" <macro@linux-mips.org>,
	linux-mips@linux-mips.org
References: <20060131171508.GB6341@linuxtv.org> <Pine.LNX.4.64N.0601311724340.31371@blysk.ds.pg.gda.pl> <20060131181414.GA8288@linuxtv.org> <20060131184253.GA23753@networkno.de> <20060131192314.GB8826@linuxtv.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20060131192314.GB8826@linuxtv.org>
User-Agent: Mutt/1.5.11
X-SA-Exim-Connect-IP: 84.190.153.84
Subject: Re: gdb vs. gdbserver with -mips3 / 32bitmode userspace
X-SA-Exim-Version: 4.2 (built Thu, 03 Mar 2005 10:44:12 +0100)
X-SA-Exim-Scanned: Yes (on allen.werkleitz.de)
Return-Path: <js@linuxtv.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: 10288
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: js@linuxtv.org
Precedence: bulk
X-list: linux-mips

On Tue, Jan 31, 2006, Johannes Stezenbach wrote:
> On Tue, Jan 31, 2006, Thiemo Seufer wrote:
> > On Tue, Jan 31, 2006 at 07:14:14PM +0100, Johannes Stezenbach wrote:
> > [snip]
> > > Yes, that's why I said I'm confused about mips_isa_regsize() vs.
> > > mips_abi_regsize().
> > > 
> > > mips_abi_regsize() correctly says the register size is 32bit for o32,
> > > but mips_register_type() calls mips_isa_regsize(), not
> > > mips_abi_regsize(). That's why I chose to "fix" mips_isa_regsize().
> > > 
> > > Or should mips_register_type() simply call mips_abi_regsize()?
> > 
> > Without having had a look at the code I think that's the right fix.
> 
> OK, I'll test if that works for me, and post results here

OK, after some testing, the patch below seems to work.

Johannes


--- gdb-6.3/gdb/mips-tdep.c.orig	2004-10-15 09:25:03.000000000 +0200
+++ gdb-6.3/gdb/mips-tdep.c	2006-01-31 20:27:54.000000000 +0100
@@ -716,16 +716,16 @@ mips_register_type (struct gdbarch *gdba
       && (regnum % NUM_REGS) < mips_regnum (current_gdbarch)->fp0 + 32)
     {
       /* The floating-point registers raw, or cooked, always match
-         mips_isa_regsize(), and also map 1:1, byte for byte.  */
+         mips_abi_regsize(), and also map 1:1, byte for byte.  */
       switch (gdbarch_byte_order (gdbarch))
 	{
 	case BFD_ENDIAN_BIG:
-	  if (mips_isa_regsize (gdbarch) == 4)
+	  if (mips_abi_regsize (gdbarch) == 4)
 	    return builtin_type_ieee_single_big;
 	  else
 	    return builtin_type_ieee_double_big;
 	case BFD_ENDIAN_LITTLE:
-	  if (mips_isa_regsize (gdbarch) == 4)
+	  if (mips_abi_regsize (gdbarch) == 4)
 	    return builtin_type_ieee_single_little;
 	  else
 	    return builtin_type_ieee_double_little;
@@ -738,7 +738,7 @@ mips_register_type (struct gdbarch *gdba
     {
       /* The raw or ISA registers.  These are all sized according to
 	 the ISA regsize.  */
-      if (mips_isa_regsize (gdbarch) == 4)
+      if (mips_abi_regsize (gdbarch) == 4)
 	return builtin_type_int32;
       else
 	return builtin_type_int64;

From js@linuxtv.org Wed Feb  1 19:15:42 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 01 Feb 2006 19:16:00 +0000 (GMT)
Received: from allen.werkleitz.de ([80.190.251.108]:1991 "EHLO
	allen.werkleitz.de") by ftp.linux-mips.org with ESMTP
	id S3458570AbWBATPl (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 1 Feb 2006 19:15:41 +0000
Received: from p54be9954.dip0.t-ipconnect.de ([84.190.153.84] helo=void.local)
	by allen.werkleitz.de with esmtpsa (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA1:24)
	(Exim 4.60)
	(envelope-from <js@linuxtv.org>)
	id 1F4NWx-0007aH-9L; Wed, 01 Feb 2006 20:20:44 +0100
Received: from js by void.local with local (Exim 3.35 #1 (Debian))
	id 1F4NWw-0005h8-00; Wed, 01 Feb 2006 20:20:38 +0100
Date:	Wed, 1 Feb 2006 20:20:38 +0100
From:	Johannes Stezenbach <js@linuxtv.org>
To:	Thiemo Seufer <ths@networkno.de>,
	"Maciej W. Rozycki" <macro@linux-mips.org>,
	linux-mips@linux-mips.org
Message-ID: <20060201192038.GA21871@linuxtv.org>
Mail-Followup-To: Johannes Stezenbach <js@linuxtv.org>,
	Thiemo Seufer <ths@networkno.de>,
	"Maciej W. Rozycki" <macro@linux-mips.org>,
	linux-mips@linux-mips.org
References: <20060131171508.GB6341@linuxtv.org> <Pine.LNX.4.64N.0601311724340.31371@blysk.ds.pg.gda.pl> <20060131181414.GA8288@linuxtv.org> <20060131184253.GA23753@networkno.de> <20060131192314.GB8826@linuxtv.org> <20060201190701.GA20411@linuxtv.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20060201190701.GA20411@linuxtv.org>
User-Agent: Mutt/1.5.11
X-SA-Exim-Connect-IP: 84.190.153.84
Subject: Re: gdb vs. gdbserver with -mips3 / 32bitmode userspace
X-SA-Exim-Version: 4.2 (built Thu, 03 Mar 2005 10:44:12 +0100)
X-SA-Exim-Scanned: Yes (on allen.werkleitz.de)
Return-Path: <js@linuxtv.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: 10289
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: js@linuxtv.org
Precedence: bulk
X-list: linux-mips

On Wed, Feb 01, 2006 at 08:07:01PM +0100, Johannes Stezenbach wrote:
> OK, after some testing, the patch below seems to work.
[snip wrong patch]

I had my mail filters set up wrong I missed some replies which
went into the wrong folder :-(

Sorry about the noise,
Johannes

From drow@nevyn.them.org Wed Feb  1 19:19:02 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 01 Feb 2006 19:19:20 +0000 (GMT)
Received: from nevyn.them.org ([66.93.172.17]:479 "EHLO nevyn.them.org")
	by ftp.linux-mips.org with ESMTP id S3458570AbWBATTC (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Wed, 1 Feb 2006 19:19:02 +0000
Received: from drow by nevyn.them.org with local (Exim 4.54)
	id 1F4NaG-00033X-MM; Wed, 01 Feb 2006 14:24:04 -0500
Date:	Wed, 1 Feb 2006 14:24:04 -0500
From:	Daniel Jacobowitz <dan@debian.org>
To:	Michael Uhler <uhler@mips.com>
Cc:	"'Maciej W. Rozycki'" <macro@linux-mips.org>,
	'Johannes Stezenbach' <js@linuxtv.org>,
	linux-mips@linux-mips.org
Subject: Re: gdb vs. gdbserver with -mips3 / 32bitmode userspace
Message-ID: <20060201192404.GA11719@nevyn.them.org>
References: <20060201164423.GA4891@nevyn.them.org> <005901c62754$b414dc80$bb14a8c0@MIPS.COM>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <005901c62754$b414dc80$bb14a8c0@MIPS.COM>
User-Agent: Mutt/1.5.8i
Return-Path: <drow@nevyn.them.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: 10290
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: dan@debian.org
Precedence: bulk
X-list: linux-mips

On Wed, Feb 01, 2006 at 09:26:57AM -0800, Michael Uhler wrote:
> Daniel,
> 
> The O/S maybe doing something different, but the architecture has 3 bits in
> Status: KX, SX, and UX that enable access to the address space above 32
> bits.  With these bits off, an attempt to access these addresses causes an
> exception.  So while 32-bit apps have the full 64-bit address space, most of
> it is inaccessible to the 32-bit app.

That's not actually what I was referring to: there's at least one MIPS
implementation where the results of 32-bit arithmetic operations are
not just architecturally unpredictable but actually wrong if the upper
bits are not properly sign extended (I might be misremembering, but I
think I'm talking about the SB-1).  That's the sort of thing that can
be basically impossible to track down if your debugger doesn't show
you the whole register.

-- 
Daniel Jacobowitz
CodeSourcery

From js@linuxtv.org Wed Feb  1 19:39:46 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 01 Feb 2006 19:40:04 +0000 (GMT)
Received: from allen.werkleitz.de ([80.190.251.108]:4039 "EHLO
	allen.werkleitz.de") by ftp.linux-mips.org with ESMTP
	id S3458570AbWBATjq (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 1 Feb 2006 19:39:46 +0000
Received: from p54be9954.dip0.t-ipconnect.de ([84.190.153.84] helo=void.local)
	by allen.werkleitz.de with esmtpsa (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA1:24)
	(Exim 4.60)
	(envelope-from <js@linuxtv.org>)
	id 1F4NuF-0007hI-U9; Wed, 01 Feb 2006 20:44:49 +0100
Received: from js by void.local with local (Exim 3.35 #1 (Debian))
	id 1F4NuF-0005oL-00; Wed, 01 Feb 2006 20:44:43 +0100
Date:	Wed, 1 Feb 2006 20:44:43 +0100
From:	Johannes Stezenbach <js@linuxtv.org>
To:	Daniel Jacobowitz <dan@debian.org>
Cc:	"Maciej W. Rozycki" <macro@linux-mips.org>,
	linux-mips@linux-mips.org
Message-ID: <20060201194443.GB21871@linuxtv.org>
Mail-Followup-To: Johannes Stezenbach <js@linuxtv.org>,
	Daniel Jacobowitz <dan@debian.org>,
	"Maciej W. Rozycki" <macro@linux-mips.org>,
	linux-mips@linux-mips.org
References: <20060131171508.GB6341@linuxtv.org> <Pine.LNX.4.64N.0601311724340.31371@blysk.ds.pg.gda.pl> <20060201164423.GA4891@nevyn.them.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20060201164423.GA4891@nevyn.them.org>
User-Agent: Mutt/1.5.11
X-SA-Exim-Connect-IP: 84.190.153.84
Subject: Re: gdb vs. gdbserver with -mips3 / 32bitmode userspace
X-SA-Exim-Version: 4.2 (built Thu, 03 Mar 2005 10:44:12 +0100)
X-SA-Exim-Scanned: Yes (on allen.werkleitz.de)
Return-Path: <js@linuxtv.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: 10291
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: js@linuxtv.org
Precedence: bulk
X-list: linux-mips

On Wed, Feb 01, 2006, Daniel Jacobowitz wrote:
> All of this code is flat-out wrong, as far as I'm concerned.  I have a
> project underway which will fix it, as a nice side effect.
> 
> GDB is trying to do something confusing, but admirable, here.  When
> you're running on a 64-bit system the full 64 bits are always there:
> even if the binary only uses half of them (is this true in Linux?  I
> don't remember if the relevant control bits get fudged, it's been a
> while; it's definitely true on some other systems).  Thus it's possible
> for a bogus instruction to corrupt the top half of a register, leading
> to otherwise inexplicable problems.
> 
> So if the remote stub knows about 64-bit registers, it should report
> them to GDB, and GDB should accept and display them, and still handle
> 32-bit frames.  If the remote stub doesn't, then there's no option but
> to report the 32-bit registers.
> 
> Really, GDB ought to (and soon will I hope) autodetect which ones were
> sent.

If I understand this correctly, gdbserver should check the
register size supported by the OS, and communicate this to gdb?

I'm using a Linux kernel with CONFIG_32BIT, and if I understand
the ptrace interface correctly, the registers as seen through
ptrace are 32bit then, even though the CPU has 64bit registers.

(I have no idea if the cp0 status suggested by others in this
thread reflect CONFIG_32BIT vs. CONFIG_64BIT on Linux.)


Anyway, is a better workaround _now_ for gdb-6.[34] than the patch
to mips_register_type()?


Thanks,
Johannes

From fxzhang@ict.ac.cn Thu Feb  2 02:33:06 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 02 Feb 2006 02:33:29 +0000 (GMT)
Received: from webmail.ict.ac.cn ([159.226.39.7]:52698 "HELO ict.ac.cn")
	by ftp.linux-mips.org with SMTP id S3465640AbWBBCdG (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Thu, 2 Feb 2006 02:33:06 +0000
Received: (qmail 539 invoked by uid 507); 2 Feb 2006 02:03:38 -0000
Received: from unknown (HELO ?210.77.15.252?) (fxzhang@210.77.15.72)
  by ict.ac.cn with SMTP; 2 Feb 2006 02:03:38 -0000
Message-ID: <439B9104.6000605@ict.ac.cn>
Date:	Sun, 11 Dec 2005 10:37:56 +0800
From:	Fuxin Zhang <fxzhang@ict.ac.cn>
User-Agent: Thunderbird 1.5 (Windows/20051201)
MIME-Version: 1.0
To:	Linux/MIPS Development <linux-mips@linux-mips.org>
Subject: linker script for non-4k page size
X-Enigmail-Version: 0.93.0.0
Content-Type: text/plain; charset=GB18030
Content-Transfer-Encoding: 7bit
Return-Path: <fxzhang@ict.ac.cn>
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: 10292
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: fxzhang@ict.ac.cn
Precedence: bulk
X-list: linux-mips

hi,
  I come across a problem when trying to use 16k page size for 2.6.14
linux/mips kernel: arch/mips/kernel/vmlinux.lds.S align some sections
with hardcoded ". = ALIGN(4096)".
  This will lead to problem if non-4k page size is used. For example,
if the .init section is put at a page 4k-aligned but not 16k-aligned,
free_initmem will free more spaces than it should do, and strange
problems will occur.
  Should we change to alignment according to CONFIG_PAGE_SIZE_XX? or
just set it to largest possible value(this may cause size increasement?)



From fxzhang@ict.ac.cn Thu Feb  2 02:51:44 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 02 Feb 2006 02:52:01 +0000 (GMT)
Received: from webmail.ict.ac.cn ([159.226.39.7]:21979 "HELO ict.ac.cn")
	by ftp.linux-mips.org with SMTP id S3465637AbWBBCvo (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Thu, 2 Feb 2006 02:51:44 +0000
Received: (qmail 1103 invoked by uid 507); 2 Feb 2006 02:22:19 -0000
Received: from unknown (HELO ?210.77.15.252?) (fxzhang@210.77.15.72)
  by ict.ac.cn with SMTP; 2 Feb 2006 02:22:19 -0000
Message-ID: <439B9566.3020607@ict.ac.cn>
Date:	Sun, 11 Dec 2005 10:56:38 +0800
From:	Fuxin Zhang <fxzhang@ict.ac.cn>
User-Agent: Thunderbird 1.5 (Windows/20051201)
MIME-Version: 1.0
To:	Linux/MIPS Development <linux-mips@linux-mips.org>
Subject: Re: linker script for non-4k page size
References: <439B9104.6000605@ict.ac.cn>
In-Reply-To: <439B9104.6000605@ict.ac.cn>
X-Enigmail-Version: 0.93.0.0
Content-Type: text/plain; charset=gb18030
Content-Transfer-Encoding: 8bit
Return-Path: <fxzhang@ict.ac.cn>
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: 10293
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: fxzhang@ict.ac.cn
Precedence: bulk
X-list: linux-mips

BTW: except this problem, 2.6.14 with 16k page size runs well on my
machine. According to our experiences of 2.4 kernels, 16k page size
has a bit benefit over 4k page size(average 6% improvement for spec
cpu2000 int).
  But to use 16k kernel, we have to convert binaries of debian/mips:
their sections are often not 16k aligned untill the latest testing branch.

Fuxin Zhang Đ´µŔ:
> hi,
>   I come across a problem when trying to use 16k page size for 2.6.14
> linux/mips kernel: arch/mips/kernel/vmlinux.lds.S align some sections
> with hardcoded ". = ALIGN(4096)".
>   This will lead to problem if non-4k page size is used. For example,
> if the .init section is put at a page 4k-aligned but not 16k-aligned,
> free_initmem will free more spaces than it should do, and strange
> problems will occur.
>   Should we change to alignment according to CONFIG_PAGE_SIZE_XX? or
> just set it to largest possible value(this may cause size increasement?)
> 
> 
> 
> 
> 

From rmk+linux-mips=linux-mips.org@arm.linux.org.uk Thu Feb  2 10:22:20 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 02 Feb 2006 10:22:43 +0000 (GMT)
Received: from caramon.arm.linux.org.uk ([212.18.232.186]:2825 "EHLO
	caramon.arm.linux.org.uk") by ftp.linux-mips.org with ESMTP
	id S3465626AbWBBKWU (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Thu, 2 Feb 2006 10:22:20 +0000
Received: from flint.arm.linux.org.uk ([2002:d412:e8ba:1:201:2ff:fe14:8fad])
	by caramon.arm.linux.org.uk with esmtpsa (TLSv1:DES-CBC3-SHA:168)
	(Exim 4.52)
	id 1F4bgR-00036b-OX; Thu, 02 Feb 2006 10:27:25 +0000
Received: from rmk by flint.arm.linux.org.uk with local (Exim 4.52)
	id 1F4bgP-00024B-GI; Thu, 02 Feb 2006 10:27:21 +0000
Date:	Thu, 2 Feb 2006 10:27:21 +0000
From:	Russell King <rmk+lkml@arm.linux.org.uk>
To:	Linux Kernel List <linux-kernel@vger.kernel.org>,
	linux-mips@linux-mips.org, linuxppc-dev@ozlabs.org,
	takata@linux-m32r.org, pfg@sgi.com
Subject: Re: [CFT] Don't use ASYNC_* nor SERIAL_IO_* with serial_core
Message-ID: <20060202102721.GE5034@flint.arm.linux.org.uk>
Mail-Followup-To: Linux Kernel List <linux-kernel@vger.kernel.org>,
	linux-mips@linux-mips.org, linuxppc-dev@ozlabs.org,
	takata@linux-m32r.org, pfg@sgi.com
References: <20060121211407.GA19984@dyn-67.arm.linux.org.uk>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20060121211407.GA19984@dyn-67.arm.linux.org.uk>
User-Agent: Mutt/1.4.1i
Return-Path: <rmk+linux-mips=linux-mips.org@arm.linux.org.uk>
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: 10294
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: rmk+lkml@arm.linux.org.uk
Precedence: bulk
X-list: linux-mips

Ping?

On Sat, Jan 21, 2006 at 09:14:07PM +0000, Russell King wrote:
> The serial_core layer has its own definitions for these, and I'd
> appreciate it if folk would use them instead of the old ASYNC_* and
> SERIAL_IO_* definitions.
> 
> They're compatible _at the moment_ but I make no guarantees that they
> will stay that way.  Hence, it's in your interest to ensure that you're
> using the correct definitions.
> 
> MIPS, PPC seem to be the architectures which are stuck in the past on
> this issue, as is the M32R SIO driver.
> 
> The ioc4_serial driver is worse.  It assumes that it can set/clear
> ASYNC_CTS_FLOW in the uart_info flags field, which is private to
> serial_core.  It also seems to set TTY_IO_ERROR followed by immediately
> clearing it (pointless), and then it writes to tty->alt_speed... which
> isn't used by the serial layer so is also pointless.
> 
> So, here's a patch to fix some of this crap up.  Please test and
> enjoy - I certainly didn't.
> 
>  arch/mips/cobalt/setup.c                   |    2 +-
>  arch/mips/lasat/setup.c                    |    4 ++--
>  arch/mips/mips-boards/atlas/atlas_setup.c  |    4 ++--
>  arch/mips/mips-boards/sead/sead_setup.c    |    4 ++--
>  arch/mips/mips-boards/sim/sim_setup.c      |    4 ++--
>  arch/mips/momentum/jaguar_atx/ja-console.c |    2 +-
>  arch/mips/pmc-sierra/yosemite/setup.c      |    2 +-
>  arch/mips/sgi-ip32/ip32-setup.c            |   13 ++++---------
>  arch/ppc/platforms/4xx/bamboo.c            |    4 ++--
>  arch/ppc/platforms/4xx/bubinga.c           |    4 ++--
>  arch/ppc/platforms/4xx/ebony.c             |    4 ++--
>  arch/ppc/platforms/4xx/luan.c              |    4 ++--
>  arch/ppc/platforms/4xx/ocotea.c            |    4 ++--
>  arch/ppc/platforms/4xx/xilinx_ml300.c      |    4 ++--
>  arch/ppc/platforms/4xx/yucca.c             |    4 ++--
>  arch/ppc/platforms/spruce.c                |    4 ++--
>  drivers/serial/ioc4_serial.c               |   14 --------------
>  drivers/serial/m32r_sio.c                  |    2 +-
>  18 files changed, 32 insertions(+), 51 deletions(-)
> 
> diff --git a/arch/mips/cobalt/setup.c b/arch/mips/cobalt/setup.c
> --- a/arch/mips/cobalt/setup.c
> +++ b/arch/mips/cobalt/setup.c
> @@ -139,7 +139,7 @@ void __init plat_setup(void)
>  		uart.type	= PORT_UNKNOWN;
>  		uart.uartclk	= 18432000;
>  		uart.irq	= COBALT_SERIAL_IRQ;
> -		uart.flags	= STD_COM_FLAGS;
> +		uart.flags	= UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
>  		uart.iobase	= 0xc800000;
>  		uart.iotype	= UPIO_PORT;
>  
> diff --git a/arch/mips/lasat/setup.c b/arch/mips/lasat/setup.c
> --- a/arch/mips/lasat/setup.c
> +++ b/arch/mips/lasat/setup.c
> @@ -134,8 +134,8 @@ void __init serial_init(void)
>  
>  	memset(&s, 0, sizeof(s));
>  
> -	s.flags = STD_COM_FLAGS;
> -	s.iotype = SERIAL_IO_MEM;
> +	s.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
> +	s.iotype = UPIO_MEM;
>  
>  	if (mips_machtype == MACH_LASAT_100) {
>  		s.uartclk = LASAT_BASE_BAUD_100 * 16;
> diff --git a/arch/mips/mips-boards/atlas/atlas_setup.c b/arch/mips/mips-boards/atlas/atlas_setup.c
> --- a/arch/mips/mips-boards/atlas/atlas_setup.c
> +++ b/arch/mips/mips-boards/atlas/atlas_setup.c
> @@ -82,8 +82,8 @@ static void __init serial_init(void)
>  #endif
>  	s.irq = ATLASINT_UART;
>  	s.uartclk = ATLAS_BASE_BAUD * 16;
> -	s.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ;
> -	s.iotype = SERIAL_IO_PORT;
> +	s.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_AUTO_IRQ;
> +	s.iotype = UPIO_PORT;
>  	s.regshift = 3;
>  
>  	if (early_serial_setup(&s) != 0) {
> diff --git a/arch/mips/mips-boards/sead/sead_setup.c b/arch/mips/mips-boards/sead/sead_setup.c
> --- a/arch/mips/mips-boards/sead/sead_setup.c
> +++ b/arch/mips/mips-boards/sead/sead_setup.c
> @@ -71,8 +71,8 @@ static void __init serial_init(void)
>  #endif
>  	s.irq = MIPSCPU_INT_BASE + MIPSCPU_INT_UART0;
>  	s.uartclk = SEAD_BASE_BAUD * 16;
> -	s.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ;
> -	s.iotype = 0;
> +	s.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_AUTO_IRQ;
> +	s.iotype = UPIO_PORT;
>  	s.regshift = 3;
>  
>  	if (early_serial_setup(&s) != 0) {
> diff --git a/arch/mips/mips-boards/sim/sim_setup.c b/arch/mips/mips-boards/sim/sim_setup.c
> --- a/arch/mips/mips-boards/sim/sim_setup.c
> +++ b/arch/mips/mips-boards/sim/sim_setup.c
> @@ -88,8 +88,8 @@ static void __init serial_init(void)
>  	 but poll for now */
>  	s.irq =  0;
>  	s.uartclk = BASE_BAUD * 16;
> -	s.flags = ASYNC_BOOT_AUTOCONF | UPF_SKIP_TEST;
> -	s.iotype = SERIAL_IO_PORT | ASYNC_SKIP_TEST;
> +	s.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
> +	s.iotype = UPIO_PORT;
>  	s.regshift = 0;
>  	s.timeout = 4;
>  
> diff --git a/arch/mips/momentum/jaguar_atx/ja-console.c b/arch/mips/momentum/jaguar_atx/ja-console.c
> --- a/arch/mips/momentum/jaguar_atx/ja-console.c
> +++ b/arch/mips/momentum/jaguar_atx/ja-console.c
> @@ -93,7 +93,7 @@ static void inline ja_console_probe(void
>  	up.uartclk	= JAGUAR_ATX_UART_CLK;
>  	up.regshift	= 2;
>  	up.iotype	= UPIO_MEM;
> -	up.flags	= ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST;
> +	up.flags	= UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
>  	up.line		= 0;
>  
>  	if (early_serial_setup(&up))
> diff --git a/arch/mips/pmc-sierra/yosemite/setup.c b/arch/mips/pmc-sierra/yosemite/setup.c
> --- a/arch/mips/pmc-sierra/yosemite/setup.c
> +++ b/arch/mips/pmc-sierra/yosemite/setup.c
> @@ -185,7 +185,7 @@ static void __init py_uart_setup(void)
>  	up.uartclk      = TITAN_UART_CLK;
>  	up.regshift     = 0;
>  	up.iotype       = UPIO_MEM;
> -	up.flags        = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST;
> +	up.flags        = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
>  	up.line         = 0;
>  
>  	if (early_serial_setup(&up))
> diff --git a/arch/mips/sgi-ip32/ip32-setup.c b/arch/mips/sgi-ip32/ip32-setup.c
> --- a/arch/mips/sgi-ip32/ip32-setup.c
> +++ b/arch/mips/sgi-ip32/ip32-setup.c
> @@ -66,11 +66,6 @@ static inline void str2eaddr(unsigned ch
>  #include <linux/tty.h>
>  #include <linux/serial.h>
>  #include <linux/serial_core.h>
> -extern int early_serial_setup(struct uart_port *port);
> -
> -#define STD_COM_FLAGS (ASYNC_SKIP_TEST)
> -#define BASE_BAUD (1843200 / 16)
> -
>  #endif /* CONFIG_SERIAL_8250 */
>  
>  /* An arbitrary time; this can be decreased if reliability looks good */
> @@ -110,8 +105,8 @@ void __init plat_setup(void)
>  		o2_serial[0].type	= PORT_16550A;
>  		o2_serial[0].line	= 0;
>  		o2_serial[0].irq	= MACEISA_SERIAL1_IRQ;
> -		o2_serial[0].flags	= STD_COM_FLAGS;
> -		o2_serial[0].uartclk	= BASE_BAUD * 16;
> +		o2_serial[0].flags	= UPF_SKIP_TEST;
> +		o2_serial[0].uartclk	= 1843200;
>  		o2_serial[0].iotype	= UPIO_MEM;
>  		o2_serial[0].membase	= (char *)&mace->isa.serial1;
>  		o2_serial[0].fifosize	= 14;
> @@ -121,8 +116,8 @@ void __init plat_setup(void)
>  		o2_serial[1].type	= PORT_16550A;
>  		o2_serial[1].line	= 1;
>  		o2_serial[1].irq	= MACEISA_SERIAL2_IRQ;
> -		o2_serial[1].flags	= STD_COM_FLAGS;
> -		o2_serial[1].uartclk	= BASE_BAUD * 16;
> +		o2_serial[1].flags	= UPF_SKIP_TEST;
> +		o2_serial[1].uartclk	= 1843200;
>  		o2_serial[1].iotype	= UPIO_MEM;
>  		o2_serial[1].membase	= (char *)&mace->isa.serial2;
>  		o2_serial[1].fifosize	= 14;
> diff --git a/arch/ppc/platforms/4xx/bamboo.c b/arch/ppc/platforms/4xx/bamboo.c
> --- a/arch/ppc/platforms/4xx/bamboo.c
> +++ b/arch/ppc/platforms/4xx/bamboo.c
> @@ -332,8 +332,8 @@ bamboo_early_serial_map(void)
>  	port.irq = 0;
>  	port.uartclk = clocks.uart0;
>  	port.regshift = 0;
> -	port.iotype = SERIAL_IO_MEM;
> -	port.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST;
> +	port.iotype = UPIO_MEM;
> +	port.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
>  	port.line = 0;
>  
>  	if (early_serial_setup(&port) != 0) {
> diff --git a/arch/ppc/platforms/4xx/bubinga.c b/arch/ppc/platforms/4xx/bubinga.c
> --- a/arch/ppc/platforms/4xx/bubinga.c
> +++ b/arch/ppc/platforms/4xx/bubinga.c
> @@ -97,8 +97,8 @@ bubinga_early_serial_map(void)
>  	port.irq = ACTING_UART0_INT;
>  	port.uartclk = uart_clock;
>  	port.regshift = 0;
> -	port.iotype = SERIAL_IO_MEM;
> -	port.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST;
> +	port.iotype = UPIO_MEM;
> +	port.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
>  	port.line = 0;
>  
>  	if (early_serial_setup(&port) != 0) {
> diff --git a/arch/ppc/platforms/4xx/ebony.c b/arch/ppc/platforms/4xx/ebony.c
> --- a/arch/ppc/platforms/4xx/ebony.c
> +++ b/arch/ppc/platforms/4xx/ebony.c
> @@ -225,8 +225,8 @@ ebony_early_serial_map(void)
>  	port.irq = 0;
>  	port.uartclk = clocks.uart0;
>  	port.regshift = 0;
> -	port.iotype = SERIAL_IO_MEM;
> -	port.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST;
> +	port.iotype = UPIO_MEM;
> +	port.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
>  	port.line = 0;
>  
>  	if (early_serial_setup(&port) != 0) {
> diff --git a/arch/ppc/platforms/4xx/luan.c b/arch/ppc/platforms/4xx/luan.c
> --- a/arch/ppc/platforms/4xx/luan.c
> +++ b/arch/ppc/platforms/4xx/luan.c
> @@ -279,8 +279,8 @@ luan_early_serial_map(void)
>  	port.irq = UART0_INT;
>  	port.uartclk = clocks.uart0;
>  	port.regshift = 0;
> -	port.iotype = SERIAL_IO_MEM;
> -	port.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST;
> +	port.iotype = UPIO_MEM;
> +	port.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
>  	port.line = 0;
>  
>  	if (early_serial_setup(&port) != 0) {
> diff --git a/arch/ppc/platforms/4xx/ocotea.c b/arch/ppc/platforms/4xx/ocotea.c
> --- a/arch/ppc/platforms/4xx/ocotea.c
> +++ b/arch/ppc/platforms/4xx/ocotea.c
> @@ -248,8 +248,8 @@ ocotea_early_serial_map(void)
>  	port.irq = UART0_INT;
>  	port.uartclk = clocks.uart0;
>  	port.regshift = 0;
> -	port.iotype = SERIAL_IO_MEM;
> -	port.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST;
> +	port.iotype = UPIO_MEM;
> +	port.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
>  	port.line = 0;
>  
>  	if (early_serial_setup(&port) != 0) {
> diff --git a/arch/ppc/platforms/4xx/xilinx_ml300.c b/arch/ppc/platforms/4xx/xilinx_ml300.c
> --- a/arch/ppc/platforms/4xx/xilinx_ml300.c
> +++ b/arch/ppc/platforms/4xx/xilinx_ml300.c
> @@ -95,8 +95,8 @@ ml300_early_serial_map(void)
>  		port.irq = old_ports[i].irq;
>  		port.uartclk = old_ports[i].baud_base * 16;
>  		port.regshift = old_ports[i].iomem_reg_shift;
> -		port.iotype = SERIAL_IO_MEM;
> -		port.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST;
> +		port.iotype = UPIO_MEM;
> +		port.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
>  		port.line = i;
>  
>  		if (early_serial_setup(&port) != 0) {
> diff --git a/arch/ppc/platforms/4xx/yucca.c b/arch/ppc/platforms/4xx/yucca.c
> --- a/arch/ppc/platforms/4xx/yucca.c
> +++ b/arch/ppc/platforms/4xx/yucca.c
> @@ -305,8 +305,8 @@ yucca_early_serial_map(void)
>  	port.irq = UART0_INT;
>  	port.uartclk = clocks.uart0;
>  	port.regshift = 0;
> -	port.iotype = SERIAL_IO_MEM;
> -	port.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST;
> +	port.iotype = UPIO_MEM;
> +	port.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
>  	port.line = 0;
>  
>  	if (early_serial_setup(&port) != 0) {
> diff --git a/arch/ppc/platforms/spruce.c b/arch/ppc/platforms/spruce.c
> --- a/arch/ppc/platforms/spruce.c
> +++ b/arch/ppc/platforms/spruce.c
> @@ -176,8 +176,8 @@ spruce_early_serial_map(void)
>  	memset(&serial_req, 0, sizeof(serial_req));
>  	serial_req.uartclk = uart_clk;
>  	serial_req.irq = UART0_INT;
> -	serial_req.flags = ASYNC_BOOT_AUTOCONF;
> -	serial_req.iotype = SERIAL_IO_MEM;
> +	serial_req.flags = UPF_BOOT_AUTOCONF;
> +	serial_req.iotype = UPIO_MEM;
>  	serial_req.membase = (u_char *)UART0_IO_BASE;
>  	serial_req.regshift = 0;
>  
> diff --git a/drivers/serial/ioc4_serial.c b/drivers/serial/ioc4_serial.c
> --- a/drivers/serial/ioc4_serial.c
> +++ b/drivers/serial/ioc4_serial.c
> @@ -1717,11 +1717,9 @@ ioc4_change_speed(struct uart_port *the_
>  	}
>  
>  	if (cflag & CRTSCTS) {
> -		info->flags |= ASYNC_CTS_FLOW;
>  		port->ip_sscr |= IOC4_SSCR_HFC_EN;
>  	}
>  	else {
> -		info->flags &= ~ASYNC_CTS_FLOW;
>  		port->ip_sscr &= ~IOC4_SSCR_HFC_EN;
>  	}
>  	writel(port->ip_sscr, &port->ip_serial_regs->sscr);
> @@ -1760,18 +1758,6 @@ static inline int ic4_startup_local(stru
>  
>  	info = the_port->info;
>  
> -	if (info->tty) {
> -		set_bit(TTY_IO_ERROR, &info->tty->flags);
> -		clear_bit(TTY_IO_ERROR, &info->tty->flags);
> -		if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
> -			info->tty->alt_speed = 57600;
> -		if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
> -			info->tty->alt_speed = 115200;
> -		if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI)
> -			info->tty->alt_speed = 230400;
> -		if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP)
> -			info->tty->alt_speed = 460800;
> -	}
>  	local_open(port);
>  
>  	/* set the speed of the serial port */
> diff --git a/drivers/serial/m32r_sio.c b/drivers/serial/m32r_sio.c
> --- a/drivers/serial/m32r_sio.c
> +++ b/drivers/serial/m32r_sio.c
> @@ -80,7 +80,7 @@
>  #include <asm/serial.h>
>  
>  /* Standard COM flags */
> -#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST)
> +#define STD_COM_FLAGS (UPF_BOOT_AUTOCONF | UPF_SKIP_TEST)
>  
>  /*
>   * SERIAL_PORT_DFNS tells us about built-in ports that have no

> diff --git a/arch/mips/cobalt/setup.c b/arch/mips/cobalt/setup.c
> --- a/arch/mips/cobalt/setup.c
> +++ b/arch/mips/cobalt/setup.c
> @@ -139,7 +139,7 @@ void __init plat_setup(void)
>  		uart.type	= PORT_UNKNOWN;
>  		uart.uartclk	= 18432000;
>  		uart.irq	= COBALT_SERIAL_IRQ;
> -		uart.flags	= STD_COM_FLAGS;
> +		uart.flags	= UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
>  		uart.iobase	= 0xc800000;
>  		uart.iotype	= UPIO_PORT;
>  
> diff --git a/arch/mips/lasat/setup.c b/arch/mips/lasat/setup.c
> --- a/arch/mips/lasat/setup.c
> +++ b/arch/mips/lasat/setup.c
> @@ -134,8 +134,8 @@ void __init serial_init(void)
>  
>  	memset(&s, 0, sizeof(s));
>  
> -	s.flags = STD_COM_FLAGS;
> -	s.iotype = SERIAL_IO_MEM;
> +	s.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
> +	s.iotype = UPIO_MEM;
>  
>  	if (mips_machtype == MACH_LASAT_100) {
>  		s.uartclk = LASAT_BASE_BAUD_100 * 16;
> diff --git a/arch/mips/mips-boards/atlas/atlas_setup.c b/arch/mips/mips-boards/atlas/atlas_setup.c
> --- a/arch/mips/mips-boards/atlas/atlas_setup.c
> +++ b/arch/mips/mips-boards/atlas/atlas_setup.c
> @@ -82,8 +82,8 @@ static void __init serial_init(void)
>  #endif
>  	s.irq = ATLASINT_UART;
>  	s.uartclk = ATLAS_BASE_BAUD * 16;
> -	s.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ;
> -	s.iotype = SERIAL_IO_PORT;
> +	s.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_AUTO_IRQ;
> +	s.iotype = UPIO_PORT;
>  	s.regshift = 3;
>  
>  	if (early_serial_setup(&s) != 0) {
> diff --git a/arch/mips/mips-boards/sead/sead_setup.c b/arch/mips/mips-boards/sead/sead_setup.c
> --- a/arch/mips/mips-boards/sead/sead_setup.c
> +++ b/arch/mips/mips-boards/sead/sead_setup.c
> @@ -71,8 +71,8 @@ static void __init serial_init(void)
>  #endif
>  	s.irq = MIPSCPU_INT_BASE + MIPSCPU_INT_UART0;
>  	s.uartclk = SEAD_BASE_BAUD * 16;
> -	s.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ;
> -	s.iotype = 0;
> +	s.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_AUTO_IRQ;
> +	s.iotype = UPIO_PORT;
>  	s.regshift = 3;
>  
>  	if (early_serial_setup(&s) != 0) {
> diff --git a/arch/mips/mips-boards/sim/sim_setup.c b/arch/mips/mips-boards/sim/sim_setup.c
> --- a/arch/mips/mips-boards/sim/sim_setup.c
> +++ b/arch/mips/mips-boards/sim/sim_setup.c
> @@ -88,8 +88,8 @@ static void __init serial_init(void)
>  	 but poll for now */
>  	s.irq =  0;
>  	s.uartclk = BASE_BAUD * 16;
> -	s.flags = ASYNC_BOOT_AUTOCONF | UPF_SKIP_TEST;
> -	s.iotype = SERIAL_IO_PORT | ASYNC_SKIP_TEST;
> +	s.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
> +	s.iotype = UPIO_PORT;
>  	s.regshift = 0;
>  	s.timeout = 4;
>  
> diff --git a/arch/mips/momentum/jaguar_atx/ja-console.c b/arch/mips/momentum/jaguar_atx/ja-console.c
> --- a/arch/mips/momentum/jaguar_atx/ja-console.c
> +++ b/arch/mips/momentum/jaguar_atx/ja-console.c
> @@ -93,7 +93,7 @@ static void inline ja_console_probe(void
>  	up.uartclk	= JAGUAR_ATX_UART_CLK;
>  	up.regshift	= 2;
>  	up.iotype	= UPIO_MEM;
> -	up.flags	= ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST;
> +	up.flags	= UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
>  	up.line		= 0;
>  
>  	if (early_serial_setup(&up))
> diff --git a/arch/mips/pmc-sierra/yosemite/setup.c b/arch/mips/pmc-sierra/yosemite/setup.c
> --- a/arch/mips/pmc-sierra/yosemite/setup.c
> +++ b/arch/mips/pmc-sierra/yosemite/setup.c
> @@ -185,7 +185,7 @@ static void __init py_uart_setup(void)
>  	up.uartclk      = TITAN_UART_CLK;
>  	up.regshift     = 0;
>  	up.iotype       = UPIO_MEM;
> -	up.flags        = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST;
> +	up.flags        = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
>  	up.line         = 0;
>  
>  	if (early_serial_setup(&up))
> diff --git a/arch/mips/sgi-ip32/ip32-setup.c b/arch/mips/sgi-ip32/ip32-setup.c
> --- a/arch/mips/sgi-ip32/ip32-setup.c
> +++ b/arch/mips/sgi-ip32/ip32-setup.c
> @@ -66,11 +66,6 @@ static inline void str2eaddr(unsigned ch
>  #include <linux/tty.h>
>  #include <linux/serial.h>
>  #include <linux/serial_core.h>
> -extern int early_serial_setup(struct uart_port *port);
> -
> -#define STD_COM_FLAGS (ASYNC_SKIP_TEST)
> -#define BASE_BAUD (1843200 / 16)
> -
>  #endif /* CONFIG_SERIAL_8250 */
>  
>  /* An arbitrary time; this can be decreased if reliability looks good */
> @@ -110,8 +105,8 @@ void __init plat_setup(void)
>  		o2_serial[0].type	= PORT_16550A;
>  		o2_serial[0].line	= 0;
>  		o2_serial[0].irq	= MACEISA_SERIAL1_IRQ;
> -		o2_serial[0].flags	= STD_COM_FLAGS;
> -		o2_serial[0].uartclk	= BASE_BAUD * 16;
> +		o2_serial[0].flags	= UPF_SKIP_TEST;
> +		o2_serial[0].uartclk	= 1843200;
>  		o2_serial[0].iotype	= UPIO_MEM;
>  		o2_serial[0].membase	= (char *)&mace->isa.serial1;
>  		o2_serial[0].fifosize	= 14;
> @@ -121,8 +116,8 @@ void __init plat_setup(void)
>  		o2_serial[1].type	= PORT_16550A;
>  		o2_serial[1].line	= 1;
>  		o2_serial[1].irq	= MACEISA_SERIAL2_IRQ;
> -		o2_serial[1].flags	= STD_COM_FLAGS;
> -		o2_serial[1].uartclk	= BASE_BAUD * 16;
> +		o2_serial[1].flags	= UPF_SKIP_TEST;
> +		o2_serial[1].uartclk	= 1843200;
>  		o2_serial[1].iotype	= UPIO_MEM;
>  		o2_serial[1].membase	= (char *)&mace->isa.serial2;
>  		o2_serial[1].fifosize	= 14;
> diff --git a/arch/ppc/platforms/4xx/bamboo.c b/arch/ppc/platforms/4xx/bamboo.c
> --- a/arch/ppc/platforms/4xx/bamboo.c
> +++ b/arch/ppc/platforms/4xx/bamboo.c
> @@ -332,8 +332,8 @@ bamboo_early_serial_map(void)
>  	port.irq = 0;
>  	port.uartclk = clocks.uart0;
>  	port.regshift = 0;
> -	port.iotype = SERIAL_IO_MEM;
> -	port.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST;
> +	port.iotype = UPIO_MEM;
> +	port.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
>  	port.line = 0;
>  
>  	if (early_serial_setup(&port) != 0) {
> diff --git a/arch/ppc/platforms/4xx/bubinga.c b/arch/ppc/platforms/4xx/bubinga.c
> --- a/arch/ppc/platforms/4xx/bubinga.c
> +++ b/arch/ppc/platforms/4xx/bubinga.c
> @@ -97,8 +97,8 @@ bubinga_early_serial_map(void)
>  	port.irq = ACTING_UART0_INT;
>  	port.uartclk = uart_clock;
>  	port.regshift = 0;
> -	port.iotype = SERIAL_IO_MEM;
> -	port.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST;
> +	port.iotype = UPIO_MEM;
> +	port.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
>  	port.line = 0;
>  
>  	if (early_serial_setup(&port) != 0) {
> diff --git a/arch/ppc/platforms/4xx/ebony.c b/arch/ppc/platforms/4xx/ebony.c
> --- a/arch/ppc/platforms/4xx/ebony.c
> +++ b/arch/ppc/platforms/4xx/ebony.c
> @@ -225,8 +225,8 @@ ebony_early_serial_map(void)
>  	port.irq = 0;
>  	port.uartclk = clocks.uart0;
>  	port.regshift = 0;
> -	port.iotype = SERIAL_IO_MEM;
> -	port.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST;
> +	port.iotype = UPIO_MEM;
> +	port.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
>  	port.line = 0;
>  
>  	if (early_serial_setup(&port) != 0) {
> diff --git a/arch/ppc/platforms/4xx/luan.c b/arch/ppc/platforms/4xx/luan.c
> --- a/arch/ppc/platforms/4xx/luan.c
> +++ b/arch/ppc/platforms/4xx/luan.c
> @@ -279,8 +279,8 @@ luan_early_serial_map(void)
>  	port.irq = UART0_INT;
>  	port.uartclk = clocks.uart0;
>  	port.regshift = 0;
> -	port.iotype = SERIAL_IO_MEM;
> -	port.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST;
> +	port.iotype = UPIO_MEM;
> +	port.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
>  	port.line = 0;
>  
>  	if (early_serial_setup(&port) != 0) {
> diff --git a/arch/ppc/platforms/4xx/ocotea.c b/arch/ppc/platforms/4xx/ocotea.c
> --- a/arch/ppc/platforms/4xx/ocotea.c
> +++ b/arch/ppc/platforms/4xx/ocotea.c
> @@ -248,8 +248,8 @@ ocotea_early_serial_map(void)
>  	port.irq = UART0_INT;
>  	port.uartclk = clocks.uart0;
>  	port.regshift = 0;
> -	port.iotype = SERIAL_IO_MEM;
> -	port.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST;
> +	port.iotype = UPIO_MEM;
> +	port.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
>  	port.line = 0;
>  
>  	if (early_serial_setup(&port) != 0) {
> diff --git a/arch/ppc/platforms/4xx/xilinx_ml300.c b/arch/ppc/platforms/4xx/xilinx_ml300.c
> --- a/arch/ppc/platforms/4xx/xilinx_ml300.c
> +++ b/arch/ppc/platforms/4xx/xilinx_ml300.c
> @@ -95,8 +95,8 @@ ml300_early_serial_map(void)
>  		port.irq = old_ports[i].irq;
>  		port.uartclk = old_ports[i].baud_base * 16;
>  		port.regshift = old_ports[i].iomem_reg_shift;
> -		port.iotype = SERIAL_IO_MEM;
> -		port.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST;
> +		port.iotype = UPIO_MEM;
> +		port.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
>  		port.line = i;
>  
>  		if (early_serial_setup(&port) != 0) {
> diff --git a/arch/ppc/platforms/4xx/yucca.c b/arch/ppc/platforms/4xx/yucca.c
> --- a/arch/ppc/platforms/4xx/yucca.c
> +++ b/arch/ppc/platforms/4xx/yucca.c
> @@ -305,8 +305,8 @@ yucca_early_serial_map(void)
>  	port.irq = UART0_INT;
>  	port.uartclk = clocks.uart0;
>  	port.regshift = 0;
> -	port.iotype = SERIAL_IO_MEM;
> -	port.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST;
> +	port.iotype = UPIO_MEM;
> +	port.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
>  	port.line = 0;
>  
>  	if (early_serial_setup(&port) != 0) {
> diff --git a/arch/ppc/platforms/spruce.c b/arch/ppc/platforms/spruce.c
> --- a/arch/ppc/platforms/spruce.c
> +++ b/arch/ppc/platforms/spruce.c
> @@ -176,8 +176,8 @@ spruce_early_serial_map(void)
>  	memset(&serial_req, 0, sizeof(serial_req));
>  	serial_req.uartclk = uart_clk;
>  	serial_req.irq = UART0_INT;
> -	serial_req.flags = ASYNC_BOOT_AUTOCONF;
> -	serial_req.iotype = SERIAL_IO_MEM;
> +	serial_req.flags = UPF_BOOT_AUTOCONF;
> +	serial_req.iotype = UPIO_MEM;
>  	serial_req.membase = (u_char *)UART0_IO_BASE;
>  	serial_req.regshift = 0;
>  
> diff --git a/drivers/serial/ioc4_serial.c b/drivers/serial/ioc4_serial.c
> --- a/drivers/serial/ioc4_serial.c
> +++ b/drivers/serial/ioc4_serial.c
> @@ -1717,11 +1717,9 @@ ioc4_change_speed(struct uart_port *the_
>  	}
>  
>  	if (cflag & CRTSCTS) {
> -		info->flags |= ASYNC_CTS_FLOW;
>  		port->ip_sscr |= IOC4_SSCR_HFC_EN;
>  	}
>  	else {
> -		info->flags &= ~ASYNC_CTS_FLOW;
>  		port->ip_sscr &= ~IOC4_SSCR_HFC_EN;
>  	}
>  	writel(port->ip_sscr, &port->ip_serial_regs->sscr);
> @@ -1760,18 +1758,6 @@ static inline int ic4_startup_local(stru
>  
>  	info = the_port->info;
>  
> -	if (info->tty) {
> -		set_bit(TTY_IO_ERROR, &info->tty->flags);
> -		clear_bit(TTY_IO_ERROR, &info->tty->flags);
> -		if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
> -			info->tty->alt_speed = 57600;
> -		if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
> -			info->tty->alt_speed = 115200;
> -		if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI)
> -			info->tty->alt_speed = 230400;
> -		if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP)
> -			info->tty->alt_speed = 460800;
> -	}
>  	local_open(port);
>  
>  	/* set the speed of the serial port */
> diff --git a/drivers/serial/m32r_sio.c b/drivers/serial/m32r_sio.c
> --- a/drivers/serial/m32r_sio.c
> +++ b/drivers/serial/m32r_sio.c
> @@ -80,7 +80,7 @@
>  #include <asm/serial.h>
>  
>  /* Standard COM flags */
> -#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST)
> +#define STD_COM_FLAGS (UPF_BOOT_AUTOCONF | UPF_SKIP_TEST)
>  
>  /*
>   * SERIAL_PORT_DFNS tells us about built-in ports that have no


-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core

From vagabon.xyz@gmail.com Thu Feb  2 10:26:57 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 02 Feb 2006 10:27:14 +0000 (GMT)
Received: from zproxy.gmail.com ([64.233.162.193]:62804 "EHLO zproxy.gmail.com")
	by ftp.linux-mips.org with ESMTP id S8133406AbWBBK04 convert rfc822-to-8bit
	(ORCPT <rfc822;linux-mips@linux-mips.org>);
	Thu, 2 Feb 2006 10:26:56 +0000
Received: by zproxy.gmail.com with SMTP id l8so358432nzf
        for <linux-mips@linux-mips.org>; Thu, 02 Feb 2006 02:32:06 -0800 (PST)
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws;
        s=beta; d=gmail.com;
        h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references;
        b=IwnSh17fGssg17Zrj+LQIYsW3KTVb/V/kj7WxGBWBc6X2cVzSVj4DbmDOHZxnddkifYTybJhHB9I9HnrM7AtH0VE8swo1El9j1P4/MCveXEgxrwv/of5Ak+4W5smh1PXXfcQGmsMYqcJpmCL7LFUWsjGs+wZajaeSVbyjZd0TT8=
Received: by 10.36.41.19 with SMTP id o19mr512612nzo;
        Thu, 02 Feb 2006 02:32:05 -0800 (PST)
Received: by 10.36.49.12 with HTTP; Thu, 2 Feb 2006 02:32:05 -0800 (PST)
Message-ID: <cda58cb80602020232r36241faeh@mail.gmail.com>
Date:	Thu, 2 Feb 2006 11:32:05 +0100
From:	Franck Bui-Huu <vagabon.xyz@gmail.com>
To:	Ralf Baechle <ralf@linux-mips.org>
Subject: Re: [PATCH] Optimize swab operations
Cc:	"Kevin D. Kissell" <kevink@mips.com>, linux-mips@linux-mips.org
In-Reply-To: <20060126120114.GD3411@linux-mips.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8BIT
Content-Disposition: inline
References: <cda58cb80601260308v3eecf0d0w@mail.gmail.com>
	 <20060126120114.GD3411@linux-mips.org>
Return-Path: <vagabon.xyz@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: 10295
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: vagabon.xyz@gmail.com
Precedence: bulk
X-list: linux-mips

2006/1/26, Ralf Baechle <ralf@linux-mips.org>:
> On Thu, Jan 26, 2006 at 12:08:25PM +0100, Franck wrote:
>
> Applied.
>

I'm a bit disapointed the way you do it. You changed the patch
(wrongly) and the authorships. At least you could have said: "thanks
to" in your commit message. Bad experience for my first patch...

--
               Franck

From ths@networkno.de Thu Feb  2 11:00:53 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 02 Feb 2006 11:01:10 +0000 (GMT)
Received: from bender.bawue.de ([193.7.176.20]:39808 "EHLO bender.bawue.de")
	by ftp.linux-mips.org with ESMTP id S8133406AbWBBLAx (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Thu, 2 Feb 2006 11:00:53 +0000
Received: from lagash (unknown [194.74.144.146])
	(using TLSv1 with cipher DES-CBC3-SHA (168/168 bits))
	(No client certificate requested)
	by bender.bawue.de (Postfix) with ESMTP
	id 2431849032; Thu,  2 Feb 2006 12:06:04 +0100 (MET)
Received: from ths by lagash with local (Exim 4.60)
	(envelope-from <ths@networkno.de>)
	id 1F4cHi-0000IL-Tp; Thu, 02 Feb 2006 11:05:54 +0000
Date:	Thu, 2 Feb 2006 11:05:54 +0000
To:	Fuxin Zhang <fxzhang@ict.ac.cn>
Cc:	Linux/MIPS Development <linux-mips@linux-mips.org>
Subject: Re: linker script for non-4k page size
Message-ID: <20060202110554.GA26789@networkno.de>
References: <439B9104.6000605@ict.ac.cn> <439B9566.3020607@ict.ac.cn>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <439B9566.3020607@ict.ac.cn>
User-Agent: Mutt/1.5.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: 10296
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

On Sun, Dec 11, 2005 at 10:56:38AM +0800, Fuxin Zhang wrote:
> BTW: except this problem, 2.6.14 with 16k page size runs well on my
> machine. According to our experiences of 2.4 kernels, 16k page size
> has a bit benefit over 4k page size(average 6% improvement for spec
> cpu2000 int).
>   But to use 16k kernel, we have to convert binaries of debian/mips:
> their sections are often not 16k aligned untill the latest testing branch.

AFAIR a 64k alignment between code and data segments was introduced
in debian shortly before the sarge release, but no attempt to
systematically rebuild with that toolchain was made (because debian
sarge supports only 4k paged kernels). A rebuild of the respective
sarge packages should be enough to work around the problem.


Thiemo

From fxzhang@ict.ac.cn Thu Feb  2 11:41:27 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 02 Feb 2006 11:41:46 +0000 (GMT)
Received: from webmail.ict.ac.cn ([159.226.39.7]:44772 "HELO ict.ac.cn")
	by ftp.linux-mips.org with SMTP id S8133736AbWBBLl1 (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Thu, 2 Feb 2006 11:41:27 +0000
Received: (qmail 13225 invoked by uid 507); 2 Feb 2006 11:11:56 -0000
Received: from unknown (HELO ?210.77.15.252?) (fxzhang@210.77.15.72)
  by ict.ac.cn with SMTP; 2 Feb 2006 11:11:56 -0000
Message-ID: <439C118B.20402@ict.ac.cn>
Date:	Sun, 11 Dec 2005 19:46:19 +0800
From:	Fuxin Zhang <fxzhang@ict.ac.cn>
User-Agent: Thunderbird 1.5 (Windows/20051201)
MIME-Version: 1.0
To:	Thiemo Seufer <ths@networkno.de>
CC:	Linux/MIPS Development <linux-mips@linux-mips.org>
Subject: Re: linker script for non-4k page size
References: <439B9104.6000605@ict.ac.cn> <439B9566.3020607@ict.ac.cn> <20060202110554.GA26789@networkno.de>
In-Reply-To: <20060202110554.GA26789@networkno.de>
X-Enigmail-Version: 0.93.0.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Return-Path: <fxzhang@ict.ac.cn>
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: 10297
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: fxzhang@ict.ac.cn
Precedence: bulk
X-list: linux-mips



Thiemo Seufer ĺ†™é“:
> 
> AFAIR a 64k alignment between code and data segments was introduced
> in debian shortly before the sarge release, but no attempt to
> systematically rebuild with that toolchain was made (because debian
> sarge supports only 4k paged kernels). A rebuild of the respective
> sarge packages should be enough to work around the problem.
Rebuild is too much work:), I just wrote some scripts to convert all the
debian packages: extract the files, convert the binaries, and repack.

If anyone is interested, I can provide the scripts(and the resulting
16k-enable sarge mipsel isos), though he has to wait some days before I go
back to lab.
> 
> 
> Thiemo
> 
> 
> 

From ralf@linux-mips.org Thu Feb  2 11:50:58 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 02 Feb 2006 11:51:18 +0000 (GMT)
Received: from mipsfw.mips-uk.com ([194.74.144.146]:60701 "EHLO
	bacchus.net.dhis.org") by ftp.linux-mips.org with ESMTP
	id S8133406AbWBBLu6 (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Thu, 2 Feb 2006 11:50:58 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by bacchus.net.dhis.org (8.13.4/8.13.4) with ESMTP id k12BtXjK005974;
	Thu, 2 Feb 2006 11:55:40 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.4/8.13.4/Submit) id k11BU7SJ003774;
	Wed, 1 Feb 2006 11:30:07 GMT
Date:	Wed, 1 Feb 2006 11:30:07 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	Philip Mucci <mucci@cs.utk.edu>
Cc:	Linux MIPS <linux-mips@linux-mips.org>
Subject: Re: /dev/cpuid or /proc/cpuinfo
Message-ID: <20060201113006.GA3562@linux-mips.org>
References: <Pine.LNX.4.44.0601271349350.2185-100000@bharathi.midascomm.com> <1138647269.4077.11.camel@localhost.localdomain>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <1138647269.4077.11.camel@localhost.localdomain>
User-Agent: Mutt/1.4.2.1i
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: 10298
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, Jan 30, 2006 at 06:54:29PM +0000, Philip Mucci wrote:

> In reference to the performance counting thread we had going earlier,
> I've noticed a 'feature' I need out of MIPS/Linux that isn't currently
> available. This has also recently come up on the oprofile list with one
> of the oprofile/mips tools not being able to grab cpu Mhz
> from /proc/cpuinfo because it's not there.

Surprise - the kernel doesn't actually have that information.  The closest
available would be the counting speed of the c0 count register which - if
something like that is available at all - could be calibrated against an
external counter to figure out the clock speed.  To complicate matters
not all processors have have a c0 counter, it's sometimes incrementing
every cycle but it might just as well counting at half the clock rate and
oh yes, more recently there is clock scaling.

> I have need to execute the mfc0 instruction on the config register and
> grok the results to find out things like cache size etc. In addition, it
> might be nice to also actually be able to find out the clock rate.
> (Currently I grab BogoMIPS and punt.)

Considering above complexities a BogoMIPS-based approach doesn't sound too
bad - but it has other problem to implement since it requires knowing the
exact execution timing.  A think that could be done is meassuring two
loops containing a different number of nops and use that to compute the
execution time for the loop closing branch.  Now knowing that based on
knowing the # of cycles per loop we can compute the clock speed - all it
takes is a timer running at a known speed.

A funny complexity is that some multiprocessor MIPS systems have processors
running at different speeds.  So knowing the clock rate doesn't make life
too much easier ;-)

> On the intel and PPC systems, I believe you can execute similar
> instructions from user mode which makes things easy. However, of course
> an MFC0 is a privileged instruction...meaning that if the value or
> values aren't found in /proc/cpuinfo, I'm s.o.l.

We have a long tradition of emulating instructions, could use that to
permit access to a bunch of cp0 registers from userland ;)

> What does the list think about this? Making a mips /dev/cpuid is a bit
> gross but extending and grokking /proc/cpuinfo is perhaps grosser...and
> many tools do just this (like PAPI and oprofile's opreport...)
> 
> Comments? I'm certainly willing to implement this, but I'd rather 'do it
> right the first time' rather than get rotten vegetables thrown my way.

/proc/cpuinfo is meant to have per processor information so I don't have
a problem with adding cache configuration information.  I was considering
to do so to make such information available for bug reports.

  Ralf

From mita@miraclelinux.com Thu Feb  2 12:45:02 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 02 Feb 2006 12:45:20 +0000 (GMT)
Received: from ns.miraclelinux.com ([219.118.163.66]:290 "EHLO
	mail01.miraclelinux.com") by ftp.linux-mips.org with ESMTP
	id S8133406AbWBBMpB (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Thu, 2 Feb 2006 12:45:01 +0000
Received: from mail01 (localhost.localdomain [127.0.0.1])
	by mail01.miraclelinux.com (Postfix) with ESMTP
	id EBEE831C286; Thu,  2 Feb 2006 21:50:08 +0900 (JST)
Received: from localhost.localdomain (sshgate.miraclelinux.com [])
	by mail01.miraclelinux.com ([10.1.0.10]);
	Thu, 02 Feb 2006 12:50:08 +0000
Received: by localhost.localdomain (Postfix, from userid 1000)
	id 5FE544201E0; Thu,  2 Feb 2006 21:50:07 +0900 (JST)
Date:	Thu, 2 Feb 2006 21:50:07 +0900
To:	Andi Kleen <ak@suse.de>
Cc:	Michael Tokarev <mjt@tls.msk.ru>, linux-kernel@vger.kernel.org,
	Richard Henderson <rth@twiddle.net>,
	Ivan Kokshaysky <ink@jurassic.park.msu.ru>,
	Russell King <rmk@arm.linux.org.uk>,
	Ian Molton <spyro@f2s.com>, dev-etrax@axis.com,
	David Howells <dhowells@redhat.com>,
	Yoshinori Sato <ysato@users.sourceforge.jp>,
	Linus Torvalds <torvalds@osdl.org>, linux-ia64@vger.kernel.org,
	Hirokazu Takata <takata@linux-m32r.org>,
	linux-m68k@lists.linux-m68k.org, Greg Ungerer <gerg@uclinux.org>,
	linux-mips@linux-mips.org, parisc-linux@parisc-linux.org,
	linuxppc-dev@ozlabs.org, linux390@de.ibm.com,
	linuxsh-dev@lists.sourceforge.net,
	linuxsh-shmedia-dev@lists.sourceforge.net,
	sparclinux@vger.kernel.org, ultralinux@vger.kernel.org,
	Miles Bader <uclinux-v850@lsi.nec.co.jp>,
	Chris Zankel <chris@zankel.net>
Subject: Re: [patch 14/44] generic hweight{64,32,16,8}()
Message-ID: <20060202125007.GA5918@miraclelinux.com>
References: <20060201090224.536581000@localhost.localdomain> <200602011006.09596.ak@suse.de> <43E07EB2.4020409@tls.msk.ru> <200602011124.29423.ak@suse.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <200602011124.29423.ak@suse.de>
User-Agent: Mutt/1.5.9i
From:	mita@miraclelinux.com (Akinobu Mita)
Return-Path: <mita@miraclelinux.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: 10299
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: mita@miraclelinux.com
Precedence: bulk
X-list: linux-mips

On Wed, Feb 01, 2006 at 11:24:27AM +0100, Andi Kleen wrote:
> On Wednesday 01 February 2006 10:26, Michael Tokarev wrote:
> > Andi Kleen wrote:
> > > On Wednesday 01 February 2006 10:02, Akinobu Mita wrote:
> > > 
> > >>+static inline unsigned int hweight32(unsigned int w)
> > []
> > > How large are these functions on x86? Maybe it would be better to not inline them,
> > > but put it into some C file out of line.
> > 
> > hweight8	47 bytes
> > hweight16	76 bytes
> > hweight32	97 bytes
> > hweight64	56 bytes (NOT inlining hweight32)
> > hweight64	197 bytes (inlining hweight32)
> > 
> > Those are when compiled as separate non-inlined functions,
> > with pushl %ebp and ret.
> 
> This would argue for moving them out of line.

This patch will put hweight*() into lib/hweight.c

Index: 2.6-git/include/asm-generic/bitops/hweight.h
===================================================================
--- 2.6-git.orig/include/asm-generic/bitops/hweight.h
+++ 2.6-git/include/asm-generic/bitops/hweight.h
@@ -1,54 +1,9 @@
 #ifndef _ASM_GENERIC_BITOPS_HWEIGHT_H_
 #define _ASM_GENERIC_BITOPS_HWEIGHT_H_
 
-#include <asm/types.h>
-
-/**
- * hweightN - returns the hamming weight of a N-bit word
- * @x: the word to weigh
- *
- * The Hamming Weight of a number is the total number of bits set in it.
- */
-
-static inline unsigned int hweight32(unsigned int w)
-{
-        unsigned int res = (w & 0x55555555) + ((w >> 1) & 0x55555555);
-        res = (res & 0x33333333) + ((res >> 2) & 0x33333333);
-        res = (res & 0x0F0F0F0F) + ((res >> 4) & 0x0F0F0F0F);
-        res = (res & 0x00FF00FF) + ((res >> 8) & 0x00FF00FF);
-        return (res & 0x0000FFFF) + ((res >> 16) & 0x0000FFFF);
-}
-
-static inline unsigned int hweight16(unsigned int w)
-{
-        unsigned int res = (w & 0x5555) + ((w >> 1) & 0x5555);
-        res = (res & 0x3333) + ((res >> 2) & 0x3333);
-        res = (res & 0x0F0F) + ((res >> 4) & 0x0F0F);
-        return (res & 0x00FF) + ((res >> 8) & 0x00FF);
-}
-
-static inline unsigned int hweight8(unsigned int w)
-{
-        unsigned int res = (w & 0x55) + ((w >> 1) & 0x55);
-        res = (res & 0x33) + ((res >> 2) & 0x33);
-        return (res & 0x0F) + ((res >> 4) & 0x0F);
-}
-
-static inline unsigned long hweight64(__u64 w)
-{
-#if BITS_PER_LONG == 32
-	return hweight32((unsigned int)(w >> 32)) + hweight32((unsigned int)w);
-#elif BITS_PER_LONG == 64
-	u64 res;
-	res = (w & 0x5555555555555555ul) + ((w >> 1) & 0x5555555555555555ul);
-	res = (res & 0x3333333333333333ul) + ((res >> 2) & 0x3333333333333333ul);
-	res = (res & 0x0F0F0F0F0F0F0F0Ful) + ((res >> 4) & 0x0F0F0F0F0F0F0F0Ful);
-	res = (res & 0x00FF00FF00FF00FFul) + ((res >> 8) & 0x00FF00FF00FF00FFul);
-	res = (res & 0x0000FFFF0000FFFFul) + ((res >> 16) & 0x0000FFFF0000FFFFul);
-	return (res & 0x00000000FFFFFFFFul) + ((res >> 32) & 0x00000000FFFFFFFFul);
-#else
-#error BITS_PER_LONG not defined
-#endif
-}
+extern unsigned int hweight32(unsigned int w);
+extern unsigned int hweight16(unsigned int w);
+extern unsigned int hweight8(unsigned int w);
+extern unsigned long hweight64(__u64 w);
 
 #endif /* _ASM_GENERIC_BITOPS_HWEIGHT_H_ */
Index: 2.6-git/lib/Makefile
===================================================================
--- 2.6-git.orig/lib/Makefile
+++ 2.6-git/lib/Makefile
@@ -5,7 +5,7 @@
 lib-y := errno.o ctype.o string.o vsprintf.o cmdline.o \
 	 bust_spinlocks.o rbtree.o radix-tree.o dump_stack.o \
 	 idr.o div64.o int_sqrt.o bitmap.o extable.o prio_tree.o \
-	 sha1.o
+	 sha1.o hweight.o
 
 lib-y	+= kobject.o kref.o kobject_uevent.o klist.o
 
Index: 2.6-git/lib/hweight.c
===================================================================
--- /dev/null
+++ 2.6-git/lib/hweight.c
@@ -0,0 +1,54 @@
+#include <linux/module.h>
+#include <asm/types.h>
+
+/**
+ * hweightN - returns the hamming weight of a N-bit word
+ * @x: the word to weigh
+ *
+ * The Hamming Weight of a number is the total number of bits set in it.
+ */
+
+unsigned int hweight32(unsigned int w)
+{
+        unsigned int res = (w & 0x55555555) + ((w >> 1) & 0x55555555);
+        res = (res & 0x33333333) + ((res >> 2) & 0x33333333);
+        res = (res & 0x0F0F0F0F) + ((res >> 4) & 0x0F0F0F0F);
+        res = (res & 0x00FF00FF) + ((res >> 8) & 0x00FF00FF);
+        return (res & 0x0000FFFF) + ((res >> 16) & 0x0000FFFF);
+}
+EXPORT_SYMBOL(hweight32);
+
+unsigned int hweight16(unsigned int w)
+{
+        unsigned int res = (w & 0x5555) + ((w >> 1) & 0x5555);
+        res = (res & 0x3333) + ((res >> 2) & 0x3333);
+        res = (res & 0x0F0F) + ((res >> 4) & 0x0F0F);
+        return (res & 0x00FF) + ((res >> 8) & 0x00FF);
+}
+EXPORT_SYMBOL(hweight16);
+
+unsigned int hweight8(unsigned int w)
+{
+        unsigned int res = (w & 0x55) + ((w >> 1) & 0x55);
+        res = (res & 0x33) + ((res >> 2) & 0x33);
+        return (res & 0x0F) + ((res >> 4) & 0x0F);
+}
+EXPORT_SYMBOL(hweight8);
+
+unsigned long hweight64(__u64 w)
+{
+#if BITS_PER_LONG == 32
+	return hweight32((unsigned int)(w >> 32)) + hweight32((unsigned int)w);
+#elif BITS_PER_LONG == 64
+	u64 res;
+	res = (w & 0x5555555555555555ul) + ((w >> 1) & 0x5555555555555555ul);
+	res = (res & 0x3333333333333333ul) + ((res >> 2) & 0x3333333333333333ul);
+	res = (res & 0x0F0F0F0F0F0F0F0Ful) + ((res >> 4) & 0x0F0F0F0F0F0F0F0Ful);
+	res = (res & 0x00FF00FF00FF00FFul) + ((res >> 8) & 0x00FF00FF00FF00FFul);
+	res = (res & 0x0000FFFF0000FFFFul) + ((res >> 16) & 0x0000FFFF0000FFFFul);
+	return (res & 0x00000000FFFFFFFFul) + ((res >> 32) & 0x00000000FFFFFFFFul);
+#else
+#error BITS_PER_LONG not defined
+#endif
+}
+EXPORT_SYMBOL(hweight64);

From ralf@linux-mips.org Thu Feb  2 13:22:39 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 02 Feb 2006 13:22:56 +0000 (GMT)
Received: from mipsfw.mips-uk.com ([194.74.144.146]:48403 "EHLO
	bacchus.net.dhis.org") by ftp.linux-mips.org with ESMTP
	id S8133531AbWBBNWj (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Thu, 2 Feb 2006 13:22:39 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by bacchus.net.dhis.org (8.13.4/8.13.4) with ESMTP id k12DQxkm014261;
	Thu, 2 Feb 2006 13:26:59 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.4/8.13.4/Submit) id k12DQwhZ014260;
	Thu, 2 Feb 2006 13:26:58 GMT
Date:	Thu, 2 Feb 2006 13:26:58 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	Daniel Jacobowitz <dan@debian.org>
Cc:	Michael Uhler <uhler@mips.com>,
	"'Maciej W. Rozycki'" <macro@linux-mips.org>,
	"'Johannes Stezenbach'" <js@linuxtv.org>, linux-mips@linux-mips.org
Subject: Re: gdb vs. gdbserver with -mips3 / 32bitmode userspace
Message-ID: <20060202132658.GC4986@linux-mips.org>
References: <20060201164423.GA4891@nevyn.them.org> <005901c62754$b414dc80$bb14a8c0@MIPS.COM> <20060201192404.GA11719@nevyn.them.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20060201192404.GA11719@nevyn.them.org>
User-Agent: Mutt/1.4.2.1i
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: 10300
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, Feb 01, 2006 at 02:24:04PM -0500, Daniel Jacobowitz wrote:

> > The O/S maybe doing something different, but the architecture has 3 bits in
> > Status: KX, SX, and UX that enable access to the address space above 32
> > bits.  With these bits off, an attempt to access these addresses causes an
> > exception.  So while 32-bit apps have the full 64-bit address space, most of
> > it is inaccessible to the 32-bit app.
> 
> That's not actually what I was referring to: there's at least one MIPS
> implementation where the results of 32-bit arithmetic operations are
> not just architecturally unpredictable but actually wrong if the upper
> bits are not properly sign extended (I might be misremembering, but I
> think I'm talking about the SB-1).  That's the sort of thing that can
> be basically impossible to track down if your debugger doesn't show
> you the whole register.

You were right, that was the SB1 core of the BCM1250 on your Sentosa.  The
behaviour however is legal; the MIPS64 specification states for almost all
32-bit arithmetic instructions that their proper operation is only
guaranteed for properly 64-bit sign-extended operands.

  Ralf

From ralf@linux-mips.org Thu Feb  2 13:38:48 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 02 Feb 2006 13:39:06 +0000 (GMT)
Received: from mipsfw.mips-uk.com ([194.74.144.146]:35846 "EHLO
	bacchus.net.dhis.org") by ftp.linux-mips.org with ESMTP
	id S3465626AbWBBNis (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Thu, 2 Feb 2006 13:38:48 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by bacchus.net.dhis.org (8.13.4/8.13.4) with ESMTP id k12DhT4r014629;
	Thu, 2 Feb 2006 13:43:29 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.4/8.13.4/Submit) id k12DhTdL014628;
	Thu, 2 Feb 2006 13:43:29 GMT
Date:	Thu, 2 Feb 2006 13:43:29 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	Johannes Stezenbach <js@linuxtv.org>,
	Daniel Jacobowitz <dan@debian.org>,
	"Maciej W. Rozycki" <macro@linux-mips.org>,
	linux-mips@linux-mips.org
Subject: Re: gdb vs. gdbserver with -mips3 / 32bitmode userspace
Message-ID: <20060202134329.GD4986@linux-mips.org>
References: <20060131171508.GB6341@linuxtv.org> <Pine.LNX.4.64N.0601311724340.31371@blysk.ds.pg.gda.pl> <20060201164423.GA4891@nevyn.them.org> <20060201194443.GB21871@linuxtv.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20060201194443.GB21871@linuxtv.org>
User-Agent: Mutt/1.4.2.1i
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: 10301
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, Feb 01, 2006 at 08:44:43PM +0100, Johannes Stezenbach wrote:

> If I understand this correctly, gdbserver should check the
> register size supported by the OS, and communicate this to gdb?
> 
> I'm using a Linux kernel with CONFIG_32BIT, and if I understand
> the ptrace interface correctly, the registers as seen through
> ptrace are 32bit then, even though the CPU has 64bit registers.

Correct.  On 32-bit kernels Linux will largely forget about the 64-bitness
of the processor.  User processes will run with 64-bit (UX bit) disabled,
so they're never able to anything 64-bitish.  The kernel will only save
and restore the lower 32-bit of registers, so the upper 32-bit will be
lost.  That means only using the $zero register as 64-bit register is safe
and that's exploited by clear_page().  There are a few place where 64-bit
loads and stores are needed because particular hardware doesn't like being
talked to with 32-bit accesses; those accesses need make sure they're not
interrupted or bad things happen.  See the code for *readq() and write()
in <asm/io.h>.

Ages ago I tried leaving all the 64-bit functionality available as far as
possible even in 32-bit kernels.  It turned out to be example messy and I
was happy to have gotten rid of it, I think in 2.1.14.

> (I have no idea if the cp0 status suggested by others in this
> thread reflect CONFIG_32BIT vs. CONFIG_64BIT on Linux.)

On 32-bit kernels Linux will clear c0_status.kx, c0_status.ux and
c0_status.fr - on hardware were those bits exist at all, that is.

On 64-bit kernels Linux will set c0_status.kx.  It will also always set
c0_status.ux which means 64-bit operations are legal even for 32-bit
processes.  To my knowledge nobody is exploiting that; I guess it could
be exploited for a faster memcpy and similar.  Finally c0_status.fr which
will be set according to the ABI of the process, that is it'll be cleared
for o32 and set for N32 and N64 processes.

  Ralf

From takata@linux-m32r.org Thu Feb  2 14:05:32 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 02 Feb 2006 14:06:41 +0000 (GMT)
Received: from mail.renesas.com ([202.234.163.13]:20144 "EHLO
	mail04.idc.renesas.com") by ftp.linux-mips.org with ESMTP
	id S3465632AbWBBOFc (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Thu, 2 Feb 2006 14:05:32 +0000
Received: from mail04.idc.renesas.com ([127.0.0.1])
 by mail04.idc.renesas.com. (SMSSMTP 4.1.9.35) with SMTP id M2006020223103611315
 for <linux-mips@linux-mips.org>; Thu, 02 Feb 2006 23:10:36 +0900
Received: (from root@localhost)
	by guardian05.idc.renesas.com with  id k12EAYui008847;
	Thu, 2 Feb 2006 23:10:34 +0900 (JST)
Received: from unknown [172.20.8.73] by guardian05.idc.renesas.com with SMTP id ZAA08846 ; Thu, 2 Feb 2006 23:10:34 +0900
Received: from mrkaisv.hoku.renesas.com ([10.145.105.245])
	by ml01.idc.renesas.com (8.12.10/8.12.10) with ESMTP id k12EAYdI001876;
	Thu, 2 Feb 2006 23:10:34 +0900 (JST)
Received: from localhost (pcepx10 [10.145.105.241])
	by mrkaisv.hoku.renesas.com (Postfix) with ESMTP
	id 2A2BE798071; Thu,  2 Feb 2006 23:10:34 +0900 (JST)
Date:	Thu, 02 Feb 2006 23:10:33 +0900 (JST)
Message-Id: <20060202.231033.1059963967.takata.hirokazu@renesas.com>
To:	rmk+lkml@arm.linux.org.uk
Cc:	linux-kernel@vger.kernel.org, linux-mips@linux-mips.org,
	linuxppc-dev@ozlabs.org, takata@linux-m32r.org, pfg@sgi.com
Subject: Re: [CFT] Don't use ASYNC_* nor SERIAL_IO_* with serial_core
From:	Hirokazu Takata <takata@linux-m32r.org>
In-Reply-To: <20060202102721.GE5034@flint.arm.linux.org.uk>
References: <20060121211407.GA19984@dyn-67.arm.linux.org.uk>
	<20060202102721.GE5034@flint.arm.linux.org.uk>
X-Mailer: Mew version 3.3 on XEmacs 21.4.18 (Social Property)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Return-Path: <takata@linux-m32r.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: 10302
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: takata@linux-m32r.org
Precedence: bulk
X-list: linux-mips

On m32r,
  compile and boot test: OK

Thank you.

-- Takata

From: Russell King <rmk+lkml@arm.linux.org.uk>
Date: Thu, 02 Feb 2006 10:27:21 +0000
> Ping?
> 
> On Sat, Jan 21, 2006 at 09:14:07PM +0000, Russell King wrote:
> > The serial_core layer has its own definitions for these, and I'd
> > appreciate it if folk would use them instead of the old ASYNC_* and
> > SERIAL_IO_* definitions.
> > 
> > They're compatible _at the moment_ but I make no guarantees that they
> > will stay that way.  Hence, it's in your interest to ensure that you're
> > using the correct definitions.
> > 
> > MIPS, PPC seem to be the architectures which are stuck in the past on
> > this issue, as is the M32R SIO driver.
> > 
> > The ioc4_serial driver is worse.  It assumes that it can set/clear
> > ASYNC_CTS_FLOW in the uart_info flags field, which is private to
> > serial_core.  It also seems to set TTY_IO_ERROR followed by immediately
> > clearing it (pointless), and then it writes to tty->alt_speed... which
> > isn't used by the serial layer so is also pointless.
> > 
> > So, here's a patch to fix some of this crap up.  Please test and
> > enjoy - I certainly didn't.
...
> >  drivers/serial/m32r_sio.c                  |    2 +-
> >  18 files changed, 32 insertions(+), 51 deletions(-)
...
> > +++ b/arch/mips/cobalt/setup.c
> > diff --git a/drivers/serial/m32r_sio.c b/drivers/serial/m32r_sio.c
> > --- a/drivers/serial/m32r_sio.c
> > +++ b/drivers/serial/m32r_sio.c
> > @@ -80,7 +80,7 @@
> >  #include <asm/serial.h>
> >  
> >  /* Standard COM flags */
> > -#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST)
> > +#define STD_COM_FLAGS (UPF_BOOT_AUTOCONF | UPF_SKIP_TEST)
> >  
> >  /*
> >   * SERIAL_PORT_DFNS tells us about built-in ports that have no
> 
> -- 
> Russell King
>  Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
>  maintainer of:  2.6 Serial core
> 

From paubert@iram.es Thu Feb  2 14:07:09 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 02 Feb 2006 14:07:34 +0000 (GMT)
Received: from gra-lx1.iram.es ([150.214.224.41]:64973 "EHLO gra-lx1.iram.es")
	by ftp.linux-mips.org with ESMTP id S3465633AbWBBOFl (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Thu, 2 Feb 2006 14:05:41 +0000
Received: from localhost (localhost [127.0.0.1])
	by gra-lx1.iram.es (Postfix/MJ-1.08) with ESMTP id CC752873E9;
	Thu,  2 Feb 2006 15:10:44 +0100 (CET)
Received: from gra-lx1.iram.es ([127.0.0.1])
	by localhost (gra-lx1 [127.0.0.1]) (amavisd-new, port 10024)
	with SMTP id 32515-05; Thu, 2 Feb 2006 15:10:41 +0100 (CET)
Received: from gra-vd1.iram.es (gra-vd1.iram.es [150.214.224.250])
	by gra-lx1.iram.es (Postfix/MJ-1.08) with ESMTP id D2FB18738A;
	Thu,  2 Feb 2006 15:10:41 +0100 (CET)
Received: from gra-vd1.iram.es (localhost [127.0.0.1])
	by gra-vd1.iram.es (8.13.4/8.13.4/Debian-3) with ESMTP id k121QuwW025805;
	Thu, 2 Feb 2006 02:26:56 +0100
Received: (from paubert@localhost)
	by gra-vd1.iram.es (8.13.4/8.13.4/Submit) id k121QcEL025804;
	Thu, 2 Feb 2006 02:26:38 +0100
From:	Gabriel Paubert <paubert@iram.es>
Date:	Thu, 2 Feb 2006 02:26:38 +0100
To:	Akinobu Mita <mita@miraclelinux.com>
Cc:	linux-kernel@vger.kernel.org, linux-mips@linux-mips.org,
	linux-ia64@vger.kernel.org, Ian Molton <spyro@f2s.com>,
	David Howells <dhowells@redhat.com>, linuxppc-dev@ozlabs.org,
	Greg Ungerer <gerg@uclinux.org>, sparclinux@vger.kernel.org,
	Miles Bader <uclinux-v850@lsi.nec.co.jp>,
	Linus Torvalds <torvalds@osdl.org>,
	Yoshinori Sato <ysato@users.sourceforge.jp>,
	Hirokazu Takata <takata@linux-m32r.org>,
	linuxsh-shmedia-dev@lists.sourceforge.net,
	linux-m68k@vger.kernel.org,
	Ivan Kokshaysky <ink@jurassic.park.msu.ru>,
	Richard Henderson <rth@twiddle.net>,
	Chris Zankel <chris@zankel.net>, dev-etrax@axis.com,
	ultralinux@vger.kernel.org, Andi Kleen <ak@suse.de>,
	linuxsh-dev@lists.sourceforge.net, linux390@de.ibm.com,
	Russell King <rmk@arm.linux.org.uk>,
	parisc-linux@parisc-linux.org
Subject: Re: [patch 14/44] generic hweight{64,32,16,8}()
Message-ID: <20060202012637.GA25093@iram.es>
References: <20060201090224.536581000@localhost.localdomain> <20060201090325.905071000@localhost.localdomain>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20060201090325.905071000@localhost.localdomain>
User-Agent: Mutt/1.5.9i
X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at iram.es
Return-Path: <paubert@iram.es>
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: 10303
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: paubert@iram.es
Precedence: bulk
X-list: linux-mips

On Wed, Feb 01, 2006 at 06:02:38PM +0900, Akinobu Mita wrote:
> 
> This patch introduces the C-language equivalents of the functions below:
> 
> unsigned int hweight32(unsigned int w);
> unsigned int hweight16(unsigned int w);
> unsigned int hweight8(unsigned int w);
> unsigned long hweight64(__u64 w);
> 
> In include/asm-generic/bitops/hweight.h
> 
> This code largely copied from:
> include/linux/bitops.h
> 
> Signed-off-by: Akinobu Mita <mita@miraclelinux.com>
>  include/asm-generic/bitops/hweight.h |   54 +++++++++++++++++++++++++++++++++++
>  1 files changed, 54 insertions(+)
> 
> Index: 2.6-git/include/asm-generic/bitops/hweight.h
> ===================================================================
> --- /dev/null
> +++ 2.6-git/include/asm-generic/bitops/hweight.h
> @@ -0,0 +1,54 @@
> +#ifndef _ASM_GENERIC_BITOPS_HWEIGHT_H_
> +#define _ASM_GENERIC_BITOPS_HWEIGHT_H_
> +
> +#include <asm/types.h>
> +
> +/**
> + * hweightN - returns the hamming weight of a N-bit word
> + * @x: the word to weigh
> + *
> + * The Hamming Weight of a number is the total number of bits set in it.
> + */
> +
> +static inline unsigned int hweight32(unsigned int w)
> +{
> +        unsigned int res = (w & 0x55555555) + ((w >> 1) & 0x55555555);
> +        res = (res & 0x33333333) + ((res >> 2) & 0x33333333);
> +        res = (res & 0x0F0F0F0F) + ((res >> 4) & 0x0F0F0F0F);
> +        res = (res & 0x00FF00FF) + ((res >> 8) & 0x00FF00FF);
> +        return (res & 0x0000FFFF) + ((res >> 16) & 0x0000FFFF);
> +}


The first step can be implemented slightly better:

unsigned int res = w-((w>>1)&0x55555555);

as I found once on the web[1].

Several of the following steps can also be simplified
by omitting the masking when the result can't possibly
cause a carry to propagate too far.

This might also have a non negligible impact
on code size.


> +
> +static inline unsigned int hweight16(unsigned int w)
> +{
> +        unsigned int res = (w & 0x5555) + ((w >> 1) & 0x5555);
> +        res = (res & 0x3333) + ((res >> 2) & 0x3333);
> +        res = (res & 0x0F0F) + ((res >> 4) & 0x0F0F);
> +        return (res & 0x00FF) + ((res >> 8) & 0x00FF);
> +}
> +
> +static inline unsigned int hweight8(unsigned int w)
> +{
> +        unsigned int res = (w & 0x55) + ((w >> 1) & 0x55);
> +        res = (res & 0x33) + ((res >> 2) & 0x33);
> +        return (res & 0x0F) + ((res >> 4) & 0x0F);
> +}
> +
> +static inline unsigned long hweight64(__u64 w)
> +{
> +#if BITS_PER_LONG == 32
> +	return hweight32((unsigned int)(w >> 32)) + hweight32((unsigned int)w);
> +#elif BITS_PER_LONG == 64
> +	u64 res;
> +	res = (w & 0x5555555555555555ul) + ((w >> 1) & 0x5555555555555555ul);
> +	res = (res & 0x3333333333333333ul) + ((res >> 2) & 0x3333333333333333ul);
> +	res = (res & 0x0F0F0F0F0F0F0F0Ful) + ((res >> 4) & 0x0F0F0F0F0F0F0F0Ful);
> +	res = (res & 0x00FF00FF00FF00FFul) + ((res >> 8) & 0x00FF00FF00FF00FFul);
> +	res = (res & 0x0000FFFF0000FFFFul) + ((res >> 16) & 0x0000FFFF0000FFFFul);
> +	return (res & 0x00000000FFFFFFFFul) + ((res >> 32) & 0x00000000FFFFFFFFul);
> +#else
> +#error BITS_PER_LONG not defined
> +#endif
> +}
> +
> +#endif /* _ASM_GENERIC_BITOPS_HWEIGHT_H_ */
>


	Regards,
	Gabriel

[1] It might be better to write the first line 

	unsigned res = w - ((w&0xaaaaaaaa)>>1);

but I can never remember what the C standard guarantess about 
right shifts values (very little IIRC). I believe that it will
work properly on all architectures that GCC supports, however,
and that it will help on many.

From runet@innovsys.com Thu Feb  2 15:00:28 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 02 Feb 2006 15:00:47 +0000 (GMT)
Received: from smtp.innovsys.com ([66.115.232.196]:54207 "EHLO
	mail.innovsys.com") by ftp.linux-mips.org with ESMTP
	id S3465637AbWBBPA2 convert rfc822-to-8bit (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Thu, 2 Feb 2006 15:00:28 +0000
X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0
Content-class: urn:content-classes:message
MIME-Version: 1.0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 8BIT
Subject: RE: [patch 10/44] generic fls64()
Date:	Thu, 2 Feb 2006 09:05:33 -0600
Message-ID: <DCEAAC0833DD314AB0B58112AD99B93B859547@ismail.innsys.innovsys.com>
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
Thread-Topic: [patch 10/44] generic fls64()
Thread-Index: AcYnkFHrC3JXjhzOTROGBLzY99BOuAAeZ/rA
From:	"Rune Torgersen" <runet@innovsys.com>
To:	"Akinobu Mita" <mita@miraclelinux.com>,
	<linux-kernel@vger.kernel.org>
Cc:	<linux-mips@linux-mips.org>, <linux-ia64@vger.kernel.org>,
	"Ian Molton" <spyro@f2s.com>,
	"David Howells" <dhowells@redhat.com>, <linuxppc-dev@ozlabs.org>,
	"Greg Ungerer" <gerg@uclinux.org>, <sparclinux@vger.kernel.org>,
	"Miles Bader" <uclinux-v850@lsi.nec.co.jp>,
	"Linus Torvalds" <torvalds@osdl.org>,
	"Yoshinori Sato" <ysato@users.sourceforge.jp>,
	"Hirokazu Takata" <takata@linux-m32r.org>,
	<linuxsh-shmedia-dev@lists.sourceforge.net>,
	<linux-m68k@lists.linux-m68k.org>,
	"Ivan Kokshaysky" <ink@jurassic.park.msu.ru>,
	"Richard Henderson" <rth@twiddle.net>,
	"Chris Zankel" <chris@zankel.net>, <dev-etrax@axis.com>,
	<ultralinux@vger.kernel.org>, "Andi Kleen" <ak@suse.de>,
	<linuxsh-dev@lists.sourceforge.net>, <linux390@de.ibm.com>,
	"Russell King" <rmk@arm.linux.org.uk>,
	<parisc-linux@parisc-linux.org>
Return-Path: <runet@innovsys.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: 10304
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: runet@innovsys.com
Precedence: bulk
X-list: linux-mips

> From: Akinobu Mita
> Sent: Wednesday, February 01, 2006 03:03
> +static inline int fls64(__u64 x)
> +{
> +	__u32 h = x >> 32;
> +	if (h)
> +		return fls(x) + 32;

Shouldn't this be return fls(h) + 32; ??
                            ^^^
> +	return fls(x);
> +}
> +
> +#endif /* _ASM_GENERIC_BITOPS_FLS64_H_ */
> 
> --
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
> 
> 

From anemo@mba.ocn.ne.jp Thu Feb  2 16:29:13 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 02 Feb 2006 16:29:31 +0000 (GMT)
Received: from mba.ocn.ne.jp ([210.190.142.172]:42188 "HELO smtp.mba.ocn.ne.jp")
	by ftp.linux-mips.org with SMTP id S3465640AbWBBQ3N (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Thu, 2 Feb 2006 16:29:13 +0000
Received: from localhost (p4005-ipad24funabasi.chiba.ocn.ne.jp [220.104.82.5])
	by smtp.mba.ocn.ne.jp (Postfix) with ESMTP
	id 5480D16D2; Fri,  3 Feb 2006 01:34:21 +0900 (JST)
Date:	Fri, 03 Feb 2006 01:34:01 +0900 (JST)
Message-Id: <20060203.013401.41198517.anemo@mba.ocn.ne.jp>
To:	linux-mips@linux-mips.org
Cc:	ralf@linux-mips.org
Subject: [PATCH] TX49 MFC0 bug workaround
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: 10305
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 mfc0 $12 follows store and the mfc0 is last instruction of a
page and fetching the next instruction causes TLB miss, the result
of the mfc0 might wrongly contain EXL bit.

ERT-TX49H2-027, ERT-TX49H3-012, ERT-TX49HL3-006, ERT-TX49H4-008

Workaround: mask EXL bit of the result or place a nop before mfc0.

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

diff --git a/include/asm-mips/interrupt.h b/include/asm-mips/interrupt.h
index 0da5818..951ee7a 100644
--- a/include/asm-mips/interrupt.h
+++ b/include/asm-mips/interrupt.h
@@ -13,6 +13,7 @@
 
 #include <linux/config.h>
 #include <asm/hazards.h>
+#include <asm/war.h>
 
 __asm__ (
 	"	.macro	local_irq_enable				\n"
@@ -55,8 +56,13 @@ __asm__ (
 	"	di							\n"
 #else
 	"	mfc0	$1,$12						\n"
+#if TX49XX_MFC0_WAR && defined(MODULE)
+	"	ori	$1,3						\n"
+	"	xori	$1,3						\n"
+#else
 	"	ori	$1,1						\n"
 	"	xori	$1,1						\n"
+#endif
 	"	.set	noreorder					\n"
 	"	mtc0	$1,$12						\n"
 #endif
@@ -96,8 +102,13 @@ __asm__ (
 	"	andi	\\result, 1					\n"
 #else
 	"	mfc0	\\result, $12					\n"
+#if TX49XX_MFC0_WAR && defined(MODULE)
+	"	ori	$1, \\result, 3					\n"
+	"	xori	$1, 3						\n"
+#else
 	"	ori	$1, \\result, 1					\n"
 	"	xori	$1, 1						\n"
+#endif
 	"	.set	noreorder					\n"
 	"	mtc0	$1, $12						\n"
 #endif
@@ -136,8 +147,13 @@ __asm__ (
 #else
 	"	mfc0	$1, $12						\n"
 	"	andi	\\flags, 1					\n"
+#if TX49XX_MFC0_WAR && defined(MODULE)
+	"	ori	$1, 3						\n"
+	"	xori	$1, 3						\n"
+#else
 	"	ori	$1, 1						\n"
 	"	xori	$1, 1						\n"
+#endif
 	"	or	\\flags, $1					\n"
 	"	mtc0	\\flags, $12					\n"
 #endif
diff --git a/include/asm-mips/war.h b/include/asm-mips/war.h
index ad374bd..859520a 100644
--- a/include/asm-mips/war.h
+++ b/include/asm-mips/war.h
@@ -169,6 +169,19 @@
 #endif
 
 /*
+ * If mfc0 $12 follows store and the mfc0 is last instruction of a
+ * page and fetching the next instruction causes TLB miss, the result
+ * of the mfc0 might wrongly contain EXL bit.
+ *
+ * ERT-TX49H2-027, ERT-TX49H3-012, ERT-TX49HL3-006, ERT-TX49H4-008
+ *
+ * Workaround: mask EXL bit of the result or place a nop before mfc0.
+ */
+#ifdef CONFIG_CPU_TX49XX
+#define TX49XX_MFC0_WAR 1
+#endif
+
+/*
  * On the RM9000 there is a problem which makes the CreateDirtyExclusive
  * cache operation unusable on SMP systems.
  */
@@ -228,6 +241,9 @@
 #ifndef TX49XX_ICACHE_INDEX_INV_WAR
 #define TX49XX_ICACHE_INDEX_INV_WAR	0
 #endif
+#ifndef TX49XX_MFC0_WAR
+#define TX49XX_MFC0_WAR	0
+#endif
 #ifndef RM9000_CDEX_SMP_WAR
 #define RM9000_CDEX_SMP_WAR		0
 #endif

From macro@linux-mips.org Thu Feb  2 16:33:27 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 02 Feb 2006 16:33:45 +0000 (GMT)
Received: from pollux.ds.pg.gda.pl ([153.19.208.7]:17681 "EHLO
	pollux.ds.pg.gda.pl") by ftp.linux-mips.org with ESMTP
	id S3465640AbWBBQd1 (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Thu, 2 Feb 2006 16:33:27 +0000
Received: from localhost (localhost [127.0.0.1])
	by pollux.ds.pg.gda.pl (Postfix) with ESMTP id 88C4BF5A5C;
	Thu,  2 Feb 2006 17:38:34 +0100 (CET)
Received: from pollux.ds.pg.gda.pl ([127.0.0.1])
 by localhost (pollux [127.0.0.1]) (amavisd-new, port 10024) with ESMTP
 id 10280-04; Thu,  2 Feb 2006 17:38:34 +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 26BB0E1C82;
	Thu,  2 Feb 2006 17:38:34 +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.3/8.13.1) with ESMTP id k12GcPlw009548;
	Thu, 2 Feb 2006 17:38:25 +0100
Date:	Thu, 2 Feb 2006 16:38:37 +0000 (GMT)
From:	"Maciej W. Rozycki" <macro@linux-mips.org>
To:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc:	linux-mips@linux-mips.org, ralf@linux-mips.org
Subject: Re: [PATCH] TX49 MFC0 bug workaround
In-Reply-To: <20060203.013401.41198517.anemo@mba.ocn.ne.jp>
Message-ID: <Pine.LNX.4.64N.0602021636380.11727@blysk.ds.pg.gda.pl>
References: <20060203.013401.41198517.anemo@mba.ocn.ne.jp>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Virus-Scanned: ClamAV 0.87.1/1270/Thu Feb  2 13:47:37 2006 on piorun.ds.pg.gda.pl
X-Virus-Status:	Clean
X-Virus-Scanned: by amavisd-new at pollux.ds.pg.gda.pl
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: 10306
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 Fri, 3 Feb 2006, Atsushi Nemoto wrote:

> Workaround: mask EXL bit of the result or place a nop before mfc0.
[...]
> @@ -55,8 +56,13 @@ __asm__ (
>  	"	di							\n"
>  #else
>  	"	mfc0	$1,$12						\n"
> +#if TX49XX_MFC0_WAR && defined(MODULE)
> +	"	ori	$1,3						\n"
> +	"	xori	$1,3						\n"
> +#else
>  	"	ori	$1,1						\n"
>  	"	xori	$1,1						\n"
> +#endif
>  	"	.set	noreorder					\n"
>  	"	mtc0	$1,$12						\n"
>  #endif

 Hmm, wouldn't that "nop" alternative be simpler?

  Maciej

From ralf@linux-mips.org Thu Feb  2 16:41:30 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 02 Feb 2006 16:41:50 +0000 (GMT)
Received: from mipsfw.mips-uk.com ([194.74.144.146]:24587 "EHLO
	bacchus.net.dhis.org") by ftp.linux-mips.org with ESMTP
	id S3465646AbWBBQla (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Thu, 2 Feb 2006 16:41:30 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by bacchus.net.dhis.org (8.13.4/8.13.4) with ESMTP id k12GkqdI020781;
	Thu, 2 Feb 2006 16:46:52 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.4/8.13.4/Submit) id k12GkqPg020780;
	Thu, 2 Feb 2006 16:46:52 GMT
Date:	Thu, 2 Feb 2006 16:46:52 +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] TX49 MFC0 bug workaround
Message-ID: <20060202164652.GA20462@linux-mips.org>
References: <20060203.013401.41198517.anemo@mba.ocn.ne.jp>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20060203.013401.41198517.anemo@mba.ocn.ne.jp>
User-Agent: Mutt/1.4.2.1i
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: 10307
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 Fri, Feb 03, 2006 at 01:34:01AM +0900, Atsushi Nemoto wrote:

> If mfc0 $12 follows store and the mfc0 is last instruction of a
> page and fetching the next instruction causes TLB miss, the result
> of the mfc0 might wrongly contain EXL bit.
> 
> ERT-TX49H2-027, ERT-TX49H3-012, ERT-TX49HL3-006, ERT-TX49H4-008
> 
> Workaround: mask EXL bit of the result or place a nop before mfc0.

Applied,

  Ralf

From ralf@linux-mips.org Thu Feb  2 16:49:33 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 02 Feb 2006 16:49:50 +0000 (GMT)
Received: from mipsfw.mips-uk.com ([194.74.144.146]:45086 "EHLO
	bacchus.net.dhis.org") by ftp.linux-mips.org with ESMTP
	id S3465645AbWBBQtd (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Thu, 2 Feb 2006 16:49:33 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by bacchus.net.dhis.org (8.13.4/8.13.4) with ESMTP id k12Gsaun020901;
	Thu, 2 Feb 2006 16:54:36 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.4/8.13.4/Submit) id k12Gsaqw020900;
	Thu, 2 Feb 2006 16:54:36 GMT
Date:	Thu, 2 Feb 2006 16:54:36 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	Clem Taylor <clem.taylor@gmail.com>
Cc:	linux-mips <linux-mips@linux-mips.org>
Subject: Re: can read/write to mprotect(PROT_NONE) region with 2.6.14 on au1550
Message-ID: <20060202165436.GB17352@linux-mips.org>
References: <ecb4efd10512071351scea736fg8d026e3fa3c54c79@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <ecb4efd10512071351scea736fg8d026e3fa3c54c79@mail.gmail.com>
User-Agent: Mutt/1.4.2.1i
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: 10308
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, Dec 07, 2005 at 04:51:23PM -0500, Clem Taylor wrote:

> I was trying to use mprotect(PROT_NONE) to help debug a problem, and
> it seems that mprotect() isn't actually doing anything with my 2.6.14
> linux-mips kernel on an au1550. Attached is a simple test program that
> segfaults as expected on x86 (2.6.12), but does not segfault on mips
> (2.6.14). I can both read and write PROT_NONE memory without problem,
> which should result in a segfault. Originally, I was trying to
> mprotect() a mmaped GFP_DMA region which wasn't working and then I
> tried a simpler test that also wasn't working.
> 
> Shouldn't mprotect() work? Could I be missing a config option, or is
> this just broken?

That's a defect in CONFIG_64BIT_PHYS_ADDR which unfortunately is need
on Alchemy SOCs due to the silly address space layout.

  Ralf

From ralf@linux-mips.org Thu Feb  2 16:51:34 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 02 Feb 2006 16:51:51 +0000 (GMT)
Received: from mipsfw.mips-uk.com ([194.74.144.146]:36363 "EHLO
	bacchus.net.dhis.org") by ftp.linux-mips.org with ESMTP
	id S3465645AbWBBQve (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Thu, 2 Feb 2006 16:51:34 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by bacchus.net.dhis.org (8.13.4/8.13.4) with ESMTP id k12Guu7n021042;
	Thu, 2 Feb 2006 16:56:56 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.4/8.13.4/Submit) id k12Guuxa021041;
	Thu, 2 Feb 2006 16:56:56 GMT
Date:	Thu, 2 Feb 2006 16:56:56 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	"Maciej W. Rozycki" <macro@linux-mips.org>
Cc:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>, linux-mips@linux-mips.org
Subject: Re: [PATCH] TX49 MFC0 bug workaround
Message-ID: <20060202165656.GC17352@linux-mips.org>
References: <20060203.013401.41198517.anemo@mba.ocn.ne.jp> <Pine.LNX.4.64N.0602021636380.11727@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.0602021636380.11727@blysk.ds.pg.gda.pl>
User-Agent: Mutt/1.4.2.1i
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: 10309
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, Feb 02, 2006 at 04:38:37PM +0000, Maciej W. Rozycki wrote:
> Date:	Thu, 2 Feb 2006 16:38:37 +0000 (GMT)
> From:	"Maciej W. Rozycki" <macro@linux-mips.org>
> To:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
> Cc:	linux-mips@linux-mips.org, ralf@linux-mips.org
> Subject: Re: [PATCH] TX49 MFC0 bug workaround
> Content-Type: TEXT/PLAIN; charset=US-ASCII
> 
> On Fri, 3 Feb 2006, Atsushi Nemoto wrote:
> 
> > Workaround: mask EXL bit of the result or place a nop before mfc0.
> [...]
> > @@ -55,8 +56,13 @@ __asm__ (
> >  	"	di							\n"
> >  #else
> >  	"	mfc0	$1,$12						\n"
> > +#if TX49XX_MFC0_WAR && defined(MODULE)
> > +	"	ori	$1,3						\n"
> > +	"	xori	$1,3						\n"
> > +#else
> >  	"	ori	$1,1						\n"
> >  	"	xori	$1,1						\n"
> > +#endif
> >  	"	.set	noreorder					\n"
> >  	"	mtc0	$1,$12						\n"
> >  #endif
> 
>  Hmm, wouldn't that "nop" alternative be simpler?

Simpler maybe - but this variant has zero runtime overhead.

  Ralf

From anemo@mba.ocn.ne.jp Thu Feb  2 16:59:40 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 02 Feb 2006 16:59:58 +0000 (GMT)
Received: from mba.ocn.ne.jp ([210.190.142.172]:52729 "HELO smtp.mba.ocn.ne.jp")
	by ftp.linux-mips.org with SMTP id S3465642AbWBBQ7k (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Thu, 2 Feb 2006 16:59:40 +0000
Received: from localhost (p4005-ipad24funabasi.chiba.ocn.ne.jp [220.104.82.5])
	by smtp.mba.ocn.ne.jp (Postfix) with ESMTP
	id A951AB4A8; Fri,  3 Feb 2006 02:04:48 +0900 (JST)
Date:	Fri, 03 Feb 2006 02:04:28 +0900 (JST)
Message-Id: <20060203.020428.59032357.anemo@mba.ocn.ne.jp>
To:	ralf@linux-mips.org
Cc:	macro@linux-mips.org, linux-mips@linux-mips.org
Subject: Re: [PATCH] TX49 MFC0 bug workaround
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
In-Reply-To: <20060202165656.GC17352@linux-mips.org>
References: <20060203.013401.41198517.anemo@mba.ocn.ne.jp>
	<Pine.LNX.4.64N.0602021636380.11727@blysk.ds.pg.gda.pl>
	<20060202165656.GC17352@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: 10310
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 Feb 2006 16:56:56 +0000, Ralf Baechle <ralf@linux-mips.org> said:

>> Hmm, wouldn't that "nop" alternative be simpler?

ralf> Simpler maybe - but this variant has zero runtime overhead.

Yes.  I do not want do add extra cycles.

However, It can be more readable since we can safely mask bit[5:1] (as
local_irq_enable() does).  Like this:

__asm__ (
	"	.macro	local_irq_disable\n"
	"	.set	push						\n"
	"	.set	noat						\n"
#ifdef CONFIG_CPU_MIPSR2
	"	di							\n"
#else
	"	mfc0	$1,$12						\n"
	"	ori	$1,0x1f						\n"
	"	xori	$1,0x1f						\n"
	"	.set	noreorder					\n"
	"	mtc0	$1,$12						\n"
#endif
	"	irq_disable_hazard					\n"
	"	.set	pop						\n"
	"	.endm							\n");


Is this preferred?  We can get rid of all TX49XX_MFC0_WAR on this way.

---
Atsushi Nemoto

From ralf@linux-mips.org Thu Feb  2 17:01:02 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 02 Feb 2006 17:01:19 +0000 (GMT)
Received: from mipsfw.mips-uk.com ([194.74.144.146]:9989 "EHLO
	bacchus.net.dhis.org") by ftp.linux-mips.org with ESMTP
	id S3465647AbWBBRBC (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Thu, 2 Feb 2006 17:01:02 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by bacchus.net.dhis.org (8.13.4/8.13.4) with ESMTP id k12H63kS021301;
	Thu, 2 Feb 2006 17:06:03 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.4/8.13.4/Submit) id k12H62kS021300;
	Thu, 2 Feb 2006 17:06:02 GMT
Date:	Thu, 2 Feb 2006 17:06:02 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	Franck Bui-Huu <vagabon.xyz@gmail.com>
Cc:	"Kevin D. Kissell" <kevink@mips.com>, linux-mips@linux-mips.org
Subject: Re: [PATCH] Optimize swab operations
Message-ID: <20060202170602.GB5273@linux-mips.org>
References: <cda58cb80601260308v3eecf0d0w@mail.gmail.com> <20060126120114.GD3411@linux-mips.org> <cda58cb80602020232r36241faeh@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <cda58cb80602020232r36241faeh@mail.gmail.com>
User-Agent: Mutt/1.4.2.1i
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: 10311
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, Feb 02, 2006 at 11:32:05AM +0100, Franck Bui-Huu wrote:

> I'm a bit disapointed the way you do it. You changed the patch
> (wrongly) and the authorships. At least you could have said: "thanks
> to" in your commit message. Bad experience for my first patch...

Sorry, yesterday was an extremly chaotic day and I had my thoughts
elsewhere ...

When applying an emailed patch my scripts (git-applymbox that is) usually
take care of proper attribution to people but since I had to edit your
patch manually that didn't happen automatically.

  Ralf

From anemo@mba.ocn.ne.jp Thu Feb  2 17:17:01 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 02 Feb 2006 17:17:19 +0000 (GMT)
Received: from mba.ocn.ne.jp ([210.190.142.172]:63434 "HELO smtp.mba.ocn.ne.jp")
	by ftp.linux-mips.org with SMTP id S3465649AbWBBRRB (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Thu, 2 Feb 2006 17:17:01 +0000
Received: from localhost (p4005-ipad24funabasi.chiba.ocn.ne.jp [220.104.82.5])
	by smtp.mba.ocn.ne.jp (Postfix) with ESMTP
	id 2189DB070; Fri,  3 Feb 2006 02:22:10 +0900 (JST)
Date:	Fri, 03 Feb 2006 02:21:50 +0900 (JST)
Message-Id: <20060203.022150.130238538.anemo@mba.ocn.ne.jp>
To:	ralf@linux-mips.org
Cc:	macro@linux-mips.org, linux-mips@linux-mips.org
Subject: Re: [PATCH] TX49 MFC0 bug workaround
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
In-Reply-To: <20060203.020428.59032357.anemo@mba.ocn.ne.jp>
References: <Pine.LNX.4.64N.0602021636380.11727@blysk.ds.pg.gda.pl>
	<20060202165656.GC17352@linux-mips.org>
	<20060203.020428.59032357.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: 10312
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 Fri, 03 Feb 2006 02:04:28 +0900 (JST), Atsushi Nemoto <anemo@mba.ocn.ne.jp> said:

anemo> However, It can be more readable since we can safely mask
anemo> bit[5:1] (as local_irq_enable() does).  Like this:

Correction: bit[4:1] (0x1e)

From ralf@linux-mips.org Thu Feb  2 17:19:11 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 02 Feb 2006 17:19:29 +0000 (GMT)
Received: from mipsfw.mips-uk.com ([194.74.144.146]:21003 "EHLO
	bacchus.net.dhis.org") by ftp.linux-mips.org with ESMTP
	id S3465649AbWBBRTL (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Thu, 2 Feb 2006 17:19:11 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by bacchus.net.dhis.org (8.13.4/8.13.4) with ESMTP id k12HOYSY021790;
	Thu, 2 Feb 2006 17:24:34 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.4/8.13.4/Submit) id k12HOYru021789;
	Thu, 2 Feb 2006 17:24:34 GMT
Date:	Thu, 2 Feb 2006 17:24:34 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc:	macro@linux-mips.org, linux-mips@linux-mips.org
Subject: Re: [PATCH] TX49 MFC0 bug workaround
Message-ID: <20060202172434.GE17352@linux-mips.org>
References: <20060203.013401.41198517.anemo@mba.ocn.ne.jp> <Pine.LNX.4.64N.0602021636380.11727@blysk.ds.pg.gda.pl> <20060202165656.GC17352@linux-mips.org> <20060203.020428.59032357.anemo@mba.ocn.ne.jp>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20060203.020428.59032357.anemo@mba.ocn.ne.jp>
User-Agent: Mutt/1.4.2.1i
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: 10313
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 Fri, Feb 03, 2006 at 02:04:28AM +0900, Atsushi Nemoto wrote:

> Is this preferred?  We can get rid of all TX49XX_MFC0_WAR on this way.

It should be ok for any R4000-style status register.  I'm not sure about
R3000 - but I'm sure Maciej will know.  If he agrees I'd say let's go for
it.

  Ralf

From sshtylyov@ru.mvista.com Thu Feb  2 18:37:58 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 02 Feb 2006 18:38:21 +0000 (GMT)
Received: from rtsoft2.corbina.net ([85.21.88.2]:6335 "HELO mail.dev.rtsoft.ru")
	by ftp.linux-mips.org with SMTP id S3465652AbWBBSh6 (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Thu, 2 Feb 2006 18:37:58 +0000
Received: (qmail 22599 invoked from network); 2 Feb 2006 18:43:09 -0000
Received: from wasted.dev.rtsoft.ru (HELO ?192.168.1.248?) (192.168.1.248)
  by mail.dev.rtsoft.ru with SMTP; 2 Feb 2006 18:43:09 -0000
Message-ID: <43E25381.4060309@ru.mvista.com>
Date:	Thu, 02 Feb 2006 21:46:25 +0300
From:	Sergei Shtylylov <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] TX49 MFC0 bug workaround
References: <20060203.013401.41198517.anemo@mba.ocn.ne.jp>
In-Reply-To: <20060203.013401.41198517.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: 10314
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:
> If mfc0 $12 follows store and the mfc0 is last instruction of a
> page and fetching the next instruction causes TLB miss, the result
> of the mfc0 might wrongly contain EXL bit.

    Hmm, a TLB miss in fetching from KSEG0?!

> ERT-TX49H2-027, ERT-TX49H3-012, ERT-TX49HL3-006, ERT-TX49H4-008
> 
> Workaround: mask EXL bit of the result or place a nop before mfc0.

    Is this workaround really needed?

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

WBR, Sergei

From anemo@mba.ocn.ne.jp Fri Feb  3 01:11:58 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 03 Feb 2006 01:12:34 +0000 (GMT)
Received: from topsns.toshiba-tops.co.jp ([202.230.225.5]:49180 "HELO
	topsns.toshiba-tops.co.jp") by ftp.linux-mips.org with SMTP
	id S3466500AbWBCBL5 (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Fri, 3 Feb 2006 01:11:57 +0000
Received: from inside-ms1.toshiba-tops.co.jp by topsns.toshiba-tops.co.jp
          via smtpd (for ftp.linux-mips.org [194.74.144.162]) with SMTP; 3 Feb 2006 01:17:10 UT
Received: from topsms.toshiba-tops.co.jp (localhost.localdomain [127.0.0.1])
	by localhost.toshiba-tops.co.jp (Postfix) with ESMTP id CBA0620336;
	Fri,  3 Feb 2006 10:17:07 +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 B730820177;
	Fri,  3 Feb 2006 10:17:07 +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 k131H64D022123;
	Fri, 3 Feb 2006 10:17:06 +0900 (JST)
	(envelope-from anemo@mba.ocn.ne.jp)
Date:	Fri, 03 Feb 2006 10:17:05 +0900 (JST)
Message-Id: <20060203.101705.41198541.nemoto@toshiba-tops.co.jp>
To:	sshtylyov@ru.mvista.com
Cc:	linux-mips@linux-mips.org, ralf@linux-mips.org
Subject: Re: [PATCH] TX49 MFC0 bug workaround
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
In-Reply-To: <43E25381.4060309@ru.mvista.com>
References: <20060203.013401.41198517.anemo@mba.ocn.ne.jp>
	<43E25381.4060309@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.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: 10315
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 Feb 2006 21:46:25 +0300, Sergei Shtylylov <sshtylyov@ru.mvista.com> said:
>> If mfc0 $12 follows store and the mfc0 is last instruction of a
>> page and fetching the next instruction causes TLB miss, the result
>> of the mfc0 might wrongly contain EXL bit.

sshtylyov>     Hmm, a TLB miss in fetching from KSEG0?!

We can call these inline functions from modules running on KSEG2.

---
Atsushi Nemoto

From mita@miraclelinux.com Fri Feb  3 01:22:27 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 03 Feb 2006 01:23:46 +0000 (GMT)
Received: from ns.miraclelinux.com ([219.118.163.66]:29255 "EHLO
	mail01.miraclelinux.com") by ftp.linux-mips.org with ESMTP
	id S8133427AbWBCBW0 (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Fri, 3 Feb 2006 01:22:26 +0000
Received: from mail01 (localhost.localdomain [127.0.0.1])
	by mail01.miraclelinux.com (Postfix) with ESMTP
	id 2D14031C2DA; Fri,  3 Feb 2006 10:27:37 +0900 (JST)
Received: from localhost.localdomain (sshgate.miraclelinux.com [])
	by mail01.miraclelinux.com ([10.1.0.10]);
	Fri, 03 Feb 2006 01:27:37 +0000
Received: by localhost.localdomain (Postfix, from userid 1000)
	id 34BC54201E0; Fri,  3 Feb 2006 10:27:35 +0900 (JST)
Date:	Fri, 3 Feb 2006 10:27:35 +0900
To:	Rune Torgersen <runet@innovsys.com>
Cc:	linux-kernel@vger.kernel.org, linux-mips@linux-mips.org,
	linux-ia64@vger.kernel.org, Ian Molton <spyro@f2s.com>,
	David Howells <dhowells@redhat.com>, linuxppc-dev@ozlabs.org,
	Greg Ungerer <gerg@uclinux.org>, sparclinux@vger.kernel.org,
	Miles Bader <uclinux-v850@lsi.nec.co.jp>,
	Linus Torvalds <torvalds@osdl.org>,
	Yoshinori Sato <ysato@users.sourceforge.jp>,
	Hirokazu Takata <takata@linux-m32r.org>,
	linuxsh-shmedia-dev@lists.sourceforge.net,
	linux-m68k@lists.linux-m68k.org,
	Ivan Kokshaysky <ink@jurassic.park.msu.ru>,
	Richard Henderson <rth@twiddle.net>,
	Chris Zankel <chris@zankel.net>, dev-etrax@axis.com,
	ultralinux@vger.kernel.org, Andi Kleen <ak@suse.de>,
	linuxsh-dev@lists.sourceforge.net, linux390@de.ibm.com,
	Russell King <rmk@arm.linux.org.uk>,
	parisc-linux@parisc-linux.org, akpm@osdl.org,
	Stephen Hemminger <shemminger@osdl.org>
Subject: [PATCH] fix generic_fls64()
Message-ID: <20060203012735.GA21567@miraclelinux.com>
References: <DCEAAC0833DD314AB0B58112AD99B93B859547@ismail.innsys.innovsys.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <DCEAAC0833DD314AB0B58112AD99B93B859547@ismail.innsys.innovsys.com>
User-Agent: Mutt/1.5.9i
From:	mita@miraclelinux.com (Akinobu Mita)
Return-Path: <mita@miraclelinux.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: 10316
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: mita@miraclelinux.com
Precedence: bulk
X-list: linux-mips

Noticed by Rune Torgersen.

fix generic_fls64().
tcp_cubic is using fls64().

Signed-off-by: Akinobu Mita <mita@miraclelinux.com>

 include/linux/bitops.h |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

Index: 2.6-git/include/linux/bitops.h
===================================================================
--- 2.6-git.orig/include/linux/bitops.h
+++ 2.6-git/include/linux/bitops.h
@@ -81,7 +81,7 @@ static inline int generic_fls64(__u64 x)
 {
 	__u32 h = x >> 32;
 	if (h)
-		return fls(x) + 32;
+		return fls(h) + 32;
 	return fls(x);
 }
 

From sshtylyov@ru.mvista.com Fri Feb  3 02:04:34 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 03 Feb 2006 02:05:21 +0000 (GMT)
Received: from rtsoft2.corbina.net ([85.21.88.2]:41686 "HELO
	mail.dev.rtsoft.ru") by ftp.linux-mips.org with SMTP
	id S8133441AbWBCCEV (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Fri, 3 Feb 2006 02:04:21 +0000
Received: (qmail 27416 invoked from network); 3 Feb 2006 02:09:33 -0000
Received: from wasted.dev.rtsoft.ru (HELO ?192.168.1.248?) (192.168.1.248)
  by mail.dev.rtsoft.ru with SMTP; 3 Feb 2006 02:09:33 -0000
Message-ID: <43E2BC1F.7080505@ru.mvista.com>
Date:	Fri, 03 Feb 2006 05:12:47 +0300
From:	Sergei Shtylylov <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@linux-mips.org>
Subject: Re: [PATCH] TX49 MFC0 bug workaround
References: <20060203.013401.41198517.anemo@mba.ocn.ne.jp>	<43E25381.4060309@ru.mvista.com> <20060203.101705.41198541.nemoto@toshiba-tops.co.jp>
In-Reply-To: <20060203.101705.41198541.nemoto@toshiba-tops.co.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: 10317
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:

>>>>>>On Thu, 02 Feb 2006 21:46:25 +0300, Sergei Shtylylov <sshtylyov@ru.mvista.com> said:
>>>
>>>If mfc0 $12 follows store and the mfc0 is last instruction of a
>>>page and fetching the next instruction causes TLB miss, the result
>>>of the mfc0 might wrongly contain EXL bit.
> 
> 
> sshtylyov>     Hmm, a TLB miss in fetching from KSEG0?!
> 
> We can call these inline functions from modules running on KSEG2.

    Hm, I'm still learning Linux/MIPS, and have overlooked #ifdef MODULE. :-<

    If I don't mistake, the offending code is in local_irq_disable, 
local_irq_save, and local_irq_restore macros. The effect would be a crash on 
any exception taken once interrupts get disabled in a module (*and* that code 
happens to fall on a page boundary)... nasty. :-(

> ---
> Atsushi Nemoto

WBR, Sergei

From anemo@mba.ocn.ne.jp Fri Feb  3 02:05:47 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 03 Feb 2006 02:09:10 +0000 (GMT)
Received: from topsns.toshiba-tops.co.jp ([202.230.225.5]:63263 "HELO
	topsns.toshiba-tops.co.jp") by ftp.linux-mips.org with SMTP
	id S8133457AbWBCCFA (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Fri, 3 Feb 2006 02:05:00 +0000
Received: from inside-ms1.toshiba-tops.co.jp by topsns.toshiba-tops.co.jp
          via smtpd (for ftp.linux-mips.org [194.74.144.162]) with SMTP; 3 Feb 2006 02:10:13 UT
Received: from topsms.toshiba-tops.co.jp (localhost.localdomain [127.0.0.1])
	by localhost.toshiba-tops.co.jp (Postfix) with ESMTP id 386B22038D;
	Fri,  3 Feb 2006 11:10:12 +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 248F91F0C0;
	Fri,  3 Feb 2006 11:10:12 +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 k132AC4D022295;
	Fri, 3 Feb 2006 11:10:12 +0900 (JST)
	(envelope-from anemo@mba.ocn.ne.jp)
Date:	Fri, 03 Feb 2006 11:10:12 +0900 (JST)
Message-Id: <20060203.111012.130238823.nemoto@toshiba-tops.co.jp>
To:	ralf@linux-mips.org
Cc:	macro@linux-mips.org, linux-mips@linux-mips.org
Subject: Re: [PATCH] TX49 MFC0 bug workaround
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
In-Reply-To: <20060202172434.GE17352@linux-mips.org>
References: <20060202165656.GC17352@linux-mips.org>
	<20060203.020428.59032357.anemo@mba.ocn.ne.jp>
	<20060202172434.GE17352@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: 10318
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 Feb 2006 17:24:34 +0000, Ralf Baechle <ralf@linux-mips.org> said:
ralf> It should be ok for any R4000-style status register.  I'm not
ralf> sure about R3000 - but I'm sure Maciej will know.  If he agrees
ralf> I'd say let's go for it.

It should be OK for all CPU while STI/CLI/KMODE macro always clear
bit[4:1] of status register.  Could you confirm, Maciej ?

So here is a patch against current GIT.


Always clear bit[4:1] of status register.  This makes interrupt.h TX49
bug proof.  TX49XX_MFC0_WAR is not needed anymore.

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

diff --git a/include/asm-mips/interrupt.h b/include/asm-mips/interrupt.h
index 951ee7a..7743487 100644
--- a/include/asm-mips/interrupt.h
+++ b/include/asm-mips/interrupt.h
@@ -13,7 +13,6 @@
 
 #include <linux/config.h>
 #include <asm/hazards.h>
-#include <asm/war.h>
 
 __asm__ (
 	"	.macro	local_irq_enable				\n"
@@ -48,6 +47,17 @@ static inline void local_irq_enable(void
  * R4000/R4400 need three nops, the R4600 two nops and the R10000 needs
  * no nops at all.
  */
+/*
+ * For TX49, operating only IE bit is not enough.
+ *
+ * If mfc0 $12 follows store and the mfc0 is last instruction of a
+ * page and fetching the next instruction causes TLB miss, the result
+ * of the mfc0 might wrongly contain EXL bit.
+ *
+ * ERT-TX49H2-027, ERT-TX49H3-012, ERT-TX49HL3-006, ERT-TX49H4-008
+ *
+ * Workaround: mask EXL bit of the result or place a nop before mfc0.
+ */
 __asm__ (
 	"	.macro	local_irq_disable\n"
 	"	.set	push						\n"
@@ -56,13 +66,8 @@ __asm__ (
 	"	di							\n"
 #else
 	"	mfc0	$1,$12						\n"
-#if TX49XX_MFC0_WAR && defined(MODULE)
-	"	ori	$1,3						\n"
-	"	xori	$1,3						\n"
-#else
-	"	ori	$1,1						\n"
-	"	xori	$1,1						\n"
-#endif
+	"	ori	$1,0x1f						\n"
+	"	xori	$1,0x1f						\n"
 	"	.set	noreorder					\n"
 	"	mtc0	$1,$12						\n"
 #endif
@@ -102,13 +107,8 @@ __asm__ (
 	"	andi	\\result, 1					\n"
 #else
 	"	mfc0	\\result, $12					\n"
-#if TX49XX_MFC0_WAR && defined(MODULE)
-	"	ori	$1, \\result, 3					\n"
-	"	xori	$1, 3						\n"
-#else
-	"	ori	$1, \\result, 1					\n"
-	"	xori	$1, 1						\n"
-#endif
+	"	ori	$1, \\result, 0x1f				\n"
+	"	xori	$1, 0x1f					\n"
 	"	.set	noreorder					\n"
 	"	mtc0	$1, $12						\n"
 #endif
@@ -147,13 +147,8 @@ __asm__ (
 #else
 	"	mfc0	$1, $12						\n"
 	"	andi	\\flags, 1					\n"
-#if TX49XX_MFC0_WAR && defined(MODULE)
-	"	ori	$1, 3						\n"
-	"	xori	$1, 3						\n"
-#else
-	"	ori	$1, 1						\n"
-	"	xori	$1, 1						\n"
-#endif
+	"	ori	$1, 0x1f					\n"
+	"	xori	$1, 0x1f					\n"
 	"	or	\\flags, $1					\n"
 	"	mtc0	\\flags, $12					\n"
 #endif
diff --git a/include/asm-mips/war.h b/include/asm-mips/war.h
index 859520a..229afaa 100644
--- a/include/asm-mips/war.h
+++ b/include/asm-mips/war.h
@@ -169,19 +169,6 @@
 #endif
 
 /*
- * If mfc0 $12 follows store and the mfc0 is last instruction of a
- * page and fetching the next instruction causes TLB miss, the result
- * of the mfc0 might wrongly contain EXL bit.
- *
- * ERT-TX49H2-027, ERT-TX49H3-012, ERT-TX49HL3-006, ERT-TX49H4-008
- *
- * Workaround: mask EXL bit of the result or place a nop before mfc0.
- */
-#ifdef CONFIG_CPU_TX49XX
-#define TX49XX_MFC0_WAR 1
-#endif
-
-/*
  * On the RM9000 there is a problem which makes the CreateDirtyExclusive
  * cache operation unusable on SMP systems.
  */

From anemo@mba.ocn.ne.jp Fri Feb  3 02:17:45 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 03 Feb 2006 02:18:27 +0000 (GMT)
Received: from topsns.toshiba-tops.co.jp ([202.230.225.5]:29957 "HELO
	topsns.toshiba-tops.co.jp") by ftp.linux-mips.org with SMTP
	id S8133457AbWBCCRm (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Fri, 3 Feb 2006 02:17:42 +0000
Received: from inside-ms1.toshiba-tops.co.jp by topsns.toshiba-tops.co.jp
          via smtpd (for ftp.linux-mips.org [194.74.144.162]) with SMTP; 3 Feb 2006 02:22:56 UT
Received: from topsms.toshiba-tops.co.jp (localhost.localdomain [127.0.0.1])
	by localhost.toshiba-tops.co.jp (Postfix) with ESMTP id 8632F2038B;
	Fri,  3 Feb 2006 11:22:54 +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 73E3A2022E;
	Fri,  3 Feb 2006 11:22:54 +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 k132Mr4D022348;
	Fri, 3 Feb 2006 11:22:53 +0900 (JST)
	(envelope-from anemo@mba.ocn.ne.jp)
Date:	Fri, 03 Feb 2006 11:22:53 +0900 (JST)
Message-Id: <20060203.112253.104030567.nemoto@toshiba-tops.co.jp>
To:	sshtylyov@ru.mvista.com
Cc:	linux-mips@linux-mips.org
Subject: Re: [PATCH] TX49 MFC0 bug workaround
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
In-Reply-To: <43E2BC1F.7080505@ru.mvista.com>
References: <43E25381.4060309@ru.mvista.com>
	<20060203.101705.41198541.nemoto@toshiba-tops.co.jp>
	<43E2BC1F.7080505@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.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: 10319
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 Fri, 03 Feb 2006 05:12:47 +0300, Sergei Shtylylov <sshtylyov@ru.mvista.com> said:
sshtylyov>     If I don't mistake, the offending code is in
sshtylyov> local_irq_disable, local_irq_save, and local_irq_restore
sshtylyov> macros. The effect would be a crash on any exception taken
sshtylyov> once interrupts get disabled in a module (*and* that code
sshtylyov> happens to fall on a page boundary)... nasty. :-(

Right.  And it can really happen.

---
Atsushi Nemoto

From sshtylyov@ru.mvista.com Fri Feb  3 02:18:53 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 03 Feb 2006 02:19:58 +0000 (GMT)
Received: from rtsoft2.corbina.net ([85.21.88.2]:61910 "HELO
	mail.dev.rtsoft.ru") by ftp.linux-mips.org with SMTP
	id S8133531AbWBCCSW (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Fri, 3 Feb 2006 02:18:22 +0000
Received: (qmail 27553 invoked from network); 3 Feb 2006 02:23:32 -0000
Received: from wasted.dev.rtsoft.ru (HELO ?192.168.1.248?) (192.168.1.248)
  by mail.dev.rtsoft.ru with SMTP; 3 Feb 2006 02:23:32 -0000
Message-ID: <43E2BF68.2000208@ru.mvista.com>
Date:	Fri, 03 Feb 2006 05:26:48 +0300
From:	Sergei Shtylylov <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:	"Maciej W. Rozycki" <macro@linux-mips.org>,
	Atsushi Nemoto <anemo@mba.ocn.ne.jp>, linux-mips@linux-mips.org
Subject: Re: [PATCH] TX49 MFC0 bug workaround
References: <20060203.013401.41198517.anemo@mba.ocn.ne.jp> <Pine.LNX.4.64N.0602021636380.11727@blysk.ds.pg.gda.pl> <20060202165656.GC17352@linux-mips.org>
In-Reply-To: <20060202165656.GC17352@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: 10320
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:

>>>Workaround: mask EXL bit of the result or place a nop before mfc0.
>>
>>[...]
>>
>>>@@ -55,8 +56,13 @@ __asm__ (
>>> 	"	di							\n"
>>> #else
>>> 	"	mfc0	$1,$12						\n"
>>>+#if TX49XX_MFC0_WAR && defined(MODULE)
>>>+	"	ori	$1,3						\n"
>>>+	"	xori	$1,3						\n"
>>>+#else
>>> 	"	ori	$1,1						\n"
>>> 	"	xori	$1,1						\n"
>>>+#endif
>>> 	"	.set	noreorder					\n"
>>> 	"	mtc0	$1,$12						\n"
>>> #endif

>> Hmm, wouldn't that "nop" alternative be simpler?

> Simpler maybe - but this variant has zero runtime overhead.

    And.. how do you imagine placing a NOP (which surely just moves MFC0 down 
so that it's a 1st insn. on the next page). What if it'll move it to the 
errata prone address from a safe one instead?

WBR, Sergei

From anemo@mba.ocn.ne.jp Fri Feb  3 02:44:56 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 03 Feb 2006 02:45:15 +0000 (GMT)
Received: from topsns.toshiba-tops.co.jp ([202.230.225.5]:10776 "HELO
	topsns.toshiba-tops.co.jp") by ftp.linux-mips.org with SMTP
	id S8133507AbWBCCo4 (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Fri, 3 Feb 2006 02:44:56 +0000
Received: from inside-ms1.toshiba-tops.co.jp by topsns.toshiba-tops.co.jp
          via smtpd (for ftp.linux-mips.org [194.74.144.162]) with SMTP; 3 Feb 2006 02:50:10 UT
Received: from topsms.toshiba-tops.co.jp (localhost.localdomain [127.0.0.1])
	by localhost.toshiba-tops.co.jp (Postfix) with ESMTP id A84C72037F;
	Fri,  3 Feb 2006 11:50:08 +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 9393020336;
	Fri,  3 Feb 2006 11:50:08 +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 k132o74D022548;
	Fri, 3 Feb 2006 11:50:08 +0900 (JST)
	(envelope-from anemo@mba.ocn.ne.jp)
Date:	Fri, 03 Feb 2006 11:50:07 +0900 (JST)
Message-Id: <20060203.115007.112625083.nemoto@toshiba-tops.co.jp>
To:	sshtylyov@ru.mvista.com
Cc:	ralf@linux-mips.org, macro@linux-mips.org,
	linux-mips@linux-mips.org
Subject: Re: [PATCH] TX49 MFC0 bug workaround
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
In-Reply-To: <43E2BF68.2000208@ru.mvista.com>
References: <Pine.LNX.4.64N.0602021636380.11727@blysk.ds.pg.gda.pl>
	<20060202165656.GC17352@linux-mips.org>
	<43E2BF68.2000208@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.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: 10321
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 Fri, 03 Feb 2006 05:26:48 +0300, Sergei Shtylylov <sshtylyov@ru.mvista.com> said:
sshtylyov>     And.. how do you imagine placing a NOP (which surely
sshtylyov> just moves MFC0 down so that it's a 1st insn. on the next
sshtylyov> page). What if it'll move it to the errata prone address
sshtylyov> from a safe one instead?

The NOP will break the "If mfc0 $12 follows store" condition.

Actually, the condition is more strict.  This is a code sequence from
the errata. (It seems English version is not updated yet...)

	Load/Store instruction
	Load/Store/Sync instruction
	Mfc0 rt,rd	; rd is Status/Cause
	-- page boundary --
	nop		; TLB mapped area

For Cause register case, Linux modules should never read it so it
would not be a problem.

---
Atsushi Nemoto

From grundler@lackof.org Fri Feb  3 03:43:30 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 03 Feb 2006 03:43:49 +0000 (GMT)
Received: from colo.lackof.org ([198.49.126.79]:45487 "EHLO colo.lackof.org")
	by ftp.linux-mips.org with ESMTP id S8133480AbWBCDna (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Fri, 3 Feb 2006 03:43:30 +0000
Received: from localhost (localhost [127.0.0.1])
	by colo.lackof.org (Postfix) with ESMTP id D25D6360018;
	Thu,  2 Feb 2006 20:58:23 -0700 (MST)
Received: from colo.lackof.org ([127.0.0.1])
	by localhost (colo.lackof.org [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id 10848-07; Thu, 2 Feb 2006 20:58:22 -0700 (MST)
Received: by colo.lackof.org (Postfix, from userid 27253)
	id 3882C360014; Thu,  2 Feb 2006 20:58:22 -0700 (MST)
Date:	Thu, 2 Feb 2006 20:58:22 -0700
From:	Grant Grundler <grundler@parisc-linux.org>
To:	Akinobu Mita <mita@miraclelinux.com>
Cc:	linux-kernel@vger.kernel.org, linux-mips@linux-mips.org,
	linux-ia64@vger.kernel.org, Ian Molton <spyro@f2s.com>,
	David Howells <dhowells@redhat.com>, linuxppc-dev@ozlabs.org,
	Greg Ungerer <gerg@uclinux.org>, sparclinux@vger.kernel.org,
	Miles Bader <uclinux-v850@lsi.nec.co.jp>,
	Linus Torvalds <torvalds@osdl.org>,
	Yoshinori Sato <ysato@users.sourceforge.jp>,
	Hirokazu Takata <takata@linux-m32r.org>,
	linuxsh-dev@lists.sourceforge.net, linux-m68k@lists.linux-m68k.org,
	Chris Zankel <chris@zankel.net>, dev-etrax@axis.com,
	ultralinux@vger.kernel.org, Andi Kleen <ak@suse.de>,
	linuxsh-shmedia-dev@lists.sourceforge.net, linux390@de.ibm.com,
	Russell King <rmk@arm.linux.org.uk>,
	parisc-linux@parisc-linux.org
Subject: Re: [parisc-linux] [patch 12/44] generic sched_find_first_bit()
Message-ID: <20060203035822.GA12539@colo.lackof.org>
References: <20060201090224.536581000@localhost.localdomain> <20060201090325.497639000@localhost.localdomain>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20060201090325.497639000@localhost.localdomain>
X-Home-Page: http://www.parisc-linux.org/
User-Agent: Mutt/1.5.9i
X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at lackof.org
Return-Path: <grundler@lackof.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: 10322
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: grundler@parisc-linux.org
Precedence: bulk
X-list: linux-mips

On Wed, Feb 01, 2006 at 06:02:36PM +0900, Akinobu Mita wrote:
> This patch introduces the C-language equivalent of the function:
> int sched_find_first_bit(const unsigned long *b);

Akinobu, would you prefer this is a slightly cleaner way?
(Not compile tested)

static inline int sched_find_first_bit(const unsigned long *b)
{
	if (unlikely(b[0]))
		return __ffs(b[0]);
	if (unlikely(b[1]))
		return __ffs(b[1]) + BITS_PER_LONG;
#if BITS_PER_LONG == 32
	if (unlikely(b[2]))
		return __ffs(b[2]) + 64;
	if (b[3])
		return __ffs(b[3]) + 96;
#endif
	return __ffs(b[128/BITS_PER_LONG]) + 128;
}

If BITS_PER_LONG isn't defined, the link step will fail and point
at a some unknown .o as the offender. But it's the responsibility
of the header file to make sure it's including the BITS_PER_LONG
definition, not the code that calls sched_find_first_bit().

hth,
grant

From anemo@mba.ocn.ne.jp Fri Feb  3 05:09:13 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 03 Feb 2006 05:09:31 +0000 (GMT)
Received: from topsns.toshiba-tops.co.jp ([202.230.225.5]:29204 "HELO
	topsns.toshiba-tops.co.jp") by ftp.linux-mips.org with SMTP
	id S8126537AbWBCFJN (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Fri, 3 Feb 2006 05:09:13 +0000
Received: from inside-ms1.toshiba-tops.co.jp by topsns.toshiba-tops.co.jp
          via smtpd (for ftp.linux-mips.org [194.74.144.162]) with SMTP; 3 Feb 2006 05:14:27 UT
Received: from topsms.toshiba-tops.co.jp (localhost.localdomain [127.0.0.1])
	by localhost.toshiba-tops.co.jp (Postfix) with ESMTP id 9DC5D203A3;
	Fri,  3 Feb 2006 14:14:25 +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 89D40201FC;
	Fri,  3 Feb 2006 14:14:25 +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 k135EO4D023175;
	Fri, 3 Feb 2006 14:14:25 +0900 (JST)
	(envelope-from anemo@mba.ocn.ne.jp)
Date:	Fri, 03 Feb 2006 14:14:24 +0900 (JST)
Message-Id: <20060203.141424.72708300.nemoto@toshiba-tops.co.jp>
To:	linux-mips@linux-mips.org
Cc:	ralf@linux-mips.org
Subject: Re: [PATCH] local_r4k_flush_cache_page fix
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
In-Reply-To: <20060201.000356.25911337.anemo@mba.ocn.ne.jp>
References: <20060201.000356.25911337.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: 10323
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, 01 Feb 2006 00:03:56 +0900 (JST), Atsushi Nemoto <anemo@mba.ocn.ne.jp> said:
anemo> If dcache_size != icache_size or dcache_size != scache_size,
anemo> icache/scache does not flushed properly.  Use correct cache
anemo> size to calculate index value for scache/icache.

Sorry, this patch was wrong !

We should use mask value based on the waysize (not whole cache size).

And now I think it would be better to do it in __BUILD_BLAST_CACHE().

I'll post a new patch later.

---
Atsushi Nemoto

From Eckhardt@satorlaser.com Fri Feb  3 08:28:10 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 03 Feb 2006 08:28:29 +0000 (GMT)
Received: from mail.domino-uk.com ([193.131.116.193]:43535 "EHLO
	vMIMEsweeper.dps.local") by ftp.linux-mips.org with ESMTP
	id S8133350AbWBCI2K (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Fri, 3 Feb 2006 08:28:10 +0000
Received: from dps-exchange1.dps.local (dps-exchange1) by vMIMEsweeper.dps.local
 (Clearswift SMTPRS 5.0.4) with ESMTP id <T763b741b76c18374c1ba8@vMIMEsweeper.dps.local>;
 Fri, 3 Feb 2006 08:33:25 +0000
Received: from emea-exchange3.emea.dps.local ([192.168.50.10]) by dps-exchange1.dps.local with Microsoft SMTPSVC(5.0.2195.6713);
	 Fri, 3 Feb 2006 08:33:25 +0000
Received: from tuxator2.emea.dps.local ([192.168.55.75]) by emea-exchange3.emea.dps.local with Microsoft SMTPSVC(6.0.3790.1830);
	 Fri, 3 Feb 2006 09:26:27 +0100
From:	Ulrich Eckhardt <eckhardt@satorlaser.com>
Organization: Sator Laser GmbH
To:	Akinobu Mita <mita@miraclelinux.com>
Subject: Re: [patch 14/44] generic hweight{64,32,16,8}()
Date:	Fri, 3 Feb 2006 09:31:42 +0100
User-Agent: KMail/1.8.3
Cc:	linux-kernel@vger.kernel.org, Richard Henderson <rth@twiddle.net>,
	Ivan Kokshaysky <ink@jurassic.park.msu.ru>,
	Russell King <rmk@arm.linux.org.uk>,
	Ian Molton <spyro@f2s.com>, dev-etrax@axis.com,
	David Howells <dhowells@redhat.com>,
	Yoshinori Sato <ysato@users.sourceforge.jp>,
	Linus Torvalds <torvalds@osdl.org>, linux-ia64@vger.kernel.org,
	Hirokazu Takata <takata@linux-m32r.org>,
	linux-m68k@lists.linux-m68k.org, Greg Ungerer <gerg@uclinux.org>,
	linux-mips@linux-mips.org, parisc-linux@parisc-linux.org,
	linuxppc-dev@ozlabs.org, linux390@de.ibm.com,
	linuxsh-dev@lists.sourceforge.net,
	linuxsh-shmedia-dev@lists.sourceforge.net,
	sparclinux@vger.kernel.org, ultralinux@vger.kernel.org,
	Miles Bader <uclinux-v850@lsi.nec.co.jp>,
	Andi Kleen <ak@suse.de>, Chris Zankel <chris@zankel.net>
References: <20060201090224.536581000@localhost.localdomain> <20060201090325.905071000@localhost.localdomain>
In-Reply-To: <20060201090325.905071000@localhost.localdomain>
MIME-Version: 1.0
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200602030931.43686.eckhardt@satorlaser.com>
X-OriginalArrivalTime: 03 Feb 2006 08:26:27.0578 (UTC) FILETIME=[86F36DA0:01C6289B]
Return-Path: <Eckhardt@satorlaser.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: 10324
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: eckhardt@satorlaser.com
Precedence: bulk
X-list: linux-mips

On Wednesday 01 February 2006 10:02, Akinobu Mita wrote:
> unsigned int hweight32(unsigned int w);
> unsigned int hweight16(unsigned int w);
> unsigned int hweight8(unsigned int w);
> unsigned long hweight64(__u64 w);

IMHO, this should use explicitly sized integers like __u8, __u16 etc, unless 
there are stringent reasons like better register use - which is hard to tell 
for generic C code. Also, why on earth is the returntype for hweight64 a 
long?

> +static inline unsigned int hweight32(unsigned int w)
> +{
> +        unsigned int res = (w & 0x55555555) + ((w >> 1) & 0x55555555);
> +        res = (res & 0x33333333) + ((res >> 2) & 0x33333333);
[...]

Why not use unsigned constants here?

> +static inline unsigned long hweight64(__u64 w)
> +{
[..]
> +	u64 res;
> +	res = (w & 0x5555555555555555ul) + ((w >> 1) & 0x5555555555555555ul);

Why not use initialisation here, too?

just my 2c

Uli

From macro@linux-mips.org Fri Feb  3 10:12:43 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 03 Feb 2006 10:13:01 +0000 (GMT)
Received: from pollux.ds.pg.gda.pl ([153.19.208.7]:32262 "EHLO
	pollux.ds.pg.gda.pl") by ftp.linux-mips.org with ESMTP
	id S8133366AbWBCKMn (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Fri, 3 Feb 2006 10:12:43 +0000
Received: from localhost (localhost [127.0.0.1])
	by pollux.ds.pg.gda.pl (Postfix) with ESMTP id CF4F5F5CE7;
	Fri,  3 Feb 2006 11:17:57 +0100 (CET)
Received: from pollux.ds.pg.gda.pl ([127.0.0.1])
 by localhost (pollux [127.0.0.1]) (amavisd-new, port 10024) with ESMTP
 id 01091-07; Fri,  3 Feb 2006 11:17:57 +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 84BA9F5A90;
	Fri,  3 Feb 2006 11:17:57 +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.3/8.13.1) with ESMTP id k13AHqiZ027570;
	Fri, 3 Feb 2006 11:17:52 +0100
Date:	Fri, 3 Feb 2006 10:17:58 +0000 (GMT)
From:	"Maciej W. Rozycki" <macro@linux-mips.org>
To:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc:	ralf@linux-mips.org, linux-mips@linux-mips.org
Subject: Re: [PATCH] TX49 MFC0 bug workaround
In-Reply-To: <20060203.111012.130238823.nemoto@toshiba-tops.co.jp>
Message-ID: <Pine.LNX.4.64N.0602031014080.3882@blysk.ds.pg.gda.pl>
References: <20060202165656.GC17352@linux-mips.org> <20060203.020428.59032357.anemo@mba.ocn.ne.jp>
 <20060202172434.GE17352@linux-mips.org> <20060203.111012.130238823.nemoto@toshiba-tops.co.jp>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Virus-Scanned: ClamAV 0.87.1/1272/Thu Feb  2 23:27:32 2006 on piorun.ds.pg.gda.pl
X-Virus-Status:	Clean
X-Virus-Scanned: by amavisd-new at pollux.ds.pg.gda.pl
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: 10325
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 Fri, 3 Feb 2006, Atsushi Nemoto wrote:

> It should be OK for all CPU while STI/CLI/KMODE macro always clear
> bit[4:1] of status register.  Could you confirm, Maciej ?

 Well, as long as RESTORE_SOME in <asm/stackframe.h> correctly restores 
the IEc, KUc, IEp and KUp bits in the status register this change should 
be OK for R3k-class processors.

  Maciej

From ralf@linux-mips.org Fri Feb  3 13:16:50 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 03 Feb 2006 13:17:09 +0000 (GMT)
Received: from mipsfw.mips-uk.com ([194.74.144.146]:58901 "EHLO
	bacchus.net.dhis.org") by ftp.linux-mips.org with ESMTP
	id S8133382AbWBCNQu (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Fri, 3 Feb 2006 13:16:50 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by bacchus.net.dhis.org (8.13.4/8.13.4) with ESMTP id k13DMHL0005692;
	Fri, 3 Feb 2006 13:22:17 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.4/8.13.4/Submit) id k12MBW44008823;
	Thu, 2 Feb 2006 22:11:32 GMT
Date:	Thu, 2 Feb 2006 22:11:32 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	Sergei Shtylylov <sshtylyov@ru.mvista.com>
Cc:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>, linux-mips@linux-mips.org
Subject: Re: [PATCH] TX49 MFC0 bug workaround
Message-ID: <20060202221132.GA8799@linux-mips.org>
References: <20060203.013401.41198517.anemo@mba.ocn.ne.jp> <43E25381.4060309@ru.mvista.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <43E25381.4060309@ru.mvista.com>
User-Agent: Mutt/1.4.2.1i
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: 10326
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, Feb 02, 2006 at 09:46:25PM +0300, Sergei Shtylylov wrote:

> Atsushi Nemoto wrote:
> >If mfc0 $12 follows store and the mfc0 is last instruction of a
> >page and fetching the next instruction causes TLB miss, the result
> >of the mfc0 might wrongly contain EXL bit.
> 
>    Hmm, a TLB miss in fetching from KSEG0?!

It'll hit loadable modules which run in the mapped KSEG2/3 spaces.

  Ralf

From ralf@linux-mips.org Fri Feb  3 14:38:52 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 03 Feb 2006 14:39:58 +0000 (GMT)
Received: from mipsfw.mips-uk.com ([194.74.144.146]:4102 "EHLO
	bacchus.net.dhis.org") by ftp.linux-mips.org with ESMTP
	id S8133401AbWBCOiw (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Fri, 3 Feb 2006 14:38:52 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by bacchus.net.dhis.org (8.13.4/8.13.4) with ESMTP id k13EiKUh008476;
	Fri, 3 Feb 2006 14:44:20 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.4/8.13.4/Submit) id k13EiKEv008475;
	Fri, 3 Feb 2006 14:44:20 GMT
Date:	Fri, 3 Feb 2006 14:44:20 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc:	macro@linux-mips.org, linux-mips@linux-mips.org
Subject: Re: [PATCH] TX49 MFC0 bug workaround
Message-ID: <20060203144420.GA3375@linux-mips.org>
References: <20060202165656.GC17352@linux-mips.org> <20060203.020428.59032357.anemo@mba.ocn.ne.jp> <20060202172434.GE17352@linux-mips.org> <20060203.111012.130238823.nemoto@toshiba-tops.co.jp>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20060203.111012.130238823.nemoto@toshiba-tops.co.jp>
User-Agent: Mutt/1.4.2.1i
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: 10327
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 Fri, Feb 03, 2006 at 11:10:12AM +0900, Atsushi Nemoto wrote:

> So here is a patch against current GIT.

Okay, applied.

  Ralf

From ralf@linux-mips.org Fri Feb  3 14:42:14 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 03 Feb 2006 14:42:35 +0000 (GMT)
Received: from mipsfw.mips-uk.com ([194.74.144.146]:23327 "EHLO
	bacchus.net.dhis.org") by ftp.linux-mips.org with ESMTP
	id S8133401AbWBCOmO (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Fri, 3 Feb 2006 14:42:14 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by bacchus.net.dhis.org (8.13.4/8.13.4) with ESMTP id k13EldCg008571;
	Fri, 3 Feb 2006 14:47:39 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.4/8.13.4/Submit) id k13Eld2Q008570;
	Fri, 3 Feb 2006 14:47:39 GMT
Date:	Fri, 3 Feb 2006 14:47:39 +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] local_r4k_flush_cache_page fix
Message-ID: <20060203144739.GB3375@linux-mips.org>
References: <20060201.000356.25911337.anemo@mba.ocn.ne.jp> <20060203.141424.72708300.nemoto@toshiba-tops.co.jp>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20060203.141424.72708300.nemoto@toshiba-tops.co.jp>
User-Agent: Mutt/1.4.2.1i
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: 10328
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 Fri, Feb 03, 2006 at 02:14:24PM +0900, Atsushi Nemoto wrote:

> 
> >>>>> On Wed, 01 Feb 2006 00:03:56 +0900 (JST), Atsushi Nemoto <anemo@mba.ocn.ne.jp> said:
> anemo> If dcache_size != icache_size or dcache_size != scache_size,
> anemo> icache/scache does not flushed properly.  Use correct cache
> anemo> size to calculate index value for scache/icache.
> 
> Sorry, this patch was wrong !
> 
> We should use mask value based on the waysize (not whole cache size).
> 
> And now I think it would be better to do it in __BUILD_BLAST_CACHE().
> 
> I'll post a new patch later.

Maciej ran over what seems to be the same issue; I attach his patch below.
Could you check if it resolves your issues?

  Ralf

Date: Tue, 31 Jan 2006 15:38:37 +0000 (GMT)
From: "Maciej W. Rozycki" <macro@mips.com>
To: Ralf Baechle <ralf@mips.com>

Ralf,

 This patch fixes a problem with set-associative caches, where depending 
on the address passed to flush_cache_page() some ways may not indeed be 
invalidated.  This has been observed with a 24KEc and a 64K D-cache.  The 
S-cache part of the fix wasn't tested. ;-)

 As suggested by Nigel, alternatively blast_?cache_page_indexed() 
functions might be changed to mask out way selection bits, in which case 
the Atsushi's fix is the right one (barring magic number removal).

  Maciej

Signed-off-by: Maciej W. Rozycki <macro@mips.com>

patch-mips-2.6.15-rc7-20060109-dc_aliases-4
diff -up --recursive --new-file linux-mips-2.6.15-rc7-20060109.macro/arch/mips/mm/c-r4k.c linux-mips-2.6.15-rc7-20060109/arch/mips/mm/c-r4k.c
--- linux-mips-2.6.15-rc7-20060109.macro/arch/mips/mm/c-r4k.c	Fri Dec  9 06:11:21 2005
+++ linux-mips-2.6.15-rc7-20060109/arch/mips/mm/c-r4k.c	Tue Jan 31 15:27:11 2006
@@ -375,7 +375,7 @@ static inline void local_r4k_flush_cache
 {
 	struct flush_cache_page_args *fcp_args = args;
 	struct vm_area_struct *vma = fcp_args->vma;
-	unsigned long addr = fcp_args->addr;
+	unsigned long addr = fcp_args->addr, iaddr;
 	int exec = vma->vm_flags & VM_EXEC;
 	struct mm_struct *mm = vma->vm_mm;
 	pgd_t *pgdp;
@@ -425,11 +425,15 @@ static inline void local_r4k_flush_cache
 	 * Do indexed flush, too much work to get the (possible) TLB refills
 	 * to work correctly.
 	 */
-	addr = INDEX_BASE + (addr & (dcache_size - 1));
 	if (cpu_has_dc_aliases || (exec && !cpu_has_ic_fills_f_dc)) {
-		r4k_blast_dcache_page_indexed(addr);
-		if (exec && !cpu_icache_snoops_remote_store)
-			r4k_blast_scache_page_indexed(addr);
+		iaddr = INDEX_BASE +
+			(addr & (current_cpu_data.dcache.waysize - 1));
+		r4k_blast_dcache_page_indexed(iaddr);
+		if (exec && !cpu_icache_snoops_remote_store) {
+			iaddr = INDEX_BASE +
+				(addr & (current_cpu_data.scache.waysize - 1));
+			r4k_blast_scache_page_indexed(iaddr);
+		}
 	}
 	if (exec) {
 		if (cpu_has_vtag_icache) {
@@ -437,8 +441,11 @@ static inline void local_r4k_flush_cache
 
 			if (cpu_context(cpu, mm) != 0)
 				drop_mmu_context(mm, cpu);
-		} else
-			r4k_blast_icache_page_indexed(addr);
+		} else {
+			iaddr = INDEX_BASE +
+				(addr & (current_cpu_data.icache.waysize - 1));
+			r4k_blast_icache_page_indexed(iaddr);
+		}
 	}
 }
 
@@ -1032,7 +1039,8 @@ static void __init probe_pcache(void)
 	case CPU_SB1:
 		break;
 	case CPU_24K:
-		if (!(read_c0_config7() & (1 << 16)))
+	case CPU_34K:
+		if (!(read_c0_config7() & _24K_CONF7_AR))
 	default:
 			if (c->dcache.waysize > PAGE_SIZE)
 				c->dcache.flags |= MIPS_CACHE_ALIASES;
diff -up --recursive --new-file linux-mips-2.6.15-rc7-20060109.macro/include/asm-mips/mipsregs.h linux-mips-2.6.15-rc7-20060109/include/asm-mips/mipsregs.h
--- linux-mips-2.6.15-rc7-20060109.macro/include/asm-mips/mipsregs.h	Thu Dec  8 05:58:58 2005
+++ linux-mips-2.6.15-rc7-20060109/include/asm-mips/mipsregs.h	Fri Jan 27 14:56:22 2006
@@ -533,6 +533,9 @@
 #define MIPS_CONF3_LPA		(_ULCAST_(1) <<  7)
 #define MIPS_CONF3_DSP		(_ULCAST_(1) << 10)
 
+/* Bits specific to the MIPS 24K, etc. CPUs.  */
+#define _24K_CONF7_AR		(_ULCAST_(1) << 16)
+
 /*
  * Bits in the MIPS32/64 coprocessor 1 (FPU) revision register.
  */


From tbm@cyrius.com Fri Feb  3 14:57:48 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 03 Feb 2006 14:58:08 +0000 (GMT)
Received: from sorrow.cyrius.com ([65.19.161.204]:31497 "EHLO
	sorrow.cyrius.com") by ftp.linux-mips.org with ESMTP
	id S8133401AbWBCO5s (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Fri, 3 Feb 2006 14:57:48 +0000
Received: by sorrow.cyrius.com (Postfix, from userid 10)
	id 4D98A64D3D; Fri,  3 Feb 2006 15:02:54 +0000 (UTC)
Received: by deprecation.cyrius.com (Postfix, from userid 1000)
	id 4FC088F69; Fri,  3 Feb 2006 15:02:32 +0000 (GMT)
Date:	Fri, 3 Feb 2006 15:02:32 +0000
From:	Martin Michlmayr <tbm@cyrius.com>
To:	"Maciej W. Rozycki" <macro@linux-mips.org>
Cc:	Peter 'p2' De Schrijver <p2@mind.be>, linux-mips@linux-mips.org
Subject: Re: DECstation R3000 boot error
Message-ID: <20060203150232.GA25701@deprecation.cyrius.com>
References: <20060123225040.GA23576@deprecation.cyrius.com> <Pine.LNX.4.64N.0601241059140.11021@blysk.ds.pg.gda.pl> <20060124122700.GA8527@deprecation.cyrius.com> <Pine.LNX.4.64N.0601241227290.11021@blysk.ds.pg.gda.pl> <20060124232117.GA4165@codecarver> <Pine.LNX.4.64N.0601251103020.7675@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.0601251103020.7675@blysk.ds.pg.gda.pl>
User-Agent: Mutt/1.5.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: 10329
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

* Maciej W. Rozycki <macro@linux-mips.org> [2006-01-25 11:10]:
> and it obviously cannot work on a MIPS I processor.  That's probably from 
> broken assembly code somewhere -- I should have my sources updated within 
> a few days and I'll see if I can reproduce the problem.

Did you have a chance to look at this?
-- 
Martin Michlmayr
http://www.cyrius.com/

From redhatter@gentoo.org Fri Feb  3 15:02:22 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 03 Feb 2006 15:02:40 +0000 (GMT)
Received: from 202-47-55-78.adsl.gil.com.au ([202.47.55.78]:20947 "EHLO
	longlandclan.hopto.org") by ftp.linux-mips.org with ESMTP
	id S8133401AbWBCPCV (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Fri, 3 Feb 2006 15:02:21 +0000
Received: (qmail 13377 invoked from network); 4 Feb 2006 01:07:30 +1000
Received: from beast.redhatters.home (HELO ?10.0.0.251?) (10.0.0.251)
  by 192.168.5.1 with SMTP; 4 Feb 2006 01:07:30 +1000
Message-ID: <43E371CE.2080302@gentoo.org>
Date:	Sat, 04 Feb 2006 01:07:58 +1000
From:	Stuart Longland <redhatter@gentoo.org>
Organization: Gentoo Foundation
User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051029)
X-Accept-Language: en-us, en
MIME-Version: 1.0
To:	linux-mips@linux-mips.org
Subject: IP22 (Indy) Breakage
X-Enigmail-Version: 0.93.0.0
OpenPGP: id=63264AB9;
	url=http://dev.gentoo.org/~redhatter/gpgkey.asc
Content-Type: multipart/signed; micalg=pgp-sha1;
 protocol="application/pgp-signature";
 boundary="------------enig6EC133A4A8077905B0DB81B3"
Return-Path: <redhatter@gentoo.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: 10330
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: redhatter@gentoo.org
Precedence: bulk
X-list: linux-mips

This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enig6EC133A4A8077905B0DB81B3
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

Hi all,
	I've just done a checkout of git HEAD (as of 23rd January), and struck
this little gem whilst trying to boot a kernel on my Indy.

	http://dev.gentoo.org/~redhatter/misc/ip22-r4k6-2615.png

	I figured WD33C93 SCSI was the culprit, so I modularised that (with the
intention of modprobing it later), and set up a kernel with IP Level
AutoConfiguration (via DHCP) and Root-over-NFS support, to try and
isolate the SCSI problem.  That yeilded the following crash.

	http://dev.gentoo.org/~redhatter/misc/ip22-r4k6-2615-nfs.png

	I've heard this affects both R4600 and R5000 Indys.  It would seem
there's some breakage of the sgiseeq and wd33c93 drivers due to changes
in the surrounding API, but this is an uneducated guess. :-)  Would
someone have some pointers as to where I should look for problems?

Regards,
-- 
Stuart Longland (aka Redhatter)              .'''.
Gentoo Linux/MIPS Cobalt and Docs Developer  '.'` :
. . . . . . . . . . . . . . . . . . . . . .   .'.'
http://dev.gentoo.org/~redhatter             :.'

--------------enig6EC133A4A8077905B0DB81B3
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFD43HRuarJ1mMmSrkRAismAJ9tsRM/MraNsXOiOgW+8va0GhYiVQCffF1s
UgaogQ0yQz0OXWB0O2SHr+Q=
=uysf
-----END PGP SIGNATURE-----

--------------enig6EC133A4A8077905B0DB81B3--

From redhatter@gentoo.org Fri Feb  3 15:06:43 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 03 Feb 2006 15:07:00 +0000 (GMT)
Received: from 202-47-55-78.adsl.gil.com.au ([202.47.55.78]:6869 "EHLO
	longlandclan.hopto.org") by ftp.linux-mips.org with ESMTP
	id S8133401AbWBCPGn (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Fri, 3 Feb 2006 15:06:43 +0000
Received: (qmail 13558 invoked from network); 4 Feb 2006 01:11:53 +1000
Received: from beast.redhatters.home (HELO ?10.0.0.251?) (10.0.0.251)
  by 192.168.5.1 with SMTP; 4 Feb 2006 01:11:53 +1000
Message-ID: <43E372D7.8010408@gentoo.org>
Date:	Sat, 04 Feb 2006 01:12:23 +1000
From:	Stuart Longland <redhatter@gentoo.org>
Organization: Gentoo Foundation
User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051029)
X-Accept-Language: en-us, en
MIME-Version: 1.0
To:	linux-mips@linux-mips.org
Subject: Re: IP22 (Indy) Breakage
References: <43E371CE.2080302@gentoo.org>
In-Reply-To: <43E371CE.2080302@gentoo.org>
X-Enigmail-Version: 0.93.0.0
OpenPGP: id=63264AB9;
	url=http://dev.gentoo.org/~redhatter/gpgkey.asc
Content-Type: multipart/signed; micalg=pgp-sha1;
 protocol="application/pgp-signature";
 boundary="------------enigE2BE8824BE17A3DB85640F29"
Return-Path: <redhatter@gentoo.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: 10331
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: redhatter@gentoo.org
Precedence: bulk
X-list: linux-mips

This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enigE2BE8824BE17A3DB85640F29
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

Stuart Longland wrote:
> Hi all,
> 	I've just done a checkout of git HEAD (as of 23rd January), and struck
> this little gem whilst trying to boot a kernel on my Indy.
> [...]

Gah, forgot my .config.  (Yeah, my brain switches off after 1AM, so I
end up making all sorts of stupid mistakes :-D)

<http://dev.gentoo.org/~redhatter/misc/indy-r4k6-2.6.15-modscsi-nfs.config.gz>
This is the version with modularised SCSI.
-- 
Stuart Longland (aka Redhatter)              .'''.
Gentoo Linux/MIPS Cobalt and Docs Developer  '.'` :
. . . . . . . . . . . . . . . . . . . . . .   .'.'
http://dev.gentoo.org/~redhatter             :.'

--------------enigE2BE8824BE17A3DB85640F29
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFD43LXuarJ1mMmSrkRAnjpAJ0e02IP5vaQg/OUvIHpSazsz+p/UACfShGi
m7P9g+bkjFidkj4lEXPBsnY=
=cyin
-----END PGP SIGNATURE-----

--------------enigE2BE8824BE17A3DB85640F29--

From anemo@mba.ocn.ne.jp Fri Feb  3 16:49:04 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 03 Feb 2006 16:49:23 +0000 (GMT)
Received: from mba.ocn.ne.jp ([210.190.142.172]:14845 "HELO smtp.mba.ocn.ne.jp")
	by ftp.linux-mips.org with SMTP id S8133406AbWBCQtE (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Fri, 3 Feb 2006 16:49:04 +0000
Received: from localhost (p2023-ipad205funabasi.chiba.ocn.ne.jp [222.146.97.23])
	by smtp.mba.ocn.ne.jp (Postfix) with ESMTP
	id 169F0A421; Sat,  4 Feb 2006 01:54:16 +0900 (JST)
Date:	Sat, 04 Feb 2006 01:53:56 +0900 (JST)
Message-Id: <20060204.015356.74753400.anemo@mba.ocn.ne.jp>
To:	ralf@linux-mips.org
Cc:	linux-mips@linux-mips.org
Subject: Re: [PATCH] local_r4k_flush_cache_page fix
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
In-Reply-To: <20060203144739.GB3375@linux-mips.org>
References: <20060201.000356.25911337.anemo@mba.ocn.ne.jp>
	<20060203.141424.72708300.nemoto@toshiba-tops.co.jp>
	<20060203144739.GB3375@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: 10332
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 Fri, 3 Feb 2006 14:47:39 +0000, Ralf Baechle <ralf@linux-mips.org> said:

ralf> Maciej ran over what seems to be the same issue; I attach his
ralf> patch below.  Could you check if it resolves your issues?

It looks OK.  But now it can be fixed in one place --
_BUILD_BLAST_CACHE().  I also try to fix for physically indexed caches
(not tested while I do not have such platform...).

Here is a revised one.  Not including Maceij's 34K fix :-)

Description:

If dcache_size != icache_size or dcache_size != scache_size, or
set-associative cache, icache/scache does not flushed properly.  Make
blast_?cache_page_indexed() masks its index value correctly.  Also,
use physical address for physically indexed pcache/scache.

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

diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
index e51c38c..69dfd53 100644
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -369,6 +369,7 @@ static void r4k_flush_cache_mm(struct mm
 struct flush_cache_page_args {
 	struct vm_area_struct *vma;
 	unsigned long addr;
+	unsigned long pfn;
 };
 
 static inline void local_r4k_flush_cache_page(void *args)
@@ -376,6 +377,7 @@ static inline void local_r4k_flush_cache
 	struct flush_cache_page_args *fcp_args = args;
 	struct vm_area_struct *vma = fcp_args->vma;
 	unsigned long addr = fcp_args->addr;
+	unsigned long paddr = fcp_args->pfn << PAGE_SHIFT;
 	int exec = vma->vm_flags & VM_EXEC;
 	struct mm_struct *mm = vma->vm_mm;
 	pgd_t *pgdp;
@@ -425,11 +427,12 @@ static inline void local_r4k_flush_cache
 	 * Do indexed flush, too much work to get the (possible) TLB refills
 	 * to work correctly.
 	 */
-	addr = INDEX_BASE + (addr & (dcache_size - 1));
 	if (cpu_has_dc_aliases || (exec && !cpu_has_ic_fills_f_dc)) {
-		r4k_blast_dcache_page_indexed(addr);
-		if (exec && !cpu_icache_snoops_remote_store)
-			r4k_blast_scache_page_indexed(addr);
+		r4k_blast_dcache_page_indexed(cpu_has_pindexed_dcache ?
+					      paddr : addr);
+		if (exec && !cpu_icache_snoops_remote_store) {
+			r4k_blast_scache_page_indexed(paddr);
+		}
 	}
 	if (exec) {
 		if (cpu_has_vtag_icache) {
@@ -449,6 +452,7 @@ static void r4k_flush_cache_page(struct 
 
 	args.vma = vma;
 	args.addr = addr;
+	args.pfn = pfn;
 
 	on_each_cpu(local_r4k_flush_cache_page, &args, 1, 1);
 }
@@ -1026,6 +1030,7 @@ static void __init probe_pcache(void)
 	switch (c->cputype) {
 	case CPU_20KC:
 	case CPU_25KF:
+		c->dcache.flags |= MIPS_CACHE_PINDEX;
 	case CPU_R10000:
 	case CPU_R12000:
 	case CPU_SB1:
diff --git a/arch/mips/mm/c-tx39.c b/arch/mips/mm/c-tx39.c
index 0a97a94..f74a52d 100644
--- a/arch/mips/mm/c-tx39.c
+++ b/arch/mips/mm/c-tx39.c
@@ -227,7 +227,6 @@ static void tx39_flush_cache_page(struct
 	 * Do indexed flush, too much work to get the (possible) TLB refills
 	 * to work correctly.
 	 */
-	page = (KSEG0 + (page & (dcache_size - 1)));
 	if (cpu_has_dc_aliases || exec)
 		tx39_blast_dcache_page_indexed(page);
 	if (exec)
diff --git a/include/asm-mips/cpu-features.h b/include/asm-mips/cpu-features.h
index 78c9cc2..3f2b6d9 100644
--- a/include/asm-mips/cpu-features.h
+++ b/include/asm-mips/cpu-features.h
@@ -96,6 +96,9 @@
 #ifndef cpu_has_ic_fills_f_dc
 #define cpu_has_ic_fills_f_dc	(cpu_data[0].icache.flags & MIPS_CACHE_IC_F_DC)
 #endif
+#ifndef cpu_has_pindexed_dcache
+#define cpu_has_pindexed_dcache	(cpu_data[0].dcache.flags & MIPS_CACHE_PINDEX)
+#endif
 
 /*
  * I-Cache snoops remote store.  This only matters on SMP.  Some multiprocessors
diff --git a/include/asm-mips/cpu-info.h b/include/asm-mips/cpu-info.h
index d5cf519..140be1c 100644
--- a/include/asm-mips/cpu-info.h
+++ b/include/asm-mips/cpu-info.h
@@ -39,6 +39,7 @@ struct cache_desc {
 #define MIPS_CACHE_ALIASES	0x00000004	/* Cache could have aliases */
 #define MIPS_CACHE_IC_F_DC	0x00000008	/* Ic can refill from D-cache */
 #define MIPS_IC_SNOOPS_REMOTE	0x00000010	/* Ic snoops remote stores */
+#define MIPS_CACHE_PINDEX	0x00000020	/* Physically indexed cache */
 
 struct cpuinfo_mips {
 	unsigned long		udelay_val;
diff --git a/include/asm-mips/r4kcache.h b/include/asm-mips/r4kcache.h
index cc53196..a108940 100644
--- a/include/asm-mips/r4kcache.h
+++ b/include/asm-mips/r4kcache.h
@@ -273,7 +273,8 @@ static inline void blast_##pfx##cache##l
 									\
 static inline void blast_##pfx##cache##lsize##_page_indexed(unsigned long page) \
 {									\
-	unsigned long start = page;					\
+	unsigned long indexmask = current_cpu_data.desc.waysize - 1;	\
+	unsigned long start = INDEX_BASE + (page & indexmask);		\
 	unsigned long end = start + PAGE_SIZE;				\
 	unsigned long ws_inc = 1UL << current_cpu_data.desc.waybit;	\
 	unsigned long ws_end = current_cpu_data.desc.ways <<		\

From sshtylyov@ru.mvista.com Sat Feb  4 00:17:22 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Sat, 04 Feb 2006 00:17:39 +0000 (GMT)
Received: from rtsoft2.corbina.net ([85.21.88.2]:54463 "HELO
	mail.dev.rtsoft.ru") by ftp.linux-mips.org with SMTP
	id S8133516AbWBDARW (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Sat, 4 Feb 2006 00:17:22 +0000
Received: (qmail 10590 invoked from network); 4 Feb 2006 00:22:38 -0000
Received: from wasted.dev.rtsoft.ru (HELO ?192.168.1.248?) (192.168.1.248)
  by mail.dev.rtsoft.ru with SMTP; 4 Feb 2006 00:22:38 -0000
Message-ID: <43E3F492.8010909@ru.mvista.com>
Date:	Sat, 04 Feb 2006 03:25:54 +0300
From:	Sergei Shtylylov <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:	David Sanchez <david.sanchez@lexbox.fr>
CC:	linux-mips@linux-mips.org
Subject: Re: [PATCH] Au1xx0: really set KSEG0 to uncached on reboot
References: <17AB476A04B7C842887E0EB1F268111E02740C@xpserver.intra.lexbox.org>
In-Reply-To: <17AB476A04B7C842887E0EB1F268111E02740C@xpserver.intra.lexbox.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: 10333
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.

David Sanchez wrote:

> The patch doesn't work for Au1550. Since I apply it my DbAu1550 frees on
> restart.

    Just tried 'reboot' command on a fresh kernel with this patch and NFP 
userland -- it worked well.

> David

WBR, Sergei

From sshtylyov@ru.mvista.com Sat Feb  4 12:02:39 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Sat, 04 Feb 2006 12:02:50 +0000 (GMT)
Received: from rtsoft2.corbina.net ([85.21.88.2]:64470 "HELO
	mail.dev.rtsoft.ru") by ftp.linux-mips.org with SMTP
	id S8133511AbWBDMCj (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Sat, 4 Feb 2006 12:02:39 +0000
Received: (qmail 14834 invoked from network); 4 Feb 2006 12:08:00 -0000
Received: from wasted.dev.rtsoft.ru (HELO ?192.168.1.248?) (192.168.1.248)
  by mail.dev.rtsoft.ru with SMTP; 4 Feb 2006 12:08:00 -0000
Message-ID: <43E499E2.6070805@ru.mvista.com>
Date:	Sat, 04 Feb 2006 15:11:14 +0300
From:	Sergei Shtylylov <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:	ralf@linux-mips.org, Manish Lachwani <mlachwani@mvista.com>,
	Konstantin Baidarov <kbaidarov@ru.mvista.com>
Subject: [PATCH] TX49x7: fix reporting of the CPU name and PCI clock
Content-Type: multipart/mixed;
 boundary="------------090708020002000202010300"
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: 10335
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
Content-Length: 9107
Lines: 258

This is a multi-part message in MIME format.
--------------090708020002000202010300
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Hello.

     I've noticed that PCI clock was incorrectly reported as 66 MHz while being
mere 33 MHz on RBTX4937 board -- this was due to the different encoding of the
PCI divisor field in CCFG register between TX4927 and TX4937 chips...
     Also, RBTX49x7 was printed out as a CPU name (e.g., "CPU is RBTX4937");
and some debug printk() were duplicating each other...

WBR, Sergei

Signed-off-by: Konstantin Baydarov <kbaidarov@ru.mvista.com>
Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>



--------------090708020002000202010300
Content-Type: text/plain;
 name="TX49x7-CPU-name-PCI-clock-report-fix.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="TX49x7-CPU-name-PCI-clock-report-fix.patch"

diff --git a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_prom.c b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_prom.c
index e4d095d..e19e2be 100644
--- a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_prom.c
+++ b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_prom.c
@@ -60,7 +60,6 @@ void __init prom_init_cmdline(void)
 
 void __init prom_init(void)
 {
-	const char* toshiba_name_list[] = GROUP_TOSHIBA_NAMES;
 	extern int tx4927_get_mem_size(void);
 	extern char* toshiba_name;
 	int msize;
@@ -69,12 +68,13 @@ void __init prom_init(void)
 
 	mips_machgroup = MACH_GROUP_TOSHIBA;
 
-	if ((read_c0_prid() & 0xff) == PRID_REV_TX4927)
+	if ((read_c0_prid() & 0xff) == PRID_REV_TX4927) {
 		mips_machtype = MACH_TOSHIBA_RBTX4927;
-	else
+ 		toshiba_name  = "TX4927";
+	} else {
 		mips_machtype = MACH_TOSHIBA_RBTX4937;
-
-        toshiba_name = toshiba_name_list[mips_machtype];
+ 		toshiba_name  = "TX4937";
+	}
 
 	msize = tx4927_get_mem_size();
 	add_memory_region(0, msize << 20, BOOT_MEM_RAM);
diff --git a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c
index 0981329..bf9eecd 100644
--- a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c
+++ b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c
@@ -539,19 +539,10 @@ void tx4927_pci_setup(void)
 	TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2,
 				       "0x%08lx=mips_io_port_base",
 				       mips_io_port_base);
-
-	TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2,
-				       "setup pci_io_resource  to 0x%08lx 0x%08lx\n",
-				       pci_io_resource.start,
-				       pci_io_resource.end);
-	TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2,
-				       "setup pci_mem_resource to 0x%08lx 0x%08lx\n",
-				       pci_mem_resource.start,
-				       pci_mem_resource.end);
-
 	if (!called) {
 		printk
-		    ("TX4927 PCIC -- DID:%04x VID:%04x RID:%02x Arbiter:%s\n",
+		    ("%s PCIC -- DID:%04x VID:%04x RID:%02x Arbiter:%s\n",
+		     toshiba_name,
 		     (unsigned short) (tx4927_pcicptr->pciid >> 16),
 		     (unsigned short) (tx4927_pcicptr->pciid & 0xffff),
 		     (unsigned short) (tx4927_pcicptr->pciccrev & 0xff),
@@ -564,21 +555,52 @@ void tx4927_pci_setup(void)
 	       (tx4927_ccfgptr->ccfg & TX4927_CCFG_PCI66) ? " PCI66" : "");
 	if (tx4927_ccfgptr->pcfg & TX4927_PCFG_PCICLKEN_ALL) {
 		int pciclk = 0;
-		switch ((unsigned long) tx4927_ccfgptr->
-			ccfg & TX4927_CCFG_PCIDIVMODE_MASK) {
-		case TX4927_CCFG_PCIDIVMODE_2_5:
-			pciclk = tx4927_cpu_clock * 2 / 5;
-			break;
-		case TX4927_CCFG_PCIDIVMODE_3:
-			pciclk = tx4927_cpu_clock / 3;
-			break;
-		case TX4927_CCFG_PCIDIVMODE_5:
-			pciclk = tx4927_cpu_clock / 5;
-			break;
-		case TX4927_CCFG_PCIDIVMODE_6:
-			pciclk = tx4927_cpu_clock / 6;
-			break;
-		}
+		if (mips_machtype == MACH_TOSHIBA_RBTX4937)
+			switch ((unsigned long) tx4927_ccfgptr->
+				ccfg & TX4937_CCFG_PCIDIVMODE_MASK) {
+			case TX4937_CCFG_PCIDIVMODE_4:
+				pciclk = tx4927_cpu_clock / 4;
+				break;
+			case TX4937_CCFG_PCIDIVMODE_4_5:
+				pciclk = tx4927_cpu_clock * 2 / 9;
+				break;
+			case TX4937_CCFG_PCIDIVMODE_5:
+				pciclk = tx4927_cpu_clock / 5;
+				break;
+			case TX4937_CCFG_PCIDIVMODE_5_5:
+				pciclk = tx4927_cpu_clock * 2 / 11;
+				break;
+			case TX4937_CCFG_PCIDIVMODE_8:
+				pciclk = tx4927_cpu_clock / 8;
+				break;
+			case TX4937_CCFG_PCIDIVMODE_9:
+				pciclk = tx4927_cpu_clock / 9;
+				break;
+			case TX4937_CCFG_PCIDIVMODE_10:
+				pciclk = tx4927_cpu_clock / 10;
+				break;
+			case TX4937_CCFG_PCIDIVMODE_11:
+				pciclk = tx4927_cpu_clock / 11;
+				break;
+			}
+
+		else
+			switch ((unsigned long) tx4927_ccfgptr->
+				ccfg & TX4927_CCFG_PCIDIVMODE_MASK) {
+			case TX4927_CCFG_PCIDIVMODE_2_5:
+				pciclk = tx4927_cpu_clock * 2 / 5;
+				break;
+			case TX4927_CCFG_PCIDIVMODE_3:
+				pciclk = tx4927_cpu_clock / 3;
+				break;
+			case TX4927_CCFG_PCIDIVMODE_5:
+				pciclk = tx4927_cpu_clock / 5;
+				break;
+			case TX4927_CCFG_PCIDIVMODE_6:
+				pciclk = tx4927_cpu_clock / 6;
+				break;
+			}
+
 		printk("Internal(%dMHz)", pciclk / 1000000);
 	} else {
 		int pciclk = 0;
@@ -823,17 +845,33 @@ void __init toshiba_rbtx4927_setup(void)
 	/* PCIC */
 	/*
 	   * ASSUMPTION: PCIDIVMODE is configured for PCI 33MHz or 66MHz.
-	   * PCIDIVMODE[12:11]'s initial value are given by S9[4:3] (ON:0, OFF:1).
+	   *
+	   * For TX4927:
+	   * PCIDIVMODE[12:11]'s initial value is given by S9[4:3] (ON:0, OFF:1).
 	   * CPU 166MHz: PCI 66MHz : PCIDIVMODE: 00 (1/2.5)
 	   * CPU 200MHz: PCI 66MHz : PCIDIVMODE: 01 (1/3)
 	   * CPU 166MHz: PCI 33MHz : PCIDIVMODE: 10 (1/5)
 	   * CPU 200MHz: PCI 33MHz : PCIDIVMODE: 11 (1/6)
 	   * i.e. S9[3]: ON (83MHz), OFF (100MHz)
+	   *
+	   * For TX4937:
+	   * PCIDIVMODE[12:11]'s initial value is given by S1[5:4] (ON:0, OFF:1)
+	   * PCIDIVMODE[10] is 0.
+	   * CPU 266MHz: PCI 33MHz : PCIDIVMODE: 000 (1/8)
+	   * CPU 266MHz: PCI 66MHz : PCIDIVMODE: 001 (1/4)
+	   * CPU 300MHz: PCI 33MHz : PCIDIVMODE: 010 (1/9)
+	   * CPU 300MHz: PCI 66MHz : PCIDIVMODE: 011 (1/4.5)
+	   * CPU 333MHz: PCI 33MHz : PCIDIVMODE: 100 (1/10)
+	   * CPU 333MHz: PCI 66MHz : PCIDIVMODE: 101 (1/5)
+	   *
 	 */
 	TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI1,
-				       "ccfg is %lx, DIV is %x\n",
-				       (unsigned long) tx4927_ccfgptr->
-				       ccfg, TX4927_CCFG_PCIDIVMODE_MASK);
+				       "ccfg is %lx, PCIDIVMODE is %x\n",
+				       (unsigned long) tx4927_ccfgptr->ccfg,
+				       (unsigned long) tx4927_ccfgptr->ccfg &
+				       (mips_machtype == MACH_TOSHIBA_RBTX4937 ?
+					TX4937_CCFG_PCIDIVMODE_MASK :
+					TX4927_CCFG_PCIDIVMODE_MASK));
 
 	TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI1,
 				       "PCI66 mode is %lx, PCI mode is %lx, pci arb is %lx\n",
@@ -844,20 +882,30 @@ void __init toshiba_rbtx4927_setup(void)
 				       (unsigned long) tx4927_ccfgptr->
 				       ccfg & TX4927_CCFG_PCIXARB);
 
-	TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI1,
-				       "PCIDIVMODE is %lx\n",
-				       (unsigned long) tx4927_ccfgptr->
-				       ccfg & TX4927_CCFG_PCIDIVMODE_MASK);
-
-	switch ((unsigned long) tx4927_ccfgptr->
-		ccfg & TX4927_CCFG_PCIDIVMODE_MASK) {
-	case TX4927_CCFG_PCIDIVMODE_2_5:
-	case TX4927_CCFG_PCIDIVMODE_5:
-		tx4927_cpu_clock = 166000000;	/* 166MHz */
-		break;
-	default:
-		tx4927_cpu_clock = 200000000;	/* 200MHz */
-	}
+	if (mips_machtype == MACH_TOSHIBA_RBTX4937)
+		switch ((unsigned long)tx4927_ccfgptr->
+			ccfg & TX4937_CCFG_PCIDIVMODE_MASK) {
+		case TX4937_CCFG_PCIDIVMODE_8:
+		case TX4937_CCFG_PCIDIVMODE_4:
+			tx4927_cpu_clock = 266666666;	/* 266MHz */
+			break;
+		case TX4937_CCFG_PCIDIVMODE_9:
+		case TX4937_CCFG_PCIDIVMODE_4_5:
+			tx4927_cpu_clock = 300000000;	/* 300MHz */
+			break;
+		default:
+			tx4927_cpu_clock = 333333333;	/* 333MHz */
+		}
+	else
+		switch ((unsigned long)tx4927_ccfgptr->
+			ccfg & TX4927_CCFG_PCIDIVMODE_MASK) {
+		case TX4927_CCFG_PCIDIVMODE_2_5:
+		case TX4927_CCFG_PCIDIVMODE_5:
+			tx4927_cpu_clock = 166666666;	/* 166MHz */
+			break;
+		default:
+			tx4927_cpu_clock = 200000000;	/* 200MHz */
+		}
 
 	/* CCFG */
 	/* enable Timeout BusError */
diff --git a/include/asm-mips/tx4927/tx4927_pci.h b/include/asm-mips/tx4927/tx4927_pci.h
index 165f6b8..66c0646 100644
--- a/include/asm-mips/tx4927/tx4927_pci.h
+++ b/include/asm-mips/tx4927/tx4927_pci.h
@@ -253,6 +253,16 @@ struct tx4927_pcic_reg {
 #define TX4927_CCFG_PCIDIVMODE_5        0x00001000
 #define TX4927_CCFG_PCIDIVMODE_6        0x00001800
 
+#define TX4937_CCFG_PCIDIVMODE_MASK	0x00001c00
+#define TX4937_CCFG_PCIDIVMODE_8	0x00000000
+#define TX4937_CCFG_PCIDIVMODE_4	0x00000400
+#define TX4937_CCFG_PCIDIVMODE_9 	0x00000800
+#define TX4937_CCFG_PCIDIVMODE_4_5	0x00000c00
+#define TX4937_CCFG_PCIDIVMODE_10	0x00001000
+#define TX4937_CCFG_PCIDIVMODE_5	0x00001400
+#define TX4937_CCFG_PCIDIVMODE_11	0x00001800
+#define TX4937_CCFG_PCIDIVMODE_5_5	0x00001c00
+
 /* PCFG : Pin Configuration */
 #define TX4927_PCFG_PCICLKEN_ALL        0x003f0000
 #define TX4927_PCFG_PCICLKEN(ch)        (0x00010000<<(ch))


--------------090708020002000202010300--

From nickeaguk@yahoo.no Sat Feb  4 12:18:00 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Sat, 04 Feb 2006 12:18:08 +0000 (GMT)
Received: from [221.200.50.51] ([221.200.50.51]:55557 "HELO 194.74.144.162")
	by ftp.linux-mips.org with SMTP id S8133511AbWBDMSA (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Sat, 4 Feb 2006 12:18:00 +0000
Received: from mail.bannered0.yahoo.ca (barberacerb.yahoo.ca [yahoo.ca])
	by andrewsite-buckleless.brokenheartedness.tv (5.23.5/5.23.5) with ESMTP id c85KcRrNa50201
	for <nickeaguk@yahoo.no>; Sat, 04 Feb 2006 05:15:03 -0700
Date:	Sat, 04 Feb 2006 17:19:03 +0500
From:	"Janet Kinsella " <nickeaguk@yahoo.no>
To:	linux-cvs-patches@linux-mips.org,
	linux-cvs-patches-bounce@linux-mips.org, linux-mips@linux-mips.org
Subject: Fw:
Message-ID: <ba4kZl774.HF87.tr5.095R2C4M6@localhost>
MIME-Version: 1.0
Content-type: text/plain; charset=US-ASCII
Priority: normal
Return-Path: <nickeaguk@yahoo.no>
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: 10336
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: nickeaguk@yahoo.no
Precedence: bulk
X-list: linux-mips
Content-Length: 658
Lines: 29

Good day,

We 0 ffer low rates.

Get signs, flat-fee MLS listings, contracts and free research.=20


U S  $ 300 ,000       iL0 iANS        are avai lable for only $277 / month=
! WE'RE iPRACT ICALLY iGIVIiNG iAWAY MOiNEY!

---------------------------------

COPY the Addreiss below and paste in your WEiB BROiWSER:

adactyl.realquikx.com

----------------------------------

V a l id for 24 Hrs.

His vest has been left in the hall..
You love me -- you are sure --.
Of course, there was no sight here, just like there was no smell,.
And his pants have been carelessly hung on the door..
I had only hope then , but now through you,=20.


Bye,
Bobbie Battelle

From rmk+linux-mips=linux-mips.org@arm.linux.org.uk Sat Feb  4 23:56:16 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Sat, 04 Feb 2006 23:56:25 +0000 (GMT)
Received: from caramon.arm.linux.org.uk ([212.18.232.186]:2571 "EHLO
	caramon.arm.linux.org.uk") by ftp.linux-mips.org with ESMTP
	id S8133870AbWBDX4Q (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Sat, 4 Feb 2006 23:56:16 +0000
Received: from flint.arm.linux.org.uk ([2002:d412:e8ba:1:201:2ff:fe14:8fad])
	by caramon.arm.linux.org.uk with esmtpsa (TLSv1:DES-CBC3-SHA:168)
	(Exim 4.52)
	id 1F5XLS-0002i7-BR; Sun, 05 Feb 2006 00:01:34 +0000
Received: from rmk by flint.arm.linux.org.uk with local (Exim 4.52)
	id 1F5XLU-0004Il-Nq; Sun, 05 Feb 2006 00:01:36 +0000
Date:	Sun, 5 Feb 2006 00:01:36 +0000
From:	Russell King <rmk+lkml@arm.linux.org.uk>
To:	Hirokazu Takata <takata@linux-m32r.org>
Cc:	linux-kernel@vger.kernel.org, linux-mips@linux-mips.org,
	linuxppc-dev@ozlabs.org, pfg@sgi.com
Subject: Re: [CFT] Don't use ASYNC_* nor SERIAL_IO_* with serial_core
Message-ID: <20060205000136.GF24887@flint.arm.linux.org.uk>
Mail-Followup-To: Hirokazu Takata <takata@linux-m32r.org>,
	linux-kernel@vger.kernel.org, linux-mips@linux-mips.org,
	linuxppc-dev@ozlabs.org, pfg@sgi.com
References: <20060121211407.GA19984@dyn-67.arm.linux.org.uk> <20060202102721.GE5034@flint.arm.linux.org.uk> <20060202.231033.1059963967.takata.hirokazu@renesas.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20060202.231033.1059963967.takata.hirokazu@renesas.com>
User-Agent: Mutt/1.4.1i
Return-Path: <rmk+linux-mips=linux-mips.org@arm.linux.org.uk>
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: 10337
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: rmk+lkml@arm.linux.org.uk
Precedence: bulk
X-list: linux-mips
Content-Length: 244
Lines: 10

On Thu, Feb 02, 2006 at 11:10:33PM +0900, Hirokazu Takata wrote:
> On m32r,
>   compile and boot test: OK

Is that an Acked-by ?

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core

From takata@linux-m32r.org Mon Feb  6 01:29:24 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 06 Feb 2006 01:29:36 +0000 (GMT)
Received: from mail.renesas.com ([202.234.163.13]:47506 "EHLO
	mail04.idc.renesas.com") by ftp.linux-mips.org with ESMTP
	id S8133565AbWBFB3Y (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Mon, 6 Feb 2006 01:29:24 +0000
Received: from mail04.idc.renesas.com ([127.0.0.1])
 by mail04.idc.renesas.com. (SMSSMTP 4.1.9.35) with SMTP id M2006020610344704680
 for <linux-mips@linux-mips.org>; Mon, 06 Feb 2006 10:34:47 +0900
Received: (from root@localhost)
	by guardian04.idc.renesas.com with  id k161YjTT025197;
	Mon, 6 Feb 2006 10:34:45 +0900 (JST)
Received: from unknown [172.20.8.73] by guardian04.idc.renesas.com with SMTP id LAA25196 ; Mon, 6 Feb 2006 10:34:45 +0900
Received: from mrkaisv.hoku.renesas.com ([10.145.105.245])
	by ml01.idc.renesas.com (8.12.10/8.12.10) with ESMTP id k161YhdI011969;
	Mon, 6 Feb 2006 10:34:44 +0900 (JST)
Received: from localhost (pcepx10 [10.145.105.241])
	by mrkaisv.hoku.renesas.com (Postfix) with ESMTP
	id 7E45D798071; Mon,  6 Feb 2006 10:34:43 +0900 (JST)
Date:	Mon, 06 Feb 2006 10:34:43 +0900 (JST)
Message-Id: <20060206.103443.608416320.takata.hirokazu@renesas.com>
To:	rmk+lkml@arm.linux.org.uk
Cc:	takata@linux-m32r.org, linux-kernel@vger.kernel.org,
	linux-mips@linux-mips.org, linuxppc-dev@ozlabs.org, pfg@sgi.com
Subject: Re: [CFT] Don't use ASYNC_* nor SERIAL_IO_* with serial_core
From:	Hirokazu Takata <takata@linux-m32r.org>
In-Reply-To: <20060205000136.GF24887@flint.arm.linux.org.uk>
References: <20060202102721.GE5034@flint.arm.linux.org.uk>
	<20060202.231033.1059963967.takata.hirokazu@renesas.com>
	<20060205000136.GF24887@flint.arm.linux.org.uk>
X-Mailer: Mew version 3.3 on XEmacs 21.4.18 (Social Property)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Return-Path: <takata@linux-m32r.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: 10338
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: takata@linux-m32r.org
Precedence: bulk
X-list: linux-mips
Content-Length: 580
Lines: 24

From: Russell King <rmk+lkml@arm.linux.org.uk>
Subject: Re: [CFT] Don't use ASYNC_* nor SERIAL_IO_* with serial_core
Date: Sun, 05 Feb 2006 00:01:36 +0000
> On Thu, Feb 02, 2006 at 11:10:33PM +0900, Hirokazu Takata wrote:
> > On m32r,
> >   compile and boot test: OK
> 
> Is that an Acked-by ?
> 
> -- 
> Russell King
>  Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
>  maintainer of:  2.6 Serial core
> 

Yes.

Acked-by: Hirokazu Takata <takata@linux-m32r.org>

Thanks,
--
Hirokazu Takata <takata@linux-m32r.org>
Linux/M32R Project:  http://www.linux-m32r.org/


From david.sanchez@lexbox.fr Mon Feb  6 08:08:27 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 06 Feb 2006 08:08:36 +0000 (GMT)
Received: from smtp4.wanadoo.fr ([193.252.22.27]:18501 "EHLO smtp4.wanadoo.fr")
	by ftp.linux-mips.org with ESMTP id S8133462AbWBFII1 convert rfc822-to-8bit
	(ORCPT <rfc822;linux-mips@linux-mips.org>);
	Mon, 6 Feb 2006 08:08:27 +0000
Received: from me-wanadoo.net (localhost [127.0.0.1])
	by mwinf0401.wanadoo.fr (SMTP Server) with ESMTP id DBF171C00313
	for <linux-mips@linux-mips.org>; Mon,  6 Feb 2006 09:13:53 +0100 (CET)
Received: from lexbox.fr (AToulouse-254-1-22-161.w81-250.abo.wanadoo.fr [81.250.29.161])
	by mwinf0401.wanadoo.fr (SMTP Server) with ESMTP id C01B71C002EE;
	Mon,  6 Feb 2006 09:13:53 +0100 (CET)
X-ME-UUID: 20060206081353786.C01B71C002EE@mwinf0401.wanadoo.fr
Subject: RE: [PATCH] Au1xx0: really set KSEG0 to uncached on reboot
MIME-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 8BIT
Date:	Mon, 6 Feb 2006 09:10:37 +0100
Content-class: urn:content-classes:message
Message-ID: <17AB476A04B7C842887E0EB1F268111E027447@xpserver.intra.lexbox.org>
X-MimeOLE: Produced By Microsoft Exchange V6.5.6944.0
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
Thread-Topic: [PATCH] Au1xx0: really set KSEG0 to uncached on reboot
Thread-Index: AcYpIisf4ajWFKCtRBS4mw0e3t+cvwB0Tsog
From:	"David Sanchez" <david.sanchez@lexbox.fr>
To:	"Sergei Shtylylov" <sshtylyov@ru.mvista.com>
Cc:	<linux-mips@linux-mips.org>
Return-Path: <david.sanchez@lexbox.fr>
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: 10339
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.sanchez@lexbox.fr
Precedence: bulk
X-list: linux-mips
Content-Length: 867
Lines: 47

Hi,

This is exactly what I did...
But I notice that sometimes it works and sometimes the kernel frees when 
"** Resetting Integrated Peripherals"

Regards,

David SANCHEZ
 LexBox, The Digital Evidence

Parc d'Activités de Basso Cambo
42, Avenue du Général de Croutte
31100 TOULOUSE / FRANCE

david.sanchez@lexbox.fr
Tél :     +33 (0)5 62 47 15 81
Fax :    +33 (0)5 62 47 15 84



-----Message d'origine-----
De : Sergei Shtylylov [mailto:sshtylyov@ru.mvista.com] 
Envoyé : samedi 4 février 2006 01:30
Ŕ : David Sanchez
Cc : linux-mips@linux-mips.org
Objet : Re: [PATCH] Au1xx0: really set KSEG0 to uncached on reboot

Hello.

David Sanchez wrote:

> The patch doesn't work for Au1550. Since I apply it my DbAu1550 frees on
> restart.

    Just tried 'reboot' command on a fresh kernel with this patch and NFP 
userland -- it worked well.

> David

WBR, Sergei







From anemo@mba.ocn.ne.jp Mon Feb  6 09:31:31 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 06 Feb 2006 09:31:40 +0000 (GMT)
Received: from topsns2.toshiba-tops.co.jp ([202.230.225.126]:14883 "EHLO
	topsns2.toshiba-tops.co.jp") by ftp.linux-mips.org with ESMTP
	id S3458260AbWBFJbb (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Mon, 6 Feb 2006 09:31: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; Mon, 6 Feb 2006 18:37:04 +0900
Received: from topsms.toshiba-tops.co.jp (localhost.localdomain [127.0.0.1])
	by localhost.toshiba-tops.co.jp (Postfix) with ESMTP id BF95B2033E;
	Mon,  6 Feb 2006 18:36:56 +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 B37BD20041;
	Mon,  6 Feb 2006 18:36:56 +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 k169at4D037481;
	Mon, 6 Feb 2006 18:36:56 +0900 (JST)
	(envelope-from anemo@mba.ocn.ne.jp)
Date:	Mon, 06 Feb 2006 18:36:55 +0900 (JST)
Message-Id: <20060206.183655.129447619.nemoto@toshiba-tops.co.jp>
To:	ralf@linux-mips.org
Cc:	macro@linux-mips.org, linux-mips@linux-mips.org
Subject: Re: [PATCH] TX49 MFC0 bug workaround
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
In-Reply-To: <20060203144420.GA3375@linux-mips.org>
References: <20060202172434.GE17352@linux-mips.org>
	<20060203.111012.130238823.nemoto@toshiba-tops.co.jp>
	<20060203144420.GA3375@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: 10340
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
Content-Length: 660
Lines: 26

>>>>> On Fri, 3 Feb 2006 14:44:20 +0000, Ralf Baechle <ralf@linux-mips.org> said:
>> So here is a patch against current GIT.

ralf> Okay, applied.

Thanks.  And please apply this also...


Remove TX49XX_MFC0_WAR completely.

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

diff --git a/include/asm-mips/war.h b/include/asm-mips/war.h
index 229afaa..ad374bd 100644
--- a/include/asm-mips/war.h
+++ b/include/asm-mips/war.h
@@ -228,9 +228,6 @@
 #ifndef TX49XX_ICACHE_INDEX_INV_WAR
 #define TX49XX_ICACHE_INDEX_INV_WAR	0
 #endif
-#ifndef TX49XX_MFC0_WAR
-#define TX49XX_MFC0_WAR	0
-#endif
 #ifndef RM9000_CDEX_SMP_WAR
 #define RM9000_CDEX_SMP_WAR		0
 #endif

From dhowells@redhat.com Mon Feb  6 10:20:53 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 06 Feb 2006 10:21:01 +0000 (GMT)
Received: from mx1.redhat.com ([66.187.233.31]:54198 "EHLO mx1.redhat.com")
	by ftp.linux-mips.org with ESMTP id S3458455AbWBFKUx (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Mon, 6 Feb 2006 10:20:53 +0000
Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254])
	by mx1.redhat.com (8.12.11/8.12.11) with ESMTP id k16AQHTE016876;
	Mon, 6 Feb 2006 05:26:17 -0500
Received: from file.cambridge.redhat.com (file.cambridge.redhat.com [172.16.18.10])
	by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id k16AQC112662;
	Mon, 6 Feb 2006 05:26:13 -0500
Received: from warthog.cambridge.redhat.com (warthog.cambridge.redhat.com [172.16.18.73])
	by file.cambridge.redhat.com (8.11.6/8.11.6) with ESMTP id k16AQB118919;
	Mon, 6 Feb 2006 10:26:11 GMT
Received: from warthog.cambridge.redhat.com (localhost.localdomain [127.0.0.1])
	by warthog.cambridge.redhat.com (8.13.4/8.13.4) with ESMTP id k16AQ0kQ012368;
	Mon, 6 Feb 2006 10:26:01 GMT
From:	David Howells <dhowells@redhat.com>
In-Reply-To: <20060201090324.373982000@localhost.localdomain> 
References: <20060201090324.373982000@localhost.localdomain>  <20060201090224.536581000@localhost.localdomain> 
To:	Akinobu Mita <mita@miraclelinux.com>
Cc:	linux-kernel@vger.kernel.org, Richard Henderson <rth@twiddle.net>,
	Ivan Kokshaysky <ink@jurassic.park.msu.ru>, dev-etrax@axis.com,
	David Howells <dhowells@redhat.com>,
	Yoshinori Sato <ysato@users.sourceforge.jp>,
	linux-ia64@vger.kernel.org,
	Hirokazu Takata <takata@linux-m32r.org>,
	Greg Ungerer <gerg@uclinux.org>, linux-mips@linux-mips.org,
	parisc-linux@parisc-linux.org, linuxsh-dev@lists.sourceforge.net,
	linuxsh-shmedia-dev@lists.sourceforge.net,
	sparclinux@vger.kernel.org, ultralinux@vger.kernel.org,
	Miles Bader <uclinux-v850@lsi.nec.co.jp>,
	Chris Zankel <chris@zankel.net>
Subject: Re: [patch 11/44] generic find_{next,first}{,_zero}_bit() 
X-Mailer: MH-E 7.84; nmh 1.1; GNU Emacs 22.0.50.1
Date:	Mon, 06 Feb 2006 10:26:00 +0000
Message-ID: <12367.1139221560@warthog.cambridge.redhat.com>
Return-Path: <dhowells@redhat.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: 10341
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: dhowells@redhat.com
Precedence: bulk
X-list: linux-mips
Content-Length: 651
Lines: 15

Akinobu Mita <mita@miraclelinux.com> wrote:

> This patch introduces the C-language equivalents of the functions below:
> 
> unsigned logn find_next_bit(const unsigned long *addr, unsigned long size,
>                             unsigned long offset);
> unsigned long find_next_zero_bit(const unsigned long *addr, unsigned long size,
>                                  unsigned long offset);
> unsigned long find_first_zero_bit(const unsigned long *addr,
>                                   unsigned long size);
> unsigned long find_first_bit(const unsigned long *addr, unsigned long size);

These big functions should perhaps be out of line.

David

From macro@linux-mips.org Mon Feb  6 10:32:32 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 06 Feb 2006 10:32:40 +0000 (GMT)
Received: from pollux.ds.pg.gda.pl ([153.19.208.7]:48645 "EHLO
	pollux.ds.pg.gda.pl") by ftp.linux-mips.org with ESMTP
	id S3458326AbWBFKcc (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Mon, 6 Feb 2006 10:32:32 +0000
Received: from localhost (localhost [127.0.0.1])
	by pollux.ds.pg.gda.pl (Postfix) with ESMTP id 4FCBFF59E9;
	Mon,  6 Feb 2006 11:38:03 +0100 (CET)
Received: from pollux.ds.pg.gda.pl ([127.0.0.1])
 by localhost (pollux [127.0.0.1]) (amavisd-new, port 10024) with ESMTP
 id 06087-04; Mon,  6 Feb 2006 11:38:03 +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 043B5E1C7A;
	Mon,  6 Feb 2006 11:38:02 +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.3/8.13.1) with ESMTP id k16Abtl9012177;
	Mon, 6 Feb 2006 11:37:55 +0100
Date:	Mon, 6 Feb 2006 10:38:02 +0000 (GMT)
From:	"Maciej W. Rozycki" <macro@linux-mips.org>
To:	Martin Michlmayr <tbm@cyrius.com>
Cc:	"Peter 'p2' De Schrijver" <p2@mind.be>, linux-mips@linux-mips.org
Subject: Re: DECstation R3000 boot error
In-Reply-To: <20060203150232.GA25701@deprecation.cyrius.com>
Message-ID: <Pine.LNX.4.64N.0602061021110.32080@blysk.ds.pg.gda.pl>
References: <20060123225040.GA23576@deprecation.cyrius.com>
 <Pine.LNX.4.64N.0601241059140.11021@blysk.ds.pg.gda.pl>
 <20060124122700.GA8527@deprecation.cyrius.com>
 <Pine.LNX.4.64N.0601241227290.11021@blysk.ds.pg.gda.pl> <20060124232117.GA4165@codecarver>
 <Pine.LNX.4.64N.0601251103020.7675@blysk.ds.pg.gda.pl>
 <20060203150232.GA25701@deprecation.cyrius.com>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Virus-Scanned: ClamAV 0.87.1/1277/Sun Feb  5 14:22:21 2006 on piorun.ds.pg.gda.pl
X-Virus-Status:	Clean
X-Virus-Scanned: by amavisd-new at pollux.ds.pg.gda.pl
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: 10342
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
Content-Length: 548
Lines: 14

On Fri, 3 Feb 2006, Martin Michlmayr wrote:

> > and it obviously cannot work on a MIPS I processor.  That's probably from 
> > broken assembly code somewhere -- I should have my sources updated within 
> > a few days and I'll see if I can reproduce the problem.
> 
> Did you have a chance to look at this?

 Not yet, sorry.  I have updated my tree and most of my local patches, but 
I have a few to go yet.  My time is limited these days, but I'll try hard 
to get at the problems you reported by the coming weekend at the very 
latest.

  Maciej

From mita@miraclelinux.com Mon Feb  6 11:41:32 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 06 Feb 2006 11:41:41 +0000 (GMT)
Received: from ns.miraclelinux.com ([219.118.163.66]:12151 "EHLO
	mail01.miraclelinux.com") by ftp.linux-mips.org with ESMTP
	id S3458475AbWBFLlc (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Mon, 6 Feb 2006 11:41:32 +0000
Received: from mail01 (localhost.localdomain [127.0.0.1])
	by mail01.miraclelinux.com (Postfix) with ESMTP
	id E1D4631C144; Mon,  6 Feb 2006 20:47:02 +0900 (JST)
Received: from localhost.localdomain (sshgate.miraclelinux.com [])
	by mail01.miraclelinux.com ([10.1.0.10]);
	Mon, 06 Feb 2006 11:47:02 +0000
Received: by localhost.localdomain (Postfix, from userid 1000)
	id 1FA2642022F; Mon,  6 Feb 2006 20:47:03 +0900 (JST)
Date:	Mon, 6 Feb 2006 20:47:02 +0900
To:	Roman Zippel <zippel@linux-m68k.org>
Cc:	linux-kernel@vger.kernel.org, Richard Henderson <rth@twiddle.net>,
	Ivan Kokshaysky <ink@jurassic.park.msu.ru>, dev-etrax@axis.com,
	David Howells <dhowells@redhat.com>,
	Yoshinori Sato <ysato@users.sourceforge.jp>,
	Linus Torvalds <torvalds@osdl.org>, linux-ia64@vger.kernel.org,
	Hirokazu Takata <takata@linux-m32r.org>,
	linux-m68k@vger.kernel.org, linux-mips@linux-mips.org,
	parisc-linux@parisc-linux.org, linuxsh-dev@lists.sourceforge.net,
	linuxsh-shmedia-dev@lists.sourceforge.net,
	sparclinux@vger.kernel.org, ultralinux@vger.kernel.org,
	Miles Bader <uclinux-v850@lsi.nec.co.jp>,
	Andi Kleen <ak@suse.de>, Chris Zankel <chris@zankel.net>
Subject: Re: [patch 15/44] generic ext2_{set,clear,test,find_first_zero,find_next_zero}_bit()
Message-ID: <20060206114702.GA11836@miraclelinux.com>
References: <20060201090224.536581000@localhost.localdomain> <20060201090326.139510000@localhost.localdomain> <Pine.LNX.4.61.0602011214270.12293@scrub.home>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <Pine.LNX.4.61.0602011214270.12293@scrub.home>
User-Agent: Mutt/1.5.9i
From:	mita@miraclelinux.com (Akinobu Mita)
Return-Path: <mita@miraclelinux.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: 10343
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: mita@miraclelinux.com
Precedence: bulk
X-list: linux-mips
Content-Length: 386
Lines: 13

On Wed, Feb 01, 2006 at 12:27:38PM +0100, Roman Zippel wrote:
> > +static __inline__ int generic_test_le_bit(unsigned long nr,
> > +				  __const__ unsigned long *addr)
> > +{
> > +	__const__ unsigned char	*tmp = (__const__ unsigned char *) addr;
> > +	return (tmp[nr >> 3] >> (nr & 7)) & 1;
> > +}
> 
> The underscores are not needed.
> 

Thanks, I converted to 'inline' and 'const'.


From mita@miraclelinux.com Mon Feb  6 11:47:25 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 06 Feb 2006 11:47:34 +0000 (GMT)
Received: from ns.miraclelinux.com ([219.118.163.66]:3192 "EHLO
	mail01.miraclelinux.com") by ftp.linux-mips.org with ESMTP
	id S3458475AbWBFLrZ (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Mon, 6 Feb 2006 11:47:25 +0000
Received: from mail01 (localhost.localdomain [127.0.0.1])
	by mail01.miraclelinux.com (Postfix) with ESMTP
	id E522231C18B; Mon,  6 Feb 2006 20:52:57 +0900 (JST)
Received: from localhost.localdomain (sshgate.miraclelinux.com [])
	by mail01.miraclelinux.com ([10.1.0.10]);
	Mon, 06 Feb 2006 11:52:57 +0000
Received: by localhost.localdomain (Postfix, from userid 1000)
	id 056AC42022F; Mon,  6 Feb 2006 20:52:57 +0900 (JST)
Date:	Mon, 6 Feb 2006 20:52:57 +0900
To:	Gabriel Paubert <paubert@iram.es>
Cc:	linux-kernel@vger.kernel.org, linux-mips@linux-mips.org,
	linux-ia64@vger.kernel.org, Ian Molton <spyro@f2s.com>,
	David Howells <dhowells@redhat.com>, linuxppc-dev@ozlabs.org,
	Greg Ungerer <gerg@uclinux.org>, sparclinux@vger.kernel.org,
	Miles Bader <uclinux-v850@lsi.nec.co.jp>,
	Linus Torvalds <torvalds@osdl.org>,
	Yoshinori Sato <ysato@users.sourceforge.jp>,
	Hirokazu Takata <takata@linux-m32r.org>,
	linuxsh-shmedia-dev@lists.sourceforge.net,
	linux-m68k@vger.kernel.org,
	Ivan Kokshaysky <ink@jurassic.park.msu.ru>,
	Richard Henderson <rth@twiddle.net>,
	Chris Zankel <chris@zankel.net>, dev-etrax@axis.com,
	ultralinux@vger.kernel.org, Andi Kleen <ak@suse.de>,
	linuxsh-dev@lists.sourceforge.net, linux390@de.ibm.com,
	Russell King <rmk@arm.linux.org.uk>,
	parisc-linux@parisc-linux.org,
	Balbir Singh <bsingharora@gmail.com>, linux@horizon.com
Subject: Re: [patch 14/44] generic hweight{64,32,16,8}()
Message-ID: <20060206115257.GB11836@miraclelinux.com>
References: <20060201090224.536581000@localhost.localdomain> <20060201090325.905071000@localhost.localdomain> <20060202012637.GA25093@iram.es>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20060202012637.GA25093@iram.es>
User-Agent: Mutt/1.5.9i
From:	mita@miraclelinux.com (Akinobu Mita)
Return-Path: <mita@miraclelinux.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: 10344
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: mita@miraclelinux.com
Precedence: bulk
X-list: linux-mips
Content-Length: 1394
Lines: 48

On Thu, Feb 02, 2006 at 02:26:38AM +0100, Gabriel Paubert wrote:
> 
> The first step can be implemented slightly better:
> 
> unsigned int res = w-((w>>1)&0x55555555);
> 

Yes. I've got many advices about hweight speedup.


static unsigned int hweight32(unsigned int w)
{
        unsigned int res = w - ((w >> 1) & 0x55555555);
        res = (res & 0x33333333) + ((res >> 2) & 0x33333333);
        res = (res + (res >> 4)) & 0x0F0F0F0F;
        res = res + (res >> 8);
        return (res + (res >> 16)) & 0x000000FF;
}

static unsigned int hweight16(unsigned int w)
{
        unsigned int res = w - ((w >> 1) & 0x5555);
        res = (res & 0x3333) + ((res >> 2) & 0x3333);
        res = (res + (res >> 4)) & 0x0F0F;
        return (res + (res >> 8)) & 0x00FF;
}

static unsigned int hweight8(unsigned int w)
{
        unsigned int res = w - ((w >> 1) & 0x55);
        res = (res & 0x33) + ((res >> 2) & 0x33);
        return (res + (res >> 4)) & 0x0F;
}

static unsigned long hweight64(__u64 w)
{
#if BITS_PER_LONG < 64
	return hweight32((unsigned int)(w >> 32)) +
				hweight32((unsigned int)w);
#else
	__u64 res = w - ((w >> 1) & 0x5555555555555555ul);
	res = (res & 0x3333333333333333ul) + ((res >> 2) & 0x3333333333333333ul);
	res = (res + (res >> 4)) & 0x0F0F0F0F0F0F0F0Ful;
	res = res + (res >> 8);
	res = res + (res >> 16);
	return (res + (res >> 32)) & 0x00000000000000FFul;
#endif
}

From anemo@mba.ocn.ne.jp Mon Feb  6 13:37:19 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 06 Feb 2006 13:37:28 +0000 (GMT)
Received: from mba.ocn.ne.jp ([210.190.142.172]:27856 "HELO smtp.mba.ocn.ne.jp")
	by ftp.linux-mips.org with SMTP id S3458482AbWBFNhT (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Mon, 6 Feb 2006 13:37:19 +0000
Received: from localhost (p8116-ipad27funabasi.chiba.ocn.ne.jp [220.107.199.116])
	by smtp.mba.ocn.ne.jp (Postfix) with ESMTP
	id 43FB5D8A; Mon,  6 Feb 2006 22:42:50 +0900 (JST)
Date:	Mon, 06 Feb 2006 22:42:31 +0900 (JST)
Message-Id: <20060206.224231.126575297.anemo@mba.ocn.ne.jp>
To:	linux-mips@linux-mips.org
Cc:	ralf@linux-mips.org
Subject: [PATCH] use CONFIG_64BIT for /proc/kcore fix
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
In-Reply-To: <20060116155343.GE26771@deprecation.cyrius.com>
References: <20050121005954.GA10260@nevyn.them.org>
	<20050214020209.GA25335@nevyn.them.org>
	<20060116155343.GE26771@deprecation.cyrius.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: 10345
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
Content-Length: 831
Lines: 26

CONFIG_MIPS64 was replaced by CONFIG_64BIT a while ago.

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

diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 4188df8..0ff9a34 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -202,7 +202,7 @@ static inline int page_is_ram(unsigned l
 }
 
 static struct kcore_list kcore_mem, kcore_vmalloc;
-#ifdef CONFIG_MIPS64
+#ifdef CONFIG_64BIT
 static struct kcore_list kcore_kseg0;
 #endif
 
@@ -255,7 +255,7 @@ void __init mem_init(void)
 	datasize =  (unsigned long) &_edata - (unsigned long) &_etext;
 	initsize =  (unsigned long) &__init_end - (unsigned long) &__init_begin;
 
-#ifdef CONFIG_MIPS64
+#ifdef CONFIG_64BIT
 	if ((unsigned long) &_text > (unsigned long) CKSEG0)
 		/* The -4 is a hack so that user tools don't have to handle
 		   the overflow.  */

From tbm@cyrius.com Mon Feb  6 15:12:51 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 06 Feb 2006 15:13:01 +0000 (GMT)
Received: from sorrow.cyrius.com ([65.19.161.204]:23053 "EHLO
	sorrow.cyrius.com") by ftp.linux-mips.org with ESMTP
	id S3458487AbWBFPMv (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Mon, 6 Feb 2006 15:12:51 +0000
Received: by sorrow.cyrius.com (Postfix, from userid 10)
	id 692DC64D3D; Mon,  6 Feb 2006 15:18:18 +0000 (UTC)
Received: by deprecation.cyrius.com (Postfix, from userid 1000)
	id B0A1E8D2D; Mon,  6 Feb 2006 15:17:54 +0000 (GMT)
Date:	Mon, 6 Feb 2006 15:17:54 +0000
From:	Martin Michlmayr <tbm@cyrius.com>
To:	linux-mips@linux-mips.org
Subject: Has anyone seen O2 crashes?
Message-ID: <20060206151754.GA22181@deprecation.cyrius.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.5.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: 10346
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
Content-Length: 389
Lines: 10

I got a report that Debian's experimental 2.6.15 mips patches
(2.6.15.2 plus linux-mips git from a few weeks ago plus random
patches) sometimes crashes, posibly under high load - there's
nothing on the serial console.

I was just wondering if anyone else (in particular the Gentoo folks)
has seem something similar, or is O2 rock solid for you?
-- 
Martin Michlmayr
http://www.cyrius.com/

From geoman@gentoo.org Mon Feb  6 15:58:33 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 06 Feb 2006 15:58:45 +0000 (GMT)
Received: from lennier.cc.vt.edu ([198.82.162.213]:35491 "EHLO
	lennier.cc.vt.edu") by ftp.linux-mips.org with ESMTP
	id S3458487AbWBFP6d (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Mon, 6 Feb 2006 15:58:33 +0000
Received: from zidane.cc.vt.edu (IDENT:mirapoint@evil-zidane.cc.vt.edu [10.1.1.13])
	by lennier.cc.vt.edu (8.12.11/8.12.11) with ESMTP id k16G3mSb010822;
	Mon, 6 Feb 2006 11:03:48 -0500
Received: from [128.173.184.73] (gs4073.geos.vt.edu [128.173.184.73])
	by zidane.cc.vt.edu (MOS 3.7.3a-GA)
	with ESMTP id FBA28602;
	Mon, 6 Feb 2006 11:03:45 -0500 (EST)
Message-ID: <43E7735B.4050307@gentoo.org>
Date:	Mon, 06 Feb 2006 11:03:39 -0500
From:	"Stephen P. Becker" <geoman@gentoo.org>
User-Agent: Mail/News 1.5 (X11/20060116)
MIME-Version: 1.0
To:	Martin Michlmayr <tbm@cyrius.com>
CC:	"'Linux/MIPS Development'" <linux-mips@linux-mips.org>
Subject: Re: Has anyone seen O2 crashes?
References: <20060206151754.GA22181@deprecation.cyrius.com>
In-Reply-To: <20060206151754.GA22181@deprecation.cyrius.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Return-Path: <geoman@gentoo.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: 10347
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: geoman@gentoo.org
Precedence: bulk
X-list: linux-mips
Content-Length: 1131
Lines: 24

Martin Michlmayr wrote:
> I got a report that Debian's experimental 2.6.15 mips patches
> (2.6.15.2 plus linux-mips git from a few weeks ago plus random
> patches) sometimes crashes, posibly under high load - there's
> nothing on the serial console.
> 
> I was just wondering if anyone else (in particular the Gentoo folks)
> has seem something similar, or is O2 rock solid for you?

I don't know how Debian is patching things up for O2 (ths care to 
comment?), but ip32 has been absolutely rock solid for me the past 
several releases.  The only modifications I make to the source tree are 
a small gbefb patch and a minor Makefile patch (however, this is 
probably different from other Gentoo folks...I hate using our kernel 
source ebuilds which apply a number of patches for other platforms and 
issues).

I had over 60 days of uptime recently with some variant of 2.6.15 (-rc5 
I think), and the machine was hammered fairly hard during that time with 
plenty of compiling, including significant portions of KDE.  I have run 
both the 2.6.15 tag from lmo git, and now I'm on 2.6.16-rc1.  It still 
seems solid as ever.

-Steve

From jcrouse@cosmic.amd.com Mon Feb  6 16:03:03 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 06 Feb 2006 16:03:16 +0000 (GMT)
Received: from amdext3.amd.com ([139.95.251.6]:61364 "EHLO amdext3.amd.com")
	by ftp.linux-mips.org with ESMTP id S3458492AbWBFQDD (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Mon, 6 Feb 2006 16:03:03 +0000
Received: from SSVLGW01.amd.com (ssvlgw01.amd.com [139.95.250.169])
	by amdext3.amd.com (8.12.11/8.12.11/AMD) with ESMTP id k16G8VBC029219;
	Mon, 6 Feb 2006 08:08:31 -0800
Received: from 139.95.53.182 by SSVLGW01.amd.com with ESMTP (AMD SMTP
 Relay (Email Firewall v6.1.0)); Mon, 06 Feb 2006 07:21:41 -0800
X-Server-Uuid: 89466532-923C-4A88-82C1-66ACAA0041DF
Received: from ldcmail.amd.com ([147.5.200.40]) by SSVLEXBH1.amd.com
 with Microsoft SMTPSVC(6.0.3790.0); Mon, 6 Feb 2006 07:21:41 -0800
Received: from cosmic.amd.com (cosmic.amd.com [147.5.201.206]) by
 ldcmail.amd.com (Postfix) with ESMTP id DD9292028; Mon, 6 Feb 2006
 08:21:40 -0700 (MST)
Received: from cosmic.amd.com (localhost [127.0.0.1]) by cosmic.amd.com
 (8.13.4/8.13.4) with ESMTP id k16FPIwD010716; Mon, 6 Feb 2006 08:25:18
 -0700
Received: (from jcrouse@localhost) by cosmic.amd.com (
 8.13.4/8.13.4/Submit) id k16FPHoS010715; Mon, 6 Feb 2006 08:25:17 -0700
Date:	Mon, 6 Feb 2006 08:25:17 -0700
From:	"Jordan Crouse" <jordan.crouse@amd.com>
To:	"David Sanchez" <david.sanchez@lexbox.fr>
cc:	"Sergei Shtylylov" <sshtylyov@ru.mvista.com>,
	linux-mips@linux-mips.org
Subject: Re: Au1xx0: really set KSEG0 to uncached on reboot
Message-ID: <20060206152516.GA10615@cosmic.amd.com>
References: <17AB476A04B7C842887E0EB1F268111E027447@xpserver.intra.lexbox.org>
MIME-Version: 1.0
In-Reply-To: <17AB476A04B7C842887E0EB1F268111E027447@xpserver.intra.lexbox.org>
User-Agent: Mutt/1.5.11
X-OriginalArrivalTime: 06 Feb 2006 15:21:41.0536 (UTC)
 FILETIME=[0810FA00:01C62B31]
X-WSS-ID: 6FF9B60F1HW6107711-01-01
Content-Type: text/plain;
 charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: 7bit
Return-Path: <jcrouse@cosmic.amd.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: 10348
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: jordan.crouse@amd.com
Precedence: bulk
X-list: linux-mips
Content-Length: 439
Lines: 18

On 06/02/06 09:10 +0100, David Sanchez wrote:
> Hi,
> 
> This is exactly what I did...
> But I notice that sometimes it works and sometimes the kernel frees when 
> "** Resetting Integrated Peripherals"

We'll need to nail this down before we go any further.  Can we get a trace
of what happens when it crashes?

Jordan

-- 
Jordan Crouse
Senior Linux Engineer
AMD - Personal Connectivity Solutions Group
<www.amd.com/embeddedprocessors>


From ralf@linux-mips.org Mon Feb  6 16:30:26 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 06 Feb 2006 16:30:42 +0000 (GMT)
Received: from mipsfw.mips-uk.com ([194.74.144.146]:61454 "EHLO
	bacchus.dhis.org") by ftp.linux-mips.org with ESMTP
	id S3458325AbWBFQaW (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Mon, 6 Feb 2006 16:30:22 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by bacchus.dhis.org (8.13.4/8.13.4) with ESMTP id k16GZx92005128;
	Mon, 6 Feb 2006 16:36:01 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.4/8.13.4/Submit) id k152h6H2013991;
	Sun, 5 Feb 2006 02:43:06 GMT
Date:	Sun, 5 Feb 2006 02:43:06 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	Sergei Shtylylov <sshtylyov@ru.mvista.com>
Cc:	Linux MIPS <linux-mips@linux-mips.org>,
	Manish Lachwani <mlachwani@mvista.com>,
	Konstantin Baidarov <kbaidarov@ru.mvista.com>
Subject: Re: [PATCH] TX49x7: fix reporting of the CPU name and PCI clock
Message-ID: <20060205024306.GA13942@linux-mips.org>
References: <43E499E2.6070805@ru.mvista.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <43E499E2.6070805@ru.mvista.com>
User-Agent: Mutt/1.4.2.1i
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: 10349
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
Content-Length: 76
Lines: 3

On Sat, Feb 04, 2006 at 03:11:14PM +0300, Sergei Shtylylov wrote:

Applied.

From sshtylyov@ru.mvista.com Mon Feb  6 17:32:28 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 06 Feb 2006 17:32:53 +0000 (GMT)
Received: from rtsoft2.corbina.net ([85.21.88.2]:55991 "HELO
	mail.dev.rtsoft.ru") by ftp.linux-mips.org with SMTP
	id S3458530AbWBFRc2 (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Mon, 6 Feb 2006 17:32:28 +0000
Received: (qmail 11102 invoked from network); 6 Feb 2006 17:37:41 -0000
Received: from wasted.dev.rtsoft.ru (HELO ?192.168.1.248?) (192.168.1.248)
  by mail.dev.rtsoft.ru with SMTP; 6 Feb 2006 17:37:41 -0000
Message-ID: <43E78A2C.2000104@ru.mvista.com>
Date:	Mon, 06 Feb 2006 20:41:00 +0300
From:	Sergei Shtylylov <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.org
CC:	Jordan Crouse <jordan.crouse@amd.com>,
	David Sanchez <david.sanchez@lexbox.fr>,
	Sergei Shtylylov <sshtylyov@ru.mvista.com>
Subject: Re: Au1xx0: really set KSEG0 to uncached on reboot
References: <17AB476A04B7C842887E0EB1F268111E027447@xpserver.intra.lexbox.org> <20060206152516.GA10615@cosmic.amd.com>
In-Reply-To: <20060206152516.GA10615@cosmic.amd.com>
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: 10350
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
Content-Length: 698
Lines: 30

Hello.

Jordan Crouse wrote:
> On 06/02/06 09:10 +0100, David Sanchez wrote:
> 
>>Hi,
>>
>>This is exactly what I did...
>>But I notice that sometimes it works and sometimes the kernel frees when 

    You mean "freezes" probably? :-)

>>"** Resetting Integrated Peripherals"

    This is not kernel's msg, but YAMON's one...

> We'll need to nail this down before we go any further.  Can we get a trace
> of what happens when it crashes?

    David, do you have BCSR fix from:

http://www.linux-mips.org/archives/linux-mips/2005-10/msg00236.html

applied (the recent kernel has it but which one are you using?)?
DBAu1550 reset may not work as expeceted otherwise indeed...

> Jordan

WBR, Sergei


From tbm@cyrius.com Mon Feb  6 18:06:10 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 06 Feb 2006 18:06:40 +0000 (GMT)
Received: from sorrow.cyrius.com ([65.19.161.204]:38414 "EHLO
	sorrow.cyrius.com") by ftp.linux-mips.org with ESMTP
	id S3458582AbWBFSGI (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Mon, 6 Feb 2006 18:06:08 +0000
Received: by sorrow.cyrius.com (Postfix, from userid 10)
	id 86AE564D3D; Mon,  6 Feb 2006 18:11:39 +0000 (UTC)
Received: by deprecation.cyrius.com (Postfix, from userid 1000)
	id CD2198D2D; Mon,  6 Feb 2006 18:11:17 +0000 (GMT)
Date:	Mon, 6 Feb 2006 18:11:17 +0000
From:	Martin Michlmayr <tbm@cyrius.com>
To:	"Stephen P. Becker" <geoman@gentoo.org>
Cc:	'Linux/MIPS Development' <linux-mips@linux-mips.org>
Subject: Re: Has anyone seen O2 crashes?
Message-ID: <20060206181117.GD25192@deprecation.cyrius.com>
References: <20060206151754.GA22181@deprecation.cyrius.com> <43E7735B.4050307@gentoo.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <43E7735B.4050307@gentoo.org>
User-Agent: Mutt/1.5.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: 10351
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
Content-Length: 470
Lines: 10

* Stephen P. Becker <geoman@gentoo.org> [2006-02-06 11:03]:
> I had over 60 days of uptime recently with some variant of 2.6.15 (-rc5 
> I think), and the machine was hammered fairly hard during that time with 
> plenty of compiling, including significant portions of KDE.  I have run 
> both the 2.6.15 tag from lmo git, and now I'm on 2.6.16-rc1.  It still 

OK, thanks for the confirmation.  I'll see what's going on here.
-- 
Martin Michlmayr
http://www.cyrius.com/

From kurts@vitesse.com Mon Feb  6 21:49:24 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 06 Feb 2006 21:49:47 +0000 (GMT)
Received: from [64.215.88.90] ([64.215.88.90]:50503 "EHLO email.vitesse.com")
	by ftp.linux-mips.org with ESMTP id S3458325AbWBFVtY convert rfc822-to-8bit
	(ORCPT <rfc822;linux-mips@linux-mips.org>);
	Mon, 6 Feb 2006 21:49:24 +0000
Received: from wilson.vitesse.com (wilson [10.9.72.71])
	by email.vitesse.com (8.11.0/8.11.0) with ESMTP id k16Ls2h24377
	for <linux-mips@linux-mips.org>; Mon, 6 Feb 2006 13:54:02 -0800 (PST)
Received: from MX-COS.vsc.vitesse.com (mx-cs1 [10.9.72.41])
	by wilson.vitesse.com (8.11.6/8.11.6) with ESMTP id k16Ls6b06925
	for <linux-mips@linux-mips.org>; Mon, 6 Feb 2006 14:54:07 -0700 (MST)
Content-class: urn:content-classes:message
MIME-Version: 1.0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 8BIT
X-MimeOLE: Produced By Microsoft Exchange V6.0.6556.0
Subject: oprofile gets only kernel samples?
Date:	Mon, 6 Feb 2006 14:54:00 -0700
Message-ID: <389E6A416914954182ECDFCD844D8269434D89@MX-COS.vsc.vitesse.com>
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
Thread-Topic: oprofile gets only kernel samples?
Thread-Index: AcYrZ9Y+7vt2h705RpmPJBZLmay+PA==
From:	"Kurt Schwemmer" <kurts@vitesse.com>
To:	<linux-mips@linux-mips.org>
Return-Path: <kurts@vitesse.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: 10352
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: kurts@vitesse.com
Precedence: bulk
X-list: linux-mips
Content-Length: 406
Lines: 10

I've got oprofile working sort of with 2.6.15 kernel on a 24Kc processor
using just timer interrupts. I only get samples within vmlinux.out
though. When I look at top output during the period of time there is
definitely some significant user mode time. Before digging too deep into
the problem I thought I'd ask to see if this is a known limitation and
if everyone is seeing this.

Thanks,
Kurt Schwemmer


From mita@miraclelinux.com Tue Feb  7 01:56:43 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 07 Feb 2006 01:56:52 +0000 (GMT)
Received: from ns.miraclelinux.com ([219.118.163.66]:41381 "EHLO
	mail01.miraclelinux.com") by ftp.linux-mips.org with ESMTP
	id S3458530AbWBGB4n (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 7 Feb 2006 01:56:43 +0000
Received: from mail01 (localhost.localdomain [127.0.0.1])
	by mail01.miraclelinux.com (Postfix) with ESMTP
	id EA7BB31C2E8; Tue,  7 Feb 2006 11:02:17 +0900 (JST)
Received: from localhost.localdomain (sshgate.miraclelinux.com [])
	by mail01.miraclelinux.com ([10.1.0.10]);
	Tue, 07 Feb 2006 02:02:16 +0000
Received: by localhost.localdomain (Postfix, from userid 1000)
	id C6BF142022F; Tue,  7 Feb 2006 11:02:16 +0900 (JST)
Date:	Tue, 7 Feb 2006 11:02:16 +0900
To:	David Howells <dhowells@redhat.com>
Cc:	linux-kernel@vger.kernel.org, Richard Henderson <rth@twiddle.net>,
	Ivan Kokshaysky <ink@jurassic.park.msu.ru>, dev-etrax@axis.com,
	Yoshinori Sato <ysato@users.sourceforge.jp>,
	linux-ia64@vger.kernel.org,
	Hirokazu Takata <takata@linux-m32r.org>,
	Greg Ungerer <gerg@uclinux.org>, linux-mips@linux-mips.org,
	parisc-linux@parisc-linux.org, linuxsh-dev@lists.sourceforge.net,
	linuxsh-shmedia-dev@lists.sourceforge.net,
	sparclinux@vger.kernel.org, ultralinux@vger.kernel.org,
	Miles Bader <uclinux-v850@lsi.nec.co.jp>,
	Chris Zankel <chris@zankel.net>
Subject: Re: [patch 11/44] generic find_{next,first}{,_zero}_bit()
Message-ID: <20060207020216.GA9323@miraclelinux.com>
References: <20060201090324.373982000@localhost.localdomain> <20060201090224.536581000@localhost.localdomain> <12367.1139221560@warthog.cambridge.redhat.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <12367.1139221560@warthog.cambridge.redhat.com>
User-Agent: Mutt/1.5.9i
From:	mita@miraclelinux.com (Akinobu Mita)
Return-Path: <mita@miraclelinux.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: 10353
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: mita@miraclelinux.com
Precedence: bulk
X-list: linux-mips
Content-Length: 846
Lines: 20

On Mon, Feb 06, 2006 at 10:26:00AM +0000, David Howells wrote:
> Akinobu Mita <mita@miraclelinux.com> wrote:
> 
> > This patch introduces the C-language equivalents of the functions below:
> > 
> > unsigned logn find_next_bit(const unsigned long *addr, unsigned long size,
> >                             unsigned long offset);
> > unsigned long find_next_zero_bit(const unsigned long *addr, unsigned long size,
> >                                  unsigned long offset);
> > unsigned long find_first_zero_bit(const unsigned long *addr,
> >                                   unsigned long size);
> > unsigned long find_first_bit(const unsigned long *addr, unsigned long size);
> 
> These big functions should perhaps be out of line.

Yes. I'll make them and below out of line.

- hweight*()
- ext2_find_*_zero_bit()
- minix_find_first_zero_bit()

From kumba@gentoo.org Tue Feb  7 02:52:39 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 07 Feb 2006 02:52:49 +0000 (GMT)
Received: from rwcrmhc11.comcast.net ([204.127.192.81]:1451 "EHLO
	rwcrmhc11.comcast.net") by ftp.linux-mips.org with ESMTP
	id S3466525AbWBGCwj (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 7 Feb 2006 02:52:39 +0000
Received: from [192.168.1.4] (unknown[69.140.185.48])
          by comcast.net (rwcrmhc11) with ESMTP
          id <20060207025807m11005t8ire>; Tue, 7 Feb 2006 02:58:11 +0000
Message-ID: <43E80CC5.5090805@gentoo.org>
Date:	Mon, 06 Feb 2006 21:58:13 -0500
From:	Kumba <kumba@gentoo.org>
User-Agent: Thunderbird 1.5 (Windows/20051201)
MIME-Version: 1.0
To:	Linux MIPS List <linux-mips@linux-mips.org>
Subject: Re: R10K/R12K Based O2's
References: <43DAFEFE.8060009@gentoo.org>
In-Reply-To: <43DAFEFE.8060009@gentoo.org>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Return-Path: <kumba@gentoo.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: 10354
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: kumba@gentoo.org
Precedence: bulk
X-list: linux-mips
Content-Length: 3642
Lines: 87

Round 2:

Discovered I'd built my IP32 R10K kernel with:
	A) An older version of Peter Fuerst's R10K Cache Barriers Patch
	B) Did a code change in the above patch that generated less
	   cache barriers instead of more

So I've re-done everything, and now have a kernel for IP32 R10K (and R12K) that 
uses the latest gcc cache barriers patch available on the IP28 site w/ the one 
code change that generates more cache barriers (See below for details).

It seems with the gcc patch and the stripped IP28 patch, a working IP32 R10K 
kernel can be produced that seems to handle itself very well.  It occasionally 
spits out CRIME CPU errors, and in my case, I've triggered two Oopses 
(non-fatal).  It seems the network adapter doesn't seem to trigger the 
speculative execution bug too much (which I believe is indicated by the CRIME 
CPU errors), however the scsi driver definitely causes them to appear every so 
often.

Patches and other misc. files available here:
http://dev.gentoo.org/~kumba/mips/netboot/testing/ip32/r10k/

Included there is a 2.6.15.2 kernel, the kernel patch, the gcc patch, the kernel 
disassembly (71MB whopper unpacked), and the cpio archive containing the netboot 
userland (this is actually 5-6 cpio archives slapped together with 'cat', but 
the kernel handles it just fine), and the md5/sha1 sums to verify against.

To boot:
bootp(): console=ttyS0,<baud>  (gbefb seems to not respond on these systems)
Initramfs should take over and load a mini netboot userland.  Has basic 
capabilities, and supports a few fs'es (xfs, ext2/3, no reiser/jfs, etc)


Stats:

# uname -a
Linux netboot-2006.0 2.6.15.2-mipsgit-20060109 #2 Sun Feb 5 19:28:36 EST 2006 
mips64 R10000 V2.6  FPU V0.0 SGI O2 GNU/Linux

# uptime
21:54:14 up 1 day,  2:23, load average: 2.01, 2.02, 2.00

Currently, it's building gcc-3.4.5 as I type this, using the disk for everything 
but swap.  There are some caveats, though, which are outlined below:


The Errors (Just a sample, and in no specific order):
CRIME CPU error at 0x00f73b850 status 0x00000004
CRIME CPU error at 0x01005fcc0 status 0x00000004
CRIME CPU error at 0x005a8b810 status 0x00000004
CRIME CPU error at 0x005a8b850 status 0x00000004
CRIME CPU error at 0x007bd7850 status 0x00000004
CRIME CPU error at 0x00802f850 status 0x00000004
CRIME CPU error at 0x003b0b850 status 0x00000004
CRIME CPU error at 0x00e33f850 status 0x00000004
CRIME CPU error at 0x00a1df850 status 0x00000004

If anyone has an idea just what those hex addresses are referencing, or what 
exact is the meaning of that status bit, I'd be curious to know.


The Oopses:
http://dev.gentoo.org/~kumba/mips/netboot/testing/ip32/r10k/ip32r10k-26152-oops1.txt
http://dev.gentoo.org/~kumba/mips/netboot/testing/ip32/r10k/ip32r10k-26152-oops2.txt

These seem similar to the old MC Bus Errors I hit when toying around in the 
early days of IP28 support.  They've pretty much vanished now since Peter wrote 
up the new IP28 bus error handler.  So whether this are the same or not is 
anyone's guess -- if so, I imagine there's some degree of fixups that can be 
done to IP32's bus error handler to take care of these.  But that's just pure 
speculation on my part.


Read the README file there too -- it's got some small /proc tweaks that, at a 
first glance, help the kernel to avoid touching the disk too often by turning 
off swap entirely and setting two other small vm settings.



--Kumba

-- 
Gentoo/MIPS Team Lead
Gentoo Foundation Board of Trustees

"Such is oft the course of deeds that move the wheels of the world: small hands 
do them because they must, while the eyes of the great are elsewhere."  --Elrond

From david.sanchez@lexbox.fr Tue Feb  7 12:45:39 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 07 Feb 2006 12:46:00 +0000 (GMT)
Received: from smtp4.wanadoo.fr ([193.252.22.27]:46831 "EHLO smtp4.wanadoo.fr")
	by ftp.linux-mips.org with ESMTP id S8133371AbWBGMpj convert rfc822-to-8bit
	(ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 7 Feb 2006 12:45:39 +0000
Received: from me-wanadoo.net (localhost [127.0.0.1])
	by mwinf0403.wanadoo.fr (SMTP Server) with ESMTP id D82371C002E1
	for <linux-mips@linux-mips.org>; Tue,  7 Feb 2006 13:51:13 +0100 (CET)
Received: from lexbox.fr (AToulouse-254-1-57-113.w81-49.abo.wanadoo.fr [81.49.32.113])
	by mwinf0403.wanadoo.fr (SMTP Server) with ESMTP id B9E921C00353;
	Tue,  7 Feb 2006 13:51:13 +0100 (CET)
X-ME-UUID: 20060207125113761.B9E921C00353@mwinf0403.wanadoo.fr
Subject: RE: Au1xx0: really set KSEG0 to uncached on reboot
MIME-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 8BIT
Date:	Tue, 7 Feb 2006 13:47:57 +0100
Content-class: urn:content-classes:message
Message-ID: <17AB476A04B7C842887E0EB1F268111E02746A@xpserver.intra.lexbox.org>
X-MimeOLE: Produced By Microsoft Exchange V6.5.6944.0
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
Thread-Topic: Au1xx0: really set KSEG0 to uncached on reboot
Thread-Index: AcYrRTLLwVzft7AeR4qUrbZ/Do6RzAAncaKg
From:	"David Sanchez" <david.sanchez@lexbox.fr>
To:	"Sergei Shtylylov" <sshtylyov@ru.mvista.com>,
	<linux-mips@linux-mips.org>
Cc:	"Jordan Crouse" <jordan.crouse@amd.com>
Return-Path: <david.sanchez@lexbox.fr>
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: 10355
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.sanchez@lexbox.fr
Precedence: bulk
X-list: linux-mips
Content-Length: 1204
Lines: 52

Yes, I mean "freezes" :) 

I have the BCSR fix applied.

And the message "** Resetting Integrated Peripherals" comes from the arch/mips/au1000/common/reset.c file (I'm using the kernel 2.6.10).

Maybe I forget to apply other patches...


-----Message d'origine-----
De : Sergei Shtylylov [mailto:sshtylyov@ru.mvista.com] 
Envoyé : lundi 6 février 2006 18:46
Ŕ : linux-mips@linux-mips.org
Cc : Jordan Crouse; David Sanchez; Sergei Shtylylov
Objet : Re: Au1xx0: really set KSEG0 to uncached on reboot

Hello.

Jordan Crouse wrote:
> On 06/02/06 09:10 +0100, David Sanchez wrote:
> 
>>Hi,
>>
>>This is exactly what I did...
>>But I notice that sometimes it works and sometimes the kernel frees when 

    You mean "freezes" probably? :-)

>>"** Resetting Integrated Peripherals"

    This is not kernel's msg, but YAMON's one...

> We'll need to nail this down before we go any further.  Can we get a trace
> of what happens when it crashes?

    David, do you have BCSR fix from:

http://www.linux-mips.org/archives/linux-mips/2005-10/msg00236.html

applied (the recent kernel has it but which one are you using?)?
DBAu1550 reset may not work as expeceted otherwise indeed...

> Jordan

WBR, Sergei








From ralf@linux-mips.org Tue Feb  7 12:50:52 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 07 Feb 2006 12:51:05 +0000 (GMT)
Received: from mipsfw.mips-uk.com ([194.74.144.146]:24587 "EHLO
	bacchus.dhis.org") by ftp.linux-mips.org with ESMTP
	id S8133369AbWBGMuw (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 7 Feb 2006 12:50:52 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by bacchus.dhis.org (8.13.4/8.13.4) with ESMTP id k17CuetQ005427;
	Tue, 7 Feb 2006 12:56:40 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.4/8.13.4/Submit) id k17B9xkm004138;
	Tue, 7 Feb 2006 11:09:59 GMT
Date:	Tue, 7 Feb 2006 11:09:59 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	Kurt Schwemmer <kurts@vitesse.com>
Cc:	linux-mips@linux-mips.org
Subject: Re: oprofile gets only kernel samples?
Message-ID: <20060207110959.GA3383@linux-mips.org>
References: <389E6A416914954182ECDFCD844D8269434D89@MX-COS.vsc.vitesse.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <389E6A416914954182ECDFCD844D8269434D89@MX-COS.vsc.vitesse.com>
User-Agent: Mutt/1.4.2.1i
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: 10356
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
Content-Length: 578
Lines: 13

On Mon, Feb 06, 2006 at 02:54:00PM -0700, Kurt Schwemmer wrote:

> I've got oprofile working sort of with 2.6.15 kernel on a 24Kc processor
> using just timer interrupts. I only get samples within vmlinux.out
> though. When I look at top output during the period of time there is
> definitely some significant user mode time. Before digging too deep into
> the problem I thought I'd ask to see if this is a known limitation and
> if everyone is seeing this.

That's the symptom of running too old oprofile tools; you need to use a
cvs; the release tarballs are too old.

  Ralf

From ralf@linux-mips.org Tue Feb  7 12:51:35 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 07 Feb 2006 12:51:57 +0000 (GMT)
Received: from mipsfw.mips-uk.com ([194.74.144.146]:10246 "EHLO
	bacchus.dhis.org") by ftp.linux-mips.org with ESMTP
	id S8133371AbWBGMux (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 7 Feb 2006 12:50:53 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by bacchus.dhis.org (8.13.4/8.13.4) with ESMTP id k17CuetS005427;
	Tue, 7 Feb 2006 12:56:41 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.4/8.13.4/Submit) id k16NOlwn004987;
	Mon, 6 Feb 2006 23:24:47 GMT
Date:	Mon, 6 Feb 2006 23:24:47 +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] use CONFIG_64BIT for /proc/kcore fix
Message-ID: <20060206232447.GB4225@linux-mips.org>
References: <20050121005954.GA10260@nevyn.them.org> <20050214020209.GA25335@nevyn.them.org> <20060116155343.GE26771@deprecation.cyrius.com> <20060206.224231.126575297.anemo@mba.ocn.ne.jp>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20060206.224231.126575297.anemo@mba.ocn.ne.jp>
User-Agent: Mutt/1.4.2.1i
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: 10357
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
Content-Length: 146
Lines: 7

On Mon, Feb 06, 2006 at 10:42:31PM +0900, Atsushi Nemoto wrote:

> CONFIG_MIPS64 was replaced by CONFIG_64BIT a while ago.

Applied also.

  Ralf

From ralf@linux-mips.org Tue Feb  7 12:52:32 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 07 Feb 2006 12:52:49 +0000 (GMT)
Received: from mipsfw.mips-uk.com ([194.74.144.146]:21261 "EHLO
	bacchus.dhis.org") by ftp.linux-mips.org with ESMTP
	id S8133379AbWBGMux (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 7 Feb 2006 12:50:53 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by bacchus.dhis.org (8.13.4/8.13.4) with ESMTP id k17CuetU005427;
	Tue, 7 Feb 2006 12:56:41 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.4/8.13.4/Submit) id k16NMk9g004942;
	Mon, 6 Feb 2006 23:22:46 GMT
Date:	Mon, 6 Feb 2006 23:22:46 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc:	macro@linux-mips.org, linux-mips@linux-mips.org
Subject: Re: [PATCH] TX49 MFC0 bug workaround
Message-ID: <20060206232246.GA4225@linux-mips.org>
References: <20060202172434.GE17352@linux-mips.org> <20060203.111012.130238823.nemoto@toshiba-tops.co.jp> <20060203144420.GA3375@linux-mips.org> <20060206.183655.129447619.nemoto@toshiba-tops.co.jp>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20060206.183655.129447619.nemoto@toshiba-tops.co.jp>
User-Agent: Mutt/1.4.2.1i
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: 10358
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
Content-Length: 175
Lines: 10

On Mon, Feb 06, 2006 at 06:36:55PM +0900, Atsushi Nemoto wrote:

> Thanks.  And please apply this also...
> 
> 
> Remove TX49XX_MFC0_WAR completely.

Applied, thanks.

  Ralf

From sshtylyov@ru.mvista.com Tue Feb  7 13:58:06 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 07 Feb 2006 13:58:16 +0000 (GMT)
Received: from rtsoft2.corbina.net ([85.21.88.2]:63181 "HELO
	mail.dev.rtsoft.ru") by ftp.linux-mips.org with SMTP
	id S8133371AbWBGN6G (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 7 Feb 2006 13:58:06 +0000
Received: (qmail 30854 invoked from network); 7 Feb 2006 14:03:36 -0000
Received: from wasted.dev.rtsoft.ru (HELO ?192.168.1.248?) (192.168.1.248)
  by mail.dev.rtsoft.ru with SMTP; 7 Feb 2006 14:03:36 -0000
Message-ID: <43E8A97F.3090208@ru.mvista.com>
Date:	Tue, 07 Feb 2006 17:06:55 +0300
From:	Sergei Shtylylov <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:	David Sanchez <david.sanchez@lexbox.fr>
CC:	linux-mips@linux-mips.org, Jordan Crouse <jordan.crouse@amd.com>
Subject: Re: Au1xx0: really set KSEG0 to uncached on reboot
References: <17AB476A04B7C842887E0EB1F268111E02746A@xpserver.intra.lexbox.org>
In-Reply-To: <17AB476A04B7C842887E0EB1F268111E02746A@xpserver.intra.lexbox.org>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
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: 10359
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
Content-Length: 1529
Lines: 61

Hello.

David Sanchez wrote:
> Yes, I mean "freezes" :) 

> I have the BCSR fix applied.

> And the message "** Resetting Integrated Peripherals" comes from the arch/mips/au1000/common/reset.c file (I'm using the kernel 2.6.10).

    You're right, I'm wrong. :-)
    I'm using the same kernel for development (at least the same version of it 
:-), and it reboots OK.

> Maybe I forget to apply other patches...

    Can't say what other patches may concern this issue off the top of my head...

-----Message d'origine-----
> De : Sergei Shtylylov [mailto:sshtylyov@ru.mvista.com] 
> Envoyé : lundi 6 février 2006 18:46
> Ŕ : linux-mips@linux-mips.org
> Cc : Jordan Crouse; David Sanchez; Sergei Shtylylov
> Objet : Re: Au1xx0: really set KSEG0 to uncached on reboot
> 
> Hello.
> 
> Jordan Crouse wrote:
> 
>>On 06/02/06 09:10 +0100, David Sanchez wrote:
>>
>>
>>>Hi,
>>>
>>>This is exactly what I did...
>>>But I notice that sometimes it works and sometimes the kernel frees when 
> 
> 
>     You mean "freezes" probably? :-)
> 
> 
>>>"** Resetting Integrated Peripherals"
> 
> 
>     This is not kernel's msg, but YAMON's one...
> 
> 
>>We'll need to nail this down before we go any further.  Can we get a trace
>>of what happens when it crashes?
> 
> 
>     David, do you have BCSR fix from:
> 
> http://www.linux-mips.org/archives/linux-mips/2005-10/msg00236.html
> 
> applied (the recent kernel has it but which one are you using?)?
> DBAu1550 reset may not work as expeceted otherwise indeed...
> 
> 
>>Jordan

WBR, Sergei

From sshtylyov@ru.mvista.com Tue Feb  7 15:23:25 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 07 Feb 2006 15:23:34 +0000 (GMT)
Received: from rtsoft2.corbina.net ([85.21.88.2]:45449 "HELO
	mail.dev.rtsoft.ru") by ftp.linux-mips.org with SMTP
	id S8133369AbWBGPXZ (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 7 Feb 2006 15:23:25 +0000
Received: (qmail 1995 invoked from network); 7 Feb 2006 15:29:01 -0000
Received: from wasted.dev.rtsoft.ru (HELO ?192.168.1.248?) (192.168.1.248)
  by mail.dev.rtsoft.ru with SMTP; 7 Feb 2006 15:29:01 -0000
Message-ID: <43E8BD84.60308@ru.mvista.com>
Date:	Tue, 07 Feb 2006 18:32:20 +0300
From:	Sergei Shtylylov <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
CC:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>, linux-mips@linux-mips.org
Subject: Re: [PATCH] TX49 MFC0 bug workaround
References: <43E25381.4060309@ru.mvista.com>	<20060203.101705.41198541.nemoto@toshiba-tops.co.jp>	<43E2BC1F.7080505@ru.mvista.com> <20060203.112253.104030567.nemoto@toshiba-tops.co.jp>
In-Reply-To: <20060203.112253.104030567.nemoto@toshiba-tops.co.jp>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
To:	unlisted-recipients:; (no To-header on input)
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: 10360
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
Content-Length: 700
Lines: 21

Hello.

Atsushi Nemoto wrote:
>>>>>>On Fri, 03 Feb 2006 05:12:47 +0300, Sergei Shtylylov <sshtylyov@ru.mvista.com> said:
> 
> sshtylyov>     If I don't mistake, the offending code is in
> sshtylyov> local_irq_disable, local_irq_save, and local_irq_restore
> sshtylyov> macros. The effect would be a crash on any exception taken
> sshtylyov> once interrupts get disabled in a module (*and* that code
> sshtylyov> happens to fall on a page boundary)... nasty. :-(

    ... and yet worse: any external interrupts actually blocked from CPU 
forever by Status.EXL set (which then will never be cleared after the errata 
triggers).

> Right.  And it can really happen.

> ---
> Atsushi Nemoto

WBR, Sergei

From anemo@mba.ocn.ne.jp Tue Feb  7 16:42:44 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 07 Feb 2006 16:42:58 +0000 (GMT)
Received: from mba.ocn.ne.jp ([210.190.142.172]:22470 "HELO smtp.mba.ocn.ne.jp")
	by ftp.linux-mips.org with SMTP id S8133389AbWBGQmo (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Tue, 7 Feb 2006 16:42:44 +0000
Received: from localhost (p1079-ipad209funabasi.chiba.ocn.ne.jp [58.88.112.79])
	by smtp.mba.ocn.ne.jp (Postfix) with ESMTP
	id A54DFA267; Wed,  8 Feb 2006 01:48:21 +0900 (JST)
Date:	Wed, 08 Feb 2006 01:48:03 +0900 (JST)
Message-Id: <20060208.014803.74752750.anemo@mba.ocn.ne.jp>
To:	linux-mips@linux-mips.org
Cc:	ralf@linux-mips.org
Subject: Re: [PATCH] rewrite get_wchan and its helper functions
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
In-Reply-To: <20051115.011721.25910359.anemo@mba.ocn.ne.jp>
References: <20051115.011721.25910359.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: 10361
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
Content-Length: 7335
Lines: 265

>>>>> On Tue, 15 Nov 2005 01:17:21 +0900 (JST), Atsushi Nemoto <anemo@mba.ocn.ne.jp> said:

anemo> Implement get_wchan and frame_info_init using kallsyms_lookup.

Updated.

Implement get_wchan() and frame_info_init() using kallsyms_lookup().
This fixes problem with static sched/lock functions and mfinfo[]
maintenance issue.  If CONFIG_KALLSYMS was disabled, get_wchan() just
returns thread_saved_pc() value.

Also unwind stackframe based on "addiu sp,-imm" analysis instead of
frame pointer.  This fixes problem with functions compiled without
-fomit-frame-pointer.

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

diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index fa98f10..376dbc4 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -24,6 +24,7 @@
 #include <linux/a.out.h>
 #include <linux/init.h>
 #include <linux/completion.h>
+#include <linux/kallsyms.h>
 
 #include <asm/abi.h>
 #include <asm/bootinfo.h>
@@ -271,46 +272,19 @@ long kernel_thread(int (*fn)(void *), vo
 
 static struct mips_frame_info {
 	void *func;
-	int omit_fp;	/* compiled without fno-omit-frame-pointer */
-	int frame_offset;
+	unsigned long func_size;
+	int frame_size;
 	int pc_offset;
-} schedule_frame, mfinfo[] = {
-	{ schedule, 0 },	/* must be first */
-	/* arch/mips/kernel/semaphore.c */
-	{ __down, 1 },
-	{ __down_interruptible, 1 },
-	/* kernel/sched.c */
-#ifdef CONFIG_PREEMPT
-	{ preempt_schedule, 0 },
-#endif
-	{ wait_for_completion, 0 },
-	{ interruptible_sleep_on, 0 },
-	{ interruptible_sleep_on_timeout, 0 },
-	{ sleep_on, 0 },
-	{ sleep_on_timeout, 0 },
-	{ yield, 0 },
-	{ io_schedule, 0 },
-	{ io_schedule_timeout, 0 },
-#if defined(CONFIG_SMP) && defined(CONFIG_PREEMPT)
-	{ __preempt_spin_lock, 0 },
-	{ __preempt_write_lock, 0 },
-#endif
-	/* kernel/timer.c */
-	{ schedule_timeout, 1 },
-/*	{ nanosleep_restart, 1 }, */
-	/* lib/rwsem-spinlock.c */
-	{ __down_read, 1 },
-	{ __down_write, 1 },
-};
+} *schedule_frame, mfinfo[64];
+static int mfinfo_num;
 
-static int mips_frame_info_initialized;
 static int __init get_frame_info(struct mips_frame_info *info)
 {
 	int i;
 	void *func = info->func;
 	union mips_instruction *ip = (union mips_instruction *)func;
 	info->pc_offset = -1;
-	info->frame_offset = info->omit_fp ? 0 : -1;
+	info->frame_size = 0;
 	for (i = 0; i < 128; i++, ip++) {
 		/* if jal, jalr, jr, stop. */
 		if (ip->j_format.opcode == jal_op ||
@@ -319,6 +293,23 @@ static int __init get_frame_info(struct 
 		      ip->r_format.func == jr_op)))
 			break;
 
+		if (info->func_size && i >= info->func_size / 4)
+			break;
+		if (
+#ifdef CONFIG_32BIT
+		    ip->i_format.opcode == addiu_op &&
+#endif
+#ifdef CONFIG_64BIT
+		    ip->i_format.opcode == daddiu_op &&
+#endif
+		    ip->i_format.rs == 29 &&
+		    ip->i_format.rt == 29) {
+			/* addiu/daddiu sp,sp,-imm */
+			if (info->frame_size)
+				continue;
+			info->frame_size = - ip->i_format.simmediate;
+		}
+
 		if (
 #ifdef CONFIG_32BIT
 		    ip->i_format.opcode == sw_op &&
@@ -326,31 +317,20 @@ static int __init get_frame_info(struct 
 #ifdef CONFIG_64BIT
 		    ip->i_format.opcode == sd_op &&
 #endif
-		    ip->i_format.rs == 29)
-		{
+		    ip->i_format.rs == 29 &&
+		    ip->i_format.rt == 31) {
 			/* sw / sd $ra, offset($sp) */
-			if (ip->i_format.rt == 31) {
-				if (info->pc_offset != -1)
-					continue;
-				info->pc_offset =
-					ip->i_format.simmediate / sizeof(long);
-			}
-			/* sw / sd $s8, offset($sp) */
-			if (ip->i_format.rt == 30) {
-//#if 0	/* gcc 3.4 does aggressive optimization... */
-				if (info->frame_offset != -1)
-					continue;
-//#endif
-				info->frame_offset =
-					ip->i_format.simmediate / sizeof(long);
-			}
+			if (info->pc_offset != -1)
+				continue;
+			info->pc_offset =
+				ip->i_format.simmediate / sizeof(long);
 		}
 	}
-	if (info->pc_offset == -1 || info->frame_offset == -1) {
-		printk("Can't analyze prologue code at %p\n", func);
+	if (info->pc_offset == -1 || info->frame_size == 0) {
+		if (func == schedule)
+			printk("Can't analyze prologue code at %p\n", func);
 		info->pc_offset = -1;
-		info->frame_offset = -1;
-		return -1;
+		info->frame_size = 0;
 	}
 
 	return 0;
@@ -358,25 +338,36 @@ static int __init get_frame_info(struct 
 
 static int __init frame_info_init(void)
 {
-	int i, found;
-	for (i = 0; i < ARRAY_SIZE(mfinfo); i++)
-		if (get_frame_info(&mfinfo[i]))
-			return -1;
-	schedule_frame = mfinfo[0];
-	/* bubble sort */
-	do {
-		struct mips_frame_info tmp;
-		found = 0;
-		for (i = 1; i < ARRAY_SIZE(mfinfo); i++) {
-			if (mfinfo[i-1].func > mfinfo[i].func) {
-				tmp = mfinfo[i];
-				mfinfo[i] = mfinfo[i-1];
-				mfinfo[i-1] = tmp;
-				found = 1;
-			}
-		}
-	} while (found);
-	mips_frame_info_initialized = 1;
+	int i;
+#ifdef CONFIG_KALLSYMS
+	char *modname;
+	char namebuf[KSYM_NAME_LEN + 1];
+	unsigned long start, size, ofs;
+	extern char __sched_text_start[], __sched_text_end[];
+	extern char __lock_text_start[], __lock_text_end[];
+
+	start = (unsigned long)__sched_text_start;
+	for (i = 0; i < ARRAY_SIZE(mfinfo); i++) {
+		if (start == (unsigned long)schedule)
+			schedule_frame = &mfinfo[i];
+		if (!kallsyms_lookup(start, &size, &ofs, &modname, namebuf))
+			break;
+		mfinfo[i].func = (void *)(start + ofs);
+		mfinfo[i].func_size = size;
+		start += size - ofs;
+		if (start >= (unsigned long)__lock_text_end)
+			break;
+		if (start == (unsigned long)__sched_text_end)
+			start = (unsigned long)__lock_text_start;
+	}
+#else
+	mfinfo[0].func = schedule;
+	schedule_frame = &mfinfo[0];
+#endif
+	for (i = 0; i < ARRAY_SIZE(mfinfo) && mfinfo[i].func; i++)
+		get_frame_info(&mfinfo[i]);
+	
+	mfinfo_num = i;
 	return 0;
 }
 
@@ -393,47 +384,52 @@ unsigned long thread_saved_pc(struct tas
 	if (t->reg31 == (unsigned long) ret_from_fork)
 		return t->reg31;
 
-	if (schedule_frame.pc_offset < 0)
+	if (!schedule_frame || schedule_frame->pc_offset < 0)
 		return 0;
-	return ((unsigned long *)t->reg29)[schedule_frame.pc_offset];
+	return ((unsigned long *)t->reg29)[schedule_frame->pc_offset];
 }
 
 /* get_wchan - a maintenance nightmare^W^Wpain in the ass ...  */
 unsigned long get_wchan(struct task_struct *p)
 {
 	unsigned long stack_page;
-	unsigned long frame, pc;
+	unsigned long pc;
+#ifdef CONFIG_KALLSYMS
+	unsigned long frame;
+#endif
 
 	if (!p || p == current || p->state == TASK_RUNNING)
 		return 0;
 
 	stack_page = (unsigned long)task_stack_page(p);
-	if (!stack_page || !mips_frame_info_initialized)
+	if (!stack_page || !mfinfo_num)
 		return 0;
 
 	pc = thread_saved_pc(p);
+#ifdef CONFIG_KALLSYMS
 	if (!in_sched_functions(pc))
 		return pc;
 
-	frame = ((unsigned long *)p->thread.reg30)[schedule_frame.frame_offset];
+	frame = p->thread.reg29 + schedule_frame->frame_size;
 	do {
 		int i;
 
 		if (frame < stack_page || frame > stack_page + THREAD_SIZE - 32)
 			return 0;
 
-		for (i = ARRAY_SIZE(mfinfo) - 1; i >= 0; i--) {
+		for (i = mfinfo_num - 1; i >= 0; i--) {
 			if (pc >= (unsigned long) mfinfo[i].func)
 				break;
 		}
 		if (i < 0)
 			break;
 
-		if (mfinfo[i].omit_fp)
-			break;
 		pc = ((unsigned long *)frame)[mfinfo[i].pc_offset];
-		frame = ((unsigned long *)frame)[mfinfo[i].frame_offset];
+		if (!mfinfo[i].frame_size)
+			break;
+		frame += mfinfo[i].frame_size;
 	} while (in_sched_functions(pc));
+#endif
 
 	return pc;
 }

From anemo@mba.ocn.ne.jp Tue Feb  7 16:46:49 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 07 Feb 2006 16:47:02 +0000 (GMT)
Received: from mba.ocn.ne.jp ([210.190.142.172]:51704 "HELO smtp.mba.ocn.ne.jp")
	by ftp.linux-mips.org with SMTP id S8133389AbWBGQqt (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Tue, 7 Feb 2006 16:46:49 +0000
Received: from localhost (p1079-ipad209funabasi.chiba.ocn.ne.jp [58.88.112.79])
	by smtp.mba.ocn.ne.jp (Postfix) with ESMTP
	id E2B399811; Wed,  8 Feb 2006 01:52:27 +0900 (JST)
Date:	Wed, 08 Feb 2006 01:52:09 +0900 (JST)
Message-Id: <20060208.015209.126139576.anemo@mba.ocn.ne.jp>
To:	linux-mips@linux-mips.org
Cc:	ralf@linux-mips.org
Subject: Re: [PATCH] fix possible sleeping in atomic on setup/restore
 sigcontext
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
In-Reply-To: <20051007.235152.75184664.anemo@mba.ocn.ne.jp>
References: <20051007.235152.75184664.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: 10362
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
Content-Length: 4015
Lines: 125

>>>>> On Fri, 07 Oct 2005 23:51:52 +0900 (JST), Atsushi Nemoto <anemo@mba.ocn.ne.jp> said:

anemo> The setup_sigcontect/restore_sigcontext might sleep on
anemo> put_user/get_user with preemption disabled (i.e. atomic
anemo> context).  Sleeping in atomic context is not allowed.  This
anemo> patch fixes this problem using temporary variable (struct
anemo> sigcontext tmpsc).

anemo> Another possible fix might be rewriting
anemo> restore_fp_context/save_fp_context to copy to/from current
anemo> thread_struct and use them with restore_fp/save_fp.

Updated.  And I'll post the "another possible fix" in next mail.  If
the another one was accepted, please ignore this patch.


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 using temporary variable (struct sigcontext tmpsc).

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

diff --git a/arch/mips/kernel/signal-common.h b/arch/mips/kernel/signal-common.h
index 0fbc492..0c7726a 100644
--- a/arch/mips/kernel/signal-common.h
+++ b/arch/mips/kernel/signal-common.h
@@ -14,6 +14,7 @@ static inline int
 setup_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
 {
 	int err = 0;
+	struct sigcontext tmpsc;
 
 	err |= __put_user(regs->cp0_epc, &sc->sc_pc);
 
@@ -73,10 +74,15 @@ setup_sigcontext(struct pt_regs *regs, s
 		own_fpu();
 		restore_fp(current);
 	}
-	err |= save_fp_context(sc);
+	/* make sure save_fp_context not sleep */
+	err |= save_fp_context(&tmpsc);
 
 	preempt_enable();
 
+	err |= __copy_to_user(&sc->sc_fpregs, &tmpsc.sc_fpregs,
+			      sizeof(tmpsc.sc_fpregs));
+	err |= __put_user(tmpsc.sc_fpc_csr, &sc->sc_fpc_csr);
+
 out:
 	return err;
 }
@@ -138,14 +144,18 @@ restore_sigcontext(struct pt_regs *regs,
 	err |= __get_user(used_math, &sc->sc_used_math);
 	conditional_used_math(used_math);
 
-	preempt_disable();
-
 	if (used_math()) {
+		/* make sure restore_fp_context not sleep */
+		struct sigcontext tmpsc;
+		err |= __copy_from_user(&tmpsc.sc_fpregs, &sc->sc_fpregs, sizeof(tmpsc.sc_fpregs));
+		err |= __get_user(tmpsc.sc_fpc_csr, &sc->sc_fpc_csr);
+		preempt_disable();
 		/* restore fpu context if we have used it before */
 		own_fpu();
-		err |= restore_fp_context(sc);
+		err |= restore_fp_context(&tmpsc);
 	} else {
 		/* signal handler may have used FPU.  Give it up. */
+		preempt_disable();
 		lose_fpu();
 	}
 
diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c
index 136260c..4741d91 100644
--- a/arch/mips/kernel/signal32.c
+++ b/arch/mips/kernel/signal32.c
@@ -377,14 +377,18 @@ static int restore_sigcontext32(struct p
 	err |= __get_user(used_math, &sc->sc_used_math);
 	conditional_used_math(used_math);
 
-	preempt_disable();
-
 	if (used_math()) {
+		struct sigcontext32 tmpsc;
+		/* make sure restore_fp_context32 not sleep */
+		err |= __copy_from_user(&tmpsc.sc_fpregs, &sc->sc_fpregs, sizeof(tmpsc.sc_fpregs));
+		err |= __get_user(tmpsc.sc_fpc_csr, &sc->sc_fpc_csr);
+		preempt_disable();
 		/* restore fpu context if we have used it before */
 		own_fpu();
-		err |= restore_fp_context32(sc);
+		err |= restore_fp_context32(&tmpsc);
 	} else {
 		/* signal handler may have used FPU.  Give it up. */
+		preempt_disable();
 		lose_fpu();
 	}
 
@@ -568,6 +572,7 @@ static inline int setup_sigcontext32(str
 				     struct sigcontext32 __user *sc)
 {
 	int err = 0;
+	struct sigcontext32 tmpsc;
 
 	err |= __put_user(regs->cp0_epc, &sc->sc_pc);
 	err |= __put_user(regs->cp0_status, &sc->sc_status);
@@ -613,10 +618,15 @@ static inline int setup_sigcontext32(str
 		own_fpu();
 		restore_fp(current);
 	}
-	err |= save_fp_context32(sc);
+	/* make sure save_fp_context32 not sleep */
+	err |= save_fp_context32(&tmpsc);
 
 	preempt_enable();
 
+	err |= __copy_to_user(&sc->sc_fpregs, &tmpsc.sc_fpregs,
+			      sizeof(tmpsc.sc_fpregs));
+	err |= __put_user(tmpsc.sc_fpc_csr, &sc->sc_fpc_csr);
+
 out:
 	return err;
 }

From anemo@mba.ocn.ne.jp Tue Feb  7 16:47:36 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 07 Feb 2006 16:48:10 +0000 (GMT)
Received: from mba.ocn.ne.jp ([210.190.142.172]:20161 "HELO smtp.mba.ocn.ne.jp")
	by ftp.linux-mips.org with SMTP id S8133407AbWBGQrd (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Tue, 7 Feb 2006 16:47:33 +0000
Received: from localhost (p1079-ipad209funabasi.chiba.ocn.ne.jp [58.88.112.79])
	by smtp.mba.ocn.ne.jp (Postfix) with ESMTP
	id A328710AE; Wed,  8 Feb 2006 01:53:08 +0900 (JST)
Date:	Wed, 08 Feb 2006 01:52:50 +0900 (JST)
Message-Id: <20060208.015250.130239257.anemo@mba.ocn.ne.jp>
To:	linux-mips@linux-mips.org
Cc:	ralf@linux-mips.org
Subject: [PATCH] rewrite restore_fp_context/save_fp_context
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: 10363
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
Content-Length: 26129
Lines: 906

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().

A path to save fp context was:
	(current.thread.fpu -> ) real FPU -> sigcontext on userstack

And with this patch it is:
	(real FPU -> ) current.thread.fpu -> sigcontext on userstack

While transfer between real FPU and current.thread.fpu can be done by
usual context save/restore routines, all arch/mips/kernel/*_fpu.S and
SC_ symbols in asm-offset.h can be removed.

 arch/mips/kernel/Makefile             |   36 +++---
 arch/mips/kernel/r2300_fpu.S          |  126 ----------------------
 arch/mips/kernel/r4k_fpu.S            |  188 ----------------------------------
 arch/mips/kernel/r6000_fpu.S          |   87 ---------------
 b/arch/mips/kernel/asm-offsets.c      |   47 --------
 b/arch/mips/kernel/signal-common.h    |   56 +++++++---
 b/arch/mips/kernel/signal32.c         |   54 +++++++--
 b/arch/mips/kernel/traps.c            |   54 ---------
 b/arch/mips/math-emu/kernel_linkage.c |   73 -------------
 b/include/asm-mips/fpu.h              |    9 -
 10 files changed, 104 insertions(+), 626 deletions(-)

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

diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
index f36c4f2..b2fe980 100644
--- a/arch/mips/kernel/Makefile
+++ b/arch/mips/kernel/Makefile
@@ -13,24 +13,24 @@ binfmt_irix-objs	:= irixelf.o irixinv.o 
 
 obj-$(CONFIG_MODULES)		+= mips_ksyms.o module.o
 
-obj-$(CONFIG_CPU_R3000)		+= r2300_fpu.o r2300_switch.o
-obj-$(CONFIG_CPU_TX39XX)	+= r2300_fpu.o r2300_switch.o
-obj-$(CONFIG_CPU_TX49XX)	+= r4k_fpu.o r4k_switch.o
-obj-$(CONFIG_CPU_R4000)		+= r4k_fpu.o r4k_switch.o
-obj-$(CONFIG_CPU_VR41XX)	+= r4k_fpu.o r4k_switch.o
-obj-$(CONFIG_CPU_R4300)		+= r4k_fpu.o r4k_switch.o
-obj-$(CONFIG_CPU_R4X00)		+= r4k_fpu.o r4k_switch.o
-obj-$(CONFIG_CPU_R5000)		+= r4k_fpu.o r4k_switch.o
-obj-$(CONFIG_CPU_R5432)		+= r4k_fpu.o r4k_switch.o
-obj-$(CONFIG_CPU_R8000)		+= r4k_fpu.o r4k_switch.o
-obj-$(CONFIG_CPU_RM7000)	+= r4k_fpu.o r4k_switch.o
-obj-$(CONFIG_CPU_RM9000)	+= r4k_fpu.o r4k_switch.o
-obj-$(CONFIG_CPU_NEVADA)	+= r4k_fpu.o r4k_switch.o
-obj-$(CONFIG_CPU_R10000)	+= r4k_fpu.o r4k_switch.o
-obj-$(CONFIG_CPU_SB1)		+= r4k_fpu.o r4k_switch.o
-obj-$(CONFIG_CPU_MIPS32)	+= r4k_fpu.o r4k_switch.o
-obj-$(CONFIG_CPU_MIPS64)	+= r4k_fpu.o r4k_switch.o
-obj-$(CONFIG_CPU_R6000)		+= r6000_fpu.o r4k_switch.o
+obj-$(CONFIG_CPU_R3000)		+= r2300_switch.o
+obj-$(CONFIG_CPU_TX39XX)	+= r2300_switch.o
+obj-$(CONFIG_CPU_TX49XX)	+= r4k_switch.o
+obj-$(CONFIG_CPU_R4000)		+= r4k_switch.o
+obj-$(CONFIG_CPU_VR41XX)	+= r4k_switch.o
+obj-$(CONFIG_CPU_R4300)		+= r4k_switch.o
+obj-$(CONFIG_CPU_R4X00)		+= r4k_switch.o
+obj-$(CONFIG_CPU_R5000)		+= r4k_switch.o
+obj-$(CONFIG_CPU_R5432)		+= r4k_switch.o
+obj-$(CONFIG_CPU_R8000)		+= r4k_switch.o
+obj-$(CONFIG_CPU_RM7000)	+= r4k_switch.o
+obj-$(CONFIG_CPU_RM9000)	+= r4k_switch.o
+obj-$(CONFIG_CPU_NEVADA)	+= r4k_switch.o
+obj-$(CONFIG_CPU_R10000)	+= r4k_switch.o
+obj-$(CONFIG_CPU_SB1)		+= r4k_switch.o
+obj-$(CONFIG_CPU_MIPS32)	+= r4k_switch.o
+obj-$(CONFIG_CPU_MIPS64)	+= r4k_switch.o
+obj-$(CONFIG_CPU_R6000)		+= r4k_switch.o
 
 obj-$(CONFIG_SMP)		+= smp.o
 
diff --git a/arch/mips/kernel/asm-offsets.c b/arch/mips/kernel/asm-offsets.c
index ca6b03c..d7e7026 100644
--- a/arch/mips/kernel/asm-offsets.c
+++ b/arch/mips/kernel/asm-offsets.c
@@ -241,53 +241,6 @@ void output_mm_defines(void)
 	linefeed;
 }
 
-#ifdef CONFIG_32BIT
-void output_sc_defines(void)
-{
-	text("/* Linux sigcontext offsets. */");
-	offset("#define SC_REGS       ", struct sigcontext, sc_regs);
-	offset("#define SC_FPREGS     ", struct sigcontext, sc_fpregs);
-	offset("#define SC_MDHI       ", struct sigcontext, sc_mdhi);
-	offset("#define SC_MDLO       ", struct sigcontext, sc_mdlo);
-	offset("#define SC_PC         ", struct sigcontext, sc_pc);
-	offset("#define SC_STATUS     ", struct sigcontext, sc_status);
-	offset("#define SC_FPC_CSR    ", struct sigcontext, sc_fpc_csr);
-	offset("#define SC_FPC_EIR    ", struct sigcontext, sc_fpc_eir);
-	offset("#define SC_HI1        ", struct sigcontext, sc_hi1);
-	offset("#define SC_LO1        ", struct sigcontext, sc_lo1);
-	offset("#define SC_HI2        ", struct sigcontext, sc_hi2);
-	offset("#define SC_LO2        ", struct sigcontext, sc_lo2);
-	offset("#define SC_HI3        ", struct sigcontext, sc_hi3);
-	offset("#define SC_LO3        ", struct sigcontext, sc_lo3);
-	linefeed;
-}
-#endif
-
-#ifdef CONFIG_64BIT
-void output_sc_defines(void)
-{
-	text("/* Linux sigcontext offsets. */");
-	offset("#define SC_REGS       ", struct sigcontext, sc_regs);
-	offset("#define SC_FPREGS     ", struct sigcontext, sc_fpregs);
-	offset("#define SC_MDHI       ", struct sigcontext, sc_hi);
-	offset("#define SC_MDLO       ", struct sigcontext, sc_lo);
-	offset("#define SC_PC         ", struct sigcontext, sc_pc);
-	offset("#define SC_FPC_CSR    ", struct sigcontext, sc_fpc_csr);
-	linefeed;
-}
-#endif
-
-#ifdef CONFIG_MIPS32_COMPAT
-void output_sc32_defines(void)
-{
-	text("/* Linux 32-bit sigcontext offsets. */");
-	offset("#define SC32_FPREGS     ", struct sigcontext32, sc_fpregs);
-	offset("#define SC32_FPC_CSR    ", struct sigcontext32, sc_fpc_csr);
-	offset("#define SC32_FPC_EIR    ", struct sigcontext32, sc_fpc_eir);
-	linefeed;
-}
-#endif
-
 void output_signal_defined(void)
 {
 	text("/* Linux signal numbers. */");
diff --git a/arch/mips/kernel/r2300_fpu.S b/arch/mips/kernel/r2300_fpu.S
deleted file mode 100644
index ac68e68..0000000
--- a/arch/mips/kernel/r2300_fpu.S
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 1996, 1998 by Ralf Baechle
- *
- * Multi-arch abstraction and asm macros for easier reading:
- * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
- *
- * Further modifications to make this work:
- * Copyright (c) 1998 Harald Koerfgen
- */
-#include <asm/asm.h>
-#include <asm/errno.h>
-#include <asm/fpregdef.h>
-#include <asm/mipsregs.h>
-#include <asm/asm-offsets.h>
-#include <asm/regdef.h>
-
-#define EX(a,b)							\
-9:	a,##b;							\
-	.section __ex_table,"a";				\
-	PTR	9b,bad_stack;					\
-	.previous
-
-	.set	noreorder
-	.set	mips1
-	/* Save floating point context */
-LEAF(_save_fp_context)
-	li	v0, 0					# assume success
-	cfc1	t1,fcr31
-	EX(swc1	$f0,(SC_FPREGS+0)(a0))
-	EX(swc1	$f1,(SC_FPREGS+8)(a0))
-	EX(swc1	$f2,(SC_FPREGS+16)(a0))
-	EX(swc1	$f3,(SC_FPREGS+24)(a0))
-	EX(swc1	$f4,(SC_FPREGS+32)(a0))
-	EX(swc1	$f5,(SC_FPREGS+40)(a0))
-	EX(swc1	$f6,(SC_FPREGS+48)(a0))
-	EX(swc1	$f7,(SC_FPREGS+56)(a0))
-	EX(swc1	$f8,(SC_FPREGS+64)(a0))
-	EX(swc1	$f9,(SC_FPREGS+72)(a0))
-	EX(swc1	$f10,(SC_FPREGS+80)(a0))
-	EX(swc1	$f11,(SC_FPREGS+88)(a0))
-	EX(swc1	$f12,(SC_FPREGS+96)(a0))
-	EX(swc1	$f13,(SC_FPREGS+104)(a0))
-	EX(swc1	$f14,(SC_FPREGS+112)(a0))
-	EX(swc1	$f15,(SC_FPREGS+120)(a0))
-	EX(swc1	$f16,(SC_FPREGS+128)(a0))
-	EX(swc1	$f17,(SC_FPREGS+136)(a0))
-	EX(swc1	$f18,(SC_FPREGS+144)(a0))
-	EX(swc1	$f19,(SC_FPREGS+152)(a0))
-	EX(swc1	$f20,(SC_FPREGS+160)(a0))
-	EX(swc1	$f21,(SC_FPREGS+168)(a0))
-	EX(swc1	$f22,(SC_FPREGS+176)(a0))
-	EX(swc1	$f23,(SC_FPREGS+184)(a0))
-	EX(swc1	$f24,(SC_FPREGS+192)(a0))
-	EX(swc1	$f25,(SC_FPREGS+200)(a0))
-	EX(swc1	$f26,(SC_FPREGS+208)(a0))
-	EX(swc1	$f27,(SC_FPREGS+216)(a0))
-	EX(swc1	$f28,(SC_FPREGS+224)(a0))
-	EX(swc1	$f29,(SC_FPREGS+232)(a0))
-	EX(swc1	$f30,(SC_FPREGS+240)(a0))
-	EX(swc1	$f31,(SC_FPREGS+248)(a0))
-	EX(sw	t1,(SC_FPC_CSR)(a0))
-	cfc1	t0,$0				# implementation/version
-	jr	ra
-	.set	nomacro
-	 EX(sw	t0,(SC_FPC_EIR)(a0))
-	.set	macro
-	END(_save_fp_context)
-
-/*
- * Restore FPU state:
- *  - fp gp registers
- *  - cp1 status/control register
- *
- * We base the decision which registers to restore from the signal stack
- * frame on the current content of c0_status, not on the content of the
- * stack frame which might have been changed by the user.
- */
-LEAF(_restore_fp_context)
-	li	v0, 0					# assume success
-	EX(lw t0,(SC_FPC_CSR)(a0))
-	EX(lwc1	$f0,(SC_FPREGS+0)(a0))
-	EX(lwc1	$f1,(SC_FPREGS+8)(a0))
-	EX(lwc1	$f2,(SC_FPREGS+16)(a0))
-	EX(lwc1	$f3,(SC_FPREGS+24)(a0))
-	EX(lwc1	$f4,(SC_FPREGS+32)(a0))
-	EX(lwc1	$f5,(SC_FPREGS+40)(a0))
-	EX(lwc1	$f6,(SC_FPREGS+48)(a0))
-	EX(lwc1	$f7,(SC_FPREGS+56)(a0))
-	EX(lwc1	$f8,(SC_FPREGS+64)(a0))
-	EX(lwc1	$f9,(SC_FPREGS+72)(a0))
-	EX(lwc1	$f10,(SC_FPREGS+80)(a0))
-	EX(lwc1	$f11,(SC_FPREGS+88)(a0))
-	EX(lwc1	$f12,(SC_FPREGS+96)(a0))
-	EX(lwc1	$f13,(SC_FPREGS+104)(a0))
-	EX(lwc1	$f14,(SC_FPREGS+112)(a0))
-	EX(lwc1	$f15,(SC_FPREGS+120)(a0))
-	EX(lwc1	$f16,(SC_FPREGS+128)(a0))
-	EX(lwc1	$f17,(SC_FPREGS+136)(a0))
-	EX(lwc1	$f18,(SC_FPREGS+144)(a0))
-	EX(lwc1	$f19,(SC_FPREGS+152)(a0))
-	EX(lwc1	$f20,(SC_FPREGS+160)(a0))
-	EX(lwc1	$f21,(SC_FPREGS+168)(a0))
-	EX(lwc1	$f22,(SC_FPREGS+176)(a0))
-	EX(lwc1	$f23,(SC_FPREGS+184)(a0))
-	EX(lwc1	$f24,(SC_FPREGS+192)(a0))
-	EX(lwc1	$f25,(SC_FPREGS+200)(a0))
-	EX(lwc1	$f26,(SC_FPREGS+208)(a0))
-	EX(lwc1	$f27,(SC_FPREGS+216)(a0))
-	EX(lwc1	$f28,(SC_FPREGS+224)(a0))
-	EX(lwc1	$f29,(SC_FPREGS+232)(a0))
-	EX(lwc1	$f30,(SC_FPREGS+240)(a0))
-	EX(lwc1	$f31,(SC_FPREGS+248)(a0))
-	jr	ra
-	 ctc1	t0,fcr31
-	END(_restore_fp_context)
-	.set	reorder
-
-	.type	fault@function
-	.ent	fault
-fault:	li	v0, -EFAULT
-	jr	ra
-	.end	fault
diff --git a/arch/mips/kernel/r4k_fpu.S b/arch/mips/kernel/r4k_fpu.S
deleted file mode 100644
index 283a985..0000000
--- a/arch/mips/kernel/r4k_fpu.S
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 1996, 98, 99, 2000, 01 Ralf Baechle
- *
- * Multi-arch abstraction and asm macros for easier reading:
- * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
- *
- * Carsten Langgaard, carstenl@mips.com
- * Copyright (C) 2000 MIPS Technologies, Inc.
- * Copyright (C) 1999, 2001 Silicon Graphics, Inc.
- */
-#include <linux/config.h>
-#include <asm/asm.h>
-#include <asm/errno.h>
-#include <asm/fpregdef.h>
-#include <asm/mipsregs.h>
-#include <asm/asm-offsets.h>
-#include <asm/regdef.h>
-
-	.macro	EX insn, reg, src
-	.set	push
-	.set	nomacro
-.ex\@:	\insn	\reg, \src
-	.set	pop
-	.section __ex_table,"a"
-	PTR	.ex\@, fault
-	.previous
-	.endm
-
-	.set	noreorder
-	.set	mips3
-
-LEAF(_save_fp_context)
-	cfc1	t1, fcr31
-
-#ifdef CONFIG_64BIT
-	/* Store the 16 odd double precision registers */
-	EX	sdc1 $f1, SC_FPREGS+8(a0)
-	EX	sdc1 $f3, SC_FPREGS+24(a0)
-	EX	sdc1 $f5, SC_FPREGS+40(a0)
-	EX	sdc1 $f7, SC_FPREGS+56(a0)
-	EX	sdc1 $f9, SC_FPREGS+72(a0)
-	EX	sdc1 $f11, SC_FPREGS+88(a0)
-	EX	sdc1 $f13, SC_FPREGS+104(a0)
-	EX	sdc1 $f15, SC_FPREGS+120(a0)
-	EX	sdc1 $f17, SC_FPREGS+136(a0)
-	EX	sdc1 $f19, SC_FPREGS+152(a0)
-	EX	sdc1 $f21, SC_FPREGS+168(a0)
-	EX	sdc1 $f23, SC_FPREGS+184(a0)
-	EX	sdc1 $f25, SC_FPREGS+200(a0)
-	EX	sdc1 $f27, SC_FPREGS+216(a0)
-	EX	sdc1 $f29, SC_FPREGS+232(a0)
-	EX	sdc1 $f31, SC_FPREGS+248(a0)
-#endif
-
-	/* Store the 16 even double precision registers */
-	EX	sdc1 $f0, SC_FPREGS+0(a0)
-	EX	sdc1 $f2, SC_FPREGS+16(a0)
-	EX	sdc1 $f4, SC_FPREGS+32(a0)
-	EX	sdc1 $f6, SC_FPREGS+48(a0)
-	EX	sdc1 $f8, SC_FPREGS+64(a0)
-	EX	sdc1 $f10, SC_FPREGS+80(a0)
-	EX	sdc1 $f12, SC_FPREGS+96(a0)
-	EX	sdc1 $f14, SC_FPREGS+112(a0)
-	EX	sdc1 $f16, SC_FPREGS+128(a0)
-	EX	sdc1 $f18, SC_FPREGS+144(a0)
-	EX	sdc1 $f20, SC_FPREGS+160(a0)
-	EX	sdc1 $f22, SC_FPREGS+176(a0)
-	EX	sdc1 $f24, SC_FPREGS+192(a0)
-	EX	sdc1 $f26, SC_FPREGS+208(a0)
-	EX	sdc1 $f28, SC_FPREGS+224(a0)
-	EX	sdc1 $f30, SC_FPREGS+240(a0)
-	EX	sw t1, SC_FPC_CSR(a0)
-	jr	ra
-	 li	v0, 0					# success
-	END(_save_fp_context)
-
-#ifdef CONFIG_MIPS32_COMPAT
-	/* Save 32-bit process floating point context */
-LEAF(_save_fp_context32)
-	cfc1	t1, fcr31
-
-	EX	sdc1 $f0, SC32_FPREGS+0(a0)
-	EX	sdc1 $f2, SC32_FPREGS+16(a0)
-	EX	sdc1 $f4, SC32_FPREGS+32(a0)
-	EX	sdc1 $f6, SC32_FPREGS+48(a0)
-	EX	sdc1 $f8, SC32_FPREGS+64(a0)
-	EX	sdc1 $f10, SC32_FPREGS+80(a0)
-	EX	sdc1 $f12, SC32_FPREGS+96(a0)
-	EX	sdc1 $f14, SC32_FPREGS+112(a0)
-	EX	sdc1 $f16, SC32_FPREGS+128(a0)
-	EX	sdc1 $f18, SC32_FPREGS+144(a0)
-	EX	sdc1 $f20, SC32_FPREGS+160(a0)
-	EX	sdc1 $f22, SC32_FPREGS+176(a0)
-	EX	sdc1 $f24, SC32_FPREGS+192(a0)
-	EX	sdc1 $f26, SC32_FPREGS+208(a0)
-	EX	sdc1 $f28, SC32_FPREGS+224(a0)
-	EX	sdc1 $f30, SC32_FPREGS+240(a0)
-	EX	sw t1, SC32_FPC_CSR(a0)
-	cfc1	t0, $0				# implementation/version
-	EX	sw t0, SC32_FPC_EIR(a0)
-
-	jr	ra
-	 li	v0, 0					# success
-	END(_save_fp_context32)
-#endif
-
-/*
- * Restore FPU state:
- *  - fp gp registers
- *  - cp1 status/control register
- */
-LEAF(_restore_fp_context)
-	EX	lw t0, SC_FPC_CSR(a0)
-#ifdef CONFIG_64BIT
-	EX	ldc1 $f1, SC_FPREGS+8(a0)
-	EX	ldc1 $f3, SC_FPREGS+24(a0)
-	EX	ldc1 $f5, SC_FPREGS+40(a0)
-	EX	ldc1 $f7, SC_FPREGS+56(a0)
-	EX	ldc1 $f9, SC_FPREGS+72(a0)
-	EX	ldc1 $f11, SC_FPREGS+88(a0)
-	EX	ldc1 $f13, SC_FPREGS+104(a0)
-	EX	ldc1 $f15, SC_FPREGS+120(a0)
-	EX	ldc1 $f17, SC_FPREGS+136(a0)
-	EX	ldc1 $f19, SC_FPREGS+152(a0)
-	EX	ldc1 $f21, SC_FPREGS+168(a0)
-	EX	ldc1 $f23, SC_FPREGS+184(a0)
-	EX	ldc1 $f25, SC_FPREGS+200(a0)
-	EX	ldc1 $f27, SC_FPREGS+216(a0)
-	EX	ldc1 $f29, SC_FPREGS+232(a0)
-	EX	ldc1 $f31, SC_FPREGS+248(a0)
-#endif
-	EX	ldc1 $f0, SC_FPREGS+0(a0)
-	EX	ldc1 $f2, SC_FPREGS+16(a0)
-	EX	ldc1 $f4, SC_FPREGS+32(a0)
-	EX	ldc1 $f6, SC_FPREGS+48(a0)
-	EX	ldc1 $f8, SC_FPREGS+64(a0)
-	EX	ldc1 $f10, SC_FPREGS+80(a0)
-	EX	ldc1 $f12, SC_FPREGS+96(a0)
-	EX	ldc1 $f14, SC_FPREGS+112(a0)
-	EX	ldc1 $f16, SC_FPREGS+128(a0)
-	EX	ldc1 $f18, SC_FPREGS+144(a0)
-	EX	ldc1 $f20, SC_FPREGS+160(a0)
-	EX	ldc1 $f22, SC_FPREGS+176(a0)
-	EX	ldc1 $f24, SC_FPREGS+192(a0)
-	EX	ldc1 $f26, SC_FPREGS+208(a0)
-	EX	ldc1 $f28, SC_FPREGS+224(a0)
-	EX	ldc1 $f30, SC_FPREGS+240(a0)
-	ctc1	t0, fcr31
-	jr	ra
-	 li	v0, 0					# success
-	END(_restore_fp_context)
-
-#ifdef CONFIG_MIPS32_COMPAT
-LEAF(_restore_fp_context32)
-	/* Restore an o32 sigcontext.  */
-	EX	lw t0, SC32_FPC_CSR(a0)
-	EX	ldc1 $f0, SC32_FPREGS+0(a0)
-	EX	ldc1 $f2, SC32_FPREGS+16(a0)
-	EX	ldc1 $f4, SC32_FPREGS+32(a0)
-	EX	ldc1 $f6, SC32_FPREGS+48(a0)
-	EX	ldc1 $f8, SC32_FPREGS+64(a0)
-	EX	ldc1 $f10, SC32_FPREGS+80(a0)
-	EX	ldc1 $f12, SC32_FPREGS+96(a0)
-	EX	ldc1 $f14, SC32_FPREGS+112(a0)
-	EX	ldc1 $f16, SC32_FPREGS+128(a0)
-	EX	ldc1 $f18, SC32_FPREGS+144(a0)
-	EX	ldc1 $f20, SC32_FPREGS+160(a0)
-	EX	ldc1 $f22, SC32_FPREGS+176(a0)
-	EX	ldc1 $f24, SC32_FPREGS+192(a0)
-	EX	ldc1 $f26, SC32_FPREGS+208(a0)
-	EX	ldc1 $f28, SC32_FPREGS+224(a0)
-	EX	ldc1 $f30, SC32_FPREGS+240(a0)
-	ctc1	t0, fcr31
-	jr	ra
-	 li	v0, 0					# success
-	END(_restore_fp_context32)
-	.set	reorder
-#endif
-
-	.type	fault@function
-	.ent	fault
-fault:	li	v0, -EFAULT				# failure
-	jr	ra
-	.end	fault
diff --git a/arch/mips/kernel/r6000_fpu.S b/arch/mips/kernel/r6000_fpu.S
deleted file mode 100644
index 43cda53..0000000
--- a/arch/mips/kernel/r6000_fpu.S
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * r6000_fpu.S: Save/restore floating point context for signal handlers.
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 1996 by Ralf Baechle
- *
- * Multi-arch abstraction and asm macros for easier reading:
- * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
- */
-#include <asm/asm.h>
-#include <asm/fpregdef.h>
-#include <asm/mipsregs.h>
-#include <asm/asm-offsets.h>
-#include <asm/regdef.h>
-
-	.set	noreorder
-	.set	mips2
-	/* Save floating point context */
-	LEAF(_save_fp_context)
-	mfc0	t0,CP0_STATUS
-	sll	t0,t0,2
-	bgez	t0,1f
-	 nop
-
-	cfc1	t1,fcr31
-	/* Store the 16 double precision registers */
-	sdc1	$f0,(SC_FPREGS+0)(a0)
-	sdc1	$f2,(SC_FPREGS+16)(a0)
-	sdc1	$f4,(SC_FPREGS+32)(a0)
-	sdc1	$f6,(SC_FPREGS+48)(a0)
-	sdc1	$f8,(SC_FPREGS+64)(a0)
-	sdc1	$f10,(SC_FPREGS+80)(a0)
-	sdc1	$f12,(SC_FPREGS+96)(a0)
-	sdc1	$f14,(SC_FPREGS+112)(a0)
-	sdc1	$f16,(SC_FPREGS+128)(a0)
-	sdc1	$f18,(SC_FPREGS+144)(a0)
-	sdc1	$f20,(SC_FPREGS+160)(a0)
-	sdc1	$f22,(SC_FPREGS+176)(a0)
-	sdc1	$f24,(SC_FPREGS+192)(a0)
-	sdc1	$f26,(SC_FPREGS+208)(a0)
-	sdc1	$f28,(SC_FPREGS+224)(a0)
-	sdc1	$f30,(SC_FPREGS+240)(a0)
-	jr	ra
-	 sw	t0,SC_FPC_CSR(a0)
-1:	jr	ra
-	 nop
-	END(_save_fp_context)
-
-/* Restore FPU state:
- *  - fp gp registers
- *  - cp1 status/control register
- *
- * We base the decision which registers to restore from the signal stack
- * frame on the current content of c0_status, not on the content of the
- * stack frame which might have been changed by the user.
- */
-	LEAF(_restore_fp_context)
-	mfc0	t0,CP0_STATUS
-	sll	t0,t0,2
-
-	bgez	t0,1f
-	 lw	t0,SC_FPC_CSR(a0)
-	/* Restore the 16 double precision registers */
-	ldc1	$f0,(SC_FPREGS+0)(a0)
-	ldc1	$f2,(SC_FPREGS+16)(a0)
-	ldc1	$f4,(SC_FPREGS+32)(a0)
-	ldc1	$f6,(SC_FPREGS+48)(a0)
-	ldc1	$f8,(SC_FPREGS+64)(a0)
-	ldc1	$f10,(SC_FPREGS+80)(a0)
-	ldc1	$f12,(SC_FPREGS+96)(a0)
-	ldc1	$f14,(SC_FPREGS+112)(a0)
-	ldc1	$f16,(SC_FPREGS+128)(a0)
-	ldc1	$f18,(SC_FPREGS+144)(a0)
-	ldc1	$f20,(SC_FPREGS+160)(a0)
-	ldc1	$f22,(SC_FPREGS+176)(a0)
-	ldc1	$f24,(SC_FPREGS+192)(a0)
-	ldc1	$f26,(SC_FPREGS+208)(a0)
-	ldc1	$f28,(SC_FPREGS+224)(a0)
-	ldc1	$f30,(SC_FPREGS+240)(a0)
-	jr	ra
-	 ctc1	t0,fcr31
-1:	jr	ra
-	 nop
-	END(_restore_fp_context)
diff --git a/arch/mips/kernel/signal-common.h b/arch/mips/kernel/signal-common.h
index 0fbc492..8488290 100644
--- a/arch/mips/kernel/signal-common.h
+++ b/arch/mips/kernel/signal-common.h
@@ -10,6 +10,42 @@
 
 #include <linux/config.h>
 
+/*
+ * Emulator context save/restore to/from a signal context
+ * presumed to be on the user stack, and therefore accessed
+ * with appropriate macros from uaccess.h
+ */
+
+static inline int save_fp_context(struct sigcontext __user *sc)
+{
+	int i;
+	int err = 0;
+
+	for (i = 0; i < 32; i++) {
+		err |=
+		    __put_user(current->thread.fpu.soft.fpr[i],
+			       &sc->sc_fpregs[i]);
+	}
+	err |= __put_user(current->thread.fpu.soft.fcr31, &sc->sc_fpc_csr);
+
+	return err;
+}
+
+static inline int restore_fp_context(struct sigcontext __user *sc)
+{
+	int i;
+	int err = 0;
+
+	for (i = 0; i < 32; i++) {
+		err |=
+		    __get_user(current->thread.fpu.soft.fpr[i],
+			       &sc->sc_fpregs[i]);
+	}
+	err |= __get_user(current->thread.fpu.soft.fcr31, &sc->sc_fpc_csr);
+
+	return err;
+}
+
 static inline int
 setup_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
 {
@@ -68,15 +104,14 @@ setup_sigcontext(struct pt_regs *regs, s
 	 * current FPU state.
 	 */
 	preempt_disable();
-
-	if (!is_fpu_owner()) {
-		own_fpu();
-		restore_fp(current);
+	if (is_fpu_owner()) {
+		/* save current context to task_struct */
+		save_fp(current);
+		lose_fpu();
 	}
-	err |= save_fp_context(sc);
-
 	preempt_enable();
 
+	err |= save_fp_context(sc);
 out:
 	return err;
 }
@@ -138,19 +173,16 @@ restore_sigcontext(struct pt_regs *regs,
 	err |= __get_user(used_math, &sc->sc_used_math);
 	conditional_used_math(used_math);
 
+	/* signal handler may have used FPU.  Give it up. */
 	preempt_disable();
+	lose_fpu();
+	preempt_enable();
 
 	if (used_math()) {
 		/* restore fpu context if we have used it before */
-		own_fpu();
 		err |= restore_fp_context(sc);
-	} else {
-		/* signal handler may have used FPU.  Give it up. */
-		lose_fpu();
 	}
 
-	preempt_enable();
-
 	return err;
 }
 
diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c
index 136260c..3db3ef0 100644
--- a/arch/mips/kernel/signal32.c
+++ b/arch/mips/kernel/signal32.c
@@ -336,6 +336,40 @@ asmlinkage int sys32_sigaltstack(nabi_no
 	return ret;
 }
 
+/*
+ * This is the o32 version
+ */
+
+static inline int save_fp_context32(struct sigcontext32 __user *sc)
+{
+	int i;
+	int err = 0;
+
+	for (i = 0; i < 32; i+=2) {
+		err |=
+		    __put_user(current->thread.fpu.soft.fpr[i],
+			       &sc->sc_fpregs[i]);
+	}
+	err |= __put_user(current->thread.fpu.soft.fcr31, &sc->sc_fpc_csr);
+
+	return err;
+}
+
+static inline int restore_fp_context32(struct sigcontext32 __user *sc)
+{
+	int i;
+	int err = 0;
+
+	for (i = 0; i < 32; i+=2) {
+		err |=
+		    __get_user(current->thread.fpu.soft.fpr[i],
+			       &sc->sc_fpregs[i]);
+	}
+	err |= __get_user(current->thread.fpu.soft.fcr31, &sc->sc_fpc_csr);
+
+	return err;
+}
+
 static int restore_sigcontext32(struct pt_regs *regs, struct sigcontext32 __user *sc)
 {
 	u32 used_math;
@@ -377,19 +411,16 @@ static int restore_sigcontext32(struct p
 	err |= __get_user(used_math, &sc->sc_used_math);
 	conditional_used_math(used_math);
 
+	/* signal handler may have used FPU.  Give it up. */
 	preempt_disable();
+	lose_fpu();
+	preempt_enable();
 
 	if (used_math()) {
 		/* restore fpu context if we have used it before */
-		own_fpu();
 		err |= restore_fp_context32(sc);
-	} else {
-		/* signal handler may have used FPU.  Give it up. */
-		lose_fpu();
 	}
 
-	preempt_enable();
-
 	return err;
 }
 
@@ -608,15 +639,14 @@ static inline int setup_sigcontext32(str
 	 * current FPU state.
 	 */
 	preempt_disable();
-
-	if (!is_fpu_owner()) {
-		own_fpu();
-		restore_fp(current);
+	if (is_fpu_owner()) {
+		/* save current context to task_struct */
+		save_fp(current);
+		lose_fpu();
 	}
-	err |= save_fp_context32(sc);
-
 	preempt_enable();
 
+	err |= save_fp_context32(sc);
 out:
 	return err;
 }
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index c9d2b51..528babe 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -1099,55 +1099,6 @@ void *set_vi_handler (int n, void *addr)
 }
 #endif
 
-/*
- * This is used by native signal handling
- */
-asmlinkage int (*save_fp_context)(struct sigcontext *sc);
-asmlinkage int (*restore_fp_context)(struct sigcontext *sc);
-
-extern asmlinkage int _save_fp_context(struct sigcontext *sc);
-extern asmlinkage int _restore_fp_context(struct sigcontext *sc);
-
-extern asmlinkage int fpu_emulator_save_context(struct sigcontext *sc);
-extern asmlinkage int fpu_emulator_restore_context(struct sigcontext *sc);
-
-static inline void signal_init(void)
-{
-	if (cpu_has_fpu) {
-		save_fp_context = _save_fp_context;
-		restore_fp_context = _restore_fp_context;
-	} else {
-		save_fp_context = fpu_emulator_save_context;
-		restore_fp_context = fpu_emulator_restore_context;
-	}
-}
-
-#ifdef CONFIG_MIPS32_COMPAT
-
-/*
- * This is used by 32-bit signal stuff on the 64-bit kernel
- */
-asmlinkage int (*save_fp_context32)(struct sigcontext32 *sc);
-asmlinkage int (*restore_fp_context32)(struct sigcontext32 *sc);
-
-extern asmlinkage int _save_fp_context32(struct sigcontext32 *sc);
-extern asmlinkage int _restore_fp_context32(struct sigcontext32 *sc);
-
-extern asmlinkage int fpu_emulator_save_context32(struct sigcontext32 *sc);
-extern asmlinkage int fpu_emulator_restore_context32(struct sigcontext32 *sc);
-
-static inline void signal32_init(void)
-{
-	if (cpu_has_fpu) {
-		save_fp_context32 = _save_fp_context32;
-		restore_fp_context32 = _restore_fp_context32;
-	} else {
-		save_fp_context32 = fpu_emulator_save_context32;
-		restore_fp_context32 = fpu_emulator_restore_context32;
-	}
-}
-#endif
-
 extern void cpu_cache_init(void);
 extern void tlb_init(void);
 extern void flush_tlb_handlers(void);
@@ -1352,11 +1303,6 @@ void __init trap_init(void)
 	else
 		memcpy((void *)(CAC_BASE + 0x080), &except_vec3_generic, 0x80);
 
-	signal_init();
-#ifdef CONFIG_MIPS32_COMPAT
-	signal32_init();
-#endif
-
 	flush_icache_range(ebase, ebase + 0x400);
 	flush_tlb_handlers();
 }
diff --git a/arch/mips/math-emu/kernel_linkage.c b/arch/mips/math-emu/kernel_linkage.c
index d187ab7..3367ace 100644
--- a/arch/mips/math-emu/kernel_linkage.c
+++ b/arch/mips/math-emu/kernel_linkage.c
@@ -44,76 +44,3 @@ void fpu_emulator_init_fpu(void)
 		current->thread.fpu.soft.fpr[i] = SIGNALLING_NAN;
 	}
 }
-
-
-/*
- * Emulator context save/restore to/from a signal context
- * presumed to be on the user stack, and therefore accessed
- * with appropriate macros from uaccess.h
- */
-
-int fpu_emulator_save_context(struct sigcontext *sc)
-{
-	int i;
-	int err = 0;
-
-	for (i = 0; i < 32; i++) {
-		err |=
-		    __put_user(current->thread.fpu.soft.fpr[i],
-			       &sc->sc_fpregs[i]);
-	}
-	err |= __put_user(current->thread.fpu.soft.fcr31, &sc->sc_fpc_csr);
-
-	return err;
-}
-
-int fpu_emulator_restore_context(struct sigcontext *sc)
-{
-	int i;
-	int err = 0;
-
-	for (i = 0; i < 32; i++) {
-		err |=
-		    __get_user(current->thread.fpu.soft.fpr[i],
-			       &sc->sc_fpregs[i]);
-	}
-	err |= __get_user(current->thread.fpu.soft.fcr31, &sc->sc_fpc_csr);
-
-	return err;
-}
-
-#ifdef CONFIG_64BIT
-/*
- * This is the o32 version
- */
-
-int fpu_emulator_save_context32(struct sigcontext32 *sc)
-{
-	int i;
-	int err = 0;
-
-	for (i = 0; i < 32; i+=2) {
-		err |=
-		    __put_user(current->thread.fpu.soft.fpr[i],
-			       &sc->sc_fpregs[i]);
-	}
-	err |= __put_user(current->thread.fpu.soft.fcr31, &sc->sc_fpc_csr);
-
-	return err;
-}
-
-int fpu_emulator_restore_context32(struct sigcontext32 *sc)
-{
-	int i;
-	int err = 0;
-
-	for (i = 0; i < 32; i+=2) {
-		err |=
-		    __get_user(current->thread.fpu.soft.fpr[i],
-			       &sc->sc_fpregs[i]);
-	}
-	err |= __get_user(current->thread.fpu.soft.fcr31, &sc->sc_fpc_csr);
-
-	return err;
-}
-#endif
diff --git a/include/asm-mips/fpu.h b/include/asm-mips/fpu.h
index 9c828b1..73b69b1 100644
--- a/include/asm-mips/fpu.h
+++ b/include/asm-mips/fpu.h
@@ -21,15 +21,6 @@
 #include <asm/processor.h>
 #include <asm/current.h>
 
-struct sigcontext;
-struct sigcontext32;
-
-extern asmlinkage int (*save_fp_context)(struct sigcontext *sc);
-extern asmlinkage int (*restore_fp_context)(struct sigcontext *sc);
-
-extern asmlinkage int (*save_fp_context32)(struct sigcontext32 *sc);
-extern asmlinkage int (*restore_fp_context32)(struct sigcontext32 *sc);
-
 extern void fpu_emulator_init_fpu(void);
 extern void _init_fpu(void);
 extern void _save_fp(struct task_struct *);

From richard@codesourcery.com Tue Feb  7 20:15:33 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 07 Feb 2006 20:15:46 +0000 (GMT)
Received: from voldemort.codesourcery.com ([65.74.133.5]:16619 "EHLO
	mail.codesourcery.com") by ftp.linux-mips.org with ESMTP
	id S8133434AbWBGUPd (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 7 Feb 2006 20:15:33 +0000
Received: (qmail 15907 invoked by uid 1010); 7 Feb 2006 20:21:14 -0000
From:	Richard Sandiford <richard@codesourcery.com>
To:	Ralf Baechle <ralf@linux-mips.org>
Mail-Followup-To: Ralf Baechle <ralf@linux-mips.org>,Martin Michlmayr <tbm@cyrius.com>,  MIPS Linux List <linux-mips@linux-mips.org>,  Stuart Anderson <anderson@netsweng.com>,  David Daney <ddaney@avtrex.com>, richard@codesourcery.com
Cc:	Martin Michlmayr <tbm@cyrius.com>,
	MIPS Linux List <linux-mips@linux-mips.org>,
	Stuart Anderson <anderson@netsweng.com>,
	David Daney <ddaney@avtrex.com>
Subject: Re: Fixes for uaccess.h with gcc >= 4.0.1
References: <20060123150507.GA18665@linux-mips.org>
Date:	Tue, 07 Feb 2006 20:21:11 +0000
In-Reply-To: <20060123150507.GA18665@linux-mips.org> (Ralf Baechle's message
	of "Mon, 23 Jan 2006 15:05:07 +0000")
Message-ID: <87wtg6c43s.fsf@talisman.home>
User-Agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.4 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Return-Path: <richard@codesourcery.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: 10364
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: richard@codesourcery.com
Precedence: bulk
X-list: linux-mips
Content-Length: 1947
Lines: 69

Ralf Baechle <ralf@linux-mips.org> writes:
> I'd appreciate if somebody with gcc 4.0.1 could test this kernel patch
> below.

Sorry in advance if this is a dup, but...

This patch caused a miscompilation of the restore_gp_regs() block
in restore_sigcontext().  This was in a 32-bit kernel compiled with
GCC CVS head.

restore_gp_regs() copies 64-bit user fields into 32-bit variables,
and in this combination, the new __get_user_asm_ll32() clobbers too
many registers.  It says:

/*
 * Get a long long 64 using 32 bit registers.
 */
#define __get_user_asm_ll32(val, addr)					\
{									\
	__asm__ __volatile__(						\
	"1:	lw	%1, (%3)				\n"	\
	"2:	lw	%D1, 4(%3)				\n"	\
	"	move	%0, $0					\n"	\
	"3:	.section	.fixup,\"ax\"			\n"	\
	"4:	li	%0, %4					\n"	\
	"	move	%1, $0					\n"	\
	"	move	%D1, $0					\n"	\
	"	j	3b					\n"	\
	"	.previous					\n"	\
	"	.section	__ex_table,\"a\"		\n"	\
	"	" __UA_ADDR "	1b, 4b				\n"	\
	"	" __UA_ADDR "	2b, 4b				\n"	\
	"	.previous					\n"	\
	: "=r" (__gu_err), "=&r" (val)					\
	: "0" (0), "r" (addr), "i" (-EFAULT));				\
}

and this requires val (%1) to be a 64-bit value.  In the case I saw,
gcc was using $3 for the 32-bit val, and wasn't expecting $4 to be
clobbered.

FWIW, the patch below fixes it for me.

Richard


diff --git a/include/asm-mips/uaccess.h b/include/asm-mips/uaccess.h
index 91d813a..1208cae 100644
--- a/include/asm-mips/uaccess.h
+++ b/include/asm-mips/uaccess.h
@@ -266,6 +266,7 @@ do {									\
  */
 #define __get_user_asm_ll32(val, addr)					\
 {									\
+        unsigned long long __gu_tmp;					\
 	__asm__ __volatile__(						\
 	"1:	lw	%1, (%3)				\n"	\
 	"2:	lw	%D1, 4(%3)				\n"	\
@@ -280,8 +281,9 @@ do {									\
 	"	" __UA_ADDR "	1b, 4b				\n"	\
 	"	" __UA_ADDR "	2b, 4b				\n"	\
 	"	.previous					\n"	\
-	: "=r" (__gu_err), "=&r" (val)					\
+	: "=r" (__gu_err), "=&r" (__gu_tmp)				\
 	: "0" (0), "r" (addr), "i" (-EFAULT));				\
+	(val) = __gu_tmp;						\
 }
 
 /*

From jcrouse@cosmic.amd.com Tue Feb  7 21:06:15 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 07 Feb 2006 21:06:26 +0000 (GMT)
Received: from amdext4.amd.com ([163.181.251.6]:59106 "EHLO amdext4.amd.com")
	by ftp.linux-mips.org with ESMTP id S8133434AbWBGVGP (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Tue, 7 Feb 2006 21:06:15 +0000
Received: from SAUSGW01.amd.com (sausgw01.amd.com [163.181.250.21])
	by amdext4.amd.com (8.12.11/8.12.11/AMD) with ESMTP id k17LB3TR031424;
	Tue, 7 Feb 2006 15:11:14 -0600
Received: from 163.181.22.101 by SAUSGW02.amd.com with ESMTP (AMD SMTP
 Relay (Email Firewall v6.1.0)); Tue, 07 Feb 2006 15:11:04 -0600
X-Server-Uuid: 5FC0E2DF-CD44-48CD-883A-0ED95B391E89
Received: from ldcmail.amd.com ([147.5.200.40]) by sausexbh1.amd.com
 with Microsoft SMTPSVC(6.0.3790.0); Tue, 7 Feb 2006 13:11:04 -0800
Received: from cosmic.amd.com (cosmic.amd.com [147.5.201.206]) by
 ldcmail.amd.com (Postfix) with ESMTP id D71272028; Tue, 7 Feb 2006
 14:11:03 -0700 (MST)
Received: from cosmic.amd.com (localhost [127.0.0.1]) by cosmic.amd.com
 (8.13.4/8.13.4) with ESMTP id k17LF0Rw008619; Tue, 7 Feb 2006 14:15:00
 -0700
Received: (from jcrouse@localhost) by cosmic.amd.com (
 8.13.4/8.13.4/Submit) id k17LF0tN008618; Tue, 7 Feb 2006 14:15:00 -0700
Date:	Tue, 7 Feb 2006 14:15:00 -0700
From:	"Jordan Crouse" <jordan.crouse@amd.com>
To:	rmk+serial@arm.linux.org.uk
cc:	linux-serial@vger.kernel.org, linux-mips@linux-mips.org
Subject: [PATCH] Fix compile error in 8250_au1x00.c
Message-ID: <20060207211500.GC5227@cosmic.amd.com>
MIME-Version: 1.0
User-Agent: Mutt/1.5.11
X-OriginalArrivalTime: 07 Feb 2006 21:11:04.0332 (UTC)
 FILETIME=[01478CC0:01C62C2B]
X-WSS-ID: 6FF7D3620BO3597395-01-01
Content-Type: multipart/mixed;
 boundary=YZ5djTAD1cGYuMQK
Content-Disposition: inline
Return-Path: <jcrouse@cosmic.amd.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: 10365
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: jordan.crouse@amd.com
Precedence: bulk
X-list: linux-mips
Content-Length: 1478
Lines: 54


--YZ5djTAD1cGYuMQK
Content-Type: text/plain;
 charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: 7bit

This patch fixes a compile error when building the 8250_au1x00 driver
for the DB1550, which doesn't have a UART2 defined, resulting in a 
compile error.

There are additional rumors of strangeness on the DB1550, but those
are unsubstantiated at this point.  At least with this patch, it will
compile.

Jordan
-- 
Jordan Crouse
Senior Linux Engineer
AMD - Personal Connectivity Solutions Group
<www.amd.com/embeddedprocessors>

--YZ5djTAD1cGYuMQK
Content-Type: text/plain;
 charset=us-ascii
Content-Disposition: inline;
 filename=8250_fixup.patch
Content-Transfer-Encoding: 7bit

[PATCH]:  Fixup for the AU1X00 8250 driver

The DB1550 actually doesn't have a UART2.  Remove it from the list.

Signed-off-by: Jordan Crouse <jordan.crouse@amd.com>
---

 drivers/serial/8250_au1x00.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/serial/8250_au1x00.c b/drivers/serial/8250_au1x00.c
index 06ae8fb..8d8d7a7 100644
--- a/drivers/serial/8250_au1x00.c
+++ b/drivers/serial/8250_au1x00.c
@@ -56,7 +56,6 @@ static struct plat_serial8250_port au1x0
 #elif defined(CONFIG_SOC_AU1550)
 	PORT(UART0_ADDR, AU1550_UART0_INT),
 	PORT(UART1_ADDR, AU1550_UART1_INT),
-	PORT(UART2_ADDR, AU1550_UART2_INT),
 	PORT(UART3_ADDR, AU1550_UART3_INT),
 #elif defined(CONFIG_SOC_AU1200)
 	PORT(UART0_ADDR, AU1200_UART0_INT),

--YZ5djTAD1cGYuMQK--


From v_kanchan@yahoo.com Wed Feb  8 01:04:13 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 08 Feb 2006 01:04:26 +0000 (GMT)
Received: from web81603.mail.mud.yahoo.com ([68.142.199.155]:10114 "HELO
	web81603.mail.mud.yahoo.com") by ftp.linux-mips.org with SMTP
	id S8133750AbWBHBEN (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 8 Feb 2006 01:04:13 +0000
Received: (qmail 16658 invoked by uid 60001); 8 Feb 2006 01:09:48 -0000
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws;
  s=s1024; d=yahoo.com;
  h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding;
  b=zPW0ceyHLuOJnjcYyul0fSwMp6TsgF/esiTjAevHJ7/QwS54OldG8zATfRLzVoJ50z4Zs+7DZKx7lNkAmgFExTtiWg5Kwfc37n4sbe53Xc9kghGOyFDTeyAcswy+qVbzG3qFYJBSSjfGZp87dHcjWng1XjetrMfHD5phL9aa/Os=  ;
Message-ID: <20060208010948.16656.qmail@web81603.mail.mud.yahoo.com>
Received: from [68.126.220.7] by web81603.mail.mud.yahoo.com via HTTP; Tue, 07 Feb 2006 17:09:48 PST
Date:	Tue, 7 Feb 2006 17:09:48 -0800 (PST)
From:	vasant kanchan <v_kanchan@yahoo.com>
Subject: Openembedded build for AMD's DBAU1200
To:	linux-mips@linux-mips.org
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Return-Path: <v_kanchan@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: 10366
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: v_kanchan@yahoo.com
Precedence: bulk
X-list: linux-mips
Content-Length: 773
Lines: 28

Hi,

This is more of an openembedded question than a MIPS
one.
However I was hoping someone could help me.

I just downloaded the instructions from AMD's
developer
website and it talks about getting OE snapshot and
Bitbake
snapshot. As follows:

OE Snapshot - Please acquire OE using monotone as per:

http://oe.handhelds.org/cgi-bin/moin.cgi/GettingStarted#head-1c5adf3b1f1467ec9bcb48b5a34c18632557c3c4

BitBake Snapshot - Please acquire Bitbake using
subversion as per: 
http://oe.handhelds.org/cgi-bin/moin.cgi/GettingStarted#head-edc470c3655ac7ebac7ae7928ea574819170fa1b


I have read through the Monotone/Svn documentation and
I am not sure how to do get both the above snapshots.
Any help is appreciated. I have installed the latest
version of both.

Regards
Kanchan

From mita@miraclelinux.com Wed Feb  8 10:35:39 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 08 Feb 2006 10:35:48 +0000 (GMT)
Received: from ns.miraclelinux.com ([219.118.163.66]:10607 "EHLO
	mail01.miraclelinux.com") by ftp.linux-mips.org with ESMTP
	id S3457885AbWBHKfj (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 8 Feb 2006 10:35:39 +0000
Received: from mail01 (localhost.localdomain [127.0.0.1])
	by mail01.miraclelinux.com (Postfix) with ESMTP
	id 4396731C2E8; Wed,  8 Feb 2006 19:41:21 +0900 (JST)
Received: from localhost.localdomain (sshgate.miraclelinux.com [])
	by mail01.miraclelinux.com ([10.1.0.10]);
	Wed, 08 Feb 2006 10:41:21 +0000
Received: by localhost.localdomain (Postfix, from userid 1000)
	id 722FD42022F; Wed,  8 Feb 2006 19:41:21 +0900 (JST)
Date:	Wed, 8 Feb 2006 19:41:21 +0900
To:	Roman Zippel <zippel@linux-m68k.org>
Cc:	linux-kernel@vger.kernel.org, Richard Henderson <rth@twiddle.net>,
	Ivan Kokshaysky <ink@jurassic.park.msu.ru>, dev-etrax@axis.com,
	David Howells <dhowells@redhat.com>,
	Yoshinori Sato <ysato@users.sourceforge.jp>,
	Linus Torvalds <torvalds@osdl.org>, linux-ia64@vger.kernel.org,
	Hirokazu Takata <takata@linux-m32r.org>,
	linux-m68k@vger.kernel.org, linux-mips@linux-mips.org,
	parisc-linux@parisc-linux.org, linuxsh-dev@lists.sourceforge.net,
	linuxsh-shmedia-dev@lists.sourceforge.net,
	sparclinux@vger.kernel.org, ultralinux@vger.kernel.org,
	Miles Bader <uclinux-v850@lsi.nec.co.jp>,
	Andi Kleen <ak@suse.de>, Chris Zankel <chris@zankel.net>
Subject: Re: [patch 15/44] generic ext2_{set,clear,test,find_first_zero,find_next_zero}_bit()
Message-ID: <20060208104121.GB27490@miraclelinux.com>
References: <20060201090224.536581000@localhost.localdomain> <20060201090326.139510000@localhost.localdomain> <Pine.LNX.4.61.0602011214270.12293@scrub.home>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <Pine.LNX.4.61.0602011214270.12293@scrub.home>
User-Agent: Mutt/1.5.9i
From:	mita@miraclelinux.com (Akinobu Mita)
Return-Path: <mita@miraclelinux.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: 10367
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: mita@miraclelinux.com
Precedence: bulk
X-list: linux-mips
Content-Length: 621
Lines: 23

On Wed, Feb 01, 2006 at 12:27:38PM +0100, Roman Zippel wrote:

> For the inline version I would prefer this version:
> 
> {
> 	const unsigned char *tmp = (const unsigned char *)addr;
> 	return (tmp[nr >> 3] & (unsigned char)(1 << (nr & 7))) != 0;
> }
> 
> Although this would be a good alternative as well:
> 
> {
> 	return (addr[nr >> 5] & (1 << ((nr ^ 24) & 31))) != 0;
> }

Thanks, maybe I could use BITOP_LE_SWIZZLE similar to other *_le_bit().

#define BITOP_LE_SWIZZLE       ((BITS_PER_LONG-1) & ~0x7)
 :
#define generic_test_le_bit(nr, addr) test_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
 :
#endif /* __BIG_ENDIAN */


From anemo@mba.ocn.ne.jp Wed Feb  8 14:34:24 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 08 Feb 2006 14:34:38 +0000 (GMT)
Received: from mba.ocn.ne.jp ([210.190.142.172]:52425 "HELO smtp.mba.ocn.ne.jp")
	by ftp.linux-mips.org with SMTP id S3467527AbWBHOeX (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Wed, 8 Feb 2006 14:34:23 +0000
Received: from localhost (p8063-ipad01funabasi.chiba.ocn.ne.jp [61.207.82.63])
	by smtp.mba.ocn.ne.jp (Postfix) with ESMTP
	id B956F9B93; Wed,  8 Feb 2006 23:40:06 +0900 (JST)
Date:	Wed, 08 Feb 2006 23:39:49 +0900 (JST)
Message-Id: <20060208.233949.25478044.anemo@mba.ocn.ne.jp>
To:	linux-mips@linux-mips.org
Cc:	ralf@linux-mips.org
Subject: [PATCH] add some __user tags to syscall.c
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: 10368
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
Content-Length: 4733
Lines: 154

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

diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c
index 3323584..1da2eeb 100644
--- a/arch/mips/kernel/syscall.c
+++ b/arch/mips/kernel/syscall.c
@@ -212,12 +212,12 @@ asmlinkage int sys_execve(nabi_no_regarg
 	int error;
 	char * filename;
 
-	filename = getname((char *) (long)regs.regs[4]);
+	filename = getname((char __user *) (long)regs.regs[4]);
 	error = PTR_ERR(filename);
 	if (IS_ERR(filename))
 		goto out;
-	error = do_execve(filename, (char **) (long)regs.regs[5],
-	                  (char **) (long)regs.regs[6], &regs);
+	error = do_execve(filename, (char __user *__user *) (long)regs.regs[5],
+	                  (char __user *__user *) (long)regs.regs[6], &regs);
 	putname(filename);
 
 out:
@@ -227,7 +227,7 @@ out:
 /*
  * Compacrapability ...
  */
-asmlinkage int sys_uname(struct old_utsname * name)
+asmlinkage int sys_uname(struct old_utsname __user * name)
 {
 	if (name && !copy_to_user(name, &system_utsname, sizeof (*name)))
 		return 0;
@@ -237,7 +237,7 @@ asmlinkage int sys_uname(struct old_utsn
 /*
  * Compacrapability ...
  */
-asmlinkage int sys_olduname(struct oldold_utsname * name)
+asmlinkage int sys_olduname(struct oldold_utsname __user * name)
 {
 	int error;
 
@@ -274,7 +274,7 @@ void sys_set_thread_area(unsigned long a
 asmlinkage int _sys_sysmips(int cmd, long arg1, int arg2, int arg3)
 {
 	int	tmp, len;
-	char	*name;
+	char	__user *name;
 
 	switch(cmd) {
 	case SETNAME: {
@@ -283,7 +283,7 @@ asmlinkage int _sys_sysmips(int cmd, lon
 		if (!capable(CAP_SYS_ADMIN))
 			return -EPERM;
 
-		name = (char *) arg1;
+		name = (char __user *) arg1;
 
 		len = strncpy_from_user(nodename, name, __NEW_UTS_LEN);
 		if (len < 0)
@@ -324,7 +324,7 @@ asmlinkage int _sys_sysmips(int cmd, lon
  * This is really horribly ugly.
  */
 asmlinkage int sys_ipc (uint call, int first, int second,
-			unsigned long third, void *ptr, long fifth)
+			unsigned long third, void __user *ptr, long fifth)
 {
 	int version, ret;
 
@@ -333,24 +333,25 @@ asmlinkage int sys_ipc (uint call, int f
 
 	switch (call) {
 	case SEMOP:
-		return sys_semtimedop (first, (struct sembuf *)ptr, second,
-		                       NULL);
+		return sys_semtimedop (first, (struct sembuf __user *)ptr,
+		                       second, NULL);
 	case SEMTIMEDOP:
-		return sys_semtimedop (first, (struct sembuf *)ptr, second,
-		                       (const struct timespec __user *)fifth);
+		return sys_semtimedop (first, (struct sembuf __user *)ptr,
+				       second,
+				       (const struct timespec __user *)fifth);
 	case SEMGET:
 		return sys_semget (first, second, third);
 	case SEMCTL: {
 		union semun fourth;
 		if (!ptr)
 			return -EINVAL;
-		if (get_user(fourth.__pad, (void **) ptr))
+		if (get_user(fourth.__pad, (void *__user *) ptr))
 			return -EFAULT;
 		return sys_semctl (first, second, third, fourth);
 	}
 
 	case MSGSND:
-		return sys_msgsnd (first, (struct msgbuf *) ptr,
+		return sys_msgsnd (first, (struct msgbuf __user *) ptr,
 				   second, third);
 	case MSGRCV:
 		switch (version) {
@@ -360,7 +361,7 @@ asmlinkage int sys_ipc (uint call, int f
 				return -EINVAL;
 
 			if (copy_from_user(&tmp,
-					   (struct ipc_kludge *) ptr,
+					   (struct ipc_kludge __user *) ptr,
 					   sizeof (tmp)))
 				return -EFAULT;
 			return sys_msgrcv (first, tmp.msgp, second,
@@ -368,35 +369,38 @@ asmlinkage int sys_ipc (uint call, int f
 		}
 		default:
 			return sys_msgrcv (first,
-					   (struct msgbuf *) ptr,
+					   (struct msgbuf __user *) ptr,
 					   second, fifth, third);
 		}
 	case MSGGET:
 		return sys_msgget ((key_t) first, second);
 	case MSGCTL:
-		return sys_msgctl (first, second, (struct msqid_ds *) ptr);
+		return sys_msgctl (first, second,
+				   (struct msqid_ds __user *) ptr);
 
 	case SHMAT:
 		switch (version) {
 		default: {
 			ulong raddr;
-			ret = do_shmat (first, (char *) ptr, second, &raddr);
+			ret = do_shmat (first, (char __user *) ptr, second,
+					&raddr);
 			if (ret)
 				return ret;
-			return put_user (raddr, (ulong *) third);
+			return put_user (raddr, (ulong __user *) third);
 		}
 		case 1:	/* iBCS2 emulator entry point */
 			if (!segment_eq(get_fs(), get_ds()))
 				return -EINVAL;
-			return do_shmat (first, (char *) ptr, second, (ulong *) third);
+			return do_shmat (first, (char __user *) ptr, second,
+					 (ulong *) third);
 		}
 	case SHMDT:
-		return sys_shmdt ((char *)ptr);
+		return sys_shmdt ((char __user *)ptr);
 	case SHMGET:
 		return sys_shmget (first, second, third);
 	case SHMCTL:
 		return sys_shmctl (first, second,
-				   (struct shmid_ds *) ptr);
+				   (struct shmid_ds __user *) ptr);
 	default:
 		return -ENOSYS;
 	}

From ralf@linux-mips.org Wed Feb  8 14:39:56 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 08 Feb 2006 14:40:05 +0000 (GMT)
Received: from mipsfw.mips-uk.com ([194.74.144.146]:15364 "EHLO
	bacchus.dhis.org") by ftp.linux-mips.org with ESMTP
	id S3467570AbWBHOjz (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 8 Feb 2006 14:39:55 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by bacchus.dhis.org (8.13.4/8.13.4) with ESMTP id k18EjlTm001974;
	Wed, 8 Feb 2006 14:45:47 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.4/8.13.4/Submit) id k18Ejjk1001973;
	Wed, 8 Feb 2006 14:45:45 GMT
Date:	Wed, 8 Feb 2006 14:45:45 +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] add some __user tags to syscall.c
Message-ID: <20060208144545.GA3484@linux-mips.org>
References: <20060208.233949.25478044.anemo@mba.ocn.ne.jp>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20060208.233949.25478044.anemo@mba.ocn.ne.jp>
User-Agent: Mutt/1.4.2.1i
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: 10369
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
Content-Length: 136
Lines: 7

On Wed, Feb 08, 2006 at 11:39:49PM +0900, Atsushi Nemoto wrote:

> Subject: [PATCH] add some __user tags to syscall.c

Applied,

  Ralf

From anemo@mba.ocn.ne.jp Wed Feb  8 15:51:30 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 08 Feb 2006 15:51:44 +0000 (GMT)
Received: from mba.ocn.ne.jp ([210.190.142.172]:56028 "HELO smtp.mba.ocn.ne.jp")
	by ftp.linux-mips.org with SMTP id S3467572AbWBHPv3 (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Wed, 8 Feb 2006 15:51:29 +0000
Received: from localhost (p8063-ipad01funabasi.chiba.ocn.ne.jp [61.207.82.63])
	by smtp.mba.ocn.ne.jp (Postfix) with ESMTP
	id DFB5CA296; Thu,  9 Feb 2006 00:57:12 +0900 (JST)
Date:	Thu, 09 Feb 2006 00:56:55 +0900 (JST)
Message-Id: <20060209.005655.96684595.anemo@mba.ocn.ne.jp>
To:	linux-mips@linux-mips.org
Cc:	ralf@linux-mips.org
Subject: [PATCH] use __raw access function for fb
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: 10370
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
Content-Length: 687
Lines: 15

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

diff --git a/include/linux/fb.h b/include/linux/fb.h
index 2cb19e6..8c0cf1c 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -809,7 +809,7 @@ struct fb_info {
 #define fb_writeq sbus_writeq
 #define fb_memset sbus_memset_io
 
-#elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) || defined(__hppa__) || (defined(__sh__) && !defined(__SH5__)) || defined(__powerpc__)
+#elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) || defined(__hppa__) || (defined(__sh__) && !defined(__SH5__)) || defined(__powerpc__) || defined(__mips__)
 
 #define fb_readb __raw_readb
 #define fb_readw __raw_readw

From anemo@mba.ocn.ne.jp Wed Feb  8 15:52:18 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 08 Feb 2006 15:52:33 +0000 (GMT)
Received: from mba.ocn.ne.jp ([210.190.142.172]:6634 "HELO smtp.mba.ocn.ne.jp")
	by ftp.linux-mips.org with SMTP id S3467572AbWBHPwS (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Wed, 8 Feb 2006 15:52:18 +0000
Received: from localhost (p8063-ipad01funabasi.chiba.ocn.ne.jp [61.207.82.63])
	by smtp.mba.ocn.ne.jp (Postfix) with ESMTP
	id 82DB3A4B0; Thu,  9 Feb 2006 00:58:02 +0900 (JST)
Date:	Thu, 09 Feb 2006 00:57:44 +0900 (JST)
Message-Id: <20060209.005744.130846941.anemo@mba.ocn.ne.jp>
To:	linux-mips@linux-mips.org
Cc:	ralf@linux-mips.org
Subject: [PATCH] add 'const' to readb and friends
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: 10371
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
Content-Length: 507
Lines: 15

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

diff --git a/include/asm-mips/io.h b/include/asm-mips/io.h
index c16d54f..0ec40f9 100644
--- a/include/asm-mips/io.h
+++ b/include/asm-mips/io.h
@@ -342,7 +342,7 @@ static inline void pfx##write##bwlq(type
 		BUG();							\
 }									\
 									\
-static inline type pfx##read##bwlq(volatile void __iomem *mem)		\
+static inline type pfx##read##bwlq(const volatile void __iomem *mem)	\
 {									\
 	volatile type *__mem;						\
 	type __val;							\

From ralf@linux-mips.org Wed Feb  8 16:29:41 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 08 Feb 2006 16:29:53 +0000 (GMT)
Received: from mipsfw.mips-uk.com ([194.74.144.146]:59930 "EHLO
	bacchus.dhis.org") by ftp.linux-mips.org with ESMTP
	id S3467577AbWBHQ3l (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 8 Feb 2006 16:29:41 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by bacchus.dhis.org (8.13.4/8.13.4) with ESMTP id k18GZZMA004747;
	Wed, 8 Feb 2006 16:35:35 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.4/8.13.4/Submit) id k18GZZ54004746;
	Wed, 8 Feb 2006 16:35:35 GMT
Date:	Wed, 8 Feb 2006 16:35:35 +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] add 'const' to readb and friends
Message-ID: <20060208163535.GC3484@linux-mips.org>
References: <20060209.005744.130846941.anemo@mba.ocn.ne.jp>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20060209.005744.130846941.anemo@mba.ocn.ne.jp>
User-Agent: Mutt/1.4.2.1i
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: 10372
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
Content-Length: 135
Lines: 7

On Thu, Feb 09, 2006 at 12:57:44AM +0900, Atsushi Nemoto wrote:

> Subject: [PATCH] add 'const' to readb and friends

Applied,

  Ralf

From rmk+linux-mips=linux-mips.org@arm.linux.org.uk Wed Feb  8 21:31:06 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 08 Feb 2006 21:31:15 +0000 (GMT)
Received: from caramon.arm.linux.org.uk ([212.18.232.186]:8973 "EHLO
	caramon.arm.linux.org.uk") by ftp.linux-mips.org with ESMTP
	id S8133359AbWBHVbG (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 8 Feb 2006 21:31:06 +0000
Received: from flint.arm.linux.org.uk ([2002:d412:e8ba:1:201:2ff:fe14:8fad])
	by caramon.arm.linux.org.uk with esmtpsa (TLSv1:DES-CBC3-SHA:168)
	(Exim 4.52)
	id 1F6wzL-0006My-Es; Wed, 08 Feb 2006 21:36:36 +0000
Received: from rmk by flint.arm.linux.org.uk with local (Exim 4.52)
	id 1F6wzX-0002jV-U2; Wed, 08 Feb 2006 21:36:47 +0000
Date:	Wed, 8 Feb 2006 21:36:47 +0000
From:	Russell King <rmk@arm.linux.org.uk>
To:	Jordan Crouse <jordan.crouse@amd.com>
Cc:	linux-serial@vger.kernel.org, linux-mips@linux-mips.org
Subject: Re: [PATCH] Fix compile error in 8250_au1x00.c
Message-ID: <20060208213647.GB8587@flint.arm.linux.org.uk>
References: <20060207211500.GC5227@cosmic.amd.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20060207211500.GC5227@cosmic.amd.com>
User-Agent: Mutt/1.4.1i
Return-Path: <rmk+linux-mips=linux-mips.org@arm.linux.org.uk>
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: 10373
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: rmk@arm.linux.org.uk
Precedence: bulk
X-list: linux-mips
Content-Length: 266
Lines: 9

On Tue, Feb 07, 2006 at 02:15:00PM -0700, Jordan Crouse wrote:
> The DB1550 actually doesn't have a UART2.  Remove it from the list.

Applied, thanks.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core

From mark.e.mason@broadcom.com Thu Feb  9 00:44:30 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 09 Feb 2006 00:44:40 +0000 (GMT)
Received: from mms2.broadcom.com ([216.31.210.18]:27401 "EHLO
	mms2.broadcom.com") by ftp.linux-mips.org with ESMTP
	id S8133409AbWBIAoa convert rfc822-to-8bit (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Thu, 9 Feb 2006 00:44:30 +0000
Received: from 10.10.64.154 by mms2.broadcom.com with ESMTP (Broadcom
 SMTP Relay (Email Firewall v6.2.0)); Wed, 08 Feb 2006 16:50:02 -0800
X-Server-Uuid: D9EB6F12-1469-4C1C-87A2-5E4C0D6F9D06
Received: by mail-irva-10.broadcom.com (Postfix, from userid 47) id
 61E802B4; Wed, 8 Feb 2006 16:50:02 -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 4CADC2AF for
 <linux-mips@linux-mips.org>; Wed, 8 Feb 2006 16:50:02 -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.3a-GA) with ESMTP
 id CWR84704; Wed, 8 Feb 2006 16:49:58 -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
 3EFD220501 for <linux-mips@linux-mips.org>; Wed, 8 Feb 2006 16:49:59
 -0800 (PST)
X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0
Content-class: urn:content-classes:message
MIME-Version: 1.0
Subject: SB1 broken on lmo tip
Date:	Wed, 8 Feb 2006 16:49:57 -0800
Message-ID: <7E000E7F06B05C49BDBB769ADAF44D0773A392@NT-SJCA-0750.brcm.ad.broadcom.com>
Thread-Topic: SB1 broken on lmo tip
Thread-Index: AcYtEr/bSiRQd6srR76aPQRB4ka0cw==
From:	"Mark E Mason" <mark.e.mason@broadcom.com>
To:	linux-mips@linux-mips.org
X-TMWD-Spam-Summary: SEV=1.1; DFV=A2006020809; IFV=2.0.6,4.0-7;
 RPD=4.00.0004;
 RPDID=303030312E30413039303230382E34334541384645392E303031312D412D;
 ENG=IBF; TS=20060209005003; CAT=NONE; CON=NONE;
X-MMS-Spam-Filter-ID: A2006020809_4.00.0004_2.0.6,4.0-7
X-WSS-ID: 6FF44E301SC4905762-01-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: 10374
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
Content-Length: 4165
Lines: 98

Hello,
 
It looks like the following merge broke the SB1 ports in linux-mips.org:
 
	Merge with e3f749c4af69c4344d89f11e2293e3790eb4eaca from Linus.
 
Specifically:
    d166b5a220813a08a79312fc384d11e1c57e9072    works, and it's child
    a7900c9bdb64c11688719bef9f6373fbc4c276ab    does not.

Unfortunately, the diffs between the two are about 19,000 lines...
And they're neighbors, so 'git bisect' will do no good.

The failure mode is the following exceptions on boot (using the
bigsur_defconfig):

294667.532000] Detected 3 available secondary CPU(s)
[4294667.534000] CPU revision is: 03041100
[4294667.534000] FPU revision is: 000f0103
[4294667.534000] Primary instruction cache 32kB, 4-way, linesize 32
bytes.
[4294667.534000] Primary data cache 32kB, 4-way, linesize 32 bytes.
[4294667.534000] Synthesized TLB refill handler (35 instructions).
[4294667.554000] CPU 0 Unable to handle kernel paging request at virtual
address 0000000000000028, epc == ffffffff80129740, 0[4294667.554000]
Oops[#1]:
[4294667.554000] Cpu 0
[4294667.554000] $ 0   : 0000000000000000 ffffffff804552e0
0000000000000020 0000000000000000
[4294667.554000] $ 4   : a8000000043da048 0000000000000000
0000000000000000 0000000000000001
[4294667.554000] $ 8   : ffffffff8045b790 ffffffff8feef420
ffffffff80424108 0000000000000000
[4294667.554000] $12   : ffffffffffffffff ffffffff8026be28
a8000000004ac630 ffffffffffffffff
[4294667.554000] $16   : 0000000000000000 a8000000043da048
a800000003da1300 0000000000000000
[4294667.554000] $20   : 0000000000000000 a800000003da1300
0000000000000001 ffffffff804552e0
[4294667.554000] $24   : 0000000000000000 ffffffff8fe94dc8
[4294667.554000] $28   : a8000000043dc000 a8000000043dfe20
a8000000043dfe30 ffffffff80129bc0
[4294667.554000] Hi    : 0000000000005a99
[4294667.554000] Lo    : 9999999998bf9800
[4294667.554000] epc   : ffffffff80129740 enqueue_task+0x18/0x88     Not
tainted
[4294667.554000] ra    : ffffffff80129bc0 activate_task+0xe0/0x158
[4294667.554000] Status: 14001fe2    KX SX UX KERNEL EXL
[4294667.554000] Cause : 00808008
[4294667.554000] BadVA : 0000000000000028
[4294667.554000] PrId  : 01041100
[4294667.554000] Modules linked in:
[4294667.554000] Process swapper (pid: 1, threadinfo=a8000000043dc000,
task=a8000000043db8a8)
[4294667.554000] Stack : a8000000043dfe30 ffffffff8045aca0
a800000003da1300 ffffffff804552e0
[4294667.554000]         a8000000043da048 0000000000000001
a8000000043dfe60 ffffffff8012ad70
[4294667.554000]         0000000014001fe1 0000000000000000
0000000000000000 0000000000000000
[4294667.554000]         ffffffffffffffff 000000000000000f
0000000000000000 ffffffffffffffff
[4294667.554000]         ffffffff80451b38 0000000000000001
0000000000000001 ffffffff8045b758
[4294667.554000]         0000000000000000 0000000000000000
0000000000000000 0000000000000000
[4294667.554000]         a8000000043dfef0 ffffffff80130bd8
a8000000043f4000 a8000000043f7fe0
[4294667.554000]         ffffffff80451b38 0000000000000001
0000000000000002 ffffffff8045b758
[4294667.554000]         0000000000000000 0000000000000000
0000000000000000 0000000000000000
[4294667.554000]         0000000000000000 ffffffff8014c308
0000000000000001 0000000000000001
[4294667.554000]         ...
[4294667.554000] Call Trace:
[4294667.554000]  [<ffffffff8012ad70>] try_to_wake_up+0x530/0x600
[4294667.554000]  [<ffffffff80130bd8>] migration_call+0x210/0x228
[4294667.554000]  [<ffffffff8014c308>] notifier_call_chain+0x38/0x78
[4294667.554000]  [<ffffffff80435e6c>] cpu_up+0x13c/0x1c8
[4294667.554000]  [<ffffffff80100e90>] init+0x9b0/0xb20
[4294667.554000]  [<ffffffff80100570>] init+0x90/0xb20
[4294667.554000]  [<ffffffff80104fc0>] kernel_thread_helper+0x10/0x18
[4294667.554000]  [<ffffffff80104fb0>] kernel_thread_helper+0x0/0x18
[4294667.554000]
[4294667.554000]
[4294667.554000] Code: 00021138  0045102d  64420020 <dc470008> 64830040
fc430008  fc820040  fc670008  fce30000
[4294667.555000] Kernel panic - not syncing: Attempted to kill init!
[4294667.556000]  <0>Rebooting in 5 seconds..Passing control back to
CFE...

I'm going to start looking into it, but any & all suggestions on where
to look are most welcome.

Cheers,
Mark


From mark.e.mason@broadcom.com Thu Feb  9 01:11:42 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 09 Feb 2006 01:12:43 +0000 (GMT)
Received: from mms3.broadcom.com ([216.31.210.19]:33804 "EHLO
	MMS3.broadcom.com") by ftp.linux-mips.org with ESMTP
	id S8133409AbWBIBLm convert rfc822-to-8bit (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Thu, 9 Feb 2006 01:11:42 +0000
Received: from 10.10.64.154 by MMS3.broadcom.com with ESMTP (Broadcom
 SMTP Relay (Email Firewall v6.2.0)); Wed, 08 Feb 2006 17:17:14 -0800
X-Server-Uuid: B238DE4C-2139-4D32-96A8-DD564EF2313E
Received: by mail-irva-10.broadcom.com (Postfix, from userid 47) id
 7C3D32AF; Wed, 8 Feb 2006 17:17:14 -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 680C82AE for
 <linux-mips@linux-mips.org>; Wed, 8 Feb 2006 17:17:14 -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.3a-GA) with ESMTP
 id CWR96137; Wed, 8 Feb 2006 17:17:14 -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
 2E0A920501 for <linux-mips@linux-mips.org>; Wed, 8 Feb 2006 17:17:14
 -0800 (PST)
X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0
Content-class: urn:content-classes:message
MIME-Version: 1.0
Subject: RE: SB1 broken on lmo tip
Date:	Wed, 8 Feb 2006 17:17:13 -0800
Message-ID: <7E000E7F06B05C49BDBB769ADAF44D0773A39C@NT-SJCA-0750.brcm.ad.broadcom.com>
Thread-Topic: SB1 broken on lmo tip
Thread-Index: AcYtEr/bSiRQd6srR76aPQRB4ka0cwAA5bBw
From:	"Mark E Mason" <mark.e.mason@broadcom.com>
To:	linux-mips@linux-mips.org
X-TMWD-Spam-Summary: SEV=1.1; DFV=A2006020810; IFV=2.0.6,4.0-7;
 RPD=4.00.0004;
 RPDID=303030312E30413039303230352E34334541393634432E303034322D412D;
 ENG=IBF; TS=20060209011718; CAT=NONE; CON=NONE;
X-MMS-Spam-Filter-ID: A2006020810_4.00.0004_2.0.6,4.0-7
X-WSS-ID: 6FF4479041W8629740-01-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: 10375
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
Content-Length: 5804
Lines: 131

And a quick follow-up.  Turning off SMP gets past the problem first
reported, and triggers the following one a little while later in the
boot process:


INIT: version 2.86 booting
[4294679.530000] CPU 0 Unable to handle kernel paging request at virtual
address 0000000000000100, epc == ffffffff801100cc, 0[4294679.531000]
Oops[#1]:
[4294679.531000] Cpu 0
[4294679.531000] $ 0   : 0000000000000000 0000000010001fe1
a8000000cfc892c0 ffffffff803ae430
[4294679.531000] $ 4   : a8000000cfcffeb0 0000000000000000
0000000000000004 0000000000000000
[4294679.531000] $ 8   : a8000000cfcffe30 a8000000cfcffe40
0000000000000000 0000000000443388
[4294679.531000] $12   : 0000000000000000 0000000000000000
0000000000000003 0000000000100100
[4294679.531000] $16   : ffffffffffffffff 0000000000000000
0000000000000000 00000000100096b0
[4294679.531000] $20   : 0000000000000000 0000000000000014
0000000000440000 0000000010008064
[4294679.531000] $24   : 0000000000000000 ffffffff801100b0
[4294679.531000] $28   : a8000000cfcfc000 a8000000cfcffde0
0000000010001390 ffffffff80102280
[4294679.531000] Hi    : 0000000000000000
[4294679.531000] Lo    : 0000000000000018
[4294679.531000] epc   : ffffffff801100cc do_signal32+0x1c/0x2a0     Not
tainted
[4294679.531000] ra    : ffffffff80102280 work_notifysig+0xc/0x14
[4294679.531000] Status: 10001fe2    KX SX UX KERNEL EXL
[4294679.531000] Cause : 00808008
[4294679.531000] BadVA : 0000000000000100
[4294679.531000] PrId  : 01041100
[4294679.531000] Modules linked in:
[4294679.531000] Process rc (pid: 19, threadinfo=a8000000cfcfc000,
task=a8000000cfc892c0)
[4294679.531000] Stack : 0000000000030002 000000000000001c
0000000000020000 0000000000000000
[4294679.531000]         0000000000000000 ffffff0000000000
ffffffff8013e830 000000007ff968d4
[4294679.531000]         0000000000020000 0000000000000000
0000000000000000 0000000000000000
[4294679.531000]         0000000000000000 ffffffff80110940
0000000000000000 0000000000000001
[4294679.531000]         0000000000000000 0000000000000000
0000000000000000 0000000000000000
[4294679.531000]         ffffffffffffffff 0000000000000000
0000000000000000 00000000100096b0
[4294679.531000]         0000000000000000 ffffffff80102280
0000000000000000 0000000010001fe0
[4294679.531000]         0000000000000000 0000000000000000
0000000000000003 000000007ff969b0
[4294679.531000]         0000000000000000 0000000000000000
000000001000e22a 000000000000007f
[4294679.531000]         0000000000000000 0000000000000000
0000000000000000 0000000000000018
[4294679.531000]         ...
[4294679.531000] Call Trace:
[4294679.531000]  [<ffffffff8013e830>] sys_rt_sigprocmask+0x98/0x130
[4294679.531000]  [<ffffffff80110940>] sys32_rt_sigprocmask+0xd0/0x198
[4294679.531000]  [<ffffffff80102280>] work_notifysig+0xc/0x14
[4294679.531000]
[4294679.531000]
[4294679.531000] Code: ffb400c0  ffb300b8  ffb200b0 <dca30100> 24020010
0080882d  30630018  00a0802d  1062000b
[4294679.534000] CPU 0 Unable to handle kernel paging request at virtual
address 0000000000000100, epc == ffffffff801100cc, 0[4294679.535000]
Oops[#2]:
[4294679.535000] Cpu 0
[4294679.535000] $ 0   : 0000000000000000 0000000010001fe0
a800000000483868 ffffffff803ae430
[4294679.535000] $ 4   : a800000000487eb0 0000000000000000
0000000000000004 fffffffffffffdfe
[4294679.535000] $ 8   : 0000000400038e28 000000007f933978
0000000000000000 fffffffffffff7ff
[4294679.535000] $12   : 0000000000000000 0000000000000018
0000000000200200 0000000000100100
[4294679.535000] $16   : 0000000000410000 000000007f9339f8
000000007f933a88 0000000000000001
[4294679.535000] $20   : 000000007f933970 000000000044b0e8
000000007f933978 000000007f935f44
[4294679.535000] $24   : 0000000000000000 ffffffff801100b0
[4294679.535000] $28   : a800000000484000 a800000000487de0
0000000000000000 ffffffff80102280
[4294679.535000] Hi    : 00000000000000e9
[4294679.535000] Lo    : 0000000000000004
[4294679.535000] epc   : ffffffff801100cc do_signal32+0x1c/0x2a0     Not
tainted
[4294679.535000] ra    : ffffffff80102280 work_notifysig+0xc/0x14
[4294679.535000] Status: 10001fe2    KX SX UX KERNEL EXL
[4294679.535000] Cause : 00808008
[4294679.535000] BadVA : 0000000000000100
[4294679.535000] PrId  : 01041100
[4294679.535000] Modules linked in:
[4294679.535000] Process init (pid: 1, threadinfo=a800000000484000,
task=a800000000483868)
[4294679.535000] Stack : a8000000cfe4eee0 a8000000cfe4eee8
a8000000cfe4eef0 a8000000cfe4eef8
[4294679.535000]         a8000000cfe4ef00 a8000000cfe4ef08
0000000000000000 0000000000000000
[4294679.535000]         a800000000487e90 0000000000489b70
000000007f933970 000000007f9339f8
[4294679.535000]         000000007f933a88 0000000000000001
000000007f933970 000000000044b0e8
[4294679.535000]         000000007f933978 000000007f935f44
0000000000000000 ffffffff801b88ec
[4294679.535000]         0000000000410000 000000007f9339f8
000000007f933a88 0000000000000001
[4294679.535000]         000000007f933970 ffffffff80102280
0000000000000202 0000000000000008
[4294679.535000]         0000000000000202 0000000000000400
000000000000000b 000000007f933978
[4294679.535000]         0000000000000000 0000000000000001
0000000000000000 000000002aaff1c0
[4294679.535000]         0000100000000008 0000000000000000
0000000000000000 0000000000000000
[4294679.535000]         ...
[4294679.535000] Call Trace:
[4294679.535000]  [<ffffffff801b88ec>] compat_sys_select+0xbc/0x1a0
[4294679.535000]  [<ffffffff80102280>] work_notifysig+0xc/0x14
[4294679.535000]  [<ffffffff80198190>] sys_dup+0x28/0x40
[4294679.535000]
[4294679.535000]
[4294679.535000] Code: ffb400c0  ffb300b8  ffb200b0 <dca30100> 24020010
0080882d  30630018  00a0802d  1062000b
[4294679.536000] Kernel panic - not syncing: Attempted to kill init!
[4294679.537000]  <0>Rebooting in 5 seconds..Passing control back to
CFE... 



From zzh.hust@gmail.com Thu Feb  9 06:29:26 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 09 Feb 2006 06:29:53 +0000 (GMT)
Received: from wproxy.gmail.com ([64.233.184.204]:18525 "EHLO wproxy.gmail.com")
	by ftp.linux-mips.org with ESMTP id S8133435AbWBIG3Y convert rfc822-to-8bit
	(ORCPT <rfc822;linux-mips@linux-mips.org>);
	Thu, 9 Feb 2006 06:29:24 +0000
Received: by wproxy.gmail.com with SMTP id i3so236190wra
        for <linux-mips@linux-mips.org>; Wed, 08 Feb 2006 22:35:14 -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=BH/egFK0ZohYoPmqheX/1VdYliLKzRn3lx8lKbKe8ZwHl9dCX3DxZpobmYF7eDhsH1yh/hJTfLDQ7Ek7MeTBIh/YzBJJ2lQOzo/7/9lPrMABOR6tYrJz4q0r8nbVJ4+Ph/O5SXKX8kYW0LYtHVZ9YrWcd5SPjyA5pJhuilxphl8=
Received: by 10.54.135.1 with SMTP id i1mr1107756wrd;
        Wed, 08 Feb 2006 22:35:14 -0800 (PST)
Received: by 10.54.128.6 with HTTP; Wed, 8 Feb 2006 22:35:14 -0800 (PST)
Message-ID: <50c9a2250602082235k1add529ctff120d0184425048@mail.gmail.com>
Date:	Thu, 9 Feb 2006 14:35:14 +0800
From:	zhuzhenhua <zzh.hust@gmail.com>
To:	linux-mips <linux-mips@linux-mips.org>
Subject: how to use sde toolchain to compile a hello world?
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8BIT
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: 10376
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
Content-Length: 213
Lines: 8

some toolchain can use as "xxx-gcc -o hello hello.c" to compile, but
sde toolchain can't find the printf function, does it means sde is not
a complete toolchain to compile applications?


Best regards

Zhuzhenhua

From geert@linux-m68k.org Thu Feb  9 08:55:50 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 09 Feb 2006 08:56:04 +0000 (GMT)
Received: from witte.sonytel.be ([80.88.33.193]:52381 "EHLO witte.sonytel.be")
	by ftp.linux-mips.org with ESMTP id S8133355AbWBIIzu (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Thu, 9 Feb 2006 08:55:50 +0000
Received: from pademelon.sonytel.be (mail.sonytel.be [43.221.60.197])
	by witte.sonytel.be (8.12.10/8.12.10) with ESMTP id k1991eYL010748;
	Thu, 9 Feb 2006 10:01:40 +0100 (MET)
Date:	Thu, 9 Feb 2006 10:01:40 +0100 (CET)
From:	Geert Uytterhoeven <geert@linux-m68k.org>
To:	zhuzhenhua <zzh.hust@gmail.com>
cc:	linux-mips <linux-mips@linux-mips.org>
Subject: Re: how to use sde toolchain to compile a hello world?
In-Reply-To: <50c9a2250602082235k1add529ctff120d0184425048@mail.gmail.com>
Message-ID: <Pine.LNX.4.62.0602091000130.25466@pademelon.sonytel.be>
References: <50c9a2250602082235k1add529ctff120d0184425048@mail.gmail.com>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Return-Path: <geert@linux-m68k.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: 10377
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: geert@linux-m68k.org
Precedence: bulk
X-list: linux-mips
Content-Length: 705
Lines: 19

On Thu, 9 Feb 2006, zhuzhenhua wrote:
> some toolchain can use as "xxx-gcc -o hello hello.c" to compile, but
> sde toolchain can't find the printf function, does it means sde is not
> a complete toolchain to compile applications?

printf() is part of the C-library, which is distributed separately.
So you have to install a C-library for the target (e.g. glibc, uClibc,
dietlibc, newlib, klibc, ...).

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

From nigel@mips.com Thu Feb  9 09:56:10 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 09 Feb 2006 09:56:20 +0000 (GMT)
Received: from 209-232-97-206.ded.pacbell.net ([209.232.97.206]:59778 "EHLO
	dns0.mips.com") by ftp.linux-mips.org with ESMTP id S8133437AbWBIJ4K
	(ORCPT <rfc822;linux-mips@linux-mips.org>);
	Thu, 9 Feb 2006 09:56:10 +0000
Received: from mercury.mips.com (sbcns-dmz [209.232.97.193])
	by dns0.mips.com (8.12.11/8.12.11) with ESMTP id k19A1mfA014582;
	Thu, 9 Feb 2006 02:01:53 -0800 (PST)
Received: from olympia.mips.com (olympia [192.168.192.128])
	by mercury.mips.com (8.12.9/8.12.11) with ESMTP id k19A1l89023000;
	Thu, 9 Feb 2006 02:01:47 -0800 (PST)
Received: from olympia.mips.com ([192.168.192.128] helo=[127.0.0.1])
	by olympia.mips.com with esmtp (Exim 3.36 #1 (Debian))
	id 1F78cM-0004Ru-00; Thu, 09 Feb 2006 10:01:38 +0000
Message-ID: <43EB1302.9090907@mips.com>
Date:	Thu, 09 Feb 2006 10:01:38 +0000
From:	Nigel Stephens <nigel@mips.com>
User-Agent: Thunderbird 1.5 (Windows/20051201)
MIME-Version: 1.0
To:	zhuzhenhua <zzh.hust@gmail.com>
CC:	linux-mips <linux-mips@linux-mips.org>
Subject: Re: how to use sde toolchain to compile a hello world?
References: <50c9a2250602082235k1add529ctff120d0184425048@mail.gmail.com>
In-Reply-To: <50c9a2250602082235k1add529ctff120d0184425048@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-MTUK-Scanner:	Found to be clean
X-MTUK-SpamCheck: not spam (whitelisted), SpamAssassin (score=-4.801,
	required 4, AWL, BAYES_00)
X-Scanned-By: MIMEDefang 2.39
Return-Path: <nigel@mips.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: 10378
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: nigel@mips.com
Precedence: bulk
X-list: linux-mips
Content-Length: 507
Lines: 13

zhuzhenhua wrote:
> some toolchain can use as "xxx-gcc -o hello hello.c" to compile, but
> sde toolchain can't find the printf function, does it means sde is not
> a complete toolchain to compile applications?
>
>   

The SDE GNU toolchain is configured to build "bare-iron" embedded 
applications, not Linux applications. Using it to build Linux apps would 
be hard. You need a compiler configured as a Linux native or cross 
compiler. See http://www.linux-mips.org/wiki/Toolchains fpr more 
information.


From anemo@mba.ocn.ne.jp Thu Feb  9 15:33:40 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 09 Feb 2006 15:34:43 +0000 (GMT)
Received: from mba.ocn.ne.jp ([210.190.142.172]:43004 "HELO smtp.mba.ocn.ne.jp")
	by ftp.linux-mips.org with SMTP id S8133466AbWBIPdk (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Thu, 9 Feb 2006 15:33:40 +0000
Received: from localhost (p5155-ipad30funabasi.chiba.ocn.ne.jp [221.184.80.155])
	by smtp.mba.ocn.ne.jp (Postfix) with ESMTP
	id A41E3800E; Fri, 10 Feb 2006 00:39:28 +0900 (JST)
Date:	Fri, 10 Feb 2006 00:39:06 +0900 (JST)
Message-Id: <20060210.003906.08077001.anemo@mba.ocn.ne.jp>
To:	linux-mips@linux-mips.org
Cc:	ralf@linux-mips.org
Subject: [PATCH] add protected_blast_icache_range, blast_icache_range, etc.
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: 10379
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
Content-Length: 11500
Lines: 434

Add blast_xxx_range(), protected_blast_xxx_range() etc. for common
use.  They are built by __BUILD_BLAST_CACHE_RANGE().
Use protected_cache_op() macro for various protected_ routines.
Output code should be logically same.

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

diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
index e51c38c..1b71d91 100644
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -471,61 +471,29 @@ struct flush_icache_range_args {
 static inline void local_r4k_flush_icache_range(void *args)
 {
 	struct flush_icache_range_args *fir_args = args;
-	unsigned long dc_lsize = cpu_dcache_line_size();
-	unsigned long ic_lsize = cpu_icache_line_size();
-	unsigned long sc_lsize = cpu_scache_line_size();
 	unsigned long start = fir_args->start;
 	unsigned long end = fir_args->end;
-	unsigned long addr, aend;
 
 	if (!cpu_has_ic_fills_f_dc) {
 		if (end - start > dcache_size) {
 			r4k_blast_dcache();
 		} else {
 			R4600_HIT_CACHEOP_WAR_IMPL;
-			addr = start & ~(dc_lsize - 1);
-			aend = (end - 1) & ~(dc_lsize - 1);
-
-			while (1) {
-				/* Hit_Writeback_Inv_D */
-				protected_writeback_dcache_line(addr);
-				if (addr == aend)
-					break;
-				addr += dc_lsize;
-			}
+			protected_blast_dcache_range(start, end);
 		}
 
 		if (!cpu_icache_snoops_remote_store) {
-			if (end - start > scache_size) {
+			if (end - start > scache_size)
 				r4k_blast_scache();
-			} else {
-				addr = start & ~(sc_lsize - 1);
-				aend = (end - 1) & ~(sc_lsize - 1);
-
-				while (1) {
-					/* Hit_Writeback_Inv_SD */
-					protected_writeback_scache_line(addr);
-					if (addr == aend)
-						break;
-					addr += sc_lsize;
-				}
-			}
+			else
+				protected_blast_scache_range(start, end);
 		}
 	}
 
 	if (end - start > icache_size)
 		r4k_blast_icache();
-	else {
-		addr = start & ~(ic_lsize - 1);
-		aend = (end - 1) & ~(ic_lsize - 1);
-		while (1) {
-			/* Hit_Invalidate_I */
-			protected_flush_icache_line(addr);
-			if (addr == aend)
-				break;
-			addr += ic_lsize;
-		}
-	}
+	else
+		protected_blast_icache_range(start, end);
 }
 
 static void r4k_flush_icache_range(unsigned long start, unsigned long end)
@@ -619,27 +587,14 @@ static void r4k_flush_icache_page(struct
 
 static void r4k_dma_cache_wback_inv(unsigned long addr, unsigned long size)
 {
-	unsigned long end, a;
-
 	/* Catch bad driver code */
 	BUG_ON(size == 0);
 
 	if (cpu_has_subset_pcaches) {
-		unsigned long sc_lsize = cpu_scache_line_size();
-
-		if (size >= scache_size) {
+		if (size >= scache_size)
 			r4k_blast_scache();
-			return;
-		}
-
-		a = addr & ~(sc_lsize - 1);
-		end = (addr + size - 1) & ~(sc_lsize - 1);
-		while (1) {
-			flush_scache_line(a);	/* Hit_Writeback_Inv_SD */
-			if (a == end)
-				break;
-			a += sc_lsize;
-		}
+		else
+			blast_scache_range(addr, addr + size);
 		return;
 	}
 
@@ -651,17 +606,8 @@ static void r4k_dma_cache_wback_inv(unsi
 	if (size >= dcache_size) {
 		r4k_blast_dcache();
 	} else {
-		unsigned long dc_lsize = cpu_dcache_line_size();
-
 		R4600_HIT_CACHEOP_WAR_IMPL;
-		a = addr & ~(dc_lsize - 1);
-		end = (addr + size - 1) & ~(dc_lsize - 1);
-		while (1) {
-			flush_dcache_line(a);	/* Hit_Writeback_Inv_D */
-			if (a == end)
-				break;
-			a += dc_lsize;
-		}
+		blast_dcache_range(addr, addr + size);
 	}
 
 	bc_wback_inv(addr, size);
@@ -669,44 +615,22 @@ static void r4k_dma_cache_wback_inv(unsi
 
 static void r4k_dma_cache_inv(unsigned long addr, unsigned long size)
 {
-	unsigned long end, a;
-
 	/* Catch bad driver code */
 	BUG_ON(size == 0);
 
 	if (cpu_has_subset_pcaches) {
-		unsigned long sc_lsize = cpu_scache_line_size();
-
-		if (size >= scache_size) {
+		if (size >= scache_size)
 			r4k_blast_scache();
-			return;
-		}
-
-		a = addr & ~(sc_lsize - 1);
-		end = (addr + size - 1) & ~(sc_lsize - 1);
-		while (1) {
-			flush_scache_line(a);	/* Hit_Writeback_Inv_SD */
-			if (a == end)
-				break;
-			a += sc_lsize;
-		}
+		else
+			blast_scache_range(addr, addr + size);
 		return;
 	}
 
 	if (size >= dcache_size) {
 		r4k_blast_dcache();
 	} else {
-		unsigned long dc_lsize = cpu_dcache_line_size();
-
 		R4600_HIT_CACHEOP_WAR_IMPL;
-		a = addr & ~(dc_lsize - 1);
-		end = (addr + size - 1) & ~(dc_lsize - 1);
-		while (1) {
-			flush_dcache_line(a);	/* Hit_Writeback_Inv_D */
-			if (a == end)
-				break;
-			a += dc_lsize;
-		}
+		blast_dcache_range(addr, addr + size);
 	}
 
 	bc_inv(addr, size);
diff --git a/arch/mips/mm/c-tx39.c b/arch/mips/mm/c-tx39.c
index 0a97a94..7c572be 100644
--- a/arch/mips/mm/c-tx39.c
+++ b/arch/mips/mm/c-tx39.c
@@ -44,8 +44,6 @@ __asm__ __volatile__( \
 /* TX39H-style cache flush routines. */
 static void tx39h_flush_icache_all(void)
 {
-	unsigned long start = KSEG0;
-	unsigned long end = (start + icache_size);
 	unsigned long flags, config;
 
 	/* disable icache (set ICE#) */
@@ -53,33 +51,18 @@ static void tx39h_flush_icache_all(void)
 	config = read_c0_conf();
 	write_c0_conf(config & ~TX39_CONF_ICE);
 	TX39_STOP_STREAMING();
-
-	/* invalidate icache */
-	while (start < end) {
-		cache16_unroll32(start, Index_Invalidate_I);
-		start += 0x200;
-	}
-
+	blast_icache16();
 	write_c0_conf(config);
 	local_irq_restore(flags);
 }
 
 static void tx39h_dma_cache_wback_inv(unsigned long addr, unsigned long size)
 {
-	unsigned long end, a;
-	unsigned long dc_lsize = current_cpu_data.dcache.linesz;
-
 	/* Catch bad driver code */
 	BUG_ON(size == 0);
 
 	iob();
-	a = addr & ~(dc_lsize - 1);
-	end = (addr + size - 1) & ~(dc_lsize - 1);
-	while (1) {
-		invalidate_dcache_line(a); /* Hit_Invalidate_D */
-		if (a == end) break;
-		a += dc_lsize;
-	}
+	blast_inv_dcache_range(addr, addr + size);
 }
 
 
@@ -241,42 +224,21 @@ static void tx39_flush_data_cache_page(u
 
 static void tx39_flush_icache_range(unsigned long start, unsigned long end)
 {
-	unsigned long dc_lsize = current_cpu_data.dcache.linesz;
-	unsigned long addr, aend;
-
 	if (end - start > dcache_size)
 		tx39_blast_dcache();
-	else {
-		addr = start & ~(dc_lsize - 1);
-		aend = (end - 1) & ~(dc_lsize - 1);
-
-		while (1) {
-			/* Hit_Writeback_Inv_D */
-			protected_writeback_dcache_line(addr);
-			if (addr == aend)
-				break;
-			addr += dc_lsize;
-		}
-	}
+	else
+		protected_blast_dcache_range(start, end);
 
 	if (end - start > icache_size)
 		tx39_blast_icache();
 	else {
 		unsigned long flags, config;
-		addr = start & ~(dc_lsize - 1);
-		aend = (end - 1) & ~(dc_lsize - 1);
 		/* disable icache (set ICE#) */
 		local_irq_save(flags);
 		config = read_c0_conf();
 		write_c0_conf(config & ~TX39_CONF_ICE);
 		TX39_STOP_STREAMING();
-		while (1) {
-			/* Hit_Invalidate_I */
-			protected_flush_icache_line(addr);
-			if (addr == aend)
-				break;
-			addr += dc_lsize;
-		}
+		protected_blast_icache_range(start, end);
 		write_c0_conf(config);
 		local_irq_restore(flags);
 	}
@@ -311,7 +273,7 @@ static void tx39_flush_icache_page(struc
 
 static void tx39_dma_cache_wback_inv(unsigned long addr, unsigned long size)
 {
-	unsigned long end, a;
+	unsigned long end;
 
 	if (((size | addr) & (PAGE_SIZE - 1)) == 0) {
 		end = addr + size;
@@ -322,20 +284,13 @@ static void tx39_dma_cache_wback_inv(uns
 	} else if (size > dcache_size) {
 		tx39_blast_dcache();
 	} else {
-		unsigned long dc_lsize = current_cpu_data.dcache.linesz;
-		a = addr & ~(dc_lsize - 1);
-		end = (addr + size - 1) & ~(dc_lsize - 1);
-		while (1) {
-			flush_dcache_line(a); /* Hit_Writeback_Inv_D */
-			if (a == end) break;
-			a += dc_lsize;
-		}
+		blast_dcache_range(addr, addr + size);
 	}
 }
 
 static void tx39_dma_cache_inv(unsigned long addr, unsigned long size)
 {
-	unsigned long end, a;
+	unsigned long end;
 
 	if (((size | addr) & (PAGE_SIZE - 1)) == 0) {
 		end = addr + size;
@@ -346,14 +301,7 @@ static void tx39_dma_cache_inv(unsigned 
 	} else if (size > dcache_size) {
 		tx39_blast_dcache();
 	} else {
-		unsigned long dc_lsize = current_cpu_data.dcache.linesz;
-		a = addr & ~(dc_lsize - 1);
-		end = (addr + size - 1) & ~(dc_lsize - 1);
-		while (1) {
-			invalidate_dcache_line(a); /* Hit_Invalidate_D */
-			if (a == end) break;
-			a += dc_lsize;
-		}
+		blast_inv_dcache_range(addr, addr + size);
 	}
 }
 
diff --git a/include/asm-mips/r4kcache.h b/include/asm-mips/r4kcache.h
index cc53196..9632c27 100644
--- a/include/asm-mips/r4kcache.h
+++ b/include/asm-mips/r4kcache.h
@@ -14,6 +14,7 @@
 
 #include <asm/asm.h>
 #include <asm/cacheops.h>
+#include <asm/cpu-features.h>
 
 /*
  * This macro return a properly sign-extended address suitable as base address
@@ -78,22 +79,25 @@ static inline void flush_scache_line(uns
 	cache_op(Hit_Writeback_Inv_SD, addr);
 }
 
+#define protected_cache_op(op,addr)				\
+	__asm__ __volatile__(					\
+	"	.set	push			\n"		\
+	"	.set	noreorder		\n"		\
+	"	.set	mips3			\n"		\
+	"1:	cache	%0, (%1)		\n"		\
+	"2:	.set	pop			\n"		\
+	"	.section __ex_table,\"a\"	\n"		\
+	"	"STR(PTR)" 1b, 2b		\n"		\
+	"	.previous"					\
+	:							\
+	: "i" (op), "r" (addr))
+
 /*
  * The next two are for badland addresses like signal trampolines.
  */
 static inline void protected_flush_icache_line(unsigned long addr)
 {
-	__asm__ __volatile__(
-		"	.set	push			\n"
-		"	.set	noreorder		\n"
-		"	.set	mips3			\n"
-		"1:	cache	%0, (%1)		\n"
-		"2:	.set	pop			\n"
-		"	.section __ex_table,\"a\"	\n"
-		"	"STR(PTR)" 1b, 2b		\n"
-		"	.previous"
-		:
-		: "i" (Hit_Invalidate_I), "r" (addr));
+	protected_cache_op(Hit_Invalidate_I, addr);
 }
 
 /*
@@ -104,32 +108,12 @@ static inline void protected_flush_icach
  */
 static inline void protected_writeback_dcache_line(unsigned long addr)
 {
-	__asm__ __volatile__(
-		"	.set	push			\n"
-		"	.set	noreorder		\n"
-		"	.set	mips3			\n"
-		"1:	cache	%0, (%1)		\n"
-		"2:	.set	pop			\n"
-		"	.section __ex_table,\"a\"	\n"
-		"	"STR(PTR)" 1b, 2b		\n"
-		"	.previous"
-		:
-		: "i" (Hit_Writeback_Inv_D), "r" (addr));
+	protected_cache_op(Hit_Writeback_Inv_D, addr);
 }
 
 static inline void protected_writeback_scache_line(unsigned long addr)
 {
-	__asm__ __volatile__(
-		"	.set	push			\n"
-		"	.set	noreorder		\n"
-		"	.set	mips3			\n"
-		"1:	cache	%0, (%1)		\n"
-		"2:	.set	pop			\n"
-		"	.section __ex_table,\"a\"	\n"
-		"	"STR(PTR)" 1b, 2b		\n"
-		"	.previous"
-		:
-		: "i" (Hit_Writeback_Inv_SD), "r" (addr));
+	protected_cache_op(Hit_Writeback_Inv_SD, addr);
 }
 
 /*
@@ -295,4 +279,28 @@ __BUILD_BLAST_CACHE(i, icache, Index_Inv
 __BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 64)
 __BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 128)
 
+/* build blast_xxx_range, protected_blast_xxx_range */
+#define __BUILD_BLAST_CACHE_RANGE(pfx, desc, hitop, prot) \
+static inline void prot##blast_##pfx##cache##_range(unsigned long start, \
+						    unsigned long end)	\
+{									\
+	unsigned long lsize = cpu_##desc##_line_size();			\
+	unsigned long addr = start & ~(lsize - 1);			\
+	unsigned long aend = (end - 1) & ~(lsize - 1);			\
+	while (1) {							\
+		prot##cache_op(hitop, addr);				\
+		if (addr == aend)					\
+			break;						\
+		addr += lsize;						\
+	}								\
+}
+
+__BUILD_BLAST_CACHE_RANGE(d, dcache, Hit_Writeback_Inv_D, protected_)
+__BUILD_BLAST_CACHE_RANGE(s, scache, Hit_Writeback_Inv_SD, protected_)
+__BUILD_BLAST_CACHE_RANGE(i, icache, Hit_Invalidate_I, protected_)
+__BUILD_BLAST_CACHE_RANGE(d, dcache, Hit_Writeback_Inv_D, )
+__BUILD_BLAST_CACHE_RANGE(s, scache, Hit_Writeback_Inv_SD, )
+/* blast_inv_dcache_range */
+__BUILD_BLAST_CACHE_RANGE(inv_d, dcache, Hit_Invalidate_D, )
+
 #endif /* _ASM_R4KCACHE_H */

From anemo@mba.ocn.ne.jp Thu Feb  9 15:37:30 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 09 Feb 2006 15:37:39 +0000 (GMT)
Received: from mba.ocn.ne.jp ([210.190.142.172]:45311 "HELO smtp.mba.ocn.ne.jp")
	by ftp.linux-mips.org with SMTP id S8133466AbWBIPha (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Thu, 9 Feb 2006 15:37:30 +0000
Received: from localhost (p5155-ipad30funabasi.chiba.ocn.ne.jp [221.184.80.155])
	by smtp.mba.ocn.ne.jp (Postfix) with ESMTP
	id C8EC184CD; Fri, 10 Feb 2006 00:43:19 +0900 (JST)
Date:	Fri, 10 Feb 2006 00:43:02 +0900 (JST)
Message-Id: <20060210.004302.96686142.anemo@mba.ocn.ne.jp>
To:	linux-mips@linux-mips.org
Cc:	ralf@linux-mips.org
Subject: [PATCH] Fix build error by removal of obsoleted au1x00_uart driver.
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: 10380
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
Content-Length: 3310
Lines: 82

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

diff --git a/include/asm-mips/serial.h b/include/asm-mips/serial.h
index a08fa1a..7b23664 100644
--- a/include/asm-mips/serial.h
+++ b/include/asm-mips/serial.h
@@ -103,66 +103,6 @@
 #define IVR_SERIAL_PORT_DEFNS
 #endif
 
-#ifdef CONFIG_SOC_AU1500
-#define AU1000_SERIAL_PORT_DEFNS                       \
-    { .baud_base = 0, .port = UART0_ADDR,              \
-      .iomem_base = (unsigned char *)UART0_ADDR,       \
-      .irq = AU1500_UART0_INT, .flags = STD_COM_FLAGS, \
-      .iomem_reg_shift = 2 },                          \
-    { .baud_base = 0, .port = UART3_ADDR,              \
-      .iomem_base = (unsigned char *)UART3_ADDR,       \
-      .irq = AU1500_UART3_INT, .flags = STD_COM_FLAGS, \
-      .iomem_reg_shift = 2 },
-#endif
-
-#ifdef CONFIG_SOC_AU1100
-#define AU1000_SERIAL_PORT_DEFNS                       \
-    { .baud_base = 0, .port = UART0_ADDR,              \
-      .iomem_base = (unsigned char *)UART0_ADDR,       \
-      .irq = AU1100_UART0_INT, .flags = STD_COM_FLAGS, \
-      .iomem_reg_shift = 2 },                          \
-    { .baud_base = 0, .port = UART1_ADDR,              \
-      .iomem_base = (unsigned char *)UART1_ADDR,       \
-      .irq = AU1100_UART1_INT, .flags = STD_COM_FLAGS, \
-      .iomem_reg_shift = 2 },                          \
-    { .baud_base = 0, .port = UART3_ADDR,              \
-      .iomem_base = (unsigned char *)UART3_ADDR,       \
-      .irq = AU1100_UART3_INT, .flags = STD_COM_FLAGS, \
-      .iomem_reg_shift = 2 },
-#endif
-
-#ifdef CONFIG_SOC_AU1550
-#define AU1000_SERIAL_PORT_DEFNS                       \
-    { .baud_base = 0, .port = UART0_ADDR,              \
-      .iomem_base = (unsigned char *)UART0_ADDR,       \
-      .irq = AU1550_UART0_INT, .flags = STD_COM_FLAGS, \
-      .iomem_reg_shift = 2 },                          \
-    { .baud_base = 0, .port = UART1_ADDR,              \
-      .iomem_base = (unsigned char *)UART1_ADDR,       \
-      .irq = AU1550_UART1_INT, .flags = STD_COM_FLAGS, \
-      .iomem_reg_shift = 2 },                          \
-    { .baud_base = 0, .port = UART3_ADDR,              \
-      .iomem_base = (unsigned char *)UART3_ADDR,       \
-      .irq = AU1550_UART3_INT,  .flags = STD_COM_FLAGS,\
-      .iomem_reg_shift = 2 },
-#endif
-
-#ifdef CONFIG_SOC_AU1200
-#define AU1000_SERIAL_PORT_DEFNS                       \
-    { .baud_base = 0, .port = UART0_ADDR,              \
-      .iomem_base = (unsigned char *)UART0_ADDR,       \
-      .irq = AU1200_UART0_INT, .flags = STD_COM_FLAGS, \
-      .iomem_reg_shift = 2 },                          \
-    { .baud_base = 0, .port = UART1_ADDR,              \
-      .iomem_base = (unsigned char *)UART1_ADDR,       \
-      .irq = AU1200_UART1_INT, .flags = STD_COM_FLAGS, \
-      .iomem_reg_shift = 2 },
-#endif
-
-#else
-#define AU1000_SERIAL_PORT_DEFNS
-#endif
-
 #ifdef CONFIG_HAVE_STD_PC_SERIAL_PORT
 #define STD_SERIAL_PORT_DEFNS			\
 	/* UART CLK   PORT IRQ     FLAGS        */			\
@@ -309,7 +249,6 @@
 	MOMENCO_OCELOT_G_SERIAL_PORT_DEFNS		\
 	MOMENCO_OCELOT_C_SERIAL_PORT_DEFNS		\
 	MOMENCO_OCELOT_SERIAL_PORT_DEFNS		\
-	MOMENCO_OCELOT_3_SERIAL_PORT_DEFNS		\
-	AU1000_SERIAL_PORT_DEFNS
+	MOMENCO_OCELOT_3_SERIAL_PORT_DEFNS
 
 #endif /* _ASM_SERIAL_H */

From ralf@linux-mips.org Thu Feb  9 15:43:59 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 09 Feb 2006 15:44:08 +0000 (GMT)
Received: from mipsfw.mips-uk.com ([194.74.144.146]:57622 "EHLO
	bacchus.dhis.org") by ftp.linux-mips.org with ESMTP
	id S8133475AbWBIPn7 (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Thu, 9 Feb 2006 15:43:59 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by bacchus.dhis.org (8.13.4/8.13.4) with ESMTP id k19FnxFW013488;
	Thu, 9 Feb 2006 15:49:59 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.4/8.13.4/Submit) id k19Fnx3T013487;
	Thu, 9 Feb 2006 15:49:59 GMT
Date:	Thu, 9 Feb 2006 15:49:59 +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] Fix build error by removal of obsoleted au1x00_uart driver.
Message-ID: <20060209154959.GA3558@linux-mips.org>
References: <20060210.004302.96686142.anemo@mba.ocn.ne.jp>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20060210.004302.96686142.anemo@mba.ocn.ne.jp>
User-Agent: Mutt/1.4.2.1i
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: 10381
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
Content-Length: 222
Lines: 7

On Fri, Feb 10, 2006 at 12:43:02AM +0900, Atsushi Nemoto wrote:

> Subject: [PATCH] Fix build error by removal of obsoleted au1x00_uart driver.

You were seconds to late, I already checked in an identical patch :)

  Ralf

From anemo@mba.ocn.ne.jp Thu Feb  9 15:45:30 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 09 Feb 2006 15:45:39 +0000 (GMT)
Received: from mba.ocn.ne.jp ([210.190.142.172]:41669 "HELO smtp.mba.ocn.ne.jp")
	by ftp.linux-mips.org with SMTP id S8133466AbWBIPpa (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Thu, 9 Feb 2006 15:45:30 +0000
Received: from localhost (p5155-ipad30funabasi.chiba.ocn.ne.jp [221.184.80.155])
	by smtp.mba.ocn.ne.jp (Postfix) with ESMTP
	id 229968422; Fri, 10 Feb 2006 00:51:21 +0900 (JST)
Date:	Fri, 10 Feb 2006 00:51:04 +0900 (JST)
Message-Id: <20060210.005104.63742308.anemo@mba.ocn.ne.jp>
To:	linux-mips@linux-mips.org
Cc:	ralf@linux-mips.org
Subject: [PATCH] make qemu buildable without CONFIG_VT
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: 10382
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
Content-Length: 815
Lines: 26

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

diff --git a/arch/mips/qemu/Makefile b/arch/mips/qemu/Makefile
index 11189fa..5f34a85 100644
--- a/arch/mips/qemu/Makefile
+++ b/arch/mips/qemu/Makefile
@@ -2,4 +2,5 @@
 # Makefile for Qemu specific kernel interface routines under Linux.
 #
 
-obj-y		= q-firmware.o q-int.o q-irq.o q-mem.o q-setup.o q-vga.o
+obj-y		= q-firmware.o q-int.o q-irq.o q-mem.o q-setup.o
+obj-$(CONFIG_VT) = q-vga.o
diff --git a/arch/mips/qemu/q-setup.c b/arch/mips/qemu/q-setup.c
index 32c3d4c..acf0f5b 100644
--- a/arch/mips/qemu/q-setup.c
+++ b/arch/mips/qemu/q-setup.c
@@ -23,6 +23,8 @@ static void __init qemu_timer_setup(stru
 void __init plat_setup(void)
 {
 	set_io_port_base(QEMU_PORT_BASE);
+#ifdef CONFIG_VT
 	qvga_init();
+#endif
 	board_timer_setup = qemu_timer_setup;
 }

From anemo@mba.ocn.ne.jp Thu Feb  9 16:20:25 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 09 Feb 2006 16:20:44 +0000 (GMT)
Received: from mba.ocn.ne.jp ([210.190.142.172]:18888 "HELO smtp.mba.ocn.ne.jp")
	by ftp.linux-mips.org with SMTP id S8133489AbWBIQUZ (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Thu, 9 Feb 2006 16:20:25 +0000
Received: from localhost (p5155-ipad30funabasi.chiba.ocn.ne.jp [221.184.80.155])
	by smtp.mba.ocn.ne.jp (Postfix) with ESMTP
	id 03EBF9BDB; Fri, 10 Feb 2006 01:26:16 +0900 (JST)
Date:	Fri, 10 Feb 2006 01:25:59 +0900 (JST)
Message-Id: <20060210.012559.89066702.anemo@mba.ocn.ne.jp>
To:	ralf@linux-mips.org
Cc:	linux-mips@linux-mips.org
Subject: Re: [PATCH] Fix build error by removal of obsoleted au1x00_uart
 driver.
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
In-Reply-To: <20060209154959.GA3558@linux-mips.org>
References: <20060210.004302.96686142.anemo@mba.ocn.ne.jp>
	<20060209154959.GA3558@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: 10383
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
Content-Length: 832
Lines: 26

>>>>> On Thu, 9 Feb 2006 15:49:59 +0000, Ralf Baechle <ralf@linux-mips.org> said:

ralf> You were seconds to late, I already checked in an identical
ralf> patch :)

Oh I see.  It seems linux-2.6.15.git is a bit behind linux.git ;-)


BTW, linux-2.6.15.git repository is somewhat broken, isn't it?  When I
pull using git protocol just after rsync, I got following error.  I'm
using git 1.1.6.

$ git-pull rsync://ftp.linux-mips.org/pub/scm/linux-2.6.15.git
receiving file list ... done

sent 107 bytes  received 162 bytes  41.38 bytes/sec
total size is 64135739  speedup is 238422.82
Already up-to-date.
$ git-pull git://ftp.linux-mips.org/pub/scm/linux-2.6.15.git
error: Could not read 91483db9b01b547ae9cc45c8c98b217642acb40a
error: Could not read 826eeb53a6f264842200d3311d69107d2eb25f5e
Already up-to-date.
$

---
Atsushi Nemoto

From pulsar@kpsws.com Thu Feb  9 16:27:00 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 09 Feb 2006 16:27:10 +0000 (GMT)
Received: from [213.189.19.80] ([213.189.19.80]:65293 "EHLO mail.kpsws.com")
	by ftp.linux-mips.org with ESMTP id S8133489AbWBIQ1A (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Thu, 9 Feb 2006 16:27:00 +0000
Received: (qmail 35518 invoked by uid 89); 9 Feb 2006 16:32:36 -0000
Received: from unknown (HELO mail.kpsws.com) (127.0.0.1)
  by localhost with SMTP; 9 Feb 2006 16:32:36 -0000
Received: from 194.171.252.101
        (SquirrelMail authenticated user pulsar@kpsws.com)
        by mail.kpsws.com with HTTP;
        Thu, 9 Feb 2006 17:32:36 +0100 (CET)
Message-ID: <13126.194.171.252.101.1139502756.squirrel@mail.kpsws.com>
In-Reply-To: <20060210.005104.63742308.anemo@mba.ocn.ne.jp>
References: <20060210.005104.63742308.anemo@mba.ocn.ne.jp>
Date:	Thu, 9 Feb 2006 17:32:36 +0100 (CET)
Subject: changing the page properties to cached/uncached
From:	"Niels Sterrenburg" <pulsar@kpsws.com>
To:	linux-mips@linux-mips.org
Reply-To: pulsar@kpsws.com
User-Agent: SquirrelMail/1.4.0
MIME-Version: 1.0
Content-Type: text/plain;charset=iso-8859-1
X-Priority: 3
Importance: Normal
Return-Path: <pulsar@kpsws.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: 10384
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: pulsar@kpsws.com
Precedence: bulk
X-list: linux-mips
Content-Length: 3508
Lines: 167

Dear list members,

Sorry for the long mail, but we're trying some exiting things
on which we need help....

----------------------

What we want:

----------------------

We have a multiprocessor system containing one MIPS r4k and
one DSP (alike) processor.

We are porting our Inter Processor Communication software to
do communication by the use of
interrupts between MIPS and DSP and
via a shared memory area in RAM for the data transfer.



SDRAM memory map:



0x00000000-0x03000000: MIPS with Linux:	48 MB

0x03000000-0x04000000: DSP software:    16 MB

0x04000000-0x08000000: Shared memory:   64 MB



We want to make this shared memory available to userspace applications so
that they can use it
without having a copy over the kernel boundary.



Besides that we want to set the shared memory cache coherancy to cached
copy-back !!!



----------------------

Our strategy:

----------------------

- Do not use swapping in the system

- Limit Linux memory usage via the mem= option in the kernel command line.

- From MIPS user space: do a mmap for the shared memory area.

- From MIPS user space: call (our selfwritten) shmemipc driver with the
request to set the mapped pages to cached (by passing virtual address and
length).

- From kernel space: find the vma for the supplied virtual address range
and change cache properties of all pages in that virtual range.



At this point the userspace application should have a cached view to
shared memory.

For flushing and invalidate we intend to use the same shmemipc driver
(e.g. to delegate the job to kernel space).



E.g.

userapp wants to read shared memory: call shmemipc driver to invalidate a
certain virtual range (before the read)

userapp wants to write shared memory: call shmemipc driver to flush a
certain virtual range (after the write)

etc.



----------------------

What we tried:

----------------------

We exported the cache flush routines in the kernel so that we can use them
in a loadable module.

We exported the tlb flush routines in the kernel so that we can use them
in a loadable module.

We succesfully do an mmap of the shared memory:

- As we mmap outside the kernel sdram (<48MB), mmap creates new pages
which are initialized to uncached, e.g. it assumes I/O)



In the driver we can find a valid vma for the memory mapped range.



We (try to) change the cache porperties of the page(s) in the vma by:

- adapting the vma->vm_page_prot and set cache properties to cached.

- for this we created the following inline derived from pgprot_noncached:

static inline pgprot_t pgprot_cached(pgprot_t _prot)

{

    unsigned long prot = pgprot_val(_prot);



    prot = (prot & ~_CACHE_MASK) | _CACHE_CACHABLE_NONCOHERENT;



    return __pgprot(prot);

}

- this inline we use as follows:

vma->vm_page_prot = pgprot_cached(vma->vm_page_prot);

- After this we do a local_flush_tlb_page or local_flush_tlb_all in order
to get the hardware TLB updated by the adapted oine in the page table.



----------------------

Open issues:

----------------------

We use dump_tlb_all to see if the cache properties of the page has
changed, which is not the case.
We use a multiprocessor test to check if the shared memory view from MIPS
is cached, which is not the case.



What are we missing here ?

What are the exact steps for adapting page properties in the kernel (for
MIPS) ?

We looked at remap_pfn_range but this sets pages to be IO and reserved....



Any help is very much appreciated.

regards,

Niels Sterrenburg


From ralf@linux-mips.org Thu Feb  9 16:38:11 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 09 Feb 2006 16:38:19 +0000 (GMT)
Received: from mipsfw.mips-uk.com ([194.74.144.146]:32791 "EHLO
	bacchus.dhis.org") by ftp.linux-mips.org with ESMTP
	id S8133489AbWBIQiL (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Thu, 9 Feb 2006 16:38:11 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by bacchus.dhis.org (8.13.4/8.13.4) with ESMTP id k19GiCPI015843;
	Thu, 9 Feb 2006 16:44:12 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.4/8.13.4/Submit) id k19GiChX015842;
	Thu, 9 Feb 2006 16:44:12 GMT
Date:	Thu, 9 Feb 2006 16:44:12 +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] Fix build error by removal of obsoleted au1x00_uart driver.
Message-ID: <20060209164412.GB3558@linux-mips.org>
References: <20060210.004302.96686142.anemo@mba.ocn.ne.jp> <20060209154959.GA3558@linux-mips.org> <20060210.012559.89066702.anemo@mba.ocn.ne.jp>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20060210.012559.89066702.anemo@mba.ocn.ne.jp>
User-Agent: Mutt/1.4.2.1i
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: 10385
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
Content-Length: 1682
Lines: 43

On Fri, Feb 10, 2006 at 01:25:59AM +0900, Atsushi Nemoto wrote:

> >>>>> On Thu, 9 Feb 2006 15:49:59 +0000, Ralf Baechle <ralf@linux-mips.org> said:
> 
> ralf> You were seconds to late, I already checked in an identical
> ralf> patch :)
> 
> Oh I see.  It seems linux-2.6.15.git is a bit behind linux.git ;-)

Not really - I just had not pushed it out yet, so it wasn't get in
linux.git either.

> BTW, linux-2.6.15.git repository is somewhat broken, isn't it?  When I
> pull using git protocol just after rsync, I got following error.  I'm
> using git 1.1.6.
> 
> $ git-pull rsync://ftp.linux-mips.org/pub/scm/linux-2.6.15.git
> receiving file list ... done

Don't do pulls using rsync URLs, it's rather slow as will download all the
packs each time I repacked the archive - which I last did this morning.

Otoh for very large pulls the git protocol is putting a significant
burden on the linux-mips.org machine ...  But linux-2.6.15.git fortunately
doesn't classify as large in this context.

> sent 107 bytes  received 162 bytes  41.38 bytes/sec
> total size is 64135739  speedup is 238422.82
> Already up-to-date.
> $ git-pull git://ftp.linux-mips.org/pub/scm/linux-2.6.15.git
> error: Could not read 91483db9b01b547ae9cc45c8c98b217642acb40a
> error: Could not read 826eeb53a6f264842200d3311d69107d2eb25f5e
> Already up-to-date.
> $

When cloning such a repository git isn't actually downloading the
.git/info/grafts file.  This results in such errors.  I don't know of a
way to get git to do this right.  You may download the file manually
and install it into your tree.  The URL of the grafts file is:

  http://www.linux-mips.org/pub/scm/linux-2.6.15.git/info/grafts

  Ralf

From vagabon.xyz@gmail.com Thu Feb  9 17:48:13 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 09 Feb 2006 17:48:22 +0000 (GMT)
Received: from zproxy.gmail.com ([64.233.162.206]:65262 "EHLO zproxy.gmail.com")
	by ftp.linux-mips.org with ESMTP id S8133489AbWBIRsN convert rfc822-to-8bit
	(ORCPT <rfc822;linux-mips@linux-mips.org>);
	Thu, 9 Feb 2006 17:48:13 +0000
Received: by zproxy.gmail.com with SMTP id l8so214001nzf
        for <linux-mips@linux-mips.org>; Thu, 09 Feb 2006 09:54:05 -0800 (PST)
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws;
        s=beta; d=gmail.com;
        h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references;
        b=IljwgaglojBYOUCjSMjk1KN/UWUya3aGB9US6PpMoXaSuTAbZJFCzg0A/t9HCD3NdcNGm3Tr4U4F0KQyCQ0FYnlyjXs8fQXDw+xKN6i1L309wD9vtOf9ywc5amLxFmnHWnuJegGLVC/2SUv2PnAlVEY7wYKVuI0vYfXk9ocFvPk=
Received: by 10.36.97.18 with SMTP id u18mr3793491nzb;
        Thu, 09 Feb 2006 09:54:05 -0800 (PST)
Received: by 10.36.49.12 with HTTP; Thu, 9 Feb 2006 09:54:05 -0800 (PST)
Message-ID: <cda58cb80602090954s46ba0d78s@mail.gmail.com>
Date:	Thu, 9 Feb 2006 18:54:05 +0100
From:	Franck Bui-Huu <vagabon.xyz@gmail.com>
To:	Ralf Baechle <ralf@linux-mips.org>
Subject: Re: [PATCH] Fix build error by removal of obsoleted au1x00_uart driver.
Cc:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>, linux-mips@linux-mips.org
In-Reply-To: <20060209164412.GB3558@linux-mips.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8BIT
Content-Disposition: inline
References: <20060210.004302.96686142.anemo@mba.ocn.ne.jp>
	 <20060209154959.GA3558@linux-mips.org>
	 <20060210.012559.89066702.anemo@mba.ocn.ne.jp>
	 <20060209164412.GB3558@linux-mips.org>
Return-Path: <vagabon.xyz@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: 10386
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: vagabon.xyz@gmail.com
Precedence: bulk
X-list: linux-mips
Content-Length: 572
Lines: 14

2006/2/9, Ralf Baechle <ralf@linux-mips.org>:
> When cloning such a repository git isn't actually downloading the
> .git/info/grafts file.  This results in such errors.  I don't know of a
> way to get git to do this right.  You may download the file manually

you can't. It seems that graft thing is, for now, only used to change
your _own_ repository's history. Fetching from a "cautorized"
repository is a risky job and you might have bad results.

It's going to change with the "shallow-clone" thing, but I don't know
when it will come out...

--
               Franck

From donimus@gmail.com Fri Feb 10 03:03:45 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 10 Feb 2006 03:03:53 +0000 (GMT)
Received: from wproxy.gmail.com ([64.233.184.197]:60617 "EHLO wproxy.gmail.com")
	by ftp.linux-mips.org with ESMTP id S8133541AbWBJDDp (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Fri, 10 Feb 2006 03:03:45 +0000
Received: by wproxy.gmail.com with SMTP id 36so462528wra
        for <linux-mips@linux-mips.org>; Thu, 09 Feb 2006 19:09:40 -0800 (PST)
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws;
        s=beta; d=gmail.com;
        h=received:message-id:date:from:user-agent:x-accept-language:mime-version:to:subject:content-type:content-transfer-encoding;
        b=XRvE8K8P7vbg6YLPfz01YC7kqJuCLg4JAK7PKZ695hJx/VxvQsx2FPnhOO88HX1JoKOuFZRI+buWM6LERPEQSPW2lf6/JrIYtahpd3nfCps62Dwotb3CopaSy2Gxb5KXapgNGuTsjyPRyiU3gzvWtuABBTiirv8lxWpgVa+LTgE=
Received: by 10.54.65.6 with SMTP id n6mr2349103wra;
        Thu, 09 Feb 2006 19:09:40 -0800 (PST)
Received: from ?192.168.2.99? ( [24.184.9.219])
        by mx.gmail.com with ESMTP id 34sm2046954wra.2006.02.09.19.09.39;
        Thu, 09 Feb 2006 19:09:40 -0800 (PST)
Message-ID: <43EC03F4.4040805@gmail.com>
Date:	Thu, 09 Feb 2006 22:09:40 -0500
From:	Don Imus <donimus@gmail.com>
User-Agent: Mozilla Thunderbird 0.9 (Windows/20041103)
X-Accept-Language: en-us, en
MIME-Version: 1.0
To:	linux-mips@linux-mips.org
Subject: Rogue Branch - can git help here?
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Return-Path: <donimus@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: 10387
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: donimus@gmail.com
Precedence: bulk
X-list: linux-mips
Content-Length: 1304
Lines: 28

I've got an old Linux 2.4.18 source tree I downloaded from a vendor who 
sells devices using MIPS processors with embedded Linux running on them.

There are clearly places in the code where the vendor has made changes. 
  Unfotunately, the vendor used their own CVS and every tagged file 
shows revision 1.1.1.1.

Can GIT help me determine on which date the vendor's tree was originally 
pulled?

I thought of a script call GIT to diff the file against all revisions in 
the repo, possibly creating patch files, and then I could look at the 
number of changes for each as a measure of "closeness".  Doing this for 
several files and finding commonality in the dates would increase the 
probability of finding the right one.

If I copy the vendor source tree into the local GIT tree and commit a 
new branch are there any facilitites in GIT that would tell me which 
older revision, prior to a given date, is the best "match" on the files 
in the tree?

I just started using GIT and maybe the question is better for the GIT 
mailing list but I figured I'd ask it here first and see if anyone has 
already done something like this.

In case anyone's wondering the device ships with a binary-only device 
driver module that will only work with a 2.4.18 kernel and that's why 
I'm stuck in the past on this.

From tnt@246tNt.com Fri Feb 10 08:30:20 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 10 Feb 2006 08:30:29 +0000 (GMT)
Received: from outmx017.isp.belgacom.be ([195.238.4.116]:37310 "EHLO
	outmx017.isp.belgacom.be") by ftp.linux-mips.org with ESMTP
	id S8133361AbWBJIaU (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Fri, 10 Feb 2006 08:30:20 +0000
Received: from outmx017.isp.belgacom.be (localhost [127.0.0.1])
        by outmx017.isp.belgacom.be (8.12.11/8.12.11/Skynet-OUT-2.22) with ESMTP id k1A8a01M015963
        for <linux-mips@linux-mips.org>; Fri, 10 Feb 2006 09:36:01 +0100
        (envelope-from <tnt@246tNt.com>)
Received: from [10.0.0.132] (161-134.245.81.adsl.skynet.be [81.245.134.161])
        by outmx017.isp.belgacom.be (8.12.11/8.12.11/Skynet-OUT-2.22) with ESMTP id k1A8ZuRU015915;
	Fri, 10 Feb 2006 09:35:56 +0100
        (envelope-from <tnt@246tNt.com>)
Message-ID: <43EC50A3.1090007@246tNt.com>
Date:	Fri, 10 Feb 2006 09:36:51 +0100
From:	Sylvain Munaut <tnt@246tNt.com>
User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050610)
X-Accept-Language: en-us, en
MIME-Version: 1.0
To:	Herbert Valerio Riedel <hvr@gnu.org>
CC:	Jay Monkman <jtm@smoothsmoothie.com>, linux-mips@linux-mips.org
Subject: Re: USB on AU1550
References: <433B0299.8080507@smoothsmoothie.com> <1135425163.13029.13.camel@mini.intra>
In-Reply-To: <1135425163.13029.13.camel@mini.intra>
X-Enigmail-Version: 0.90.0.0
X-Enigmail-Supports: pgp-inline, pgp-mime
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Return-Path: <tnt@246tNt.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: 10388
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: tnt@246tNt.com
Precedence: bulk
X-list: linux-mips
Content-Length: 2213
Lines: 72

Maybe it's already in the code but That patch also activates the
OHCI_BIG_ENDIAN flag in the struct ohci_hcd. If not big endian mode
will be choosed only if USB_OHCI_LITTLE_ENDIAN is not selected as well
(both can be selected at once and if they are, it's that plag in the
hcd sruct that selects what to use)

	Sylvain

Herbert Valerio Riedel wrote:
> hello,
> 
> On Wed, 2005-09-28 at 15:52 -0500, Jay Monkman wrote:
> 
>>I'm trying to get USB working on my AU1550 board, and I'm getting an error I
>>don't understand. I've searched the web and the mailing list archives, but
>>haven't found anything relevant.
> 
> 
> there was a post of mine, dating back to 22 Nov 2004 which could have
> been relevant to your cause :-)
> 
> 
>>I'm using 2.6.12, in big-endian mode.
> 
> [..]
> 
>>Can anyone point me in the right direction to get this working?
> 
> 
> don't know whether you still require being pointed in to any direction;
> however, the following patch (against current GIT HEAD, works for me,
> YMMV :-) might provide a hint:
> 
> diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
> index ed1899d..914b964 100644
> --- a/drivers/usb/host/Kconfig
> +++ b/drivers/usb/host/Kconfig
> @@ -100,12 +100,14 @@ config USB_OHCI_HCD_PCI
>  config USB_OHCI_BIG_ENDIAN
>  	bool
>  	depends on USB_OHCI_HCD
> +	default y if SOC_AU1X00 && CPU_BIG_ENDIAN
>  	default n
>  
>  config USB_OHCI_LITTLE_ENDIAN
>  	bool
>  	depends on USB_OHCI_HCD
>  	default n if STB03xxx || PPC_MPC52xx
> +	default n if SOC_AU1X00 && CPU_BIG_ENDIAN
>  	default y
>  
>  config USB_UHCI_HCD
> diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h
> index caacf14..bf18351 100644
> --- a/drivers/usb/host/ohci.h
> +++ b/drivers/usb/host/ohci.h
> @@ -462,6 +462,11 @@ static inline struct usb_hcd *ohci_to_hc
>  #define writel_be(val, addr)	out_be32((__force unsigned *)addr, val)
>  #endif
>  
> +#if defined(CONFIG_SOC_AU1X00)
> +#define readl_be(addr)          __raw_readl((__force u32 *)(addr))
> +#define writel_be(val, addr)    __raw_writel(val, (__force u32 *)(addr))
> +#endif
> +
>  static inline unsigned int ohci_readl (const struct ohci_hcd *ohci,
>  							__hc32 __iomem * regs)
>  {
> 
> 
> greetings,


From rmk+linux-mips=linux-mips.org@arm.linux.org.uk Fri Feb 10 08:38:54 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 10 Feb 2006 08:39:04 +0000 (GMT)
Received: from caramon.arm.linux.org.uk ([212.18.232.186]:33805 "EHLO
	caramon.arm.linux.org.uk") by ftp.linux-mips.org with ESMTP
	id S8133361AbWBJIiy (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Fri, 10 Feb 2006 08:38:54 +0000
Received: from flint.arm.linux.org.uk ([2002:d412:e8ba:1:201:2ff:fe14:8fad])
	by caramon.arm.linux.org.uk with esmtpsa (TLSv1:DES-CBC3-SHA:168)
	(Exim 4.52)
	id 1F7TtE-0007pV-5i; Fri, 10 Feb 2006 08:44:28 +0000
Received: from rmk by flint.arm.linux.org.uk with local (Exim 4.52)
	id 1F7TtV-0000Va-Pd; Fri, 10 Feb 2006 08:44:45 +0000
Date:	Fri, 10 Feb 2006 08:44:45 +0000
From:	Russell King <rmk+lkml@arm.linux.org.uk>
To:	Linux Kernel List <linux-kernel@vger.kernel.org>,
	linux-mips@linux-mips.org, linuxppc-dev@ozlabs.org, pfg@sgi.com
Subject: Re: [CFT] Don't use ASYNC_* nor SERIAL_IO_* with serial_core
Message-ID: <20060210084445.GA1947@flint.arm.linux.org.uk>
Mail-Followup-To: Linux Kernel List <linux-kernel@vger.kernel.org>,
	linux-mips@linux-mips.org, linuxppc-dev@ozlabs.org, pfg@sgi.com
References: <20060121211407.GA19984@dyn-67.arm.linux.org.uk>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20060121211407.GA19984@dyn-67.arm.linux.org.uk>
User-Agent: Mutt/1.4.1i
Return-Path: <rmk+linux-mips=linux-mips.org@arm.linux.org.uk>
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: 10389
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: rmk+lkml@arm.linux.org.uk
Precedence: bulk
X-list: linux-mips
Content-Length: 1705
Lines: 49

On Sat, Jan 21, 2006 at 09:14:07PM +0000, Russell King wrote:
> The ioc4_serial driver is worse.  It assumes that it can set/clear
> ASYNC_CTS_FLOW in the uart_info flags field, which is private to
> serial_core.  It also seems to set TTY_IO_ERROR followed by immediately
> clearing it (pointless), and then it writes to tty->alt_speed... which
> isn't used by the serial layer so is also pointless.

Okay, the only remaining part of this patch which hasn't been applied
is this - can anyone ack it?

diff --git a/drivers/serial/ioc4_serial.c b/drivers/serial/ioc4_serial.c
--- a/drivers/serial/ioc4_serial.c
+++ b/drivers/serial/ioc4_serial.c
@@ -1717,11 +1717,9 @@ ioc4_change_speed(struct uart_port *the_
 	}
 
 	if (cflag & CRTSCTS) {
-		info->flags |= ASYNC_CTS_FLOW;
 		port->ip_sscr |= IOC4_SSCR_HFC_EN;
 	}
 	else {
-		info->flags &= ~ASYNC_CTS_FLOW;
 		port->ip_sscr &= ~IOC4_SSCR_HFC_EN;
 	}
 	writel(port->ip_sscr, &port->ip_serial_regs->sscr);
@@ -1760,18 +1758,6 @@ static inline int ic4_startup_local(stru
 
 	info = the_port->info;
 
-	if (info->tty) {
-		set_bit(TTY_IO_ERROR, &info->tty->flags);
-		clear_bit(TTY_IO_ERROR, &info->tty->flags);
-		if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
-			info->tty->alt_speed = 57600;
-		if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
-			info->tty->alt_speed = 115200;
-		if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI)
-			info->tty->alt_speed = 230400;
-		if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP)
-			info->tty->alt_speed = 460800;
-	}
 	local_open(port);
 
 	/* set the speed of the serial port */

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core

From ralf@linux-mips.org Fri Feb 10 11:37:27 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 10 Feb 2006 11:37:43 +0000 (GMT)
Received: from mipsfw.mips-uk.com ([194.74.144.146]:4868 "EHLO
	bacchus.dhis.org") by ftp.linux-mips.org with ESMTP
	id S8133571AbWBJLh1 (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Fri, 10 Feb 2006 11:37:27 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by bacchus.dhis.org (8.13.4/8.13.4) with ESMTP id k1ABh8PT005779;
	Fri, 10 Feb 2006 11:43:10 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.4/8.13.4/Submit) id k19KrcV2003597;
	Thu, 9 Feb 2006 20:53:38 GMT
Date:	Thu, 9 Feb 2006 20:53:38 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	Franck Bui-Huu <vagabon.xyz@gmail.com>
Cc:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>, linux-mips@linux-mips.org
Subject: Re: [PATCH] Fix build error by removal of obsoleted au1x00_uart driver.
Message-ID: <20060209205338.GA3508@linux-mips.org>
References: <20060210.004302.96686142.anemo@mba.ocn.ne.jp> <20060209154959.GA3558@linux-mips.org> <20060210.012559.89066702.anemo@mba.ocn.ne.jp> <20060209164412.GB3558@linux-mips.org> <cda58cb80602090954s46ba0d78s@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <cda58cb80602090954s46ba0d78s@mail.gmail.com>
User-Agent: Mutt/1.4.2.1i
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: 10390
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
Content-Length: 1402
Lines: 31

On Thu, Feb 09, 2006 at 06:54:05PM +0100, Franck Bui-Huu wrote:

> 2006/2/9, Ralf Baechle <ralf@linux-mips.org>:
> > When cloning such a repository git isn't actually downloading the
> > .git/info/grafts file.  This results in such errors.  I don't know of a
> > way to get git to do this right.  You may download the file manually
> 
> you can't. It seems that graft thing is, for now, only used to change
> your _own_ repository's history. Fetching from a "cautorized"
> repository is a risky job and you might have bad results.

It works for me (TM).

> It's going to change with the "shallow-clone" thing, but I don't know
> when it will come out...

There are many problems with "cautorized" repositories, some with the
current implementation, some more fundamental ones.  Such as what is
the cut-off criterium?  The MIPS git repository also contains the objects
of Linus's tree [1].  So a tag like linux-2.6.15 as the line for truncation
isn't working too well because I'll only truncate the Linux/MIPS history
but that'll still leave all of Linus's tree - well over 130,000 objects -
in the tree.

Anyway, I'm trying to maintain a homebrew shallow variant of the tree
for the time being until git provides a better instrument for the job.

  Ralf

[1] Not Linus's tags to avoid confusion.  They could easily be pulled from
    Linus tree into a separate branch.  Similar for Marcelo's 2.4 tree.

From ralf@linux-mips.org Fri Feb 10 11:38:38 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 10 Feb 2006 11:38:50 +0000 (GMT)
Received: from mipsfw.mips-uk.com ([194.74.144.146]:19211 "EHLO
	bacchus.dhis.org") by ftp.linux-mips.org with ESMTP
	id S8133571AbWBJLih (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Fri, 10 Feb 2006 11:38:37 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by bacchus.dhis.org (8.13.4/8.13.4) with ESMTP id k1ABh8PP005779;
	Fri, 10 Feb 2006 11:43:08 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.4/8.13.4/Submit) id k1A1Ye9l020402;
	Fri, 10 Feb 2006 01:34:40 GMT
Date:	Fri, 10 Feb 2006 01:34:40 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	Martin Michlmayr <tbm@cyrius.com>,
	MIPS Linux List <linux-mips@linux-mips.org>,
	Stuart Anderson <anderson@netsweng.com>,
	David Daney <ddaney@avtrex.com>, richard@codesourcery.com
Subject: Re: Fixes for uaccess.h with gcc >= 4.0.1
Message-ID: <20060210013440.GA5436@linux-mips.org>
References: <20060123150507.GA18665@linux-mips.org> <87wtg6c43s.fsf@talisman.home>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <87wtg6c43s.fsf@talisman.home>
User-Agent: Mutt/1.4.2.1i
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: 10391
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
Content-Length: 618
Lines: 22

On Tue, Feb 07, 2006 at 08:21:11PM +0000, Richard Sandiford wrote:

> Ralf Baechle <ralf@linux-mips.org> writes:
> > I'd appreciate if somebody with gcc 4.0.1 could test this kernel patch
> > below.
> 
> Sorry in advance if this is a dup, but...

No, not a dupe.

> and this requires val (%1) to be a 64-bit value.  In the case I saw,
> gcc was using $3 for the 32-bit val, and wasn't expecting $4 to be
> clobbered.

Thanks, makes perfect sense.  I tried various other obscure things and
your patch was holding up, so I just applied it.

Thanks,

  Ralf

PS: If in the future you could include a Signed-off-by: line.

From ralf@linux-mips.org Fri Feb 10 11:49:41 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 10 Feb 2006 11:49:49 +0000 (GMT)
Received: from mipsfw.mips-uk.com ([194.74.144.146]:5124 "EHLO
	bacchus.dhis.org") by ftp.linux-mips.org with ESMTP
	id S8133588AbWBJLtl (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Fri, 10 Feb 2006 11:49:41 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by bacchus.dhis.org (8.13.4/8.13.4) with ESMTP id k1ABtPWs006118;
	Fri, 10 Feb 2006 11:55:25 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.4/8.13.4/Submit) id k1ABtPme006117;
	Fri, 10 Feb 2006 11:55:25 GMT
Date:	Fri, 10 Feb 2006 11:55:25 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	Don Imus <donimus@gmail.com>
Cc:	linux-mips@linux-mips.org
Subject: Re: Rogue Branch - can git help here?
Message-ID: <20060210115525.GA5195@linux-mips.org>
References: <43EC03F4.4040805@gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <43EC03F4.4040805@gmail.com>
User-Agent: Mutt/1.4.2.1i
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: 10392
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
Content-Length: 1844
Lines: 41

On Thu, Feb 09, 2006 at 10:09:40PM -0500, Don Imus wrote:

> I've got an old Linux 2.4.18 source tree I downloaded from a vendor who 
> sells devices using MIPS processors with embedded Linux running on them.
> 
> There are clearly places in the code where the vendor has made changes. 
>  Unfotunately, the vendor used their own CVS and every tagged file 
> shows revision 1.1.1.1.
> 
> Can GIT help me determine on which date the vendor's tree was originally 
> pulled?
> 
> I thought of a script call GIT to diff the file against all revisions in 
> the repo, possibly creating patch files, and then I could look at the 
> number of changes for each as a measure of "closeness".  Doing this for 
> several files and finding commonality in the dates would increase the 
> probability of finding the right one.
> 
> If I copy the vendor source tree into the local GIT tree and commit a 
> new branch are there any facilitites in GIT that would tell me which 
> older revision, prior to a given date, is the best "match" on the files 
> in the tree?

Nothing straight of the shelf, unfortunately.

> I just started using GIT and maybe the question is better for the GIT 
> mailing list but I figured I'd ask it here first and see if anyone has 
> already done something like this.
> 
> In case anyone's wondering the device ships with a binary-only device 
> driver module that will only work with a 2.4.18 kernel and that's why 
> I'm stuck in the past on this.

The crude ad-hoc method would be to write a quick shell scripts that
creates a diff between every revision between linux-2.4.18..linux-2.4.19
but that would be slow.  And it's a just too common problem (I last faced
it less than a week ago ...) so may deserve a better solution in git than
just an ad-hoc script, so I suggest you indeed take this to the git
mailing list.

  Ralf

From alan@lxorguk.ukuu.org.uk Fri Feb 10 15:52:36 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 10 Feb 2006 15:52:44 +0000 (GMT)
Received: from outpipe-village-512-1.bc.nu ([81.2.110.250]:38310 "EHLO
	lxorguk.ukuu.org.uk") by ftp.linux-mips.org with ESMTP
	id S3467599AbWBJPwg (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Fri, 10 Feb 2006 15:52:36 +0000
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
	by lxorguk.ukuu.org.uk (8.13.4/8.13.4) with ESMTP id k1AG169K013129;
	Fri, 10 Feb 2006 16:01:06 GMT
Received: (from alan@localhost)
	by localhost.localdomain (8.13.4/8.13.4/Submit) id k1AG13n2013128;
	Fri, 10 Feb 2006 16:01:03 GMT
X-Authentication-Warning: localhost.localdomain: alan set sender to alan@lxorguk.ukuu.org.uk using -f
Subject: Re: changing the page properties to cached/uncached
From:	Alan Cox <alan@lxorguk.ukuu.org.uk>
To:	pulsar@kpsws.com
Cc:	linux-mips@linux-mips.org
In-Reply-To: <13126.194.171.252.101.1139502756.squirrel@mail.kpsws.com>
References: <20060210.005104.63742308.anemo@mba.ocn.ne.jp>
	 <13126.194.171.252.101.1139502756.squirrel@mail.kpsws.com>
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Date:	Fri, 10 Feb 2006 16:01:02 +0000
Message-Id: <1139587262.12521.12.camel@localhost.localdomain>
Mime-Version: 1.0
X-Mailer: Evolution 2.2.3 (2.2.3-2.fc4) 
Return-Path: <alan@lxorguk.ukuu.org.uk>
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: 10393
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: alan@lxorguk.ukuu.org.uk
Precedence: bulk
X-list: linux-mips
Content-Length: 1045
Lines: 22

On Iau, 2006-02-09 at 17:32 +0100, Niels Sterrenburg wrote:
> - Do not use swapping in the system
> - Limit Linux memory usage via the mem= option in the kernel command line.
> - From MIPS user space: do a mmap for the shared memory area.
> - From MIPS user space: call (our selfwritten) shmemipc driver with the
> request to set the mapped pages to cached (by passing virtual address and
> length).
> - From kernel space: find the vma for the supplied virtual address range
> and change cache properties of all pages in that virtual range.

You don't need to worry about swapping. You can simply mark the pages in
question reserved just as i386 does with the 640K-1Mb hole or since when
a page has a use count it won't swap out, mark it as having a user. In
your case the "user" is the DSP so you just need to account fine

> - As we mmap outside the kernel sdram (<48MB), mmap creates new pages
> which are initialized to uncached, e.g. it assumes I/O)

You can provide your own "nopage" method. Good example is
sound/oss/via82cxxx_audio.c 



From thomas.koeller@baslerweb.com Fri Feb 10 16:30:35 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 10 Feb 2006 16:30:47 +0000 (GMT)
Received: from mail.baslerweb.com ([145.253.187.130]:10541 "EHLO
	mail.baslerweb.com") by ftp.linux-mips.org with ESMTP
	id S3467599AbWBJQaf (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Fri, 10 Feb 2006 16:30:35 +0000
Received: (from mail@localhost)
	by mail.baslerweb.com (8.12.10/8.12.10) id k1AGZ2cn019249
	for <linux-mips@linux-mips.org>; Fri, 10 Feb 2006 17:35:02 +0100
Received: from unknown by gateway id /processing/kwHJ5xVG; Fri Feb 10 17:34:51 2006
Received: from vclinux-1.basler.corp (localhost [172.16.13.253]) by comm1.baslerweb.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2657.72)
	id 1TF84RSD; Fri, 10 Feb 2006 17:36:23 +0100
From:	Thomas Koeller <thomas.koeller@baslerweb.com>
Organization: Basler AG
To:	linux-mips@linux-mips.org
Date:	Fri, 10 Feb 2006 17:36:27 +0100
User-Agent: KMail/1.6.2
MIME-Version: 1.0
Message-Id: <200602101736.27563.thomas.koeller@baslerweb.com>
Subject: [PATCH] RM9000 icache problem
Content-Disposition: inline
Content-Type: text/plain;
  charset="us-ascii"
Content-Transfer-Encoding: 7bit
Return-Path: <thomas.koeller@baslerweb.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: 10394
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: thomas.koeller@baslerweb.com
Precedence: bulk
X-list: linux-mips
Content-Length: 967
Lines: 30

The code to work around the RM9000 icache problems is wrong and
ineffective. The patch below fixes that.

Signed-off-by: Thomas Koeller  <thomas.koeller@baslerweb.com>

--- linux.git/arch/mips/kernel/signal-common.h	2005-11-02 13:21:29.000000000 +0100
+++ linux-2.6.14-5/arch/mips/kernel/signal-common.h	2006-02-10 12:48:50.000000000 +0100
@@ -176,7 +176,7 @@
 	if ((ka->sa.sa_flags & SA_ONSTACK) && (sas_ss_flags (sp) == 0))
 		sp = current->sas_ss_sp + current->sas_ss_size;
 
-	return (void *)((sp - frame_size) & (ICACHE_REFILLS_WORKAROUND_WAR ? 32 : ALMASK));
+	return (void *)((sp - frame_size) & (ICACHE_REFILLS_WORKAROUND_WAR ? ~(cpu_icache_line_size()-1) : ALMASK));
 }
 
 static inline int install_sigtramp(unsigned int __user *tramp,



-- 
--------------------------------------------------

Thomas Koeller, Software Development
Basler Vision Technologies

thomas dot koeller at baslerweb dot com
http://www.baslerweb.com

==============================


From ralf@linux-mips.org Fri Feb 10 17:09:13 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 10 Feb 2006 17:09:20 +0000 (GMT)
Received: from wf1.mips-uk.com ([194.74.144.154]:54474 "EHLO bacchus.dhis.org")
	by ftp.linux-mips.org with ESMTP id S8133472AbWBJRJM (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Fri, 10 Feb 2006 17:09:12 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by bacchus.dhis.org (8.13.4/8.13.4) with ESMTP id k1AHEKjg004941;
	Fri, 10 Feb 2006 17:14:20 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.4/8.13.4/Submit) id k1AHEKR2004940;
	Fri, 10 Feb 2006 17:14:20 GMT
Date:	Fri, 10 Feb 2006 17:14:20 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	Thomas Koeller <thomas.koeller@baslerweb.com>
Cc:	linux-mips@linux-mips.org
Subject: Re: [PATCH] RM9000 icache problem
Message-ID: <20060210171420.GC32721@linux-mips.org>
References: <200602101736.27563.thomas.koeller@baslerweb.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <200602101736.27563.thomas.koeller@baslerweb.com>
User-Agent: Mutt/1.4.2.1i
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: 10395
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
Content-Length: 270
Lines: 11

On Fri, Feb 10, 2006 at 05:36:27PM +0100, Thomas Koeller wrote:

> The code to work around the RM9000 icache problems is wrong and
> ineffective. The patch below fixes that.

Ah, indeed.  Hand applied, as your patch does not apply to the latest
kernel.

Thanks,

  Ralf

From jcrouse@cosmic.amd.com Fri Feb 10 18:10:06 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 10 Feb 2006 18:10:18 +0000 (GMT)
Received: from amdext4.amd.com ([163.181.251.6]:13978 "EHLO amdext4.amd.com")
	by ftp.linux-mips.org with ESMTP id S8133472AbWBJSKG (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Fri, 10 Feb 2006 18:10:06 +0000
Received: from SAUSGW02.amd.com (sausgw02.amd.com [163.181.250.22])
	by amdext4.amd.com (8.12.11/8.12.11/AMD) with ESMTP id k1AIFx7W021270;
	Fri, 10 Feb 2006 12:15:59 -0600
Received: from 163.181.22.101 by SAUSGW01.amd.com with ESMTP (AMD SMTP
 Relay (Email Firewall v6.1.0)); Fri, 10 Feb 2006 12:15:53 -0600
X-Server-Uuid: 8C3DB987-180B-4465-9446-45C15473FD3E
Received: from ldcmail.amd.com ([147.5.200.40]) by sausexbh1.amd.com
 with Microsoft SMTPSVC(6.0.3790.0); Fri, 10 Feb 2006 10:15:52 -0800
Received: from cosmic.amd.com (cosmic.amd.com [147.5.201.206]) by
 ldcmail.amd.com (Postfix) with ESMTP id 7F1082028; Fri, 10 Feb 2006
 11:15:52 -0700 (MST)
Received: from cosmic.amd.com (localhost [127.0.0.1]) by cosmic.amd.com
 (8.13.4/8.13.4) with ESMTP id k1AIKYkR027535; Fri, 10 Feb 2006 11:20:34
 -0700
Received: (from jcrouse@localhost) by cosmic.amd.com (
 8.13.4/8.13.4/Submit) id k1AIKXkC027534; Fri, 10 Feb 2006 11:20:33
 -0700
Date:	Fri, 10 Feb 2006 11:20:33 -0700
From:	"Jordan Crouse" <jordan.crouse@amd.com>
To:	linux-mips@linux-mips.org, linux-ide@vger.kernel.org
cc:	enrico.walther@amd.com
Subject: [PATCH] Enable MwDMA for AU1200 IDE driver
Message-ID: <20060210182033.GA24353@cosmic.amd.com>
MIME-Version: 1.0
User-Agent: Mutt/1.5.11
X-OriginalArrivalTime: 10 Feb 2006 18:15:52.0938 (UTC)
 FILETIME=[073D5CA0:01C62E6E]
X-WSS-ID: 6FF207D30MS4470519-01-01
Content-Type: multipart/mixed;
 boundary=dDRMvlgZJXvWKvBx
Content-Disposition: inline
Return-Path: <jcrouse@cosmic.amd.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: 10396
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: jordan.crouse@amd.com
Precedence: bulk
X-list: linux-mips
Content-Length: 4420
Lines: 131


--dDRMvlgZJXvWKvBx
Content-Type: text/plain;
 charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: 7bit

Greetings all - the attached patch enables MwDMA mode for the AU1200
IDE driver.  If one heavily uses the USB on the DB1200 board with IDE
in PIO mode, you may experience hangs from overloading the bus with
interrupts - this should help.  Since it is obvious that this is the
desired mode, I'm adding it to the defconfig to enable by default.

Also, I snuck in a fix for a warning (mixed code and declarations = evil!).
Applies against latest lmo git, but it should work for linux-ide as well.

Regards,
Jordan
-- 
Jordan Crouse
Senior Linux Engineer
AMD - Personal Connectivity Solutions Group
<www.amd.com/embeddedprocessors>

--dDRMvlgZJXvWKvBx
Content-Type: text/plain;
 charset=us-ascii
Content-Disposition: inline;
 filename=auide-fixes.patch
Content-Transfer-Encoding: 7bit

[PATCH] Enable MWDMA mode for the AU1200 IDE driver

This enables MwDMA mode for the AU1200 driver - this will benefit
anybody using IDE + USB, which together seem to cause hangs when IDE is 
in PIO due to the large number of interrupts on the same bus.

Signed-off-by: Jordan Crouse <jordan.crouse@amd.com>
---

 arch/mips/configs/db1200_defconfig        |    4 ++--
 drivers/ide/mips/au1xxx-ide.c             |   14 ++++++++++++--
 include/asm-mips/mach-au1x00/au1xxx_ide.h |    9 ---------
 3 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/arch/mips/configs/db1200_defconfig b/arch/mips/configs/db1200_defconfig
index 9288847..355b32f 100644
--- a/arch/mips/configs/db1200_defconfig
+++ b/arch/mips/configs/db1200_defconfig
@@ -497,8 +497,8 @@ CONFIG_BLK_DEV_IDECS=m
 #
 CONFIG_IDE_GENERIC=y
 CONFIG_BLK_DEV_IDE_AU1XXX=y
-CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA=y
-# CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA is not set
+#CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA is not set
+CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA=y
 CONFIG_BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ=128
 # CONFIG_IDE_ARM is not set
 # CONFIG_BLK_DEV_IDEDMA is not set
diff --git a/drivers/ide/mips/au1xxx-ide.c b/drivers/ide/mips/au1xxx-ide.c
index 32431dc..c2bf766 100644
--- a/drivers/ide/mips/au1xxx-ide.c
+++ b/drivers/ide/mips/au1xxx-ide.c
@@ -652,6 +652,7 @@ static int au_ide_probe(struct device *d
 	struct platform_device *pdev = to_platform_device(dev);
 	_auide_hwif *ahwif = &auide_hwif;
 	ide_hwif_t *hwif;
+	hw_regs_t *hw;
 	struct resource *res;
 	int ret = 0;
 
@@ -690,17 +691,26 @@ static int au_ide_probe(struct device *d
 	/* FIXME:  This might possibly break PCMCIA IDE devices */
 
 	hwif                            = &ide_hwifs[pdev->id];
-	hw_regs_t *hw 			= &hwif->hw;
+	hw				= &hwif->hw;
 	hwif->irq = hw->irq             = ahwif->irq;
 	hwif->chipset                   = ide_au1xxx;
 
 	auide_setup_ports(hw, ahwif);
 	memcpy(hwif->io_ports, hw->io_ports, sizeof(hwif->io_ports));
 
+#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ
+	hwif->rqsize = CONFIG_BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ;
+	hwif->rqsize = ((hwif->rqsize > AU1XXX_ATA_RQSIZE)
+			|| (hwif->rqsize < 32)) 
+                        ? AU1XXX_ATA_RQSIZE : hwif->rqsize;
+#else /* if kernel config is not set */
+	hwif->rqsize                    = AU1XXX_ATA_RQSIZE;
+#endif
+			
 	hwif->ultra_mask                = 0x0;  /* Disable Ultra DMA */
 #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
 	hwif->mwdma_mask                = 0x07; /* Multimode-2 DMA  */
-	hwif->swdma_mask                = 0x00;
+	hwif->swdma_mask                = 0x07;
 #else
 	hwif->mwdma_mask                = 0x0;
 	hwif->swdma_mask                = 0x0;
diff --git a/include/asm-mips/mach-au1x00/au1xxx_ide.h b/include/asm-mips/mach-au1x00/au1xxx_ide.h
index 5dab100..b9713c3 100644
--- a/include/asm-mips/mach-au1x00/au1xxx_ide.h
+++ b/include/asm-mips/mach-au1x00/au1xxx_ide.h
@@ -42,11 +42,6 @@
         #define AU1XXX_ATA_RQSIZE       128
 #endif
 
-/* Disable Burstable-Support for DBDMA */
-#ifndef CONFIG_BLK_DEV_IDE_AU1XXX_BURSTABLE_ON
-        #define CONFIG_BLK_DEV_IDE_AU1XXX_BURSTABLE_ON  0
-#endif
-
 typedef struct
 {
         u32                     tx_dev_id, rx_dev_id, target_dev_id;
@@ -65,10 +60,6 @@ typedef struct
 } _auide_hwif;
 
 #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
-struct drive_list_entry {
-	const char *id_model;
-	const char *id_firmware;
-};
 
 /* HD white list */
 static const struct drive_list_entry dma_white_list [] = {

--dDRMvlgZJXvWKvBx--


From pfg@sgi.com Fri Feb 10 20:54:45 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 10 Feb 2006 20:54:54 +0000 (GMT)
Received: from omx1-ext.sgi.com ([192.48.179.11]:28119 "EHLO
	omx1.americas.sgi.com") by ftp.linux-mips.org with ESMTP
	id S8133592AbWBJUyp (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Fri, 10 Feb 2006 20:54:45 +0000
Received: from imr2.americas.sgi.com (imr2.americas.sgi.com [198.149.16.18])
	by omx1.americas.sgi.com (8.12.10/8.12.9/linux-outbound_gateway-1.1) with ESMTP id k1AL0EOX003774;
	Fri, 10 Feb 2006 15:00:15 -0600
Received: from poppy-e236.americas.sgi.com (poppy-e236.americas.sgi.com [128.162.236.207])
	by imr2.americas.sgi.com (8.12.9/8.12.10/SGI_generic_relay-1.2) with ESMTP id k1ALH0a513825180;
	Fri, 10 Feb 2006 13:17:00 -0800 (PST)
Received: from eagdhcp-232-152.americas.sgi.com (eagdhcp-232-152.americas.sgi.com [128.162.232.152]) by poppy-e236.americas.sgi.com (8.12.9/ASC-news-1.4) with ESMTP id k1AL0BSQ682424; Fri, 10 Feb 2006 15:00:13 -0600 (CST)
From:	Pat Gefre <pfg@sgi.com>
Organization: SGI
To:	Russell King <rmk+lkml@arm.linux.org.uk>
Subject: Re: [CFT] Don't use ASYNC_* nor SERIAL_IO_* with serial_core
Date:	Fri, 10 Feb 2006 14:57:45 -0600
User-Agent: KMail/1.7.1
Cc:	Linux Kernel List <linux-kernel@vger.kernel.org>,
	linux-mips@linux-mips.org, linuxppc-dev@ozlabs.org
References: <20060121211407.GA19984@dyn-67.arm.linux.org.uk> <20060210084445.GA1947@flint.arm.linux.org.uk>
In-Reply-To: <20060210084445.GA1947@flint.arm.linux.org.uk>
MIME-Version: 1.0
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200602101457.45847.pfg@sgi.com>
Return-Path: <pfg@sgi.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: 10397
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: pfg@sgi.com
Precedence: bulk
X-list: linux-mips
Content-Length: 1803
Lines: 52

 
Yeah this is something I should've fixed up... thanks

Acked-by: pfg@sgi.com



On Fri February 10 2006 2:44 am, Russell King wrote:
> On Sat, Jan 21, 2006 at 09:14:07PM +0000, Russell King wrote:
> > The ioc4_serial driver is worse.  It assumes that it can set/clear
> > ASYNC_CTS_FLOW in the uart_info flags field, which is private to
> > serial_core.  It also seems to set TTY_IO_ERROR followed by immediately
> > clearing it (pointless), and then it writes to tty->alt_speed... which
> > isn't used by the serial layer so is also pointless.
>
> Okay, the only remaining part of this patch which hasn't been applied
> is this - can anyone ack it?
>
> diff --git a/drivers/serial/ioc4_serial.c b/drivers/serial/ioc4_serial.c
> --- a/drivers/serial/ioc4_serial.c
> +++ b/drivers/serial/ioc4_serial.c
> @@ -1717,11 +1717,9 @@ ioc4_change_speed(struct uart_port *the_
>  	}
>
>  	if (cflag & CRTSCTS) {
> -		info->flags |= ASYNC_CTS_FLOW;
>  		port->ip_sscr |= IOC4_SSCR_HFC_EN;
>  	}
>  	else {
> -		info->flags &= ~ASYNC_CTS_FLOW;
>  		port->ip_sscr &= ~IOC4_SSCR_HFC_EN;
>  	}
>  	writel(port->ip_sscr, &port->ip_serial_regs->sscr);
> @@ -1760,18 +1758,6 @@ static inline int ic4_startup_local(stru
>
>  	info = the_port->info;
>
> -	if (info->tty) {
> -		set_bit(TTY_IO_ERROR, &info->tty->flags);
> -		clear_bit(TTY_IO_ERROR, &info->tty->flags);
> -		if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
> -			info->tty->alt_speed = 57600;
> -		if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
> -			info->tty->alt_speed = 115200;
> -		if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI)
> -			info->tty->alt_speed = 230400;
> -		if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP)
> -			info->tty->alt_speed = 460800;
> -	}
>  	local_open(port);
>
>  	/* set the speed of the serial port */

From rmk+linux-mips=linux-mips.org@arm.linux.org.uk Fri Feb 10 21:46:12 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 10 Feb 2006 21:46:22 +0000 (GMT)
Received: from caramon.arm.linux.org.uk ([212.18.232.186]:37134 "EHLO
	caramon.arm.linux.org.uk") by ftp.linux-mips.org with ESMTP
	id S8133592AbWBJVqM (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Fri, 10 Feb 2006 21:46:12 +0000
Received: from flint.arm.linux.org.uk ([2002:d412:e8ba:1:201:2ff:fe14:8fad])
	by caramon.arm.linux.org.uk with esmtpsa (TLSv1:DES-CBC3-SHA:168)
	(Exim 4.52)
	id 1F7gB9-0008RW-Kw; Fri, 10 Feb 2006 21:51:48 +0000
Received: from rmk by flint.arm.linux.org.uk with local (Exim 4.52)
	id 1F7gBS-0000Sm-W9; Fri, 10 Feb 2006 21:52:07 +0000
Date:	Fri, 10 Feb 2006 21:52:06 +0000
From:	Russell King <rmk+lkml@arm.linux.org.uk>
To:	Pat Gefre <pfg@sgi.com>
Cc:	Linux Kernel List <linux-kernel@vger.kernel.org>,
	linux-mips@linux-mips.org, linuxppc-dev@ozlabs.org
Subject: Re: [CFT] Don't use ASYNC_* nor SERIAL_IO_* with serial_core
Message-ID: <20060210215206.GB30777@flint.arm.linux.org.uk>
Mail-Followup-To: Pat Gefre <pfg@sgi.com>,
	Linux Kernel List <linux-kernel@vger.kernel.org>,
	linux-mips@linux-mips.org, linuxppc-dev@ozlabs.org
References: <20060121211407.GA19984@dyn-67.arm.linux.org.uk> <20060210084445.GA1947@flint.arm.linux.org.uk> <200602101457.45847.pfg@sgi.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <200602101457.45847.pfg@sgi.com>
User-Agent: Mutt/1.4.1i
Return-Path: <rmk+linux-mips=linux-mips.org@arm.linux.org.uk>
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: 10398
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: rmk+lkml@arm.linux.org.uk
Precedence: bulk
X-list: linux-mips
Content-Length: 275
Lines: 11

On Fri, Feb 10, 2006 at 02:57:45PM -0600, Pat Gefre wrote:
> Yeah this is something I should've fixed up... thanks
> 
> Acked-by: pfg@sgi.com

Thanks, applied.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core

From mark.e.mason@broadcom.com Fri Feb 10 23:12:48 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 10 Feb 2006 23:12:57 +0000 (GMT)
Received: from mms3.broadcom.com ([216.31.210.19]:26117 "EHLO
	MMS3.broadcom.com") by ftp.linux-mips.org with ESMTP
	id S8133596AbWBJXMs convert rfc822-to-8bit (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Fri, 10 Feb 2006 23:12:48 +0000
Received: from 10.10.64.154 by MMS3.broadcom.com with ESMTP (Broadcom
 SMTP Relay (Email Firewall v6.2.0)); Fri, 10 Feb 2006 15:19:53 -0800
X-Server-Uuid: B238DE4C-2139-4D32-96A8-DD564EF2313E
Received: by mail-irva-10.broadcom.com (Postfix, from userid 47) id
 1DFF32AF; Fri, 10 Feb 2006 15:18:28 -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 09C432AE for
 <linux-mips@linux-mips.org>; Fri, 10 Feb 2006 15:18:28 -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.3a-GA) with ESMTP
 id CXB42215; Fri, 10 Feb 2006 15:18:20 -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
 E809B20502 for <linux-mips@linux-mips.org>; Fri, 10 Feb 2006 15:18:20
 -0800 (PST)
X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0
Content-class: urn:content-classes:message
MIME-Version: 1.0
Subject: Tracking down exception in sched.c
Date:	Fri, 10 Feb 2006 15:18:20 -0800
Message-ID: <7E000E7F06B05C49BDBB769ADAF44D0773A636@NT-SJCA-0750.brcm.ad.broadcom.com>
Thread-Topic: Tracking down exception in sched.c
Thread-Index: AcYumEe7z+axQZsxS5qat6rWn3Q4Xg==
From:	"Mark E Mason" <mark.e.mason@broadcom.com>
To:	linux-mips@linux-mips.org
X-TMWD-Spam-Summary: SEV=1.1; DFV=A2006021009; IFV=2.0.6,4.0-7;
 RPD=4.00.0004;
 RPDID=303030312E30413039303230312E34334544314436362E303038312D412D;
 ENG=IBF; TS=20060210231957; CAT=NONE; CON=NONE;
X-MMS-Spam-Filter-ID: A2006021009_4.00.0004_2.0.6,4.0-7
X-WSS-ID: 6FF3C01341W9078334-01-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: 10399
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
Content-Length: 3831
Lines: 107

[Cross-posted from LKML]
 
Hello all,
 
Working from the linux-mip.org repository (which just recently merged
from the kernel.org repository), we've been getting exceptions on
several different processors due to NULL pointer dereferences in
sched.c.  These happen on SMP systems only (but both 32 and 64-bit
systems trigger this problem).
 
The Oops output and surrounding text (w/ backtrace) is below.  What I've
traced is down to so far is that enqueue_task() gets called with a ready
queue (rq) where (rq->active == NULL).

Backtracing a bit, the following patch triggers an earlier, slightly
more controlled failure:

[mason@hawaii linux.git]$ git diff kernel/sched.c diff --git
a/kernel/sched.c b/kernel/sched.c
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1264,6 +1264,7 @@ static int try_to_wake_up(task_t *p, uns  #endif

        rq = task_rq_lock(p, &flags);
+       BUG_ON(rq->active == NULL);
        old_state = p->state;
        if (!(old_state & state))
                goto out;


My question is, is the above assert valid (ie. Should rq->active always
be non-NULL at this point)?  It seems like it should be, but I'm pretty
new to this code, and thought I should double-check before going off
into the weeds.

If anyone has any ideas about where specifically to look for the
underlying problem, I'd appreciate it.

Thanks (very much) in advance,
Mark Mason
mason@broadcom.com
Newberg, Oregon
 
CPU revision is: 03040102
Primary instruction cache 32kB, 4-way, linesize 32 bytes.
Primary data cache 32kB, 4-way, linesize 32 bytes.
Synthesized TLB refill handler (40 instructions).
CPU 0 Unable to handle kernel paging request at virtual address
0000000000000028, epc == ffffffff80129840, ra == ffffffff8010Oops[#1]:
Cpu 0
$ 0   : 0000000000000000 ffffffff804202e0 0000000000000020
0000000000000000
$ 4   : a80000000fe00668 0000000000000000 0000000000000000
0000000000000001
$ 8   : ffffffff80427da0 ffffffff8fef7bc0 ffffffff803ef108
0000000000000000
$12   : ffffffffffffffff ffffffff8024e048 a80000000fe97630
ffffffffffffffff
$16   : 0000000000000000 a80000000fe00668 a800000001385ca0
0000000000000000
$20   : 0000000000000000 a800000001385ca0 0000000000000001
ffffffff804202e0
$24   : 0000000000000000 ffffffff8fe9e3cc
$28   : a80000000fe04000 a80000000fe07e20 a80000000fe07e30
ffffffff80129cc0
Hi    : 00000000000026cc
Lo    : cccccccccc6f7000
epc   : ffffffff80129840 enqueue_task+0x18/0x88     Not tainted
ra    : ffffffff80129cc0 activate_task+0xe0/0x158
Status: 14001fe2    KX SX UX KERNEL EXL
Cause : 00808008
BadVA : 0000000000000028
PrId  : 01040102
Modules linked in:
Process swapper (pid: 1, threadinfo=a80000000fe04000,
task=a80000000fe018c8) Stack : a80000000fe07e30 ffffffff80427400
a800000001385ca0 ffffffff804202e0
        a80000000fe00668 0000000000000001 a80000000fe07e60
ffffffff8012ae80
        0000000014001fe1 0000000000000000 0000000000000000
0000000000000000
        ffffffffffffffff 000000000000000f 0000000000000000
ffffffffffffffff
        ffffffff803a6dc8 0000000000000001 0000000000000001
ffffffff80427d78
        0000000000000000 0000000000000000 0000000000000000
0000000000000000
        a80000000fe07ef0 ffffffff80130dd0 a80000000fe24000
a80000000fe27fe0
        ffffffff803a6dc8 0000000000000001 0000000000000002
ffffffff80427d78
        0000000000000000 0000000000000000 0000000000000000
0000000000000000
        0000000000000000 ffffffff8014c768 0000000000000001
0000000000000001
        ...
Call Trace:
 [<ffffffff8012ae80>] try_to_wake_up+0x530/0x600  [<ffffffff80130dd0>]
migration_call+0x210/0x228  [<ffffffff8014c768>]
notifier_call_chain+0x38/0x78  [<ffffffff8015c404>] cpu_up+0x13c/0x1c8
[<ffffffff80100cf0>] init+0x810/0xb20  [<ffffffff80100568>]
init+0x88/0xb20  [<ffffffff80104c40>] kernel_thread_helper+0x10/0x18
[<ffffffff80104c30>] kernel_thread_helper+0x0/0x18
 

 


From anemo@mba.ocn.ne.jp Sat Feb 11 13:38:35 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Sat, 11 Feb 2006 13:38:44 +0000 (GMT)
Received: from mba.ocn.ne.jp ([210.190.142.172]:40150 "HELO smtp.mba.ocn.ne.jp")
	by ftp.linux-mips.org with SMTP id S8133598AbWBKNif (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Sat, 11 Feb 2006 13:38:35 +0000
Received: from localhost (p5152-ipad02funabasi.chiba.ocn.ne.jp [61.207.152.152])
	by smtp.mba.ocn.ne.jp (Postfix) with ESMTP
	id E273A8F9E; Sat, 11 Feb 2006 22:44:35 +0900 (JST)
Date:	Sat, 11 Feb 2006 22:44:20 +0900 (JST)
Message-Id: <20060211.224420.25910222.anemo@mba.ocn.ne.jp>
To:	ralf@linux-mips.org
Cc:	tbm@cyrius.com, linux-mips@linux-mips.org, anderson@netsweng.com,
	ddaney@avtrex.com, richard@codesourcery.com
Subject: Re: Fixes for uaccess.h with gcc >= 4.0.1
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
In-Reply-To: <20060210013440.GA5436@linux-mips.org>
References: <20060123150507.GA18665@linux-mips.org>
	<87wtg6c43s.fsf@talisman.home>
	<20060210013440.GA5436@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: 10400
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
Content-Length: 717
Lines: 22

>>>>> On Fri, 10 Feb 2006 01:34:40 +0000, Ralf Baechle <ralf@linux-mips.org> said:

ralf> Thanks, makes perfect sense.  I tried various other obscure
ralf> things and your patch was holding up, so I just applied it.

Please add this cast to fix compiler/sparse warnings?

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

diff --git a/include/asm-mips/uaccess.h b/include/asm-mips/uaccess.h
index 7a553e9..252caba 100644
--- a/include/asm-mips/uaccess.h
+++ b/include/asm-mips/uaccess.h
@@ -284,7 +284,7 @@ do {									\
 	"	.previous					\n"	\
 	: "=r" (__gu_err), "=&r" (__gu_tmp)				\
 	: "0" (0), "r" (addr), "i" (-EFAULT));				\
-	(val) = __gu_tmp;						\
+	(val) = (__typeof__(val)) __gu_tmp;				\
 }
 
 /*

From pdh@colonel-panic.org Sun Feb 12 17:04:23 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Sun, 12 Feb 2006 17:04:33 +0000 (GMT)
Received: from i-83-67-53-76.freedom2surf.net ([83.67.53.76]:44763 "EHLO
	nephila.localnet") by ftp.linux-mips.org with ESMTP
	id S8133433AbWBLREX (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Sun, 12 Feb 2006 17:04:23 +0000
Received: from pdh by nephila.localnet with local (Exim 4.50)
	id 1F8Kjx-0000Pd-Qx; Sun, 12 Feb 2006 17:10:25 +0000
Date:	Sun, 12 Feb 2006 17:10:25 +0000
To:	linux-mips@linux-mips.org
Cc:	ralf@linux-mips.org
Subject: [PATCH 2.6.X] Early console for Cobalt
Message-ID: <20060212171025.GB1562@colonel-panic.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.5.9i
From:	Peter Horton <pdh@colonel-panic.org>
Return-Path: <pdh@colonel-panic.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: 10402
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: pdh@colonel-panic.org
Precedence: bulk
X-list: linux-mips
Content-Length: 4423
Lines: 156

Adds early console support for Cobalts.

Signed-off-by: Peter Horton <pdh@colonel-panic.org>

P.

Index: linux.git/arch/mips/cobalt/setup.c
===================================================================
--- linux.git.orig/arch/mips/cobalt/setup.c	2006-02-12 14:33:51.000000000 +0000
+++ linux.git/arch/mips/cobalt/setup.c	2006-02-12 16:40:54.000000000 +0000
@@ -31,6 +31,7 @@
 extern void cobalt_machine_restart(char *command);
 extern void cobalt_machine_halt(void);
 extern void cobalt_machine_power_off(void);
+extern void cobalt_early_console(void);
 
 int cobalt_board_id;
 
@@ -109,14 +110,6 @@
 	/* I/O port resource must include UART and LCD/buttons */
 	ioport_resource.end = 0x0fffffff;
 
-	/*
-	 * This is a prom style console. We just poke at the
-	 *  UART to make it talk.
-	 * Only use this console if you really screw up and can't
-	 *  get to the stage of setting up a real serial console.
-	 */
-	/*ns16550_setup_console();*/
-
 	/* request I/O space for devices used on all i[345]86 PCs */
 	for (i = 0; i < COBALT_IO_RESOURCES; i++)
 		request_resource(&ioport_resource, cobalt_io_resources + i);
@@ -136,6 +129,10 @@
 #ifdef CONFIG_SERIAL_8250
 	if (cobalt_board_id > COBALT_BRD_ID_RAQ1) {
 
+#ifdef CONFIG_COBALT_EARLY_CONSOLE
+		cobalt_early_console();
+#endif
+
 		uart.line	= 0;
 		uart.type	= PORT_UNKNOWN;
 		uart.uartclk	= 18432000;
Index: linux.git/arch/mips/cobalt/Makefile
===================================================================
--- linux.git.orig/arch/mips/cobalt/Makefile	2006-02-12 14:33:51.000000000 +0000
+++ linux.git/arch/mips/cobalt/Makefile	2006-02-12 16:39:25.000000000 +0000
@@ -4,4 +4,6 @@
 
 obj-y	 := irq.o int-handler.o reset.o setup.o
 
+obj-$(CONFIG_COBALT_EARLY_CONSOLE)	+= console.o
+
 EXTRA_AFLAGS := $(CFLAGS)
Index: linux.git/arch/mips/cobalt/console.c
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linux.git/arch/mips/cobalt/console.c	2006-02-12 16:42:05.000000000 +0000
@@ -0,0 +1,60 @@
+/*
+ * (C) P. Horton 2006
+ */
+
+#include <linux/config.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/console.h>
+#include <linux/serial_reg.h>
+#include <asm/addrspace.h>
+#include <asm/mach-cobalt/cobalt.h>
+
+#if 0
+
+static int kbhit(void)
+{
+	return COBALT_UART[UART_LSR] & UART_LSR_DR;
+}
+
+static int getch(void)
+{
+	while(!kbhit())
+		;
+
+	return (unsigned char) COBALT_UART[UART_RX];
+}
+
+#endif
+
+static void putchar(int c)
+{
+	if(c == '\n')
+		putchar('\r');
+
+	while(!(COBALT_UART[UART_LSR] & UART_LSR_THRE))
+		;
+
+	COBALT_UART[UART_TX] = c;
+}
+
+static void cons_write(struct console *c, const char *s, unsigned n)
+{
+	while(n-- && *s)
+		putchar(*s++);
+}
+
+static struct console cons_info =
+{
+	.name	= "uart",
+	.write	= cons_write,
+	.flags	= CON_PRINTBUFFER | CON_BOOT,
+	.index	= -1,
+};
+
+void __init cobalt_early_console(void)
+{
+	register_console(&cons_info);
+
+	printk("Cobalt: early console registered\n");
+}
Index: linux.git/include/asm/mach-cobalt/cobalt.h
===================================================================
--- linux.git.orig/include/asm/mach-cobalt/cobalt.h	2006-02-12 14:34:12.000000000 +0000
+++ linux.git/include/asm/mach-cobalt/cobalt.h	2006-02-12 15:54:51.000000000 +0000
@@ -113,4 +113,6 @@
 # define COBALT_KEY_SELECT	(1 << 7)
 # define COBALT_KEY_MASK	0xfe
 
+#define COBALT_UART		((volatile unsigned char *) CKSEG1ADDR(0x1c800000))
+
 #endif /* __ASM_COBALT_H */
Index: linux.git/arch/mips/Kconfig
===================================================================
--- linux.git.orig/arch/mips/Kconfig	2006-02-12 14:33:51.000000000 +0000
+++ linux.git/arch/mips/Kconfig	2006-02-12 16:33:25.000000000 +0000
@@ -787,6 +787,7 @@
 source "arch/mips/tx4938/Kconfig"
 source "arch/mips/vr41xx/Kconfig"
 source "arch/mips/philips/pnx8550/common/Kconfig"
+source "arch/mips/cobalt/Kconfig"
 
 endmenu
 
Index: linux.git/arch/mips/cobalt/Kconfig
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linux.git/arch/mips/cobalt/Kconfig	2006-02-12 16:45:14.000000000 +0000
@@ -0,0 +1,7 @@
+config COBALT_EARLY_CONSOLE
+	bool "Early console support"
+	depends on MIPS_COBALT
+	help
+	  Provide early console support by direct access to the
+	  on board UART. The UART must have been previously
+	  initialised by the boot loader.


From mangoo@wpkg.org Sun Feb 12 18:12:46 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Sun, 12 Feb 2006 18:12:55 +0000 (GMT)
Received: from networks.syneticon.net ([213.239.212.131]:60305 "EHLO
	mail2.syneticon.net") by ftp.linux-mips.org with ESMTP
	id S8133444AbWBLSMq (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Sun, 12 Feb 2006 18:12:46 +0000
Received: from localhost (localhost [127.0.0.1])
	by mail2.syneticon.net (Postfix) with ESMTP id 7C2F83D875
	for <linux-mips@linux-mips.org>; Sun, 12 Feb 2006 19:18:53 +0100 (CET)
Received: from mail2.syneticon.net ([127.0.0.1])
 by localhost (linux [127.0.0.1]) (amavisd-new, port 10024) with ESMTP
 id 02483-14 for <linux-mips@linux-mips.org>;
 Sun, 12 Feb 2006 19:18:48 +0100 (CET)
Received: from [84.44.217.177] (xdsl-84-44-217-177.netcologne.de [84.44.217.177])
	by mail2.syneticon.net (Postfix) with ESMTP
	for <linux-mips@linux-mips.org>; Sun, 12 Feb 2006 19:18:48 +0100 (CET)
Message-ID: <43EF7C06.3080006@wpkg.org>
Date:	Sun, 12 Feb 2006 19:18:46 +0100
From:	Tomasz Chmielewski <mangoo@wpkg.org>
User-Agent: Mail/News 1.5 (X11/20060210)
MIME-Version: 1.0
To:	linux-mips@linux-mips.org
Subject: native gcc for mipsel / uClibc (building or binaries)?
Content-Type: text/plain; charset=ISO-8859-2; format=flowed
Content-Transfer-Encoding: 7bit
X-Virus-Scanned: amavisd-new at syneticon.de
Return-Path: <mangoo@wpkg.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: 10403
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: mangoo@wpkg.org
Precedence: bulk
X-list: linux-mips
Content-Length: 918
Lines: 27

I'm trying to cross-compile gcc to work on mipsel / uClibc, to run there 
natively (that is, I want to compile on this mipsel / uClibc machine).

So far I have a cross compiler that builds binaries for mipsel/uClibc on 
a x86 machine.


According to crosstool HOWTO, "to do a Canadian Cross build with 
crosstool, you have to run it three times:

    1. once to build a toolchain that runs on the build system and 
generates code for the host system
    2. once to build a toolchain that runs on the build system and 
generates code for the target system
    3. once to build a toolchain that runs on the host system and 
generates code for the target system".

So I guess the first step is behind me, but I'm not sure how to do steps 
2 and 3.

Anyone knows how to do it?
Or perhaps, there are already gcc binaries available for mipsel / uClibc?

-- 
Tomasz Chmielewski
Software deployment with Samba
http://wpkg.org

From ilya@total-knowledge.com Sun Feb 12 19:21:23 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Sun, 12 Feb 2006 19:22:27 +0000 (GMT)
Received: from alpha.total-knowledge.com ([205.217.158.170]:9355 "EHLO
	total-knowledge.com") by ftp.linux-mips.org with ESMTP
	id S8133488AbWBLTVX (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Sun, 12 Feb 2006 19:21:23 +0000
Received: (qmail 6614 invoked from network); 12 Feb 2006 10:28:36 -0800
Received: from unknown (HELO ?10.50.163.242?) (ilya@209.157.142.204)
  by alpha.total-knowledge.com with ESMTPA; 12 Feb 2006 10:28:36 -0800
Message-ID: <43EF8C16.9020104@total-knowledge.com>
Date:	Sun, 12 Feb 2006 11:27:18 -0800
From:	"Ilya A. Volynets-Evenbakh" <ilya@total-knowledge.com>
Organization: Total Knowledge
User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051015)
X-Accept-Language: en-us, en
MIME-Version: 1.0
To:	Tomasz Chmielewski <mangoo@wpkg.org>
CC:	linux-mips@linux-mips.org
Subject: Re: native gcc for mipsel / uClibc (building or binaries)?
References: <43EF7C06.3080006@wpkg.org>
In-Reply-To: <43EF7C06.3080006@wpkg.org>
Content-Type: text/plain; charset=ISO-8859-2
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: 10404
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
Content-Length: 1464
Lines: 42

Canadian cross is when you build toolchain on system X to run on system
Y, and generate code for system Z.
Are you sure it is what you want? I somehow suspect that you want to
generate toolchain to build things
natively on your mipsel box to run on said box. If that is true,
buildroot (http://buildroot.uclibc.org) will do everything
for you. Also, I think crosstool does it by default as well (not 100%
sure though). Look under your destination dir
for <target>/bin/gcc.

Tomasz Chmielewski wrote:

> I'm trying to cross-compile gcc to work on mipsel / uClibc, to run
> there natively (that is, I want to compile on this mipsel / uClibc
> machine).
>
> So far I have a cross compiler that builds binaries for mipsel/uClibc
> on a x86 machine.
>
>
> According to crosstool HOWTO, "to do a Canadian Cross build with
> crosstool, you have to run it three times:
>
>    1. once to build a toolchain that runs on the build system and
> generates code for the host system
>    2. once to build a toolchain that runs on the build system and
> generates code for the target system
>    3. once to build a toolchain that runs on the host system and
> generates code for the target system".
>
> So I guess the first step is behind me, but I'm not sure how to do
> steps 2 and 3.
>
> Anyone knows how to do it?
> Or perhaps, there are already gcc binaries available for mipsel / uClibc?
>

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


From mangoo@wpkg.org Sun Feb 12 20:13:37 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Sun, 12 Feb 2006 20:13:48 +0000 (GMT)
Received: from networks.syneticon.net ([213.239.212.131]:8850 "EHLO
	mail2.syneticon.net") by ftp.linux-mips.org with ESMTP
	id S3458484AbWBLUNh (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Sun, 12 Feb 2006 20:13:37 +0000
Received: from localhost (localhost [127.0.0.1])
	by mail2.syneticon.net (Postfix) with ESMTP id 8AFC03CBCC;
	Sun, 12 Feb 2006 21:19:48 +0100 (CET)
Received: from mail2.syneticon.net ([127.0.0.1])
 by localhost (linux [127.0.0.1]) (amavisd-new, port 10024) with ESMTP
 id 02644-17; Sun, 12 Feb 2006 21:19:42 +0100 (CET)
Received: from [84.44.217.177] (xdsl-84-44-217-177.netcologne.de [84.44.217.177])
	by mail2.syneticon.net (Postfix) with ESMTP;
	Sun, 12 Feb 2006 21:19:41 +0100 (CET)
Message-ID: <43EF985C.4060609@wpkg.org>
Date:	Sun, 12 Feb 2006 21:19:40 +0100
From:	Tomasz Chmielewski <mangoo@wpkg.org>
User-Agent: Mail/News 1.5 (X11/20060210)
MIME-Version: 1.0
To:	"Ilya A. Volynets-Evenbakh" <ilya@total-knowledge.com>,
	linux-mips@linux-mips.org
Subject: Re: native gcc for mipsel / uClibc (building or binaries)?
References: <43EF7C06.3080006@wpkg.org> <43EF8C16.9020104@total-knowledge.com>
In-Reply-To: <43EF8C16.9020104@total-knowledge.com>
Content-Type: text/plain; charset=ISO-8859-2; format=flowed
Content-Transfer-Encoding: 7bit
X-Virus-Scanned: amavisd-new at syneticon.de
Return-Path: <mangoo@wpkg.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: 10405
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: mangoo@wpkg.org
Precedence: bulk
X-list: linux-mips
Content-Length: 1090
Lines: 35

Ilya A. Volynets-Evenbakh wrote:
> Canadian cross is when you build toolchain on system X to run on system
> Y, and generate code for system Z.

all right, so I misunderstood, I need to build gcc on system X to run on 
system Y.


> Are you sure it is what you want? I somehow suspect that you want to
> generate toolchain to build things
> natively on your mipsel box to run on said box. If that is true,
> buildroot (http://buildroot.uclibc.org) will do everything

Buildroot also builds gcc which works on let's say x86 and makes 
binaries for mipsel/uclibc).

I need the gcc binaries which will work on mipsel, and which will build 
for mipsel.


> for you. Also, I think crosstool does it by default as well (not 100%
> sure though). Look under your destination dir
> for <target>/bin/gcc.

Crosstool by default builds the binaries on system X that will run on 
system X and build for Y.

So now I have binaries that build for mipsel/uclibc on x86, but I can't 
build gcc that will work on mipsel/uclibc with it.


-- 
Tomasz Chmielewski
Software deployment with Samba
http://wpkg.org

From ilya@total-knowledge.com Sun Feb 12 20:26:32 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Sun, 12 Feb 2006 20:26:42 +0000 (GMT)
Received: from alpha.total-knowledge.com ([205.217.158.170]:36491 "EHLO
	total-knowledge.com") by ftp.linux-mips.org with ESMTP
	id S8133496AbWBLU0c (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Sun, 12 Feb 2006 20:26:32 +0000
Received: (qmail 7583 invoked from network); 12 Feb 2006 11:33:48 -0800
Received: from unknown (HELO ?10.50.163.242?) (ilya@209.157.142.204)
  by alpha.total-knowledge.com with ESMTPA; 12 Feb 2006 11:33:48 -0800
Message-ID: <43EF9B63.7020506@total-knowledge.com>
Date:	Sun, 12 Feb 2006 12:32:35 -0800
From:	"Ilya A. Volynets-Evenbakh" <ilya@total-knowledge.com>
Organization: Total Knowledge
User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051015)
X-Accept-Language: en-us, en
MIME-Version: 1.0
To:	Tomasz Chmielewski <mangoo@wpkg.org>
CC:	linux-mips@linux-mips.org
Subject: Re: native gcc for mipsel / uClibc (building or binaries)?
References: <43EF7C06.3080006@wpkg.org> <43EF8C16.9020104@total-knowledge.com> <43EF985C.4060609@wpkg.org>
In-Reply-To: <43EF985C.4060609@wpkg.org>
Content-Type: text/plain; charset=ISO-8859-2
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: 10406
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
Content-Length: 1193
Lines: 40

Tomasz Chmielewski wrote:

> Ilya A. Volynets-Evenbakh wrote:
>
>> Are you sure it is what you want? I somehow suspect that you want to
>> generate toolchain to build things
>> natively on your mipsel box to run on said box. If that is true,
>> buildroot (http://buildroot.uclibc.org) will do everything
>
>
> Buildroot also builds gcc which works on let's say x86 and makes
> binaries for mipsel/uclibc).
>
> I need the gcc binaries which will work on mipsel, and which will
> build for mipsel.

Buildroot builds _both_. At least it has support for building both.

>
>
>> for you. Also, I think crosstool does it by default as well (not 100%
>> sure though). Look under your destination dir
>> for <target>/bin/gcc.
>
>
> Crosstool by default builds the binaries on system X that will run on
> system X and build for Y.
>
> So now I have binaries that build for mipsel/uclibc on x86, but I
> can't build gcc that will work on mipsel/uclibc with it.

Let's say you build with instdir /crosstool
Then look for mipsel toolchain binaries in
/crosstool/gcc-x.y.z-glibc-K.L.M/mipsel-linux-gnu/mipsel-linux-gnu/bin

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


From mangoo@wpkg.org Sun Feb 12 20:43:41 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Sun, 12 Feb 2006 20:43:53 +0000 (GMT)
Received: from networks.syneticon.net ([213.239.212.131]:14738 "EHLO
	mail2.syneticon.net") by ftp.linux-mips.org with ESMTP
	id S8133496AbWBLUnk (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Sun, 12 Feb 2006 20:43:40 +0000
Received: from localhost (localhost [127.0.0.1])
	by mail2.syneticon.net (Postfix) with ESMTP id CF3033C6FE;
	Sun, 12 Feb 2006 21:49:52 +0100 (CET)
Received: from mail2.syneticon.net ([127.0.0.1])
 by localhost (linux [127.0.0.1]) (amavisd-new, port 10024) with ESMTP
 id 02199-19; Sun, 12 Feb 2006 21:49:48 +0100 (CET)
Received: from [84.44.217.177] (xdsl-84-44-217-177.netcologne.de [84.44.217.177])
	by mail2.syneticon.net (Postfix) with ESMTP;
	Sun, 12 Feb 2006 21:49:48 +0100 (CET)
Message-ID: <43EF9F6A.8000207@wpkg.org>
Date:	Sun, 12 Feb 2006 21:49:46 +0100
From:	Tomasz Chmielewski <mangoo@wpkg.org>
User-Agent: Mail/News 1.5 (X11/20060210)
MIME-Version: 1.0
To:	"Ilya A. Volynets-Evenbakh" <ilya@total-knowledge.com>
Cc:	linux-mips@linux-mips.org
Subject: Re: native gcc for mipsel / uClibc (building or binaries)?
References: <43EF7C06.3080006@wpkg.org> <43EF8C16.9020104@total-knowledge.com> <43EF985C.4060609@wpkg.org> <43EF9B63.7020506@total-knowledge.com>
In-Reply-To: <43EF9B63.7020506@total-knowledge.com>
Content-Type: text/plain; charset=ISO-8859-2; format=flowed
Content-Transfer-Encoding: 7bit
X-Virus-Scanned: amavisd-new at syneticon.de
Return-Path: <mangoo@wpkg.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: 10407
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: mangoo@wpkg.org
Precedence: bulk
X-list: linux-mips
Content-Length: 2028
Lines: 60

Ilya A. Volynets-Evenbakh wrote:
> Tomasz Chmielewski wrote:
> 
>> Ilya A. Volynets-Evenbakh wrote:
>>
>>> Are you sure it is what you want? I somehow suspect that you want to
>>> generate toolchain to build things
>>> natively on your mipsel box to run on said box. If that is true,
>>> buildroot (http://buildroot.uclibc.org) will do everything
>>
>> Buildroot also builds gcc which works on let's say x86 and makes
>> binaries for mipsel/uclibc).
>>
>> I need the gcc binaries which will work on mipsel, and which will
>> build for mipsel.
> 
> Buildroot builds _both_. At least it has support for building both.

OK, than I didn't look close enough.


>>> for you. Also, I think crosstool does it by default as well (not 100%
>>> sure though). Look under your destination dir
>>> for <target>/bin/gcc.
>>
>> Crosstool by default builds the binaries on system X that will run on
>> system X and build for Y.
>>
>> So now I have binaries that build for mipsel/uclibc on x86, but I
>> can't build gcc that will work on mipsel/uclibc with it.
> 
> Let's say you build with instdir /crosstool
> Then look for mipsel toolchain binaries in
> /crosstool/gcc-x.y.z-glibc-K.L.M/mipsel-linux-gnu/mipsel-linux-gnu/bin

It's all x86 cross compilers (they will build for mipsel, on x86):


# pwd
/opt/crosstool/mipsel-unknown-linux-uclibc/gcc-3.3.3-uClibc-0.9.23/mipsel-unknown-linux-uclibc/bin
# file gcc
gcc: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for 
GNU/Linux 2.2.5, dynamically linked (uses shared libs), for GNU/Linux 
2.2.5, not stripped

# pwd
/opt/crosstool/mipsel-unknown-linux-uclibc/gcc-3.3.3-uClibc-0.9.23/bin
# file mipsel-unknown-linux-uclibc-gcc
mipsel-unknown-linux-uclibc-gcc: ELF 32-bit LSB executable, Intel 80386, 
version 1 (SYSV), for GNU/Linux 2.2.5, dynamically linked (uses shared 
libs), for GNU/Linux 2.2.5, not stripped


So I guess I need to spend some more time on it, if I don't figure out, 
I'll keep on asking :)

-- 
Tomasz Chmielewski
Software deployment with Samba
http://wpkg.org

From mangoo@wpkg.org Sun Feb 12 21:42:06 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Sun, 12 Feb 2006 21:42:16 +0000 (GMT)
Received: from networks.syneticon.net ([213.239.212.131]:22674 "EHLO
	mail2.syneticon.net") by ftp.linux-mips.org with ESMTP
	id S8133496AbWBLVmG (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Sun, 12 Feb 2006 21:42:06 +0000
Received: from localhost (localhost [127.0.0.1])
	by mail2.syneticon.net (Postfix) with ESMTP id AF93B3C71C;
	Sun, 12 Feb 2006 22:48:17 +0100 (CET)
Received: from mail2.syneticon.net ([127.0.0.1])
 by localhost (linux [127.0.0.1]) (amavisd-new, port 10024) with ESMTP
 id 04334-13; Sun, 12 Feb 2006 22:48:15 +0100 (CET)
Received: from [84.44.217.177] (xdsl-84-44-217-177.netcologne.de [84.44.217.177])
	by mail2.syneticon.net (Postfix) with ESMTP;
	Sun, 12 Feb 2006 22:48:14 +0100 (CET)
Message-ID: <43EFAD1D.9010100@wpkg.org>
Date:	Sun, 12 Feb 2006 22:48:13 +0100
From:	Tomasz Chmielewski <mangoo@wpkg.org>
User-Agent: Mail/News 1.5 (X11/20060210)
MIME-Version: 1.0
To:	David Daney <ddaney@avtrex.com>
Cc:	linux-mips@linux-mips.org
Subject: Re: native gcc for mipsel / uClibc (building or binaries)?
References: <43EF7C06.3080006@wpkg.org> <43EFA945.1030906@avtrex.com>
In-Reply-To: <43EFA945.1030906@avtrex.com>
Content-Type: text/plain; charset=ISO-8859-2; format=flowed
Content-Transfer-Encoding: 7bit
X-Virus-Scanned: amavisd-new at syneticon.de
Return-Path: <mangoo@wpkg.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: 10408
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: mangoo@wpkg.org
Precedence: bulk
X-list: linux-mips
Content-Length: 1396
Lines: 38

David Daney wrote:

> I have done it for mipsel-linux-glibc, however until last week gcc had 
> no support for uClibc, so it will probably not work with uClibc without 
> some patching to gcc.
> 
> The basic idea is that once you have a working cross toolchain just 
> configure gcc and binutils with: --build=i686-pc-linux-glibc 
> --target=mipsel-linux --host=mipsel-linux.  This will produce a native 
> toolchain.  You will have to copy the compile time portions of the C 
> library (include files and link time libraries) to the target, then you 
> should be all set.

Exactly that's my problem.

I have a compiler that generates binaries for mipsel/uclibc.

I compiled lots of software with it, so we can say it's functional.


Now, when I try to compile gcc (--build=i686-pc-linux-glibc
 > --target=mipsel-linux --host=mipsel-linux), it breaks, as during the 
build process gcc's ./configure has a schizophrenia: it tries to compile 
some parts for mipsel (as I'd expect), but it also tries to compile and 
execute the binaries during the build process.

This means, it creates some binaries/libs needed for the build process 
(like libiberty), then tries to run/use them, but as they are mipsel 
binaries, the build process breaks.

I tried that with gcc-4.0.2, and some earlier 3.3.6 and 3.4.5, without a 
success.


-- 
Tomasz Chmielewski
Software deployment with Samba
http://wpkg.org

From ddaney@avtrex.com Sun Feb 12 21:25:44 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 13 Feb 2006 00:39:33 +0000 (GMT)
Received: from adsl-67-116-42-147.dsl.sntc01.pacbell.net ([67.116.42.147]:36899
	"EHLO avtrex.com") by ftp.linux-mips.org with ESMTP
	id S3465640AbWBLVZn (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Sun, 12 Feb 2006 21:25:43 +0000
Received: from [192.168.7.26] ([192.168.7.3]) by avtrex.com with Microsoft SMTPSVC(6.0.3790.1830);
	 Sun, 12 Feb 2006 13:31:51 -0800
Message-ID: <43EFA945.1030906@avtrex.com>
Date:	Sun, 12 Feb 2006 13:31:49 -0800
From:	David Daney <ddaney@avtrex.com>
User-Agent: Mozilla Thunderbird 1.0.7-1.1.fc3 (X11/20050929)
X-Accept-Language: en-us, en
MIME-Version: 1.0
To:	Tomasz Chmielewski <mangoo@wpkg.org>
CC:	linux-mips@linux-mips.org
Subject: Re: native gcc for mipsel / uClibc (building or binaries)?
References: <43EF7C06.3080006@wpkg.org>
In-Reply-To: <43EF7C06.3080006@wpkg.org>
Content-Type: text/plain; charset=ISO-8859-2; format=flowed
Content-Transfer-Encoding: 7bit
X-OriginalArrivalTime: 12 Feb 2006 21:31:51.0780 (UTC) FILETIME=[BCE1C240:01C6301B]
Return-Path: <ddaney@avtrex.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: 10409
X-Approved-By: ralf@linux-mips.org
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: ddaney@avtrex.com
Precedence: bulk
X-list: linux-mips
Content-Length: 1466
Lines: 38

Tomasz Chmielewski wrote:
> I'm trying to cross-compile gcc to work on mipsel / uClibc, to run there 
> natively (that is, I want to compile on this mipsel / uClibc machine).
> 
> So far I have a cross compiler that builds binaries for mipsel/uClibc on 
> a x86 machine.
> 
> 
> According to crosstool HOWTO, "to do a Canadian Cross build with 
> crosstool, you have to run it three times:
> 
>    1. once to build a toolchain that runs on the build system and 
> generates code for the host system
>    2. once to build a toolchain that runs on the build system and 
> generates code for the target system
>    3. once to build a toolchain that runs on the host system and 
> generates code for the target system".
> 
> So I guess the first step is behind me, but I'm not sure how to do steps 
> 2 and 3.
> 
> Anyone knows how to do it?
> Or perhaps, there are already gcc binaries available for mipsel / uClibc?
> 

I have done it for mipsel-linux-glibc, however until last week gcc had 
no support for uClibc, so it will probably not work with uClibc without 
some patching to gcc.

The basic idea is that once you have a working cross toolchain just 
configure gcc and binutils with: --build=i686-pc-linux-glibc 
--target=mipsel-linux --host=mipsel-linux.  This will produce a native 
toolchain.  You will have to copy the compile time portions of the C 
library (include files and link time libraries) to the target, then you 
should be all set.

David Daney.


From zzh.hust@gmail.com Mon Feb 13 01:32:30 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 13 Feb 2006 01:32:37 +0000 (GMT)
Received: from uproxy.gmail.com ([66.249.92.199]:17165 "EHLO uproxy.gmail.com")
	by ftp.linux-mips.org with ESMTP id S3465649AbWBMBca convert rfc822-to-8bit
	(ORCPT <rfc822;linux-mips@linux-mips.org>);
	Mon, 13 Feb 2006 01:32:30 +0000
Received: by uproxy.gmail.com with SMTP id q2so848241uge
        for <linux-mips@linux-mips.org>; Sun, 12 Feb 2006 17:38:43 -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=aBb9w7khtCmwrhDZ9LBq6aBa2DngRDIhKZwOnHhvqXzWTNmoMdVppgjP05IPj0iX3lWDNnYnaJVECmLXvtDDxHljniU593gt+5TmcOJg7tlDIafjNIrAp57MOT1CAT/CFyAoGtbZErMcEh8m6ocWBGKLxb5euD1rtS/EjcNotgs=
Received: by 10.49.38.11 with SMTP id q11mr636785nfj;
        Sun, 12 Feb 2006 17:38:42 -0800 (PST)
Received: by 10.48.143.19 with HTTP; Sun, 12 Feb 2006 17:38:42 -0800 (PST)
Message-ID: <50c9a2250602121738r59f5fed0s800e43f9d232c6eb@mail.gmail.com>
Date:	Mon, 13 Feb 2006 09:38:42 +0800
From:	zhuzhenhua <zzh.hust@gmail.com>
To:	linux-mips <linux-mips@linux-mips.org>
Subject: does any other cross-tool support UID instruction?
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8BIT
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: 10410
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
Content-Length: 282
Lines: 9

i want to use the UID instruction in my application or library, but
the sde toolchain on support to compile bootloader or kernel.
how to use it to compile a application or library?
or does any other cross-tool support UID instruction?
thanks for any hints

Best regards

zhuzhenhua

From anemo@mba.ocn.ne.jp Mon Feb 13 02:37:50 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 13 Feb 2006 02:38:00 +0000 (GMT)
Received: from topsns2.toshiba-tops.co.jp ([202.230.225.126]:25557 "EHLO
	topsns2.toshiba-tops.co.jp") by ftp.linux-mips.org with ESMTP
	id S3466466AbWBMChu (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Mon, 13 Feb 2006 02:37:50 +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; Mon, 13 Feb 2006 11:44:03 +0900
Received: from topsms.toshiba-tops.co.jp (localhost.localdomain [127.0.0.1])
	by localhost.toshiba-tops.co.jp (Postfix) with ESMTP id 601E01FF65;
	Mon, 13 Feb 2006 11:44:00 +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 4D8FA1FF61;
	Mon, 13 Feb 2006 11:44:00 +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 k1D2hx4D069276;
	Mon, 13 Feb 2006 11:43:59 +0900 (JST)
	(envelope-from anemo@mba.ocn.ne.jp)
Date:	Mon, 13 Feb 2006 11:43:59 +0900 (JST)
Message-Id: <20060213.114359.07641583.nemoto@toshiba-tops.co.jp>
To:	pdh@colonel-panic.org
Cc:	linux-mips@linux-mips.org, ralf@linux-mips.org
Subject: Re: [PATCH 2.6.X] Early console for Cobalt
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
In-Reply-To: <20060212171025.GB1562@colonel-panic.org>
References: <20060212171025.GB1562@colonel-panic.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: 10411
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
Content-Length: 219
Lines: 7

>>>>> On Sun, 12 Feb 2006 17:10:25 +0000, Peter Horton <pdh@colonel-panic.org> said:
pdh> Adds early console support for Cobalts.

We already have EARLY_PRINTK.  How about using it?  (like dec does)

---
Atsushi Nemoto

From kumba@gentoo.org Mon Feb 13 04:12:53 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 13 Feb 2006 04:13:05 +0000 (GMT)
Received: from rwcrmhc12.comcast.net ([216.148.227.152]:38821 "EHLO
	rwcrmhc12.comcast.net") by ftp.linux-mips.org with ESMTP
	id S8133354AbWBMEMx (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Mon, 13 Feb 2006 04:12:53 +0000
Received: from [192.168.1.4] (unknown[69.140.185.48])
          by comcast.net (rwcrmhc12) with ESMTP
          id <20060213041900m1200d7cste>; Mon, 13 Feb 2006 04:19:00 +0000
Message-ID: <43F008B1.7070103@gentoo.org>
Date:	Sun, 12 Feb 2006 23:18:57 -0500
From:	Kumba <kumba@gentoo.org>
User-Agent: Thunderbird 1.5 (Windows/20051201)
MIME-Version: 1.0
To:	linux-mips@linux-mips.org
Subject: Re: [PATCH 2.6.X] Early console for Cobalt
References: <20060212171025.GB1562@colonel-panic.org> <20060213.114359.07641583.nemoto@toshiba-tops.co.jp>
In-Reply-To: <20060213.114359.07641583.nemoto@toshiba-tops.co.jp>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Return-Path: <kumba@gentoo.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: 10413
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: kumba@gentoo.org
Precedence: bulk
X-list: linux-mips
Content-Length: 1091
Lines: 27

Atsushi Nemoto wrote:
>>>>>> On Sun, 12 Feb 2006 17:10:25 +0000, Peter Horton <pdh@colonel-panic.org> said:
> pdh> Adds early console support for Cobalts.
> 
> We already have EARLY_PRINTK.  How about using it?  (like dec does)

I already tried getting early printk to work....Either it wasn't initializing 
early enough for my needs, I was enabling it incorrectly, or it just doesn't 
work on Cobalt.  This does work, however, and already pointed out one obvious 
flaw I have in a patch I've been using on Cobalt (setting cpu_scache_line_size 
to > 0 when cobalt lacks an scache).

For systems where the serial device can be difficult to use until initialized 
late in the boot cycle (Octane comes to mind), early_printk won't function either.

Maybe some kind of framework is needed for defining the kinds of early console 
various systems can support?


--Kumba

-- 
Gentoo/MIPS Team Lead
Gentoo Foundation Board of Trustees

"Such is oft the course of deeds that move the wheels of the world: small hands 
do them because they must, while the eyes of the great are elsewhere."  --Elrond

From anemo@mba.ocn.ne.jp Mon Feb 13 04:32:35 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 13 Feb 2006 04:32:46 +0000 (GMT)
Received: from topsns2.toshiba-tops.co.jp ([202.230.225.126]:64718 "EHLO
	topsns2.toshiba-tops.co.jp") by ftp.linux-mips.org with ESMTP
	id S8133354AbWBMEcf (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Mon, 13 Feb 2006 04:32: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; Mon, 13 Feb 2006 13:38:48 +0900
Received: from topsms.toshiba-tops.co.jp (localhost.localdomain [127.0.0.1])
	by localhost.toshiba-tops.co.jp (Postfix) with ESMTP id 5BE1F20379;
	Mon, 13 Feb 2006 13:38: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 500F62035E;
	Mon, 13 Feb 2006 13:38: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 k1D4cj4D069638;
	Mon, 13 Feb 2006 13:38:45 +0900 (JST)
	(envelope-from anemo@mba.ocn.ne.jp)
Date:	Mon, 13 Feb 2006 13:38:45 +0900 (JST)
Message-Id: <20060213.133845.15247873.nemoto@toshiba-tops.co.jp>
To:	kumba@gentoo.org
Cc:	linux-mips@linux-mips.org
Subject: Re: [PATCH 2.6.X] Early console for Cobalt
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
In-Reply-To: <43F008B1.7070103@gentoo.org>
References: <20060212171025.GB1562@colonel-panic.org>
	<20060213.114359.07641583.nemoto@toshiba-tops.co.jp>
	<43F008B1.7070103@gentoo.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: 10414
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
Content-Length: 709
Lines: 15

>>>>> On Sun, 12 Feb 2006 23:18:57 -0500, Kumba <kumba@gentoo.org> said:
kumba> I already tried getting early printk to work....Either it
kumba> wasn't initializing early enough for my needs, I was enabling
kumba> it incorrectly, or it just doesn't work on Cobalt.  This does
kumba> work, however, and already pointed out one obvious flaw I have
kumba> in a patch I've been using on Cobalt (setting
kumba> cpu_scache_line_size to > 0 when cobalt lacks an scache).

Well, I do not have any objection to cobalt/console.c itself.  I just
mean let's use CONFIG_EARLY_PRINTK symbol instead of
CONFIG_COBALT_EARLY_CONSOLE (and add some other tweaks such as
implementing disable_early_printk()).

---
Atsushi Nemoto

From pulsar@kpsws.com Mon Feb 13 08:34:00 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 13 Feb 2006 08:35:04 +0000 (GMT)
Received: from [213.189.19.80] ([213.189.19.80]:30727 "EHLO mail.kpsws.com")
	by ftp.linux-mips.org with ESMTP id S8133447AbWBMIeA (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Mon, 13 Feb 2006 08:34:00 +0000
Received: (qmail 32688 invoked by uid 89); 13 Feb 2006 08:40:06 -0000
Received: from unknown (HELO mail.kpsws.com) (127.0.0.1)
  by localhost with SMTP; 13 Feb 2006 08:40:06 -0000
Received: from 194.171.252.101
        (SquirrelMail authenticated user pulsar@kpsws.com)
        by mail.kpsws.com with HTTP;
        Mon, 13 Feb 2006 09:40:06 +0100 (CET)
Message-ID: <40646.194.171.252.101.1139820006.squirrel@mail.kpsws.com>
In-Reply-To: <1139587262.12521.12.camel@localhost.localdomain>
References: <20060210.005104.63742308.anemo@mba.ocn.ne.jp> 
     <13126.194.171.252.101.1139502756.squirrel@mail.kpsws.com> 
     <1139587262.12521.12.camel@localhost.localdomain>
Date:	Mon, 13 Feb 2006 09:40:06 +0100 (CET)
Subject: Re: changing the page properties to cached/uncached
From:	"Niels Sterrenburg" <pulsar@kpsws.com>
To:	"Alan Cox" <alan@lxorguk.ukuu.org.uk>
Cc:	pulsar@kpsws.com, linux-mips@linux-mips.org
Reply-To: pulsar@kpsws.com
User-Agent: SquirrelMail/1.4.0
MIME-Version: 1.0
Content-Type: text/plain;charset=iso-8859-1
X-Priority: 3
Importance: Normal
Return-Path: <pulsar@kpsws.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: 10415
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: pulsar@kpsws.com
Precedence: bulk
X-list: linux-mips
Content-Length: 1626
Lines: 43

> On Iau, 2006-02-09 at 17:32 +0100, Niels Sterrenburg wrote:
>> - Do not use swapping in the system
>> - Limit Linux memory usage via the mem= option in the kernel command
>> line.
>> - From MIPS user space: do a mmap for the shared memory area.
>> - From MIPS user space: call (our selfwritten) shmemipc driver with the
>> request to set the mapped pages to cached (by passing virtual address
>> and
>> length).
>> - From kernel space: find the vma for the supplied virtual address range
>> and change cache properties of all pages in that virtual range.
>
> You don't need to worry about swapping. You can simply mark the pages in
> question reserved just as i386 does with the 640K-1Mb hole or since when
> a page has a use count it won't swap out, mark it as having a user. In
> your case the "user" is the DSP so you just need to account fine

Ok, swapping is not (yet) relevant for us, but I'll keep it in mind.

> You can provide your own "nopage" method. Good example is
> sound/oss/via82cxxx_audio.c
>
So if I understand correctly I can implement my own nopage routine
as part of my driver mmap functionanlity (via initializing vm_ops in mmap).

When an mmap on my driver is done to a virtual area for which nopage's
exist then my nopage routine is called, right ?

Then I can handle tha cache properties while creating the page(s), right ?

In the case of the via82cxxx_aucio.c it grabs a dma page, claims it
and returns it, right ?

If all my above interpretations are correct, how can I then toggle the
page caching properties:
- on which level should I do that: pte/page level or vma level ?

regards,

Niels




From macro@linux-mips.org Mon Feb 13 09:09:45 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 13 Feb 2006 09:09:55 +0000 (GMT)
Received: from pollux.ds.pg.gda.pl ([153.19.208.7]:43273 "EHLO
	pollux.ds.pg.gda.pl") by ftp.linux-mips.org with ESMTP
	id S8133461AbWBMJJp (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Mon, 13 Feb 2006 09:09:45 +0000
Received: from localhost (localhost [127.0.0.1])
	by pollux.ds.pg.gda.pl (Postfix) with ESMTP id 23449F5C57;
	Mon, 13 Feb 2006 10:15:56 +0100 (CET)
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 26401-07; Mon, 13 Feb 2006 10:15:55 +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 D009EF5C54;
	Mon, 13 Feb 2006 10:15:55 +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.3/8.13.1) with ESMTP id k1D9FiXP011689;
	Mon, 13 Feb 2006 10:15:44 +0100
Date:	Mon, 13 Feb 2006 09:15:49 +0000 (GMT)
From:	"Maciej W. Rozycki" <macro@linux-mips.org>
To:	Martin Michlmayr <tbm@cyrius.com>,
	Ralf Baechle <ralf@linux-mips.org>
cc:	"Peter 'p2' De Schrijver" <p2@mind.be>, linux-mips@linux-mips.org
Subject: Re: DECstation R3000 boot error
In-Reply-To: <Pine.LNX.4.64N.0602061021110.32080@blysk.ds.pg.gda.pl>
Message-ID: <Pine.LNX.4.64N.0602130911260.17051@blysk.ds.pg.gda.pl>
References: <20060123225040.GA23576@deprecation.cyrius.com>
 <Pine.LNX.4.64N.0601241059140.11021@blysk.ds.pg.gda.pl>
 <20060124122700.GA8527@deprecation.cyrius.com>
 <Pine.LNX.4.64N.0601241227290.11021@blysk.ds.pg.gda.pl> <20060124232117.GA4165@codecarver>
 <Pine.LNX.4.64N.0601251103020.7675@blysk.ds.pg.gda.pl>
 <20060203150232.GA25701@deprecation.cyrius.com>
 <Pine.LNX.4.64N.0602061021110.32080@blysk.ds.pg.gda.pl>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Virus-Scanned: ClamAV 0.87.1/1284/Sun Feb 12 17:00:59 2006 on piorun.ds.pg.gda.pl
X-Virus-Status:	Clean
X-Virus-Scanned: by amavisd-new at pollux.ds.pg.gda.pl
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: 10416
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
Content-Length: 1288
Lines: 31

On Mon, 6 Feb 2006, Maciej W. Rozycki wrote:

>  Not yet, sorry.  I have updated my tree and most of my local patches, but 
> I have a few to go yet.  My time is limited these days, but I'll try hard 
> to get at the problems you reported by the coming weekend at the very 
> latest.

 The following change fixes the problem for me -- it looks like an 
omission from some recent changes elsewhere.  Ralf, please apply.

  Maciej

Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>

patch-mips-2.6.15-20060124-mips-cpu-isa-0
diff -up --recursive --new-file linux-mips-2.6.15-20060124.macro/include/asm-mips/cpu.h linux-mips-2.6.15-20060124/include/asm-mips/cpu.h
--- linux-mips-2.6.15-20060124.macro/include/asm-mips/cpu.h	2005-12-10 05:58:16.000000000 +0000
+++ linux-mips-2.6.15-20060124/include/asm-mips/cpu.h	2006-02-12 02:34:24.000000000 +0000
@@ -204,9 +204,9 @@
  */
 #define MIPS_CPU_ISA_I		0x00000001
 #define MIPS_CPU_ISA_II		0x00000002
-#define MIPS_CPU_ISA_III	0x00000003
-#define MIPS_CPU_ISA_IV		0x00000004
-#define MIPS_CPU_ISA_V		0x00000005
+#define MIPS_CPU_ISA_III	0x00000004
+#define MIPS_CPU_ISA_IV		0x00000008
+#define MIPS_CPU_ISA_V		0x00000010
 #define MIPS_CPU_ISA_M32R1	0x00000020
 #define MIPS_CPU_ISA_M32R2	0x00000040
 #define MIPS_CPU_ISA_M64R1	0x00000080

From ralf@linux-mips.org Mon Feb 13 09:50:39 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 13 Feb 2006 09:50:47 +0000 (GMT)
Received: from mipsfw.mips-uk.com ([194.74.144.146]:46617 "EHLO
	bacchus.dhis.org") by ftp.linux-mips.org with ESMTP
	id S8133461AbWBMJuj (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Mon, 13 Feb 2006 09:50:39 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by bacchus.dhis.org (8.13.4/8.13.4) with ESMTP id k1D9v0XE005665;
	Mon, 13 Feb 2006 09:57:00 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.4/8.13.4/Submit) id k1D9uwb7005663;
	Mon, 13 Feb 2006 09:56:58 GMT
Date:	Mon, 13 Feb 2006 09:56:58 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	Peter Horton <pdh@colonel-panic.org>
Cc:	linux-mips@linux-mips.org
Subject: Re: [PATCH 2.6.X] Early console for Cobalt
Message-ID: <20060213095658.GA3720@linux-mips.org>
References: <20060212171025.GB1562@colonel-panic.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20060212171025.GB1562@colonel-panic.org>
User-Agent: Mutt/1.4.2.1i
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: 10417
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
Content-Length: 411
Lines: 14

On Sun, Feb 12, 2006 at 05:10:25PM +0000, Peter Horton wrote:

> Adds early console support for Cobalts.
> 
> Signed-off-by: Peter Horton <pdh@colonel-panic.org>

Queued for 2.6.17.

Please never include pathnames using the asm symlink like
linux.git/include/asm/mach-cobalt/cobalt.h in patches.  They do cause
rejects and are generally a PITA.  I also sent the #if 0'ed code in
console.c to /dev/hell.

  Ralf

From richard@codesourcery.com Mon Feb 13 10:29:43 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 13 Feb 2006 10:29:52 +0000 (GMT)
Received: from voldemort.codesourcery.com ([65.74.133.5]:15029 "EHLO
	mail.codesourcery.com") by ftp.linux-mips.org with ESMTP
	id S8133511AbWBMK3n (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Mon, 13 Feb 2006 10:29:43 +0000
Received: (qmail 5583 invoked by uid 1010); 13 Feb 2006 10:35:56 -0000
From:	Richard Sandiford <richard@codesourcery.com>
To:	Tomasz Chmielewski <mangoo@wpkg.org>
Mail-Followup-To: Tomasz Chmielewski <mangoo@wpkg.org>,David Daney <ddaney@avtrex.com>,  linux-mips@linux-mips.org, richard@codesourcery.com
Cc:	David Daney <ddaney@avtrex.com>, linux-mips@linux-mips.org
Subject: Re: native gcc for mipsel / uClibc (building or binaries)?
References: <43EF7C06.3080006@wpkg.org> <43EFA945.1030906@avtrex.com>
	<43EFAD1D.9010100@wpkg.org>
Date:	Mon, 13 Feb 2006 10:35:54 +0000
In-Reply-To: <43EFAD1D.9010100@wpkg.org> (Tomasz Chmielewski's message of
	"Sun, 12 Feb 2006 22:48:13 +0100")
Message-ID: <87slqnczqt.fsf@talisman.home>
User-Agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.4 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Return-Path: <richard@codesourcery.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: 10418
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: richard@codesourcery.com
Precedence: bulk
X-list: linux-mips
Content-Length: 960
Lines: 20

Tomasz Chmielewski <mangoo@wpkg.org> writes:
> Now, when I try to compile gcc (--build=i686-pc-linux-glibc
>  > --target=mipsel-linux --host=mipsel-linux), it breaks, as during the 
> build process gcc's ./configure has a schizophrenia: it tries to compile
> some parts for mipsel (as I'd expect), but it also tries to compile and
> execute the binaries during the build process.

Just to rule out one possibility, were the x86-hosted tools in
your path when you ran configure and make?  They need to be.

> This means, it creates some binaries/libs needed for the build process
> (like libiberty), then tries to run/use them, but as they are mipsel
> binaries, the build process breaks.

Recent versions compile two versions of libiberty, one for the build
machine and one for the host.  The build version is used for things
like genattrtab (a build-time tool used only to build gcc itself)
while the host version is linked into the final compilers.

Richard

From bzolnier@gmail.com Mon Feb 13 10:48:18 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 13 Feb 2006 10:48:27 +0000 (GMT)
Received: from nproxy.gmail.com ([64.233.182.198]:55678 "EHLO nproxy.gmail.com")
	by ftp.linux-mips.org with ESMTP id S8133510AbWBMKsS convert rfc822-to-8bit
	(ORCPT <rfc822;linux-mips@linux-mips.org>);
	Mon, 13 Feb 2006 10:48:18 +0000
Received: by nproxy.gmail.com with SMTP id y25so216185nfb
        for <linux-mips@linux-mips.org>; Mon, 13 Feb 2006 02:54:34 -0800 (PST)
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws;
        s=beta; d=gmail.com;
        h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references;
        b=nhbqPXjcV4lAEJD5BSV/FD7DASA1WTN87hGlPNI7xcmyNmr72jvXj45OjKtBgUDdyK6Yrhz8sX1fmS1KPyH4rsp2N7ENqdqKDJA+r6ilEqMgD2tKAfzy3/2ITaNUUG6Bl3pYta0YpU+tmSL3R3v8Zds6LuQK2mNqob1abQEo5Vo=
Received: by 10.48.157.5 with SMTP id f5mr759101nfe;
        Mon, 13 Feb 2006 02:54:33 -0800 (PST)
Received: by 10.48.49.10 with HTTP; Mon, 13 Feb 2006 02:54:33 -0800 (PST)
Message-ID: <58cb370e0602130254ga67a53cu32e54f5bf8e71bb7@mail.gmail.com>
Date:	Mon, 13 Feb 2006 11:54:33 +0100
From:	Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To:	Jordan Crouse <jordan.crouse@amd.com>
Subject: Re: [PATCH] Enable MwDMA for AU1200 IDE driver
Cc:	linux-mips@linux-mips.org, linux-ide@vger.kernel.org,
	enrico.walther@amd.com
In-Reply-To: <20060210182033.GA24353@cosmic.amd.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8BIT
Content-Disposition: inline
References: <20060210182033.GA24353@cosmic.amd.com>
Return-Path: <bzolnier@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: 10419
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: bzolnier@gmail.com
Precedence: bulk
X-list: linux-mips
Content-Length: 3979
Lines: 100

Hi,

On 2/10/06, Jordan Crouse <jordan.crouse@amd.com> wrote:
> Greetings all - the attached patch enables MwDMA mode for the AU1200
> IDE driver.  If one heavily uses the USB on the DB1200 board with IDE
> in PIO mode, you may experience hangs from overloading the bus with
> interrupts - this should help.  Since it is obvious that this is the
> desired mode, I'm adding it to the defconfig to enable by default.
>
> Also, I snuck in a fix for a warning (mixed code and declarations = evil!).

if this refers to drive_list_entry - it is fixed in Linus' tree

> Applies against latest lmo git, but it should work for linux-ide as well.

> [PATCH] Enable MWDMA mode for the AU1200 IDE driver
>
> This enables MwDMA mode for the AU1200 driver - this will benefit
> anybody using IDE + USB, which together seem to cause hangs when IDE is
> in PIO due to the large number of interrupts on the same bus.

ide-au1xxx driver enables IRQ unmasking unconditionally,
could it be that hardware actually needs IRQs to be masked
during PIO transfers?

> Signed-off-by: Jordan Crouse <jordan.crouse@amd.com>
> ---
>
>  arch/mips/configs/db1200_defconfig        |    4 ++--
>  drivers/ide/mips/au1xxx-ide.c             |   14 ++++++++++++--
>  include/asm-mips/mach-au1x00/au1xxx_ide.h |    9 ---------
>  3 files changed, 14 insertions(+), 13 deletions(-)
>
> diff --git a/arch/mips/configs/db1200_defconfig b/arch/mips/configs/db1200_defconfig
> index 9288847..355b32f 100644
> --- a/arch/mips/configs/db1200_defconfig
> +++ b/arch/mips/configs/db1200_defconfig
> @@ -497,8 +497,8 @@ CONFIG_BLK_DEV_IDECS=m
>  #
>  CONFIG_IDE_GENERIC=y
>  CONFIG_BLK_DEV_IDE_AU1XXX=y
> -CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA=y
> -# CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA is not set
> +#CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA is not set
> +CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA=y
>  CONFIG_BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ=128
>  # CONFIG_IDE_ARM is not set
>  # CONFIG_BLK_DEV_IDEDMA is not set
> diff --git a/drivers/ide/mips/au1xxx-ide.c b/drivers/ide/mips/au1xxx-ide.c
> index 32431dc..c2bf766 100644
> --- a/drivers/ide/mips/au1xxx-ide.c
> +++ b/drivers/ide/mips/au1xxx-ide.c
> @@ -652,6 +652,7 @@ static int au_ide_probe(struct device *d
>         struct platform_device *pdev = to_platform_device(dev);
>         _auide_hwif *ahwif = &auide_hwif;
>         ide_hwif_t *hwif;
> +       hw_regs_t *hw;
>         struct resource *res;
>         int ret = 0;
>
> @@ -690,17 +691,26 @@ static int au_ide_probe(struct device *d
>         /* FIXME:  This might possibly break PCMCIA IDE devices */
>
>         hwif                            = &ide_hwifs[pdev->id];
> -       hw_regs_t *hw                   = &hwif->hw;
> +       hw                              = &hwif->hw;
>         hwif->irq = hw->irq             = ahwif->irq;
>         hwif->chipset                   = ide_au1xxx;
>
>         auide_setup_ports(hw, ahwif);
>         memcpy(hwif->io_ports, hw->io_ports, sizeof(hwif->io_ports));
>
> +#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ
> +       hwif->rqsize = CONFIG_BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ;
> +       hwif->rqsize = ((hwif->rqsize > AU1XXX_ATA_RQSIZE)
> +                       || (hwif->rqsize < 32))
> +                        ? AU1XXX_ATA_RQSIZE : hwif->rqsize;
> +#else /* if kernel config is not set */
> +       hwif->rqsize                    = AU1XXX_ATA_RQSIZE;
> +#endif
> +

Patch description says nothing about this change...

NAK.  Please don't re-introduce
CONFIG_BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ.

Either this controller works reliably with rqsize > 32 or not.

>         hwif->ultra_mask                = 0x0;  /* Disable Ultra DMA */
>  #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
>         hwif->mwdma_mask                = 0x07; /* Multimode-2 DMA  */
> -       hwif->swdma_mask                = 0x00;
> +       hwif->swdma_mask                = 0x07;

Also not mentioned in the patch description.
I don't see any code in the driver to handle SWDMA?

Thanks,
Bartlomiej

From ralf@linux-mips.org Mon Feb 13 13:13:02 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 13 Feb 2006 13:13:10 +0000 (GMT)
Received: from mipsfw.mips-uk.com ([194.74.144.146]:19727 "EHLO
	bacchus.dhis.org") by ftp.linux-mips.org with ESMTP
	id S8133531AbWBMNNC (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Mon, 13 Feb 2006 13:13:02 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by bacchus.dhis.org (8.13.4/8.13.4) with ESMTP id k1DDJOKE010698;
	Mon, 13 Feb 2006 13:19:24 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.4/8.13.4/Submit) id k1DDJLn1010697;
	Mon, 13 Feb 2006 13:19:21 GMT
Date:	Mon, 13 Feb 2006 13:19:21 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc:	pdh@colonel-panic.org, linux-mips@linux-mips.org
Subject: Re: [PATCH 2.6.X] Early console for Cobalt
Message-ID: <20060213131921.GB3720@linux-mips.org>
References: <20060212171025.GB1562@colonel-panic.org> <20060213.114359.07641583.nemoto@toshiba-tops.co.jp>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20060213.114359.07641583.nemoto@toshiba-tops.co.jp>
User-Agent: Mutt/1.4.2.1i
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: 10420
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
Content-Length: 295
Lines: 10

On Mon, Feb 13, 2006 at 11:43:59AM +0900, Atsushi Nemoto wrote:

> >>>>> On Sun, 12 Feb 2006 17:10:25 +0000, Peter Horton <pdh@colonel-panic.org> said:
> pdh> Adds early console support for Cobalts.
> 
> We already have EARLY_PRINTK.  How about using it?  (like dec does)

Indeed, done.

  Ralf

From anemo@mba.ocn.ne.jp Mon Feb 13 16:09:10 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 13 Feb 2006 16:09:23 +0000 (GMT)
Received: from mba.ocn.ne.jp ([210.190.142.172]:7642 "HELO smtp.mba.ocn.ne.jp")
	by ftp.linux-mips.org with SMTP id S8133558AbWBMQJK (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Mon, 13 Feb 2006 16:09:10 +0000
Received: from localhost (p3068-ipad205funabasi.chiba.ocn.ne.jp [222.146.98.68])
	by smtp.mba.ocn.ne.jp (Postfix) with ESMTP
	id 7B144A993; Tue, 14 Feb 2006 01:15:22 +0900 (JST)
Date:	Tue, 14 Feb 2006 01:15:08 +0900 (JST)
Message-Id: <20060214.011508.41198724.anemo@mba.ocn.ne.jp>
To:	linux-mips@linux-mips.org
Cc:	ralf@linux-mips.org
Subject: [PATCH] fix cache coherency issues
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: 10421
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
Content-Length: 11996
Lines: 391

There are several cache-related problems with multi-threaded program
and fork().


Problem-1:  copy-on-write and signal trampoline on harvard-cache.
[previously reported with subject: missing data cache flush for signal trampoline on fork]

A program which is heavily using signal and fork occasionally killed
by SIGSEGV, etc.  When it was killed, PC is always near the stack
pointer.

This would happen on CPUs without MIPS_CACHE_IC_F_DC.  D-cache
aliasing is irrelevant.

1. To handle a delivered signal, a signal-trampoline code are written
to the stack page.

2. They are flushed to memory immediately and I-cache are invalidated.

3. If other thread called fork() before the signal handler is
executed, all writable pages (including the stack page) are marked as
COW page.

4. When the user signal handler is to write to the stack, the page
will be copied to new physical page by copy_user_highpage(), but not
flushed to main memory.

5. Then flush_cache_page() is called for the stack page, but it does
not flush the cache written by copy_user_highpage() because new PTE is
not established yet.

6. When returned from the user signal handler, the signal trampoline
code might not be written to main memory.  Garbage code will be
executed and the program will die.


Problem-2:  copy-on-write and dcache-aliasing
[previously reported with subject: dcache aliasing problem on fork]

1. Now there is a process containing two thread (T1 and T2).  The
   thread T1 calls fork().  Then dup_mmap() function called on T1 context.

static inline int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm)
	...
	flush_cache_mm(current->mm);
	...	/* A */
	(write-protect all Copy-On-Write pages)
	...	/* B */
	flush_tlb_mm(current->mm);
	...

2. When preemption happens between A and B (or on SMP kernel), the
   thread T2 can run and modify data on COW pages without page fault
   (modified data will stay in cache).

3. Some time after fork() completed, the thread T2 may cause a page
   fault by write-protect on a COW page.

4. Then data of the COW page will be copied to newly allocated
   physical page (copy_cow_page()).  It reads data via kernel mapping.
   The kernel mapping can have different 'color' with user space
   mapping of the thread T2 (dcache aliasing).  Therefore
   copy_cow_page() will copy stale data.  Then the modified data in
   cache will be lost.


This patch fixes above problems using custom copy_user_highpage().  It
uses kmap_coherent() to map an user page for kernel with same color.
Also copy_to_user_page() and copy_from_user_page() are rewritten using
the kmap_coherent() to avoid extra cache flushing.


The main part of this patch was originally written by Ralf Baechle.

 arch/mips/mm/init.c           |  132 ++++++++++++++++++++++++++++++++++++++++++
 include/asm-mips/cacheflush.h |   14 ++--
 include/asm-mips/fixmap.h     |    8 +-
 include/asm-mips/page.h       |   14 +---
 include/linux/highmem.h       |    7 +-
 mm/memory.c                   |    8 +-
 6 files changed, 160 insertions(+), 23 deletions(-)

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

diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 0ff9a34..333fd59 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -30,11 +30,15 @@
 #include <asm/cachectl.h>
 #include <asm/cpu.h>
 #include <asm/dma.h>
+#include <asm/interrupt.h>
+#include <asm/kmap_types.h>
+#include <asm/mipsmtregs.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>
 
 DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
 
@@ -79,6 +83,134 @@ unsigned long setup_zero_pages(void)
 	return 1UL << order;
 }
 
+/*
+ * These are almost like kmap_atomic / kunmap_atmic except they take an
+ * additional address argument as the hint.
+ */
+
+static inline void *kmap_coherent(struct page *page, unsigned long addr)
+{
+	unsigned long vaddr, flags, entrylo;
+	enum fixed_addresses idx;
+	unsigned long asid;
+	unsigned int vpflags;
+	unsigned int wired;
+
+	if (!cpu_has_dc_aliases)
+		return page_address(page);
+	inc_preempt_count();
+
+	if (cpu_has_mipsmt)
+		vpflags = dvpe();
+	local_irq_save(flags);
+
+	idx = (addr >> 12) & 7;
+	vaddr = __fix_to_virt(FIX_CMAP_END - idx);
+
+	asid = read_c0_entryhi();
+	wired = read_c0_wired();
+	write_c0_wired(wired + 1);
+	write_c0_index(wired);
+	write_c0_entryhi(vaddr & ~0x1fffUL);
+	entrylo = (page_to_pfn(page) << 6) | (pgprot_val(PAGE_KERNEL) >> 6);
+	write_c0_entrylo0(entrylo);
+	write_c0_entrylo1(entrylo);
+	mtc0_tlbw_hazard();
+	tlb_write_indexed();
+	write_c0_entryhi(asid);
+
+	local_irq_restore(flags);
+	if (cpu_has_mipsmt)
+		evpe(vpflags);
+
+	return (void*) vaddr;
+}
+
+#define UNIQUE_ENTRYHI(idx) (CKSEG0 + ((idx) << (PAGE_SHIFT + 1)))
+
+static inline void kunmap_coherent(void)
+{
+	unsigned int vpflags, wired;
+	unsigned long flags, asid;
+
+	if (!cpu_has_dc_aliases)
+		return;
+	if (cpu_has_mipsmt)
+		vpflags = dvpe();
+	local_irq_save(flags);
+
+	asid = 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(asid);
+
+	local_irq_restore(flags);
+	if (cpu_has_mipsmt)
+		evpe(vpflags);
+
+	dec_preempt_count();
+	preempt_check_resched();
+}
+
+void copy_user_highpage(struct page *to, struct page *from,
+			unsigned long vaddr, struct vm_area_struct *vma)
+{
+	char *vfrom, *vto;
+	/*
+	 * Map 'from' page to same color with vaddr and map 'to' page
+	 * to kernel, and flush 'to' page if needed.
+	 * Just using kmap_coherent for both 'from' and 'to' (and no
+	 * flushing) is not enough because:
+	 * 1. The signal trampoline code should be flushed to main memory.
+	 * 2. The page 'to' might have been cached via kernel mapping.
+	 */
+	vfrom = kmap_coherent(from, vaddr);
+	vto = kmap_atomic(to, KM_USER1);
+	copy_page(vto, vfrom);
+	if (((vma->vm_flags & VM_EXEC) && !cpu_has_ic_fills_f_dc) ||
+	    (cpu_has_dc_aliases && pages_do_alias((unsigned long)vto, vaddr)))
+		flush_data_cache_page((unsigned long)vto);
+	kunmap_atomic(vto, KM_USER1);
+	kunmap_coherent();
+	/* Make sure this page is cleared on other CPU's too before using it */
+	smp_wmb();
+}
+
+EXPORT_SYMBOL(copy_user_highpage);
+
+void __copy_to_user_page(struct vm_area_struct *vma,
+        struct page *page, unsigned long vaddr, const void *src,
+	unsigned long len)
+{
+	char *vto;
+
+	vto = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK);
+        memcpy(vto, src, len);
+	kunmap_coherent();
+        flush_icache_page(vma, page);
+}
+
+EXPORT_SYMBOL(__copy_to_user_page);
+
+void __copy_from_user_page(struct page *page, unsigned long vaddr,
+	void *dst, unsigned long len)
+{
+	char *vfrom;
+
+	vfrom = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK);
+	memcpy(dst, vfrom, len);
+	kunmap_coherent();
+}
+
+EXPORT_SYMBOL(__copy_from_user_page);
+
+
 #ifdef CONFIG_HIGHMEM
 pte_t *kmap_pte;
 pgprot_t kmap_prot;
diff --git a/include/asm-mips/cacheflush.h b/include/asm-mips/cacheflush.h
index aeae9fa..7e4c30d 100644
--- a/include/asm-mips/cacheflush.h
+++ b/include/asm-mips/cacheflush.h
@@ -53,23 +53,23 @@ extern void (*flush_icache_range)(unsign
 #define flush_cache_vmap(start, end)		flush_cache_all()
 #define flush_cache_vunmap(start, end)		flush_cache_all()
 
+extern void __copy_to_user_page(struct vm_area_struct *vma,
+	struct page *page, unsigned long vaddr, const void *src,
+	unsigned long len);
 static inline 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);
+	__copy_to_user_page(vma, page, vaddr, src, len);
 }
 
+extern void __copy_from_user_page(struct page *page, unsigned long vaddr,
+	void *dst, unsigned long len);
 static inline 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);
+	__copy_from_user_page(page, vaddr, dst, len);
 }
 
 extern void (*flush_cache_sigtramp)(unsigned long addr);
diff --git a/include/asm-mips/fixmap.h b/include/asm-mips/fixmap.h
index 73a3028..3dc8af6 100644
--- a/include/asm-mips/fixmap.h
+++ b/include/asm-mips/fixmap.h
@@ -46,8 +46,12 @@
  * fix-mapped?
  */
 enum fixed_addresses {
+#define FIX_N_COLOURS 8
+	FIX_CMAP_BEGIN,
+	FIX_CMAP_END = FIX_CMAP_BEGIN + FIX_N_COLOURS,
 #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 +74,7 @@ extern void __set_fixmap (enum fixed_add
  * 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/page.h b/include/asm-mips/page.h
index ee25a77..a896495 100644
--- a/include/asm-mips/page.h
+++ b/include/asm-mips/page.h
@@ -62,15 +62,11 @@ 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);
-
-	copy_page(vto, vfrom);
-	if (pages_do_alias((unsigned long)vto, vaddr))
-		flush_data_cache_page((unsigned long)vto);
-}
+struct vm_area_struct;
+extern void copy_user_highpage(struct page *to, struct page *from,
+	unsigned long vaddr, struct vm_area_struct *vma);
+
+#define __HAVE_ARCH_COPY_USER_HIGHPAGE
 
 /*
  * These are used to make use of C type-checking..
diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index 6bece92..768914a 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -78,7 +78,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;
 
@@ -91,6 +94,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 2bee1f2..653b08f 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1386,7 +1386,7 @@ 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
@@ -1410,7 +1410,7 @@ static inline void cow_user_page(struct 
 		return;
 		
 	}
-	copy_user_highpage(dst, src, va);
+	copy_user_highpage(dst, src, va, vma);
 }
 
 /*
@@ -1475,7 +1475,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);
 	}
 
 	/*
@@ -2074,7 +2074,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 tbm@cyrius.com Mon Feb 13 22:33:57 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 13 Feb 2006 22:34:07 +0000 (GMT)
Received: from sorrow.cyrius.com ([65.19.161.204]:31493 "EHLO
	sorrow.cyrius.com") by ftp.linux-mips.org with ESMTP
	id S3467366AbWBMWd5 (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Mon, 13 Feb 2006 22:33:57 +0000
Received: by sorrow.cyrius.com (Postfix, from userid 10)
	id C482864D3D; Mon, 13 Feb 2006 22:40:06 +0000 (UTC)
Received: by deprecation.cyrius.com (Postfix, from userid 1000)
	id 996F582BB; Mon, 13 Feb 2006 22:39:51 +0000 (GMT)
Date:	Mon, 13 Feb 2006 22:39:51 +0000
From:	Martin Michlmayr <tbm@cyrius.com>
To:	"Maciej W. Rozycki" <macro@linux-mips.org>
Cc:	Ralf Baechle <ralf@linux-mips.org>,
	Peter 'p2' De Schrijver <p2@mind.be>,
	linux-mips@linux-mips.org
Subject: Re: DECstation R3000 boot error
Message-ID: <20060213223951.GA4226@deprecation.cyrius.com>
References: <20060123225040.GA23576@deprecation.cyrius.com> <Pine.LNX.4.64N.0601241059140.11021@blysk.ds.pg.gda.pl> <20060124122700.GA8527@deprecation.cyrius.com> <Pine.LNX.4.64N.0601241227290.11021@blysk.ds.pg.gda.pl> <20060124232117.GA4165@codecarver> <Pine.LNX.4.64N.0601251103020.7675@blysk.ds.pg.gda.pl> <20060203150232.GA25701@deprecation.cyrius.com> <Pine.LNX.4.64N.0602061021110.32080@blysk.ds.pg.gda.pl> <Pine.LNX.4.64N.0602130911260.17051@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.0602130911260.17051@blysk.ds.pg.gda.pl>
User-Agent: Mutt/1.5.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: 10422
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
Content-Length: 543
Lines: 13

* Maciej W. Rozycki <macro@linux-mips.org> [2006-02-13 09:15]:
>  The following change fixes the problem for me -- it looks like an 
> omission from some recent changes elsewhere.  Ralf, please apply.

Current git and the standard decstation config fails to build with:

  LD      .tmp_vmlinux1
arch/mips/kernel/built-in.o: In function `einval':arch/mips/kernel/scall32-o32.S:(.text+0xb6c0): undefined reference to `sys_newfstatat'

This is with binutils 2.16.1cvs20060117-1 and gcc 4.0.3 20051201.
-- 
Martin Michlmayr
http://www.cyrius.com/

From tbm@cyrius.com Mon Feb 13 22:41:23 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 13 Feb 2006 22:41:33 +0000 (GMT)
Received: from sorrow.cyrius.com ([65.19.161.204]:37637 "EHLO
	sorrow.cyrius.com") by ftp.linux-mips.org with ESMTP
	id S3467599AbWBMWlX (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Mon, 13 Feb 2006 22:41:23 +0000
Received: by sorrow.cyrius.com (Postfix, from userid 10)
	id D93B564D3D; Mon, 13 Feb 2006 22:47:40 +0000 (UTC)
Received: by deprecation.cyrius.com (Postfix, from userid 1000)
	id 0F62A82BB; Mon, 13 Feb 2006 22:47:33 +0000 (GMT)
Date:	Mon, 13 Feb 2006 22:47:33 +0000
From:	Martin Michlmayr <tbm@cyrius.com>
To:	"Maciej W. Rozycki" <macro@linux-mips.org>
Cc:	Ralf Baechle <ralf@linux-mips.org>,
	Peter 'p2' De Schrijver <p2@mind.be>,
	linux-mips@linux-mips.org
Subject: Re: DECstation R3000 boot error
Message-ID: <20060213224733.GA4983@deprecation.cyrius.com>
References: <20060123225040.GA23576@deprecation.cyrius.com> <Pine.LNX.4.64N.0601241059140.11021@blysk.ds.pg.gda.pl> <20060124122700.GA8527@deprecation.cyrius.com> <Pine.LNX.4.64N.0601241227290.11021@blysk.ds.pg.gda.pl> <20060124232117.GA4165@codecarver> <Pine.LNX.4.64N.0601251103020.7675@blysk.ds.pg.gda.pl> <20060203150232.GA25701@deprecation.cyrius.com> <Pine.LNX.4.64N.0602061021110.32080@blysk.ds.pg.gda.pl> <Pine.LNX.4.64N.0602130911260.17051@blysk.ds.pg.gda.pl> <20060213223951.GA4226@deprecation.cyrius.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20060213223951.GA4226@deprecation.cyrius.com>
User-Agent: Mutt/1.5.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: 10423
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
Content-Length: 566
Lines: 14

* Martin Michlmayr <tbm@cyrius.com> [2006-02-13 22:39]:
>   LD      .tmp_vmlinux1
> arch/mips/kernel/built-in.o: In function `einval':arch/mips/kernel/scall32-o32.S:(.text+0xb6c0): undefined reference to `sys_newfstatat'
> 
> This is with binutils 2.16.1cvs20060117-1 and gcc 4.0.3 20051201.

I see a fix for this just went into Linus' git tree.  Can we have this
in the linux-mips tree too please.

http://www.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=326a625748535c4cdb1c632b1dcb07030989a393

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

From tbm@cyrius.com Mon Feb 13 22:47:21 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 13 Feb 2006 22:47:30 +0000 (GMT)
Received: from sorrow.cyrius.com ([65.19.161.204]:41733 "EHLO
	sorrow.cyrius.com") by ftp.linux-mips.org with ESMTP
	id S3467599AbWBMWrV (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Mon, 13 Feb 2006 22:47:21 +0000
Received: by sorrow.cyrius.com (Postfix, from userid 10)
	id BB75164D3D; Mon, 13 Feb 2006 22:53:37 +0000 (UTC)
Received: by deprecation.cyrius.com (Postfix, from userid 1000)
	id C2E8F82BB; Mon, 13 Feb 2006 22:53:31 +0000 (GMT)
Date:	Mon, 13 Feb 2006 22:53:31 +0000
From:	Martin Michlmayr <tbm@cyrius.com>
To:	linux-mips@linux-mips.org
Subject: Please pull drivers/scsi/dec_esp.c from Linus' git
Message-ID: <20060213225331.GA5315@deprecation.cyrius.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
User-Agent: Mutt/1.5.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: 10424
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
Content-Length: 4565
Lines: 120

linux-mips git on DECstation currently fails to compile with:

  CC      drivers/scsi/dec_esp.o
drivers/scsi/dec_esp.c:137: error: static declaration of â€dec_esp_detectâ€™ follows non-static declaration
drivers/scsi/dec_esp.c:101: error: previous declaration of â€dec_esp_detectâ€™ was here
make[2]: *** [drivers/scsi/dec_esp.o] Error 1
make[1]: *** [drivers/scsi] Error 2

This declaration is correct in Linus' git tree but not in ours.  Ralf,
can you please compare the two again and sync.

The current delta is included below.


--- drivers/scsi/dec_esp.c	2006-02-13 21:48:12.000000000 +0000
+++ /home/tbm/index.html?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=blob_plain;h=a35ee43a48df78e1b627c63e33e6895035d0fe1a;f=drivers%2Fscsi%2Fdec_esp.c	2006-02-13 22:52:06.000000000 +0000
@@ -55,7 +55,7 @@
 
 static int  dma_bytes_sent(struct NCR_ESP *esp, int fifo_count);
 static void dma_drain(struct NCR_ESP *esp);
-static int  dma_can_transfer(struct NCR_ESP *esp, Scsi_Cmnd * sp);
+static int  dma_can_transfer(struct NCR_ESP *esp, struct scsi_cmnd *sp);
 static void dma_dump_state(struct NCR_ESP *esp);
 static void dma_init_read(struct NCR_ESP *esp, u32 vaddress, int length);
 static void dma_init_write(struct NCR_ESP *esp, u32 vaddress, int length);
@@ -64,9 +64,9 @@
 static int  dma_irq_p(struct NCR_ESP *esp);
 static int  dma_ports_p(struct NCR_ESP *esp);
 static void dma_setup(struct NCR_ESP *esp, u32 addr, int count, int write);
-static void dma_mmu_get_scsi_one(struct NCR_ESP *esp, Scsi_Cmnd * sp);
-static void dma_mmu_get_scsi_sgl(struct NCR_ESP *esp, Scsi_Cmnd * sp);
-static void dma_advance_sg(Scsi_Cmnd * sp);
+static void dma_mmu_get_scsi_one(struct NCR_ESP *esp, struct scsi_cmnd * sp);
+static void dma_mmu_get_scsi_sgl(struct NCR_ESP *esp, struct scsi_cmnd * sp);
+static void dma_advance_sg(struct scsi_cmnd * sp);
 
 static void pmaz_dma_drain(struct NCR_ESP *esp);
 static void pmaz_dma_init_read(struct NCR_ESP *esp, u32 vaddress, int length);
@@ -74,7 +74,7 @@
 static void pmaz_dma_ints_off(struct NCR_ESP *esp);
 static void pmaz_dma_ints_on(struct NCR_ESP *esp);
 static void pmaz_dma_setup(struct NCR_ESP *esp, u32 addr, int count, int write);
-static void pmaz_dma_mmu_get_scsi_one(struct NCR_ESP *esp, Scsi_Cmnd * sp);
+static void pmaz_dma_mmu_get_scsi_one(struct NCR_ESP *esp, struct scsi_cmnd * sp);
 
 #define TC_ESP_RAM_SIZE 0x20000
 #define ESP_TGT_DMA_SIZE ((TC_ESP_RAM_SIZE/7) & ~(sizeof(int)-1))
@@ -98,7 +98,7 @@
 static irqreturn_t scsi_dma_err_int(int, void *, struct pt_regs *);
 static irqreturn_t scsi_dma_int(int, void *, struct pt_regs *);
 
-int dec_esp_detect(struct scsi_host_template * tpnt);
+static int dec_esp_detect(struct scsi_host_template * tpnt);
 
 static int dec_esp_release(struct Scsi_Host *shost)
 {
@@ -112,7 +112,7 @@
 
 static struct scsi_host_template driver_template = {
 	.proc_name		= "dec_esp",
-	.proc_info		= &esp_proc_info,
+	.proc_info		= esp_proc_info,
 	.name			= "NCR53C94",
 	.detect			= dec_esp_detect,
 	.slave_alloc		= esp_slave_alloc,
@@ -230,7 +230,7 @@
 			mem_start = get_tc_base_addr(slot);
 
 			/* Store base addr into esp struct */
-			esp->slot = mem_start;
+			esp->slot = CPHYSADDR(mem_start);
 
 			esp->dregs = 0;
 			esp->eregs = (void *)CKSEG1ADDR(mem_start +
@@ -379,7 +379,7 @@
 	}
 }
 
-static int dma_can_transfer(struct NCR_ESP *esp, Scsi_Cmnd * sp)
+static int dma_can_transfer(struct NCR_ESP *esp, struct scsi_cmnd * sp)
 {
 	return sp->SCp.this_residual;
 }
@@ -491,12 +491,12 @@
 		dma_init_write(esp, addr, count);
 }
 
-static void dma_mmu_get_scsi_one(struct NCR_ESP *esp, Scsi_Cmnd * sp)
+static void dma_mmu_get_scsi_one(struct NCR_ESP *esp, struct scsi_cmnd * sp)
 {
 	sp->SCp.ptr = (char *)virt_to_phys(sp->request_buffer);
 }
 
-static void dma_mmu_get_scsi_sgl(struct NCR_ESP *esp, Scsi_Cmnd * sp)
+static void dma_mmu_get_scsi_sgl(struct NCR_ESP *esp, struct scsi_cmnd * sp)
 {
 	int sz = sp->SCp.buffers_residual;
 	struct scatterlist *sg = sp->SCp.buffer;
@@ -508,7 +508,7 @@
 	sp->SCp.ptr = (char *)(sp->SCp.buffer->dma_address);
 }
 
-static void dma_advance_sg(Scsi_Cmnd * sp)
+static void dma_advance_sg(struct scsi_cmnd * sp)
 {
 	sp->SCp.ptr = (char *)(sp->SCp.buffer->dma_address);
 }
@@ -572,7 +572,7 @@
 		pmaz_dma_init_write(esp, addr, count);
 }
 
-static void pmaz_dma_mmu_get_scsi_one(struct NCR_ESP *esp, Scsi_Cmnd * sp)
+static void pmaz_dma_mmu_get_scsi_one(struct NCR_ESP *esp, struct scsi_cmnd * sp)
 {
 	sp->SCp.ptr = (char *)virt_to_phys(sp->request_buffer);
 }

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

From tbm@cyrius.com Mon Feb 13 22:53:17 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 13 Feb 2006 22:53:25 +0000 (GMT)
Received: from sorrow.cyrius.com ([65.19.161.204]:45317 "EHLO
	sorrow.cyrius.com") by ftp.linux-mips.org with ESMTP
	id S3467599AbWBMWxR (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Mon, 13 Feb 2006 22:53:17 +0000
Received: by sorrow.cyrius.com (Postfix, from userid 10)
	id CCB9C64D3D; Mon, 13 Feb 2006 22:59:33 +0000 (UTC)
Received: by deprecation.cyrius.com (Postfix, from userid 1000)
	id C457D82BB; Mon, 13 Feb 2006 22:59:27 +0000 (GMT)
Date:	Mon, 13 Feb 2006 22:59:27 +0000
From:	Martin Michlmayr <tbm@cyrius.com>
To:	"Maciej W. Rozycki" <macro@linux-mips.org>
Cc:	Ralf Baechle <ralf@linux-mips.org>,
	Peter 'p2' De Schrijver <p2@mind.be>,
	linux-mips@linux-mips.org
Subject: Re: DECstation R3000 boot error
Message-ID: <20060213225927.GB4226@deprecation.cyrius.com>
References: <20060123225040.GA23576@deprecation.cyrius.com> <Pine.LNX.4.64N.0601241059140.11021@blysk.ds.pg.gda.pl> <20060124122700.GA8527@deprecation.cyrius.com> <Pine.LNX.4.64N.0601241227290.11021@blysk.ds.pg.gda.pl> <20060124232117.GA4165@codecarver> <Pine.LNX.4.64N.0601251103020.7675@blysk.ds.pg.gda.pl> <20060203150232.GA25701@deprecation.cyrius.com> <Pine.LNX.4.64N.0602061021110.32080@blysk.ds.pg.gda.pl> <Pine.LNX.4.64N.0602130911260.17051@blysk.ds.pg.gda.pl>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <Pine.LNX.4.64N.0602130911260.17051@blysk.ds.pg.gda.pl>
User-Agent: Mutt/1.5.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: 10425
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
Content-Length: 2147
Lines: 56

BTW, turning CONFIG_VT on leads to these compile errors:

  CC      drivers/tc/lk201.o
drivers/tc/lk201.c:19:26: error: linux/kbd_ll.h: No such file or directory
drivers/tc/lk201.c:23:26: error: asm/keyboard.h: No such file or directory
drivers/tc/lk201.c: In function â€parse_kbd_rateâ€™:
drivers/tc/lk201.c:189: error: â€struct kbd_repeatâ€™ has no member named â€rateâ€™
drivers/tc/lk201.c:190: error: â€struct kbd_repeatâ€™ has no member named â€rateâ€™
drivers/tc/lk201.c:190: error: â€struct kbd_repeatâ€™ has no member named â€rateâ€™
drivers/tc/lk201.c:196: error: â€struct kbd_repeatâ€™ has no member named â€rateâ€™
drivers/tc/lk201.c:197: error: â€struct kbd_repeatâ€™ has no member named â€rateâ€™
drivers/tc/lk201.c:198: error: â€struct kbd_repeatâ€™ has no member named â€rateâ€™
drivers/tc/lk201.c:199: error: â€struct kbd_repeatâ€™ has no member named â€rateâ€™
drivers/tc/lk201.c:200: error: â€struct kbd_repeatâ€™ has no member named â€rateâ€™
drivers/tc/lk201.c:201: error: â€struct kbd_repeatâ€™ has no member named â€rateâ€™
drivers/tc/lk201.c: In function â€write_kbd_rateâ€™:
drivers/tc/lk201.c:210: error: â€struct kbd_repeatâ€™ has no member named â€rateâ€™
drivers/tc/lk201.c: In function â€lk201_rx_charâ€™:
drivers/tc/lk201.c:363: warning: implicit declaration of function â€handle_scancodeâ€™
drivers/tc/lk201.c: In function â€lk201_initâ€™:
drivers/tc/lk201.c:407: error: invalid lvalue in assignment
drivers/tc/lk201.c:408: error: invalid lvalue in assignment
make[2]: *** [drivers/tc/lk201.o] Error 1


--- old-config	2006-02-13 22:55:32.000000000 +0000
+++ .config	2006-02-13 22:55:36.000000000 +0000
@@ -530,7 +530,9 @@
 #
 # Character devices
 #
-# CONFIG_VT is not set
+CONFIG_VT=y
+CONFIG_VT_CONSOLE=y
+CONFIG_HW_CONSOLE=y
 # CONFIG_SERIAL_NONSTANDARD is not set
 CONFIG_SERIAL_DEC=y
 CONFIG_SERIAL_DEC_CONSOLE=y
@@ -631,6 +633,13 @@
 # CONFIG_FB_VIRTUAL is not set
 
 #
+# Console display driver support
+#
+CONFIG_VGA_CONSOLE=y
+CONFIG_DUMMY_CONSOLE=y
+# CONFIG_FRAMEBUFFER_CONSOLE is not set
+
+#
 # Logo configuration
 #
 CONFIG_LOGO=y

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

From tbm@cyrius.com Mon Feb 13 23:17:22 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 13 Feb 2006 23:17:33 +0000 (GMT)
Received: from sorrow.cyrius.com ([65.19.161.204]:54789 "EHLO
	sorrow.cyrius.com") by ftp.linux-mips.org with ESMTP
	id S3467599AbWBMXRW (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Mon, 13 Feb 2006 23:17:22 +0000
Received: by sorrow.cyrius.com (Postfix, from userid 10)
	id 2D20C64D3D; Mon, 13 Feb 2006 23:23:39 +0000 (UTC)
Received: by deprecation.cyrius.com (Postfix, from userid 1000)
	id 161A38FB8; Mon, 13 Feb 2006 23:23:29 +0000 (GMT)
Date:	Mon, 13 Feb 2006 23:23:29 +0000
From:	Martin Michlmayr <tbm@cyrius.com>
To:	"Maciej W. Rozycki" <macro@linux-mips.org>
Cc:	linux-mips@linux-mips.org
Subject: Re: DECstation R3000 boot error
Message-ID: <20060213232329.GA8286@deprecation.cyrius.com>
References: <20060123225040.GA23576@deprecation.cyrius.com> <Pine.LNX.4.64N.0601241059140.11021@blysk.ds.pg.gda.pl> <20060124122700.GA8527@deprecation.cyrius.com> <Pine.LNX.4.64N.0601241227290.11021@blysk.ds.pg.gda.pl> <20060124232117.GA4165@codecarver> <Pine.LNX.4.64N.0601251103020.7675@blysk.ds.pg.gda.pl> <20060203150232.GA25701@deprecation.cyrius.com> <Pine.LNX.4.64N.0602061021110.32080@blysk.ds.pg.gda.pl> <Pine.LNX.4.64N.0602130911260.17051@blysk.ds.pg.gda.pl> <20060213225927.GB4226@deprecation.cyrius.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20060213225927.GB4226@deprecation.cyrius.com>
User-Agent: Mutt/1.5.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: 10426
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
Content-Length: 2050
Lines: 83

* Martin Michlmayr <tbm@cyrius.com> [2006-02-13 22:59]:
> BTW, turning CONFIG_VT on leads to these compile errors:

OK, I got it down to:

  CC      drivers/tc/lk201.o
drivers/tc/lk201.c: In function â€lk201_rx_charâ€™:
drivers/tc/lk201.c:361: warning: implicit declaration of function â€handle_scancodeâ€™
drivers/tc/lk201.c: In function â€lk201_initâ€™:
drivers/tc/lk201.c:405: error: invalid lvalue in assignment
drivers/tc/lk201.c:406: error: invalid lvalue in assignment
make[2]: *** [drivers/tc/lk201.o] Error 1

But this driver really needs to be ported to the new input interface.


--- a/drivers/tc/lk201.c~	2006-02-13 22:59:57.000000000 +0000
+++ b/drivers/tc/lk201.c	2006-02-13 23:21:54.000000000 +0000
@@ -16,11 +16,9 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/delay.h>
-#include <linux/kbd_ll.h>
 #include <linux/kbd_kern.h>
 #include <linux/vt_kern.h>
 
-#include <asm/keyboard.h>
 #include <asm/dec/tc.h>
 #include <asm/dec/machtype.h>
 #include <asm/dec/serial.h>
@@ -186,28 +184,28 @@
 {
 	if (r->delay <= 0)
 		r->delay = kbdrate.delay;
-	if (r->rate <= 0)
-		r->rate = kbdrate.rate;
+	if (r->period <= 0)
+		r->period = kbdrate.period;
 
 	if (r->delay < 5)
 		r->delay = 5;
 	if (r->delay > 630)
 		r->delay = 630;
-	if (r->rate < 12)
-		r->rate = 12;
-	if (r->rate > 127)
-		r->rate = 127;
-	if (r->rate == 125)
-		r->rate = 124;
+	if (r->period < 12)
+		r->period = 12;
+	if (r->period > 127)
+		r->period = 127;
+	if (r->period == 125)
+		r->period = 124;
 }
 
 static int write_kbd_rate(struct kbd_repeat *rep)
 {
-	int delay, rate;
+	int delay, period;
 	int i;
 
 	delay = rep->delay / 5;
-	rate = rep->rate;
+	period = rep->period;
 	for (i = 0; i < 4; i++) {
 		if (lk201_hook.poll_tx_char(lk201_handle,
 					    LK_CMD_RPT_RATE(i)))
@@ -216,7 +214,7 @@
 					    LK_PARAM_DELAY(delay)))
 			return 1;
 		if (lk201_hook.poll_tx_char(lk201_handle,
-					    LK_PARAM_RATE(rate)))
+					    LK_PARAM_RATE(period)))
 			return 1;
 	}
 	return 0;


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

From tbm@cyrius.com Mon Feb 13 23:20:53 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 13 Feb 2006 23:21:02 +0000 (GMT)
Received: from sorrow.cyrius.com ([65.19.161.204]:61957 "EHLO
	sorrow.cyrius.com") by ftp.linux-mips.org with ESMTP
	id S3467599AbWBMXUx (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Mon, 13 Feb 2006 23:20:53 +0000
Received: by sorrow.cyrius.com (Postfix, from userid 10)
	id 13AE564D3D; Mon, 13 Feb 2006 23:27:11 +0000 (UTC)
Received: by deprecation.cyrius.com (Postfix, from userid 1000)
	id 4F9DA82BB; Mon, 13 Feb 2006 23:27:04 +0000 (GMT)
Date:	Mon, 13 Feb 2006 23:27:04 +0000
From:	Martin Michlmayr <tbm@cyrius.com>
To:	"Maciej W. Rozycki" <macro@linux-mips.org>
Cc:	Ralf Baechle <ralf@linux-mips.org>,
	Peter 'p2' De Schrijver <p2@mind.be>,
	linux-mips@linux-mips.org
Subject: Re: DECstation R3000 boot error
Message-ID: <20060213232704.GA8360@deprecation.cyrius.com>
References: <20060123225040.GA23576@deprecation.cyrius.com> <Pine.LNX.4.64N.0601241059140.11021@blysk.ds.pg.gda.pl> <20060124122700.GA8527@deprecation.cyrius.com> <Pine.LNX.4.64N.0601241227290.11021@blysk.ds.pg.gda.pl> <20060124232117.GA4165@codecarver> <Pine.LNX.4.64N.0601251103020.7675@blysk.ds.pg.gda.pl> <20060203150232.GA25701@deprecation.cyrius.com> <Pine.LNX.4.64N.0602061021110.32080@blysk.ds.pg.gda.pl> <Pine.LNX.4.64N.0602130911260.17051@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.0602130911260.17051@blysk.ds.pg.gda.pl>
User-Agent: Mutt/1.5.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: 10427
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
Content-Length: 466
Lines: 12

* Maciej W. Rozycki <macro@linux-mips.org> [2006-02-13 09:15]:
> The following change fixes the problem for me -- it looks like an
> omission from some recent changes elsewhere.  Ralf, please apply.

Apparently it boots with current git and your fix.  I think p2 will
confirm later.

However, it doesn't boot with 2.6.15 from a few weeks ago plus some
random fixes plus your patch.  Any idea what else might have changed?
-- 
Martin Michlmayr
http://www.cyrius.com/

From tbm@cyrius.com Mon Feb 13 23:29:33 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 13 Feb 2006 23:29:43 +0000 (GMT)
Received: from sorrow.cyrius.com ([65.19.161.204]:4102 "EHLO sorrow.cyrius.com")
	by ftp.linux-mips.org with ESMTP id S3467599AbWBMX3d (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Mon, 13 Feb 2006 23:29:33 +0000
Received: by sorrow.cyrius.com (Postfix, from userid 10)
	id 0E3C664D3D; Mon, 13 Feb 2006 23:35:51 +0000 (UTC)
Received: by deprecation.cyrius.com (Postfix, from userid 1000)
	id 9AB7A82BB; Mon, 13 Feb 2006 23:35:45 +0000 (GMT)
Date:	Mon, 13 Feb 2006 23:35:45 +0000
From:	Martin Michlmayr <tbm@cyrius.com>
To:	"Maciej W. Rozycki" <macro@linux-mips.org>
Cc:	Ralf Baechle <ralf@linux-mips.org>,
	Peter 'p2' De Schrijver <p2@mind.be>,
	linux-mips@linux-mips.org
Subject: Re: DECstation R3000 boot error
Message-ID: <20060213233545.GA8892@deprecation.cyrius.com>
References: <20060123225040.GA23576@deprecation.cyrius.com> <Pine.LNX.4.64N.0601241059140.11021@blysk.ds.pg.gda.pl> <20060124122700.GA8527@deprecation.cyrius.com> <Pine.LNX.4.64N.0601241227290.11021@blysk.ds.pg.gda.pl> <20060124232117.GA4165@codecarver> <Pine.LNX.4.64N.0601251103020.7675@blysk.ds.pg.gda.pl> <20060203150232.GA25701@deprecation.cyrius.com> <Pine.LNX.4.64N.0602061021110.32080@blysk.ds.pg.gda.pl> <Pine.LNX.4.64N.0602130911260.17051@blysk.ds.pg.gda.pl> <20060213232704.GA8360@deprecation.cyrius.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20060213232704.GA8360@deprecation.cyrius.com>
User-Agent: Mutt/1.5.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: 10428
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
Content-Length: 3359
Lines: 81

* Martin Michlmayr <tbm@cyrius.com> [2006-02-13 23:27]:
> Apparently it boots with current git and your fix.  I think p2 will
> confirm later.

Here's the boot log from p2:


>>boot 3/tftp/vmlinux-pmax console=ttyS2

-tftp boot(3), bootp 10.42.0.190:/tftpboot/vmlinux-pmax
-tftp load 2986117+0+118683
Linux version 2.6.16-rc3 (tbm@deprecation) (gcc version 4.0.3 20051201 (prerelease) (Debian 4.0.2-5)) #3 Mon Feb 13 22:40:31 GMT 2006
This is a DECstation 5000/2x0
CPU revision is: 00000230
FPU revision is: 00000340
Determined physical RAM map:
 memory: 0c000000 @ 00000000 (usable)
Built 1 zonelists
Kernel command line: console=ttyS2
Primary instruction cache 64kB, linesize 4 bytes.
Primary data cache 64kB, linesize 4 bytes.
Synthesized TLB refill handler (17 instructions).
Synthesized TLB load handler fastpath (31 instructions).
Synthesized TLB store handler fastpath (31 instructions).
Synthesized TLB modify handler fastpath (25 instructions).
PID hash table entries: 1024 (order: 10, 16384 bytes)
Using 25.000 MHz high precision timer.
Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
Memory: 191488k/196608k available (2350k kernel code, 5044k reserved, 417k data, 148k init, 0k highmem)
Mount-cache hash table entries: 512
Checking for 'wait' instruction...  unavailable.
NET: Registered protocol family 16
SCSI subsystem initialized
TURBOchannel rev. 1 at 25.0 MHz (without parity)
    slot 0: DEC      PMAZ-AA  V5.3d
    slot 1: DEC      PMAGB-BA V1.0
    slot 2: DEC      PMAG-BA  V5.3a
Initializing Cryptographic API
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler deadline registered
io scheduler cfq registered
fb0: PMAG-BA frame buffer device in slot 2
fb1: PMAGB-BA frame buffer device in slot 1
fb1: Osc0: 130.808MHz, Osc1: disabled, Osc0 selected
DECstation Z8530 serial driver version 0.09
ttyS00 at 0xbf900001 (irq = 14) is a Z85C30 SCC
ttyS01 at 0xbf900009 (irq = 14) is a Z85C30 SCC
ttyS02 at 0xbf980001 (irq = 15) is a Z85C30 SCC
ttyS03 at 0xbf980009 (irq = 15) is a Z85C30 SCC
rtc: Digital DECstation epoch (2000) detected
Real Time Clock Driver v1.12a
declance.c: v0.009 by Linux MIPS DECstation task force
declance0: IOASIC onboard LANCE, addr = 08:00:2b:38:72:b4, irq = 16
declance0: registered as eth0.
SCSI ID 7 Clk 25MHz CCF=5 TOut 167 NCR53C9x(esp236)
SCSI ID 7 Clk 25MHz CCF=5 TOut 167 NCR53C9x(esp236)
ESP: Total of 2 ESP hosts found, 2 actually in use.
scsi0 : ESP236 (NCR53C9x)
scsi1 : ESP236 (NCR53C9x)
mice: PS/2 mouse device common for all mice
NET: Registered protocol family 2
IP route cache hash table entries: 2048 (order: 1, 8192 bytes)
TCP established hash table entries: 8192 (order: 3, 32768 bytes)
TCP bind hash table entries: 8192 (order: 3, 32768 bytes)
TCP: Hash tables configured (established 8192 bind 8192)
TCP reno registered
TCP bic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
Root-NFS: No NFS server available, giving up.
VFS: Unable to mount root fs via NFS, trying floppy.
VFS: Cannot open root device "<NULL>" or unknown-block(2,0)
Please append a correct "root=" boot option
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)

(He didn't specify root= so that's fine)
-- 
Martin Michlmayr
http://www.cyrius.com/

From yoichi_yuasa@tripeaks.co.jp Tue Feb 14 01:53:13 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Feb 2006 01:53:22 +0000 (GMT)
Received: from mo00.po.2iij.net ([210.130.202.204]:41448 "EHLO
	mo00.po.2iij.net") by ftp.linux-mips.org with ESMTP
	id S3467611AbWBNBxN (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 14 Feb 2006 01:53:13 +0000
Received: NPO MO00 id k1E1xTPg024121; Tue, 14 Feb 2006 10:59:29 +0900 (JST)
Received: from localhost.localdomain (65.126.232.202.bf.2iij.net [202.232.126.65])
	by mbox.po.2iij.net (NPO-MR/mbox02) id k1E1xSRW007832
	(version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NOT);
	Tue, 14 Feb 2006 10:59:28 +0900 (JST)
Date:	Tue, 14 Feb 2006 10:59:28 +0900
From:	Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
To:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc:	yoichi_yuasa@tripeaks.co.jp, linux-mips@linux-mips.org,
	ralf@linux-mips.org
Subject: Re: [PATCH] fix cache coherency issues
Message-Id: <20060214105928.0cd46e6f.yoichi_yuasa@tripeaks.co.jp>
In-Reply-To: <20060214.011508.41198724.anemo@mba.ocn.ne.jp>
References: <20060214.011508.41198724.anemo@mba.ocn.ne.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-Envid: tripeaks.co.jp
Envelope-Id: tripeaks.co.jp
X-archive-position: 10429
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
Content-Length: 133
Lines: 6

Hi Nemoto-san,

VR41xx cannot be booted with 2.6.16-rc2 + patch.
It freeze after "Freeing unused kernel memory: 168k freed".

Yoichi

From anemo@mba.ocn.ne.jp Tue Feb 14 02:09:32 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Feb 2006 02:09:41 +0000 (GMT)
Received: from topsns2.toshiba-tops.co.jp ([202.230.225.126]:3355 "EHLO
	topsns2.toshiba-tops.co.jp") by ftp.linux-mips.org with ESMTP
	id S3467609AbWBNCJc (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 14 Feb 2006 02:09:32 +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, 14 Feb 2006 11:15:51 +0900
Received: from topsms.toshiba-tops.co.jp (localhost.localdomain [127.0.0.1])
	by localhost.toshiba-tops.co.jp (Postfix) with ESMTP id 370DF20181;
	Tue, 14 Feb 2006 11:15:48 +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 21D671F711;
	Tue, 14 Feb 2006 11:15:48 +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 k1E2Fl4D074010;
	Tue, 14 Feb 2006 11:15:47 +0900 (JST)
	(envelope-from anemo@mba.ocn.ne.jp)
Date:	Tue, 14 Feb 2006 11:15:47 +0900 (JST)
Message-Id: <20060214.111547.21591480.nemoto@toshiba-tops.co.jp>
To:	yoichi_yuasa@tripeaks.co.jp
Cc:	linux-mips@linux-mips.org, ralf@linux-mips.org
Subject: Re: [PATCH] fix cache coherency issues
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
In-Reply-To: <20060214105928.0cd46e6f.yoichi_yuasa@tripeaks.co.jp>
References: <20060214.011508.41198724.anemo@mba.ocn.ne.jp>
	<20060214105928.0cd46e6f.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.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: 10430
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
Content-Length: 413
Lines: 11

>>>>> On Tue, 14 Feb 2006 10:59:28 +0900, Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp> said:
yuasa> VR41xx cannot be booted with 2.6.16-rc2 + patch.  It freeze
yuasa> after "Freeing unused kernel memory: 168k freed".

Good morning!  Thank you very much for testing.

Could you give me a full boot log and some other informations?
(icache/dcache size/associativity, highmem/preempt/smp enabled?)

---
Atsushi Nemoto

From yoichi_yuasa@tripeaks.co.jp Tue Feb 14 02:20:38 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Feb 2006 02:20:55 +0000 (GMT)
Received: from mo01.po.2iij.net ([210.130.202.205]:18684 "EHLO
	mo01.po.2iij.net") by ftp.linux-mips.org with ESMTP
	id S3467615AbWBNCUi (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 14 Feb 2006 02:20:38 +0000
Received: NPO MO01 id k1E2Qtne003000; Tue, 14 Feb 2006 11:26:55 +0900 (JST)
Received: from localhost.localdomain (65.126.232.202.bf.2iij.net [202.232.126.65])
	by mbox.po.2iij.net (NPO-MR/mbox00) id k1E2QrUk018278
	(version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NOT);
	Tue, 14 Feb 2006 11:26:53 +0900 (JST)
Date:	Tue, 14 Feb 2006 11:26:53 +0900
From:	Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
To:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc:	yoichi_yuasa@tripeaks.co.jp, linux-mips@linux-mips.org,
	ralf@linux-mips.org
Subject: Re: [PATCH] fix cache coherency issues
Message-Id: <20060214112653.25ed3e05.yoichi_yuasa@tripeaks.co.jp>
In-Reply-To: <20060214.111547.21591480.nemoto@toshiba-tops.co.jp>
References: <20060214.011508.41198724.anemo@mba.ocn.ne.jp>
	<20060214105928.0cd46e6f.yoichi_yuasa@tripeaks.co.jp>
	<20060214.111547.21591480.nemoto@toshiba-tops.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-Envid: tripeaks.co.jp
Envelope-Id: tripeaks.co.jp
X-archive-position: 10431
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
Content-Length: 4272
Lines: 106

Good morning,

On Tue, 14 Feb 2006 11:15:47 +0900 (JST)
Atsushi Nemoto <anemo@mba.ocn.ne.jp> wrote:

> >>>>> On Tue, 14 Feb 2006 10:59:28 +0900, Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp> said:
> yuasa> VR41xx cannot be booted with 2.6.16-rc2 + patch.  It freeze
> yuasa> after "Freeing unused kernel memory: 168k freed".

Oops, I'm testing 2.6.16-rc3 + patch on VR41xx.
                         ^^^
> 
> Good morning!  Thank you very much for testing.
> 
> Could you give me a full boot log and some other informations?
> (icache/dcache size/associativity, highmem/preempt/smp enabled?)

Here is the boot log.

Linux version 2.6.16-rc3 (yuasa@localhost) (gcc version 3.3.2) #5 Tue Feb 14 10:32:44 JST 2006
CPU revision is: 00000c83
PClock: 199065600Hz
VTClock: 99532800Hz
TClock: 49766400Hz
Determined physical RAM map:
User-defined physical RAM map:
 memory: 04000000 @ 00000000 (usable)
Built 1 zonelists
Kernel command line: mem=64M console=ttyVR0,115200 ip=any root=/dev/nfs
Primary instruction cache 16kB, physically tagged, 2-way, linesize 16 bytes.
Primary data cache 16kB, 2-way, linesize 16 bytes.
Synthesized TLB refill handler (21 instructions).
Synthesized TLB load handler fastpath (33 instructions).
Synthesized TLB store handler fastpath (33 instructions).
Synthesized TLB modify handler fastpath (32 instructions).
PID hash table entries: 512 (order: 9, 8192 bytes)
Using 12.442 MHz high precision timer.
Console: colour dummy device 80x25
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory: 61116k/65536k available (2887k kernel code, 4356k reserved, 532k data, 168k init, 0k highmem)
Mount-cache hash table entries: 512
Checking for 'wait' instruction...  unavailable.
NET: Registered protocol family 16
SCSI subsystem initialized
PCI: Bridge: 0000:01:00.0
  IO window: disabled.
  MEM window: 11a00000-11afffff
  PREFETCH window: disabled.
PCI: Bridge: 0000:00:12.0
  IO window: 1000000-1000fff
  MEM window: 11a00000-11bfffff
  PREFETCH window: disabled.
SGI XFS with ACLs, no debug enabled
SGI XFS Quota Management subsystem
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler deadline registered
io scheduler cfq registered
GIU: major number 254
SIU: ttyVR0 at MMIO 0xf000800 (irq = 17) is a SIU
SIU: ttyVR1 at MMIO 0xf000820 (irq = 29) is a DSIU
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
r8169 Gigabit Ethernet driver 2.2LK loaded
r8169: PowerManagement capability not found.
eth0: RTL8169 at 0xb1b00000, 00:20:0f:00:24:04, IRQ 53
r8169 Gigabit Ethernet driver 2.2LK loaded
r8169: PowerManagement capability not found.
eth1: RTL8169 at 0xb1b00100, 00:20:0f:00:24:05, IRQ 53
Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2
ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx
SiI680: IDE controller at PCI slot 0000:00:11.0
SiI680: chipset revision 2
SiI680: BASE CLOCK == 133
SiI680: 100% native mode on irq 48
    ide0: MMIO-DMA , BIOS settings: hda:pio, hdb:pio
    ide1: MMIO-DMA , BIOS settings: hdc:pio, hdd:pio
hda: Hitachi CVM1.1.1, CFA DISK drive
ide0 at 0xb1c80080-0xb1c80087,0xb1c8008a on irq 48
hda: max request size: 64KiB
hda: 250368 sectors (128 MB) w/1KiB Cache, CHS=978/8/32
 hda: hda1
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 4096 (order: 2, 16384 bytes)
TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
TCP: Hash tables configured (established 4096 bind 4096)
TCP reno registered
TCP bic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
r8169: eth0: link up
r8169: eth1: link down
Sending BOOTP requests . OK
IP-Config: Got BOOTP answer from 192.168.2.1, my address is 192.168.2.101
IP-Config: Complete:
      device=eth0, addr=192.168.2.101, mask=255.255.255.0, gw=255.255.255.255,
     host=192.168.2.101, domain=tripeaks.co.jp, nis-domain=(none),
     bootserver=192.168.2.1, rootserver=192.168.2.1, rootpath=/opt/nfsroot-tb0287
Looking up port of RPC 100003/2 on 192.168.2.1
Looking up port of RPC 100005/1 on 192.168.2.1
VFS: Mounted root (nfs filesystem) readonly.
Freeing unused kernel memory: 168k freed

Yoichi


From anemo@mba.ocn.ne.jp Tue Feb 14 03:02:38 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Feb 2006 03:02:54 +0000 (GMT)
Received: from topsns2.toshiba-tops.co.jp ([202.230.225.126]:58865 "EHLO
	topsns2.toshiba-tops.co.jp") by ftp.linux-mips.org with ESMTP
	id S3467615AbWBNDCi (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 14 Feb 2006 03:02:38 +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, 14 Feb 2006 12:08:57 +0900
Received: from topsms.toshiba-tops.co.jp (localhost.localdomain [127.0.0.1])
	by localhost.toshiba-tops.co.jp (Postfix) with ESMTP id 27858203DB;
	Tue, 14 Feb 2006 12:08:48 +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 1C6CB1FDD7;
	Tue, 14 Feb 2006 12:08:48 +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 k1E38l4D074215;
	Tue, 14 Feb 2006 12:08:47 +0900 (JST)
	(envelope-from anemo@mba.ocn.ne.jp)
Date:	Tue, 14 Feb 2006 12:08:46 +0900 (JST)
Message-Id: <20060214.120846.15248106.nemoto@toshiba-tops.co.jp>
To:	yoichi_yuasa@tripeaks.co.jp
Cc:	linux-mips@linux-mips.org, ralf@linux-mips.org
Subject: Re: [PATCH] fix cache coherency issues
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
In-Reply-To: <20060214112653.25ed3e05.yoichi_yuasa@tripeaks.co.jp>
References: <20060214105928.0cd46e6f.yoichi_yuasa@tripeaks.co.jp>
	<20060214.111547.21591480.nemoto@toshiba-tops.co.jp>
	<20060214112653.25ed3e05.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.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: 10432
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
Content-Length: 870
Lines: 22

>>>>> On Tue, 14 Feb 2006 11:26:53 +0900, Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp> said:
yuasa> Here is the boot log.

Thanks.  Could you try with this patch?

http://www.linux-mips.org/cgi-bin/mesg.cgi?a=linux-mips&i=20060204.015356.74753400.anemo%40mba.ocn.ne.jp

Or this quick workaround?

diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
index 1b71d91..5bd413f 100644
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -425,7 +425,7 @@ static inline void local_r4k_flush_cache
 	 * Do indexed flush, too much work to get the (possible) TLB refills
 	 * to work correctly.
 	 */
-	addr = INDEX_BASE + (addr & (dcache_size - 1));
+	addr = INDEX_BASE + (addr & (current_cpu_data.dcache.waysize - 1));
 	if (cpu_has_dc_aliases || (exec && !cpu_has_ic_fills_f_dc)) {
 		r4k_blast_dcache_page_indexed(addr);
 		if (exec && !cpu_icache_snoops_remote_store)

From mita@miraclelinux.com Tue Feb 14 04:58:31 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Feb 2006 04:58:45 +0000 (GMT)
Received: from ns.miraclelinux.com ([219.118.163.66]:36046 "EHLO
	mail01.miraclelinux.com") by ftp.linux-mips.org with ESMTP
	id S8133381AbWBNE6b (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 14 Feb 2006 04:58:31 +0000
Received: from mail01 (localhost.localdomain [127.0.0.1])
	by mail01.miraclelinux.com (Postfix) with ESMTP
	id 76BF331C329; Tue, 14 Feb 2006 14:04:45 +0900 (JST)
Received: from localhost.localdomain (sshgate.miraclelinux.com [])
	by mail01.miraclelinux.com ([10.1.0.10]);
	Tue, 14 Feb 2006 05:04:45 +0000
Received: by localhost.localdomain (Postfix, from userid 1000)
	id 36BC4420236; Tue, 14 Feb 2006 14:04:43 +0900 (JST)
Message-Id: <20060214050443.068971000@localhost.localdomain>
References: <20060214050351.252615000@localhost.localdomain>
Date:	Tue, 14 Feb 2006 14:03:58 +0900
From:	Akinobu Mita <mita@miraclelinux.com>
To:	linux-kernel@vger.kernel.org
Cc:	akpm@osdl.org, Russell King <rmk@arm.linux.org.uk>,
	Ian Molton <spyro@f2s.com>, dev-etrax@axis.com,
	Hirokazu Takata <takata@linux-m32r.org>,
	linux-mips@linux-mips.org, parisc-linux@parisc-linux.org,
	linuxppc-dev@ozlabs.org, linuxsh-dev@lists.sourceforge.net,
	linuxsh-shmedia-dev@lists.sourceforge.net,
	sparclinux@vger.kernel.org, ultralinux@vger.kernel.org,
	Chris Zankel <chris@zankel.net>,
	Akinobu Mita <mita@miraclelinux.com>
Subject: [patch 07/47] generic __{,test_and_}{set,clear,change}_bit() and test_bit()
Content-Disposition: inline; filename=non-atomic-bitops.patch
Return-Path: <mita@miraclelinux.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: 10433
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: mita@miraclelinux.com
Precedence: bulk
X-list: linux-mips
Content-Length: 4243
Lines: 137

This patch introduces the C-language equivalents of the functions below:

void __set_bit(int nr, volatile unsigned long *addr);
void __clear_bit(int nr, volatile unsigned long *addr);
void __change_bit(int nr, volatile unsigned long *addr);
int __test_and_set_bit(int nr, volatile unsigned long *addr);
int __test_and_clear_bit(int nr, volatile unsigned long *addr);
int __test_and_change_bit(int nr, volatile unsigned long *addr);
int test_bit(int nr, const volatile unsigned long *addr);

In include/asm-generic/bitops/non-atomic.h

This code largely copied from:
asm-powerpc/bitops.h

Signed-off-by: Akinobu Mita <mita@miraclelinux.com>
 include/asm-generic/bitops/non-atomic.h |  111 ++++++++++++++++++++++++++++++++
 1 files changed, 111 insertions(+)

Index: 2.6-rc/include/asm-generic/bitops/non-atomic.h
===================================================================
--- /dev/null
+++ 2.6-rc/include/asm-generic/bitops/non-atomic.h
@@ -0,0 +1,111 @@
+#ifndef _ASM_GENERIC_BITOPS_NON_ATOMIC_H_
+#define _ASM_GENERIC_BITOPS_NON_ATOMIC_H_
+
+#include <asm/types.h>
+
+#define BITOP_MASK(nr)		(1UL << ((nr) % BITS_PER_LONG))
+#define BITOP_WORD(nr)		((nr) / BITS_PER_LONG)
+
+/**
+ * __set_bit - Set a bit in memory
+ * @nr: the bit to set
+ * @addr: the address to start counting from
+ *
+ * Unlike set_bit(), this function is non-atomic and may be reordered.
+ * If it's called on the same region of memory simultaneously, the effect
+ * may be that only one operation succeeds.
+ */
+static inline void __set_bit(int nr, volatile unsigned long *addr)
+{
+	unsigned long mask = BITOP_MASK(nr);
+	unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
+
+	*p  |= mask;
+}
+
+static inline void __clear_bit(int nr, volatile unsigned long *addr)
+{
+	unsigned long mask = BITOP_MASK(nr);
+	unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
+
+	*p &= ~mask;
+}
+
+/**
+ * __change_bit - Toggle a bit in memory
+ * @nr: the bit to change
+ * @addr: the address to start counting from
+ *
+ * Unlike change_bit(), this function is non-atomic and may be reordered.
+ * If it's called on the same region of memory simultaneously, the effect
+ * may be that only one operation succeeds.
+ */
+static inline void __change_bit(int nr, volatile unsigned long *addr)
+{
+	unsigned long mask = BITOP_MASK(nr);
+	unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
+
+	*p ^= mask;
+}
+
+/**
+ * __test_and_set_bit - Set a bit and return its old value
+ * @nr: Bit to set
+ * @addr: Address to count from
+ *
+ * This operation is non-atomic and can be reordered.  
+ * If two examples of this operation race, one can appear to succeed
+ * but actually fail.  You must protect multiple accesses with a lock.
+ */
+static inline int __test_and_set_bit(int nr, volatile unsigned long *addr)
+{
+	unsigned long mask = BITOP_MASK(nr);
+	unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
+	unsigned long old = *p;
+
+	*p = old | mask;
+	return (old & mask) != 0;
+}
+
+/**
+ * __test_and_clear_bit - Clear a bit and return its old value
+ * @nr: Bit to clear
+ * @addr: Address to count from
+ *
+ * This operation is non-atomic and can be reordered.  
+ * If two examples of this operation race, one can appear to succeed
+ * but actually fail.  You must protect multiple accesses with a lock.
+ */
+static inline int __test_and_clear_bit(int nr, volatile unsigned long *addr)
+{
+	unsigned long mask = BITOP_MASK(nr);
+	unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
+	unsigned long old = *p;
+
+	*p = old & ~mask;
+	return (old & mask) != 0;
+}
+
+/* WARNING: non atomic and it can be reordered! */
+static inline int __test_and_change_bit(int nr,
+					    volatile unsigned long *addr)
+{
+	unsigned long mask = BITOP_MASK(nr);
+	unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
+	unsigned long old = *p;
+
+	*p = old ^ mask;
+	return (old & mask) != 0;
+}
+
+/**
+ * test_bit - Determine whether a bit is set
+ * @nr: bit number to test
+ * @addr: Address to start counting from
+ */
+static inline int test_bit(int nr, const volatile unsigned long *addr)
+{
+	return 1UL & (addr[BITOP_WORD(nr)] >> (nr & (BITS_PER_LONG-1)));
+}
+
+#endif /* _ASM_GENERIC_BITOPS_NON_ATOMIC_H_ */

--

From mita@miraclelinux.com Tue Feb 14 04:59:11 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Feb 2006 04:59:24 +0000 (GMT)
Received: from ns.miraclelinux.com ([219.118.163.66]:42702 "EHLO
	mail01.miraclelinux.com") by ftp.linux-mips.org with ESMTP
	id S8133420AbWBNE6b (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 14 Feb 2006 04:58:31 +0000
Received: from mail01 (localhost.localdomain [127.0.0.1])
	by mail01.miraclelinux.com (Postfix) with ESMTP
	id CBFAE31C325; Tue, 14 Feb 2006 14:04:45 +0900 (JST)
Received: from localhost.localdomain (sshgate.miraclelinux.com [])
	by mail01.miraclelinux.com ([10.1.0.10]);
	Tue, 14 Feb 2006 05:04:45 +0000
Received: by localhost.localdomain (Postfix, from userid 1000)
	id 6B7EE420237; Tue, 14 Feb 2006 14:04:43 +0900 (JST)
Message-Id: <20060214050443.261426000@localhost.localdomain>
References: <20060214050351.252615000@localhost.localdomain>
Date:	Tue, 14 Feb 2006 14:03:59 +0900
From:	Akinobu Mita <mita@miraclelinux.com>
To:	linux-kernel@vger.kernel.org
Cc:	akpm@osdl.org, Russell King <rmk@arm.linux.org.uk>,
	Ian Molton <spyro@f2s.com>,
	David Howells <dhowells@redhat.com>,
	Hirokazu Takata <takata@linux-m32r.org>,
	Greg Ungerer <gerg@uclinux.org>, linux-mips@linux-mips.org,
	linuxsh-dev@lists.sourceforge.net,
	linuxsh-shmedia-dev@lists.sourceforge.net,
	sparclinux@vger.kernel.org, ultralinux@vger.kernel.org,
	Miles Bader <uclinux-v850@lsi.nec.co.jp>,
	Akinobu Mita <mita@miraclelinux.com>
Subject: [patch 08/47] generic __ffs()
Content-Disposition: inline; filename=__ffs-bitops.patch
Return-Path: <mita@miraclelinux.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: 10434
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: mita@miraclelinux.com
Precedence: bulk
X-list: linux-mips
Content-Length: 1344
Lines: 62

This patch introduces the C-language equivalent of the function:
unsigned long __ffs(unsigned long word);

In include/asm-generic/bitops/__ffs.h

This code largely copied from:
include/asm-sparc/bitops.h

Signed-off-by: Akinobu Mita <mita@miraclelinux.com>
 include/asm-generic/bitops/__ffs.h |   43 +++++++++++++++++++++++++++++++++++++
 1 files changed, 43 insertions(+)

Index: 2.6-rc/include/asm-generic/bitops/__ffs.h
===================================================================
--- /dev/null
+++ 2.6-rc/include/asm-generic/bitops/__ffs.h
@@ -0,0 +1,43 @@
+#ifndef _ASM_GENERIC_BITOPS___FFS_H_
+#define _ASM_GENERIC_BITOPS___FFS_H_
+
+#include <asm/types.h>
+
+/**
+ * __ffs - find first bit in word.
+ * @word: The word to search
+ *
+ * Undefined if no bit exists, so code should check against 0 first.
+ */
+static inline unsigned long __ffs(unsigned long word)
+{
+	int num = 0;
+
+#if BITS_PER_LONG == 64
+	if ((word & 0xffffffff) == 0) {
+		num += 32;
+		word >>= 32;
+	}
+#endif
+	if ((word & 0xffff) == 0) {
+		num += 16;
+		word >>= 16;
+	}
+	if ((word & 0xff) == 0) {
+		num += 8;
+		word >>= 8;
+	}
+	if ((word & 0xf) == 0) {
+		num += 4;
+		word >>= 4;
+	}
+	if ((word & 0x3) == 0) {
+		num += 2;
+		word >>= 2;
+	}
+	if ((word & 0x1) == 0)
+		num += 1;
+	return num;
+}
+
+#endif /* _ASM_GENERIC_BITOPS___FFS_H_ */

--

From mita@miraclelinux.com Tue Feb 14 04:59:53 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Feb 2006 05:00:20 +0000 (GMT)
Received: from ns.miraclelinux.com ([219.118.163.66]:56014 "EHLO
	mail01.miraclelinux.com") by ftp.linux-mips.org with ESMTP
	id S8133421AbWBNE6d (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 14 Feb 2006 04:58:33 +0000
Received: from mail01 (localhost.localdomain [127.0.0.1])
	by mail01.miraclelinux.com (Postfix) with ESMTP
	id 2C32231C327; Tue, 14 Feb 2006 14:04:46 +0900 (JST)
Received: from localhost.localdomain (sshgate.miraclelinux.com [])
	by mail01.miraclelinux.com ([10.1.0.10]);
	Tue, 14 Feb 2006 05:04:45 +0000
Received: by localhost.localdomain (Postfix, from userid 1000)
	id D02BA420234; Tue, 14 Feb 2006 14:04:42 +0900 (JST)
Message-Id: <20060214050442.695246000@localhost.localdomain>
References: <20060214050351.252615000@localhost.localdomain>
Date:	Tue, 14 Feb 2006 14:03:56 +0900
From:	Akinobu Mita <mita@miraclelinux.com>
To:	linux-kernel@vger.kernel.org
Cc:	akpm@osdl.org, dev-etrax@axis.com,
	David Howells <dhowells@redhat.com>,
	Yoshinori Sato <ysato@users.sourceforge.jp>,
	linux-ia64@vger.kernel.org,
	Hirokazu Takata <takata@linux-m32r.org>,
	linux-m68k@lists.linux-m68k.org, Greg Ungerer <gerg@uclinux.org>,
	linux-mips@linux-mips.org, linux390@de.ibm.com,
	linuxsh-dev@lists.sourceforge.net,
	linuxsh-shmedia-dev@lists.sourceforge.net,
	sparclinux@vger.kernel.org, ultralinux@vger.kernel.org,
	Miles Bader <uclinux-v850@lsi.nec.co.jp>,
	Chris Zankel <chris@zankel.net>,
	Akinobu Mita <mita@miraclelinux.com>
Subject: [patch 05/47] use non atomic operations for minix_*_bit() and ext2_*_bit()
Content-Disposition: inline; filename=use-non-atomic.patch
Return-Path: <mita@miraclelinux.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: 10435
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: mita@miraclelinux.com
Precedence: bulk
X-list: linux-mips
Content-Length: 19511
Lines: 445

Bitmap functions for the minix filesystem and the ext2 filesystem
except ext2_set_bit_atomic() and ext2_clear_bit_atomic()
do not require the atomic guarantees.

But these are defined by using atomic bit operations on several architectures.
(cris, frv, h8300, ia64, m32r, m68k, m68knommu, mips, s390, sh, sh64, sparc,
 sparc64, v850, and xtensa)

This patch switches to non atomic bit operation.

Signed-off-by: Akinobu Mita <mita@miraclelinux.com>

 include/asm-cris/bitops.h      |    8 ++++----
 include/asm-frv/bitops.h       |   14 +++++++-------
 include/asm-h8300/bitops.h     |    6 +++---
 include/asm-ia64/bitops.h      |   10 +++++-----
 include/asm-m32r/bitops.h      |    2 +-
 include/asm-m68k/bitops.h      |   10 +++++-----
 include/asm-m68knommu/bitops.h |    6 +++---
 include/asm-mips/bitops.h      |    6 +++---
 include/asm-s390/bitops.h      |   10 +++++-----
 include/asm-sh/bitops.h        |   16 +++++-----------
 include/asm-sh64/bitops.h      |   16 +++++-----------
 include/asm-sparc/bitops.h     |    6 +++---
 include/asm-sparc64/bitops.h   |    6 +++---
 include/asm-v850/bitops.h      |   10 +++++-----
 include/asm-xtensa/bitops.h    |    6 +++---
 15 files changed, 60 insertions(+), 72 deletions(-)

Index: 2.6-rc/include/asm-h8300/bitops.h
===================================================================
--- 2.6-rc.orig/include/asm-h8300/bitops.h
+++ 2.6-rc/include/asm-h8300/bitops.h
@@ -397,9 +397,9 @@ found_middle:
 }
 
 /* Bitmap functions for the minix filesystem.  */
-#define minix_test_and_set_bit(nr,addr) test_and_set_bit(nr,addr)
-#define minix_set_bit(nr,addr) set_bit(nr,addr)
-#define minix_test_and_clear_bit(nr,addr) test_and_clear_bit(nr,addr)
+#define minix_test_and_set_bit(nr,addr) __test_and_set_bit(nr,addr)
+#define minix_set_bit(nr,addr) __set_bit(nr,addr)
+#define minix_test_and_clear_bit(nr,addr) __test_and_clear_bit(nr,addr)
 #define minix_test_bit(nr,addr) test_bit(nr,addr)
 #define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
 
Index: 2.6-rc/include/asm-ia64/bitops.h
===================================================================
--- 2.6-rc.orig/include/asm-ia64/bitops.h
+++ 2.6-rc/include/asm-ia64/bitops.h
@@ -394,18 +394,18 @@ extern int __find_next_bit(const void *a
 
 #define __clear_bit(nr, addr)		clear_bit(nr, addr)
 
-#define ext2_set_bit			test_and_set_bit
+#define ext2_set_bit			__test_and_set_bit
 #define ext2_set_bit_atomic(l,n,a)	test_and_set_bit(n,a)
-#define ext2_clear_bit			test_and_clear_bit
+#define ext2_clear_bit			__test_and_clear_bit
 #define ext2_clear_bit_atomic(l,n,a)	test_and_clear_bit(n,a)
 #define ext2_test_bit			test_bit
 #define ext2_find_first_zero_bit	find_first_zero_bit
 #define ext2_find_next_zero_bit		find_next_zero_bit
 
 /* Bitmap functions for the minix filesystem.  */
-#define minix_test_and_set_bit(nr,addr)		test_and_set_bit(nr,addr)
-#define minix_set_bit(nr,addr)			set_bit(nr,addr)
-#define minix_test_and_clear_bit(nr,addr)	test_and_clear_bit(nr,addr)
+#define minix_test_and_set_bit(nr,addr)		__test_and_set_bit(nr,addr)
+#define minix_set_bit(nr,addr)			__set_bit(nr,addr)
+#define minix_test_and_clear_bit(nr,addr)	__test_and_clear_bit(nr,addr)
 #define minix_test_bit(nr,addr)			test_bit(nr,addr)
 #define minix_find_first_zero_bit(addr,size)	find_first_zero_bit(addr,size)
 
Index: 2.6-rc/include/asm-mips/bitops.h
===================================================================
--- 2.6-rc.orig/include/asm-mips/bitops.h
+++ 2.6-rc/include/asm-mips/bitops.h
@@ -962,9 +962,9 @@ found_middle:
  * FIXME: These assume that Minix uses the native byte/bitorder.
  * This limits the Minix filesystem's value for data exchange very much.
  */
-#define minix_test_and_set_bit(nr,addr) test_and_set_bit(nr,addr)
-#define minix_set_bit(nr,addr) set_bit(nr,addr)
-#define minix_test_and_clear_bit(nr,addr) test_and_clear_bit(nr,addr)
+#define minix_test_and_set_bit(nr,addr) __test_and_set_bit(nr,addr)
+#define minix_set_bit(nr,addr) __set_bit(nr,addr)
+#define minix_test_and_clear_bit(nr,addr) __test_and_clear_bit(nr,addr)
 #define minix_test_bit(nr,addr) test_bit(nr,addr)
 #define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
 
Index: 2.6-rc/include/asm-s390/bitops.h
===================================================================
--- 2.6-rc.orig/include/asm-s390/bitops.h
+++ 2.6-rc/include/asm-s390/bitops.h
@@ -871,11 +871,11 @@ static inline int sched_find_first_bit(u
  */
 
 #define ext2_set_bit(nr, addr)       \
-	test_and_set_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr)
+	__test_and_set_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr)
 #define ext2_set_bit_atomic(lock, nr, addr)       \
 	test_and_set_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr)
 #define ext2_clear_bit(nr, addr)     \
-	test_and_clear_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr)
+	__test_and_clear_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr)
 #define ext2_clear_bit_atomic(lock, nr, addr)     \
 	test_and_clear_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr)
 #define ext2_test_bit(nr, addr)      \
@@ -1014,11 +1014,11 @@ ext2_find_next_zero_bit(void *vaddr, uns
 /* Bitmap functions for the minix filesystem.  */
 /* FIXME !!! */
 #define minix_test_and_set_bit(nr,addr) \
-	test_and_set_bit(nr,(unsigned long *)addr)
+	__test_and_set_bit(nr,(unsigned long *)addr)
 #define minix_set_bit(nr,addr) \
-	set_bit(nr,(unsigned long *)addr)
+	__set_bit(nr,(unsigned long *)addr)
 #define minix_test_and_clear_bit(nr,addr) \
-	test_and_clear_bit(nr,(unsigned long *)addr)
+	__test_and_clear_bit(nr,(unsigned long *)addr)
 #define minix_test_bit(nr,addr) \
 	test_bit(nr,(unsigned long *)addr)
 #define minix_find_first_zero_bit(addr,size) \
Index: 2.6-rc/include/asm-sh/bitops.h
===================================================================
--- 2.6-rc.orig/include/asm-sh/bitops.h
+++ 2.6-rc/include/asm-sh/bitops.h
@@ -339,8 +339,8 @@ static inline int sched_find_first_bit(c
 }
 
 #ifdef __LITTLE_ENDIAN__
-#define ext2_set_bit(nr, addr) test_and_set_bit((nr), (addr))
-#define ext2_clear_bit(nr, addr) test_and_clear_bit((nr), (addr))
+#define ext2_set_bit(nr, addr) __test_and_set_bit((nr), (addr))
+#define ext2_clear_bit(nr, addr) __test_and_clear_bit((nr), (addr))
 #define ext2_test_bit(nr, addr) test_bit((nr), (addr))
 #define ext2_find_first_zero_bit(addr, size) find_first_zero_bit((addr), (size))
 #define ext2_find_next_zero_bit(addr, size, offset) \
@@ -349,30 +349,24 @@ static inline int sched_find_first_bit(c
 static __inline__ int ext2_set_bit(int nr, volatile void * addr)
 {
 	int		mask, retval;
-	unsigned long	flags;
 	volatile unsigned char	*ADDR = (unsigned char *) addr;
 
 	ADDR += nr >> 3;
 	mask = 1 << (nr & 0x07);
-	local_irq_save(flags);
 	retval = (mask & *ADDR) != 0;
 	*ADDR |= mask;
-	local_irq_restore(flags);
 	return retval;
 }
 
 static __inline__ int ext2_clear_bit(int nr, volatile void * addr)
 {
 	int		mask, retval;
-	unsigned long	flags;
 	volatile unsigned char	*ADDR = (unsigned char *) addr;
 
 	ADDR += nr >> 3;
 	mask = 1 << (nr & 0x07);
-	local_irq_save(flags);
 	retval = (mask & *ADDR) != 0;
 	*ADDR &= ~mask;
-	local_irq_restore(flags);
 	return retval;
 }
 
@@ -459,9 +453,9 @@ found_middle:
 	})
 
 /* Bitmap functions for the minix filesystem.  */
-#define minix_test_and_set_bit(nr,addr) test_and_set_bit(nr,addr)
-#define minix_set_bit(nr,addr) set_bit(nr,addr)
-#define minix_test_and_clear_bit(nr,addr) test_and_clear_bit(nr,addr)
+#define minix_test_and_set_bit(nr,addr) __test_and_set_bit(nr,addr)
+#define minix_set_bit(nr,addr) __set_bit(nr,addr)
+#define minix_test_and_clear_bit(nr,addr) __test_and_clear_bit(nr,addr)
 #define minix_test_bit(nr,addr) test_bit(nr,addr)
 #define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
 
Index: 2.6-rc/include/asm-sh64/bitops.h
===================================================================
--- 2.6-rc.orig/include/asm-sh64/bitops.h
+++ 2.6-rc/include/asm-sh64/bitops.h
@@ -382,8 +382,8 @@ static inline int sched_find_first_bit(u
 #define hweight8(x) generic_hweight8(x)
 
 #ifdef __LITTLE_ENDIAN__
-#define ext2_set_bit(nr, addr) test_and_set_bit((nr), (addr))
-#define ext2_clear_bit(nr, addr) test_and_clear_bit((nr), (addr))
+#define ext2_set_bit(nr, addr) __test_and_set_bit((nr), (addr))
+#define ext2_clear_bit(nr, addr) __test_and_clear_bit((nr), (addr))
 #define ext2_test_bit(nr, addr) test_bit((nr), (addr))
 #define ext2_find_first_zero_bit(addr, size) find_first_zero_bit((addr), (size))
 #define ext2_find_next_zero_bit(addr, size, offset) \
@@ -392,30 +392,24 @@ static inline int sched_find_first_bit(u
 static __inline__ int ext2_set_bit(int nr, volatile void * addr)
 {
 	int		mask, retval;
-	unsigned long	flags;
 	volatile unsigned char	*ADDR = (unsigned char *) addr;
 
 	ADDR += nr >> 3;
 	mask = 1 << (nr & 0x07);
-	local_irq_save(flags);
 	retval = (mask & *ADDR) != 0;
 	*ADDR |= mask;
-	local_irq_restore(flags);
 	return retval;
 }
 
 static __inline__ int ext2_clear_bit(int nr, volatile void * addr)
 {
 	int		mask, retval;
-	unsigned long	flags;
 	volatile unsigned char	*ADDR = (unsigned char *) addr;
 
 	ADDR += nr >> 3;
 	mask = 1 << (nr & 0x07);
-	local_irq_save(flags);
 	retval = (mask & *ADDR) != 0;
 	*ADDR &= ~mask;
-	local_irq_restore(flags);
 	return retval;
 }
 
@@ -502,9 +496,9 @@ found_middle:
 	})
 
 /* Bitmap functions for the minix filesystem.  */
-#define minix_test_and_set_bit(nr,addr) test_and_set_bit(nr,addr)
-#define minix_set_bit(nr,addr) set_bit(nr,addr)
-#define minix_test_and_clear_bit(nr,addr) test_and_clear_bit(nr,addr)
+#define minix_test_and_set_bit(nr,addr) __test_and_set_bit(nr,addr)
+#define minix_set_bit(nr,addr) __set_bit(nr,addr)
+#define minix_test_and_clear_bit(nr,addr) __test_and_clear_bit(nr,addr)
 #define minix_test_bit(nr,addr) test_bit(nr,addr)
 #define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
 
Index: 2.6-rc/include/asm-sparc/bitops.h
===================================================================
--- 2.6-rc.orig/include/asm-sparc/bitops.h
+++ 2.6-rc/include/asm-sparc/bitops.h
@@ -523,11 +523,11 @@ found_middle:
 
 /* Bitmap functions for the minix filesystem.  */
 #define minix_test_and_set_bit(nr,addr)	\
-	test_and_set_bit((nr),(unsigned long *)(addr))
+	__test_and_set_bit((nr),(unsigned long *)(addr))
 #define minix_set_bit(nr,addr)		\
-	set_bit((nr),(unsigned long *)(addr))
+	__set_bit((nr),(unsigned long *)(addr))
 #define minix_test_and_clear_bit(nr,addr) \
-	test_and_clear_bit((nr),(unsigned long *)(addr))
+	__test_and_clear_bit((nr),(unsigned long *)(addr))
 #define minix_test_bit(nr,addr)		\
 	test_bit((nr),(unsigned long *)(addr))
 #define minix_find_first_zero_bit(addr,size) \
Index: 2.6-rc/include/asm-sparc64/bitops.h
===================================================================
--- 2.6-rc.orig/include/asm-sparc64/bitops.h
+++ 2.6-rc/include/asm-sparc64/bitops.h
@@ -280,11 +280,11 @@ extern unsigned long find_next_zero_le_b
 
 /* Bitmap functions for the minix filesystem.  */
 #define minix_test_and_set_bit(nr,addr)	\
-	test_and_set_bit((nr),(unsigned long *)(addr))
+	__test_and_set_bit((nr),(unsigned long *)(addr))
 #define minix_set_bit(nr,addr)	\
-	set_bit((nr),(unsigned long *)(addr))
+	__set_bit((nr),(unsigned long *)(addr))
 #define minix_test_and_clear_bit(nr,addr) \
-	test_and_clear_bit((nr),(unsigned long *)(addr))
+	__test_and_clear_bit((nr),(unsigned long *)(addr))
 #define minix_test_bit(nr,addr)	\
 	test_bit((nr),(unsigned long *)(addr))
 #define minix_find_first_zero_bit(addr,size) \
Index: 2.6-rc/include/asm-v850/bitops.h
===================================================================
--- 2.6-rc.orig/include/asm-v850/bitops.h
+++ 2.6-rc/include/asm-v850/bitops.h
@@ -336,18 +336,18 @@ static inline int sched_find_first_bit(u
 #define hweight16(x) 			generic_hweight16 (x)
 #define hweight8(x) 			generic_hweight8 (x)
 
-#define ext2_set_bit			test_and_set_bit
+#define ext2_set_bit			__test_and_set_bit
 #define ext2_set_bit_atomic(l,n,a)      test_and_set_bit(n,a)
-#define ext2_clear_bit			test_and_clear_bit
+#define ext2_clear_bit			__test_and_clear_bit
 #define ext2_clear_bit_atomic(l,n,a)    test_and_clear_bit(n,a)
 #define ext2_test_bit			test_bit
 #define ext2_find_first_zero_bit	find_first_zero_bit
 #define ext2_find_next_zero_bit		find_next_zero_bit
 
 /* Bitmap functions for the minix filesystem.  */
-#define minix_test_and_set_bit		test_and_set_bit
-#define minix_set_bit			set_bit
-#define minix_test_and_clear_bit	test_and_clear_bit
+#define minix_test_and_set_bit		__test_and_set_bit
+#define minix_set_bit			__set_bit
+#define minix_test_and_clear_bit	__test_and_clear_bit
 #define minix_test_bit 			test_bit
 #define minix_find_first_zero_bit 	find_first_zero_bit
 
Index: 2.6-rc/include/asm-xtensa/bitops.h
===================================================================
--- 2.6-rc.orig/include/asm-xtensa/bitops.h
+++ 2.6-rc/include/asm-xtensa/bitops.h
@@ -436,9 +436,9 @@ static inline int sched_find_first_bit(c
 
 /* Bitmap functions for the minix filesystem.  */
 
-#define minix_test_and_set_bit(nr,addr) test_and_set_bit(nr,addr)
-#define minix_set_bit(nr,addr) set_bit(nr,addr)
-#define minix_test_and_clear_bit(nr,addr) test_and_clear_bit(nr,addr)
+#define minix_test_and_set_bit(nr,addr) __test_and_set_bit(nr,addr)
+#define minix_set_bit(nr,addr) __set_bit(nr,addr)
+#define minix_test_and_clear_bit(nr,addr) __test_and_clear_bit(nr,addr)
 #define minix_test_bit(nr,addr) test_bit(nr,addr)
 #define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
 
Index: 2.6-rc/include/asm-m32r/bitops.h
===================================================================
--- 2.6-rc.orig/include/asm-m32r/bitops.h
+++ 2.6-rc/include/asm-m32r/bitops.h
@@ -575,7 +575,7 @@ found_middle:
  */
 
 #ifdef __LITTLE_ENDIAN__
-#define ext2_set_bit			test_and_set_bit
+#define ext2_set_bit			__test_and_set_bit
 #define ext2_clear_bit			__test_and_clear_bit
 #define ext2_test_bit			test_bit
 #define ext2_find_first_zero_bit	find_first_zero_bit
Index: 2.6-rc/include/asm-cris/bitops.h
===================================================================
--- 2.6-rc.orig/include/asm-cris/bitops.h
+++ 2.6-rc/include/asm-cris/bitops.h
@@ -352,17 +352,17 @@ found_middle:
 #define find_first_bit(addr, size) \
         find_next_bit((addr), (size), 0)
 
-#define ext2_set_bit                 test_and_set_bit
+#define ext2_set_bit                 __test_and_set_bit
 #define ext2_set_bit_atomic(l,n,a)   test_and_set_bit(n,a)
-#define ext2_clear_bit               test_and_clear_bit
+#define ext2_clear_bit               __test_and_clear_bit
 #define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a)
 #define ext2_test_bit                test_bit
 #define ext2_find_first_zero_bit     find_first_zero_bit
 #define ext2_find_next_zero_bit      find_next_zero_bit
 
 /* Bitmap functions for the minix filesystem.  */
-#define minix_set_bit(nr,addr) test_and_set_bit(nr,addr)
-#define minix_clear_bit(nr,addr) test_and_clear_bit(nr,addr)
+#define minix_set_bit(nr,addr) __test_and_set_bit(nr,addr)
+#define minix_clear_bit(nr,addr) __test_and_clear_bit(nr,addr)
 #define minix_test_bit(nr,addr) test_bit(nr,addr)
 #define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
 
Index: 2.6-rc/include/asm-frv/bitops.h
===================================================================
--- 2.6-rc.orig/include/asm-frv/bitops.h
+++ 2.6-rc/include/asm-frv/bitops.h
@@ -259,11 +259,11 @@ static inline int sched_find_first_bit(c
 #define hweight16(x) generic_hweight16(x)
 #define hweight8(x) generic_hweight8(x)
 
-#define ext2_set_bit(nr, addr)		test_and_set_bit  ((nr) ^ 0x18, (addr))
-#define ext2_clear_bit(nr, addr)	test_and_clear_bit((nr) ^ 0x18, (addr))
+#define ext2_set_bit(nr, addr)		__test_and_set_bit  ((nr) ^ 0x18, (addr))
+#define ext2_clear_bit(nr, addr)	__test_and_clear_bit((nr) ^ 0x18, (addr))
 
-#define ext2_set_bit_atomic(lock,nr,addr)	ext2_set_bit((nr), addr)
-#define ext2_clear_bit_atomic(lock,nr,addr)	ext2_clear_bit((nr), addr)
+#define ext2_set_bit_atomic(lock,nr,addr)	test_and_set_bit  ((nr) ^ 0x18, (addr))
+#define ext2_clear_bit_atomic(lock,nr,addr)	test_and_clear_bit((nr) ^ 0x18, (addr))
 
 static inline int ext2_test_bit(int nr, const volatile void * addr)
 {
@@ -331,9 +331,9 @@ found_middle:
 }
 
 /* Bitmap functions for the minix filesystem.  */
-#define minix_test_and_set_bit(nr,addr)		ext2_set_bit(nr,addr)
-#define minix_set_bit(nr,addr)			ext2_set_bit(nr,addr)
-#define minix_test_and_clear_bit(nr,addr)	ext2_clear_bit(nr,addr)
+#define minix_test_and_set_bit(nr,addr)		__test_and_set_bit  ((nr) ^ 0x18, (addr))
+#define minix_set_bit(nr,addr)			__set_bit((nr) ^ 0x18, (addr))
+#define minix_test_and_clear_bit(nr,addr)	__test_and_clear_bit((nr) ^ 0x18, (addr))
 #define minix_test_bit(nr,addr)			ext2_test_bit(nr,addr)
 #define minix_find_first_zero_bit(addr,size)	ext2_find_first_zero_bit(addr,size)
 
Index: 2.6-rc/include/asm-m68k/bitops.h
===================================================================
--- 2.6-rc.orig/include/asm-m68k/bitops.h
+++ 2.6-rc/include/asm-m68k/bitops.h
@@ -365,9 +365,9 @@ static inline int minix_find_first_zero_
 	return ((p - addr) << 4) + (res ^ 31);
 }
 
-#define minix_test_and_set_bit(nr, addr)	test_and_set_bit((nr) ^ 16, (unsigned long *)(addr))
-#define minix_set_bit(nr,addr)			set_bit((nr) ^ 16, (unsigned long *)(addr))
-#define minix_test_and_clear_bit(nr, addr)	test_and_clear_bit((nr) ^ 16, (unsigned long *)(addr))
+#define minix_test_and_set_bit(nr, addr)	__test_and_set_bit((nr) ^ 16, (unsigned long *)(addr))
+#define minix_set_bit(nr,addr)			__set_bit((nr) ^ 16, (unsigned long *)(addr))
+#define minix_test_and_clear_bit(nr, addr)	__test_and_clear_bit((nr) ^ 16, (unsigned long *)(addr))
 
 static inline int minix_test_bit(int nr, const void *vaddr)
 {
@@ -377,9 +377,9 @@ static inline int minix_test_bit(int nr,
 
 /* Bitmap functions for the ext2 filesystem. */
 
-#define ext2_set_bit(nr, addr)			test_and_set_bit((nr) ^ 24, (unsigned long *)(addr))
+#define ext2_set_bit(nr, addr)			__test_and_set_bit((nr) ^ 24, (unsigned long *)(addr))
 #define ext2_set_bit_atomic(lock, nr, addr)	test_and_set_bit((nr) ^ 24, (unsigned long *)(addr))
-#define ext2_clear_bit(nr, addr)		test_and_clear_bit((nr) ^ 24, (unsigned long *)(addr))
+#define ext2_clear_bit(nr, addr)		__test_and_clear_bit((nr) ^ 24, (unsigned long *)(addr))
 #define ext2_clear_bit_atomic(lock, nr, addr)	test_and_clear_bit((nr) ^ 24, (unsigned long *)(addr))
 
 static inline int ext2_test_bit(int nr, const void *vaddr)
Index: 2.6-rc/include/asm-m68knommu/bitops.h
===================================================================
--- 2.6-rc.orig/include/asm-m68knommu/bitops.h
+++ 2.6-rc/include/asm-m68knommu/bitops.h
@@ -476,9 +476,9 @@ found_middle:
 }
 
 /* Bitmap functions for the minix filesystem.  */
-#define minix_test_and_set_bit(nr,addr) test_and_set_bit(nr,addr)
-#define minix_set_bit(nr,addr) set_bit(nr,addr)
-#define minix_test_and_clear_bit(nr,addr) test_and_clear_bit(nr,addr)
+#define minix_test_and_set_bit(nr,addr) __test_and_set_bit(nr,addr)
+#define minix_set_bit(nr,addr) __set_bit(nr,addr)
+#define minix_test_and_clear_bit(nr,addr) __test_and_clear_bit(nr,addr)
 #define minix_test_bit(nr,addr) test_bit(nr,addr)
 #define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
 

--

From mita@miraclelinux.com Tue Feb 14 05:00:48 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Feb 2006 05:01:09 +0000 (GMT)
Received: from ns.miraclelinux.com ([219.118.163.66]:46542 "EHLO
	mail01.miraclelinux.com") by ftp.linux-mips.org with ESMTP
	id S8133438AbWBNE6g (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 14 Feb 2006 04:58:36 +0000
Received: from mail01 (localhost.localdomain [127.0.0.1])
	by mail01.miraclelinux.com (Postfix) with ESMTP
	id 7059D31C336; Tue, 14 Feb 2006 14:04:46 +0900 (JST)
Received: from localhost.localdomain (sshgate.miraclelinux.com [])
	by mail01.miraclelinux.com ([10.1.0.10]);
	Tue, 14 Feb 2006 05:04:46 +0000
Received: by localhost.localdomain (Postfix, from userid 1000)
	id 8AC3D42023B; Tue, 14 Feb 2006 14:04:44 +0900 (JST)
Message-Id: <20060214050444.425684000@localhost.localdomain>
References: <20060214050351.252615000@localhost.localdomain>
Date:	Tue, 14 Feb 2006 14:04:05 +0900
From:	Akinobu Mita <mita@miraclelinux.com>
To:	linux-kernel@vger.kernel.org
Cc:	akpm@osdl.org, Greg Ungerer <gerg@uclinux.org>,
	linux-mips@linux-mips.org, sparclinux@vger.kernel.org,
	ultralinux@vger.kernel.org, Akinobu Mita <mita@miraclelinux.com>
Subject: [patch 14/47] generic ffs()
Content-Disposition: inline; filename=ffs-bitops.patch
Return-Path: <mita@miraclelinux.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: 10436
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: mita@miraclelinux.com
Precedence: bulk
X-list: linux-mips
Content-Length: 1193
Lines: 60

This patch introduces the C-language equivalent of the function:
int ffs(int x);

In include/asm-generic/bitops/ffs.h

This code largely copied from:
include/linux/bitops.h

Signed-off-by: Akinobu Mita <mita@miraclelinux.com>
 include/asm-generic/bitops/ffs.h |   41 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 41 insertions(+)

Index: 2.6-rc/include/asm-generic/bitops/ffs.h
===================================================================
--- /dev/null
+++ 2.6-rc/include/asm-generic/bitops/ffs.h
@@ -0,0 +1,41 @@
+#ifndef _ASM_GENERIC_BITOPS_FFS_H_
+#define _ASM_GENERIC_BITOPS_FFS_H_
+
+/**
+ * ffs - find first bit set
+ * @x: the word to search
+ *
+ * This is defined the same way as
+ * the libc and compiler builtin ffs routines, therefore
+ * differs in spirit from the above ffz (man ffs).
+ */
+static inline int ffs(int x)
+{
+	int r = 1;
+
+	if (!x)
+		return 0;
+	if (!(x & 0xffff)) {
+		x >>= 16;
+		r += 16;
+	}
+	if (!(x & 0xff)) {
+		x >>= 8;
+		r += 8;
+	}
+	if (!(x & 0xf)) {
+		x >>= 4;
+		r += 4;
+	}
+	if (!(x & 3)) {
+		x >>= 2;
+		r += 2;
+	}
+	if (!(x & 1)) {
+		x >>= 1;
+		r += 1;
+	}
+	return r;
+}
+
+#endif /* _ASM_GENERIC_BITOPS_FFS_H_ */

--

From mita@miraclelinux.com Tue Feb 14 05:01:40 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Feb 2006 05:02:02 +0000 (GMT)
Received: from ns.miraclelinux.com ([219.118.163.66]:39374 "EHLO
	mail01.miraclelinux.com") by ftp.linux-mips.org with ESMTP
	id S8133459AbWBNE6h (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 14 Feb 2006 04:58:37 +0000
Received: from mail01 (localhost.localdomain [127.0.0.1])
	by mail01.miraclelinux.com (Postfix) with ESMTP
	id EEBCE31C332; Tue, 14 Feb 2006 14:04:45 +0900 (JST)
Received: from localhost.localdomain (sshgate.miraclelinux.com [])
	by mail01.miraclelinux.com ([10.1.0.10]);
	Tue, 14 Feb 2006 05:04:45 +0000
Received: by localhost.localdomain (Postfix, from userid 1000)
	id 967CA420238; Tue, 14 Feb 2006 14:04:43 +0900 (JST)
Message-Id: <20060214050443.468528000@localhost.localdomain>
References: <20060214050351.252615000@localhost.localdomain>
Date:	Tue, 14 Feb 2006 14:04:00 +0900
From:	Akinobu Mita <mita@miraclelinux.com>
To:	linux-kernel@vger.kernel.org
Cc:	akpm@osdl.org, Russell King <rmk@arm.linux.org.uk>,
	Ian Molton <spyro@f2s.com>,
	David Howells <dhowells@redhat.com>,
	Hirokazu Takata <takata@linux-m32r.org>,
	Greg Ungerer <gerg@uclinux.org>, linux-mips@linux-mips.org,
	parisc-linux@parisc-linux.org, sparclinux@vger.kernel.org,
	ultralinux@vger.kernel.org,
	Miles Bader <uclinux-v850@lsi.nec.co.jp>,
	Akinobu Mita <mita@miraclelinux.com>
Subject: [patch 09/47] generic ffz()
Content-Disposition: inline; filename=ffz-bitops.patch
Return-Path: <mita@miraclelinux.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: 10437
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: mita@miraclelinux.com
Precedence: bulk
X-list: linux-mips
Content-Length: 836
Lines: 31

This patch introduces the C-language equivalent of the function:
unsigned long ffz(unsigned long word);

In include/asm-generic/bitops/ffz.h

This code largely copied from:
include/asm-parisc/bitops.h

Signed-off-by: Akinobu Mita <mita@miraclelinux.com>
 include/asm-generic/bitops/ffz.h |   12 ++++++++++++
 1 files changed, 12 insertions(+)

Index: 2.6-rc/include/asm-generic/bitops/ffz.h
===================================================================
--- /dev/null
+++ 2.6-rc/include/asm-generic/bitops/ffz.h
@@ -0,0 +1,12 @@
+#ifndef _ASM_GENERIC_BITOPS_FFZ_H_
+#define _ASM_GENERIC_BITOPS_FFZ_H_
+
+/*
+ * ffz - find first zero in word.
+ * @word: The word to search
+ *
+ * Undefined if no zero exists, so code should check against ~0UL first.
+ */
+#define ffz(x)  __ffs(~(x))
+
+#endif /* _ASM_GENERIC_BITOPS_FFZ_H_ */

--

From mita@miraclelinux.com Tue Feb 14 05:02:29 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Feb 2006 05:02:48 +0000 (GMT)
Received: from ns.miraclelinux.com ([219.118.163.66]:13263 "EHLO
	mail01.miraclelinux.com") by ftp.linux-mips.org with ESMTP
	id S8133474AbWBNE6p (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 14 Feb 2006 04:58:45 +0000
Received: from mail01 (localhost.localdomain [127.0.0.1])
	by mail01.miraclelinux.com (Postfix) with ESMTP
	id 6D95B31C32E; Tue, 14 Feb 2006 14:04:46 +0900 (JST)
Received: from localhost.localdomain (sshgate.miraclelinux.com [])
	by mail01.miraclelinux.com ([10.1.0.10]);
	Tue, 14 Feb 2006 05:04:46 +0000
Received: by localhost.localdomain (Postfix, from userid 1000)
	id C750F420232; Tue, 14 Feb 2006 14:04:43 +0900 (JST)
Message-Id: <20060214050443.645438000@localhost.localdomain>
References: <20060214050351.252615000@localhost.localdomain>
Date:	Tue, 14 Feb 2006 14:04:01 +0900
From:	Akinobu Mita <mita@miraclelinux.com>
To:	linux-kernel@vger.kernel.org
Cc:	akpm@osdl.org, Richard Henderson <rth@twiddle.net>,
	Ivan Kokshaysky <ink@jurassic.park.msu.ru>,
	Russell King <rmk@arm.linux.org.uk>,
	Ian Molton <spyro@f2s.com>, dev-etrax@axis.com,
	Yoshinori Sato <ysato@users.sourceforge.jp>,
	Hirokazu Takata <takata@linux-m32r.org>,
	Greg Ungerer <gerg@uclinux.org>, linux-mips@linux-mips.org,
	linux390@de.ibm.com, linuxsh-dev@lists.sourceforge.net,
	linuxsh-shmedia-dev@lists.sourceforge.net,
	sparclinux@vger.kernel.org, ultralinux@vger.kernel.org,
	Miles Bader <uclinux-v850@lsi.nec.co.jp>,
	Akinobu Mita <mita@miraclelinux.com>
Subject: [patch 10/47] generic fls()
Content-Disposition: inline; filename=fls-bitops.patch
Return-Path: <mita@miraclelinux.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: 10438
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: mita@miraclelinux.com
Precedence: bulk
X-list: linux-mips
Content-Length: 1204
Lines: 60

This patch introduces the C-language equivalent of the function:
int fls(int x);

In include/asm-generic/bitops/fls.h

This code largely copied from:
include/linux/bitops.h

Signed-off-by: Akinobu Mita <mita@miraclelinux.com>
 include/asm-generic/bitops/fls.h |   41 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 41 insertions(+)

Index: 2.6-rc/include/asm-generic/bitops/fls.h
===================================================================
--- /dev/null
+++ 2.6-rc/include/asm-generic/bitops/fls.h
@@ -0,0 +1,41 @@
+#ifndef _ASM_GENERIC_BITOPS_FLS_H_
+#define _ASM_GENERIC_BITOPS_FLS_H_
+
+/**
+ * fls - find last (most-significant) bit set
+ * @x: the word to search
+ *
+ * This is defined the same way as ffs.
+ * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32.
+ */
+
+static inline int fls(int x)
+{
+	int r = 32;
+
+	if (!x)
+		return 0;
+	if (!(x & 0xffff0000u)) {
+		x <<= 16;
+		r -= 16;
+	}
+	if (!(x & 0xff000000u)) {
+		x <<= 8;
+		r -= 8;
+	}
+	if (!(x & 0xf0000000u)) {
+		x <<= 4;
+		r -= 4;
+	}
+	if (!(x & 0xc0000000u)) {
+		x <<= 2;
+		r -= 2;
+	}
+	if (!(x & 0x80000000u)) {
+		x <<= 1;
+		r -= 1;
+	}
+	return r;
+}
+
+#endif /* _ASM_GENERIC_BITOPS_FLS_H_ */

--

From mita@miraclelinux.com Tue Feb 14 05:03:17 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Feb 2006 05:03:32 +0000 (GMT)
Received: from ns.miraclelinux.com ([219.118.163.66]:24527 "EHLO
	mail01.miraclelinux.com") by ftp.linux-mips.org with ESMTP
	id S8133499AbWBNE6q (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 14 Feb 2006 04:58:46 +0000
Received: from mail01 (localhost.localdomain [127.0.0.1])
	by mail01.miraclelinux.com (Postfix) with ESMTP
	id D8E0131C33F; Tue, 14 Feb 2006 14:04:50 +0900 (JST)
Received: from localhost.localdomain (sshgate.miraclelinux.com [])
	by mail01.miraclelinux.com ([10.1.0.10]);
	Tue, 14 Feb 2006 05:04:47 +0000
Received: by localhost.localdomain (Postfix, from userid 1000)
	id B7D2042023C; Tue, 14 Feb 2006 14:04:44 +0900 (JST)
Message-Id: <20060214050444.599668000@localhost.localdomain>
References: <20060214050351.252615000@localhost.localdomain>
Date:	Tue, 14 Feb 2006 14:04:06 +0900
From:	Akinobu Mita <mita@miraclelinux.com>
To:	linux-kernel@vger.kernel.org
Cc:	akpm@osdl.org, Richard Henderson <rth@twiddle.net>,
	Ivan Kokshaysky <ink@jurassic.park.msu.ru>,
	Russell King <rmk@arm.linux.org.uk>,
	Ian Molton <spyro@f2s.com>, dev-etrax@axis.com,
	David Howells <dhowells@redhat.com>,
	Yoshinori Sato <ysato@users.sourceforge.jp>,
	Linus Torvalds <torvalds@osdl.org>, linux-ia64@vger.kernel.org,
	Hirokazu Takata <takata@linux-m32r.org>,
	linux-m68k@lists.linux-m68k.org, Greg Ungerer <gerg@uclinux.org>,
	linux-mips@linux-mips.org, parisc-linux@parisc-linux.org,
	linuxppc-dev@ozlabs.org, linux390@de.ibm.com,
	linuxsh-dev@lists.sourceforge.net,
	linuxsh-shmedia-dev@lists.sourceforge.net,
	sparclinux@vger.kernel.org, ultralinux@vger.kernel.org,
	Miles Bader <uclinux-v850@lsi.nec.co.jp>,
	Andi Kleen <ak@suse.de>, Chris Zankel <chris@zankel.net>,
	Akinobu Mita <mita@miraclelinux.com>
Subject: [patch 15/47] generic hweight{64,32,16,8}()
Content-Disposition: inline; filename=hweight-bitops.patch
Return-Path: <mita@miraclelinux.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: 10439
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: mita@miraclelinux.com
Precedence: bulk
X-list: linux-mips
Content-Length: 3563
Lines: 106


This patch introduces the C-language equivalents of the functions below:

unsigned int hweight32(unsigned int w);
unsigned int hweight16(unsigned int w);
unsigned int hweight8(unsigned int w);
unsigned long hweight64(__u64 w);

In include/asm-generic/bitops/hweight.h

This code largely copied from:
include/linux/bitops.h

Signed-off-by: Akinobu Mita <mita@miraclelinux.com>
 include/asm-generic/bitops/hweight.h |    9 +++++
 lib/Makefile                         |    1 
 lib/hweight.c                        |   54 +++++++++++++++++++++++++++++++++++
 3 files changed, 64 insertions(+)

Index: 2.6-rc/include/asm-generic/bitops/hweight.h
===================================================================
--- /dev/null
+++ 2.6-rc/include/asm-generic/bitops/hweight.h
@@ -0,0 +1,9 @@
+#ifndef _ASM_GENERIC_BITOPS_HWEIGHT_H_
+#define _ASM_GENERIC_BITOPS_HWEIGHT_H_
+
+extern unsigned int hweight32(unsigned int w);
+extern unsigned int hweight16(unsigned int w);
+extern unsigned int hweight8(unsigned int w);
+extern unsigned long hweight64(__u64 w);
+
+#endif /* _ASM_GENERIC_BITOPS_HWEIGHT_H_ */
Index: 2.6-rc/lib/Makefile
===================================================================
--- 2.6-rc.orig/lib/Makefile
+++ 2.6-rc/lib/Makefile
@@ -21,6 +21,7 @@ lib-$(CONFIG_RWSEM_GENERIC_SPINLOCK) += 
 lib-$(CONFIG_RWSEM_XCHGADD_ALGORITHM) += rwsem.o
 lib-$(CONFIG_SEMAPHORE_SLEEPERS) += semaphore-sleepers.o
 lib-$(CONFIG_GENERIC_FIND_NEXT_BIT) += find_next_bit.o
+lib-$(CONFIG_GENERIC_HWEIGHT) += hweight.o
 obj-$(CONFIG_LOCK_KERNEL) += kernel_lock.o
 obj-$(CONFIG_DEBUG_PREEMPT) += smp_processor_id.o
 
Index: 2.6-rc/lib/hweight.c
===================================================================
--- /dev/null
+++ 2.6-rc/lib/hweight.c
@@ -0,0 +1,54 @@
+#include <linux/module.h>
+#include <asm/types.h>
+
+/**
+ * hweightN - returns the hamming weight of a N-bit word
+ * @x: the word to weigh
+ *
+ * The Hamming Weight of a number is the total number of bits set in it.
+ */
+
+unsigned int hweight32(unsigned int w)
+{
+	unsigned int res = (w & 0x55555555) + ((w >> 1) & 0x55555555);
+	res = (res & 0x33333333) + ((res >> 2) & 0x33333333);
+	res = (res & 0x0F0F0F0F) + ((res >> 4) & 0x0F0F0F0F);
+	res = (res & 0x00FF00FF) + ((res >> 8) & 0x00FF00FF);
+	return (res & 0x0000FFFF) + ((res >> 16) & 0x0000FFFF);
+}
+EXPORT_SYMBOL(hweight32);
+
+unsigned int hweight16(unsigned int w)
+{
+	unsigned int res = (w & 0x5555) + ((w >> 1) & 0x5555);
+	res = (res & 0x3333) + ((res >> 2) & 0x3333);
+	res = (res & 0x0F0F) + ((res >> 4) & 0x0F0F);
+	return (res & 0x00FF) + ((res >> 8) & 0x00FF);
+}
+EXPORT_SYMBOL(hweight16);
+
+unsigned int hweight8(unsigned int w)
+{
+	unsigned int res = (w & 0x55) + ((w >> 1) & 0x55);
+	res = (res & 0x33) + ((res >> 2) & 0x33);
+	return (res & 0x0F) + ((res >> 4) & 0x0F);
+}
+EXPORT_SYMBOL(hweight8);
+
+unsigned long hweight64(__u64 w)
+{
+#if BITS_PER_LONG == 32
+	return hweight32((unsigned int)(w >> 32)) + hweight32((unsigned int)w);
+#elif BITS_PER_LONG == 64
+	u64 res;
+	res = (w & 0x5555555555555555ul) + ((w >> 1) & 0x5555555555555555ul);
+	res = (res & 0x3333333333333333ul) + ((res >> 2) & 0x3333333333333333ul);
+	res = (res & 0x0F0F0F0F0F0F0F0Ful) + ((res >> 4) & 0x0F0F0F0F0F0F0F0Ful);
+	res = (res & 0x00FF00FF00FF00FFul) + ((res >> 8) & 0x00FF00FF00FF00FFul);
+	res = (res & 0x0000FFFF0000FFFFul) + ((res >> 16) & 0x0000FFFF0000FFFFul);
+	return (res & 0x00000000FFFFFFFFul) + ((res >> 32) & 0x00000000FFFFFFFFul);
+#else
+#error BITS_PER_LONG not defined
+#endif
+}
+EXPORT_SYMBOL(hweight64);

--

From mita@miraclelinux.com Tue Feb 14 05:04:02 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Feb 2006 05:04:25 +0000 (GMT)
Received: from ns.miraclelinux.com ([219.118.163.66]:16335 "EHLO
	mail01.miraclelinux.com") by ftp.linux-mips.org with ESMTP
	id S8133476AbWBNE6q (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 14 Feb 2006 04:58:46 +0000
Received: from mail01 (localhost.localdomain [127.0.0.1])
	by mail01.miraclelinux.com (Postfix) with ESMTP
	id D8EB331C32D; Tue, 14 Feb 2006 14:04:46 +0900 (JST)
Received: from localhost.localdomain (sshgate.miraclelinux.com [])
	by mail01.miraclelinux.com ([10.1.0.10]);
	Tue, 14 Feb 2006 05:04:46 +0000
Received: by localhost.localdomain (Postfix, from userid 1000)
	id 324E3420239; Tue, 14 Feb 2006 14:04:44 +0900 (JST)
Message-Id: <20060214050444.051147000@localhost.localdomain>
References: <20060214050351.252615000@localhost.localdomain>
Date:	Tue, 14 Feb 2006 14:04:03 +0900
From:	Akinobu Mita <mita@miraclelinux.com>
To:	linux-kernel@vger.kernel.org
Cc:	akpm@osdl.org, Richard Henderson <rth@twiddle.net>,
	Ivan Kokshaysky <ink@jurassic.park.msu.ru>, dev-etrax@axis.com,
	David Howells <dhowells@redhat.com>,
	Yoshinori Sato <ysato@users.sourceforge.jp>,
	linux-ia64@vger.kernel.org,
	Hirokazu Takata <takata@linux-m32r.org>,
	Greg Ungerer <gerg@uclinux.org>, linux-mips@linux-mips.org,
	parisc-linux@parisc-linux.org, linuxsh-dev@lists.sourceforge.net,
	linuxsh-shmedia-dev@lists.sourceforge.net,
	sparclinux@vger.kernel.org, ultralinux@vger.kernel.org,
	Miles Bader <uclinux-v850@lsi.nec.co.jp>,
	Chris Zankel <chris@zankel.net>,
	Akinobu Mita <mita@miraclelinux.com>
Subject: [patch 12/47] generic find_{next,first}{,_zero}_bit()
Content-Disposition: inline; filename=find-bitops.patch
Return-Path: <mita@miraclelinux.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: 10440
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: mita@miraclelinux.com
Precedence: bulk
X-list: linux-mips
Content-Length: 4715
Lines: 175

This patch introduces the C-language equivalents of the functions below:

unsigned logn find_next_bit(const unsigned long *addr, unsigned long size,
                            unsigned long offset);
unsigned long find_next_zero_bit(const unsigned long *addr, unsigned long size,
                                 unsigned long offset);
unsigned long find_first_zero_bit(const unsigned long *addr,
                                  unsigned long size);
unsigned long find_first_bit(const unsigned long *addr, unsigned long size);

In include/asm-generic/bitops/find.h

This code largely copied from:
arch/powerpc/lib/bitops.c

Signed-off-by: Akinobu Mita <mita@miraclelinux.com>
 include/asm-generic/bitops/find.h |   13 ++++
 lib/find_next_bit.c               |  114 +++++++++++++++++++++++++++-----------
 2 files changed, 95 insertions(+), 32 deletions(-)

Index: 2.6-rc/include/asm-generic/bitops/find.h
===================================================================
--- /dev/null
+++ 2.6-rc/include/asm-generic/bitops/find.h
@@ -0,0 +1,13 @@
+#ifndef _ASM_GENERIC_BITOPS_FIND_H_
+#define _ASM_GENERIC_BITOPS_FIND_H_
+
+extern unsigned long find_next_bit(const unsigned long *addr, unsigned long
+		size, unsigned long offset);
+
+extern unsigned long find_next_zero_bit(const unsigned long *addr, unsigned
+		long size, unsigned long offset);
+
+#define find_first_bit(addr, size) find_next_bit((addr), (size), 0)
+#define find_first_zero_bit(addr, size) find_next_zero_bit((addr), (size), 0)
+
+#endif /*_ASM_GENERIC_BITOPS_FIND_H_ */
Index: 2.6-rc/lib/find_next_bit.c
===================================================================
--- 2.6-rc.orig/lib/find_next_bit.c
+++ 2.6-rc/lib/find_next_bit.c
@@ -11,48 +11,98 @@
 
 #include <linux/bitops.h>
 #include <linux/module.h>
+#include <asm/types.h>
 
-int find_next_bit(const unsigned long *addr, int size, int offset)
+#define BITOP_WORD(nr)		((nr) / BITS_PER_LONG)
+
+/**
+ * find_next_bit - find the next set bit in a memory region
+ * @addr: The address to base the search on
+ * @offset: The bitnumber to start searching at
+ * @size: The maximum size to search
+ */
+unsigned long find_next_bit(const unsigned long *addr, unsigned long size,
+		unsigned long offset)
 {
-	const unsigned long *base;
-	const int NBITS = sizeof(*addr) * 8;
+	const unsigned long *p = addr + BITOP_WORD(offset);
+	unsigned long result = offset & ~(BITS_PER_LONG-1);
 	unsigned long tmp;
 
-	base = addr;
+	if (offset >= size)
+		return size;
+	size -= result;
+	offset %= BITS_PER_LONG;
 	if (offset) {
-		int suboffset;
-
-		addr += offset / NBITS;
-
-		suboffset = offset % NBITS;
-		if (suboffset) {
-			tmp = *addr;
-			tmp >>= suboffset;
-			if (tmp)
-				goto finish;
-		}
-
-		addr++;
+		tmp = *(p++);
+		tmp &= (~0UL << offset);
+		if (size < BITS_PER_LONG)
+			goto found_first;
+		if (tmp)
+			goto found_middle;
+		size -= BITS_PER_LONG;
+		result += BITS_PER_LONG;
 	}
+	while (size & ~(BITS_PER_LONG-1)) {
+		if ((tmp = *(p++)))
+			goto found_middle;
+		result += BITS_PER_LONG;
+		size -= BITS_PER_LONG;
+	}
+	if (!size)
+		return result;
+	tmp = *p;
+
+found_first:
+	tmp &= (~0UL >> (BITS_PER_LONG - size));
+	if (tmp == 0UL)		/* Are any bits set? */
+		return result + size;	/* Nope. */
+found_middle:
+	return result + __ffs(tmp);
+}
 
-	while ((tmp = *addr) == 0)
-		addr++;
+EXPORT_SYMBOL(find_next_bit);
 
-	offset = (addr - base) * NBITS;
+/*
+ * This implementation of find_{first,next}_zero_bit was stolen from
+ * Linus' asm-alpha/bitops.h.
+ */
+unsigned long find_next_zero_bit(const unsigned long *addr, unsigned long size,
+		unsigned long offset)
+{
+	const unsigned long *p = addr + BITOP_WORD(offset);
+	unsigned long result = offset & ~(BITS_PER_LONG-1);
+	unsigned long tmp;
 
- finish:
-	/* count the remaining bits without using __ffs() since that takes a 32-bit arg */
-	while (!(tmp & 0xff)) {
-		offset += 8;
-		tmp >>= 8;
+	if (offset >= size)
+		return size;
+	size -= result;
+	offset %= BITS_PER_LONG;
+	if (offset) {
+		tmp = *(p++);
+		tmp |= ~0UL >> (BITS_PER_LONG - offset);
+		if (size < BITS_PER_LONG)
+			goto found_first;
+		if (~tmp)
+			goto found_middle;
+		size -= BITS_PER_LONG;
+		result += BITS_PER_LONG;
 	}
-
-	while (!(tmp & 1)) {
-		offset++;
-		tmp >>= 1;
+	while (size & ~(BITS_PER_LONG-1)) {
+		if (~(tmp = *(p++)))
+			goto found_middle;
+		result += BITS_PER_LONG;
+		size -= BITS_PER_LONG;
 	}
-
-	return offset;
+	if (!size)
+		return result;
+	tmp = *p;
+
+found_first:
+	tmp |= ~0UL << size;
+	if (tmp == ~0UL)	/* Are any bits zero? */
+		return result + size;	/* Nope. */
+found_middle:
+	return result + ffz(tmp);
 }
 
-EXPORT_SYMBOL(find_next_bit);
+EXPORT_SYMBOL(find_next_zero_bit);

--

From mita@miraclelinux.com Tue Feb 14 05:04:51 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Feb 2006 05:05:13 +0000 (GMT)
Received: from ns.miraclelinux.com ([219.118.163.66]:31439 "EHLO
	mail01.miraclelinux.com") by ftp.linux-mips.org with ESMTP
	id S3457193AbWBNE6r (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 14 Feb 2006 04:58:47 +0000
Received: from mail01 (localhost.localdomain [127.0.0.1])
	by mail01.miraclelinux.com (Postfix) with ESMTP
	id 9F01B31C339; Tue, 14 Feb 2006 14:04:47 +0900 (JST)
Received: from localhost.localdomain (sshgate.miraclelinux.com [])
	by mail01.miraclelinux.com ([10.1.0.10]);
	Tue, 14 Feb 2006 05:04:47 +0000
Received: by localhost.localdomain (Postfix, from userid 1000)
	id 2C89A42022F; Tue, 14 Feb 2006 14:04:45 +0900 (JST)
Message-Id: <20060214050445.011576000@localhost.localdomain>
References: <20060214050351.252615000@localhost.localdomain>
Date:	Tue, 14 Feb 2006 14:04:08 +0900
From:	Akinobu Mita <mita@miraclelinux.com>
To:	linux-kernel@vger.kernel.org
Cc:	akpm@osdl.org, Yoshinori Sato <ysato@users.sourceforge.jp>,
	Hirokazu Takata <takata@linux-m32r.org>,
	linux-mips@linux-mips.org, linuxsh-dev@lists.sourceforge.net,
	linuxsh-shmedia-dev@lists.sourceforge.net,
	sparclinux@vger.kernel.org, Akinobu Mita <mita@miraclelinux.com>
Subject: [patch 17/47] generic ext2_{set,clear}_bit_atomic()
Content-Disposition: inline; filename=ext2-atomic-bitops.patch
Return-Path: <mita@miraclelinux.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: 10441
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: mita@miraclelinux.com
Precedence: bulk
X-list: linux-mips
Content-Length: 1228
Lines: 43

This patch introduces the C-language equivalents of the functions below:

int ext2_set_bit_atomic(int nr, volatile unsigned long *addr);
int ext2_clear_bit_atomic(int nr, volatile unsigned long *addr);

In include/asm-generic/bitops/ext2-atomic.h

This code largely copied from:
include/asm-sparc/bitops.h

Signed-off-by: Akinobu Mita <mita@miraclelinux.com>
 include/asm-generic/bitops/ext2-atomic.h |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+)

Index: 2.6-rc/include/asm-generic/bitops/ext2-atomic.h
===================================================================
--- /dev/null
+++ 2.6-rc/include/asm-generic/bitops/ext2-atomic.h
@@ -0,0 +1,22 @@
+#ifndef _ASM_GENERIC_BITOPS_EXT2_ATOMIC_H_
+#define _ASM_GENERIC_BITOPS_EXT2_ATOMIC_H_
+
+#define ext2_set_bit_atomic(lock, nr, addr)		\
+	({						\
+		int ret;				\
+		spin_lock(lock);			\
+		ret = ext2_set_bit((nr), (unsigned long *)(addr)); \
+		spin_unlock(lock);			\
+		ret;					\
+	})
+
+#define ext2_clear_bit_atomic(lock, nr, addr)		\
+	({						\
+		int ret;				\
+		spin_lock(lock);			\
+		ret = ext2_clear_bit((nr), (unsigned long *)(addr)); \
+		spin_unlock(lock);			\
+		ret;					\
+	})
+
+#endif /* _ASM_GENERIC_BITOPS_EXT2_ATOMIC_H_ */

--

From mita@miraclelinux.com Tue Feb 14 05:05:44 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Feb 2006 05:06:06 +0000 (GMT)
Received: from ns.miraclelinux.com ([219.118.163.66]:33231 "EHLO
	mail01.miraclelinux.com") by ftp.linux-mips.org with ESMTP
	id S3458391AbWBNE6s (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 14 Feb 2006 04:58:48 +0000
Received: from mail01 (localhost.localdomain [127.0.0.1])
	by mail01.miraclelinux.com (Postfix) with ESMTP
	id 9AE1C31C340; Tue, 14 Feb 2006 14:04:55 +0900 (JST)
Received: from localhost.localdomain (sshgate.miraclelinux.com [])
	by mail01.miraclelinux.com ([10.1.0.10]);
	Tue, 14 Feb 2006 05:04:52 +0000
Received: by localhost.localdomain (Postfix, from userid 1000)
	id A150E42023A; Tue, 14 Feb 2006 14:04:47 +0900 (JST)
Message-Id: <20060214050447.512369000@localhost.localdomain>
References: <20060214050351.252615000@localhost.localdomain>
Date:	Tue, 14 Feb 2006 14:04:21 +0900
From:	Akinobu Mita <mita@miraclelinux.com>
To:	linux-kernel@vger.kernel.org
Cc:	akpm@osdl.org, linux-mips@linux-mips.org,
	Akinobu Mita <mita@miraclelinux.com>
Subject: [patch 30/47] mips: use generic bitops
Content-Disposition: inline; filename=mips.patch
Return-Path: <mita@miraclelinux.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: 10442
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: mita@miraclelinux.com
Precedence: bulk
X-list: linux-mips
Content-Length: 16201
Lines: 600

- remove __{,test_and_}{set,clear,change}_bit() and test_bit()

- unless defined(CONFIG_CPU_MIPS32) or defined(CONFIG_CPU_MIPS64)

  - remove __ffs()
  - remove ffs()
  - remove ffz()
  - remove fls()

- remove fls64()
- remove find_{next,first}{,_zero}_bit()
- remove sched_find_first_bit()
- remove generic_hweight64()
- remove generic_hweight{32,16,8}()
- remove ext2_{set,clear,test,find_first_zero,find_next_zero}_bit()
- remove ext2_{set,clear}_bit_atomic()
- remove minix_{test,set,test_and_clear,test,find_first_zero}_bit()

Signed-off-by: Akinobu Mita <mita@miraclelinux.com>
 arch/mips/Kconfig         |    8 
 include/asm-mips/bitops.h |  465 +---------------------------------------------
 2 files changed, 24 insertions(+), 449 deletions(-)

Index: 2.6-rc/include/asm-mips/bitops.h
===================================================================
--- 2.6-rc.orig/include/asm-mips/bitops.h
+++ 2.6-rc/include/asm-mips/bitops.h
@@ -105,22 +105,6 @@ static inline void set_bit(unsigned long
 }
 
 /*
- * __set_bit - Set a bit in memory
- * @nr: the bit to set
- * @addr: the address to start counting from
- *
- * Unlike set_bit(), this function is non-atomic and may be reordered.
- * If it's called on the same region of memory simultaneously, the effect
- * may be that only one operation succeeds.
- */
-static inline void __set_bit(unsigned long nr, volatile unsigned long * addr)
-{
-	unsigned long * m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
-
-	*m |= 1UL << (nr & SZLONG_MASK);
-}
-
-/*
  * clear_bit - Clears a bit in memory
  * @nr: Bit to clear
  * @addr: Address to start counting from
@@ -169,22 +153,6 @@ static inline void clear_bit(unsigned lo
 }
 
 /*
- * __clear_bit - Clears a bit in memory
- * @nr: Bit to clear
- * @addr: Address to start counting from
- *
- * Unlike clear_bit(), this function is non-atomic and may be reordered.
- * If it's called on the same region of memory simultaneously, the effect
- * may be that only one operation succeeds.
- */
-static inline void __clear_bit(unsigned long nr, volatile unsigned long * addr)
-{
-	unsigned long * m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
-
-	*m &= ~(1UL << (nr & SZLONG_MASK));
-}
-
-/*
  * change_bit - Toggle a bit in memory
  * @nr: Bit to change
  * @addr: Address to start counting from
@@ -235,22 +203,6 @@ static inline void change_bit(unsigned l
 }
 
 /*
- * __change_bit - Toggle a bit in memory
- * @nr: the bit to change
- * @addr: the address to start counting from
- *
- * Unlike change_bit(), this function is non-atomic and may be reordered.
- * If it's called on the same region of memory simultaneously, the effect
- * may be that only one operation succeeds.
- */
-static inline void __change_bit(unsigned long nr, volatile unsigned long * addr)
-{
-	unsigned long * m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
-
-	*m ^= 1UL << (nr & SZLONG_MASK);
-}
-
-/*
  * test_and_set_bit - Set a bit and return its old value
  * @nr: Bit to set
  * @addr: Address to count from
@@ -321,30 +273,6 @@ static inline int test_and_set_bit(unsig
 }
 
 /*
- * __test_and_set_bit - Set a bit and return its old value
- * @nr: Bit to set
- * @addr: Address to count from
- *
- * This operation is non-atomic and can be reordered.
- * If two examples of this operation race, one can appear to succeed
- * but actually fail.  You must protect multiple accesses with a lock.
- */
-static inline int __test_and_set_bit(unsigned long nr,
-	volatile unsigned long *addr)
-{
-	volatile unsigned long *a = addr;
-	unsigned long mask;
-	int retval;
-
-	a += nr >> SZLONG_LOG;
-	mask = 1UL << (nr & SZLONG_MASK);
-	retval = (mask & *a) != 0;
-	*a |= mask;
-
-	return retval;
-}
-
-/*
  * test_and_clear_bit - Clear a bit and return its old value
  * @nr: Bit to clear
  * @addr: Address to count from
@@ -417,30 +345,6 @@ static inline int test_and_clear_bit(uns
 }
 
 /*
- * __test_and_clear_bit - Clear a bit and return its old value
- * @nr: Bit to clear
- * @addr: Address to count from
- *
- * This operation is non-atomic and can be reordered.
- * If two examples of this operation race, one can appear to succeed
- * but actually fail.  You must protect multiple accesses with a lock.
- */
-static inline int __test_and_clear_bit(unsigned long nr,
-	volatile unsigned long * addr)
-{
-	volatile unsigned long *a = addr;
-	unsigned long mask;
-	int retval;
-
-	a += (nr >> SZLONG_LOG);
-	mask = 1UL << (nr & SZLONG_MASK);
-	retval = ((mask & *a) != 0);
-	*a &= ~mask;
-
-	return retval;
-}
-
-/*
  * test_and_change_bit - Change a bit and return its old value
  * @nr: Bit to change
  * @addr: Address to count from
@@ -509,43 +413,11 @@ static inline int test_and_change_bit(un
 	}
 }
 
-/*
- * __test_and_change_bit - Change a bit and return its old value
- * @nr: Bit to change
- * @addr: Address to count from
- *
- * This operation is non-atomic and can be reordered.
- * If two examples of this operation race, one can appear to succeed
- * but actually fail.  You must protect multiple accesses with a lock.
- */
-static inline int __test_and_change_bit(unsigned long nr,
-	volatile unsigned long *addr)
-{
-	volatile unsigned long *a = addr;
-	unsigned long mask;
-	int retval;
-
-	a += (nr >> SZLONG_LOG);
-	mask = 1UL << (nr & SZLONG_MASK);
-	retval = ((mask & *a) != 0);
-	*a ^= mask;
-
-	return retval;
-}
-
 #undef __bi_flags
 #undef __bi_local_irq_save
 #undef __bi_local_irq_restore
 
-/*
- * test_bit - Determine whether a bit is set
- * @nr: bit number to test
- * @addr: Address to start counting from
- */
-static inline int test_bit(unsigned long nr, const volatile unsigned long *addr)
-{
-	return 1UL & (addr[nr >> SZLONG_LOG] >> (nr & SZLONG_MASK));
-}
+#include <asm-generic/bitops/non-atomic.h>
 
 /*
  * Return the bit position (0..63) of the most significant 1 bit in a word
@@ -580,6 +452,8 @@ static inline int __ilog2(unsigned long 
 	return 63 - lz;
 }
 
+#if defined(CONFIG_CPU_MIPS32) || defined(CONFIG_CPU_MIPS64)
+
 /*
  * __ffs - find first bit in word.
  * @word: The word to search
@@ -589,31 +463,7 @@ static inline int __ilog2(unsigned long 
  */
 static inline unsigned long __ffs(unsigned long word)
 {
-#if defined(CONFIG_CPU_MIPS32) || defined(CONFIG_CPU_MIPS64)
 	return __ilog2(word & -word);
-#else
-	int b = 0, s;
-
-#ifdef CONFIG_32BIT
-	s = 16; if (word << 16 != 0) s = 0; b += s; word >>= s;
-	s =  8; if (word << 24 != 0) s = 0; b += s; word >>= s;
-	s =  4; if (word << 28 != 0) s = 0; b += s; word >>= s;
-	s =  2; if (word << 30 != 0) s = 0; b += s; word >>= s;
-	s =  1; if (word << 31 != 0) s = 0; b += s;
-
-	return b;
-#endif
-#ifdef CONFIG_64BIT
-	s = 32; if (word << 32 != 0) s = 0; b += s; word >>= s;
-	s = 16; if (word << 48 != 0) s = 0; b += s; word >>= s;
-	s =  8; if (word << 56 != 0) s = 0; b += s; word >>= s;
-	s =  4; if (word << 60 != 0) s = 0; b += s; word >>= s;
-	s =  2; if (word << 62 != 0) s = 0; b += s; word >>= s;
-	s =  1; if (word << 63 != 0) s = 0; b += s;
-
-	return b;
-#endif
-#endif
 }
 
 /*
@@ -652,321 +502,38 @@ static inline unsigned long ffz(unsigned
  */
 static inline unsigned long fls(unsigned long word)
 {
-#ifdef CONFIG_32BIT
 #ifdef CONFIG_CPU_MIPS32
 	__asm__ ("clz %0, %1" : "=r" (word) : "r" (word));
 
 	return 32 - word;
-#else
-	{
-	int r = 32, s;
-
-	if (word == 0)
-		return 0;
-
-	s = 16; if ((word & 0xffff0000)) s = 0; r -= s; word <<= s;
-	s = 8;  if ((word & 0xff000000)) s = 0; r -= s; word <<= s;
-	s = 4;  if ((word & 0xf0000000)) s = 0; r -= s; word <<= s;
-	s = 2;  if ((word & 0xc0000000)) s = 0; r -= s; word <<= s;
-	s = 1;  if ((word & 0x80000000)) s = 0; r -= s;
-
-	return r;
-	}
 #endif
-#endif /* CONFIG_32BIT */
 
-#ifdef CONFIG_64BIT
 #ifdef CONFIG_CPU_MIPS64
-
 	__asm__ ("dclz %0, %1" : "=r" (word) : "r" (word));
 
 	return 64 - word;
-#else
-	{
-	int r = 64, s;
-
-	if (word == 0)
-		return 0;
-
-	s = 32; if ((word & 0xffffffff00000000UL)) s = 0; r -= s; word <<= s;
-	s = 16; if ((word & 0xffff000000000000UL)) s = 0; r -= s; word <<= s;
-	s = 8;  if ((word & 0xff00000000000000UL)) s = 0; r -= s; word <<= s;
-	s = 4;  if ((word & 0xf000000000000000UL)) s = 0; r -= s; word <<= s;
-	s = 2;  if ((word & 0xc000000000000000UL)) s = 0; r -= s; word <<= s;
-	s = 1;  if ((word & 0x8000000000000000UL)) s = 0; r -= s;
-
-	return r;
-	}
 #endif
-#endif /* CONFIG_64BIT */
 }
 
-#define fls64(x)   generic_fls64(x)
-
-/*
- * find_next_zero_bit - find the first zero bit in a memory region
- * @addr: The address to base the search on
- * @offset: The bitnumber to start searching at
- * @size: The maximum size to search
- */
-static inline unsigned long find_next_zero_bit(const unsigned long *addr,
-	unsigned long size, unsigned long offset)
-{
-	const unsigned long *p = addr + (offset >> SZLONG_LOG);
-	unsigned long result = offset & ~SZLONG_MASK;
-	unsigned long tmp;
-
-	if (offset >= size)
-		return size;
-	size -= result;
-	offset &= SZLONG_MASK;
-	if (offset) {
-		tmp = *(p++);
-		tmp |= ~0UL >> (_MIPS_SZLONG-offset);
-		if (size < _MIPS_SZLONG)
-			goto found_first;
-		if (~tmp)
-			goto found_middle;
-		size -= _MIPS_SZLONG;
-		result += _MIPS_SZLONG;
-	}
-	while (size & ~SZLONG_MASK) {
-		if (~(tmp = *(p++)))
-			goto found_middle;
-		result += _MIPS_SZLONG;
-		size -= _MIPS_SZLONG;
-	}
-	if (!size)
-		return result;
-	tmp = *p;
-
-found_first:
-	tmp |= ~0UL << size;
-	if (tmp == ~0UL)		/* Are any bits zero? */
-		return result + size;	/* Nope. */
-found_middle:
-	return result + ffz(tmp);
-}
+#else
 
-#define find_first_zero_bit(addr, size) \
-	find_next_zero_bit((addr), (size), 0)
+#include <asm-generic/bitops/__ffs.h>
+#include <asm-generic/bitops/ffs.h>
+#include <asm-generic/bitops/ffz.h>
+#include <asm-generic/bitops/fls.h>
 
-/*
- * find_next_bit - find the next set bit in a memory region
- * @addr: The address to base the search on
- * @offset: The bitnumber to start searching at
- * @size: The maximum size to search
- */
-static inline unsigned long find_next_bit(const unsigned long *addr,
-	unsigned long size, unsigned long offset)
-{
-	const unsigned long *p = addr + (offset >> SZLONG_LOG);
-	unsigned long result = offset & ~SZLONG_MASK;
-	unsigned long tmp;
-
-	if (offset >= size)
-		return size;
-	size -= result;
-	offset &= SZLONG_MASK;
-	if (offset) {
-		tmp = *(p++);
-		tmp &= ~0UL << offset;
-		if (size < _MIPS_SZLONG)
-			goto found_first;
-		if (tmp)
-			goto found_middle;
-		size -= _MIPS_SZLONG;
-		result += _MIPS_SZLONG;
-	}
-	while (size & ~SZLONG_MASK) {
-		if ((tmp = *(p++)))
-			goto found_middle;
-		result += _MIPS_SZLONG;
-		size -= _MIPS_SZLONG;
-	}
-	if (!size)
-		return result;
-	tmp = *p;
-
-found_first:
-	tmp &= ~0UL >> (_MIPS_SZLONG - size);
-	if (tmp == 0UL)			/* Are any bits set? */
-		return result + size;	/* Nope. */
-found_middle:
-	return result + __ffs(tmp);
-}
+#endif /*defined(CONFIG_CPU_MIPS32) || defined(CONFIG_CPU_MIPS64) */
 
-/*
- * find_first_bit - find the first set bit in a memory region
- * @addr: The address to start the search at
- * @size: The maximum size to search
- *
- * Returns the bit-number of the first set bit, not the number of the byte
- * containing a bit.
- */
-#define find_first_bit(addr, size) \
-	find_next_bit((addr), (size), 0)
+#include <asm-generic/bitops/fls64.h>
+#include <asm-generic/bitops/find.h>
 
 #ifdef __KERNEL__
 
-/*
- * Every architecture must define this function. It's the fastest
- * way of searching a 140-bit bitmap where the first 100 bits are
- * unlikely to be set. It's guaranteed that at least one of the 140
- * bits is cleared.
- */
-static inline int sched_find_first_bit(const unsigned long *b)
-{
-#ifdef CONFIG_32BIT
-	if (unlikely(b[0]))
-		return __ffs(b[0]);
-	if (unlikely(b[1]))
-		return __ffs(b[1]) + 32;
-	if (unlikely(b[2]))
-		return __ffs(b[2]) + 64;
-	if (b[3])
-		return __ffs(b[3]) + 96;
-	return __ffs(b[4]) + 128;
-#endif
-#ifdef CONFIG_64BIT
-	if (unlikely(b[0]))
-		return __ffs(b[0]);
-	if (unlikely(b[1]))
-		return __ffs(b[1]) + 64;
-	return __ffs(b[2]) + 128;
-#endif
-}
-
-/*
- * hweightN - returns the hamming weight of a N-bit word
- * @x: the word to weigh
- *
- * The Hamming Weight of a number is the total number of bits set in it.
- */
-
-#define hweight64(x)	generic_hweight64(x)
-#define hweight32(x)	generic_hweight32(x)
-#define hweight16(x)	generic_hweight16(x)
-#define hweight8(x)	generic_hweight8(x)
-
-static inline int __test_and_set_le_bit(unsigned long nr, unsigned long *addr)
-{
-	unsigned char	*ADDR = (unsigned char *) addr;
-	int		mask, retval;
-
-	ADDR += nr >> 3;
-	mask = 1 << (nr & 0x07);
-	retval = (mask & *ADDR) != 0;
-	*ADDR |= mask;
-
-	return retval;
-}
-
-static inline int __test_and_clear_le_bit(unsigned long nr, unsigned long *addr)
-{
-	unsigned char	*ADDR = (unsigned char *) addr;
-	int		mask, retval;
-
-	ADDR += nr >> 3;
-	mask = 1 << (nr & 0x07);
-	retval = (mask & *ADDR) != 0;
-	*ADDR &= ~mask;
-
-	return retval;
-}
-
-static inline int test_le_bit(unsigned long nr, const unsigned long * addr)
-{
-	const unsigned char	*ADDR = (const unsigned char *) addr;
-	int			mask;
-
-	ADDR += nr >> 3;
-	mask = 1 << (nr & 0x07);
-
-	return ((mask & *ADDR) != 0);
-}
-
-static inline unsigned long find_next_zero_le_bit(unsigned long *addr,
-	unsigned long size, unsigned long offset)
-{
-	unsigned long *p = ((unsigned long *) addr) + (offset >> SZLONG_LOG);
-	unsigned long result = offset & ~SZLONG_MASK;
-	unsigned long tmp;
-
-	if (offset >= size)
-		return size;
-	size -= result;
-	offset &= SZLONG_MASK;
-	if (offset) {
-		tmp = cpu_to_lelongp(p++);
-		tmp |= ~0UL >> (_MIPS_SZLONG-offset); /* bug or feature ? */
-		if (size < _MIPS_SZLONG)
-			goto found_first;
-		if (~tmp)
-			goto found_middle;
-		size -= _MIPS_SZLONG;
-		result += _MIPS_SZLONG;
-	}
-	while (size & ~SZLONG_MASK) {
-		if (~(tmp = cpu_to_lelongp(p++)))
-			goto found_middle;
-		result += _MIPS_SZLONG;
-		size -= _MIPS_SZLONG;
-	}
-	if (!size)
-		return result;
-	tmp = cpu_to_lelongp(p);
-
-found_first:
-	tmp |= ~0UL << size;
-	if (tmp == ~0UL)		/* Are any bits zero? */
-		return result + size;	/* Nope. */
-
-found_middle:
-	return result + ffz(tmp);
-}
-
-#define find_first_zero_le_bit(addr, size) \
-	find_next_zero_le_bit((addr), (size), 0)
-
-#define ext2_set_bit(nr,addr) \
-	__test_and_set_le_bit((nr),(unsigned long*)addr)
-#define ext2_clear_bit(nr, addr) \
-	__test_and_clear_le_bit((nr),(unsigned long*)addr)
- #define ext2_set_bit_atomic(lock, nr, addr)		\
-({							\
-	int ret;					\
-	spin_lock(lock);				\
-	ret = ext2_set_bit((nr), (addr));		\
-	spin_unlock(lock);				\
-	ret;						\
-})
-
-#define ext2_clear_bit_atomic(lock, nr, addr)		\
-({							\
-	int ret;					\
-	spin_lock(lock);				\
-	ret = ext2_clear_bit((nr), (addr));		\
-	spin_unlock(lock);				\
-	ret;						\
-})
-#define ext2_test_bit(nr, addr)	test_le_bit((nr),(unsigned long*)addr)
-#define ext2_find_first_zero_bit(addr, size) \
-	find_first_zero_le_bit((unsigned long*)addr, size)
-#define ext2_find_next_zero_bit(addr, size, off) \
-	find_next_zero_le_bit((unsigned long*)addr, size, off)
-
-/*
- * Bitmap functions for the minix filesystem.
- *
- * FIXME: These assume that Minix uses the native byte/bitorder.
- * This limits the Minix filesystem's value for data exchange very much.
- */
-#define minix_test_and_set_bit(nr,addr) __test_and_set_bit(nr,addr)
-#define minix_set_bit(nr,addr) __set_bit(nr,addr)
-#define minix_test_and_clear_bit(nr,addr) __test_and_clear_bit(nr,addr)
-#define minix_test_bit(nr,addr) test_bit(nr,addr)
-#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
+#include <asm-generic/bitops/sched.h>
+#include <asm-generic/bitops/hweight.h>
+#include <asm-generic/bitops/ext2-non-atomic.h>
+#include <asm-generic/bitops/ext2-atomic.h>
+#include <asm-generic/bitops/minix.h>
 
 #endif /* __KERNEL__ */
 
Index: 2.6-rc/arch/mips/Kconfig
===================================================================
--- 2.6-rc.orig/arch/mips/Kconfig
+++ 2.6-rc/arch/mips/Kconfig
@@ -800,6 +800,14 @@ config RWSEM_GENERIC_SPINLOCK
 config RWSEM_XCHGADD_ALGORITHM
 	bool
 
+config GENERIC_FIND_NEXT_BIT
+	bool
+	default y
+
+config GENERIC_HWEIGHT
+	bool
+	default y
+
 config GENERIC_CALIBRATE_DELAY
 	bool
 	default y

--

From mita@miraclelinux.com Tue Feb 14 05:06:34 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Feb 2006 05:06:52 +0000 (GMT)
Received: from ns.miraclelinux.com ([219.118.163.66]:41679 "EHLO
	mail01.miraclelinux.com") by ftp.linux-mips.org with ESMTP
	id S3458549AbWBNE6v (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 14 Feb 2006 04:58:51 +0000
Received: from mail01 (localhost.localdomain [127.0.0.1])
	by mail01.miraclelinux.com (Postfix) with ESMTP
	id 138F731C335; Tue, 14 Feb 2006 14:04:47 +0900 (JST)
Received: from localhost.localdomain (sshgate.miraclelinux.com [])
	by mail01.miraclelinux.com ([10.1.0.10]);
	Tue, 14 Feb 2006 05:04:46 +0000
Received: by localhost.localdomain (Postfix, from userid 1000)
	id 5FC4D42023A; Tue, 14 Feb 2006 14:04:44 +0900 (JST)
Message-Id: <20060214050444.235416000@localhost.localdomain>
References: <20060214050351.252615000@localhost.localdomain>
Date:	Tue, 14 Feb 2006 14:04:04 +0900
From:	Akinobu Mita <mita@miraclelinux.com>
To:	linux-kernel@vger.kernel.org
Cc:	akpm@osdl.org, Russell King <rmk@arm.linux.org.uk>,
	Ian Molton <spyro@f2s.com>, dev-etrax@axis.com,
	David Howells <dhowells@redhat.com>,
	Yoshinori Sato <ysato@users.sourceforge.jp>,
	Linus Torvalds <torvalds@osdl.org>, linux-ia64@vger.kernel.org,
	Hirokazu Takata <takata@linux-m32r.org>,
	linux-m68k@lists.linux-m68k.org, Greg Ungerer <gerg@uclinux.org>,
	linux-mips@linux-mips.org, parisc-linux@parisc-linux.org,
	linuxppc-dev@ozlabs.org, linux390@de.ibm.com,
	linuxsh-dev@lists.sourceforge.net,
	linuxsh-shmedia-dev@lists.sourceforge.net,
	sparclinux@vger.kernel.org, ultralinux@vger.kernel.org,
	Miles Bader <uclinux-v850@lsi.nec.co.jp>,
	Andi Kleen <ak@suse.de>, Chris Zankel <chris@zankel.net>,
	Akinobu Mita <mita@miraclelinux.com>
Subject: [patch 13/47] generic sched_find_first_bit()
Content-Disposition: inline; filename=sched-bitops.patch
Return-Path: <mita@miraclelinux.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: 10443
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: mita@miraclelinux.com
Precedence: bulk
X-list: linux-mips
Content-Length: 1517
Lines: 55

This patch introduces the C-language equivalent of the function:
int sched_find_first_bit(const unsigned long *b);

In include/asm-generic/bitops/sched.h

This code largely copied from:
include/asm-powerpc/bitops.h

Signed-off-by: Akinobu Mita <mita@miraclelinux.com>
 include/asm-generic/bitops/sched.h |   36 ++++++++++++++++++++++++++++++++++++
 1 files changed, 36 insertions(+)

Index: 2.6-rc/include/asm-generic/bitops/sched.h
===================================================================
--- /dev/null
+++ 2.6-rc/include/asm-generic/bitops/sched.h
@@ -0,0 +1,36 @@
+#ifndef _ASM_GENERIC_BITOPS_SCHED_H_
+#define _ASM_GENERIC_BITOPS_SCHED_H_
+
+#include <linux/compiler.h>	/* unlikely() */
+#include <asm/types.h>
+
+/*
+ * Every architecture must define this function. It's the fastest
+ * way of searching a 140-bit bitmap where the first 100 bits are
+ * unlikely to be set. It's guaranteed that at least one of the 140
+ * bits is cleared.
+ */
+static inline int sched_find_first_bit(const unsigned long *b)
+{
+#if BITS_PER_LONG == 64
+	if (unlikely(b[0]))
+		return __ffs(b[0]);
+	if (unlikely(b[1]))
+		return __ffs(b[1]) + 64;
+	return __ffs(b[2]) + 128;
+#elif BITS_PER_LONG == 32
+	if (unlikely(b[0]))
+		return __ffs(b[0]);
+	if (unlikely(b[1]))
+		return __ffs(b[1]) + 32;
+	if (unlikely(b[2]))
+		return __ffs(b[2]) + 64;
+	if (b[3])
+		return __ffs(b[3]) + 96;
+	return __ffs(b[4]) + 128;
+#else
+#error BITS_PER_LONG not defined
+#endif
+}
+
+#endif /* _ASM_GENERIC_BITOPS_SCHED_H_ */

--

From mita@miraclelinux.com Tue Feb 14 05:07:21 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Feb 2006 05:07:42 +0000 (GMT)
Received: from ns.miraclelinux.com ([219.118.163.66]:4816 "EHLO
	mail01.miraclelinux.com") by ftp.linux-mips.org with ESMTP
	id S3458570AbWBNE6x (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 14 Feb 2006 04:58:53 +0000
Received: from mail01 (localhost.localdomain [127.0.0.1])
	by mail01.miraclelinux.com (Postfix) with ESMTP
	id 446F531C326; Tue, 14 Feb 2006 14:04:52 +0900 (JST)
Received: from localhost.localdomain (sshgate.miraclelinux.com [])
	by mail01.miraclelinux.com ([10.1.0.10]);
	Tue, 14 Feb 2006 05:04:51 +0000
Received: by localhost.localdomain (Postfix, from userid 1000)
	id E78A542023D; Tue, 14 Feb 2006 14:04:44 +0900 (JST)
Message-Id: <20060214050444.795734000@localhost.localdomain>
References: <20060214050351.252615000@localhost.localdomain>
Date:	Tue, 14 Feb 2006 14:04:07 +0900
From:	Akinobu Mita <mita@miraclelinux.com>
To:	linux-kernel@vger.kernel.org
Cc:	akpm@osdl.org, Richard Henderson <rth@twiddle.net>,
	Ivan Kokshaysky <ink@jurassic.park.msu.ru>, dev-etrax@axis.com,
	David Howells <dhowells@redhat.com>,
	Yoshinori Sato <ysato@users.sourceforge.jp>,
	Linus Torvalds <torvalds@osdl.org>, linux-ia64@vger.kernel.org,
	Hirokazu Takata <takata@linux-m32r.org>,
	linux-m68k@lists.linux-m68k.org, linux-mips@linux-mips.org,
	parisc-linux@parisc-linux.org, linuxsh-dev@lists.sourceforge.net,
	linuxsh-shmedia-dev@lists.sourceforge.net,
	sparclinux@vger.kernel.org, ultralinux@vger.kernel.org,
	Miles Bader <uclinux-v850@lsi.nec.co.jp>,
	Andi Kleen <ak@suse.de>, Chris Zankel <chris@zankel.net>,
	Akinobu Mita <mita@miraclelinux.com>
Subject: [patch 16/47] generic ext2_{set,clear,test,find_first_zero,find_next_zero}_bit()
Content-Disposition: inline; filename=ext2-non-atomic-bitops.patch
Return-Path: <mita@miraclelinux.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: 10444
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: mita@miraclelinux.com
Precedence: bulk
X-list: linux-mips
Content-Length: 6184
Lines: 194

This patch introduces the C-language equivalents of the functions below:

int ext2_set_bit(int nr, volatile unsigned long *addr);
int ext2_clear_bit(int nr, volatile unsigned long *addr);
int ext2_test_bit(int nr, const volatile unsigned long *addr);
unsigned long ext2_find_first_zero_bit(const unsigned long *addr,
                                       unsigned long size);
unsinged long ext2_find_next_zero_bit(const unsigned long *addr,
                                      unsigned long size);

In include/asm-generic/bitops/ext2-non-atomic.h

This code largely copied from:

include/asm-powerpc/bitops.h
include/asm-parisc/bitops.h

Signed-off-by: Akinobu Mita <mita@miraclelinux.com>
 include/asm-generic/bitops/ext2-non-atomic.h |   18 ++++++
 include/asm-generic/bitops/le.h              |   53 +++++++++++++++++++
 lib/find_next_bit.c                          |   73 +++++++++++++++++++++++++++
 3 files changed, 144 insertions(+)

Index: 2.6-rc/include/asm-generic/bitops/ext2-non-atomic.h
===================================================================
--- /dev/null
+++ 2.6-rc/include/asm-generic/bitops/ext2-non-atomic.h
@@ -0,0 +1,18 @@
+#ifndef _ASM_GENERIC_BITOPS_EXT2_NON_ATOMIC_H_
+#define _ASM_GENERIC_BITOPS_EXT2_NON_ATOMIC_H_
+
+#include <asm-generic/bitops/le.h>
+
+#define ext2_set_bit(nr,addr)	\
+	generic___test_and_set_le_bit((nr),(unsigned long *)(addr))
+#define ext2_clear_bit(nr,addr)	\
+	generic___test_and_clear_le_bit((nr),(unsigned long *)(addr))
+
+#define ext2_test_bit(nr,addr)	\
+	generic_test_le_bit((nr),(unsigned long *)(addr))
+#define ext2_find_first_zero_bit(addr, size) \
+	generic_find_first_zero_le_bit((unsigned long *)(addr), (size))
+#define ext2_find_next_zero_bit(addr, size, off) \
+	generic_find_next_zero_le_bit((unsigned long *)(addr), (size), (off))
+
+#endif /* _ASM_GENERIC_BITOPS_EXT2_NON_ATOMIC_H_ */
Index: 2.6-rc/include/asm-generic/bitops/le.h
===================================================================
--- /dev/null
+++ 2.6-rc/include/asm-generic/bitops/le.h
@@ -0,0 +1,53 @@
+#ifndef _ASM_GENERIC_BITOPS_LE_H_
+#define _ASM_GENERIC_BITOPS_LE_H_
+
+#include <asm/types.h>
+#include <asm/byteorder.h>
+
+#define BITOP_WORD(nr)		((nr) / BITS_PER_LONG)
+#define BITOP_LE_SWIZZLE	((BITS_PER_LONG-1) & ~0x7)
+
+#if defined(__LITTLE_ENDIAN)
+
+#define generic_test_le_bit(nr, addr) test_bit(nr, addr)
+#define generic___set_le_bit(nr, addr) __set_bit(nr, addr)
+#define generic___clear_le_bit(nr, addr) __clear_bit(nr, addr)
+
+#define generic_test_and_set_le_bit(nr, addr) test_and_set_bit(nr, addr)
+#define generic_test_and_clear_le_bit(nr, addr) test_and_clear_bit(nr, addr)
+
+#define generic___test_and_set_le_bit(nr, addr) __test_and_set_bit(nr, addr)
+#define generic___test_and_clear_le_bit(nr, addr) __test_and_clear_bit(nr, addr)
+
+#define generic_find_next_zero_le_bit(addr, size, offset) find_next_zero_bit(addr, size, offset)
+
+#elif defined(__BIG_ENDIAN)
+
+#define generic_test_le_bit(nr, addr) \
+	test_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
+#define generic___set_le_bit(nr, addr) \
+	__set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
+#define generic___clear_le_bit(nr, addr) \
+	__clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
+
+#define generic_test_and_set_le_bit(nr, addr) \
+	test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
+#define generic_test_and_clear_le_bit(nr, addr) \
+	test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
+
+#define generic___test_and_set_le_bit(nr, addr) \
+	__test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
+#define generic___test_and_clear_le_bit(nr, addr) \
+	__test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
+
+extern unsigned long generic_find_next_zero_le_bit(const unsigned long *addr,
+		unsigned long size, unsigned long offset);
+
+#else
+#error "Please fix <asm/byteorder.h>"
+#endif
+
+#define generic_find_first_zero_le_bit(addr, size) \
+        generic_find_next_zero_le_bit((addr), (size), 0)
+
+#endif /* _ASM_GENERIC_BITOPS_LE_H_ */
Index: 2.6-rc/lib/find_next_bit.c
===================================================================
--- 2.6-rc.orig/lib/find_next_bit.c
+++ 2.6-rc/lib/find_next_bit.c
@@ -12,6 +12,7 @@
 #include <linux/bitops.h>
 #include <linux/module.h>
 #include <asm/types.h>
+#include <asm/byteorder.h>
 
 #define BITOP_WORD(nr)		((nr) / BITS_PER_LONG)
 
@@ -106,3 +107,75 @@ found_middle:
 }
 
 EXPORT_SYMBOL(find_next_zero_bit);
+
+#ifdef __BIG_ENDIAN
+
+/* include/linux/byteorder does not support "unsigned long" type */
+static inline unsigned long ext2_swabp(const unsigned long * x)
+{
+#if BITS_PER_LONG == 64
+	return (unsigned long) __swab64p((u64 *) x);
+#elif BITS_PER_LONG == 32
+	return (unsigned long) __swab32p((u32 *) x);
+#else
+#error BITS_PER_LONG not defined
+#endif
+}
+
+/* include/linux/byteorder doesn't support "unsigned long" type */
+static inline unsigned long ext2_swab(const unsigned long y)
+{
+#if BITS_PER_LONG == 64
+	return (unsigned long) __swab64((u64) y);
+#elif BITS_PER_LONG == 32
+	return (unsigned long) __swab32((u32) y);
+#else
+#error BITS_PER_LONG not defined
+#endif
+}
+
+unsigned long generic_find_next_zero_le_bit(const unsigned long *addr, unsigned
+		long size, unsigned long offset)
+{
+	const unsigned long *p = addr + BITOP_WORD(offset);
+	unsigned long result = offset & ~(BITS_PER_LONG - 1);
+	unsigned long tmp;
+
+	if (offset >= size)
+		return size;
+	size -= result;
+	offset &= (BITS_PER_LONG - 1UL);
+	if (offset) {
+		tmp = ext2_swabp(p++);
+		tmp |= (~0UL >> (BITS_PER_LONG - offset));
+		if (size < BITS_PER_LONG)
+			goto found_first;
+		if (~tmp)
+			goto found_middle;
+		size -= BITS_PER_LONG;
+		result += BITS_PER_LONG;
+	}
+
+	while (size & ~(BITS_PER_LONG - 1)) {
+		if (~(tmp = *(p++)))
+			goto found_middle_swap;
+		result += BITS_PER_LONG;
+		size -= BITS_PER_LONG;
+	}
+	if (!size)
+		return result;
+	tmp = ext2_swabp(p);
+found_first:
+	tmp |= ~0UL << size;
+	if (tmp == ~0UL)	/* Are any bits zero? */
+		return result + size; /* Nope. Skip ffz */
+found_middle:
+	return result + ffz(tmp);
+
+found_middle_swap:
+	return result + ffz(ext2_swab(tmp));
+}
+
+EXPORT_SYMBOL(generic_find_next_zero_le_bit);
+
+#endif /* __BIG_ENDIAN */

--

From mita@miraclelinux.com Tue Feb 14 05:08:15 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Feb 2006 05:08:33 +0000 (GMT)
Received: from ns.miraclelinux.com ([219.118.163.66]:63439 "EHLO
	mail01.miraclelinux.com") by ftp.linux-mips.org with ESMTP
	id S3458553AbWBNE6x (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 14 Feb 2006 04:58:53 +0000
Received: from mail01 (localhost.localdomain [127.0.0.1])
	by mail01.miraclelinux.com (Postfix) with ESMTP
	id B288F31C351; Tue, 14 Feb 2006 14:04:53 +0900 (JST)
Received: from localhost.localdomain (sshgate.miraclelinux.com [])
	by mail01.miraclelinux.com ([10.1.0.10]);
	Tue, 14 Feb 2006 05:04:51 +0000
Received: by localhost.localdomain (Postfix, from userid 1000)
	id 5AF07420235; Tue, 14 Feb 2006 14:04:45 +0900 (JST)
Message-Id: <20060214050445.212426000@localhost.localdomain>
References: <20060214050351.252615000@localhost.localdomain>
Date:	Tue, 14 Feb 2006 14:04:09 +0900
From:	Akinobu Mita <mita@miraclelinux.com>
To:	linux-kernel@vger.kernel.org
Cc:	akpm@osdl.org, Richard Henderson <rth@twiddle.net>,
	Ivan Kokshaysky <ink@jurassic.park.msu.ru>, dev-etrax@axis.com,
	David Howells <dhowells@redhat.com>,
	Yoshinori Sato <ysato@users.sourceforge.jp>,
	Linus Torvalds <torvalds@osdl.org>, linux-ia64@vger.kernel.org,
	Hirokazu Takata <takata@linux-m32r.org>,
	Greg Ungerer <gerg@uclinux.org>, linux-mips@linux-mips.org,
	linux390@de.ibm.com, linuxsh-dev@lists.sourceforge.net,
	linuxsh-shmedia-dev@lists.sourceforge.net,
	sparclinux@vger.kernel.org, ultralinux@vger.kernel.org,
	Miles Bader <uclinux-v850@lsi.nec.co.jp>,
	Andi Kleen <ak@suse.de>, Chris Zankel <chris@zankel.net>,
	Akinobu Mita <mita@miraclelinux.com>
Subject: [patch 18/47] generic minix_{test,set,test_and_clear,test,find_first_zero}_bit()
Content-Disposition: inline; filename=minix-bitops.patch
Return-Path: <mita@miraclelinux.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: 10445
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: mita@miraclelinux.com
Precedence: bulk
X-list: linux-mips
Content-Length: 2458
Lines: 65

This patch introduces the C-language equivalents of the functions below:

int minix_test_and_set_bit(int nr, volatile unsigned long *addr);
int minix_set_bit(int nr, volatile unsigned long *addr);
int minix_test_and_clear_bit(int nr, volatile unsigned long *addr);
int minix_test_bit(int nr, const volatile unsigned long *addr);
unsigned long minix_find_first_zero_bit(const unsigned long *addr,
                                        unsigned long size);

In include/asm-generic/bitops/minix.h
   and include/asm-generic/bitops/minix-le.h

This code largely copied from:
include/asm-sparc/bitops.h

Signed-off-by: Akinobu Mita <mita@miraclelinux.com>

 include/asm-generic/bitops/minix-le.h |   17 +++++++++++++++++
 include/asm-generic/bitops/minix.h    |   15 +++++++++++++++
 2 files changed, 32 insertions(+)

Index: 2.6-rc/include/asm-generic/bitops/minix.h
===================================================================
--- /dev/null
+++ 2.6-rc/include/asm-generic/bitops/minix.h
@@ -0,0 +1,15 @@
+#ifndef _ASM_GENERIC_BITOPS_MINIX_H_
+#define _ASM_GENERIC_BITOPS_MINIX_H_
+
+#define minix_test_and_set_bit(nr,addr)	\
+	__test_and_set_bit((nr),(unsigned long *)(addr))
+#define minix_set_bit(nr,addr)		\
+	__set_bit((nr),(unsigned long *)(addr))
+#define minix_test_and_clear_bit(nr,addr) \
+	__test_and_clear_bit((nr),(unsigned long *)(addr))
+#define minix_test_bit(nr,addr)		\
+	test_bit((nr),(unsigned long *)(addr))
+#define minix_find_first_zero_bit(addr,size) \
+	find_first_zero_bit((unsigned long *)(addr),(size))
+
+#endif /* _ASM_GENERIC_BITOPS_MINIX_H_ */
Index: 2.6-rc/include/asm-generic/bitops/minix-le.h
===================================================================
--- /dev/null
+++ 2.6-rc/include/asm-generic/bitops/minix-le.h
@@ -0,0 +1,17 @@
+#ifndef _ASM_GENERIC_BITOPS_MINIX_LE_H_
+#define _ASM_GENERIC_BITOPS_MINIX_LE_H_
+
+#include <asm-generic/bitops/le.h>
+
+#define minix_test_and_set_bit(nr,addr)	\
+	generic___test_and_set_le_bit((nr),(unsigned long *)(addr))
+#define minix_set_bit(nr,addr)		\
+	generic___set_le_bit((nr),(unsigned long *)(addr))
+#define minix_test_and_clear_bit(nr,addr) \
+	generic___test_and_clear_le_bit((nr),(unsigned long *)(addr))
+#define minix_test_bit(nr,addr)		\
+	generic_test_le_bit((nr),(unsigned long *)(addr))
+#define minix_find_first_zero_bit(addr,size) \
+	generic_find_first_zero_le_bit((unsigned long *)(addr),(size))
+
+#endif /* _ASM_GENERIC_BITOPS_MINIX_LE_H_ */

--

From mita@miraclelinux.com Tue Feb 14 05:09:04 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Feb 2006 05:09:25 +0000 (GMT)
Received: from ns.miraclelinux.com ([219.118.163.66]:55247 "EHLO
	mail01.miraclelinux.com") by ftp.linux-mips.org with ESMTP
	id S3458571AbWBNE6y (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 14 Feb 2006 04:58:54 +0000
Received: from mail01 (localhost.localdomain [127.0.0.1])
	by mail01.miraclelinux.com (Postfix) with ESMTP
	id BF78F31C328; Tue, 14 Feb 2006 14:04:50 +0900 (JST)
Received: from localhost.localdomain (sshgate.miraclelinux.com [])
	by mail01.miraclelinux.com ([10.1.0.10]);
	Tue, 14 Feb 2006 05:04:47 +0000
Received: by localhost.localdomain (Postfix, from userid 1000)
	id 02042420233; Tue, 14 Feb 2006 14:04:43 +0900 (JST)
Message-Id: <20060214050443.852246000@localhost.localdomain>
References: <20060214050351.252615000@localhost.localdomain>
Date:	Tue, 14 Feb 2006 14:04:02 +0900
From:	Akinobu Mita <mita@miraclelinux.com>
To:	linux-kernel@vger.kernel.org
Cc:	akpm@osdl.org, Richard Henderson <rth@twiddle.net>,
	Ivan Kokshaysky <ink@jurassic.park.msu.ru>,
	Russell King <rmk@arm.linux.org.uk>,
	Ian Molton <spyro@f2s.com>, dev-etrax@axis.com,
	David Howells <dhowells@redhat.com>,
	Yoshinori Sato <ysato@users.sourceforge.jp>,
	Linus Torvalds <torvalds@osdl.org>, linux-ia64@vger.kernel.org,
	Hirokazu Takata <takata@linux-m32r.org>,
	linux-m68k@lists.linux-m68k.org, Greg Ungerer <gerg@uclinux.org>,
	linux-mips@linux-mips.org, parisc-linux@parisc-linux.org,
	linuxppc-dev@ozlabs.org, linux390@de.ibm.com,
	linuxsh-dev@lists.sourceforge.net,
	linuxsh-shmedia-dev@lists.sourceforge.net,
	sparclinux@vger.kernel.org, ultralinux@vger.kernel.org,
	Miles Bader <uclinux-v850@lsi.nec.co.jp>,
	Andi Kleen <ak@suse.de>, Chris Zankel <chris@zankel.net>,
	Akinobu Mita <mita@miraclelinux.com>
Subject: [patch 11/47] generic fls64()
Content-Disposition: inline; filename=fls64.patch
Return-Path: <mita@miraclelinux.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: 10446
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: mita@miraclelinux.com
Precedence: bulk
X-list: linux-mips
Content-Length: 755
Lines: 31

This patch introduces the C-language equivalent of the function:
int fls64(__u64 x);

In include/asm-generic/bitops/fls64.h

This code largely copied from:
include/linux/bitops.h

Signed-off-by: Akinobu Mita <mita@miraclelinux.com>
 include/asm-generic/bitops/fls64.h |   12 ++++++++++++
 1 files changed, 12 insertions(+)

Index: 2.6-rc/include/asm-generic/bitops/fls64.h
===================================================================
--- /dev/null
+++ 2.6-rc/include/asm-generic/bitops/fls64.h
@@ -0,0 +1,12 @@
+#ifndef _ASM_GENERIC_BITOPS_FLS64_H_
+#define _ASM_GENERIC_BITOPS_FLS64_H_
+
+static inline int fls64(__u64 x)
+{
+	__u32 h = x >> 32;
+	if (h)
+		return fls(h) + 32;
+	return fls(x);
+}
+
+#endif /* _ASM_GENERIC_BITOPS_FLS64_H_ */

--

From hjl@lucon.org Tue Feb 14 06:04:55 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Feb 2006 06:05:09 +0000 (GMT)
Received: from smtp107.sbc.mail.mud.yahoo.com ([68.142.198.206]:8021 "HELO
	smtp107.sbc.mail.mud.yahoo.com") by ftp.linux-mips.org with SMTP
	id S8133421AbWBNGEz (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 14 Feb 2006 06:04:55 +0000
Received: (qmail 12119 invoked from network); 14 Feb 2006 06:11:08 -0000
Received: from unknown (HELO lucon.org) (hjjean@sbcglobal.net@69.232.202.246 with login)
  by smtp107.sbc.mail.mud.yahoo.com with SMTP; 14 Feb 2006 06:11:08 -0000
Received: by lucon.org (Postfix, from userid 1000)
	id 3325C63EED; Mon, 13 Feb 2006 22:11:07 -0800 (PST)
Date:	Mon, 13 Feb 2006 22:11:07 -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>
Subject: The Linux binutils 2.16.91.0.6 is released
Message-ID: <20060214061107.GA7047@lucon.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.4.2.1i
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: 10447
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
Content-Length: 13204
Lines: 424

This is the beta release of binutils 2.16.91.0.6 for Linux, which is
based on binutils 2006 0212 in CVS on sources.redhat.com plus various
changes. It is purely for Linux.

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.16.91.0.6 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.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.16.91.0.6.tar.bz2. Source code.
2. binutils-2.16.91.0.5-2.16.91.0.6.diff.bz2. Patch against the
   previous beta source code.
3. binutils-2.16.91.0.6-1.i386.rpm. IA-32 binary RPM for RedHat EL 4.
4. binutils-2.16.91.0.6-1.ia64.rpm. IA-64 binary RPM for RedHat EL 4.
5. binutils-2.16.91.0.6-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.16.91.0.6.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
02/13/2006
Reply-To: 


From anemo@mba.ocn.ne.jp Tue Feb 14 06:51:35 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Feb 2006 06:51:47 +0000 (GMT)
Received: from topsns2.toshiba-tops.co.jp ([202.230.225.126]:54662 "EHLO
	topsns2.toshiba-tops.co.jp") by ftp.linux-mips.org with ESMTP
	id S8133421AbWBNGvf (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 14 Feb 2006 06:51: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; Tue, 14 Feb 2006 15:57:54 +0900
Received: from topsms.toshiba-tops.co.jp (localhost.localdomain [127.0.0.1])
	by localhost.toshiba-tops.co.jp (Postfix) with ESMTP id 41862203DE;
	Tue, 14 Feb 2006 15:57:52 +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 3400F203D8;
	Tue, 14 Feb 2006 15:57:52 +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 k1E6vp4D075145;
	Tue, 14 Feb 2006 15:57:51 +0900 (JST)
	(envelope-from anemo@mba.ocn.ne.jp)
Date:	Tue, 14 Feb 2006 15:57:50 +0900 (JST)
Message-Id: <20060214.155750.93206425.nemoto@toshiba-tops.co.jp>
To:	ralf@linux-mips.org
Cc:	tbm@cyrius.com, linux-mips@linux-mips.org, anderson@netsweng.com,
	ddaney@avtrex.com, richard@codesourcery.com
Subject: Re: Fixes for uaccess.h with gcc >= 4.0.1
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
In-Reply-To: <20060211.224420.25910222.anemo@mba.ocn.ne.jp>
References: <87wtg6c43s.fsf@talisman.home>
	<20060210013440.GA5436@linux-mips.org>
	<20060211.224420.25910222.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: 10448
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
Content-Length: 1457
Lines: 44

>>>>> On Sat, 11 Feb 2006 22:44:20 +0900 (JST), Atsushi Nemoto <anemo@mba.ocn.ne.jp> said:
anemo> Please add this cast to fix compiler/sparse warnings?

Sorry, please ignore this patch.  It would be wrong.


It seems current get_user() incorrectly sign-extend an unsigned int
value on 64bit kernel.  I think this is because '(__typeof__(val))'
cast in final assignment.  I suppose the cast should be
'(__typeof__(*(addr))'.

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

diff --git a/include/asm-mips/uaccess.h b/include/asm-mips/uaccess.h
index 7a553e9..b96f3e0 100644
--- a/include/asm-mips/uaccess.h
+++ b/include/asm-mips/uaccess.h
@@ -233,7 +233,7 @@ do {									\
 #define __get_user_check(x,ptr,size)					\
 ({									\
 	long __gu_err = -EFAULT;					\
-	const void __user * __gu_ptr = (ptr);				\
+	const __typeof__(*(ptr)) __user * __gu_ptr = (ptr);		\
 									\
 	if (likely(access_ok(VERIFY_READ,  __gu_ptr, size)))		\
 		__get_user_common((x), size, __gu_ptr);			\
@@ -258,7 +258,7 @@ do {									\
 	: "=r" (__gu_err), "=r" (__gu_tmp)				\
 	: "0" (0), "o" (__m(addr)), "i" (-EFAULT));			\
 									\
-	(val) = (__typeof__(val)) __gu_tmp;				\
+	(val) = (__typeof__(*(addr))) __gu_tmp;				\
 }
 
 /*
@@ -284,7 +284,7 @@ do {									\
 	"	.previous					\n"	\
 	: "=r" (__gu_err), "=&r" (__gu_tmp)				\
 	: "0" (0), "r" (addr), "i" (-EFAULT));				\
-	(val) = __gu_tmp;						\
+	(val) = (__typeof__(*(addr))) __gu_tmp;				\
 }
 
 /*

From yoichi_yuasa@tripeaks.co.jp Tue Feb 14 07:01:12 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Feb 2006 07:01:27 +0000 (GMT)
Received: from mo01.po.2iij.net ([210.130.202.205]:50657 "EHLO
	mo01.po.2iij.net") by ftp.linux-mips.org with ESMTP
	id S3465560AbWBNHBM (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 14 Feb 2006 07:01:12 +0000
Received: NPO MO01 id k1E77Une013870; Tue, 14 Feb 2006 16:07:30 +0900 (JST)
Received: from localhost.localdomain (65.126.232.202.bf.2iij.net [202.232.126.65])
	by mbox.po.2iij.net (NPO-MR/mbox00) id k1E77Tah013064
	(version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NOT);
	Tue, 14 Feb 2006 16:07:29 +0900 (JST)
Message-Id: <200602140707.k1E77Tah013064@mbox00.po.2iij.net>
Date:	Tue, 14 Feb 2006 16:07:29 +0900
From:	Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
To:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc:	yoichi_yuasa@tripeaks.co.jp, linux-mips@linux-mips.org,
	ralf@linux-mips.org
Subject: Re: [PATCH] fix cache coherency issues
In-Reply-To: <20060214.120846.15248106.nemoto@toshiba-tops.co.jp>
References: <20060214105928.0cd46e6f.yoichi_yuasa@tripeaks.co.jp>
	<20060214.111547.21591480.nemoto@toshiba-tops.co.jp>
	<20060214112653.25ed3e05.yoichi_yuasa@tripeaks.co.jp>
	<20060214.120846.15248106.nemoto@toshiba-tops.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-Envid: tripeaks.co.jp
Envelope-Id: tripeaks.co.jp
X-archive-position: 10449
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
Content-Length: 433
Lines: 16

Hi,

On Tue, 14 Feb 2006 12:08:46 +0900 (JST)
Atsushi Nemoto <anemo@mba.ocn.ne.jp> wrote:

> >>>>> On Tue, 14 Feb 2006 11:26:53 +0900, Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp> said:
> yuasa> Here is the boot log.
> 
> Thanks.  Could you try with this patch?
> 
> http://www.linux-mips.org/cgi-bin/mesg.cgi?a=linux-mips&i=20060204.015356.74753400.anemo%40mba.ocn.ne.jp

I added the patch and tested it.
It has same problem.

Yoichi

From anemo@mba.ocn.ne.jp Tue Feb 14 07:35:59 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Feb 2006 07:36:16 +0000 (GMT)
Received: from topsns2.toshiba-tops.co.jp ([202.230.225.126]:32799 "EHLO
	topsns2.toshiba-tops.co.jp") by ftp.linux-mips.org with ESMTP
	id S8133381AbWBNHf7 (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 14 Feb 2006 07:35:59 +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, 14 Feb 2006 16:42:19 +0900
Received: from topsms.toshiba-tops.co.jp (localhost.localdomain [127.0.0.1])
	by localhost.toshiba-tops.co.jp (Postfix) with ESMTP id 6D06B20356;
	Tue, 14 Feb 2006 16:42:17 +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 6267E1FFEB;
	Tue, 14 Feb 2006 16:42:17 +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 k1E7gG4D075294;
	Tue, 14 Feb 2006 16:42:16 +0900 (JST)
	(envelope-from anemo@mba.ocn.ne.jp)
Date:	Tue, 14 Feb 2006 16:42:16 +0900 (JST)
Message-Id: <20060214.164216.48797359.nemoto@toshiba-tops.co.jp>
To:	yoichi_yuasa@tripeaks.co.jp
Cc:	linux-mips@linux-mips.org, ralf@linux-mips.org
Subject: Re: [PATCH] fix cache coherency issues
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
In-Reply-To: <200602140707.k1E77Tah013064@mbox00.po.2iij.net>
References: <20060214112653.25ed3e05.yoichi_yuasa@tripeaks.co.jp>
	<20060214.120846.15248106.nemoto@toshiba-tops.co.jp>
	<200602140707.k1E77Tah013064@mbox00.po.2iij.net>
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: 10450
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
Content-Length: 1274
Lines: 36

>>>>> On Tue, 14 Feb 2006 16:07:29 +0900, Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp> said:
yuasa> I added the patch and tested it.  It has same problem.

Thank you.  I realize the reason just now.  VR41XX's PTE format is a
bit different from others.  I should use mk_pte() to wrap these
difference.

Could you try this patch?  64BIT_PHYS_ADDR + MIPS32_R1 part are not
tested ;-)

--- linux-mips/arch/mips/mm/init.c	2006-02-14 15:30:58.000000000 +0900
+++ linux/arch/mips/mm/init.c	2006-02-14 16:29:51.000000000 +0900
@@ -95,6 +95,7 @@ static inline void *kmap_coherent(struct
 	unsigned long asid;
 	unsigned int vpflags;
 	unsigned int wired;
+	pte_t pte;
 
 	if (!cpu_has_dc_aliases)
 		return page_address(page);
@@ -111,8 +112,13 @@ static inline void *kmap_coherent(struct
 	wired = read_c0_wired();
 	write_c0_wired(wired + 1);
 	write_c0_index(wired);
-	write_c0_entryhi(vaddr & ~0x1fffUL);
-	entrylo = (page_to_pfn(page) << 6) | (pgprot_val(PAGE_KERNEL) >> 6);
+	write_c0_entryhi(vaddr & (PAGE_MASK << 1));
+	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
 	write_c0_entrylo0(entrylo);
 	write_c0_entrylo1(entrylo);
 	mtc0_tlbw_hazard();

From yoichi_yuasa@tripeaks.co.jp Tue Feb 14 08:50:40 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Feb 2006 08:51:49 +0000 (GMT)
Received: from mo00.po.2iij.net ([210.130.202.204]:58347 "EHLO
	mo00.po.2iij.net") by ftp.linux-mips.org with ESMTP
	id S8133381AbWBNIuk (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 14 Feb 2006 08:50:40 +0000
Received: NPO MO00 id k1E8uwNw019520; Tue, 14 Feb 2006 17:56:58 +0900 (JST)
Received: from localhost.localdomain (65.126.232.202.bf.2iij.net [202.232.126.65])
	by mbox.po.2iij.net (NPO-MR/mbox03) id k1E8uvm1021728
	(version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NOT);
	Tue, 14 Feb 2006 17:56:57 +0900 (JST)
Message-Id: <200602140856.k1E8uvm1021728@mbox03.po.2iij.net>
Date:	Tue, 14 Feb 2006 17:56:57 +0900
From:	Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
To:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc:	yoichi_yuasa@tripeaks.co.jp, linux-mips@linux-mips.org,
	ralf@linux-mips.org
Subject: Re: [PATCH] fix cache coherency issues
In-Reply-To: <20060214.164216.48797359.nemoto@toshiba-tops.co.jp>
References: <20060214112653.25ed3e05.yoichi_yuasa@tripeaks.co.jp>
	<20060214.120846.15248106.nemoto@toshiba-tops.co.jp>
	<200602140707.k1E77Tah013064@mbox00.po.2iij.net>
	<20060214.164216.48797359.nemoto@toshiba-tops.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-Envid: tripeaks.co.jp
Envelope-Id: tripeaks.co.jp
X-archive-position: 10451
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
Content-Length: 1222
Lines: 36

On Tue, 14 Feb 2006 16:42:16 +0900 (JST)
Atsushi Nemoto <anemo@mba.ocn.ne.jp> wrote:

> >>>>> On Tue, 14 Feb 2006 16:07:29 +0900, Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp> said:
> yuasa> I added the patch and tested it.  It has same problem.
> 
> Thank you.  I realize the reason just now.  VR41XX's PTE format is a
> bit different from others.  I should use mk_pte() to wrap these
> difference.
> 
> Could you try this patch?  64BIT_PHYS_ADDR + MIPS32_R1 part are not
> tested ;-)

This patch fixed the boot problem, but the kernel still has cache coherency problem.

~# ./cachetest 
Test separation: 4096 bytes: FAIL - cache not coherent
Test separation: 8192 bytes: pass
Test separation: 16384 bytes: pass
Test separation: 32768 bytes: pass
Test separation: 65536 bytes: pass
Test separation: 131072 bytes: pass
Test separation: 262144 bytes: pass
Test separation: 524288 bytes: pass
Test separation: 1048576 bytes: pass
Test separation: 2097152 bytes: pass
Test separation: 4194304 bytes: pass
Test separation: 8388608 bytes: pass
Test separation: 16777216 bytes: pass
VM page alias coherency test: minimum fast spacing: 8192 (2 pages)

I'm using the following test program.

http://lkml.org/lkml/2003/8/29/6

Yoichi

From macro@linux-mips.org Tue Feb 14 09:50:28 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Feb 2006 09:50:36 +0000 (GMT)
Received: from pollux.ds.pg.gda.pl ([153.19.208.7]:10001 "EHLO
	pollux.ds.pg.gda.pl") by ftp.linux-mips.org with ESMTP
	id S8133421AbWBNJu2 (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 14 Feb 2006 09:50:28 +0000
Received: from localhost (localhost [127.0.0.1])
	by pollux.ds.pg.gda.pl (Postfix) with ESMTP id 234C1F5CE7;
	Tue, 14 Feb 2006 10:56:27 +0100 (CET)
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 03833-02-2; Tue, 14 Feb 2006 10:56:26 +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 05D19F6256;
	Tue, 14 Feb 2006 10:53:22 +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.3/8.13.1) with ESMTP id k1E9mXRe015620;
	Tue, 14 Feb 2006 10:49:19 +0100
Date:	Tue, 14 Feb 2006 09:48:19 +0000 (GMT)
From:	"Maciej W. Rozycki" <macro@linux-mips.org>
To:	Martin Michlmayr <tbm@cyrius.com>
cc:	Ralf Baechle <ralf@linux-mips.org>,
	"Peter 'p2' De Schrijver" <p2@mind.be>, linux-mips@linux-mips.org
Subject: Re: DECstation R3000 boot error
In-Reply-To: <20060213225927.GB4226@deprecation.cyrius.com>
Message-ID: <Pine.LNX.4.64N.0602140946470.14255@blysk.ds.pg.gda.pl>
References: <20060123225040.GA23576@deprecation.cyrius.com>
 <Pine.LNX.4.64N.0601241059140.11021@blysk.ds.pg.gda.pl>
 <20060124122700.GA8527@deprecation.cyrius.com>
 <Pine.LNX.4.64N.0601241227290.11021@blysk.ds.pg.gda.pl> <20060124232117.GA4165@codecarver>
 <Pine.LNX.4.64N.0601251103020.7675@blysk.ds.pg.gda.pl>
 <20060203150232.GA25701@deprecation.cyrius.com>
 <Pine.LNX.4.64N.0602061021110.32080@blysk.ds.pg.gda.pl>
 <Pine.LNX.4.64N.0602130911260.17051@blysk.ds.pg.gda.pl>
 <20060213225927.GB4226@deprecation.cyrius.com>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Virus-Scanned: ClamAV 0.87.1/1287/Mon Feb 13 22:29:18 2006 on piorun.ds.pg.gda.pl
X-Virus-Status:	Clean
X-Virus-Scanned: by amavisd-new at pollux.ds.pg.gda.pl
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: 10452
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
Content-Length: 439
Lines: 21

On Mon, 13 Feb 2006, Martin Michlmayr wrote:

> @@ -631,6 +633,13 @@
>  # CONFIG_FB_VIRTUAL is not set
>  
>  #
> +# Console display driver support
> +#
> +CONFIG_VGA_CONSOLE=y
> +CONFIG_DUMMY_CONSOLE=y
> +# CONFIG_FRAMEBUFFER_CONSOLE is not set
> +
> +#
>  # Logo configuration
>  #
>  CONFIG_LOGO=y

 Hmm, VGA_CONSOLE doesn't make much sense for the DECstation, does it?  
You might want to select FRAMEBUFFER_CONSOLE instead.

  Maciej

From macro@linux-mips.org Tue Feb 14 09:55:32 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Feb 2006 09:55:41 +0000 (GMT)
Received: from pollux.ds.pg.gda.pl ([153.19.208.7]:24584 "EHLO
	pollux.ds.pg.gda.pl") by ftp.linux-mips.org with ESMTP
	id S8133421AbWBNJzc (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 14 Feb 2006 09:55:32 +0000
Received: from localhost (localhost [127.0.0.1])
	by pollux.ds.pg.gda.pl (Postfix) with ESMTP id 5308DF5A2C;
	Tue, 14 Feb 2006 11:01:52 +0100 (CET)
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 13880-09; Tue, 14 Feb 2006 11:01:52 +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 1350DE1C65;
	Tue, 14 Feb 2006 11:01:52 +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.3/8.13.1) with ESMTP id k1EA1iEn018207;
	Tue, 14 Feb 2006 11:01:45 +0100
Date:	Tue, 14 Feb 2006 10:01:51 +0000 (GMT)
From:	"Maciej W. Rozycki" <macro@linux-mips.org>
To:	Martin Michlmayr <tbm@cyrius.com>
cc:	linux-mips@linux-mips.org
Subject: Re: DECstation R3000 boot error
In-Reply-To: <20060213232329.GA8286@deprecation.cyrius.com>
Message-ID: <Pine.LNX.4.64N.0602140950200.14255@blysk.ds.pg.gda.pl>
References: <20060123225040.GA23576@deprecation.cyrius.com>
 <Pine.LNX.4.64N.0601241059140.11021@blysk.ds.pg.gda.pl>
 <20060124122700.GA8527@deprecation.cyrius.com>
 <Pine.LNX.4.64N.0601241227290.11021@blysk.ds.pg.gda.pl> <20060124232117.GA4165@codecarver>
 <Pine.LNX.4.64N.0601251103020.7675@blysk.ds.pg.gda.pl>
 <20060203150232.GA25701@deprecation.cyrius.com>
 <Pine.LNX.4.64N.0602061021110.32080@blysk.ds.pg.gda.pl>
 <Pine.LNX.4.64N.0602130911260.17051@blysk.ds.pg.gda.pl>
 <20060213225927.GB4226@deprecation.cyrius.com> <20060213232329.GA8286@deprecation.cyrius.com>
MIME-Version: 1.0
Content-Type: MULTIPART/MIXED; BOUNDARY="328795856-308165493-1139911311=:14255"
X-Virus-Scanned: ClamAV 0.87.1/1287/Mon Feb 13 22:29:18 2006 on piorun.ds.pg.gda.pl
X-Virus-Status:	Clean
X-Virus-Scanned: by amavisd-new at pollux.ds.pg.gda.pl
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: 10453
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
Content-Length: 1652
Lines: 36

  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.

--328795856-308165493-1139911311=:14255
Content-Type: TEXT/PLAIN; charset=utf-8
Content-Transfer-Encoding: 8BIT

On Mon, 13 Feb 2006, Martin Michlmayr wrote:

> OK, I got it down to:
> 
>   CC      drivers/tc/lk201.o
> drivers/tc/lk201.c: In function â€lk201_rx_charâ€™:
> drivers/tc/lk201.c:361: warning: implicit declaration of function â€handle_scancodeâ€™
> drivers/tc/lk201.c: In function â€lk201_initâ€™:
> drivers/tc/lk201.c:405: error: invalid lvalue in assignment
> drivers/tc/lk201.c:406: error: invalid lvalue in assignment
> make[2]: *** [drivers/tc/lk201.o] Error 1
> 
> But this driver really needs to be ported to the new input interface.

 The driver has been ported by JBG (thanks!) -- it's the zs.c driver that 
needs to be ported to the new serial infrastructure.  But that's tough if 
to be done properly (DMA and synchronous modes are not handled well by the 
serial core), so not at the moment, sorry.  I'll think about minimal 
functionality to keep it going though and perhaps lk201.c could be changed 
to work with current zs.c as is (dz.c has already been ported -- I have no 
way of testing it, so I somewhat lack incentive to go through it and 
verify if it's at least as good as the old driver in 2.4.)...

 I'm not sure what your patch is meant to do, but if changing rate to 
period you need to invert the values as well -- period = 1 / rate -- and 
the hardware expects rates in cps IIRC; mind the units, though.

  Maciej
--328795856-308165493-1139911311=:14255--

From anemo@mba.ocn.ne.jp Tue Feb 14 10:05:58 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Feb 2006 10:06:08 +0000 (GMT)
Received: from topsns2.toshiba-tops.co.jp ([202.230.225.126]:36046 "EHLO
	topsns2.toshiba-tops.co.jp") by ftp.linux-mips.org with ESMTP
	id S8133421AbWBNKF6 (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 14 Feb 2006 10:05:58 +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, 14 Feb 2006 19:12: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 CD5C4200BA;
	Tue, 14 Feb 2006 19:12: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 C0DE31F4B9;
	Tue, 14 Feb 2006 19:12: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 k1EACF4D076129;
	Tue, 14 Feb 2006 19:12:15 +0900 (JST)
	(envelope-from anemo@mba.ocn.ne.jp)
Date:	Tue, 14 Feb 2006 19:12:15 +0900 (JST)
Message-Id: <20060214.191215.115641299.nemoto@toshiba-tops.co.jp>
To:	yoichi_yuasa@tripeaks.co.jp
Cc:	anemo@mba.ocn.ne.jp, linux-mips@linux-mips.org, ralf@linux-mips.org
Subject: Re: [PATCH] fix cache coherency issues
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
In-Reply-To: <200602140856.k1E8uvm1021728@mbox03.po.2iij.net>
References: <200602140707.k1E77Tah013064@mbox00.po.2iij.net>
	<20060214.164216.48797359.nemoto@toshiba-tops.co.jp>
	<200602140856.k1E8uvm1021728@mbox03.po.2iij.net>
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: 10454
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
Content-Length: 776
Lines: 21

>>>>> On Tue, 14 Feb 2006 17:56:57 +0900, Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp> said:
yuasa> This patch fixed the boot problem, but the kernel still has
yuasa> cache coherency problem.

yuasa> ~# ./cachetest 
yuasa> Test separation: 4096 bytes: FAIL - cache not coherent

Thank you for testing.

As for the cachetest program, I think the test program is wrong.

It try to mmap offset 0 of a shared file to odd address page with
MAP_FIXED.  It means "I want non-coherent mapping if dcache alias
exists".  Currently the kernel surely gives what the program want.

The kernel might have to return EINVAL in such case, but I'm not sure
which is the right behavior.  Please look at David S. Miller's
comments, for example, http://lkml.org/lkml/2003/9/1/48

---
Atsushi Nemoto

From kamezawa.hiroyu@jp.fujitsu.com Tue Feb 14 10:28:28 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Feb 2006 10:28:37 +0000 (GMT)
Received: from fgwmail5.fujitsu.co.jp ([192.51.44.35]:10904 "EHLO
	fgwmail5.fujitsu.co.jp") by ftp.linux-mips.org with ESMTP
	id S8133421AbWBNK22 (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 14 Feb 2006 10:28:28 +0000
Received: from m2.gw.fujitsu.co.jp ([10.0.50.72])
        by fgwmail5.fujitsu.co.jp (Fujitsu Gateway)
        with ESMTP id k1EAYfwM030035; Tue, 14 Feb 2006 19:34:41 +0900
        (envelope-from kamezawa.hiroyu@jp.fujitsu.com)
Received: from s5.gw.fujitsu.co.jp by m2.gw.fujitsu.co.jp (8.12.10/Fujitsu Domain Master)
	id k1EAYdY7027268; Tue, 14 Feb 2006 19:34:40 +0900
	(envelope-from kamezawa.hiroyu@jp.fujitsu.com)
Received: from s5.gw.fujitsu.co.jp (s5 [127.0.0.1])
	by s5.gw.fujitsu.co.jp (Postfix) with ESMTP id CCD1D1B8057;
	Tue, 14 Feb 2006 19:34:39 +0900 (JST)
Received: from fjm503.ms.jp.fujitsu.com (fjm503.ms.jp.fujitsu.com [10.56.99.77])
	by s5.gw.fujitsu.co.jp (Postfix) with ESMTP id 186131B805C;
	Tue, 14 Feb 2006 19:34:39 +0900 (JST)
Received: from [127.0.0.1] (fjmscan501.ms.jp.fujitsu.com [10.56.99.141])by fjm503.ms.jp.fujitsu.com with ESMTP id k1EAYYg7006708;
	Tue, 14 Feb 2006 19:34:36 +0900
Message-ID: <43F1B29B.3030909@jp.fujitsu.com>
Date:	Tue, 14 Feb 2006 19:36:11 +0900
From:	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
User-Agent: Thunderbird 1.5 (Windows/20051201)
MIME-Version: 1.0
To:	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
CC:	Andrew Morton <akpm@osdl.org>, linux-mips@linux-mips.org
Subject: [PATCH] unify pfn_to_page take3 [12/23] mips pfn_to_page
References: <43F1A753.2020003@jp.fujitsu.com>
In-Reply-To: <43F1A753.2020003@jp.fujitsu.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Return-Path: <kamezawa.hiroyu@jp.fujitsu.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: 10455
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: kamezawa.hiroyu@jp.fujitsu.com
Precedence: bulk
X-list: linux-mips
Content-Length: 1592
Lines: 59

MIPS can use generic funcs.

Signed-Off-By: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>

Index: testtree/include/asm-mips/mmzone.h
===================================================================
--- testtree.orig/include/asm-mips/mmzone.h
+++ testtree/include/asm-mips/mmzone.h
@@ -22,20 +22,6 @@
  		       NODE_DATA(__n)->node_spanned_pages) : 0);\
  })

-#define pfn_to_page(pfn)					\
-({								\
- 	unsigned long __pfn = (pfn);				\
-	pg_data_t *__pg = NODE_DATA(pfn_to_nid(__pfn));		\
-	__pg->node_mem_map + (__pfn - __pg->node_start_pfn);	\
-})
-
-#define page_to_pfn(p)						\
-({								\
-	struct page *__p = (p);					\
-	struct zone *__z = page_zone(__p);			\
-	((__p - __z->zone_mem_map) + __z->zone_start_pfn);	\
-})
-
  /* XXX: FIXME -- wli */
  #define kern_addr_valid(addr)	(0)

Index: testtree/include/asm-mips/page.h
===================================================================
--- testtree.orig/include/asm-mips/page.h
+++ testtree/include/asm-mips/page.h
@@ -17,6 +17,7 @@

  #endif

+
  /*
   * PAGE_SHIFT determines the page size
   */
@@ -140,8 +141,6 @@ typedef struct { unsigned long pgprot; }
  #define pfn_to_kaddr(pfn)	__va((pfn) << PAGE_SHIFT)

  #ifndef CONFIG_NEED_MULTIPLE_NODES
-#define pfn_to_page(pfn)	(mem_map + (pfn))
-#define page_to_pfn(page)	((unsigned long)((page) - mem_map))
  #define pfn_valid(pfn)		((pfn) < max_mapnr)
  #endif

@@ -160,6 +159,7 @@ typedef struct { unsigned long pgprot; }
  #define WANT_PAGE_VIRTUAL
  #endif

+#include <asm-generic/memory_model.h>
  #include <asm-generic/page.h>

  #endif /* _ASM_PAGE_H */


From vbarinov@ru.mvista.com Tue Feb 14 12:53:42 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Feb 2006 12:54:06 +0000 (GMT)
Received: from rtsoft3.corbina.net ([85.21.88.6]:57355 "EHLO
	buildserver.ru.mvista.com") by ftp.linux-mips.org with ESMTP
	id S8133421AbWBNMxm (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 14 Feb 2006 12:53:42 +0000
Received: from [192.168.12.17] ([10.149.0.1])
	by buildserver.ru.mvista.com (8.11.6/8.11.6) with ESMTP id k1ECxbt09796;
	Tue, 14 Feb 2006 16:59:37 +0400
Message-ID: <43F1D439.60205@ru.mvista.com>
Date:	Tue, 14 Feb 2006 15:59:37 +0300
From:	"Vladimir A. Barinov" <vbarinov@ru.mvista.com>
User-Agent: Mozilla Thunderbird 1.0.2-6 (X11/20050513)
X-Accept-Language: en-us, en
MIME-Version: 1.0
To:	Todd Poynor <tpoynor@mvista.com>, linux-mtd@lists.infradead.org,
	linux-mips@linux-mips.org
Subject: Re: [PATCH] PNX8550 NAND flash driver
References: <43A2F819.1040106@ru.mvista.com> <43C69EC2.2070601@mvista.com>
In-Reply-To: <43C69EC2.2070601@mvista.com>
Content-Type: multipart/mixed;
 boundary="------------000007060306080608070304"
Return-Path: <vbarinov@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: 10456
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: vbarinov@ru.mvista.com
Precedence: bulk
X-list: linux-mips
Content-Length: 31385
Lines: 1008

This is a multi-part message in MIME format.
--------------000007060306080608070304
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Hi Todd,

Thank you for review.
I attached recasted patch with the additional fix for wrong write in the 
OOB area.

The driver is tested with bonnie++ test tool:
This patches fixes the issue of the bug.
This is tested by bonnie++ test on NAND flash formatted with jffs2 fs:

root@192.168.0.8:~# flash_eraseall -j /dev/mtd4
Erasing 16 Kibyte @ 90c000 -- 56 % complete. Cleanmarker written at 90c000.
Skipping bad block at 0x00910000
Erasing 16 Kibyte @ ffc000 -- 99 % complete. Cleanmarker written at ffc000.
root@192.168.0.8:~# mount -t jffs2 /dev/mtdblock4 /mnt
root@192.168.0.8:~# mount
rootfs on / type rootfs (rw)
/dev/root on / type nfs 
(rw,v2,rsize=4096,wsize=4096,hard,udp,nolock,addr=192.168.0.1)
proc on /proc type proc (rw,nodiratime)
sysfs on /sys type sysfs (rw)
tmpfs on /tmp type tmpfs (rw)
tmpfs on /dev/shm type tmpfs (rw)
/dev/mtdblock4 on /mnt type jffs2 (rw,noatime)
root@192.168.0.8:~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00004000 00004000 "microBTM"
mtd1: 0003c000 00004000 "bootloader"
mtd2: 005c0000 00004000 "ROMFS-Tools"
mtd3: 00a00000 00004000 "ROMFS-User"
mtd4: 01000000 00004000 "User"
root@192.168.0.8:~#
root@192.168.0.8:~# bonnie++ -u root -d /mnt -s 16 -r 0
Using uid:0, gid:0.
Writing with putc()...done
Writing intelligently...done
Rewriting...done
Reading with getc()...mtd->read(0x78 bytes from 0x64154) returned ECC error
done
Reading intelligently...done
start 'em...done...done...done...
Create files in sequential order...done.
Stat files in sequential order...done.
Delete files in sequential order...done.
Create files in random order...done.
Stat files in random order...done.
Delete files in random order...done.
Version  1.03       ------Sequential Output------ --Sequential Input- 
--Random-
                    -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- 
--Seeks--
Machine        Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP  
/sec %CP
192.168.0.8     16M   286  99  2379  99  2253  98   357  99 +++++ +++  
1961  98
                    ------Sequential Create------ --------Random 
Create--------
                    -Create-- --Read--- -Delete-- -Create-- --Read--- 
-Delete--
              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  
/sec %CP
                 16   285  99  3013  99   292  97   275  95  3199 100   
295  99
192.168.0.8,16M,286,99,2379,99,2253,98,357,99,+++++,+++,1960.8,98,16,285,99,3013,99,292,97,275,95,3199,100,295,99
root@192.168.0.8:~#

Vladimir

Todd Poynor wrote:

> Vladimir A. Barinov wrote:
>
>> Hi All,
>>
>> Attached patch is NAND flash driver for PNX8550 based platforms.
>> Any comments and suggestions are highly appreciated.
>>
>> Vladimir
>>
>>
>> +    if ((u32) from & 3) {
>> +        printk
>> +            ("%s: from buffer not 32bit aligned, will not use 
>> fastest transfer mechanism\n",
>> +             __FUNCTION__);
>> +    }
>> +    if ((u32) to & 3) {
>> +        printk
>> +            ("%s: to buffer not 32bit aligned, will not use fastest 
>> transfer mechanism\n",
>> +             __FUNCTION__);
>
>
> Those printks could get old pretty fast.  Debugging info, not needed 
> for normal operation.

Thanks. Removed in the attached patch.

>
>> +    }
>> +
>> +    if (((bytes & 3) || (bytes < 16)) || ((u32) to & 3) || ((u32) 
>> from & 3)) {
>> +        if (((bytes & 1) == 0) &&
>> +            (((u32) to & 1) == 0) && (((u32) from & 1) == 0)) {
>> +            int words = bytes / 2;
>> +
>> +            local_irq_disable();
>> +            for (i = 0; i < words; i++) {
>> +                to16[i] = from16[i];
>> +            }
>> +            local_irq_enable();
>
>
> Really necessary to disable all irqs around this transfer?  How long 
> can interrupts be off during that time?

That is needed since the NAND device is binded to the external XIO bus 
that could be used by another devices.

>
>
>> +
>> +    local_irq_disable();
>> +    PNX8550_DMA_TRANS_SIZE = bytes >> 2;    /* Length in words */
>> +    PNX8550_DMA_EXT_ADDR = external;
>> +    PNX8550_DMA_INT_ADDR = internal;
>> +    PNX8550_DMA_INT_CLEAR = 0xffff;
>> +    PNX8550_DMA_CTRL = PNX8550_DMA_CTRL_BURST_512 |
>> +        PNX8550_DMA_CTRL_SND2XIO | PNX8550_DMA_CTRL_INIT_DMA | cmd;
>> +
>> +    while ((PNX8550_DMA_INT_STATUS & PNX8550_DMA_INT_COMPL) == 0) ;
>> +
>> +    if (!toxio) {
>> +        dma_cache_inv(to, bytes);
>> +    }
>> +    local_irq_enable();
>
>
> Again, necessary to prevent interrupts?
>
>> +} +    /* Scan to find existence of the device */
>> +    if (nand_scan(&pnx8550_mtd, 1)) {
>> +        printk("%s: Exiting No Devices\n", __FUNCTION__);
>> +        return -ENXIO;
>
>
> Need kfree(transferBuffer)
>
>> +    }
>> +
>> +    /* Register the partitions */
>> +    add_mtd_partitions(&pnx8550_mtd, partition_info, NUM_PARTITIONS);
>
>
> Need Kconfig to select MTD_PARTITIONS if required.

Added "ifdef". Thanks.

>
>> +static void __exit pnx8550_nand_cleanup(void)
>> +{
>> +    /* Unregister the device */
>> +    del_mtd_device(&pnx8550_mtd);
>
>
> Need del_mtd_partitions I think?

No. That is in the del_mtd_device().

>
>> +    if (transferBuffer) {
>> +        kfree(transferBuffer);
>
>
> "if (transferBuffer)" not needed and is discouraged

Already removed.



--------------000007060306080608070304
Content-Type: text/plain;
 name="pnx8550_nand.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="pnx8550_nand.patch"

Signed-off-by: vbarinov@ru.mvista.com

 drivers/mtd/nand/Kconfig             |    6 
 drivers/mtd/nand/Makefile            |    1 
 drivers/mtd/nand/pnx8550.c           |  707 +++++++++++++++++++++++++++++++++++
 include/asm-mips/mach-pnx8550/nand.h |   22 -
 4 files changed, 734 insertions(+), 2 deletions(-)
Index: linux.git/drivers/mtd/nand/Kconfig
===================================================================
--- linux.git.orig/drivers/mtd/nand/Kconfig
+++ linux.git/drivers/mtd/nand/Kconfig
@@ -90,6 +90,12 @@ config MTD_NAND_S3C2410
 	  No board specfic support is done by this driver, each board
 	  must advertise a platform_device for the driver to attach.
 
+config MTD_NAND_PNX8550
+	tristate "NAND Flash support for PNX8550"
+	depends on PNX8550 && MTD_NAND
+	help
+	  This enables the NAND flash controller on the PNX8550.
+
 config MTD_NAND_S3C2410_DEBUG
 	bool "S3C2410 NAND driver debug"
 	depends on MTD_NAND_S3C2410
Index: linux.git/drivers/mtd/nand/Makefile
===================================================================
--- linux.git.orig/drivers/mtd/nand/Makefile
+++ linux.git/drivers/mtd/nand/Makefile
@@ -18,5 +18,6 @@ obj-$(CONFIG_MTD_NAND_H1900)		+= h1910.o
 obj-$(CONFIG_MTD_NAND_RTC_FROM4)	+= rtc_from4.o
 obj-$(CONFIG_MTD_NAND_SHARPSL)		+= sharpsl.o
 obj-$(CONFIG_MTD_NAND_NANDSIM)		+= nandsim.o
+obj-$(CONFIG_MTD_NAND_PNX8550)		+= pnx8550.o
 
 nand-objs = nand_base.o nand_bbt.o
Index: linux.git/drivers/mtd/nand/pnx8550.c
===================================================================
--- /dev/null
+++ linux.git/drivers/mtd/nand/pnx8550.c
@@ -0,0 +1,707 @@
+/*
+ * Copyright (C) 2005 Koninklijke Philips Electronics N.V.
+ * All Rights Reserved.
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * 
+ * Overview:
+ *   This is a device driver for the NAND flash device found on the
+ *   PNX8550 board which utilizes the Samsung K9F5616U0C part. This is
+ *   a 32MByte (16M x 16 bits) NAND flash device.
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/slab.h>
+#include <linux/module.h>
+#include <linux/delay.h>
+#include <linux/errno.h>
+#include <linux/sched.h>
+#include <linux/string.h>
+#include <linux/types.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/nand.h>
+#include <linux/mtd/nand_ecc.h>
+#include <linux/mtd/compatmac.h>
+#include <linux/interrupt.h>
+#include <linux/mtd/partitions.h>
+#include <asm/io.h>
+#include <asm/mach-pnx8550/nand.h>
+
+#define UBTM_NAME                 "microBTM"
+#define UBTM_BLOCK_START         ( 0x00000000)
+#define UBTM_BLOCK_END           ( 0x00004000)	/* 16K size, first block */
+#define UBTM_SIZE                ( UBTM_BLOCK_END - UBTM_BLOCK_START)
+
+#define BOOTLOADER_NAME           "bootloader"
+#define BOOTLOADER_BLOCK_START   ( UBTM_BLOCK_END)
+#define BOOTLOADER_BLOCK_END     ( 0x00040000)	/* 256K -  16K = 240K    */
+#define BOOTLOADER_SIZE          ( BOOTLOADER_BLOCK_END - BOOTLOADER_BLOCK_START)
+
+#define ROMFS_SYS_NAME            "ROMFS-Tools"
+#define ROMFS_SYS_BLOCK_START    ( BOOTLOADER_BLOCK_END)
+#define ROMFS_SYS_BLOCK_END      ( 0x00600000)	/*   6M - 256K = 5.75M   */
+#define ROMFS_SYS_SIZE           ( ROMFS_SYS_BLOCK_END - ROMFS_SYS_BLOCK_START)
+
+#define ROMFS_APP_NAME            "ROMFS-User"
+#define ROMFS_APP_BLOCK_START    ( ROMFS_SYS_BLOCK_END)
+#define ROMFS_APP_BLOCK_END      ( 0x01000000)	/*  16M -   6M = 10M     */
+#define ROMFS_APP_SIZE           ( ROMFS_APP_BLOCK_END - ROMFS_APP_BLOCK_START)
+
+#define USER_NAME                 "User"
+#define USER_BLOCK_START         ( ROMFS_APP_BLOCK_END)
+#define USER_BLOCK_END           ( 0x02000000)	/*  32M -  16M = 16M     */
+#define USER_SIZE                ( USER_BLOCK_END - USER_BLOCK_START)
+
+#define NAND_ADDR(_col, _page) ((_col) & (mtd->oobblock - 1)) + ((_page) << this->page_shift)
+
+#define NAND_ADDR_SEND(_addr) writew(0, pNandAddr + _addr)
+
+#define NAND_TRANSFER_TO(_addr, _buffer, _bytes)   pnx8550_nand_transfer(_buffer, pNandAddr + _addr, _bytes, 1)
+#define NAND_TRANSFER_FROM(_addr, _buffer, _bytes) pnx8550_nand_transfer(pNandAddr + _addr, _buffer, _bytes, 0)
+
+/*
+ * Define partitions for flash device
+ */
+#define NUM_PARTITIONS 5
+const static struct mtd_partition partition_info[NUM_PARTITIONS] = {
+	{
+	 .name = UBTM_NAME,
+	 .offset = UBTM_BLOCK_START,
+	 .size = UBTM_SIZE},
+	{
+	 .name = BOOTLOADER_NAME,
+	 .offset = BOOTLOADER_BLOCK_START,
+	 .size = BOOTLOADER_SIZE},
+	{
+	 .name = ROMFS_SYS_NAME,
+	 .offset = ROMFS_SYS_BLOCK_START,
+	 .size = ROMFS_SYS_SIZE},
+	{
+	 .name = ROMFS_APP_NAME,
+	 .offset = ROMFS_APP_BLOCK_START,
+	 .size = ROMFS_APP_SIZE},
+	{
+	 .name = USER_NAME,
+	 .offset = USER_BLOCK_START,
+	 .size = USER_SIZE}
+};
+
+/* Bad block descriptor for 16Bit nand flash */
+static uint8_t scan_ff_pattern[] = { 0xff, 0xff };
+static struct nand_bbt_descr nand16bit_memorybased = {
+	.options = 0,
+	.offs = 0,
+	.len = 2,
+	.pattern = scan_ff_pattern
+};
+
+/* OOB Placement information that lines up with the boot loader code */
+static struct nand_oobinfo nand16bit_oob_16 = {
+	.useecc = MTD_NANDECC_AUTOPLACE,
+	.eccbytes = 6,
+	.eccpos = {2, 3, 4, 5, 6, 7},
+	.oobfree = {{8, 8}}
+};
+
+/* Pointer into XIO for access to the 16Bit NAND flash device */
+static u8 *pNandAddr;
+
+/* Last command sent to the pnx8550_nand_command function */
+static int last_command = -1;
+/*
+ * Next column address to read/write, set by pnx8550_nand_command
+ * updated by the read/write functions
+ */
+static int last_col_addr = -1;
+/*
+ *  Next page address to read/write, set by pnx8550_nand_command
+ *  updated by the read/write functions
+ */
+static int last_page_addr = -1;
+
+/* 32bit Aligned/DMA buffer */
+static u_char *transferBuffer;
+
+static struct mtd_info pnx8550_mtd;
+static struct nand_chip pnx8550_nand;
+
+/**
+ * Allocate the buffer used to tranfser data between flash and memory.
+ * We use a transfer buffer so we know that the buffer is 32bit aligned.
+ */
+static void pnx8550_nand_alloc_transfer_buffer(void)
+{
+	if (transferBuffer == NULL) {
+		transferBuffer =
+			kmalloc(pnx8550_mtd.oobblock + pnx8550_mtd.oobsize,
+			GFP_DMA | GFP_KERNEL);
+	}
+}
+
+/**
+ * Setup the registers in PCIXIO
+ */
+static void pnx8550_nand_register_setup(u_char cmd_no,
+					u_char addr_no,
+					u_char include_data,
+					u_char monitor_ACK,
+					u_char enable64M, int cmd_a, int cmd_b)
+{
+	unsigned int reg_nand = 0;
+	reg_nand |= enable64M ? PNX8550_XIO_FLASH_64MB : 0;
+	reg_nand |= include_data ? PNX8550_XIO_FLASH_INC_DATA : 0;
+	reg_nand |= PNX8550_XIO_FLASH_CMD_PH(cmd_no);
+	reg_nand |= PNX8550_XIO_FLASH_ADR_PH(addr_no);
+	reg_nand |= PNX8550_XIO_FLASH_CMD_A(cmd_a);
+	reg_nand |= PNX8550_XIO_FLASH_CMD_B(cmd_b);
+	PNX8550_XIO_FLASH_CTRL = reg_nand;
+	barrier();
+}
+
+/**
+ * Wait for the device to be ready for the next command
+ */
+static inline void pnx8550_nand_wait_for_dev_ready(void)
+{
+	while ((PNX8550_XIO_CTRL & PNX8550_XIO_CTRL_XIO_ACK) == 0) ;
+}
+
+/**
+ * Transfer data to/from the NAND chip using DMA
+ *
+ * @from:  Address to transfer data from
+ * @to:    Address to transfer the data to
+ * @bytes: Number of bytes to transfer
+ * @toxio: Whether the transfer is going to XIO or not.
+ */
+static void pnx8550_nand_transferDMA(void *from, void *to, int bytes, int toxio)
+{
+	int cmd = 0;
+	u32 internal;
+	u32 external;
+
+	if (toxio) {
+		cmd = PNX8550_DMA_CTRL_PCI_CMD_WRITE;
+		dma_cache_wback((unsigned long)from, bytes);
+		internal = (u32) virt_to_phys(from);
+		external = (u32) to - KSEG1;
+	} else {
+		cmd = PNX8550_DMA_CTRL_PCI_CMD_READ;
+		internal = (u32) virt_to_phys(to);
+		external = (u32) from - KSEG1;
+	}
+
+	local_irq_disable();
+	PNX8550_DMA_TRANS_SIZE = bytes >> 2;	/* Length in words */
+	PNX8550_DMA_EXT_ADDR = external;
+	PNX8550_DMA_INT_ADDR = internal;
+	PNX8550_DMA_INT_CLEAR = 0xffff;
+	PNX8550_DMA_CTRL = PNX8550_DMA_CTRL_BURST_512 |
+	    PNX8550_DMA_CTRL_SND2XIO | PNX8550_DMA_CTRL_INIT_DMA | cmd;
+
+	while ((PNX8550_DMA_INT_STATUS & PNX8550_DMA_INT_COMPL) == 0) ;
+
+	if (!toxio)
+		dma_cache_inv((unsigned long)to, bytes);
+
+	local_irq_enable();
+}
+
+/**
+ * Transfer data to/from the NAND chip.
+ * This function decides whether to use DMA or not depending on
+ * the amount of data to transfer and the alignment of the buffers.
+ *
+ * @from:  Address to transfer data from
+ * @to:    Address to transfer the data to
+ * @bytes: Number of bytes to transfer
+ * @toxio: Whether the transfer is going to XIO or not.
+ */
+static void pnx8550_nand_transfer(void *from, void *to, int bytes, int toxio)
+{
+	u16 *from16 = (u16 *) from;
+	u16 *to16 = (u16 *) to;
+	int i;
+
+	if (((bytes & 3) || (bytes < 16)) || ((u32) to & 3) || ((u32) from & 3)) {
+		if (((bytes & 1) == 0) &&
+		    (((u32) to & 1) == 0) && (((u32) from & 1) == 0)) {
+			int words = bytes / 2;
+
+			local_irq_disable();
+			for (i = 0; i < words; i++)
+				to16[i] = from16[i];
+			local_irq_enable();
+		} 
+		else
+			printk(KERN_ERR "%s: Transfer failed, "
+			       "byte-aligned transfers no allowed!\n",
+			        __FUNCTION__);
+	} else {
+		pnx8550_nand_transferDMA(from, to, bytes, toxio);
+	}
+}
+
+/**
+ * pnx8550_nand_read_byte - read one byte endianess aware from the chip
+ * @mtd:	MTD device structure
+ */
+static u_char pnx8550_nand_read_byte(struct mtd_info *mtd)
+{
+	struct nand_chip *this = mtd->priv;
+	u16 data = 0;
+	int addr = NAND_ADDR(last_col_addr, last_page_addr);
+	/*
+	 * Read ID is a special case as we have to read BOTH bytes at the same
+	 * time otherwise it doesn't work, once we have both bytes we work out
+	 * which one we want.
+	 */
+	if (last_command == NAND_CMD_READID) {
+		u32 data32;
+		data32 = cpu_to_le32(readl(pNandAddr + 0));
+		if (last_col_addr)
+			data = (u16) (data32 >> 16);
+		else
+			data = (u16) data32;
+	} else {
+		data = readw(pNandAddr + addr);
+		if ((addr & 0x1) == 1)
+			data = (data & 0xff00) >> 16;
+	}
+	/*
+	 * Status is a special case, we don't need to increment the address
+	 * because the address isn't used by the chip
+	 */
+	if (last_command != NAND_CMD_STATUS)
+		last_col_addr++;
+
+	return data & 0xff;
+}
+
+/**
+ * pnx8550_nand_read_word - read one word from the chip
+ * @mtd:	MTD device structure
+ *
+ * Read function for 16bit buswith without
+ * endianess conversion
+ */
+static u16 pnx8550_nand_read_word(struct mtd_info *mtd)
+{
+	struct nand_chip *this = mtd->priv;
+	int addr = NAND_ADDR(last_col_addr, last_page_addr);
+	u16 data = readw(pNandAddr + addr);
+	return data;
+}
+
+/**
+ * pnx8550_nand_write_byte - write one byte endianess aware to the chip
+ * @mtd:	MTD device structure
+ * @byte:	pointer to data byte to write
+ *
+ * Write function for 16bit buswith with
+ * endianess conversion
+ */
+static void pnx8550_nand_write_byte(struct mtd_info *mtd, u_char byte)
+{
+	struct nand_chip *this = mtd->priv;
+	int addr = NAND_ADDR(last_col_addr, last_page_addr);
+	writew(le16_to_cpu((u16) byte), pNandAddr + addr);
+}
+
+/**
+ * pnx8550_nand_write_word - write one word to the chip
+ * @mtd:	MTD device structure
+ * @word:	data word to write
+ *
+ * Write function for 16bit buswith without
+ * endianess conversion
+ */
+static void pnx8550_nand_write_word(struct mtd_info *mtd, u16 word)
+{
+	struct nand_chip *this = mtd->priv;
+	int addr = NAND_ADDR(last_col_addr, last_page_addr);
+	writew(word, pNandAddr + addr);
+}
+
+/**
+ * pnx8550_nand_write_buf - write buffer to chip
+ * @mtd:	MTD device structure
+ * @buf:	data buffer
+ * @len:	number of bytes to write
+ */
+static void pnx8550_nand_write_buf(struct mtd_info *mtd, const u_char * buf,
+				   int len)
+{
+	struct nand_chip *this = mtd->priv;
+	int addr = NAND_ADDR(last_col_addr, last_page_addr);
+	int pageLen;
+	int oobLen = 0;
+	u_char *transBuf = (u_char *) buf;
+
+	/* some sanity checking, word access only please */
+	if (len & 1)
+		pr_debug("%s: non-word aligned length requested!\n",
+			 __FUNCTION__);
+
+	pnx8550_nand_alloc_transfer_buffer();
+
+	memcpy(transferBuffer, buf, len);
+	transBuf = transferBuffer;
+
+	/*
+	 * Work out whether we are going to write to the OOB area
+	 * after a standard page write.
+	 * This is not the case when the command function is called
+	 * with a column address > page size. Then we write as though
+	 * it is to the page rather than the OOB as the command function
+	 * has already selected the OOB area.
+	 */
+	if ((last_col_addr + len) > mtd->oobblock) {
+		if (last_col_addr >= mtd->oobblock)
+			oobLen = len;
+		else
+			oobLen = (last_col_addr + len) - mtd->oobblock;
+	}
+	pageLen = len - oobLen;
+
+	/* Clear the done flag */
+	PNX8550_GPXIO_CTRL |= PNX8550_GPXIO_CLR_DONE;
+	if (pageLen > 0)
+		NAND_TRANSFER_TO(addr, transBuf, pageLen);
+
+	if (oobLen > 0) {
+		pnx8550_nand_wait_for_dev_ready();
+
+		pnx8550_nand_register_setup(1, 0, 0, 1, 0, NAND_CMD_READOOB, 0);
+		/* Work out where in the OOB we are going to start to write */
+		addr = NAND_ADDR(last_col_addr - mtd->oobblock, last_page_addr);
+		NAND_ADDR_SEND(addr);
+		pnx8550_nand_register_setup(2, 3, 1, 1, 0, NAND_CMD_SEQIN,
+					    NAND_CMD_PAGEPROG);
+
+		/* Clear the done flag */
+		PNX8550_GPXIO_CTRL |= PNX8550_GPXIO_CLR_DONE;
+		NAND_TRANSFER_TO(addr, transBuf + pageLen, oobLen);
+	}
+
+	/*
+	 * Increment the address so on the next write we write in the
+	 * correct place.
+	 */
+	last_col_addr += len;
+	if (last_col_addr >= mtd->oobblock + mtd->oobsize) {
+		last_col_addr -= mtd->oobblock + mtd->oobsize;
+		last_page_addr++;
+	}
+}
+
+/**
+ * pnx8550_nand_read_buf - read chip data into buffer
+ * @mtd:	MTD device structure
+ * @buf:	buffer to store date
+ * @len:	number of bytes to read
+ */
+static void pnx8550_nand_read_buf(struct mtd_info *mtd, u_char * buf, int len)
+{
+	struct nand_chip *this = mtd->priv;
+	int addr = NAND_ADDR(last_col_addr, last_page_addr);
+	int pageLen;
+	int oobLen = 0;
+	u_char *transBuf = buf;
+
+	/* some sanity checking, word access only please */
+	if (len & 1)
+		pr_debug("%s: non-word aligned length\n", __FUNCTION__);
+
+	pnx8550_nand_alloc_transfer_buffer();
+
+	transBuf = transferBuffer;
+
+	/*
+	 * Work out whether we are going to read the OOB area
+	 * after a standard page read.
+	 * This is not the case when the command function is called
+	 * with a column address > page size. Then we read as though
+	 * it is from the page rather than the OOB as the command
+	 * function has already selected the OOB area.
+	 */
+	if ((last_col_addr + len) > mtd->oobblock) {
+		if (last_col_addr >= mtd->oobblock)
+			oobLen = len;
+		else
+			oobLen = (last_col_addr + len) - mtd->oobblock;
+	}
+	pageLen = len - oobLen;
+
+	if (pageLen)
+		NAND_TRANSFER_FROM(addr, transBuf, pageLen);
+
+	if (oobLen > 0) {
+		pnx8550_nand_register_setup(1, 3, 1, 1, 0, NAND_CMD_READOOB, 0);
+		addr = NAND_ADDR(last_col_addr - mtd->oobblock, last_page_addr);
+		NAND_TRANSFER_FROM(addr, transBuf + pageLen, oobLen);
+	}
+
+	memcpy(buf, transBuf, len);
+
+	/*
+	 * Increment the address so on the next read we read from the
+	 * correct place.
+	 */
+	last_col_addr += len;
+	if (last_col_addr > mtd->oobblock + mtd->oobsize) {
+		last_col_addr -= mtd->oobblock + mtd->oobsize;
+		last_page_addr++;
+	}
+	return;
+}
+
+/**
+ * pnx8550_nand_verify_buf -  Verify chip data against buffer
+ * @mtd:	MTD device structure
+ * @buf:	buffer containing the data to compare
+ * @len:	number of bytes to compare
+ *
+ */
+static int pnx8550_nand_verify_buf(struct mtd_info *mtd, const u_char * buf,
+				   int len)
+{
+	int result = 0;
+
+	/* some sanity checking, word access only please */
+	if (len & 1)
+		pr_debug("%s: non-word aligned length\n", __FUNCTION__);
+
+	pnx8550_nand_read_buf(mtd, transferBuffer, len);
+	if (memcmp(buf, transferBuffer, len))
+		result = -EFAULT;
+
+	return result;
+
+}
+
+/**
+ * pnx8550_nand_command - Send command to NAND device
+ * @mtd:	MTD device structure
+ * @command:	the command to be sent
+ * @column:	the column address for this command, -1 if none
+ * @page_addr:	the page address for this command, -1 if none
+ *
+ * Send command to NAND device.
+ */
+static void pnx8550_nand_command(struct mtd_info *mtd, unsigned command,
+				 int column, int page_addr)
+{
+	register struct nand_chip *this = mtd->priv;
+	u_char addr_no = 0;
+	u_char spare = 0;
+	int addr;
+	/*
+	   If we are starting a write work out whether it is to the
+	   OOB or the main page and position the pointer correctly.
+	 */
+	if (command == NAND_CMD_SEQIN) {
+		int readcmd;
+		int col = column;
+		if (column >= mtd->oobblock) {
+			/* OOB area */
+			col -= mtd->oobblock;
+			readcmd = NAND_CMD_READOOB;
+			spare = 1;
+		} else {
+			readcmd = NAND_CMD_READ0;
+		}
+		pnx8550_nand_register_setup(1, 0, 0, 1, 0, readcmd, 0);
+		addr = NAND_ADDR(col, page_addr);
+		NAND_ADDR_SEND(addr);
+	}
+
+	/* Check the number of address bytes */
+	if ((column == -1) && (page_addr == -1)) {
+		addr_no = 0;
+		column = 0;
+		page_addr = 0;
+	} else if ((column == -1) && (page_addr != -1)) {
+		addr_no = 2;
+		column = 0;
+	} else if ((column != -1) && (page_addr == -1)) {
+		addr_no = 1;
+		page_addr = 0;
+	} else {
+		addr_no = 3;
+	}
+
+	last_command = command;
+	last_col_addr = column;
+	last_page_addr = page_addr;
+
+	switch (command) {
+	case NAND_CMD_PAGEPROG:
+		/* Nothing to do, we've already done it! */
+		return;
+
+	case NAND_CMD_SEQIN:
+		if (addr_no != 3)
+			printk(KERN_ERR
+			       "NAND: Command %02x needs 3 byte address,"
+			       "but addr_no = %d\n", command, addr_no);
+		pnx8550_nand_register_setup(2, 3, 1, 1, spare, NAND_CMD_SEQIN,
+					    NAND_CMD_PAGEPROG);
+		return;
+
+	case NAND_CMD_ERASE1:
+		if (addr_no != 2)
+			pr_debug("NAND: Command %02x needs 2 byte" "address,"
+				 "but addr_no = %d\n", command, addr_no);
+		PNX8550_GPXIO_CTRL |= PNX8550_GPXIO_CLR_DONE;
+		pnx8550_nand_register_setup(2, 2, 0, 1, 0, NAND_CMD_ERASE1,
+					    NAND_CMD_ERASE2);
+		addr = NAND_ADDR(column, page_addr);
+		NAND_ADDR_SEND(addr);
+		return;
+
+	case NAND_CMD_ERASE2:
+		/* Nothing to do, we've already done it! */
+		return;
+
+	case NAND_CMD_STATUS:
+		if (addr_no != 0)
+			pr_debug("NAND: Command %02x needs 0 byte address,"
+				 "but addr_no = %d\n", command, addr_no);
+		pnx8550_nand_register_setup(1, 0, 1, 0, 0, NAND_CMD_STATUS, 0);
+		return;
+
+	case NAND_CMD_RESET:
+		if (addr_no != 0)
+			pr_debug("NAND: Command %02x needs 0 byte address,"
+				 "but addr_no = %d\n", command, addr_no);
+		pnx8550_nand_register_setup(1, 0, 0, 0, 0, NAND_CMD_RESET, 0);
+		addr = NAND_ADDR(column, page_addr);
+		NAND_ADDR_SEND(addr);
+		return;
+
+	case NAND_CMD_READ0:
+		if (addr_no != 3)
+			pr_debug("NAND: Command %02x needs 3 byte address,"
+				 "but addr_no = %d\n", command, addr_no);
+		pnx8550_nand_register_setup(1, 3, 1, 1, 0, NAND_CMD_READ0, 0);
+		return;
+
+	case NAND_CMD_READ1:
+		printk(KERN_ERR "Wrong command: %02x\n", command);
+		return;
+
+	case NAND_CMD_READOOB:
+		if (addr_no != 3)
+			pr_debug("NAND: Command %02x needs 3 byte address,"
+				 "but addr_no = %d\n", command, addr_no);
+		pnx8550_nand_register_setup(1, 3, 1, 1, 0, NAND_CMD_READOOB, 0);
+		return;
+
+	case NAND_CMD_READID:
+		if (addr_no != 1)
+			pr_debug("NAND: Command %02x needs 1 byte address,"
+				 "but addr_no = %d\n", command, addr_no);
+		pnx8550_nand_register_setup(1, 1, 1, 0, 0, NAND_CMD_READID, 0);
+		return;
+	}
+}
+
+/**
+ * Return true if the device is ready, false otherwise
+ */
+static int pnx8550_nand_dev_ready(struct mtd_info *mtd)
+{
+	return ((PNX8550_XIO_CTRL & PNX8550_XIO_CTRL_XIO_ACK) != 0);
+}
+
+/**
+ *	hardware specific access to control-lines
+ */
+static void pnx8550_nand_hwcontrol(struct mtd_info *mtd, int cmd)
+{
+	/* Nothing to do here, its all done by the XIO block */
+}
+
+/**
+ * Main initialization routine
+ */
+int __init pnx8550_nand_init(void)
+{
+	struct nand_chip *this;
+
+	/* Get pointer to private data */
+	this = &pnx8550_nand;
+
+	/* Work out address of Nand Flash */
+	pNandAddr = (u8 *) (KSEG1 | (PNX8550_BASE18_ADDR & (~0x7)));
+
+	pNandAddr = (u8 *) (((u32) pNandAddr) +
+			     ((PNX8550_XIO_SEL0 & PNX8550_XIO_SEL0_OFFSET_MASK)
+			      >> PNX8550_XIO_SEL0_OFFSET_SHIFT) * 8 * 1024 *
+			     1024);
+
+	/* Link the private data with the MTD structure */
+	pnx8550_mtd.priv = this;
+	this->chip_delay = 15;
+	this->options = NAND_BUSWIDTH_16;
+	this->cmdfunc = pnx8550_nand_command;
+	this->read_byte = pnx8550_nand_read_byte;
+	this->read_word = pnx8550_nand_read_word;
+	this->read_buf = pnx8550_nand_read_buf;
+	this->write_byte = pnx8550_nand_write_byte;
+	this->write_word = pnx8550_nand_write_word;
+	this->write_buf = pnx8550_nand_write_buf;
+	this->verify_buf = pnx8550_nand_verify_buf;
+	this->dev_ready = pnx8550_nand_dev_ready;
+	this->hwcontrol = pnx8550_nand_hwcontrol;
+	this->eccmode = NAND_ECC_SOFT;
+	this->badblock_pattern = &nand16bit_memorybased;
+	this->autooob = &nand16bit_oob_16;
+
+	/* Scan to find existence of the device */
+	if (nand_scan(&pnx8550_mtd, 1)) {
+		printk(KERN_ERR "No NAND devices\n");
+		return -ENXIO;
+	}
+
+	if (!transferBuffer) {
+		printk(KERN_ERR
+		    "Unable to allocate NAND data buffer for PNX8550\n");
+		return -ENOMEM;
+	}
+#ifdef CONFIG_MTD_PARTITIONS
+	add_mtd_partitions(&pnx8550_mtd, partition_info, NUM_PARTITIONS);
+#endif
+
+	return 0;
+}
+
+module_init(pnx8550_nand_init);
+
+#ifdef MODULE
+static void __exit pnx8550_nand_cleanup(void)
+{
+	nand_release(&pnx8550_mtd);
+	kfree(transferBuffer);
+}
+
+module_exit(pnx8550_nand_cleanup);
+#endif
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Adam Charrett");
+MODULE_DESCRIPTION("Driver for 16Bit NAND Flash on the XIO bus for PNX8550");
Index: linux.git/include/asm-mips/mach-pnx8550/nand.h
===================================================================
--- linux.git.orig/include/asm-mips/mach-pnx8550/nand.h
+++ linux.git/include/asm-mips/mach-pnx8550/nand.h
@@ -4,10 +4,14 @@
 #define PNX8550_NAND_BASE_ADDR   0x10000000
 #define PNX8550_PCIXIO_BASE	 0xBBE40000
 
+#define PNX8550_BASE10_ADDR      *(volatile unsigned long *)(PNX8550_PCIXIO_BASE + 0x050)
+#define PNX8550_BASE14_ADDR      *(volatile unsigned long *)(PNX8550_PCIXIO_BASE + 0x054)
+#define PNX8550_BASE18_ADDR      *(volatile unsigned long *)(PNX8550_PCIXIO_BASE + 0x058)
 #define PNX8550_DMA_EXT_ADDR     *(volatile unsigned long *)(PNX8550_PCIXIO_BASE + 0x800)
 #define PNX8550_DMA_INT_ADDR     *(volatile unsigned long *)(PNX8550_PCIXIO_BASE + 0x804)
 #define PNX8550_DMA_TRANS_SIZE   *(volatile unsigned long *)(PNX8550_PCIXIO_BASE + 0x808)
 #define PNX8550_DMA_CTRL         *(volatile unsigned long *)(PNX8550_PCIXIO_BASE + 0x80c)
+#define PNX8550_XIO_CTRL         *(volatile unsigned long *)(PNX8550_PCIXIO_BASE + 0x810)
 #define PNX8550_XIO_SEL0         *(volatile unsigned long *)(PNX8550_PCIXIO_BASE + 0x814)
 #define PNX8550_GPXIO_ADDR       *(volatile unsigned long *)(PNX8550_PCIXIO_BASE + 0x820)
 #define PNX8550_GPXIO_WR         *(volatile unsigned long *)(PNX8550_PCIXIO_BASE + 0x824)
@@ -21,6 +25,8 @@
 #define PNX8550_DMA_INT_ENABLE   *(volatile unsigned long *)(PNX8550_PCIXIO_BASE + 0xfd4)
 #define PNX8550_DMA_INT_CLEAR    *(volatile unsigned long *)(PNX8550_PCIXIO_BASE + 0xfd8)
 
+#define PNX8550_XIO_CTRL_XIO_ACK     0x00000002
+
 #define PNX8550_XIO_SEL0_EN_16BIT    0x00800000
 #define PNX8550_XIO_SEL0_USE_ACK     0x00400000
 #define PNX8550_XIO_SEL0_REN_HIGH    0x00100000
@@ -39,6 +45,9 @@
 #define PNX8550_XIO_SEL0_SIZE_64MB   0x00000006
 #define PNX8550_XIO_SEL0_ENAB        0x00000001
 
+#define PNX8550_XIO_SEL0_OFFSET_SHIFT 5
+#define PNX8550_XIO_SEL0_OFFSET_MASK  (0xf << PNX8550_XIO_SEL0_OFFSET_SHIFT)
+
 #define PNX8550_SEL0_DEFAULT ((PNX8550_XIO_SEL0_EN_16BIT)  | \
                               (PNX8550_XIO_SEL0_REN_HIGH*0)| \
 	                      (PNX8550_XIO_SEL0_REN_LOW*2) | \
@@ -59,11 +68,15 @@
 
 #define PNX8550_XIO_FLASH_64MB       0x00200000
 #define PNX8550_XIO_FLASH_INC_DATA   0x00100000
-#define PNX8550_XIO_FLASH_CMD_PH     0x000C0000
+#define PNX8550_XIO_FLASH_CMD_PH_SHIFT 18
+#define PNX8550_XIO_FLASH_CMD_PH_MASK  (3 << PNX8550_XIO_FLASH_CMD_PH_SHIFT)
+#define PNX8550_XIO_FLASH_CMD_PH(_x)   (((_x) << PNX8550_XIO_FLASH_CMD_PH_SHIFT) & PNX8550_XIO_FLASH_CMD_PH_MASK)
+#define PNX8550_XIO_FLASH_ADR_PH_SHIFT 16
+#define PNX8550_XIO_FLASH_ADR_PH_MASK  (3 << PNX8550_XIO_FLASH_ADR_PH_SHIFT)
+#define PNX8550_XIO_FLASH_ADR_PH(_x)   (((_x) << PNX8550_XIO_FLASH_ADR_PH_SHIFT) & PNX8550_XIO_FLASH_ADR_PH_MASK)
 #define PNX8550_XIO_FLASH_CMD_PH2    0x00080000
 #define PNX8550_XIO_FLASH_CMD_PH1    0x00040000
 #define PNX8550_XIO_FLASH_CMD_PH0    0x00000000
-#define PNX8550_XIO_FLASH_ADR_PH     0x00030000
 #define PNX8550_XIO_FLASH_ADR_PH3    0x00030000
 #define PNX8550_XIO_FLASH_ADR_PH2    0x00020000
 #define PNX8550_XIO_FLASH_ADR_PH1    0x00010000
@@ -118,4 +131,9 @@
 #define PNX8550_DMA_INT_CLR_M_ABORT	(1<<2)
 #define PNX8550_DMA_INT_CLR_T_ABORT	(1<<1)
 
+#define PNX8550_DMA_INT_ACK          0x00004000
+#define PNX8550_DMA_INT_COMPL        0x00001000
+#define PNX8550_DMA_INT_NONSUP       0x00000200
+#define PNX8550_DMA_INT_ABORT        0x00000004
+
 #endif

--------------000007060306080608070304--

From anemo@mba.ocn.ne.jp Tue Feb 14 13:08:06 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Feb 2006 13:08:17 +0000 (GMT)
Received: from mba.ocn.ne.jp ([210.190.142.172]:480 "HELO smtp.mba.ocn.ne.jp")
	by ftp.linux-mips.org with SMTP id S8133476AbWBNNIG (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Tue, 14 Feb 2006 13:08:06 +0000
Received: from localhost (p3141-ipad30funabasi.chiba.ocn.ne.jp [221.184.78.141])
	by smtp.mba.ocn.ne.jp (Postfix) with ESMTP
	id 75E36AEB9; Tue, 14 Feb 2006 22:14:22 +0900 (JST)
Date:	Tue, 14 Feb 2006 22:14:08 +0900 (JST)
Message-Id: <20060214.221408.74751414.anemo@mba.ocn.ne.jp>
To:	ralf@linux-mips.org
Cc:	linux-mips@linux-mips.org
Subject: Re: [PATCH] fix cache coherency issues
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
In-Reply-To: <20060214.191215.115641299.nemoto@toshiba-tops.co.jp>
References: <20060214.164216.48797359.nemoto@toshiba-tops.co.jp>
	<200602140856.k1E8uvm1021728@mbox03.po.2iij.net>
	<20060214.191215.115641299.nemoto@toshiba-tops.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: 10457
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
Content-Length: 12111
Lines: 399

Revised.

There are several cache-related problems with multi-threaded program
and fork().


Problem-1:  copy-on-write and signal trampoline on harvard-cache.
[previously reported with subject: missing data cache flush for signal trampoline on fork]

A program which is heavily using signal and fork occasionally killed
by SIGSEGV, etc.  When it was killed, PC is always near the stack
pointer.

This would happen on CPUs without MIPS_CACHE_IC_F_DC.  D-cache
aliasing is irrelevant.

1. To handle a delivered signal, a signal-trampoline code are written
to the stack page.

2. They are flushed to memory immediately and I-cache are invalidated.

3. If other thread called fork() before the signal handler is
executed, all writable pages (including the stack page) are marked as
COW page.

4. When the user signal handler is to write to the stack, the page
will be copied to new physical page by copy_user_highpage(), but not
flushed to main memory.

5. Then flush_cache_page() is called for the stack page, but it does
not flush the cache written by copy_user_highpage() because new PTE is
not established yet.

6. When returned from the user signal handler, the signal trampoline
code might not be written to main memory.  Garbage code will be
executed and the program will die.


Problem-2:  copy-on-write and dcache-aliasing
[previously reported with subject: dcache aliasing problem on fork]

1. Now there is a process containing two thread (T1 and T2).  The
   thread T1 calls fork().  Then dup_mmap() function called on T1 context.

static inline int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm)
	...
	flush_cache_mm(current->mm);
	...	/* A */
	(write-protect all Copy-On-Write pages)
	...	/* B */
	flush_tlb_mm(current->mm);
	...

2. When preemption happens between A and B (or on SMP kernel), the
   thread T2 can run and modify data on COW pages without page fault
   (modified data will stay in cache).

3. Some time after fork() completed, the thread T2 may cause a page
   fault by write-protect on a COW page.

4. Then data of the COW page will be copied to newly allocated
   physical page (copy_cow_page()).  It reads data via kernel mapping.
   The kernel mapping can have different 'color' with user space
   mapping of the thread T2 (dcache aliasing).  Therefore
   copy_cow_page() will copy stale data.  Then the modified data in
   cache will be lost.


This patch fixes above problems using custom copy_user_highpage().  It
uses kmap_coherent() to map an user page for kernel with same color.
Also copy_to_user_page() and copy_from_user_page() are rewritten using
the kmap_coherent() to avoid extra cache flushing.


The main part of this patch was originally written by Ralf Baechle.

 arch/mips/mm/init.c           |  138 ++++++++++++++++++++++++++++++++++++++++++
 include/asm-mips/cacheflush.h |   14 ++--
 include/asm-mips/fixmap.h     |    8 +-
 include/asm-mips/page.h       |   14 +---
 include/linux/highmem.h       |    7 +-
 mm/memory.c                   |    8 +-
 6 files changed, 166 insertions(+), 23 deletions(-)

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

diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 0ff9a34..dee0b2b 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -30,11 +30,15 @@
 #include <asm/cachectl.h>
 #include <asm/cpu.h>
 #include <asm/dma.h>
+#include <asm/interrupt.h>
+#include <asm/kmap_types.h>
+#include <asm/mipsmtregs.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>
 
 DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
 
@@ -79,6 +83,140 @@ unsigned long setup_zero_pages(void)
 	return 1UL << order;
 }
 
+/*
+ * These are almost like kmap_atomic / kunmap_atmic except they take an
+ * additional address argument as the hint.
+ */
+
+static inline void *kmap_coherent(struct page *page, unsigned long addr)
+{
+	unsigned long vaddr, flags, entrylo;
+	enum fixed_addresses idx;
+	unsigned long asid;
+	unsigned int vpflags;
+	unsigned int wired;
+	pte_t pte;
+
+	if (!cpu_has_dc_aliases)
+		return page_address(page);
+	inc_preempt_count();
+
+	if (cpu_has_mipsmt)
+		vpflags = dvpe();
+	local_irq_save(flags);
+
+	idx = (addr >> 12) & 7;
+	vaddr = __fix_to_virt(FIX_CMAP_END - idx);
+
+	asid = read_c0_entryhi();
+	wired = read_c0_wired();
+	write_c0_wired(wired + 1);
+	write_c0_index(wired);
+	write_c0_entryhi(vaddr & (PAGE_MASK << 1));
+	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
+	write_c0_entrylo0(entrylo);
+	write_c0_entrylo1(entrylo);
+	mtc0_tlbw_hazard();
+	tlb_write_indexed();
+	write_c0_entryhi(asid);
+
+	local_irq_restore(flags);
+	if (cpu_has_mipsmt)
+		evpe(vpflags);
+
+	return (void*) vaddr;
+}
+
+#define UNIQUE_ENTRYHI(idx) (CKSEG0 + ((idx) << (PAGE_SHIFT + 1)))
+
+static inline void kunmap_coherent(void)
+{
+	unsigned int vpflags, wired;
+	unsigned long flags, asid;
+
+	if (!cpu_has_dc_aliases)
+		return;
+	if (cpu_has_mipsmt)
+		vpflags = dvpe();
+	local_irq_save(flags);
+
+	asid = 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(asid);
+
+	local_irq_restore(flags);
+	if (cpu_has_mipsmt)
+		evpe(vpflags);
+
+	dec_preempt_count();
+	preempt_check_resched();
+}
+
+void copy_user_highpage(struct page *to, struct page *from,
+			unsigned long vaddr, struct vm_area_struct *vma)
+{
+	char *vfrom, *vto;
+	/*
+	 * Map 'from' page to same color with vaddr and map 'to' page
+	 * to kernel, and flush 'to' page if needed.
+	 * Just using kmap_coherent for both 'from' and 'to' (and no
+	 * flushing) is not enough because:
+	 * 1. The signal trampoline code should be flushed to main memory.
+	 * 2. The page 'to' might have been cached via kernel mapping.
+	 */
+	vfrom = kmap_coherent(from, vaddr);
+	vto = kmap_atomic(to, KM_USER1);
+	copy_page(vto, vfrom);
+	if (((vma->vm_flags & VM_EXEC) && !cpu_has_ic_fills_f_dc) ||
+	    (cpu_has_dc_aliases && pages_do_alias((unsigned long)vto, vaddr)))
+		flush_data_cache_page((unsigned long)vto);
+	kunmap_atomic(vto, KM_USER1);
+	kunmap_coherent();
+	/* Make sure this page is cleared on other CPU's too before using it */
+	smp_wmb();
+}
+
+EXPORT_SYMBOL(copy_user_highpage);
+
+void __copy_to_user_page(struct vm_area_struct *vma,
+	struct page *page, unsigned long vaddr, const void *src,
+	unsigned long len)
+{
+	char *vto;
+
+	vto = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK);
+	memcpy(vto, src, len);
+	kunmap_coherent();
+	flush_icache_page(vma, page);
+}
+
+EXPORT_SYMBOL(__copy_to_user_page);
+
+void __copy_from_user_page(struct page *page, unsigned long vaddr,
+	void *dst, unsigned long len)
+{
+	char *vfrom;
+
+	vfrom = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK);
+	memcpy(dst, vfrom, len);
+	kunmap_coherent();
+}
+
+EXPORT_SYMBOL(__copy_from_user_page);
+
+
 #ifdef CONFIG_HIGHMEM
 pte_t *kmap_pte;
 pgprot_t kmap_prot;
diff --git a/include/asm-mips/cacheflush.h b/include/asm-mips/cacheflush.h
index aeae9fa..7e4c30d 100644
--- a/include/asm-mips/cacheflush.h
+++ b/include/asm-mips/cacheflush.h
@@ -53,23 +53,23 @@ extern void (*flush_icache_range)(unsign
 #define flush_cache_vmap(start, end)		flush_cache_all()
 #define flush_cache_vunmap(start, end)		flush_cache_all()
 
+extern void __copy_to_user_page(struct vm_area_struct *vma,
+	struct page *page, unsigned long vaddr, const void *src,
+	unsigned long len);
 static inline 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);
+	__copy_to_user_page(vma, page, vaddr, src, len);
 }
 
+extern void __copy_from_user_page(struct page *page, unsigned long vaddr,
+	void *dst, unsigned long len);
 static inline 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);
+	__copy_from_user_page(page, vaddr, dst, len);
 }
 
 extern void (*flush_cache_sigtramp)(unsigned long addr);
diff --git a/include/asm-mips/fixmap.h b/include/asm-mips/fixmap.h
index 73a3028..3dc8af6 100644
--- a/include/asm-mips/fixmap.h
+++ b/include/asm-mips/fixmap.h
@@ -46,8 +46,12 @@
  * fix-mapped?
  */
 enum fixed_addresses {
+#define FIX_N_COLOURS 8
+	FIX_CMAP_BEGIN,
+	FIX_CMAP_END = FIX_CMAP_BEGIN + FIX_N_COLOURS,
 #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 +74,7 @@ extern void __set_fixmap (enum fixed_add
  * 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/page.h b/include/asm-mips/page.h
index ee25a77..a896495 100644
--- a/include/asm-mips/page.h
+++ b/include/asm-mips/page.h
@@ -62,15 +62,11 @@ 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);
-
-	copy_page(vto, vfrom);
-	if (pages_do_alias((unsigned long)vto, vaddr))
-		flush_data_cache_page((unsigned long)vto);
-}
+struct vm_area_struct;
+extern void copy_user_highpage(struct page *to, struct page *from,
+	unsigned long vaddr, struct vm_area_struct *vma);
+
+#define __HAVE_ARCH_COPY_USER_HIGHPAGE
 
 /*
  * These are used to make use of C type-checking..
diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index 6bece92..768914a 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -78,7 +78,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;
 
@@ -91,6 +94,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 2bee1f2..653b08f 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1386,7 +1386,7 @@ 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
@@ -1410,7 +1410,7 @@ static inline void cow_user_page(struct 
 		return;
 		
 	}
-	copy_user_highpage(dst, src, va);
+	copy_user_highpage(dst, src, va, vma);
 }
 
 /*
@@ -1475,7 +1475,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);
 	}
 
 	/*
@@ -2074,7 +2074,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 anemo@mba.ocn.ne.jp Tue Feb 14 13:34:40 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Feb 2006 13:34:49 +0000 (GMT)
Received: from mba.ocn.ne.jp ([210.190.142.172]:25074 "HELO smtp.mba.ocn.ne.jp")
	by ftp.linux-mips.org with SMTP id S8133495AbWBNNek (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Tue, 14 Feb 2006 13:34:40 +0000
Received: from localhost (p3141-ipad30funabasi.chiba.ocn.ne.jp [221.184.78.141])
	by smtp.mba.ocn.ne.jp (Postfix) with ESMTP
	id BF2CA94F0; Tue, 14 Feb 2006 22:40:58 +0900 (JST)
Date:	Tue, 14 Feb 2006 22:40:45 +0900 (JST)
Message-Id: <20060214.224045.41632501.anemo@mba.ocn.ne.jp>
To:	linux-mips@linux-mips.org
Cc:	ralf@linux-mips.org
Subject: [PATCH] fix typo in _sys32_rt_sigreturn, _sysn32_rt_sigreturn
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: 10458
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
Content-Length: 1193
Lines: 28

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

diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c
index da3271e..8a8b8dd 100644
--- a/arch/mips/kernel/signal32.c
+++ b/arch/mips/kernel/signal32.c
@@ -537,7 +537,7 @@ _sys32_rt_sigreturn(nabi_no_regargs stru
 	/* The ucontext contains a stack32_t, so we must convert!  */
 	if (__get_user(sp, &frame->rs_uc.uc_stack.ss_sp))
 		goto badframe;
-	st.ss_size = (long) sp;
+	st.ss_sp = (void *)(long) sp;
 	if (__get_user(st.ss_size, &frame->rs_uc.uc_stack.ss_size))
 		goto badframe;
 	if (__get_user(st.ss_flags, &frame->rs_uc.uc_stack.ss_flags))
diff --git a/arch/mips/kernel/signal_n32.c b/arch/mips/kernel/signal_n32.c
index 384fc4a..5a37760 100644
--- a/arch/mips/kernel/signal_n32.c
+++ b/arch/mips/kernel/signal_n32.c
@@ -108,7 +108,7 @@ _sysn32_rt_sigreturn(nabi_no_regargs str
 	/* The ucontext contains a stack32_t, so we must convert!  */
 	if (__get_user(sp, &frame->rs_uc.uc_stack.ss_sp))
 		goto badframe;
-	st.ss_size = (long) sp;
+	st.ss_sp = (void *)(long) sp;
 	if (__get_user(st.ss_size, &frame->rs_uc.uc_stack.ss_size))
 		goto badframe;
 	if (__get_user(st.ss_flags, &frame->rs_uc.uc_stack.ss_flags))

From kevink@mips.com Tue Feb 14 13:39:57 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Feb 2006 13:40:06 +0000 (GMT)
Received: from 209-232-97-206.ded.pacbell.net ([209.232.97.206]:61099 "EHLO
	dns0.mips.com") by ftp.linux-mips.org with ESMTP id S8133495AbWBNNj4
	(ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 14 Feb 2006 13:39:56 +0000
Received: from mercury.mips.com (sbcns-dmz [209.232.97.193])
	by dns0.mips.com (8.12.11/8.12.11) with ESMTP id k1EDk9rX013520;
	Tue, 14 Feb 2006 05:46:10 -0800 (PST)
Received: from [192.168.236.16] (grendel [192.168.236.16])
	by mercury.mips.com (8.12.9/8.12.11) with ESMTP id k1EDk689013611;
	Tue, 14 Feb 2006 05:46:07 -0800 (PST)
Message-ID: <43F1DFB7.1060106@mips.com>
Date:	Tue, 14 Feb 2006 14:48:39 +0100
From:	"Kevin D. Kissell" <kevink@mips.com>
User-Agent: Thunderbird 1.5 (X11/20051025)
MIME-Version: 1.0
To:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
CC:	yoichi_yuasa@tripeaks.co.jp, linux-mips@linux-mips.org,
	ralf@linux-mips.org
Subject: Re: [PATCH] fix cache coherency issues
References: <200602140707.k1E77Tah013064@mbox00.po.2iij.net>	<20060214.164216.48797359.nemoto@toshiba-tops.co.jp>	<200602140856.k1E8uvm1021728@mbox03.po.2iij.net> <20060214.191215.115641299.nemoto@toshiba-tops.co.jp>
In-Reply-To: <20060214.191215.115641299.nemoto@toshiba-tops.co.jp>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Scanned-By: MIMEDefang 2.39
Return-Path: <kevink@mips.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: 10459
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: kevink@mips.com
Precedence: bulk
X-list: linux-mips
Content-Length: 1478
Lines: 37

Atsushi Nemoto wrote:
>>>>>> On Tue, 14 Feb 2006 17:56:57 +0900, Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp> said:
> yuasa> This patch fixed the boot problem, but the kernel still has
> yuasa> cache coherency problem.
> 
> yuasa> ~# ./cachetest 
> yuasa> Test separation: 4096 bytes: FAIL - cache not coherent
> 
> Thank you for testing.
> 
> As for the cachetest program, I think the test program is wrong.
> 
> It try to mmap offset 0 of a shared file to odd address page with
> MAP_FIXED.  It means "I want non-coherent mapping if dcache alias
> exists".  Currently the kernel surely gives what the program want.
> 
> The kernel might have to return EINVAL in such case, but I'm not sure
> which is the right behavior.  Please look at David S. Miller's
> comments, for example, http://lkml.org/lkml/2003/9/1/48

I've been maintaining for years that EINVAL is the correct
thing to do when the kernel detects that a user is requesting
a mapping that the kernel knows will create aliasing problems,
but this ran counter to the "serves the user right" philosophy
that seemed to dominate the Linux kernel community.  I'm
pleased to see that the tide seems to be shifting.  As an old-time
BSD/SysV hacker from the 1980s, I view system calls as a
contract with the user: if the kernel says it's OK, it's
supposed to work, period.

But I better get down off my soapbox before I launch into
my rant about the OOM killer being proof of a failed paradigm... ;o)

		Regards,

		Kevin K.


From ralf@linux-mips.org Tue Feb 14 14:47:15 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Feb 2006 14:47:23 +0000 (GMT)
Received: from mipsfw.mips-uk.com ([194.74.144.146]:31243 "EHLO
	bacchus.dhis.org") by ftp.linux-mips.org with ESMTP
	id S8133430AbWBNOrP (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 14 Feb 2006 14:47:15 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by bacchus.dhis.org (8.13.4/8.13.4) with ESMTP id k1EErh4c021395;
	Tue, 14 Feb 2006 14:53:43 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.4/8.13.4/Submit) id k1EErgcX021394;
	Tue, 14 Feb 2006 14:53:42 GMT
Date:	Tue, 14 Feb 2006 14:53:42 +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] fix typo in _sys32_rt_sigreturn, _sysn32_rt_sigreturn
Message-ID: <20060214145342.GA21016@linux-mips.org>
References: <20060214.224045.41632501.anemo@mba.ocn.ne.jp>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20060214.224045.41632501.anemo@mba.ocn.ne.jp>
User-Agent: Mutt/1.4.2.1i
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: 10460
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
Content-Length: 137
Lines: 7

On Tue, Feb 14, 2006 at 10:40:45PM +0900, Atsushi Nemoto wrote:

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

Applied,

  Ralf

From ralf@linux-mips.org Tue Feb 14 16:24:25 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Feb 2006 16:24:34 +0000 (GMT)
Received: from mipsfw.mips-uk.com ([194.74.144.146]:41753 "EHLO
	bacchus.dhis.org") by ftp.linux-mips.org with ESMTP
	id S8133495AbWBNQYZ (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 14 Feb 2006 16:24:25 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by bacchus.dhis.org (8.13.4/8.13.4) with ESMTP id k1EGPrvC030805;
	Tue, 14 Feb 2006 16:25:53 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.4/8.13.4/Submit) id k1EGPo3P030803;
	Tue, 14 Feb 2006 16:25:50 GMT
Date:	Tue, 14 Feb 2006 16:25:50 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	Martin Michlmayr <tbm@cyrius.com>
Cc:	"Maciej W. Rozycki" <macro@linux-mips.org>,
	"Peter 'p2' De Schrijver" <p2@mind.be>, linux-mips@linux-mips.org
Subject: Re: DECstation R3000 boot error
Message-ID: <20060214162550.GC21016@linux-mips.org>
References: <20060123225040.GA23576@deprecation.cyrius.com> <Pine.LNX.4.64N.0601241059140.11021@blysk.ds.pg.gda.pl> <20060124122700.GA8527@deprecation.cyrius.com> <Pine.LNX.4.64N.0601241227290.11021@blysk.ds.pg.gda.pl> <20060124232117.GA4165@codecarver> <Pine.LNX.4.64N.0601251103020.7675@blysk.ds.pg.gda.pl> <20060203150232.GA25701@deprecation.cyrius.com> <Pine.LNX.4.64N.0602061021110.32080@blysk.ds.pg.gda.pl> <Pine.LNX.4.64N.0602130911260.17051@blysk.ds.pg.gda.pl> <20060213223951.GA4226@deprecation.cyrius.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20060213223951.GA4226@deprecation.cyrius.com>
User-Agent: Mutt/1.4.2.1i
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: 10461
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
Content-Length: 304
Lines: 8

On Mon, Feb 13, 2006 at 10:39:51PM +0000, Martin Michlmayr wrote:

>   LD      .tmp_vmlinux1
> arch/mips/kernel/built-in.o: In function `einval':arch/mips/kernel/scall32-o32.S:(.text+0xb6c0): undefined reference to `sys_newfstatat'

Fixed yesterday, didn't get around to push it out until today.

  Ralf

From ralf@linux-mips.org Tue Feb 14 16:25:57 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Feb 2006 16:26:06 +0000 (GMT)
Received: from mipsfw.mips-uk.com ([194.74.144.146]:52505 "EHLO
	bacchus.dhis.org") by ftp.linux-mips.org with ESMTP
	id S8133476AbWBNQZ5 (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 14 Feb 2006 16:25:57 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by bacchus.dhis.org (8.13.4/8.13.4) with ESMTP id k1EGRMJ0030836;
	Tue, 14 Feb 2006 16:27:22 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.4/8.13.4/Submit) id k1EGRMwf030835;
	Tue, 14 Feb 2006 16:27:22 GMT
Date:	Tue, 14 Feb 2006 16:27:22 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	Martin Michlmayr <tbm@cyrius.com>
Cc:	"Maciej W. Rozycki" <macro@linux-mips.org>,
	"Peter 'p2' De Schrijver" <p2@mind.be>, linux-mips@linux-mips.org
Subject: Re: DECstation R3000 boot error
Message-ID: <20060214162722.GD21016@linux-mips.org>
References: <Pine.LNX.4.64N.0601241059140.11021@blysk.ds.pg.gda.pl> <20060124122700.GA8527@deprecation.cyrius.com> <Pine.LNX.4.64N.0601241227290.11021@blysk.ds.pg.gda.pl> <20060124232117.GA4165@codecarver> <Pine.LNX.4.64N.0601251103020.7675@blysk.ds.pg.gda.pl> <20060203150232.GA25701@deprecation.cyrius.com> <Pine.LNX.4.64N.0602061021110.32080@blysk.ds.pg.gda.pl> <Pine.LNX.4.64N.0602130911260.17051@blysk.ds.pg.gda.pl> <20060213223951.GA4226@deprecation.cyrius.com> <20060213224733.GA4983@deprecation.cyrius.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20060213224733.GA4983@deprecation.cyrius.com>
User-Agent: Mutt/1.4.2.1i
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: 10462
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
Content-Length: 650
Lines: 16

On Mon, Feb 13, 2006 at 10:47:33PM +0000, Martin Michlmayr wrote:

> >   LD      .tmp_vmlinux1
> > arch/mips/kernel/built-in.o: In function `einval':arch/mips/kernel/scall32-o32.S:(.text+0xb6c0): undefined reference to `sys_newfstatat'
> > 
> > This is with binutils 2.16.1cvs20060117-1 and gcc 4.0.3 20051201.
> 
> I see a fix for this just went into Linus' git tree.  Can we have this
> in the linux-mips tree too please.
> 
> http://www.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=326a625748535c4cdb1c632b1dcb07030989a393

Ah, Yoichi at it again.  He really loves sending patches upstream without
letting me know.

  Ralf

From nigel@mips.com Tue Feb 14 18:54:50 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Feb 2006 18:54:59 +0000 (GMT)
Received: from 209-232-97-206.ded.pacbell.net ([209.232.97.206]:27054 "EHLO
	dns0.mips.com") by ftp.linux-mips.org with ESMTP id S8133495AbWBNSyu
	(ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 14 Feb 2006 18:54:50 +0000
Received: from mercury.mips.com (sbcns-dmz [209.232.97.193])
	by dns0.mips.com (8.12.11/8.12.11) with ESMTP id k1EJ12Ns015196;
	Tue, 14 Feb 2006 11:01:03 -0800 (PST)
Received: from olympia.mips.com (olympia [192.168.192.128])
	by mercury.mips.com (8.12.9/8.12.11) with ESMTP id k1EJ1189020181;
	Tue, 14 Feb 2006 11:01:01 -0800 (PST)
Received: from officemobile.mips-dk.mips.com ([192.168.192.20] helo=[127.0.0.1])
	by olympia.mips.com with esmtp (Exim 3.36 #1 (Debian))
	id 1F95Px-0006BW-00; Tue, 14 Feb 2006 19:00:53 +0000
Message-ID: <43F228E4.40200@mips.com>
Date:	Tue, 14 Feb 2006 19:00:52 +0000
From:	Nigel Stephens <nigel@mips.com>
User-Agent: Thunderbird 1.5 (Windows/20051201)
MIME-Version: 1.0
To:	zhuzhenhua <zzh.hust@gmail.com>
CC:	linux-mips <linux-mips@linux-mips.org>
Subject: Re: does any other cross-tool support UID instruction?
References: <50c9a2250602121738r59f5fed0s800e43f9d232c6eb@mail.gmail.com>
In-Reply-To: <50c9a2250602121738r59f5fed0s800e43f9d232c6eb@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-MTUK-Scanner:	Found to be clean
X-MTUK-SpamCheck: not spam (whitelisted), SpamAssassin (score=-4.809,
	required 4, AWL, BAYES_00)
X-Scanned-By: MIMEDefang 2.39
Return-Path: <nigel@mips.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: 10463
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: nigel@mips.com
Precedence: bulk
X-list: linux-mips
Content-Length: 555
Lines: 16

zhuzhenhua wrote:
> i want to use the UID instruction in my application or library, but
> the sde toolchain on support to compile bootloader or kernel.
> how to use it to compile a application or library?
> or does any other cross-tool support UID instruction?
> thanks for any hints
>
>   

I assume that you mean the UDI instruction. You could consider the 
TimeSys Linuxlink MIPS distribution see 
http://www.timesys.com/releases/home_bdy_news.php?show_article=1265 
which will include MIPS SDE configured as a full Linux MIPS cross-toolchain.

Nigel


From mips@catchmedia.com Tue Feb 14 21:23:58 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Feb 2006 21:25:03 +0000 (GMT)
Received: from phoebe.catchmedia.com ([66.139.79.199]:35003 "EHLO
	phoebe.catchmedia.com") by ftp.linux-mips.org with ESMTP
	id S8133507AbWBNVX6 (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 14 Feb 2006 21:23:58 +0000
Received: from [192.168.2.81] (80.178.104.73.adsl.012.net.il [80.178.104.73])
	by phoebe.catchmedia.com (Postfix) with ESMTP id E05505901A1
	for <linux-mips@linux-mips.org>; Tue, 14 Feb 2006 21:30:21 +0000 (UTC)
From:	Avi Lieberman <mips@catchmedia.com>
Reply-To: mips@catchmedia.com
To:	linux-mips@linux-mips.org
Subject: Position available - AMD MIPS Linux development
Date:	Tue, 14 Feb 2006 23:30:19 +0200
User-Agent: KMail/1.8.3
MIME-Version: 1.0
Content-Type: text/plain;
  charset="us-ascii"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200602142330.19144.mips@catchmedia.com>
Return-Path: <mips@catchmedia.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: 10464
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: mips@catchmedia.com
Precedence: bulk
X-list: linux-mips
Content-Length: 989
Lines: 28

All,

My company, Catch Media, Inc., a Silicon Valley startup, has an opening for an 
embedded linux developer.  Position is technically in San Jose, but 
telecommute may be an option. Project-based work also an option. 
Requirements are as follows:

   * Bachelors degree in computer science or electrical engineering
   * Advanced degree a plus
   * Proven experience with linux on embedded platforms
   * Knowledge of JTAG interface
   * Knowledge of AMD MIPS chips a plus
   * Experience developing consumer devices
   * Broad and deep linux knowledge
   * Experience writing device drivers
   * Ability to work independently
   * Ability to deliver results in a deadline-driven environment

Catch Media is a three year old startup working in the digital entertainment 
space. Our founders are successful entrepreneurs, and we have a top-notch 
team in place. If this positions interests you, please email me at 
mips@catchmedia.com

Thank you,

Avi Lieberman
VP R&D
Catch Media, Inc.

From yoichi_yuasa@tripeaks.co.jp Tue Feb 14 22:57:45 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 14 Feb 2006 22:57:54 +0000 (GMT)
Received: from mo00.po.2iij.net ([210.130.202.204]:7917 "EHLO mo00.po.2iij.net")
	by ftp.linux-mips.org with ESMTP id S8133507AbWBNW5p (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Tue, 14 Feb 2006 22:57:45 +0000
Received: NPO MO00 id k1EN422E017301; Wed, 15 Feb 2006 08:04:02 +0900 (JST)
Received: from stratos (87.26.30.125.dy.iij4u.or.jp [125.30.26.87])
	by mbox.po.2iij.net (NPO-MR/mbox01) id k1EN41T8007816
	(version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NOT);
	Wed, 15 Feb 2006 08:04:01 +0900 (JST)
Date:	Wed, 15 Feb 2006 08:04:00 +0900
From:	Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
To:	Ralf Baechle <ralf@linux-mips.org>
Cc:	yoichi_yuasa@tripeaks.co.jp, tbm@cyrius.com, macro@linux-mips.org,
	p2@mind.be, linux-mips@linux-mips.org
Subject: Re: DECstation R3000 boot error
Message-Id: <20060215080400.0e523f60.yoichi_yuasa@tripeaks.co.jp>
In-Reply-To: <20060214162722.GD21016@linux-mips.org>
References: <Pine.LNX.4.64N.0601241059140.11021@blysk.ds.pg.gda.pl>
	<20060124122700.GA8527@deprecation.cyrius.com>
	<Pine.LNX.4.64N.0601241227290.11021@blysk.ds.pg.gda.pl>
	<20060124232117.GA4165@codecarver>
	<Pine.LNX.4.64N.0601251103020.7675@blysk.ds.pg.gda.pl>
	<20060203150232.GA25701@deprecation.cyrius.com>
	<Pine.LNX.4.64N.0602061021110.32080@blysk.ds.pg.gda.pl>
	<Pine.LNX.4.64N.0602130911260.17051@blysk.ds.pg.gda.pl>
	<20060213223951.GA4226@deprecation.cyrius.com>
	<20060213224733.GA4983@deprecation.cyrius.com>
	<20060214162722.GD21016@linux-mips.org>
Organization: TriPeaks Corporation
X-Mailer: Sylpheed version 1.0.6 (GTK+ 1.2.10; i486-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-Envid: tripeaks.co.jp
Envelope-Id: tripeaks.co.jp
X-archive-position: 10465
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
Content-Length: 783
Lines: 21

On Tue, 14 Feb 2006 16:27:22 +0000
Ralf Baechle <ralf@linux-mips.org> wrote:

> On Mon, Feb 13, 2006 at 10:47:33PM +0000, Martin Michlmayr wrote:
> 
> > >   LD      .tmp_vmlinux1
> > > arch/mips/kernel/built-in.o: In function `einval':arch/mips/kernel/scall32-o32.S:(.text+0xb6c0): undefined reference to `sys_newfstatat'
> > > 
> > > This is with binutils 2.16.1cvs20060117-1 and gcc 4.0.3 20051201.
> > 
> > I see a fix for this just went into Linus' git tree.  Can we have this
> > in the linux-mips tree too please.
> > 
> > http://www.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=326a625748535c4cdb1c632b1dcb07030989a393
> 
> Ah, Yoichi at it again.  He really loves sending patches upstream without
> letting me know.

Sorry, I forgot add Cc: .

Yoichi

From anemo@mba.ocn.ne.jp Wed Feb 15 09:19:25 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 15 Feb 2006 09:19:36 +0000 (GMT)
Received: from topsns2.toshiba-tops.co.jp ([202.230.225.126]:32619 "EHLO
	topsns2.toshiba-tops.co.jp") by ftp.linux-mips.org with ESMTP
	id S8133478AbWBOJTZ (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 15 Feb 2006 09:19:25 +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; Wed, 15 Feb 2006 18:25:51 +0900
Received: from topsms.toshiba-tops.co.jp (localhost.localdomain [127.0.0.1])
	by localhost.toshiba-tops.co.jp (Postfix) with ESMTP id 84BBD20011;
	Wed, 15 Feb 2006 18:25:49 +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 786B11F54C;
	Wed, 15 Feb 2006 18:25:49 +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 k1F9Pn4D081047;
	Wed, 15 Feb 2006 18:25:49 +0900 (JST)
	(envelope-from anemo@mba.ocn.ne.jp)
Date:	Wed, 15 Feb 2006 18:25:48 +0900 (JST)
Message-Id: <20060215.182548.118975142.nemoto@toshiba-tops.co.jp>
To:	linux-mips@linux-mips.org
Cc:	ralf@linux-mips.org
Subject: [PATCH] sc-rm7k.c 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.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: 10466
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
Content-Length: 2316
Lines: 78

Use blast_scache_range, blast_inv_scache_range for rm7k scache routine.
Output code should be logically same.

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

diff --git a/arch/mips/mm/sc-rm7k.c b/arch/mips/mm/sc-rm7k.c
index 9e8ff8b..3b6cc9b 100644
--- a/arch/mips/mm/sc-rm7k.c
+++ b/arch/mips/mm/sc-rm7k.c
@@ -9,6 +9,7 @@
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/mm.h>
+#include <linux/bitops.h>
 
 #include <asm/addrspace.h>
 #include <asm/bcache.h>
@@ -43,14 +44,7 @@ static void rm7k_sc_wback_inv(unsigned l
 	/* Catch bad driver code */
 	BUG_ON(size == 0);
 
-	a = addr & ~(sc_lsize - 1);
-	end = (addr + size - 1) & ~(sc_lsize - 1);
-	while (1) {
-		flush_scache_line(a);	/* Hit_Writeback_Inv_SD */
-		if (a == end)
-			break;
-		a += sc_lsize;
-	}
+	blast_scache_range(addr, addr + size);
 
 	if (!rm7k_tcache_enabled)
 		return;
@@ -74,14 +68,7 @@ static void rm7k_sc_inv(unsigned long ad
 	/* Catch bad driver code */
 	BUG_ON(size == 0);
 
-	a = addr & ~(sc_lsize - 1);
-	end = (addr + size - 1) & ~(sc_lsize - 1);
-	while (1) {
-		invalidate_scache_line(a);	/* Hit_Invalidate_SD */
-		if (a == end)
-			break;
-		a += sc_lsize;
-	}
+	blast_inv_scache_range(addr, addr + size);
 
 	if (!rm7k_tcache_enabled)
 		return;
@@ -143,11 +130,17 @@ struct bcache_ops rm7k_sc_ops = {
 
 void __init rm7k_sc_init(void)
 {
+	struct cpuinfo_mips *c = &current_cpu_data;
 	unsigned int config = read_c0_config();
 
 	if ((config & RM7K_CONF_SC))
 		return;
 
+	c->scache.linesz = sc_lsize;
+	c->scache.ways = 4;
+	c->scache.waybit= ffs(scache_size / c->scache.ways) - 1;
+	c->scache.waysize = scache_size / c->scache.ways;
+	c->scache.sets = scache_size / (c->scache.linesz * c->scache.ways);
 	printk(KERN_INFO "Secondary cache size %dK, linesize %d bytes.\n",
 	       (scache_size >> 10), sc_lsize);
 
diff --git a/include/asm-mips/r4kcache.h b/include/asm-mips/r4kcache.h
index 9632c27..42f7be2 100644
--- a/include/asm-mips/r4kcache.h
+++ b/include/asm-mips/r4kcache.h
@@ -302,5 +302,6 @@ __BUILD_BLAST_CACHE_RANGE(d, dcache, Hit
 __BUILD_BLAST_CACHE_RANGE(s, scache, Hit_Writeback_Inv_SD, )
 /* blast_inv_dcache_range */
 __BUILD_BLAST_CACHE_RANGE(inv_d, dcache, Hit_Invalidate_D, )
+__BUILD_BLAST_CACHE_RANGE(inv_s, scache, Hit_Invalidate_SD, )
 
 #endif /* _ASM_R4KCACHE_H */

From TheMole@mail.be Wed Feb 15 10:50:33 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 15 Feb 2006 10:50:42 +0000 (GMT)
Received: from WILBUR.CONTACTOFFICE.NET ([212.3.242.68]:7066 "EHLO
	wilbur.contactoffice.net") by ftp.linux-mips.org with ESMTP
	id S8133521AbWBOKud (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 15 Feb 2006 10:50:33 +0000
Received: from pumbaa (pumbaa.contactoffice.com [10.0.0.3])
	by wilbur.contactoffice.net (Postfix) with ESMTP id 927E71238E5
	for <linux-mips@linux-mips.org>; Wed, 15 Feb 2006 11:57:00 +0100 (CET)
Message-ID: <2811923.1140001023878.JavaMail.root@pumbaa>
Date:	Wed, 15 Feb 2006 11:57:03 +0100 (CET)
From:	The Mole <TheMole@mail.be>
Reply-To: The Mole <TheMole@mail.be>
To:	linux-mips@linux-mips.org
Subject: usb-serial generic AMD DBAu1200
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-Origin-IP: 193.190.131.17
X-Mailer: ContactOffice Mail
Return-Path: <TheMole@mail.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: 10467
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: TheMole@mail.be
Precedence: bulk
X-list: linux-mips
Content-Length: 836
Lines: 16

Hi,

I'm currently experimenting with an AMD DBAu1200 devboard and the kernel AMD provided with it (a 2.6.11 derivative...). I only intend to use the usb ports actually... don't care much about the rest...

The problem I'm having is the following:
I succesfully compiled usb-serial as a module (with generic support) and the module loads fine (with the vendor en product parameters). If I however plugin the USB device with said vendor en product id's, the driver does not 'attach' itself to the device. The system recognises a new usb device, the driver is loaded fine... the interaction between both doesn't seem to be happening at all though...

Has anyone experienced this before? Any ideas are welcome...

Thanks,

Danny
-----------------------------------------------------
Mail.be, WebMail and Virtual Office
http://www.mail.be


From ralf@linux-mips.org Wed Feb 15 13:05:11 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 15 Feb 2006 13:05:19 +0000 (GMT)
Received: from mipsfw.mips-uk.com ([194.74.144.146]:27660 "EHLO
	bacchus.dhis.org") by ftp.linux-mips.org with ESMTP
	id S8133508AbWBONFL (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 15 Feb 2006 13:05:11 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by bacchus.dhis.org (8.13.4/8.13.4) with ESMTP id k1FDBhH2025960;
	Wed, 15 Feb 2006 13:11:43 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.4/8.13.4/Submit) id k1FDBgAE025959;
	Wed, 15 Feb 2006 13:11:42 GMT
Date:	Wed, 15 Feb 2006 13:11:42 +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] sc-rm7k.c cleanup
Message-ID: <20060215131142.GA24149@linux-mips.org>
References: <20060215.182548.118975142.nemoto@toshiba-tops.co.jp>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20060215.182548.118975142.nemoto@toshiba-tops.co.jp>
User-Agent: Mutt/1.4.2.1i
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: 10468
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
Content-Length: 211
Lines: 8

On Wed, Feb 15, 2006 at 06:25:48PM +0900, Atsushi Nemoto wrote:

> Use blast_scache_range, blast_inv_scache_range for rm7k scache routine.
> Output code should be logically same.

Ok, queued for 2.6.17.

  Ralf

From ralf@linux-mips.org Wed Feb 15 15:03:09 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 15 Feb 2006 15:03:17 +0000 (GMT)
Received: from mipsfw.mips-uk.com ([194.74.144.146]:19214 "EHLO
	bacchus.dhis.org") by ftp.linux-mips.org with ESMTP
	id S8133529AbWBOPDJ (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Wed, 15 Feb 2006 15:03:09 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by bacchus.dhis.org (8.13.4/8.13.4) with ESMTP id k1FF8ea4011160;
	Wed, 15 Feb 2006 15:08:40 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.4/8.13.4/Submit) id k1FF8dG1011159;
	Wed, 15 Feb 2006 15:08:39 GMT
Date:	Wed, 15 Feb 2006 15:08:39 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	Martin Michlmayr <tbm@cyrius.com>
Cc:	"Maciej W. Rozycki" <macro@linux-mips.org>,
	linux-mips@linux-mips.org
Subject: Re: Please pull drivers/scsi/dec_esp.c from Linus' git
Message-ID: <20060215150839.GA27719@linux-mips.org>
References: <20060213225331.GA5315@deprecation.cyrius.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20060213225331.GA5315@deprecation.cyrius.com>
User-Agent: Mutt/1.4.2.1i
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: 10469
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
Content-Length: 460
Lines: 17

On Mon, Feb 13, 2006 at 10:53:31PM +0000, Martin Michlmayr wrote:

> @@ -230,7 +230,7 @@
>  			mem_start = get_tc_base_addr(slot);
>  
>  			/* Store base addr into esp struct */
> -			esp->slot = mem_start;
> +			esp->slot = CPHYSADDR(mem_start);
>  
>  			esp->dregs = 0;
>  			esp->eregs = (void *)CKSEG1ADDR(mem_start +

I merged allmost all of the differences from mainline except this one.

Maciej, does this need the CPHYSADDR() op or not here?

  Ralf

From macro@linux-mips.org Thu Feb 16 10:11:11 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 16 Feb 2006 10:11:21 +0000 (GMT)
Received: from pollux.ds.pg.gda.pl ([153.19.208.7]:16400 "EHLO
	pollux.ds.pg.gda.pl") by ftp.linux-mips.org with ESMTP
	id S8133375AbWBPKLL (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Thu, 16 Feb 2006 10:11:11 +0000
Received: from localhost (localhost [127.0.0.1])
	by pollux.ds.pg.gda.pl (Postfix) with ESMTP id 2A8C4F5BD2;
	Thu, 16 Feb 2006 11:17:39 +0100 (CET)
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 05396-04; Thu, 16 Feb 2006 11:17:38 +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 BEC86F59D6;
	Thu, 16 Feb 2006 11:17:38 +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.3/8.13.1) with ESMTP id k1GAHaJq020859;
	Thu, 16 Feb 2006 11:17:37 +0100
Date:	Thu, 16 Feb 2006 10:17:38 +0000 (GMT)
From:	"Maciej W. Rozycki" <macro@linux-mips.org>
To:	Ralf Baechle <ralf@linux-mips.org>
cc:	Martin Michlmayr <tbm@cyrius.com>, linux-mips@linux-mips.org
Subject: Re: Please pull drivers/scsi/dec_esp.c from Linus' git
In-Reply-To: <20060215150839.GA27719@linux-mips.org>
Message-ID: <Pine.LNX.4.64N.0602161016260.7169@blysk.ds.pg.gda.pl>
References: <20060213225331.GA5315@deprecation.cyrius.com>
 <20060215150839.GA27719@linux-mips.org>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Virus-Scanned: ClamAV version 0.88, clamav-milter version 0.87 on piorun.ds.pg.gda.pl
X-Virus-Status:	Clean
X-Virus-Scanned: by amavisd-new at pollux.ds.pg.gda.pl
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: 10470
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
Content-Length: 572
Lines: 20

On Wed, 15 Feb 2006, Ralf Baechle wrote:

> > @@ -230,7 +230,7 @@
> >  			mem_start = get_tc_base_addr(slot);
> >  
> >  			/* Store base addr into esp struct */
> > -			esp->slot = mem_start;
> > +			esp->slot = CPHYSADDR(mem_start);
> >  
> >  			esp->dregs = 0;
> >  			esp->eregs = (void *)CKSEG1ADDR(mem_start +
> 
> I merged allmost all of the differences from mainline except this one.
> 
> Maciej, does this need the CPHYSADDR() op or not here?

 Of course not as get_tc_base_addr() returns a physical address these 
days.  Thanks for spotting this bit.

  Maciej

From hemant.mohan@wipro.com Thu Feb 16 12:40:33 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 16 Feb 2006 12:40:42 +0000 (GMT)
Received: from wip-ec-wd.wipro.com ([203.91.193.32]:25512 "EHLO
	wip-ec-wd.wipro.com") by ftp.linux-mips.org with ESMTP
	id S8133398AbWBPMkd (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Thu, 16 Feb 2006 12:40:33 +0000
Received: from wip-ec-wd.wipro.com (localhost.wipro.com [127.0.0.1])
	by localhost (Postfix) with ESMTP id B000D20618
	for <linux-mips@linux-mips.org>; Thu, 16 Feb 2006 18:01:52 +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 92DA4205DA
	for <linux-mips@linux-mips.org>; Thu, 16 Feb 2006 18:01:52 +0530 (IST)
Received: from PNE-HJN-MBX01.wipro.com ([10.111.50.182]) by blr-ec-bh01.wipro.com with Microsoft SMTPSVC(6.0.3790.1830);
	 Thu, 16 Feb 2006 18:16:58 +0530
Received: from [10.111.17.97] ([10.111.17.97]) by PNE-HJN-MBX01.wipro.com with Microsoft SMTPSVC(6.0.3790.1830);
	 Thu, 16 Feb 2006 18:16:57 +0530
Message-ID: <43F47420.9080708@wipro.com>
Date:	Thu, 16 Feb 2006 18:16:24 +0530
From:	Hemant Mohan <hemant.mohan@wipro.com>
Reply-To:  hemant.mohan@wipro.com
Organization: Wipro Technologies
User-Agent: Thunderbird 1.5 (X11/20051201)
MIME-Version: 1.0
To:	linux-mips@linux-mips.org
Subject: [PATCH] - PMC Titan network controller - compilation problem with
 gcc4.0.2
Content-Type: multipart/mixed;
 boundary="------------000605000809020206090109"
X-OriginalArrivalTime: 16 Feb 2006 12:46:57.0895 (UTC) FILETIME=[12B74770:01C632F7]
Return-Path: <hemant.mohan@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: 10471
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: hemant.mohan@wipro.com
Precedence: bulk
X-list: linux-mips
Content-Length: 1221
Lines: 38

This is a multi-part message in MIME format.
--------------000605000809020206090109
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

This fixes the compilation error in PMC Titan network Controller, with 
gcc 4.0.2.

Thanks,
Hemant


--------------000605000809020206090109
Content-Type: text/plain;
 name="linux-2.6.15-net-titan.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="linux-2.6.15-net-titan.patch"

Submitted By: Hemant Mohan (hemant dot mohan at wipro dot com)
Date: 2006-02-16
Initial Package Version: 2.6.15
Origin: Linux-MIPS
Description:  Fixes compilation error with PMC Titan network controller with gcc4.0.2

diff -Naur linux-2.6.15-mips-orig/drivers/net/titan_ge.h linux-mips-hemant-2.6.15/drivers/net/titan_ge.h
--- linux-2.6.15-mips-orig/drivers/net/titan_ge.h	2006-01-09 21:57:29.000000000 +0530
+++ linux-mips-hemant-2.6.15/drivers/net/titan_ge.h	2006-02-14 17:33:50.000000000 +0530
@@ -44,7 +44,6 @@
 #define	TITAN_SRAM_BASE		((OCD_READ(RM9000x2_OCD_LKB13) & ~1) << 4)
 #define	TITAN_SRAM_SIZE		0x2000UL
 
-extern unsigned long titan_ge_sram;
 
 /*
  * We may need these constants

--------------000605000809020206090109--

From joris_lijssens1980@yahoo.com Thu Feb 16 12:56:09 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 16 Feb 2006 12:56:18 +0000 (GMT)
Received: from web36102.mail.mud.yahoo.com ([66.163.179.216]:21651 "HELO
	web36102.mail.mud.yahoo.com") by ftp.linux-mips.org with SMTP
	id S8133398AbWBPM4J (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Thu, 16 Feb 2006 12:56:09 +0000
Received: (qmail 72705 invoked by uid 60001); 16 Feb 2006 13:02:36 -0000
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws;
  s=s1024; d=yahoo.com;
  h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding;
  b=1pSn8h6I6X9K95NH5r8sQ1KzUpTQLEqzyUhEGyT3nYN6gWUdpLRfoB8l25nHbbmtyeIp7VoQH8m6/A5CcUBzG6oJ3Ur83FrNMT+RWOdyUJI2KjGVGZYzajnCXgISmzMv1qgziIQcE8tFaanls/ngKVnWjsBUBsOlir076LO0fwE=  ;
Message-ID: <20060216130236.72703.qmail@web36102.mail.mud.yahoo.com>
Received: from [81.240.203.107] by web36102.mail.mud.yahoo.com via HTTP; Thu, 16 Feb 2006 13:02:36 GMT
Date:	Thu, 16 Feb 2006 13:02:36 +0000 (GMT)
From:	joris lijssens <joris_lijssens1980@yahoo.com>
Subject: patch to increase stack size 
To:	linux-mips@linux-mips.org
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Return-Path: <joris_lijssens1980@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: 10472
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: joris_lijssens1980@yahoo.com
Precedence: bulk
X-list: linux-mips
Content-Length: 487
Lines: 18

Hello,

I was wondering if there is a patch avaible to
increase the stack size on a mips 2.6 linux kernel. I
have found one for the i386 that sets the stack size
from 4K to 16K. But I don't find anything for the mips
kernel. I would like it if somebody has some info on
this topic.


regards

Joris


		
___________________________________________________________ 
To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com

From ralf@linux-mips.org Thu Feb 16 14:33:43 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 16 Feb 2006 14:33:51 +0000 (GMT)
Received: from mipsfw.mips-uk.com ([194.74.144.146]:35333 "EHLO
	bacchus.dhis.org") by ftp.linux-mips.org with ESMTP
	id S8133398AbWBPOdn (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Thu, 16 Feb 2006 14:33:43 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by bacchus.dhis.org (8.13.4/8.13.4) with ESMTP id k1GEeKgF003469;
	Thu, 16 Feb 2006 14:40:20 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.4/8.13.4/Submit) id k1GEeJM3003467;
	Thu, 16 Feb 2006 14:40:19 GMT
Date:	Thu, 16 Feb 2006 14:40:19 +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] make qemu buildable without CONFIG_VT
Message-ID: <20060216144019.GA2034@linux-mips.org>
References: <20060210.005104.63742308.anemo@mba.ocn.ne.jp>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20060210.005104.63742308.anemo@mba.ocn.ne.jp>
User-Agent: Mutt/1.4.2.1i
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: 10473
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
Content-Length: 140
Lines: 7

On Fri, Feb 10, 2006 at 12:51:04AM +0900, Atsushi Nemoto wrote:

> Subject: [PATCH] make qemu buildable without CONFIG_VT

Applied.

  Ralf

From anemo@mba.ocn.ne.jp Thu Feb 16 14:39:01 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 16 Feb 2006 14:39:11 +0000 (GMT)
Received: from mba.ocn.ne.jp ([210.190.142.172]:51698 "HELO smtp.mba.ocn.ne.jp")
	by ftp.linux-mips.org with SMTP id S8133398AbWBPOjB (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Thu, 16 Feb 2006 14:39:01 +0000
Received: from localhost (p6076-ipad212funabasi.chiba.ocn.ne.jp [58.91.170.76])
	by smtp.mba.ocn.ne.jp (Postfix) with ESMTP
	id E88CBB43E; Thu, 16 Feb 2006 23:45:31 +0900 (JST)
Date:	Thu, 16 Feb 2006 23:45:19 +0900 (JST)
Message-Id: <20060216.234519.82087885.anemo@mba.ocn.ne.jp>
To:	linux-mips@linux-mips.org
Cc:	ralf@linux-mips.org
Subject: [PATCH] oprofile 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: 10474
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
Content-Length: 4314
Lines: 153

1. Use CONFIG_OPROFILE to get rid of overhead for null_perf_irq() call.
2. Call perf_irq from timer_interrupt instead of ll_timer_interrupt.
   Most (non-SMP) boards will use timer_interrupt (instead of
   ll_timer_interrupt), so it would be better to move calling of
   perf_irq() to timer_interrupt().
3. Use jiffies instead of local timer_tick_count.

I can not test it by myself for now while I do not have any
MIPS32/MIPS64 board.

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

diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c
index 7050b4f..7b5c5b9 100644
--- a/arch/mips/kernel/time.c
+++ b/arch/mips/kernel/time.c
@@ -414,6 +414,18 @@ void local_timer_interrupt(int irq, void
 	update_process_times(user_mode(regs));
 }
 
+#if defined(CONFIG_OPROFILE) || defined(CONFIG_OPROFILE_MODULE)
+int null_perf_irq(struct pt_regs *regs)
+{
+	return 0;
+}
+
+int (*perf_irq)(struct pt_regs *regs) = null_perf_irq;
+
+EXPORT_SYMBOL(null_perf_irq);
+EXPORT_SYMBOL(perf_irq);
+#endif
+
 /*
  * High-level timer interrupt service routines.  This function
  * is set as irqaction->handler and is invoked through do_IRQ.
@@ -422,6 +434,22 @@ irqreturn_t timer_interrupt(int irq, voi
 {
 	unsigned long j;
 	unsigned int count;
+#if defined(CONFIG_OPROFILE) || defined(CONFIG_OPROFILE_MODULE)
+	int r2 = cpu_has_mips_r2;
+
+	/*
+	 * Suckage alert:
+	 * Before R2 of the architecture there was no way to see if a
+	 * performance counter interrupt was pending, so we have to run the
+	 * performance counter interrupt handler anyway.
+	 */
+	if (!r2 || (read_c0_cause() & (1 << 26)))
+		if (perf_irq(regs))
+			return IRQ_HANDLED;
+
+	if (r2 && !(read_c0_cause() & (1 << 30)))
+		return IRQ_HANDLED;
+#endif
 
 	count = mips_hpt_read();
 	mips_timer_ack();
@@ -507,38 +535,14 @@ irqreturn_t timer_interrupt(int irq, voi
 	return IRQ_HANDLED;
 }
 
-int null_perf_irq(struct pt_regs *regs)
-{
-	return 0;
-}
-
-int (*perf_irq)(struct pt_regs *regs) = null_perf_irq;
-
-EXPORT_SYMBOL(null_perf_irq);
-EXPORT_SYMBOL(perf_irq);
-
 asmlinkage void ll_timer_interrupt(int irq, struct pt_regs *regs)
 {
-	int r2 = cpu_has_mips_r2;
-
 	irq_enter();
 	kstat_this_cpu.irqs[irq]++;
 
-	/*
-	 * Suckage alert:
-	 * Before R2 of the architecture there was no way to see if a
-	 * performance counter interrupt was pending, so we have to run the
-	 * performance counter interrupt handler anyway.
-	 */
-	if (!r2 || (read_c0_cause() & (1 << 26)))
-		if (perf_irq(regs))
-			goto out;
-
 	/* we keep interrupt disabled all the time */
-	if (!r2 || (read_c0_cause() & (1 << 30)))
-		timer_interrupt(irq, NULL, regs);
+	timer_interrupt(irq, NULL, regs);
 
-out:
 	irq_exit();
 }
 
diff --git a/arch/mips/mips-boards/generic/time.c b/arch/mips/mips-boards/generic/time.c
index 93f3bf2..f9471de 100644
--- a/arch/mips/mips-boards/generic/time.c
+++ b/arch/mips/mips-boards/generic/time.c
@@ -58,12 +58,11 @@ static char display_string[] = "        
 static unsigned int display_count = 0;
 #define MAX_DISPLAY_COUNT (sizeof(display_string) - 8)
 
-static unsigned int timer_tick_count=0;
 static int mips_cpu_timer_irq;
 
 static inline void scroll_display_message(void)
 {
-	if ((timer_tick_count++ % HZ) == 0) {
+	if ((jiffies % HZ) == 0) {
 		mips_display_message(&display_string[display_count++]);
 		if (display_count == MAX_DISPLAY_COUNT)
 			display_count = 0;
@@ -75,13 +74,8 @@ static void mips_timer_dispatch (struct 
 	do_IRQ (mips_cpu_timer_irq, regs);
 }
 
-extern int null_perf_irq(struct pt_regs *regs);
-
-extern int (*perf_irq)(struct pt_regs *regs);
-
 irqreturn_t mips_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 {
-	int r2 = cpu_has_mips_r2;
 	int cpu = smp_processor_id();
 
 	if (cpu == 0) {
@@ -90,13 +84,7 @@ irqreturn_t mips_timer_interrupt(int irq
 		 * accounting resets count/compare registers to trigger next
 		 * timer int.
 		 */
-		if (!r2 || (read_c0_cause() & (1 << 26)))
-			if (perf_irq(regs))
-				goto out;
-
-		/* we keep interrupt disabled all the time */
-		if (!r2 || (read_c0_cause() & (1 << 30)))
-			timer_interrupt(irq, NULL, regs);
+		timer_interrupt(irq, NULL, regs);
 
 		scroll_display_message();
 	} else {
@@ -114,7 +102,6 @@ irqreturn_t mips_timer_interrupt(int irq
 		local_timer_interrupt (irq, dev_id, regs);
 	}
 
-out:
 	return IRQ_HANDLED;
 }
 

From ralf@linux-mips.org Thu Feb 16 14:53:53 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 16 Feb 2006 14:54:02 +0000 (GMT)
Received: from mipsfw.mips-uk.com ([194.74.144.146]:23300 "EHLO
	bacchus.dhis.org") by ftp.linux-mips.org with ESMTP
	id S8133413AbWBPOxx (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Thu, 16 Feb 2006 14:53:53 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by bacchus.dhis.org (8.13.4/8.13.4) with ESMTP id k1GExVY7004216;
	Thu, 16 Feb 2006 14:59:31 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.4/8.13.4/Submit) id k1GExVu2004215;
	Thu, 16 Feb 2006 14:59:31 GMT
Date:	Thu, 16 Feb 2006 14:59:31 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	"Maciej W. Rozycki" <macro@linux-mips.org>
Cc:	Martin Michlmayr <tbm@cyrius.com>, linux-mips@linux-mips.org
Subject: Re: Please pull drivers/scsi/dec_esp.c from Linus' git
Message-ID: <20060216145931.GA1633@linux-mips.org>
References: <20060213225331.GA5315@deprecation.cyrius.com> <20060215150839.GA27719@linux-mips.org> <Pine.LNX.4.64N.0602161016260.7169@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.0602161016260.7169@blysk.ds.pg.gda.pl>
User-Agent: Mutt/1.4.2.1i
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: 10475
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
Content-Length: 1594
Lines: 51

On Thu, Feb 16, 2006 at 10:17:38AM +0000, Maciej W. Rozycki wrote:
> Date:	Thu, 16 Feb 2006 10:17:38 +0000 (GMT)
> From:	"Maciej W. Rozycki" <macro@linux-mips.org>
> To:	Ralf Baechle <ralf@linux-mips.org>
> cc:	Martin Michlmayr <tbm@cyrius.com>, linux-mips@linux-mips.org
> Subject: Re: Please pull drivers/scsi/dec_esp.c from Linus' git
> Content-Type: TEXT/PLAIN; charset=US-ASCII
> 
> On Wed, 15 Feb 2006, Ralf Baechle wrote:
> 
> > > @@ -230,7 +230,7 @@
> > >  			mem_start = get_tc_base_addr(slot);
> > >  
> > >  			/* Store base addr into esp struct */
> > > -			esp->slot = mem_start;
> > > +			esp->slot = CPHYSADDR(mem_start);
> > >  
> > >  			esp->dregs = 0;
> > >  			esp->eregs = (void *)CKSEG1ADDR(mem_start +
> > 
> > I merged allmost all of the differences from mainline except this one.
> > 
> > Maciej, does this need the CPHYSADDR() op or not here?
> 
>  Of course not as get_tc_base_addr() returns a physical address these 
> days.  Thanks for spotting this bit.

Ok, I sent this bit upstream.

That still leaves below gem to sort out.

  Ralf

diff --git a/drivers/scsi/NCR53C9x.h b/drivers/scsi/NCR53C9x.h
index 65a9b37..81d03d1 100644
--- a/drivers/scsi/NCR53C9x.h
+++ b/drivers/scsi/NCR53C9x.h
@@ -145,12 +145,7 @@
 
 #ifndef MULTIPLE_PAD_SIZES
 
-#ifdef CONFIG_CPU_HAS_WB
-#include <asm/wbflush.h>
-#define esp_write(__reg, __val) do{(__reg) = (__val); wbflush();} while(0)
-#else
-#define esp_write(__reg, __val) ((__reg) = (__val))
-#endif
+#define esp_write(__reg, __val) do{(__reg) = (__val); iob();} while(0)
 #define esp_read(__reg) (__reg)
 
 struct ESP_regs {

From macro@linux-mips.org Thu Feb 16 15:42:20 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 16 Feb 2006 15:42:29 +0000 (GMT)
Received: from pollux.ds.pg.gda.pl ([153.19.208.7]:9229 "EHLO
	pollux.ds.pg.gda.pl") by ftp.linux-mips.org with ESMTP
	id S8133413AbWBPPmU (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Thu, 16 Feb 2006 15:42:20 +0000
Received: from localhost (localhost [127.0.0.1])
	by pollux.ds.pg.gda.pl (Postfix) with ESMTP id 6AC5DF5BCD;
	Thu, 16 Feb 2006 16:48:48 +0100 (CET)
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 00755-03; Thu, 16 Feb 2006 16:48:48 +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 264A5F59E3;
	Thu, 16 Feb 2006 16:48:48 +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.3/8.13.1) with ESMTP id k1GFmlgo008987;
	Thu, 16 Feb 2006 16:48:47 +0100
Date:	Thu, 16 Feb 2006 15:48:52 +0000 (GMT)
From:	"Maciej W. Rozycki" <macro@linux-mips.org>
To:	Ralf Baechle <ralf@linux-mips.org>
cc:	Martin Michlmayr <tbm@cyrius.com>, linux-mips@linux-mips.org
Subject: Re: Please pull drivers/scsi/dec_esp.c from Linus' git
In-Reply-To: <20060216145931.GA1633@linux-mips.org>
Message-ID: <Pine.LNX.4.64N.0602161504230.7169@blysk.ds.pg.gda.pl>
References: <20060213225331.GA5315@deprecation.cyrius.com>
 <20060215150839.GA27719@linux-mips.org> <Pine.LNX.4.64N.0602161016260.7169@blysk.ds.pg.gda.pl>
 <20060216145931.GA1633@linux-mips.org>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Virus-Scanned: ClamAV 0.88/1290/Thu Feb 16 10:14:53 2006 on piorun.ds.pg.gda.pl
X-Virus-Status:	Clean
X-Virus-Scanned: by amavisd-new at pollux.ds.pg.gda.pl
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: 10476
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
Content-Length: 815
Lines: 17

On Thu, 16 Feb 2006, Ralf Baechle wrote:

> That still leaves below gem to sort out.

 Yeah -- there is that mmiowb() macro that is supposed to fit here, but 
some MIPS-based hardware is ordered weakly (and strangely) enough for this 
single macro to be a bit insufficient.  I think we should have at least 
mmiowb() and mmiob() (corresponding to wmb() and mb(), respectively) as 
there is a system we support that does writes in order, but snoops the 
writeback buffer (the R3220).  Another one is worse yet as does all of 
that plus byte gathering (the R2020).  At least the latter cannot have the 
NCR/Emulex SCSI chip and uses DEC's own design instead (a DC7061 gate 
array highly suspected to also support DSSI if appropriately configured).

 I'm not sure if we really need mmiorb() -- probably not.

  Maciej

From anemo@mba.ocn.ne.jp Thu Feb 16 16:04:21 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 16 Feb 2006 16:04:32 +0000 (GMT)
Received: from mba.ocn.ne.jp ([210.190.142.172]:58363 "HELO smtp.mba.ocn.ne.jp")
	by ftp.linux-mips.org with SMTP id S8133440AbWBPQEU (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Thu, 16 Feb 2006 16:04:20 +0000
Received: from localhost (p6076-ipad212funabasi.chiba.ocn.ne.jp [58.91.170.76])
	by smtp.mba.ocn.ne.jp (Postfix) with ESMTP
	id CB618AE62; Fri, 17 Feb 2006 01:10:47 +0900 (JST)
Date:	Fri, 17 Feb 2006 01:10:35 +0900 (JST)
Message-Id: <20060217.011035.08319839.anemo@mba.ocn.ne.jp>
To:	ralf@linux-mips.org
Cc:	linux-mips@linux-mips.org
Subject: Re: [PATCH] make qemu buildable without CONFIG_VT
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
In-Reply-To: <20060216144019.GA2034@linux-mips.org>
References: <20060210.005104.63742308.anemo@mba.ocn.ne.jp>
	<20060216144019.GA2034@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: 10477
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
Content-Length: 235
Lines: 10

>>>>> On Thu, 16 Feb 2006 14:40:19 +0000, Ralf Baechle <ralf@linux-mips.org> said:

>> Subject: [PATCH] make qemu buildable without CONFIG_VT

ralf> Applied.

Thanks.  And thank you for fixing my fault in Makefile.

---
Atsushi Nemoto

From anemo@mba.ocn.ne.jp Thu Feb 16 16:30:29 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 16 Feb 2006 16:30:51 +0000 (GMT)
Received: from mba.ocn.ne.jp ([210.190.142.172]:64743 "HELO smtp.mba.ocn.ne.jp")
	by ftp.linux-mips.org with SMTP id S8133442AbWBPQa3 (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Thu, 16 Feb 2006 16:30:29 +0000
Received: from localhost (p6076-ipad212funabasi.chiba.ocn.ne.jp [58.91.170.76])
	by smtp.mba.ocn.ne.jp (Postfix) with ESMTP
	id DA922AE97; Fri, 17 Feb 2006 01:36:36 +0900 (JST)
Date:	Fri, 17 Feb 2006 01:36:24 +0900 (JST)
Message-Id: <20060217.013624.04769497.anemo@mba.ocn.ne.jp>
To:	linux-mips@linux-mips.org
Cc:	ralf@linux-mips.org
Subject: [PATCH] make I/O helpers more customizable
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: 10478
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
Content-Length: 7385
Lines: 212

1. Move ioswab*() and __mem_ioswab*() to mangle-port.h.  Now io.h is
clean from CONFIG_SGI_IP22.

2. Pass a virtual address to *ioswab*().  Then we can provide
mach-specific *ioswab*() and can do every evil thing based on its
argument.  It could be useful on machines which have regions with
different endian conversion scheme.

3. Call __swizzle_addr*() _after_ adding mips_io_port_base.  This
unifies the meaning of the argument of __swizzle_addr*() (always
virtual address).  Then mach-specific __swizzle_addr*() can do every
evil thing based on the argument.

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

diff --git a/include/asm-mips/io.h b/include/asm-mips/io.h
index 10ea7ca..7efac6d 100644
--- a/include/asm-mips/io.h
+++ b/include/asm-mips/io.h
@@ -40,56 +40,13 @@
  * hardware.  An example use would be for flash memory that's used for
  * execute in place.
  */
-# define __raw_ioswabb(x)	(x)
-# define __raw_ioswabw(x)	(x)
-# define __raw_ioswabl(x)	(x)
-# define __raw_ioswabq(x)	(x)
-# define ____raw_ioswabq(x)	(x)
-
-/*
- * Sane hardware offers swapping of PCI/ISA I/O space accesses in hardware;
- * less sane hardware forces software to fiddle with this...
- *
- * Regardless, if the host bus endianness mismatches that of PCI/ISA, then
- * you can't have the numerical value of data and byte addresses within
- * multibyte quantities both preserved at the same time.  Hence two
- * variations of functions: non-prefixed ones that preserve the value
- * and prefixed ones that preserve byte addresses.  The latters are
- * typically used for moving raw data between a peripheral and memory (cf.
- * string I/O functions), hence the "__mem_" prefix.
- */
-#if defined(CONFIG_SWAP_IO_SPACE)
-
-# define ioswabb(x)		(x)
-# define __mem_ioswabb(x)	(x)
-# ifdef CONFIG_SGI_IP22
-/*
- * IP22 seems braindead enough to swap 16bits values in hardware, but
- * not 32bits.  Go figure... Can't tell without documentation.
- */
-#  define ioswabw(x)		(x)
-#  define __mem_ioswabw(x)	le16_to_cpu(x)
-# else
-#  define ioswabw(x)		le16_to_cpu(x)
-#  define __mem_ioswabw(x)	(x)
-# endif
-# define ioswabl(x)		le32_to_cpu(x)
-# define __mem_ioswabl(x)	(x)
-# define ioswabq(x)		le64_to_cpu(x)
-# define __mem_ioswabq(x)	(x)
+# define __raw_ioswabb(a,x)	(x)
+# define __raw_ioswabw(a,x)	(x)
+# define __raw_ioswabl(a,x)	(x)
+# define __raw_ioswabq(a,x)	(x)
+# define ____raw_ioswabq(a,x)	(x)
 
-#else
-
-# define ioswabb(x)		(x)
-# define __mem_ioswabb(x)	(x)
-# define ioswabw(x)		(x)
-# define __mem_ioswabw(x)	cpu_to_le16(x)
-# define ioswabl(x)		(x)
-# define __mem_ioswabl(x)	cpu_to_le32(x)
-# define ioswabq(x)		(x)
-# define __mem_ioswabq(x)	cpu_to_le32(x)
-
-#endif
+/* ioswab[bwlq], __mem_ioswab[bwlq] are defined in mangle-port.h */
 
 #define IO_SPACE_LIMIT 0xffff
 
@@ -316,7 +273,7 @@ static inline void pfx##write##bwlq(type
 									\
 	__mem = (void *)__swizzle_addr_##bwlq((unsigned long)(mem));	\
 									\
-	__val = pfx##ioswab##bwlq(val);					\
+	__val = pfx##ioswab##bwlq(__mem, val);				\
 									\
 	if (sizeof(type) != sizeof(u64) || sizeof(u64) == sizeof(long))	\
 		*__mem = __val;						\
@@ -371,7 +328,7 @@ static inline type pfx##read##bwlq(const
 		BUG();							\
 	}								\
 									\
-	return pfx##ioswab##bwlq(__val);				\
+	return pfx##ioswab##bwlq(__mem, __val);				\
 }
 
 #define __BUILD_IOPORT_SINGLE(pfx, bwlq, type, p, slow)			\
@@ -381,10 +338,9 @@ static inline void pfx##out##bwlq##p(typ
 	volatile type *__addr;						\
 	type __val;							\
 									\
-	port = __swizzle_addr_##bwlq(port);				\
-	__addr = (void *)(mips_io_port_base + port);			\
+	__addr = (void *)__swizzle_addr_##bwlq(mips_io_port_base + port); \
 									\
-	__val = pfx##ioswab##bwlq(val);					\
+	__val = pfx##ioswab##bwlq(__addr, val);				\
 									\
 	/* Really, we want this to be atomic */				\
 	BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long));		\
@@ -398,15 +354,14 @@ static inline type pfx##in##bwlq##p(unsi
 	volatile type *__addr;						\
 	type __val;							\
 									\
-	port = __swizzle_addr_##bwlq(port);				\
-	__addr = (void *)(mips_io_port_base + port);			\
+	__addr = (void *)__swizzle_addr_##bwlq(mips_io_port_base + port); \
 									\
 	BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long));		\
 									\
 	__val = *__addr;						\
 	slow;								\
 									\
-	return pfx##ioswab##bwlq(__val);				\
+	return pfx##ioswab##bwlq(__addr, __val);			\
 }
 
 #define __BUILD_MEMORY_PFX(bus, bwlq, type)				\
diff --git a/include/asm-mips/mach-generic/mangle-port.h b/include/asm-mips/mach-generic/mangle-port.h
index 4a98d83..6e1b0c0 100644
--- a/include/asm-mips/mach-generic/mangle-port.h
+++ b/include/asm-mips/mach-generic/mangle-port.h
@@ -13,4 +13,40 @@
 #define __swizzle_addr_l(port)	(port)
 #define __swizzle_addr_q(port)	(port)
 
+/*
+ * Sane hardware offers swapping of PCI/ISA I/O space accesses in hardware;
+ * less sane hardware forces software to fiddle with this...
+ *
+ * Regardless, if the host bus endianness mismatches that of PCI/ISA, then
+ * you can't have the numerical value of data and byte addresses within
+ * multibyte quantities both preserved at the same time.  Hence two
+ * variations of functions: non-prefixed ones that preserve the value
+ * and prefixed ones that preserve byte addresses.  The latters are
+ * typically used for moving raw data between a peripheral and memory (cf.
+ * string I/O functions), hence the "__mem_" prefix.
+ */
+#if defined(CONFIG_SWAP_IO_SPACE)
+
+# define ioswabb(a,x)		(x)
+# define __mem_ioswabb(a,x)	(x)
+# define ioswabw(a,x)		le16_to_cpu(x)
+# define __mem_ioswabw(a,x)	(x)
+# define ioswabl(a,x)		le32_to_cpu(x)
+# define __mem_ioswabl(a,x)	(x)
+# define ioswabq(a,x)		le64_to_cpu(x)
+# define __mem_ioswabq(a,x)	(x)
+
+#else
+
+# define ioswabb(a,x)		(x)
+# define __mem_ioswabb(a,x)	(x)
+# define ioswabw(a,x)		(x)
+# define __mem_ioswabw(a,x)	cpu_to_le16(x)
+# define ioswabl(a,x)		(x)
+# define __mem_ioswabl(a,x)	cpu_to_le32(x)
+# define ioswabq(a,x)		(x)
+# define __mem_ioswabq(a,x)	cpu_to_le32(x)
+
+#endif
+
 #endif /* __ASM_MACH_GENERIC_MANGLE_PORT_H */
diff --git a/include/asm-mips/mach-ip27/mangle-port.h b/include/asm-mips/mach-ip27/mangle-port.h
index f76c448..d615312 100644
--- a/include/asm-mips/mach-ip27/mangle-port.h
+++ b/include/asm-mips/mach-ip27/mangle-port.h
@@ -13,4 +13,13 @@
 #define __swizzle_addr_l(port)	(port)
 #define __swizzle_addr_q(port)	(port)
 
+# define ioswabb(a,x)		(x)
+# define __mem_ioswabb(a,x)	(x)
+# define ioswabw(a,x)		(x)
+# define __mem_ioswabw(a,x)	cpu_to_le16(x)
+# define ioswabl(a,x)		(x)
+# define __mem_ioswabl(a,x)	cpu_to_le32(x)
+# define ioswabq(a,x)		(x)
+# define __mem_ioswabq(a,x)	cpu_to_le32(x)
+
 #endif /* __ASM_MACH_IP27_MANGLE_PORT_H */
diff --git a/include/asm-mips/mach-ip32/mangle-port.h b/include/asm-mips/mach-ip32/mangle-port.h
index 6e25b52..81320eb 100644
--- a/include/asm-mips/mach-ip32/mangle-port.h
+++ b/include/asm-mips/mach-ip32/mangle-port.h
@@ -14,4 +14,13 @@
 #define __swizzle_addr_l(port)	(port)
 #define __swizzle_addr_q(port)	(port)
 
+# define ioswabb(a,x)		(x)
+# define __mem_ioswabb(a,x)	(x)
+# define ioswabw(a,x)		(x)
+# define __mem_ioswabw(a,x)	cpu_to_le16(x)
+# define ioswabl(a,x)		(x)
+# define __mem_ioswabl(a,x)	cpu_to_le32(x)
+# define ioswabq(a,x)		(x)
+# define __mem_ioswabq(a,x)	cpu_to_le32(x)
+
 #endif /* __ASM_MACH_IP32_MANGLE_PORT_H */

From mark.e.mason@broadcom.com Thu Feb 16 22:57:32 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 16 Feb 2006 22:57:42 +0000 (GMT)
Received: from mms1.broadcom.com ([216.31.210.17]:26634 "EHLO
	mms1.broadcom.com") by ftp.linux-mips.org with ESMTP
	id S8133520AbWBPW5c (ORCPT <rfc822;linux-mips@www.linux-mips.org>);
	Thu, 16 Feb 2006 22:57:32 +0000
Received: from 10.10.64.154 by mms1.broadcom.com with ESMTP (Broadcom
 SMTP Relay (Email Firewall v6.2.0)); Thu, 16 Feb 2006 15:03:57 -0800
X-Server-Uuid: F962EFE0-448C-40EE-8100-87DF498ED0EA
Received: by mail-irva-10.broadcom.com (Postfix, from userid 47) id
 595B52B0; Thu, 16 Feb 2006 15:03:47 -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 2352E2AE for
 <linux-mips@www.linux-mips.org>; Thu, 16 Feb 2006 15:03:47 -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.3a-GA) with ESMTP
 id CYD21449; Thu, 16 Feb 2006 15:03:46 -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
 C278120501 for <linux-mips@www.linux-mips.org>; Thu, 16 Feb 2006
 15:03:46 -0800 (PST)
Received: from localhost.localdomain ([10.136.253.1]) by
 NT-SJCA-0750.brcm.ad.broadcom.com with Microsoft
 SMTPSVC(6.0.3790.1830); Thu, 16 Feb 2006 15:03:46 -0800
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
 by localhost.localdomain (8.13.4/8.13.4) with ESMTP id k1GN3Kun011998
 for <linux-mips@www.linux-mips.org>; Thu, 16 Feb 2006 15:03:24 -0800
Received: (from mason@localhost) by localhost.localdomain (
 8.13.4/8.13.4/Submit) id k1GN34KT011995 for
 linux-mips@www.linux-mips.org; Thu, 16 Feb 2006 15:03:04 -0800
Date:	Thu, 16 Feb 2006 15:03:04 -0800
From:	"Mark Mason" <mason@broadcom.com>
To:	linux-mips@www.linux-mips.org
Subject: Patches for BCM1250/BCM1480 header files.
Message-ID: <20060216230304.GA11952@localhost.localdomain>
MIME-Version: 1.0
User-Agent: Mutt/1.4.2.1i
X-OriginalArrivalTime: 16 Feb 2006 23:03:46.0583 (UTC)
 FILETIME=[3D9CEA70:01C6334D]
X-TMWD-Spam-Summary: SEV=1.1; DFV=A2006021609; IFV=2.0.6,4.0-7;
 RPD=4.00.0004;
 RPDID=303030312E30413039303230372E34334635303243332E303035312D412D;
 ENG=IBF; TS=20060216230400; CAT=NONE; CON=NONE;
X-MMS-Spam-Filter-ID: A2006021609_4.00.0004_2.0.6,4.0-7
X-WSS-ID: 6FEBDB5710G11239986-01-01
Content-Type: text/plain;
 charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: 7bit
Return-Path: <mark.e.mason@broadcom.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@www.linux-mips.org
Original-Recipient: rfc822;linux-mips@www.linux-mips.org
X-archive-position: 10479
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: mason@broadcom.com
Precedence: bulk
X-list: linux-mips
Content-Length: 7807
Lines: 174

Hello all,

The following patch makes some minor feature updates to the BCM1250/BCM1480
header files.

Please apply.

Thanks,
Mark

Signed-off-by: Mark Mason <mason@broadcom.com>

diff --git a/include/asm-mips/sibyte/bcm1480_mc.h b/include/asm-mips/sibyte/bcm1480_mc.h
index 6bdc941..262690b 100644
--- a/include/asm-mips/sibyte/bcm1480_mc.h
+++ b/include/asm-mips/sibyte/bcm1480_mc.h
@@ -410,7 +410,9 @@
 
 #if SIBYTE_HDR_FEATURE(1480, PASS2)
 #define K_BCM1480_MC_DRAM_TYPE_DDR2	    2
-#endif
+#endif			
+
+#define K_BCM1480_MC_DRAM_TYPE_DDR2_PASS1   4	
 
 #define V_BCM1480_MC_DRAM_TYPE_JEDEC        V_BCM1480_MC_DRAM_TYPE(K_BCM1480_MC_DRAM_TYPE_JEDEC)
 #define V_BCM1480_MC_DRAM_TYPE_FCRAM        V_BCM1480_MC_DRAM_TYPE(K_BCM1480_MC_DRAM_TYPE_FCRAM)
@@ -511,6 +513,22 @@
 #define M_BCM1480_MC_WR_ODT6_CS6	    _SB_MAKEMASK1(31)
 
 #define M_BCM1480_MC_CS_ODD_ODT_EN	    _SB_MAKEMASK1(32)
+
+#define S_BCM1480_MC_ODT0	            0
+#define M_BCM1480_MC_ODT0		    _SB_MAKEMASK(8,S_BCM1480_MC_ODT0)
+#define V_BCM1480_MC_ODT0(x)		    _SB_MAKEVALUE(x,S_BCM1480_MC_ODT0)
+		    
+#define S_BCM1480_MC_ODT2	            8
+#define M_BCM1480_MC_ODT2		    _SB_MAKEMASK(8,S_BCM1480_MC_ODT2)
+#define V_BCM1480_MC_ODT2(x)		    _SB_MAKEVALUE(x,S_BCM1480_MC_ODT2)
+
+#define S_BCM1480_MC_ODT4	            16
+#define M_BCM1480_MC_ODT4		    _SB_MAKEMASK(8,S_BCM1480_MC_ODT4)
+#define V_BCM1480_MC_ODT4(x)		    _SB_MAKEVALUE(x,S_BCM1480_MC_ODT4)
+
+#define S_BCM1480_MC_ODT6	            24
+#define M_BCM1480_MC_ODT6		    _SB_MAKEMASK(8,S_BCM1480_MC_ODT6)
+#define V_BCM1480_MC_ODT6(x)		    _SB_MAKEVALUE(x,S_BCM1480_MC_ODT6)
 #endif
 
 /*
diff --git a/include/asm-mips/sibyte/sb1250_mac.h b/include/asm-mips/sibyte/sb1250_mac.h
index adfc688..833c8b5 100644
--- a/include/asm-mips/sibyte/sb1250_mac.h
+++ b/include/asm-mips/sibyte/sb1250_mac.h
@@ -129,9 +129,9 @@
 #define M_MAC_BYPASS_16             _SB_MAKEMASK1(42)
 #define M_MAC_BYPASS_FCS_CHK	    _SB_MAKEMASK1(43)
 
-#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
+#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
 #define M_MAC_RX_CH_SEL_MSB	    _SB_MAKEMASK1(44)
-#endif /* 1250 PASS2 || 112x PASS1 */
+#endif /* 1250 PASS2 || 112x PASS1 || 1480*/
 
 #if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
 #define M_MAC_SPLIT_CH_SEL	    _SB_MAKEMASK1(45)
@@ -223,9 +223,9 @@
 /* XXX: Can't enable, as it has the same name as a pass2+ define below.  */
 /* #define M_MAC_TX_WR_THRSH           _SB_MAKEMASK(6,S_MAC_TX_WR_THRSH) */
 #endif /* up to 1250 PASS1 */
-#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
+#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
 #define M_MAC_TX_WR_THRSH           _SB_MAKEMASK(7,S_MAC_TX_WR_THRSH)
-#endif /* 1250 PASS2 || 112x PASS1 */
+#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
 #define V_MAC_TX_WR_THRSH(x)        _SB_MAKEVALUE(x,S_MAC_TX_WR_THRSH)
 #define G_MAC_TX_WR_THRSH(x)        _SB_GETVALUE(x,S_MAC_TX_WR_THRSH,M_MAC_TX_WR_THRSH)
 
@@ -234,9 +234,9 @@
 /* XXX: Can't enable, as it has the same name as a pass2+ define below.  */
 /* #define M_MAC_TX_RD_THRSH           _SB_MAKEMASK(6,S_MAC_TX_RD_THRSH) */
 #endif /* up to 1250 PASS1 */
-#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
+#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
 #define M_MAC_TX_RD_THRSH           _SB_MAKEMASK(7,S_MAC_TX_RD_THRSH)
-#endif /* 1250 PASS2 || 112x PASS1 */
+#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
 #define V_MAC_TX_RD_THRSH(x)        _SB_MAKEVALUE(x,S_MAC_TX_RD_THRSH)
 #define G_MAC_TX_RD_THRSH(x)        _SB_GETVALUE(x,S_MAC_TX_RD_THRSH,M_MAC_TX_RD_THRSH)
 
@@ -260,12 +260,12 @@
 #define V_MAC_RX_RL_THRSH(x)        _SB_MAKEVALUE(x,S_MAC_RX_RL_THRSH)
 #define G_MAC_RX_RL_THRSH(x)        _SB_GETVALUE(x,S_MAC_RX_RL_THRSH,M_MAC_RX_RL_THRSH)
 
-#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
+#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
 #define S_MAC_ENC_FC_THRSH           _SB_MAKE64(56)
 #define M_MAC_ENC_FC_THRSH           _SB_MAKEMASK(6,S_MAC_ENC_FC_THRSH)
 #define V_MAC_ENC_FC_THRSH(x)        _SB_MAKEVALUE(x,S_MAC_ENC_FC_THRSH)
 #define G_MAC_ENC_FC_THRSH(x)        _SB_GETVALUE(x,S_MAC_ENC_FC_THRSH,M_MAC_ENC_FC_THRSH)
-#endif /* 1250 PASS2 || 112x PASS1 */
+#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
 
 /*
  * MAC Frame Configuration Registers (Table 9-15)
@@ -462,9 +462,9 @@
 #define M_MAC_LTCOL_ERR             _SB_MAKEMASK1(44)
 #define M_MAC_EXCOL_ERR             _SB_MAKEMASK1(45)
 #define M_MAC_CNTR_OVRFL_ERR        _SB_MAKEMASK1(46)
-#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
+#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
 #define M_MAC_SPLIT_EN		    _SB_MAKEMASK1(47) 	/* interrupt mask only */
-#endif /* 1250 PASS2 || 112x PASS1 */
+#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
 
 #define S_MAC_COUNTER_ADDR          _SB_MAKE64(47)
 #define M_MAC_COUNTER_ADDR          _SB_MAKEMASK(5,S_MAC_COUNTER_ADDR)
@@ -598,9 +598,9 @@
 #define M_MAC_MCAST_INV         _SB_MAKEMASK1(4)
 #define M_MAC_BCAST_EN          _SB_MAKEMASK1(5)
 #define M_MAC_DIRECT_INV        _SB_MAKEMASK1(6)
-#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
+#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
 #define M_MAC_ALLMCAST_EN	_SB_MAKEMASK1(7)
-#endif /* 1250 PASS2 || 112x PASS1 */
+#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
 
 #define S_MAC_IPHDR_OFFSET      _SB_MAKE64(8)
 #define M_MAC_IPHDR_OFFSET      _SB_MAKEMASK(8,S_MAC_IPHDR_OFFSET)
diff --git a/include/asm-mips/sibyte/sb1250_regs.h b/include/asm-mips/sibyte/sb1250_regs.h
index bab3a45..ace20d0 100644
--- a/include/asm-mips/sibyte/sb1250_regs.h
+++ b/include/asm-mips/sibyte/sb1250_regs.h
@@ -243,10 +243,10 @@
 #define R_MAC_ADFILTER_CFG              0x00000200
 #define R_MAC_ETHERNET_ADDR             0x00000208
 #define R_MAC_PKT_TYPE                  0x00000210
-#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1)
+#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
 #define R_MAC_ADMASK0			0x00000218
 #define R_MAC_ADMASK1			0x00000220
-#endif /* 1250 PASS3 || 112x PASS1 */
+#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
 #define R_MAC_HASH_BASE                 0x00000240
 #define R_MAC_ADDR_BASE                 0x00000280
 #define R_MAC_CHLO0_BASE                0x00000300
@@ -256,9 +256,9 @@
 #define R_MAC_INT_MASK                  0x00000410
 #define R_MAC_TXD_CTL                   0x00000420
 #define R_MAC_MDIO                      0x00000428
-#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
+#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
 #define R_MAC_STATUS1		        0x00000430
-#endif /* 1250 PASS2 || 112x PASS1 */
+#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
 #define R_MAC_DEBUG_STATUS              0x00000448
 
 #define MAC_HASH_COUNT			8
@@ -289,11 +289,11 @@
 #define R_DUART_RX_HOLD             0x160
 #define R_DUART_TX_HOLD             0x170
 
-#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
+#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
 #define R_DUART_FULL_CTL	    0x140
 #define R_DUART_OPCR_X		    0x180
 #define R_DUART_AUXCTL_X	    0x190
-#endif /* 1250 PASS2 || 112x PASS1 */
+#endif /* 1250 PASS2 || 112x PASS1 || 1480*/
 
 
 /*



From mark.e.mason@broadcom.com Thu Feb 16 23:19:35 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 16 Feb 2006 23:19:52 +0000 (GMT)
Received: from mms1.broadcom.com ([216.31.210.17]:60430 "EHLO
	mms1.broadcom.com") by ftp.linux-mips.org with ESMTP
	id S8133520AbWBPXTe (ORCPT <rfc822;linux-mips@www.linux-mips.org>);
	Thu, 16 Feb 2006 23:19:34 +0000
Received: from 10.10.64.154 by mms1.broadcom.com with ESMTP (Broadcom
 SMTP Relay (Email Firewall v6.2.0)); Thu, 16 Feb 2006 15:26:06 -0800
X-Server-Uuid: F962EFE0-448C-40EE-8100-87DF498ED0EA
Received: by mail-irva-10.broadcom.com (Postfix, from userid 47) id
 A51732AE; Thu, 16 Feb 2006 15:25:56 -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 304552B0 for
 <linux-mips@www.linux-mips.org>; Thu, 16 Feb 2006 15:25:56 -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.3a-GA) with ESMTP
 id CYD28611; Thu, 16 Feb 2006 15:25:55 -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
 6670020501 for <linux-mips@www.linux-mips.org>; Thu, 16 Feb 2006
 15:25:55 -0800 (PST)
Received: from localhost.localdomain ([10.136.253.1]) by
 NT-SJCA-0750.brcm.ad.broadcom.com with Microsoft
 SMTPSVC(6.0.3790.1830); Thu, 16 Feb 2006 15:25:55 -0800
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
 by localhost.localdomain (8.13.4/8.13.4) with ESMTP id k1GNPeaW012310
 for <linux-mips@www.linux-mips.org>; Thu, 16 Feb 2006 15:25:41 -0800
Received: (from mason@localhost) by localhost.localdomain (
 8.13.4/8.13.4/Submit) id k1GNPc3H012309 for
 linux-mips@www.linux-mips.org; Thu, 16 Feb 2006 15:25:38 -0800
Date:	Thu, 16 Feb 2006 15:25:38 -0800
From:	"Mark Mason" <mason@broadcom.com>
To:	linux-mips@www.linux-mips.org
Subject: Correct patch for BCM1250/BCM1480 header files.
Message-ID: <20060216232538.GA12285@localhost.localdomain>
MIME-Version: 1.0
User-Agent: Mutt/1.4.2.1i
X-OriginalArrivalTime: 16 Feb 2006 23:25:55.0185 (UTC)
 FILETIME=[55857E10:01C63350]
X-TMWD-Spam-Summary: SEV=1.1; DFV=A2006021609; IFV=2.0.6,4.0-7;
 RPD=4.00.0004;
 RPDID=303030312E30413039303230372E34334635303746352E303031322D412D;
 ENG=IBF; TS=20060216232609; CAT=NONE; CON=NONE;
X-MMS-Spam-Filter-ID: A2006021609_4.00.0004_2.0.6,4.0-7
X-WSS-ID: 6FEBD58410G11243700-01-01
Content-Type: text/plain;
 charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: 7bit
Return-Path: <mark.e.mason@broadcom.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0)
X-Orcpt: rfc822;linux-mips@www.linux-mips.org
Original-Recipient: rfc822;linux-mips@www.linux-mips.org
X-archive-position: 10480
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: mason@broadcom.com
Precedence: bulk
X-list: linux-mips
Content-Length: 7935
Lines: 176

Hello all,

This is the *CORRECT* patch.  The previous one got mangled at the last
moment (I hate it when that happens). Sorry about that.

The following patch makes some minor feature updates to the BCM1250/BCM1480 header files.

Please apply.

Thanks,
Mark

Signed-off-by: Mark Mason <mason@broadcom.com>

diff --git a/include/asm-mips/sibyte/bcm1480_mc.h b/include/asm-mips/sibyte/bcm1480_mc.h
index 6bdc941..262690b 100644
--- a/include/asm-mips/sibyte/bcm1480_mc.h
+++ b/include/asm-mips/sibyte/bcm1480_mc.h
@@ -410,7 +410,9 @@
 
 #if SIBYTE_HDR_FEATURE(1480, PASS2)
 #define K_BCM1480_MC_DRAM_TYPE_DDR2	    2
-#endif
+#endif			
+
+#define K_BCM1480_MC_DRAM_TYPE_DDR2_PASS1   4	
 
 #define V_BCM1480_MC_DRAM_TYPE_JEDEC        V_BCM1480_MC_DRAM_TYPE(K_BCM1480_MC_DRAM_TYPE_JEDEC)
 #define V_BCM1480_MC_DRAM_TYPE_FCRAM        V_BCM1480_MC_DRAM_TYPE(K_BCM1480_MC_DRAM_TYPE_FCRAM)
@@ -511,6 +513,22 @@
 #define M_BCM1480_MC_WR_ODT6_CS6	    _SB_MAKEMASK1(31)
 
 #define M_BCM1480_MC_CS_ODD_ODT_EN	    _SB_MAKEMASK1(32)
+
+#define S_BCM1480_MC_ODT0	            0
+#define M_BCM1480_MC_ODT0		    _SB_MAKEMASK(8,S_BCM1480_MC_ODT0)
+#define V_BCM1480_MC_ODT0(x)		    _SB_MAKEVALUE(x,S_BCM1480_MC_ODT0)
+		    
+#define S_BCM1480_MC_ODT2	            8
+#define M_BCM1480_MC_ODT2		    _SB_MAKEMASK(8,S_BCM1480_MC_ODT2)
+#define V_BCM1480_MC_ODT2(x)		    _SB_MAKEVALUE(x,S_BCM1480_MC_ODT2)
+
+#define S_BCM1480_MC_ODT4	            16
+#define M_BCM1480_MC_ODT4		    _SB_MAKEMASK(8,S_BCM1480_MC_ODT4)
+#define V_BCM1480_MC_ODT4(x)		    _SB_MAKEVALUE(x,S_BCM1480_MC_ODT4)
+
+#define S_BCM1480_MC_ODT6	            24
+#define M_BCM1480_MC_ODT6		    _SB_MAKEMASK(8,S_BCM1480_MC_ODT6)
+#define V_BCM1480_MC_ODT6(x)		    _SB_MAKEVALUE(x,S_BCM1480_MC_ODT6)
 #endif
 
 /*
diff --git a/include/asm-mips/sibyte/sb1250_mac.h b/include/asm-mips/sibyte/sb1250_mac.h
index adfc688..833c8b5 100644
--- a/include/asm-mips/sibyte/sb1250_mac.h
+++ b/include/asm-mips/sibyte/sb1250_mac.h
@@ -129,9 +129,9 @@
 #define M_MAC_BYPASS_16             _SB_MAKEMASK1(42)
 #define M_MAC_BYPASS_FCS_CHK	    _SB_MAKEMASK1(43)
 
-#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
+#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
 #define M_MAC_RX_CH_SEL_MSB	    _SB_MAKEMASK1(44)
-#endif /* 1250 PASS2 || 112x PASS1 */
+#endif /* 1250 PASS2 || 112x PASS1 || 1480*/
 
 #if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
 #define M_MAC_SPLIT_CH_SEL	    _SB_MAKEMASK1(45)
@@ -223,9 +223,9 @@
 /* XXX: Can't enable, as it has the same name as a pass2+ define below.  */
 /* #define M_MAC_TX_WR_THRSH           _SB_MAKEMASK(6,S_MAC_TX_WR_THRSH) */
 #endif /* up to 1250 PASS1 */
-#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
+#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
 #define M_MAC_TX_WR_THRSH           _SB_MAKEMASK(7,S_MAC_TX_WR_THRSH)
-#endif /* 1250 PASS2 || 112x PASS1 */
+#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
 #define V_MAC_TX_WR_THRSH(x)        _SB_MAKEVALUE(x,S_MAC_TX_WR_THRSH)
 #define G_MAC_TX_WR_THRSH(x)        _SB_GETVALUE(x,S_MAC_TX_WR_THRSH,M_MAC_TX_WR_THRSH)
 
@@ -234,9 +234,9 @@
 /* XXX: Can't enable, as it has the same name as a pass2+ define below.  */
 /* #define M_MAC_TX_RD_THRSH           _SB_MAKEMASK(6,S_MAC_TX_RD_THRSH) */
 #endif /* up to 1250 PASS1 */
-#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
+#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
 #define M_MAC_TX_RD_THRSH           _SB_MAKEMASK(7,S_MAC_TX_RD_THRSH)
-#endif /* 1250 PASS2 || 112x PASS1 */
+#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
 #define V_MAC_TX_RD_THRSH(x)        _SB_MAKEVALUE(x,S_MAC_TX_RD_THRSH)
 #define G_MAC_TX_RD_THRSH(x)        _SB_GETVALUE(x,S_MAC_TX_RD_THRSH,M_MAC_TX_RD_THRSH)
 
@@ -260,12 +260,12 @@
 #define V_MAC_RX_RL_THRSH(x)        _SB_MAKEVALUE(x,S_MAC_RX_RL_THRSH)
 #define G_MAC_RX_RL_THRSH(x)        _SB_GETVALUE(x,S_MAC_RX_RL_THRSH,M_MAC_RX_RL_THRSH)
 
-#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
+#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
 #define S_MAC_ENC_FC_THRSH           _SB_MAKE64(56)
 #define M_MAC_ENC_FC_THRSH           _SB_MAKEMASK(6,S_MAC_ENC_FC_THRSH)
 #define V_MAC_ENC_FC_THRSH(x)        _SB_MAKEVALUE(x,S_MAC_ENC_FC_THRSH)
 #define G_MAC_ENC_FC_THRSH(x)        _SB_GETVALUE(x,S_MAC_ENC_FC_THRSH,M_MAC_ENC_FC_THRSH)
-#endif /* 1250 PASS2 || 112x PASS1 */
+#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
 
 /*
  * MAC Frame Configuration Registers (Table 9-15)
@@ -462,9 +462,9 @@
 #define M_MAC_LTCOL_ERR             _SB_MAKEMASK1(44)
 #define M_MAC_EXCOL_ERR             _SB_MAKEMASK1(45)
 #define M_MAC_CNTR_OVRFL_ERR        _SB_MAKEMASK1(46)
-#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
+#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
 #define M_MAC_SPLIT_EN		    _SB_MAKEMASK1(47) 	/* interrupt mask only */
-#endif /* 1250 PASS2 || 112x PASS1 */
+#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
 
 #define S_MAC_COUNTER_ADDR          _SB_MAKE64(47)
 #define M_MAC_COUNTER_ADDR          _SB_MAKEMASK(5,S_MAC_COUNTER_ADDR)
@@ -598,9 +598,9 @@
 #define M_MAC_MCAST_INV         _SB_MAKEMASK1(4)
 #define M_MAC_BCAST_EN          _SB_MAKEMASK1(5)
 #define M_MAC_DIRECT_INV        _SB_MAKEMASK1(6)
-#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
+#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
 #define M_MAC_ALLMCAST_EN	_SB_MAKEMASK1(7)
-#endif /* 1250 PASS2 || 112x PASS1 */
+#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
 
 #define S_MAC_IPHDR_OFFSET      _SB_MAKE64(8)
 #define M_MAC_IPHDR_OFFSET      _SB_MAKEMASK(8,S_MAC_IPHDR_OFFSET)
diff --git a/include/asm-mips/sibyte/sb1250_regs.h b/include/asm-mips/sibyte/sb1250_regs.h
index bab3a45..ace20d0 100644
--- a/include/asm-mips/sibyte/sb1250_regs.h
+++ b/include/asm-mips/sibyte/sb1250_regs.h
@@ -243,10 +243,10 @@
 #define R_MAC_ADFILTER_CFG              0x00000200
 #define R_MAC_ETHERNET_ADDR             0x00000208
 #define R_MAC_PKT_TYPE                  0x00000210
-#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1)
+#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
 #define R_MAC_ADMASK0			0x00000218
 #define R_MAC_ADMASK1			0x00000220
-#endif /* 1250 PASS3 || 112x PASS1 */
+#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
 #define R_MAC_HASH_BASE                 0x00000240
 #define R_MAC_ADDR_BASE                 0x00000280
 #define R_MAC_CHLO0_BASE                0x00000300
@@ -256,9 +256,9 @@
 #define R_MAC_INT_MASK                  0x00000410
 #define R_MAC_TXD_CTL                   0x00000420
 #define R_MAC_MDIO                      0x00000428
-#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
+#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
 #define R_MAC_STATUS1		        0x00000430
-#endif /* 1250 PASS2 || 112x PASS1 */
+#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
 #define R_MAC_DEBUG_STATUS              0x00000448
 
 #define MAC_HASH_COUNT			8
@@ -289,11 +289,11 @@
 #define R_DUART_RX_HOLD             0x160
 #define R_DUART_TX_HOLD             0x170
 
-#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
+#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
 #define R_DUART_FULL_CTL	    0x140
 #define R_DUART_OPCR_X		    0x180
 #define R_DUART_AUXCTL_X	    0x190
-#endif /* 1250 PASS2 || 112x PASS1 */
+#endif /* 1250 PASS2 || 112x PASS1 || 1480*/
 
 
 /*



From tbm@cyrius.com Fri Feb 17 03:06:52 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 17 Feb 2006 03:07:04 +0000 (GMT)
Received: from sorrow.cyrius.com ([65.19.161.204]:61202 "EHLO
	sorrow.cyrius.com") by ftp.linux-mips.org with ESMTP
	id S8133620AbWBQDGw (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Fri, 17 Feb 2006 03:06:52 +0000
Received: by sorrow.cyrius.com (Postfix, from userid 10)
	id 1CD4464D3F; Fri, 17 Feb 2006 03:13:27 +0000 (UTC)
Received: by deprecation.cyrius.com (Postfix, from userid 1000)
	id EEF068F77; Fri, 17 Feb 2006 03:13:24 +0000 (GMT)
Date:	Fri, 17 Feb 2006 03:13:24 +0000
From:	Martin Michlmayr <tbm@cyrius.com>
To:	ralf@linux-mips.org
Cc:	linux-mips@linux-mips.org
Subject: Re: [PATCH 2.6] Cobalt IDE fix, again
Message-ID: <20060217031324.GJ23441@deprecation.cyrius.com>
References: <20060125001303.GA2569@colonel-panic.org> <20060126171904.GA12850@deprecation.cyrius.com> <20060126175725.GA409@colonel-panic.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20060126175725.GA409@colonel-panic.org>
User-Agent: Mutt/1.5.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: 10481
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
Content-Length: 2187
Lines: 110

Resending a patch that still needs to be applied.


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

[MIPS] Fix long IDE detection delay by not scanning non-existent channels.

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>

---

 ide.h |   49 +++++++++++++++++++++----------------------------
 1 file changed, 21 insertions(+), 28 deletions(-)

--- 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 jes@trained-monkey.org Fri Feb 17 09:05:37 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 17 Feb 2006 09:05:49 +0000 (GMT)
Received: from jaguar.mkp.net ([192.139.46.146]:62946 "EHLO jaguar.mkp.net")
	by ftp.linux-mips.org with ESMTP id S8133370AbWBQJFh (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Fri, 17 Feb 2006 09:05:37 +0000
Received: by jaguar.mkp.net (Postfix, from userid 1655)
	id D464B286DAD; Fri, 17 Feb 2006 04:12:12 -0500 (EST)
To:	"Maciej W. Rozycki" <macro@linux-mips.org>
Cc:	Ralf Baechle <ralf@linux-mips.org>,
	Martin Michlmayr <tbm@cyrius.com>, linux-mips@linux-mips.org
Subject: Re: Please pull drivers/scsi/dec_esp.c from Linus' git
References: <20060213225331.GA5315@deprecation.cyrius.com>
	<20060215150839.GA27719@linux-mips.org>
	<Pine.LNX.4.64N.0602161016260.7169@blysk.ds.pg.gda.pl>
	<20060216145931.GA1633@linux-mips.org>
	<Pine.LNX.4.64N.0602161504230.7169@blysk.ds.pg.gda.pl>
From:	Jes Sorensen <jes@sgi.com>
Date:	17 Feb 2006 04:12:12 -0500
In-Reply-To: <Pine.LNX.4.64N.0602161504230.7169@blysk.ds.pg.gda.pl>
Message-ID: <yq0pslmxsb7.fsf@jaguar.mkp.net>
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Return-Path: <jes@trained-monkey.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: 10482
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: jes@sgi.com
Precedence: bulk
X-list: linux-mips
Content-Length: 1104
Lines: 25

>>>>> "Maciej" == Maciej W Rozycki <macro@linux-mips.org> writes:

Maciej> On Thu, 16 Feb 2006, Ralf Baechle wrote:
>> That still leaves below gem to sort out.

Maciej>  Yeah -- there is that mmiowb() macro that is supposed to fit
Maciej> here, but some MIPS-based hardware is ordered weakly (and
Maciej> strangely) enough for this single macro to be a bit
Maciej> insufficient.  I think we should have at least mmiowb() and
Maciej> mmiob() (corresponding to wmb() and mb(), respectively) as
Maciej> there is a system we support that does writes in order, but
Maciej> snoops the writeback buffer (the R3220).  Another one is worse
Maciej> yet as does all of that plus byte gathering (the R2020).  At
Maciej> least the latter cannot have the NCR/Emulex SCSI chip and uses
Maciej> DEC's own design instead (a DC7061 gate array highly suspected
Maciej> to also support DSSI if appropriately configured).

Maciej>  I'm not sure if we really need mmiorb() -- probably not.

Just make mmiowb() strong enough on those platforms. There's really no
reason to introduce yet another variation at this point.

Jes



From macro@linux-mips.org Fri Feb 17 10:44:20 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 17 Feb 2006 10:44:29 +0000 (GMT)
Received: from pollux.ds.pg.gda.pl ([153.19.208.7]:15889 "EHLO
	pollux.ds.pg.gda.pl") by ftp.linux-mips.org with ESMTP
	id S8133627AbWBQKoT (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Fri, 17 Feb 2006 10:44:19 +0000
Received: from localhost (localhost [127.0.0.1])
	by pollux.ds.pg.gda.pl (Postfix) with ESMTP id 85CCBF5C07;
	Fri, 17 Feb 2006 11:44:57 +0100 (CET)
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 01113-08; Fri, 17 Feb 2006 11:44:57 +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 90C18F5C02;
	Fri, 17 Feb 2006 11:44:56 +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.3/8.13.1) with ESMTP id k1HAj0As023820;
	Fri, 17 Feb 2006 11:45:01 +0100
Date:	Fri, 17 Feb 2006 10:45:02 +0000 (GMT)
From:	"Maciej W. Rozycki" <macro@linux-mips.org>
To:	Jes Sorensen <jes@sgi.com>
cc:	Ralf Baechle <ralf@linux-mips.org>,
	Martin Michlmayr <tbm@cyrius.com>, linux-mips@linux-mips.org
Subject: Re: Please pull drivers/scsi/dec_esp.c from Linus' git
In-Reply-To: <yq0pslmxsb7.fsf@jaguar.mkp.net>
Message-ID: <Pine.LNX.4.64N.0602171039320.7169@blysk.ds.pg.gda.pl>
References: <20060213225331.GA5315@deprecation.cyrius.com>
 <20060215150839.GA27719@linux-mips.org> <Pine.LNX.4.64N.0602161016260.7169@blysk.ds.pg.gda.pl>
 <20060216145931.GA1633@linux-mips.org> <Pine.LNX.4.64N.0602161504230.7169@blysk.ds.pg.gda.pl>
 <yq0pslmxsb7.fsf@jaguar.mkp.net>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Virus-Scanned: ClamAV 0.88/1291/Thu Feb 16 21:15:09 2006 on piorun.ds.pg.gda.pl
X-Virus-Status:	Clean
X-Virus-Scanned: by amavisd-new at pollux.ds.pg.gda.pl
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: 10483
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
Content-Length: 404
Lines: 11

On Fri, 17 Feb 2006, Jes Sorensen wrote:

> Just make mmiowb() strong enough on those platforms. There's really no
> reason to introduce yet another variation at this point.

 It's just horribly slow and an overkill if it's only ordering of 
consecutive writes rather than ordering of a read after a write that has 
to be guaranteed.  But perhaps we could keep abusing wmb() for the 
former...

  Maciej

From ralf@linux-mips.org Fri Feb 17 10:58:33 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 17 Feb 2006 10:58:42 +0000 (GMT)
Received: from mipsfw.mips-uk.com ([194.74.144.146]:64269 "EHLO
	bacchus.dhis.org") by ftp.linux-mips.org with ESMTP
	id S8133627AbWBQK6d (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Fri, 17 Feb 2006 10:58:33 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by bacchus.dhis.org (8.13.4/8.13.4) with ESMTP id k1HB5EPL017167;
	Fri, 17 Feb 2006 11:05:14 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.4/8.13.4/Submit) id k1GNOkmP028613;
	Thu, 16 Feb 2006 23:24:46 GMT
Date:	Thu, 16 Feb 2006 23:24:46 +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] make I/O helpers more customizable
Message-ID: <20060216232446.GA27840@linux-mips.org>
References: <20060217.013624.04769497.anemo@mba.ocn.ne.jp>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20060217.013624.04769497.anemo@mba.ocn.ne.jp>
User-Agent: Mutt/1.4.2.1i
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: 10484
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
Content-Length: 789
Lines: 20

On Fri, Feb 17, 2006 at 01:36:24AM +0900, Atsushi Nemoto wrote:

> 1. Move ioswab*() and __mem_ioswab*() to mangle-port.h.  Now io.h is
> clean from CONFIG_SGI_IP22.
> 
> 2. Pass a virtual address to *ioswab*().  Then we can provide
> mach-specific *ioswab*() and can do every evil thing based on its
> argument.  It could be useful on machines which have regions with
> different endian conversion scheme.
> 
> 3. Call __swizzle_addr*() _after_ adding mips_io_port_base.  This
> unifies the meaning of the argument of __swizzle_addr*() (always
> virtual address).  Then mach-specific __swizzle_addr*() can do every
> evil thing based on the argument.
> 
> Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>

Looks nice.  This this is more of a cleanup so I queued it for 2.6.17.

  Ralf

From jes@sgi.com Fri Feb 17 12:32:05 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 17 Feb 2006 12:32:13 +0000 (GMT)
Received: from omx1-ext.sgi.com ([192.48.179.11]:33701 "EHLO
	omx1.americas.sgi.com") by ftp.linux-mips.org with ESMTP
	id S8133645AbWBQMcF (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Fri, 17 Feb 2006 12:32:05 +0000
Received: from imr2.americas.sgi.com (imr2.americas.sgi.com [198.149.16.18])
	by omx1.americas.sgi.com (8.12.10/8.12.9/linux-outbound_gateway-1.1) with ESMTP id k1HCcdOX002728;
	Fri, 17 Feb 2006 06:38:40 -0600
Received: from daisy-e236.americas.sgi.com (daisy-e236.americas.sgi.com [128.162.236.214])
	by imr2.americas.sgi.com (8.12.9/8.12.10/SGI_generic_relay-1.2) with ESMTP id k1HCtXa514804457;
	Fri, 17 Feb 2006 04:55:33 -0800 (PST)
Received: from [127.0.0.1] (daisy-e236.americas.sgi.com [128.162.236.214]) by daisy-e236.americas.sgi.com (8.12.9/SGI-server-1.8) with ESMTP id k1HCcaQq1630112; Fri, 17 Feb 2006 06:38:37 -0600 (CST)
Message-ID: <43F5C300.10108@sgi.com>
Date:	Fri, 17 Feb 2006 13:35:12 +0100
From:	Jes Sorensen <jes@sgi.com>
User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051013)
X-Accept-Language: en-us, en
MIME-Version: 1.0
To:	"Maciej W. Rozycki" <macro@linux-mips.org>
CC:	Ralf Baechle <ralf@linux-mips.org>,
	Martin Michlmayr <tbm@cyrius.com>, linux-mips@linux-mips.org
Subject: Re: Please pull drivers/scsi/dec_esp.c from Linus' git
References: <20060213225331.GA5315@deprecation.cyrius.com> <20060215150839.GA27719@linux-mips.org> <Pine.LNX.4.64N.0602161016260.7169@blysk.ds.pg.gda.pl> <20060216145931.GA1633@linux-mips.org> <Pine.LNX.4.64N.0602161504230.7169@blysk.ds.pg.gda.pl> <yq0pslmxsb7.fsf@jaguar.mkp.net> <Pine.LNX.4.64N.0602171039320.7169@blysk.ds.pg.gda.pl>
In-Reply-To: <Pine.LNX.4.64N.0602171039320.7169@blysk.ds.pg.gda.pl>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Return-Path: <jes@sgi.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: 10485
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: jes@sgi.com
Precedence: bulk
X-list: linux-mips
Content-Length: 559
Lines: 17

Maciej W. Rozycki wrote:
> On Fri, 17 Feb 2006, Jes Sorensen wrote:
> 
> 
>>Just make mmiowb() strong enough on those platforms. There's really no
>>reason to introduce yet another variation at this point.
> 
> 
>  It's just horribly slow and an overkill if it's only ordering of 
> consecutive writes rather than ordering of a read after a write that has 
> to be guaranteed.  But perhaps we could keep abusing wmb() for the 
> former...

Depends on where it's happening. If it's the CPU doing it before it hits
the bus then wmb() would probably be ok.

Jes

From macro@linux-mips.org Fri Feb 17 12:44:45 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 17 Feb 2006 12:44:54 +0000 (GMT)
Received: from pollux.ds.pg.gda.pl ([153.19.208.7]:33550 "EHLO
	pollux.ds.pg.gda.pl") by ftp.linux-mips.org with ESMTP
	id S8133636AbWBQMop (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Fri, 17 Feb 2006 12:44:45 +0000
Received: from localhost (localhost [127.0.0.1])
	by pollux.ds.pg.gda.pl (Postfix) with ESMTP id BBE43F5C14;
	Fri, 17 Feb 2006 13:51:14 +0100 (CET)
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 00783-05; Fri, 17 Feb 2006 13:51:14 +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 55AFDF5C0F;
	Fri, 17 Feb 2006 13:51:14 +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.3/8.13.1) with ESMTP id k1HCpIRX014997;
	Fri, 17 Feb 2006 13:51:18 +0100
Date:	Fri, 17 Feb 2006 12:51:21 +0000 (GMT)
From:	"Maciej W. Rozycki" <macro@linux-mips.org>
To:	Jes Sorensen <jes@sgi.com>
cc:	Ralf Baechle <ralf@linux-mips.org>,
	Martin Michlmayr <tbm@cyrius.com>, linux-mips@linux-mips.org
Subject: Re: Please pull drivers/scsi/dec_esp.c from Linus' git
In-Reply-To: <43F5C300.10108@sgi.com>
Message-ID: <Pine.LNX.4.64N.0602171245580.7169@blysk.ds.pg.gda.pl>
References: <20060213225331.GA5315@deprecation.cyrius.com>
 <20060215150839.GA27719@linux-mips.org> <Pine.LNX.4.64N.0602161016260.7169@blysk.ds.pg.gda.pl>
 <20060216145931.GA1633@linux-mips.org> <Pine.LNX.4.64N.0602161504230.7169@blysk.ds.pg.gda.pl>
 <yq0pslmxsb7.fsf@jaguar.mkp.net> <Pine.LNX.4.64N.0602171039320.7169@blysk.ds.pg.gda.pl>
 <43F5C300.10108@sgi.com>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Virus-Scanned: ClamAV 0.88/1292/Fri Feb 17 10:39:02 2006 on piorun.ds.pg.gda.pl
X-Virus-Status:	Clean
X-Virus-Scanned: by amavisd-new at pollux.ds.pg.gda.pl
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: 10486
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
Content-Length: 737
Lines: 16

On Fri, 17 Feb 2006, Jes Sorensen wrote:

> > It's just horribly slow and an overkill if it's only ordering of consecutive
> > writes rather than ordering of a read after a write that has to be
> > guaranteed.  But perhaps we could keep abusing wmb() for the former...
> 
> Depends on where it's happening. If it's the CPU doing it before it hits
> the bus then wmb() would probably be ok.

 These systems only allow the CPU to access devices other than RAM.  But 
consistency between platforms is important as the same drivers may be used 
for systems that have different access rules.  Examples are currently the 
defxx and the tgafb drivers.  They should work correctly with the R3220 
writeback buffer as well as with PCI.

  Maciej

From tbm@cyrius.com Fri Feb 17 13:51:34 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 17 Feb 2006 13:51:46 +0000 (GMT)
Received: from sorrow.cyrius.com ([65.19.161.204]:6407 "EHLO sorrow.cyrius.com")
	by ftp.linux-mips.org with ESMTP id S8133654AbWBQNve (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Fri, 17 Feb 2006 13:51:34 +0000
Received: by sorrow.cyrius.com (Postfix, from userid 10)
	id E9D8A64D59; Fri, 17 Feb 2006 13:57:55 +0000 (UTC)
Received: by deprecation.cyrius.com (Postfix, from userid 1000)
	id EE53F8F77; Fri, 17 Feb 2006 13:57:48 +0000 (GMT)
Date:	Fri, 17 Feb 2006 13:57:48 +0000
From:	Martin Michlmayr <tbm@cyrius.com>
To:	Ralf Baechle <ralf@linux-mips.org>
Cc:	linux-mips@linux-mips.org
Subject: Re: undefined reference to `__lshrdi3' error with GCC 4.0
Message-ID: <20060217135748.GA28319@deprecation.cyrius.com>
References: <20060117134838.GJ27047@deprecation.cyrius.com> <200601171617.16147.p_christ@hol.gr> <20060117190859.GA2061@linux-mips.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20060117190859.GA2061@linux-mips.org>
User-Agent: Mutt/1.5.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: 10487
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
Content-Length: 722
Lines: 17

* Ralf Baechle <ralf@linux-mips.org> [2006-01-17 19:08]:
> > > arch/mips/kernel/built-in.o: In function `time_init':
> > > : undefined reference to `__lshrdi3'
> 
> Thanks to Martin Michlmayr's testing I now know this problem is limited
> to kernels built with gcc 4.0 and newer when optimizing for size.
...
> There is an awful lot of libgcc bits flying around in the kernel and I guess
> I'd be flamed for submitting even more ;-)  so I tried to come up with
> something to make most if not all unnecessary.  Still needs a little
> polishing but below for testing and commenting.

I think you've cleaned it up in the meantime.  Can you please send the
patch to lkml as a RFC?
-- 
Martin Michlmayr
http://www.cyrius.com/

From freddy@dusktilldawn.nl Fri Feb 17 14:47:21 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 17 Feb 2006 14:47:32 +0000 (GMT)
Received: from tool.snarl.nl ([213.84.251.124]:32164 "EHLO tool.snarl.nl")
	by ftp.linux-mips.org with ESMTP id S8133657AbWBQOrV (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Fri, 17 Feb 2006 14:47:21 +0000
Received: from localhost (tool.local.snarl.nl [127.0.0.1])
	by tool.snarl.nl (Postfix) with ESMTP id 754EC5DF5B
	for <linux-mips@linux-mips.org>; Fri, 17 Feb 2006 15:53:53 +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 29617-03 for <linux-mips@linux-mips.org>;
	Fri, 17 Feb 2006 15:53:53 +0100 (CET)
Received: by tool.snarl.nl (Postfix, from userid 1000)
	id 00E8A5DF4D; Fri, 17 Feb 2006 15:53:52 +0100 (CET)
Date:	Fri, 17 Feb 2006 15:53:52 +0100
From:	Freddy Spierenburg <freddy@dusktilldawn.nl>
To:	linux-mips@linux-mips.org
Subject: [PATCH] replaced io_remap_page_range() with io_remap_pfn_range()
Message-ID: <20060217145352.GD14066@dusktilldawn.nl>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="fwqqG+mf3f7vyBCB"
Content-Disposition: inline
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.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: 10488
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
Content-Length: 1927
Lines: 67


--fwqqG+mf3f7vyBCB
Content-Type: multipart/mixed; boundary="cYtjc4pxslFTELvY"
Content-Disposition: inline


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

Hi,

Replaced the no longer existing io_remap_page_range() routine
with the io_remap_pfn_range() routine. Did not have a chance yet
to test the functionality of the driver, but at least the kernel
compiles cleanly again.

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

--cYtjc4pxslFTELvY
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="fb.patch"
Content-Transfer-Encoding: quoted-printable

diff -Naur master.orig/drivers/video/au1100fb.c master.good/drivers/video/a=
u1100fb.c
--- master.orig/drivers/video/au1100fb.c	2006-02-17 10:57:28.000000000 +0000
+++ master.good/drivers/video/au1100fb.c	2006-02-17 14:05:58.000000000 +0000
@@ -50,6 +50,7 @@
 #include <linux/interrupt.h>
 #include <linux/ctype.h>
 #include <linux/dma-mapping.h>
+#include <linux/platform_device.h>
=20
 #include <asm/mach-au1x00/au1000.h>
=20
@@ -407,7 +408,7 @@
=20
 	vma->vm_flags |=3D VM_IO;
    =20
-	if (io_remap_page_range(vma, vma->vm_start, off,
+	if (io_remap_pfn_range(vma, vma->vm_start, off >> PAGE_SHIFT,
 				vma->vm_end - vma->vm_start,
 				vma->vm_page_prot)) {
 		return -EAGAIN;

--cYtjc4pxslFTELvY--

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

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

iD8DBQFD9eOAbxf9XXlB0eERAmF9AJ9dnQoSo2U/yMwXcG3QdnCZcoPxngCgtMw+
pMzQ+TnIhLoy8anKjYBfBm4=
=c6pg
-----END PGP SIGNATURE-----

--fwqqG+mf3f7vyBCB--

From freddy@dusktilldawn.nl Fri Feb 17 14:47:59 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 17 Feb 2006 14:48:15 +0000 (GMT)
Received: from tool.snarl.nl ([213.84.251.124]:32676 "EHLO tool.snarl.nl")
	by ftp.linux-mips.org with ESMTP id S8133656AbWBQOr2 (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Fri, 17 Feb 2006 14:47:28 +0000
Received: from localhost (tool.local.snarl.nl [127.0.0.1])
	by tool.snarl.nl (Postfix) with ESMTP id DAE7A5DF5B
	for <linux-mips@linux-mips.org>; Fri, 17 Feb 2006 15:54:06 +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 29617-03-2 for <linux-mips@linux-mips.org>;
	Fri, 17 Feb 2006 15:54:06 +0100 (CET)
Received: by tool.snarl.nl (Postfix, from userid 1000)
	id 8A8865DF4D; Fri, 17 Feb 2006 15:54:06 +0100 (CET)
Date:	Fri, 17 Feb 2006 15:54:06 +0100
From:	Freddy Spierenburg <freddy@dusktilldawn.nl>
To:	linux-mips@linux-mips.org
Subject: [PATCH] Small time UART configuration fix for AU1100 processor
Message-ID: <20060217145406.GE14066@dusktilldawn.nl>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="h3LYUU6HlUDSAOzy"
Content-Disposition: inline
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.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: 10489
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
Content-Length: 1760
Lines: 56


--h3LYUU6HlUDSAOzy
Content-Type: multipart/mixed; boundary="f5QefDQHtn8hx44O"
Content-Disposition: inline


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

Hi,

The AU1100 processor does not have an internal UART2. Only
UART0, UART1 and UART3 exist. This patch removes the non existing
UART2 and replaces it with a descriptive comment.

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

--f5QefDQHtn8hx44O
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="uart2.patch"

diff -Naur master.orig/drivers/serial/8250_au1x00.c master.good/drivers/serial/8250_au1x00.c
--- master.orig/drivers/serial/8250_au1x00.c	2006-02-17 10:57:28.000000000 +0000
+++ master.good/drivers/serial/8250_au1x00.c	2006-02-17 14:02:38.000000000 +0000
@@ -51,7 +51,7 @@
 #elif defined(CONFIG_SOC_AU1100)
 	PORT(UART0_ADDR, AU1100_UART0_INT),
 	PORT(UART1_ADDR, AU1100_UART1_INT),
-	PORT(UART2_ADDR, AU1100_UART2_INT),
+	/* The internal UART2 does not exist on the AU1100 processor. */
 	PORT(UART3_ADDR, AU1100_UART3_INT),
 #elif defined(CONFIG_SOC_AU1550)
 	PORT(UART0_ADDR, AU1550_UART0_INT),

--f5QefDQHtn8hx44O--

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

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

iD8DBQFD9eOObxf9XXlB0eERAm6xAJ9tfIcSuMhg27t1QhnThmFsO4Aj+gCfS60V
J3YWh12F1UKObLTo+YKoKbI=
=k/9W
-----END PGP SIGNATURE-----

--h3LYUU6HlUDSAOzy--

From jes@trained-monkey.org Fri Feb 17 15:10:23 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 17 Feb 2006 15:10:33 +0000 (GMT)
Received: from jaguar.mkp.net ([192.139.46.146]:2278 "EHLO jaguar.mkp.net")
	by ftp.linux-mips.org with ESMTP id S8133657AbWBQPKX (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Fri, 17 Feb 2006 15:10:23 +0000
Received: by jaguar.mkp.net (Postfix, from userid 1655)
	id AA956286D89; Fri, 17 Feb 2006 10:17:00 -0500 (EST)
To:	"Maciej W. Rozycki" <macro@linux-mips.org>
Cc:	Ralf Baechle <ralf@linux-mips.org>,
	Martin Michlmayr <tbm@cyrius.com>, linux-mips@linux-mips.org
Subject: Re: Please pull drivers/scsi/dec_esp.c from Linus' git
References: <20060213225331.GA5315@deprecation.cyrius.com>
	<20060215150839.GA27719@linux-mips.org>
	<Pine.LNX.4.64N.0602161016260.7169@blysk.ds.pg.gda.pl>
	<20060216145931.GA1633@linux-mips.org>
	<Pine.LNX.4.64N.0602161504230.7169@blysk.ds.pg.gda.pl>
	<yq0pslmxsb7.fsf@jaguar.mkp.net>
	<Pine.LNX.4.64N.0602171039320.7169@blysk.ds.pg.gda.pl>
	<43F5C300.10108@sgi.com>
	<Pine.LNX.4.64N.0602171245580.7169@blysk.ds.pg.gda.pl>
From:	Jes Sorensen <jes@sgi.com>
Date:	17 Feb 2006 10:17:00 -0500
In-Reply-To: <Pine.LNX.4.64N.0602171245580.7169@blysk.ds.pg.gda.pl>
Message-ID: <yq0d5hmxbf7.fsf@jaguar.mkp.net>
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Return-Path: <jes@trained-monkey.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: 10490
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: jes@sgi.com
Precedence: bulk
X-list: linux-mips
Content-Length: 560
Lines: 14

>>>>> "Maciej" == Maciej W Rozycki <macro@linux-mips.org> writes:

Maciej>  These systems only allow the CPU to access devices other than
Maciej> RAM.  But consistency between platforms is important as the
Maciej> same drivers may be used for systems that have different
Maciej> access rules.  Examples are currently the defxx and the tgafb
Maciej> drivers.  They should work correctly with the R3220 writeback
Maciej> buffer as well as with PCI.

So just change the implementation of mmiowb depending on whether it's
on an R3220 or a PCI system.

Cheers,
Jes

From anemo@mba.ocn.ne.jp Fri Feb 17 15:14:25 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 17 Feb 2006 15:14:33 +0000 (GMT)
Received: from mba.ocn.ne.jp ([210.190.142.172]:52989 "HELO smtp.mba.ocn.ne.jp")
	by ftp.linux-mips.org with SMTP id S8133657AbWBQPOY (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Fri, 17 Feb 2006 15:14:24 +0000
Received: from localhost (p2067-ipad28funabasi.chiba.ocn.ne.jp [220.107.201.67])
	by smtp.mba.ocn.ne.jp (Postfix) with ESMTP
	id 215A5B518; Sat, 18 Feb 2006 00:21:01 +0900 (JST)
Date:	Sat, 18 Feb 2006 00:20:49 +0900 (JST)
Message-Id: <20060218.002049.75184722.anemo@mba.ocn.ne.jp>
To:	linux-mips@linux-mips.org
Cc:	ralf@linux-mips.org
Subject: Re: [PATCH] use __raw access function for fb
From:	Atsushi Nemoto <anemo@mba.ocn.ne.jp>
In-Reply-To: <20060209.005655.96684595.anemo@mba.ocn.ne.jp>
References: <20060209.005655.96684595.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: 10491
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
Content-Length: 217
Lines: 8

I just sent another non-intrusive fix (add __force tag to fb_readb,
etc) to LKML.

BTW, current fb_readw(), etc. are really appropriate for IP22/IP32?
It seems they have funny __swizzle_addr_w ...

---
Atsushi Nemoto

From ralf@linux-mips.org Fri Feb 17 15:23:56 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 17 Feb 2006 15:24:05 +0000 (GMT)
Received: from mipsfw.mips-uk.com ([194.74.144.146]:18181 "EHLO
	bacchus.dhis.org") by ftp.linux-mips.org with ESMTP
	id S8133657AbWBQPX4 (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Fri, 17 Feb 2006 15:23:56 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by bacchus.dhis.org (8.13.4/8.13.4) with ESMTP id k1HFUcvL024668;
	Fri, 17 Feb 2006 15:30:38 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.4/8.13.4/Submit) id k1HFUbgc024667;
	Fri, 17 Feb 2006 15:30:37 GMT
Date:	Fri, 17 Feb 2006 15:30:37 +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] use __raw access function for fb
Message-ID: <20060217153037.GA23432@linux-mips.org>
References: <20060209.005655.96684595.anemo@mba.ocn.ne.jp> <20060218.002049.75184722.anemo@mba.ocn.ne.jp>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20060218.002049.75184722.anemo@mba.ocn.ne.jp>
User-Agent: Mutt/1.4.2.1i
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: 10492
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
Content-Length: 592
Lines: 16

On Sat, Feb 18, 2006 at 12:20:49AM +0900, Atsushi Nemoto wrote:

> I just sent another non-intrusive fix (add __force tag to fb_readb,
> etc) to LKML.
> 
> BTW, current fb_readw(), etc. are really appropriate for IP22/IP32?
> It seems they have funny __swizzle_addr_w ...

Ignoring the theoretical possibility of using an EISA graphics card in an
IP22 (more exactly Indigo 2) system, IP22 simply doesn't have a framebuffer.

I'm not sure what the effect of the patch on IP32 would be so I was
waiting to apply your patch in the hope somebody is going to test it
No reports so far ...

  Ralf

From ralf@linux-mips.org Fri Feb 17 15:57:33 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 17 Feb 2006 15:57:42 +0000 (GMT)
Received: from mipsfw.mips-uk.com ([194.74.144.146]:12038 "EHLO
	bacchus.dhis.org") by ftp.linux-mips.org with ESMTP
	id S8133657AbWBQP5d (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Fri, 17 Feb 2006 15:57:33 +0000
Received: from denk.linux-mips.net (denk.linux-mips.net [127.0.0.1])
	by bacchus.dhis.org (8.13.4/8.13.4) with ESMTP id k1HG4CgH025634;
	Fri, 17 Feb 2006 16:04:12 GMT
Received: (from ralf@localhost)
	by denk.linux-mips.net (8.13.4/8.13.4/Submit) id k1HG4CHH025633;
	Fri, 17 Feb 2006 16:04:12 GMT
Date:	Fri, 17 Feb 2006 16:04:12 +0000
From:	Ralf Baechle <ralf@linux-mips.org>
To:	joris lijssens <joris_lijssens1980@yahoo.com>
Cc:	linux-mips@linux-mips.org
Subject: Re: patch to increase stack size
Message-ID: <20060217160412.GE18396@linux-mips.org>
References: <20060216130236.72703.qmail@web36102.mail.mud.yahoo.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20060216130236.72703.qmail@web36102.mail.mud.yahoo.com>
User-Agent: Mutt/1.4.2.1i
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: 10493
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
Content-Length: 541
Lines: 15

On Thu, Feb 16, 2006 at 01:02:36PM +0000, joris lijssens wrote:

> I was wondering if there is a patch avaible to
> increase the stack size on a mips 2.6 linux kernel. I
> have found one for the i386 that sets the stack size
> from 4K to 16K. But I don't find anything for the mips
> kernel. I would like it if somebody has some info on
> this topic.

If anything the aim is to shrink the kernel stack further.  The larger
allocations are, then less likely they succeed.

32-bit MIPS kernels use 8kB stack,  64-bit uses 16kB stacks.

  Ralf

From jcrouse@cosmic.amd.com Fri Feb 17 17:12:04 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 17 Feb 2006 17:12:13 +0000 (GMT)
Received: from amdext3.amd.com ([139.95.251.6]:48015 "EHLO amdext3.amd.com")
	by ftp.linux-mips.org with ESMTP id S8133714AbWBQRME (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Fri, 17 Feb 2006 17:12:04 +0000
Received: from SSVLGW01.amd.com (ssvlgw01.amd.com [139.95.250.169])
	by amdext3.amd.com (8.12.11/8.12.11/AMD) with ESMTP id k1HHIa4Z022821;
	Fri, 17 Feb 2006 09:18:38 -0800
Received: from 139.95.53.182 by SSVLGW01.amd.com with ESMTP (AMD SMTP
 Relay (Email Firewall v6.1.0)); Fri, 17 Feb 2006 09:18:18 -0800
X-Server-Uuid: 89466532-923C-4A88-82C1-66ACAA0041DF
Received: from ldcmail.amd.com ([147.5.200.40]) by SSVLEXBH1.amd.com
 with Microsoft SMTPSVC(6.0.3790.0); Fri, 17 Feb 2006 09:18:18 -0800
Received: from cosmic.amd.com (cosmic.amd.com [147.5.201.206]) by
 ldcmail.amd.com (Postfix) with ESMTP id B83222030; Fri, 17 Feb 2006
 10:18:17 -0700 (MST)
Received: from cosmic.amd.com (localhost [127.0.0.1]) by cosmic.amd.com
 (8.13.4/8.13.4) with ESMTP id k1HHOmgM030541; Fri, 17 Feb 2006 10:24:48
 -0700
Received: (from jcrouse@localhost) by cosmic.amd.com (
 8.13.4/8.13.4/Submit) id k1HHOluY030540; Fri, 17 Feb 2006 10:24:47
 -0700
Date:	Fri, 17 Feb 2006 10:24:47 -0700
From:	"Jordan Crouse" <jordan.crouse@amd.com>
To:	"Freddy Spierenburg" <freddy@dusktilldawn.nl>
cc:	linux-mips@linux-mips.org
Subject: Re: Small time UART configuration fix for AU1100 processor
Message-ID: <20060217172447.GA30429@cosmic.amd.com>
References: <20060217145406.GE14066@dusktilldawn.nl>
MIME-Version: 1.0
In-Reply-To: <20060217145406.GE14066@dusktilldawn.nl>
User-Agent: Mutt/1.5.11
X-OriginalArrivalTime: 17 Feb 2006 17:18:18.0653 (UTC)
 FILETIME=[25378CD0:01C633E6]
X-WSS-ID: 6FE8DAD02W4253210-01-01
Content-Type: text/plain;
 charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: 7bit
Return-Path: <jcrouse@cosmic.amd.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: 10494
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: jordan.crouse@amd.com
Precedence: bulk
X-list: linux-mips
Content-Length: 587
Lines: 15

> The AU1100 processor does not have an internal UART2. Only
> UART0, UART1 and UART3 exist. This patch removes the non existing
> UART2 and replaces it with a descriptive comment.

Thanks.  I think that Ralf already told you to send it to Russell King,
but I'll toss it in my tree as well, in case he doesn't get it.

The comment probably isn't required, though - just remove it.

I know this is a stupid question for an AMD employee to ask, but since
I've only been associated with the AU1200, and to a limited extent the AU1550,
do *ANY* of our boards have an UART2 on them?

Jordan


From sshtylyov@ru.mvista.com Fri Feb 17 17:20:22 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 17 Feb 2006 17:20:30 +0000 (GMT)
Received: from rtsoft2.corbina.net ([85.21.88.2]:59347 "HELO
	mail.dev.rtsoft.ru") by ftp.linux-mips.org with SMTP
	id S8133441AbWBQRUW (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Fri, 17 Feb 2006 17:20:22 +0000
Received: (qmail 8932 invoked from network); 17 Feb 2006 17:26:55 -0000
Received: from wasted.dev.rtsoft.ru (HELO ?192.168.1.248?) (192.168.1.248)
  by mail.dev.rtsoft.ru with SMTP; 17 Feb 2006 17:26:55 -0000
Message-ID: <43F60824.9030401@ru.mvista.com>
Date:	Fri, 17 Feb 2006 20:30:12 +0300
From:	Sergei Shtylylov <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:	Jordan Crouse <jordan.crouse@amd.com>
CC:	linux-mips@linux-mips.org
Subject: Re: Small time UART configuration fix for AU1100 processor
References: <20060217145406.GE14066@dusktilldawn.nl> <20060217172447.GA30429@cosmic.amd.com>
In-Reply-To: <20060217172447.GA30429@cosmic.amd.com>
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: 10495
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
Content-Length: 340
Lines: 13

Hello.

Jordan Crouse wrote:
> I know this is a stupid question for an AMD employee to ask, but since
> I've only been associated with the AU1200, and to a limited extent the AU1550,
> do *ANY* of our boards have an UART2 on them?

   Looks like only Au1000 SOC has all 4 UARTs. The other SOCs have UART2 
missing...

> Jordan

WBR, Sergei

From jcrouse@cosmic.amd.com Fri Feb 17 17:22:00 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 17 Feb 2006 17:22:09 +0000 (GMT)
Received: from amdext3.amd.com ([139.95.251.6]:4497 "EHLO amdext3.amd.com")
	by ftp.linux-mips.org with ESMTP id S8133716AbWBQRWA (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Fri, 17 Feb 2006 17:22:00 +0000
Received: from SSVLGW02.amd.com (ssvlgw02.amd.com [139.95.250.170])
	by amdext3.amd.com (8.12.11/8.12.11/AMD) with ESMTP id k1HHPxHV024242;
	Fri, 17 Feb 2006 09:28:35 -0800
Received: from 139.95.53.182 by SSVLGW01.amd.com with ESMTP (AMD SMTP
 Relay (Email Firewall v6.1.0)); Fri, 17 Feb 2006 09:28:20 -0800
X-Server-Uuid: 89466532-923C-4A88-82C1-66ACAA0041DF
Received: from ldcmail.amd.com ([147.5.200.40]) by SSVLEXBH1.amd.com
 with Microsoft SMTPSVC(6.0.3790.0); Fri, 17 Feb 2006 09:28:19 -0800
Received: from cosmic.amd.com (cosmic.amd.com [147.5.201.206]) by
 ldcmail.amd.com (Postfix) with ESMTP id CEC54202D; Fri, 17 Feb 2006
 10:28:18 -0700 (MST)
Received: from cosmic.amd.com (localhost [127.0.0.1]) by cosmic.amd.com
 (8.13.4/8.13.4) with ESMTP id k1HHYnKl030661; Fri, 17 Feb 2006 10:34:49
 -0700
Received: (from jcrouse@localhost) by cosmic.amd.com (
 8.13.4/8.13.4/Submit) id k1HHYmXt030660; Fri, 17 Feb 2006 10:34:48
 -0700
Date:	Fri, 17 Feb 2006 10:34:48 -0700
From:	"Jordan Crouse" <jordan.crouse@amd.com>
To:	"Freddy Spierenburg" <freddy@dusktilldawn.nl>
cc:	linux-mips@linux-mips.org
Subject: Re: replaced io_remap_page_range() with io_remap_pfn_range()
Message-ID: <20060217173448.GB30429@cosmic.amd.com>
References: <20060217145352.GD14066@dusktilldawn.nl>
MIME-Version: 1.0
In-Reply-To: <20060217145352.GD14066@dusktilldawn.nl>
User-Agent: Mutt/1.5.11
X-OriginalArrivalTime: 17 Feb 2006 17:28:20.0216 (UTC)
 FILETIME=[8BC6C780:01C633E7]
X-WSS-ID: 6FE8D83E2W4256147-01-01
Content-Type: text/plain;
 charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: 7bit
Return-Path: <jcrouse@cosmic.amd.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: 10496
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: jordan.crouse@amd.com
Precedence: bulk
X-list: linux-mips
Content-Length: 208
Lines: 9

I do believe that this fix is already upstream.  Are you playing
with the latest kernel?

-- 
Jordan Crouse
Senior Linux Engineer
AMD - Personal Connectivity Solutions Group
<www.amd.com/embeddedprocessors>


From freddy@dusktilldawn.nl Fri Feb 17 18:18:30 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 17 Feb 2006 18:18:40 +0000 (GMT)
Received: from tool.snarl.nl ([213.84.251.124]:53668 "EHLO tool.snarl.nl")
	by ftp.linux-mips.org with ESMTP id S8133718AbWBQSSa (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Fri, 17 Feb 2006 18:18:30 +0000
Received: from localhost (tool.local.snarl.nl [127.0.0.1])
	by tool.snarl.nl (Postfix) with ESMTP id BA1F75DF5B;
	Fri, 17 Feb 2006 19:25:10 +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 30825-04-2; Fri, 17 Feb 2006 19:25:10 +0100 (CET)
Received: by tool.snarl.nl (Postfix, from userid 1000)
	id 620AB5DF4D; Fri, 17 Feb 2006 19:25:10 +0100 (CET)
Date:	Fri, 17 Feb 2006 19:25:10 +0100
From:	Freddy Spierenburg <freddy@dusktilldawn.nl>
To:	Jordan Crouse <jordan.crouse@amd.com>
Cc:	linux-mips@linux-mips.org
Subject: Re: Small time UART configuration fix for AU1100 processor
Message-ID: <20060217182510.GG14066@dusktilldawn.nl>
References: <20060217145406.GE14066@dusktilldawn.nl> <20060217172447.GA30429@cosmic.amd.com>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="W/+CTqSGWdiRg+8j"
Content-Disposition: inline
In-Reply-To: <20060217172447.GA30429@cosmic.amd.com>
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.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: 10497
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
Content-Length: 1543
Lines: 46


--W/+CTqSGWdiRg+8j
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi Jordan,

On Fri, Feb 17, 2006 at 10:24:47AM -0700, Jordan Crouse wrote:
> I think that Ralf already told you to send it to Russell King,
> but I'll toss it in my tree as well, in case he doesn't get it.
I have already send it to Russell yes, so...

> The comment probably isn't required, though - just remove it.
=2E..no chance to remove the comment anymore. Well, it actually
does not hurt that much (IMHO) and saves newbies like me some
searching. :-)

> I know this is a stupid question for an AMD employee to ask, but since
> I've only been associated with the AU1200, and to a limited extent the AU=
1550,
> do *ANY* of our boards have an UART2 on them?
Unfortunately I have no idea. I'm fairly new (two weeks actually)
to this architecture and the AU1100 is the only AMD board I have
access to. Sorry.

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

--W/+CTqSGWdiRg+8j
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

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

iD8DBQFD9hUGbxf9XXlB0eERAtrtAKCfQg7NTI2l38WCcPmzuB0np6EMmACeL4PK
YlxrLO0xkUleXxcykk7mw4g=
=lxuP
-----END PGP SIGNATURE-----

--W/+CTqSGWdiRg+8j--

From tbm@cyrius.com Fri Feb 17 18:21:21 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 17 Feb 2006 18:21:41 +0000 (GMT)
Received: from sorrow.cyrius.com ([65.19.161.204]:20233 "EHLO
	sorrow.cyrius.com") by ftp.linux-mips.org with ESMTP
	id S8133720AbWBQSVV (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Fri, 17 Feb 2006 18:21:21 +0000
Received: by sorrow.cyrius.com (Postfix, from userid 10)
	id 990BE64D59; Fri, 17 Feb 2006 18:27:59 +0000 (UTC)
Received: by deprecation.cyrius.com (Postfix, from userid 1000)
	id AAB4A8F77; Fri, 17 Feb 2006 18:27:51 +0000 (GMT)
Date:	Fri, 17 Feb 2006 18:27:51 +0000
From:	Martin Michlmayr <tbm@cyrius.com>
To:	Ralf Baechle <ralf@linux-mips.org>
Cc:	linux-mips@linux-mips.org
Subject: [PATCH] Enable VIA82CXXX and TULIP in Cobalt defconfig
Message-ID: <20060217182747.GA25475@deprecation.cyrius.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.5.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: 10498
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
Content-Length: 2397
Lines: 78

All MIPS based Cobalt machines have an in-built VIA82CXXX IDE chip and
Tulip Ethernet.  It therefore makes sense to activate those in the Cobalt
defconfig.

Signed-off-by: Martin Michlmayr <tbm@cyrius.com>

---

 cobalt_defconfig |   44 +++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 41 insertions(+), 3 deletions(-)

diff --git a/arch/mips/configs/cobalt_defconfig b/arch/mips/configs/cobalt_defconfig
index b08c852..8336b21 100644
--- a/arch/mips/configs/cobalt_defconfig
+++ b/arch/mips/configs/cobalt_defconfig
@@ -370,9 +370,38 @@ CONFIG_BLK_DEV_IDEDISK=y
 # IDE chipset support/bugfixes
 #
 CONFIG_IDE_GENERIC=y
-# CONFIG_BLK_DEV_IDEPCI is not set
+CONFIG_BLK_DEV_IDEPCI=y
+# CONFIG_IDEPCI_SHARE_IRQ is not set
+# CONFIG_BLK_DEV_OFFBOARD is not set
+# CONFIG_BLK_DEV_GENERIC is not set
+# CONFIG_BLK_DEV_OPTI621 is not set
+CONFIG_BLK_DEV_IDEDMA_PCI=y
+# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
+# CONFIG_IDEDMA_PCI_AUTO is not set
+# CONFIG_BLK_DEV_AEC62XX is not set
+# CONFIG_BLK_DEV_ALI15X3 is not set
+# CONFIG_BLK_DEV_AMD74XX is not set
+# CONFIG_BLK_DEV_CMD64X is not set
+# CONFIG_BLK_DEV_TRIFLEX is not set
+# CONFIG_BLK_DEV_CY82C693 is not set
+# CONFIG_BLK_DEV_CS5520 is not set
+# CONFIG_BLK_DEV_CS5530 is not set
+# CONFIG_BLK_DEV_HPT34X is not set
+# CONFIG_BLK_DEV_HPT366 is not set
+# CONFIG_BLK_DEV_SC1200 is not set
+# CONFIG_BLK_DEV_PIIX is not set
+# CONFIG_BLK_DEV_IT821X is not set
+# CONFIG_BLK_DEV_NS87415 is not set
+# CONFIG_BLK_DEV_PDC202XX_OLD is not set
+# CONFIG_BLK_DEV_PDC202XX_NEW is not set
+# CONFIG_BLK_DEV_SVWKS is not set
+# CONFIG_BLK_DEV_SIIMAGE is not set
+# CONFIG_BLK_DEV_SLC90E66 is not set
+# CONFIG_BLK_DEV_TRM290 is not set
+CONFIG_BLK_DEV_VIA82CXXX=y
 # CONFIG_IDE_ARM is not set
-# CONFIG_BLK_DEV_IDEDMA is not set
+CONFIG_BLK_DEV_IDEDMA=y
+# CONFIG_IDEDMA_IVB is not set
 # CONFIG_IDEDMA_AUTO is not set
 # CONFIG_BLK_DEV_HD is not set
 
@@ -444,7 +473,16 @@ CONFIG_NET_ETHERNET=y
 #
 # Tulip family network device support
 #
-# CONFIG_NET_TULIP is not set
+CONFIG_NET_TULIP=y
+CONFIG_DE2104X=y
+CONFIG_TULIP=y
+# CONFIG_TULIP_MWI is not set
+# CONFIG_TULIP_MMIO is not set
+# CONFIG_TULIP_NAPI is not set
+# CONFIG_DE4X5 is not set
+# CONFIG_WINBOND_840 is not set
+# CONFIG_DM9102 is not set
+# CONFIG_ULI526X is not set
 # CONFIG_HP100 is not set
 # CONFIG_NET_PCI is not set
 

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

From freddy@dusktilldawn.nl Fri Feb 17 18:25:17 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 17 Feb 2006 18:25:33 +0000 (GMT)
Received: from tool.snarl.nl ([213.84.251.124]:55460 "EHLO tool.snarl.nl")
	by ftp.linux-mips.org with ESMTP id S8133359AbWBQSZR (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Fri, 17 Feb 2006 18:25:17 +0000
Received: from localhost (tool.local.snarl.nl [127.0.0.1])
	by tool.snarl.nl (Postfix) with ESMTP id DC6055DF5B;
	Fri, 17 Feb 2006 19:31:55 +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 31047-02; Fri, 17 Feb 2006 19:31:55 +0100 (CET)
Received: by tool.snarl.nl (Postfix, from userid 1000)
	id 600EA5DF4D; Fri, 17 Feb 2006 19:31:55 +0100 (CET)
Date:	Fri, 17 Feb 2006 19:31:55 +0100
From:	Freddy Spierenburg <freddy@dusktilldawn.nl>
To:	Jordan Crouse <jordan.crouse@amd.com>
Cc:	linux-mips@linux-mips.org
Subject: Re: replaced io_remap_page_range() with io_remap_pfn_range()
Message-ID: <20060217183155.GH14066@dusktilldawn.nl>
References: <20060217145352.GD14066@dusktilldawn.nl> <20060217173448.GB30429@cosmic.amd.com>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="iAzLNm1y1mIRgolD"
Content-Disposition: inline
In-Reply-To: <20060217173448.GB30429@cosmic.amd.com>
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.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: 10499
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
Content-Length: 1565
Lines: 52


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

Hi Jordan,

On Fri, Feb 17, 2006 at 10:34:48AM -0700, Jordan Crouse wrote:
> I do believe that this fix is already upstream.  Are you playing
> with the latest kernel?
I played with the latest git repository which I did got from:

	$ git clone rsync://ftp.linux-mips.org/pub/scm/linux.git linux.git

and which I today updated using:

	$ git pull git://ftp.linux-mips.org/pub/scm/linux.git

And just to make sure it's not upstream I checked out:

	$ cg-clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.=
6.git

and just to be 100% sure linux-2.6.15.4.tar.bz2 with
patch-2.6.16-rc3.bz2 too.

I now think I covered it all, or am I still missing something?
Anyway, I did not find the problem fixed in any of these
repositories or tarballs so hence I shall send the patch to
Antonino Daplas later tonight or tomorrow.

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

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

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

iD8DBQFD9habbxf9XXlB0eERAk3MAJ4pLnlv0q9M5uV+zPEoQJMQLbQF7QCfVwck
JHGGzKidECPtmXMEMOxRV1I=
=gx2M
-----END PGP SIGNATURE-----

--iAzLNm1y1mIRgolD--

From tbm@cyrius.com Fri Feb 17 19:07:38 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 17 Feb 2006 19:07:49 +0000 (GMT)
Received: from sorrow.cyrius.com ([65.19.161.204]:47881 "EHLO
	sorrow.cyrius.com") by ftp.linux-mips.org with ESMTP
	id S8133379AbWBQTHi (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Fri, 17 Feb 2006 19:07:38 +0000
Received: by sorrow.cyrius.com (Postfix, from userid 10)
	id 2593864D59; Fri, 17 Feb 2006 19:14:16 +0000 (UTC)
Received: by deprecation.cyrius.com (Postfix, from userid 1000)
	id 4A4638F77; Fri, 17 Feb 2006 19:14:06 +0000 (GMT)
Date:	Fri, 17 Feb 2006 19:14:06 +0000
From:	Martin Michlmayr <tbm@cyrius.com>
To:	Ralf Baechle <ralf@linux-mips.org>
Cc:	linux-mips@linux-mips.org
Subject: Re: Fix a CPU definition for Cobalt
Message-ID: <20060217191406.GA19158@deprecation.cyrius.com>
References: <20060119192414.GA26798@deprecation.cyrius.com> <20060119210440.GE3398@linux-mips.org> <20060119214546.GB10040@deprecation.cyrius.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20060119214546.GB10040@deprecation.cyrius.com>
User-Agent: Mutt/1.5.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: 10500
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
Content-Length: 2879
Lines: 88

* Martin Michlmayr <tbm@cyrius.com> [2006-01-19 21:45]:
> > scache flushing functions aren't getting initialized and the NULL
> > pointer is eventually called as a function.  So I suggest this below.
> > Can you test it?
> Doesn't work.

OK, I found the bug in your patch, fixed this and also added proper
type casting.  Tested patch below; please commit to git and push to
Linus since Cobalt support is completely broken without this patch.


From: Martin Michlmayr <tbm@cyrius.com>

[PATCH] Initialize scache flushing functions when CPU has no scache

When a CPU has no scache, the scache flushing functions currently
aren't getting initialized and the NULL pointer is eventually called
as a function.  Initialize the scache flushing functions as a noop
when there's no scache.

Signed-off-by: Martin Michlmayr <tbm@cyrius.com>

---

 c-r4k.c |   16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
index 1b71d91..0668e9b 100644
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -235,7 +235,9 @@ static inline void r4k_blast_scache_page
 {
 	unsigned long sc_lsize = cpu_scache_line_size();
 
-	if (sc_lsize == 16)
+	if (scache_size == 0)
+		r4k_blast_scache_page = (void *)no_sc_noop;
+	else if (sc_lsize == 16)
 		r4k_blast_scache_page = blast_scache16_page;
 	else if (sc_lsize == 32)
 		r4k_blast_scache_page = blast_scache32_page;
@@ -251,7 +253,9 @@ static inline void r4k_blast_scache_page
 {
 	unsigned long sc_lsize = cpu_scache_line_size();
 
-	if (sc_lsize == 16)
+	if (scache_size == 0)
+		r4k_blast_scache_page_indexed = (void *)no_sc_noop;
+	else if (sc_lsize == 16)
 		r4k_blast_scache_page_indexed = blast_scache16_page_indexed;
 	else if (sc_lsize == 32)
 		r4k_blast_scache_page_indexed = blast_scache32_page_indexed;
@@ -267,7 +271,9 @@ static inline void r4k_blast_scache_setu
 {
 	unsigned long sc_lsize = cpu_scache_line_size();
 
-	if (sc_lsize == 16)
+	if (scache_size == 0)
+		r4k_blast_scache = (void *)no_sc_noop;
+	else if (sc_lsize == 16)
 		r4k_blast_scache = blast_scache16;
 	else if (sc_lsize == 32)
 		r4k_blast_scache = blast_scache32;
@@ -482,7 +488,7 @@ static inline void local_r4k_flush_icach
 			protected_blast_dcache_range(start, end);
 		}
 
-		if (!cpu_icache_snoops_remote_store) {
+		if (!cpu_icache_snoops_remote_store && scache_size) {
 			if (end - start > scache_size)
 				r4k_blast_scache();
 			else
@@ -651,7 +657,7 @@ static void local_r4k_flush_cache_sigtra
 
 	R4600_HIT_CACHEOP_WAR_IMPL;
 	protected_writeback_dcache_line(addr & ~(dc_lsize - 1));
-	if (!cpu_icache_snoops_remote_store)
+	if (!cpu_icache_snoops_remote_store && scache_size)
 		protected_writeback_scache_line(addr & ~(sc_lsize - 1));
 	protected_flush_icache_line(addr & ~(ic_lsize - 1));
 	if (MIPS4K_ICACHE_REFILL_WAR) {



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

From tbm@cyrius.com Fri Feb 17 19:13:06 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 17 Feb 2006 19:13:17 +0000 (GMT)
Received: from sorrow.cyrius.com ([65.19.161.204]:51465 "EHLO
	sorrow.cyrius.com") by ftp.linux-mips.org with ESMTP
	id S8133379AbWBQTNG (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Fri, 17 Feb 2006 19:13:06 +0000
Received: by sorrow.cyrius.com (Postfix, from userid 10)
	id 785B264D59; Fri, 17 Feb 2006 19:19:45 +0000 (UTC)
Received: by deprecation.cyrius.com (Postfix, from userid 1000)
	id 7E4E48F77; Fri, 17 Feb 2006 19:19:37 +0000 (GMT)
Date:	Fri, 17 Feb 2006 19:19:37 +0000
From:	Martin Michlmayr <tbm@cyrius.com>
To:	linux-mips@linux-mips.org
Subject: Oops on 64-bit Cobalt with current git
Message-ID: <20060217191937.GA20521@deprecation.cyrius.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
User-Agent: Mutt/1.5.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: 10501
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
Content-Length: 27616
Lines: 510

I get the following oops with a 64-bit Cobalt kernel with today's
linux-mips git.  A 32-bit kernel with the same configuration works
without any problems.

Any idea?


Linux version 2.6.16-rc3 (tbm@deprecation) (gcc version 4.0.3 20051201 (prerelease) (Debian 4.0.2-5)) #12 Fri Feb 17 19:07:58 GMT 2006
 CPU revision is: 000028a0
 FPU revision is: 000028a0
 Cobalt board ID: 5
 Determined physical RAM map:
  memory: 0000000008000000 @ 0000000000000000 (usable)
 Built 1 zonelists
 Kernel command line: console=ttyS0,115200 root=/dev/hda2
 Primary instruction cache 32kB, physically tagged, 2-way, linesize 32 bytes.
 Primary data cache 32kB, 2-way, linesize 32 bytes.
 Synthesized TLB refill handler (32 instructions).
 Synthesized TLB load handler fastpath (46 instructions).
 Synthesized TLB store handler fastpath (46 instructions).
 Synthesized TLB modify handler fastpath (45 instructions).
 PID hash table entries: 1024 (order: 10, 32768 bytes)
 Console: colour dummy device 80x25
 Dentry cache hash table entries: 32768 (order: 6, 262144 bytes)
 Inode-cache hash table entries: 16384 (order: 5, 131072 bytes)
 Memory: 124244k/131072k available (2882k kernel code, 6676k reserved, 669k data, 156k init, 0k highmem)
 Mount-cache hash table entries: 256
 Checking for 'wait' instruction...  available.
 Checking for the multiply/shift bug... no.
 Checking for the daddi bug... no.
 Checking for the daddiu bug... no.
 NET: Registered protocol family 16
 Generic PHY: Registered new driver
 Galileo: fixed bridge class
 Galileo: revision 17
 fuse init (API version 7.6)
 Initializing Cryptographic API
 io scheduler noop registered
 io scheduler anticipatory registered (default)
 io scheduler deadline registered
 io scheduler cfq registered
 Activating ISA DMA hang workarounds.
 rtc: Digital UNIX epoch (1952) detected
 Real Time Clock Driver v1.12a
 Cobalt LCD Driver v2.10
 Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing disabled
 ˙serial8250: ttyS0 at I/O 0xc800000 (irq = 21) is a ST16650V2
 loop: loaded (max 8 devices)
 Marvell 88E1101: Registered new driver
 Davicom DM9161E: Registered new driver
 Davicom DM9131: Registered new driver
 Cicada Cis8204: Registered new driver
 LXT970: Registered new driver
 LXT971: Registered new driver
 QS6612: Registered new driver
 Linux Tulip driver version 1.1.13 (May 11, 2002)
 PCI: Enabling device 0000:00:07.0 (0041 -> 0043)
 tulip0: Old format EEPROM on 'Cobalt Microserver' board.  Using substitute media control info.
 tulip0:  EEPROM default media type Autosense.
 tulip0:  Index #0 - Media MII (#11) described by a 21142 MII PHY (3) block.
 tulip0:  MII transceiver #1 config 1000 status 7809 advertising 01e1.
 eth0: Digital DS21143 Tulip rev 65 at ffffffffb0001000, 00:10:E0:00:BE:5E, IRQ 19.
 PCI: Enabling device 0000:00:0c.0 (0005 -> 0007)
 tulip1: Old format EEPROM on 'Cobalt Microserver' board.  Using substitute media control info.
 tulip1:  EEPROM default media type Autosense.
 tulip1:  Index #0 - Media MII (#11) described by a 21142 MII PHY (3) block.
 tulip1:  MII transceiver #1 config 1000 status 7809 advertising 01e1.
 eth1: Digital DS21143 Tulip rev 65 at ffffffffb0001080, 00:10:E0:00:C5:7A, IRQ 20.
 Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2
 ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx
 VP_IDE: IDE controller at PCI slot 0000:00:09.1
 VP_IDE: chipset revision 6
 VP_IDE: not 100% native mode: will probe irqs later
 VP_IDE: VIA vt82c586a (rev 27) IDE UDMA33 controller on pci0000:00:09.1
     ide0: BM-DMA at 0x1420-0x1427, BIOS settings: hda:pio, hdb:pio
     ide1: BM-DMA at 0x1428-0x142f, BIOS settings: hdc:pio, hdd:pio
 hda: QUANTUM FIREBALLlct08 04, ATA DISK drive
 ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
 hda: max request size: 128KiB
 hda: 8421840 sectors (4311 MB) w/418KiB Cache, CHS=8912/15/63
 hda: cache flushes not supported
  hda: hda1 hda2 hda3 < hda5 hda6 >
 aoe: aoe_init: AoE v2.6-14 initialised.
 mice: PS/2 mouse device common for all mice
 NET: Registered protocol family 2
 IP route cache hash table entries: 2048 (order: 2, 16384 bytes)
 TCP established hash table entries: 8192 (order: 4, 65536 bytes)
 TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
 TCP: Hash tables configured (established 8192 bind 8192)
 TCP reno registered
 TCP bic registered
 Initializing IPsec netlink socket
 NET: Registered protocol family 1
 NET: Registered protocol family 17
 NET: Registered protocol family 15
 ieee80211: 802.11 data/management/control stack, git-1.1.7
 ieee80211: Copyright (C) 2004-2005 Intel Corporation <jketreno@linux.intel.com>
 kjournald starting.  Commit interval 5 seconds
 EXT3-fs: mounted filesystem with ordered data mode.
 VFS: Mounted root (ext3 filesystem) readonly.
 Freeing unused kernel memory: 156k freed
 Failed to mount /selinux/: No such file or directory
 INIT: version 2.86 booting
CPU 0 Unable to handle kernel paging request at virtual address 0000000000000100, epc == ffffffff8008e8a8, ra == ffffffff80081d10
 Oops[#1]:
 Cpu 0
 $ 0   : 0000000000000000 ffffffff900064e1 9800000007fc98e8 ffffffff803a25d8
 $ 4   : 9800000007fcfeb0 0000000000000000 0000000000000004 9800000007fa1a80
 $ 8   : 0000000000000000 9800000007fcfe60 0000000000000000 0000000000443868
 $12   : 0000000000000000 0000000000000003 ffffffff8008f7f8 980000000786c000
 $16   : ffffffffffffffff 0000000000000000 0000000000538c88 0000000000000000
 $20   : 0000000000000000 00000000000002b5 0000000000440000 00000000005297e4
 $24   : 0000000000000000 ffffffff8008e890                                  
 $28   : 9800000007fcc000 9800000007fcfde0 0000000000522900 ffffffff80081d10
 Hi    : 0000000000000000
 Lo    : 0000000000000078
 epc   : ffffffff8008e8a8 do_signal32+0x18/0x2a0     Not tainted
 ra    : ffffffff80081d10 work_notifysig+0xc/0x14
 Status: 900064e2    KX SX UX KERNEL EXL 
 Cause : 00808008
 BadVA : 0000000000000100
 PrId  : 000028a0
 Process default.hotplug (pid: 688, threadinfo=9800000007fcc000, task=9800000007fc98e8)
 Stack : 0003000200000000 9800000007fc98e8 ffffffff800af118 0000000000100100
         0000000000200200 ffffffff80428318 0000000000000000 ffffff0000000000
         0000000000538c88 0000000000000000 ffffffff800c4400 0000000000000000
         0000000000020000 0000000000000000 0000000000000000 0000000000000000
         0000000000000000 ffffffff8008f844 0000000000538c88 0000000000538b48
         ffffffffffffffff 0000000000000000 0000000000538c88 0000000000000000
         ffffffff80081d10 ffffffff800980c8 0000000000000000 ffffffff900064e0
         0000000000000000 0000000000000000 0000000000000003 000000007fb0ce70
         0000000000000000 0000000000000000 0000000000000002 0000000000000001
         0000000000000000 0000000000000000 0000000000000000 0000000000000000
         ...
 Call Trace:
  [<ffffffff800af118>] default_wake_function+0x0/0x20
  [<ffffffff800c4400>] sys_rt_sigprocmask+0x98/0x130
  [<ffffffff8008f844>] sys32_rt_sigprocmask+0x4c/0x190
  [<ffffffff80081d10>] work_notifysig+0xc/0x14
  [<ffffffff800980c8>] handle_sys+0x128/0x144
 
 
 Code: ffbf00c0  ffb300b8  ffb200b0 <dca20100> 24030010  30420018  00a0802d  1043000b  0080882d 
 CPU 0 Unable to handle kernel paging request at virtual address 0000000000000100, epc == ffffffff8008e8a8, ra == ffffffff80081d10
 Oops[#2]:
 Cpu 0
 $ 0   : 0000000000000000 ffffffff900064e1 9800000007ed80c8 ffffffff803a25d8
 $ 4   : 9800000007fa7eb0 0000000000000000 0000000000000004 9800000007fa1d20
 $ 8   : 0000000000000000 9800000007fa7e60 0000000000000000 0000000000443868
 $12   : 0000000000000000 0000000000000003 ffffffff8008f7f8 9800000007864000
 $16   : ffffffffffffffff 0000000000000000 0000000000538c88 0000000000000000
 $20   : 0000000000000000 00000000000002b4 0000000000440000 00000000005297e4
 $24   : 0000000000000000 ffffffff8008e890                                  
 $28   : 9800000007fa4000 9800000007fa7de0 0000000000522900 ffffffff80081d10
 Hi    : 0000000000000000
 Lo    : 0000000000000078
 epc   : ffffffff8008e8a8 do_signal32+0x18/0x2a0     Not tainted
 ra    : ffffffff80081d10 work_notifysig+0xc/0x14
 Status: 900064e2    KX SX UX KERNEL EXL 
 Cause : 00808408
 BadVA : 0000000000000100
 PrId  : 000028a0
 Process default.hotplug (pid: 687, threadinfo=9800000007fa4000, task=9800000007ed80c8)
 Stack : 0003000200000000 9800000007ed80c8 ffffffff800af118 0000000000100100
         0000000000200200 0000000000000012 0000000000000000 ffffff0000000000
         0000000000538c88 0000000000000000 ffffffff800c4400 0000000000000000
         0000000000020000 0000000000000000 0000000000000000 0000000000000000
         0000000000000000 ffffffff8008f844 0000000000538c88 0000000000538b48
         ffffffffffffffff 0000000000000000 0000000000538c88 0000000000000000
         ffffffff80081d10 ffffffff800980c8 0000000000000000 ffffffff900064e0
         0000000000000000 0000000000000000 0000000000000003 000000007fd0fe70
         0000000000000000 0000000000000000 0000000000000002 0000000000000001
         0000000000000000 0000000000000000 0000000000000000 0000000000000000
         ...
 Call Trace:
  [<ffffffff800af118>] default_wake_function+0x0/0x20
  [<ffffffff800c4400>] sys_rt_sigprocmask+0x98/0x130
  [<ffffffff8008f844>] sys32_rt_sigprocmask+0x4c/0x190
  [<ffffffff80081d10>] work_notifysig+0xc/0x14
  [<ffffffff800980c8>] handle_sys+0x128/0x144
 
 
 Code: ffbf00c0  ffb300b8  ffb200b0 <dca20100> 24030010  30420018  00a0802d  1043000b  0080882d 
 CPU 0 Unable to handle kernel paging request at virtual address 0000000000000100, epc == ffffffff8008e8a8, ra == ffffffff80081d10
 Oops[#3]:
 Cpu 0
 $ 0   : 0000000000000000 ffffffff900064e0 9800000007ed98c8 ffffffff803a25d8
 $ 4   : 9800000007edfeb0 0000000000000000 0000000000000004 0000000000000000
 $ 8   : ffffffff80428770 ffffffff80430000 98000000012d1000 ffffffff80420000
 $12   : 0000000000000000 000000000000000b 0000000000000000 ffffffff80430000
 $16   : ffffffffffffffff 0000000000000004 0000000000000080 000000007fb0d190
 $20   : 0000000000000003 0000000000538468 0000000000000000 0000000000000000
 $24   : 0000000000000018 ffffffff8008e890                                  
 $28   : 9800000007edc000 9800000007edfde0 0000000000000001 ffffffff80081d10
 Hi    : 00000000000168cc
 Lo    : 0000000000007844
 epc   : ffffffff8008e8a8 do_signal32+0x18/0x2a0     Not tainted
 ra    : ffffffff80081d10 work_notifysig+0xc/0x14
 Status: 900064e2    KX SX UX KERNEL EXL 
 Cause : 00808008
 BadVA : 0000000000000100
 PrId  : 000028a0
 Process default.hotplug (pid: 683, threadinfo=9800000007edc000, task=9800000007ed98c8)
 Stack : 9800000007f387c0 000000007fb0d190 0000000000000000 0000000000000080
         9800000007fc4f20 0000000000000001 98000000007c2b40 000000000000000b
         0000000000000003 0000000000538468 0000000000000000 0000000000000000
         0000000000000001 ffffffff80104754 fffffffffffffff7 000000007fb0d190
         9800000007f387c0 000000007fb0d190 ffffffff8010535c 9800000007f383c0
         ffffffffffffffff 0000000000000004 0000000000000080 000000007fb0d190
         ffffffff80081d10 ffffffff800980c8 0000000000000000 ffffffffb00064e1
         000000000000000b 0000000000000003 0000000000000003 000000007fb0d190
         0000000000000080 0000000000000000 0000000000000000 0000000000442fa8
         0000000000000000 0000000000000001 0000000000000000 0000000000000001
         ...
 Call Trace:
  [<ffffffff80104754>] vfs_read+0x11c/0x178
  [<ffffffff8010535c>] sys_read+0x4c/0x90
  [<ffffffff80081d10>] work_notifysig+0xc/0x14
  [<ffffffff800980c8>] handle_sys+0x128/0x144
  [<ffffffff8008f7f8>] sys32_rt_sigprocmask+0x0/0x190
 
 
 Code: ffbf00c0  ffb300b8  ffb200b0 <dca20100> 24030010  30420018  00a0802d  1043000b  0080882d 
 CPU 0 Unable to handle kernel paging request at virtual address 0000000000000100, epc == ffffffff8008e8a8, ra == ffffffff80081d10
 Oops[#4]:
 Cpu 0
 $ 0   : 0000000000000000 ffffffff900064e1 980000000052f2a8 ffffffff803a25d8
 $ 4   : 9800000007c17eb0 0000000000000000 0000000000000004 98000000005142a0
 $ 8   : 0000000000000000 9800000007c17e60 0000000000000000 0000000000443868
 $12   : 0000000000000000 0000000000000003 ffffffff8008f7f8 00000000004404f8
 $16   : ffffffffffffffff 0000000000000000 0000000000537fa8 000000000000008b
 $20   : 0000000000000000 00000000000002ab 0000000000440000 00000000005297e4
 $24   : 0000000000000000 ffffffff8008e890                                  
 $28   : 9800000007c14000 9800000007c17de0 0000000000522900 ffffffff80081d10
 Hi    : 0000000000000054
 Lo    : 000000000001b3bc
 epc   : ffffffff8008e8a8 do_signal32+0x18/0x2a0     Not tainted
 ra    : ffffffff80081d10 work_notifysig+0xc/0x14
 Status: 900064e2    KX SX UX KERNEL EXL 
 Cause : 00808008
 BadVA : 0000000000000100
 PrId  : 000028a0
 Process hotplug (pid: 679, threadinfo=9800000007c14000, task=980000000052f2a8)
 Stack : 0000000000000000 ffffffff80430000 0000000000000000 ffffffff80430000
         ffffffff80430000 fffffffffffffffe 0000000000000000 ffffff0000000000
         0000000000537fa8 000000000000008b ffffffff800c4400 ffffffff80430000
         0000000000020000 0000000000000000 0000000000000000 0000000000000000
         0000000000000000 ffffffff8008f844 000000000052ae5c 0000000000522924
         ffffffffffffffff 0000000000000000 0000000000537fa8 000000000000008b
         ffffffff80081d10 ffffffff800980c8 0000000000000000 000000002ac4311c
         0000000000000000 0000000000000000 0000000000000003 000000007ff6a3e8
         0000000000000000 0000000000000000 0000000000000002 000000002aaff270
         0000000000000000 0000000000000001 0000000000000000 ffffffff80000010
         ...
 Call Trace:
  [<ffffffff800c4400>] sys_rt_sigprocmask+0x98/0x130
  [<ffffffff8008f844>] sys32_rt_sigprocmask+0x4c/0x190
  [<ffffffff80081d10>] work_notifysig+0xc/0x14
  [<ffffffff800980c8>] handle_sys+0x128/0x144
  [<ffffffff801053a0>] sys_write+0x0/0x90
  [<ffffffff800c39f8>] flush_signals+0x98/0xd0
 
 
 Code: ffbf00c0  ffb300b8  ffb200b0 <dca20100> 24030010  30420018  00a0802d  1043000b  0080882d 
 CPU 0 Unable to handle kernel paging request at virtual address 0000000000000100, epc == ffffffff8008e8a8, ra == ffffffff80081d10
 Oops[#5]:
 Cpu 0
 $ 0   : 0000000000000000 ffffffff900064e0 980000000052e6a8 ffffffff803a25d8
 $ 4   : 9800000007e3beb0 0000000000000000 0000000000000004 0000000000000000
 $ 8   : ffffffff80428770 ffffffff80430000 98000000012d1000 ffffffff80420000
 $12   : 0000000000000000 000000000000000b 0000000000000000 ffffffff80430000
 $16   : ffffffffffffffff 0000000000000004 0000000000000080 000000007fd10190
 $20   : 0000000000000003 0000000000538468 0000000000000000 0000000000000000
 $24   : 0000000000000018 ffffffff8008e890                                  
 $28   : 9800000007e38000 9800000007e3bde0 0000000000000001 ffffffff80081d10
 Hi    : 0000000000017f79
 Lo    : 0000000000007fd3
 epc   : ffffffff8008e8a8 do_signal32+0x18/0x2a0     Not tainted
 ra    : ffffffff80081d10 work_notifysig+0xc/0x14
 Status: 900064e2    KX SX UX KERNEL EXL 
 Cause : 00808008
 BadVA : 0000000000000100
 PrId  : 000028a0
 Process default.hotplug (pid: 681, threadinfo=9800000007e38000, task=980000000052e6a8)
 Stack : 9800000007f388c0 000000007fd10190 0000000000000000 0000000000000080
         9800000007d880c0 0000000000000001 9800000000554090 000000000000000b
         0000000000000003 0000000000538468 0000000000000000 0000000000000000
         0000000000000001 ffffffff80104754 fffffffffffffff7 000000007fd10190
         9800000007f388c0 000000007fd10190 ffffffff8010535c 9800000007f384c0
         ffffffffffffffff 0000000000000004 0000000000000080 000000007fd10190
         ffffffff80081d10 ffffffff800980c8 0000000000000000 ffffffffb00064e1
         000000000000000b 0000000000000003 0000000000000003 000000007fd10190
         0000000000000080 0000000000000000 0000000000000000 0000000000442fa8
         0000000000000000 0000000000000001 0000000000000000 0000000000000001
         ...
 Call Trace:
  [<ffffffff80104754>] vfs_read+0x11c/0x178
  [<ffffffff8010535c>] sys_read+0x4c/0x90
  [<ffffffff80081d10>] work_notifysig+0xc/0x14
  [<ffffffff800980c8>] handle_sys+0x128/0x144
  [<ffffffff8008f7f8>] sys32_rt_sigprocmask+0x0/0x190
 
 
 Code: ffbf00c0  ffb300b8  ffb200b0 <dca20100> 24030010  30420018  00a0802d  1043000b  0080882d 
 CPU 0 Unable to handle kernel paging request at virtual address 0000000000000100, epc == ffffffff8008e8a8, ra == ffffffff80081d10
 Oops[#6]:
 Cpu 0
 $ 0   : 0000000000000000 ffffffff900064e1 9800000001323288 ffffffff803a25d8
 $ 4   : 9800000001333eb0 0000000000000000 0000000000000004 98000000005147e0
 $ 8   : 0000000000000000 9800000001333e60 0000000000000000 0000000000443868
 $12   : 0000000000000000 0000000000000003 ffffffff8008f7f8 00000000004404f8
 $16   : ffffffffffffffff 0000000000000000 0000000000537fc8 000000000000008b
 $20   : 0000000000000000 00000000000002a9 0000000000440000 00000000005297e4
 $24   : 0000000000000000 ffffffff8008e890                                  
 $28   : 9800000001330000 9800000001333de0 0000000000522900 ffffffff80081d10
 Hi    : 0000000000000054
 Lo    : 000000000001b3bc
 epc   : ffffffff8008e8a8 do_signal32+0x18/0x2a0     Not tainted
 ra    : ffffffff80081d10 work_notifysig+0xc/0x14
 Status: 900064e2    KX SX UX KERNEL EXL 
 Cause : 00808008
 BadVA : 0000000000000100
 PrId  : 000028a0
 Process hotplug (pid: 677, threadinfo=9800000001330000, task=9800000001323288)
 Stack : 0000000000000000 ffffffff80430000 0000000000000000 ffffffff80430000
         ffffffff80430000 fffffffffffffffe 0000000000000000 ffffff0000000000
         0000000000537fc8 000000000000008b ffffffff800c4400 ffffffff80430000
         0000000000020000 0000000000000000 0000000000000000 0000000000000000
         0000000000000000 ffffffff8008f844 000000002aac0cb8 0000000000000000
         ffffffffffffffff 0000000000000000 0000000000537fc8 000000000000008b
         ffffffff80081d10 ffffffff800980c8 0000000000000000 ffffffff900064e0
         0000000000000000 0000000000000000 0000000000000003 000000007fa623e8
         0000000000000000 0000000000000000 0000000000000002 000000002aaff270
         0000000000000000 0000000000000001 0000000000000000 0000000000000000
         ...
 Call Trace:
  [<ffffffff800c4400>] sys_rt_sigprocmask+0x98/0x130
  [<ffffffff8008f844>] sys32_rt_sigprocmask+0x4c/0x190
  [<ffffffff80081d10>] work_notifysig+0xc/0x14
  [<ffffffff800980c8>] handle_sys+0x128/0x144
  [<ffffffff800c39f8>] flush_signals+0x98/0xd0
 
 
 Code: ffbf00c0  ffb300b8  ffb200b0 <dca20100> 24030010  30420018  00a0802d  1043000b  0080882d 
 CPU 0 Unable to handle kernel paging request at virtual address 0000000000000100, epc == ffffffff8008e8a8, ra == ffffffff80081d10
 Oops[#7]:
 Cpu 0
 $ 0   : 0000000000000000 ffffffff900064e1 9800000007fc8ce8 ffffffff803a25d8
 $ 4   : 980000000780feb0 0000000000000000 0000000000000004 9800000007fa1540
 $ 8   : 0000000000000000 980000000780fe60 0000000000000000 0000000000443868
 $12   : 0000000000000000 0000000000000003 ffffffff8008f7f8 9800000007830000
 $16   : ffffffffffffffff 0000000000000000 0000000000538c88 0000000000000000
 $20   : 0000000000000000 00000000000002b3 0000000000440000 00000000005297e4
 $24   : 0000000000000000 ffffffff8008e890                                  
 $28   : 980000000780c000 980000000780fde0 0000000000522900 ffffffff80081d10
 Hi    : 0000000000000000
 Lo    : 0000000000000078
 epc   : ffffffff8008e8a8 do_signal32+0x18/0x2a0     Not tainted
 ra    : ffffffff80081d10 work_notifysig+0xc/0x14
 Status: 900064e2    KX SX UX KERNEL EXL 
 Cause : 00808008
 BadVA : 0000000000000100
 PrId  : 000028a0
 Process default.hotplug (pid: 690, threadinfo=980000000780c000, task=9800000007fc8ce8)
 Stack : 0000000000000000 ffffffff80430000 0000000000000000 ffffffff80430000
         ffffffff80430000 fffffffffffffffe 0000000000000000 ffffff0000000000
         0000000000538c88 0000000000000000 ffffffff800c4400 ffffffff80430000
         0000000000020000 0000000000000000 0000000000000000 0000000000000000
         0000000000000000 ffffffff8008f844 000000000052ae5c 0000000000522924
         ffffffffffffffff 0000000000000000 0000000000538c88 0000000000000000
         ffffffff80081d10 ffffffff800980c8 0000000000000000 ffffffff900064e0
         0000000000000000 0000000000000000 0000000000000003 000000007fa3ce70
         0000000000000000 0000000000000000 0000000000000002 0000000000000001
         0000000000000000 0000000000000000 0000000000000000 0000000000000000
         ...
 Call Trace:
  [<ffffffff800c4400>] sys_rt_sigprocmask+0x98/0x130
  [<ffffffff8008f844>] sys32_rt_sigprocmask+0x4c/0x190
  [<ffffffff80081d10>] work_notifysig+0xc/0x14
  [<ffffffff800980c8>] handle_sys+0x128/0x144
 
 
 Code: ffbf00c0  ffb300b8  ffb200b0 <dca20100> 24030010  30420018  00a0802d  1043000b  0080882d 
 CPU 0 Unable to handle kernel paging request at virtual address 0000000000000100, epc == ffffffff8008e8a8, ra == ffffffff80081d10
 Oops[#8]:
 Cpu 0
 $ 0   : 0000000000000000 ffffffff900064e0 980000000052e0a8 ffffffff803a25d8
 $ 4   : 9800000007e5beb0 0000000000000000 0000000000000004 98000000011a45b0
 $ 8   : 0000000000000001 0000000000000001 0000000000000018 ffffffff80420000
 $12   : 0000000000000000 0000000000006400 0000000000000000 980000000780c000
 $16   : 000000000000000a 0000000000000004 0000000000000080 000000007fa3d190
 $20   : 0000000000000003 000000007fa3d19b 000000000053b508 0000000000000000
 $24   : 0000000000000020 ffffffff8008e890                                  
 $28   : 9800000007e58000 9800000007e5bde0 0000000000000001 ffffffff80081d10
 Hi    : 0000000000000000
 Lo    : 0000000000000018
 epc   : ffffffff8008e8a8 do_signal32+0x18/0x2a0     Not tainted
 ra    : ffffffff80081d10 work_notifysig+0xc/0x14
 Status: 900064e2    KX SX UX KERNEL EXL 
 Cause : 00808008
 BadVA : 0000000000000100
 PrId  : 000028a0
 Process default.hotplug (pid: 682, threadinfo=9800000007e58000, task=980000000052e0a8)
 Stack : 9800000007f386c0 000000007fa3d190 9800000007e5be88 0000000000000080
         0000000000000003 000000007fa3d19b 000000000053b508 0000000000000000
         0000000000000001 ffffffff80117174 000000007fa3d190 0000000000000080
         ffffffff801046f8 ffffffff801046d0 fffffffffffffff7 000000007fa3d190
         9800000007f386c0 000000007fa3d190 ffffffff8010535c 0000000000000080
         000000000000000a 0000000000000004 0000000000000080 000000007fa3d190
         ffffffff80081d10 ffffffff800980c8 0000000000000000 ffffffff900064e0
         0000000000000000 000000000000000c 0000000000000003 000000007fa3d190
         0000000000000080 0000000000000000 0000000000000000 0000000000000000
         98000000012d1000 000000000000000b 0000000000000000 000000000000000b
         ...
 Call Trace:
  [<ffffffff80117174>] pipe_read+0x1c/0x28
  [<ffffffff801046f8>] vfs_read+0xc0/0x178
  [<ffffffff801046d0>] vfs_read+0x98/0x178
  [<ffffffff8010535c>] sys_read+0x4c/0x90
  [<ffffffff80081d10>] work_notifysig+0xc/0x14
  [<ffffffff800980c8>] handle_sys+0x128/0x144
 
 
 Code: ffbf00c0  ffb300b8  ffb200b0 <dca20100> 24030010  30420018  00a0802d  1043000b  0080882d 
 CPU 0 Unable to handle kernel paging request at virtual address 0000000000000100, epc == ffffffff8008e8a8, ra == ffffffff80081d10
 Oops[#9]:
 Cpu 0
 $ 0   : 0000000000000000 ffffffff900064e1 9800000001322088 ffffffff803a25d8
 $ 4   : 980000000051feb0 0000000000000000 0000000000000004 9800000000514540
 $ 8   : 0000000000000000 980000000051fe60 0000000000000000 0000000000443868
 $12   : 0000000000000000 0000000000000003 ffffffff8008f7f8 00000000004404f8
 $16   : ffffffffffffffff 0000000000000000 0000000000537fa8 000000000000008b
 $20   : 0000000000000000 00000000000002aa 0000000000440000 00000000005297e4
 $24   : 0000000000000000 ffffffff8008e890                                  
 $28   : 980000000051c000 980000000051fde0 0000000000522900 ffffffff80081d10
 Hi    : 0000000000000054
 Lo    : 000000000001b3bc
 epc   : ffffffff8008e8a8 do_signal32+0x18/0x2a0     Not tainted
 ra    : ffffffff80081d10 work_notifysig+0xc/0x14
 Status: 900064e2    KX SX UX KERNEL EXL 
 Cause : 00808008
 BadVA : 0000000000000100
 PrId  : 000028a0
 Process hotplug (pid: 678, threadinfo=980000000051c000, task=9800000001322088)
 Stack : 0000000000000000 ffffffff80430000 0000000000000000 ffffffff80430000
         ffffffff80430000 fffffffffffffffe 0000000000000000 ffffff0000000000
         0000000000537fa8 000000000000008b ffffffff800c4400 ffffffff80430000
         0000000000020000 0000000000000000 0000000000000000 0000000000000000
         0000000000000000 ffffffff8008f844 00000000004e0000 0000000000537fa8
         ffffffffffffffff 0000000000000000 0000000000537fa8 000000000000008b
         ffffffff80081d10 ffffffff800980c8 0000000000000000 ffffffff900064e0
         0000000000000000 0000000000000000 0000000000000003 000000007f9a23e8
         0000000000000000 0000000000000000 0000000000000002 000000002aaff270
         0000000000000000 0000000000000001 0000000000000000 0000000000000000
         ...
 Call Trace:
  [<ffffffff800c4400>] sys_rt_sigprocmask+0x98/0x130
  [<ffffffff8008f844>] sys32_rt_sigprocmask+0x4c/0x190
  [<ffffffff80081d10>] work_notifysig+0xc/0x14
  [<ffffffff800980c8>] handle_sys+0x128/0x144
  [<ffffffff800c39f8>] flush_signals+0x98/0xd0
 
 
 Code: ffbf00c0  ffb300b8  ffb200b0 <dca20100> 24030010  30420018  00a0802d  1043000b  0080882d 
 CPU 0 Unable to handle kernel paging request at virtual address 0000000000000100, epc == ffffffff8008e8a8, ra == ffffffff80081d10
 Oops[#10]:
 Cpu 0
 $ 0   : 0000000000000000 ffffffff900064e0 980000000045d848 ffffffff803a25d8
 $ 4   : 9800000000463eb0 0000000000000000 0000000000000004 0000000000000000
 $ 8   : 9800000007892788 9800000000463c10 0004ce78440afdbf 0000000000000000
 $12   : 0000000000000000 9800000000463cc0 0000000000000180 ffffffff80430000
 $16   : 000000007fe058e0 000000002ad80000 000000007fe056ec 000000002ad70000
 $20   : 000000007fe058e0 0000000000000180 000000002ad06fc0 0000000000000000
 $24   : 0000000000000004 ffffffff8008e890                                  
 $28   : 9800000000460000 9800000000463de0 000000007fe054cc ffffffff80081d10
 Hi    : 0000000000016a88
 Lo    : 00000000000078d8
 epc   : ffffffff8008e8a8 do_signal32+0x18/0x2a0     Not tainted
 ra    : ffffffff80081d10 work_notifysig+0xc/0x14
 Status: 900064e2    KX SX UX KERNEL EXL 
 Cause : 00808008
 BadVA : 0000000000000100
 PrId  : 000028a0
 Process init (pid: 1, threadinfo=9800000000460000, task=980000000045d848)
 Stack : 0000000000000007 0000000000000000 0000000000000000 9800000000463e60
         980000000071e460 0000000000000001 9800000007d65db0 0000000000000180
         000000007fe058e0 0000000000000180 000000002ad06fc0 0000000000000000
         000000007fe054cc ffffffff80104754 fffffffffffffff7 000000007fe056ec
         98000000078926e0 000000002ad70000 ffffffff8010535c 0000000000000000
         000000007fe058e0 000000002ad80000 000000007fe056ec 000000002ad70000
         ffffffff80081d10 ffffffff800980c8 0000000000000000 ffffffff900064e0
         0000000000000180 0000000000000005 0000000000000000 000000007fe056ec
         0000000000000180 0000000000000000 0000000000000000 0000000000402b24
         0000000000000000 0000000000000001 0000000000000000 ffffffff80000010
         ...
 Call Trace:
  [<ffffffff80104754>] vfs_read+0x11c/0x178
  [<ffffffff8010535c>] sys_read+0x4c/0x90
  [<ffffffff80081d10>] work_notifysig+0xc/0x14
  [<ffffffff800980c8>] handle_sys+0x128/0x144
  [<ffffffff8008bbb0>] sys32_llseek+0x0/0x30
 
 
 Code: ffbf00c0  ffb300b8  ffb200b0 <dca20100> 24030010  30420018  00a0802d  1043000b  0080882d 
 Kernel panic - not syncing: Attempted to kill init!
  

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

From jcrouse@cosmic.amd.com Fri Feb 17 20:18:08 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 17 Feb 2006 20:18:19 +0000 (GMT)
Received: from amdext3.amd.com ([139.95.251.6]:40614 "EHLO amdext3.amd.com")
	by ftp.linux-mips.org with ESMTP id S8133414AbWBQUSI (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Fri, 17 Feb 2006 20:18:08 +0000
Received: from SSVLGW02.amd.com (ssvlgw02.amd.com [139.95.250.170])
	by amdext3.amd.com (8.12.11/8.12.11/AMD) with ESMTP id k1HKKiwL017551;
	Fri, 17 Feb 2006 12:24:41 -0800
Received: from 139.95.53.182 by SSVLGW02.amd.com with ESMTP (AMD SMTP
 Relay (Email Firewall v6.1.0)); Fri, 17 Feb 2006 12:03:18 -0800
X-Server-Uuid: 519AC16A-9632-469E-B354-112C592D09E8
Received: from ldcmail.amd.com ([147.5.200.40]) by SSVLEXBH1.amd.com
 with Microsoft SMTPSVC(6.0.3790.0); Fri, 17 Feb 2006 12:03:13 -0800
Received: from cosmic.amd.com (cosmic.amd.com [147.5.201.206]) by
 ldcmail.amd.com (Postfix) with ESMTP id E9E492028; Fri, 17 Feb 2006
 13:03:12 -0700 (MST)
Received: from cosmic.amd.com (localhost [127.0.0.1]) by cosmic.amd.com
 (8.13.4/8.13.4) with ESMTP id k1HK9jJ3032177; Fri, 17 Feb 2006 13:09:45
 -0700
Received: (from jcrouse@localhost) by cosmic.amd.com (
 8.13.4/8.13.4/Submit) id k1HK9ihp032176; Fri, 17 Feb 2006 13:09:44
 -0700
Date:	Fri, 17 Feb 2006 13:09:44 -0700
From:	"Jordan Crouse" <jordan.crouse@amd.com>
To:	"Freddy Spierenburg" <freddy@dusktilldawn.nl>
cc:	linux-mips@linux-mips.org
Subject: Re: replaced io_remap_page_range() with io_remap_pfn_range()
Message-ID: <20060217200944.GF30429@cosmic.amd.com>
References: <20060217145352.GD14066@dusktilldawn.nl>
 <20060217173448.GB30429@cosmic.amd.com>
 <20060217183155.GH14066@dusktilldawn.nl>
MIME-Version: 1.0
In-Reply-To: <20060217183155.GH14066@dusktilldawn.nl>
User-Agent: Mutt/1.5.11
X-OriginalArrivalTime: 17 Feb 2006 20:03:13.0814 (UTC)
 FILETIME=[2F314B60:01C633FD]
X-WSS-ID: 6FE8F4701V0320899-04-01
Content-Type: text/plain;
 charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: 7bit
Return-Path: <jcrouse@cosmic.amd.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: 10502
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: jordan.crouse@amd.com
Precedence: bulk
X-list: linux-mips
Content-Length: 600
Lines: 19

On 17/02/06 19:31 +0100, Freddy Spierenburg wrote:
 
> I now think I covered it all, or am I still missing something?
> Anyway, I did not find the problem fixed in any of these
> repositories or tarballs so hence I shall send the patch to
> Antonino Daplas later tonight or tomorrow.

Well, won't hurt, but don't be surprised if he says its fixed.  I'm
looking at the lmo tree right now, and its very definately fixed at
au1200fb.c:1280.  Either way, thanks for the patch.

Jordan

-- 
Jordan Crouse
Senior Linux Engineer
AMD - Personal Connectivity Solutions Group
<www.amd.com/embeddedprocessors>


From tbm@cyrius.com Fri Feb 17 22:45:46 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 17 Feb 2006 22:45:58 +0000 (GMT)
Received: from sorrow.cyrius.com ([65.19.161.204]:59658 "EHLO
	sorrow.cyrius.com") by ftp.linux-mips.org with ESMTP
	id S8133648AbWBQWpq (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Fri, 17 Feb 2006 22:45:46 +0000
Received: by sorrow.cyrius.com (Postfix, from userid 10)
	id 9CD3664D59; Fri, 17 Feb 2006 22:52:23 +0000 (UTC)
Received: by deprecation.cyrius.com (Postfix, from userid 1000)
	id CA25C8F77; Fri, 17 Feb 2006 22:52:16 +0000 (GMT)
Date:	Fri, 17 Feb 2006 22:52:16 +0000
From:	Martin Michlmayr <tbm@cyrius.com>
To:	linux-mips@linux-mips.org
Subject: Re: Oops with git: do_signal32 on 64-bit
Message-ID: <20060217225216.GA15781@deprecation.cyrius.com>
References: <20060217191937.GA20521@deprecation.cyrius.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20060217191937.GA20521@deprecation.cyrius.com>
User-Agent: Mutt/1.5.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: 10503
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
Content-Length: 15008
Lines: 294

* Martin Michlmayr <tbm@cyrius.com> [2006-02-17 19:19]:
> Any idea?

And the same do_signal32 problem on IP22 with current git.  I quickly
tried reverting some of the recent signal changes but that didn't help
and I've no time to investigate properly right now.  Maybe someone
else can take a look.  (Unsurprisingly, rc2 works whereas rc3 and
current git don't.)


 >> boot -f bootp()/srv/tftp/ip22 root=/dev/sda1
Setting $netaddr to 192.168.1.6 (from server )
 Obtaining /srv/tftp/ip22 from server 
Linux version 2.6.16-rc3 (tbm@deprecation) (gcc version 4.0.3 20051201 (prerelease) (Debian 4.0.2-5)) #1 Fri Feb 17 22:24:53 GMT 2006
 ARCH: SGI-IP22
 PROMLIB: ARC firmware Version 1 Revision 10
 CPU revision is: 00000460
 FPU revision is: 00000500
 MC: SGI memory controller Revision 3
 MC: Probing memory configuration:
  bank0:  64M @ 08000000
  bank1:  32M @ 0c000000
 Determined physical RAM map:
  memory: 0000000006000000 @ 0000000008000000 (usable)
 Built 1 zonelists
 Kernel command line: root=scsi(0)disk(1)rdisk(0)partition(0) root=/dev/sda1
 Primary instruction cache 16kB, physically tagged, direct mapped, linesize 16 bytes.
 Primary data cache 16kB, direct mapped, linesize 16 bytes.
 Unified secondary cache 1024kB direct mapped, linesize 128 bytes.
 Synthesized TLB refill handler (32 instructions).
 Synthesized TLB load handler fastpath (45 instructions).
 Synthesized TLB store handler fastpath (45 instructions).
 Synthesized TLB modify handler fastpath (44 instructions).
 PID hash table entries: 1024 (order: 10, 32768 bytes)
 Calibrating system timer... warning: timer counts differ, retrying... disagreement, using average... 66833 [133.0333 MHz CPU]
 Using 66.833 MHz high precision timer.
 NG1: Revision 6, 24 bitplanes, REX3 revision B, VC2 revision A, xmap9 revision A, cmap revision D, bt445 revision D
 NG1: Screensize 1024x768
 Console: colour SGI Newport 128x48
 Dentry cache hash table entries: 32768 (order: 6, 262144 bytes)
 Inode-cache hash table entries: 16384 (order: 5, 131072 bytes)
 Memory: 90336k/98304k available (2916k kernel code, 7860k reserved, 788k data, 308k init, 0k highmem)
 Security Framework v1.0.0 initialized
 Mount-cache hash table entries: 256
 Checking for 'wait' instruction...  unavailable.
 Checking for the multiply/shift bug... no.
 Checking for the daddi bug... no.
 Checking for the daddiu bug... no.
 NET: Registered protocol family 16
 EISA bus registered
 SCSI subsystem initialized
 audit: initializing netlink socket (disabled)
 audit(1140215055.132:1): initialized
 VFS: Disk quotas dquot_6.5.1
 Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
 Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
 Initializing Cryptographic API
 io scheduler noop registered (default)
 DS1286 Real Time Clock Driver v1.0
 i8042.c: Warning: Keylock active.
 serio: i8042 AUX port at 0xffffffffbfbd9843,0xffffffffbfbd9847 irq 44
 serio: i8042 KBD port at 0xffffffffbfbd9843,0xffffffffbfbd9847 irq 44
 Serial: IP22 Zilog driver (1 chips).
 ttyS0 at MMIO 0xffffffff5fbd9830 (irq = 45) is a IP22-Zilog
 Console: ttyS0 (IP22-Zilog)
 ttyS1 at MMIO 0xffffffff5fbd9838 (irq = 45) is a IP22-Zilog
 RAMDISK driver initialized: 16 RAM disks of 8192K size 1024 blocksize
 eth0: SGI Seeq8003 08:00:69:09:ad:d6
 wd33c93-0: chip=WD33c93B/13 no_sync=0xff no_dma=0 debug_flags=0x00
            setup_args=,,,,,,,,,
            Version 1.26 - 22/Feb/2003, Compiled Feb 17 2006 at 22:21:28
 scsi0 : SGI WD93
  sending SDTR 0103013200sync_xfer=20<5>  Vendor:           Model:                   Rev:     
   Type:   Direct-Access                      ANSI SCSI revision: 00
 SCSI device sda: 17942584 512-byte hdwr sectors (9187 MB)
 sda: Write Protect is off
 SCSI device sda: drive cache: write back w/ FUA
 SCSI device sda: 17942584 512-byte hdwr sectors (9187 MB)
 sda: Write Protect is off
 SCSI device sda: drive cache: write back w/ FUA
  sda: sda1 sda2 sda9 sda11
 sd 0:0:0:0: Attached scsi disk sda
 mice: PS/2 mouse device common for all mice
 md: raid0 personality registered for level 0
 md: raid1 personality registered for level 1
 md: raid5 personality registered for level 5
 md: raid4 personality registered for level 4
 raid5: measuring checksumming speed
    8regs     :   172.000 MB/sec
    8regs_prefetch:   172.000 MB/sec
    32regs    :   204.000 MB/sec
    32regs_prefetch:   204.000 MB/sec
 raid5: using function: 32regs_prefetch (204.000 MB/sec)
 md: multipath personality registered for level -4
 md: md driver 0.90.3 MAX_MD_DEVS=256, MD_SB_DISKS=27
 md: bitmap version 4.39
 NET: Registered protocol family 2
 IP route cache hash table entries: 2048 (order: 2, 16384 bytes)
 TCP established hash table entries: 8192 (order: 4, 65536 bytes)
 TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
 TCP: Hash tables configured (established 8192 bind 8192)
 TCP reno registered
 TCP bic registered
 Initializing IPsec netlink socket
 NET: Registered protocol family 1
 NET: Registered protocol family 17
 NET: Registered protocol family 15
 atkbd.c: keyboard reset failed on hpc3ps2/serio1
 md: Autodetecting RAID arrays.
 md: autorun ...
 md: ... autorun DONE.
 EXT3-fs: INFO: recovery required on readonly filesystem.
 EXT3-fs: write access will be enabled during recovery.
 atkbd.c: keyboard reset failed on hpc3ps2/serio0
 kjournald starting.  Commit interval 5 seconds
 EXT3-fs: recovery complete.
 EXT3-fs: mounted filesystem with ordered data mode.
 VFS: Mounted root (ext3 filesystem) readonly.
 Freeing unused kernel memory: 308k freed
 INIT: version 2.85 booting
CPU 0 Unable to handle kernel paging request at virtual address 0000000000000100, epc == ffffffff880149e0, ra == ffffffff88007f64
 Oops[#1]:
 Cpu 0
 $ 0   : 0000000000000000 000000001004cce1 ffffffff8d503000 ffffffff88346708
 $ 4   : ffffffff8d50beb0 0000000000000000 0000000000000004 ffffffff8d5039e0
 $ 8   : 0000000000000000 ffffffff8d50be60 0000000000000000 0000000000446324
 $12   : 0000000000000000 0000000000000003 ffffffff880158b0 ffffffff8d52c000
 $16   : 0000000000000000 ffffffffffffffff 000000001002ac28 0000000000000000
 $20   : 0000000000000000 000000000000000a 000000007fa1bf58 0000000000000000
 $24   : 0000000000000000 ffffffff880149c8                                  
 $28   : ffffffff8d508000 ffffffff8d50bde0 0000000000000000 ffffffff88007f64
 Hi    : 0000000000000000
 Lo    : 0000000000000078
 epc   : ffffffff880149e0 do_signal32+0x18/0x2a8     Not tainted
 ra    : ffffffff88007f64 work_notifysig+0xc/0x14
 Status: 1004cce2    KX SX UX KERNEL EXL 
 Cause : 00000008
 BadVA : 0000000000000100
 PrId  : 00000460
 Modules linked in:
 Process rcS (pid: 672, threadinfo=ffffffff8d508000, task=ffffffff8d503000)
 Stack : 0000000000030002 ffffffff8d503000 ffffffff880339e0 0000000000100100
         0000000000200200 0000000000000012 0000000000000000 ffffff0000000000
         000000001002ac28 0000000000000000 ffffffff88048258 0000000000000000
         0000000000020000 0000000000000000 0000000000000000 0000000000000000
         0000000000000000 ffffffff88015900 0000000000000001 000000001002ac28
         0000000000000000 ffffffffffffffff 000000001002ac28 0000000000000000
         ffffffff88007f64 ffffffff8801bb4c 0000000000000000 0000000010009cf8
         0000000000000000 0000000000000000 0000000000000003 000000007fa1bf58
         0000000000000000 0000000000000000 0000000000000000 0000000000000000
         000000001002c4c8 0000000000000000 0000000000000000 0000000000000000
         ...
 Call Trace:
  [<ffffffff880339e0>] default_wake_function+0x0/0x20
  [<ffffffff88048258>] sys_rt_sigprocmask+0x98/0x138
  [<ffffffff88015900>] sys32_rt_sigprocmask+0x50/0x198
  [<ffffffff88007f64>] work_notifysig+0xc/0x14
  [<ffffffff8801bb4c>] handle_sys+0x12c/0x148
 
 
 Code: ffbf00c0  ffb300b8  ffb200b0 <dca20100> 24030010  30420018  00a0802d  1043000b  0080882d 
 CPU 0 Unable to handle kernel paging request at virtual address 0000000000000100, epc == ffffffff880149e0, ra == ffffffff88007f64
 Oops[#2]:
 Cpu 0
 $ 0   : 0000000000000000 000000001004cce0 ffffffff8d4c4370 ffffffff88346708
 $ 4   : ffffffff8d4cbeb0 0000000000000000 0000000000000004 0000000000000001
 $ 8   : 000000001004cce1 ffffffff88350000 0000000000000001 000000000000050c
 $12   : 0000000000000000 000000000000cc00 0000000000000000 ffffffff8d508000
 $16   : 000000000000000a 0000000000000004 0000000000000080 000000007fa1c040
 $20   : 0000000000000003 000000001002c208 0000000000000003 0000000000000001
 $24   : ffffffff883f0000 ffffffff880149c8                                  
 $28   : ffffffff8d4c8000 ffffffff8d4cbde0 0000000000000001 ffffffff88007f64
 Hi    : 0000000000000000
 Lo    : 0000000000000018
 epc   : ffffffff880149e0 do_signal32+0x18/0x2a8     Not tainted
 ra    : ffffffff88007f64 work_notifysig+0xc/0x14
 Status: 1004cce2    KX SX UX KERNEL EXL 
 Cause : 00000008
 BadVA : 0000000000000100
 PrId  : 00000460
 Modules linked in:
 Process rcS (pid: 671, threadinfo=ffffffff8d4c8000, task=ffffffff8d4c4370)
 Stack : ffffffff8d4d6160 0000000000000000 000000007fa1c040 ffffffff8d4cbe88
         0000000000000080 000000001002c208 0000000000000003 0000000000000001
         0000000000000001 ffffffff8809c10c 000000007fa1c040 0000000000000080
         ffffffff8808b13c ffffffff8808b0e0 fffffffffffffff7 000000007fa1c040
         ffffffff8d4d6160 000000007fa1c040 0000000000000003 ffffffff8808be94
         000000000000000a 0000000000000004 0000000000000080 000000007fa1c040
         ffffffff88007f64 ffffffff8801bb4c 0000000000000000 000000001004cce0
         0000000000000000 000000000000000c 0000000000000003 000000007fa1c040
         0000000000000080 0000000000000000 0000000000000000 0000000000000000
         ffffffff8dc62d20 0000000000000006 0000000000000000 0000000000000006
         ...
 Call Trace:
  [<ffffffff8809c10c>] pipe_read+0x1c/0x28
  [<ffffffff8808b13c>] vfs_read+0xfc/0x1b8
  [<ffffffff8808b0e0>] vfs_read+0xa0/0x1b8
  [<ffffffff8808be94>] sys_read+0x4c/0x90
  [<ffffffff88007f64>] work_notifysig+0xc/0x14
  [<ffffffff8801bb4c>] handle_sys+0x12c/0x148
 
 
 Code: ffbf00c0  ffb300b8  ffb200b0 <dca20100> 24030010  30420018  00a0802d  1043000b  0080882d 
 /etc/CPU 0 Unable to handle kernel paging request at virtual address 0000000000000100, epc == ffffffff880149e0, ra == ffffffff88007f64
 Oops[#3]:
 Cpu 0
 $ 0   : 0000000000000000 000000001004cce1 ffffffff8d94cb40 ffffffff88346708
 $ 4   : ffffffff8daf7eb0 0000000000000000 0000000000000004 ffffffff8d94d520
 $ 8   : 0000000000000000 ffffffff8daf7e60 0000000000000000 0000000000446324
 $12   : 0000000000000000 0000000000000003 ffffffff880158b0 ffffffff88400000
 $16   : 0000000000000000 ffffffffffffffff 00000000100181a8 0000000000000000
 $20   : 000000000000008b 000000000000000a 000000007fa1c9b8 0000000000000000
 $24   : 0000000000000000 ffffffff880149c8                                  
 $28   : ffffffff8daf4000 ffffffff8daf7de0 0000000000000000 ffffffff88007f64
 Hi    : 00000000000000a2
 Lo    : 8f5c28f5c28dd500
 epc   : ffffffff880149e0 do_signal32+0x18/0x2a8     Not tainted
 ra    : ffffffff88007f64 work_notifysig+0xc/0x14
 Status: 1004cce2    KX SX UX KERNEL EXL 
 Cause : 00000008
 BadVA : 0000000000000100
 PrId  : 00000460
 Modules linked in:
 Process rcS (pid: 670, threadinfo=ffffffff8daf4000, task=ffffffff8d94cb40)
 Stack : ffffffff881ae5c8 ffffffff881ae614 0000000000000000 0000000000000001
         ffffffff8d942310 0000000000000062 0000000000000000 ffffff0000000000
         00000000100181a8 0000000000000000 ffffffff88048258 0000000000000000
         0000000000020000 0000000000000000 0000000000000000 0000000000000000
         0000000000000000 ffffffff88015900 00000000100181a8 ffffffff8808bf24
         0000000000000000 ffffffffffffffff 00000000100181a8 0000000000000000
         ffffffff88007f64 ffffffff8801bb4c 0000000000000000 0000000010009cbc
         0000000000000000 0000000000000000 0000000000000003 000000007fa1c9b8
         0000000000000000 0000000000000000 0000000000000000 0000000000000000
         ffffffffa0000000 0000000000000000 0000000000000000 0000000000000000
         ...
 Call Trace:
  [<ffffffff881ae5c8>] tty_write+0x230/0x330
  [<ffffffff881ae614>] tty_write+0x27c/0x330
  [<ffffffff88048258>] sys_rt_sigprocmask+0x98/0x138
  [<ffffffff88015900>] sys32_rt_sigprocmask+0x50/0x198
  [<ffffffff8808bf24>] sys_write+0x4c/0x90
  [<ffffffff88007f64>] work_notifysig+0xc/0x14
  [<ffffffff8801bb4c>] handle_sys+0x12c/0x148
 
 
 Code: ffbf00c0  ffb300b8  ffb200b0 <dca20100> 24030010  30420018  00a0802d  1043000b  0080882d 
 init.d/CPU 0 Unable to handle kernel paging request at virtual address 0000000000000100, epc == ffffffff880149e0, ra == ffffffff88007f64
 Oops[#4]:
 Cpu 0
 $ 0   : 0000000000000000 000000001004cce0 ffffffff8938e750 ffffffff88346708
 $ 4   : ffffffff89397eb0 0000000000000000 0000000000000004 fffffffffffffdfe
 $ 8   : 0000000500000000 000000007fdc3b98 0000000000000000 000000000000030a
 $12   : 0000000000000000 000000000000cc00 0000000000000000 ffffffff8daf4000
 $16   : 000000007fdc3c28 000000007fdc3cb8 000000007fdc3a10 000000007fdc3b90
 $20   : 0000000000000000 0000000000000001 0000000000000053 ffffffff88300000
 $24   : 0000000000000000 ffffffff880149c8                                  
 $28   : ffffffff89394000 ffffffff89397de0 ffffffff882f0000 ffffffff88007f64
 Hi    : 0000000000000000
 Lo    : 000000000007acd8
 epc   : ffffffff880149e0 do_signal32+0x18/0x2a8     Not tainted
 ra    : ffffffff88007f64 work_notifysig+0xc/0x14
 Status: 1004cce2    KX SX UX KERNEL EXL 
 Cause : 00000408
 BadVA : 0000000000000100
 PrId  : 00000460
 Modules linked in:
 Process init (pid: 1, threadinfo=ffffffff89394000, task=ffffffff8938e750)
 Stack : 0000000000000000 0000000000000000 fffffffffffffdfe ffffffff880c24b0
         ffffffff8db105f0 ffffffff8db105f8 ffffffff8db10600 ffffffff8db10608
         ffffffff8db10610 ffffffff8db10618 000000007fdc3b90 000000007fdc3cb8
         000000007fdc3a10 000000007fdc3b90 0000000000000000 0000000000000001
         0000000000000053 ffffffff88300000 ffffffff882f0000 ffffffff880c2944
         000000007fdc3c28 000000007fdc3cb8 000000007fdc3a10 000000007fdc3b90
         ffffffff88007f64 ffffffff8801bb4c 0000000000000202 00000000100000ec
         0000000000000202 000000007fdc3a10 000000000000000b 000000007fdc3cb8
         0000000000000000 0000000000000001 0000000000000000 000000007fdc3950
         00000000000044ee ffffffff88350000 0000000000000000 ffffffff88191d48
         ...
 Call Trace:
  [<ffffffff880c24b0>] compat_core_sys_select+0x250/0x258
  [<ffffffff880c2944>] compat_sys_select+0x3c/0x230
  [<ffffffff88007f64>] work_notifysig+0xc/0x14
  [<ffffffff8801bb4c>] handle_sys+0x12c/0x148
  [<ffffffff88191d48>] memset_partial+0x44/0x60
  [<ffffffff8808a6f0>] sys_open+0x0/0x18
 
 
 Code: ffbf00c0  ffb300b8  ffb200b0 <dca20100> 24030010  30420018  00a0802d  1043000b  0080882d 
 Kernel panic - not syncing: Attempted to kill init!
  rcS: line 57:   671 Segmentation fault      ( trap - INT QUIT TSTP; set start; . $i )

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

From tbm@cyrius.com Fri Feb 17 22:51:51 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 17 Feb 2006 22:52:04 +0000 (GMT)
Received: from sorrow.cyrius.com ([65.19.161.204]:62474 "EHLO
	sorrow.cyrius.com") by ftp.linux-mips.org with ESMTP
	id S8133648AbWBQWvv (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Fri, 17 Feb 2006 22:51:51 +0000
Received: by sorrow.cyrius.com (Postfix, from userid 10)
	id 0330664D59; Fri, 17 Feb 2006 22:58:31 +0000 (UTC)
Received: by deprecation.cyrius.com (Postfix, from userid 1000)
	id B86588F77; Fri, 17 Feb 2006 22:58:24 +0000 (GMT)
Date:	Fri, 17 Feb 2006 22:58:24 +0000
From:	Martin Michlmayr <tbm@cyrius.com>
To:	linux-mips@linux-mips.org
Cc:	jblache@debian.org
Subject: IP22 doesn't shutdown properly
Message-ID: <20060217225824.GE20785@deprecation.cyrius.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.5.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: 10504
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
Content-Length: 788
Lines: 25

When you try to shutdown or reboot an IP22 with 2.6.15 or 2.6.16-rc2,
you see that the TERM signal is sent but then nothing happens.  At the
beginning, the light on the Indy is green but after about 20 seconds
it turns red.  Nothing happens on the console and the machine doesn't
turn off.  Seen on Indy and Indigo2.

Anyone got a fix?


sgi:~# shutdown -r now

Broadcast message from root (ttyS0) (Fri Feb 17 22:52:47 2006):

The system is going down for reboot NOW!
INIT: Sending processes the TERM signal
INIT: Sending proces

[and nothing more]

Or, according to an Indigo2 users, "The machine hangs on shutdown -r
now after init sends the TERM signal; the LED stays green for a few
seconds, then turns orange which definitely isn't good."
-- 
Martin Michlmayr
http://www.cyrius.com/

From kumba@gentoo.org Sat Feb 18 01:12:21 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Sat, 18 Feb 2006 01:12:29 +0000 (GMT)
Received: from sccrmhc11.comcast.net ([63.240.77.81]:52400 "EHLO
	sccrmhc11.comcast.net") by ftp.linux-mips.org with ESMTP
	id S8133650AbWBRBMV (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Sat, 18 Feb 2006 01:12:21 +0000
Received: from [192.168.1.4] (unknown[69.140.185.48])
          by comcast.net (sccrmhc11) with ESMTP
          id <2006021801185701100kqnpie>; Sat, 18 Feb 2006 01:18:58 +0000
Message-ID: <43F67607.1030703@gentoo.org>
Date:	Fri, 17 Feb 2006 20:19:03 -0500
From:	Kumba <kumba@gentoo.org>
User-Agent: Thunderbird 1.5 (Windows/20051201)
MIME-Version: 1.0
To:	linux-mips@linux-mips.org
CC:	jblache@debian.org
Subject: Re: IP22 doesn't shutdown properly
References: <20060217225824.GE20785@deprecation.cyrius.com>
In-Reply-To: <20060217225824.GE20785@deprecation.cyrius.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Return-Path: <kumba@gentoo.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: 10505
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: kumba@gentoo.org
Precedence: bulk
X-list: linux-mips
Content-Length: 1108
Lines: 35

Martin Michlmayr wrote:
> When you try to shutdown or reboot an IP22 with 2.6.15 or 2.6.16-rc2,
> you see that the TERM signal is sent but then nothing happens.  At the
> beginning, the light on the Indy is green but after about 20 seconds
> it turns red.  Nothing happens on the console and the machine doesn't
> turn off.  Seen on Indy and Indigo2.
> 
> Anyone got a fix?
> 
> 
> sgi:~# shutdown -r now
> 
> Broadcast message from root (ttyS0) (Fri Feb 17 22:52:47 2006):
> 
> The system is going down for reboot NOW!
> INIT: Sending processes the TERM signal
> INIT: Sending proces
> 
> [and nothing more]
> 
> Or, according to an Indigo2 users, "The machine hangs on shutdown -r
> now after init sends the TERM signal; the LED stays green for a few
> seconds, then turns orange which definitely isn't good."

Turns red/orange and stays that color, or starts flashing?


--Kumba

-- 
Gentoo/MIPS Team Lead
Gentoo Foundation Board of Trustees

"Such is oft the course of deeds that move the wheels of the world: small hands 
do them because they must, while the eyes of the great are elsewhere."  --Elrond

From tbm@cyrius.com Sat Feb 18 01:20:40 2006
Received: with ECARTIS (v1.0.0; list linux-mips); Sat, 18 Feb 2006 01:20:49 +0000 (GMT)
Received: from sorrow.cyrius.com ([65.19.161.204]:48395 "EHLO
	sorrow.cyrius.com") by ftp.linux-mips.org with ESMTP
	id S8133650AbWBRBUk (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Sat, 18 Feb 2006 01:20:40 +0000
Received: by sorrow.cyrius.com (Postfix, from userid 10)
	id 6E71C64D59; Sat, 18 Feb 2006 01:27:21 +0000 (UTC)
Received: by deprecation.cyrius.com (Postfix, from userid 1000)
	id 506CB8F77; Sat, 18 Feb 2006 01:27:13 +0000 (GMT)
Date:	Sat, 18 Feb 2006 01:27:13 +0000
From:	Martin Michlmayr <tbm@cyrius.com>
To:	Kumba <kumba@gentoo.org>
Cc:	linux-mips@linux-mips.org, jblache@debian.org
Subject: Re: IP22 doesn't shutdown properly
Message-ID: <20060218012713.GJ20785@deprecation.cyrius.com>
References: <20060217225824.GE20785@deprecation.cyrius.com> <43F67607.1030703@gentoo.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <43F67607.1030703@gentoo.org>
User-Agent: Mutt/1.5.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: 10506
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