From patchwork Mon Dec 15 18:51:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Bellows X-Patchwork-Id: 42284 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 884E32456A for ; Mon, 15 Dec 2014 18:58:21 +0000 (UTC) Received: by mail-wi0-f198.google.com with SMTP id r20sf3957319wiv.5 for ; Mon, 15 Dec 2014 10:58:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=hSiZKCAZTRYGL6+WJfNrsVnRpJDYY5hJTsj+cSgp9/o=; b=IdX+7vhyN9Lyz8G0LERNlTpxdiUplMDrxSZQU387KPgUHnNdQqcf4KTcW0hTmYv51E Cn89qw8I8HEVJpmYNGggIO9uDBB5t8TKcQhG715ExOxrUWUo3HAd6dLIjudK5wUumZ0J DQJmZS4/ZIHFGkNyMhijIXMIa50PpgXh8qbLP4Cdap1biPo0Epl5OXrJH/I4JdLhRI4J G1cjIL8OSPsDTACs84+6cRmTvrrcuwpf3FD/0m0PfxQXKGZ8BaO1L92iRsnjUExEPIqx KFeyRZLB18Q4LaU7rbDose9QClHNaXza1D6JUXVGFAjBbv7ozhAFVkxJE20wymKLBrLO QjBA== X-Gm-Message-State: ALoCoQk6kSbRSpUWnp0c7IItxlqzHlG0y89Di0BI2WVZfXw4RRAORRFko9wcnVygwnIKnDfggipo X-Received: by 10.112.235.231 with SMTP id up7mr878929lbc.0.1418669900759; Mon, 15 Dec 2014 10:58:20 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.3.202 with SMTP id e10ls722397lae.86.gmail; Mon, 15 Dec 2014 10:58:20 -0800 (PST) X-Received: by 10.112.171.199 with SMTP id aw7mr31549497lbc.40.1418669900475; Mon, 15 Dec 2014 10:58:20 -0800 (PST) Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com. [209.85.217.176]) by mx.google.com with ESMTPS id x7si11290352lae.100.2014.12.15.10.58.20 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 15 Dec 2014 10:58:20 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) client-ip=209.85.217.176; Received: by mail-lb0-f176.google.com with SMTP id p9so9470824lbv.7 for ; Mon, 15 Dec 2014 10:58:20 -0800 (PST) X-Received: by 10.152.7.229 with SMTP id m5mr32104349laa.80.1418669900361; Mon, 15 Dec 2014 10:58:20 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.142.69 with SMTP id ru5csp810032lbb; Mon, 15 Dec 2014 10:58:19 -0800 (PST) X-Received: by 10.140.83.169 with SMTP id j38mr54618274qgd.99.1418669898692; Mon, 15 Dec 2014 10:58:18 -0800 (PST) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id f3si11616403qcg.36.2014.12.15.10.58.17 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 15 Dec 2014 10:58:18 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:41496 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0aqX-0002K0-OZ for patch@linaro.org; Mon, 15 Dec 2014 13:58:17 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38367) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0akP-0000rp-9H for qemu-devel@nongnu.org; Mon, 15 Dec 2014 13:52:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y0akJ-0005yA-Bk for qemu-devel@nongnu.org; Mon, 15 Dec 2014 13:51:57 -0500 Received: from mail-pa0-f45.google.com ([209.85.220.45]:42334) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0akJ-0005xv-2j for qemu-devel@nongnu.org; Mon, 15 Dec 2014 13:51:51 -0500 Received: by mail-pa0-f45.google.com with SMTP id lf10so11759686pab.4 for ; Mon, 15 Dec 2014 10:51:50 -0800 (PST) X-Received: by 10.70.130.108 with SMTP id od12mr53303419pdb.109.1418669510532; Mon, 15 Dec 2014 10:51:50 -0800 (PST) Received: from gbellows-linaro.qualcomm.com (rrcs-67-52-129-61.west.biz.rr.com. [67.52.129.61]) by mx.google.com with ESMTPSA id bq7sm9972513pdb.50.2014.12.15.10.51.49 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 15 Dec 2014 10:51:49 -0800 (PST) From: Greg Bellows To: qemu-devel@nongnu.org, serge.fdrv@gmail.com, edgar.iglesias@gmail.com, aggelerf@ethz.ch, peter.maydell@linaro.org Date: Mon, 15 Dec 2014 12:51:17 -0600 Message-Id: <1418669479-23908-14-git-send-email-greg.bellows@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1418669479-23908-1-git-send-email-greg.bellows@linaro.org> References: <1418669479-23908-1-git-send-email-greg.bellows@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.220.45 Cc: Greg Bellows Subject: [Qemu-devel] [PATCH v3 13/15] target-arm: Breakout integratorcp and versatilepb cpu init 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: greg.bellows@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 This commit changes the integratorcp and versatilepb CPU initialization from using the generic ARM cpu_arm_init function to doing it inline. This is necessary in order to allow CPU configuration changes to occur between CPU instance initialization and realization. Specifically, this change is in preparation for disabling CPU EL3 support. Signed-off-by: Greg Bellows Reviewed-by: Peter Maydell --- hw/arm/integratorcp.c | 19 +++++++++++++++++-- hw/arm/versatilepb.c | 20 ++++++++++++++++++-- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/hw/arm/integratorcp.c b/hw/arm/integratorcp.c index 266ec18..f196189 100644 --- a/hw/arm/integratorcp.c +++ b/hw/arm/integratorcp.c @@ -15,6 +15,7 @@ #include "net/net.h" #include "exec/address-spaces.h" #include "sysemu/sysemu.h" +#include "qemu/error-report.h" #define TYPE_INTEGRATOR_CM "integrator_core" #define INTEGRATOR_CM(obj) \ @@ -469,6 +470,8 @@ static void integratorcp_init(MachineState *machine) const char *kernel_filename = machine->kernel_filename; const char *kernel_cmdline = machine->kernel_cmdline; const char *initrd_filename = machine->initrd_filename; + ObjectClass *cpu_oc; + Object *cpuobj; ARMCPU *cpu; MemoryRegion *address_space_mem = get_system_memory(); MemoryRegion *ram = g_new(MemoryRegion, 1); @@ -476,16 +479,28 @@ static void integratorcp_init(MachineState *machine) qemu_irq pic[32]; DeviceState *dev; int i; + Error *err = NULL; if (!cpu_model) { cpu_model = "arm926"; } - cpu = cpu_arm_init(cpu_model); - if (!cpu) { + + cpu_oc = cpu_class_by_name(TYPE_ARM_CPU, cpu_model); + if (!cpu_oc) { fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } + cpuobj = object_new(object_class_get_name(cpu_oc)); + + object_property_set_bool(cpuobj, true, "realized", &err); + if (err) { + error_report("%s", error_get_pretty(err)); + exit(1); + } + + cpu = ARM_CPU(cpuobj); + memory_region_init_ram(ram, NULL, "integrator.ram", ram_size, &error_abort); vmstate_register_ram_global(ram); /* ??? On a real system the first 1Mb is mapped as SSRAM or boot flash. */ diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c index e6ef0a2..b74dc15 100644 --- a/hw/arm/versatilepb.c +++ b/hw/arm/versatilepb.c @@ -18,6 +18,7 @@ #include "sysemu/block-backend.h" #include "exec/address-spaces.h" #include "hw/block/flash.h" +#include "qemu/error-report.h" #define VERSATILE_FLASH_ADDR 0x34000000 #define VERSATILE_FLASH_SIZE (64 * 1024 * 1024) @@ -175,6 +176,8 @@ static struct arm_boot_info versatile_binfo; static void versatile_init(MachineState *machine, int board_id) { + ObjectClass *cpu_oc; + Object *cpuobj; ARMCPU *cpu; MemoryRegion *sysmem = get_system_memory(); MemoryRegion *ram = g_new(MemoryRegion, 1); @@ -189,15 +192,28 @@ static void versatile_init(MachineState *machine, int board_id) int n; int done_smc = 0; DriveInfo *dinfo; + Error *err = NULL; if (!machine->cpu_model) { machine->cpu_model = "arm926"; } - cpu = cpu_arm_init(machine->cpu_model); - if (!cpu) { + + cpu_oc = cpu_class_by_name(TYPE_ARM_CPU, machine->cpu_model); + if (!cpu_oc) { fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } + + cpuobj = object_new(object_class_get_name(cpu_oc)); + + object_property_set_bool(cpuobj, true, "realized", &err); + if (err) { + error_report("%s", error_get_pretty(err)); + exit(1); + } + + cpu = ARM_CPU(cpuobj); + memory_region_init_ram(ram, NULL, "versatile.ram", machine->ram_size, &error_abort); vmstate_register_ram_global(ram);