Skip to contentSkip to conversation

qom: Automated conversion of type checking boilerplate

PATCH Superseded Eduardo Habkost 14 participants 112 messages Aug 20, 2020 – Aug 27, 2020 Page 1 of 3

Subsystems (17)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover qom: Automated conversion of type checking boilerplate

This is an extension of the series previously submitted by Daniel[1], including a script that will convert existing type checker macros automatically.

Changes from series v1 to v2:
* Don't skip TypeCheckMacro conversion if typedefs
are found in typedefs.h
* Don't look for typedefs if type check macro uses "struct [...]"
* "qom: Fix G_DEFINE_AUTOPTR_CLEANUP_FUNC" was squashed
in the original buggy patch
* 18 new patches that fix inconsistencies in the code,
and make automated changes without --force possible
* pl110:
* Fix typo on commit message
* Rename enum values to VERSION_*
* "[automated]" patches (without --force):
* Re-ran script after after the changes mentioned above. Now the patches change many more QOM type checker macros
* "[semi-automated] Use DECLARE_*CHECKER* when possible (--force mode)":
* Now the patch touches very few macros, and all of them have comments explaining why they are unusual
* Maintainers are now CCed in the cleanup patches
(except for the automated ones, because they are too large)
* TYPE_INFO macro: added commit message note suggested by Daniel
* Added more details to commit message of "Rename enum constants" patches
* Removed confusing paragraph mentioning _Generic from "Make type checker functions accept const pointers" commit message

Link to series v1:
https://lore.kernel.org/qemu-devel/[email protected]=
m/

The series is divided in the sections below:

Constant renaming
-----------------

Patches 1-10 will just rename existing constants that will conflict with the type checker function names.

Fix and cleanups of existing code
---------------------------------

Patches 11-41 are changes to existing code
that will either fix existing issues, delete unused and broken macros, or move typedefs around to make code conversion easier.

Original patches from Daniel
----------------------------

Patches 42-43 are the ones originally submitted by Daniel.

They introduce the macros:
* OBJECT_DECLARE_TYPE
* OBJECT_DECLARE_SIMPLE_TYPE
* OBJECT_DEFINE_TYPE
* OBJECT_DEFINE_TYPE_WITH_INTERFACES
* OBJECT_DEFINE_ABSTRACT_TYPE

Changes to new macros
---------------------

Patches 44-48 extend the macros introduced by Daniel. It includes small bug fixes, change the arguments to a few macros, and introduce a few new macros:

* DECLARE_INSTANCE_CHECKER
* DECLARE_CLASS_CHECKERS
* DECLARE_OBJ_CHECKERS
* TYPE_INFO

Automated code conversion
-------------------------

Patch 49 is the code conversion script that will look for common patterns and change them to use the new macros.

Patches 50-56 are all automatically generated by that script, to gradually transform existing code into DECLARE_*CHECKER or OBJECT_DECLARE*_TYPE macros.

Original crypto QOM patches from Daniel
---------------------------------------

Patches 57-58 are the patches originally sent by Daniel to convert the crypto QOM code to use the new macros, rebased and updated to pass additional arguments to OBJECT_DECLARE_*.

[1] https://lore.kernel.org/qemu-devel/20200723181410.3145233-1-berrange@redh=
at.com/

Daniel P. Berrang=C3=A9 (4):
qom: make object_ref/unref use a void * instead of Object *.
qom: provide convenient macros for declaring and defining types
crypto: use QOM macros for declaration/definition of secret types
crypto: use QOM macros for declaration/definition of TLS creds types

Eduardo Habkost (54):
e1000: Rename QOM class cast macros
megasas: Rename QOM class cast macros
vmw_pvscsi: Rename QOM class cast macros
pl110: Rename pl110_version enum values
allwinner-h3: Rename memmap enum constants
aspeed_soc: Rename memmap/irqmap enum constants
opentitan: Rename memmap enum constants
sifive_e: Rename memmap enum constants
sifive_u: Rename memmap enum constants
aspeed_timer: Fix ASPEED_TIMER macro definition
versatile: Fix typo in PCI_VPB_HOST definition
virtio-ccw: Fix definition of VIRTIO_CCW_BUS_GET_CLASS
hvf: Add missing include
hcd-dwc2: Rename USB_*CLASS macros for consistency
tulip: Move TulipState typedef to header
throttle-groups: Move ThrottleGroup typedef to header
pci: Move PCIBusClass typedef to pci.h
i8254: Move PITCommonState/PITCommonClass typedefs to i8254.h
hvf: Move HVFState typedef to hvf.h
mcf_fec: Move mcf_fec_state typedef to header
s390_flic: Move KVMS390FLICState typedef to header
can_emu: Delete macros for non-existing typedef
nubus: Delete unused NUBUS_BRIDGE macro
platform-bus: Delete macros for non-existing typedef
armsse: Rename QOM macros to avoid conflicts
xen-legacy-backend: Add missing typedef XenLegacyDevice
spapr: Move typedef SpaprMachineState to spapr.h
s390x: Move typedef SCLPEventFacility to event-facility.h
vhost-user-gpu: Move QOM macro to header
ahci: Move QOM macros to header
i8257: Move QOM macro to header
ahci: Move QOM macro to header
pckbd: Move QOM macro to header
vmbus: Move QOM macros to vmbus.h
virtio-serial-bus: Move QOM macros to header
piix: Move QOM macros to header
auxbus: Move QOM macros to header
rocker: Move QOM macros to header
pxa2xx: Move QOM macros to header
mptsas: Move QOM macros to header
kvm: Move QOM macros to kvm.h
vfio/pci: Move QOM macros to header
qom: Allow class type name to be specified in OBJECT_DECLARE*
qom: DECLARE_*_CHECKERS macros
qom: Make type checker functions accept const pointers
qom: TYPE_INFO macro
codeconverter: script for automating QOM code cleanups [automated] Delete duplicate QOM typedefs
[automated] Use TYPE_INFO macro
[automated] Move QOM typedefs and add missing includes [automated] Use DECLARE_*CHECKER* macros [semi-automated] Use DECLARE_*CHECKER* when possible (--force mode) [automated] Use OBJECT_DECLARE_TYPE where possible [automated] Use OBJECT_DECLARE_SIMPLE_TYPE when possible

 .../codeconverter/codeconverter/__init__.py   |   0
 .../codeconverter/codeconverter/patching.py   | 381 +++++++++++
 .../codeconverter/codeconverter/qom_macros.py | 628 ++++++++++++++++++
 .../codeconverter/qom_type_info.py            | 314 +++++++++
 .../codeconverter/codeconverter/regexps.py    |  89 +++
 .../codeconverter/test_patching.py            |  98 +++
 .../codeconverter/test_regexps.py             | 272 ++++++++
 scripts/codeconverter/codeconverter/utils.py  |  65 ++
 scripts/codeconverter/converter.py            | 113 ++++
 chardev/chardev-internal.h                    |   8 +-
 hw/9pfs/virtio-9p.h                           |  11 +-
 hw/audio/intel-hda.h                          |  20 +-
 hw/avr/atmega.h                               |   9 +-
 hw/block/nvme.h                               |  10 +-
 hw/display/ati_int.h                          |   9 +-
 hw/display/qxl.h                              |   9 +-
 hw/display/virtio-vga.h                       |  17 +-
 hw/i386/amd_iommu.h                           |  10 +-
 hw/ide/ahci_internal.h                        |   5 -
 hw/misc/tmp105.h                              |   9 +-
 hw/net/fsl_etsec/etsec.h                      |  10 +-
 hw/net/rocker/rocker.h                        |   7 +-
 hw/net/tulip.h                                |   5 +-
 hw/net/vmxnet3_defs.h                         |   9 +-
 hw/ppc/e500-ccsr.h                            |   9 +-
 hw/ppc/e500.h                                 |  19 +-
 hw/ppc/mac.h                                  |  19 +-
 hw/rdma/vmw/pvrdma.h                          |   9 +-
 hw/s390x/ccw-device.h                         |  17 +-
 hw/s390x/ipl.h                                |   6 +-
 hw/s390x/s390-pci-bus.h                       |  34 +-
 hw/s390x/virtio-ccw.h                         | 141 ++--
 hw/scsi/mptsas.h                              |   7 +-
 hw/usb/ccid.h                                 |  14 +-
 hw/usb/hcd-dwc2.h                             |   9 +-
 hw/usb/hcd-ehci.h                             |  36 +-
 hw/usb/hcd-ohci.h                             |   9 +-
 hw/usb/hcd-xhci.h                             |   7 +-
 hw/vfio/pci.h                                 |  10 +-
 hw/virtio/virtio-mem-pci.h                    |   5 +-
 hw/virtio/virtio-pci.h                        |  24 +-
 hw/virtio/virtio-pmem-pci.h                   |   5 +-
 hw/xen/xen_pt.h                               |   5 +-
 include/authz/base.h                          |  15 +-
 include/authz/list.h                          |  17 +-
 include/authz/listfile.h                      |  17 +-
 include/authz/pamacct.h                       |  17 +-
 include/authz/simple.h                        |  17 +-
 include/block/throttle-groups.h               |   5 +-
 include/chardev/char-fd.h                     |   9 +-
 include/chardev/char-win.h                    |   9 +-
 include/chardev/char.h                        |  12 +-
 include/chardev/spice.h                       |   9 +-
 include/crypto/secret.h                       |  11 +-
 include/crypto/secret_common.h                |  12 +-
 include/crypto/secret_keyring.h               |  24 +-
 include/crypto/tls-cipher-suites.h            |   9 +-
 include/crypto/tlscreds.h                     |  13 +-
 include/crypto/tlscredsanon.h                 |  15 +-
 include/crypto/tlscredspsk.h                  |  14 +-
 include/crypto/tlscredsx509.h                 |  14 +-
 include/exec/memory.h                         |  19 +-
 include/hw/acpi/acpi_dev_interface.h          |  13 +-
 include/hw/acpi/generic_event_device.h        |  10 +-
 include/hw/acpi/vmgenid.h                     |   9 +-
 include/hw/adc/stm32f2xx_adc.h                |  10 +-
 include/hw/arm/allwinner-a10.h                |   9 +-
 include/hw/arm/allwinner-h3.h                 |  70 +-
 include/hw/arm/armsse.h                       |  18 +-
 include/hw/arm/armv7m.h                       |  17 +-
 include/hw/arm/aspeed.h                       |  14 +-
 include/hw/arm/aspeed_soc.h                   | 110 +--
 include/hw/arm/bcm2835_peripherals.h          |  10 +-
 include/hw/arm/bcm2836.h                      |  18 +-
 include/hw/arm/digic.h                        |   9 +-
 include/hw/arm/exynos4210.h                   |  10 +-
 include/hw/arm/fsl-imx25.h                    |   9 +-
 include/hw/arm/fsl-imx31.h                    |   9 +-
 include/hw/arm/fsl-imx6.h                     |   9 +-
 include/hw/arm/fsl-imx6ul.h                   |   9 +-
 include/hw/arm/fsl-imx7.h                     |   9 +-
 include/hw/arm/linux-boot-if.h                |  11 +-
 include/hw/arm/msf2-soc.h                     |   9 +-
 include/hw/arm/nrf51_soc.h                    |  10 +-
 include/hw/arm/omap.h                         |  20 +-
 include/hw/arm/pxa.h                          |  16 +
 include/hw/arm/smmu-common.h                  |  18 +-
 include/hw/arm/smmuv3.h                       |  18 +-
 include/hw/arm/stm32f205_soc.h                |  10 +-
 include/hw/arm/stm32f405_soc.h                |  10 +-
 include/hw/arm/virt.h                         |  19 +-
 include/hw/arm/xlnx-versal.h                  |   9 +-
 include/hw/arm/xlnx-zynqmp.h                  |  10 +-
 include/hw/block/flash.h                      |  13 +-
 include/hw/block/swim.h                       |  12 +-
 include/hw/boards.h                           |   8 +-
 include/hw/char/avr_usart.h                   |  10 +-
 include/hw/char/bcm2835_aux.h                 |   9 +-
 include/hw/char/cadence_uart.h                |  10 +-
 include/hw/char/cmsdk-apb-uart.h              |  10 +-
 include/hw/char/digic-uart.h                  |  10 +-
 include/hw/char/escc.h                        |   9 +-
 include/hw/char/ibex_uart.h                   |  10 +-
 include/hw/char/imx_serial.h                  |   9 +-
 include/hw/char/nrf51_uart.h                  |   9 +-
 include/hw/char/pl011.h                       |   9 +-
 include/hw/char/renesas_sci.h                 |   9 +-
 include/hw/char/serial.h                      |  25 +-
 include/hw/char/stm32f2xx_usart.h             |  10 +-
 include/hw/clock.h                            |   5 +-
 include/hw/core/cpu.h                         |  10 +-
 include/hw/core/generic-loader.h              |  10 +-
 include/hw/core/split-irq.h                   |   3 +-
 include/hw/cpu/a15mpcore.h                    |  10 +-
 include/hw/cpu/a9mpcore.h                     |  10 +-
 include/hw/cpu/arm11mpcore.h                  |  10 +-
 include/hw/cpu/cluster.h                      |  10 +-
 include/hw/cpu/core.h                         |  10 +-
 include/hw/display/bcm2835_fb.h               |   9 +-
 include/hw/display/dpcd.h                     |   4 +-
 include/hw/display/i2c-ddc.h                  |   4 +-
 include/hw/display/macfb.h                    |  22 +-
 include/hw/display/xlnx_dp.h                  |   9 +-
 include/hw/dma/bcm2835_dma.h                  |  10 +-
 include/hw/dma/i8257.h                        |   8 +-
 include/hw/dma/pl080.h                        |   9 +-
 include/hw/dma/xlnx-zdma.h                    |  10 +-
 include/hw/dma/xlnx-zynq-devcfg.h             |  10 +-
 include/hw/dma/xlnx_dpdma.h                   |   4 +-
 include/hw/fw-path-provider.h                 |  11 +-
 include/hw/gpio/aspeed_gpio.h                 |  18 +-
 include/hw/gpio/bcm2835_gpio.h                |  10 +-
 include/hw/gpio/imx_gpio.h                    |   9 +-
 include/hw/gpio/nrf51_gpio.h                  |   9 +-
 include/hw/hotplug.h                          |  11 +-
 include/hw/hyperv/vmbus-bridge.h              |  12 +-
 include/hw/hyperv/vmbus.h                     |  19 +-
 include/hw/i2c/arm_sbcon_i2c.h                |  10 +-
 include/hw/i2c/aspeed_i2c.h                   |  19 +-
 include/hw/i2c/i2c.h                          |  19 +-
 include/hw/i2c/imx_i2c.h                      |   9 +-
 include/hw/i2c/microbit_i2c.h                 |  10 +-
 include/hw/i2c/ppc4xx_i2c.h                   |   9 +-
 include/hw/i2c/smbus_slave.h                  |  15 +-
 include/hw/i386/apic_internal.h               |  17 +-
 include/hw/i386/ich9.h                        |  10 +-
 include/hw/i386/intel_iommu.h                 |   7 +-
 include/hw/i386/ioapic_internal.h             |  16 +-
 include/hw/i386/microvm.h                     |  19 +-
 include/hw/i386/pc.h                          |  14 +-
 include/hw/i386/x86-iommu.h                   |   5 +-
 include/hw/i386/x86.h                         |  19 +-
 include/hw/ide/ahci.h                         |  17 +-
 include/hw/ide/internal.h                     |  19 +-
 include/hw/ide/pci.h                          |   9 +-
 include/hw/input/adb.h                        |  16 +-
 include/hw/input/i8042.h                      |   5 +-
 include/hw/intc/allwinner-a10-pic.h           |   9 +-
 include/hw/intc/arm_gic.h                     |  15 +-
 include/hw/intc/arm_gic_common.h              |  21 +-
 include/hw/intc/arm_gicv3.h                   |  14 +-
 include/hw/intc/arm_gicv3_common.h            |  16 +-
 include/hw/intc/arm_gicv3_its_common.h        |  11 +-
 include/hw/intc/armv7m_nvic.h                 |  10 +-
 include/hw/intc/aspeed_vic.h                  |   9 +-
 include/hw/intc/bcm2835_ic.h                  |   9 +-
 include/hw/intc/bcm2836_control.h             |  10 +-
 include/hw/intc/heathrow_pic.h                |   9 +-
 include/hw/intc/ibex_plic.h                   |  10 +-
 include/hw/intc/imx_avic.h                    |   9 +-
 include/hw/intc/imx_gpcv2.h                   |   9 +-
 include/hw/intc/intc.h                        |  11 +-
 include/hw/intc/mips_gic.h                    |   6 +-
 include/hw/intc/realview_gic.h                |  10 +-
 include/hw/intc/rx_icu.h                      |   4 +-
 include/hw/intc/xlnx-pmu-iomod-intc.h         |  10 +-
 include/hw/intc/xlnx-zynqmp-ipi.h             |  10 +-
 include/hw/ipack/ipack.h                      |  14 +-
 include/hw/ipmi/ipmi.h                        |  36 +-
 include/hw/isa/i8259_internal.h               |  15 +-
 include/hw/isa/isa.h                          |  28 +-
 include/hw/isa/pc87312.h                      |   9 +-
 include/hw/isa/superio.h                      |  19 +-
 include/hw/m68k/mcf_fec.h                     |   5 +-
 include/hw/mem/memory-device.h                |  11 +-
 include/hw/mem/nvdimm.h                       |  11 +-
 include/hw/mem/pc-dimm.h                      |  17 +-
 include/hw/mips/cps.h                         |   9 +-
 include/hw/misc/a9scu.h                       |   9 +-
 include/hw/misc/allwinner-cpucfg.h            |   9 +-
 include/hw/misc/allwinner-h3-ccu.h            |   9 +-
 include/hw/misc/allwinner-h3-dramc.h          |   9 +-
 include/hw/misc/allwinner-h3-sysctrl.h        |   9 +-
 include/hw/misc/allwinner-sid.h               |   9 +-
 include/hw/misc/arm11scu.h                    |   9 +-
 include/hw/misc/armsse-cpuid.h                |   9 +-
 include/hw/misc/armsse-mhu.h                  |   9 +-
 include/hw/misc/aspeed_scu.h                  |  18 +-
 include/hw/misc/aspeed_sdmc.h                 |  18 +-
 include/hw/misc/aspeed_xdma.h                 |   9 +-
 include/hw/misc/auxbus.h                      |  12 +-
 include/hw/misc/avr_power.h                   |   9 +-
 include/hw/misc/bcm2835_mbox.h                |  10 +-
 include/hw/misc/bcm2835_mphi.h                |   5 +-
 include/hw/misc/bcm2835_property.h            |  10 +-
 include/hw/misc/bcm2835_rng.h                 |  10 +-
 include/hw/misc/bcm2835_thermal.h             |  10 +-
 include/hw/misc/grlib_ahb_apb_pnp.h           |   9 +-
 include/hw/misc/imx25_ccm.h                   |   9 +-
 include/hw/misc/imx31_ccm.h                   |   9 +-
 include/hw/misc/imx6_ccm.h                    |   9 +-
 include/hw/misc/imx6_src.h                    |   9 +-
 include/hw/misc/imx6ul_ccm.h                  |   9 +-
 include/hw/misc/imx7_ccm.h                    |  17 +-
 include/hw/misc/imx7_gpr.h                    |   9 +-
 include/hw/misc/imx7_snvs.h                   |   9 +-
 include/hw/misc/imx_ccm.h                     |  11 +-
 include/hw/misc/imx_rngc.h                    |   9 +-
 include/hw/misc/iotkit-secctl.h               |   6 +-
 include/hw/misc/iotkit-sysctl.h               |  10 +-
 include/hw/misc/iotkit-sysinfo.h              |  10 +-
 include/hw/misc/mac_via.h                     |  27 +-
 include/hw/misc/macio/cuda.h                  |  18 +-
 include/hw/misc/macio/gpio.h                  |   9 +-
 include/hw/misc/macio/macio.h                 |  43 +-
 include/hw/misc/macio/pmu.h                   |  18 +-
 include/hw/misc/max111x.h                     |  10 +-
 include/hw/misc/mips_cmgcr.h                  |   6 +-
 include/hw/misc/mips_cpc.h                    |   9 +-
 include/hw/misc/mips_itu.h                    |   9 +-
 include/hw/misc/mos6522.h                     |  11 +-
 include/hw/misc/mps2-fpgaio.h                 |   9 +-
 include/hw/misc/mps2-scc.h                    |   9 +-
 include/hw/misc/msf2-sysreg.h                 |   9 +-
 include/hw/misc/nrf51_rng.h                   |   9 +-
 include/hw/misc/pca9552.h                     |   9 +-
 include/hw/misc/stm32f2xx_syscfg.h            |  10 +-
 include/hw/misc/stm32f4xx_exti.h              |  10 +-
 include/hw/misc/stm32f4xx_syscfg.h            |  10 +-
 include/hw/misc/tz-mpc.h                      |   6 +-
 include/hw/misc/tz-msc.h                      |   9 +-
 include/hw/misc/tz-ppc.h                      |   6 +-
 include/hw/misc/unimp.h                       |  10 +-
 include/hw/misc/vmcoreinfo.h                  |   9 +-
 include/hw/misc/zynq-xadc.h                   |  10 +-
 include/hw/net/allwinner-sun8i-emac.h         |   9 +-
 include/hw/net/allwinner_emac.h               |   9 +-
 include/hw/net/cadence_gem.h                  |   9 +-
 include/hw/net/ftgmac100.h                    |  17 +-
 include/hw/net/imx_fec.h                      |   9 +-
 include/hw/net/lance.h                        |  10 +-
 include/hw/net/lasi_82596.h                   |  10 +-
 include/hw/net/msf2-emac.h                    |  10 +-
 include/hw/nmi.h                              |  11 +-
 include/hw/nubus/mac-nubus-bridge.h           |  10 +-
 include/hw/nubus/nubus.h                      |  19 +-
 include/hw/nvram/fw_cfg.h                     |  21 +-
 include/hw/nvram/nrf51_nvm.h                  |   9 +-
 include/hw/or-irq.h                           |   3 +-
 include/hw/pci-bridge/simba.h                 |  10 +-
 include/hw/pci-host/designware.h              |  16 +-
 include/hw/pci-host/gpex.h                    |  19 +-
 include/hw/pci-host/i440fx.h                  |  10 +-
 include/hw/pci-host/pnv_phb3.h                |  20 +-
 include/hw/pci-host/pnv_phb4.h                |  21 +-
 include/hw/pci-host/q35.h                     |  19 +-
 include/hw/pci-host/sabre.h                   |  19 +-
 include/hw/pci-host/spapr.h                   |   7 +-
 include/hw/pci-host/uninorth.h                |  31 +-
 include/hw/pci-host/xilinx-pcie.h             |  19 +-
 include/hw/pci/pci.h                          |  20 +-
 include/hw/pci/pci_bridge.h                   |   4 +-
 include/hw/pci/pci_bus.h                      |   4 +-
 include/hw/pci/pci_host.h                     |  14 +-
 include/hw/pci/pcie_host.h                    |   5 +-
 include/hw/pci/pcie_port.h                    |  18 +-
 include/hw/pcmcia.h                           |  19 +-
 include/hw/platform-bus.h                     |   9 +-
 include/hw/ppc/mac_dbdma.h                    |   9 +-
 include/hw/ppc/openpic.h                      |   9 +-
 include/hw/ppc/pnv.h                          |  75 +--
 include/hw/ppc/pnv_core.h                     |  26 +-
 include/hw/ppc/pnv_homer.h                    |  22 +-
 include/hw/ppc/pnv_lpc.h                      |  28 +-
 include/hw/ppc/pnv_occ.h                      |  22 +-
 include/hw/ppc/pnv_pnor.h                     |   9 +-
 include/hw/ppc/pnv_psi.h                      |  35 +-
 include/hw/ppc/pnv_xive.h                     |  16 +-
 include/hw/ppc/pnv_xscom.h                    |  10 +-
 include/hw/ppc/spapr.h                        |  24 +-
 include/hw/ppc/spapr_cpu_core.h               |  17 +-
 include/hw/ppc/spapr_drc.h                    |  80 +--
 include/hw/ppc/spapr_irq.h                    |  48 +-
 include/hw/ppc/spapr_tpm_proxy.h              |   9 +-
 include/hw/ppc/spapr_vio.h                    |  19 +-
 include/hw/ppc/spapr_xive.h                   |  19 +-
 include/hw/ppc/xics.h                         |  31 +-
 include/hw/ppc/xics_spapr.h                   |   5 +-
 include/hw/ppc/xive.h                         |  77 ++-
 include/hw/qdev-core.h                        |  15 +-
 include/hw/rdma/rdma.h                        |   5 +-
 include/hw/register.h                         |   4 +-
 include/hw/resettable.h                       |  11 +-
 include/hw/riscv/opentitan.h                  |  48 +-
 include/hw/riscv/riscv_hart.h                 |  10 +-
 include/hw/riscv/sifive_clint.h               |  10 +-
 include/hw/riscv/sifive_e.h                   |  57 +-
 include/hw/riscv/sifive_e_prci.h              |  10 +-
 include/hw/riscv/sifive_gpio.h                |   9 +-
 include/hw/riscv/sifive_plic.h                |  10 +-
 include/hw/riscv/sifive_test.h                |  10 +-
 include/hw/riscv/sifive_u.h                   |  49 +-
 include/hw/riscv/sifive_u_otp.h               |  10 +-
 include/hw/riscv/sifive_u_prci.h              |  10 +-
 include/hw/riscv/sifive_uart.h                |  10 +-
 include/hw/riscv/virt.h                       |  10 +-
 include/hw/rtc/allwinner-rtc.h                |  18 +-
 include/hw/rtc/aspeed_rtc.h                   |   9 +-
 include/hw/rtc/goldfish_rtc.h                 |  10 +-
 include/hw/rtc/m48t59.h                       |  11 +-
 include/hw/rtc/mc146818rtc.h                  |   9 +-
 include/hw/rtc/pl031.h                        |   9 +-
 include/hw/rtc/xlnx-zynqmp-rtc.h              |  10 +-
 include/hw/rx/rx62n.h                         |   9 +-
 include/hw/s390x/3270-ccw.h                   |  19 +-
 include/hw/s390x/ap-device.h                  |  10 +-
 include/hw/s390x/css-bridge.h                 |  18 +-
 include/hw/s390x/event-facility.h             |  35 +-
 include/hw/s390x/s390-ccw.h                   |  19 +-
 include/hw/s390x/s390-virtio-ccw.h            |  11 +-
 include/hw/s390x/s390_flic.h                  |  31 +-
 include/hw/s390x/sclp.h                       |  18 +-
 include/hw/s390x/storage-attributes.h         |  37 +-
 include/hw/s390x/storage-keys.h               |  28 +-
 include/hw/s390x/tod.h                        |  18 +-
 include/hw/s390x/vfio-ccw.h                   |   7 +-
 include/hw/scsi/esp.h                         |   9 +-
 include/hw/scsi/scsi.h                        |  19 +-
 include/hw/sd/allwinner-sdhost.h              |  18 +-
 include/hw/sd/aspeed_sdhci.h                  |  10 +-
 include/hw/sd/bcm2835_sdhost.h                |  10 +-
 include/hw/sd/sd.h                            |  23 +-
 include/hw/sd/sdhci.h                         |  13 +-
 include/hw/southbridge/piix.h                 |  10 +-
 include/hw/sparc/sparc32_dma.h                |  34 +-
 include/hw/sparc/sun4m_iommu.h                |   9 +-
 include/hw/sparc/sun4u_iommu.h                |   9 +-
 include/hw/ssi/aspeed_smc.h                   |  18 +-
 include/hw/ssi/imx_spi.h                      |   9 +-
 include/hw/ssi/mss-spi.h                      |   9 +-
 include/hw/ssi/pl022.h                        |   9 +-
 include/hw/ssi/ssi.h                          |  11 +-
 include/hw/ssi/stm32f2xx_spi.h                |  10 +-
 include/hw/ssi/xilinx_spips.h                 |  32 +-
 include/hw/stream.h                           |  11 +-
 include/hw/sysbus.h                           |  17 +-
 include/hw/timer/a9gtimer.h                   |   6 +-
 include/hw/timer/allwinner-a10-pit.h          |   6 +-
 include/hw/timer/arm_mptimer.h                |  10 +-
 include/hw/timer/armv7m_systick.h             |   9 +-
 include/hw/timer/aspeed_timer.h               |  19 +-
 include/hw/timer/avr_timer16.h                |  10 +-
 include/hw/timer/bcm2835_systmr.h             |  10 +-
 include/hw/timer/cmsdk-apb-dualtimer.h        |   7 +-
 include/hw/timer/cmsdk-apb-timer.h            |  10 +-
 include/hw/timer/digic-timer.h                |   9 +-
 include/hw/timer/i8254.h                      |  11 +-
 include/hw/timer/i8254_internal.h             |   8 +-
 include/hw/timer/imx_epit.h                   |   9 +-
 include/hw/timer/imx_gpt.h                    |   9 +-
 include/hw/timer/mss-timer.h                  |  10 +-
 include/hw/timer/nrf51_timer.h                |   9 +-
 include/hw/timer/renesas_cmt.h                |   9 +-
 include/hw/timer/renesas_tmr.h                |   9 +-
 include/hw/timer/stm32f2xx_timer.h            |  10 +-
 include/hw/usb.h                              |  17 +-
 include/hw/usb/chipidea.h                     |   9 +-
 include/hw/usb/imx-usb-phy.h                  |   9 +-
 include/hw/vfio/vfio-amd-xgbe.h               |  11 +-
 include/hw/vfio/vfio-calxeda-xgmac.h          |  21 +-
 include/hw/vfio/vfio-platform.h               |  19 +-
 include/hw/virtio/vhost-scsi-common.h         |  10 +-
 include/hw/virtio/vhost-scsi.h                |  10 +-
 include/hw/virtio/vhost-user-blk.h            |  10 +-
 include/hw/virtio/vhost-user-fs.h             |  10 +-
 include/hw/virtio/vhost-user-scsi.h           |  10 +-
 include/hw/virtio/vhost-user-vsock.h          |  10 +-
 include/hw/virtio/vhost-vsock-common.h        |  10 +-
 include/hw/virtio/vhost-vsock.h               |  10 +-
 include/hw/virtio/virtio-balloon.h            |  10 +-
 include/hw/virtio/virtio-blk.h                |  10 +-
 include/hw/virtio/virtio-bus.h                |  15 +-
 include/hw/virtio/virtio-crypto.h             |  10 +-
 include/hw/virtio/virtio-gpu-pci.h            |   5 +-
 include/hw/virtio/virtio-gpu.h                |  33 +-
 include/hw/virtio/virtio-input.h              |  29 +-
 include/hw/virtio/virtio-iommu.h              |  10 +-
 include/hw/virtio/virtio-mem.h                |  17 +-
 include/hw/virtio/virtio-mmio.h               |  19 +-
 include/hw/virtio/virtio-net.h                |   7 +-
 include/hw/virtio/virtio-pmem.h               |  17 +-
 include/hw/virtio/virtio-rng.h                |  10 +-
 include/hw/virtio/virtio-scsi.h               |  19 +-
 include/hw/virtio/virtio-serial.h             |  23 +-
 include/hw/virtio/virtio.h                    |  14 +-
 include/hw/vmstate-if.h                       |  11 +-
 include/hw/watchdog/cmsdk-apb-watchdog.h      |  10 +-
 include/hw/watchdog/wdt_aspeed.h              |  19 +-
 include/hw/watchdog/wdt_diag288.h             |  19 +-
 include/hw/watchdog/wdt_imx2.h                |   9 +-
 include/hw/xen/xen-block.h                    |  39 +-
 include/hw/xen/xen-bus.h                      |  37 +-
 include/hw/xen/xen-legacy-backend.h           |   6 +-
 include/io/channel-buffer.h                   |   7 +-
 include/io/channel-command.h                  |   7 +-
 include/io/channel-file.h                     |   7 +-
 include/io/channel-socket.h                   |   7 +-
 include/io/channel-tls.h                      |   7 +-
 include/io/channel-websock.h                  |   7 +-
 include/io/channel.h                          |  12 +-
 include/io/dns-resolver.h                     |  13 +-
 include/io/net-listener.h                     |  14 +-
 include/net/can_emu.h                         |   8 +-
 include/net/can_host.h                        |  21 +-
 include/net/filter.h                          |  13 +-
 include/qom/object.h                          | 332 ++++++++-
 include/qom/object_interfaces.h               |  13 +-
 include/scsi/pr-manager.h                     |  16 +-
 include/sysemu/accel.h                        |  18 +-
 include/sysemu/cryptodev.h                    |  16 +-
 include/sysemu/hostmem.h                      |  10 +-
 include/sysemu/hvf.h                          |   8 +-
 include/sysemu/iothread.h                     |   9 +-
 include/sysemu/kvm.h                          |   7 +
 include/sysemu/kvm_int.h                      |   5 -
 include/sysemu/rng-random.h                   |   5 +-
 include/sysemu/rng.h                          |  10 +-
 include/sysemu/tpm.h                          |  11 +-
 include/sysemu/tpm_backend.h                  |  12 +-
 include/sysemu/vhost-user-backend.h           |  17 +-
 include/ui/console.h                          |  10 +-
 migration/migration.h                         |   6 +-
 target/alpha/cpu-qom.h                        |  14 +-
 target/arm/cpu-qom.h                          |  19 +-
 target/arm/idau.h                             |  11 +-
 target/avr/cpu-qom.h                          |  14 +-
 target/cris/cpu-qom.h                         |  14 +-
 target/hppa/cpu-qom.h                         |  14 +-
 target/i386/cpu-qom.h                         |  14 +-
 target/i386/hvf/hvf-i386.h                    |   4 +-
 target/lm32/cpu-qom.h                         |  14 +-
 target/m68k/cpu-qom.h                         |  14 +-
 target/microblaze/cpu-qom.h                   |  14 +-
 target/mips/cpu-qom.h                         |  14 +-
 target/moxie/cpu.h                            |  17 +-
 target/nios2/cpu.h                            |  17 +-
 target/openrisc/cpu.h                         |  17 +-
 target/ppc/cpu-qom.h                          |  14 +-
 target/ppc/cpu.h                              |  11 +-
 target/riscv/cpu.h                            |  17 +-
 target/rx/cpu-qom.h                           |   6 +-
 target/s390x/cpu-qom.h                        |  14 +-
 target/sh4/cpu-qom.h                          |  14 +-
 target/sparc/cpu-qom.h                        |  14 +-
 target/tilegx/cpu.h                           |  17 +-
 target/tricore/cpu-qom.h                      |  14 +-
 target/unicore32/cpu-qom.h                    |  14 +-
 target/xtensa/cpu-qom.h                       |  14 +-
 accel/accel.c                                 |   6 +-
 accel/kvm/kvm-all.c                           |   6 +-
 accel/qtest.c                                 |   6 +-
 accel/tcg/tcg-all.c                           |  15 +-
 accel/xen/xen-all.c                           |   6 +-
 authz/base.c                                  |   6 +-
 authz/list.c                                  |   7 +-
 authz/listfile.c                              |   7 +-
 authz/pamacct.c                               |   7 +-
 authz/simple.c                                |   7 +-
 backends/cryptodev-builtin.c                  |  15 +-
 backends/cryptodev-vhost-user.c               |  18 +-
 backends/cryptodev.c                          |   7 +-
 backends/dbus-vmstate.c                       |  23 +-
 backends/hostmem-file.c                       |  13 +-
 backends/hostmem-memfd.c                      |   9 +-
 backends/hostmem-ram.c                        |   6 +-
 backends/hostmem.c                            |   6 +-
 backends/rng-builtin.c                        |  15 +-
 backends/rng-egd.c                            |  16 +-
 backends/rng-random.c                         |   6 +-
 backends/rng.c                                |   6 +-
 backends/tpm/tpm_backend.c                    |   8 +-
 backends/tpm/tpm_emulator.c                   |  16 +-
 backends/tpm/tpm_passthrough.c                |  13 +-
 backends/vhost-user.c                         |   6 +-
 block/throttle-groups.c                       |  10 +-
 chardev/baum.c                                |  15 +-
 chardev/char-console.c                        |   6 +-
 chardev/char-fd.c                             |   6 +-
 chardev/char-mux.c                            |   6 +-
 chardev/char-null.c                           |   6 +-
 chardev/char-parallel.c                       |  23 +-
 chardev/char-pty.c                            |  15 +-
 chardev/char-ringbuf.c                        |  18 +-
 chardev/char-socket.c                         |  16 +-
 chardev/char-udp.c                            |  15 +-
 chardev/char-win-stdio.c                      |  16 +-
 chardev/char-win.c                            |   6 +-
 chardev/char.c                                |   6 +-
 chardev/msmouse.c                             |  16 +-
 chardev/spice.c                               |  10 +-
 chardev/testdev.c                             |  16 +-
 chardev/wctablet.c                            |  16 +-
 crypto/secret.c                               |  24 +-
 crypto/secret_common.c                        |  32 +-
 crypto/secret_keyring.c                       |  28 +-
 crypto/tls-cipher-suites.c                    |   6 +-
 crypto/tlscreds.c                             |  25 +-
 crypto/tlscredsanon.c                         |  23 +-
 crypto/tlscredspsk.c                          |  25 +-
 crypto/tlscredsx509.c                         |  29 +-
 gdbstub.c                                     |   6 +-
 hw/9pfs/virtio-9p-device.c                    |   6 +-
 hw/acpi/generic_event_device.c                |   6 +-
 hw/acpi/piix4.c                               |  16 +-
 hw/acpi/vmgenid.c                             |   6 +-
 hw/adc/stm32f2xx_adc.c                        |   6 +-
 hw/alpha/typhoon.c                            |  18 +-
 hw/arm/allwinner-a10.c                        |   6 +-
 hw/arm/allwinner-h3.c                         | 130 ++--
 hw/arm/armsse.c                               |  26 +-
 hw/arm/armv7m.c                               |   8 +-
 hw/arm/aspeed.c                               |   4 +-
 hw/arm/aspeed_ast2600.c                       | 208 +++---
 hw/arm/aspeed_soc.c                           | 228 +++----
 hw/arm/bcm2835_peripherals.c                  |   6 +-
 hw/arm/bcm2836.c                              |   2 +-
 hw/arm/boot.c                                 |   6 +-
 hw/arm/collie.c                               |  16 +-
 hw/arm/digic.c                                |   6 +-
 hw/arm/exynos4210.c                           |   6 +-
 hw/arm/exynos4_boards.c                       |   8 +-
 hw/arm/fsl-imx25.c                            |   6 +-
 hw/arm/fsl-imx31.c                            |   6 +-
 hw/arm/fsl-imx6.c                             |   6 +-
 hw/arm/fsl-imx6ul.c                           |   6 +-
 hw/arm/fsl-imx7.c                             |   6 +-
 hw/arm/gumstix.c                              |   8 +-
 hw/arm/highbank.c                             |  24 +-
 hw/arm/integratorcp.c                         |  38 +-
 hw/arm/microbit.c                             |  16 +-
 hw/arm/mps2-tz.c                              |  29 +-
 hw/arm/mps2.c                                 |  29 +-
 hw/arm/msf2-soc.c                             |   6 +-
 hw/arm/musca.c                                |  29 +-
 hw/arm/musicpal.c                             |  95 +--
 hw/arm/nrf51_soc.c                            |   6 +-
 hw/arm/nseries.c                              |   8 +-
 hw/arm/omap_sx1.c                             |   8 +-
 hw/arm/orangepi.c                             |   6 +-
 hw/arm/palm.c                                 |  16 +-
 hw/arm/pxa2xx.c                               |  49 +-
 hw/arm/pxa2xx_gpio.c                          |  13 +-
 hw/arm/pxa2xx_pic.c                           |  16 +-
 hw/arm/raspi.c                                |  19 +-
 hw/arm/realview.c                             |  12 +-
 hw/arm/sbsa-ref.c                             |  16 +-
 hw/arm/smmu-common.c                          |   6 +-
 hw/arm/spitz.c                                |  89 ++-
 hw/arm/stellaris.c                            |  46 +-
 hw/arm/stm32f205_soc.c                        |   6 +-
 hw/arm/stm32f405_soc.c                        |   6 +-
 hw/arm/strongarm.c                            |  65 +-
 hw/arm/tosa.c                                 |  28 +-
 hw/arm/versatilepb.c                          |  24 +-
 hw/arm/vexpress.c                             |  29 +-
 hw/arm/virt.c                                 |   6 +-
 hw/arm/xilinx_zynq.c                          |  16 +-
 hw/arm/xlnx-versal-virt.c                     |  16 +-
 hw/arm/xlnx-versal.c                          |   6 +-
 hw/arm/xlnx-zcu102.c                          |  16 +-
 hw/arm/xlnx-zynqmp.c                          |   6 +-
 hw/arm/z2.c                                   |  17 +-
 hw/audio/ac97.c                               |  10 +-
 hw/audio/adlib.c                              |   9 +-
 hw/audio/cs4231.c                             |  16 +-
 hw/audio/cs4231a.c                            |   9 +-
 hw/audio/es1370.c                             |  10 +-
 hw/audio/gus.c                                |   9 +-
 hw/audio/hda-codec.c                          |  16 +-
 hw/audio/intel-hda.c                          |  15 +-
 hw/audio/marvell_88w8618.c                    |  16 +-
 hw/audio/milkymist-ac97.c                     |  13 +-
 hw/audio/pcspk.c                              |  11 +-
 hw/audio/pl041.c                              |  15 +-
 hw/audio/sb16.c                               |   9 +-
 hw/audio/wm8750.c                             |  15 +-
 hw/avr/arduino.c                              |  19 +-
 hw/avr/atmega.c                               |  12 +-
 hw/block/fdc.c                                |  50 +-
 hw/block/m25p80.c                             |  21 +-
 hw/block/nand.c                               |  11 +-
 hw/block/nvme.c                               |   6 +-
 hw/block/onenand.c                            |  15 +-
 hw/block/pflash_cfi01.c                       |   6 +-
 hw/block/pflash_cfi02.c                       |   6 +-
 hw/block/swim.c                               |  10 +-
 hw/block/vhost-user-blk.c                     |   6 +-
 hw/block/virtio-blk.c                         |   6 +-
 hw/block/xen-block.c                          |  10 +-
 hw/char/avr_usart.c                           |   6 +-
 hw/char/bcm2835_aux.c                         |   6 +-
 hw/char/cadence_uart.c                        |   6 +-
 hw/char/cmsdk-apb-uart.c                      |   6 +-
 hw/char/debugcon.c                            |  16 +-
 hw/char/digic-uart.c                          |   6 +-
 hw/char/escc.c                                |   6 +-
 hw/char/etraxfs_ser.c                         |  16 +-
 hw/char/exynos4210_uart.c                     |  16 +-
 hw/char/grlib_apbuart.c                       |  16 +-
 hw/char/ibex_uart.c                           |   6 +-
 hw/char/imx_serial.c                          |   6 +-
 hw/char/ipoctal232.c                          |  11 +-
 hw/char/lm32_juart.c                          |  12 +-
 hw/char/lm32_uart.c                           |  12 +-
 hw/char/mcf_uart.c                            |  15 +-
 hw/char/milkymist-uart.c                      |  13 +-
 hw/char/nrf51_uart.c                          |   6 +-
 hw/char/parallel.c                            |  16 +-
 hw/char/pl011.c                               |   8 +-
 hw/char/renesas_sci.c                         |   6 +-
 hw/char/sclpconsole-lm.c                      |  16 +-
 hw/char/sclpconsole.c                         |  16 +-
 hw/char/serial-isa.c                          |  15 +-
 hw/char/serial-pci-multi.c                    |   8 +-
 hw/char/serial-pci.c                          |  15 +-
 hw/char/serial.c                              |  10 +-
 hw/char/spapr_vty.c                           |  12 +-
 hw/char/stm32f2xx_usart.c                     |   6 +-
 hw/char/terminal3270.c                        |  16 +-
 hw/char/virtio-console.c                      |  18 +-
 hw/char/virtio-serial-bus.c                   |  14 +-
 hw/char/xilinx_uartlite.c                     |  16 +-
 hw/core/bus.c                                 |   6 +-
 hw/core/clock.c                               |   6 +-
 hw/core/cpu.c                                 |   6 +-
 hw/core/fw-path-provider.c                    |   6 +-
 hw/core/generic-loader.c                      |   6 +-
 hw/core/hotplug.c                             |   6 +-
 hw/core/irq.c                                 |   9 +-
 hw/core/machine.c                             |   6 +-
 hw/core/nmi.c                                 |   6 +-
 hw/core/or-irq.c                              |   6 +-
 hw/core/platform-bus.c                        |   6 +-
 hw/core/qdev.c                                |   6 +-
 hw/core/register.c                            |   6 +-
 hw/core/resettable.c                          |   6 +-
 hw/core/split-irq.c                           |   6 +-
 hw/core/stream.c                              |   6 +-
 hw/core/sysbus.c                              |   8 +-
 hw/core/vmstate-if.c                          |   6 +-
 hw/cpu/a15mpcore.c                            |   6 +-
 hw/cpu/a9mpcore.c                             |   6 +-
 hw/cpu/arm11mpcore.c                          |   6 +-
 hw/cpu/cluster.c                              |   6 +-
 hw/cpu/core.c                                 |   6 +-
 hw/cpu/realview_mpcore.c                      |  16 +-
 hw/display/ads7846.c                          |  15 +-
 hw/display/artist.c                           |  15 +-
 hw/display/ati.c                              |   6 +-
 hw/display/bcm2835_fb.c                       |   6 +-
 hw/display/bochs-display.c                    |  16 +-
 hw/display/cg3.c                              |  15 +-
 hw/display/cirrus_vga.c                       |  16 +-
 hw/display/cirrus_vga_isa.c                   |  16 +-
 hw/display/dpcd.c                             |   6 +-
 hw/display/exynos4210_fimd.c                  |  16 +-
 hw/display/g364fb.c                           |  15 +-
 hw/display/i2c-ddc.c                          |   6 +-
 hw/display/jazz_led.c                         |  15 +-
 hw/display/macfb.c                            |   8 +-
 hw/display/milkymist-tmu2.c                   |  13 +-
 hw/display/milkymist-vgafb.c                  |  13 +-
 hw/display/next-fb.c                          |  12 +-
 hw/display/pl110.c                            |  41 +-
 hw/display/qxl.c                              |  10 +-
 hw/display/ramfb-standalone.c                 |  15 +-
 hw/display/sii9022.c                          |  15 +-
 hw/display/sm501.c                            |  26 +-
 hw/display/ssd0303.c                          |  15 +-
 hw/display/ssd0323.c                          |  15 +-
 hw/display/tcx.c                              |  15 +-
 hw/display/vga-isa.c                          |  15 +-
 hw/display/vga-pci.c                          |  19 +-
 hw/display/vhost-user-gpu-pci.c               |  10 +-
 hw/display/vhost-user-gpu.c                   |   9 +-
 hw/display/vhost-user-vga.c                   |  10 +-
 hw/display/virtio-gpu-base.c                  |   7 +-
 hw/display/virtio-gpu-pci.c                   |  12 +-
 hw/display/virtio-gpu.c                       |   6 +-
 hw/display/virtio-vga.c                       |  12 +-
 hw/display/vmware_vga.c                       |  11 +-
 hw/display/xlnx_dp.c                          |   6 +-
 hw/dma/bcm2835_dma.c                          |   6 +-
 hw/dma/i82374.c                               |  15 +-
 hw/dma/i8257.c                                |   8 +-
 hw/dma/pl080.c                                |   8 +-
 hw/dma/pl330.c                                |  10 +-
 hw/dma/puv3_dma.c                             |  15 +-
 hw/dma/pxa2xx_dma.c                           |  15 +-
 hw/dma/rc4030.c                               |  18 +-
 hw/dma/sparc32_dma.c                          |  12 +-
 hw/dma/xilinx_axidma.c                        |  29 +-
 hw/dma/xlnx-zdma.c                            |   6 +-
 hw/dma/xlnx-zynq-devcfg.c                     |   6 +-
 hw/dma/xlnx_dpdma.c                           |   6 +-
 hw/gpio/aspeed_gpio.c                         |  14 +-
 hw/gpio/bcm2835_gpio.c                        |   6 +-
 hw/gpio/gpio_key.c                            |  15 +-
 hw/gpio/imx_gpio.c                            |   6 +-
 hw/gpio/max7310.c                             |  15 +-
 hw/gpio/mpc8xxx.c                             |  15 +-
 hw/gpio/nrf51_gpio.c                          |   6 +-
 hw/gpio/omap_gpio.c                           |   8 +-
 hw/gpio/pl061.c                               |  17 +-
 hw/gpio/puv3_gpio.c                           |  15 +-
 hw/gpio/zaurus.c                              |  12 +-
 hw/hppa/dino.c                                |  16 +-
 hw/hppa/lasi.c                                |  16 +-
 hw/hyperv/hyperv.c                            |  15 +-
 hw/hyperv/hyperv_testdev.c                    |  11 +-
 hw/hyperv/vmbus.c                             |  13 +-
 hw/i2c/aspeed_i2c.c                           |  12 +-
 hw/i2c/bitbang_i2c.c                          |  15 +-
 hw/i2c/core.c                                 |   8 +-
 hw/i2c/exynos4210_i2c.c                       |  16 +-
 hw/i2c/imx_i2c.c                              |   6 +-
 hw/i2c/microbit_i2c.c                         |   6 +-
 hw/i2c/mpc_i2c.c                              |  16 +-
 hw/i2c/omap_i2c.c                             |   6 +-
 hw/i2c/ppc4xx_i2c.c                           |   6 +-
 hw/i2c/smbus_eeprom.c                         |  16 +-
 hw/i2c/smbus_ich9.c                           |  16 +-
 hw/i2c/smbus_slave.c                          |   6 +-
 hw/i2c/versatile_i2c.c                        |  13 +-
 hw/i386/amd_iommu.c                           |  10 +-
 hw/i386/intel_iommu.c                         |   8 +-
 hw/i386/kvm/apic.c                            |   6 +-
 hw/i386/kvm/clock.c                           |  15 +-
 hw/i386/kvm/i8254.c                           |  24 +-
 hw/i386/kvm/i8259.c                           |  18 +-
 hw/i386/kvm/ioapic.c                          |   6 +-
 hw/i386/kvmvapic.c                            |  15 +-
 hw/i386/microvm.c                             |   6 +-
 hw/i386/pc.c                                  |   6 +-
 hw/i386/pc_piix.c                             |   6 +-
 hw/i386/port92.c                              |  15 +-
 hw/i386/vmmouse.c                             |  16 +-
 hw/i386/vmport.c                              |  15 +-
 hw/i386/x86-iommu.c                           |   6 +-
 hw/i386/x86.c                                 |   6 +-
 hw/i386/xen/xen_apic.c                        |   6 +-
 hw/i386/xen/xen_platform.c                    |  16 +-
 hw/i386/xen/xen_pvdevice.c                    |  16 +-
 hw/ide/ahci-allwinner.c                       |   9 +-
 hw/ide/ahci.c                                 |   6 +-
 hw/ide/cmd646.c                               |   6 +-
 hw/ide/ich.c                                  |   6 +-
 hw/ide/isa.c                                  |  15 +-
 hw/ide/macio.c                                |   6 +-
 hw/ide/microdrive.c                           |  17 +-
 hw/ide/mmio.c                                 |  15 +-
 hw/ide/pci.c                                  |   6 +-
 hw/ide/piix.c                                 |  10 +-
 hw/ide/qdev.c                                 |  14 +-
 hw/ide/sii3112.c                              |  14 +-
 hw/ide/via.c                                  |   6 +-
 hw/input/adb-kbd.c                            |  24 +-
 hw/input/adb-mouse.c                          |  24 +-
 hw/input/adb.c                                |   8 +-
 hw/input/lm832x.c                             |  15 +-
 hw/input/milkymist-softusb.c                  |  13 +-
 hw/input/pckbd.c                              |   8 +-
 hw/input/pl050.c                              |  19 +-
 hw/input/vhost-user-input.c                   |   6 +-
 hw/input/virtio-input-hid.c                   |  12 +-
 hw/input/virtio-input-host.c                  |   6 +-
 hw/input/virtio-input.c                       |   6 +-
 hw/intc/allwinner-a10-pic.c                   |   6 +-
 hw/intc/apic.c                                |  12 +-
 hw/intc/apic_common.c                         |   6 +-
 hw/intc/arm_gic.c                             |   6 +-
 hw/intc/arm_gic_common.c                      |   6 +-
 hw/intc/arm_gic_kvm.c                         |  23 +-
 hw/intc/arm_gicv2m.c                          |  15 +-
 hw/intc/arm_gicv3.c                           |   6 +-
 hw/intc/arm_gicv3_common.c                    |   6 +-
 hw/intc/arm_gicv3_its_common.c                |   6 +-
 hw/intc/arm_gicv3_its_kvm.c                   |  20 +-
 hw/intc/arm_gicv3_kvm.c                       |  21 +-
 hw/intc/armv7m_nvic.c                         |   6 +-
 hw/intc/aspeed_vic.c                          |   6 +-
 hw/intc/bcm2835_ic.c                          |   6 +-
 hw/intc/bcm2836_control.c                     |   6 +-
 hw/intc/etraxfs_pic.c                         |  11 +-
 hw/intc/exynos4210_combiner.c                 |  16 +-
 hw/intc/exynos4210_gic.c                      |  31 +-
 hw/intc/grlib_irqmp.c                         |  15 +-
 hw/intc/heathrow_pic.c                        |   6 +-
 hw/intc/i8259.c                               |  16 +-
 hw/intc/i8259_common.c                        |   6 +-
 hw/intc/ibex_plic.c                           |   6 +-
 hw/intc/imx_avic.c                            |   6 +-
 hw/intc/imx_gpcv2.c                           |   6 +-
 hw/intc/intc.c                                |   6 +-
 hw/intc/ioapic.c                              |   6 +-
 hw/intc/ioapic_common.c                       |   6 +-
 hw/intc/lm32_pic.c                            |  12 +-
 hw/intc/loongson_liointc.c                    |  11 +-
 hw/intc/mips_gic.c                            |   6 +-
 hw/intc/nios2_iic.c                           |  16 +-
 hw/intc/omap_intc.c                           |  10 +-
 hw/intc/ompic.c                               |  12 +-
 hw/intc/openpic.c                             |   6 +-
 hw/intc/openpic_kvm.c                         |  16 +-
 hw/intc/pl190.c                               |  15 +-
 hw/intc/pnv_xive.c                            |   6 +-
 hw/intc/puv3_intc.c                           |  15 +-
 hw/intc/realview_gic.c                        |   6 +-
 hw/intc/rx_icu.c                              |   6 +-
 hw/intc/s390_flic.c                           |   8 +-
 hw/intc/s390_flic_kvm.c                       |  22 +-
 hw/intc/slavio_intctl.c                       |  16 +-
 hw/intc/spapr_xive.c                          |   6 +-
 hw/intc/xics.c                                |  10 +-
 hw/intc/xics_pnv.c                            |   6 +-
 hw/intc/xics_spapr.c                          |   6 +-
 hw/intc/xilinx_intc.c                         |  10 +-
 hw/intc/xive.c                                |  18 +-
 hw/intc/xlnx-pmu-iomod-intc.c                 |   6 +-
 hw/intc/xlnx-zynqmp-ipi.c                     |   6 +-
 hw/ipack/ipack.c                              |   8 +-
 hw/ipack/tpci200.c                            |  16 +-
 hw/ipmi/ipmi.c                                |   8 +-
 hw/ipmi/ipmi_bmc_extern.c                     |  10 +-
 hw/ipmi/ipmi_bmc_sim.c                        |   6 +-
 hw/ipmi/isa_ipmi_bt.c                         |  16 +-
 hw/ipmi/isa_ipmi_kcs.c                        |  16 +-
 hw/ipmi/pci_ipmi_bt.c                         |  16 +-
 hw/ipmi/pci_ipmi_kcs.c                        |  16 +-
 hw/ipmi/smbus_ipmi.c                          |  15 +-
 hw/isa/i82378.c                               |  16 +-
 hw/isa/isa-bus.c                              |  12 +-
 hw/isa/isa-superio.c                          |   8 +-
 hw/isa/lpc_ich9.c                             |   6 +-
 hw/isa/pc87312.c                              |   6 +-
 hw/isa/piix3.c                                |  14 +-
 hw/isa/piix4.c                                |  16 +-
 hw/isa/smc37c669-superio.c                    |   6 +-
 hw/isa/vt82c686.c                             |  51 +-
 hw/lm32/lm32_boards.c                         |   8 +-
 hw/m68k/mcf_intc.c                            |  15 +-
 hw/m68k/next-cube.c                           |  15 +-
 hw/m68k/next-kbd.c                            |  15 +-
 hw/m68k/q800.c                                |   6 +-
 hw/mem/memory-device.c                        |   6 +-
 hw/mem/nvdimm.c                               |   6 +-
 hw/mem/pc-dimm.c                              |   6 +-
 hw/microblaze/xlnx-zynqmp-pmu.c               |  16 +-
 hw/mips/boston.c                              |  15 +-
 hw/mips/cps.c                                 |   6 +-
 hw/mips/gt64xxx_pci.c                         |  18 +-
 hw/mips/jazz.c                                |   8 +-
 hw/mips/malta.c                               |  15 +-
 hw/misc/a9scu.c                               |   6 +-
 hw/misc/allwinner-cpucfg.c                    |   6 +-
 hw/misc/allwinner-h3-ccu.c                    |   6 +-
 hw/misc/allwinner-h3-dramc.c                  |   6 +-
 hw/misc/allwinner-h3-sysctrl.c                |   6 +-
 hw/misc/allwinner-sid.c                       |   6 +-
 hw/misc/applesmc.c                            |  12 +-
 hw/misc/arm11scu.c                            |   6 +-
 hw/misc/arm_integrator_debug.c                |  16 +-
 hw/misc/arm_l2x0.c                            |  15 +-
 hw/misc/arm_sysctl.c                          |  16 +-
 hw/misc/armsse-cpuid.c                        |   6 +-
 hw/misc/armsse-mhu.c                          |   6 +-
 hw/misc/aspeed_scu.c                          |  12 +-
 hw/misc/aspeed_sdmc.c                         |  12 +-
 hw/misc/aspeed_xdma.c                         |   6 +-
 hw/misc/auxbus.c                              |  12 +-
 hw/misc/avr_power.c                           |   6 +-
 hw/misc/bcm2835_mbox.c                        |   6 +-
 hw/misc/bcm2835_mphi.c                        |   6 +-
 hw/misc/bcm2835_property.c                    |   6 +-
 hw/misc/bcm2835_rng.c                         |   6 +-
 hw/misc/bcm2835_thermal.c                     |   6 +-
 hw/misc/debugexit.c                           |  16 +-
 hw/misc/eccmemctl.c                           |  15 +-
 hw/misc/edu.c                                 |   9 +-
 hw/misc/empty_slot.c                          |  15 +-
 hw/misc/exynos4210_clk.c                      |  12 +-
 hw/misc/exynos4210_pmu.c                      |  16 +-
 hw/misc/exynos4210_rng.c                      |  16 +-
 hw/misc/grlib_ahb_apb_pnp.c                   |   8 +-
 hw/misc/imx25_ccm.c                           |   6 +-
 hw/misc/imx31_ccm.c                           |   6 +-
 hw/misc/imx6_ccm.c                            |   6 +-
 hw/misc/imx6_src.c                            |   6 +-
 hw/misc/imx6ul_ccm.c                          |   6 +-
 hw/misc/imx7_ccm.c                            |   8 +-
 hw/misc/imx7_gpr.c                            |   6 +-
 hw/misc/imx7_snvs.c                           |   6 +-
 hw/misc/imx_ccm.c                             |   6 +-
 hw/misc/imx_rngc.c                            |   6 +-
 hw/misc/iotkit-secctl.c                       |   6 +-
 hw/misc/iotkit-sysctl.c                       |   6 +-
 hw/misc/iotkit-sysinfo.c                      |   6 +-
 hw/misc/ivshmem.c                             |  32 +-
 hw/misc/mac_via.c                             |  10 +-
 hw/misc/macio/cuda.c                          |   8 +-
 hw/misc/macio/gpio.c                          |   6 +-
 hw/misc/macio/mac_dbdma.c                     |   6 +-
 hw/misc/macio/macio.c                         |  12 +-
 hw/misc/macio/pmu.c                           |   8 +-
 hw/misc/max111x.c                             |  10 +-
 hw/misc/milkymist-hpdmc.c                     |  13 +-
 hw/misc/milkymist-pfpu.c                      |  13 +-
 hw/misc/mips_cmgcr.c                          |   6 +-
 hw/misc/mips_cpc.c                            |   6 +-
 hw/misc/mips_itu.c                            |   6 +-
 hw/misc/mos6522.c                             |   6 +-
 hw/misc/mps2-fpgaio.c                         |   6 +-
 hw/misc/mps2-scc.c                            |   6 +-
 hw/misc/msf2-sysreg.c                         |   6 +-
 hw/misc/mst_fpga.c                            |  16 +-
 hw/misc/nrf51_rng.c                           |   6 +-
 hw/misc/pc-testdev.c                          |  16 +-
 hw/misc/pca9552.c                             |  20 +-
 hw/misc/pci-testdev.c                         |  16 +-
 hw/misc/puv3_pm.c                             |  15 +-
 hw/misc/pvpanic.c                             |  16 +-
 hw/misc/sga.c                                 |  15 +-
 hw/misc/slavio_misc.c                         |  25 +-
 hw/misc/stm32f2xx_syscfg.c                    |   6 +-
 hw/misc/stm32f4xx_exti.c                      |   6 +-
 hw/misc/stm32f4xx_syscfg.c                    |   6 +-
 hw/misc/tmp105.c                              |   6 +-
 hw/misc/tmp421.c                              |  20 +-
 hw/misc/tz-mpc.c                              |   8 +-
 hw/misc/tz-msc.c                              |   6 +-
 hw/misc/tz-ppc.c                              |   6 +-
 hw/misc/unimp.c                               |   6 +-
 hw/misc/vmcoreinfo.c                          |   6 +-
 hw/misc/zynq-xadc.c                           |   6 +-
 hw/misc/zynq_slcr.c                           |  15 +-
 hw/net/allwinner-sun8i-emac.c                 |   6 +-
 hw/net/allwinner_emac.c                       |   6 +-
 hw/net/cadence_gem.c                          |   6 +-
 hw/net/can/can_kvaser_pci.c                   |  16 +-
 hw/net/can/can_mioe3680_pci.c                 |  16 +-
 hw/net/can/can_pcm3680_pci.c                  |  16 +-
 hw/net/dp8393x.c                              |  15 +-
 hw/net/e1000.c                                |  25 +-
 hw/net/e1000e.c                               |  15 +-
 hw/net/etraxfs_eth.c                          |  17 +-
 hw/net/fsl_etsec/etsec.c                      |   6 +-
 hw/net/ftgmac100.c                            |   8 +-
 hw/net/imx_fec.c                              |   8 +-
 hw/net/lan9118.c                              |  15 +-
 hw/net/lance.c                                |   6 +-
 hw/net/lasi_i82596.c                          |   6 +-
 hw/net/mcf_fec.c                              |  10 +-
 hw/net/milkymist-minimac2.c                   |  13 +-
 hw/net/mipsnet.c                              |  15 +-
 hw/net/msf2-emac.c                            |   6 +-
 hw/net/ne2000-isa.c                           |  15 +-
 hw/net/ne2000-pci.c                           |   6 +-
 hw/net/opencores_eth.c                        |  15 +-
 hw/net/pcnet-pci.c                            |  16 +-
 hw/net/rocker/rocker.c                        |  11 +-
 hw/net/rtl8139.c                              |  16 +-
 hw/net/smc91c111.c                            |  15 +-
 hw/net/spapr_llan.c                           |  12 +-
 hw/net/stellaris_enet.c                       |  16 +-
 hw/net/sungem.c                               |  15 +-
 hw/net/sunhme.c                               |  15 +-
 hw/net/tulip.c                                |  10 +-
 hw/net/virtio-net.c                           |   6 +-
 hw/net/vmxnet3.c                              |  14 +-
 hw/net/xgmac.c                                |  15 +-
 hw/net/xilinx_axienet.c                       |  29 +-
 hw/net/xilinx_ethlite.c                       |  11 +-
 hw/nubus/mac-nubus-bridge.c                   |   6 +-
 hw/nubus/nubus-bridge.c                       |   6 +-
 hw/nubus/nubus-bus.c                          |   6 +-
 hw/nubus/nubus-device.c                       |   6 +-
 hw/nvram/ds1225y.c                            |  15 +-
 hw/nvram/eeprom_at24c.c                       |  15 +-
 hw/nvram/fw_cfg.c                             |  12 +-
 hw/nvram/mac_nvram.c                          |   6 +-
 hw/nvram/nrf51_nvm.c                          |   6 +-
 hw/nvram/spapr_nvram.c                        |  16 +-
 hw/pci-bridge/dec.c                           |  19 +-
 hw/pci-bridge/gen_pcie_root_port.c            |  10 +-
 hw/pci-bridge/i82801b11.c                     |   6 +-
 hw/pci-bridge/ioh3420.c                       |   6 +-
 hw/pci-bridge/pci_bridge_dev.c                |  15 +-
 hw/pci-bridge/pci_expander_bridge.c           |  37 +-
 hw/pci-bridge/pcie_pci_bridge.c               |  16 +-
 hw/pci-bridge/pcie_root_port.c                |   6 +-
 hw/pci-bridge/simba.c                         |   6 +-
 hw/pci-bridge/xio3130_downstream.c            |   6 +-
 hw/pci-bridge/xio3130_upstream.c              |   6 +-
 hw/pci-host/bonito.c                          |  22 +-
 hw/pci-host/designware.c                      |   8 +-
 hw/pci-host/gpex.c                            |   8 +-
 hw/pci-host/grackle.c                         |  18 +-
 hw/pci-host/i440fx.c                          |  18 +-
 hw/pci-host/pnv_phb3.c                        |  17 +-
 hw/pci-host/pnv_phb3_msi.c                    |   6 +-
 hw/pci-host/pnv_phb3_pbcq.c                   |   6 +-
 hw/pci-host/pnv_phb4.c                        |  17 +-
 hw/pci-host/pnv_phb4_pec.c                    |   8 +-
 hw/pci-host/ppce500.c                         |  21 +-
 hw/pci-host/prep.c                            |  27 +-
 hw/pci-host/q35.c                             |   8 +-
 hw/pci-host/sabre.c                           |   8 +-
 hw/pci-host/uninorth.c                        |  18 +-
 hw/pci-host/versatile.c                       |  24 +-
 hw/pci-host/xen_igd_pt.c                      |   6 +-
 hw/pci-host/xilinx-pcie.c                     |   8 +-
 hw/pci/pci.c                                  |  14 +-
 hw/pci/pci_bridge.c                           |   6 +-
 hw/pci/pci_host.c                             |   6 +-
 hw/pci/pcie_host.c                            |   6 +-
 hw/pci/pcie_port.c                            |   8 +-
 hw/pcmcia/pcmcia.c                            |   6 +-
 hw/pcmcia/pxa2xx.c                            |  10 +-
 hw/ppc/e500.c                                 |   8 +-
 hw/ppc/e500plat.c                             |   6 +-
 hw/ppc/mac_newworld.c                         |   6 +-
 hw/ppc/mac_oldworld.c                         |   6 +-
 hw/ppc/mpc8544_guts.c                         |  12 +-
 hw/ppc/mpc8544ds.c                            |   6 +-
 hw/ppc/pnv_core.c                             |   6 +-
 hw/ppc/pnv_homer.c                            |  10 +-
 hw/ppc/pnv_lpc.c                              |  12 +-
 hw/ppc/pnv_occ.c                              |  10 +-
 hw/ppc/pnv_pnor.c                             |   6 +-
 hw/ppc/pnv_psi.c                              |  12 +-
 hw/ppc/pnv_xscom.c                            |   6 +-
 hw/ppc/ppc405_boards.c                        |   8 +-
 hw/ppc/ppc440_pcix.c                          |  16 +-
 hw/ppc/ppc440_uc.c                            |  16 +-
 hw/ppc/ppc4xx_pci.c                           |  15 +-
 hw/ppc/ppce500_spin.c                         |  15 +-
 hw/ppc/prep_systemio.c                        |  16 +-
 hw/ppc/rs6000_mc.c                            |  16 +-
 hw/ppc/spapr.c                                |   6 +-
 hw/ppc/spapr_drc.c                            |  16 +-
 hw/ppc/spapr_iommu.c                          |   8 +-
 hw/ppc/spapr_irq.c                            |   6 +-
 hw/ppc/spapr_pci.c                            |   6 +-
 hw/ppc/spapr_rng.c                            |  13 +-
 hw/ppc/spapr_rtc.c                            |   6 +-
 hw/ppc/spapr_tpm_proxy.c                      |   2 +-
 hw/ppc/spapr_vio.c                            |  10 +-
 hw/rdma/rdma.c                                |   6 +-
 hw/rdma/vmw/pvrdma_main.c                     |   6 +-
 hw/riscv/opentitan.c                          |  90 ++-
 hw/riscv/riscv_hart.c                         |   6 +-
 hw/riscv/sifive_clint.c                       |   6 +-
 hw/riscv/sifive_e.c                           |  94 ++-
 hw/riscv/sifive_e_prci.c                      |   6 +-
 hw/riscv/sifive_gpio.c                        |   6 +-
 hw/riscv/sifive_plic.c                        |   6 +-
 hw/riscv/sifive_test.c                        |   6 +-
 hw/riscv/sifive_u.c                           | 148 ++---
 hw/riscv/sifive_u_otp.c                       |   6 +-
 hw/riscv/sifive_u_prci.c                      |   6 +-
 hw/riscv/virt.c                               |   6 +-
 hw/rtc/allwinner-rtc.c                        |  12 +-
 hw/rtc/aspeed_rtc.c                           |   6 +-
 hw/rtc/ds1338.c                               |  15 +-
 hw/rtc/exynos4210_rtc.c                       |  16 +-
 hw/rtc/goldfish_rtc.c                         |   6 +-
 hw/rtc/m41t80.c                               |  15 +-
 hw/rtc/m48t59-isa.c                           |  23 +-
 hw/rtc/m48t59.c                               |  23 +-
 hw/rtc/mc146818rtc.c                          |   6 +-
 hw/rtc/pl031.c                                |   6 +-
 hw/rtc/sun4v-rtc.c                            |  15 +-
 hw/rtc/twl92230.c                             |  15 +-
 hw/rtc/xlnx-zynqmp-rtc.c                      |   6 +-
 hw/rx/rx-gdbsim.c                             |  19 +-
 hw/rx/rx62n.c                                 |  12 +-
 hw/s390x/3270-ccw.c                           |   6 +-
 hw/s390x/ap-bridge.c                          |   8 +-
 hw/s390x/ap-device.c                          |   6 +-
 hw/s390x/ccw-device.c                         |   6 +-
 hw/s390x/css-bridge.c                         |   8 +-
 hw/s390x/event-facility.c                     |  10 +-
 hw/s390x/ipl.c                                |   6 +-
 hw/s390x/s390-ccw.c                           |   6 +-
 hw/s390x/s390-pci-bus.c                       |  14 +-
 hw/s390x/s390-skeys-kvm.c                     |   6 +-
 hw/s390x/s390-skeys.c                         |   8 +-
 hw/s390x/s390-stattrib-kvm.c                  |   6 +-
 hw/s390x/s390-stattrib.c                      |   8 +-
 hw/s390x/s390-virtio-ccw.c                    |   6 +-
 hw/s390x/sclp.c                               |   6 +-
 hw/s390x/sclpcpu.c                            |   6 +-
 hw/s390x/sclpquiesce.c                        |   6 +-
 hw/s390x/tod-kvm.c                            |   6 +-
 hw/s390x/tod-qemu.c                           |   6 +-
 hw/s390x/tod.c                                |   6 +-
 hw/s390x/vhost-vsock-ccw.c                    |   6 +-
 hw/s390x/virtio-ccw-9p.c                      |   6 +-
 hw/s390x/virtio-ccw-balloon.c                 |   6 +-
 hw/s390x/virtio-ccw-blk.c                     |   6 +-
 hw/s390x/virtio-ccw-crypto.c                  |   6 +-
 hw/s390x/virtio-ccw-gpu.c                     |   6 +-
 hw/s390x/virtio-ccw-input.c                   |  14 +-
 hw/s390x/virtio-ccw-net.c                     |   6 +-
 hw/s390x/virtio-ccw-rng.c                     |   6 +-
 hw/s390x/virtio-ccw-scsi.c                    |   4 +-
 hw/s390x/virtio-ccw-serial.c                  |   6 +-
 hw/s390x/virtio-ccw.c                         |   8 +-
 hw/scsi/esp-pci.c                             |  27 +-
 hw/scsi/esp.c                                 |   6 +-
 hw/scsi/lsi53c895a.c                          |  18 +-
 hw/scsi/megasas.c                             |  29 +-
 hw/scsi/mptsas.c                              |   5 -
 hw/scsi/scsi-bus.c                            |   8 +-
 hw/scsi/scsi-disk.c                           |  30 +-
 hw/scsi/scsi-generic.c                        |   6 +-
 hw/scsi/spapr_vscsi.c                         |  16 +-
 hw/scsi/vhost-scsi-common.c                   |   6 +-
 hw/scsi/vhost-scsi.c                          |   6 +-
 hw/scsi/vhost-user-scsi.c                     |   6 +-
 hw/scsi/virtio-scsi.c                         |   8 +-
 hw/scsi/vmw_pvscsi.c                          |  29 +-
 hw/sd/allwinner-sdhost.c                      |  18 +-
 hw/sd/aspeed_sdhci.c                          |   6 +-
 hw/sd/bcm2835_sdhost.c                        |  14 +-
 hw/sd/core.c                                  |   6 +-
 hw/sd/milkymist-memcard.c                     |  13 +-
 hw/sd/pl181.c                                 |  15 +-
 hw/sd/pxa2xx_mmci.c                           |  16 +-
 hw/sd/sd.c                                    |   6 +-
 hw/sd/sdhci-pci.c                             |   6 +-
 hw/sd/sdhci.c                                 |  17 +-
 hw/sd/ssi-sd.c                                |  15 +-
 hw/sh4/sh_pci.c                               |  18 +-
 hw/sparc/sun4m.c                              |  62 +-
 hw/sparc/sun4m_iommu.c                        |   8 +-
 hw/sparc64/niagara.c                          |   6 +-
 hw/sparc64/sun4u.c                            |  45 +-
 hw/sparc64/sun4u_iommu.c                      |   8 +-
 hw/ssi/aspeed_smc.c                           |   2 +-
 hw/ssi/imx_spi.c                              |   6 +-
 hw/ssi/mss-spi.c                              |   6 +-
 hw/ssi/pl022.c                                |   6 +-
 hw/ssi/ssi.c                                  |  12 +-
 hw/ssi/stm32f2xx_spi.c                        |   6 +-
 hw/ssi/xilinx_spi.c                           |  15 +-
 hw/ssi/xilinx_spips.c                         |  10 +-
 hw/timer/a9gtimer.c                           |   6 +-
 hw/timer/allwinner-a10-pit.c                  |   6 +-
 hw/timer/altera_timer.c                       |  16 +-
 hw/timer/arm_mptimer.c                        |   6 +-
 hw/timer/arm_timer.c                          |  26 +-
 hw/timer/armv7m_systick.c                     |   6 +-
 hw/timer/aspeed_timer.c                       |  12 +-
 hw/timer/avr_timer16.c                        |   6 +-
 hw/timer/bcm2835_systmr.c                     |   6 +-
 hw/timer/cadence_ttc.c                        |  16 +-
 hw/timer/cmsdk-apb-dualtimer.c                |   6 +-
 hw/timer/cmsdk-apb-timer.c                    |   6 +-
 hw/timer/digic-timer.c                        |   6 +-
 hw/timer/etraxfs_timer.c                      |  16 +-
 hw/timer/exynos4210_mct.c                     |  16 +-
 hw/timer/exynos4210_pwm.c                     |  16 +-
 hw/timer/grlib_gptimer.c                      |  13 +-
 hw/timer/hpet.c                               |  15 +-
 hw/timer/i8254.c                              |  16 +-
 hw/timer/i8254_common.c                       |   6 +-
 hw/timer/imx_epit.c                           |   6 +-
 hw/timer/imx_gpt.c                            |  12 +-
 hw/timer/lm32_timer.c                         |  12 +-
 hw/timer/milkymist-sysctl.c                   |  13 +-
 hw/timer/mss-timer.c                          |   6 +-
 hw/timer/nrf51_timer.c                        |   6 +-
 hw/timer/puv3_ost.c                           |  15 +-
 hw/timer/pxa2xx_timer.c                       |  17 +-
 hw/timer/renesas_cmt.c                        |   6 +-
 hw/timer/renesas_tmr.c                        |   6 +-
 hw/timer/slavio_timer.c                       |  16 +-
 hw/timer/stm32f2xx_timer.c                    |   6 +-
 hw/timer/xilinx_timer.c                       |  11 +-
 hw/tpm/tpm_crb.c                              |  15 +-
 hw/tpm/tpm_spapr.c                            |  16 +-
 hw/tpm/tpm_tis_isa.c                          |  15 +-
 hw/tpm/tpm_tis_sysbus.c                       |  15 +-
 hw/usb/bus.c                                  |   8 +-
 hw/usb/ccid-card-emulated.c                   |  13 +-
 hw/usb/ccid-card-passthru.c                   |  11 +-
 hw/usb/chipidea.c                             |   6 +-
 hw/usb/dev-audio.c                            |  11 +-
 hw/usb/dev-hid.c                              |  17 +-
 hw/usb/dev-hub.c                              |  15 +-
 hw/usb/dev-mtp.c                              |  10 +-
 hw/usb/dev-network.c                          |  15 +-
 hw/usb/dev-serial.c                           |  15 +-
 hw/usb/dev-smartcard-reader.c                 |  23 +-
 hw/usb/dev-storage.c                          |  19 +-
 hw/usb/dev-uas.c                              |  10 +-
 hw/usb/dev-wacom.c                            |  11 +-
 hw/usb/hcd-dwc2.c                             |  14 +-
 hw/usb/hcd-ehci-pci.c                         |   2 +-
 hw/usb/hcd-ehci-sysbus.c                      |  18 +-
 hw/usb/hcd-ohci-pci.c                         |  15 +-
 hw/usb/hcd-ohci.c                             |   6 +-
 hw/usb/hcd-uhci.c                             |   6 +-
 hw/usb/hcd-xhci-nec.c                         |   6 +-
 hw/usb/hcd-xhci.c                             |   8 +-
 hw/usb/host-libusb.c                          |  13 +-
 hw/usb/imx-usb-phy.c                          |   6 +-
 hw/usb/redirect.c                             |  10 +-
 hw/usb/tusb6010.c                             |  15 +-
 hw/vfio/amd-xgbe.c                            |   6 +-
 hw/vfio/ap.c                                  |  16 +-
 hw/vfio/calxeda-xgmac.c                       |   6 +-
 hw/vfio/ccw.c                                 |   6 +-
 hw/vfio/igd.c                                 |   6 +-
 hw/vfio/pci.c                                 |  11 +-
 hw/vfio/platform.c                            |   6 +-
 hw/virtio/vhost-scsi-pci.c                    |   5 +-
 hw/virtio/vhost-user-blk-pci.c                |   5 +-
 hw/virtio/vhost-user-fs-pci.c                 |   5 +-
 hw/virtio/vhost-user-fs.c                     |   6 +-
 hw/virtio/vhost-user-input-pci.c              |   5 +-
 hw/virtio/vhost-user-scsi-pci.c               |   5 +-
 hw/virtio/vhost-user-vsock-pci.c              |   5 +-
 hw/virtio/vhost-user-vsock.c                  |   6 +-
 hw/virtio/vhost-vsock-common.c                |   6 +-
 hw/virtio/vhost-vsock-pci.c                   |   5 +-
 hw/virtio/vhost-vsock.c                       |   6 +-
 hw/virtio/virtio-9p-pci.c                     |  10 +-
 hw/virtio/virtio-balloon-pci.c                |   5 +-
 hw/virtio/virtio-balloon.c                    |   6 +-
 hw/virtio/virtio-blk-pci.c                    |   5 +-
 hw/virtio/virtio-bus.c                        |   6 +-
 hw/virtio/virtio-crypto-pci.c                 |   5 +-
 hw/virtio/virtio-crypto.c                     |   6 +-
 hw/virtio/virtio-input-host-pci.c             |   5 +-
 hw/virtio/virtio-input-pci.c                  |  13 +-
 hw/virtio/virtio-iommu-pci.c                  |   5 +-
 hw/virtio/virtio-iommu.c                      |   8 +-
 hw/virtio/virtio-mem.c                        |   6 +-
 hw/virtio/virtio-mmio.c                       |   8 +-
 hw/virtio/virtio-net-pci.c                    |   5 +-
 hw/virtio/virtio-pci.c                        |   4 +-
 hw/virtio/virtio-pmem.c                       |   6 +-
 hw/virtio/virtio-rng-pci.c                    |   5 +-
 hw/virtio/virtio-rng.c                        |   6 +-
 hw/virtio/virtio-scsi-pci.c                   |   5 +-
 hw/virtio/virtio-serial-pci.c                 |   5 +-
 hw/virtio/virtio.c                            |   6 +-
 hw/watchdog/cmsdk-apb-watchdog.c              |   8 +-
 hw/watchdog/wdt_aspeed.c                      |   8 +-
 hw/watchdog/wdt_diag288.c                     |   2 +-
 hw/watchdog/wdt_i6300esb.c                    |   7 +-
 hw/watchdog/wdt_ib700.c                       |  11 +-
 hw/watchdog/wdt_imx2.c                        |   2 +-
 hw/xen/xen-bus.c                              |  10 +-
 hw/xen/xen-legacy-backend.c                   |  10 +-
 hw/xen/xen_pt.c                               |   6 +-
 hw/xtensa/xtfpga.c                            |  20 +-
 io/channel-buffer.c                           |   6 +-
 io/channel-command.c                          |   6 +-
 io/channel-file.c                             |   6 +-
 io/channel-socket.c                           |   6 +-
 io/channel-tls.c                              |   6 +-
 io/channel-websock.c                          |   6 +-
 io/channel.c                                  |   6 +-
 io/dns-resolver.c                             |   6 +-
 io/net-listener.c                             |   6 +-
 iothread.c                                    |  12 +-
 migration/migration.c                         |   6 +-
 migration/rdma.c                              |  13 +-
 net/can/can_core.c                            |   6 +-
 net/can/can_host.c                            |   6 +-
 net/can/can_socketcan.c                       |  16 +-
 net/colo-compare.c                            |  15 +-
 net/dump.c                                    |  13 +-
 net/filter-buffer.c                           |  15 +-
 net/filter-mirror.c                           |  25 +-
 net/filter-replay.c                           |  13 +-
 net/filter-rewriter.c                         |  17 +-
 net/filter.c                                  |   6 +-
 qom/container.c                               |   6 +-
 qom/object.c                                  |   6 +-
 scsi/pr-manager-helper.c                      |  17 +-
 scsi/pr-manager.c                             |   7 +-
 softmmu/memory.c                              |   8 +-
 target/arm/cpu.c                              |   4 +-
 target/arm/cpu64.c                            |   2 +-
 target/hppa/cpu.c                             |   6 +-
 target/i386/cpu.c                             |   8 +-
 target/i386/hax-all.c                         |   6 +-
 target/i386/hvf/hvf.c                         |   6 +-
 target/i386/sev.c                             |  14 +-
 target/i386/whpx-all.c                        |   6 +-
 target/microblaze/cpu.c                       |   6 +-
 target/mips/cpu.c                             |   2 +-
 target/nios2/cpu.c                            |   6 +-
 target/ppc/translate_init.inc.c               |   4 +-
 target/rx/cpu.c                               |   8 +-
 target/s390x/cpu.c                            |   6 +-
 target/s390x/cpu_models.c                     |   6 +-
 target/sparc/cpu.c                            |   2 +-
 target/tilegx/cpu.c                           |   6 +-
 target/xtensa/cpu.c                           |   6 +-
 tests/check-qom-interface.c                   |  11 +-
 tests/check-qom-proplist.c                    |  16 +-
 tests/test-qdev-global-props.c                |  13 +-
 ui/console.c                                  |  15 +-
 ui/gtk.c                                      |   8 +-
 ui/input-barrier.c                            |  20 +-
 ui/input-linux.c                              |  20 +-
 ui/spice-app.c                                |   9 +-
 1332 files changed, 9573 insertions(+), 9591 deletions(-)
 create mode 100644 scripts/codeconverter/codeconverter/__init__.py
 create mode 100644 scripts/codeconverter/codeconverter/patching.py
 create mode 100644 scripts/codeconverter/codeconverter/qom_macros.py
 create mode 100644 scripts/codeconverter/codeconverter/qom_type_info.py
 create mode 100644 scripts/codeconverter/codeconverter/regexps.py
 create mode 100644 scripts/codeconverter/codeconverter/test_patching.py
 create mode 100644 scripts/codeconverter/codeconverter/test_regexps.py
 create mode 100644 scripts/codeconverter/codeconverter/utils.py
 create mode 100755 scripts/codeconverter/converter.py

--=20
2.26.2

#1 lore raw

PATCH v2 1/58 e1000: Rename QOM class cast macros

Rename the E1000_DEVICE_CLASS() and E1000_DEVICE_GET_CLASS() macros to be consistent with the E1000() instance cast macro.

This will allow us to register the type cast macros using OBJECT_DECLARE_TYPE later.

---
Changes v1 -> v2: none

---
Cc: Jason Wang <[email protected]>
Cc: [email protected]

---
 hw/net/e1000.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
hw/net/e1000.c +4 -4
index a18f80e369..c4d896a9e6 100644
@@ -151,9 +151,9 @@ typedef struct E1000BaseClass {
 #define E1000(obj) \
     OBJECT_CHECK(E1000State, (obj), TYPE_E1000_BASE)
 
-#define E1000_DEVICE_CLASS(klass) \
+#define E1000_CLASS(klass) \
      OBJECT_CLASS_CHECK(E1000BaseClass, (klass), TYPE_E1000_BASE)
-#define E1000_DEVICE_GET_CLASS(obj) \
+#define E1000_GET_CLASS(obj) \
     OBJECT_GET_CLASS(E1000BaseClass, (obj), TYPE_E1000_BASE)
 
 static void
@@ -365,7 +365,7 @@ e1000_autoneg_timer(void *opaque)
 static void e1000_reset(void *opaque)
 {
     E1000State *d = opaque;
-    E1000BaseClass *edc = E1000_DEVICE_GET_CLASS(d);
+    E1000BaseClass *edc = E1000_GET_CLASS(d);
     uint8_t *macaddr = d->conf.macaddr.a;
 
     timer_del(d->autoneg_timer);
@@ -1751,7 +1751,7 @@ static void e1000_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
     PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
-    E1000BaseClass *e = E1000_DEVICE_CLASS(klass);
+    E1000BaseClass *e = E1000_CLASS(klass);
     const E1000Info *info = data;
 
     k->realize = pci_e1000_realize;
Signature · 1 line
2.26.2
#2 lore raw

PATCH v2 2/58 megasas: Rename QOM class cast macros

In reply to Eduardo Habkost

Rename the MEGASAS_DEVICE_CLASS() and MEGASAS_DEVICE_GET_CLASS() macros to be consistent with the MEGASAS() instance cast macro.

This will allow us to register the type cast macros using OBJECT_DECLARE_TYPE later.

---
Changes v1 -> v2: none

---
Cc: Paolo Bonzini <[email protected]>
Cc: Fam Zheng <[email protected]>
Cc: Hannes Reinecke <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 hw/scsi/megasas.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
hw/scsi/megasas.c +6 -6
index 5cfd1bf22e..390c2f2edb 100644
@@ -134,9 +134,9 @@ typedef struct MegasasBaseClass {
 #define MEGASAS(obj) \
     OBJECT_CHECK(MegasasState, (obj), TYPE_MEGASAS_BASE)
 
-#define MEGASAS_DEVICE_CLASS(oc) \
+#define MEGASAS_CLASS(oc) \
     OBJECT_CLASS_CHECK(MegasasBaseClass, (oc), TYPE_MEGASAS_BASE)
-#define MEGASAS_DEVICE_GET_CLASS(oc) \
+#define MEGASAS_GET_CLASS(oc) \
     OBJECT_GET_CLASS(MegasasBaseClass, (oc), TYPE_MEGASAS_BASE)
 
 #define MEGASAS_INTR_DISABLED_MASK 0xFFFFFFFF
@@ -733,7 +733,7 @@ static int megasas_ctrl_get_info(MegasasState *s, MegasasCmd *cmd)
 {
     PCIDevice *pci_dev = PCI_DEVICE(s);
     PCIDeviceClass *pci_class = PCI_DEVICE_GET_CLASS(pci_dev);
-    MegasasBaseClass *base_class = MEGASAS_DEVICE_GET_CLASS(s);
+    MegasasBaseClass *base_class = MEGASAS_GET_CLASS(s);
     struct mfi_ctrl_info info;
     size_t dcmd_size = sizeof(info);
     BusChild *kid;
@@ -1999,7 +1999,7 @@ static uint64_t megasas_mmio_read(void *opaque, hwaddr addr,
 {
     MegasasState *s = opaque;
     PCIDevice *pci_dev = PCI_DEVICE(s);
-    MegasasBaseClass *base_class = MEGASAS_DEVICE_GET_CLASS(s);
+    MegasasBaseClass *base_class = MEGASAS_GET_CLASS(s);
     uint32_t retval = 0;
 
     switch (addr) {
@@ -2322,7 +2322,7 @@ static const struct SCSIBusInfo megasas_scsi_info = {
 static void megasas_scsi_realize(PCIDevice *dev, Error **errp)
 {
     MegasasState *s = MEGASAS(dev);
-    MegasasBaseClass *b = MEGASAS_DEVICE_GET_CLASS(s);
+    MegasasBaseClass *b = MEGASAS_GET_CLASS(s);
     uint8_t *pci_conf;
     int i, bar_type;
     Error *err = NULL;
@@ -2506,7 +2506,7 @@ static void megasas_class_init(ObjectClass *oc, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(oc);
     PCIDeviceClass *pc = PCI_DEVICE_CLASS(oc);
-    MegasasBaseClass *e = MEGASAS_DEVICE_CLASS(oc);
+    MegasasBaseClass *e = MEGASAS_CLASS(oc);
     const MegasasInfo *info = data;
 
     pc->realize = megasas_scsi_realize;
Signature · 1 line
2.26.2
#3 lore raw

PATCH v2 3/58 vmw_pvscsi: Rename QOM class cast macros

In reply to Eduardo Habkost

Rename the PVSCSI_DEVICE_CLASS() and PVSCSI_DEVICE_GET_CLASS() macros to be consistent with the PVSCSI() instance cast macro.

This will allow us to register the type cast macros using OBJECT_DECLARE_TYPE later.

---
Changes v1 -> v2: none

---
Cc: Dmitry Fleytman <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Fam Zheng <[email protected]>
Cc: [email protected]

---
 hw/scsi/vmw_pvscsi.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
hw/scsi/vmw_pvscsi.c +4 -4
index df07ab6bfb..c071e0c7aa 100644
@@ -64,9 +64,9 @@ typedef struct PVSCSIClass {
 #define TYPE_PVSCSI "pvscsi"
 #define PVSCSI(obj) OBJECT_CHECK(PVSCSIState, (obj), TYPE_PVSCSI)
 
-#define PVSCSI_DEVICE_CLASS(klass) \
+#define PVSCSI_CLASS(klass) \
     OBJECT_CLASS_CHECK(PVSCSIClass, (klass), TYPE_PVSCSI)
-#define PVSCSI_DEVICE_GET_CLASS(obj) \
+#define PVSCSI_GET_CLASS(obj) \
     OBJECT_GET_CLASS(PVSCSIClass, (obj), TYPE_PVSCSI)
 
 /* Compatibility flags for migration */
@@ -1265,7 +1265,7 @@ static Property pvscsi_properties[] = {
 
 static void pvscsi_realize(DeviceState *qdev, Error **errp)
 {
-    PVSCSIClass *pvs_c = PVSCSI_DEVICE_GET_CLASS(qdev);
+    PVSCSIClass *pvs_c = PVSCSI_GET_CLASS(qdev);
     PCIDevice *pci_dev = PCI_DEVICE(qdev);
     PVSCSIState *s = PVSCSI(qdev);
 
@@ -1280,7 +1280,7 @@ static void pvscsi_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
     PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
-    PVSCSIClass *pvs_k = PVSCSI_DEVICE_CLASS(klass);
+    PVSCSIClass *pvs_k = PVSCSI_CLASS(klass);
     HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(klass);
 
     k->realize = pvscsi_realizefn;
Signature · 1 line
2.26.2
#4 lore raw

PATCH v2 4/58 pl110: Rename pl110_version enum values

In reply to Eduardo Habkost

The PL110 enum value name will conflict with the PL110 type cast checker, when we replace the existing macro with an inline function. Add a VERSION_ prefix to all pl110_version enum values, to avoid conflicts.

---
Changes v1 -> v2:
* Fixed typo on commit message
* Rename all enum values to VERSION_* (Philippe Mathieu-Daudé)

---
Cc: Peter Maydell <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 hw/display/pl110.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
hw/display/pl110.c +11 -11
index c2991a28d2..61fefbffb3 100644
@@ -42,9 +42,9 @@ enum pl110_bppmode
 /* The Versatile/PB uses a slightly modified PL110 controller.  */
 enum pl110_version
 {
-    PL110,
-    PL110_VERSATILE,
-    PL111
+    VERSION_PL110,
+    VERSION_PL110_VERSATILE,
+    VERSION_PL111
 };
 
 #define TYPE_PL110 "pl110"
@@ -189,7 +189,7 @@ static void pl110_update_display(void *opaque)
     else
         bpp_offset = 24;
 
-    if ((s->version != PL111) && (s->bpp == BPP_16)) {
+    if ((s->version != VERSION_PL111) && (s->bpp == BPP_16)) {
         /* The PL110's native 16 bit mode is 5551; however
          * most boards with a PL110 implement an external
          * mux which allows bits to be reshuffled to give
@@ -372,12 +372,12 @@ static uint64_t pl110_read(void *opaque, hwaddr offset,
     case 5: /* LCDLPBASE */
         return s->lpbase;
     case 6: /* LCDIMSC */
-        if (s->version != PL110) {
+        if (s->version != VERSION_PL110) {
             return s->cr;
         }
         return s->int_mask;
     case 7: /* LCDControl */
-        if (s->version != PL110) {
+        if (s->version != VERSION_PL110) {
             return s->int_mask;
         }
         return s->cr;
@@ -437,7 +437,7 @@ static void pl110_write(void *opaque, hwaddr offset,
         s->lpbase = val;
         break;
     case 6: /* LCDIMSC */
-        if (s->version != PL110) {
+        if (s->version != VERSION_PL110) {
             goto control;
         }
     imsc:
@@ -445,7 +445,7 @@ static void pl110_write(void *opaque, hwaddr offset,
         pl110_update(s);
         break;
     case 7: /* LCDControl */
-        if (s->version != PL110) {
+        if (s->version != VERSION_PL110) {
             goto imsc;
         }
     control:
@@ -513,21 +513,21 @@ static void pl110_init(Object *obj)
 {
     PL110State *s = PL110(obj);
 
-    s->version = PL110;
+    s->version = VERSION_PL110;
 }
 
 static void pl110_versatile_init(Object *obj)
 {
     PL110State *s = PL110(obj);
 
-    s->version = PL110_VERSATILE;
+    s->version = VERSION_PL110_VERSATILE;
 }
 
 static void pl111_init(Object *obj)
 {
     PL110State *s = PL110(obj);
 
-    s->version = PL111;
+    s->version = VERSION_PL111;
 }
 
 static void pl110_class_init(ObjectClass *klass, void *data)
Signature · 1 line
2.26.2
Reviewed-by on v2 4/58
#5 lore raw

Re: [PATCH v2 04/58] pl110: Rename pl110_version enum values

Quoted 11 lines · Eduardo Habkost

The PL110 enum value name will conflict with the PL110 type cast checker, when we replace the existing macro with an inline function. Add a VERSION_ prefix to all pl110_version enum values, to avoid conflicts.

---
Changes v1 -> v2:
* Fixed typo on commit message
* Rename all enum values to VERSION_* (Philippe Mathieu-Daudé)

Quoted 8 lines

---
Cc: Peter Maydell <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 hw/display/pl110.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
Reviewed-by on v2 4/58
#6 lore raw

Re: [PATCH v2 04/58] pl110: Rename pl110_version enum values

In reply to Eduardo Habkost
Quoted 10 lines · Eduardo Habkost

The PL110 enum value name will conflict with the PL110 type cast checker, when we replace the existing macro with an inline function. Add a VERSION_ prefix to all pl110_version enum values, to avoid conflicts.

---
Changes v1 -> v2:
* Fixed typo on commit message
* Rename all enum values to VERSION_* (Philippe Mathieu-Daudé)

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#7 lore raw

PATCH v2 5/58 allwinner-h3: Rename memmap enum constants

In reply to Eduardo Habkost

Some of the enum constant names conflict with the QOM type check macros (AW_H3_CCU, AW_H3_SYSCTRL). This needs to be addressed to allow us to transform the QOM type check macros into functions generated by OBJECT_DECLARE_TYPE().

Rename all the constants to AW_H3_DEV_*, to avoid conflicts.

---
Changes v1 -> v2:
* Added more details to commit message

---
Cc: Beniamino Galvani <[email protected]>
Cc: Peter Maydell <[email protected]>
Cc: Niek Linnenbank <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 include/hw/arm/allwinner-h3.h |  62 ++++++++---------
 hw/arm/allwinner-h3.c         | 124 +++++++++++++++++-----------------
 hw/arm/orangepi.c             |   6 +-
 3 files changed, 96 insertions(+), 96 deletions(-)
include/hw/arm/allwinner-h3.h +31 -31
index 82e4e59216..626139dcb3 100644
@@ -61,37 +61,37 @@
  * @see AwH3State
  */
 enum {
-    AW_H3_SRAM_A1,
-    AW_H3_SRAM_A2,
-    AW_H3_SRAM_C,
-    AW_H3_SYSCTRL,
-    AW_H3_MMC0,
-    AW_H3_SID,
-    AW_H3_EHCI0,
-    AW_H3_OHCI0,
-    AW_H3_EHCI1,
-    AW_H3_OHCI1,
-    AW_H3_EHCI2,
-    AW_H3_OHCI2,
-    AW_H3_EHCI3,
-    AW_H3_OHCI3,
-    AW_H3_CCU,
-    AW_H3_PIT,
-    AW_H3_UART0,
-    AW_H3_UART1,
-    AW_H3_UART2,
-    AW_H3_UART3,
-    AW_H3_EMAC,
-    AW_H3_DRAMCOM,
-    AW_H3_DRAMCTL,
-    AW_H3_DRAMPHY,
-    AW_H3_GIC_DIST,
-    AW_H3_GIC_CPU,
-    AW_H3_GIC_HYP,
-    AW_H3_GIC_VCPU,
-    AW_H3_RTC,
-    AW_H3_CPUCFG,
-    AW_H3_SDRAM
+    AW_H3_DEV_SRAM_A1,
+    AW_H3_DEV_SRAM_A2,
+    AW_H3_DEV_SRAM_C,
+    AW_H3_DEV_SYSCTRL,
+    AW_H3_DEV_MMC0,
+    AW_H3_DEV_SID,
+    AW_H3_DEV_EHCI0,
+    AW_H3_DEV_OHCI0,
+    AW_H3_DEV_EHCI1,
+    AW_H3_DEV_OHCI1,
+    AW_H3_DEV_EHCI2,
+    AW_H3_DEV_OHCI2,
+    AW_H3_DEV_EHCI3,
+    AW_H3_DEV_OHCI3,
+    AW_H3_DEV_CCU,
+    AW_H3_DEV_PIT,
+    AW_H3_DEV_UART0,
+    AW_H3_DEV_UART1,
+    AW_H3_DEV_UART2,
+    AW_H3_DEV_UART3,
+    AW_H3_DEV_EMAC,
+    AW_H3_DEV_DRAMCOM,
+    AW_H3_DEV_DRAMCTL,
+    AW_H3_DEV_DRAMPHY,
+    AW_H3_DEV_GIC_DIST,
+    AW_H3_DEV_GIC_CPU,
+    AW_H3_DEV_GIC_HYP,
+    AW_H3_DEV_GIC_VCPU,
+    AW_H3_DEV_RTC,
+    AW_H3_DEV_CPUCFG,
+    AW_H3_DEV_SDRAM
 };
 
 /** Total number of CPU cores in the H3 SoC */
hw/arm/allwinner-h3.c +62 -62

218 lines not on this page · raw message

hw/arm/orangepi.c +3 -3
index 1679468232..17a568a2b4 100644
@@ -79,7 +79,7 @@ static void orangepi_init(MachineState *machine)
     object_property_set_int(OBJECT(&h3->emac), "phy-addr", 1, &error_abort);
 
     /* DRAMC */
-    object_property_set_uint(OBJECT(h3), "ram-addr", h3->memmap[AW_H3_SDRAM],
+    object_property_set_uint(OBJECT(h3), "ram-addr", h3->memmap[AW_H3_DEV_SDRAM],
                              &error_abort);
     object_property_set_int(OBJECT(h3), "ram-size", machine->ram_size / MiB,
                             &error_abort);
@@ -98,7 +98,7 @@ static void orangepi_init(MachineState *machine)
     qdev_realize_and_unref(carddev, bus, &error_fatal);
 
     /* SDRAM */
-    memory_region_add_subregion(get_system_memory(), h3->memmap[AW_H3_SDRAM],
+    memory_region_add_subregion(get_system_memory(), h3->memmap[AW_H3_DEV_SDRAM],
                                 machine->ram);
 
     /* Load target kernel or start using BootROM */
@@ -106,7 +106,7 @@ static void orangepi_init(MachineState *machine)
         /* Use Boot ROM to copy data from SD card to SRAM */
         allwinner_h3_bootrom_setup(h3, blk);
     }
-    orangepi_binfo.loader_start = h3->memmap[AW_H3_SDRAM];
+    orangepi_binfo.loader_start = h3->memmap[AW_H3_DEV_SDRAM];
     orangepi_binfo.ram_size = machine->ram_size;
     arm_load_kernel(ARM_CPU(first_cpu), machine, &orangepi_binfo);
 }
Signature · 1 line
2.26.2
Reviewed-by on v2 5/58
#8 lore raw

Re: [PATCH v2 05/58] allwinner-h3: Rename memmap enum constants

Op do 20 aug. 2020 02:12 schreef Eduardo Habkost <[email protected]>:

Quoted 9 lines

Some of the enum constant names conflict with the QOM type check macros (AW_H3_CCU, AW_H3_SYSCTRL). This needs to be addressed to allow us to transform the QOM type check macros into functions generated by OBJECT_DECLARE_TYPE().

Rename all the constants to AW_H3_DEV_*, to avoid conflicts.

Quoted 394 lines

---
Changes v1 -> v2:
* Added more details to commit message

---
Cc: Beniamino Galvani <[email protected]>
Cc: Peter Maydell <[email protected]>
Cc: Niek Linnenbank <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 include/hw/arm/allwinner-h3.h |  62 ++++++++---------
 hw/arm/allwinner-h3.c         | 124 +++++++++++++++++-----------------
 hw/arm/orangepi.c             |   6 +-
 3 files changed, 96 insertions(+), 96 deletions(-)
include/hw/arm/allwinner-h3.h +31 -31
index 82e4e59216..626139dcb3 100644
@@ -61,37 +61,37 @@
  * @see AwH3State
  */
 enum {
-    AW_H3_SRAM_A1,
-    AW_H3_SRAM_A2,
-    AW_H3_SRAM_C,
-    AW_H3_SYSCTRL,
-    AW_H3_MMC0,
-    AW_H3_SID,
-    AW_H3_EHCI0,
-    AW_H3_OHCI0,
-    AW_H3_EHCI1,
-    AW_H3_OHCI1,
-    AW_H3_EHCI2,
-    AW_H3_OHCI2,
-    AW_H3_EHCI3,
-    AW_H3_OHCI3,
-    AW_H3_CCU,
-    AW_H3_PIT,
-    AW_H3_UART0,
-    AW_H3_UART1,
-    AW_H3_UART2,
-    AW_H3_UART3,
-    AW_H3_EMAC,
-    AW_H3_DRAMCOM,
-    AW_H3_DRAMCTL,
-    AW_H3_DRAMPHY,
-    AW_H3_GIC_DIST,
-    AW_H3_GIC_CPU,
-    AW_H3_GIC_HYP,
-    AW_H3_GIC_VCPU,
-    AW_H3_RTC,
-    AW_H3_CPUCFG,
-    AW_H3_SDRAM
+    AW_H3_DEV_SRAM_A1,
+    AW_H3_DEV_SRAM_A2,
+    AW_H3_DEV_SRAM_C,
+    AW_H3_DEV_SYSCTRL,
+    AW_H3_DEV_MMC0,
+    AW_H3_DEV_SID,
+    AW_H3_DEV_EHCI0,
+    AW_H3_DEV_OHCI0,
+    AW_H3_DEV_EHCI1,
+    AW_H3_DEV_OHCI1,
+    AW_H3_DEV_EHCI2,
+    AW_H3_DEV_OHCI2,
+    AW_H3_DEV_EHCI3,
+    AW_H3_DEV_OHCI3,
+    AW_H3_DEV_CCU,
+    AW_H3_DEV_PIT,
+    AW_H3_DEV_UART0,
+    AW_H3_DEV_UART1,
+    AW_H3_DEV_UART2,
+    AW_H3_DEV_UART3,
+    AW_H3_DEV_EMAC,
+    AW_H3_DEV_DRAMCOM,
+    AW_H3_DEV_DRAMCTL,
+    AW_H3_DEV_DRAMPHY,
+    AW_H3_DEV_GIC_DIST,
+    AW_H3_DEV_GIC_CPU,
+    AW_H3_DEV_GIC_HYP,
+    AW_H3_DEV_GIC_VCPU,
+    AW_H3_DEV_RTC,
+    AW_H3_DEV_CPUCFG,
+    AW_H3_DEV_SDRAM
 };
 
 /** Total number of CPU cores in the H3 SoC */
hw/arm/allwinner-h3.c +32 -36
index ff92ded82c..341abe6718 100644
@@ -35,37 +35,37 @@
 
 /* Memory map */
 const hwaddr allwinner_h3_memmap[] = {
-    [AW_H3_SRAM_A1]    = 0x00000000,
-    [AW_H3_SRAM_A2]    = 0x00044000,
-    [AW_H3_SRAM_C]     = 0x00010000,
-    [AW_H3_SYSCTRL]    = 0x01c00000,
-    [AW_H3_MMC0]       = 0x01c0f000,
-    [AW_H3_SID]        = 0x01c14000,
-    [AW_H3_EHCI0]      = 0x01c1a000,
-    [AW_H3_OHCI0]      = 0x01c1a400,
-    [AW_H3_EHCI1]      = 0x01c1b000,
-    [AW_H3_OHCI1]      = 0x01c1b400,
-    [AW_H3_EHCI2]      = 0x01c1c000,
-    [AW_H3_OHCI2]      = 0x01c1c400,
-    [AW_H3_EHCI3]      = 0x01c1d000,
-    [AW_H3_OHCI3]      = 0x01c1d400,
-    [AW_H3_CCU]        = 0x01c20000,
-    [AW_H3_PIT]        = 0x01c20c00,
-    [AW_H3_UART0]      = 0x01c28000,
-    [AW_H3_UART1]      = 0x01c28400,
-    [AW_H3_UART2]      = 0x01c28800,
-    [AW_H3_UART3]      = 0x01c28c00,
-    [AW_H3_EMAC]       = 0x01c30000,
-    [AW_H3_DRAMCOM]    = 0x01c62000,
-    [AW_H3_DRAMCTL]    = 0x01c63000,
-    [AW_H3_DRAMPHY]    = 0x01c65000,
-    [AW_H3_GIC_DIST]   = 0x01c81000,
-    [AW_H3_GIC_CPU]    = 0x01c82000,
-    [AW_H3_GIC_HYP]    = 0x01c84000,
-    [AW_H3_GIC_VCPU]   = 0x01c86000,
-    [AW_H3_RTC]        = 0x01f00000,
-    [AW_H3_CPUCFG]     = 0x01f01c00,
-    [AW_H3_SDRAM]      = 0x40000000
+    [AW_H3_DEV_SRAM_A1]    = 0x00000000,
+    [AW_H3_DEV_SRAM_A2]    = 0x00044000,
+    [AW_H3_DEV_SRAM_C]     = 0x00010000,
+    [AW_H3_DEV_SYSCTRL]    = 0x01c00000,
+    [AW_H3_DEV_MMC0]       = 0x01c0f000,
+    [AW_H3_DEV_SID]        = 0x01c14000,
+    [AW_H3_DEV_EHCI0]      = 0x01c1a000,
+    [AW_H3_DEV_OHCI0]      = 0x01c1a400,
+    [AW_H3_DEV_EHCI1]      = 0x01c1b000,
+    [AW_H3_DEV_OHCI1]      = 0x01c1b400,
+    [AW_H3_DEV_EHCI2]      = 0x01c1c000,
+    [AW_H3_DEV_OHCI2]      = 0x01c1c400,
+    [AW_H3_DEV_EHCI3]      = 0x01c1d000,
+    [AW_H3_DEV_OHCI3]      = 0x01c1d400,
+    [AW_H3_DEV_CCU]        = 0x01c20000,
+    [AW_H3_DEV_PIT]        = 0x01c20c00,
+    [AW_H3_DEV_UART0]      = 0x01c28000,
+    [AW_H3_DEV_UART1]      = 0x01c28400,
+    [AW_H3_DEV_UART2]      = 0x01c28800,
+    [AW_H3_DEV_UART3]      = 0x01c28c00,
+    [AW_H3_DEV_EMAC]       = 0x01c30000,
+    [AW_H3_DEV_DRAMCOM]    = 0x01c62000,
+    [AW_H3_DEV_DRAMCTL]    = 0x01c63000,
+    [AW_H3_DEV_DRAMPHY]    = 0x01c65000,
+    [AW_H3_DEV_GIC_DIST]   = 0x01c81000,
+    [AW_H3_DEV_GIC_CPU]    = 0x01c82000,
+    [AW_H3_DEV_GIC_HYP]    = 0x01c84000,
+    [AW_H3_DEV_GIC_VCPU]   = 0x01c86000,
+    [AW_H3_DEV_RTC]        = 0x01f00000,
+    [AW_H3_DEV_CPUCFG]     = 0x01f01c00,
+    [AW_H3_DEV_SDRAM]      = 0x40000000
 };
 
 /* List of unimplemented devices */
@@ -183,7 +183,7 @@ void allwinner_h3_bootrom_setup(AwH3State *s,
 BlockBackend *blk)
     }
 
     rom_add_blob("allwinner-h3.bootrom", buffer, rom_size,
-                  rom_size, s->memmap[AW_H3_SRAM_A1],
+                  rom_size, s->memmap[AW_H3_DEV_SRAM_A1],
                   NULL, NULL, NULL, NULL, false);
 }
@@ -262,10 +262,10 @@ static void allwinner_h3_realize(DeviceState *dev,
 Error **errp)
     qdev_prop_set_bit(DEVICE(&s->gic), "has-virtualization-extensions",
 true);
     sysbus_realize(SYS_BUS_DEVICE(&s->gic), &error_fatal);
 
-    sysbus_mmio_map(SYS_BUS_DEVICE(&s->gic), 0,
 s->memmap[AW_H3_GIC_DIST]);
-    sysbus_mmio_map(SYS_BUS_DEVICE(&s->gic), 1, s->memmap[AW_H3_GIC_CPU]);
-    sysbus_mmio_map(SYS_BUS_DEVICE(&s->gic), 2, s->memmap[AW_H3_GIC_HYP]);
-    sysbus_mmio_map(SYS_BUS_DEVICE(&s->gic), 3,

s->memmap[AW_H3_GIC_VCPU]);
+ sysbus_mmio_map(SYS_BUS_DEVICE(&s->gic), 0,
s->memmap[AW_H3_DEV_GIC_DIST]);
+ sysbus_mmio_map(SYS_BUS_DEVICE(&s->gic), 1,
s->memmap[AW_H3_DEV_GIC_CPU]);
+ sysbus_mmio_map(SYS_BUS_DEVICE(&s->gic), 2,
s->memmap[AW_H3_DEV_GIC_HYP]);
+ sysbus_mmio_map(SYS_BUS_DEVICE(&s->gic), 3,
s->memmap[AW_H3_DEV_GIC_VCPU]);

/*
* Wire the outputs from each CPU's generic timer and the GICv3

hw/arm/allwinner-h3.c +1 -1
@@ -312,7 +312,7 @@ static void allwinner_h3_realize(DeviceState *dev,
 Error **errp)
 
     /* Timer */
     sysbus_realize(SYS_BUS_DEVICE(&s->timer), &error_fatal);
-    sysbus_mmio_map(SYS_BUS_DEVICE(&s->timer), 0, s->memmap[AW_H3_PIT]);
+    sysbus_mmio_map(SYS_BUS_DEVICE(&s->timer), 0,
 s->memmap[AW_H3_DEV_PIT]);
     sysbus_connect_irq(SYS_BUS_DEVICE(&s->timer), 0,
                        qdev_get_gpio_in(DEVICE(&s->gic),
AW_H3_GIC_SPI_TIMER0));
     sysbus_connect_irq(SYS_BUS_DEVICE(&s->timer), 1,
hw/arm/allwinner-h3.c +6 -6
@@ -325,32 +325,32 @@ static void allwinner_h3_realize(DeviceState *dev,
 Error **errp)
                             32 * KiB, &error_abort);
     memory_region_init_ram(&s->sram_c, OBJECT(dev), "sram C",
                             44 * KiB, &error_abort);
-    memory_region_add_subregion(get_system_memory(),
 s->memmap[AW_H3_SRAM_A1],
+    memory_region_add_subregion(get_system_memory(),
 s->memmap[AW_H3_DEV_SRAM_A1],
                                 &s->sram_a1);
-    memory_region_add_subregion(get_system_memory(),
 s->memmap[AW_H3_SRAM_A2],
+    memory_region_add_subregion(get_system_memory(),
 s->memmap[AW_H3_DEV_SRAM_A2],
                                 &s->sram_a2);
-    memory_region_add_subregion(get_system_memory(),
 s->memmap[AW_H3_SRAM_C],
+    memory_region_add_subregion(get_system_memory(),
 s->memmap[AW_H3_DEV_SRAM_C],
                                 &s->sram_c);
 
     /* Clock Control Unit */
     sysbus_realize(SYS_BUS_DEVICE(&s->ccu), &error_fatal);
-    sysbus_mmio_map(SYS_BUS_DEVICE(&s->ccu), 0, s->memmap[AW_H3_CCU]);
+    sysbus_mmio_map(SYS_BUS_DEVICE(&s->ccu), 0, s->memmap[AW_H3_DEV_CCU]);
 
     /* System Control */
     sysbus_realize(SYS_BUS_DEVICE(&s->sysctrl), &error_fatal);
-    sysbus_mmio_map(SYS_BUS_DEVICE(&s->sysctrl), 0,
 s->memmap[AW_H3_SYSCTRL]);
+    sysbus_mmio_map(SYS_BUS_DEVICE(&s->sysctrl), 0,
 s->memmap[AW_H3_DEV_SYSCTRL]);
 
     /* CPU Configuration */
     sysbus_realize(SYS_BUS_DEVICE(&s->cpucfg), &error_fatal);
-    sysbus_mmio_map(SYS_BUS_DEVICE(&s->cpucfg), 0,
 s->memmap[AW_H3_CPUCFG]);
+    sysbus_mmio_map(SYS_BUS_DEVICE(&s->cpucfg), 0,
 s->memmap[AW_H3_DEV_CPUCFG]);
     /* Security Identifier */
     sysbus_realize(SYS_BUS_DEVICE(&s->sid), &error_fatal);
hw/arm/allwinner-h3.c +2 -2
-    sysbus_mmio_map(SYS_BUS_DEVICE(&s->sid), 0, s->memmap[AW_H3_SID]);
+    sysbus_mmio_map(SYS_BUS_DEVICE(&s->sid), 0, s->memmap[AW_H3_DEV_SID]);
 
     /* SD/MMC */
     sysbus_realize(SYS_BUS_DEVICE(&s->mmc0), &error_fatal);
-    sysbus_mmio_map(SYS_BUS_DEVICE(&s->mmc0), 0, s->memmap[AW_H3_MMC0]);
+    sysbus_mmio_map(SYS_BUS_DEVICE(&s->mmc0), 0,
s->memmap[AW_H3_DEV_MMC0]);
     sysbus_connect_irq(SYS_BUS_DEVICE(&s->mmc0), 0,
                        qdev_get_gpio_in(DEVICE(&s->gic),

AW_H3_GIC_SPI_MMC0));

hw/arm/allwinner-h3.c +9 -9
@@ -364,63 +364,63 @@ static void allwinner_h3_realize(DeviceState *dev,
 Error **errp)
         qdev_set_nic_properties(DEVICE(&s->emac), &nd_table[0]);
     }
     sysbus_realize(SYS_BUS_DEVICE(&s->emac), &error_fatal);
-    sysbus_mmio_map(SYS_BUS_DEVICE(&s->emac), 0, s->memmap[AW_H3_EMAC]);
+    sysbus_mmio_map(SYS_BUS_DEVICE(&s->emac), 0,
 s->memmap[AW_H3_DEV_EMAC]);
     sysbus_connect_irq(SYS_BUS_DEVICE(&s->emac), 0,
                        qdev_get_gpio_in(DEVICE(&s->gic),
 AW_H3_GIC_SPI_EMAC));
 
     /* Universal Serial Bus */
-    sysbus_create_simple(TYPE_AW_H3_EHCI, s->memmap[AW_H3_EHCI0],
+    sysbus_create_simple(TYPE_AW_H3_EHCI, s->memmap[AW_H3_DEV_EHCI0],
                          qdev_get_gpio_in(DEVICE(&s->gic),
                                           AW_H3_GIC_SPI_EHCI0));
-    sysbus_create_simple(TYPE_AW_H3_EHCI, s->memmap[AW_H3_EHCI1],
+    sysbus_create_simple(TYPE_AW_H3_EHCI, s->memmap[AW_H3_DEV_EHCI1],
                          qdev_get_gpio_in(DEVICE(&s->gic),
                                           AW_H3_GIC_SPI_EHCI1));
-    sysbus_create_simple(TYPE_AW_H3_EHCI, s->memmap[AW_H3_EHCI2],
+    sysbus_create_simple(TYPE_AW_H3_EHCI, s->memmap[AW_H3_DEV_EHCI2],
                          qdev_get_gpio_in(DEVICE(&s->gic),
                                           AW_H3_GIC_SPI_EHCI2));
-    sysbus_create_simple(TYPE_AW_H3_EHCI, s->memmap[AW_H3_EHCI3],
+    sysbus_create_simple(TYPE_AW_H3_EHCI, s->memmap[AW_H3_DEV_EHCI3],
                          qdev_get_gpio_in(DEVICE(&s->gic),
                                           AW_H3_GIC_SPI_EHCI3));
 
-    sysbus_create_simple("sysbus-ohci", s->memmap[AW_H3_OHCI0],
+    sysbus_create_simple("sysbus-ohci", s->memmap[AW_H3_DEV_OHCI0],
                          qdev_get_gpio_in(DEVICE(&s->gic),
                                           AW_H3_GIC_SPI_OHCI0));
-    sysbus_create_simple("sysbus-ohci", s->memmap[AW_H3_OHCI1],
+    sysbus_create_simple("sysbus-ohci", s->memmap[AW_H3_DEV_OHCI1],
                          qdev_get_gpio_in(DEVICE(&s->gic),
                                           AW_H3_GIC_SPI_OHCI1));
-    sysbus_create_simple("sysbus-ohci", s->memmap[AW_H3_OHCI2],
+    sysbus_create_simple("sysbus-ohci", s->memmap[AW_H3_DEV_OHCI2],
                          qdev_get_gpio_in(DEVICE(&s->gic),
                                           AW_H3_GIC_SPI_OHCI2));
-    sysbus_create_simple("sysbus-ohci", s->memmap[AW_H3_OHCI3],
+    sysbus_create_simple("sysbus-ohci", s->memmap[AW_H3_DEV_OHCI3],
                          qdev_get_gpio_in(DEVICE(&s->gic),
                                           AW_H3_GIC_SPI_OHCI3));
 
     /* UART0. For future clocktree API: All UARTS are connected to

APB2_CLK. */

hw/arm/allwinner-h3.c +4 -5
-    serial_mm_init(get_system_memory(), s->memmap[AW_H3_UART0], 2,
+    serial_mm_init(get_system_memory(), s->memmap[AW_H3_DEV_UART0], 2,
                    qdev_get_gpio_in(DEVICE(&s->gic), AW_H3_GIC_SPI_UART0),
                    115200, serial_hd(0), DEVICE_NATIVE_ENDIAN);
     /* UART1 */
-    serial_mm_init(get_system_memory(), s->memmap[AW_H3_UART1], 2,
+    serial_mm_init(get_system_memory(), s->memmap[AW_H3_DEV_UART1], 2,
                    qdev_get_gpio_in(DEVICE(&s->gic), AW_H3_GIC_SPI_UART1),
                    115200, serial_hd(1), DEVICE_NATIVE_ENDIAN);
     /* UART2 */
-    serial_mm_init(get_system_memory(), s->memmap[AW_H3_UART2], 2,
+    serial_mm_init(get_system_memory(), s->memmap[AW_H3_DEV_UART2], 2,
                    qdev_get_gpio_in(DEVICE(&s->gic), AW_H3_GIC_SPI_UART2),
                    115200, serial_hd(2), DEVICE_NATIVE_ENDIAN);
     /* UART3 */
-    serial_mm_init(get_system_memory(), s->memmap[AW_H3_UART3], 2,
+    serial_mm_init(get_system_memory(), s->memmap[AW_H3_DEV_UART3], 2,
                    qdev_get_gpio_in(DEVICE(&s->gic), AW_H3_GIC_SPI_UART3),
                    115200, serial_hd(3), DEVICE_NATIVE_ENDIAN);
 
     /* DRAMC */
     sysbus_realize(SYS_BUS_DEVICE(&s->dramc), &error_fatal);
-    sysbus_mmio_map(SYS_BUS_DEVICE(&s->dramc), 0,

s->memmap[AW_H3_DRAMCOM]);
- sysbus_mmio_map(SYS_BUS_DEVICE(&s->dramc), 1,
s->memmap[AW_H3_DRAMCTL]);
- sysbus_mmio_map(SYS_BUS_DEVICE(&s->dramc), 2,
s->memmap[AW_H3_DRAMPHY]);
+ sysbus_mmio_map(SYS_BUS_DEVICE(&s->dramc), 0,
s->memmap[AW_H3_DEV_DRAMCOM]);
+ sysbus_mmio_map(SYS_BUS_DEVICE(&s->dramc), 1,
s->memmap[AW_H3_DEV_DRAMCTL]);
+ sysbus_mmio_map(SYS_BUS_DEVICE(&s->dramc), 2,
s->memmap[AW_H3_DEV_DRAMPHY]);

     /* RTC */
     sysbus_realize(SYS_BUS_DEVICE(&s->rtc), &error_fatal);
hw/arm/allwinner-h3.c +1 -1
-    sysbus_mmio_map(SYS_BUS_DEVICE(&s->rtc), 0, s->memmap[AW_H3_RTC]);
+    sysbus_mmio_map(SYS_BUS_DEVICE(&s->rtc), 0, s->memmap[AW_H3_DEV_RTC]);
 
     /* Unimplemented devices */
     for (i = 0; i < ARRAY_SIZE(unimplemented); i++) {
hw/arm/orangepi.c +1 -1
index 1679468232..17a568a2b4 100644
@@ -79,7 +79,7 @@ static void orangepi_init(MachineState *machine)
     object_property_set_int(OBJECT(&h3->emac), "phy-addr", 1,
 &error_abort);
 
     /* DRAMC */
-    object_property_set_uint(OBJECT(h3), "ram-addr",
 h3->memmap[AW_H3_SDRAM],
+    object_property_set_uint(OBJECT(h3), "ram-addr",
 h3->memmap[AW_H3_DEV_SDRAM],
                              &error_abort);
     object_property_set_int(OBJECT(h3), "ram-size", machine->ram_size /
MiB,
                             &error_abort);
hw/arm/orangepi.c +1 -1
@@ -98,7 +98,7 @@ static void orangepi_init(MachineState *machine)
     qdev_realize_and_unref(carddev, bus, &error_fatal);
 
     /* SDRAM */
-    memory_region_add_subregion(get_system_memory(),
 h3->memmap[AW_H3_SDRAM],
+    memory_region_add_subregion(get_system_memory(),
 h3->memmap[AW_H3_DEV_SDRAM],
                                 machine->ram);
     /* Load target kernel or start using BootROM */
hw/arm/orangepi.c +1 -2
@@ -106,7 +106,7 @@ static void orangepi_init(MachineState *machine)
         /* Use Boot ROM to copy data from SD card to SRAM */
         allwinner_h3_bootrom_setup(h3, blk);
     }
-    orangepi_binfo.loader_start = h3->memmap[AW_H3_SDRAM];
+    orangepi_binfo.loader_start = h3->memmap[AW_H3_DEV_SDRAM];
     orangepi_binfo.ram_size = machine->ram_size;
     arm_load_kernel(ARM_CPU(first_cpu), machine, &orangepi_binfo);
 }
--

2.26.2

Reviewed-by on v2 5/58
#9 lore raw

Re: [PATCH v2 05/58] allwinner-h3: Rename memmap enum constants

In reply to Eduardo Habkost
Quoted 19 lines · Eduardo Habkost

Some of the enum constant names conflict with the QOM type check macros (AW_H3_CCU, AW_H3_SYSCTRL). This needs to be addressed to allow us to transform the QOM type check macros into functions generated by OBJECT_DECLARE_TYPE().

Rename all the constants to AW_H3_DEV_*, to avoid conflicts.

---
Changes v1 -> v2:
* Added more details to commit message

---
Cc: Beniamino Galvani <[email protected]>
Cc: Peter Maydell <[email protected]>
Cc: Niek Linnenbank <[email protected]>
Cc: [email protected]
Cc: [email protected]

Quoted 5 lines
---
 include/hw/arm/allwinner-h3.h |  62 ++++++++---------
 hw/arm/allwinner-h3.c         | 124 +++++++++++++++++-----------------
 hw/arm/orangepi.c             |   6 +-
 3 files changed, 96 insertions(+), 96 deletions(-)

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#10 lore raw

PATCH v2 6/58 aspeed_soc: Rename memmap/irqmap enum constants

In reply to Eduardo Habkost

Some of the enum constant names conflict with the QOM type check macros:

ASPEED_GPIO
ASPEED_I2C
ASPEED_RTC
ASPEED_SCU
ASPEED_SDHCI
ASPEED_SDMC
ASPEED_VIC
ASPEED_WDT
ASPEED_XDMA

This needs to be addressed to allow us to transform the QOM type check macros into functions generated by OBJECT_DECLARE_TYPE().

Rename all the constants to ASPEED_DEV_*, to avoid conflicts.

---
Changes v1 -> v2:
* Added more details to commit message

---
Cc: "Cédric Le Goater" <[email protected]>
Cc: Peter Maydell <[email protected]>
Cc: Andrew Jeffery <[email protected]>
Cc: Joel Stanley <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 include/hw/arm/aspeed_soc.h |  92 +++++++--------
 hw/arm/aspeed.c             |   4 +-
 hw/arm/aspeed_ast2600.c     | 208 ++++++++++++++++----------------
 hw/arm/aspeed_soc.c         | 228 ++++++++++++++++++------------------
 4 files changed, 266 insertions(+), 266 deletions(-)
include/hw/arm/aspeed_soc.h +46 -46
index 914115f3ef..d46f197cbe 100644
@@ -87,52 +87,52 @@ typedef struct AspeedSoCClass {
     OBJECT_GET_CLASS(AspeedSoCClass, (obj), TYPE_ASPEED_SOC)
 
 enum {
-    ASPEED_IOMEM,
-    ASPEED_UART1,
-    ASPEED_UART2,
-    ASPEED_UART3,
-    ASPEED_UART4,
-    ASPEED_UART5,
-    ASPEED_VUART,
-    ASPEED_FMC,
-    ASPEED_SPI1,
-    ASPEED_SPI2,
-    ASPEED_EHCI1,
-    ASPEED_EHCI2,
-    ASPEED_VIC,
-    ASPEED_SDMC,
-    ASPEED_SCU,
-    ASPEED_ADC,
-    ASPEED_VIDEO,
-    ASPEED_SRAM,
-    ASPEED_SDHCI,
-    ASPEED_GPIO,
-    ASPEED_GPIO_1_8V,
-    ASPEED_RTC,
-    ASPEED_TIMER1,
-    ASPEED_TIMER2,
-    ASPEED_TIMER3,
-    ASPEED_TIMER4,
-    ASPEED_TIMER5,
-    ASPEED_TIMER6,
-    ASPEED_TIMER7,
-    ASPEED_TIMER8,
-    ASPEED_WDT,
-    ASPEED_PWM,
-    ASPEED_LPC,
-    ASPEED_IBT,
-    ASPEED_I2C,
-    ASPEED_ETH1,
-    ASPEED_ETH2,
-    ASPEED_ETH3,
-    ASPEED_ETH4,
-    ASPEED_MII1,
-    ASPEED_MII2,
-    ASPEED_MII3,
-    ASPEED_MII4,
-    ASPEED_SDRAM,
-    ASPEED_XDMA,
-    ASPEED_EMMC,
+    ASPEED_DEV_IOMEM,
+    ASPEED_DEV_UART1,
+    ASPEED_DEV_UART2,
+    ASPEED_DEV_UART3,
+    ASPEED_DEV_UART4,
+    ASPEED_DEV_UART5,
+    ASPEED_DEV_VUART,
+    ASPEED_DEV_FMC,
+    ASPEED_DEV_SPI1,
+    ASPEED_DEV_SPI2,
+    ASPEED_DEV_EHCI1,
+    ASPEED_DEV_EHCI2,
+    ASPEED_DEV_VIC,
+    ASPEED_DEV_SDMC,
+    ASPEED_DEV_SCU,
+    ASPEED_DEV_ADC,
+    ASPEED_DEV_VIDEO,
+    ASPEED_DEV_SRAM,
+    ASPEED_DEV_SDHCI,
+    ASPEED_DEV_GPIO,
+    ASPEED_DEV_GPIO_1_8V,
+    ASPEED_DEV_RTC,
+    ASPEED_DEV_TIMER1,
+    ASPEED_DEV_TIMER2,
+    ASPEED_DEV_TIMER3,
+    ASPEED_DEV_TIMER4,
+    ASPEED_DEV_TIMER5,
+    ASPEED_DEV_TIMER6,
+    ASPEED_DEV_TIMER7,
+    ASPEED_DEV_TIMER8,
+    ASPEED_DEV_WDT,
+    ASPEED_DEV_PWM,
+    ASPEED_DEV_LPC,
+    ASPEED_DEV_IBT,
+    ASPEED_DEV_I2C,
+    ASPEED_DEV_ETH1,
+    ASPEED_DEV_ETH2,
+    ASPEED_DEV_ETH3,
+    ASPEED_DEV_ETH4,
+    ASPEED_DEV_MII1,
+    ASPEED_DEV_MII2,
+    ASPEED_DEV_MII3,
+    ASPEED_DEV_MII4,
+    ASPEED_DEV_SDRAM,
+    ASPEED_DEV_XDMA,
+    ASPEED_DEV_EMMC,
 };
 
 #endif /* ASPEED_SOC_H */
hw/arm/aspeed.c +2 -2
index fcb1a7cd87..8109cc6d2d 100644
@@ -309,7 +309,7 @@ static void aspeed_machine_init(MachineState *machine)
     qdev_realize(DEVICE(&bmc->soc), NULL, &error_abort);
 
     memory_region_add_subregion(get_system_memory(),
-                                sc->memmap[ASPEED_SDRAM],
+                                sc->memmap[ASPEED_DEV_SDRAM],
                                 &bmc->ram_container);
 
     max_ram_size = object_property_get_uint(OBJECT(&bmc->soc), "max-ram-size",
@@ -360,7 +360,7 @@ static void aspeed_machine_init(MachineState *machine)
     }
 
     aspeed_board_binfo.ram_size = ram_size;
-    aspeed_board_binfo.loader_start = sc->memmap[ASPEED_SDRAM];
+    aspeed_board_binfo.loader_start = sc->memmap[ASPEED_DEV_SDRAM];
     aspeed_board_binfo.nb_cpus = sc->num_cpus;
 
     if (amc->i2c_init) {
hw/arm/aspeed_ast2600.c +104 -104

351 lines not on this page · raw message

hw/arm/aspeed_soc.c +114 -114

356 lines not on this page · raw message

Signature · 1 line
2.26.2
Reviewed-by on v2 6/58
#11 lore raw

Re: [PATCH v2 06/58] aspeed_soc: Rename memmap/irqmap enum constants

Quoted 13 lines · Eduardo Habkost

Some of the enum constant names conflict with the QOM type check macros:

ASPEED_GPIO
ASPEED_I2C
ASPEED_RTC
ASPEED_SCU
ASPEED_SDHCI
ASPEED_SDMC
ASPEED_VIC
ASPEED_WDT
ASPEED_XDMA

Quoted 6 lines

This needs to be addressed to allow us to transform the QOM type check macros into functions generated by OBJECT_DECLARE_TYPE().

Rename all the constants to ASPEED_DEV_*, to avoid conflicts.

Thanks,

C.

Quoted 883 lines

---
Changes v1 -> v2:
* Added more details to commit message

---
Cc: "Cédric Le Goater" <[email protected]>
Cc: Peter Maydell <[email protected]>
Cc: Andrew Jeffery <[email protected]>
Cc: Joel Stanley <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 include/hw/arm/aspeed_soc.h |  92 +++++++--------
 hw/arm/aspeed.c             |   4 +-
 hw/arm/aspeed_ast2600.c     | 208 ++++++++++++++++----------------
 hw/arm/aspeed_soc.c         | 228 ++++++++++++++++++------------------
 4 files changed, 266 insertions(+), 266 deletions(-)
include/hw/arm/aspeed_soc.h +46 -46
index 914115f3ef..d46f197cbe 100644
@@ -87,52 +87,52 @@ typedef struct AspeedSoCClass {
     OBJECT_GET_CLASS(AspeedSoCClass, (obj), TYPE_ASPEED_SOC)
 
 enum {
-    ASPEED_IOMEM,
-    ASPEED_UART1,
-    ASPEED_UART2,
-    ASPEED_UART3,
-    ASPEED_UART4,
-    ASPEED_UART5,
-    ASPEED_VUART,
-    ASPEED_FMC,
-    ASPEED_SPI1,
-    ASPEED_SPI2,
-    ASPEED_EHCI1,
-    ASPEED_EHCI2,
-    ASPEED_VIC,
-    ASPEED_SDMC,
-    ASPEED_SCU,
-    ASPEED_ADC,
-    ASPEED_VIDEO,
-    ASPEED_SRAM,
-    ASPEED_SDHCI,
-    ASPEED_GPIO,
-    ASPEED_GPIO_1_8V,
-    ASPEED_RTC,
-    ASPEED_TIMER1,
-    ASPEED_TIMER2,
-    ASPEED_TIMER3,
-    ASPEED_TIMER4,
-    ASPEED_TIMER5,
-    ASPEED_TIMER6,
-    ASPEED_TIMER7,
-    ASPEED_TIMER8,
-    ASPEED_WDT,
-    ASPEED_PWM,
-    ASPEED_LPC,
-    ASPEED_IBT,
-    ASPEED_I2C,
-    ASPEED_ETH1,
-    ASPEED_ETH2,
-    ASPEED_ETH3,
-    ASPEED_ETH4,
-    ASPEED_MII1,
-    ASPEED_MII2,
-    ASPEED_MII3,
-    ASPEED_MII4,
-    ASPEED_SDRAM,
-    ASPEED_XDMA,
-    ASPEED_EMMC,
+    ASPEED_DEV_IOMEM,
+    ASPEED_DEV_UART1,
+    ASPEED_DEV_UART2,
+    ASPEED_DEV_UART3,
+    ASPEED_DEV_UART4,
+    ASPEED_DEV_UART5,
+    ASPEED_DEV_VUART,
+    ASPEED_DEV_FMC,
+    ASPEED_DEV_SPI1,
+    ASPEED_DEV_SPI2,
+    ASPEED_DEV_EHCI1,
+    ASPEED_DEV_EHCI2,
+    ASPEED_DEV_VIC,
+    ASPEED_DEV_SDMC,
+    ASPEED_DEV_SCU,
+    ASPEED_DEV_ADC,
+    ASPEED_DEV_VIDEO,
+    ASPEED_DEV_SRAM,
+    ASPEED_DEV_SDHCI,
+    ASPEED_DEV_GPIO,
+    ASPEED_DEV_GPIO_1_8V,
+    ASPEED_DEV_RTC,
+    ASPEED_DEV_TIMER1,
+    ASPEED_DEV_TIMER2,
+    ASPEED_DEV_TIMER3,
+    ASPEED_DEV_TIMER4,
+    ASPEED_DEV_TIMER5,
+    ASPEED_DEV_TIMER6,
+    ASPEED_DEV_TIMER7,
+    ASPEED_DEV_TIMER8,
+    ASPEED_DEV_WDT,
+    ASPEED_DEV_PWM,
+    ASPEED_DEV_LPC,
+    ASPEED_DEV_IBT,
+    ASPEED_DEV_I2C,
+    ASPEED_DEV_ETH1,
+    ASPEED_DEV_ETH2,
+    ASPEED_DEV_ETH3,
+    ASPEED_DEV_ETH4,
+    ASPEED_DEV_MII1,
+    ASPEED_DEV_MII2,
+    ASPEED_DEV_MII3,
+    ASPEED_DEV_MII4,
+    ASPEED_DEV_SDRAM,
+    ASPEED_DEV_XDMA,
+    ASPEED_DEV_EMMC,
 };
 
 #endif /* ASPEED_SOC_H */
hw/arm/aspeed.c +2 -2
index fcb1a7cd87..8109cc6d2d 100644
@@ -309,7 +309,7 @@ static void aspeed_machine_init(MachineState *machine)
     qdev_realize(DEVICE(&bmc->soc), NULL, &error_abort);
 
     memory_region_add_subregion(get_system_memory(),
-                                sc->memmap[ASPEED_SDRAM],
+                                sc->memmap[ASPEED_DEV_SDRAM],
                                 &bmc->ram_container);
 
     max_ram_size = object_property_get_uint(OBJECT(&bmc->soc), "max-ram-size",
@@ -360,7 +360,7 @@ static void aspeed_machine_init(MachineState *machine)
     }
 
     aspeed_board_binfo.ram_size = ram_size;
-    aspeed_board_binfo.loader_start = sc->memmap[ASPEED_SDRAM];
+    aspeed_board_binfo.loader_start = sc->memmap[ASPEED_DEV_SDRAM];
     aspeed_board_binfo.nb_cpus = sc->num_cpus;
 
     if (amc->i2c_init) {
hw/arm/aspeed_ast2600.c +104 -104
index 3767f7d8d0..9d95e42143 100644
@@ -24,43 +24,43 @@
 #define ASPEED_SOC_IOMEM_SIZE       0x00200000
 
 static const hwaddr aspeed_soc_ast2600_memmap[] = {
-    [ASPEED_SRAM]      = 0x10000000,
+    [ASPEED_DEV_SRAM]      = 0x10000000,
     /* 0x16000000     0x17FFFFFF : AHB BUS do LPC Bus bridge */
-    [ASPEED_IOMEM]     = 0x1E600000,
-    [ASPEED_PWM]       = 0x1E610000,
-    [ASPEED_FMC]       = 0x1E620000,
-    [ASPEED_SPI1]      = 0x1E630000,
-    [ASPEED_SPI2]      = 0x1E641000,
-    [ASPEED_EHCI1]     = 0x1E6A1000,
-    [ASPEED_EHCI2]     = 0x1E6A3000,
-    [ASPEED_MII1]      = 0x1E650000,
-    [ASPEED_MII2]      = 0x1E650008,
-    [ASPEED_MII3]      = 0x1E650010,
-    [ASPEED_MII4]      = 0x1E650018,
-    [ASPEED_ETH1]      = 0x1E660000,
-    [ASPEED_ETH3]      = 0x1E670000,
-    [ASPEED_ETH2]      = 0x1E680000,
-    [ASPEED_ETH4]      = 0x1E690000,
-    [ASPEED_VIC]       = 0x1E6C0000,
-    [ASPEED_SDMC]      = 0x1E6E0000,
-    [ASPEED_SCU]       = 0x1E6E2000,
-    [ASPEED_XDMA]      = 0x1E6E7000,
-    [ASPEED_ADC]       = 0x1E6E9000,
-    [ASPEED_VIDEO]     = 0x1E700000,
-    [ASPEED_SDHCI]     = 0x1E740000,
-    [ASPEED_EMMC]      = 0x1E750000,
-    [ASPEED_GPIO]      = 0x1E780000,
-    [ASPEED_GPIO_1_8V] = 0x1E780800,
-    [ASPEED_RTC]       = 0x1E781000,
-    [ASPEED_TIMER1]    = 0x1E782000,
-    [ASPEED_WDT]       = 0x1E785000,
-    [ASPEED_LPC]       = 0x1E789000,
-    [ASPEED_IBT]       = 0x1E789140,
-    [ASPEED_I2C]       = 0x1E78A000,
-    [ASPEED_UART1]     = 0x1E783000,
-    [ASPEED_UART5]     = 0x1E784000,
-    [ASPEED_VUART]     = 0x1E787000,
-    [ASPEED_SDRAM]     = 0x80000000,
+    [ASPEED_DEV_IOMEM]     = 0x1E600000,
+    [ASPEED_DEV_PWM]       = 0x1E610000,
+    [ASPEED_DEV_FMC]       = 0x1E620000,
+    [ASPEED_DEV_SPI1]      = 0x1E630000,
+    [ASPEED_DEV_SPI2]      = 0x1E641000,
+    [ASPEED_DEV_EHCI1]     = 0x1E6A1000,
+    [ASPEED_DEV_EHCI2]     = 0x1E6A3000,
+    [ASPEED_DEV_MII1]      = 0x1E650000,
+    [ASPEED_DEV_MII2]      = 0x1E650008,
+    [ASPEED_DEV_MII3]      = 0x1E650010,
+    [ASPEED_DEV_MII4]      = 0x1E650018,
+    [ASPEED_DEV_ETH1]      = 0x1E660000,
+    [ASPEED_DEV_ETH3]      = 0x1E670000,
+    [ASPEED_DEV_ETH2]      = 0x1E680000,
+    [ASPEED_DEV_ETH4]      = 0x1E690000,
+    [ASPEED_DEV_VIC]       = 0x1E6C0000,
+    [ASPEED_DEV_SDMC]      = 0x1E6E0000,
+    [ASPEED_DEV_SCU]       = 0x1E6E2000,
+    [ASPEED_DEV_XDMA]      = 0x1E6E7000,
+    [ASPEED_DEV_ADC]       = 0x1E6E9000,
+    [ASPEED_DEV_VIDEO]     = 0x1E700000,
+    [ASPEED_DEV_SDHCI]     = 0x1E740000,
+    [ASPEED_DEV_EMMC]      = 0x1E750000,
+    [ASPEED_DEV_GPIO]      = 0x1E780000,
+    [ASPEED_DEV_GPIO_1_8V] = 0x1E780800,
+    [ASPEED_DEV_RTC]       = 0x1E781000,
+    [ASPEED_DEV_TIMER1]    = 0x1E782000,
+    [ASPEED_DEV_WDT]       = 0x1E785000,
+    [ASPEED_DEV_LPC]       = 0x1E789000,
+    [ASPEED_DEV_IBT]       = 0x1E789140,
+    [ASPEED_DEV_I2C]       = 0x1E78A000,
+    [ASPEED_DEV_UART1]     = 0x1E783000,
+    [ASPEED_DEV_UART5]     = 0x1E784000,
+    [ASPEED_DEV_VUART]     = 0x1E787000,
+    [ASPEED_DEV_SDRAM]     = 0x80000000,
 };
 
 #define ASPEED_A7MPCORE_ADDR 0x40460000
@@ -69,41 +69,41 @@ static const hwaddr aspeed_soc_ast2600_memmap[] = {
 
 /* Shared Peripheral Interrupt values below are offset by -32 from datasheet */
 static const int aspeed_soc_ast2600_irqmap[] = {
-    [ASPEED_UART1]     = 47,
-    [ASPEED_UART2]     = 48,
-    [ASPEED_UART3]     = 49,
-    [ASPEED_UART4]     = 50,
-    [ASPEED_UART5]     = 8,
-    [ASPEED_VUART]     = 8,
-    [ASPEED_FMC]       = 39,
-    [ASPEED_SDMC]      = 0,
-    [ASPEED_SCU]       = 12,
-    [ASPEED_ADC]       = 78,
-    [ASPEED_XDMA]      = 6,
-    [ASPEED_SDHCI]     = 43,
-    [ASPEED_EHCI1]     = 5,
-    [ASPEED_EHCI2]     = 9,
-    [ASPEED_EMMC]      = 15,
-    [ASPEED_GPIO]      = 40,
-    [ASPEED_GPIO_1_8V] = 11,
-    [ASPEED_RTC]       = 13,
-    [ASPEED_TIMER1]    = 16,
-    [ASPEED_TIMER2]    = 17,
-    [ASPEED_TIMER3]    = 18,
-    [ASPEED_TIMER4]    = 19,
-    [ASPEED_TIMER5]    = 20,
-    [ASPEED_TIMER6]    = 21,
-    [ASPEED_TIMER7]    = 22,
-    [ASPEED_TIMER8]    = 23,
-    [ASPEED_WDT]       = 24,
-    [ASPEED_PWM]       = 44,
-    [ASPEED_LPC]       = 35,
-    [ASPEED_IBT]       = 35,    /* LPC */
-    [ASPEED_I2C]       = 110,   /* 110 -> 125 */
-    [ASPEED_ETH1]      = 2,
-    [ASPEED_ETH2]      = 3,
-    [ASPEED_ETH3]      = 32,
-    [ASPEED_ETH4]      = 33,
+    [ASPEED_DEV_UART1]     = 47,
+    [ASPEED_DEV_UART2]     = 48,
+    [ASPEED_DEV_UART3]     = 49,
+    [ASPEED_DEV_UART4]     = 50,
+    [ASPEED_DEV_UART5]     = 8,
+    [ASPEED_DEV_VUART]     = 8,
+    [ASPEED_DEV_FMC]       = 39,
+    [ASPEED_DEV_SDMC]      = 0,
+    [ASPEED_DEV_SCU]       = 12,
+    [ASPEED_DEV_ADC]       = 78,
+    [ASPEED_DEV_XDMA]      = 6,
+    [ASPEED_DEV_SDHCI]     = 43,
+    [ASPEED_DEV_EHCI1]     = 5,
+    [ASPEED_DEV_EHCI2]     = 9,
+    [ASPEED_DEV_EMMC]      = 15,
+    [ASPEED_DEV_GPIO]      = 40,
+    [ASPEED_DEV_GPIO_1_8V] = 11,
+    [ASPEED_DEV_RTC]       = 13,
+    [ASPEED_DEV_TIMER1]    = 16,
+    [ASPEED_DEV_TIMER2]    = 17,
+    [ASPEED_DEV_TIMER3]    = 18,
+    [ASPEED_DEV_TIMER4]    = 19,
+    [ASPEED_DEV_TIMER5]    = 20,
+    [ASPEED_DEV_TIMER6]    = 21,
+    [ASPEED_DEV_TIMER7]    = 22,
+    [ASPEED_DEV_TIMER8]    = 23,
+    [ASPEED_DEV_WDT]       = 24,
+    [ASPEED_DEV_PWM]       = 44,
+    [ASPEED_DEV_LPC]       = 35,
+    [ASPEED_DEV_IBT]       = 35,    /* LPC */
+    [ASPEED_DEV_I2C]       = 110,   /* 110 -> 125 */
+    [ASPEED_DEV_ETH1]      = 2,
+    [ASPEED_DEV_ETH2]      = 3,
+    [ASPEED_DEV_ETH3]      = 32,
+    [ASPEED_DEV_ETH4]      = 33,
 
 };
 
@@ -232,11 +232,11 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)
     qemu_irq irq;
 
     /* IO space */
-    create_unimplemented_device("aspeed_soc.io", sc->memmap[ASPEED_IOMEM],
+    create_unimplemented_device("aspeed_soc.io", sc->memmap[ASPEED_DEV_IOMEM],
                                 ASPEED_SOC_IOMEM_SIZE);
 
     /* Video engine stub */
-    create_unimplemented_device("aspeed.video", sc->memmap[ASPEED_VIDEO],
+    create_unimplemented_device("aspeed.video", sc->memmap[ASPEED_DEV_VIDEO],
                                 0x1000);
 
     /* CPU */
@@ -295,21 +295,21 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)
         return;
     }
     memory_region_add_subregion(get_system_memory(),
-                                sc->memmap[ASPEED_SRAM], &s->sram);
+                                sc->memmap[ASPEED_DEV_SRAM], &s->sram);
 
     /* SCU */
     if (!sysbus_realize(SYS_BUS_DEVICE(&s->scu), errp)) {
         return;
     }
-    sysbus_mmio_map(SYS_BUS_DEVICE(&s->scu), 0, sc->memmap[ASPEED_SCU]);
+    sysbus_mmio_map(SYS_BUS_DEVICE(&s->scu), 0, sc->memmap[ASPEED_DEV_SCU]);
 
     /* RTC */
     if (!sysbus_realize(SYS_BUS_DEVICE(&s->rtc), errp)) {
         return;
     }
-    sysbus_mmio_map(SYS_BUS_DEVICE(&s->rtc), 0, sc->memmap[ASPEED_RTC]);
+    sysbus_mmio_map(SYS_BUS_DEVICE(&s->rtc), 0, sc->memmap[ASPEED_DEV_RTC]);
     sysbus_connect_irq(SYS_BUS_DEVICE(&s->rtc), 0,
-                       aspeed_soc_get_irq(s, ASPEED_RTC));
+                       aspeed_soc_get_irq(s, ASPEED_DEV_RTC));
 
     /* Timer */
     object_property_set_link(OBJECT(&s->timerctrl), "scu", OBJECT(&s->scu),
@@ -318,16 +318,16 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)
         return;
     }
     sysbus_mmio_map(SYS_BUS_DEVICE(&s->timerctrl), 0,
-                    sc->memmap[ASPEED_TIMER1]);
+                    sc->memmap[ASPEED_DEV_TIMER1]);
     for (i = 0; i < ASPEED_TIMER_NR_TIMERS; i++) {
-        qemu_irq irq = aspeed_soc_get_irq(s, ASPEED_TIMER1 + i);
+        qemu_irq irq = aspeed_soc_get_irq(s, ASPEED_DEV_TIMER1 + i);
         sysbus_connect_irq(SYS_BUS_DEVICE(&s->timerctrl), i, irq);
     }
 
     /* UART - attach an 8250 to the IO space as our UART5 */
     if (serial_hd(0)) {
-        qemu_irq uart5 = aspeed_soc_get_irq(s, ASPEED_UART5);
-        serial_mm_init(get_system_memory(), sc->memmap[ASPEED_UART5], 2,
+        qemu_irq uart5 = aspeed_soc_get_irq(s, ASPEED_DEV_UART5);
+        serial_mm_init(get_system_memory(), sc->memmap[ASPEED_DEV_UART5], 2,
                        uart5, 38400, serial_hd(0), DEVICE_LITTLE_ENDIAN);
     }
 
@@ -337,10 +337,10 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)
     if (!sysbus_realize(SYS_BUS_DEVICE(&s->i2c), errp)) {
         return;
     }
-    sysbus_mmio_map(SYS_BUS_DEVICE(&s->i2c), 0, sc->memmap[ASPEED_I2C]);
+    sysbus_mmio_map(SYS_BUS_DEVICE(&s->i2c), 0, sc->memmap[ASPEED_DEV_I2C]);
     for (i = 0; i < ASPEED_I2C_GET_CLASS(&s->i2c)->num_busses; i++) {
         qemu_irq irq = qdev_get_gpio_in(DEVICE(&s->a7mpcore),
-                                        sc->irqmap[ASPEED_I2C] + i);
+                                        sc->irqmap[ASPEED_DEV_I2C] + i);
         /*
          * The AST2600 SoC has one IRQ per I2C bus. Skip the common
          * IRQ (AST2400 and AST2500) and connect all bussses.
@@ -352,17 +352,17 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)
     object_property_set_link(OBJECT(&s->fmc), "dram", OBJECT(s->dram_mr),
                              &error_abort);
     if (!object_property_set_int(OBJECT(&s->fmc), "sdram-base",
-                                 sc->memmap[ASPEED_SDRAM], errp)) {
+                                 sc->memmap[ASPEED_DEV_SDRAM], errp)) {
         return;
     }
     if (!sysbus_realize(SYS_BUS_DEVICE(&s->fmc), errp)) {
         return;
     }
-    sysbus_mmio_map(SYS_BUS_DEVICE(&s->fmc), 0, sc->memmap[ASPEED_FMC]);
+    sysbus_mmio_map(SYS_BUS_DEVICE(&s->fmc), 0, sc->memmap[ASPEED_DEV_FMC]);
     sysbus_mmio_map(SYS_BUS_DEVICE(&s->fmc), 1,
                     s->fmc.ctrl->flash_window_base);
     sysbus_connect_irq(SYS_BUS_DEVICE(&s->fmc), 0,
-                       aspeed_soc_get_irq(s, ASPEED_FMC));
+                       aspeed_soc_get_irq(s, ASPEED_DEV_FMC));
 
     /* SPI */
     for (i = 0; i < sc->spis_num; i++) {
@@ -373,7 +373,7 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)
             return;
         }
         sysbus_mmio_map(SYS_BUS_DEVICE(&s->spi[i]), 0,
-                        sc->memmap[ASPEED_SPI1 + i]);
+                        sc->memmap[ASPEED_DEV_SPI1 + i]);
         sysbus_mmio_map(SYS_BUS_DEVICE(&s->spi[i]), 1,
                         s->spi[i].ctrl->flash_window_base);
     }
@@ -384,16 +384,16 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)
             return;
         }
         sysbus_mmio_map(SYS_BUS_DEVICE(&s->ehci[i]), 0,
-                        sc->memmap[ASPEED_EHCI1 + i]);
+                        sc->memmap[ASPEED_DEV_EHCI1 + i]);
         sysbus_connect_irq(SYS_BUS_DEVICE(&s->ehci[i]), 0,
-                           aspeed_soc_get_irq(s, ASPEED_EHCI1 + i));
+                           aspeed_soc_get_irq(s, ASPEED_DEV_EHCI1 + i));
     }
 
     /* SDMC - SDRAM Memory Controller */
     if (!sysbus_realize(SYS_BUS_DEVICE(&s->sdmc), errp)) {
         return;
     }
-    sysbus_mmio_map(SYS_BUS_DEVICE(&s->sdmc), 0, sc->memmap[ASPEED_SDMC]);
+    sysbus_mmio_map(SYS_BUS_DEVICE(&s->sdmc), 0, sc->memmap[ASPEED_DEV_SDMC]);
 
     /* Watch dog */
     for (i = 0; i < sc->wdts_num; i++) {
@@ -405,7 +405,7 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)
             return;
         }
         sysbus_mmio_map(SYS_BUS_DEVICE(&s->wdt[i]), 0,
-                        sc->memmap[ASPEED_WDT] + i * awc->offset);
+                        sc->memmap[ASPEED_DEV_WDT] + i * awc->offset);
     }
 
     /* Net */
@@ -416,9 +416,9 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)
             return;
         }
         sysbus_mmio_map(SYS_BUS_DEVICE(&s->ftgmac100[i]), 0,
-                        sc->memmap[ASPEED_ETH1 + i]);
+                        sc->memmap[ASPEED_DEV_ETH1 + i]);
         sysbus_connect_irq(SYS_BUS_DEVICE(&s->ftgmac100[i]), 0,
-                           aspeed_soc_get_irq(s, ASPEED_ETH1 + i));
+                           aspeed_soc_get_irq(s, ASPEED_DEV_ETH1 + i));
 
         object_property_set_link(OBJECT(&s->mii[i]), "nic",
                                  OBJECT(&s->ftgmac100[i]), &error_abort);
@@ -427,7 +427,7 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)
         }
 
         sysbus_mmio_map(SYS_BUS_DEVICE(&s->mii[i]), 0,
-                        sc->memmap[ASPEED_MII1 + i]);
+                        sc->memmap[ASPEED_DEV_MII1 + i]);
     }
 
     /* XDMA */
@@ -435,42 +435,42 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)
         return;
     }
     sysbus_mmio_map(SYS_BUS_DEVICE(&s->xdma), 0,
-                    sc->memmap[ASPEED_XDMA]);
+                    sc->memmap[ASPEED_DEV_XDMA]);
     sysbus_connect_irq(SYS_BUS_DEVICE(&s->xdma), 0,
-                       aspeed_soc_get_irq(s, ASPEED_XDMA));
+                       aspeed_soc_get_irq(s, ASPEED_DEV_XDMA));
 
     /* GPIO */
     if (!sysbus_realize(SYS_BUS_DEVICE(&s->gpio), errp)) {
         return;
     }
-    sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpio), 0, sc->memmap[ASPEED_GPIO]);
+    sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpio), 0, sc->memmap[ASPEED_DEV_GPIO]);
     sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpio), 0,
-                       aspeed_soc_get_irq(s, ASPEED_GPIO));
+                       aspeed_soc_get_irq(s, ASPEED_DEV_GPIO));
 
     if (!sysbus_realize(SYS_BUS_DEVICE(&s->gpio_1_8v), errp)) {
         return;
     }
     sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpio_1_8v), 0,
-                    sc->memmap[ASPEED_GPIO_1_8V]);
+                    sc->memmap[ASPEED_DEV_GPIO_1_8V]);
     sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpio_1_8v), 0,
-                       aspeed_soc_get_irq(s, ASPEED_GPIO_1_8V));
+                       aspeed_soc_get_irq(s, ASPEED_DEV_GPIO_1_8V));
 
     /* SDHCI */
     if (!sysbus_realize(SYS_BUS_DEVICE(&s->sdhci), errp)) {
         return;
     }
     sysbus_mmio_map(SYS_BUS_DEVICE(&s->sdhci), 0,
-                    sc->memmap[ASPEED_SDHCI]);
+                    sc->memmap[ASPEED_DEV_SDHCI]);
     sysbus_connect_irq(SYS_BUS_DEVICE(&s->sdhci), 0,
-                       aspeed_soc_get_irq(s, ASPEED_SDHCI));
+                       aspeed_soc_get_irq(s, ASPEED_DEV_SDHCI));
 
     /* eMMC */
     if (!sysbus_realize(SYS_BUS_DEVICE(&s->emmc), errp)) {
         return;
     }
-    sysbus_mmio_map(SYS_BUS_DEVICE(&s->emmc), 0, sc->memmap[ASPEED_EMMC]);
+    sysbus_mmio_map(SYS_BUS_DEVICE(&s->emmc), 0, sc->memmap[ASPEED_DEV_EMMC]);
     sysbus_connect_irq(SYS_BUS_DEVICE(&s->emmc), 0,
-                       aspeed_soc_get_irq(s, ASPEED_EMMC));
+                       aspeed_soc_get_irq(s, ASPEED_DEV_EMMC));
 }
 
 static void aspeed_soc_ast2600_class_init(ObjectClass *oc, void *data)
hw/arm/aspeed_soc.c +114 -114
index a1a8684216..35be126db6 100644
@@ -27,97 +27,97 @@
 #define ASPEED_SOC_IOMEM_SIZE       0x00200000
 
 static const hwaddr aspeed_soc_ast2400_memmap[] = {
-    [ASPEED_IOMEM]  = 0x1E600000,
-    [ASPEED_FMC]    = 0x1E620000,
-    [ASPEED_SPI1]   = 0x1E630000,
-    [ASPEED_EHCI1]  = 0x1E6A1000,
-    [ASPEED_VIC]    = 0x1E6C0000,
-    [ASPEED_SDMC]   = 0x1E6E0000,
-    [ASPEED_SCU]    = 0x1E6E2000,
-    [ASPEED_XDMA]   = 0x1E6E7000,
-    [ASPEED_VIDEO]  = 0x1E700000,
-    [ASPEED_ADC]    = 0x1E6E9000,
-    [ASPEED_SRAM]   = 0x1E720000,
-    [ASPEED_SDHCI]  = 0x1E740000,
-    [ASPEED_GPIO]   = 0x1E780000,
-    [ASPEED_RTC]    = 0x1E781000,
-    [ASPEED_TIMER1] = 0x1E782000,
-    [ASPEED_WDT]    = 0x1E785000,
-    [ASPEED_PWM]    = 0x1E786000,
-    [ASPEED_LPC]    = 0x1E789000,
-    [ASPEED_IBT]    = 0x1E789140,
-    [ASPEED_I2C]    = 0x1E78A000,
-    [ASPEED_ETH1]   = 0x1E660000,
-    [ASPEED_ETH2]   = 0x1E680000,
-    [ASPEED_UART1]  = 0x1E783000,
-    [ASPEED_UART5]  = 0x1E784000,
-    [ASPEED_VUART]  = 0x1E787000,
-    [ASPEED_SDRAM]  = 0x40000000,
+    [ASPEED_DEV_IOMEM]  = 0x1E600000,
+    [ASPEED_DEV_FMC]    = 0x1E620000,
+    [ASPEED_DEV_SPI1]   = 0x1E630000,
+    [ASPEED_DEV_EHCI1]  = 0x1E6A1000,
+    [ASPEED_DEV_VIC]    = 0x1E6C0000,
+    [ASPEED_DEV_SDMC]   = 0x1E6E0000,
+    [ASPEED_DEV_SCU]    = 0x1E6E2000,
+    [ASPEED_DEV_XDMA]   = 0x1E6E7000,
+    [ASPEED_DEV_VIDEO]  = 0x1E700000,
+    [ASPEED_DEV_ADC]    = 0x1E6E9000,
+    [ASPEED_DEV_SRAM]   = 0x1E720000,
+    [ASPEED_DEV_SDHCI]  = 0x1E740000,
+    [ASPEED_DEV_GPIO]   = 0x1E780000,
+    [ASPEED_DEV_RTC]    = 0x1E781000,
+    [ASPEED_DEV_TIMER1] = 0x1E782000,
+    [ASPEED_DEV_WDT]    = 0x1E785000,
+    [ASPEED_DEV_PWM]    = 0x1E786000,
+    [ASPEED_DEV_LPC]    = 0x1E789000,
+    [ASPEED_DEV_IBT]    = 0x1E789140,
+    [ASPEED_DEV_I2C]    = 0x1E78A000,
+    [ASPEED_DEV_ETH1]   = 0x1E660000,
+    [ASPEED_DEV_ETH2]   = 0x1E680000,
+    [ASPEED_DEV_UART1]  = 0x1E783000,
+    [ASPEED_DEV_UART5]  = 0x1E784000,
+    [ASPEED_DEV_VUART]  = 0x1E787000,
+    [ASPEED_DEV_SDRAM]  = 0x40000000,
 };
 
 static const hwaddr aspeed_soc_ast2500_memmap[] = {
-    [ASPEED_IOMEM]  = 0x1E600000,
-    [ASPEED_FMC]    = 0x1E620000,
-    [ASPEED_SPI1]   = 0x1E630000,
-    [ASPEED_SPI2]   = 0x1E631000,
-    [ASPEED_EHCI1]  = 0x1E6A1000,
-    [ASPEED_EHCI2]  = 0x1E6A3000,
-    [ASPEED_VIC]    = 0x1E6C0000,
-    [ASPEED_SDMC]   = 0x1E6E0000,
-    [ASPEED_SCU]    = 0x1E6E2000,
-    [ASPEED_XDMA]   = 0x1E6E7000,
-    [ASPEED_ADC]    = 0x1E6E9000,
-    [ASPEED_VIDEO]  = 0x1E700000,
-    [ASPEED_SRAM]   = 0x1E720000,
-    [ASPEED_SDHCI]  = 0x1E740000,
-    [ASPEED_GPIO]   = 0x1E780000,
-    [ASPEED_RTC]    = 0x1E781000,
-    [ASPEED_TIMER1] = 0x1E782000,
-    [ASPEED_WDT]    = 0x1E785000,
-    [ASPEED_PWM]    = 0x1E786000,
-    [ASPEED_LPC]    = 0x1E789000,
-    [ASPEED_IBT]    = 0x1E789140,
-    [ASPEED_I2C]    = 0x1E78A000,
-    [ASPEED_ETH1]   = 0x1E660000,
-    [ASPEED_ETH2]   = 0x1E680000,
-    [ASPEED_UART1]  = 0x1E783000,
-    [ASPEED_UART5]  = 0x1E784000,
-    [ASPEED_VUART]  = 0x1E787000,
-    [ASPEED_SDRAM]  = 0x80000000,
+    [ASPEED_DEV_IOMEM]  = 0x1E600000,
+    [ASPEED_DEV_FMC]    = 0x1E620000,
+    [ASPEED_DEV_SPI1]   = 0x1E630000,
+    [ASPEED_DEV_SPI2]   = 0x1E631000,
+    [ASPEED_DEV_EHCI1]  = 0x1E6A1000,
+    [ASPEED_DEV_EHCI2]  = 0x1E6A3000,
+    [ASPEED_DEV_VIC]    = 0x1E6C0000,
+    [ASPEED_DEV_SDMC]   = 0x1E6E0000,
+    [ASPEED_DEV_SCU]    = 0x1E6E2000,
+    [ASPEED_DEV_XDMA]   = 0x1E6E7000,
+    [ASPEED_DEV_ADC]    = 0x1E6E9000,
+    [ASPEED_DEV_VIDEO]  = 0x1E700000,
+    [ASPEED_DEV_SRAM]   = 0x1E720000,
+    [ASPEED_DEV_SDHCI]  = 0x1E740000,
+    [ASPEED_DEV_GPIO]   = 0x1E780000,
+    [ASPEED_DEV_RTC]    = 0x1E781000,
+    [ASPEED_DEV_TIMER1] = 0x1E782000,
+    [ASPEED_DEV_WDT]    = 0x1E785000,
+    [ASPEED_DEV_PWM]    = 0x1E786000,
+    [ASPEED_DEV_LPC]    = 0x1E789000,
+    [ASPEED_DEV_IBT]    = 0x1E789140,
+    [ASPEED_DEV_I2C]    = 0x1E78A000,
+    [ASPEED_DEV_ETH1]   = 0x1E660000,
+    [ASPEED_DEV_ETH2]   = 0x1E680000,
+    [ASPEED_DEV_UART1]  = 0x1E783000,
+    [ASPEED_DEV_UART5]  = 0x1E784000,
+    [ASPEED_DEV_VUART]  = 0x1E787000,
+    [ASPEED_DEV_SDRAM]  = 0x80000000,
 };
 
 static const int aspeed_soc_ast2400_irqmap[] = {
-    [ASPEED_UART1]  = 9,
-    [ASPEED_UART2]  = 32,
-    [ASPEED_UART3]  = 33,
-    [ASPEED_UART4]  = 34,
-    [ASPEED_UART5]  = 10,
-    [ASPEED_VUART]  = 8,
-    [ASPEED_FMC]    = 19,
-    [ASPEED_EHCI1]  = 5,
-    [ASPEED_EHCI2]  = 13,
-    [ASPEED_SDMC]   = 0,
-    [ASPEED_SCU]    = 21,
-    [ASPEED_ADC]    = 31,
-    [ASPEED_GPIO]   = 20,
-    [ASPEED_RTC]    = 22,
-    [ASPEED_TIMER1] = 16,
-    [ASPEED_TIMER2] = 17,
-    [ASPEED_TIMER3] = 18,
-    [ASPEED_TIMER4] = 35,
-    [ASPEED_TIMER5] = 36,
-    [ASPEED_TIMER6] = 37,
-    [ASPEED_TIMER7] = 38,
-    [ASPEED_TIMER8] = 39,
-    [ASPEED_WDT]    = 27,
-    [ASPEED_PWM]    = 28,
-    [ASPEED_LPC]    = 8,
-    [ASPEED_IBT]    = 8, /* LPC */
-    [ASPEED_I2C]    = 12,
-    [ASPEED_ETH1]   = 2,
-    [ASPEED_ETH2]   = 3,
-    [ASPEED_XDMA]   = 6,
-    [ASPEED_SDHCI]  = 26,
+    [ASPEED_DEV_UART1]  = 9,
+    [ASPEED_DEV_UART2]  = 32,
+    [ASPEED_DEV_UART3]  = 33,
+    [ASPEED_DEV_UART4]  = 34,
+    [ASPEED_DEV_UART5]  = 10,
+    [ASPEED_DEV_VUART]  = 8,
+    [ASPEED_DEV_FMC]    = 19,
+    [ASPEED_DEV_EHCI1]  = 5,
+    [ASPEED_DEV_EHCI2]  = 13,
+    [ASPEED_DEV_SDMC]   = 0,
+    [ASPEED_DEV_SCU]    = 21,
+    [ASPEED_DEV_ADC]    = 31,
+    [ASPEED_DEV_GPIO]   = 20,
+    [ASPEED_DEV_RTC]    = 22,
+    [ASPEED_DEV_TIMER1] = 16,
+    [ASPEED_DEV_TIMER2] = 17,
+    [ASPEED_DEV_TIMER3] = 18,
+    [ASPEED_DEV_TIMER4] = 35,
+    [ASPEED_DEV_TIMER5] = 36,
+    [ASPEED_DEV_TIMER6] = 37,
+    [ASPEED_DEV_TIMER7] = 38,
+    [ASPEED_DEV_TIMER8] = 39,
+    [ASPEED_DEV_WDT]    = 27,
+    [ASPEED_DEV_PWM]    = 28,
+    [ASPEED_DEV_LPC]    = 8,
+    [ASPEED_DEV_IBT]    = 8, /* LPC */
+    [ASPEED_DEV_I2C]    = 12,
+    [ASPEED_DEV_ETH1]   = 2,
+    [ASPEED_DEV_ETH2]   = 3,
+    [ASPEED_DEV_XDMA]   = 6,
+    [ASPEED_DEV_SDHCI]  = 26,
 };
 
 #define aspeed_soc_ast2500_irqmap aspeed_soc_ast2400_irqmap
@@ -221,11 +221,11 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
     Error *err = NULL;
 
     /* IO space */
-    create_unimplemented_device("aspeed_soc.io", sc->memmap[ASPEED_IOMEM],
+    create_unimplemented_device("aspeed_soc.io", sc->memmap[ASPEED_DEV_IOMEM],
                                 ASPEED_SOC_IOMEM_SIZE);
 
     /* Video engine stub */
-    create_unimplemented_device("aspeed.video", sc->memmap[ASPEED_VIDEO],
+    create_unimplemented_device("aspeed.video", sc->memmap[ASPEED_DEV_VIDEO],
                                 0x1000);
 
     /* CPU */
@@ -243,19 +243,19 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
         return;
     }
     memory_region_add_subregion(get_system_memory(),
-                                sc->memmap[ASPEED_SRAM], &s->sram);
+                                sc->memmap[ASPEED_DEV_SRAM], &s->sram);
 
     /* SCU */
     if (!sysbus_realize(SYS_BUS_DEVICE(&s->scu), errp)) {
         return;
     }
-    sysbus_mmio_map(SYS_BUS_DEVICE(&s->scu), 0, sc->memmap[ASPEED_SCU]);
+    sysbus_mmio_map(SYS_BUS_DEVICE(&s->scu), 0, sc->memmap[ASPEED_DEV_SCU]);
 
     /* VIC */
     if (!sysbus_realize(SYS_BUS_DEVICE(&s->vic), errp)) {
         return;
     }
-    sysbus_mmio_map(SYS_BUS_DEVICE(&s->vic), 0, sc->memmap[ASPEED_VIC]);
+    sysbus_mmio_map(SYS_BUS_DEVICE(&s->vic), 0, sc->memmap[ASPEED_DEV_VIC]);
     sysbus_connect_irq(SYS_BUS_DEVICE(&s->vic), 0,
                        qdev_get_gpio_in(DEVICE(&s->cpu), ARM_CPU_IRQ));
     sysbus_connect_irq(SYS_BUS_DEVICE(&s->vic), 1,
@@ -265,9 +265,9 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
     if (!sysbus_realize(SYS_BUS_DEVICE(&s->rtc), errp)) {
         return;
     }
-    sysbus_mmio_map(SYS_BUS_DEVICE(&s->rtc), 0, sc->memmap[ASPEED_RTC]);
+    sysbus_mmio_map(SYS_BUS_DEVICE(&s->rtc), 0, sc->memmap[ASPEED_DEV_RTC]);
     sysbus_connect_irq(SYS_BUS_DEVICE(&s->rtc), 0,
-                       aspeed_soc_get_irq(s, ASPEED_RTC));
+                       aspeed_soc_get_irq(s, ASPEED_DEV_RTC));
 
     /* Timer */
     object_property_set_link(OBJECT(&s->timerctrl), "scu", OBJECT(&s->scu),
@@ -276,16 +276,16 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
         return;
     }
     sysbus_mmio_map(SYS_BUS_DEVICE(&s->timerctrl), 0,
-                    sc->memmap[ASPEED_TIMER1]);
+                    sc->memmap[ASPEED_DEV_TIMER1]);
     for (i = 0; i < ASPEED_TIMER_NR_TIMERS; i++) {
-        qemu_irq irq = aspeed_soc_get_irq(s, ASPEED_TIMER1 + i);
+        qemu_irq irq = aspeed_soc_get_irq(s, ASPEED_DEV_TIMER1 + i);
         sysbus_connect_irq(SYS_BUS_DEVICE(&s->timerctrl), i, irq);
     }
 
     /* UART - attach an 8250 to the IO space as our UART5 */
     if (serial_hd(0)) {
-        qemu_irq uart5 = aspeed_soc_get_irq(s, ASPEED_UART5);
-        serial_mm_init(get_system_memory(), sc->memmap[ASPEED_UART5], 2,
+        qemu_irq uart5 = aspeed_soc_get_irq(s, ASPEED_DEV_UART5);
+        serial_mm_init(get_system_memory(), sc->memmap[ASPEED_DEV_UART5], 2,
                        uart5, 38400, serial_hd(0), DEVICE_LITTLE_ENDIAN);
     }
 
@@ -295,25 +295,25 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
     if (!sysbus_realize(SYS_BUS_DEVICE(&s->i2c), errp)) {
         return;
     }
-    sysbus_mmio_map(SYS_BUS_DEVICE(&s->i2c), 0, sc->memmap[ASPEED_I2C]);
+    sysbus_mmio_map(SYS_BUS_DEVICE(&s->i2c), 0, sc->memmap[ASPEED_DEV_I2C]);
     sysbus_connect_irq(SYS_BUS_DEVICE(&s->i2c), 0,
-                       aspeed_soc_get_irq(s, ASPEED_I2C));
+                       aspeed_soc_get_irq(s, ASPEED_DEV_I2C));
 
     /* FMC, The number of CS is set at the board level */
     object_property_set_link(OBJECT(&s->fmc), "dram", OBJECT(s->dram_mr),
                              &error_abort);
     if (!object_property_set_int(OBJECT(&s->fmc), "sdram-base",
-                                 sc->memmap[ASPEED_SDRAM], errp)) {
+                                 sc->memmap[ASPEED_DEV_SDRAM], errp)) {
         return;
     }
     if (!sysbus_realize(SYS_BUS_DEVICE(&s->fmc), errp)) {
         return;
     }
-    sysbus_mmio_map(SYS_BUS_DEVICE(&s->fmc), 0, sc->memmap[ASPEED_FMC]);
+    sysbus_mmio_map(SYS_BUS_DEVICE(&s->fmc), 0, sc->memmap[ASPEED_DEV_FMC]);
     sysbus_mmio_map(SYS_BUS_DEVICE(&s->fmc), 1,
                     s->fmc.ctrl->flash_window_base);
     sysbus_connect_irq(SYS_BUS_DEVICE(&s->fmc), 0,
-                       aspeed_soc_get_irq(s, ASPEED_FMC));
+                       aspeed_soc_get_irq(s, ASPEED_DEV_FMC));
 
     /* SPI */
     for (i = 0; i < sc->spis_num; i++) {
@@ -322,7 +322,7 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
             return;
         }
         sysbus_mmio_map(SYS_BUS_DEVICE(&s->spi[i]), 0,
-                        sc->memmap[ASPEED_SPI1 + i]);
+                        sc->memmap[ASPEED_DEV_SPI1 + i]);
         sysbus_mmio_map(SYS_BUS_DEVICE(&s->spi[i]), 1,
                         s->spi[i].ctrl->flash_window_base);
     }
@@ -333,16 +333,16 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
             return;
         }
         sysbus_mmio_map(SYS_BUS_DEVICE(&s->ehci[i]), 0,
-                        sc->memmap[ASPEED_EHCI1 + i]);
+                        sc->memmap[ASPEED_DEV_EHCI1 + i]);
         sysbus_connect_irq(SYS_BUS_DEVICE(&s->ehci[i]), 0,
-                           aspeed_soc_get_irq(s, ASPEED_EHCI1 + i));
+                           aspeed_soc_get_irq(s, ASPEED_DEV_EHCI1 + i));
     }
 
     /* SDMC - SDRAM Memory Controller */
     if (!sysbus_realize(SYS_BUS_DEVICE(&s->sdmc), errp)) {
         return;
     }
-    sysbus_mmio_map(SYS_BUS_DEVICE(&s->sdmc), 0, sc->memmap[ASPEED_SDMC]);
+    sysbus_mmio_map(SYS_BUS_DEVICE(&s->sdmc), 0, sc->memmap[ASPEED_DEV_SDMC]);
 
     /* Watch dog */
     for (i = 0; i < sc->wdts_num; i++) {
@@ -354,7 +354,7 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
             return;
         }
         sysbus_mmio_map(SYS_BUS_DEVICE(&s->wdt[i]), 0,
-                        sc->memmap[ASPEED_WDT] + i * awc->offset);
+                        sc->memmap[ASPEED_DEV_WDT] + i * awc->offset);
     }
 
     /* Net */
@@ -365,9 +365,9 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
             return;
         }
         sysbus_mmio_map(SYS_BUS_DEVICE(&s->ftgmac100[i]), 0,
-                        sc->memmap[ASPEED_ETH1 + i]);
+                        sc->memmap[ASPEED_DEV_ETH1 + i]);
         sysbus_connect_irq(SYS_BUS_DEVICE(&s->ftgmac100[i]), 0,
-                           aspeed_soc_get_irq(s, ASPEED_ETH1 + i));
+                           aspeed_soc_get_irq(s, ASPEED_DEV_ETH1 + i));
     }
 
     /* XDMA */
@@ -375,26 +375,26 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
         return;
     }
     sysbus_mmio_map(SYS_BUS_DEVICE(&s->xdma), 0,
-                    sc->memmap[ASPEED_XDMA]);
+                    sc->memmap[ASPEED_DEV_XDMA]);
     sysbus_connect_irq(SYS_BUS_DEVICE(&s->xdma), 0,
-                       aspeed_soc_get_irq(s, ASPEED_XDMA));
+                       aspeed_soc_get_irq(s, ASPEED_DEV_XDMA));
 
     /* GPIO */
     if (!sysbus_realize(SYS_BUS_DEVICE(&s->gpio), errp)) {
         return;
     }
-    sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpio), 0, sc->memmap[ASPEED_GPIO]);
+    sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpio), 0, sc->memmap[ASPEED_DEV_GPIO]);
     sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpio), 0,
-                       aspeed_soc_get_irq(s, ASPEED_GPIO));
+                       aspeed_soc_get_irq(s, ASPEED_DEV_GPIO));
 
     /* SDHCI */
     if (!sysbus_realize(SYS_BUS_DEVICE(&s->sdhci), errp)) {
         return;
     }
     sysbus_mmio_map(SYS_BUS_DEVICE(&s->sdhci), 0,
-                    sc->memmap[ASPEED_SDHCI]);
+                    sc->memmap[ASPEED_DEV_SDHCI]);
     sysbus_connect_irq(SYS_BUS_DEVICE(&s->sdhci), 0,
-                       aspeed_soc_get_irq(s, ASPEED_SDHCI));
+                       aspeed_soc_get_irq(s, ASPEED_DEV_SDHCI));
 }
 static Property aspeed_soc_properties[] = {
     DEFINE_PROP_LINK("dram", AspeedSoCState, dram_mr, TYPE_MEMORY_REGION,
Reviewed-by on v2 6/58
#12 lore raw

Re: [PATCH v2 06/58] aspeed_soc: Rename memmap/irqmap enum constants

In reply to Eduardo Habkost
Quoted 30 lines · Eduardo Habkost

Some of the enum constant names conflict with the QOM type check macros:

ASPEED_GPIO
ASPEED_I2C
ASPEED_RTC
ASPEED_SCU
ASPEED_SDHCI
ASPEED_SDMC
ASPEED_VIC
ASPEED_WDT
ASPEED_XDMA

This needs to be addressed to allow us to transform the QOM type check macros into functions generated by OBJECT_DECLARE_TYPE().

Rename all the constants to ASPEED_DEV_*, to avoid conflicts.

---
Changes v1 -> v2:
* Added more details to commit message

---
Cc: "Cédric Le Goater" <[email protected]>
Cc: Peter Maydell <[email protected]>
Cc: Andrew Jeffery <[email protected]>
Cc: Joel Stanley <[email protected]>
Cc: [email protected]
Cc: [email protected]

Quoted 6 lines
---
 include/hw/arm/aspeed_soc.h |  92 +++++++--------
 hw/arm/aspeed.c             |   4 +-
 hw/arm/aspeed_ast2600.c     | 208 ++++++++++++++++----------------
 hw/arm/aspeed_soc.c         | 228 ++++++++++++++++++------------------
 4 files changed, 266 insertions(+), 266 deletions(-)

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#13 lore raw

PATCH v2 7/58 opentitan: Rename memmap enum constants

In reply to Eduardo Habkost

Some of the enum constant names conflict with the QOM type check macros (IBEX_PLIC, IBEX_UART). This needs to be addressed to allow us to transform the QOM type check macros into functions generated by OBJECT_DECLARE_TYPE().

Rename all the constants to IBEX_DEV_*, to avoid conflicts.

---
Changes v1 -> v2:
* Added more details to commit message

---
Cc: Alistair Francis <[email protected]>
Cc: Palmer Dabbelt <[email protected]>
Cc: Sagar Karandikar <[email protected]>
Cc: Bastian Koppelmann <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 include/hw/riscv/opentitan.h | 38 ++++++++--------
 hw/riscv/opentitan.c         | 84 ++++++++++++++++++------------------
 2 files changed, 61 insertions(+), 61 deletions(-)
include/hw/riscv/opentitan.h +19 -19
index 8f29b9cbbf..835a80f896 100644
@@ -49,25 +49,25 @@ typedef struct OpenTitanState {
 } OpenTitanState;
 
 enum {
-    IBEX_ROM,
-    IBEX_RAM,
-    IBEX_FLASH,
-    IBEX_UART,
-    IBEX_GPIO,
-    IBEX_SPI,
-    IBEX_FLASH_CTRL,
-    IBEX_RV_TIMER,
-    IBEX_AES,
-    IBEX_HMAC,
-    IBEX_PLIC,
-    IBEX_PWRMGR,
-    IBEX_RSTMGR,
-    IBEX_CLKMGR,
-    IBEX_PINMUX,
-    IBEX_ALERT_HANDLER,
-    IBEX_NMI_GEN,
-    IBEX_USBDEV,
-    IBEX_PADCTRL,
+    IBEX_DEV_ROM,
+    IBEX_DEV_RAM,
+    IBEX_DEV_FLASH,
+    IBEX_DEV_UART,
+    IBEX_DEV_GPIO,
+    IBEX_DEV_SPI,
+    IBEX_DEV_FLASH_CTRL,
+    IBEX_DEV_RV_TIMER,
+    IBEX_DEV_AES,
+    IBEX_DEV_HMAC,
+    IBEX_DEV_PLIC,
+    IBEX_DEV_PWRMGR,
+    IBEX_DEV_RSTMGR,
+    IBEX_DEV_CLKMGR,
+    IBEX_DEV_PINMUX,
+    IBEX_DEV_ALERT_HANDLER,
+    IBEX_DEV_NMI_GEN,
+    IBEX_DEV_USBDEV,
+    IBEX_DEV_PADCTRL,
 };
 
 enum {
hw/riscv/opentitan.c +42 -42

140 lines not on this page · raw message

Signature · 1 line
2.26.2
Reviewed-by on v2 7/58
#14 lore raw

Re: [PATCH v2 07/58] opentitan: Rename memmap enum constants

Quoted 20 lines · Eduardo Habkost

Some of the enum constant names conflict with the QOM type check macros (IBEX_PLIC, IBEX_UART). This needs to be addressed to allow us to transform the QOM type check macros into functions generated by OBJECT_DECLARE_TYPE().

Rename all the constants to IBEX_DEV_*, to avoid conflicts.

---
Changes v1 -> v2:
* Added more details to commit message

---
Cc: Alistair Francis <[email protected]>
Cc: Palmer Dabbelt <[email protected]>
Cc: Sagar Karandikar <[email protected]>
Cc: Bastian Koppelmann <[email protected]>
Cc: [email protected]
Cc: [email protected]

Quoted 4 lines
---
 include/hw/riscv/opentitan.h | 38 ++++++++--------
 hw/riscv/opentitan.c         | 84 ++++++++++++++++++------------------
 2 files changed, 61 insertions(+), 61 deletions(-)

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#15 lore raw

PATCH v2 8/58 sifive_e: Rename memmap enum constants

In reply to Eduardo Habkost

Some of the enum constant names conflict with a QOM type check macro (SIFIVE_E_PRCI). This needs to be addressed to allow us to transform the QOM type check macros into functions generated by OBJECT_DECLARE_TYPE().

Rename all the constants to SIFIVE_E_DEV_*, to avoid conflicts.

---
Changes v1 -> v2:
* Added more details to commit message

---
Cc: Palmer Dabbelt <[email protected]>
Cc: Alistair Francis <[email protected]>
Cc: Sagar Karandikar <[email protected]>
Cc: Bastian Koppelmann <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 include/hw/riscv/sifive_e.h | 38 ++++++++---------
 hw/riscv/sifive_e.c         | 82 ++++++++++++++++++-------------------
 2 files changed, 60 insertions(+), 60 deletions(-)
include/hw/riscv/sifive_e.h +19 -19
index 637414130b..7c2eb70189 100644
@@ -53,25 +53,25 @@ typedef struct SiFiveEState {
     OBJECT_CHECK(SiFiveEState, (obj), TYPE_RISCV_E_MACHINE)
 
 enum {
-    SIFIVE_E_DEBUG,
-    SIFIVE_E_MROM,
-    SIFIVE_E_OTP,
-    SIFIVE_E_CLINT,
-    SIFIVE_E_PLIC,
-    SIFIVE_E_AON,
-    SIFIVE_E_PRCI,
-    SIFIVE_E_OTP_CTRL,
-    SIFIVE_E_GPIO0,
-    SIFIVE_E_UART0,
-    SIFIVE_E_QSPI0,
-    SIFIVE_E_PWM0,
-    SIFIVE_E_UART1,
-    SIFIVE_E_QSPI1,
-    SIFIVE_E_PWM1,
-    SIFIVE_E_QSPI2,
-    SIFIVE_E_PWM2,
-    SIFIVE_E_XIP,
-    SIFIVE_E_DTIM
+    SIFIVE_E_DEV_DEBUG,
+    SIFIVE_E_DEV_MROM,
+    SIFIVE_E_DEV_OTP,
+    SIFIVE_E_DEV_CLINT,
+    SIFIVE_E_DEV_PLIC,
+    SIFIVE_E_DEV_AON,
+    SIFIVE_E_DEV_PRCI,
+    SIFIVE_E_DEV_OTP_CTRL,
+    SIFIVE_E_DEV_GPIO0,
+    SIFIVE_E_DEV_UART0,
+    SIFIVE_E_DEV_QSPI0,
+    SIFIVE_E_DEV_PWM0,
+    SIFIVE_E_DEV_UART1,
+    SIFIVE_E_DEV_QSPI1,
+    SIFIVE_E_DEV_PWM1,
+    SIFIVE_E_DEV_QSPI2,
+    SIFIVE_E_DEV_PWM2,
+    SIFIVE_E_DEV_XIP,
+    SIFIVE_E_DEV_DTIM
 };
 
 enum {
hw/riscv/sifive_e.c +41 -41

141 lines not on this page · raw message

Signature · 1 line
2.26.2
Reviewed-by on v2 8/58
#16 lore raw

Re: [PATCH v2 08/58] sifive_e: Rename memmap enum constants

Quoted 20 lines · Eduardo Habkost

Some of the enum constant names conflict with a QOM type check macro (SIFIVE_E_PRCI). This needs to be addressed to allow us to transform the QOM type check macros into functions generated by OBJECT_DECLARE_TYPE().

Rename all the constants to SIFIVE_E_DEV_*, to avoid conflicts.

---
Changes v1 -> v2:
* Added more details to commit message

---
Cc: Palmer Dabbelt <[email protected]>
Cc: Alistair Francis <[email protected]>
Cc: Sagar Karandikar <[email protected]>
Cc: Bastian Koppelmann <[email protected]>
Cc: [email protected]
Cc: [email protected]

Quoted 4 lines
---
 include/hw/riscv/sifive_e.h | 38 ++++++++---------
 hw/riscv/sifive_e.c         | 82 ++++++++++++++++++-------------------
 2 files changed, 60 insertions(+), 60 deletions(-)

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#17 lore raw

PATCH v2 9/58 sifive_u: Rename memmap enum constants

In reply to Eduardo Habkost

Some of the enum constant names conflict with the QOM type check macros (SIFIVE_U_OTP, SIFIVE_U_PRCI). This needs to be addressed to allow us to transform the QOM type check macros into functions generated by OBJECT_DECLARE_TYPE().

Rename all the constants to SIFIVE_U_DEV_*, to avoid conflicts.

---
Changes v1 -> v2:
* Added more details to commit message

---
Cc: Palmer Dabbelt <[email protected]>
Cc: Alistair Francis <[email protected]>
Cc: Sagar Karandikar <[email protected]>
Cc: Bastian Koppelmann <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 include/hw/riscv/sifive_u.h |  30 ++++----
 hw/riscv/sifive_u.c         | 136 ++++++++++++++++++------------------
 2 files changed, 83 insertions(+), 83 deletions(-)
include/hw/riscv/sifive_u.h +15 -15
index aba4d0181f..0dab922f3a 100644
@@ -68,21 +68,21 @@ typedef struct SiFiveUState {
 } SiFiveUState;
 
 enum {
-    SIFIVE_U_DEBUG,
-    SIFIVE_U_MROM,
-    SIFIVE_U_CLINT,
-    SIFIVE_U_L2LIM,
-    SIFIVE_U_PLIC,
-    SIFIVE_U_PRCI,
-    SIFIVE_U_UART0,
-    SIFIVE_U_UART1,
-    SIFIVE_U_GPIO,
-    SIFIVE_U_OTP,
-    SIFIVE_U_DMC,
-    SIFIVE_U_FLASH0,
-    SIFIVE_U_DRAM,
-    SIFIVE_U_GEM,
-    SIFIVE_U_GEM_MGMT
+    SIFIVE_U_DEV_DEBUG,
+    SIFIVE_U_DEV_MROM,
+    SIFIVE_U_DEV_CLINT,
+    SIFIVE_U_DEV_L2LIM,
+    SIFIVE_U_DEV_PLIC,
+    SIFIVE_U_DEV_PRCI,
+    SIFIVE_U_DEV_UART0,
+    SIFIVE_U_DEV_UART1,
+    SIFIVE_U_DEV_GPIO,
+    SIFIVE_U_DEV_OTP,
+    SIFIVE_U_DEV_DMC,
+    SIFIVE_U_DEV_FLASH0,
+    SIFIVE_U_DEV_DRAM,
+    SIFIVE_U_DEV_GEM,
+    SIFIVE_U_DEV_GEM_MGMT
 };
 
 enum {
hw/riscv/sifive_u.c +68 -68

324 lines not on this page · raw message

Signature · 1 line
2.26.2
Reviewed-by on v2 9/58
#18 lore raw

Re: [PATCH v2 09/58] sifive_u: Rename memmap enum constants

Quoted 20 lines · Eduardo Habkost

Some of the enum constant names conflict with the QOM type check macros (SIFIVE_U_OTP, SIFIVE_U_PRCI). This needs to be addressed to allow us to transform the QOM type check macros into functions generated by OBJECT_DECLARE_TYPE().

Rename all the constants to SIFIVE_U_DEV_*, to avoid conflicts.

---
Changes v1 -> v2:
* Added more details to commit message

---
Cc: Palmer Dabbelt <[email protected]>
Cc: Alistair Francis <[email protected]>
Cc: Sagar Karandikar <[email protected]>
Cc: Bastian Koppelmann <[email protected]>
Cc: [email protected]
Cc: [email protected]

Quoted 4 lines
---
 include/hw/riscv/sifive_u.h |  30 ++++----
 hw/riscv/sifive_u.c         | 136 ++++++++++++++++++------------------
 2 files changed, 83 insertions(+), 83 deletions(-)

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#19 lore raw

PATCH v2 10/58 aspeed_timer: Fix ASPEED_TIMER macro definition

In reply to Eduardo Habkost

The macro definition had an extra semicolon. This was never noticed because the macro was only being used where it didn't make a difference.

---
Changes v1 -> v2: none

---
Cc: "Cédric Le Goater" <[email protected]>
Cc: Peter Maydell <[email protected]>
Cc: Andrew Jeffery <[email protected]>
Cc: Joel Stanley <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 include/hw/timer/aspeed_timer.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/hw/timer/aspeed_timer.h +1 -1
index 948329893c..d7c7d8ad28 100644
@@ -26,7 +26,7 @@
 #include "hw/misc/aspeed_scu.h"
 
 #define ASPEED_TIMER(obj) \
-    OBJECT_CHECK(AspeedTimerCtrlState, (obj), TYPE_ASPEED_TIMER);
+    OBJECT_CHECK(AspeedTimerCtrlState, (obj), TYPE_ASPEED_TIMER)
 #define TYPE_ASPEED_TIMER "aspeed.timer"
 #define TYPE_ASPEED_2400_TIMER TYPE_ASPEED_TIMER "-ast2400"
 #define TYPE_ASPEED_2500_TIMER TYPE_ASPEED_TIMER "-ast2500"
Signature · 1 line
2.26.2
Reviewed-by on v2 10/58
#20 lore raw

Re: [PATCH v2 10/58] aspeed_timer: Fix ASPEED_TIMER macro definition

Quoted 7 lines · Eduardo Habkost

The macro definition had an extra semicolon. This was never noticed because the macro was only being used where it didn't make a difference.

Thanks,

C.

Quoted 28 lines

---
Changes v1 -> v2: none

---
Cc: "Cédric Le Goater" <[email protected]>
Cc: Peter Maydell <[email protected]>
Cc: Andrew Jeffery <[email protected]>
Cc: Joel Stanley <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 include/hw/timer/aspeed_timer.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/hw/timer/aspeed_timer.h +1 -1
index 948329893c..d7c7d8ad28 100644
@@ -26,7 +26,7 @@
 #include "hw/misc/aspeed_scu.h"
 
 #define ASPEED_TIMER(obj) \
-    OBJECT_CHECK(AspeedTimerCtrlState, (obj), TYPE_ASPEED_TIMER);
+    OBJECT_CHECK(AspeedTimerCtrlState, (obj), TYPE_ASPEED_TIMER)
 #define TYPE_ASPEED_TIMER "aspeed.timer"
 #define TYPE_ASPEED_2400_TIMER TYPE_ASPEED_TIMER "-ast2400"
 #define TYPE_ASPEED_2500_TIMER TYPE_ASPEED_TIMER "-ast2500"
#21 lore raw

PATCH v2 11/58 versatile: Fix typo in PCI_VPB_HOST definition

In reply to Eduardo Habkost
Fixes cd93dbf375bd ("versatile_pci: Update to realize and instance init functions")

---
Changes v1 -> v2: none

---
Cc: Peter Maydell <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 hw/pci-host/versatile.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/pci-host/versatile.c +1 -1
index 616882a80d..7e4aa467a2 100644
@@ -161,7 +161,7 @@ static const VMStateDescription pci_vpb_vmstate = {
 
 #define TYPE_VERSATILE_PCI_HOST "versatile_pci_host"
 #define PCI_VPB_HOST(obj) \
-    OBJECT_CHECK(PCIDevice, (obj), TYPE_VERSATILE_PCIHOST)
+    OBJECT_CHECK(PCIDevice, (obj), TYPE_VERSATILE_PCI_HOST)
 
 typedef enum {
     PCI_IMAP0 = 0x0,
Signature · 1 line
2.26.2
#22 lore raw

PATCH v2 12/58 virtio-ccw: Fix definition of VIRTIO_CCW_BUS_GET_CLASS

In reply to Eduardo Habkost

The macro was incorrectly defined using OBJECT_CHECK.

---
Changes v1 -> v2: none

---
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Cornelia Huck <[email protected]>
Cc: Halil Pasic <[email protected]>
Cc: Christian Borntraeger <[email protected]>
Cc: Richard Henderson <[email protected]>
Cc: David Hildenbrand <[email protected]>
Cc: Thomas Huth <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 hw/s390x/virtio-ccw.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/s390x/virtio-ccw.h +2 -2
index c0e3355248..b281896f7d 100644
@@ -65,9 +65,9 @@ typedef struct VirtioBusClass VirtioCcwBusClass;
 
 #define TYPE_VIRTIO_CCW_BUS "virtio-ccw-bus"
 #define VIRTIO_CCW_BUS(obj) \
-     OBJECT_CHECK(VirtioCcwBus, (obj), TYPE_VIRTIO_CCW_BUS)
+     OBJECT_CHECK(VirtioCcwBusState, (obj), TYPE_VIRTIO_CCW_BUS)
 #define VIRTIO_CCW_BUS_GET_CLASS(obj) \
-    OBJECT_CHECK(VirtioCcwBusState, (obj), TYPE_VIRTIO_CCW_BUS)
+    OBJECT_GET_CLASS(VirtioCcwBusClass, (obj), TYPE_VIRTIO_CCW_BUS)
 #define VIRTIO_CCW_BUS_CLASS(klass) \
     OBJECT_CLASS_CHECK(VirtioCcwBusClass, klass, TYPE_VIRTIO_CCW_BUS)
 
Signature · 1 line
2.26.2
Reviewed-by on v2 12/58
#23 lore raw

Re: [PATCH v2 12/58] virtio-ccw: Fix definition of VIRTIO_CCW_BUS_GET_CLASS

Quoted 29 lines · Eduardo Habkost

The macro was incorrectly defined using OBJECT_CHECK.

---
Changes v1 -> v2: none

---
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Cornelia Huck <[email protected]>
Cc: Halil Pasic <[email protected]>
Cc: Christian Borntraeger <[email protected]>
Cc: Richard Henderson <[email protected]>
Cc: David Hildenbrand <[email protected]>
Cc: Thomas Huth <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 hw/s390x/virtio-ccw.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/s390x/virtio-ccw.h +0 -0
index c0e3355248..b281896f7d 100644
@@ -65,9 +65,9 @@ typedef struct VirtioBusClass VirtioCcwBusClass;
 

hw/s390x/virtio-ccw.h typedef struct VirtioBusClass VirtioCcwBusClass; · line 73

Quoted 10 lines
hw/s390x/virtio-ccw.h +2 -2
 #define TYPE_VIRTIO_CCW_BUS "virtio-ccw-bus"
 #define VIRTIO_CCW_BUS(obj) \
-     OBJECT_CHECK(VirtioCcwBus, (obj), TYPE_VIRTIO_CCW_BUS)
+     OBJECT_CHECK(VirtioCcwBusState, (obj), TYPE_VIRTIO_CCW_BUS)
 #define VIRTIO_CCW_BUS_GET_CLASS(obj) \
-    OBJECT_CHECK(VirtioCcwBusState, (obj), TYPE_VIRTIO_CCW_BUS)
+    OBJECT_GET_CLASS(VirtioCcwBusClass, (obj), TYPE_VIRTIO_CCW_BUS)
 #define VIRTIO_CCW_BUS_CLASS(klass) \
     OBJECT_CLASS_CHECK(VirtioCcwBusClass, klass, TYPE_VIRTIO_CCW_BUS)
 
Signature · 3 lines
Thanks,

David / dhildenb
#24 lore raw

PATCH v2 13/58 hvf: Add missing include

In reply to Eduardo Habkost

The sysemu/accel.h header is needed for the ACCEL_CLASS_NAME macro. This will be necessary to allow us to use OBJECT_DEFINE*() for TYPE_HVF_ACCEL.

---
Changes v1 -> v2: none

---
Cc: Cameron Esfahani <[email protected]>
Cc: Roman Bolshakov <[email protected]>
Cc: [email protected]

---
 include/sysemu/hvf.h | 2 ++
 1 file changed, 2 insertions(+)
include/sysemu/hvf.h +2 -0
index 6d3ee4fdb7..d3bed80ea8 100644
@@ -13,6 +13,8 @@
 #ifndef HVF_H
 #define HVF_H
 
+#include "sysemu/accel.h"
+
 #ifdef CONFIG_HVF
 uint32_t hvf_get_supported_cpuid(uint32_t func, uint32_t idx,
                                  int reg);
Signature · 1 line
2.26.2
#25 lore raw

PATCH v2 14/58 hcd-dwc2: Rename USB_*CLASS macros for consistency

In reply to Eduardo Habkost

Rename the DWC2_CLASS to DWC2_USB_CLASS and DWC2_GET_CLASS to DWC2_USB_GET_CLASS, for consistency with the DWC2_USB macro.

---
Changes v1 -> v2: none

---
Cc: Gerd Hoffmann <[email protected]>
Cc: [email protected]

---
 hw/usb/hcd-dwc2.h | 4 ++--
 hw/usb/hcd-dwc2.c | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)
hw/usb/hcd-dwc2.h +2 -2
index 4ba809a07b..54111d835e 100644
@@ -182,9 +182,9 @@ struct DWC2Class {
 #define TYPE_DWC2_USB   "dwc2-usb"
 #define DWC2_USB(obj) \
     OBJECT_CHECK(DWC2State, (obj), TYPE_DWC2_USB)
-#define DWC2_CLASS(klass) \
+#define DWC2_USB_CLASS(klass) \
     OBJECT_CLASS_CHECK(DWC2Class, (klass), TYPE_DWC2_USB)
-#define DWC2_GET_CLASS(obj) \
+#define DWC2_USB_GET_CLASS(obj) \
     OBJECT_GET_CLASS(DWC2Class, (obj), TYPE_DWC2_USB)
 
 #endif
hw/usb/hcd-dwc2.c +4 -4
index 56f91f6bee..97688d21bf 100644
@@ -1155,7 +1155,7 @@ static void dwc2_work_timer(void *opaque)
 
 static void dwc2_reset_enter(Object *obj, ResetType type)
 {
-    DWC2Class *c = DWC2_GET_CLASS(obj);
+    DWC2Class *c = DWC2_USB_GET_CLASS(obj);
     DWC2State *s = DWC2_USB(obj);
     int i;
 
@@ -1239,7 +1239,7 @@ static void dwc2_reset_enter(Object *obj, ResetType type)
 
 static void dwc2_reset_hold(Object *obj)
 {
-    DWC2Class *c = DWC2_GET_CLASS(obj);
+    DWC2Class *c = DWC2_USB_GET_CLASS(obj);
     DWC2State *s = DWC2_USB(obj);
 
     trace_usb_dwc2_reset_hold();
@@ -1253,7 +1253,7 @@ static void dwc2_reset_hold(Object *obj)
 
 static void dwc2_reset_exit(Object *obj)
 {
-    DWC2Class *c = DWC2_GET_CLASS(obj);
+    DWC2Class *c = DWC2_USB_GET_CLASS(obj);
     DWC2State *s = DWC2_USB(obj);
 
     trace_usb_dwc2_reset_exit();
@@ -1382,7 +1382,7 @@ static Property dwc2_usb_properties[] = {
 static void dwc2_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
-    DWC2Class *c = DWC2_CLASS(klass);
+    DWC2Class *c = DWC2_USB_CLASS(klass);
     ResettableClass *rc = RESETTABLE_CLASS(klass);
 
     dc->realize = dwc2_realize;
Signature · 1 line
2.26.2
#26 lore raw

PATCH v2 15/58 tulip: Move TulipState typedef to header

In reply to Eduardo Habkost

Move typedef closer to the type check macros, to make it easier to convert the code to OBJECT_DEFINE_TYPE() in the future.

---
Changes v1 -> v2: none

---
Cc: Sven Schnelle <[email protected]>
Cc: Jason Wang <[email protected]>
Cc: [email protected]

---
 hw/net/tulip.h | 1 +
 hw/net/tulip.c | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)
hw/net/tulip.h +1 -0
index 5271aad8d5..c3fcd4d4e1 100644
@@ -5,6 +5,7 @@
 #include "net/net.h"
 
 #define TYPE_TULIP "tulip"
+typedef struct TULIPState TULIPState;
 #define TULIP(obj) OBJECT_CHECK(TULIPState, (obj), TYPE_TULIP)
 
 #define CSR(_x) ((_x) << 3)
hw/net/tulip.c +2 -2
index 4487fd61cf..ca69f7ea5e 100644
@@ -18,7 +18,7 @@
 #include "trace.h"
 #include "net/eth.h"
 
-typedef struct TULIPState {
+struct TULIPState {
     PCIDevice dev;
     MemoryRegion io;
     MemoryRegion memory;
@@ -44,7 +44,7 @@ typedef struct TULIPState {
 
     uint32_t rx_status;
     uint8_t filter[16][6];
-} TULIPState;
+};
 
 static const VMStateDescription vmstate_pci_tulip = {
     .name = "tulip",
Signature · 1 line
2.26.2
#27 lore raw

PATCH v2 16/58 throttle-groups: Move ThrottleGroup typedef to header

In reply to Eduardo Habkost

Move typedef closer to the type check macros, to make it easier to convert the code to OBJECT_DEFINE_TYPE() in the future.

---
Changes v1 -> v2: none

---
Cc: Alberto Garcia <[email protected]>
Cc: Kevin Wolf <[email protected]>
Cc: Max Reitz <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 include/block/throttle-groups.h | 1 +
 block/throttle-groups.c         | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)
include/block/throttle-groups.h +1 -0
index 712a8e64b4..5e77db700f 100644
@@ -59,6 +59,7 @@ typedef struct ThrottleGroupMember {
 } ThrottleGroupMember;
 
 #define TYPE_THROTTLE_GROUP "throttle-group"
+typedef struct ThrottleGroup ThrottleGroup;
 #define THROTTLE_GROUP(obj) OBJECT_CHECK(ThrottleGroup, (obj), TYPE_THROTTLE_GROUP)
 
 const char *throttle_group_get_name(ThrottleGroupMember *tgm);
block/throttle-groups.c +2 -2
index 98fea7fd47..4e28365d8d 100644
@@ -63,7 +63,7 @@ static void timer_cb(ThrottleGroupMember *tgm, bool is_write);
  * access some other ThrottleGroupMember's timers only after verifying that
  * that ThrottleGroupMember has throttled requests in the queue.
  */
-typedef struct ThrottleGroup {
+struct ThrottleGroup {
     Object parent_obj;
 
     /* refuse individual property change if initialization is complete */
@@ -79,7 +79,7 @@ typedef struct ThrottleGroup {
 
     /* This field is protected by the global QEMU mutex */
     QTAILQ_ENTRY(ThrottleGroup) list;
-} ThrottleGroup;
+};
 
 /* This is protected by the global QEMU mutex */
 static QTAILQ_HEAD(, ThrottleGroup) throttle_groups =
Signature · 1 line
2.26.2
#28 lore raw

PATCH v2 17/58 pci: Move PCIBusClass typedef to pci.h

In reply to Eduardo Habkost

Move typedef closer to the type check macros, to make it easier to convert the code to OBJECT_DEFINE_TYPE() in the future.

---
Changes v1 -> v2: none

---
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Marcel Apfelbaum <[email protected]>
Cc: [email protected]

---
 include/hw/pci/pci.h     | 1 +
 include/hw/pci/pci_bus.h | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)
include/hw/pci/pci.h +1 -0
index c1bf7d5356..4ca7258b5b 100644
@@ -396,6 +396,7 @@ typedef int (*pci_map_irq_fn)(PCIDevice *pci_dev, int irq_num);
 typedef PCIINTxRoute (*pci_route_irq_fn)(void *opaque, int pin);
 
 #define TYPE_PCI_BUS "PCI"
+typedef struct PCIBusClass PCIBusClass;
 #define PCI_BUS(obj) OBJECT_CHECK(PCIBus, (obj), TYPE_PCI_BUS)
 #define PCI_BUS_CLASS(klass) OBJECT_CLASS_CHECK(PCIBusClass, (klass), TYPE_PCI_BUS)
 #define PCI_BUS_GET_CLASS(obj) OBJECT_GET_CLASS(PCIBusClass, (obj), TYPE_PCI_BUS)
include/hw/pci/pci_bus.h +2 -2
index 0714f578af..347440d42c 100644
@@ -10,14 +10,14 @@
  * use accessor functions in pci.h
  */
 
-typedef struct PCIBusClass {
+struct PCIBusClass {
     /*< private >*/
     BusClass parent_class;
     /*< public >*/
 
     int (*bus_num)(PCIBus *bus);
     uint16_t (*numa_node)(PCIBus *bus);
-} PCIBusClass;
+};
 
 enum PCIBusFlags {
     /* This bus is the root of a PCI domain */
Signature · 1 line
2.26.2
#29 lore raw

PATCH v2 18/58 i8254: Move PITCommonState/PITCommonClass typedefs to i8254.h

In reply to Eduardo Habkost

Move typedef closer to the type check macros, to make it easier to convert the code to OBJECT_DEFINE_TYPE() in the future.

---
Changes v1 -> v2: none

---
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: [email protected]

---
 include/hw/timer/i8254.h          | 2 ++
 include/hw/timer/i8254_internal.h | 8 ++++----
 2 files changed, 6 insertions(+), 4 deletions(-)
include/hw/timer/i8254.h +2 -0
index e75b4a5a08..206b8f8464 100644
@@ -39,6 +39,8 @@ typedef struct PITChannelInfo {
 } PITChannelInfo;
 
 #define TYPE_PIT_COMMON "pit-common"
+typedef struct PITCommonState PITCommonState;
+typedef struct PITCommonClass PITCommonClass;
 #define PIT_COMMON(obj) \
      OBJECT_CHECK(PITCommonState, (obj), TYPE_PIT_COMMON)
 #define PIT_COMMON_CLASS(klass) \
include/hw/timer/i8254_internal.h +4 -4
index 3db462aecd..a9a600d941 100644
@@ -50,14 +50,14 @@ typedef struct PITChannelState {
     uint32_t irq_disabled;
 } PITChannelState;
 
-typedef struct PITCommonState {
+struct PITCommonState {
     ISADevice dev;
     MemoryRegion ioports;
     uint32_t iobase;
     PITChannelState channels[3];
-} PITCommonState;
+};
 
-typedef struct PITCommonClass {
+struct PITCommonClass {
     ISADeviceClass parent_class;
 
     void (*set_channel_gate)(PITCommonState *s, PITChannelState *sc, int val);
@@ -65,7 +65,7 @@ typedef struct PITCommonClass {
                              PITChannelInfo *info);
     void (*pre_save)(PITCommonState *s);
     void (*post_load)(PITCommonState *s);
-} PITCommonClass;
+};
 
 int pit_get_out(PITChannelState *s, int64_t current_time);
 int64_t pit_get_next_transition_time(PITChannelState *s, int64_t current_time);
Signature · 1 line
2.26.2
#30 lore raw

PATCH v2 19/58 hvf: Move HVFState typedef to hvf.h

In reply to Eduardo Habkost

Move typedef closer to the type check macros, to make it easier to convert the code to OBJECT_DEFINE_TYPE() in the future.

---
Changes v1 -> v2: none

---
Cc: Cameron Esfahani <[email protected]>
Cc: Roman Bolshakov <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Richard Henderson <[email protected]>
Cc: Eduardo Habkost <[email protected]>
Cc: [email protected]

---
 include/sysemu/hvf.h       | 1 +
 target/i386/hvf/hvf-i386.h | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)
include/sysemu/hvf.h +1 -0
index d3bed80ea8..760d6c79a2 100644
@@ -35,6 +35,7 @@ void hvf_vcpu_destroy(CPUState *);
 
 #define TYPE_HVF_ACCEL ACCEL_CLASS_NAME("hvf")
 
+typedef struct HVFState HVFState;
 #define HVF_STATE(obj) \
     OBJECT_CHECK(HVFState, (obj), TYPE_HVF_ACCEL)
 
target/i386/hvf/hvf-i386.h +2 -2
index ef20c73eca..e0edffd077 100644
@@ -57,13 +57,13 @@ typedef struct hvf_vcpu_caps {
     uint64_t vmx_cap_preemption_timer;
 } hvf_vcpu_caps;
 
-typedef struct HVFState {
+struct HVFState {
     AccelState parent;
     hvf_slot slots[32];
     int num_slots;
 
     hvf_vcpu_caps *hvf_caps;
-} HVFState;
+};
 extern HVFState *hvf_state;
 
 void hvf_set_phys_mem(MemoryRegionSection *, bool);
Signature · 1 line
2.26.2
Reviewed-by on v2 19/58
#31 lore raw

Re: [PATCH v2 19/58] hvf: Move HVFState typedef to hvf.h

Quoted 55 lines · Eduardo Habkost

Move typedef closer to the type check macros, to make it easier to convert the code to OBJECT_DEFINE_TYPE() in the future.

---
Changes v1 -> v2: none

---
Cc: Cameron Esfahani <[email protected]>
Cc: Roman Bolshakov <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Richard Henderson <[email protected]>
Cc: Eduardo Habkost <[email protected]>
Cc: [email protected]

---
 include/sysemu/hvf.h       | 1 +
 target/i386/hvf/hvf-i386.h | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)
include/sysemu/hvf.h +1 -0
index d3bed80ea8..760d6c79a2 100644
@@ -35,6 +35,7 @@ void hvf_vcpu_destroy(CPUState *);
 
 #define TYPE_HVF_ACCEL ACCEL_CLASS_NAME("hvf")
 
+typedef struct HVFState HVFState;
 #define HVF_STATE(obj) \
     OBJECT_CHECK(HVFState, (obj), TYPE_HVF_ACCEL)
 
target/i386/hvf/hvf-i386.h +2 -2
index ef20c73eca..e0edffd077 100644
@@ -57,13 +57,13 @@ typedef struct hvf_vcpu_caps {
     uint64_t vmx_cap_preemption_timer;
 } hvf_vcpu_caps;
 
-typedef struct HVFState {
+struct HVFState {
     AccelState parent;
     hvf_slot slots[32];
     int num_slots;
 
     hvf_vcpu_caps *hvf_caps;
-} HVFState;
+};
 extern HVFState *hvf_state;
 
 void hvf_set_phys_mem(MemoryRegionSection *, bool);
Signature · 1 line
2.26.2

But it seems the accel misuses QOM as pointed out in the other thread. I also don't see a place where HVF_STATE is invoked... ah, you're replacing it later in "Use DECLARE_*CHECKER* macros".

Thanks,
Roman

#32 lore raw

Re: [PATCH v2 19/58] hvf: Move HVFState typedef to hvf.h

In reply to Eduardo Habkost
Quoted 25 lines · Eduardo Habkost

Move typedef closer to the type check macros, to make it easier to convert the code to OBJECT_DEFINE_TYPE() in the future.

---
Changes v1 -> v2: none

---
Cc: Cameron Esfahani <[email protected]>
Cc: Roman Bolshakov <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Richard Henderson <[email protected]>
Cc: Eduardo Habkost <[email protected]>
Cc: [email protected]

---
 include/sysemu/hvf.h       | 1 +
 target/i386/hvf/hvf-i386.h | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)
include/sysemu/hvf.h +0 -0
index d3bed80ea8..760d6c79a2 100644

include/sysemu/hvf.h void hvf_vcpu_destroy(CPUState *); · line 38

Quoted 4 lines
include/sysemu/hvf.h +1 -0
@@ -35,6 +35,7 @@ void hvf_vcpu_destroy(CPUState *);
 
 #define TYPE_HVF_ACCEL ACCEL_CLASS_NAME("hvf")
 
+typedef struct HVFState HVFState;

Forward declaration of HVFState is missed before the typedef.

Quoted 26 lines
include/sysemu/hvf.h +0 -0
 #define HVF_STATE(obj) \
     OBJECT_CHECK(HVFState, (obj), TYPE_HVF_ACCEL)
 
target/i386/hvf/hvf-i386.h +2 -2
index ef20c73eca..e0edffd077 100644
@@ -57,13 +57,13 @@ typedef struct hvf_vcpu_caps {
     uint64_t vmx_cap_preemption_timer;
 } hvf_vcpu_caps;
 
-typedef struct HVFState {
+struct HVFState {
     AccelState parent;
     hvf_slot slots[32];
     int num_slots;
 
     hvf_vcpu_caps *hvf_caps;
-} HVFState;
+};
 extern HVFState *hvf_state;
 
 void hvf_set_phys_mem(MemoryRegionSection *, bool);
Signature · 1 line
2.26.2
#33 lore raw

Re: [PATCH v2 19/58] hvf: Move HVFState typedef to hvf.h

Quoted 27 lines · Roman Bolshakov
Quoted 26 lines · Eduardo Habkost

Move typedef closer to the type check macros, to make it easier to convert the code to OBJECT_DEFINE_TYPE() in the future.

---
Changes v1 -> v2: none

---
Cc: Cameron Esfahani <[email protected]>
Cc: Roman Bolshakov <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Richard Henderson <[email protected]>
Cc: Eduardo Habkost <[email protected]>
Cc: [email protected]

---
 include/sysemu/hvf.h       | 1 +
 target/i386/hvf/hvf-i386.h | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)
include/sysemu/hvf.h +0 -0
index d3bed80ea8..760d6c79a2 100644
@@ -35,6 +35,7 @@ void hvf_vcpu_destroy(CPUState *);
 
Quoted 5 lines

include/sysemu/hvf.h void hvf_vcpu_destroy(CPUState *); · line 38

Quoted 3 lines
include/sysemu/hvf.h +1 -0
 #define TYPE_HVF_ACCEL ACCEL_CLASS_NAME("hvf")
 
+typedef struct HVFState HVFState;

Forward declaration of HVFState is missed before the typedef.

Why is that an issue?

Signature · 1 line
Eduardo
#34 lore raw

PATCH v2 20/58 mcf_fec: Move mcf_fec_state typedef to header

In reply to Eduardo Habkost

Move typedef closer to the type check macros, to make it easier to convert the code to OBJECT_DEFINE_TYPE() in the future.

---
Changes v1 -> v2: none

---
Cc: Thomas Huth <[email protected]>
Cc: Jason Wang <[email protected]>
Cc: [email protected]

---
 include/hw/m68k/mcf_fec.h | 1 +
 hw/net/mcf_fec.c          | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)
include/hw/m68k/mcf_fec.h +1 -0
index eeb471f9c9..c09e33a57c 100644
@@ -11,6 +11,7 @@
 #define HW_M68K_MCF_FEC_H
 
 #define TYPE_MCF_FEC_NET "mcf-fec"
+typedef struct mcf_fec_state mcf_fec_state;
 #define MCF_FEC_NET(obj) OBJECT_CHECK(mcf_fec_state, (obj), TYPE_MCF_FEC_NET)
 
 #define FEC_NUM_IRQ 13
hw/net/mcf_fec.c +2 -2
index 281345862c..25e3e453ab 100644
@@ -32,7 +32,7 @@ do { printf("mcf_fec: " fmt , ## __VA_ARGS__); } while (0)
 #define FEC_MAX_FRAME_SIZE 2032
 #define FEC_MIB_SIZE 64
 
-typedef struct {
+struct mcf_fec_state {
     SysBusDevice parent_obj;
 
     MemoryRegion iomem;
@@ -56,7 +56,7 @@ typedef struct {
     uint32_t etdsr;
     uint32_t emrbr;
     uint32_t mib[FEC_MIB_SIZE];
-} mcf_fec_state;
+};
 
 #define FEC_INT_HB   0x80000000
 #define FEC_INT_BABR 0x40000000
Signature · 1 line
2.26.2
Reviewed-by on v2 20/58
#35 lore raw

Re: [PATCH v2 20/58] mcf_fec: Move mcf_fec_state typedef to header

Quoted 44 lines · Eduardo Habkost

Move typedef closer to the type check macros, to make it easier to convert the code to OBJECT_DEFINE_TYPE() in the future.

---
Changes v1 -> v2: none

---
Cc: Thomas Huth <[email protected]>
Cc: Jason Wang <[email protected]>
Cc: [email protected]

---
 include/hw/m68k/mcf_fec.h | 1 +
 hw/net/mcf_fec.c          | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)
include/hw/m68k/mcf_fec.h +1 -0
index eeb471f9c9..c09e33a57c 100644
@@ -11,6 +11,7 @@
 #define HW_M68K_MCF_FEC_H
 
 #define TYPE_MCF_FEC_NET "mcf-fec"
+typedef struct mcf_fec_state mcf_fec_state;
 #define MCF_FEC_NET(obj) OBJECT_CHECK(mcf_fec_state, (obj), TYPE_MCF_FEC_NET)
 
 #define FEC_NUM_IRQ 13
hw/net/mcf_fec.c +1 -1
index 281345862c..25e3e453ab 100644
@@ -32,7 +32,7 @@ do { printf("mcf_fec: " fmt , ## __VA_ARGS__); } while (0)
 #define FEC_MAX_FRAME_SIZE 2032
 #define FEC_MIB_SIZE 64
 
-typedef struct {
+struct mcf_fec_state {
     SysBusDevice parent_obj;
 
     MemoryRegion iomem;

hw/net/mcf_fec.c typedef struct { · line 62

Quoted 8 lines
hw/net/mcf_fec.c +1 -1
@@ -56,7 +56,7 @@ typedef struct {
     uint32_t etdsr;
     uint32_t emrbr;
     uint32_t mib[FEC_MIB_SIZE];
-} mcf_fec_state;
+};
 
 #define FEC_INT_HB   0x80000000
 #define FEC_INT_BABR 0x40000000
#36 lore raw

PATCH v2 21/58 s390_flic: Move KVMS390FLICState typedef to header

In reply to Eduardo Habkost

Move typedef closer to the type check macros, to make it easier to convert the code to OBJECT_DEFINE_TYPE() in the future.

---
Changes v1 -> v2: none

---
Cc: Cornelia Huck <[email protected]>
Cc: Thomas Huth <[email protected]>
Cc: Halil Pasic <[email protected]>
Cc: Christian Borntraeger <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 include/hw/s390x/s390_flic.h | 1 +
 hw/intc/s390_flic_kvm.c      | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)
include/hw/s390x/s390_flic.h +1 -0
index 4687ecfe83..df11de9b20 100644
@@ -75,6 +75,7 @@ typedef struct S390FLICStateClass {
 } S390FLICStateClass;
 
 #define TYPE_KVM_S390_FLIC "s390-flic-kvm"
+typedef struct KVMS390FLICState KVMS390FLICState;
 #define KVM_S390_FLIC(obj) \
     OBJECT_CHECK(KVMS390FLICState, (obj), TYPE_KVM_S390_FLIC)
 
hw/intc/s390_flic_kvm.c +2 -2
index a306b26faa..dbd4e682ce 100644
@@ -29,12 +29,12 @@
 #define FLIC_FAILED (-1UL)
 #define FLIC_SAVEVM_VERSION 1
 
-typedef struct KVMS390FLICState {
+struct KVMS390FLICState{
     S390FLICState parent_obj;
 
     uint32_t fd;
     bool clear_io_supported;
-} KVMS390FLICState;
+};
 
 static KVMS390FLICState *s390_get_kvm_flic(S390FLICState *fs)
 {
Signature · 1 line
2.26.2
#37 lore raw

PATCH v2 22/58 can_emu: Delete macros for non-existing typedef

In reply to Eduardo Habkost

CanBusClass doesn't exist. This will break when we automatically convert the code to use OBJECT_DEFINE_TYPE(). Delete the macros that reference the non-existing typedef.

---
Changes v1 -> v2: none

---
Cc: Jason Wang <[email protected]>
Cc: [email protected]

---
 include/net/can_emu.h | 4 ----
 1 file changed, 4 deletions(-)
include/net/can_emu.h +0 -4
index fce9770928..7e90fd8a45 100644
@@ -100,10 +100,6 @@ struct CanBusClientState {
 };
 
 #define TYPE_CAN_BUS "can-bus"
-#define CAN_BUS_CLASS(klass) \
-     OBJECT_CLASS_CHECK(CanBusClass, (klass), TYPE_CAN_BUS)
-#define CAN_BUS_GET_CLASS(obj) \
-     OBJECT_GET_CLASS(CanBusClass, (obj), TYPE_CAN_BUS)
 #define CAN_BUS(obj) \
      OBJECT_CHECK(CanBusState, (obj), TYPE_CAN_BUS)
 
Signature · 1 line
2.26.2
#38 lore raw

PATCH v2 23/58 nubus: Delete unused NUBUS_BRIDGE macro

In reply to Eduardo Habkost

The macro never worked because the NubusBridge typedef doesn't exist. Delete it.

---
Changes v1 -> v2: none

---
Cc: Laurent Vivier <[email protected]>
Cc: [email protected]

---
 include/hw/nubus/nubus.h | 1 -
 1 file changed, 1 deletion(-)
include/hw/nubus/nubus.h +0 -1
index a8634e54c5..c350948262 100644
@@ -29,7 +29,6 @@
 #define NUBUS_BUS(obj) OBJECT_CHECK(NubusBus, (obj), TYPE_NUBUS_BUS)
 
 #define TYPE_NUBUS_BRIDGE "nubus-bridge"
-#define NUBUS_BRIDGE(obj) OBJECT_CHECK(NubusBridge, (obj), TYPE_NUBUS_BRIDGE)
 
 typedef struct NubusBus {
     BusState qbus;
Signature · 1 line
2.26.2
Acked-by on v2 23/58
#39 lore raw

Re: [PATCH v2 23/58] nubus: Delete unused NUBUS_BRIDGE macro

Le 20/08/2020 à 02:12, Eduardo Habkost a écrit :

Quoted 22 lines

The macro never worked because the NubusBridge typedef doesn't exist. Delete it.

---
Changes v1 -> v2: none

---
Cc: Laurent Vivier <[email protected]>
Cc: [email protected]

---
 include/hw/nubus/nubus.h | 1 -
 1 file changed, 1 deletion(-)
include/hw/nubus/nubus.h +0 -0
index a8634e54c5..c350948262 100644

include/hw/nubus/nubus.h line 34

Quoted 7 lines
include/hw/nubus/nubus.h +0 -1
@@ -29,7 +29,6 @@
 #define NUBUS_BUS(obj) OBJECT_CHECK(NubusBus, (obj), TYPE_NUBUS_BUS)
 
 #define TYPE_NUBUS_BRIDGE "nubus-bridge"
-#define NUBUS_BRIDGE(obj) OBJECT_CHECK(NubusBridge, (obj), TYPE_NUBUS_BRIDGE)
 
 typedef struct NubusBus {
     BusState qbus;
#40 lore raw

PATCH v2 24/58 platform-bus: Delete macros for non-existing typedef

In reply to Eduardo Habkost

PlatformBusDeviceClass doesn't exist. This will break when we automatically convert the code to use OBJECT_DEFINE_TYPE(). Delete the macros that reference the non-existing typedef.

---
Changes v1 -> v2: none

---
Cc: [email protected]

---
 include/hw/platform-bus.h | 4 ----
 1 file changed, 4 deletions(-)
include/hw/platform-bus.h +0 -4
index 19e20c57ce..33745a418e 100644
@@ -29,10 +29,6 @@ typedef struct PlatformBusDevice PlatformBusDevice;
 #define TYPE_PLATFORM_BUS_DEVICE "platform-bus-device"
 #define PLATFORM_BUS_DEVICE(obj) \
      OBJECT_CHECK(PlatformBusDevice, (obj), TYPE_PLATFORM_BUS_DEVICE)
-#define PLATFORM_BUS_DEVICE_CLASS(klass) \
-     OBJECT_CLASS_CHECK(PlatformBusDeviceClass, (klass), TYPE_PLATFORM_BUS_DEVICE)
-#define PLATFORM_BUS_DEVICE_GET_CLASS(obj) \
-     OBJECT_GET_CLASS(PlatformBusDeviceClass, (obj), TYPE_PLATFORM_BUS_DEVICE)
 
 struct PlatformBusDevice {
     /*< private >*/
Signature · 1 line
2.26.2
#41 lore raw

PATCH v2 25/58 armsse: Rename QOM macros to avoid conflicts

In reply to Eduardo Habkost

Rename TYPE_ARMSSE to TYPE_ARM_SSE, and ARMSSE*() type checking macros to ARM_SSE*().

This will avoid a future conflict between an ARM_SSE() type checking macro and the ARMSSE typedef name.

---
Changes series v1 -> v2: new patch in series v2

---
 include/hw/arm/armsse.h | 12 ++++++------
 hw/arm/armsse.c         | 24 ++++++++++++------------
 2 files changed, 18 insertions(+), 18 deletions(-)
include/hw/arm/armsse.h +6 -6
index 84080c2299..529816286d 100644
@@ -106,8 +106,8 @@
 #include "hw/core/split-irq.h"
 #include "hw/cpu/cluster.h"
 
-#define TYPE_ARMSSE "arm-sse"
-#define ARMSSE(obj) OBJECT_CHECK(ARMSSE, (obj), TYPE_ARMSSE)
+#define TYPE_ARM_SSE "arm-sse"
+#define ARM_SSE(obj) OBJECT_CHECK(ARMSSE, (obj), TYPE_ARM_SSE)
 
 /*
  * These type names are for specific IoTKit subsystems; other than
@@ -224,9 +224,9 @@ typedef struct ARMSSEClass {
     const ARMSSEInfo *info;
 } ARMSSEClass;
 
-#define ARMSSE_CLASS(klass) \
-    OBJECT_CLASS_CHECK(ARMSSEClass, (klass), TYPE_ARMSSE)
-#define ARMSSE_GET_CLASS(obj) \
-    OBJECT_GET_CLASS(ARMSSEClass, (obj), TYPE_ARMSSE)
+#define ARM_SSE_CLASS(klass) \
+    OBJECT_CLASS_CHECK(ARMSSEClass, (klass), TYPE_ARM_SSE)
+#define ARM_SSE_GET_CLASS(obj) \
+    OBJECT_GET_CLASS(ARMSSEClass, (obj), TYPE_ARM_SSE)
 
 #endif
hw/arm/armsse.c +12 -12
index dcbff9bd8f..6264eab16b 100644
@@ -167,7 +167,7 @@ static void irq_status_forwarder(void *opaque, int n, int level)
 
 static void nsccfg_handler(void *opaque, int n, int level)
 {
-    ARMSSE *s = ARMSSE(opaque);
+    ARMSSE *s = ARM_SSE(opaque);
 
     s->nsccfg = level;
 }
@@ -233,8 +233,8 @@ static void armsse_forward_sec_resp_cfg(ARMSSE *s)
 
 static void armsse_init(Object *obj)
 {
-    ARMSSE *s = ARMSSE(obj);
-    ARMSSEClass *asc = ARMSSE_GET_CLASS(obj);
+    ARMSSE *s = ARM_SSE(obj);
+    ARMSSEClass *asc = ARM_SSE_GET_CLASS(obj);
     const ARMSSEInfo *info = asc->info;
     int i;
 
@@ -391,7 +391,7 @@ static void armsse_exp_irq(void *opaque, int n, int level)
 
 static void armsse_mpcexp_status(void *opaque, int n, int level)
 {
-    ARMSSE *s = ARMSSE(opaque);
+    ARMSSE *s = ARM_SSE(opaque);
     qemu_set_irq(s->mpcexp_status_in[n], level);
 }
 
@@ -401,7 +401,7 @@ static qemu_irq armsse_get_common_irq_in(ARMSSE *s, int irqno)
      * Return a qemu_irq which can be used to signal IRQ n to
      * all CPUs in the SSE.
      */
-    ARMSSEClass *asc = ARMSSE_GET_CLASS(s);
+    ARMSSEClass *asc = ARM_SSE_GET_CLASS(s);
     const ARMSSEInfo *info = asc->info;
 
     assert(irq_is_common[irqno]);
@@ -428,8 +428,8 @@ static void map_ppu(ARMSSE *s, int ppuidx, const char *name, hwaddr addr)
 
 static void armsse_realize(DeviceState *dev, Error **errp)
 {
-    ARMSSE *s = ARMSSE(dev);
-    ARMSSEClass *asc = ARMSSE_GET_CLASS(dev);
+    ARMSSE *s = ARM_SSE(dev);
+    ARMSSEClass *asc = ARM_SSE_GET_CLASS(dev);
     const ARMSSEInfo *info = asc->info;
     int i;
     MemoryRegion *mr;
@@ -1114,7 +1114,7 @@ static void armsse_idau_check(IDAUInterface *ii, uint32_t address,
      * of the address bits. The NSC attribute is guest-adjustable via the
      * NSCCFG register in the security controller.
      */
-    ARMSSE *s = ARMSSE(ii);
+    ARMSSE *s = ARM_SSE(ii);
     int region = extract32(address, 28, 4);
 
     *ns = !(region & 1);
@@ -1136,7 +1136,7 @@ static const VMStateDescription armsse_vmstate = {
 
 static void armsse_reset(DeviceState *dev)
 {
-    ARMSSE *s = ARMSSE(dev);
+    ARMSSE *s = ARM_SSE(dev);
 
     s->nsccfg = 0;
 }
@@ -1145,7 +1145,7 @@ static void armsse_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
     IDAUInterfaceClass *iic = IDAU_INTERFACE_CLASS(klass);
-    ARMSSEClass *asc = ARMSSE_CLASS(klass);
+    ARMSSEClass *asc = ARM_SSE_CLASS(klass);
     const ARMSSEInfo *info = data;
 
     dc->realize = armsse_realize;
@@ -1157,7 +1157,7 @@ static void armsse_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo armsse_info = {
-    .name = TYPE_ARMSSE,
+    .name = TYPE_ARM_SSE,
     .parent = TYPE_SYS_BUS_DEVICE,
     .instance_size = sizeof(ARMSSE),
     .instance_init = armsse_init,
@@ -1177,7 +1177,7 @@ static void armsse_register_types(void)
     for (i = 0; i < ARRAY_SIZE(armsse_variants); i++) {
         TypeInfo ti = {
             .name = armsse_variants[i].name,
-            .parent = TYPE_ARMSSE,
+            .parent = TYPE_ARM_SSE,
             .class_init = armsse_class_init,
             .class_data = (void *)&armsse_variants[i],
         };
Signature · 1 line
2.26.2
Reviewed-by on v2 25/58
#42 lore raw

Re: [PATCH v2 25/58] armsse: Rename QOM macros to avoid conflicts

Quoted 10 lines · Eduardo Habkost

Rename TYPE_ARMSSE to TYPE_ARM_SSE, and ARMSSE*() type checking macros to ARM_SSE*().

This will avoid a future conflict between an ARM_SSE() type checking macro and the ARMSSE typedef name.

---
Changes series v1 -> v2: new patch in series v2

Quoted 7 lines
---
 include/hw/arm/armsse.h | 12 ++++++------
 hw/arm/armsse.c         | 24 ++++++++++++------------
 2 files changed, 18 insertions(+), 18 deletions(-)

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#43 lore raw

PATCH v2 26/58 xen-legacy-backend: Add missing typedef XenLegacyDevice

In reply to Eduardo Habkost

The typedef was used in the XENBACKEND_DEVICE macro, but it was never defined. Define the typedef close to the type checking macro.

---
Changes series v1 -> v2: new patch in series v2

---
Cc: Stefano Stabellini <[email protected]>
Cc: Anthony Perard <[email protected]>
Cc: Paul Durrant <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 include/hw/xen/xen-legacy-backend.h | 1 +
 1 file changed, 1 insertion(+)
include/hw/xen/xen-legacy-backend.h +1 -0
index 5e6c56c4d6..704bc7852b 100644
@@ -9,6 +9,7 @@
 #define TYPE_XENSYSBUS "xen-sysbus"
 #define TYPE_XENBACKEND "xen-backend"
 
+typedef struct XenLegacyDevice XenLegacyDevice;
 #define XENBACKEND_DEVICE(obj) \
     OBJECT_CHECK(XenLegacyDevice, (obj), TYPE_XENBACKEND)
 
Signature · 1 line
2.26.2
Reviewed-by on v2 26/58
#45 lore raw

Re: [PATCH v2 26/58] xen-legacy-backend: Add missing typedef XenLegacyDevice

In reply to Eduardo Habkost
Quoted 14 lines · Eduardo Habkost

The typedef was used in the XENBACKEND_DEVICE macro, but it was never defined. Define the typedef close to the type checking macro.

---
Changes series v1 -> v2: new patch in series v2

---
Cc: Stefano Stabellini <[email protected]>
Cc: Anthony Perard <[email protected]>
Cc: Paul Durrant <[email protected]>
Cc: [email protected]
Cc: [email protected]

Quoted 3 lines
---
 include/hw/xen/xen-legacy-backend.h | 1 +
 1 file changed, 1 insertion(+)

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#46 lore raw

PATCH v2 27/58 spapr: Move typedef SpaprMachineState to spapr.h

In reply to Eduardo Habkost

Move the typedef from spapr_irq.h to spapr.h, and use "struct SpaprMachineState" in the spapr_*.h headers (to avoid circular header dependencies).

This will make future conversion to OBJECT_DECLARE* easier.

---
Changes series v1 -> v2: new patch in series v2

Cc David Gibson <[email protected]>
Cc "Cédric Le Goater" <[email protected]>
---
 include/hw/ppc/spapr.h      |  1 +
 include/hw/ppc/spapr_irq.h  | 36 ++++++++++++++++++------------------
 include/hw/ppc/spapr_xive.h |  3 ++-
 3 files changed, 21 insertions(+), 19 deletions(-)
include/hw/ppc/spapr.h +1 -0
index 3134d339e8..a1e230ad39 100644
@@ -41,6 +41,7 @@ typedef struct SpaprDimmState SpaprDimmState;
 typedef struct SpaprMachineClass SpaprMachineClass;
 
 #define TYPE_SPAPR_MACHINE      "spapr-machine"
+typedef struct SpaprMachineState SpaprMachineState;
 #define SPAPR_MACHINE(obj) \
     OBJECT_CHECK(SpaprMachineState, (obj), TYPE_SPAPR_MACHINE)
 #define SPAPR_MACHINE_GET_CLASS(obj) \
include/hw/ppc/spapr_irq.h +18 -18
index ca8cb44213..b161ccebc2 100644
@@ -28,7 +28,7 @@
 
 #define SPAPR_NR_XIRQS       0x1000
 
-typedef struct SpaprMachineState SpaprMachineState;
+struct SpaprMachineState;
 
 typedef struct SpaprInterruptController SpaprInterruptController;
 
@@ -67,20 +67,20 @@ typedef struct SpaprInterruptControllerClass {
     int (*post_load)(SpaprInterruptController *intc, int version_id);
 } SpaprInterruptControllerClass;
 
-void spapr_irq_update_active_intc(SpaprMachineState *spapr);
+void spapr_irq_update_active_intc(struct SpaprMachineState *spapr);
 
-int spapr_irq_cpu_intc_create(SpaprMachineState *spapr,
+int spapr_irq_cpu_intc_create(struct SpaprMachineState *spapr,
                               PowerPCCPU *cpu, Error **errp);
-void spapr_irq_cpu_intc_reset(SpaprMachineState *spapr, PowerPCCPU *cpu);
-void spapr_irq_cpu_intc_destroy(SpaprMachineState *spapr, PowerPCCPU *cpu);
-void spapr_irq_print_info(SpaprMachineState *spapr, Monitor *mon);
-void spapr_irq_dt(SpaprMachineState *spapr, uint32_t nr_servers,
+void spapr_irq_cpu_intc_reset(struct SpaprMachineState *spapr, PowerPCCPU *cpu);
+void spapr_irq_cpu_intc_destroy(struct SpaprMachineState *spapr, PowerPCCPU *cpu);
+void spapr_irq_print_info(struct SpaprMachineState *spapr, Monitor *mon);
+void spapr_irq_dt(struct SpaprMachineState *spapr, uint32_t nr_servers,
                   void *fdt, uint32_t phandle);
 
-uint32_t spapr_irq_nr_msis(SpaprMachineState *spapr);
-int spapr_irq_msi_alloc(SpaprMachineState *spapr, uint32_t num, bool align,
+uint32_t spapr_irq_nr_msis(struct SpaprMachineState *spapr);
+int spapr_irq_msi_alloc(struct SpaprMachineState *spapr, uint32_t num, bool align,
                         Error **errp);
-void spapr_irq_msi_free(SpaprMachineState *spapr, int irq, uint32_t num);
+void spapr_irq_msi_free(struct SpaprMachineState *spapr, int irq, uint32_t num);
 
 typedef struct SpaprIrq {
     bool        xics;
@@ -92,13 +92,13 @@ extern SpaprIrq spapr_irq_xics_legacy;
 extern SpaprIrq spapr_irq_xive;
 extern SpaprIrq spapr_irq_dual;
 
-void spapr_irq_init(SpaprMachineState *spapr, Error **errp);
-int spapr_irq_claim(SpaprMachineState *spapr, int irq, bool lsi, Error **errp);
-void spapr_irq_free(SpaprMachineState *spapr, int irq, int num);
-qemu_irq spapr_qirq(SpaprMachineState *spapr, int irq);
-int spapr_irq_post_load(SpaprMachineState *spapr, int version_id);
-void spapr_irq_reset(SpaprMachineState *spapr, Error **errp);
-int spapr_irq_get_phandle(SpaprMachineState *spapr, void *fdt, Error **errp);
+void spapr_irq_init(struct SpaprMachineState *spapr, Error **errp);
+int spapr_irq_claim(struct SpaprMachineState *spapr, int irq, bool lsi, Error **errp);
+void spapr_irq_free(struct SpaprMachineState *spapr, int irq, int num);
+qemu_irq spapr_qirq(struct SpaprMachineState *spapr, int irq);
+int spapr_irq_post_load(struct SpaprMachineState *spapr, int version_id);
+void spapr_irq_reset(struct SpaprMachineState *spapr, Error **errp);
+int spapr_irq_get_phandle(struct SpaprMachineState *spapr, void *fdt, Error **errp);
 
 typedef int (*SpaprInterruptControllerInitKvm)(SpaprInterruptController *,
                                                uint32_t, Error **);
@@ -111,7 +111,7 @@ int spapr_irq_init_kvm(SpaprInterruptControllerInitKvm fn,
 /*
  * XICS legacy routines
  */
-int spapr_irq_find(SpaprMachineState *spapr, int num, bool align, Error **errp);
+int spapr_irq_find(struct SpaprMachineState *spapr, int num, bool align, Error **errp);
 #define spapr_irq_findone(spapr, errp) spapr_irq_find(spapr, 1, false, errp)
 
 #endif
include/hw/ppc/spapr_xive.h +2 -1
index 93d09d68de..85f124506d 100644
@@ -66,7 +66,8 @@ typedef struct SpaprXiveClass {
 
 void spapr_xive_pic_print_info(SpaprXive *xive, Monitor *mon);
 
-void spapr_xive_hcall_init(SpaprMachineState *spapr);
+struct SpaprMachineState;
+void spapr_xive_hcall_init(struct SpaprMachineState *spapr);
 void spapr_xive_mmio_set_enabled(SpaprXive *xive, bool enable);
 void spapr_xive_map_mmio(SpaprXive *xive);
 
Signature · 1 line
2.26.2
Reviewed-by on v2 27/58
#47 lore raw

Re: [PATCH v2 27/58] spapr: Move typedef SpaprMachineState to spapr.h

Quoted 14 lines · Eduardo Habkost

Move the typedef from spapr_irq.h to spapr.h, and use "struct SpaprMachineState" in the spapr_*.h headers (to avoid circular header dependencies).

This will make future conversion to OBJECT_DECLARE* easier.

---
Changes series v1 -> v2: new patch in series v2

Cc David Gibson <[email protected]>
Cc "Cédric Le Goater" <[email protected]>
Quoted 5 lines
---
 include/hw/ppc/spapr.h      |  1 +
 include/hw/ppc/spapr_irq.h  | 36 ++++++++++++++++++------------------
 include/hw/ppc/spapr_xive.h |  3 ++-
 3 files changed, 21 insertions(+), 19 deletions(-)

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#48 lore raw

PATCH v2 28/58 s390x: Move typedef SCLPEventFacility to event-facility.h

In reply to Eduardo Habkost

This will make future conversion to OBJECT_DECLARE* easier.

In sclp.h, use "struct SCLPEventFacility" to avoid introducing unnecessary header dependencies.

---
Changes series v1 -> v2: new patch in series v2

Cc Cornelia Huck <[email protected]>
Cc Halil Pasic <[email protected]>
Cc Christian Borntraeger <[email protected]>
Cc Thomas Huth <[email protected]>
---
 include/hw/s390x/event-facility.h | 1 +
 include/hw/s390x/sclp.h           | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)
include/hw/s390x/event-facility.h +1 -0
index 700a610f33..e61c4651d7 100644
@@ -195,6 +195,7 @@ typedef struct SCLPEventClass {
 } SCLPEventClass;
 
 #define TYPE_SCLP_EVENT_FACILITY "s390-sclp-event-facility"
+typedef struct SCLPEventFacility SCLPEventFacility;
 #define EVENT_FACILITY(obj) \
      OBJECT_CHECK(SCLPEventFacility, (obj), TYPE_SCLP_EVENT_FACILITY)
 #define EVENT_FACILITY_CLASS(klass) \
include/hw/s390x/sclp.h +2 -2
index 822eff4396..a87ed2a0ab 100644
@@ -185,12 +185,12 @@ typedef struct SCCB {
 #define SCLP_CLASS(oc) OBJECT_CLASS_CHECK(SCLPDeviceClass, (oc), TYPE_SCLP)
 #define SCLP_GET_CLASS(obj) OBJECT_GET_CLASS(SCLPDeviceClass, (obj), TYPE_SCLP)
 
-typedef struct SCLPEventFacility SCLPEventFacility;
+struct SCLPEventFacility;
 
 typedef struct SCLPDevice {
     /* private */
     DeviceState parent_obj;
-    SCLPEventFacility *event_facility;
+    struct SCLPEventFacility *event_facility;
     int increment_size;
 
     /* public */
Signature · 1 line
2.26.2
Acked-by on v2 28/58
#49 lore raw

Re: [PATCH v2 28/58] s390x: Move typedef SCLPEventFacility to event-facility.h

Quoted 15 lines · On Wed, 19 Aug 2020 20:12:06 -0400 Eduardo Habkost <[email protected]> wrote:

This will make future conversion to OBJECT_DECLARE* easier.

In sclp.h, use "struct SCLPEventFacility" to avoid introducing unnecessary header dependencies.

---
Changes series v1 -> v2: new patch in series v2

Cc Cornelia Huck <[email protected]>
Cc Halil Pasic <[email protected]>
Cc Christian Borntraeger <[email protected]>
Cc Thomas Huth <[email protected]>
Quoted 4 lines
---
 include/hw/s390x/event-facility.h | 1 +
 include/hw/s390x/sclp.h           | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)
Reviewed-by on v2 28/58
#50 lore raw

Re: [PATCH v2 28/58] s390x: Move typedef SCLPEventFacility to event-facility.h

In reply to Eduardo Habkost
Quoted 15 lines · Eduardo Habkost

This will make future conversion to OBJECT_DECLARE* easier.

In sclp.h, use "struct SCLPEventFacility" to avoid introducing unnecessary header dependencies.

---
Changes series v1 -> v2: new patch in series v2

Cc Cornelia Huck <[email protected]>
Cc Halil Pasic <[email protected]>
Cc Christian Borntraeger <[email protected]>
Cc Thomas Huth <[email protected]>
Quoted 4 lines
---
 include/hw/s390x/event-facility.h | 1 +
 include/hw/s390x/sclp.h           | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#51 lore raw

PATCH v2 29/58 vhost-user-gpu: Move QOM macro to header

In reply to Eduardo Habkost

Move the VHOST_USER_GPU type checking macro to virtio-gpu.h, close to the TYPE_VHOST_USER_GPU #define.

This will make future conversion to OBJECT_DECLARE* easier.

---
Changes series v1 -> v2: new patch in series v2

Cc "Michael S. Tsirkin" <[email protected]>
Cc "Marc-André Lureau" <[email protected]>
Cc Gerd Hoffmann <[email protected]>
---
 include/hw/virtio/virtio-gpu.h | 2 ++
 hw/display/vhost-user-gpu.c    | 3 ---
 2 files changed, 2 insertions(+), 3 deletions(-)
include/hw/virtio/virtio-gpu.h +2 -0
index 6dd57f2025..7517438e10 100644
@@ -36,6 +36,8 @@
         OBJECT_CHECK(VirtIOGPU, (obj), TYPE_VIRTIO_GPU)
 
 #define TYPE_VHOST_USER_GPU "vhost-user-gpu"
+#define VHOST_USER_GPU(obj)                                    \
+    OBJECT_CHECK(VhostUserGPU, (obj), TYPE_VHOST_USER_GPU)
 
 #define VIRTIO_ID_GPU 16
 
hw/display/vhost-user-gpu.c +0 -3
index 4cdaee1bde..51f1747c4a 100644
@@ -17,9 +17,6 @@
 #include "qapi/error.h"
 #include "migration/blocker.h"
 
-#define VHOST_USER_GPU(obj)                                    \
-    OBJECT_CHECK(VhostUserGPU, (obj), TYPE_VHOST_USER_GPU)
-
 typedef enum VhostUserGpuRequest {
     VHOST_USER_GPU_NONE = 0,
     VHOST_USER_GPU_GET_PROTOCOL_FEATURES,
Signature · 1 line
2.26.2
Reviewed-by on v2 29/58
#53 lore raw

Re: [PATCH v2 29/58] vhost-user-gpu: Move QOM macro to header

In reply to Eduardo Habkost
Quoted 9 lines · Eduardo Habkost

Move the VHOST_USER_GPU type checking macro to virtio-gpu.h, close to the TYPE_VHOST_USER_GPU #define.

This will make future conversion to OBJECT_DECLARE* easier.

---
Changes series v1 -> v2: new patch in series v2

Quoted 8 lines
Cc "Michael S. Tsirkin" <[email protected]>
Cc "Marc-André Lureau" <[email protected]>
Cc Gerd Hoffmann <[email protected]>
---
 include/hw/virtio/virtio-gpu.h | 2 ++
 hw/display/vhost-user-gpu.c    | 3 ---
 2 files changed, 2 insertions(+), 3 deletions(-)

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#54 lore raw

PATCH v2 30/58 ahci: Move QOM macros to header

In reply to Eduardo Habkost

The TYPE_* constants and the typedefs are defined in ahci.h, so we can move the type checking macros there too.

This will make future conversion to OBJECT_DECLARE* easier.

---
Changes series v1 -> v2: new patch in series v2

---
 hw/ide/ahci_internal.h | 5 -----
 include/hw/ide/ahci.h  | 3 +++
 2 files changed, 3 insertions(+), 5 deletions(-)
hw/ide/ahci_internal.h +0 -5
index bab0459774..ac9bdead7b 100644
@@ -332,9 +332,6 @@ struct AHCIPCIState {
     AHCIState ahci;
 };
 
-#define ICH_AHCI(obj) \
-    OBJECT_CHECK(AHCIPCIState, (obj), TYPE_ICH9_AHCI)
-
 extern const VMStateDescription vmstate_ahci;
 
 #define VMSTATE_AHCI(_field, _state) {                               \
@@ -394,6 +391,4 @@ void ahci_uninit(AHCIState *s);
 
 void ahci_reset(AHCIState *s);
 
-#define SYSBUS_AHCI(obj) OBJECT_CHECK(SysbusAHCIState, (obj), TYPE_SYSBUS_AHCI)
-
 #endif /* HW_IDE_AHCI_INTERNAL_H */
include/hw/ide/ahci.h +3 -0
index b44e3000cf..ce2bf8a5f8 100644
@@ -53,11 +53,14 @@ typedef struct AHCIState {
 typedef struct AHCIPCIState AHCIPCIState;
 
 #define TYPE_ICH9_AHCI "ich9-ahci"
+#define ICH_AHCI(obj) \
+    OBJECT_CHECK(AHCIPCIState, (obj), TYPE_ICH9_AHCI)
 
 int32_t ahci_get_num_ports(PCIDevice *dev);
 void ahci_ide_create_devs(PCIDevice *dev, DriveInfo **hd);
 
 #define TYPE_SYSBUS_AHCI "sysbus-ahci"
+#define SYSBUS_AHCI(obj) OBJECT_CHECK(SysbusAHCIState, (obj), TYPE_SYSBUS_AHCI)
 
 typedef struct SysbusAHCIState {
     /*< private >*/
Signature · 1 line
2.26.2
Reviewed-by on v2 30/58
#55 lore raw

Re: [PATCH v2 30/58] ahci: Move QOM macros to header

Quoted 9 lines · Eduardo Habkost

The TYPE_* constants and the typedefs are defined in ahci.h, so we can move the type checking macros there too.

This will make future conversion to OBJECT_DECLARE* easier.

---
Changes series v1 -> v2: new patch in series v2

Quoted 7 lines
---
 hw/ide/ahci_internal.h | 5 -----
 include/hw/ide/ahci.h  | 3 +++
 2 files changed, 3 insertions(+), 5 deletions(-)

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#56 lore raw

PATCH v2 31/58 i8257: Move QOM macro to header

In reply to Eduardo Habkost

Move the I8257 macro to i8257.h, close to the TYPE_I8257 define.

This will make future conversion to OBJECT_DECLARE* easier.

---
Changes series v1 -> v2: new patch in series v2

Cc "Michael S. Tsirkin" <[email protected]>
Cc Paolo Bonzini <[email protected]>
---
 include/hw/dma/i8257.h | 2 ++
 hw/dma/i8257.c         | 2 --
 2 files changed, 2 insertions(+), 2 deletions(-)
include/hw/dma/i8257.h +2 -0
index 03e2c166be..ee06371699 100644
@@ -5,6 +5,8 @@
 #include "exec/ioport.h"
 
 #define TYPE_I8257 "i8257"
+#define I8257(obj) \
+    OBJECT_CHECK(I8257State, (obj), TYPE_I8257)
 
 typedef struct I8257Regs {
     int now[2];
hw/dma/i8257.c +0 -2
index db808029b0..de5f696919 100644
@@ -33,8 +33,6 @@
 #include "qemu/log.h"
 #include "trace.h"
 
-#define I8257(obj) \
-    OBJECT_CHECK(I8257State, (obj), TYPE_I8257)
 
 /* #define DEBUG_DMA */
 
Signature · 1 line
2.26.2
Reviewed-by on v2 31/58
#57 lore raw

Re: [PATCH v2 31/58] i8257: Move QOM macro to header

Quoted 8 lines · Eduardo Habkost

Move the I8257 macro to i8257.h, close to the TYPE_I8257 define.

This will make future conversion to OBJECT_DECLARE* easier.

---
Changes series v1 -> v2: new patch in series v2

Quoted 7 lines
Cc "Michael S. Tsirkin" <[email protected]>
Cc Paolo Bonzini <[email protected]>
---
 include/hw/dma/i8257.h | 2 ++
 hw/dma/i8257.c         | 2 --
 2 files changed, 2 insertions(+), 2 deletions(-)

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#58 lore raw

PATCH v2 32/58 ahci: Move QOM macro to header

In reply to Eduardo Habkost

Move the ALLWINNER_AHCI macro close to the TYPE_ALLWINNER_AHCI define.

This will make future conversion to OBJECT_DECLARE* easier.

---
Changes series v1 -> v2: new patch in series v2

---
 include/hw/ide/ahci.h   | 2 ++
 hw/ide/ahci-allwinner.c | 3 ---
 2 files changed, 2 insertions(+), 3 deletions(-)
include/hw/ide/ahci.h +2 -0
index ce2bf8a5f8..41bb517047 100644
@@ -72,6 +72,8 @@ typedef struct SysbusAHCIState {
 } SysbusAHCIState;
 
 #define TYPE_ALLWINNER_AHCI "allwinner-ahci"
+#define ALLWINNER_AHCI(obj) \
+        OBJECT_CHECK(AllwinnerAHCIState, (obj), TYPE_ALLWINNER_AHCI)
 
 #define ALLWINNER_AHCI_MMIO_OFF  0x80
 #define ALLWINNER_AHCI_MMIO_SIZE 0x80
hw/ide/ahci-allwinner.c +0 -3
index 8536b9eb5a..227e747ba7 100644
@@ -25,9 +25,6 @@
 
 #include "trace.h"
 
-#define ALLWINNER_AHCI(obj) \
-        OBJECT_CHECK(AllwinnerAHCIState, (obj), TYPE_ALLWINNER_AHCI)
-
 #define ALLWINNER_AHCI_BISTAFR    ((0xa0 - ALLWINNER_AHCI_MMIO_OFF) / 4)
 #define ALLWINNER_AHCI_BISTCR     ((0xa4 - ALLWINNER_AHCI_MMIO_OFF) / 4)
 #define ALLWINNER_AHCI_BISTFCTR   ((0xa8 - ALLWINNER_AHCI_MMIO_OFF) / 4)
Signature · 1 line
2.26.2
Reviewed-by on v2 32/58
#59 lore raw

Re: [PATCH v2 32/58] ahci: Move QOM macro to header

Quoted 9 lines · Eduardo Habkost

Move the ALLWINNER_AHCI macro close to the TYPE_ALLWINNER_AHCI define.

This will make future conversion to OBJECT_DECLARE* easier.

---
Changes series v1 -> v2: new patch in series v2

Quoted 7 lines
---
 include/hw/ide/ahci.h   | 2 ++
 hw/ide/ahci-allwinner.c | 3 ---
 2 files changed, 2 insertions(+), 3 deletions(-)

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#60 lore raw

PATCH v2 33/58 pckbd: Move QOM macro to header

In reply to Eduardo Habkost

Move the I8042 macro close to the TYPE_I8042 define.

This will make future conversion to OBJECT_DECLARE* easier.

---
Changes series v1 -> v2: new patch in series v2

Cc "Michael S. Tsirkin" <[email protected]>
Cc Paolo Bonzini <[email protected]>
---
 include/hw/input/i8042.h | 1 +
 hw/input/pckbd.c         | 2 --
 2 files changed, 1 insertion(+), 2 deletions(-)
include/hw/input/i8042.h +1 -0
index 8eaebf50ce..4569dfddd9 100644
@@ -11,6 +11,7 @@
 #include "hw/isa/isa.h"
 
 #define TYPE_I8042 "i8042"
+#define I8042(obj) OBJECT_CHECK(ISAKBDState, (obj), TYPE_I8042)
 
 #define I8042_A20_LINE "a20"
 
hw/input/pckbd.c +0 -2
index 29d633ca94..dde85ba6c6 100644
@@ -481,8 +481,6 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq,
     qemu_register_reset(kbd_reset, s);
 }
 
-#define I8042(obj) OBJECT_CHECK(ISAKBDState, (obj), TYPE_I8042)
-
 struct ISAKBDState {
     ISADevice parent_obj;
 
Signature · 1 line
2.26.2
Reviewed-by on v2 33/58
#61 lore raw

Re: [PATCH v2 33/58] pckbd: Move QOM macro to header

Quoted 8 lines · Eduardo Habkost

Move the I8042 macro close to the TYPE_I8042 define.

This will make future conversion to OBJECT_DECLARE* easier.

---
Changes series v1 -> v2: new patch in series v2

Quoted 7 lines
Cc "Michael S. Tsirkin" <[email protected]>
Cc Paolo Bonzini <[email protected]>
---
 include/hw/input/i8042.h | 1 +
 hw/input/pckbd.c         | 2 --
 2 files changed, 1 insertion(+), 2 deletions(-)

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#62 lore raw

PATCH v2 34/58 vmbus: Move QOM macros to vmbus.h

In reply to Eduardo Habkost

Move all declarations related to TYPE_VMBUS to the same place in vmbus.h.

This will make future conversion to OBJECT_DECLARE* easier.

---
Changes series v1 -> v2: new patch in series v2

---
 include/hw/hyperv/vmbus-bridge.h | 3 +--
 include/hw/hyperv/vmbus.h        | 4 ++++
 hw/hyperv/vmbus.c                | 3 ---
 3 files changed, 5 insertions(+), 5 deletions(-)
include/hw/hyperv/vmbus-bridge.h +1 -2
index 33f93de64d..fe90bda01b 100644
@@ -11,11 +11,10 @@
 #define HW_HYPERV_VMBUS_BRIDGE_H
 
 #include "hw/sysbus.h"
+#include "hw/hyperv/vmbus.h"
 
 #define TYPE_VMBUS_BRIDGE "vmbus-bridge"
 
-typedef struct VMBus VMBus;
-
 typedef struct VMBusBridge {
     SysBusDevice parent_obj;
 
include/hw/hyperv/vmbus.h +4 -0
index 40e8417eec..cd98ec24e7 100644
@@ -26,6 +26,10 @@
 #define VMBUS_DEVICE_GET_CLASS(obj) \
     OBJECT_GET_CLASS(VMBusDeviceClass, (obj), TYPE_VMBUS_DEVICE)
 
+#define TYPE_VMBUS "vmbus"
+typedef struct VMBus VMBus;
+#define VMBUS(obj) OBJECT_CHECK(VMBus, (obj), TYPE_VMBUS)
+
 /*
  * Object wrapping a GPADL -- GPA Descriptor List -- an array of guest physical
  * pages, to be used for various buffers shared between the host and the guest.
hw/hyperv/vmbus.c +0 -3
index 34392e892a..75af6b83dd 100644
@@ -20,9 +20,6 @@
 #include "cpu.h"
 #include "trace.h"
 
-#define TYPE_VMBUS "vmbus"
-#define VMBUS(obj) OBJECT_CHECK(VMBus, (obj), TYPE_VMBUS)
-
 enum {
     VMGPADL_INIT,
     VMGPADL_ALIVE,
Signature · 1 line
2.26.2
Reviewed-by on v2 34/58
#63 lore raw

Re: [PATCH v2 34/58] vmbus: Move QOM macros to vmbus.h

Quoted 9 lines · Eduardo Habkost

Move all declarations related to TYPE_VMBUS to the same place in vmbus.h.

This will make future conversion to OBJECT_DECLARE* easier.

---
Changes series v1 -> v2: new patch in series v2

Quoted 6 lines
---
 include/hw/hyperv/vmbus-bridge.h | 3 +--
 include/hw/hyperv/vmbus.h        | 4 ++++
 hw/hyperv/vmbus.c                | 3 ---
 3 files changed, 5 insertions(+), 5 deletions(-)

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#64 lore raw

PATCH v2 35/58 virtio-serial-bus: Move QOM macros to header

In reply to Eduardo Habkost

This will make future conversion to OBJECT_DECLARE* easier.

---
Changes series v1 -> v2: new patch in series v2

Cc Laurent Vivier <[email protected]>
Cc Amit Shah <[email protected]>
Cc "Michael S. Tsirkin" <[email protected]>
Cc "Marc-André Lureau" <[email protected]>
Cc Paolo Bonzini <[email protected]>
---
 include/hw/virtio/virtio-serial.h | 5 +++++
 hw/char/virtio-serial-bus.c       | 4 ----
 2 files changed, 5 insertions(+), 4 deletions(-)
include/hw/virtio/virtio-serial.h +5 -0
index ed3e916b68..448615a6b3 100644
@@ -33,7 +33,12 @@ struct virtio_serial_conf {
      OBJECT_GET_CLASS(VirtIOSerialPortClass, (obj), TYPE_VIRTIO_SERIAL_PORT)
 
 typedef struct VirtIOSerial VirtIOSerial;
+
+#define TYPE_VIRTIO_SERIAL_BUS "virtio-serial-bus"
 typedef struct VirtIOSerialBus VirtIOSerialBus;
+#define VIRTIO_SERIAL_BUS(obj) \
+      OBJECT_CHECK(VirtIOSerialBus, (obj), TYPE_VIRTIO_SERIAL_BUS)
+
 typedef struct VirtIOSerialPort VirtIOSerialPort;
 
 typedef struct VirtIOSerialPortClass {
hw/char/virtio-serial-bus.c +0 -4
index f9a4428bd6..cf08ef9728 100644
@@ -843,10 +843,6 @@ static Property virtser_props[] = {
     DEFINE_PROP_END_OF_LIST()
 };
 
-#define TYPE_VIRTIO_SERIAL_BUS "virtio-serial-bus"
-#define VIRTIO_SERIAL_BUS(obj) \
-      OBJECT_CHECK(VirtIOSerialBus, (obj), TYPE_VIRTIO_SERIAL_BUS)
-
 static void virtser_bus_class_init(ObjectClass *klass, void *data)
 {
     BusClass *k = BUS_CLASS(klass);
Signature · 1 line
2.26.2
Reviewed-by on v2 35/58
#65 lore raw

Re: [PATCH v2 35/58] virtio-serial-bus: Move QOM macros to header

Quoted 12 lines · Eduardo Habkost

This will make future conversion to OBJECT_DECLARE* easier.

---
Changes series v1 -> v2: new patch in series v2

Cc Laurent Vivier <[email protected]>
Cc Amit Shah <[email protected]>
Cc "Michael S. Tsirkin" <[email protected]>
Cc "Marc-André Lureau" <[email protected]>
Cc Paolo Bonzini <[email protected]>
Quoted 4 lines
---
 include/hw/virtio/virtio-serial.h | 5 +++++
 hw/char/virtio-serial-bus.c       | 4 ----
 2 files changed, 5 insertions(+), 4 deletions(-)

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#66 lore raw

PATCH v2 36/58 piix: Move QOM macros to header

In reply to Eduardo Habkost

This will make future conversion to OBJECT_DECLARE* easier.

---
Changes series v1 -> v2: new patch in series v2

Cc "Michael S. Tsirkin" <[email protected]>
Cc Marcel Apfelbaum <[email protected]>
Cc "Hervé Poussineau" <[email protected]>
Cc "Philippe Mathieu-Daudé" <[email protected]>
Cc Aleksandar Markovic <[email protected]>
Cc Aurelien Jarno <[email protected]>
---
 include/hw/southbridge/piix.h | 4 ++++
 hw/isa/piix3.c                | 4 ----
 2 files changed, 4 insertions(+), 4 deletions(-)
include/hw/southbridge/piix.h +4 -0
index 02bd741209..ac1d04ddc2 100644
@@ -64,6 +64,10 @@ typedef struct PIIXState {
     MemoryRegion rcr_mem;
 } PIIX3State;
 
+#define TYPE_PIIX3_PCI_DEVICE "pci-piix3"
+#define PIIX3_PCI_DEVICE(obj) \
+    OBJECT_CHECK(PIIX3State, (obj), TYPE_PIIX3_PCI_DEVICE)
+
 extern PCIDevice *piix4_dev;
 
 PIIX3State *piix3_create(PCIBus *pci_bus, ISABus **isa_bus);
hw/isa/piix3.c +0 -4
index 1a5267e19f..587850b888 100644
@@ -36,10 +36,6 @@
 
 #define XEN_PIIX_NUM_PIRQS      128ULL
 
-#define TYPE_PIIX3_PCI_DEVICE "pci-piix3"
-#define PIIX3_PCI_DEVICE(obj) \
-    OBJECT_CHECK(PIIX3State, (obj), TYPE_PIIX3_PCI_DEVICE)
-
 #define TYPE_PIIX3_DEVICE "PIIX3"
 #define TYPE_PIIX3_XEN_DEVICE "PIIX3-xen"
 
Signature · 1 line
2.26.2
Reviewed-by on v2 36/58
#67 lore raw

Re: [PATCH v2 36/58] piix: Move QOM macros to header

Quoted 13 lines · Eduardo Habkost

This will make future conversion to OBJECT_DECLARE* easier.

---
Changes series v1 -> v2: new patch in series v2

Cc "Michael S. Tsirkin" <[email protected]>
Cc Marcel Apfelbaum <[email protected]>
Cc "Hervé Poussineau" <[email protected]>
Cc "Philippe Mathieu-Daudé" <[email protected]>
Cc Aleksandar Markovic <[email protected]>
Cc Aurelien Jarno <[email protected]>
Quoted 4 lines
---
 include/hw/southbridge/piix.h | 4 ++++
 hw/isa/piix3.c                | 4 ----
 2 files changed, 4 insertions(+), 4 deletions(-)
Reviewed-by on v2 36/58
#68 lore raw

Re: [PATCH v2 36/58] piix: Move QOM macros to header

In reply to Eduardo Habkost
Quoted 13 lines · Eduardo Habkost

This will make future conversion to OBJECT_DECLARE* easier.

---
Changes series v1 -> v2: new patch in series v2

Cc "Michael S. Tsirkin" <[email protected]>
Cc Marcel Apfelbaum <[email protected]>
Cc "Hervé Poussineau" <[email protected]>
Cc "Philippe Mathieu-Daudé" <[email protected]>
Cc Aleksandar Markovic <[email protected]>
Cc Aurelien Jarno <[email protected]>
Quoted 4 lines
---
 include/hw/southbridge/piix.h | 4 ++++
 hw/isa/piix3.c                | 4 ----
 2 files changed, 4 insertions(+), 4 deletions(-)

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#69 lore raw

PATCH v2 37/58 auxbus: Move QOM macros to header

In reply to Eduardo Habkost

This will make future conversion to OBJECT_DECLARE* easier.

---
Changes series v1 -> v2: new patch in series v2

---
 include/hw/misc/auxbus.h | 3 +++
 hw/misc/auxbus.c         | 2 --
 2 files changed, 3 insertions(+), 2 deletions(-)
include/hw/misc/auxbus.h +3 -0
index 15a8973517..041edfc9e9 100644
@@ -32,7 +32,10 @@ typedef struct AUXBus AUXBus;
 typedef struct AUXSlave AUXSlave;
 typedef enum AUXCommand AUXCommand;
 typedef enum AUXReply AUXReply;
+
+#define TYPE_AUXTOI2C "aux-to-i2c-bridge"
 typedef struct AUXTOI2CState AUXTOI2CState;
+#define AUXTOI2C(obj) OBJECT_CHECK(AUXTOI2CState, (obj), TYPE_AUXTOI2C)
 
 enum AUXCommand {
     WRITE_I2C = 0,
hw/misc/auxbus.c +0 -2
index da361baa32..6c099ae2a2 100644
@@ -45,8 +45,6 @@
     }                                                                          \
 } while (0)
 
-#define TYPE_AUXTOI2C "aux-to-i2c-bridge"
-#define AUXTOI2C(obj) OBJECT_CHECK(AUXTOI2CState, (obj), TYPE_AUXTOI2C)
 
 static void aux_slave_dev_print(Monitor *mon, DeviceState *dev, int indent);
 static inline I2CBus *aux_bridge_get_i2c_bus(AUXTOI2CState *bridge);
Signature · 1 line
2.26.2
Reviewed-by on v2 37/58
#70 lore raw

Re: [PATCH v2 37/58] auxbus: Move QOM macros to header

Quoted 11 lines · Eduardo Habkost

This will make future conversion to OBJECT_DECLARE* easier.

---
Changes series v1 -> v2: new patch in series v2

---
 include/hw/misc/auxbus.h | 3 +++
 hw/misc/auxbus.c         | 2 --
 2 files changed, 3 insertions(+), 2 deletions(-)

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#71 lore raw

PATCH v2 38/58 rocker: Move QOM macros to header

In reply to Eduardo Habkost

This will make future conversion to OBJECT_DECLARE* easier.

---
Changes series v1 -> v2: new patch in series v2

---
 hw/net/rocker/rocker.h | 6 +++++-
 hw/net/rocker/rocker.c | 5 -----
 2 files changed, 5 insertions(+), 6 deletions(-)
hw/net/rocker/rocker.h +5 -1
index 7ae0495d9e..e4c22db4ff 100644
@@ -66,11 +66,15 @@ static inline bool ipv6_addr_is_multicast(const Ipv6Addr *addr)
     return (addr->addr32[0] & htonl(0xFF000000)) == htonl(0xFF000000);
 }
 
-typedef struct rocker Rocker;
 typedef struct world World;
 typedef struct desc_info DescInfo;
 typedef struct desc_ring DescRing;
 
+#define TYPE_ROCKER "rocker"
+typedef struct rocker Rocker;
+#define ROCKER(obj) \
+    OBJECT_CHECK(Rocker, (obj), TYPE_ROCKER)
+
 Rocker *rocker_find(const char *name);
 uint32_t rocker_fp_ports(Rocker *r);
 int rocker_event_link_changed(Rocker *r, uint32_t pport, bool link_up);
hw/net/rocker/rocker.c +0 -5
index 15d66f6cbc..1af1e6fa2f 100644
@@ -73,11 +73,6 @@ struct rocker {
     QLIST_ENTRY(rocker) next;
 };
 
-#define TYPE_ROCKER "rocker"
-
-#define ROCKER(obj) \
-    OBJECT_CHECK(Rocker, (obj), TYPE_ROCKER)
-
 static QLIST_HEAD(, rocker) rockers;
 
 Rocker *rocker_find(const char *name)
Signature · 1 line
2.26.2
Reviewed-by on v2 38/58
#72 lore raw

Re: [PATCH v2 38/58] rocker: Move QOM macros to header

Quoted 6 lines · Eduardo Habkost

This will make future conversion to OBJECT_DECLARE* easier.

---
Changes series v1 -> v2: new patch in series v2

Quoted 7 lines
---
 hw/net/rocker/rocker.h | 6 +++++-
 hw/net/rocker/rocker.c | 5 -----
 2 files changed, 5 insertions(+), 6 deletions(-)

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#73 lore raw

PATCH v2 39/58 pxa2xx: Move QOM macros to header

In reply to Eduardo Habkost

This will make future conversion to OBJECT_DECLARE* easier.

---
Changes series v1 -> v2: new patch in series v2

Cc Andrzej Zaborowski <[email protected]>
Cc Peter Maydell <[email protected]>
---
 include/hw/arm/pxa.h | 13 +++++++++++++
 hw/arm/pxa2xx.c      |  7 -------
 hw/pcmcia/pxa2xx.c   |  4 ----
 hw/sd/pxa2xx_mmci.c  |  3 ---
 4 files changed, 13 insertions(+), 14 deletions(-)
include/hw/arm/pxa.h +13 -0
index 8843e5f910..f6359fe7c9 100644
@@ -86,7 +86,10 @@ PXA2xxLCDState *pxa2xx_lcdc_init(MemoryRegion *sysmem,
 void pxa2xx_lcd_vsync_notifier(PXA2xxLCDState *s, qemu_irq handler);
 
 /* pxa2xx_mmci.c */
+#define TYPE_PXA2XX_MMCI "pxa2xx-mmci"
 typedef struct PXA2xxMMCIState PXA2xxMMCIState;
+#define PXA2XX_MMCI(obj) OBJECT_CHECK(PXA2xxMMCIState, (obj), TYPE_PXA2XX_MMCI)
+
 PXA2xxMMCIState *pxa2xx_mmci_init(MemoryRegion *sysmem,
                 hwaddr base,
                 BlockBackend *blk, qemu_irq irq,
@@ -95,7 +98,11 @@ void pxa2xx_mmci_handlers(PXA2xxMMCIState *s, qemu_irq readonly,
                 qemu_irq coverswitch);
 
 /* pxa2xx_pcmcia.c */
+#define TYPE_PXA2XX_PCMCIA "pxa2xx-pcmcia"
 typedef struct PXA2xxPCMCIAState PXA2xxPCMCIAState;
+#define PXA2XX_PCMCIA(obj) \
+    OBJECT_CHECK(PXA2xxPCMCIAState, obj, TYPE_PXA2XX_PCMCIA)
+
 PXA2xxPCMCIAState *pxa2xx_pcmcia_init(MemoryRegion *sysmem,
                                       hwaddr base);
 int pxa2xx_pcmcia_attach(void *opaque, PCMCIACardState *card);
@@ -120,8 +127,14 @@ PXA2xxI2CState *pxa2xx_i2c_init(hwaddr base,
                 qemu_irq irq, uint32_t page_size);
 I2CBus *pxa2xx_i2c_bus(PXA2xxI2CState *s);
 
+#define TYPE_PXA2XX_I2C "pxa2xx_i2c"
 typedef struct PXA2xxI2SState PXA2xxI2SState;
+#define PXA2XX_I2C(obj) \
+    OBJECT_CHECK(PXA2xxI2CState, (obj), TYPE_PXA2XX_I2C)
+
+#define TYPE_PXA2XX_FIR "pxa2xx-fir"
 typedef struct PXA2xxFIrState PXA2xxFIrState;
+#define PXA2XX_FIR(obj) OBJECT_CHECK(PXA2xxFIrState, (obj), TYPE_PXA2XX_FIR)
 
 typedef struct {
     ARMCPU *cpu;
hw/arm/pxa2xx.c +0 -7
index 6203c4cfe0..037d415498 100644
@@ -1250,10 +1250,6 @@ typedef struct PXA2xxI2CSlaveState {
     PXA2xxI2CState *host;
 } PXA2xxI2CSlaveState;
 
-#define TYPE_PXA2XX_I2C "pxa2xx_i2c"
-#define PXA2XX_I2C(obj) \
-    OBJECT_CHECK(PXA2xxI2CState, (obj), TYPE_PXA2XX_I2C)
-
 struct PXA2xxI2CState {
     /*< private >*/
     SysBusDevice parent_obj;
@@ -1786,9 +1782,6 @@ static PXA2xxI2SState *pxa2xx_i2s_init(MemoryRegion *sysmem,
 }
 
 /* PXA Fast Infra-red Communications Port */
-#define TYPE_PXA2XX_FIR "pxa2xx-fir"
-#define PXA2XX_FIR(obj) OBJECT_CHECK(PXA2xxFIrState, (obj), TYPE_PXA2XX_FIR)
-
 struct PXA2xxFIrState {
     /*< private >*/
     SysBusDevice parent_obj;
hw/pcmcia/pxa2xx.c +0 -4
index 5f4bf22a90..fcca7e571b 100644
@@ -18,10 +18,6 @@
 #include "hw/pcmcia.h"
 #include "hw/arm/pxa.h"
 
-#define TYPE_PXA2XX_PCMCIA "pxa2xx-pcmcia"
-#define PXA2XX_PCMCIA(obj) \
-    OBJECT_CHECK(PXA2xxPCMCIAState, obj, TYPE_PXA2XX_PCMCIA)
-
 struct PXA2xxPCMCIAState {
     SysBusDevice parent_obj;
 
hw/sd/pxa2xx_mmci.c +0 -3
index 68bed24480..c400197815 100644
@@ -22,9 +22,6 @@
 #include "qemu/module.h"
 #include "trace.h"
 
-#define TYPE_PXA2XX_MMCI "pxa2xx-mmci"
-#define PXA2XX_MMCI(obj) OBJECT_CHECK(PXA2xxMMCIState, (obj), TYPE_PXA2XX_MMCI)
-
 #define TYPE_PXA2XX_MMCI_BUS "pxa2xx-mmci-bus"
 #define PXA2XX_MMCI_BUS(obj) OBJECT_CHECK(SDBus, (obj), TYPE_PXA2XX_MMCI_BUS)
 
Signature · 1 line
2.26.2
Reviewed-by on v2 39/58
#74 lore raw

Re: [PATCH v2 39/58] pxa2xx: Move QOM macros to header

Quoted 10 lines · Eduardo Habkost

This will make future conversion to OBJECT_DECLARE* easier.

---
Changes series v1 -> v2: new patch in series v2

Cc Andrzej Zaborowski <[email protected]>
Cc Peter Maydell <[email protected]>
Quoted 6 lines
---
 include/hw/arm/pxa.h | 13 +++++++++++++
 hw/arm/pxa2xx.c      |  7 -------
 hw/pcmcia/pxa2xx.c   |  4 ----
 hw/sd/pxa2xx_mmci.c  |  3 ---
 4 files changed, 13 insertions(+), 14 deletions(-)

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#75 lore raw

PATCH v2 40/58 mptsas: Move QOM macros to header

In reply to Eduardo Habkost

This will make future conversion to OBJECT_DECLARE* easier.

---
Changes series v1 -> v2: new patch in series v2

Cc Paolo Bonzini <[email protected]>
Cc Fam Zheng <[email protected]>
---
 hw/scsi/mptsas.h | 6 +++++-
 hw/scsi/mptsas.c | 5 -----
 2 files changed, 5 insertions(+), 6 deletions(-)
hw/scsi/mptsas.h +5 -1
index 0436a33911..9ac98fc20e 100644
@@ -11,9 +11,13 @@
 
 #define MPTSAS_MAXIMUM_CHAIN_DEPTH 0x22
 
-typedef struct MPTSASState MPTSASState;
 typedef struct MPTSASRequest MPTSASRequest;
 
+#define TYPE_MPTSAS1068 "mptsas1068"
+typedef struct MPTSASState MPTSASState;
+#define MPT_SAS(obj) \
+    OBJECT_CHECK(MPTSASState, (obj), TYPE_MPTSAS1068)
+
 enum {
     DOORBELL_NONE,
     DOORBELL_WRITE,
hw/scsi/mptsas.c +0 -5
index 14cbed84d0..135e7d96e4 100644
@@ -42,11 +42,6 @@
 #define NAA_LOCALLY_ASSIGNED_ID 0x3ULL
 #define IEEE_COMPANY_LOCALLY_ASSIGNED 0x525400
 
-#define TYPE_MPTSAS1068 "mptsas1068"
-
-#define MPT_SAS(obj) \
-    OBJECT_CHECK(MPTSASState, (obj), TYPE_MPTSAS1068)
-
 #define MPTSAS1068_PRODUCT_ID                  \
     (MPI_FW_HEADER_PID_FAMILY_1068_SAS |       \
      MPI_FW_HEADER_PID_PROD_INITIATOR_SCSI |   \
Signature · 1 line
2.26.2
Reviewed-by on v2 40/58
#76 lore raw

Re: [PATCH v2 40/58] mptsas: Move QOM macros to header

Quoted 6 lines · Eduardo Habkost

This will make future conversion to OBJECT_DECLARE* easier.

---
Changes series v1 -> v2: new patch in series v2

Quoted 7 lines
Cc Paolo Bonzini <[email protected]>
Cc Fam Zheng <[email protected]>
---
 hw/scsi/mptsas.h | 6 +++++-
 hw/scsi/mptsas.c | 5 -----
 2 files changed, 5 insertions(+), 6 deletions(-)

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#77 lore raw

PATCH v2 41/58 kvm: Move QOM macros to kvm.h

In reply to Eduardo Habkost

Move QOM macros close to the KVMState typedef.

This will make future conversion to OBJECT_DECLARE* easier.

---
Changes series v1 -> v2: new patch in series v2

---
 include/sysemu/kvm.h     | 6 ++++++
 include/sysemu/kvm_int.h | 5 -----
 2 files changed, 6 insertions(+), 5 deletions(-)
include/sysemu/kvm.h +6 -0
index b4174d941c..8445a88db1 100644
@@ -17,6 +17,7 @@
 #include "qemu/queue.h"
 #include "hw/core/cpu.h"
 #include "exec/memattrs.h"
+#include "sysemu/accel.h"
 
 #ifdef NEED_CPU_H
 # ifdef CONFIG_KVM
@@ -199,7 +200,12 @@ typedef struct KVMCapabilityInfo {
 #define KVM_CAP_LAST_INFO { NULL, 0 }
 
 struct KVMState;
+
+#define TYPE_KVM_ACCEL ACCEL_CLASS_NAME("kvm")
 typedef struct KVMState KVMState;
+#define KVM_STATE(obj) \
+    OBJECT_CHECK(KVMState, (obj), TYPE_KVM_ACCEL)
+
 extern KVMState *kvm_state;
 typedef struct Notifier Notifier;
 
include/sysemu/kvm_int.h +0 -5
index c660a70c51..65740806da 100644
@@ -33,11 +33,6 @@ typedef struct KVMMemoryListener {
     int as_id;
 } KVMMemoryListener;
 
-#define TYPE_KVM_ACCEL ACCEL_CLASS_NAME("kvm")
-
-#define KVM_STATE(obj) \
-    OBJECT_CHECK(KVMState, (obj), TYPE_KVM_ACCEL)
-
 void kvm_memory_listener_register(KVMState *s, KVMMemoryListener *kml,
                                   AddressSpace *as, int as_id);
 
Signature · 1 line
2.26.2
Reviewed-by on v2 41/58
#78 lore raw

Re: [PATCH v2 41/58] kvm: Move QOM macros to kvm.h

Quoted 8 lines · Eduardo Habkost

Move QOM macros close to the KVMState typedef.

This will make future conversion to OBJECT_DECLARE* easier.

---
Changes series v1 -> v2: new patch in series v2

Quoted 7 lines
---
 include/sysemu/kvm.h     | 6 ++++++
 include/sysemu/kvm_int.h | 5 -----
 2 files changed, 6 insertions(+), 5 deletions(-)

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#79 lore raw

PATCH v2 42/58 vfio/pci: Move QOM macros to header

In reply to Eduardo Habkost

This will make future conversion to OBJECT_DECLARE* easier.

---
Changes series v1 -> v2: new patch in series v2

Cc Alex Williamson <[email protected]>
---
 hw/vfio/pci.h | 3 +++
 hw/vfio/pci.c | 3 ---
 2 files changed, 3 insertions(+), 3 deletions(-)
hw/vfio/pci.h +3 -0
index 0da7a20a7e..3c0dca024b 100644
@@ -113,6 +113,9 @@ typedef struct VFIOMSIXInfo {
     unsigned long *pending;
 } VFIOMSIXInfo;
 
+#define TYPE_VFIO_PCI "vfio-pci"
+#define PCI_VFIO(obj)    OBJECT_CHECK(VFIOPCIDevice, obj, TYPE_VFIO_PCI)
+
 typedef struct VFIOPCIDevice {
     PCIDevice pdev;
     VFIODevice vbasedev;
hw/vfio/pci.c +0 -3
index 2e561c06d6..3611dcd38b 100644
@@ -42,9 +42,6 @@
 #include "qapi/error.h"
 #include "migration/blocker.h"
 
-#define TYPE_VFIO_PCI "vfio-pci"
-#define PCI_VFIO(obj)    OBJECT_CHECK(VFIOPCIDevice, obj, TYPE_VFIO_PCI)
-
 #define TYPE_VFIO_PCI_NOHOTPLUG "vfio-pci-nohotplug"
 
 static void vfio_disable_interrupts(VFIOPCIDevice *vdev);
Signature · 1 line
2.26.2
Reviewed-by on v2 42/58
#80 lore raw

Re: [PATCH v2 42/58] vfio/pci: Move QOM macros to header

Quoted 6 lines · Eduardo Habkost

This will make future conversion to OBJECT_DECLARE* easier.

---
Changes series v1 -> v2: new patch in series v2

Quoted 7 lines
Cc Alex Williamson <[email protected]>
---
 hw/vfio/pci.h | 3 +++
 hw/vfio/pci.c | 3 ---
 2 files changed, 3 insertions(+), 3 deletions(-)
Reviewed-by on v2 42/58
#81 lore raw

Re: [PATCH v2 42/58] vfio/pci: Move QOM macros to header

In reply to Eduardo Habkost
Quoted 6 lines · Eduardo Habkost

This will make future conversion to OBJECT_DECLARE* easier.

---
Changes series v1 -> v2: new patch in series v2

Quoted 7 lines
Cc Alex Williamson <[email protected]>
---
 hw/vfio/pci.h | 3 +++
 hw/vfio/pci.c | 3 ---
 2 files changed, 3 insertions(+), 3 deletions(-)
Reviewed-by on v2 42/58
#82 lore raw

Re: [PATCH v2 42/58] vfio/pci: Move QOM macros to header

In reply to Eduardo Habkost
Quoted 6 lines · Eduardo Habkost

This will make future conversion to OBJECT_DECLARE* easier.

---
Changes series v1 -> v2: new patch in series v2

Quoted 6 lines
Cc Alex Williamson <[email protected]>
---
 hw/vfio/pci.h | 3 +++
 hw/vfio/pci.c | 3 ---
 2 files changed, 3 insertions(+), 3 deletions(-)

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#83 lore raw

PATCH v2 43/58 qom: make object_ref/unref use a void * instead of Object *.

In reply to Eduardo Habkost

From: Daniel P. Berrangé <[email protected]>

The object_ref/unref methods are intended for use with any subclass of the base Object. Using "Object *" in the signature is not adding any meaningful level of type safety, since callers simply use "OBJECT(ptr)" and this expands to an unchecked cast "(Object *)".

By using "void *" we enable the object_unref() method to be used to provide support for g_autoptr() with any subclass.

Message-Id: <[email protected]>
---
Changes v1 -> v2: none

---
 include/qom/object.h | 4 ++--
 qom/object.c         | 6 ++++--
 2 files changed, 6 insertions(+), 4 deletions(-)
include/qom/object.h +2 -2
index 0f3a60617c..1f8aa2d48e 100644
@@ -1035,7 +1035,7 @@ GSList *object_class_get_list_sorted(const char *implements_type,
  * as its reference count is greater than zero.
  * Returns: @obj
  */
-Object *object_ref(Object *obj);
+Object *object_ref(void *obj);
 
 /**
  * object_unref:
@@ -1044,7 +1044,7 @@ Object *object_ref(Object *obj);
  * Decrease the reference count of a object.  A object cannot be freed as long
  * as its reference count is greater than zero.
  */
-void object_unref(Object *obj);
+void object_unref(void *obj);
 
 /**
  * object_property_try_add:
qom/object.c +4 -2
index 00fdf89b3b..b1822a2ef4 100644
@@ -1124,8 +1124,9 @@ GSList *object_class_get_list_sorted(const char *implements_type,
                         object_class_cmp);
 }
 
-Object *object_ref(Object *obj)
+Object *object_ref(void *objptr)
 {
+    Object *obj = OBJECT(objptr);
     if (!obj) {
         return NULL;
     }
@@ -1133,8 +1134,9 @@ Object *object_ref(Object *obj)
     return obj;
 }
 
-void object_unref(Object *obj)
+void object_unref(void *objptr)
 {
+    Object *obj = OBJECT(objptr);
     if (!obj) {
         return;
     }
Signature · 1 line
2.26.2
#84 lore raw

PATCH v2 44/58 qom: provide convenient macros for declaring and defining types

In reply to Eduardo Habkost

From: Daniel P. Berrangé <[email protected]>

When creating new QOM types, there is a lot of boilerplate code that must be repeated using a standard pattern. This is tedious to write and liable to suffer from subtle inconsistencies. Thus it would benefit from some simple automation.

QOM was loosely inspired by GLib's GObject, and indeed GObject suffers from the same burden of boilerplate code, but has long provided a set of macros to eliminate this burden in the source implementation. More recently it has also provided a set of macros to eliminate this burden in the header declaration.

In GLib there are the G_DECLARE_* and G_DEFINE_* family of macros for the header declaration and source implementation respectively:

https://developer.gnome.org/gobject/stable/chapter-gobject.html
https://developer.gnome.org/gobject/stable/howto-gobject.html

This patch takes inspiration from GObject to provide the equivalent functionality for QOM.

In the header file, instead of:

    typedef struct MyDevice MyDevice;
    typedef struct MyDeviceClass MyDeviceClass;

    G_DEFINE_AUTOPTR_CLEANUP_FUNC(MyDeviceClass, object_unref)

    #define MY_DEVICE_GET_CLASS(void *obj) \
            OBJECT_GET_CLASS(MyDeviceClass, obj, TYPE_MY_DEVICE)
    #define MY_DEVICE_CLASS(void *klass) \
            OBJECT_CLASS_CHECK(MyDeviceClass, klass, TYPE_MY_DEVICE)
    #define MY_DEVICE(void *obj)
            OBJECT_CHECK(MyDevice, obj, TYPE_MY_DEVICE)

    struct MyDeviceClass {
        DeviceClass parent_class;
    };

We now have

OBJECT_DECLARE_SIMPLE_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE)

In cases where the class needs some virtual methods, it can be left to be implemented manually using

OBJECT_DECLARE_TYPE(MyDevice, my_device, MY_DEVICE)

Note that these macros are including support for g_autoptr() for the object types, which is something previously only supported for variables declared as the base Object * type.

Meanwhile in the source file, instead of:

    static void my_device_finalize(Object *obj);
    static void my_device_class_init(ObjectClass *oc, void *data);
    static void my_device_init(Object *obj);

    static const TypeInfo my_device_info = {
        .parent = TYPE_DEVICE,
        .name = TYPE_MY_DEVICE,
        .instance_size = sizeof(MyDevice),
        .instance_init = my_device_init,
        .instance_finalize = my_device_finalize,
        .class_size = sizeof(MyDeviceClass),
        .class_init = my_device_class_init,
    };

    static void
    my_device_register_types(void)
    {
        type_register_static(&my_device_info);
    }
    type_init(my_device_register_types);

We now have

OBJECT_DEFINE_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE)

Or, if a class needs to implement interfaces:

OBJECT_DEFINE_TYPE_WITH_INTERFACES(MyDevice, my_device, MY_DEVICE, DEVICE,
{ TYPE_USER_CREATABLE }, { NULL })

Or, if a class needs to be abstract

OBJECT_DEFINE_ABSTRACT_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE)

IOW, in both cases the maintainer now only has to think about the interesting part of the code which implements useful functionality and avoids much of the boilerplate.

Message-Id: <[email protected]>

[ehabkost: Fix G_DEFINE_AUTOPTR_CLEANUP_FUNC usage]

---
Changes v1 -> v2:
* Squashed "Fix G_DEFINE_AUTOPTR_CLEANUP_FUNC" into this patch

---
 include/qom/object.h | 277 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 277 insertions(+)
include/qom/object.h +277 -0
index 1f8aa2d48e..f515230f61 100644
@@ -304,6 +304,119 @@ typedef struct InterfaceInfo InterfaceInfo;
  *
  * The first example of such a QOM method was #CPUClass.reset,
  * another example is #DeviceClass.realize.
+ *
+ * # Standard type declaration and definition macros #
+ *
+ * A lot of the code outlined above follows a standard pattern and naming
+ * convention. To reduce the amount of boilerplate code that needs to be
+ * written for a new type there are two sets of macros to generate the
+ * common parts in a standard format.
+ *
+ * A type is declared using the OBJECT_DECLARE macro family. In types
+ * which do not require any virtual functions in the class, the
+ * OBJECT_DECLARE_SIMPLE_TYPE macro is suitable, and is commonly placed
+ * in the header file:
+ *
+ * <example>
+ *   <title>Declaring a simple type</title>
+ *   <programlisting>
+ *     OBJECT_DECLARE_SIMPLE_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE)
+ *   </programlisting>
+ * </example>
+ *
+ * This is equivalent to the following:
+ *
+ * <example>
+ *   <title>Expansion from declaring a simple type</title>
+ *   <programlisting>
+ *     typedef struct MyDevice MyDevice;
+ *     typedef struct MyDeviceClass MyDeviceClass;
+ *
+ *     G_DEFINE_AUTOPTR_CLEANUP_FUNC(MyDeviceClass, object_unref)
+ *
+ *     #define MY_DEVICE_GET_CLASS(void *obj) \
+ *             OBJECT_GET_CLASS(MyDeviceClass, obj, TYPE_MY_DEVICE)
+ *     #define MY_DEVICE_CLASS(void *klass) \
+ *             OBJECT_CLASS_CHECK(MyDeviceClass, klass, TYPE_MY_DEVICE)
+ *     #define MY_DEVICE(void *obj)
+ *             OBJECT_CHECK(MyDevice, obj, TYPE_MY_DEVICE)
+ *
+ *     struct MyDeviceClass {
+ *         DeviceClass parent_class;
+ *     };
+ *   </programlisting>
+ * </example>
+ *
+ * The 'struct MyDevice' needs to be declared separately.
+ * If the type requires virtual functions to be declared in the class
+ * struct, then the alternative OBJECT_DECLARE_TYPE() macro can be
+ * used. This does the same as OBJECT_DECLARE_SIMPLE_TYPE(), but without
+ * the 'struct MyDeviceClass' definition.
+ *
+ * To implement the type, the OBJECT_DEFINE macro family is available.
+ * In the simple case the OBJECT_DEFINE_TYPE macro is suitable:
+ *
+ * <example>
+ *   <title>Defining a simple type</title>
+ *   <programlisting>
+ *     OBJECT_DEFINE_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE)
+ *   </programlisting>
+ * </example>
+ *
+ * This is equivalent to the following:
+ *
+ * <example>
+ *   <title>Expansion from defining a simple type</title>
+ *   <programlisting>
+ *     static void my_device_finalize(Object *obj);
+ *     static void my_device_class_init(ObjectClass *oc, void *data);
+ *     static void my_device_init(Object *obj);
+ *
+ *     static const TypeInfo my_device_info = {
+ *         .parent = TYPE_DEVICE,
+ *         .name = TYPE_MY_DEVICE,
+ *         .instance_size = sizeof(MyDevice),
+ *         .instance_init = my_device_init,
+ *         .instance_finalize = my_device_finalize,
+ *         .class_size = sizeof(MyDeviceClass),
+ *         .class_init = my_device_class_init,
+ *     };
+ *
+ *     static void
+ *     my_device_register_types(void)
+ *     {
+ *         type_register_static(&my_device_info);
+ *     }
+ *     type_init(my_device_register_types);
+ *   </programlisting>
+ * </example>
+ *
+ * This is sufficient to get the type registered with the type
+ * system, and the three standard methods now need to be implemented
+ * along with any other logic required for the type.
+ *
+ * If the type needs to implement one or more interfaces, then the
+ * OBJECT_DEFINE_TYPE_WITH_INTERFACES() macro can be used instead.
+ * This accepts an array of interface type names.
+ *
+ * <example>
+ *   <title>Defining a simple type implementing interfaces</title>
+ *   <programlisting>
+ *     OBJECT_DEFINE_TYPE_WITH_INTERFACES(MyDevice, my_device,
+ *                                        MY_DEVICE, DEVICE,
+ *                                        { TYPE_USER_CREATABLE }, { NULL })
+ *   </programlisting>
+ * </example>
+ *
+ * If the type is not intended to be instantiated, then then
+ * the OBJECT_DEFINE_ABSTRACT_TYPE() macro can be used instead:
+ *
+ * <example>
+ *   <title>Defining a simple type</title>
+ *   <programlisting>
+ *     OBJECT_DEFINE_ABSTRACT_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE)
+ *   </programlisting>
+ * </example>
  */
 
 
@@ -440,6 +553,170 @@ struct Object
     Object *parent;
 };
 
+/**
+ * OBJECT_DECLARE_TYPE:
+ * @ModuleObjName: the object name with initial capitalization
+ * @module_obj_name: the object name in lowercase with underscore separators
+ * @MODULE_OBJ_NAME: the object name in uppercase with underscore separators
+ *
+ * This macro is typically used in a header file, and will:
+ *
+ *   - create the typedefs for the object and class structs
+ *   - register the type for use with g_autoptr
+ *   - provide three standard type cast functions
+ *
+ * The object struct and class struct need to be declared manually.
+ */
+#define OBJECT_DECLARE_TYPE(ModuleObjName, module_obj_name, MODULE_OBJ_NAME) \
+    typedef struct ModuleObjName ModuleObjName; \
+    typedef struct ModuleObjName##Class ModuleObjName##Class; \
+    \
+    G_DEFINE_AUTOPTR_CLEANUP_FUNC(ModuleObjName, object_unref) \
+    \
+    static inline G_GNUC_UNUSED ModuleObjName##Class * \
+    MODULE_OBJ_NAME##_GET_CLASS(void *obj) \
+    { return OBJECT_GET_CLASS(ModuleObjName##Class, obj, \
+                              TYPE_##MODULE_OBJ_NAME); } \
+    \
+    static inline G_GNUC_UNUSED ModuleObjName##Class * \
+    MODULE_OBJ_NAME##_CLASS(void *klass) \
+    { return OBJECT_CLASS_CHECK(ModuleObjName##Class, klass, \
+                                TYPE_##MODULE_OBJ_NAME); } \
+    \
+    static inline G_GNUC_UNUSED ModuleObjName * \
+    MODULE_OBJ_NAME(void *obj) \
+    { return OBJECT_CHECK(ModuleObjName, obj, \
+                          TYPE_##MODULE_OBJ_NAME); }
+
+/**
+ * OBJECT_DECLARE_SIMPLE_TYPE:
+ * @ModuleObjName: the object name with initial caps
+ * @module_obj_name: the object name in lowercase with underscore separators
+ * @MODULE_OBJ_NAME: the object name in uppercase with underscore separators
+ * @ParentModuleObjName: the parent object name with initial caps
+ *
+ * This does the same as OBJECT_DECLARE_TYPE(), but also declares
+ * the class struct, thus only the object struct needs to be declare
+ * manually.
+ *
+ * This macro should be used unless the class struct needs to have
+ * virtual methods declared.
+ */
+#define OBJECT_DECLARE_SIMPLE_TYPE(ModuleObjName, module_obj_name, \
+                                   MODULE_OBJ_NAME, ParentModuleObjName) \
+    OBJECT_DECLARE_TYPE(ModuleObjName, module_obj_name, MODULE_OBJ_NAME) \
+    struct ModuleObjName##Class { ParentModuleObjName##Class parent_class; };
+
+
+/**
+ * OBJECT_DEFINE_TYPE_EXTENDED:
+ * @ModuleObjName: the object name with initial caps
+ * @module_obj_name: the object name in lowercase with underscore separators
+ * @MODULE_OBJ_NAME: the object name in uppercase with underscore separators
+ * @PARENT_MODULE_OBJ_NAME: the parent object name in uppercase with underscore
+ *                          separators
+ * @ABSTRACT: boolean flag to indicate whether the object can be instantiated
+ * @...: list of initializers for "InterfaceInfo" to declare implemented interfaces
+ *
+ * This macro is typically used in a source file, and will:
+ *
+ *   - declare prototypes for _finalize, _class_init and _init methods
+ *   - declare the TypeInfo struct instance
+ *   - provide the constructor to register the type
+ *
+ * After using this macro, implementations of the _finalize, _class_init,
+ * and _init methods need to be written. Any of these can be zero-line
+ * no-op impls if no special logic is required for a given type.
+ *
+ * This macro should rarely be used, instead one of the more specialized
+ * macros is usually a better choice.
+ */
+#define OBJECT_DEFINE_TYPE_EXTENDED(ModuleObjName, module_obj_name, \
+                                    MODULE_OBJ_NAME, PARENT_MODULE_OBJ_NAME, \
+                                    ABSTRACT, ...) \
+    static void \
+    module_obj_name##_finalize(Object *obj); \
+    static void \
+    module_obj_name##_class_init(ObjectClass *oc, void *data); \
+    static void \
+    module_obj_name##_init(Object *obj); \
+    \
+    static const TypeInfo module_obj_name##_info = { \
+        .parent = TYPE_##PARENT_MODULE_OBJ_NAME, \
+        .name = TYPE_##MODULE_OBJ_NAME, \
+        .instance_size = sizeof(ModuleObjName), \
+        .instance_init = module_obj_name##_init, \
+        .instance_finalize = module_obj_name##_finalize, \
+        .class_size = sizeof(ModuleObjName##Class), \
+        .class_init = module_obj_name##_class_init, \
+        .abstract = ABSTRACT, \
+        .interfaces = (InterfaceInfo[]) { __VA_ARGS__ } , \
+    }; \
+    \
+    static void \
+    module_obj_name##_register_types(void) \
+    { \
+        type_register_static(&module_obj_name##_info); \
+    } \
+    type_init(module_obj_name##_register_types);
+
+/**
+ * OBJECT_DEFINE_TYPE:
+ * @ModuleObjName: the object name with initial caps
+ * @module_obj_name: the object name in lowercase with underscore separators
+ * @MODULE_OBJ_NAME: the object name in uppercase with underscore separators
+ * @PARENT_MODULE_OBJ_NAME: the parent object name in uppercase with underscore
+ *                          separators
+ *
+ * This is a specialization of OBJECT_DEFINE_TYPE_EXTENDED, which is suitable
+ * for the common case of a non-abstract type, without any interfaces.
+ */
+#define OBJECT_DEFINE_TYPE(ModuleObjName, module_obj_name, MODULE_OBJ_NAME, \
+                           PARENT_MODULE_OBJ_NAME) \
+    OBJECT_DEFINE_TYPE_EXTENDED(ModuleObjName, module_obj_name, \
+                                MODULE_OBJ_NAME, PARENT_MODULE_OBJ_NAME, \
+                                false, { NULL })
+
+/**
+ * OBJECT_DEFINE_TYPE_WITH_INTERFACES:
+ * @ModuleObjName: the object name with initial caps
+ * @module_obj_name: the object name in lowercase with underscore separators
+ * @MODULE_OBJ_NAME: the object name in uppercase with underscore separators
+ * @PARENT_MODULE_OBJ_NAME: the parent object name in uppercase with underscore
+ *                          separators
+ * @...: list of initializers for "InterfaceInfo" to declare implemented interfaces
+ *
+ * This is a specialization of OBJECT_DEFINE_TYPE_EXTENDED, which is suitable
+ * for the common case of a non-abstract type, with one or more implemented
+ * interfaces.
+ *
+ * Note when passing the list of interfaces, be sure to include the final
+ * NULL entry, e.g.  { TYPE_USER_CREATABLE }, { NULL }
+ */
+#define OBJECT_DEFINE_TYPE_WITH_INTERFACES(ModuleObjName, module_obj_name, \
+                                           MODULE_OBJ_NAME, \
+                                           PARENT_MODULE_OBJ_NAME, ...) \
+    OBJECT_DEFINE_TYPE_EXTENDED(ModuleObjName, module_obj_name, \
+                                MODULE_OBJ_NAME, PARENT_MODULE_OBJ_NAME, \
+                                false, __VA_ARGS__)
+
+/**
+ * OBJECT_DEFINE_ABSTRACT_TYPE:
+ * @ModuleObjName: the object name with initial caps
+ * @module_obj_name: the object name in lowercase with underscore separators
+ * @MODULE_OBJ_NAME: the object name in uppercase with underscore separators
+ * @PARENT_MODULE_OBJ_NAME: the parent object name in uppercase with underscore
+ *                          separators
+ *
+ * This is a specialization of OBJECT_DEFINE_TYPE_EXTENDED, which is suitable
+ * for defining an abstract type, without any interfaces.
+ */
+#define OBJECT_DEFINE_ABSTRACT_TYPE(ModuleObjName, module_obj_name, \
+                                    MODULE_OBJ_NAME, PARENT_MODULE_OBJ_NAME) \
+    OBJECT_DEFINE_TYPE_EXTENDED(ModuleObjName, module_obj_name, \
+                                MODULE_OBJ_NAME, PARENT_MODULE_OBJ_NAME, \
+                                true, { NULL })
+
 /**
  * TypeInfo:
  * @name: The name of the type.
Signature · 1 line
2.26.2
#85 lore raw

Re: [PATCH v2 44/58] qom: provide convenient macros for declaring and defining types

(CCing Eric Blake, who reviewed the original patch. Sorry for not CCing you previously, Eric)

On Wed, Aug 19, 2020 at 08:12:22PM -0400, Eduardo Habkost wrote:
[...]

Quoted 5 lines

+/**
+ * OBJECT_DECLARE_TYPE:
+ * @ModuleObjName: the object name with initial capitalization
+ * @module_obj_name: the object name in lowercase with underscore separators
+ * @MODULE_OBJ_NAME: the object name in uppercase with underscore separators

We need to decide what to do with TYPE_SWIM:

  #define TYPE_SWIM "swim"
  typedef struct SWIM SWIM;
  #define SWIM(obj) OBJECT_CHECK(SWIM, (obj), TYPE_SWIM)

Both the typedef and type checking macros are called "SWIM". This makes usage of OBJECT_DECLARE_TYPE impossible (because the type checking function can't have the same as the typedef). What should be the recommended style here? Rename the struct to "Swim"?

We have similar issues with RXCPU and ARMSSE, but these type checking macros can be easily renamed to RX_CPU and ARM_SSE. so they won't be an issue.

Quoted 29 lines

+ *
+ * This macro is typically used in a header file, and will:
+ *

+ *   - create the typedefs for the object and class structs
+ *   - register the type for use with g_autoptr
+ *   - provide three standard type cast functions

+ *
+ * The object struct and class struct need to be declared manually.
+ */

include/qom/object.h +20 -0
+#define OBJECT_DECLARE_TYPE(ModuleObjName, module_obj_name, MODULE_OBJ_NAME) \
+    typedef struct ModuleObjName ModuleObjName; \
+    typedef struct ModuleObjName##Class ModuleObjName##Class; \
+    \
+    G_DEFINE_AUTOPTR_CLEANUP_FUNC(ModuleObjName, object_unref) \
+    \
+    static inline G_GNUC_UNUSED ModuleObjName##Class * \
+    MODULE_OBJ_NAME##_GET_CLASS(void *obj) \
+    { return OBJECT_GET_CLASS(ModuleObjName##Class, obj, \
+                              TYPE_##MODULE_OBJ_NAME); } \
+    \
+    static inline G_GNUC_UNUSED ModuleObjName##Class * \
+    MODULE_OBJ_NAME##_CLASS(void *klass) \
+    { return OBJECT_CLASS_CHECK(ModuleObjName##Class, klass, \
+                                TYPE_##MODULE_OBJ_NAME); } \
+    \
+    static inline G_GNUC_UNUSED ModuleObjName * \
+    MODULE_OBJ_NAME(void *obj) \
+    { return OBJECT_CHECK(ModuleObjName, obj, \
+                          TYPE_##MODULE_OBJ_NAME); }

[...]

Signature · 1 line
Eduardo
#86 lore raw

Re: [PATCH v2 44/58] qom: provide convenient macros for declaring and defining types

Quoted 17 lines · Eduardo Habkost

(CCing Eric Blake, who reviewed the original patch. Sorry for not CCing you previously, Eric)

On Wed, Aug 19, 2020 at 08:12:22PM -0400, Eduardo Habkost wrote:
[...]

Quoted 5 lines

+/**
+ * OBJECT_DECLARE_TYPE:
+ * @ModuleObjName: the object name with initial capitalization
+ * @module_obj_name: the object name in lowercase with underscore separators
+ * @MODULE_OBJ_NAME: the object name in uppercase with underscore separators

We need to decide what to do with TYPE_SWIM:

  #define TYPE_SWIM "swim"
  typedef struct SWIM SWIM;
  #define SWIM(obj) OBJECT_CHECK(SWIM, (obj), TYPE_SWIM)
Quoted 5 lines

Both the typedef and type checking macros are called "SWIM". This makes usage of OBJECT_DECLARE_TYPE impossible (because the type checking function can't have the same as the typedef). What should be the recommended style here? Rename the struct to "Swim"?

This would be the gobject style approach to the problem - structs always have initial-caps-only even if they are abbreviations.

If that's unappealing we could add a suffix "struct SWIMInst"

Quoted 3 lines

We have similar issues with RXCPU and ARMSSE, but these type checking macros can be easily renamed to RX_CPU and ARM_SSE. so they won't be an issue.

Or RSCPUInst and ARMSSEInst ?

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#87 lore raw

Re: [PATCH v2 44/58] qom: provide convenient macros for declaring and defining types

Quoted 24 lines · Daniel P. Berrangé
Quoted 17 lines · Eduardo Habkost

(CCing Eric Blake, who reviewed the original patch. Sorry for not CCing you previously, Eric)

On Wed, Aug 19, 2020 at 08:12:22PM -0400, Eduardo Habkost wrote:
[...]

Quoted 5 lines

+/**
+ * OBJECT_DECLARE_TYPE:
+ * @ModuleObjName: the object name with initial capitalization
+ * @module_obj_name: the object name in lowercase with underscore separators
+ * @MODULE_OBJ_NAME: the object name in uppercase with underscore separators

We need to decide what to do with TYPE_SWIM:

  #define TYPE_SWIM "swim"
  typedef struct SWIM SWIM;
  #define SWIM(obj) OBJECT_CHECK(SWIM, (obj), TYPE_SWIM)
Quoted 5 lines

Both the typedef and type checking macros are called "SWIM". This makes usage of OBJECT_DECLARE_TYPE impossible (because the type checking function can't have the same as the typedef). What should be the recommended style here? Rename the struct to "Swim"?

Quoted 4 lines

This would be the gobject style approach to the problem - structs always have initial-caps-only even if they are abbreviations.

If that's unappealing we could add a suffix "struct SWIMInst"

I was considering "SWIMState", because "State" is a common instance type suffix in QEMU device code. But I will let the maintainer (Laurent) decide.

Quoted 6 lines
Quoted 4 lines

We have similar issues with RXCPU and ARMSSE, but these type checking macros can be easily renamed to RX_CPU and ARM_SSE. so they won't be an issue.

Or RSCPUInst and ARMSSEInst ?

In these cases, renaming the type checking macro seems more logical, because the type name constants are TYPE_RX_CPU and TYPE_ARM_SSE.

Signature · 1 line
Eduardo
#88 lore raw

Re: [PATCH v2 44/58] qom: provide convenient macros for declaring and defining types

In reply to Eduardo Habkost

Le 20/08/2020 à 19:45, Eduardo Habkost a écrit :

Quoted 17 lines

(CCing Eric Blake, who reviewed the original patch. Sorry for not CCing you previously, Eric)

On Wed, Aug 19, 2020 at 08:12:22PM -0400, Eduardo Habkost wrote:
[...]

Quoted 5 lines

+/**
+ * OBJECT_DECLARE_TYPE:
+ * @ModuleObjName: the object name with initial capitalization
+ * @module_obj_name: the object name in lowercase with underscore separators
+ * @MODULE_OBJ_NAME: the object name in uppercase with underscore separators

We need to decide what to do with TYPE_SWIM:

  #define TYPE_SWIM "swim"
  typedef struct SWIM SWIM;
  #define SWIM(obj) OBJECT_CHECK(SWIM, (obj), TYPE_SWIM)
Quoted 5 lines

Both the typedef and type checking macros are called "SWIM". This makes usage of OBJECT_DECLARE_TYPE impossible (because the type checking function can't have the same as the typedef). What should be the recommended style here? Rename the struct to "Swim"?

"Swim" looks good to me.

Thanks,
Laurent

#89 lore raw

PATCH v2 45/58 qom: Allow class type name to be specified in OBJECT_DECLARE*

In reply to Eduardo Habkost

Many QOM types don't follow the Type/TypeClass pattern on the instance/struct names. Let the class struct name be specified in the OBJECT_DECLARE* macros.

---
Changes v1 -> v2: none

---
 include/qom/object.h | 35 ++++++++++++++++++-----------------
 1 file changed, 18 insertions(+), 17 deletions(-)
include/qom/object.h +18 -17
index f515230f61..500e7dfa99 100644
@@ -555,7 +555,8 @@ struct Object
 
 /**
  * OBJECT_DECLARE_TYPE:
- * @ModuleObjName: the object name with initial capitalization
+ * @InstanceType: instance struct name
+ * @ClassType: class struct name
  * @module_obj_name: the object name in lowercase with underscore separators
  * @MODULE_OBJ_NAME: the object name in uppercase with underscore separators
  *
@@ -567,33 +568,33 @@ struct Object
  *
  * The object struct and class struct need to be declared manually.
  */
-#define OBJECT_DECLARE_TYPE(ModuleObjName, module_obj_name, MODULE_OBJ_NAME) \
-    typedef struct ModuleObjName ModuleObjName; \
-    typedef struct ModuleObjName##Class ModuleObjName##Class; \
+#define OBJECT_DECLARE_TYPE(InstanceType, ClassType, module_obj_name, MODULE_OBJ_NAME) \
+    typedef struct InstanceType InstanceType; \
+    typedef struct ClassType ClassType; \
     \
-    G_DEFINE_AUTOPTR_CLEANUP_FUNC(ModuleObjName, object_unref) \
+    G_DEFINE_AUTOPTR_CLEANUP_FUNC(InstanceType, object_unref) \
     \
-    static inline G_GNUC_UNUSED ModuleObjName##Class * \
+    static inline G_GNUC_UNUSED ClassType * \
     MODULE_OBJ_NAME##_GET_CLASS(void *obj) \
-    { return OBJECT_GET_CLASS(ModuleObjName##Class, obj, \
+    { return OBJECT_GET_CLASS(ClassType, obj, \
                               TYPE_##MODULE_OBJ_NAME); } \
     \
-    static inline G_GNUC_UNUSED ModuleObjName##Class * \
+    static inline G_GNUC_UNUSED ClassType * \
     MODULE_OBJ_NAME##_CLASS(void *klass) \
-    { return OBJECT_CLASS_CHECK(ModuleObjName##Class, klass, \
+    { return OBJECT_CLASS_CHECK(ClassType, klass, \
                                 TYPE_##MODULE_OBJ_NAME); } \
     \
-    static inline G_GNUC_UNUSED ModuleObjName * \
+    static inline G_GNUC_UNUSED InstanceType * \
     MODULE_OBJ_NAME(void *obj) \
-    { return OBJECT_CHECK(ModuleObjName, obj, \
+    { return OBJECT_CHECK(InstanceType, obj, \
                           TYPE_##MODULE_OBJ_NAME); }
 
 /**
  * OBJECT_DECLARE_SIMPLE_TYPE:
- * @ModuleObjName: the object name with initial caps
+ * @InstanceType: instance struct name
  * @module_obj_name: the object name in lowercase with underscore separators
  * @MODULE_OBJ_NAME: the object name in uppercase with underscore separators
- * @ParentModuleObjName: the parent object name with initial caps
+ * @ParentClassType: class struct name of parent type
  *
  * This does the same as OBJECT_DECLARE_TYPE(), but also declares
  * the class struct, thus only the object struct needs to be declare
@@ -602,10 +603,10 @@ struct Object
  * This macro should be used unless the class struct needs to have
  * virtual methods declared.
  */
-#define OBJECT_DECLARE_SIMPLE_TYPE(ModuleObjName, module_obj_name, \
-                                   MODULE_OBJ_NAME, ParentModuleObjName) \
-    OBJECT_DECLARE_TYPE(ModuleObjName, module_obj_name, MODULE_OBJ_NAME) \
-    struct ModuleObjName##Class { ParentModuleObjName##Class parent_class; };
+#define OBJECT_DECLARE_SIMPLE_TYPE(InstanceType, module_obj_name, \
+                                   MODULE_OBJ_NAME, ParentClassType) \
+    OBJECT_DECLARE_TYPE(InstanceType, InstanceType##Class, module_obj_name, MODULE_OBJ_NAME) \
+    struct InstanceType##Class { ParentClassType parent_class; };
 
 
 /**
Signature · 1 line
2.26.2
#90 lore raw

PATCH v2 46/58 qom: DECLARE_*_CHECKERS macros

In reply to Eduardo Habkost

Sometimes the typedefs are buried inside another header, but we want to benefit from the automatic definition of type cast functions. Introduce macros that will let type checkers be defined when typedefs are already available.

---
Changes v1 -> v2: none

---
 include/qom/object.h | 72 +++++++++++++++++++++++++++++++++++---------
 1 file changed, 58 insertions(+), 14 deletions(-)
include/qom/object.h +58 -14
index 500e7dfa99..4cd84998c2 100644
@@ -553,6 +553,62 @@ struct Object
     Object *parent;
 };
 
+/**
+ * DECLARE_INSTANCE_CHECKER:
+ * @InstanceType: instance struct name
+ * @OBJ_NAME: the object name in uppercase with underscore separators
+ * @TYPENAME: type name
+ *
+ * Direct usage of this macro should be avoided, and the complete
+ * OBJECT_DECLARE_TYPE macro is recommended instead.
+ *
+ * This macro will provide the three standard type cast functions for a
+ * QOM type.
+ */
+#define DECLARE_INSTANCE_CHECKER(InstanceType, OBJ_NAME, TYPENAME) \
+    static inline G_GNUC_UNUSED InstanceType * \
+    OBJ_NAME(void *obj) \
+    { return OBJECT_CHECK(InstanceType, obj, TYPENAME); }
+
+/**
+ * DECLARE_CLASS_CHECKERS:
+ * @ClassType: class struct name
+ * @OBJ_NAME: the object name in uppercase with underscore separators
+ * @TYPENAME: type name
+ *
+ * Direct usage of this macro should be avoided, and the complete
+ * OBJECT_DECLARE_TYPE macro is recommended instead.
+ *
+ * This macro will provide the three standard type cast functions for a
+ * QOM type.
+ */
+#define DECLARE_CLASS_CHECKERS(ClassType, OBJ_NAME, TYPENAME) \
+    static inline G_GNUC_UNUSED ClassType * \
+    OBJ_NAME##_GET_CLASS(void *obj) \
+    { return OBJECT_GET_CLASS(ClassType, obj, TYPENAME); } \
+    \
+    static inline G_GNUC_UNUSED ClassType * \
+    OBJ_NAME##_CLASS(void *klass) \
+    { return OBJECT_CLASS_CHECK(ClassType, klass, TYPENAME); }
+
+/**
+ * DECLARE_OBJ_CHECKERS:
+ * @InstanceType: instance struct name
+ * @ClassType: class struct name
+ * @OBJ_NAME: the object name in uppercase with underscore separators
+ * @TYPENAME: type name
+ *
+ * Direct usage of this macro should be avoided, and the complete
+ * OBJECT_DECLARE_TYPE macro is recommended instead.
+ *
+ * This macro will provide the three standard type cast functions for a
+ * QOM type.
+ */
+#define DECLARE_OBJ_CHECKERS(InstanceType, ClassType, OBJ_NAME, TYPENAME) \
+    DECLARE_INSTANCE_CHECKER(InstanceType, OBJ_NAME, TYPENAME) \
+    \
+    DECLARE_CLASS_CHECKERS(ClassType, OBJ_NAME, TYPENAME)
+
 /**
  * OBJECT_DECLARE_TYPE:
  * @InstanceType: instance struct name
@@ -574,20 +630,8 @@ struct Object
     \
     G_DEFINE_AUTOPTR_CLEANUP_FUNC(InstanceType, object_unref) \
     \
-    static inline G_GNUC_UNUSED ClassType * \
-    MODULE_OBJ_NAME##_GET_CLASS(void *obj) \
-    { return OBJECT_GET_CLASS(ClassType, obj, \
-                              TYPE_##MODULE_OBJ_NAME); } \
-    \
-    static inline G_GNUC_UNUSED ClassType * \
-    MODULE_OBJ_NAME##_CLASS(void *klass) \
-    { return OBJECT_CLASS_CHECK(ClassType, klass, \
-                                TYPE_##MODULE_OBJ_NAME); } \
-    \
-    static inline G_GNUC_UNUSED InstanceType * \
-    MODULE_OBJ_NAME(void *obj) \
-    { return OBJECT_CHECK(InstanceType, obj, \
-                          TYPE_##MODULE_OBJ_NAME); }
+    DECLARE_OBJ_CHECKERS(InstanceType, ClassType, \
+                         MODULE_OBJ_NAME, TYPE_##MODULE_OBJ_NAME)
 
 /**
  * OBJECT_DECLARE_SIMPLE_TYPE:
Signature · 1 line
2.26.2
#91 lore raw

PATCH v2 47/58 qom: Make type checker functions accept const pointers

In reply to Eduardo Habkost

The existing type check macros all unconditionally drop const qualifiers from their arguments. Keep this behavior in the macros generated by DECLARE_*CHECKER* by now.

---
Changes v1 -> v2:
* Removed note about _Generic from commit message, because it won't be possible to do what I was planning without manual #defines

---
 include/qom/object.h | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
include/qom/object.h +5 -3
index 4cd84998c2..1d6a520d35 100644
@@ -567,7 +567,7 @@ struct Object
  */
 #define DECLARE_INSTANCE_CHECKER(InstanceType, OBJ_NAME, TYPENAME) \
     static inline G_GNUC_UNUSED InstanceType * \
-    OBJ_NAME(void *obj) \
+    OBJ_NAME(const void *obj) \
     { return OBJECT_CHECK(InstanceType, obj, TYPENAME); }
 
 /**
@@ -581,14 +581,16 @@ struct Object
  *
  * This macro will provide the three standard type cast functions for a
  * QOM type.
+ *
+ *FIXME: Use _Generic to make this const-safe
  */
 #define DECLARE_CLASS_CHECKERS(ClassType, OBJ_NAME, TYPENAME) \
     static inline G_GNUC_UNUSED ClassType * \
-    OBJ_NAME##_GET_CLASS(void *obj) \
+    OBJ_NAME##_GET_CLASS(const void *obj) \
     { return OBJECT_GET_CLASS(ClassType, obj, TYPENAME); } \
     \
     static inline G_GNUC_UNUSED ClassType * \
-    OBJ_NAME##_CLASS(void *klass) \
+    OBJ_NAME##_CLASS(const void *klass) \
     { return OBJECT_CLASS_CHECK(ClassType, klass, TYPENAME); }
 
 /**
Signature · 1 line
2.26.2
#92 lore raw

PATCH v2 48/58 qom: TYPE_INFO macro

In reply to Eduardo Habkost

Provide a TYPE_INFO macro that can be used to register a TypeInfo struct declaratively. This will allow QOM type registration to be 100% declarative.

---
Changes v1 -> v2: none

---
 include/qom/object.h | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
include/qom/object.h +9 -6
index 1d6a520d35..81bea3b4ed 100644
@@ -655,6 +655,14 @@ struct Object
     struct InstanceType##Class { ParentClassType parent_class; };
 
 
+#define TYPE_INFO(type_info_var) \
+    static void \
+    register_type_info_##type_info_var(void) \
+    { \
+        type_register_static(&type_info_var); \
+    } \
+    type_init(register_type_info_##type_info_var);
+
 /**
  * OBJECT_DEFINE_TYPE_EXTENDED:
  * @ModuleObjName: the object name with initial caps
@@ -700,12 +708,7 @@ struct Object
         .interfaces = (InterfaceInfo[]) { __VA_ARGS__ } , \
     }; \
     \
-    static void \
-    module_obj_name##_register_types(void) \
-    { \
-        type_register_static(&module_obj_name##_info); \
-    } \
-    type_init(module_obj_name##_register_types);
+    TYPE_INFO(module_obj_name##_info)
 
 /**
  * OBJECT_DEFINE_TYPE:
Signature · 1 line
2.26.2
#93 lore raw

PATCH v2 49/58 codeconverter: script for automating QOM code cleanups

In reply to Eduardo Habkost

This started as a simple script that scanned for regular expressions, but became more and more complex when exceptions to the rules were found.

I don't know if this should be maintained in the QEMU source tree long term (maybe it can be reused for other code transformations that Coccinelle can't handle). In either case, this is included as part of the patch series to document how exactly the automated code transformations in the next patches were done.

---
Changes v1 -> v2:
* Don't warn/skip TypeCheckMacro conversion if typedefs are found in typedefs.h
* Convert type check macros that use "struct [...]" without --force

---
 .../codeconverter/codeconverter/__init__.py   |   0
 .../codeconverter/codeconverter/patching.py   | 381 +++++++++++
 .../codeconverter/codeconverter/qom_macros.py | 628 ++++++++++++++++++
 .../codeconverter/qom_type_info.py            | 314 +++++++++
 .../codeconverter/codeconverter/regexps.py    |  89 +++
 .../codeconverter/test_patching.py            |  98 +++
 .../codeconverter/test_regexps.py             | 272 ++++++++
 scripts/codeconverter/codeconverter/utils.py  |  65 ++
 scripts/codeconverter/converter.py            | 113 ++++
 9 files changed, 1960 insertions(+)
 create mode 100644 scripts/codeconverter/codeconverter/__init__.py
 create mode 100644 scripts/codeconverter/codeconverter/patching.py
 create mode 100644 scripts/codeconverter/codeconverter/qom_macros.py
 create mode 100644 scripts/codeconverter/codeconverter/qom_type_info.py
 create mode 100644 scripts/codeconverter/codeconverter/regexps.py
 create mode 100644 scripts/codeconverter/codeconverter/test_patching.py
 create mode 100644 scripts/codeconverter/codeconverter/test_regexps.py
 create mode 100644 scripts/codeconverter/codeconverter/utils.py
 create mode 100755 scripts/codeconverter/converter.py
scripts/codeconverter/codeconverter/__init__.py new file +0 -0
new file mode 100644
index 0000000000..e69de29bb2
scripts/codeconverter/codeconverter/patching.py new file +381 -0

382 lines not on this page · raw message

scripts/codeconverter/codeconverter/qom_macros.py new file +628 -0

628 lines not on this page · raw message

scripts/codeconverter/codeconverter/qom_type_info.py new file +314 -0

314 lines not on this page · raw message

scripts/codeconverter/codeconverter/regexps.py new file +89 -0

89 lines not on this page · raw message

scripts/codeconverter/codeconverter/test_patching.py new file +98 -0

98 lines not on this page · raw message

scripts/codeconverter/codeconverter/test_regexps.py new file +272 -0

272 lines not on this page · raw message

scripts/codeconverter/codeconverter/utils.py new file +65 -0

66 lines not on this page · raw message

scripts/codeconverter/converter.py new file +113 -0

114 lines not on this page · raw message

Signature · 1 line
2.26.2
#94 lore raw

PATCH v2 50/58 Delete duplicate QOM typedefs

In reply to Eduardo Habkost

Generated using:

 $ ./scripts/codeconverter/converter.py -i \
   --pattern=QOMDuplicatedTypedefs $(git grep -l '' -- '*.[ch]')

---
Changes v1 -> v2: none

---
 include/crypto/secret_keyring.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
include/crypto/secret_keyring.h +4 -4
index 9f371ad251..4345eb048e 100644
@@ -39,14 +39,14 @@
 typedef struct QCryptoSecretKeyring QCryptoSecretKeyring;
 typedef struct QCryptoSecretKeyringClass QCryptoSecretKeyringClass;
 
-typedef struct QCryptoSecretKeyring {
+struct QCryptoSecretKeyring {
     QCryptoSecretCommon parent;
     int32_t serial;
-} QCryptoSecretKeyring;
+};
 
 
-typedef struct QCryptoSecretKeyringClass {
+struct QCryptoSecretKeyringClass {
     QCryptoSecretCommonClass parent;
-} QCryptoSecretKeyringClass;
+};
 
 #endif /* QCRYPTO_SECRET_KEYRING_H */
Signature · 1 line
2.26.2