From patchwork Fri Aug 5 11:06:21 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evgeny Voevodin X-Patchwork-Id: 108639 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 09FCAB6F70 for ; Fri, 5 Aug 2011 21:10:24 +1000 (EST) Received: from localhost ([::1]:50006 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QpIIF-0001Cm-VX for incoming@patchwork.ozlabs.org; Fri, 05 Aug 2011 07:10:19 -0400 Received: from eggs.gnu.org ([140.186.70.92]:52959) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QpII7-0001CQ-AF for qemu-devel@nongnu.org; Fri, 05 Aug 2011 07:10:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QpII3-0004FA-Db for qemu-devel@nongnu.org; Fri, 05 Aug 2011 07:10:11 -0400 Received: from lo.gmane.org ([80.91.229.12]:48786) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QpII2-0004Ek-Uy for qemu-devel@nongnu.org; Fri, 05 Aug 2011 07:10:07 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1QpII1-0001Ax-3d for qemu-devel@nongnu.org; Fri, 05 Aug 2011 13:10:05 +0200 Received: from 213.33.220.118 ([213.33.220.118]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 05 Aug 2011 13:10:05 +0200 Received: from e.voevodin by 213.33.220.118 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 05 Aug 2011 13:10:05 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: qemu-devel@nongnu.org From: Evgeny Voevodin Date: Fri, 05 Aug 2011 15:06:21 +0400 Lines: 103 Message-ID: <4E3BCEAD.60407@samsung.com> References: Mime-Version: 1.0 X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 213.33.220.118 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.18) Gecko/20110617 Thunderbird/3.1.11 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.91.229.12 Cc: Kyungmin Park , Dmitry Solodkiy Subject: Re: [Qemu-devel] [PATCH] target-arm: upgrade for secondary cpu bootloader X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From 851173b22dc2c5d5f8bb46eef07c452af78f61e8 Mon Sep 17 00:00:00 2001 From: Evgeny Voevodin Date: Fri, 29 Jul 2011 09:36:21 +0400 Subject: [PATCH 1/2] arm: Add new secondary CPU bootloader Secondary CPU bootloader enables interrupt and issues wfi until start address is written to system controller. The position where to find this start address is hardcoded to 0x10000030. This commit adds new bootloader for secondary CPU which allows a target board to cpecify a position where to find start address. Signed-off-by: Evgeny Voevodin Signed-off-by: Kyungmin Park --- hw/arm-misc.h | 1 + hw/arm_boot.c | 35 ++++++++++++++++++++++++++++++----- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/hw/arm-misc.h b/hw/arm-misc.h index 010acb4..ef1d61d 100644 --- a/hw/arm-misc.h +++ b/hw/arm-misc.h @@ -28,6 +28,7 @@ struct arm_boot_info { const char *initrd_filename; target_phys_addr_t loader_start; target_phys_addr_t smp_loader_start; + target_phys_addr_t smp_startaddr; target_phys_addr_t smp_priv_base; int nb_cpus; int board_id; diff --git a/hw/arm_boot.c b/hw/arm_boot.c index 620550b..59a6f05 100644 --- a/hw/arm_boot.c +++ b/hw/arm_boot.c @@ -44,6 +44,20 @@ static uint32_t smpboot[] = { 0 /* privbase: Private memory region base address. */ }; +static uint32_t smpboot2[] = { + 0xe59f201c, /* ldr r2, privbase */ + 0xe59f001c, /* ldr r0, startaddr */ + 0xe3a01001, /* mov r1, #1 */ + 0xe5821100, /* str r1, [r2, #256] */ + 0xe320f003, /* wfi */ + 0xe5901000, /* ldr r1, [r0] */ + 0xe1110001, /* tst r1, r1 */ + 0x0afffffb, /* beq */ + 0xe12fff11, /* bx r1 */ + 0, /* privbase: Private memory region base address. */ + 0 /* startaddr: Where to find start address */ +}; + #define WRITE_WORD(p, value) do { \ stl_phys_notdirty(p, value); \ p += 4; \ @@ -269,12 +283,23 @@ 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) { - smpboot[10] = info->smp_priv_base; - for (n = 0; n < sizeof(smpboot) / 4; n++) { - smpboot[n] = tswap32(smpboot[n]); + if (info->smp_startaddr) { + smpboot2[(sizeof(smpboot2) - 8)/4] = info->smp_priv_base; + smpboot2[(sizeof(smpboot2) - 4)/4] = info->smp_startaddr; + for (n = 0; n < sizeof(smpboot2) / 4; n++) { + smpboot2[n] = tswap32(smpboot2[n]); + } + rom_add_blob_fixed("smpboot2", smpboot2, sizeof(smpboot2), + info->smp_loader_start); + } + else { + smpboot[10] = info->smp_priv_base; + for (n = 0; n < sizeof(smpboot) / 4; n++) { + smpboot[n] = tswap32(smpboot[n]); + } + rom_add_blob_fixed("smpboot", smpboot, sizeof(smpboot), + info->smp_loader_start); } - rom_add_blob_fixed("smpboot", smpboot, sizeof(smpboot), - info->smp_loader_start); } info->initrd_size = initrd_size; } -- 1.7.4.1