LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3 v3] Raise the upper limit of NR_CPUS.
From: Tony Breeds @ 2008-04-23  4:06 UTC (permalink / raw)
  To: Paul Mackerras, linuxppc-dev

As the pacas are statically initialised increasing NR_CPUS beyond 128,
means that any additional pacas will be empty  ... which is bad.

This patch adds the required functionality to fill in any excess pacas
at runtime.

Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
---
Changes since v1:
 - Addressed thinko pointed out by sfr.
 - Addeed nicely worded comment about paca->kernel_toc from Segher
Changes since v2:
 - none

Paul, please consider before -rc1

 arch/powerpc/kernel/paca.c             |   61 +++++++++++++++++++++-----------
 arch/powerpc/kernel/setup_64.c         |    3 ++
 arch/powerpc/platforms/Kconfig.cputype |    4 +-
 include/asm-powerpc/paca.h             |   20 ++++++++++
 4 files changed, 65 insertions(+), 23 deletions(-)

diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c
index ac163bd..4c7db2e 100644
--- a/arch/powerpc/kernel/paca.c
+++ b/arch/powerpc/kernel/paca.c
@@ -18,6 +18,15 @@
 #include <asm/paca.h>
 #include <asm/mmu.h>
 
+/*
+ * In order to handle "strange" values of NR_CPUS, Make sure we use
+ * max(NR_CPUS, NR_STATIC_PACAS) for array sizes below
+ */
+#if NR_CPUS > NR_STATIC_PACAS
+#define MAX_CPUS	NR_CPUS
+#else
+#define MAX_CPUS	NR_STATIC_PACAS
+#endif
 
 /* This symbol is provided by the linker - let it fill in the paca
  * field correctly */
@@ -33,7 +42,7 @@ extern unsigned long __toc_start;
  * will suffice to ensure that it doesn't cross a page boundary.
  */
 struct lppaca lppaca[] = {
-	[0 ... (NR_CPUS-1)] = {
+	[0 ... (MAX_CPUS-1)] = {
 		.desc = 0xd397d781,	/* "LpPa" */
 		.size = sizeof(struct lppaca),
 		.dyn_proc_status = 2,
@@ -50,7 +59,7 @@ struct lppaca lppaca[] = {
  * initially, hence will all be invaild until we actually write them.
  */
 struct slb_shadow slb_shadow[] __cacheline_aligned = {
-	[0 ... (NR_CPUS-1)] = {
+	[0 ... (MAX_CPUS-1)] = {
 		.persistent = SLB_NUM_BOLTED,
 		.buffer_length = sizeof(struct slb_shadow),
 	},
@@ -76,7 +85,7 @@ struct slb_shadow slb_shadow[] __cacheline_aligned = {
 	.__current = &init_task,					    \
 }
 
-struct paca_struct paca[] = {
+struct paca_struct paca[MAX_CPUS] = {
 	PACA_INIT(0),
 #if NR_CPUS > 1
 	PACA_INIT(  1), PACA_INIT(  2), PACA_INIT(  3),
@@ -98,27 +107,37 @@ struct paca_struct paca[] = {
 	PACA_INIT( 52), PACA_INIT( 53), PACA_INIT( 54), PACA_INIT( 55),
 	PACA_INIT( 56), PACA_INIT( 57), PACA_INIT( 58), PACA_INIT( 59),
 	PACA_INIT( 60), PACA_INIT( 61), PACA_INIT( 62), PACA_INIT( 63),
-#if NR_CPUS > 64
-	PACA_INIT( 64), PACA_INIT( 65), PACA_INIT( 66), PACA_INIT( 67),
-	PACA_INIT( 68), PACA_INIT( 69), PACA_INIT( 70), PACA_INIT( 71),
-	PACA_INIT( 72), PACA_INIT( 73), PACA_INIT( 74), PACA_INIT( 75),
-	PACA_INIT( 76), PACA_INIT( 77), PACA_INIT( 78), PACA_INIT( 79),
-	PACA_INIT( 80), PACA_INIT( 81), PACA_INIT( 82), PACA_INIT( 83),
-	PACA_INIT( 84), PACA_INIT( 85), PACA_INIT( 86), PACA_INIT( 87),
-	PACA_INIT( 88), PACA_INIT( 89), PACA_INIT( 90), PACA_INIT( 91),
-	PACA_INIT( 92), PACA_INIT( 93), PACA_INIT( 94), PACA_INIT( 95),
-	PACA_INIT( 96), PACA_INIT( 97), PACA_INIT( 98), PACA_INIT( 99),
-	PACA_INIT(100), PACA_INIT(101), PACA_INIT(102), PACA_INIT(103),
-	PACA_INIT(104), PACA_INIT(105), PACA_INIT(106), PACA_INIT(107),
-	PACA_INIT(108), PACA_INIT(109), PACA_INIT(110), PACA_INIT(111),
-	PACA_INIT(112), PACA_INIT(113), PACA_INIT(114), PACA_INIT(115),
-	PACA_INIT(116), PACA_INIT(117), PACA_INIT(118), PACA_INIT(119),
-	PACA_INIT(120), PACA_INIT(121), PACA_INIT(122), PACA_INIT(123),
-	PACA_INIT(124), PACA_INIT(125), PACA_INIT(126), PACA_INIT(127),
-#endif
 #endif
 #endif
 #endif
 #endif
 };
 EXPORT_SYMBOL(paca);
+
+/*
+ * The first few (NR_STATIC_PACAS) paca entires are initiialised
+ * statically. populate the rest.
+ */
+void __init initialise_pacas(void)
+{
+	int cpu;
+
+	/* The TOC register (GPR2) points 32kB into the TOC, so that 64kB
+	 * of the TOC can be addressed using a single machine instruction.
+	 */
+	unsigned long kernel_toc = (unsigned long)(&__toc_start) + 0x8000UL;
+
+	/* Can't use for_each_*_cpu, as they aren't functional yet */
+	for (cpu = NR_STATIC_PACAS; cpu < NR_CPUS; cpu++) {
+		struct paca_struct *new_paca = &paca[cpu];
+
+		new_paca->lppaca_ptr = &lppaca[cpu];
+		new_paca->lock_token = 0x8000;
+		new_paca->paca_index = cpu;
+		new_paca->kernel_toc = kernel_toc;
+		new_paca->hw_cpu_id = 0xffff;
+		new_paca->slb_shadow_ptr = &slb_shadow[cpu];
+		new_paca->__current = &init_task;
+
+	}
+}
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index 31ada9f..5e382ac 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -170,6 +170,9 @@ void __init setup_paca(int cpu)
 
 void __init early_setup(unsigned long dt_ptr)
 {
+	/* Fill in any unititialised pacas */
+	initialise_pacas();
+
 	/* Identify CPU type */
 	identify_cpu(0, mfspr(SPRN_PVR));
 
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index 5fc7fac..f7efaa9 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -220,8 +220,8 @@ config SMP
 	  If you don't know what to do here, say N.
 
 config NR_CPUS
-	int "Maximum number of CPUs (2-128)"
-	range 2 128
+	int "Maximum number of CPUs (2-1024)"
+	range 2 1024
 	depends on SMP
 	default "32" if PPC64
 	default "4"
diff --git a/include/asm-powerpc/paca.h b/include/asm-powerpc/paca.h
index eb61b9c..2a05cc0 100644
--- a/include/asm-powerpc/paca.h
+++ b/include/asm-powerpc/paca.h
@@ -16,10 +16,29 @@
 #define _ASM_POWERPC_PACA_H
 #ifdef __KERNEL__
 
+#include <linux/threads.h>
+
 #include	<asm/types.h>
 #include	<asm/lppaca.h>
 #include	<asm/mmu.h>
 
+/*
+ * iSeries needs the paca to be statically allocated and initialised.
+ * We will allocated this many, based on NR_CPUS.
+ */
+#if   NR_CPUS > 32
+#define NR_STATIC_PACAS	64
+#elif NR_CPUS > 8
+#define NR_STATIC_PACAS	32
+#elif NR_CPUS > 4
+#define NR_STATIC_PACAS	8
+#elif NR_CPUS > 1
+#define NR_STATIC_PACAS	4
+#else
+#define NR_STATIC_PACAS	1
+#endif
+
+
 register struct paca_struct *local_paca asm("r13");
 
 #if defined(CONFIG_DEBUG_PREEMPT) && defined(CONFIG_SMP)
@@ -108,6 +127,7 @@ struct paca_struct {
 };
 
 extern struct paca_struct paca[];
+extern void initialise_pacas(void);
 
 #endif /* __KERNEL__ */
 #endif /* _ASM_POWERPC_PACA_H */
-- 
1.5.5.1

^ permalink raw reply related

* [PATCH 2/3 v3] Make iSeries spin on __secondary_hold_spinloop, like pSeries.
From: Tony Breeds @ 2008-04-23  4:06 UTC (permalink / raw)
  To: Paul Mackerras, linuxppc-dev; +Cc: Stephen Rothwell
In-Reply-To: <d54206d25b690c9160401f65a583f586004dcd5d.1208923391.git.tony@bakeyournoodle.com>

Currently all iSeries secondary CPU's spin directly on the cpu_start in thier
paca.  Make them spin on the global __secondary_hold_spinloop, until after the
pacas have been initialised.

As sfr points out this works because __secondary_hold_spinloop is being set
already, but iSeries isn't looking at it :)

Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
Acked-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
Changes since v1:
 - Updated commit message.
Changes since v2:
 - Fixed my brain damage, and split out the code that should be in 3/3

 arch/powerpc/platforms/iseries/exception.S |   27 ++++++++++++++++++++++++++-
 1 files changed, 26 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/platforms/iseries/exception.S b/arch/powerpc/platforms/iseries/exception.S
index c775cd4..8ff330d 100644
--- a/arch/powerpc/platforms/iseries/exception.S
+++ b/arch/powerpc/platforms/iseries/exception.S
@@ -59,8 +59,33 @@ system_reset_iSeries:
 	andc	r4,r4,r5
 	mtspr	SPRN_CTRLT,r4
 
+/* Spin on __secondary_hold_spinloop until it is updated by the boot cpu. */
+/* In the UP case we'll yeild() later, and we will not access the paca anyway */
+#ifdef CONFIG_SMP
 1:
 	HMT_LOW
+	LOAD_REG_IMMEDIATE(r23, __secondary_hold_spinloop)
+	ld	r23,0(r23)
+	sync
+	LOAD_REG_IMMEDIATE(r3,current_set)
+	sldi	r28,r24,3		/* get current_set[cpu#] */
+	ldx	r3,r3,r28
+	addi	r1,r3,THREAD_SIZE
+	subi	r1,r1,STACK_FRAME_OVERHEAD
+
+	cmpwi	0,r23,0			/* Keep poking the Hypervisor until */
+	bne	2f			/* we're released */
+	/* Let the Hypervisor know we are alive */
+	/* 8002 is a call to HvCallCfg::getLps, a harmless Hypervisor function */
+	lis	r3,0x8002
+	rldicr	r3,r3,32,15		/* r0 = (r3 << 32) & 0xffff000000000000 */
+	li	r0,-1			/* r0=-1 indicates a Hypervisor call */
+	sc				/* Invoke the hypervisor via a system call */
+	b	1b
+#endif
+
+2:
+	HMT_LOW
 #ifdef CONFIG_SMP
 	lbz	r23,PACAPROCSTART(r13)	/* Test if this processor
 					 * should start */
@@ -91,7 +116,7 @@ iSeries_secondary_smp_loop:
 	li	r0,-1			/* r0=-1 indicates a Hypervisor call */
 	sc				/* Invoke the hypervisor via a system call */
 	mfspr	r13,SPRN_SPRG3		/* Put r13 back ???? */
-	b	1b			/* If SMP not configured, secondaries
+	b	2b			/* If SMP not configured, secondaries
 					 * loop forever */
 
 /***  ISeries-LPAR interrupt handlers ***/
-- 
1.5.5.1

^ permalink raw reply related

* [PATCH 3/3 v3] Move the paca array into the BSS.
From: Tony Breeds @ 2008-04-23  4:06 UTC (permalink / raw)
  To: Paul Mackerras, linuxppc-dev
In-Reply-To: <d54206d25b690c9160401f65a583f586004dcd5d.1208923391.git.tony@bakeyournoodle.com>

With NR_CPUS=1024
text    data     bss     dec     hex filename
 137 1704032       0 1704169  1a00e9 arch/powerpc/kernel/paca.o :Before
 121 1179744  524288 1704153  1a00d9 arch/powerpc/kernel/paca.o :After

Now that we're not statically allocating the paca, we don't need the
NR_STATIC_PACAS #define anymore.

Also remove unneeded #includes.

Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
---
Changes since v1:
 - none
Changes since v2:
 - none

 arch/powerpc/kernel/paca.c |   64 +++-----------------------------------------
 include/asm-powerpc/paca.h |   17 -----------
 2 files changed, 4 insertions(+), 77 deletions(-)

diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c
index 4c7db2e..c9bf17e 100644
--- a/arch/powerpc/kernel/paca.c
+++ b/arch/powerpc/kernel/paca.c
@@ -7,26 +7,11 @@
  *      2 of the License, or (at your option) any later version.
  */
 
-#include <linux/types.h>
 #include <linux/threads.h>
 #include <linux/module.h>
 
-#include <asm/processor.h>
-#include <asm/ptrace.h>
-#include <asm/page.h>
 #include <asm/lppaca.h>
 #include <asm/paca.h>
-#include <asm/mmu.h>
-
-/*
- * In order to handle "strange" values of NR_CPUS, Make sure we use
- * max(NR_CPUS, NR_STATIC_PACAS) for array sizes below
- */
-#if NR_CPUS > NR_STATIC_PACAS
-#define MAX_CPUS	NR_CPUS
-#else
-#define MAX_CPUS	NR_STATIC_PACAS
-#endif
 
 /* This symbol is provided by the linker - let it fill in the paca
  * field correctly */
@@ -42,7 +27,7 @@ extern unsigned long __toc_start;
  * will suffice to ensure that it doesn't cross a page boundary.
  */
 struct lppaca lppaca[] = {
-	[0 ... (MAX_CPUS-1)] = {
+	[0 ... (NR_CPUS-1)] = {
 		.desc = 0xd397d781,	/* "LpPa" */
 		.size = sizeof(struct lppaca),
 		.dyn_proc_status = 2,
@@ -59,7 +44,7 @@ struct lppaca lppaca[] = {
  * initially, hence will all be invaild until we actually write them.
  */
 struct slb_shadow slb_shadow[] __cacheline_aligned = {
-	[0 ... (MAX_CPUS-1)] = {
+	[0 ... (NR_CPUS-1)] = {
 		.persistent = SLB_NUM_BOLTED,
 		.buffer_length = sizeof(struct slb_shadow),
 	},
@@ -74,50 +59,9 @@ struct slb_shadow slb_shadow[] __cacheline_aligned = {
  * processors.  The processor VPD array needs one entry per physical
  * processor (not thread).
  */
-#define PACA_INIT(number)						    \
-{									    \
-	.lppaca_ptr = &lppaca[number],					    \
-	.lock_token = 0x8000,						    \
-	.paca_index = (number),		/* Paca Index */		    \
-	.kernel_toc = (unsigned long)(&__toc_start) + 0x8000UL,		    \
-	.hw_cpu_id = 0xffff,						    \
-	.slb_shadow_ptr = &slb_shadow[number],				    \
-	.__current = &init_task,					    \
-}
-
-struct paca_struct paca[MAX_CPUS] = {
-	PACA_INIT(0),
-#if NR_CPUS > 1
-	PACA_INIT(  1), PACA_INIT(  2), PACA_INIT(  3),
-#if NR_CPUS > 4
-	PACA_INIT(  4), PACA_INIT(  5), PACA_INIT(  6), PACA_INIT(  7),
-#if NR_CPUS > 8
-	PACA_INIT(  8), PACA_INIT(  9), PACA_INIT( 10), PACA_INIT( 11),
-	PACA_INIT( 12), PACA_INIT( 13), PACA_INIT( 14), PACA_INIT( 15),
-	PACA_INIT( 16), PACA_INIT( 17), PACA_INIT( 18), PACA_INIT( 19),
-	PACA_INIT( 20), PACA_INIT( 21), PACA_INIT( 22), PACA_INIT( 23),
-	PACA_INIT( 24), PACA_INIT( 25), PACA_INIT( 26), PACA_INIT( 27),
-	PACA_INIT( 28), PACA_INIT( 29), PACA_INIT( 30), PACA_INIT( 31),
-#if NR_CPUS > 32
-	PACA_INIT( 32), PACA_INIT( 33), PACA_INIT( 34), PACA_INIT( 35),
-	PACA_INIT( 36), PACA_INIT( 37), PACA_INIT( 38), PACA_INIT( 39),
-	PACA_INIT( 40), PACA_INIT( 41), PACA_INIT( 42), PACA_INIT( 43),
-	PACA_INIT( 44), PACA_INIT( 45), PACA_INIT( 46), PACA_INIT( 47),
-	PACA_INIT( 48), PACA_INIT( 49), PACA_INIT( 50), PACA_INIT( 51),
-	PACA_INIT( 52), PACA_INIT( 53), PACA_INIT( 54), PACA_INIT( 55),
-	PACA_INIT( 56), PACA_INIT( 57), PACA_INIT( 58), PACA_INIT( 59),
-	PACA_INIT( 60), PACA_INIT( 61), PACA_INIT( 62), PACA_INIT( 63),
-#endif
-#endif
-#endif
-#endif
-};
+struct paca_struct paca[NR_CPUS];
 EXPORT_SYMBOL(paca);
 
-/*
- * The first few (NR_STATIC_PACAS) paca entires are initiialised
- * statically. populate the rest.
- */
 void __init initialise_pacas(void)
 {
 	int cpu;
@@ -128,7 +72,7 @@ void __init initialise_pacas(void)
 	unsigned long kernel_toc = (unsigned long)(&__toc_start) + 0x8000UL;
 
 	/* Can't use for_each_*_cpu, as they aren't functional yet */
-	for (cpu = NR_STATIC_PACAS; cpu < NR_CPUS; cpu++) {
+	for (cpu = 0; cpu < NR_CPUS; cpu++) {
 		struct paca_struct *new_paca = &paca[cpu];
 
 		new_paca->lppaca_ptr = &lppaca[cpu];
diff --git a/include/asm-powerpc/paca.h b/include/asm-powerpc/paca.h
index 2a05cc0..0bfc180 100644
--- a/include/asm-powerpc/paca.h
+++ b/include/asm-powerpc/paca.h
@@ -22,23 +22,6 @@
 #include	<asm/lppaca.h>
 #include	<asm/mmu.h>
 
-/*
- * iSeries needs the paca to be statically allocated and initialised.
- * We will allocated this many, based on NR_CPUS.
- */
-#if   NR_CPUS > 32
-#define NR_STATIC_PACAS	64
-#elif NR_CPUS > 8
-#define NR_STATIC_PACAS	32
-#elif NR_CPUS > 4
-#define NR_STATIC_PACAS	8
-#elif NR_CPUS > 1
-#define NR_STATIC_PACAS	4
-#else
-#define NR_STATIC_PACAS	1
-#endif
-
-
 register struct paca_struct *local_paca asm("r13");
 
 #if defined(CONFIG_DEBUG_PREEMPT) && defined(CONFIG_SMP)
-- 
1.5.5.1

^ permalink raw reply related

* Re: [PATCH v3] powerpc: Add irqtrace support for 32-bit powerpc
From: Benjamin Herrenschmidt @ 2008-04-23  4:40 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linuxppc-dev
In-Reply-To: <1207690574.7442.4.camel@johannes.berg>


On Tue, 2008-04-08 at 23:36 +0200, Johannes Berg wrote:
> > > This version fixes the clobbering of r12 by the call to
> > > trace_hardirqs_off() that was pointed out by BenH.
> > > 
> > > Johannes, I'd appreciate your trying this version if/when
> > > you get the chance.
> > 
> > Thanks Dale, this version seems to work. I'll stress it a bit more
> > later, but so far it has survived *much* longer than both previous
> > versions.
> 
> Hmm. Bad news. I got a crash in console_callback() again where
> apparently r28 had a bogus value. That, however, doesn't make sense, so
> maybe that register value was calculated from another register.

Possibly. How hard was it to reproduce ? Could it be a bug unrelated to
lockdep ?

Ben.

^ permalink raw reply

* Re: [RFC patch 6/9] POWERPC remove -traditional
From: Paul Mackerras @ 2008-04-23  4:41 UTC (permalink / raw)
  To: Mathieu Desnoyers
  Cc: linuxppc-dev, akpm, Sam Ravnborg, Ingo Molnar, linux-kernel
In-Reply-To: <20080422172842.427209743@polymtl.ca>

Mathieu Desnoyers writes:
> Subject: [RFC patch 6/9] Re: [PATCH] Stringify support commas
>  > This is a no-no for those archs that still use -traditional.
>  > > I dunno if this is a problem for you at the moment and the
>  > > right fix is anyway to nuke -traditional.
>  > > 
>  > >     Sam
> 
> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
> CC: Sam Ravnborg <sam@ravnborg.org>
> CC: paulus@samba.org
> CC: linuxppc-dev@ozlabs.org
> ---
>  arch/powerpc/boot/Makefile |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Looks OK.  I'll put it in my tree.

Paul.

^ permalink raw reply

* Re: [PATCH] powerpc TLF_RESTORE_SIGMASK
From: Paul Mackerras @ 2008-04-23  5:04 UTC (permalink / raw)
  To: Roland McGrath; +Cc: linuxppc-dev, akpm, linux-kernel
In-Reply-To: <20080403210842.6C88C26F98D@magilla.localdomain>

Roland McGrath writes:

> This requires the earlier HAVE_SET_RESTORE_SIGMASK patch series.
> This does the same for powerpc that I posted the x86 change for.

...

> +static inline void set_restore_sigmask(void)
> +{
> +	struct thread_info *ti = current_thread_info();
> +	ti->local_flags |= TLF_RESTORE_SIGMASK;

This should be _TLF_RESTORE_SIGMASK (leading '_'), I think.

Paul.

^ permalink raw reply

* Re: Phy read timeout in ibm_new_emac driver
From: Markus Brunner @ 2008-04-23  5:06 UTC (permalink / raw)
  To: benh; +Cc: netdev, ppc-dev
In-Reply-To: <1208347791.6958.279.camel@pasglop>

On Wednesday 16 April 2008, Benjamin Herrenschmidt wrote:

> Somebody knows off hand what the standard says the timeout should be ?

Anyone?

I didn't find any documentation on the standard, but I had a look at other 
drivers. 
au1000_eth.c waits 20 ms (20 * 1ms) in mdio_read.
bfin_mac.c waits 500 * 1us in mdio_poll. 
In both functions the last delay before the timeout is useless, like in 
new_emac. Not nice, but timeouts shouldn't occur anyway.

new emac probably doesn't wait long enough, but 20ms seems to be a bit too 
long.

Regards
Markus

^ permalink raw reply

* [PATCH] ibm_newemac: Increase MDIO timeouts
From: Benjamin Herrenschmidt @ 2008-04-23  5:17 UTC (permalink / raw)
  To: jgarzik; +Cc: super.firetwister, netdev, linuxppc-dev

This patch doubles the MDIO timeouts in EMAC as there are field
cases where they are two short to communicate with some PHYs.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---

 drivers/net/ibm_newemac/core.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

--- linux-work.orig/drivers/net/ibm_newemac/core.c	2008-04-23 15:11:16.000000000 +1000
+++ linux-work/drivers/net/ibm_newemac/core.c	2008-04-23 15:14:20.000000000 +1000
@@ -738,7 +738,7 @@ static int __emac_mdio_read(struct emac_
 		rgmii_get_mdio(dev->rgmii_dev, dev->rgmii_port);
 
 	/* Wait for management interface to become idle */
-	n = 10;
+	n = 20;
 	while (!emac_phy_done(dev, in_be32(&p->stacr))) {
 		udelay(1);
 		if (!--n) {
@@ -763,7 +763,7 @@ static int __emac_mdio_read(struct emac_
 	out_be32(&p->stacr, r);
 
 	/* Wait for read to complete */
-	n = 100;
+	n = 200;
 	while (!emac_phy_done(dev, (r = in_be32(&p->stacr)))) {
 		udelay(1);
 		if (!--n) {
@@ -810,7 +810,7 @@ static void __emac_mdio_write(struct ema
 		rgmii_get_mdio(dev->rgmii_dev, dev->rgmii_port);
 
 	/* Wait for management interface to be idle */
-	n = 10;
+	n = 20;
 	while (!emac_phy_done(dev, in_be32(&p->stacr))) {
 		udelay(1);
 		if (!--n) {
@@ -836,7 +836,7 @@ static void __emac_mdio_write(struct ema
 	out_be32(&p->stacr, r);
 
 	/* Wait for write to complete */
-	n = 100;
+	n = 200;
 	while (!emac_phy_done(dev, in_be32(&p->stacr))) {
 		udelay(1);
 		if (!--n) {

^ permalink raw reply

* Re: Phy read timeout in ibm_new_emac driver
From: Benjamin Herrenschmidt @ 2008-04-23  5:18 UTC (permalink / raw)
  To: Markus Brunner; +Cc: netdev, ppc-dev
In-Reply-To: <200804230706.32641.super.firetwister@gmail.com>


On Wed, 2008-04-23 at 07:06 +0200, Markus Brunner wrote:
> On Wednesday 16 April 2008, Benjamin Herrenschmidt wrote:
> 
> > Somebody knows off hand what the standard says the timeout should be ?
> 
> Anyone?
> 
> I didn't find any documentation on the standard, but I had a look at other 
> drivers. 
> au1000_eth.c waits 20 ms (20 * 1ms) in mdio_read.
> bfin_mac.c waits 500 * 1us in mdio_poll. 
> In both functions the last delay before the timeout is useless, like in 
> new_emac. Not nice, but timeouts shouldn't occur anyway.
> 
> new emac probably doesn't wait long enough, but 20ms seems to be a bit too 
> long.

I just send Jeff a patch doubling the timeouts.

Cheers,
Ben.

^ permalink raw reply

* Re: [PATCH 1/3 v3] Raise the upper limit of NR_CPUS.
From: Michael Ellerman @ 2008-04-23  5:41 UTC (permalink / raw)
  To: Tony Breeds; +Cc: linuxppc-dev, Paul Mackerras
In-Reply-To: <d54206d25b690c9160401f65a583f586004dcd5d.1208923391.git.tony@bakeyournoodle.com>

[-- Attachment #1: Type: text/plain, Size: 888 bytes --]

On Wed, 2008-04-23 at 14:06 +1000, Tony Breeds wrote:
> As the pacas are statically initialised increasing NR_CPUS beyond 128,
> means that any additional pacas will be empty  ... which is bad.
> 
> This patch adds the required functionality to fill in any excess pacas
> at runtime.
> 
> Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
> ---

You add about 30 lines of code in this patch, which you remove in patch
3, is there a better way to do it?

Is there any harm dynamically initialising the statically initialised
pacas, I think that would allow you to basically skip the
NR_STATIC_PACAS business.

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* Re: [PATCH 02/11] Add udbg_console_anytime() which sets udbg console to CON_ANYTIME
From: Michael Ellerman @ 2008-04-23  5:43 UTC (permalink / raw)
  To: benh; +Cc: linuxppc-dev
In-Reply-To: <1208506858.6958.404.camel@pasglop>

[-- Attachment #1: Type: text/plain, Size: 1279 bytes --]

On Fri, 2008-04-18 at 18:20 +1000, Benjamin Herrenschmidt wrote:
> On Fri, 2008-04-18 at 17:54 +1000, Michael Ellerman wrote:
> > In theory the udbg console should be safe to call basically at any time
> > after boot. It does not need any per-cpu resources or for the cpu to be
> > online, as long as there is a udbg_putc routine hooked up it should
> > work. So it should be able to be marked as CON_ANYTIME.
> > 
> > Verifying this will take a bit of time and testing though, so instead of
> > marking udbg console as CON_ANYTIME for all platforms, add a routine so
> > that a platform can opt-in to having udbg console called early.
> > 
> > Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
> 
> Nah, just stick it always.

Meh, OK. I'm still going to require the platform code to call
register_early_udbg_console() if it wants to register earlier than
setup_system() - so the behaviour will essentially be the same.

NB that if it breaks anything I can now say BenH told me to do it ;)

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* Re: [PATCH 04/11] Convert from DBG() to pr_debug() in platforms/pseries/setup.c
From: Michael Ellerman @ 2008-04-23  5:45 UTC (permalink / raw)
  To: Olof Johansson; +Cc: linuxppc-dev list
In-Reply-To: <20080422133120.GA8338@lixom.net>

[-- Attachment #1: Type: text/plain, Size: 787 bytes --]

On Tue, 2008-04-22 at 08:31 -0500, Olof Johansson wrote:
> On Fri, Apr 18, 2008 at 05:54:36PM +1000, Michael Ellerman wrote:
> > Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
> 
> I know it's fun to see yourself in the changeset statistics, but this is
> silly. Please bake together all the simple changes to one patch instead
> of one per file. They are all trivial.

Yeah that's totally what I was going for ...

Thanks for reading them at least, they're mostly trivial but many eyes
make light work.

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* Re: [PATCH 1/3] MSI driver for Freescale 83xx/85xx/86xx cpu
From: Michael Ellerman @ 2008-04-23  5:45 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: linuxppc-dev list, Kumar Gala, Jin Zhengxiong
In-Reply-To: <e642c15622ac3ca89a6a43f439f2c222@kernel.crashing.org>

[-- Attachment #1: Type: text/plain, Size: 795 bytes --]

On Tue, 2008-04-22 at 15:22 +0200, Segher Boessenkool wrote:
> >>>> +static void fsl_compose_msi_msg(struct pci_dev *pdev, int hwirq,
> >>>> +				  struct msi_msg *msg)
> 
> > No I mean I'm confused about the maths here. If we pull out the
> > variables it boils down to:
> >
> > data = ((hwirq / 32) << 5) | ((hwirq % 32) & 0x1F)
> >
> > Which doesn't seem to actually do anything?
> 
> It's not a no-op, because hwirq is signed.  It probably should be
> unsigned, like most things.

You'll have to draw me a picture.

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* Re: [PATCH 1/3 v3] Raise the upper limit of NR_CPUS.
From: Tony Breeds @ 2008-04-23  6:08 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev, Paul Mackerras
In-Reply-To: <1208929299.9212.4.camel@concordia.ozlabs.ibm.com>

On Wed, Apr 23, 2008 at 03:41:39PM +1000, Michael Ellerman wrote:
 
> You add about 30 lines of code in this patch, which you remove in patch
> 3, is there a better way to do it?
> 
> Is there any harm dynamically initialising the statically initialised
> pacas, I think that would allow you to basically skip the
> NR_STATIC_PACAS business.

Yes, I could make patch 2 the first in the series, and then roll batches
1 and 3 together.  As iSeries will barf I do all the PACAs dynamically
without that extra wait.

/me is too linear.

new version comming.

Yours Tony

  linux.conf.au    http://www.marchsouth.org/
  Jan 19 - 24 2009 The Australian Linux Technical Conference!

^ permalink raw reply

* Re: [PATCH] powerpc TLF_RESTORE_SIGMASK
From: Roland McGrath @ 2008-04-23  6:37 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev, akpm, linux-kernel
In-Reply-To: <18446.50037.964682.539009@cargo.ozlabs.ibm.com>

> Roland McGrath writes:
> 
> > This requires the earlier HAVE_SET_RESTORE_SIGMASK patch series.
> > This does the same for powerpc that I posted the x86 change for.
> 
> ...
> 
> > +static inline void set_restore_sigmask(void)
> > +{
> > +	struct thread_info *ti = current_thread_info();
> > +	ti->local_flags |= TLF_RESTORE_SIGMASK;
> 
> This should be _TLF_RESTORE_SIGMASK (leading '_'), I think.

Indeed so.  Here's a replacement patch.

Thanks,
Roland

---
[PATCH] powerpc TLF_RESTORE_SIGMASK

Replace TIF_RESTORE_SIGMASK with TLF_RESTORE_SIGMASK and define
our own set_restore_sigmask() function.  This saves the costly
SMP-safe set_bit operation, which we do not need for the sigmask
flag since TIF_SIGPENDING always has to be set too.

Signed-off-by: Roland McGrath <roland@redhat.com>
---
 arch/powerpc/kernel/entry_32.S    |    4 ++--
 arch/powerpc/kernel/signal.c      |   12 ++++++------
 arch/powerpc/kernel/signal_32.c   |    2 +-
 include/asm-powerpc/thread_info.h |   17 +++++++++++++----
 4 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index 84c8686..f056b3c 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -667,7 +667,7 @@ user_exc_return:		/* r10 contains MSR_KERNEL here */
 	/* Check current_thread_info()->flags */
 	rlwinm	r9,r1,0,0,(31-THREAD_SHIFT)
 	lwz	r9,TI_FLAGS(r9)
-	andi.	r0,r9,(_TIF_SIGPENDING|_TIF_RESTORE_SIGMASK|_TIF_NEED_RESCHED)
+	andi.	r0,r9,(_TIF_SIGPENDING|_TIF_NEED_RESCHED)
 	bne	do_work
 
 restore_user:
@@ -924,7 +924,7 @@ recheck:
 	lwz	r9,TI_FLAGS(r9)
 	andi.	r0,r9,_TIF_NEED_RESCHED
 	bne-	do_resched
-	andi.	r0,r9,_TIF_SIGPENDING|_TIF_RESTORE_SIGMASK
+	andi.	r0,r9,_TIF_SIGPENDING
 	beq	restore_user
 do_user_signal:			/* r10 contains MSR_KERNEL here */
 	ori	r10,r10,MSR_EE
diff --git a/arch/powerpc/kernel/signal.c b/arch/powerpc/kernel/signal.c
index a65a44f..ad55488 100644
--- a/arch/powerpc/kernel/signal.c
+++ b/arch/powerpc/kernel/signal.c
@@ -120,7 +120,7 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs)
 	int ret;
 	int is32 = is_32bit_task();
 
-	if (test_thread_flag(TIF_RESTORE_SIGMASK))
+	if (current_thread_info()->local_flags & _TLF_RESTORE_SIGMASK)
 		oldset = &current->saved_sigmask;
 	else if (!oldset)
 		oldset = &current->blocked;
@@ -131,9 +131,10 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs)
 	check_syscall_restart(regs, &ka, signr > 0);
 
 	if (signr <= 0) {
+		struct thread_info *ti = current_thread_info();
 		/* No signal to deliver -- put the saved sigmask back */
-		if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
-			clear_thread_flag(TIF_RESTORE_SIGMASK);
+		if (ti->local_flags & _TLF_RESTORE_SIGMASK) {
+			ti->local_flags &= ~_TLF_RESTORE_SIGMASK;
 			sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
 		}
 		return 0;               /* no signals delivered */
@@ -169,10 +170,9 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs)
 
 		/*
 		 * A signal was successfully delivered; the saved sigmask is in
-		 * its frame, and we can clear the TIF_RESTORE_SIGMASK flag.
+		 * its frame, and we can clear the TLF_RESTORE_SIGMASK flag.
 		 */
-		if (test_thread_flag(TIF_RESTORE_SIGMASK))
-			clear_thread_flag(TIF_RESTORE_SIGMASK);
+		current_thread_info()->local_flags &= ~_TLF_RESTORE_SIGMASK;
 	}
 
 	return ret;
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
index ad69434..4ae16d1 100644
--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
@@ -243,7 +243,7 @@ long sys_sigsuspend(old_sigset_t mask)
 
  	current->state = TASK_INTERRUPTIBLE;
  	schedule();
- 	set_thread_flag(TIF_RESTORE_SIGMASK);
+	set_restore_sigmask();
  	return -ERESTARTNOHAND;
 }
 
diff --git a/include/asm-powerpc/thread_info.h b/include/asm-powerpc/thread_info.h
index 40d5f98..07d5106 100644
--- a/include/asm-powerpc/thread_info.h
+++ b/include/asm-powerpc/thread_info.h
@@ -120,7 +120,6 @@ static inline struct thread_info *current_thread_info(void)
 #define TIF_SECCOMP		10	/* secure computing */
 #define TIF_RESTOREALL		11	/* Restore all regs (implies NOERROR) */
 #define TIF_NOERROR		12	/* Force successful syscall return */
-#define TIF_RESTORE_SIGMASK	13	/* Restore signal mask in do_signal */
 #define TIF_FREEZE		14	/* Freezing for suspend */
 #define TIF_RUNLATCH		15	/* Is the runlatch enabled? */
 #define TIF_ABI_PENDING		16	/* 32/64 bit switch needed */
@@ -138,21 +137,31 @@ static inline struct thread_info *current_thread_info(void)
 #define _TIF_SECCOMP		(1<<TIF_SECCOMP)
 #define _TIF_RESTOREALL		(1<<TIF_RESTOREALL)
 #define _TIF_NOERROR		(1<<TIF_NOERROR)
-#define _TIF_RESTORE_SIGMASK	(1<<TIF_RESTORE_SIGMASK)
 #define _TIF_FREEZE		(1<<TIF_FREEZE)
 #define _TIF_RUNLATCH		(1<<TIF_RUNLATCH)
 #define _TIF_ABI_PENDING	(1<<TIF_ABI_PENDING)
 #define _TIF_SYSCALL_T_OR_A	(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP)
 
-#define _TIF_USER_WORK_MASK	( _TIF_SIGPENDING | \
-				 _TIF_NEED_RESCHED | _TIF_RESTORE_SIGMASK)
+#define _TIF_USER_WORK_MASK	(_TIF_SIGPENDING | _TIF_NEED_RESCHED)
 #define _TIF_PERSYSCALL_MASK	(_TIF_RESTOREALL|_TIF_NOERROR)
 
 /* Bits in local_flags */
 /* Don't move TLF_NAPPING without adjusting the code in entry_32.S */
 #define TLF_NAPPING		0	/* idle thread enabled NAP mode */
+#define TLF_RESTORE_SIGMASK	1	/* Restore signal mask in do_signal */
 
 #define _TLF_NAPPING		(1 << TLF_NAPPING)
+#define _TLF_RESTORE_SIGMASK	(1 << TLF_RESTORE_SIGMASK)
+
+#ifndef __ASSEMBLY__
+#define HAVE_SET_RESTORE_SIGMASK	1
+static inline void set_restore_sigmask(void)
+{
+	struct thread_info *ti = current_thread_info();
+	ti->local_flags |= _TLF_RESTORE_SIGMASK;
+	set_bit(TIF_SIGPENDING, &ti->flags);
+}
+#endif	/* !__ASSEMBLY__ */
 
 #endif /* __KERNEL__ */
 

^ permalink raw reply related

* Re: SecretLab 2.6.24 with USB
From: Peter Korsgaard @ 2008-04-23  6:43 UTC (permalink / raw)
  To: aaronsells; +Cc: linuxppc-embedded
In-Reply-To: <16825460.post@talk.nabble.com>

>>>>> "aaronsells" == aaronsells  <aaron.sells@zin-tech.com> writes:

Hi,

 aaronsells> I've tried this on my ML403 board with no success.  My
 aaronsells> Xilinx git tree is current.  I'm using Peter's most
 aaronsells> recent patches from
 aaronsells> http://peter.korsgaard.com/patches/linux/. I'm using an
 aaronsells> OpenEmbedded console-image mounted via nfs as my root
 aaronsells> filesystem.  I don't receive any messages when I plug USB
 aaronsells> devices into the board (keyboard, mouse, webcam).  Any
 aaronsells> ideas on how I can troubleshoot this?

Did you register a struct platform_device for the c67x00?

-- 
Bye, Peter Korsgaard

^ permalink raw reply

* Re: [PATCH v3] powerpc: Add irqtrace support for 32-bit powerpc
From: Johannes Berg @ 2008-04-23  6:33 UTC (permalink / raw)
  To: benh; +Cc: linuxppc-dev
In-Reply-To: <1208925639.9060.16.camel@pasglop>

[-- Attachment #1: Type: text/plain, Size: 529 bytes --]

On Wed, 2008-04-23 at 14:40 +1000, Benjamin Herrenschmidt wrote:

> > Hmm. Bad news. I got a crash in console_callback() again where
> > apparently r28 had a bogus value. That, however, doesn't make sense, so
> > maybe that register value was calculated from another register.
> 
> Possibly. How hard was it to reproduce ? 

It just happened after maybe half an hour or an hour uptime.

> Could it be a bug unrelated to lockdep ?

Unlikely, I've been running the same kernel for days without that patch.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

^ permalink raw reply

* Re: Question on MPC83xx interrupts
From: André Schwarz @ 2008-04-23  7:54 UTC (permalink / raw)
  To: michael; +Cc: Scott Wood, linux-ppc list
In-Reply-To: <1208905031.6947.0.camel@concordia>

Michael Ellerman schrieb:
> On Tue, 2008-04-22 at 12:23 -0500, Scott Wood wrote:
>> On Tue, Apr 22, 2008 at 06:58:33PM +0200, Andre Schwarz wrote:
>>> I wonder if the IRQ number should match the vector of the datasheet .=
..=20
>>> giving :
>> No.  The numbers in /proc/interrupts are virtual IRQ numbers, which ar=
e a
>> purely Linux-internal construct.
>=20
> You can see the mapping between virq and hwirq numbers by turning on
> CONFIG_VIRQ_DEBUG and looking in /sys/kernel/debug/powerpc/virq_mapping
> (after mounting debugfs).
>=20
> cheers
>=20

Ahhh - thanks Michael !

very useful ...



Cheers,
Andr=E9

MATRIX VISION GmbH, Talstra=DFe 16, DE-71570 Oppenweiler  - Registergeric=
ht: Amtsgericht Stuttgart, HRB 271090
Gesch=E4ftsf=FChrer: Gerhard Thullner, Werner Armingeon, Uwe Furtner

^ permalink raw reply

* new warnings from stacktrace patch
From: Stephen Rothwell @ 2008-04-23  7:59 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: Christoph Hellwig, ppc-dev

[-- Attachment #1: Type: text/plain, Size: 1368 bytes --]

Hi all,

Linus' kernel today produces these warnings for an allyesconfig build:
(it was actually a linux-next build, but the commit is in Linus' tree)

In file included from arch/powerpc/kernel/stacktrace.c:16:
include/asm/asm-offsets.h:113:1: warning: "CLONE_VM" redefined
In file included from arch/powerpc/kernel/stacktrace.c:13:
include/linux/sched.h:8:1: warning: this is the location of the previous definition
In file included from arch/powerpc/kernel/stacktrace.c:16:
include/asm/asm-offsets.h:114:1: warning: "CLONE_UNTRACED" redefined
In file included from arch/powerpc/kernel/stacktrace.c:13:
include/linux/sched.h:22:1: warning: this is the location of the previous definition
In file included from arch/powerpc/kernel/stacktrace.c:16:
include/asm/asm-offsets.h:151:1: warning: "NSEC_PER_SEC" redefined
In file included from include/linux/timex.h:57,
                 from include/linux/sched.h:54,
                 from arch/powerpc/kernel/stacktrace.c:13:
include/linux/time.h:37:1: warning: this is the location of the previous definition

This is from commit fd3e0bbc6052ca9747a5332b382584ece83aab6d ("[POWERPC]
Stacktrace support for lockdep").  We don't include asm-offsets.h in any
other C file in the powerpc build.

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* Re: [BUG] 2.6.25-rc2-git4 - Regression Kernel oops  while running kernbench and tbench on powerpc
From: Paul Mackerras @ 2008-04-23  8:16 UTC (permalink / raw)
  To: Kamalesh Babulal
  Cc: kernel list, linuxppc-dev, linux-next, nacc, Andrew Morton,
	Balbir Singh
In-Reply-To: <48035C03.10104@linux.vnet.ibm.com>

Kamalesh Babulal writes:

> After applying the patch above and the patch posted on
> http://lkml.org/lkml/2008/4/8/42
> the bug had the following information,

Thanks.  The patch below, against Linus' current git tree, fixes one
bug that might be the cause of the problem, and also attempts to
detect the erroneous situation earlier and fix it up, and also print
some debug information.  Please try to reproduce the problem with this
patch applied, and if there are any console log messages starting with
SLB: or FWNMI:, please send me the console log.

Paul.

diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index c0db5b7..f7f0962 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -439,6 +439,19 @@ END_FTR_SECTION_IFSET(CPU_FTR_1T_SEGMENT)
 	mr	r1,r8		/* start using new stack pointer */
 	std	r7,PACAKSAVE(r13)
 
+	/* check that SLB entry 2 contains the right thing */
+	clrrdi	r6,r1,28
+	clrldi.	r0,r6,2
+	beq	3f
+	li	r0,2
+	slbmfee	r7,r0
+	oris	r6,r6,SLB_ESID_V@h
+	cmpd	r6,r7
+	beq	3f
+	bl	bad_slb_switch
+	ld	r3,PACACURRENT(r13)
+	addi	r3,r3,THREAD
+3:
 	ld	r6,_CCR(r1)
 	mtcrf	0xFF,r6
 
@@ -540,6 +553,19 @@ END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES)
 	ld	r4,_XER(r1)
 	mtspr	SPRN_XER,r4
 
+	/* check that SLB entry 2 contains the right thing */
+	clrrdi	r6,r1,28	/* stack ESID */
+	clrldi.	r0,r6,2
+	beq	57f
+	li	r0,2
+	slbmfee	r7,r0
+	oris	r6,r6,SLB_ESID_V@h
+	cmpd	r6,r7
+	beq	57f
+	addi	r3,r1,STACK_FRAME_OVERHEAD
+	bl	bad_slb_exc
+	ld	r3,_MSR(r1)
+57:
 	REST_8GPRS(5, r1)
 
 	andi.	r0,r3,MSR_RI
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index be35ffa..c938134 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -45,6 +45,7 @@
 #include <asm/system.h>
 #include <asm/mpic.h>
 #include <asm/vdso_datapage.h>
+#include <asm/mmu.h>
 #ifdef CONFIG_PPC64
 #include <asm/paca.h>
 #endif
@@ -580,6 +581,10 @@ int __devinit start_secondary(void *unused)
 	atomic_inc(&init_mm.mm_count);
 	current->active_mm = &init_mm;
 
+	/* Bolt in the entry for the kernel stack now */
+	if (cpu_has_feature(CPU_FTR_SLB))
+		slb_flush_and_rebolt();
+
 	smp_store_cpu_info(cpu);
 	set_dec(tb_ticks_per_jiffy);
 	preempt_disable();
diff --git a/arch/powerpc/mm/slb.c b/arch/powerpc/mm/slb.c
index 906daed..bb7765b 100644
--- a/arch/powerpc/mm/slb.c
+++ b/arch/powerpc/mm/slb.c
@@ -309,3 +309,34 @@ void slb_initialize(void)
 	 * one. */
 	asm volatile("isync":::"memory");
 }
+
+static void dump_slb(void)
+{
+	long entry;
+	unsigned long esid, vsid;
+
+	printk(KERN_EMERG "SLB contents now:\n");
+	for (entry = 0; entry < 64; ++entry) {
+		asm volatile("slbmfee  %0,%1" : "=r" (esid) : "r" (entry));
+		if (esid == 0)
+			/* valid bit is clear along with everything else */
+			continue;
+		asm volatile("slbmfev  %0,%1" : "=r" (vsid) : "r" (entry));
+		printk(KERN_EMERG "%d: %.16lx %.16lx\n", entry, esid, vsid);
+	}
+}
+
+void bad_slb_exc(struct pt_regs *regs)
+{
+	printk(KERN_EMERG "SLB: stack not bolted on exception return\n");
+	dump_slb();
+	slb_flush_and_rebolt();
+	show_regs(regs);
+}
+
+void bad_slb_switch(void)
+{
+	printk(KERN_EMERG "SLB: stack not bolted on context switch\n");
+	dump_slb();
+	slb_flush_and_rebolt();
+}
diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c
index a1ab25c..ed68083 100644
--- a/arch/powerpc/platforms/pseries/ras.c
+++ b/arch/powerpc/platforms/pseries/ras.c
@@ -325,6 +325,8 @@ static int recover_mce(struct pt_regs *regs, struct rtas_error_log * err)
 
 	if (err->disposition == RTAS_DISP_FULLY_RECOVERED) {
 		/* Platform corrected itself */
+		printk(KERN_ALERT "FWNMI: platform corrected error %.16lx\n",
+		       *(unsigned long *)err);
 		nonfatal = 1;
 	} else if ((regs->msr & MSR_RI) &&
 		   user_mode(regs) &&

^ permalink raw reply related

* mpc8379e rdb nand flash support
From: ??? @ 2008-04-23  7:47 UTC (permalink / raw)
  To: linuxppc-embedded
In-Reply-To: <mailman.2018.1208895004.11702.linuxppc-embedded@ozlabs.org>

RGVhciBhbGw6DQogICAgRGlkIGFueW9uZSB1c2UgbXBjODM3OWVyZGIgYm9hcmQ/ICBJIGNoYW5n
ZWQgbmFuZCBmbGFzaCBmcm9tIHNhbXN1bmcgMzJNIHRvIGh5bml4IDFHIGJ5dGUuQW5kIHRoZSAx
RyBieXRlIG5hbmQncyBlcmFzZSBibG9jayBzaXplIGlzIDI1NktCLg0KICAgIE5vdyB0aGUgcHJv
YmxlbSBpczogd2hlbiBJIHVzZSAiIG5hbmQgd3JpdGUuamZmczIiIGNvbW1hbmQgdG8gd3JpdGUg
amZmczIgZmlsZXN5c3RlbXMgdG8gbmFuZCBmbGFzaCAsdGhlcmUgaXMgb25seSAxMjhLQnl0ZSBv
ZiBldmVyeSBlcmFzZSBibG9ja3MgY2FuIGJlIHdyaXRlZC4NCiAgICBGcm9tIHRoZSBkYXRhc2hl
ZXQgb2YgdGhlIG1wYzgzNzllICwiUGFnZSBzaXplIG9mIDIwNDggbWFpbiBhcmVhIGJ5dGVzIHBs
dXMgNjQgc3BhcmUgYXJlYSBieXRlcyAobGFyZ2UgcGFnZSBkZXZpY2VzKTsNCkZDTSBSQU0gYnVm
ZmVycyBhcmUgNCBLYnl0ZXMgZWFjaDsgRmxhc2ggYmxvY2sgc2l6ZSBvZiAxMjggS2J5dGVzLiIN
CiAgICBJcyBpdCBtZWFucyBtcGM4Mzc5ZSBvbmx5IHN1cHBvcnQgMTI4S2J5dGVzIGJsb2NrIHNp
emU/DQogICAgSGVyZSBpcyB0aGUgaW5mb3JtYXRpb24gd2hlbiBJIHRyaWVkIHRvIHdyaXRlIGl0
IDoNCg0KLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8v
Ly8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLw0KICAgIEVob21l
dGVjaCMgbmFuZCBlcmFzZSANCiAgICBOQU5EIGVyYXNlOiBkZXZpY2UgMCB3aG9sZSBjaGlwDQog
ICAgRXJhc2luZyBhdCAweDNmZmMwMDAwIC0tIDEwMCUgY29tcGxldGUuDQogICAgT0sNCiAgICBF
aG9tZXRlY2gjIG5hbmQgZGV2aWNlDQogICAgRGV2aWNlIDA6IE5BTkQgMUdpQiAzLDNWIDgtYml0
DQogICAgRWhvbWV0ZWNoIyBuYW5kIGluZm8NCiAgICBEZXZpY2UgMDogTkFORCAxR2lCIDMsM1Yg
OC1iaXQsIHNlY3RvciBzaXplIDI1NiBLaUINCiAgICBFaG9tZXRlY2gjIG5hbmQgd3JpdGUuamZm
czIgMTAwMDAwMCAwIDk5YjM1Yw0KICAgIE5BTkQgd3JpdGU6IGRldmljZSAwIG9mZnNldCAweDAs
IHNpemUgMHg5OWIzNWMNCiAgICBXcml0aW5nIGRhdGEgYXQgMHgxODgwMCAtLSAgIDElIGNvbXBs
ZXRlLndyaXRpbmcgTkFORCBwYWdlIGF0IG9mZnNldCAweDIwMDAwIGZhaWxlZA0KICAgIERhdGEg
ZGlkIG5vdCBmaXQgaW50byBkZXZpY2UsIGR1ZSB0byBiYWQgYmxvY2tzDQogICAgMTAwNzI5MjQg
Ynl0ZXMgd3JpdHRlbjogRVJST1INCiAgICBFaG9tZXRlY2gjIG5hbmQgYmFkDQogICAgRGV2aWNl
IDAgYmFkIGJsb2NrczoNCiAgICBFaG9tZXRlY2gjIG5hbmQgd3JpdGUuamZmczIgMTAwMDAwMCA0
MDAwMCA5OWIzNWMNCiAgICBOQU5EIHdyaXRlOiBkZXZpY2UgMCBvZmZzZXQgMHg0MDAwMCwgc2l6
ZSAweDk5YjM1Yw0KICAgIFdyaXRpbmcgZGF0YSBhdCAweDU4ODAwIC0tICAgMSUgY29tcGxldGUu
d3JpdGluZyBOQU5EIHBhZ2UgYXQgb2Zmc2V0IDB4NjAwMDAgZmFpbGVkDQogICAgRGF0YSBkaWQg
bm90IGZpdCBpbnRvIGRldmljZSwgZHVlIHRvIGJhZCBibG9ja3MNCiAgICAxMDA3MjkyNCBieXRl
cyB3cml0dGVuOiBFUlJPUg0KICAgIEVob21ldGVjaCMgbmFuZCB3cml0ZS5qZmZzMiAxMDAwMDAw
IDEwMDAwMCA5OWIzNWMNCiAgICBOQU5EIHdyaXRlOiBkZXZpY2UgMCBvZmZzZXQgMHgxMDAwMDAs
IHNpemUgMHg5OWIzNWMNCiAgICBXcml0aW5nIGRhdGEgYXQgMHgxMTg4MDAgLS0gICAxJSBjb21w
bGV0ZS53cml0aW5nIE5BTkQgcGFnZSBhdCBvZmZzZXQgMHgxMjAwMDAgZmFpbGVkDQogICAgRGF0
YSBkaWQgbm90IGZpdCBpbnRvIGRldmljZSwgZHVlIHRvIGJhZCBibG9ja3MNCiAgICAxMDA3Mjky
NCBieXRlcyB3cml0dGVuOiBFUlJPUg0KDQovLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8v
Ly8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8v
Ly8vDQogICAgQmVzdCBXaXNoZXMhDQogICAgMjAwOC00LTIzIA==

^ permalink raw reply

* Re: [RFC POWERPC] booting-without-of: bindings for FHCI USB, GPIO LEDs, MCU, and NAND on UPM
From: Laurent Pinchart @ 2008-04-23  9:15 UTC (permalink / raw)
  To: linuxppc-dev, avorontsov
In-Reply-To: <20080422194135.GA27822@polina.dev.rtsoft.ru>

[-- Attachment #1: Type: text/plain, Size: 4375 bytes --]

Hi Anton,

On Tuesday 22 April 2008 21:41, Anton Vorontsov wrote:
> Hi all,
> 
> Here is purposed bindings draft for the new drivers that I would like to
> send for this or next merge window, depending on results of this RFC. ;-)
> (The new bindings needs to be in-tree or at least Acked before I could
> send the drivers.)
> 
> Comments and suggestions are highly appreciated.
> 
> Thanks.
> 
> diff --git a/Documentation/powerpc/booting-without-of.txt 
b/Documentation/powerpc/booting-without-of.txt
> index c350623..38fe3e9 100644
> --- a/Documentation/powerpc/booting-without-of.txt
> +++ b/Documentation/powerpc/booting-without-of.txt
> @@ -59,6 +59,11 @@ Table of Contents
>        p) Freescale Synchronous Serial Interface
>        q) USB EHCI controllers
>        r) Freescale General-purpose Timers Module
> +      s) Freescale USB Parameter RAM:
> +      t) Freescale QUICC Engine USB Controller
> +      u) LEDs on GPIOs
> +      v) Freescale MCU with MPC8349E-mITX compatible firmware
> +      w) NAND on UPM-driven Freescale Localbus
>  
>    VII - Marvell Discovery mv64[345]6x System Controller chips
>      1) The /system-controller node
> @@ -2866,6 +2871,139 @@ platforms are moved over to use the 
flattened-device-tree model.
>      	clock-frequency = <0>;
>      };
>  
> +    s) Freescale USB Parameter RAM:
> +
> +    Required properties:
> +      - compatible : should be "fsl,<chip>-qe-muram-usb-pram",
> +        "fsl,qe-muram-usb-pram", "fsl,cpm-muram-usb-pram".
> +      - reg : should contain USB PRAM location and length.
> +
> +    Example:
> +
> +	usb-pram@8b00 {
> +		compatible = "fsl,mpc8360-qe-muram-usb-pram",
> +			     "fsl,qe-muram-usb-pram",
> +			     "fsl,cpm-muram-usb-pram";
> +		reg = <0x8b00 0x100>;
> +	};
> +
> +    t) Freescale QUICC Engine USB Controller
> +
> +    Required properties:
> +      - compatible : should be "fsl,<chip>-qe-usb", "fsl,qe-usb",
> +        "fsl,usb-fhci"
> +      - reg : should contain gtm registers location and length.
> +      - interrupts : should contain USB interrupt.
> +      - interrupt-parent : interrupt source phandle.
> +      - fsl,fullspeed-clock : specifies the full speed USB clock source.
> +      - fsl,lowspeed-clock : specifies the low speed USB clock source.
> +      - fsl,usb-mode : should be "host".
> +      - linux,hub-power-budget : optional, USB power budget for the root 
hub
> +        in mA.
> +      - gpios : should specify GPIOs in this order: USBOE, USBTP, USBTN, 
USBRP,
> +        USBRN, SPEED (optional), and SUSPEND (optional).

Suspend should in my opinion be renamed power (or bus power or anything 
similar), as it controls the USB power and not USB PHY sleep mode.

> +    Example:
> +
> +	usb@6c0 {
> +		compatible = "fsl,mpc8360-qe-usb", "fsl,qe-usb",
> +			     "fsl,usb-fhci";
> +		reg = <0x6c0 0x40>;
> +		interrupts = <11>;
> +		interrupt-parent = <&qeic>;
> +		fsl,fullspeed-clock = "clk21";
> +		fsl,usb-mode = "host";
> +		gpios = <&qe_pio_b  2 0 /* USBOE */
> +			 &qe_pio_b  3 0 /* USBTP */
> +			 &qe_pio_b  8 0 /* USBTN */
> +			 &qe_pio_b  9 0 /* USBRP */
> +			 &qe_pio_b 11 0 /* USBRN */
> +			 &qe_pio_e 20 0 /* SPEED */
> +			 &qe_pio_e 21 0 /* SUSPN */>;
> +	};
> +
> +    u) LEDs on GPIOs
> +
> +    Required properties:
> +      - compatible : should be "linux,gpio-led".
> +      - linux,name : LED name.
> +      - linux,active-low : property should be present if LED wired as
> +        active-low.

Just thinking out loud, wasn't the third GPIO cell supposed to be used to 
encode such properties ?

> +      - linux,default-trigger : Linux default trigger for this LED.
> +      - linux,brightness : default brightness.
> +      - gpios : should specify LED GPIO.
> +
> +    Example:
> +
> +	led@0 {
> +		compatible = "linux,gpio-led";
> +		linux,name = "pwr";
> +		linux,brightness = <1>;
> +		linux,active-low;
> +		gpios = <&mcu_pio 0>;
> +	};
> +
> +	led@1 {
> +	        compatible = "linux,gpio-led";
> +	        linux,name = "hdd";
> +	        linux,default-trigger = "ide-disk";
> +		linux,active-low;
> +		gpios = <&mcu_pio 1>;
> +	};

[snip]

-- 
Laurent Pinchart
CSE Semaphore Belgium

Chaussee de Bruxelles, 732A
B-1410 Waterloo
Belgium

T +32 (2) 387 42 59
F +32 (2) 387 42 75

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* Re: [Linux-fbdev-devel] [PATCH 1/3] radeonfb: Fix 64 bits resources on 32 bits archs
From: Michel Dänzer @ 2008-04-23  9:32 UTC (permalink / raw)
  To: benh
  Cc: linux-fbdev-devel, Hollis Blanchard, adaplas, linux-kernel,
	linuxppc-dev, Andrew Morton, Detlev Zundel
In-Reply-To: <1208902903.9640.138.camel@pasglop>

On Wed, 2008-04-23 at 08:21 +1000, Benjamin Herrenschmidt wrote:
> On Tue, 2008-04-22 at 17:55 +0200, Christian Ehrhardt wrote:
> > I wanted to ask if there are any known workarounds atm that would
> > allow me to use my X11 for now?
> 
> X is doing a mmap of /dev/mem instead of /dev/fb ?
> 
> You can normally map the fb mapping /dev/fb and then map the registers
> using /dev/fb at an offset beyond the framebuffer (fix->smem_len).
> 
> If X is using /dev/mem instead, then it's being stupid and needs to be
> fixed...

It's up to the driver, and again, the current radeon driver doesn't use
radeonfb at all anymore...


-- 
Earthling Michel Dänzer           |          http://tungstengraphics.com
Libre software enthusiast         |          Debian, X and DRI developer

^ permalink raw reply

* Re: [Linux-fbdev-devel] [PATCH 1/3] radeonfb: Fix 64 bits resources on 32 bits archs
From: Benjamin Herrenschmidt @ 2008-04-23  9:40 UTC (permalink / raw)
  To: Michel Dänzer
  Cc: linux-fbdev-devel, Hollis Blanchard, adaplas, linux-kernel,
	linuxppc-dev, Andrew Morton, Detlev Zundel
In-Reply-To: <1208943127.5632.324.camel@thor.sulgenrain.local>


On Wed, 2008-04-23 at 11:32 +0200, Michel Dänzer wrote:
> > X is doing a mmap of /dev/mem instead of /dev/fb ?
> > 
> > You can normally map the fb mapping /dev/fb and then map the
> registers
> > using /dev/fb at an offset beyond the framebuffer (fix->smem_len).
> > 
> > If X is using /dev/mem instead, then it's being stupid and needs to
> be
> > fixed...
> 
> It's up to the driver, and again, the current radeon driver doesn't
> use
> radeonfb at all anymore...

Right. And I'm happy to go fix what remains, don't get me wrong here :-)
We all know how stupid legacy code can be !

I'll try to get some patches to expose a new version of the structure
sometimes in the upcoming week or two (we'll see what time permits) and
then see about fixing X drivers that need fixing, though hopefully with
pci-rework being upstream now, that shouldn't be many.

The main issue is directfb. I hope they'll catch up with the new ioctls.

Ben.

^ permalink raw reply

* [2.6 patch] drivers/of/of_i2c.c: add MODULE_LICENSE
From: Adrian Bunk @ 2008-04-23  9:51 UTC (permalink / raw)
  To: Jochen Friedrich, Paul Mackerras; +Cc: linuxppc-dev, linux-kernel

After commit 585468e5d5962660867c269e26f0a4b89a599473
([POWERPC] i2c: Fix build breakage introduced by OF helpers)
drivers/of/of_i2c.c needs a MODULE_LICENSE.

Signed-off-by: Adrian Bunk <bunk@kernel.org>

---

 drivers/of/of_i2c.c |    3 +++
 1 file changed, 3 insertions(+)

946ca8103416a313577b0b9d52d30541fe7eef85 diff --git a/drivers/of/of_i2c.c b/drivers/of/of_i2c.c
index 6316891..715a444 100644
--- a/drivers/of/of_i2c.c
+++ b/drivers/of/of_i2c.c
@@ -13,6 +13,7 @@
 
 #include <linux/i2c.h>
 #include <linux/of.h>
+#include <linux/module.h>
 
 struct i2c_driver_device {
 	char    *of_device;
@@ -113,3 +114,5 @@ void of_register_i2c_devices(struct i2c_adapter *adap,
 	}
 }
 EXPORT_SYMBOL(of_register_i2c_devices);
+
+MODULE_LICENSE("GPL");

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox