From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:40277) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RnXmz-0004y4-VC for qemu-devel@nongnu.org; Wed, 18 Jan 2012 10:51:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RnXmq-0005bP-7S for qemu-devel@nongnu.org; Wed, 18 Jan 2012 10:51:05 -0500 Received: from smtp191.dfw.emailsrvr.com ([67.192.241.191]:59041) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RnXmq-0005bJ-2r for qemu-devel@nongnu.org; Wed, 18 Jan 2012 10:50:56 -0500 From: Mark Langsdorf Date: Wed, 18 Jan 2012 09:50:53 -0600 Message-Id: <1326901853-18807-1-git-send-email-mark.langsdorf@calxeda.com> In-Reply-To: <4F16DF93.5070709@calxeda.com> References: <4F16DF93.5070709@calxeda.com> Subject: [Qemu-devel] [PATCH][RFC] arm: add secondary cpu book callbacks to arm_boot.c List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, afaerber@suse.de, Mark Langsdorf 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 --- 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