qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Alistair Francis <alistair.francis@xilinx.com>
Cc: Peter Crosthwaite <crosthwaitepeter@gmail.com>,
	qemu-arm <qemu-arm@nongnu.org>,
	QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH v1 1/5] cadence_gem: QOMify Cadence GEM
Date: Mon, 25 Jul 2016 17:55:04 +0100	[thread overview]
Message-ID: <CAFEAcA_TxR5TehaTQayzRTP6LbRGADdj5wUhYuGE_e_VKyO61Q@mail.gmail.com> (raw)
In-Reply-To: <CAKmqyKNFekP+i7z5HUhyAhoWYit4zCDKG3taonOYe1n=KiayJg@mail.gmail.com>

On 25 July 2016 at 17:42, Alistair Francis <alistair.francis@xilinx.com> wrote:
> On Mon, Jul 25, 2016 at 9:38 AM, Alistair Francis
> <alistair.francis@xilinx.com> wrote:
>> On Mon, Jul 25, 2016 at 8:20 AM, Peter Maydell <peter.maydell@linaro.org> wrote:
>>> On 12 July 2016 at 00:20, Alistair Francis <alistair.francis@xilinx.com> wrote:
>>>> Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
>>>> ---
>>>>
>>>>  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 <peter.maydell@linaro.org>

thanks
-- PMM

  reply	other threads:[~2016-07-25 16:55 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-11 23:20 [Qemu-devel] [PATCH v1 0/5] Add support for Cadence GEM priority queues Alistair Francis
2016-07-11 23:20 ` [Qemu-devel] [PATCH v1 1/5] cadence_gem: QOMify Cadence GEM Alistair Francis
2016-07-25 15:20   ` Peter Maydell
2016-07-25 16:38     ` Alistair Francis
2016-07-25 16:42       ` Alistair Francis
2016-07-25 16:55         ` Peter Maydell [this message]
2016-07-11 23:20 ` [Qemu-devel] [PATCH v1 2/5] cadence_gem: Arrayify Alistair Francis
2016-07-25 15:22   ` Peter Maydell
2016-07-11 23:20 ` [Qemu-devel] [PATCH v1 3/5] cadence_gem: Add queue support Alistair Francis
2016-07-25 15:46   ` Peter Maydell
2016-07-25 23:01     ` Alistair Francis
2016-07-11 23:20 ` [Qemu-devel] [PATCH v1 4/5] cadence_gem: Correct indentation Alistair Francis
2016-07-25 15:48   ` Peter Maydell
2016-07-25 16:34     ` Alistair Francis
2016-07-25 16:55       ` Peter Maydell
2016-07-11 23:20 ` [Qemu-devel] [PATCH v1 5/5] xlnx-zynqmp: Set the number of priority queues Alistair Francis
2016-07-25 15:50   ` Peter Maydell
2016-07-12 14:25 ` [Qemu-devel] [PATCH v1 0/5] Add support for Cadence GEM " Peter Maydell
2016-07-12 16:34   ` Alistair Francis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFEAcA_TxR5TehaTQayzRTP6LbRGADdj5wUhYuGE_e_VKyO61Q@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=alistair.francis@xilinx.com \
    --cc=crosthwaitepeter@gmail.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).