qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 2/3] hw/ssi: Add Nuvoton PSPI Module


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH 2/3] hw/ssi: Add Nuvoton PSPI Module
Date: Wed, 8 Feb 2023 08:45:54 +0100
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.6.1

On 7/2/23 20:21, Hao Wu wrote:
On Tue, Feb 7, 2023 at 10:46 AM Hao Wu <wuhaotsh@google.com <mailto:wuhaotsh@google.com>> wrote:

    Thanks for your review!

    On Mon, Feb 6, 2023 at 11:13 PM Philippe Mathieu-Daudé
    <philmd@linaro.org <mailto:philmd@linaro.org>> wrote:

        On 7/2/23 00:34, Hao Wu wrote:
         > Nuvoton's PSPI is a general purpose SPI module which enables
         > connections to SPI-based peripheral devices.
         >
         > Signed-off-by: Hao Wu <wuhaotsh@google.com
        <mailto:wuhaotsh@google.com>>
         > Reviewed-by: Chris Rauer <crauer@google.com
        <mailto:crauer@google.com>>
         > ---
         >   MAINTAINERS                |   6 +-
         >   hw/ssi/meson.build         |   2 +-
         >   hw/ssi/npcm_pspi.c         | 216
        +++++++++++++++++++++++++++++++++++++
         >   hw/ssi/trace-events        |   5 +
         >   include/hw/ssi/npcm_pspi.h |  53 +++++++++
         >   5 files changed, 278 insertions(+), 4 deletions(-)
         >   create mode 100644 hw/ssi/npcm_pspi.c
         >   create mode 100644 include/hw/ssi/npcm_pspi.h


         > +static void npcm_pspi_realize(DeviceState *dev, Error **errp)
         > +{
         > +    NPCMPSPIState *s = NPCM_PSPI(dev);
         > +    SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
         > +    Object *obj = OBJECT(dev);
         > +
         > +    s->spi = ssi_create_bus(dev, "pspi");

        FYI there is an ongoing discussion about how to model QOM tree. If
        this bus isn't shared with another controller, the "embed QOM child
        in parent" style could be preferred. If so, the bus would be created
        as:

                object_initialize_child(obj, "pspi", &s->spi, TYPE_SSI_BUS);

    I was just following some existing code here. I think I can use the
new style.
I've tried to use this and got the following error:
**
ERROR:../qom/object.c:511:object_initialize_with_type: assertion failed: (size >= type->instance_size) Bail out! ERROR:../qom/object.c:511:object_initialize_with_type: assertion failed: (size >= type->instance_size)

I think the problem is that we define s->spi as SSIBus* instead of SSIBus. But if we define it as SSIBus, we'll get an incomplete type error. Fixing it will require refactoring hw/ssi/ssi.c which I'm not sure if we want to do it right now. This code is consistent with other code in hw/ssi so I guess we can leave it here for now and wait
for a future refactor.
Sorry, I was just mumbling alone thinking about what would need to be
done, not asking you to change it yet :/ I should have been
more explicit.



reply via email to

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