qemu-arm
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 3/5] hw/intc/exynos4210_combiner: replace 'qemu_split_irq'


From: Peter Maydell
Subject: Re: [PATCH v3 3/5] hw/intc/exynos4210_combiner: replace 'qemu_split_irq' with 'TYPE_SPLIT_IRQ'
Date: Wed, 23 Mar 2022 18:14:50 +0000

On Wed, 23 Mar 2022 at 17:36, Zongyuan Li <zongyuan.li@smartx.com> wrote:
>
> Signed-off-by: Zongyuan Li <zongyuan.li@smartx.com>
> ---
>  hw/intc/exynos4210_combiner.c | 32 +++++++++++++++++++++++++-------
>  1 file changed, 25 insertions(+), 7 deletions(-)
>
> diff --git a/hw/intc/exynos4210_combiner.c b/hw/intc/exynos4210_combiner.c
> index 4534ee248d..18dade35d3 100644
> --- a/hw/intc/exynos4210_combiner.c
> +++ b/hw/intc/exynos4210_combiner.c
> @@ -31,10 +31,12 @@
>  #include "hw/sysbus.h"
>  #include "migration/vmstate.h"
>  #include "qemu/module.h"
> +#include "qapi/error.h"
>
>  #include "hw/arm/exynos4210.h"
>  #include "hw/hw.h"
>  #include "hw/irq.h"
> +#include "hw/core/split-irq.h"
>  #include "hw/qdev-properties.h"
>  #include "qom/object.h"
>
> @@ -105,6 +107,22 @@ static const VMStateDescription 
> vmstate_exynos4210_combiner = {
>      }
>  };
>
> +static qemu_irq split_irq(qemu_irq out1, qemu_irq out2) {
> +    DeviceState *splitter = qdev_new(TYPE_SPLIT_IRQ);
> +
> +    qdev_prop_set_uint32(splitter, "num-lines", 2);
> +
> +    if (!qdev_realize_and_unref(splitter, NULL, &error_fatal)) {
> +        hw_error("exynos4210.combiner: unable to realize split irq device");
> +        return NULL;
> +    }
> +
> +    qdev_connect_gpio_out(splitter, 0, out1);
> +    qdev_connect_gpio_out(splitter, 1, out2);
> +
> +    return qdev_get_gpio_in(splitter, 0);
> +}

This is an device object, so it needs to handle the splitter device
differently to how board code does it. The splitters should be struct
fields in the device's state struct. The device instance init
method should initialize the devices with object_initialize_child().
The realize method should call qdev_realize() (not _realize_and_undef)
and wire up the gpio lines. There's an example in hw/arm/armsse.c.

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]