[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 11/22] target-arm: Add GIC phandle to VirtBoardInfo
From: |
Peter Maydell |
Subject: |
[Qemu-devel] [PULL 11/22] target-arm: Add GIC phandle to VirtBoardInfo |
Date: |
Tue, 2 Jun 2015 17:33:41 +0100 |
From: Christoffer Dall <address@hidden>
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 <address@hidden>
Reviewed-by: Peter Maydell <address@hidden>
Signed-off-by: Christoffer Dall <address@hidden>
Message-id: address@hidden
Signed-off-by: Peter Maydell <address@hidden>
---
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
--
1.9.1
- Re: [Qemu-devel] [PULL 20/22] hw/arm/boot: arm_load_kernel implemented as a machine init done notifier, (continued)
- [Qemu-devel] [PULL 21/22] hw/arm/virt: add dynamic sysbus device support, Peter Maydell, 2015/06/02
- [Qemu-devel] [PULL 17/22] arm_gicv2m: set kvm_gsi_direct_mapping and kvm_msi_via_irqfd_allowed, Peter Maydell, 2015/06/02
- [Qemu-devel] [PULL 16/22] kvm: introduce kvm_arch_msi_data_to_gsi, Peter Maydell, 2015/06/02
- [Qemu-devel] [PULL 19/22] hw/arm/sysbus-fdt: helpers for platform bus nodes addition, Peter Maydell, 2015/06/02
- [Qemu-devel] [PULL 15/22] pl061: fix wrong calculation of GPIOMIS register, Peter Maydell, 2015/06/02
- [Qemu-devel] [PULL 13/22] target-arm: Extend the gic node properties, Peter Maydell, 2015/06/02
- [Qemu-devel] [PULL 14/22] target-arm: Add the GICv2m to the virt board, Peter Maydell, 2015/06/02
- [Qemu-devel] [PULL 09/22] target-arm: Add TLBI_VAE2{IS}, Peter Maydell, 2015/06/02
- [Qemu-devel] [PULL 11/22] target-arm: Add GIC phandle to VirtBoardInfo,
Peter Maydell <=
- [Qemu-devel] [PULL 08/22] target-arm: Add TLBI_ALLE2, Peter Maydell, 2015/06/02
- [Qemu-devel] [PULL 06/22] target-arm: Add TTBR0_EL2, Peter Maydell, 2015/06/02
- [Qemu-devel] [PULL 05/22] target-arm: Add TPIDR_EL2, Peter Maydell, 2015/06/02
- [Qemu-devel] [PULL 12/22] arm_gicv2m: Add GICv2m widget to support MSIs, Peter Maydell, 2015/06/02
- [Qemu-devel] [PULL 04/22] target-arm: Add SCTLR_EL2, Peter Maydell, 2015/06/02
- [Qemu-devel] [PULL 02/22] target-arm: Add MAIR_EL2, Peter Maydell, 2015/06/02
- [Qemu-devel] [PULL 10/22] Revert "target-arm: Avoid g_hash_table_get_keys()", Peter Maydell, 2015/06/02
- [Qemu-devel] [PULL 03/22] target-arm: Add TCR_EL2, Peter Maydell, 2015/06/02
- [Qemu-devel] [PULL 18/22] target-arm: Remove v8_ prefix from names of non-v8-specific cpreg arrays, Peter Maydell, 2015/06/02
- [Qemu-devel] [PULL 07/22] target-arm: Add TLBI_ALLE1{IS}, Peter Maydell, 2015/06/02