[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v1 1/2] hw/arm: versal: Add support for the LPD ADMAs
From: |
Peter Maydell |
Subject: |
Re: [PATCH v1 1/2] hw/arm: versal: Add support for the LPD ADMAs |
Date: |
Mon, 2 Mar 2020 11:22:56 +0000 |
On Thu, 27 Feb 2020 at 03:17, Edgar E. Iglesias
<address@hidden> wrote:
>
> From: "Edgar E. Iglesias" <address@hidden>
>
> Add support for the Versal LPD ADMAs.
>
> Signed-off-by: Edgar E. Iglesias <address@hidden>
> ---
> hw/arm/xlnx-versal.c | 24 ++++++++++++++++++++++++
> include/hw/arm/xlnx-versal.h | 6 ++++++
> 2 files changed, 30 insertions(+)
>
> diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
> index 1cf3daaf4f..f9beba07ed 100644
> --- a/hw/arm/xlnx-versal.c
> +++ b/hw/arm/xlnx-versal.c
> @@ -193,6 +193,29 @@ static void versal_create_gems(Versal *s, qemu_irq *pic)
> }
> }
>
> +static void versal_create_admas(Versal *s, qemu_irq *pic)
> +{
> + int i;
> +
> + for (i = 0; i < ARRAY_SIZE(s->lpd.iou.adma); i++) {
> + char *name = g_strdup_printf("adma%d", i);
> + DeviceState *dev;
> + MemoryRegion *mr;
> +
> + dev = qdev_create(NULL, "xlnx.zdma");
> + s->lpd.iou.adma[i] = SYS_BUS_DEVICE(dev);
> + object_property_add_child(OBJECT(s), name, OBJECT(dev),
> &error_fatal);
> + qdev_init_nofail(dev);
> +
> + mr = sysbus_mmio_get_region(s->lpd.iou.adma[i], 0);
> + memory_region_add_subregion(&s->mr_ps,
> + MM_ADMA_CH0 + i * MM_ADMA_CH0_SIZE, mr);
> +
> + sysbus_connect_irq(s->lpd.iou.adma[i], 0, pic[VERSAL_ADMA_IRQ_0 +
> i]);
> + g_free(name);
> + }
> +}
It would be more in the modern style to write it with the child device
struct embedded in the parent struct, object_initialize_child() in the
parent init, and object_property_set_bool(..., true, "realized", ...)
in the parent realized, but I guess this fits with the way the
rest of the existing device is written.
Series applied to target-arm.next, thanks.
thanks
-- PMM