public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Marco Stornelli <marco.stornelli@coritel•it>
To: Simon Kagstrom <simon.kagstrom@ericsson•com>
Cc: "linuxppc-embedded@ozlabs•org" <linuxppc-embedded@ozlabs•org>
Subject: Re: Kexec on arch powerpc, device trees
Date: Wed, 23 Jul 2008 13:59:52 +0200	[thread overview]
Message-ID: <48871D38.5030600@coritel.it> (raw)
In-Reply-To: <20080723114848.0e2d1a73@seasc0532.dyn.rnd.as.sw.ericsson.se>

Simon Kagstrom ha scritto:
> Hi!
> 
> I'm looking a bit at adding kexec support for our mpc8347-based board
> running a 2.6.21 kernel. Since the board isn't a "PPC_MULTIPLATFORM"
> one, I did a quick patch to the Kconfig file to allow enabling Kexec
> for our own board. The patch below then adds the kexec machine
> callbacks for our board, and this is enough to build.
> 
> I ran into two problems though: First, /proc/iomem did not contain any
> "System RAM", so the kexec userspace tool ended up without any usable
> memory regions and fails because of that. I thought this would be
> handled by the device tree support, where we have a node for the memory:
> 
> 	memory {
> 		device_type = "memory";
> 		reg = <00000000 20000000>;
> 	};
> 
> but apparently it isn't. Anyway, the add_ram_region_iomem() function
> adds a "System RAM" region for all "memory" nodes in the device tree.
> 
> 
> However, even after this kexec still fails:
> 
>    bash-3.1# /kexec -l /vmlinux
>    Invalid memory segment 0xc0000000 - 0xc0304fff
> 
> this time because the "System RAM" is really 0x00000000-0x20000000. If
> I use the --gamecube=1 option, kexec will load the kernel, but when
> trying to start it the board will just crash:
> 
>    bash-3.1# /kexec -e -d
>    [ 1579.005719] Starting new kernel
>    <end up in U-boot here>
> 
> So some questions: Is the --gamecube=1 option really meant to be used
> without a gamecube and should the first version really fail? Is the
> "System RAM" usage correct? Are there any similar freescale-based
> boards which have kexec support?
> 
> // Simon
> 
> Index: linux-2.6.21-standard/arch/powerpc/platforms/83xx/cmxb.c
> ===================================================================
> --- linux-2.6.21-standard.orig/arch/powerpc/platforms/83xx/cmxb.c
> +++ linux-2.6.21-standard/arch/powerpc/platforms/83xx/cmxb.c
> @@ -23,6 +23,7 @@
>  #include <linux/delay.h>
>  #include <linux/seq_file.h>
>  #include <linux/root_dev.h>
> +#include <linux/bootmem.h>
>  
>  #include <asm/system.h>
>  #include <asm/atomic.h>
> @@ -35,6 +36,7 @@
>  #include <asm/prom.h>
>  #include <asm/udbg.h>
>  #include <sysdev/fsl_soc.h>
> +#include <linux/kexec.h>
>  
>  #include "mpc83xx.h"
>  #include "cmxb.h"
> @@ -44,6 +46,31 @@ unsigned long isa_io_base = 0;
>  unsigned long isa_mem_base = 0;
>  #endif
>  
> +
> +static void add_ram_region_iomem(void)
> +{
> +	struct device_node *np;
> +	struct resource *res;
> +	struct resource of_resource;
> +
> +	for (np = NULL; (np = of_find_node_by_type(np, "memory")) != NULL;) {
> +                if (of_address_to_resource(np, 0, &of_resource)) {
> +                        printk(KERN_ERR "Could not convert memory node to resource\n");
> +                        of_node_put(np);
> +                        return;
> +                }
> +		res = alloc_bootmem(sizeof(struct resource));
> +
> +		res->name = "System RAM";
> +		res->start = of_resource.start;
> +		res->end = of_resource.end;
> +		res->flags = of_resource.flags;
> +		request_resource(&iomem_resource, res);
> +                of_node_put(np);
> +	}
> +}
> +
> +
>  /* ************************************************************************
>   *
>   * Setup the architecture
> @@ -62,6 +89,7 @@ static void __init cmxb_setup_arch(void)
>  
>  	ppc_md.pci_exclude_device = mpc83xx_exclude_device;
>  #endif
> +        add_ram_region_iomem();
>  }
>  
>  static void __init cmxb_init_IRQ(void)
> @@ -100,4 +128,9 @@ define_machine(cmxb) {
>  	.time_init		= mpc83xx_time_init,
>  	.calibrate_decr		= generic_calibrate_decr,
>  	.progress		= udbg_progress,
> +#ifdef CONFIG_KEXEC
> +	.machine_kexec		= default_machine_kexec,
> +	.machine_kexec_prepare	= default_machine_kexec_prepare,
> +	.machine_crash_shutdown	= default_machine_crash_shutdown,
> +#endif
>  };
> _______________________________________________
> Linuxppc-embedded mailing list
> Linuxppc-embedded@ozlabs•org
> https://ozlabs.org/mailman/listinfo/linuxppc-embedded
> 
Hi mate,

I think currently there's support for the kexec on 85xx.

Regards,

-- 
Marco Stornelli
Embedded Software Engineer
CoRiTeL - Consorzio di Ricerca sulle Telecomunicazioni
http://www.coritel.it

marco.stornelli@coritel•it
+39 06 72582838

      reply	other threads:[~2008-07-23 11:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-23  9:48 Kexec on arch powerpc, device trees Simon Kagstrom
2008-07-23 11:59 ` Marco Stornelli [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48871D38.5030600@coritel.it \
    --to=marco.stornelli@coritel$(echo .)it \
    --cc=linuxppc-embedded@ozlabs$(echo .)org \
    --cc=simon.kagstrom@ericsson$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox