Message ID | 20200427181649.26851-6-edgar.iglesias@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v1,01/11] hw/arm: versal: Remove inclusion of arm_gicv3_common.h | expand |
On Mon, Apr 27, 2020 at 11:20 AM Edgar E. Iglesias <edgar.iglesias@gmail.com> wrote: > > From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> > > Embedd the GEMs into the SoC type. > > Suggested-by: Peter Maydell <peter.maydell@linaro.org> > Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Alistair > --- > hw/arm/xlnx-versal.c | 15 ++++++++------- > include/hw/arm/xlnx-versal.h | 3 ++- > 2 files changed, 10 insertions(+), 8 deletions(-) > > diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c > index dbde03b7e6..e424aa789e 100644 > --- a/hw/arm/xlnx-versal.c > +++ b/hw/arm/xlnx-versal.c > @@ -170,25 +170,26 @@ static void versal_create_gems(Versal *s, qemu_irq *pic) > DeviceState *dev; > MemoryRegion *mr; > > - dev = qdev_create(NULL, "cadence_gem"); > - s->lpd.iou.gem[i] = SYS_BUS_DEVICE(dev); > - object_property_add_child(OBJECT(s), name, OBJECT(dev), &error_fatal); > + sysbus_init_child_obj(OBJECT(s), name, > + &s->lpd.iou.gem[i], sizeof(s->lpd.iou.gem[i]), > + TYPE_CADENCE_GEM); > + dev = DEVICE(&s->lpd.iou.gem[i]); > if (nd->used) { > qemu_check_nic_model(nd, "cadence_gem"); > qdev_set_nic_properties(dev, nd); > } > - object_property_set_int(OBJECT(s->lpd.iou.gem[i]), > + object_property_set_int(OBJECT(dev), > 2, "num-priority-queues", > &error_abort); > - object_property_set_link(OBJECT(s->lpd.iou.gem[i]), > + object_property_set_link(OBJECT(dev), > OBJECT(&s->mr_ps), "dma", > &error_abort); > qdev_init_nofail(dev); > > - mr = sysbus_mmio_get_region(s->lpd.iou.gem[i], 0); > + mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0); > memory_region_add_subregion(&s->mr_ps, addrs[i], mr); > > - sysbus_connect_irq(s->lpd.iou.gem[i], 0, pic[irqs[i]]); > + sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[irqs[i]]); > g_free(name); > } > } > diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h > index a3dfd064b3..01da736a5b 100644 > --- a/include/hw/arm/xlnx-versal.h > +++ b/include/hw/arm/xlnx-versal.h > @@ -16,6 +16,7 @@ > #include "hw/arm/boot.h" > #include "hw/intc/arm_gicv3.h" > #include "hw/char/pl011.h" > +#include "hw/net/cadence_gem.h" > > #define TYPE_XLNX_VERSAL "xlnx-versal" > #define XLNX_VERSAL(obj) OBJECT_CHECK(Versal, (obj), TYPE_XLNX_VERSAL) > @@ -51,7 +52,7 @@ typedef struct Versal { > > struct { > PL011State uart[XLNX_VERSAL_NR_UARTS]; > - SysBusDevice *gem[XLNX_VERSAL_NR_GEMS]; > + CadenceGEMState gem[XLNX_VERSAL_NR_GEMS]; > SysBusDevice *adma[XLNX_VERSAL_NR_ADMAS]; > } iou; > } lpd; > -- > 2.20.1 > >
On 4/27/20 8:16 PM, Edgar E. Iglesias wrote: > From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> > > Embedd the GEMs into the SoC type. > > Suggested-by: Peter Maydell <peter.maydell@linaro.org> > Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> > --- > hw/arm/xlnx-versal.c | 15 ++++++++------- > include/hw/arm/xlnx-versal.h | 3 ++- > 2 files changed, 10 insertions(+), 8 deletions(-) > > diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c > index dbde03b7e6..e424aa789e 100644 > --- a/hw/arm/xlnx-versal.c > +++ b/hw/arm/xlnx-versal.c > @@ -170,25 +170,26 @@ static void versal_create_gems(Versal *s, qemu_irq *pic) > DeviceState *dev; > MemoryRegion *mr; > > - dev = qdev_create(NULL, "cadence_gem"); > - s->lpd.iou.gem[i] = SYS_BUS_DEVICE(dev); > - object_property_add_child(OBJECT(s), name, OBJECT(dev), &error_fatal); > + sysbus_init_child_obj(OBJECT(s), name, > + &s->lpd.iou.gem[i], sizeof(s->lpd.iou.gem[i]), > + TYPE_CADENCE_GEM); > + dev = DEVICE(&s->lpd.iou.gem[i]); > if (nd->used) { > qemu_check_nic_model(nd, "cadence_gem"); > qdev_set_nic_properties(dev, nd); > } > - object_property_set_int(OBJECT(s->lpd.iou.gem[i]), > + object_property_set_int(OBJECT(dev), > 2, "num-priority-queues", > &error_abort); > - object_property_set_link(OBJECT(s->lpd.iou.gem[i]), > + object_property_set_link(OBJECT(dev), > OBJECT(&s->mr_ps), "dma", > &error_abort); > qdev_init_nofail(dev); > > - mr = sysbus_mmio_get_region(s->lpd.iou.gem[i], 0); > + mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0); > memory_region_add_subregion(&s->mr_ps, addrs[i], mr); > > - sysbus_connect_irq(s->lpd.iou.gem[i], 0, pic[irqs[i]]); > + sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[irqs[i]]); > g_free(name); > } > } > diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h > index a3dfd064b3..01da736a5b 100644 > --- a/include/hw/arm/xlnx-versal.h > +++ b/include/hw/arm/xlnx-versal.h > @@ -16,6 +16,7 @@ > #include "hw/arm/boot.h" > #include "hw/intc/arm_gicv3.h" > #include "hw/char/pl011.h" > +#include "hw/net/cadence_gem.h" > > #define TYPE_XLNX_VERSAL "xlnx-versal" > #define XLNX_VERSAL(obj) OBJECT_CHECK(Versal, (obj), TYPE_XLNX_VERSAL) > @@ -51,7 +52,7 @@ typedef struct Versal { > > struct { > PL011State uart[XLNX_VERSAL_NR_UARTS]; > - SysBusDevice *gem[XLNX_VERSAL_NR_GEMS]; > + CadenceGEMState gem[XLNX_VERSAL_NR_GEMS]; > SysBusDevice *adma[XLNX_VERSAL_NR_ADMAS]; > } iou; > } lpd; > Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
On 4/27/20 8:16 PM, Edgar E. Iglesias wrote: > From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> > > Embedd the GEMs into the SoC type. > > Suggested-by: Peter Maydell <peter.maydell@linaro.org> > Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> Reviewed-by: Luc Michel <luc.michel@greensocs.com> > --- > hw/arm/xlnx-versal.c | 15 ++++++++------- > include/hw/arm/xlnx-versal.h | 3 ++- > 2 files changed, 10 insertions(+), 8 deletions(-) > > diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c > index dbde03b7e6..e424aa789e 100644 > --- a/hw/arm/xlnx-versal.c > +++ b/hw/arm/xlnx-versal.c > @@ -170,25 +170,26 @@ static void versal_create_gems(Versal *s, qemu_irq *pic) > DeviceState *dev; > MemoryRegion *mr; > > - dev = qdev_create(NULL, "cadence_gem"); > - s->lpd.iou.gem[i] = SYS_BUS_DEVICE(dev); > - object_property_add_child(OBJECT(s), name, OBJECT(dev), &error_fatal); > + sysbus_init_child_obj(OBJECT(s), name, > + &s->lpd.iou.gem[i], sizeof(s->lpd.iou.gem[i]), > + TYPE_CADENCE_GEM); > + dev = DEVICE(&s->lpd.iou.gem[i]); > if (nd->used) { > qemu_check_nic_model(nd, "cadence_gem"); > qdev_set_nic_properties(dev, nd); > } > - object_property_set_int(OBJECT(s->lpd.iou.gem[i]), > + object_property_set_int(OBJECT(dev), > 2, "num-priority-queues", > &error_abort); > - object_property_set_link(OBJECT(s->lpd.iou.gem[i]), > + object_property_set_link(OBJECT(dev), > OBJECT(&s->mr_ps), "dma", > &error_abort); > qdev_init_nofail(dev); > > - mr = sysbus_mmio_get_region(s->lpd.iou.gem[i], 0); > + mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0); > memory_region_add_subregion(&s->mr_ps, addrs[i], mr); > > - sysbus_connect_irq(s->lpd.iou.gem[i], 0, pic[irqs[i]]); > + sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[irqs[i]]); > g_free(name); > } > } > diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h > index a3dfd064b3..01da736a5b 100644 > --- a/include/hw/arm/xlnx-versal.h > +++ b/include/hw/arm/xlnx-versal.h > @@ -16,6 +16,7 @@ > #include "hw/arm/boot.h" > #include "hw/intc/arm_gicv3.h" > #include "hw/char/pl011.h" > +#include "hw/net/cadence_gem.h" > > #define TYPE_XLNX_VERSAL "xlnx-versal" > #define XLNX_VERSAL(obj) OBJECT_CHECK(Versal, (obj), TYPE_XLNX_VERSAL) > @@ -51,7 +52,7 @@ typedef struct Versal { > > struct { > PL011State uart[XLNX_VERSAL_NR_UARTS]; > - SysBusDevice *gem[XLNX_VERSAL_NR_GEMS]; > + CadenceGEMState gem[XLNX_VERSAL_NR_GEMS]; > SysBusDevice *adma[XLNX_VERSAL_NR_ADMAS]; > } iou; > } lpd; >
diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c index dbde03b7e6..e424aa789e 100644 --- a/hw/arm/xlnx-versal.c +++ b/hw/arm/xlnx-versal.c @@ -170,25 +170,26 @@ static void versal_create_gems(Versal *s, qemu_irq *pic) DeviceState *dev; MemoryRegion *mr; - dev = qdev_create(NULL, "cadence_gem"); - s->lpd.iou.gem[i] = SYS_BUS_DEVICE(dev); - object_property_add_child(OBJECT(s), name, OBJECT(dev), &error_fatal); + sysbus_init_child_obj(OBJECT(s), name, + &s->lpd.iou.gem[i], sizeof(s->lpd.iou.gem[i]), + TYPE_CADENCE_GEM); + dev = DEVICE(&s->lpd.iou.gem[i]); if (nd->used) { qemu_check_nic_model(nd, "cadence_gem"); qdev_set_nic_properties(dev, nd); } - object_property_set_int(OBJECT(s->lpd.iou.gem[i]), + object_property_set_int(OBJECT(dev), 2, "num-priority-queues", &error_abort); - object_property_set_link(OBJECT(s->lpd.iou.gem[i]), + object_property_set_link(OBJECT(dev), OBJECT(&s->mr_ps), "dma", &error_abort); qdev_init_nofail(dev); - mr = sysbus_mmio_get_region(s->lpd.iou.gem[i], 0); + mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0); memory_region_add_subregion(&s->mr_ps, addrs[i], mr); - sysbus_connect_irq(s->lpd.iou.gem[i], 0, pic[irqs[i]]); + sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[irqs[i]]); g_free(name); } } diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h index a3dfd064b3..01da736a5b 100644 --- a/include/hw/arm/xlnx-versal.h +++ b/include/hw/arm/xlnx-versal.h @@ -16,6 +16,7 @@ #include "hw/arm/boot.h" #include "hw/intc/arm_gicv3.h" #include "hw/char/pl011.h" +#include "hw/net/cadence_gem.h" #define TYPE_XLNX_VERSAL "xlnx-versal" #define XLNX_VERSAL(obj) OBJECT_CHECK(Versal, (obj), TYPE_XLNX_VERSAL) @@ -51,7 +52,7 @@ typedef struct Versal { struct { PL011State uart[XLNX_VERSAL_NR_UARTS]; - SysBusDevice *gem[XLNX_VERSAL_NR_GEMS]; + CadenceGEMState gem[XLNX_VERSAL_NR_GEMS]; SysBusDevice *adma[XLNX_VERSAL_NR_ADMAS]; } iou; } lpd;