[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 11/24] cpu/a15mpcore: Embed GICState
From: |
Andreas Färber |
Subject: |
[Qemu-devel] [PATCH v3 11/24] cpu/a15mpcore: Embed GICState |
Date: |
Tue, 20 Aug 2013 17:21:03 +0200 |
From: Andreas Färber <address@hidden>
This covers both emulated and KVM GIC.
Prepares for QOM realize.
Signed-off-by: Andreas Färber <address@hidden>
---
hw/cpu/a15mpcore.c | 35 ++++++++++++++++++++++-------------
1 file changed, 22 insertions(+), 13 deletions(-)
diff --git a/hw/cpu/a15mpcore.c b/hw/cpu/a15mpcore.c
index c261cea..3f8b07b 100644
--- a/hw/cpu/a15mpcore.c
+++ b/hw/cpu/a15mpcore.c
@@ -20,6 +20,7 @@
#include "hw/sysbus.h"
#include "sysemu/kvm.h"
+#include "hw/intc/arm_gic.h"
/* A15MP private memory region. */
@@ -35,40 +36,48 @@ typedef struct A15MPPrivState {
uint32_t num_cpu;
uint32_t num_irq;
MemoryRegion container;
- DeviceState *gic;
+
+ GICState gic;
} A15MPPrivState;
static void a15mp_priv_set_irq(void *opaque, int irq, int level)
{
A15MPPrivState *s = (A15MPPrivState *)opaque;
- qemu_set_irq(qdev_get_gpio_in(s->gic, irq), level);
+
+ qemu_set_irq(qdev_get_gpio_in(DEVICE(&s->gic), irq), level);
}
static void a15mp_priv_initfn(Object *obj)
{
SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
A15MPPrivState *s = A15MPCORE_PRIV(obj);
+ DeviceState *gicdev;
+ const char *gictype = "arm_gic";
+
+ if (kvm_irqchip_in_kernel()) {
+ gictype = "kvm-arm-gic";
+ }
memory_region_init(&s->container, obj, "a15mp-priv-container", 0x8000);
sysbus_init_mmio(sbd, &s->container);
+
+ object_initialize(&s->gic, gictype);
+ gicdev = DEVICE(&s->gic);
+ qdev_set_parent_bus(gicdev, sysbus_get_default());
+ qdev_prop_set_uint32(gicdev, "revision", 2);
}
static int a15mp_priv_init(SysBusDevice *dev)
{
A15MPPrivState *s = A15MPCORE_PRIV(dev);
+ DeviceState *gicdev;
SysBusDevice *busdev;
- const char *gictype = "arm_gic";
-
- if (kvm_irqchip_in_kernel()) {
- gictype = "kvm-arm-gic";
- }
- s->gic = qdev_create(NULL, gictype);
- qdev_prop_set_uint32(s->gic, "num-cpu", s->num_cpu);
- qdev_prop_set_uint32(s->gic, "num-irq", s->num_irq);
- qdev_prop_set_uint32(s->gic, "revision", 2);
- qdev_init_nofail(s->gic);
- busdev = SYS_BUS_DEVICE(s->gic);
+ gicdev = DEVICE(&s->gic);
+ qdev_prop_set_uint32(gicdev, "num-cpu", s->num_cpu);
+ qdev_prop_set_uint32(gicdev, "num-irq", s->num_irq);
+ qdev_init_nofail(gicdev);
+ busdev = SYS_BUS_DEVICE(&s->gic);
/* Pass through outbound IRQ lines from the GIC */
sysbus_pass_irq(dev, busdev);
--
1.8.1.4
- [Qemu-devel] [PATCH v3 00/24] arm: ARM11MPCore+A9MPCore+A15MPCore QOM'ification, Andreas Färber, 2013/08/20
- [Qemu-devel] [PATCH v3 02/24] intc/arm_gic: Extract headers hw/intc/arm_gic{, _common}.h, Andreas Färber, 2013/08/20
- [Qemu-devel] [PATCH v3 14/24] a9scu: Build only once, Andreas Färber, 2013/08/20
- [Qemu-devel] [PATCH v3 01/24] cpu/a9mpcore: Split off instance_init, Andreas Färber, 2013/08/20
- [Qemu-devel] [PATCH v3 03/24] cpu/a9mpcore: Embed GICState, Andreas Färber, 2013/08/20
- [Qemu-devel] [PATCH v3 10/24] cpu/a15mpcore: Split off instance_init, Andreas Färber, 2013/08/20
- [Qemu-devel] [PATCH v3 08/24] cpu/a9mpcore: Convert to QOM realize, Andreas Färber, 2013/08/20
- [Qemu-devel] [PATCH v3 11/24] cpu/a15mpcore: Embed GICState,
Andreas Färber <=
- [Qemu-devel] [PATCH v3 04/24] misc/a9scu: QOM cleanups, Andreas Färber, 2013/08/20
- [Qemu-devel] [PATCH v3 15/24] arm11mpcore: Fix typo in MemoryRegion name, Andreas Färber, 2013/08/20
- [Qemu-devel] [PATCH v3 05/24] cpu/a9mpcore: Embed A9SCUState, Andreas Färber, 2013/08/20
- [Qemu-devel] [PATCH v3 07/24] cpu/a9mpcore: Embed ARMMPTimerState, Andreas Färber, 2013/08/20
- [Qemu-devel] [PATCH v3 06/24] timer/arm_mptimer: Convert to QOM realize, Andreas Färber, 2013/08/20
- [Qemu-devel] [PATCH v3 17/24] arm11mpcore: Create container MemoryRegion in instance_init, Andreas Färber, 2013/08/20
- [Qemu-devel] [PATCH v3 20/24] realview_gic: Convert to QOM realize, Andreas Färber, 2013/08/20