From patchwork Thu Feb 5 14:02:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 44443 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E078D21521 for ; Thu, 5 Feb 2015 14:11:39 +0000 (UTC) Received: by mail-wi0-f200.google.com with SMTP id fb4sf6583691wid.3 for ; Thu, 05 Feb 2015 06:11:38 -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: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=b3cjcB0yJWljhZ32QXTD2EwGl1xZMgHHYx7rRA92Eok=; b=SJUHep/U0jL2aGILj0NmBAB7EwkfzD7Kqo0y2EGqGkG4JmbRCEG5q/ZBXdDX6hdR3T bm/cRkUSbyEU4Nwt06YzbU7aP8+qSCjXfEpCoDHCJzDl8toUKPffEcIxr8sHcS+MuYd1 LGMQ4SRc4iq9lXcAdwJWI4/PoayShTbW4UHO2LiklRkpS1RBHU8MkqR+pKLvdHEQTvxu 5hA0GWcXU/BH/q59GifbSq+V3aqZVUal3h3rcmF3uChRtDwH7KTFUhN2wxReFVUlh8qj 0DKV4+LY+UpQ8uv+T0C92jRr1xbO+wIY1B1M6zGBLcp8hqIH1ip7pe/frP1lJNiwEtPX z3Mw== X-Gm-Message-State: ALoCoQmro5GUBgiOH2yQ9cFhUduVzjXAWMdK34GX0GCMrNYFhBR34VOJuW9lBASrWI3+gfxZEA6R X-Received: by 10.112.154.233 with SMTP id vr9mr528051lbb.9.1423145498905; Thu, 05 Feb 2015 06:11:38 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.1.195 with SMTP id 3ls138918lao.47.gmail; Thu, 05 Feb 2015 06:11:38 -0800 (PST) X-Received: by 10.112.35.165 with SMTP id i5mr3601074lbj.49.1423145498726; Thu, 05 Feb 2015 06:11:38 -0800 (PST) Received: from mail-lb0-f175.google.com (mail-lb0-f175.google.com. [209.85.217.175]) by mx.google.com with ESMTPS id ll2si4051903lac.39.2015.02.05.06.11.38 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Feb 2015 06:11:38 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.175 as permitted sender) client-ip=209.85.217.175; Received: by mail-lb0-f175.google.com with SMTP id n10so3276056lbv.6 for ; Thu, 05 Feb 2015 06:11:38 -0800 (PST) X-Received: by 10.112.213.38 with SMTP id np6mr3866454lbc.36.1423145498560; Thu, 05 Feb 2015 06:11:38 -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.35.133 with SMTP id h5csp1164705lbj; Thu, 5 Feb 2015 06:11:37 -0800 (PST) X-Received: by 10.140.17.45 with SMTP id 42mr8311009qgc.66.1423145496945; Thu, 05 Feb 2015 06:11:36 -0800 (PST) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id x10si6246842qal.20.2015.02.05.06.11.36 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 05 Feb 2015 06:11:36 -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]:42160 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJN9b-0006ze-VS for patch@linaro.org; Thu, 05 Feb 2015 09:11:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49963) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJN1j-0001X4-8S for qemu-devel@nongnu.org; Thu, 05 Feb 2015 09:03:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YJN1i-0007Zo-4g for qemu-devel@nongnu.org; Thu, 05 Feb 2015 09:03:27 -0500 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:54955) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJN1h-0007RD-Nr for qemu-devel@nongnu.org; Thu, 05 Feb 2015 09:03:26 -0500 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1YJN1P-0002ys-CQ for qemu-devel@nongnu.org; Thu, 05 Feb 2015 14:03:07 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Date: Thu, 5 Feb 2015 14:02:41 +0000 Message-Id: <1423144987-11425-3-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1423144987-11425-1-git-send-email-peter.maydell@linaro.org> References: <1423144987-11425-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:8b0:1d0::1 Subject: [Qemu-devel] [PULL 02/28] target_arm: Parameterise the irq lines for armv7m_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: peter.maydell@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.175 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 From: Alistair Francis This patch allows the board to specifiy the number of NVIC interrupt lines when using armv7m_init. Signed-off-by: Alistair Francis Reviewed-by: Peter Crosthwaite Message-id: 5a0b0fcc778df0340899f488053acc9493679e03.1422077994.git.alistair23@gmail.com [PMM: removed stale FIXME comment] Signed-off-by: Peter Maydell --- hw/arm/armv7m.c | 8 ++++---- hw/arm/stellaris.c | 5 ++++- include/hw/arm/arm.h | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c index 50281f7..c6eab6d 100644 --- a/hw/arm/armv7m.c +++ b/hw/arm/armv7m.c @@ -166,14 +166,13 @@ static void armv7m_reset(void *opaque) mem_size is in bytes. Returns the NVIC array. */ -qemu_irq *armv7m_init(MemoryRegion *system_memory, int mem_size, +qemu_irq *armv7m_init(MemoryRegion *system_memory, int mem_size, int num_irq, const char *kernel_filename, const char *cpu_model) { ARMCPU *cpu; CPUARMState *env; DeviceState *nvic; - /* FIXME: make this local state. */ - static qemu_irq pic[64]; + qemu_irq *pic = g_new(qemu_irq, num_irq); int image_size; uint64_t entry; uint64_t lowaddr; @@ -194,11 +193,12 @@ qemu_irq *armv7m_init(MemoryRegion *system_memory, int mem_size, armv7m_bitband_init(); nvic = qdev_create(NULL, "armv7m_nvic"); + qdev_prop_set_uint32(nvic, "num-irq", num_irq); env->nvic = nvic; qdev_init_nofail(nvic); sysbus_connect_irq(SYS_BUS_DEVICE(nvic), 0, qdev_get_gpio_in(DEVICE(cpu), ARM_CPU_IRQ)); - for (i = 0; i < 64; i++) { + for (i = 0; i < num_irq; i++) { pic[i] = qdev_get_gpio_in(nvic, i); } diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c index 8e9c30b..cb515ec 100644 --- a/hw/arm/stellaris.c +++ b/hw/arm/stellaris.c @@ -29,6 +29,8 @@ #define BP_OLED_SSI 0x02 #define BP_GAMEPAD 0x04 +#define NUM_IRQ_LINES 64 + typedef const struct { const char *name; uint32_t did0; @@ -1239,7 +1241,8 @@ static void stellaris_init(const char *kernel_filename, const char *cpu_model, vmstate_register_ram_global(sram); memory_region_add_subregion(system_memory, 0x20000000, sram); - pic = armv7m_init(system_memory, flash_size, kernel_filename, cpu_model); + pic = armv7m_init(system_memory, flash_size, NUM_IRQ_LINES, + kernel_filename, cpu_model); if (board->dc1 & (1 << 16)) { dev = sysbus_create_varargs(TYPE_STELLARIS_ADC, 0x40038000, diff --git a/include/hw/arm/arm.h b/include/hw/arm/arm.h index f8b329b..5c940eb 100644 --- a/include/hw/arm/arm.h +++ b/include/hw/arm/arm.h @@ -15,7 +15,7 @@ #include "hw/irq.h" /* armv7m.c */ -qemu_irq *armv7m_init(MemoryRegion *system_memory, int mem_size, +qemu_irq *armv7m_init(MemoryRegion *system_memory, int mem_size, int num_irq, const char *kernel_filename, const char *cpu_model); /* arm_boot.c */