[PATCH 04/22] Blackfin: Split the BF532 BFIN_*_FIO_FLAG() functions to their own header

Previous thread: 2.6.36-rc2-git4 - INFO: possible circular locking dependency detected by Miles Lane on Thursday, August 26, 2010 - 6:56 pm. (2 messages)

Next thread: linux-next: build warning after merge of the drivers-x86 tree by Stephen Rothwell on Thursday, August 26, 2010 - 6:59 pm. (4 messages)
From: David Howells
Date: Thursday, August 26, 2010 - 6:59 pm

[Note that this patch alters all arches except AVR32, Cris, Microblaze, Score,
 Tile and Xtensa as I don't have usable compilers for those.  Not all the other
 arches compiled successfully, but as far as I can tell, those problems are not
 due to my patches].

A patch ("Fix IRQ flag handling naming") in the middle of the series makes the
naming of the general irq flag functions sane.  That is followed by a bunch of
patches for individual arches that aren't included yet in the main patch, but
will need rolling in before final submission.


Currently, under one configuration, linux/irqflags.h maps:

	local_irq_enable() -> raw_local_irq_enable()
	local_irq_disable() -> raw_local_irq_disable()
	local_irq_save() -> raw_local_irq_save()
	...

and under the other configuration, it maps:

	raw_local_irq_enable() -> local_irq_enable()
	raw_local_irq_disable() -> local_irq_disable()
	raw_local_irq_save() -> local_irq_save()
	...

This is quite confusing.  There should be one set of names expected of the
arch, and this should be wrapped to give another set of names that are expected
by users of this facility.

The main patch changes the asm/irqflags.h headers to provide:

	flags = arch_local_save_flags()
	flags = arch_local_irq_save()
	arch_local_irq_restore(flags)
	arch_local_irq_disable()
	arch_local_irq_enable()
	arch_irqs_disabled_flags(flags)
	arch_irqs_disabled()
	arch_safe_halt()

Then linux/irqflags.h wraps these to provide:

	raw_local_save_flags(flags)
	raw_local_irq_save(flags)
	raw_local_irq_restore(flags)
	raw_local_irq_disable()
	raw_local_irq_enable()
	raw_irqs_disabled_flags(flags)
	raw_irqs_disabled()
	raw_safe_halt()

with type checking on the flags 'arguments', and then wraps those to provide:

	local_save_flags(flags)
	local_irq_save(flags)
	local_irq_restore(flags)
	local_irq_disable()
	local_irq_enable()
	irqs_disabled_flags(flags)
	irqs_disabled()
	safe_halt()

with tracing included if enabled.

The arch functions can now all be ...
From: David Howells
Date: Thursday, August 26, 2010 - 6:59 pm

Fix a comma that got accidentally deleted from sys_osf_statfs() leading to the
following warning:

	arch/alpha/kernel/osf_sys.c: In function 'SYSC_osf_statfs':
	arch/alpha/kernel/osf_sys.c:255: error: syntax error before 'buffer'

Signed-off-by: David Howells <dhowells@redhat.com>
---

 arch/alpha/kernel/osf_sys.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
index fb58150..5d1e6d6 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
@@ -252,7 +252,7 @@ SYSCALL_DEFINE3(osf_statfs, const char __user *, pathname,
 
 	retval = user_path(pathname, &path);
 	if (!retval) {
-		retval = do_osf_statfs(&path buffer, bufsiz);
+		retval = do_osf_statfs(&path, buffer, bufsiz);
 		path_put(&path);
 	}
 	return retval;

--

From: David Howells
Date: Thursday, August 26, 2010 - 6:59 pm

Split the PLL control code from the Blackfin machine-specific cdef headers so
that the irqflags functions can be renamed without incurring a header loop.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 .../mach-bf518/include/mach/cdefBF51x_base.h       |   50 --------------
 arch/blackfin/mach-bf518/include/mach/pll.h        |   63 ++++++++++++++++++
 .../mach-bf527/include/mach/cdefBF52x_base.h       |   50 --------------
 arch/blackfin/mach-bf527/include/mach/pll.h        |   63 ++++++++++++++++++
 arch/blackfin/mach-bf533/include/mach/cdefBF532.h  |   44 -------------
 arch/blackfin/mach-bf533/include/mach/pll.h        |   57 +++++++++++++++++
 arch/blackfin/mach-bf537/include/mach/cdefBF534.h  |   44 -------------
 arch/blackfin/mach-bf537/include/mach/pll.h        |   57 +++++++++++++++++
 arch/blackfin/mach-bf538/include/mach/cdefBF538.h  |   50 --------------
 arch/blackfin/mach-bf538/include/mach/pll.h        |   63 ++++++++++++++++++
 .../mach-bf548/include/mach/cdefBF54x_base.h       |   56 ----------------
 arch/blackfin/mach-bf548/include/mach/pll.h        |   69 ++++++++++++++++++++
 arch/blackfin/mach-bf561/include/mach/cdefBF561.h  |   50 --------------
 arch/blackfin/mach-bf561/include/mach/pll.h        |   63 ++++++++++++++++++
 drivers/net/bfin_mac.c                             |    1 
 15 files changed, 436 insertions(+), 344 deletions(-)
 create mode 100644 arch/blackfin/mach-bf518/include/mach/pll.h
 create mode 100644 arch/blackfin/mach-bf527/include/mach/pll.h
 create mode 100644 arch/blackfin/mach-bf533/include/mach/pll.h
 create mode 100644 arch/blackfin/mach-bf537/include/mach/pll.h
 create mode 100644 arch/blackfin/mach-bf538/include/mach/pll.h
 create mode 100644 arch/blackfin/mach-bf548/include/mach/pll.h
 create mode 100644 arch/blackfin/mach-bf561/include/mach/pll.h

diff --git a/arch/blackfin/mach-bf518/include/mach/cdefBF51x_base.h b/arch/blackfin/mach-bf518/include/mach/cdefBF51x_base.h
index e548e9d..29498e5 100644
--- ...
From: David Howells
Date: Thursday, August 26, 2010 - 6:59 pm

Various Blackfin machine-specific headers override Blackfin serial port
symbols from the <asm/bfin_sport.h> header file with exactly the same values.

Remove the duplicates in favour of the master header.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 arch/blackfin/include/asm/bfin_sport.h             |   16 +++++
 arch/blackfin/mach-bf533/include/mach/defBF532.h   |   27 ---------
 .../mach-bf548/include/mach/defBF54x_base.h        |   59 +-------------------
 arch/blackfin/mach-bf561/include/mach/defBF561.h   |   58 --------------------
 4 files changed, 18 insertions(+), 142 deletions(-)

diff --git a/arch/blackfin/include/asm/bfin_sport.h b/arch/blackfin/include/asm/bfin_sport.h
index 9626cf7..a98533e 100644
--- a/arch/blackfin/include/asm/bfin_sport.h
+++ b/arch/blackfin/include/asm/bfin_sport.h
@@ -189,6 +189,22 @@ struct sport_register {
 #define MCMEN		0x0010	/* Multichannel Frame Mode Enable */
 #define FSDR		0x0080	/* Multichannel Frame Sync to Data Relationship */
 #define MFD		0xF000	/* Multichannel Frame Delay */
+#define MFD_0		0x0000		/* Multichannel Frame Delay = 0	  */
+#define MFD_1		0x1000		/* Multichannel Frame Delay = 1	 */
+#define MFD_2		0x2000		/* Multichannel Frame Delay = 2	 */
+#define MFD_3		0x3000		/* Multichannel Frame Delay = 3	 */
+#define MFD_4		0x4000		/* Multichannel Frame Delay = 4	 */
+#define MFD_5		0x5000		/* Multichannel Frame Delay = 5	 */
+#define MFD_6		0x6000		/* Multichannel Frame Delay = 6	 */
+#define MFD_7		0x7000		/* Multichannel Frame Delay = 7	 */
+#define MFD_8		0x8000		/* Multichannel Frame Delay = 8	 */
+#define MFD_9		0x9000		/* Multichannel Frame Delay = 9	 */
+#define MFD_10		0xA000		/* Multichannel Frame Delay = 10 */
+#define MFD_11		0xB000		/* Multichannel Frame Delay = 11 */
+#define MFD_12		0xC000		/* Multichannel Frame Delay = 12 */
+#define MFD_13		0xD000		/* Multichannel Frame Delay = 13 */
+#define MFD_14		0xE000		/* Multichannel Frame Delay = 14 */
+#define MFD_15		0xF000		/* Multichannel Frame ...
From: David Howells
Date: Thursday, August 26, 2010 - 6:59 pm

Rename the PC2() symbol in the generic DES crypto module to be prefixed with
DES_ to avoid collision with arch code (Blackfin in this case).

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---

 crypto/des_generic.c |  130 +++++++++++++++++++++++++-------------------------
 1 files changed, 65 insertions(+), 65 deletions(-)

diff --git a/crypto/des_generic.c b/crypto/des_generic.c
index 249f903..873818d 100644
--- a/crypto/des_generic.c
+++ b/crypto/des_generic.c
@@ -614,7 +614,7 @@ static const u32 S8[64] = {
 #define T3(x) pt[2 * (x) + 2]
 #define T4(x) pt[2 * (x) + 3]
 
-#define PC2(a, b, c, d) (T4(d) | T3(c) | T2(b) | T1(a))
+#define DES_PC2(a, b, c, d) (T4(d) | T3(c) | T2(b) | T1(a))
 
 /*
  * Encryption key expansion
@@ -639,22 +639,22 @@ unsigned long des_ekey(u32 *pe, const u8 *k)
 	b = k[6]; b &= 0x0e; b <<= 4; b |= k[2] & 0x1e; b = pc1[b];
 	a = k[7]; a &= 0x0e; a <<= 4; a |= k[3] & 0x1e; a = pc1[a];
 
-	pe[15 * 2 + 0] = PC2(a, b, c, d); d = rs[d];
-	pe[14 * 2 + 0] = PC2(d, a, b, c); c = rs[c]; b = rs[b];
-	pe[13 * 2 + 0] = PC2(b, c, d, a); a = rs[a]; d = rs[d];
-	pe[12 * 2 + 0] = PC2(d, a, b, c); c = rs[c]; b = rs[b];
-	pe[11 * 2 + 0] = PC2(b, c, d, a); a = rs[a]; d = rs[d];
-	pe[10 * 2 + 0] = PC2(d, a, b, c); c = rs[c]; b = rs[b];
-	pe[ 9 * 2 + 0] = PC2(b, c, d, a); a = rs[a]; d = rs[d];
-	pe[ 8 * 2 + 0] = PC2(d, a, b, c); c = rs[c];
-	pe[ 7 * 2 + 0] = PC2(c, d, a, b); b = rs[b]; a = rs[a];
-	pe[ 6 * 2 + 0] = PC2(a, b, c, d); d = rs[d]; c = rs[c];
-	pe[ 5 * 2 + 0] = PC2(c, d, a, b); b = rs[b]; a = rs[a];
-	pe[ 4 * 2 + 0] = PC2(a, b, c, d); d = rs[d]; c = rs[c];
-	pe[ 3 * 2 + 0] = PC2(c, d, a, b); b = rs[b]; a = rs[a];
-	pe[ 2 * 2 + 0] = PC2(a, b, c, d); d = rs[d]; c = rs[c];
-	pe[ 1 * 2 + 0] = PC2(c, d, a, b); b = rs[b];
-	pe[ 0 * 2 + 0] = PC2(b, c, d, a);
+	pe[15 * 2 + 0] = DES_PC2(a, b, c, d); d = rs[d];
+	pe[14 * 2 + 0] = DES_PC2(d, a, b, c); c = rs[c]; b = rs[b];
+	pe[13 * 2 + 0] = DES_PC2(b, c, ...
From: David Howells
Date: Thursday, August 26, 2010 - 6:59 pm

Split the BF532 machine type BFIN_*_FIO_FLAG() functions to their own header
file to avoid circular #include problems as these functions require IRQ flag
handling, which requires asm/blackfin.h, which otherwise requires the header
file that defines these functions.

For good measure, also get rid of the inclusion of asm/blackfin.h from
mach/cdefBF532.h (which is circular) and defBF532.h (which is included by
asm/blackfin.h before including this header).

Signed-off-by: David Howells <dhowells@redhat.com>
---

 arch/blackfin/mach-bf533/boards/blackstamp.c      |    1 
 arch/blackfin/mach-bf533/boards/ip0x.c            |    1 
 arch/blackfin/mach-bf533/boards/stamp.c           |    1 
 arch/blackfin/mach-bf533/include/mach/cdefBF532.h |   47 ------------------
 arch/blackfin/mach-bf533/include/mach/fio_flag.h  |   55 +++++++++++++++++++++
 5 files changed, 58 insertions(+), 47 deletions(-)
 create mode 100644 arch/blackfin/mach-bf533/include/mach/fio_flag.h

diff --git a/arch/blackfin/mach-bf533/boards/blackstamp.c b/arch/blackfin/mach-bf533/boards/blackstamp.c
index 842b4fa..84a06f6 100644
--- a/arch/blackfin/mach-bf533/boards/blackstamp.c
+++ b/arch/blackfin/mach-bf533/boards/blackstamp.c
@@ -25,6 +25,7 @@
 #include <asm/bfin5xx_spi.h>
 #include <asm/portmux.h>
 #include <asm/dpmc.h>
+#include <mach/fio_flag.h>
 
 /*
  * Name the Board for the /proc/cpuinfo
diff --git a/arch/blackfin/mach-bf533/boards/ip0x.c b/arch/blackfin/mach-bf533/boards/ip0x.c
index 7349970..b8474ca 100644
--- a/arch/blackfin/mach-bf533/boards/ip0x.c
+++ b/arch/blackfin/mach-bf533/boards/ip0x.c
@@ -22,6 +22,7 @@
 #include <asm/dma.h>
 #include <asm/bfin5xx_spi.h>
 #include <asm/portmux.h>
+#include <mach/fio_flag.h>
 
 /*
  * Name the Board for the /proc/cpuinfo
diff --git a/arch/blackfin/mach-bf533/boards/stamp.c b/arch/blackfin/mach-bf533/boards/stamp.c
index c457eaa..29c219e 100644
--- a/arch/blackfin/mach-bf533/boards/stamp.c
+++ b/arch/blackfin/mach-bf533/boards/stamp.c
@@ -24,6 +24,7 ...
From: David Howells
Date: Thursday, August 26, 2010 - 6:59 pm

Add a missing dependency (mach/blackfin.h) to asm/irqflags.h so that
bfin_read_IMASK() can be used by inline functions.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 arch/blackfin/include/asm/irqflags.h |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/arch/blackfin/include/asm/irqflags.h b/arch/blackfin/include/asm/irqflags.h
index 813a1af..f3ed931 100644
--- a/arch/blackfin/include/asm/irqflags.h
+++ b/arch/blackfin/include/asm/irqflags.h
@@ -8,6 +8,8 @@
 #ifndef __ASM_BFIN_IRQFLAGS_H__
 #define __ASM_BFIN_IRQFLAGS_H__
 
+#include <mach/blackfin.h>
+
 #ifdef CONFIG_SMP
 # include <asm/pda.h>
 # include <asm/processor.h>
@@ -185,7 +187,12 @@ static inline void raw_local_irq_enable(void)
 	bfin_sti(bfin_irq_flags);
 }
 
-#define raw_local_save_flags(flags) do { (flags) = bfin_read_IMASK(); } while (0)
+static inline unsigned long arch_local_save_flags(void)
+{
+	return bfin_read_IMASK();
+}
+
+#define raw_local_save_flags(flags) do { (flags) = arch_local_save_flags(); } while (0)
 
 #define raw_irqs_disabled_flags(flags) (((flags) & ~0x3f) == 0)
 

--

From: David Howells
Date: Thursday, August 26, 2010 - 6:59 pm

Rename h/w IRQ flags handling functions to be in line with what is expected for
the irq renaming patch.  This renames local_*_hw() to hard_local_*() using the
following perl command:

	perl -pi -e 's/local_irq_(restore|enable|disable)_hw/hard_local_irq_\1/ or s/local_irq_save_hw([_a-z]*)[(]flags[)]/flags = hard_local_irq_save\1()/' `find arch/blackfin/ -name "*.[ch]"`

and then fixing up asm/irqflags.h manually.

Additionally, arch/hard_local_save_flags() and arch/hard_local_irq_save() both
return the flags rather than passing it through the argument list.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 arch/blackfin/include/asm/ipipe.h                |    8 -
 arch/blackfin/include/asm/irqflags.h             |  284 +++++++++++-----------
 arch/blackfin/include/asm/mmu_context.h          |    8 -
 arch/blackfin/include/asm/system.h               |    4 
 arch/blackfin/kernel/bfin_gpio.c                 |  102 ++++----
 arch/blackfin/kernel/cplb-mpu/cplbmgr.c          |    8 -
 arch/blackfin/kernel/ipipe.c                     |   38 +--
 arch/blackfin/kernel/process.c                   |    4 
 arch/blackfin/mach-bf518/include/mach/pll.h      |    8 -
 arch/blackfin/mach-bf527/include/mach/pll.h      |    8 -
 arch/blackfin/mach-bf533/include/mach/fio_flag.h |    8 -
 arch/blackfin/mach-bf533/include/mach/pll.h      |    8 -
 arch/blackfin/mach-bf537/include/mach/pll.h      |    8 -
 arch/blackfin/mach-bf538/include/mach/pll.h      |    8 -
 arch/blackfin/mach-bf548/include/mach/pll.h      |    8 -
 arch/blackfin/mach-bf561/include/mach/pll.h      |    8 -
 arch/blackfin/mach-common/cpufreq.c              |    4 
 arch/blackfin/mach-common/ints-priority.c        |   24 +-
 arch/blackfin/mach-common/pm.c                   |   10 -
 19 files changed, 284 insertions(+), 274 deletions(-)

diff --git a/arch/blackfin/include/asm/ipipe.h b/arch/blackfin/include/asm/ipipe.h
index d3b4044..40f94a7 100644
--- a/arch/blackfin/include/asm/ipipe.h
+++ ...
From: David Howells
Date: Thursday, August 26, 2010 - 6:59 pm

Fix h8300's asm/atomic.h to store the IRQ flags in an unsigned long to deal
with warnings of the following type:

/warthog/nfs/linux-2.6-fscache/arch/h8300/include/asm/atomic.h: In function 'atomic_add_return':
/warthog/nfs/linux-2.6-fscache/arch/h8300/include/asm/atomic.h:22: warning: comparison of distinct pointer types lacks a cast
/warthog/nfs/linux-2.6-fscache/arch/h8300/include/asm/atomic.h:24: warning: comparison of distinct pointer types lacks a cast

Signed-off-by: David Howells <dhowells@redhat.com>
---

 arch/h8300/include/asm/atomic.h |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/arch/h8300/include/asm/atomic.h b/arch/h8300/include/asm/atomic.h
index e936804..984221a 100644
--- a/arch/h8300/include/asm/atomic.h
+++ b/arch/h8300/include/asm/atomic.h
@@ -18,7 +18,8 @@
 
 static __inline__ int atomic_add_return(int i, atomic_t *v)
 {
-	int ret,flags;
+	unsigned long flags;
+	int ret;
 	local_irq_save(flags);
 	ret = v->counter += i;
 	local_irq_restore(flags);
@@ -30,7 +31,8 @@ static __inline__ int atomic_add_return(int i, atomic_t *v)
 
 static __inline__ int atomic_sub_return(int i, atomic_t *v)
 {
-	int ret,flags;
+	unsigned long flags;
+	int ret;
 	local_irq_save(flags);
 	ret = v->counter -= i;
 	local_irq_restore(flags);
@@ -42,7 +44,8 @@ static __inline__ int atomic_sub_return(int i, atomic_t *v)
 
 static __inline__ int atomic_inc_return(atomic_t *v)
 {
-	int ret,flags;
+	unsigned long flags;
+	int ret;
 	local_irq_save(flags);
 	v->counter++;
 	ret = v->counter;
@@ -64,7 +67,8 @@ static __inline__ int atomic_inc_return(atomic_t *v)
 
 static __inline__ int atomic_dec_return(atomic_t *v)
 {
-	int ret,flags;
+	unsigned long flags;
+	int ret;
 	local_irq_save(flags);
 	--v->counter;
 	ret = v->counter;
@@ -76,7 +80,8 @@ static __inline__ int atomic_dec_return(atomic_t *v)
 
 static __inline__ int atomic_dec_and_test(atomic_t *v)
 {
-	int ret,flags;
+	unsigned long flags;
+	int ret;
 ...
From: David Howells
Date: Thursday, August 26, 2010 - 6:59 pm

Fix missing consts in h8300's kernel_execve():

arch/h8300/kernel/sys_h8300.c: In function 'kernel_execve':
arch/h8300/kernel/sys_h8300.c:59: warning: initialization from incompatible pointer type
arch/h8300/kernel/sys_h8300.c:60: warning: initialization from incompatible pointer type

Signed-off-by: David Howells <dhowells@redhat.com>
---

 arch/h8300/kernel/sys_h8300.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/h8300/kernel/sys_h8300.c b/arch/h8300/kernel/sys_h8300.c
index dc1ac02..aaf5e5a 100644
--- a/arch/h8300/kernel/sys_h8300.c
+++ b/arch/h8300/kernel/sys_h8300.c
@@ -56,8 +56,8 @@ int kernel_execve(const char *filename,
 		  const char *const envp[])
 {
 	register long res __asm__("er0");
-	register char *const *_c __asm__("er3") = envp;
-	register char *const *_b __asm__("er2") = argv;
+	register const char *const *_c __asm__("er3") = envp;
+	register const char *const *_b __asm__("er2") = argv;
 	register const char * _a __asm__("er1") = filename;
 	__asm__ __volatile__ ("mov.l %1,er0\n\t"
 			"trapa	#0\n\t"

--

From: David Howells
Date: Thursday, August 26, 2010 - 7:00 pm

Fix the IRQ flag handling naming.  In linux/irqflags.h under one configuration,
it maps:

	local_irq_enable() -> raw_local_irq_enable()
	local_irq_disable() -> raw_local_irq_disable()
	local_irq_save() -> raw_local_irq_save()
	...

and under the other configuration, it maps:

	raw_local_irq_enable() -> local_irq_enable()
	raw_local_irq_disable() -> local_irq_disable()
	raw_local_irq_save() -> local_irq_save()
	...

This is quite confusing.  There should be one set of names expected of the
arch, and this should be wrapped to give another set of names that are expected
by users of this facility.

Change this to have the arch provide:

	flags = arch_local_save_flags()
	flags = arch_local_irq_save()
	arch_local_irq_restore(flags)
	arch_local_irq_disable()
	arch_local_irq_enable()
	arch_irqs_disabled_flags(flags)
	arch_irqs_disabled()
	arch_safe_halt()

Then linux/irqflags.h wraps these to provide:

	raw_local_save_flags(flags)
	raw_local_irq_save(flags)
	raw_local_irq_restore(flags)
	raw_local_irq_disable()
	raw_local_irq_enable()
	raw_irqs_disabled_flags(flags)
	raw_irqs_disabled()
	raw_safe_halt()

with type checking on the flags 'arguments', and then wraps those to provide:

	local_save_flags(flags)
	local_irq_save(flags)
	local_irq_restore(flags)
	local_irq_disable()
	local_irq_enable()
	irqs_disabled_flags(flags)
	irqs_disabled()
	safe_halt()

with tracing included if enabled.

The arch functions can now all be inline functions rather than some of them
having to be macros.

[Note that this patch only alters X86, FRV, MN10300, ARM and Blackfin at the
 moment.  The other arches will need altering too as part of this patch].

Signed-off-by: David Howells <dhowells@redhat.com>
Tested-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
---

 arch/arm/include/asm/irqflags.h      |  143 ++++++++++++++++++-------------
 arch/blackfin/include/asm/irqflags.h |   12 ---
 arch/frv/include/asm/irqflags.h      |  ...
From: David Howells
Date: Thursday, August 26, 2010 - 7:00 pm

Add missing consts to the sys_execve() declaration which result in the
following error:

arch/sh/kernel/process_32.c:303: error: conflicting types for 'sys_execve'
/warthog/nfs/linux-2.6-fscache/arch/sh/include/asm/syscalls_32.h:24: error: previous declaration of 'sys_execve' was here

Signed-off-by: David Howells <dhowells@redhat.com>
---

 arch/sh/include/asm/syscalls_32.h |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/sh/include/asm/syscalls_32.h b/arch/sh/include/asm/syscalls_32.h
index be201fd..454538a 100644
--- a/arch/sh/include/asm/syscalls_32.h
+++ b/arch/sh/include/asm/syscalls_32.h
@@ -19,8 +19,10 @@ asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp,
 asmlinkage int sys_vfork(unsigned long r4, unsigned long r5,
 			 unsigned long r6, unsigned long r7,
 			 struct pt_regs __regs);
-asmlinkage int sys_execve(const char __user *ufilename, char __user * __user *uargv,
-			  char __user * __user *uenvp, unsigned long r7,
+asmlinkage int sys_execve(const char __user *ufilename,
+			  const char __user *const __user *uargv,
+			  const char __user *const __user *uenvp,
+			  unsigned long r7,
 			  struct pt_regs __regs);
 asmlinkage int sys_sigsuspend(old_sigset_t mask, unsigned long r5,
 			      unsigned long r6, unsigned long r7,

--

From: David Howells
Date: Thursday, August 26, 2010 - 7:00 pm

---

 arch/mips/include/asm/irqflags.h |   53 +++++++++++++++++++++-----------------
 1 files changed, 29 insertions(+), 24 deletions(-)

diff --git a/arch/mips/include/asm/irqflags.h b/arch/mips/include/asm/irqflags.h
index 701ec0b..9ef3b0d 100644
--- a/arch/mips/include/asm/irqflags.h
+++ b/arch/mips/include/asm/irqflags.h
@@ -17,7 +17,7 @@
 #include <asm/hazards.h>
 
 __asm__(
-	"	.macro	raw_local_irq_enable				\n"
+	"	.macro	arch_local_irq_enable				\n"
 	"	.set	push						\n"
 	"	.set	reorder						\n"
 	"	.set	noat						\n"
@@ -40,7 +40,7 @@ __asm__(
 
 extern void smtc_ipi_replay(void);
 
-static inline void raw_local_irq_enable(void)
+static inline void arch_local_irq_enable(void)
 {
 #ifdef CONFIG_MIPS_MT_SMTC
 	/*
@@ -50,7 +50,7 @@ static inline void raw_local_irq_enable(void)
 	smtc_ipi_replay();
 #endif
 	__asm__ __volatile__(
-		"raw_local_irq_enable"
+		"arch_local_irq_enable"
 		: /* no outputs */
 		: /* no inputs */
 		: "memory");
@@ -76,7 +76,7 @@ static inline void raw_local_irq_enable(void)
  * Workaround: mask EXL bit of the result or place a nop before mfc0.
  */
 __asm__(
-	"	.macro	raw_local_irq_disable\n"
+	"	.macro	arch_local_irq_disable\n"
 	"	.set	push						\n"
 	"	.set	noat						\n"
 #ifdef CONFIG_MIPS_MT_SMTC
@@ -97,17 +97,17 @@ __asm__(
 	"	.set	pop						\n"
 	"	.endm							\n");
 
-static inline void raw_local_irq_disable(void)
+static inline void arch_local_irq_disable(void)
 {
 	__asm__ __volatile__(
-		"raw_local_irq_disable"
+		"arch_local_irq_disable"
 		: /* no outputs */
 		: /* no inputs */
 		: "memory");
 }
 
 __asm__(
-	"	.macro	raw_local_save_flags flags			\n"
+	"	.macro	arch_local_save_flags flags			\n"
 	"	.set	push						\n"
 	"	.set	reorder						\n"
 #ifdef CONFIG_MIPS_MT_SMTC
@@ -118,13 +118,15 @@ __asm__(
 	"	.set	pop						\n"
 	"	.endm							\n");
 
-#define raw_local_save_flags(x)						\
-__asm__ __volatile__(							\
-	"raw_local_save_flags %0"					\
-	: "=r" (x))
+static inline ...
From: David Howells
Date: Thursday, August 26, 2010 - 7:00 pm

---

 arch/h8300/include/asm/irqflags.h |   43 +++++++++++++++++++++++++++++++++++++
 arch/h8300/include/asm/system.h   |   24 +--------------------
 2 files changed, 44 insertions(+), 23 deletions(-)
 create mode 100644 arch/h8300/include/asm/irqflags.h

diff --git a/arch/h8300/include/asm/irqflags.h b/arch/h8300/include/asm/irqflags.h
new file mode 100644
index 0000000..9617cd5
--- /dev/null
+++ b/arch/h8300/include/asm/irqflags.h
@@ -0,0 +1,43 @@
+#ifndef _H8300_IRQFLAGS_H
+#define _H8300_IRQFLAGS_H
+
+static inline unsigned long arch_local_save_flags(void)
+{
+	unsigned long flags;
+	asm volatile ("stc ccr,%w0" : "=r" (flags));
+	return flags;
+}
+
+static inline void arch_local_irq_disable(void)
+{
+	asm volatile ("orc  #0x80,ccr" : : : "memory");
+}
+
+static inline void arch_local_irq_enable(void)
+{
+	asm volatile ("andc #0x7f,ccr" : : : "memory");
+}
+
+static inline unsigned long arch_local_irq_save(void)
+{
+	unsigned long flags = arch_local_save_flags();
+	arch_local_irq_disable();
+	return flags;
+}
+
+static inline void arch_local_irq_restore(unsigned long flags)
+{
+	asm volatile ("ldc %w0,ccr" : : "r" (flags) : "memory");
+}
+
+static inline bool arch_irqs_disabled_flags(unsigned long flags)
+{
+	return (flags & 0x80) == 0x80;
+}
+
+static inline bool arch_irqs_disabled(void)
+{
+	return arch_irqs_disabled_flags(arch_local_save_flags());
+}
+
+#endif /* _H8300_IRQFLAGS_H */
diff --git a/arch/h8300/include/asm/system.h b/arch/h8300/include/asm/system.h
index 16bf156..2c2382e 100644
--- a/arch/h8300/include/asm/system.h
+++ b/arch/h8300/include/asm/system.h
@@ -2,6 +2,7 @@
 #define _H8300_SYSTEM_H
 
 #include <linux/linkage.h>
+#include <linux/irqflags.h>
 
 struct pt_regs;
 
@@ -51,31 +52,8 @@ asmlinkage void resume(void);
   (last) = _last; 					    \
 }
 
-#define __sti() asm volatile ("andc #0x7f,ccr")
-#define __cli() asm volatile ("orc  #0x80,ccr")
-
-#define __save_flags(x) \
-       asm volatile ("stc ...
From: David Howells
Date: Thursday, August 26, 2010 - 7:00 pm

---

 arch/ia64/include/asm/irqflags.h |   94 ++++++++++++++++++++++++++++++++++++++
 arch/ia64/include/asm/system.h   |   76 -------------------------------
 2 files changed, 94 insertions(+), 76 deletions(-)
 create mode 100644 arch/ia64/include/asm/irqflags.h

diff --git a/arch/ia64/include/asm/irqflags.h b/arch/ia64/include/asm/irqflags.h
new file mode 100644
index 0000000..f82d6be
--- /dev/null
+++ b/arch/ia64/include/asm/irqflags.h
@@ -0,0 +1,94 @@
+/*
+ * IRQ flags defines.
+ *
+ * Copyright (C) 1998-2003 Hewlett-Packard Co
+ *	David Mosberger-Tang <davidm@hpl.hp.com>
+ * Copyright (C) 1999 Asit Mallick <asit.k.mallick@intel.com>
+ * Copyright (C) 1999 Don Dugger <don.dugger@intel.com>
+ */
+
+#ifndef _ASM_IA64_IRQFLAGS_H
+#define _ASM_IA64_IRQFLAGS_H
+
+#ifdef CONFIG_IA64_DEBUG_IRQ
+extern unsigned long last_cli_ip;
+static inline void arch_maybe_save_ip(unsigned long flags)
+{
+	if (flags & IA64_PSR_I)
+		last_cli_ip = ia64_getreg(_IA64_REG_IP);
+}
+#else
+#define arch_maybe_save_ip(flags) do {} while (0)
+#endif
+
+/*
+ * - clearing psr.i is implicitly serialized (visible by next insn)
+ * - setting psr.i requires data serialization
+ * - we need a stop-bit before reading PSR because we sometimes
+ *   write a floating-point register right before reading the PSR
+ *   and that writes to PSR.mfl
+ */
+
+static inline unsigned long arch_local_save_flags(void)
+{
+	ia64_stop();
+#ifdef CONFIG_PARAVIRT
+	return ia64_get_psr_i();
+#else
+	return ia64_getreg(_IA64_REG_PSR);
+#endif
+}
+
+static inline unsigned long arch_local_irq_save(void)
+{
+	unsigned long flags = arch_local_save_flags();
+
+	ia64_stop();
+	ia64_rsm(IA64_PSR_I);
+	arch_maybe_save_ip(flags);
+	return flags;
+}
+
+static inline void arch_local_irq_disable(void)
+{
+#ifdef CONFIG_IA64_DEBUG_IRQ
+	arch_local_irq_save();
+#else
+	ia64_stop();
+	ia64_rsm(IA64_PSR_I);
+#endif
+}
+
+static inline void ...
From: David Howells
Date: Thursday, August 26, 2010 - 7:00 pm

---

 arch/m32r/include/asm/irqflags.h |  105 ++++++++++++++++++++++++++++++++++++++
 arch/m32r/include/asm/system.h   |   66 ------------------------
 2 files changed, 106 insertions(+), 65 deletions(-)
 create mode 100644 arch/m32r/include/asm/irqflags.h

diff --git a/arch/m32r/include/asm/irqflags.h b/arch/m32r/include/asm/irqflags.h
new file mode 100644
index 0000000..e465339
--- /dev/null
+++ b/arch/m32r/include/asm/irqflags.h
@@ -0,0 +1,105 @@
+/*
+ * 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) 2001  Hiroyuki Kondo, Hirokazu Takata, and Hitoshi Yamamoto
+ * Copyright (C) 2004, 2006  Hirokazu Takata <takata at linux-m32r.org>
+ */
+
+#ifndef _ASM_M32R_IRQFLAGS_H
+#define _ASM_M32R_IRQFLAGS_H
+
+#include <linux/types.h>
+
+static inline unsigned long arch_local_save_flags(void)
+{
+	unsigned long flags;
+	asm volatile("mvfc %0,psw" : "=r"(flags));
+	return flags;
+}
+
+static inline void arch_local_irq_disable(void)
+{
+#if !defined(CONFIG_CHIP_M32102) && !defined(CONFIG_CHIP_M32104)
+	asm volatile (
+		"clrpsw #0x40 -> nop"
+		: : :"memory");
+#else
+	unsigned long tmpreg0, tmpreg1;
+	asm volatile (
+		"ld24	%0, #0	; Use 32-bit insn.			\n\t"
+		"mvfc	%1, psw	; No interrupt can be accepted here.	\n\t"
+		"mvtc	%0, psw						\n\t"
+		"and3	%0, %1, #0xffbf					\n\t"
+		"mvtc	%0, psw						\n\t"
+		: "=&r" (tmpreg0), "=&r" (tmpreg1)
+		:
+		: "cbit", "memory");
+#endif
+}
+
+static inline void arch_local_irq_enable(void)
+{
+#if !defined(CONFIG_CHIP_M32102) && !defined(CONFIG_CHIP_M32104)
+	asm volatile (
+		"setpsw #0x40 -> nop"
+		: : :"memory");
+#else
+	unsigned long tmpreg;
+	asm volatile (
+		"mvfc	%0, psw;		\n\t"
+		"or3	%0, %0, #0x0040;	\n\t"
+		"mvtc	%0, psw;		\n\t"
+		: "=&r" (tmpreg)
+		:
+		: "cbit", "memory");
+#endif
+}
+
+static inline unsigned long ...
From: David Howells
Date: Thursday, August 26, 2010 - 7:00 pm

---

 arch/m68k/include/asm/irqflags.h    |    5 ++
 arch/m68k/include/asm/irqflags_mm.h |   57 +++++++++++++++++++++++
 arch/m68k/include/asm/irqflags_no.h |   86 +++++++++++++++++++++++++++++++++++
 arch/m68k/include/asm/system_mm.h   |   25 ----------
 arch/m68k/include/asm/system_no.h   |   49 --------------------
 5 files changed, 150 insertions(+), 72 deletions(-)
 create mode 100644 arch/m68k/include/asm/irqflags.h
 create mode 100644 arch/m68k/include/asm/irqflags_mm.h
 create mode 100644 arch/m68k/include/asm/irqflags_no.h

diff --git a/arch/m68k/include/asm/irqflags.h b/arch/m68k/include/asm/irqflags.h
new file mode 100644
index 0000000..868c405
--- /dev/null
+++ b/arch/m68k/include/asm/irqflags.h
@@ -0,0 +1,5 @@
+#ifdef __uClinux__
+#include "irqflags_no.h"
+#else
+#include "irqflags_mm.h"
+#endif
diff --git a/arch/m68k/include/asm/irqflags_mm.h b/arch/m68k/include/asm/irqflags_mm.h
new file mode 100644
index 0000000..d00716d
--- /dev/null
+++ b/arch/m68k/include/asm/irqflags_mm.h
@@ -0,0 +1,57 @@
+#ifndef _M68K_IRQFLAGS_MM_H
+#define _M68K_IRQFLAGS_MM_H
+
+#include <linux/types.h>
+#include <linux/hardirq.h>
+#include <asm/thread_info.h>
+#include <asm/entry_mm.h>
+
+static inline unsigned long arch_local_save_flags(void)
+{
+	unsigned long flags;
+	asm volatile ("movew %%sr,%0": "=d" (flags) : : "memory");
+	return flags;
+}
+
+static inline void arch_local_irq_disable(void)
+{
+	asm volatile ("oriw  #0x0700,%%sr" : : : "memory");
+}
+
+#if 0
+static inline void arch_local_irq_enable(void)
+{
+		asm volatile ("andiw %0,%%sr" : : "i" (ALLOWINT) : "memory");
+}
+#else
+#define arch_local_irq_enable()						\
+	do {								\
+		if (MACH_IS_Q40 || !hardirq_count())			\
+			asm volatile ("andiw %0,%%sr"			\
+				      : : "i" (ALLOWINT) : "memory");	\
+	} while (0)
+#endif
+
+static inline unsigned long arch_local_irq_save(void)
+{
+	unsigned long flags = arch_local_save_flags();
+	arch_local_irq_disable();
+	return ...
From: Greg Ungerer
Date: Monday, August 30, 2010 - 12:12 am

Hi David,


I have no problem with the changes as such. But I would rather
not have separate mm and no headers if we can avoid it.

Regards


-- 
------------------------------------------------------------------------
Greg Ungerer  --  Principal Engineer        EMAIL:     gerg@snapgear.com
SnapGear Group, McAfee                      PHONE:       +61 7 3435 2888
8 Gardner Close                             FAX:         +61 7 3217 5323
Milton, QLD, 4064, Australia                WEB: http://www.SnapGear.com
--

From: David Howells
Date: Monday, August 30, 2010 - 1:50 pm

Well, I can roll the headers into one, but then it'll be much more #ifdef'd if
you're okay with that.  The IRQ handling seems sufficiently different to
warrant that.

David
--

From: Geert Uytterhoeven
Date: Tuesday, August 31, 2010 - 12:36 am

Indeed, m68k doesn't use generic hardirqs yet, m68knommu does.

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: David Howells
Date: Tuesday, August 31, 2010 - 9:00 am

That's orthogonal to this patch series, however.  I'm dealing with IRQ flags
management, not hardirq support.

Out of interest, will the m68knommu arch be integrated into the m68k arch at
some point?  It's certainly possible to have an arch that is bimodal in this
aspect (FRV has CONFIG_MMU as a config option).

David
--

From: Greg Ungerer
Date: Tuesday, August 31, 2010 - 11:38 pm

At some point it will happen. Steven King sent a script to
largely automate for a first pass about a year ago.

Regards
Greg



--

From: Greg Ungerer
Date: Tuesday, August 31, 2010 - 11:33 pm

Here is a spin of the same patch, only with a single irqflags.h.
It is closely modeled on the mm version, merging (and cleaning)
the non-mmu bits as needed. There is a fair bit of common code
in here.

It does refactor arch_local_irq_save() but I am pretty sure that
makes no impact (performance or code size). I have left
arch_irq_enable as-is for all, it is not clear to me why it is
the way it is for the mm case (Geert?)

This is not run or compile tested...

Regards
Greg



  arch/m68k/include/asm/irqflags.h  |   88 
+++++++++++++++++++++++++++++++++++++
  arch/m68k/include/asm/system_mm.h |   25 +----------
  arch/m68k/include/asm/system_no.h |   49 +--------------------
  3 files changed, 90 insertions(+), 72 deletions(-)
  create mode 100644 arch/m68k/include/asm/irqflags.h

diff --git a/arch/m68k/include/asm/irqflags.h 
b/arch/m68k/include/asm/irqflags.h
new file mode 100644
index 0000000..b61edcc
--- /dev/null
+++ b/arch/m68k/include/asm/irqflags.h
@@ -0,0 +1,88 @@
+#ifndef _M68K_IRQFLAGS_MM_H
+#define _M68K_IRQFLAGS_MM_H
+
+#include <linux/types.h>
+#include <linux/hardirq.h>
+#include <asm/thread_info.h>
+#include <asm/entry.h>
+
+static inline unsigned long arch_local_save_flags(void)
+{
+	unsigned long flags;
+	asm volatile ("movew %%sr,%0": "=d" (flags) : : "memory");
+	return flags;
+}
+
+static inline void arch_local_irq_disable(void)
+{
+#ifdef CONFIG_COLDFIRE
+	asm volatile (
+		"move	%/sr,%%d0	\n\t"
+		"ori.l	#0x0700,%%d0	\n\t"
+		"move	%%d0,%/sr	\n"
+		: /* no outputs */
+		:
+		: "cc", "%d0", "memory");
+#else
+	asm volatile ("oriw  #0x0700,%%sr" : : : "memory");
+#endif
+}
+
+#ifdef CONFIG_MMU
+#if 0
+static inline void arch_local_irq_enable(void)
+{
+		asm volatile ("andiw %0,%%sr" : : "i" (ALLOWINT) : "memory");
+}
+#else
+#define arch_local_irq_enable()						\
+	do {								\
+		if (MACH_IS_Q40 || !hardirq_count())			\
+			asm volatile ("andiw %0,%%sr"			\
+				      : : "i" (ALLOWINT) : "memory");	\
+	} while ...
From: David Howells
Date: Wednesday, September 1, 2010 - 3:43 am

Thanks!

I can compile test, but I can't run test (no h/w).

David
--

From: Greg Ungerer
Date: Wednesday, September 1, 2010 - 4:21 am

I can compile and run test on a ColdFire platfom tomorrow,
so that will at least check the non-mmu m68k side of the
changes.

Regards
Greg


--

From: David Howells
Date: Wednesday, September 1, 2010 - 3:46 am

Your patch got partially word-wrapped.

David
--

From: Greg Ungerer
Date: Wednesday, September 1, 2010 - 4:22 am

Bugger :-(  Sorry about that. After I test it tomorrow I'll
resend an updated version.

Regards
Greg
--

From: David Howells
Date: Wednesday, September 1, 2010 - 4:31 am

Don't worry about it.  I just substituted the bits of my patch that removed
from system.h.

David
--

From: David Howells
Date: Wednesday, September 1, 2010 - 4:30 am

Here's my take on your patch.  By removing a couple of apparently unnecessary
refs to asm/system.h I can turn the #define of arch_local_irq_enable() into an
inline function.

Should I take it that Coldfire chips lack the AND/OR directly to SR
instructions?

David
---
 arch/m68k/include/asm/irqflags.h  |   76 ++++++++++++++++++++++++++++++++++++++
 arch/m68k/include/asm/system_mm.h |   25 ------------
 arch/m68k/include/asm/system_no.h |   49 ------------------------
 include/linux/hardirq.h           |    1 
 include/linux/list.h              |    1 
 5 files changed, 78 insertions(+), 74 deletions(-)

diff --git a/arch/m68k/include/asm/irqflags.h b/arch/m68k/include/asm/irqflags.h
new file mode 100644
index 0000000..b186de8
--- /dev/null
+++ b/arch/m68k/include/asm/irqflags.h
@@ -0,0 +1,76 @@
+#ifndef _M68K_IRQFLAGS_MM_H
+#define _M68K_IRQFLAGS_MM_H
+
+#include <linux/types.h>
+#include <linux/hardirq.h>
+#include <linux/preempt.h>
+#include <asm/thread_info.h>
+#include <asm/entry.h>
+
+static inline unsigned long arch_local_save_flags(void)
+{
+	unsigned long flags;
+	asm volatile ("movew %%sr,%0": "=d" (flags) : : "memory");
+	return flags;
+}
+
+static inline void arch_local_irq_disable(void)
+{
+#ifdef CONFIG_COLDFIRE
+	asm volatile (
+		"move	%/sr,%%d0	\n\t"
+		"ori.l	#0x0700,%%d0	\n\t"
+		"move	%%d0,%/sr	\n"
+		: /* no outputs */
+		:
+		: "cc", "%d0", "memory");
+#else
+	asm volatile ("oriw  #0x0700,%%sr" : : : "memory");
+#endif
+}
+
+static inline void arch_local_irq_enable(void)
+{
+#if defined(CONFIG_COLDFIRE)
+	asm volatile (
+		"move	%/sr,%%d0	\n\t"
+		"andi.l	#0xf8ff,%%d0	\n\t"
+		"move	%%d0,%/sr	\n"
+		: /* no outputs */
+		:
+		: "cc", "%d0", "memory");
+#else
+# if defined(CONFIG_MMU)
+	if (MACH_IS_Q40 || !hardirq_count())
+# endif
+		asm volatile (
+			"andiw %0,%%sr"
+			:
+			: "i" (ALLOWINT)
+			: "memory")
+#endif
+}
+
+static inline unsigned long arch_local_irq_save(void)
+{
+	unsigned long flags = ...
From: Greg Ungerer
Date: Wednesday, September 1, 2010 - 4:36 am

Yes, thats right.

The patch looks good to me.
I'll test it and respond with an ack.

Regards

--

From: David Howells
Date: Wednesday, September 1, 2010 - 5:03 am

Excellent, thanks!

David
--

From: Greg Ungerer
Date: Wednesday, September 1, 2010 - 6:46 pm

Hi David,



Including this here caused problems by pulling in system.h (or in
this case system_no.h) and that needs some of the later definitions
for local_irq_save() etc. I just removed this one include, and

Also need to remove irqs_disabled_flags() inline function from

Those couple of changes got it compiling. I had to make one more
change to get it to run:

diff --git a/arch/m68k/include/asm/entry_no.h 
b/arch/m68k/include/asm/entry_no.h
index 907ed03..80e4149 100644
--- a/arch/m68k/include/asm/entry_no.h
+++ b/arch/m68k/include/asm/entry_no.h
@@ -28,7 +28,7 @@
   *                     M68K              COLDFIRE
   */

-#define ALLOWINT 0xf8ff
+#define ALLOWINT (~0x700)

  #ifdef __ASSEMBLY__


The consistent use of longs for holding the flags means we need to
get this mask 32bit clean for the non-mmu case now.

After this it runs with no problems so far on my ColdFire boards.

If you want to respin your patch one more time I can do a final
test on it.

Regards
Greg


-- 
------------------------------------------------------------------------
Greg Ungerer  --  Principal Engineer        EMAIL:     gerg@snapgear.com
SnapGear Group, McAfee                      PHONE:       +61 7 3435 2888
8 Gardner Close                             FAX:         +61 7 3217 5323
Milton, QLD, 4064, Australia                WEB: http://www.SnapGear.com
--

From: David Howells
Date: Thursday, September 2, 2010 - 3:20 am

Aha!  I can now (mostly) compile the m68knommu defconfig target.  The only
errors I now see are:

arch/m68knommu/platform/coldfire/head.S: Assembler messages:
arch/m68knommu/platform/coldfire/head.S:177: Error: operands mismatch -- statement `movec %d0,%ACR0' ignored
arch/m68knommu/platform/coldfire/head.S:177: Error: operands mismatch -- statement `movec %d0,%ACR1'

I think my compiler may be too old.

My respun patches will follow shortly.

David
--

From: David Howells
Date: Thursday, September 2, 2010 - 3:21 am

Drop inclusions of asm/include.h from linux/hardirq.h and linux/list.h as
they're no longer required and prevent the M68K arch's IRQ flag handling macros
from being made into inlined functions due to circular dependencies.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 include/linux/hardirq.h |    1 -
 include/linux/list.h    |    1 -
 2 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index d5b3876..7dfdc06 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -8,7 +8,6 @@
 #include <linux/lockdep.h>
 #include <linux/ftrace_irq.h>
 #include <asm/hardirq.h>
-#include <asm/system.h>
 
 /*
  * We put the hardirq and softirq counter into the preemption
diff --git a/include/linux/list.h b/include/linux/list.h
index d167b5d..88a0006 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -5,7 +5,6 @@
 #include <linux/stddef.h>
 #include <linux/poison.h>
 #include <linux/prefetch.h>
-#include <asm/system.h>
 
 /*
  * Simple doubly linked list implementation.

--

From: Greg Ungerer
Date: Thursday, September 2, 2010 - 6:29 pm

-- 
------------------------------------------------------------------------
Greg Ungerer  --  Principal Engineer        EMAIL:     gerg@snapgear.com
SnapGear Group, McAfee                      PHONE:       +61 7 3435 2888
8 Gardner Close                             FAX:         +61 7 3217 5323
Milton, QLD, 4064, Australia                WEB: http://www.SnapGear.com
--

From: David Howells
Date: Thursday, September 2, 2010 - 3:21 am

Use CONFIG_MMU not __uClinux__ to select m68knommu contributions as nothing in
the arch defines __uClinux__ for the build.

This patch was achieved by running the following three commands:

perl -pi -e 's/ifdef __uClinux__/ifndef CONFIG_MMU/' `find arch/m68k -name "*.[ch]"`
perl -pi -e 's/ifndef __uClinux__/ifdef CONFIG_MMU/' `find arch/m68k -name "*.[ch]"`
perl -pi -e 's!endif /[*] __uClinux__ [*]/!endif /* CONFIG_MMU */!' `find arch/m68k -name "*.[ch]"

Signed-off-by: David Howells <dhowells@redhat.com>
---

 arch/m68k/include/asm/atomic.h      |    2 +-
 arch/m68k/include/asm/bitops.h      |    2 +-
 arch/m68k/include/asm/cacheflush.h  |    2 +-
 arch/m68k/include/asm/delay.h       |    2 +-
 arch/m68k/include/asm/entry.h       |    2 +-
 arch/m68k/include/asm/hardirq.h     |    2 +-
 arch/m68k/include/asm/io.h          |    2 +-
 arch/m68k/include/asm/machdep.h     |    2 +-
 arch/m68k/include/asm/page.h        |    2 +-
 arch/m68k/include/asm/param.h       |    2 +-
 arch/m68k/include/asm/pgtable.h     |    2 +-
 arch/m68k/include/asm/sigcontext.h  |    4 ++--
 arch/m68k/include/asm/signal.h      |    4 ++--
 arch/m68k/include/asm/string.h      |    2 +-
 arch/m68k/include/asm/system.h      |    2 +-
 arch/m68k/include/asm/thread_info.h |    2 +-
 arch/m68k/include/asm/traps.h       |    2 +-
 arch/m68k/include/asm/uaccess.h     |    2 +-
 18 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/arch/m68k/include/asm/atomic.h b/arch/m68k/include/asm/atomic.h
index eab36dc..eec8b50 100644
--- a/arch/m68k/include/asm/atomic.h
+++ b/arch/m68k/include/asm/atomic.h
@@ -1,4 +1,4 @@
-#ifdef __uClinux__
+#ifndef CONFIG_MMU
 #include "atomic_no.h"
 #else
 #include "atomic_mm.h"
diff --git a/arch/m68k/include/asm/bitops.h b/arch/m68k/include/asm/bitops.h
index ce163ab..0fba82a 100644
--- a/arch/m68k/include/asm/bitops.h
+++ b/arch/m68k/include/asm/bitops.h
@@ -1,4 +1,4 @@
-#ifdef __uClinux__
+#ifndef CONFIG_MMU
 #include "bitops_no.h"
 #else
 #include ...
From: Sam Ravnborg
Date: Thursday, September 2, 2010 - 6:54 am

Have you verified that this does not leak out
to the userspace headers?
We cannot use the CONFIG_ symbol to distingush between
the two variants in userspace.

This was exactly the reason why __uClinux__ was used
in the first place. But I hope Geert/Greg has fixed
it up so all exported headers are the same so that
this patch is OK.

At first look I think it is OK - but your changelog
does not address this so wanted you to confirm this.

	Sam
--

From: Andreas Schwab
Date: Thursday, September 2, 2010 - 7:15 am

asm/param.h and asm/sigcontext.h are user-space headers, so this is not
ok.

Andreas.

-- 
Andreas Schwab, schwab@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."
--

From: Greg Ungerer
Date: Thursday, September 2, 2010 - 8:29 pm

Well, I don't quite have them all fixed yet. I have been working
through them, merging the separate files, and getting rid of the
use of __uClinux__ where ever I can. Most of the cases in David's
patch are the files I still have out-standing to merge back
together. The exceptions are param.h and sigcontext.h - and
they are a bit more tricky. They are user exported, and they

I don't have any problem with David's patch if we take out param.h
and sigcontext.h. But over time most will go away as I merge them
anyway.

Regards
Greg


------------------------------------------------------------------------
Greg Ungerer  --  Principal Engineer        EMAIL:     gerg@snapgear.com
SnapGear Group, McAfee                      PHONE:       +61 7 3435 2888
8 Gardner Close                             FAX:         +61 7 3217 5323
Milton, QLD, 4064, Australia                WEB: http://www.SnapGear.com
--

From: Andreas Schwab
Date: Thursday, September 2, 2010 - 7:21 am

You are using the wrong compiler.

Andreas.

-- 
Andreas Schwab, schwab@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."
--

From: Geert Uytterhoeven
Date: Thursday, September 2, 2010 - 12:53 pm

it would be nice if you could use the same compiler for m68k and m68knommu, at
least for compiling kernels.

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: Greg Ungerer
Date: Thursday, September 2, 2010 - 8:30 pm

It would be very nice :-)

Regards
Greg


------------------------------------------------------------------------
Greg Ungerer  --  Principal Engineer        EMAIL:     gerg@snapgear.com
SnapGear Group, McAfee                      PHONE:       +61 7 3435 2888
8 Gardner Close                             FAX:         +61 7 3217 5323
Milton, QLD, 4064, Australia                WEB: http://www.SnapGear.com
--

From: Andreas Schwab
Date: Friday, September 3, 2010 - 1:41 am

You are almost able to use the uclinux compiler for both, except that
currently __uClinux__ is hardcoded.

Andreas.

-- 
Andreas Schwab, schwab@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."
--

From: David Howells
Date: Friday, September 3, 2010 - 2:18 am

The m68knommu arch Makefile in the kernel could specify it on the compiler
command line, then m68k compilers should be possible.

The kernel should probably also set appropriate -mcpu= and -mtune= flags,
depending on the type of kernel selected.

David
--

From: Greg Ungerer
Date: Friday, September 3, 2010 - 2:31 am

Not sure about m68k but m68knommu targets already setup
appropriate -mcpu flags for its various supported CPU types.

Regards
Greg

--

From: Geert Uytterhoeven
Date: Friday, September 3, 2010 - 2:33 am

Same for m68k.

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: David Howells
Date: Friday, September 3, 2010 - 2:52 am

It doesn't seem to:

	warthog>grep -r mcpu arch/m68k
	warthog1>grep -r mtune arch/m68k
	warthog1>

I see that m68knommu does:

	warthog1>grep -r mcpu arch/m68knommu/
	arch/m68knommu/Makefile:cflags-$(CONFIG_M5206)          := $(call cc-option,-mcpu=5206,-m5200)
	arch/m68knommu/Makefile:cflags-$(CONFIG_M520x)          := $(call cc-option,-mcpu=5208,-m5200)
	arch/m68knommu/Makefile:cflags-$(CONFIG_M523x)          := $(call cc-option,-mcpu=523x,-m5307)
	...

I guess the m68k compiler I already had doesn't fully support -m5200, since I
see that, but it doesn't compile some of the instructions when compiling the
m68knommu defconfig (CONFIG_M520x=y).

David
--

From: Geert Uytterhoeven
Date: Friday, September 3, 2010 - 3:02 am

Sorry, we're still using e.g. -m68040 instead of the -mcpu/-mtune variants.

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: Greg Ungerer
Date: Friday, September 3, 2010 - 3:41 am

Ah, ok, that would explain it. The m520x is one of the newer ColdFire
variants (thus proper cpu=5208 support is only in more recent binutils.
A fallback to -m5200 (which is the absolute minimum ColdFire support)
looks like it is not quite enough here.

Regards
Greg
--

From: David Howells
Date: Thursday, September 2, 2010 - 8:11 am

It's the only m68k compiler that I've got.

David
--

From: David Howells
Date: Thursday, September 2, 2010 - 8:12 am

That shouldn't be used in kernel headers.  It should be !CONFIG_MMU.

David
--

From: Sam Ravnborg
Date: Thursday, September 2, 2010 - 9:50 am

Thats preferable - yes.
But in headers that are exported we cannot rely on CONFIG_MMU,
and Andreas could point out two headers that are exported
where your patch replaced __uClinux__ with CONFIG_MMU.

Thats wrong.
I assume you aggree on this?

	Sam
--

From: David Howells
Date: Thursday, September 2, 2010 - 3:22 am

From: Greg Ungerer <gerg@snapgear.com>


---

 arch/m68k/include/asm/entry_no.h    |    2 -
 arch/m68k/include/asm/irqflags.h    |   76 +++++++++++++++++++++++++++++++++++
 arch/m68k/include/asm/system_mm.h   |   25 ------------
 arch/m68k/include/asm/system_no.h   |   57 --------------------------
 arch/m68knommu/kernel/asm-offsets.c |    2 -
 include/asm-generic/hardirq.h       |    1 
 6 files changed, 79 insertions(+), 84 deletions(-)
 create mode 100644 arch/m68k/include/asm/irqflags.h

diff --git a/arch/m68k/include/asm/entry_no.h b/arch/m68k/include/asm/entry_no.h
index 907ed03..80e4149 100644
--- a/arch/m68k/include/asm/entry_no.h
+++ b/arch/m68k/include/asm/entry_no.h
@@ -28,7 +28,7 @@
  *			M68K		  COLDFIRE
  */
 
-#define ALLOWINT 0xf8ff
+#define ALLOWINT (~0x700)
 
 #ifdef __ASSEMBLY__
 
diff --git a/arch/m68k/include/asm/irqflags.h b/arch/m68k/include/asm/irqflags.h
new file mode 100644
index 0000000..6d31c5c
--- /dev/null
+++ b/arch/m68k/include/asm/irqflags.h
@@ -0,0 +1,76 @@
+#ifndef _M68K_IRQFLAGS_H
+#define _M68K_IRQFLAGS_H
+
+#include <linux/types.h>
+#include <linux/hardirq.h>
+#include <linux/preempt.h>
+#include <asm/thread_info.h>
+#include <asm/entry.h>
+
+static inline unsigned long arch_local_save_flags(void)
+{
+	unsigned long flags;
+	asm volatile ("movew %%sr,%0": "=d" (flags) : : "memory");
+	return flags;
+}
+
+static inline void arch_local_irq_disable(void)
+{
+#ifdef CONFIG_COLDFIRE
+	asm volatile (
+		"move	%/sr,%%d0	\n\t"
+		"ori.l	#0x0700,%%d0	\n\t"
+		"move	%%d0,%/sr	\n"
+		: /* no outputs */
+		:
+		: "cc", "%d0", "memory");
+#else
+	asm volatile ("oriw  #0x0700,%%sr" : : : "memory");
+#endif
+}
+
+static inline void arch_local_irq_enable(void)
+{
+#if defined(CONFIG_COLDFIRE)
+	asm volatile (
+		"move	%/sr,%%d0	\n\t"
+		"andi.l	#0xf8ff,%%d0	\n\t"
+		"move	%%d0,%/sr	\n"
+		: /* no outputs */
+		:
+		: "cc", "%d0", "memory");
+#else
+# if defined(CONFIG_MMU)
+	if (MACH_IS_Q40 || ...
From: Greg Ungerer
Date: Thursday, September 2, 2010 - 6:28 pm

Hi David,



This breaks final link due to missing THREAD_SIZE definition in head.S:

   LD      vmlinux
arch/m68knommu/platform/coldfire/head.o: In function `_clear_bss':
(.head.text+0xa4): undefined reference to `THREAD_SIZE'


Without that asm-offsets.c change it works on my ColdFire boards.
I am happy with it:

Acked-by:  Greg Ungerer <gerg@uclinux.org>

Thanks
Greg



------------------------------------------------------------------------
Greg Ungerer  --  Principal Engineer        EMAIL:     gerg@snapgear.com
SnapGear Group, McAfee                      PHONE:       +61 7 3435 2888
8 Gardner Close                             FAX:         +61 7 3217 5323
Milton, QLD, 4064, Australia                WEB: http://www.SnapGear.com
--

From: David Howells
Date: Thursday, September 2, 2010 - 11:44 pm

With that, I get a duplicate reference to THREAD_SIZE.  head.S should include
asm/thread_info.h rather than THREAD_SIZE being redefined in asm-offsets.

  CC      init/do_mounts_rd.o
In file included from /warthog/nfs/linux-2.6-fscache/arch/m68k/include/asm/asm-offsets.h:1,
                 from arch/m68knommu/platform/coldfire/entry.S:36:
include/generated/asm-offsets.h:46:1: warning: "THREAD_SIZE" redefined
In file included from /warthog/nfs/linux-2.6-fscache/arch/m68k/include/asm/thread_info.h:2,
                 from arch/m68knommu/platform/coldfire/entry.S:32:
/warthog/nfs/linux-2.6-fscache/arch/m68k/include/asm/thread_info_no.h:27:1: warning: this is the location of the previous definition

Unfortunately, I don't have a binutils that can handle the funny Coldfire
instructions.  Can you point me at a Coldfire toolchain?

David
--

From: Greg Ungerer
Date: Thursday, September 2, 2010 - 11:53 pm

This is what I currently use:

http://www.uclinux.org/pub/uClinux/m68k-elf-tools/tools-20080626/m68k-uclinux-tools-20...

Its just a binutils-2.18 and gcc-4.2.4 configured for m68k-uclinux
target.

Regards
Greg


------------------------------------------------------------------------
Greg Ungerer  --  Principal Engineer        EMAIL:     gerg@snapgear.com
SnapGear Group, McAfee                      PHONE:       +61 7 3435 2888
8 Gardner Close                             FAX:         +61 7 3217 5323
Milton, QLD, 4064, Australia                WEB: http://www.SnapGear.com
--

From: David Howells
Date: Friday, September 3, 2010 - 12:28 am

It's possible my binutils is too old (2.17.50.0.2) or configured strangely.

David
--

From: David Howells
Date: Friday, September 3, 2010 - 1:05 am

With this toolchain and the m68knommu defconfig, the asm errors are now gone,
but I see the following link error:

/usr/local/bin/m68k-uclinux-ld.real: error: no memory region specified for loadable section `.data..shared_aligned'

I don't see any errors or warnings concerning THREAD_SIZE.

David
--

From: Greg Ungerer
Date: Friday, September 3, 2010 - 2:28 am

You need to apply this patch to fix this (sent to Linus,
but not in head yet)

http://marc.info/?l=linux-kernel&m=128347657132425&w=2

Regards
Greg

--

From: David Howells
Date: Friday, September 3, 2010 - 3:05 am

In that case, this patch works for me.  I made head.S include
asm/thread_info.h, and now it finds THREAD_SIZE again.

David
---
From: Greg Ungerer <gerg@snapgear.com>
Subject: [PATCH] Fix M68K irqflags


---

 arch/m68k/include/asm/entry_no.h        |    2 -
 arch/m68k/include/asm/irqflags.h        |   76 +++++++++++++++++++++++++++++++
 arch/m68k/include/asm/system_mm.h       |   25 ----------
 arch/m68k/include/asm/system_no.h       |   57 -----------------------
 arch/m68knommu/kernel/asm-offsets.c     |    2 -
 arch/m68knommu/platform/coldfire/head.S |    1 
 include/asm-generic/hardirq.h           |    1 
 7 files changed, 80 insertions(+), 84 deletions(-)
 create mode 100644 arch/m68k/include/asm/irqflags.h


diff --git a/arch/m68k/include/asm/entry_no.h b/arch/m68k/include/asm/entry_no.h
index 907ed03..80e4149 100644
--- a/arch/m68k/include/asm/entry_no.h
+++ b/arch/m68k/include/asm/entry_no.h
@@ -28,7 +28,7 @@
  *			M68K		  COLDFIRE
  */
 
-#define ALLOWINT 0xf8ff
+#define ALLOWINT (~0x700)
 
 #ifdef __ASSEMBLY__
 
diff --git a/arch/m68k/include/asm/irqflags.h b/arch/m68k/include/asm/irqflags.h
new file mode 100644
index 0000000..6d31c5c
--- /dev/null
+++ b/arch/m68k/include/asm/irqflags.h
@@ -0,0 +1,76 @@
+#ifndef _M68K_IRQFLAGS_H
+#define _M68K_IRQFLAGS_H
+
+#include <linux/types.h>
+#include <linux/hardirq.h>
+#include <linux/preempt.h>
+#include <asm/thread_info.h>
+#include <asm/entry.h>
+
+static inline unsigned long arch_local_save_flags(void)
+{
+	unsigned long flags;
+	asm volatile ("movew %%sr,%0": "=d" (flags) : : "memory");
+	return flags;
+}
+
+static inline void arch_local_irq_disable(void)
+{
+#ifdef CONFIG_COLDFIRE
+	asm volatile (
+		"move	%/sr,%%d0	\n\t"
+		"ori.l	#0x0700,%%d0	\n\t"
+		"move	%%d0,%/sr	\n"
+		: /* no outputs */
+		:
+		: "cc", "%d0", "memory");
+#else
+	asm volatile ("oriw  #0x0700,%%sr" : : : "memory");
+#endif
+}
+
+static inline void arch_local_irq_enable(void)
+{
+#if ...
From: Greg Ungerer
Date: Friday, September 3, 2010 - 3:38 am

Yep, that looks good to me.

Regards

--

From: David Howells
Date: Thursday, September 2, 2010 - 3:48 am

asm/include.h should read asm/system.h here and in the subject.

David
--

From: David Howells
Date: Thursday, August 26, 2010 - 7:00 pm

---

 arch/parisc/include/asm/irqflags.h |   46 ++++++++++++++++++++++++++++++++++++
 arch/parisc/include/asm/system.h   |   19 +--------------
 2 files changed, 47 insertions(+), 18 deletions(-)
 create mode 100644 arch/parisc/include/asm/irqflags.h

diff --git a/arch/parisc/include/asm/irqflags.h b/arch/parisc/include/asm/irqflags.h
new file mode 100644
index 0000000..40442a1
--- /dev/null
+++ b/arch/parisc/include/asm/irqflags.h
@@ -0,0 +1,46 @@
+#ifndef __PARISC_IRQFLAGS_H
+#define __PARISC_IRQFLAGS_H
+
+#include <linux/types.h>
+#include <asm/psw.h>
+
+static inline unsigned long arch_local_save_flags(void)
+{
+	unsigned long flags;
+	asm volatile("ssm 0, %0" : "=r" (flags) : : "memory");
+	return flags;
+}
+
+static inline void arch_local_irq_disable(void)
+{
+	asm volatile("rsm %0,%%r0\n" : : "i" (PSW_I) : "memory");
+}
+
+static inline void arch_local_irq_enable(void)
+{
+	asm volatile("ssm %0,%%r0\n" : : "i" (PSW_I) : "memory");
+}
+
+static inline unsigned long arch_local_irq_save(void)
+{
+	unsigned long flags;
+	asm volatile ("rsm %1,%0" : "=r" (flags) :"i" (PSW_I) : "memory");
+	return flags;
+}
+
+static inline void arch_local_irq_restore(unsigned long flags)
+{
+	asm volatile ("mtsm %0" : : "r" (flags) : "memory");
+}
+
+static inline bool arch_irqs_disabled_flags(unsigned long flags)
+{
+	return (flags & PSW_I) == 0;
+}
+
+static inline bool arch_irqs_disabled(void)
+{
+	return arch_irqs_disabled_flags(arch_local_save_flags());
+}
+
+#endif /* __PARISC_IRQFLAGS_H */
diff --git a/arch/parisc/include/asm/system.h b/arch/parisc/include/asm/system.h
index 2ab4af5..b19e63a 100644
--- a/arch/parisc/include/asm/system.h
+++ b/arch/parisc/include/asm/system.h
@@ -1,7 +1,7 @@
 #ifndef __PARISC_SYSTEM_H
 #define __PARISC_SYSTEM_H
 
-#include <asm/psw.h>
+#include <linux/irqflags.h>
 
 /* The program status word as bitfields.  */
 struct pa_psw {
@@ -48,23 +48,6 @@ extern struct task_struct *_switch_to(struct task_struct *, struct ...
From: Kyle McMartin
Date: Thursday, September 2, 2010 - 6:40 pm

Looks good to me, David.

Should I merge this, or are you going to push this with some larger
changes?

--Kyle
--

From: David Howells
Date: Thursday, September 2, 2010 - 11:48 pm

This will need to be merged into the main patch before that is submitted, but
if I can have your Acked-by, I can include that specifically for the PA-RISC
bits.

David
--

From: Kyle McMartin
Date: Friday, September 3, 2010 - 6:31 am

Please do:

Acked-by: Kyle McMartin <kyle@mcmartin.ca>
--

From: David Howells
Date: Thursday, August 26, 2010 - 7:00 pm

---

 arch/powerpc/include/asm/hw_irq.h    |  115 +++++++++++++++++++---------------
 arch/powerpc/include/asm/irqflags.h  |    2 -
 arch/powerpc/kernel/exceptions-64s.S |    4 +
 arch/powerpc/kernel/irq.c            |    4 +
 4 files changed, 69 insertions(+), 56 deletions(-)

diff --git a/arch/powerpc/include/asm/hw_irq.h b/arch/powerpc/include/asm/hw_irq.h
index bd100fc..4255de6 100644
--- a/arch/powerpc/include/asm/hw_irq.h
+++ b/arch/powerpc/include/asm/hw_irq.h
@@ -16,42 +16,57 @@ extern void timer_interrupt(struct pt_regs *);
 #ifdef CONFIG_PPC64
 #include <asm/paca.h>
 
-static inline unsigned long local_get_flags(void)
+static inline unsigned long arch_local_save_flags(void)
 {
 	unsigned long flags;
 
-	__asm__ __volatile__("lbz %0,%1(13)"
-	: "=r" (flags)
-	: "i" (offsetof(struct paca_struct, soft_enabled)));
+	asm volatile(
+		"lbz %0,%1(13)"
+		: "=r" (flags)
+		: "i" (offsetof(struct paca_struct, soft_enabled)));
 
 	return flags;
 }
 
-static inline unsigned long raw_local_irq_disable(void)
+static inline unsigned long arch_local_irq_disable(void)
 {
 	unsigned long flags, zero;
 
-	__asm__ __volatile__("li %1,0; lbz %0,%2(13); stb %1,%2(13)"
-	: "=r" (flags), "=&r" (zero)
-	: "i" (offsetof(struct paca_struct, soft_enabled))
-	: "memory");
+	asm volatile(
+		"li %1,0; lbz %0,%2(13); stb %1,%2(13)"
+		: "=r" (flags), "=&r" (zero)
+		: "i" (offsetof(struct paca_struct, soft_enabled))
+		: "memory");
 
 	return flags;
 }
 
-extern void raw_local_irq_restore(unsigned long);
+extern void arch_local_irq_restore(unsigned long);
 extern void iseries_handle_interrupts(void);
 
-#define raw_local_irq_enable()		raw_local_irq_restore(1)
-#define raw_local_save_flags(flags)	((flags) = local_get_flags())
-#define raw_local_irq_save(flags)	((flags) = raw_local_irq_disable())
+static inline void arch_local_irq_enable(void)
+{
+	arch_local_irq_restore(1);
+}
 
-#define raw_irqs_disabled()		(local_get_flags() == 0)
-#define ...
From: David Howells
Date: Thursday, August 26, 2010 - 7:00 pm

---

 arch/sparc/include/asm/irqflags_32.h |   35 ++++++++++++++++++++--------------
 arch/sparc/include/asm/irqflags_64.h |   29 +++++++++-------------------
 arch/sparc/kernel/irq_32.c           |   12 ++++++------
 3 files changed, 36 insertions(+), 40 deletions(-)

diff --git a/arch/sparc/include/asm/irqflags_32.h b/arch/sparc/include/asm/irqflags_32.h
index 0fca9d9..081d130 100644
--- a/arch/sparc/include/asm/irqflags_32.h
+++ b/arch/sparc/include/asm/irqflags_32.h
@@ -5,33 +5,40 @@
  *
  * This file gets included from lowlevel asm headers too, to provide
  * wrapped versions of the local_irq_*() APIs, based on the
- * raw_local_irq_*() functions from the lowlevel headers.
+ * arch_local_irq_*() functions from the lowlevel headers.
  */
 #ifndef _ASM_IRQFLAGS_H
 #define _ASM_IRQFLAGS_H
 
 #ifndef __ASSEMBLY__
 
-extern void raw_local_irq_restore(unsigned long);
-extern unsigned long __raw_local_irq_save(void);
-extern void raw_local_irq_enable(void);
+#include <linux/types.h>
 
-static inline unsigned long getipl(void)
+extern void arch_local_irq_restore(unsigned long);
+extern unsigned long arch_local_irq_save(void);
+extern void arch_local_irq_enable(void);
+
+static inline unsigned long arch_local_save_flags(void)
 {
-        unsigned long retval;
+        unsigned long flags;
+
+        asm volatile("rd        %%psr, %0" : "=r" (flags));
+        return flags;
+}
 
-        __asm__ __volatile__("rd        %%psr, %0" : "=r" (retval));
-        return retval;
+static inline void arch_local_irq_disable(void)
+{
+	arch_local_irq_save();
 }
 
-#define raw_local_save_flags(flags) ((flags) = getipl())
-#define raw_local_irq_save(flags)   ((flags) = __raw_local_irq_save())
-#define raw_local_irq_disable()     ((void) __raw_local_irq_save())
-#define raw_irqs_disabled()         ((getipl() & PSR_PIL) != 0)
+static inline bool arch_irqs_disabled_flags(unsigned long flags)
+{
+        return (flags & PSR_PIL) != 0;
+}
 
-static inline int ...
From: David Howells
Date: Thursday, August 26, 2010 - 7:00 pm

---

 arch/sh/kernel/irq_32.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/sh/kernel/irq_32.c b/arch/sh/kernel/irq_32.c
index e33ab15..14d2477 100644
--- a/arch/sh/kernel/irq_32.c
+++ b/arch/sh/kernel/irq_32.c
@@ -10,7 +10,7 @@
 #include <linux/irqflags.h>
 #include <linux/module.h>
 
-void notrace raw_local_irq_restore(unsigned long flags)
+void notrace arch_local_irq_restore(unsigned long flags)
 {
 	unsigned long __dummy0, __dummy1;
 
@@ -38,9 +38,9 @@ void notrace raw_local_irq_restore(unsigned long flags)
 		);
 	}
 }
-EXPORT_SYMBOL(raw_local_irq_restore);
+EXPORT_SYMBOL(arch_local_irq_restore);
 
-unsigned long notrace __raw_local_save_flags(void)
+unsigned long notrace __arch_local_save_flags(void)
 {
 	unsigned long flags;
 
@@ -54,4 +54,4 @@ unsigned long notrace __raw_local_save_flags(void)
 
 	return flags;
 }
-EXPORT_SYMBOL(__raw_local_save_flags);
+EXPORT_SYMBOL(__arch_local_save_flags);

--

From: David Howells
Date: Thursday, August 26, 2010 - 7:00 pm

---

 arch/alpha/include/asm/irqflags.h |   65 +++++++++++++++++++++++++++++++++++++
 arch/alpha/include/asm/system.h   |   28 ----------------
 2 files changed, 65 insertions(+), 28 deletions(-)
 create mode 100644 arch/alpha/include/asm/irqflags.h

diff --git a/arch/alpha/include/asm/irqflags.h b/arch/alpha/include/asm/irqflags.h
new file mode 100644
index 0000000..75dfe395
--- /dev/null
+++ b/arch/alpha/include/asm/irqflags.h
@@ -0,0 +1,65 @@
+#ifndef __ALPHA_IRQFLAGS_H
+#define __ALPHA_IRQFLAGS_H
+
+#define IPL_MIN		0
+#define IPL_SW0		1
+#define IPL_SW1		2
+#define IPL_DEV0	3
+#define IPL_DEV1	4
+#define IPL_TIMER	5
+#define IPL_PERF	6
+#define IPL_POWERFAIL	6
+#define IPL_MCHECK	7
+#define IPL_MAX		7
+
+#ifdef CONFIG_ALPHA_BROKEN_IRQ_MASK
+#undef IPL_MIN
+#define IPL_MIN		__min_ipl
+extern int __min_ipl;
+#endif
+
+#define getipl()		(rdps() & 7)
+#define setipl(ipl)		((void) swpipl(ipl))
+
+static inline unsigned long arch_local_save_flags(void)
+{
+	return rdps();
+}
+
+static inline void arch_local_irq_disable(void)
+{
+	setipl(IPL_MAX);
+	barrier();
+}
+
+static inline unsigned long arch_local_irq_save(void)
+{
+	unsigned long flags = swpipl(IPL_MAX);
+	barrier();
+	return flags;
+}
+
+static inline void arch_local_irq_enable(void)
+{
+	barrier();
+	setipl(IPL_MIN);
+}
+
+static inline void arch_local_irq_restore(unsigned long flags)
+{
+	barrier();
+	setipl(flags);
+	barrier();
+}
+
+static inline bool arch_irqs_disabled_flags(unsigned long flags)
+{
+	return flags == IPL_MAX;
+}
+
+static inline bool arch_irqs_disabled(void)
+{
+	return arch_irqs_disabled_flags(getipl());
+}
+
+#endif /* __ALPHA_IRQFLAGS_H */
diff --git a/arch/alpha/include/asm/system.h b/arch/alpha/include/asm/system.h
index 5aa40cc..9f78e69 100644
--- a/arch/alpha/include/asm/system.h
+++ b/arch/alpha/include/asm/system.h
@@ -259,34 +259,6 @@ __CALL_PAL_RW2(wrperfmon, unsigned long, unsigned long, unsigned long);
 __CALL_PAL_W1(wrusp, unsigned ...
From: David Howells
Date: Thursday, August 26, 2010 - 6:59 pm

Fix h8300's die() to take care of a number of problems:

  CC      arch/h8300/kernel/traps.o
In file included from /warthog/nfs/linux-2.6-fscache/arch/h8300/include/asm/bitops.h:10,
                 from include/linux/bitops.h:22,
                 from include/linux/kernel.h:17,
                 from include/linux/sched.h:54,
                 from arch/h8300/kernel/traps.c:18:
/warthog/nfs/linux-2.6-fscache/arch/h8300/include/asm/system.h:136: warning: 'struct pt_regs' declared inside parameter list
/warthog/nfs/linux-2.6-fscache/arch/h8300/include/asm/system.h:136: warning: its scope is only this definition or declaration, which is probably not what you want
arch/h8300/kernel/traps.c:100: error: conflicting types for 'die'
/warthog/nfs/linux-2.6-fscache/arch/h8300/include/asm/system.h:136: error: previous declaration of 'die' was here
make[2]: *** [arch/h8300/kernel/traps.o] Error 1

Signed-off-by: David Howells <dhowells@redhat.com>
---

 arch/h8300/include/asm/system.h |    4 +++-
 arch/h8300/kernel/traps.c       |    2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/h8300/include/asm/system.h b/arch/h8300/include/asm/system.h
index d98d976..16bf156 100644
--- a/arch/h8300/include/asm/system.h
+++ b/arch/h8300/include/asm/system.h
@@ -3,6 +3,8 @@
 
 #include <linux/linkage.h>
 
+struct pt_regs;
+
 /*
  * switch_to(n) should switch tasks to task ptr, first checking that
  * ptr isn't the current task, in which case it does nothing.  This
@@ -155,6 +157,6 @@ static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int siz
 
 #define arch_align_stack(x) (x)
 
-void die(char *str, struct pt_regs *fp, unsigned long err);
+extern void die(const char *str, struct pt_regs *fp, unsigned long err);
 
 #endif /* _H8300_SYSTEM_H */
diff --git a/arch/h8300/kernel/traps.c b/arch/h8300/kernel/traps.c
index 3c0b66b..dfa05bd 100644
--- a/arch/h8300/kernel/traps.c
+++ b/arch/h8300/kernel/traps.c
@@ -96,7 +96,7 @@ static void dump(struct ...
Previous thread: 2.6.36-rc2-git4 - INFO: possible circular locking dependency detected by Miles Lane on Thursday, August 26, 2010 - 6:56 pm. (2 messages)

Next thread: linux-next: build warning after merge of the drivers-x86 tree by Stephen Rothwell on Thursday, August 26, 2010 - 6:59 pm. (4 messages)