mbox series

[for-6.2,00/12] qom: Get rid of all manual usage of OBJECT_CHECK & friends

Message ID 20210806211127.646908-1-ehabkost@redhat.com (mailing list archive)
Headers show
Series qom: Get rid of all manual usage of OBJECT_CHECK & friends | expand

Message

Eduardo Habkost Aug. 6, 2021, 9:11 p.m. UTC
This series gets rid of all manual usage of OBJECT_CHECK,
OBJECT_CLASS_CHECK, and OBJECT_GET_CLASS.

All type check macros defined manually are replaced with
DEFINE_*CHECKER* or OBJECT_DECLARE* macros.

All manual usage of OBJECT_CHECK/OBJECT_CLASS_CHECK/OBJECT_GET_CLASS
is manually replaced with the corresponding type-specific wrappers.

For a git tree containing all dependencies, see:
  https://gitlab.com/ehabkost/qemu.git work/qom-automated-declare-type-pass2

This series is based on multiple other series I have submitted
recently, including:

  Date: Thu,  5 Aug 2021 15:34:25 -0400
  Subject: [PATCH for-6.2 0/6] qom: Fix broken OBJECT_CHECK usage
  Message-Id: <20210805193431.307761-1-ehabkost@redhat.com>
  https://lore.kernel.org/qemu-devel/20210805193431.307761-1-ehabkost@redhat.com

  Date: Thu,  5 Aug 2021 17:47:39 -0400
  Subject: [PATCH] bcm2836: Remove redundant typedef and macros
  Message-Id: <20210805214739.390613-1-ehabkost@redhat.com>
  https://lore.kernel.org/qemu-devel/20210805214739.390613-1-ehabkost@redhat.com

  Date: Thu,  5 Aug 2021 22:31:19 -0400
  Subject: [PATCH for-6.2] sbsa-ref: Rename SBSA_GWDT enum value
  Message-Id: <20210806023119.431680-1-ehabkost@redhat.com>
  https://lore.kernel.org/qemu-devel/20210806023119.431680-1-ehabkost@redhat.com

Based-on: <20210805193431.307761-1-ehabkost@redhat.com>
Based-on: <20210805214739.390613-1-ehabkost@redhat.com>
Based-on: <20210806023119.431680-1-ehabkost@redhat.com>

Eduardo Habkost (12):
  accel: Rename TYPE_ACCEL to TYPE_ACCEL_BASE
  qom: Use DEVICE_*CLASS instead of OBJECT_*CLASS
  scripts/codeconverter: Update to latest version
  [automated] Add struct names to typedefs used by QOM types
  [automated] Move QOM typedefs and add missing includes
  [automated] Split QOM "typedef struct T { ... } T" declarations
  [automated] Use DECLARE_*CHECKER* macros when possible
  npcm7xx_clk: Use DECLARE_INSTANCE_CHECKER
  npcm7xx_otp: Use DECLARE_CLASS_CHECKERS
  [automated] Use DECLARE_OBJ_CHECKERS when possible
  [automated] Use OBJECT_DECLARE_TYPE when possible
  [automated] Use OBJECT_DECLARE_SIMPLE_TYPE when possible

 hw/core/machine.c                             |   2 +-
 hw/nvme/nvme.h                                |  24 +-
 hw/usb/hcd-uhci.h                             |   6 +-
 hw/usb/hcd-xhci-pci.h                         |   8 +-
 hw/usb/hcd-xhci-sysbus.h                      |   8 +-
 hw/usb/u2f.h                                  |  17 +-
 include/crypto/tlscreds.h                     |   5 +-
 include/hw/acpi/acpi_dev_interface.h          |   2 +-
 include/hw/adc/npcm7xx_adc.h                  |   8 +-
 include/hw/arm/linux-boot-if.h                |   2 +-
 include/hw/arm/npcm7xx.h                      |  36 ++-
 include/hw/char/shakti_uart.h                 |   8 +-
 include/hw/core/accel-cpu.h                   |   6 +-
 include/hw/dma/sifive_pdma.h                  |   8 +-
 include/hw/dma/xlnx_csu_dma.h                 |   8 +-
 include/hw/fw-path-provider.h                 |   2 +-
 include/hw/gpio/npcm7xx_gpio.h                |  10 +-
 include/hw/gpio/sifive_gpio.h                 |   4 +-
 include/hw/hotplug.h                          |   2 +-
 include/hw/i2c/npcm7xx_smbus.h                |  10 +-
 include/hw/intc/intc.h                        |   2 +-
 include/hw/intc/m68k_irqc.h                   |   8 +-
 include/hw/intc/sifive_clint.h                |   8 +-
 include/hw/intc/sifive_plic.h                 |   4 +-
 include/hw/ipmi/ipmi.h                        |   2 +-
 include/hw/mem/memory-device.h                |   2 +-
 include/hw/mem/npcm7xx_mc.h                   |   9 +-
 include/hw/misc/aspeed_lpc.h                  |   7 +-
 include/hw/misc/bcm2835_cprman.h              |  21 +-
 include/hw/misc/bcm2835_cprman_internals.h    |  13 +-
 include/hw/misc/led.h                         |   3 +-
 include/hw/misc/mchp_pfsoc_dmc.h              |  17 +-
 include/hw/misc/mchp_pfsoc_ioscb.h            |   8 +-
 include/hw/misc/mchp_pfsoc_sysreg.h           |   9 +-
 include/hw/misc/npcm7xx_clk.h                 |  18 +-
 include/hw/misc/npcm7xx_gcr.h                 |   7 +-
 include/hw/misc/npcm7xx_mft.h                 |   7 +-
 include/hw/misc/npcm7xx_pwm.h                 |   4 +-
 include/hw/misc/npcm7xx_rng.h                 |   9 +-
 include/hw/misc/sifive_e_prci.h               |   4 +-
 include/hw/misc/sifive_test.h                 |   4 +-
 include/hw/misc/sifive_u_otp.h                |   4 +-
 include/hw/misc/sifive_u_prci.h               |   4 +-
 include/hw/misc/xlnx-versal-xramc.h           |   8 +-
 include/hw/net/npcm7xx_emc.h                  |   5 +-
 include/hw/net/xlnx-zynqmp-can.h              |   8 +-
 include/hw/nmi.h                              |   2 +-
 include/hw/nvram/npcm7xx_otp.h                |  12 +-
 include/hw/ppc/spapr_drc.h                    |  23 +-
 include/hw/ppc/spapr_xive.h                   |  15 +-
 include/hw/ppc/vof.h                          |   1 +
 include/hw/rdma/rdma.h                        |   2 +-
 include/hw/register.h                         |   3 +-
 include/hw/riscv/microchip_pfsoc.h            |  18 +-
 include/hw/riscv/shakti_c.h                   |  15 +-
 include/hw/riscv/sifive_e.h                   |  17 +-
 include/hw/riscv/sifive_u.h                   |  17 +-
 include/hw/rtc/m48t59.h                       |   2 +-
 include/hw/sd/cadence_sdhci.h                 |   8 +-
 include/hw/ssi/npcm7xx_fiu.h                  |   4 +-
 include/hw/ssi/sifive_spi.h                   |   7 +-
 include/hw/stream.h                           |   2 +-
 include/hw/timer/npcm7xx_timer.h              |   4 +-
 include/hw/tricore/tricore_testdevice.h       |   8 +-
 include/hw/usb/hcd-dwc3.h                     |   8 +-
 include/hw/usb/msd.h                          |   1 +
 include/hw/usb/xlnx-usb-subsystem.h           |  10 +-
 include/hw/usb/xlnx-versal-usb2-ctrl-regs.h   |   8 +-
 include/hw/vmstate-if.h                       |   2 +-
 include/hw/watchdog/sbsa_gwdt.h               |  10 +-
 include/qemu/accel.h                          |  20 +-
 include/qom/object_interfaces.h               |   2 +-
 include/sysemu/tpm.h                          |   2 +-
 target/arm/idau.h                             |   2 +-
 target/hexagon/cpu.h                          |  19 +-
 accel/accel-common.c                          |   4 +-
 accel/accel-softmmu.c                         |   4 +-
 accel/accel-user.c                            |   2 +-
 accel/hvf/hvf-accel-ops.c                     |   4 +-
 accel/kvm/kvm-all.c                           |   4 +-
 accel/qtest/qtest.c                           |   4 +-
 accel/tcg/tcg-all.c                           |   5 +-
 accel/xen/xen-all.c                           |   4 +-
 bsd-user/main.c                               |   2 +-
 chardev/char-parallel.c                       |  17 +-
 hw/arm/bcm2836.c                              |   1 +
 hw/block/fdc-sysbus.c                         |   5 +-
 hw/i2c/i2c_mux_pca954x.c                      |   9 +-
 hw/m68k/mcf5206.c                             |   7 +-
 hw/mem/sparse-mem.c                           |   9 +-
 hw/mips/boston.c                              |   4 +-
 hw/mips/loongson3_virt.c                      |   1 +
 hw/misc/npcm7xx_clk.c                         |  10 +-
 hw/misc/sbsa_ec.c                             |   9 +-
 hw/net/can/ctucan_pci.c                       |   5 +-
 hw/nvram/npcm7xx_otp.c                        |   6 +-
 hw/pci/pci.c                                  |   3 +-
 hw/s390x/vhost-user-fs-ccw.c                  |   8 +-
 hw/sensor/adm1272.c                           |   7 +-
 hw/sensor/max34451.c                          |   7 +-
 hw/usb/hcd-ehci-pci.c                         |   2 +-
 hw/usb/u2f-emulated.c                         |   5 +-
 hw/usb/u2f-passthru.c                         |   5 +-
 hw/virtio/vhost-user-i2c-pci.c                |   1 +
 linux-user/main.c                             |   2 +-
 migration/savevm.c                            |   3 +-
 monitor/misc.c                                |   3 +-
 .../codeconverter/codeconverter/patching.py   |  18 +-
 .../codeconverter/codeconverter/qom_macros.py | 187 +++++++++++--
 .../codeconverter/qom_type_info.py            | 247 +++++++++++++++++-
 .../codeconverter/codeconverter/regexps.py    |   3 +-
 softmmu/memory.c                              |   2 +-
 softmmu/qdev-monitor.c                        |   3 +-
 softmmu/vl.c                                  |   6 +-
 target/i386/hax/hax-all.c                     |   4 +-
 target/i386/nvmm/nvmm-all.c                   |   4 +-
 target/i386/whpx/whpx-all.c                   |   4 +-
 tests/qtest/pnv-xscom-test.c                  |   5 +-
 tests/unit/check-qom-interface.c              |   2 +-
 ui/vdagent.c                                  |   1 +
 120 files changed, 805 insertions(+), 458 deletions(-)

Comments

Philippe Mathieu-Daudé Aug. 7, 2021, 8:15 a.m. UTC | #1
On 8/6/21 11:11 PM, Eduardo Habkost wrote:
> This series gets rid of all manual usage of OBJECT_CHECK,
> OBJECT_CLASS_CHECK, and OBJECT_GET_CLASS.
> 
> All type check macros defined manually are replaced with
> DEFINE_*CHECKER* or OBJECT_DECLARE* macros.
> 
> All manual usage of OBJECT_CHECK/OBJECT_CLASS_CHECK/OBJECT_GET_CLASS
> is manually replaced with the corresponding type-specific wrappers.

Is INTERFACE_CHECK already converted / in good shape?
Eduardo Habkost Aug. 9, 2021, 6 p.m. UTC | #2
On Sat, Aug 07, 2021 at 10:15:52AM +0200, Philippe Mathieu-Daudé wrote:
> On 8/6/21 11:11 PM, Eduardo Habkost wrote:
> > This series gets rid of all manual usage of OBJECT_CHECK,
> > OBJECT_CLASS_CHECK, and OBJECT_GET_CLASS.
> > 
> > All type check macros defined manually are replaced with
> > DEFINE_*CHECKER* or OBJECT_DECLARE* macros.
> > 
> > All manual usage of OBJECT_CHECK/OBJECT_CLASS_CHECK/OBJECT_GET_CLASS
> > is manually replaced with the corresponding type-specific wrappers.
> 
> Is INTERFACE_CHECK already converted / in good shape?

Not yet.  I need to refresh my memory by looking at mailing list
archives, but I have a work in progress branch that I haven't
touched in a while (except for rebasing it) at:

https://gitlab.com/ehabkost/qemu/-/commits/work/qom-declare-interface-type/

Basically it introduces a DECLARE_INTERFACE_CHECKER macro instead
of reusing OBJECT_CHECK/DECLARE_INSTANCE_CHECKER.