qemu-arm
[Top][All Lists]
Advanced

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

Re: [Qemu-arm] [Qemu-devel] [PATCH v1 1/5] cadence_gem: QOMify Cadence G


From: Peter Maydell
Subject: Re: [Qemu-arm] [Qemu-devel] [PATCH v1 1/5] cadence_gem: QOMify Cadence GEM
Date: Mon, 25 Jul 2016 17:55:04 +0100

On 25 July 2016 at 17:42, Alistair Francis <address@hidden> wrote:
> On Mon, Jul 25, 2016 at 9:38 AM, Alistair Francis
> <address@hidden> wrote:
>> On Mon, Jul 25, 2016 at 8:20 AM, Peter Maydell <address@hidden> wrote:
>>> On 12 July 2016 at 00:20, Alistair Francis <address@hidden> wrote:
>>>> Signed-off-by: Alistair Francis <address@hidden>
>>>> ---
>>>>
>>>>  hw/net/cadence_gem.c | 27 ++++++++++++++++-----------
>>>>  1 file changed, 16 insertions(+), 11 deletions(-)
>>>>
>>>> diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c
>>>> index 8a4be1e..9d64644 100644
>>>> --- a/hw/net/cadence_gem.c
>>>> +++ b/hw/net/cadence_gem.c
>>>> @@ -1214,24 +1214,29 @@ static NetClientInfo net_gem_info = {
>>>>      .link_status_changed = gem_set_link,
>>>>  };
>>>>
>>>> -static int gem_init(SysBusDevice *sbd)
>>>> +static void gem_realize(DeviceState *dev, Error **errp)
>>>>  {
>>>> -    DeviceState *dev = DEVICE(sbd);
>>>>      CadenceGEMState *s = CADENCE_GEM(dev);
>>>>
>>>> -    DB_PRINT("\n");
>>>> +    sysbus_init_irq(SYS_BUS_DEVICE(dev), &s->irq);
>>>>
>>>> -    gem_init_register_masks(s);
>>>> -    memory_region_init_io(&s->iomem, OBJECT(s), &gem_ops, s,
>>>> -                          "enet", sizeof(s->regs));
>>>> -    sysbus_init_mmio(sbd, &s->iomem);
>>>> -    sysbus_init_irq(sbd, &s->irq);
>>>>      qemu_macaddr_default_if_unset(&s->conf.macaddr);
>>>>
>>>>      s->nic = qemu_new_nic(&net_gem_info, &s->conf,
>>>>              object_get_typename(OBJECT(dev)), dev->id, s);
>>>> +}
>>>> +
>>>> +static void gem_init(Object *obj)
>>>> +{
>>>> +    CadenceGEMState *s = CADENCE_GEM(obj);
>>>> +    DeviceState *dev = DEVICE(obj);
>>>> +
>>>> +    DB_PRINT("\n");
>>>>
>>>> -    return 0;
>>>> +    gem_init_register_masks(s);
>>>> +    memory_region_init_io(&s->iomem, OBJECT(s), &gem_ops, s,
>>>> +                          "enet", sizeof(s->regs));
>>>> +    sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->iomem);
>>>>  }
>>>
>>> I don't understand the logic behind which things are
>>> in init and which in realize here -- why is
>>> sysbus_init_mmio() in init but sysbus_init_irq() in
>>> realize ?
>>
>> That was just a mistake. I have moved all of the *_init_* functions to
>> the main init function.
>
> As soon as I sent that mail I remembered why it was like that.
>
> Eventually the sysbus_init_irq() function depends on the number of
> queues, which is a property so it can't be set in the init.
>
> Do you think the sysbus_init_mmio() should be moved to the realise as well 
> then?

Oh, I see. This is fine, then, but put a note in the commit message
about why the sysbus_init_irq() is where it is.

Reviewed-by: Peter Maydell <address@hidden>

thanks
-- PMM



reply via email to

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