From patchwork Tue Jun 10 01:33:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 357661 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id A436214008D for ; Tue, 10 Jun 2014 11:34:26 +1000 (EST) Received: from localhost ([::1]:35955 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WuAxE-0000vY-CV for incoming@patchwork.ozlabs.org; Mon, 09 Jun 2014 21:34:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52509) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WuAwC-00086k-MD for qemu-devel@nongnu.org; Mon, 09 Jun 2014 21:33:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WuAw6-0007ks-Kv for qemu-devel@nongnu.org; Mon, 09 Jun 2014 21:33:20 -0400 Received: from mail-pa0-x22b.google.com ([2607:f8b0:400e:c03::22b]:59862) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WuAw6-0007ko-A5 for qemu-devel@nongnu.org; Mon, 09 Jun 2014 21:33:14 -0400 Received: by mail-pa0-f43.google.com with SMTP id rd3so106950pab.30 for ; Mon, 09 Jun 2014 18:33:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=EzhRi+3IBGEYgZjD5McwS41RiA5Jk4ysLRVEQObT9bE=; b=oAZ61X1obGt+/2d3srtN31xMW9WuLvZf615iXsdZFhBYhSZmJSJ9mI2wwHR8Zpyvyq VUz9FLr6YKhPMIGIhln9T+ATBQBcZscqTnVe9MKQn9nBTSq/XByQgJhZAkknSEkSsURW C8NtLsyarTSp14vjktibHYacASXTFb9+D7CEj/OD/x8HePleWgAuPL3YoT/Hbau2LQiG SJR5lTmG1CxMQ+iOhpOw8Bj1/rXkn9OZyn51QtvxKPRh9vUoE/VH1vRpREjlz4qZVe6E Kttc8sxqAQzfkeaWEBzXYHbMMpzcJOKN6+m/FEqix33J9cl0ZaPeBjGRYiwgZtLxI80Q Kf6g== X-Received: by 10.66.192.73 with SMTP id he9mr2081117pac.88.1402363993132; Mon, 09 Jun 2014 18:33:13 -0700 (PDT) Received: from localhost ([203.126.243.116]) by mx.google.com with ESMTPSA id py7sm66237128pbb.78.2014.06.09.18.33.09 for (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Mon, 09 Jun 2014 18:33:12 -0700 (PDT) From: Alistair Francis To: qemu-devel@nongnu.org Date: Tue, 10 Jun 2014 11:33:06 +1000 Message-Id: X-Mailer: git-send-email 1.9.0 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c03::22b Cc: peter.maydell@linaro.org, peter.crosthwaite@xilinx.com, alistair.francis@xilinx.com Subject: [Qemu-devel] [RFC v1 2/2] zynq: Update Zynq to init the CPU in the a9mpcore device 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 This patch removes the initialisation of the ARM Cortex-A9 in Zynq and instead allows the a9mpcore device to init the CPU. This also updates components that rely on the CPU and GIC, as they are now initialised in a slightly different way Signed-off-by: Alistair Francis --- All other Cortex-A9 machines can be updated a similar way This patch breaks the AArch64 make check tests. I get a: 'Warning: "-global dynamic-prop-type-bad.prop3=103" not used' followed by a broken pipe and failure. Any hints on what would be causing this? hw/arm/xilinx_zynq.c | 63 +++++++++++++++++++++++-------------------------- 1 files changed, 30 insertions(+), 33 deletions(-) diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c index ba5aa82..5a4ce5c 100644 --- a/hw/arm/xilinx_zynq.c +++ b/hw/arm/xilinx_zynq.c @@ -26,6 +26,7 @@ #include "hw/loader.h" #include "hw/ssi.h" #include "qemu/error-report.h" +#include "hw/cpu/a9mpcore.h" #define NUM_SPI_FLASHES 4 #define NUM_QSPI_FLASHES 2 @@ -104,12 +105,10 @@ static inline void zynq_init_spi_flashes(uint32_t base_addr, qemu_irq irq, static void zynq_init(MachineState *machine) { ram_addr_t ram_size = machine->ram_size; - const char *cpu_model = machine->cpu_model; const char *kernel_filename = machine->kernel_filename; const char *kernel_cmdline = machine->kernel_cmdline; const char *initrd_filename = machine->initrd_filename; - ObjectClass *cpu_oc; - ARMCPU *cpu; + A9MPPrivState *mpcore; MemoryRegion *address_space_mem = get_system_memory(); MemoryRegion *ext_ram = g_new(MemoryRegion, 1); MemoryRegion *ocm_ram = g_new(MemoryRegion, 1); @@ -119,30 +118,6 @@ static void zynq_init(MachineState *machine) Error *err = NULL; int n; - if (!cpu_model) { - cpu_model = "cortex-a9"; - } - cpu_oc = cpu_class_by_name(TYPE_ARM_CPU, cpu_model); - - cpu = ARM_CPU(object_new(object_class_get_name(cpu_oc))); - - object_property_set_int(OBJECT(cpu), ZYNQ_BOARD_MIDR, "midr", &err); - if (err) { - error_report("%s", error_get_pretty(err)); - exit(1); - } - - object_property_set_int(OBJECT(cpu), MPCORE_PERIPHBASE, "reset-cbar", &err); - if (err) { - error_report("%s", error_get_pretty(err)); - exit(1); - } - object_property_set_bool(OBJECT(cpu), true, "realized", &err); - if (err) { - error_report("%s", error_get_pretty(err)); - exit(1); - } - /* max 2GB ram */ if (ram_size > 0x80000000) { ram_size = 0x80000000; @@ -171,16 +146,38 @@ static void zynq_init(MachineState *machine) qdev_init_nofail(dev); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0xF8000000); - dev = qdev_create(NULL, "a9mpcore_priv"); - qdev_prop_set_uint32(dev, "num-cpu", 1); - qdev_init_nofail(dev); - busdev = SYS_BUS_DEVICE(dev); + mpcore = A9MPCORE_PRIV(object_new("a9mpcore_priv")); + object_property_set_int(OBJECT(mpcore), 1, "num-cpu", + &err); + if (err) { + error_report("%s", error_get_pretty(err)); + exit(1); + } + object_property_set_int(OBJECT(mpcore), ZYNQ_BOARD_MIDR, "midr", + &err); + if (err) { + error_report("%s", error_get_pretty(err)); + exit(1); + } + object_property_set_int(OBJECT(mpcore), MPCORE_PERIPHBASE, + "reset-cbar", &err); + if (err) { + error_report("%s", error_get_pretty(err)); + exit(1); + } + object_property_set_bool(OBJECT(mpcore), true, "realized", &err); + if (err != NULL) { + error_report("Couldn't realize the Zynq A9MPCore: %s", + error_get_pretty(err)); + exit(1); + } + busdev = SYS_BUS_DEVICE(DEVICE(mpcore)); sysbus_mmio_map(busdev, 0, MPCORE_PERIPHBASE); sysbus_connect_irq(busdev, 0, - qdev_get_gpio_in(DEVICE(cpu), ARM_CPU_IRQ)); + qdev_get_gpio_in(DEVICE(mpcore->cpu), ARM_CPU_IRQ)); for (n = 0; n < 64; n++) { - pic[n] = qdev_get_gpio_in(dev, n); + pic[n] = qdev_get_gpio_in(DEVICE(mpcore), n); } zynq_init_spi_flashes(0xE0006000, pic[58-IRQ_OFFSET], false);