Patchwork [1/3] target-arm: Setup smpboot code in all setups

login
register
mail settings
Submitter Adam Lackorzynski
Date Feb. 15, 2011, 1:12 p.m.
Message ID <20110215131245.GE19666@os.inf.tu-dresden.de>
Download mbox | patch
Permalink /patch/83242/
State New
Headers show

Comments

Adam Lackorzynski - Feb. 15, 2011, 1:12 p.m.
On Tue Feb 15, 2011 at 13:01:08 +0000, Peter Maydell wrote:
> On 15 February 2011 10:48, Adam Lackorzynski <adam@os.inf.tu-dresden.de> wrote:
> > Make smpboot available not only for Linux but for all setups.
> 
> I'm not convinced about this. I think if you're providing a raw
> image for an SMP system (rather than a Linux kernel) then it's
> your job to provide an image which handles the bootup of the
> secondary CPUs, the same way it would be if you were providing
> a ROM image for real hardware.

Ok, this is one possibility. Another one would be something like this:

 Subject: [PATCH] target-arm: Provide entry vector for non-linux systems

Non-Linux systems must provide their own code for secondary CPU boot-up.
We use the same entry point as on the first CPU.

Signed-off-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de>
---
 hw/realview.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
Peter Maydell - Feb. 15, 2011, 1:37 p.m.
On 15 February 2011 13:12, Adam Lackorzynski <adam@os.inf.tu-dresden.de> wrote:
>
> On Tue Feb 15, 2011 at 13:01:08 +0000, Peter Maydell wrote:
>> On 15 February 2011 10:48, Adam Lackorzynski <adam@os.inf.tu-dresden.de> wrote:
>> > Make smpboot available not only for Linux but for all setups.
>>
>> I'm not convinced about this. I think if you're providing a raw
>> image for an SMP system (rather than a Linux kernel) then it's
>> your job to provide an image which handles the bootup of the
>> secondary CPUs, the same way it would be if you were providing
>> a ROM image for real hardware.
>
> Ok, this is one possibility. Another one would be something like this:

> @@ -112,7 +112,11 @@ static void secondary_cpu_reset(void *opaque)
>   /* Set entry point for secondary CPUs.  This assumes we're using
>      the init code from arm_boot.c.  Real hardware resets all CPUs
>      the same.  */
> -  env->regs[15] = SMP_BOOT_ADDR;
> +  if (realview_binfo.is_linux) {
> +      env->regs[15] = SMP_BOOT_ADDR;
> +  } else {
> +      env->regs[15] = realview_binfo.entry;
> +  }
>  }

Moving in the right direction, but it would be cleaner if the secondary
CPU reset was handled inside arm_boot.c, I think (there is a TODO
in that file to that effect). Then we could get rid of the cpu reset
hook from realview.c.

-- PMM

Patch

diff --git a/hw/realview.c b/hw/realview.c
index 6eb6c6a..574bc11 100644
--- a/hw/realview.c
+++ b/hw/realview.c
@@ -112,7 +112,11 @@  static void secondary_cpu_reset(void *opaque)
   /* Set entry point for secondary CPUs.  This assumes we're using
      the init code from arm_boot.c.  Real hardware resets all CPUs
      the same.  */
-  env->regs[15] = SMP_BOOT_ADDR;
+  if (realview_binfo.is_linux) {
+      env->regs[15] = SMP_BOOT_ADDR;
+  } else {
+      env->regs[15] = realview_binfo.entry;
+  }
 }
 
 /* The following two lists must be consistent.  */