qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH][RFC] arm: add secondary cpu book callbacks to arm_b


From: Mark Langsdorf
Subject: [Qemu-devel] [PATCH][RFC] arm: add secondary cpu book callbacks to arm_boot.c
Date: Wed, 18 Jan 2012 09:50:53 -0600

Create two functions, write_secondary_boot() and secondary_cpu_reset_hook(),
to allow platforms more control of how secondary CPUs are brought up. The
new functions default to NULL and aren't called unless they are populated
so there are no changes to existing platform models.

Signed-off-by: Mark Langsdorf <address@hidden>
---
I'll add this to the Highbank patch series but I wanted to throw it out
now to make sure the general structure was good.

 hw/arm-misc.h |    4 ++++
 hw/arm_boot.c |    6 +++++-
 2 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/hw/arm-misc.h b/hw/arm-misc.h
index 6e8ae6b..866f848 100644
--- a/hw/arm-misc.h
+++ b/hw/arm-misc.h
@@ -36,6 +36,10 @@ struct arm_boot_info {
     int nb_cpus;
     int board_id;
     int (*atag_board)(const struct arm_boot_info *info, void *p);
+    void (*write_secondary_boot)(CPUState *env,
+                                 const struct arm_boot_info *info);
+    void (*secondary_cpu_reset_hook)(CPUState *env,
+                                     const struct arm_boot_info *info);
     /* Used internally by arm_boot.c */
     int is_linux;
     target_phys_addr_t initrd_size;
diff --git a/hw/arm_boot.c b/hw/arm_boot.c
index bf509a8..78626bb 100644
--- a/hw/arm_boot.c
+++ b/hw/arm_boot.c
@@ -196,6 +196,8 @@ static void do_cpu_reset(void *opaque)
                     set_kernel_args(info, info->initrd_size,
                                     info->loader_start);
                 }
+            } else if (info->secondary_cpu_reset_hook) {
+                info->secondary_cpu_reset_hook(env, info);
             } else {
                 stl_phys_notdirty(info->smp_bootreg_addr, 0);
                 env->regs[15] = info->smp_loader_start;
@@ -272,7 +274,9 @@ void arm_load_kernel(CPUState *env, struct arm_boot_info 
*info)
         }
         rom_add_blob_fixed("bootloader", bootloader, sizeof(bootloader),
                            info->loader_start);
-        if (info->nb_cpus > 1) {
+        if ((info->nb_cpus > 1) && (info->write_secondary_boot)) {
+            info->write_secondary_boot(env, info);
+        } else if (info->nb_cpus > 1) {
             smpboot[ARRAY_SIZE(smpboot) - 1] = info->smp_bootreg_addr;
             smpboot[ARRAY_SIZE(smpboot) - 2] = info->smp_priv_base;
             for (n = 0; n < ARRAY_SIZE(smpboot); n++) {
-- 
1.7.5.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]