qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Auger <eric.auger@linaro.org>
To: Christoffer Dall <christoffer.dall@linaro.org>, qemu-devel@nongnu.org
Cc: kvmarm@lists.cs.columbia.edu
Subject: Re: [Qemu-devel] [PATCH v3 1/4] target-arm: Add GIC phandle to VirtBoardInfo
Date: Tue, 26 May 2015 14:24:33 +0200	[thread overview]
Message-ID: <55646601.6060804@linaro.org> (raw)
In-Reply-To: <1432464666-4825-2-git-send-email-christoffer.dall@linaro.org>

Reviewed-by: Eric Auger <eric.auger@linaro.org>

On 05/24/2015 12:51 PM, Christoffer Dall wrote:
> 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: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
> ---
> 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 a7f9a10..f9f7482 100644
> --- a/hw/arm/virt.c
> +++ b/hw/arm/virt.c
> @@ -87,6 +87,7 @@ typedef struct VirtBoardInfo {
>      void *fdt;
>      int fdt_size;
>      uint32_t clock_phandle;
> +    uint32_t gic_phandle;
>  } VirtBoardInfo;
>  
>  typedef struct {
> @@ -322,12 +323,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' */
> @@ -340,12 +340,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;
> @@ -394,7 +392,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)
> @@ -641,8 +639,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 = vbi->memmap[VIRT_PCIE].base;
>      hwaddr size = vbi->memmap[VIRT_PCIE].size;
> @@ -714,7 +711,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);
>  }
> @@ -736,7 +733,6 @@ static void machvirt_init(MachineState *machine)
>      MemoryRegion *ram = g_new(MemoryRegion, 1);
>      const char *cpu_model = machine->cpu_model;
>      VirtBoardInfo *vbi;
> -    uint32_t gic_phandle;
>      char **cpustr;
>  
>      if (!cpu_model) {
> @@ -813,13 +809,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
> 

  reply	other threads:[~2015-05-26 12:24 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-24 10:51 [Qemu-devel] [PATCH v3 0/4] Add support for for GICv2m and MSIs to arm-virt Christoffer Dall
2015-05-24 10:51 ` [Qemu-devel] [PATCH v3 1/4] target-arm: Add GIC phandle to VirtBoardInfo Christoffer Dall
2015-05-26 12:24   ` Eric Auger [this message]
2015-05-24 10:51 ` [Qemu-devel] [PATCH v3 2/4] arm_gicv2m: Add GICv2m widget to support MSIs Christoffer Dall
2015-05-26 12:24   ` Eric Auger
2015-05-24 10:51 ` [Qemu-devel] [PATCH v3 3/4] target-arm: Extend the gic node properties Christoffer Dall
2015-05-26 12:54   ` Eric Auger
2015-05-24 10:51 ` [Qemu-devel] [PATCH v3 4/4] target-arm: Add the GICv2m to the virt board Christoffer Dall
2015-05-25 13:09   ` Pavel Fedin
2015-05-25 15:01     ` Peter Maydell
2015-05-25 16:25       ` Eric Auger
2015-05-26  6:39         ` Pavel Fedin
2015-05-25 20:56     ` Christoffer Dall
2015-05-26 12:54   ` Eric Auger
2015-05-26 12:55     ` Peter Maydell
2015-05-26 13:07       ` Eric Auger
2015-05-26 13:52         ` Peter Maydell
2015-05-26 13:54         ` Pavel Fedin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55646601.6060804@linaro.org \
    --to=eric.auger@linaro.org \
    --cc=christoffer.dall@linaro.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).