From: Markus Armbruster <armbru@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Alistair Francis <alistair.francis@wdc.com>,
qemu-devel@nongnu.org, Peter Maydell <peter.maydell@linaro.org>
Subject: Re: [PATCH RESEND v3 56/58] qdev: Convert bus-less devices to qdev_realize() with Coccinelle
Date: Wed, 10 Jun 2020 11:37:55 +0200 [thread overview]
Message-ID: <87sgf3feh8.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <0a4e8a47-5d11-0864-8ad8-700922d08712@redhat.com> ("Philippe Mathieu-Daudé"'s message of "Wed, 10 Jun 2020 10:21:05 +0200")
Philippe Mathieu-Daudé <philmd@redhat.com> writes:
> Hi Markus, Peter.
>
> On 6/10/20 7:32 AM, Markus Armbruster wrote:
>> All remaining conversions to qdev_realize() are for bus-less devices.
>> Coccinelle script:
>>
>> // only correct for bus-less @dev!
>>
>> @@
>> expression errp;
>> expression dev;
>> @@
>> - qdev_init_nofail(dev);
>> + qdev_realize(dev, NULL, &error_fatal);
>>
>> @ depends on !(file in "hw/core/qdev.c") && !(file in "hw/core/bus.c")@
>> expression errp;
>> expression dev;
>> symbol true;
>> @@
>> - object_property_set_bool(OBJECT(dev), true, "realized", errp);
>> + qdev_realize(DEVICE(dev), NULL, errp);
>>
>> @ depends on !(file in "hw/core/qdev.c") && !(file in "hw/core/bus.c")@
>> expression errp;
>> expression dev;
>> symbol true;
>> @@
>> - object_property_set_bool(dev, true, "realized", errp);
>> + qdev_realize(DEVICE(dev), NULL, errp);
>
> Finally. Now my ealier suggestion is easier to explain:
> Rename qdev_realize() -> sysbus_realize(), extracting the qdev_realize()
> part. qdev_realize() doesn't take a Bus argument anymore.
> Left for later.
I'm still confused.
Cases:
* Devices that plug into a bus: use qdev_realize() passing that bus.
If there is a bus-specific wrapper, use that, for legibility.
In particular, use sysbus_realize() for sysbus devices plugging into
the main system bus.
* Devices that don't plug into a bus: use qdev_realize() passing a null
bus.
What would you like me to improve here?
>
>>
>> Note that Coccinelle chokes on ARMSSE typedef vs. macro in
>> hw/arm/armsse.c. Worked around by temporarily renaming the macro for
>> the spatch run.
>>
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>> Acked-by: Alistair Francis <alistair.francis@wdc.com>
>> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
>> ---
>> hw/arm/allwinner-a10.c | 2 +-
>> hw/arm/allwinner-h3.c | 2 +-
>> hw/arm/armsse.c | 20 ++++++---------
>> hw/arm/armv7m.c | 2 +-
>> hw/arm/aspeed.c | 3 +--
>> hw/arm/aspeed_ast2600.c | 2 +-
>> hw/arm/aspeed_soc.c | 2 +-
>> hw/arm/bcm2836.c | 3 +--
>> hw/arm/cubieboard.c | 2 +-
>> hw/arm/digic.c | 2 +-
>> hw/arm/digic_boards.c | 2 +-
>> hw/arm/exynos4210.c | 4 +--
>> hw/arm/fsl-imx25.c | 2 +-
>> hw/arm/fsl-imx31.c | 2 +-
>> hw/arm/fsl-imx6.c | 2 +-
>> hw/arm/fsl-imx6ul.c | 3 +--
>> hw/arm/fsl-imx7.c | 2 +-
>> hw/arm/highbank.c | 2 +-
>> hw/arm/imx25_pdk.c | 2 +-
>> hw/arm/integratorcp.c | 2 +-
>> hw/arm/kzm.c | 2 +-
>> hw/arm/mcimx6ul-evk.c | 2 +-
>> hw/arm/mcimx7d-sabre.c | 2 +-
>> hw/arm/mps2-tz.c | 9 +++----
>> hw/arm/mps2.c | 7 +++---
>> hw/arm/musca.c | 6 ++---
>> hw/arm/orangepi.c | 2 +-
>> hw/arm/raspi.c | 2 +-
>> hw/arm/realview.c | 2 +-
>> hw/arm/sabrelite.c | 2 +-
>> hw/arm/sbsa-ref.c | 2 +-
>> hw/arm/stm32f205_soc.c | 2 +-
>> hw/arm/stm32f405_soc.c | 2 +-
>> hw/arm/versatilepb.c | 2 +-
>> hw/arm/vexpress.c | 2 +-
>> hw/arm/virt.c | 2 +-
>> hw/arm/xilinx_zynq.c | 2 +-
>> hw/arm/xlnx-versal.c | 2 +-
>> hw/arm/xlnx-zcu102.c | 2 +-
>> hw/arm/xlnx-zynqmp.c | 10 +++-----
>
> Peter you might want to skim at the changes (other
> ARM devices out of hw/arm/ involved) but to resume
> basically these types are not SysBusDev:
>
> - cpu
> - soc / container
> - or-gate / irq-splitter
>
> I reviewed all of them.
>
> Next is for Markus.
>
>> hw/char/serial-isa.c | 2 +-
>> hw/char/serial-pci-multi.c | 2 +-
>> hw/char/serial-pci.c | 2 +-
>> hw/char/serial.c | 4 +--
>
> I need to review again hw/char/serial-isa.c, it is
> not clear why it is a container and not a SysBusDevice.
TYPE_SERIAL is a bus-less TYPE_DEVICE.
TYPE_ISA_SERIAL is its adapter for the ISA bus. It contains one
TYPE_SERIAL child.
TYPE_SERIAL_MM is its adapter for the sysbus pseudo-bus. It contains
one TYPE_SERIAL child.
TYPE_PCI_SERIAL, "pci-serial-2x", "pci-serial-4x" are adapters for the
PCI bus. They contain one, two and four TYPE_SERIAL respectively.
Exemplary use of QOM, I think.
>> hw/ide/microdrive.c | 3 ++-
>
> I never had to look at the PCMCIA devices, they seem
> an unfinished attempt to plug a the devices on a bus.
> Maybe it is finished, but the code is not clear (and
> not documented). I need more time to review.
>
>> hw/intc/pnv_xive.c | 4 +--
>> hw/intc/spapr_xive.c | 4 +--
>> hw/intc/xics.c | 2 +-
>> hw/intc/xive.c | 2 +-
>> hw/pci-host/pnv_phb3.c | 6 ++---
>> hw/pci-host/pnv_phb4.c | 2 +-
>> hw/pci-host/pnv_phb4_pec.c | 2 +-
>> hw/pci-host/prep.c | 3 +--
>> hw/ppc/pnv.c | 32 ++++++++++--------------
>> hw/ppc/pnv_bmc.c | 2 +-
>> hw/ppc/pnv_core.c | 2 +-
>> hw/ppc/pnv_psi.c | 4 +--
>> hw/ppc/spapr.c | 5 ++--
>> hw/ppc/spapr_cpu_core.c | 2 +-
>> hw/ppc/spapr_drc.c | 2 +-
>> hw/ppc/spapr_iommu.c | 2 +-
>> hw/ppc/spapr_irq.c | 2 +-
>
> Wow, lot of QOM code for PPC hardware. Not all clear
> yet, in particular the pci-host devices. Apparently
> a LPC bus in the middle. Need a bit more time.
>
>> hw/s390x/s390-skeys.c | 2 +-
>> hw/s390x/s390-stattrib.c | 2 +-
>> hw/s390x/s390-virtio-ccw.c | 4 +--
>> hw/s390x/sclp.c | 2 +-
>> hw/s390x/tod.c | 2 +-
>
> Eh, odd s390x stuff. No clue, I might review it too.
>
>> target/i386/cpu.c | 3 +--
>
> What is this APIC stuff doing burried with TCG?...
>
> All the rest that is elided and not commented is reviewed.
>
> When do you plan to send a pullreq?
I want to get this wrapped as quickly as possible; rebasing has been
quite a time sink. But not at the price of rushed review.
next prev parent reply other threads:[~2020-06-10 9:38 UTC|newest]
Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-10 5:31 [PATCH RESEND v3 00/58] qdev: Rework how we plug into the parent bus Markus Armbruster
2020-06-10 5:31 ` [PATCH RESEND v3 01/58] qdev: Rename qbus_realize() to qbus_init() Markus Armbruster
2020-06-10 5:31 ` [PATCH RESEND v3 02/58] Revert "hw/prep: realize the PCI root bus as part of the prep init" Markus Armbruster
2020-06-10 5:31 ` [PATCH RESEND v3 03/58] Revert "hw/versatile: realize the PCI root bus as part of the versatile init" Markus Armbruster
2020-06-10 5:31 ` [PATCH RESEND v3 04/58] qdev: New qdev_new(), qdev_realize(), etc Markus Armbruster
2020-06-10 5:31 ` [PATCH RESEND v3 05/58] qdev: Put qdev_new() to use with Coccinelle Markus Armbruster
2020-06-10 5:31 ` [PATCH RESEND v3 06/58] qdev: Convert to qbus_realize(), qbus_unrealize() Markus Armbruster
2020-06-10 5:31 ` [PATCH RESEND v3 07/58] qdev: Convert to qdev_unrealize() with Coccinelle Markus Armbruster
2020-06-10 5:31 ` [PATCH RESEND v3 08/58] qdev: Convert to qdev_unrealize() manually Markus Armbruster
2020-06-10 5:31 ` [PATCH RESEND v3 09/58] qdev: Convert uses of qdev_create() with Coccinelle Markus Armbruster
2020-06-10 5:31 ` [PATCH RESEND v3 10/58] qdev: Convert uses of qdev_create() manually Markus Armbruster
2020-06-10 5:32 ` [PATCH RESEND v3 11/58] qdev: Convert uses of qdev_set_parent_bus() with Coccinelle Markus Armbruster
2020-06-10 5:32 ` [PATCH RESEND v3 12/58] qdev: Convert uses of qdev_set_parent_bus() manually Markus Armbruster
2020-06-10 5:32 ` [PATCH RESEND v3 13/58] pci: New pci_new(), pci_realize_and_unref() etc Markus Armbruster
2020-06-10 5:32 ` [PATCH RESEND v3 14/58] hw/ppc: Eliminate two superfluous QOM casts Markus Armbruster
2020-06-10 5:32 ` [PATCH RESEND v3 15/58] pci: Convert uses of pci_create() etc. with Coccinelle Markus Armbruster
2020-06-10 5:32 ` [PATCH RESEND v3 16/58] pci: Convert uses of pci_create() etc. manually Markus Armbruster
2020-06-10 5:32 ` [PATCH RESEND v3 17/58] pci: pci_create(), pci_create_multifunction() are now unused, drop Markus Armbruster
2020-06-10 5:32 ` [PATCH RESEND v3 18/58] isa: New isa_new(), isa_realize_and_unref() etc Markus Armbruster
2020-06-10 5:32 ` [PATCH RESEND v3 19/58] isa: Convert uses of isa_create() with Coccinelle Markus Armbruster
2020-06-10 5:32 ` [PATCH RESEND v3 20/58] isa: Convert uses of isa_create(), isa_try_create() manually Markus Armbruster
2020-06-10 5:32 ` [PATCH RESEND v3 21/58] isa: isa_create(), isa_try_create() are now unused, drop Markus Armbruster
2020-06-10 5:32 ` [PATCH RESEND v3 22/58] ssi: ssi_auto_connect_slaves() never does anything, drop Markus Armbruster
2020-06-10 5:32 ` [PATCH RESEND v3 23/58] ssi: Convert uses of ssi_create_slave_no_init() with Coccinelle Markus Armbruster
2020-06-10 5:32 ` [PATCH RESEND v3 24/58] ssi: Convert last use of ssi_create_slave_no_init() manually Markus Armbruster
2020-06-10 5:32 ` [PATCH RESEND v3 25/58] ssi: ssi_create_slave_no_init() is now unused, drop Markus Armbruster
2020-06-10 5:32 ` [PATCH RESEND v3 26/58] usb: New usb_new(), usb_realize_and_unref() Markus Armbruster
2020-06-10 5:32 ` [PATCH RESEND v3 27/58] usb: Convert uses of usb_create() Markus Armbruster
2020-06-10 5:32 ` [PATCH RESEND v3 28/58] usb: usb_create() is now unused, drop Markus Armbruster
2020-06-10 5:32 ` [PATCH RESEND v3 29/58] usb: Eliminate usb_try_create_simple() Markus Armbruster
2020-06-10 5:32 ` [PATCH RESEND v3 30/58] qdev: qdev_create(), qdev_try_create() are now unused, drop Markus Armbruster
2020-06-10 5:32 ` [PATCH RESEND v3 31/58] auxbus: Rename aux_init_bus() to aux_bus_init() Markus Armbruster
2020-06-10 7:54 ` Philippe Mathieu-Daudé
2020-06-10 5:32 ` [PATCH RESEND v3 32/58] auxbus: New aux_bus_realize(), pairing with aux_bus_init() Markus Armbruster
2020-06-10 5:32 ` [PATCH RESEND v3 33/58] auxbus: Convert a use of qdev_set_parent_bus() Markus Armbruster
2020-06-10 5:32 ` [PATCH RESEND v3 34/58] auxbus: Eliminate aux_create_slave() Markus Armbruster
2020-06-10 5:32 ` [PATCH RESEND v3 35/58] qom: Tidy up a few object_initialize_child() calls Markus Armbruster
2020-06-10 5:32 ` [PATCH RESEND v3 36/58] qom: Less verbose object_initialize_child() Markus Armbruster
2020-06-10 5:32 ` [PATCH RESEND v3 37/58] macio: Convert use of qdev_set_parent_bus() Markus Armbruster
2020-06-10 5:32 ` [PATCH RESEND v3 38/58] macio: Eliminate macio_init_child_obj() Markus Armbruster
2020-06-10 5:32 ` [PATCH RESEND v3 39/58] sysbus: Drop useless OBJECT() in sysbus_init_child_obj() calls Markus Armbruster
2020-06-10 5:32 ` [PATCH RESEND v3 40/58] microbit: Tidy up sysbus_init_child_obj() @child argument Markus Armbruster
2020-06-10 5:32 ` [PATCH RESEND v3 41/58] sysbus: Tidy up sysbus_init_child_obj()'s @childsize arg, part 1 Markus Armbruster
2020-06-10 5:32 ` [PATCH RESEND v3 42/58] hw/arm/armsse: Pass correct child size to sysbus_init_child_obj() Markus Armbruster
2020-06-10 5:32 ` [PATCH RESEND v3 43/58] sysbus: Tidy up sysbus_init_child_obj()'s @childsize arg, part 2 Markus Armbruster
2020-06-10 5:32 ` [PATCH RESEND v3 44/58] sysbus: New sysbus_realize(), sysbus_realize_and_unref() Markus Armbruster
2020-06-10 5:32 ` [PATCH RESEND v3 45/58] sysbus: Convert to sysbus_realize() etc. with Coccinelle Markus Armbruster
2020-06-10 5:32 ` [PATCH RESEND v3 46/58] qdev: Drop qdev_realize() support for null bus Markus Armbruster
2020-06-10 5:32 ` [PATCH RESEND v3 47/58] sysbus: Convert qdev_set_parent_bus() use with Coccinelle, part 1 Markus Armbruster
2020-06-10 5:32 ` [PATCH RESEND v3 48/58] sysbus: Convert qdev_set_parent_bus() use with Coccinelle, part 2 Markus Armbruster
2020-06-10 5:32 ` [PATCH RESEND v3 49/58] sysbus: Convert qdev_set_parent_bus() use with Coccinelle, part 3 Markus Armbruster
2020-06-10 5:32 ` [PATCH RESEND v3 50/58] sysbus: Convert qdev_set_parent_bus() use with Coccinelle, part 4 Markus Armbruster
2020-06-10 5:32 ` [PATCH RESEND v3 51/58] sysbus: sysbus_init_child_obj() is now unused, drop Markus Armbruster
2020-06-10 5:32 ` [PATCH RESEND v3 52/58] microbit: Eliminate two local variables in microbit_init() Markus Armbruster
2020-06-10 7:54 ` Philippe Mathieu-Daudé
2020-06-10 5:32 ` [PATCH RESEND v3 53/58] s390x/event-facility: Simplify creation of SCLP event devices Markus Armbruster
2020-06-10 5:32 ` [PATCH RESEND v3 54/58] qdev: Make qdev_realize() support bus-less devices Markus Armbruster
2020-06-10 5:32 ` [PATCH RESEND v3 55/58] qdev: Use qdev_realize() in qdev_device_add() Markus Armbruster
2020-06-10 5:32 ` [PATCH RESEND v3 56/58] qdev: Convert bus-less devices to qdev_realize() with Coccinelle Markus Armbruster
2020-06-10 8:21 ` Philippe Mathieu-Daudé
2020-06-10 9:37 ` Markus Armbruster [this message]
2020-06-10 5:32 ` [PATCH RESEND v3 57/58] qdev: qdev_init_nofail() is now unused, drop Markus Armbruster
2020-06-10 5:32 ` [PATCH RESEND v3 58/58] MAINTAINERS: Make section QOM cover hw/core/*bus.c as well Markus Armbruster
2020-06-10 5:41 ` [PATCH RESEND v3 00/58] qdev: Rework how we plug into the parent bus Michael S. Tsirkin
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=87sgf3feh8.fsf@dusky.pond.sub.org \
--to=armbru@redhat.com \
--cc=alistair.francis@wdc.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@redhat.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.