[PATCH v3 1/3] [POWERPC] Move to runtime allocated exception stacks

Josh Boyer jwboyer at linux.vnet.ibm.com
Tue May 20 07:08:45 EST 2008


On Fri, 16 May 2008 14:04:54 -0500 (CDT)
Kumar Gala <galak at kernel.crashing.org> wrote:

> For the additonal exception levels (critical, debug, machine check) on
> 40x/book-e we were using "static" allocations of the stack in the
> associated head.S.
> 
> Move to a runtime allocation to make the code a bit easier to read as
> we mimic how we handle IRQ stacks.  Its also a bit easier to setup the
> stack with a "dummy" thread_info in C code.
> 
> Signed-off-by: Kumar Gala <galak at kernel.crashing.org>
> ---
>  arch/powerpc/kernel/head_40x.S       |   14 ++------------
>  arch/powerpc/kernel/head_44x.S       |    9 ---------
>  arch/powerpc/kernel/head_booke.h     |   29 +++++++++++------------------
>  arch/powerpc/kernel/head_fsl_booke.S |    9 ---------
>  arch/powerpc/kernel/irq.c            |   33 +++++++++++++++++++++++++++++++++
>  arch/powerpc/kernel/setup_32.c       |   24 ++++++++++++++++++++++++
>  include/asm-powerpc/irq.h            |   13 +++++++++++++
>  7 files changed, 83 insertions(+), 48 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/head_40x.S b/arch/powerpc/kernel/head_40x.S
> index 8552e67..ca75eaf 100644
> --- a/arch/powerpc/kernel/head_40x.S
> +++ b/arch/powerpc/kernel/head_40x.S
> @@ -148,8 +148,8 @@ _ENTRY(crit_r11)
>  	mfcr	r10;			/* save CR in r10 for now	   */\
>  	mfspr	r11,SPRN_SRR3;		/* check whether user or kernel    */\
>  	andi.	r11,r11,MSR_PR;						     \
> -	lis	r11,critical_stack_top at h;				     \
> -	ori	r11,r11,critical_stack_top at l;				     \
> +	lis	r11,critirq_ctx at ha;					     \

You need a:

	tophys(r11,r11); \

here.  That fixes the hangs I see on my Walnut (PPC405GP) board when
using gdb.  The problem is that we're in real mode at this point, but
using the virtual address of critirq_ctx.  That seems to be a bad idea
when trying to load values out of it... ;)

> +	lwz	r11,critirq_ctx at l(r11);					     \
>  	beq	1f;							     \
>  	/* COMING FROM USER MODE */					     \
>  	mfspr	r11,SPRN_SPRG3;		/* if from user, start at top of   */\

josh



More information about the Linuxppc-dev mailing list