From patchwork Tue Jul 23 09:33:16 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Mian M. Hamayun" X-Patchwork-Id: 261011 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 6580E2C00BF for ; Tue, 23 Jul 2013 19:37:58 +1000 (EST) Received: from localhost ([::1]:46582 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1Z2a-0005Mx-2q for incoming@patchwork.ozlabs.org; Tue, 23 Jul 2013 05:37:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49399) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1Z29-0005GI-JC for qemu-devel@nongnu.org; Tue, 23 Jul 2013 05:37:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V1YyZ-0000lO-Ig for qemu-devel@nongnu.org; Tue, 23 Jul 2013 05:33:55 -0400 Received: from mail-we0-f169.google.com ([74.125.82.169]:62401) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1YyZ-0000lD-9r for qemu-devel@nongnu.org; Tue, 23 Jul 2013 05:33:47 -0400 Received: by mail-we0-f169.google.com with SMTP id n57so7009031wev.14 for ; Tue, 23 Jul 2013 02:33:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=ItlyoUTkr+8ph4A22ZRdf6bQYhjjfDHFLwTebar9hDc=; b=aVfB9KAxT41im+2ZTyHhoiwslPh2HTmPLB3BnxX4RkpcaNC03gCbf/W+rgkGQwIyJt noLhGKE6ql48aopY9BtFgsFfwmV/c4t+vGL40VRt5SmNbunbC02pTGWXB/qC4Gv8T0BL BmzKET1kpDk6hafsWaR42J3v1WUci4SEKnn/zb/fpJRpij0xL54TTUbcWJ81ozuo3+Lp WrrkxajISZPMjtzJJD/pi7wKJAMRbFfrANCTp0LSmB6NRoN0MzQflVzQkwmqUoaPGvrc ulotGJDq1uNcMQxUl0LMIqK9rblN9khMpkja/xCFGiA4qSoI9cYzjVtO4I8pqiYtGy9q AfMg== X-Received: by 10.194.239.225 with SMTP id vv1mr22396706wjc.63.1374572026575; Tue, 23 Jul 2013 02:33:46 -0700 (PDT) Received: from localhost.localdomain (68.107.73.86.rev.sfr.net. [86.73.107.68]) by mx.google.com with ESMTPSA id f8sm2158705wiv.0.2013.07.23.02.33.44 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 23 Jul 2013 02:33:45 -0700 (PDT) From: "Mian M. Hamayun" To: qemu-devel@nongnu.org Date: Tue, 23 Jul 2013 11:33:16 +0200 Message-Id: <1374571996-9228-8-git-send-email-m.hamayun@virtualopensystems.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1374571996-9228-1-git-send-email-m.hamayun@virtualopensystems.com> References: <1374571996-9228-1-git-send-email-m.hamayun@virtualopensystems.com> X-Gm-Message-State: ALoCoQnHrejeRXRaZd4h4WFKI5YlIxC/LaROTfqKKropBpN/GS822aq7Ziy0pghiuIZHnF9Bgf9c X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 74.125.82.169 Cc: peter.maydell@linaro.org, tech@virtualopensystems.com, kvmarm@lists.cs.columbia.edu Subject: [Qemu-devel] [PATCH v2 7/7] AARCH64: Use the spin-table method for booting secondary processors in machvirt 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: "Mian M. Hamayun" As the SMP bootloader uses a spin-table to wait for the cpu_release_addr, we disable the PSCI method for AArch64 in machvirt and use spin-table instead. The CPU_RELEASE_OFFSET is introduced in machvirt and is to calculate the cpu_release_addr by addition of this value to the memory base address, and this value is updated in the smp bootloader using the smp_bootreg_addr board info parameter. Tested-by: Alexander Spyridakis Signed-off-by: Mian M. Hamayun --- hw/arm/virt.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 8a2bdc7..44ab59d 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -52,6 +52,7 @@ #define IO_LEN 0x000f0000 #if defined(TARGET_AARCH64) +#define CPU_RELEASE_OFFSET 0x0000fff8 #define DEFAULT_CPU_MODEL "cortex-a57" #elif defined(TARGET_ARM) #define DEFAULT_CPU_MODEL "cortex-a15" @@ -170,7 +171,7 @@ static void *initial_fdt(struct machine_info *mi) qemu_devtree_setprop_cell(fdt, "/soc", "#interrupt-cells", 0x1); /* No PSCI for TCG yet */ -#ifdef CONFIG_KVM +#if defined (CONFIG_KVM) && !defined(TARGET_AARCH64) if (kvm_enabled()) { qemu_devtree_add_subnode(fdt, "/psci"); qemu_devtree_setprop_string(fdt, "/psci", "compatible", "arm,psci"); @@ -234,7 +235,14 @@ static void fdt_add_cpu_nodes(void *fdt, struct machine_info *mi, int smp_cpus) mi->cpu_compatible); if (smp_cpus > 1) { +#if defined(TARGET_AARCH64) + qemu_devtree_setprop_string(fdt, cpu_name, "enable-method", + "spin-table"); + qemu_devtree_setprop_u64(fdt, cpu_name, "cpu-release-addr", + (mi->mem_base + CPU_RELEASE_OFFSET)); +#else qemu_devtree_setprop_string(fdt, cpu_name, "enable-method", "psci"); +#endif } qemu_devtree_setprop_cell(fdt, cpu_name, "reg", cpu); @@ -437,6 +445,10 @@ static void machvirt_init(QEMUMachineInitArgs *args) machvirt_binfo.nb_cpus = smp_cpus; machvirt_binfo.board_id = -1; machvirt_binfo.loader_start = mi->mem_base; + machvirt_binfo.smp_loader_start = mi->mem_base + 0x1000; +#if defined(TARGET_AARCH64) + machvirt_binfo.smp_bootreg_addr = mi->mem_base + CPU_RELEASE_OFFSET; +#endif machvirt_binfo.get_dtb = machvirt_dtb; arm_load_kernel(arm_env_get_cpu(first_cpu), &machvirt_binfo); }