Subject: Re: [PATCH 8/8] powerpc: last bits to support kdump on ppc32

From: Michael Ellerman <[email-masked]>
Date: Mon, 04 Aug 2008 00:40:43 +1000

On Fri, 2008-08-01 at 18:14 +0400, Anton Vorontsov wrote:
> From: Dale Farnsworth <[email-masked]>
> 
> Wire up the trampoline code for ppc32 to relay exceptions from the
> vectors at address 0 to vectors at address 32MB, and modify Kconfig
> to enable Kdump support for all powerpcs (except BookE, for now).
> 
> Signed-off-by: Dale Farnsworth <[email-masked]>
> Signed-off-by: Anton Vorontsov <[email-masked]>

> diff --git a/arch/powerpc/kernel/crash_dump.c b/arch/powerpc/kernel/crash_dump.c
> index e0debcc..96cd521 100644
> --- a/arch/powerpc/kernel/crash_dump.c
> +++ b/arch/powerpc/kernel/crash_dump.c
> @@ -34,7 +34,11 @@ void __init reserve_kdump_trampoline(void)
>  
>  static void __init create_trampoline(unsigned long addr)
>  {
> -	unsigned int *p = (unsigned int *)addr;
> +	unsigned int *p;
> +
> +	/* XXX: why this code is working without += PAGE_OFFSET on PPC64? */
> +	addr += PAGE_OFFSET;
> +	p = (unsigned int *)addr;

Because we're still in real mode when we call it.

It's kind of funny that it works on 32-bit as well. You're creating a
branch from 0xc0000000 to 0xc2000000, and then expecting it to work when
you're in real mode and you actually want to jump from 0x0 to 0x2000000
- luckily it's a relative branch :)

To clean this up you should just be able to change the definitions for
KDUMP_TRAMPOLINE_START/END to include PAGE_OFFSET and that should work
for 32 & 64-bit.

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