From patchwork Fri May 29 11:01:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 49162 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E4168218E7 for ; Fri, 29 May 2015 11:03:18 +0000 (UTC) Received: by wgv5 with SMTP id 5sf12972658wgv.0 for ; Fri, 29 May 2015 04:03:18 -0700 (PDT) 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=H6bqCbPq3USIe49ZqYCltlelUK4dxh6A6+dq5CtASTM=; b=XI9MQKHyBafSzpdJ5l8n9tB1SeB8SxOAADI8MYFBYf7zW8gdrlRVTlvSV+gDpGB2uU AYmm2OGHEP+RkuLT1YLqoHjD+ivgsDYgr3//lirXi0WD+FM+NlndkhFITL63TAp965Rv 9eW/fV+NO3rtUEwjYkWdWyh50MFAkCQ9DoYXTDsZNm0vw3A+qFbn5N4FUDhvM8+ef4P0 HS4H1LNWxzigFcMOnFn0J8yxj9m4Vhm52YohuJOyONOuRjbipxs7QqIpl12Q9Fq+b7zD FTJqcEx/8ZNuKdxjk18AG/ieYmF1ol4jMqdSzYLWBqTtcL7/PmCIK0TQWWDXWa5nXW1d nNpg== X-Gm-Message-State: ALoCoQljDW8uPCFEvuoDdu73D3vigP8wTparFHQODeg5ZsDQiAzpo31UA8or5sf5EVKAh8rNQkP1 X-Received: by 10.112.42.236 with SMTP id r12mr6918757lbl.2.1432897398026; Fri, 29 May 2015 04:03:18 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.204.168 with SMTP id kz8ls268706lac.105.gmail; Fri, 29 May 2015 04:03:17 -0700 (PDT) X-Received: by 10.152.204.7 with SMTP id ku7mr7397850lac.38.1432897397887; Fri, 29 May 2015 04:03:17 -0700 (PDT) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com. [209.85.215.43]) by mx.google.com with ESMTPS id dh4si4421066lac.35.2015.05.29.04.03.17 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 May 2015 04:03:17 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by laat2 with SMTP id t2so52909461laa.1 for ; Fri, 29 May 2015 04:03:17 -0700 (PDT) X-Received: by 10.112.163.168 with SMTP id yj8mr7429443lbb.36.1432897397768; Fri, 29 May 2015 04:03:17 -0700 (PDT) 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.108.230 with SMTP id hn6csp221946lbb; Fri, 29 May 2015 04:03:16 -0700 (PDT) X-Received: by 10.55.17.133 with SMTP id 5mr14902780qkr.18.1432897396218; Fri, 29 May 2015 04:03:16 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id b192si5245477qka.47.2015.05.29.04.03.15 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 29 May 2015 04:03:16 -0700 (PDT) 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]:35059 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YyI4J-0004se-0L for patch@linaro.org; Fri, 29 May 2015 07:03:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49466) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YyI1w-0000yB-9t for qemu-devel@nongnu.org; Fri, 29 May 2015 07:00:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YyI1s-0001YM-OG for qemu-devel@nongnu.org; Fri, 29 May 2015 07:00:48 -0400 Received: from mail-la0-f44.google.com ([209.85.215.44]:34908) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YyI1s-0001Y8-Ed for qemu-devel@nongnu.org; Fri, 29 May 2015 07:00:44 -0400 Received: by labko7 with SMTP id ko7so49258832lab.2 for ; Fri, 29 May 2015 04:00:43 -0700 (PDT) X-Received: by 10.152.22.72 with SMTP id b8mr7376986laf.1.1432897243662; Fri, 29 May 2015 04:00:43 -0700 (PDT) Received: from localhost.localdomain (188-178-240-98-static.dk.customer.tdc.net. [188.178.240.98]) by mx.google.com with ESMTPSA id zf3sm1319671lbb.2.2015.05.29.04.00.42 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 May 2015 04:00:42 -0700 (PDT) From: Christoffer Dall To: qemu-devel@nongnu.org Date: Fri, 29 May 2015 13:01:07 +0200 Message-Id: <1432897270-7780-2-git-send-email-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.1.2.330.g565301e.dirty In-Reply-To: <1432897270-7780-1-git-send-email-christoffer.dall@linaro.org> References: <1432897270-7780-1-git-send-email-christoffer.dall@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.215.44 Cc: Christoffer Dall , kvmarm@lists.cs.columbia.edu, shankerd@codeaurora.org, eric.auger@linaro.org Subject: [Qemu-devel] [PATCH v4 1/4] target-arm: Add GIC phandle to VirtBoardInfo 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: christoffer.dall@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.215.43 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 Instead of passing the GIC phandle around between functions, add it to the VirtBoardInfo just like we do for the clock_phandle. We are about to add the v2m phandle as well, and it's easier not having to pass around a bunch of phandles, return multiple values from functions, etc. Reviewed-by: Eric Auger Reviewed-by: Peter Maydell Signed-off-by: Christoffer Dall --- Changes since v3: - Added reviewed-by tag Changes since v2: - None Changes since v1: - Added reviewed-by tag hw/arm/virt.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 05db8cb..e5235ef 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -69,6 +69,7 @@ typedef struct VirtBoardInfo { void *fdt; int fdt_size; uint32_t clock_phandle; + uint32_t gic_phandle; } VirtBoardInfo; typedef struct { @@ -299,12 +300,11 @@ static void fdt_add_cpu_nodes(const VirtBoardInfo *vbi) } } -static uint32_t fdt_add_gic_node(const VirtBoardInfo *vbi) +static void fdt_add_gic_node(VirtBoardInfo *vbi) { - uint32_t gic_phandle; - gic_phandle = qemu_fdt_alloc_phandle(vbi->fdt); - qemu_fdt_setprop_cell(vbi->fdt, "/", "interrupt-parent", gic_phandle); + vbi->gic_phandle = qemu_fdt_alloc_phandle(vbi->fdt); + qemu_fdt_setprop_cell(vbi->fdt, "/", "interrupt-parent", vbi->gic_phandle); qemu_fdt_add_subnode(vbi->fdt, "/intc"); /* 'cortex-a15-gic' means 'GIC v2' */ @@ -317,12 +317,10 @@ static uint32_t fdt_add_gic_node(const VirtBoardInfo *vbi) 2, vbi->memmap[VIRT_GIC_DIST].size, 2, vbi->memmap[VIRT_GIC_CPU].base, 2, vbi->memmap[VIRT_GIC_CPU].size); - qemu_fdt_setprop_cell(vbi->fdt, "/intc", "phandle", gic_phandle); - - return gic_phandle; + qemu_fdt_setprop_cell(vbi->fdt, "/intc", "phandle", vbi->gic_phandle); } -static uint32_t create_gic(const VirtBoardInfo *vbi, qemu_irq *pic) +static void create_gic(VirtBoardInfo *vbi, qemu_irq *pic) { /* We create a standalone GIC v2 */ DeviceState *gicdev; @@ -371,7 +369,7 @@ static uint32_t create_gic(const VirtBoardInfo *vbi, qemu_irq *pic) pic[i] = qdev_get_gpio_in(gicdev, i); } - return fdt_add_gic_node(vbi); + fdt_add_gic_node(vbi); } static void create_uart(const VirtBoardInfo *vbi, qemu_irq *pic) @@ -618,8 +616,7 @@ static void create_pcie_irq_map(const VirtBoardInfo *vbi, uint32_t gic_phandle, 0x7 /* PCI irq */); } -static void create_pcie(const VirtBoardInfo *vbi, qemu_irq *pic, - uint32_t gic_phandle) +static void create_pcie(const VirtBoardInfo *vbi, qemu_irq *pic) { hwaddr base_mmio = vbi->memmap[VIRT_PCIE_MMIO].base; hwaddr size_mmio = vbi->memmap[VIRT_PCIE_MMIO].size; @@ -685,7 +682,7 @@ static void create_pcie(const VirtBoardInfo *vbi, qemu_irq *pic, 2, base_mmio, 2, size_mmio); qemu_fdt_setprop_cell(vbi->fdt, nodename, "#interrupt-cells", 1); - create_pcie_irq_map(vbi, gic_phandle, irq, nodename); + create_pcie_irq_map(vbi, vbi->gic_phandle, irq, nodename); g_free(nodename); } @@ -717,7 +714,6 @@ static void machvirt_init(MachineState *machine) VirtBoardInfo *vbi; VirtGuestInfoState *guest_info_state = g_malloc0(sizeof *guest_info_state); VirtGuestInfo *guest_info = &guest_info_state->info; - uint32_t gic_phandle; char **cpustr; if (!cpu_model) { @@ -794,13 +790,13 @@ static void machvirt_init(MachineState *machine) create_flash(vbi); - gic_phandle = create_gic(vbi, pic); + create_gic(vbi, pic); create_uart(vbi, pic); create_rtc(vbi, pic); - create_pcie(vbi, pic, gic_phandle); + create_pcie(vbi, pic); /* Create mmio transports, so the user can create virtio backends * (which will be automatically plugged in to the transports). If