Machine queue, 2020-12-23
Subsystems (9)
The following changes since commit a05f8ecd88f15273d033b6f044b850a8af84a5b8:
Merge remote-tracking branch 'remotes/alistair/tags/pull-riscv-to-apply-20201217-1' into staging (2020-12-18 11:12:35 +0000)
are available in the Git repository at:
https://gitlab.com/ehabkost/qemu.git tags/machine-next-pull-request
for you to fetch changes up to bdd5ce050d086e9f63874f1f36e9e39fa27a976c:
bugfix: hostmem: Free host_nodes list right after visited (2020-12-18 15:20:23 -0500)
----------------------------------------------------------------
Machine queue, 2020-12-23
Cleanup:
* qdev code cleanup (Eduardo Habkost)
Bug fix:
* hostmem: Free host_nodes list right after visited (Keqian Zhu)
----------------------------------------------------------------
Eduardo Habkost (14):
qdev: Move softmmu properties to qdev-properties-system.h
qdev: Reuse DEFINE_PROP in all DEFINE_PROP_* macros
sparc: Use DEFINE_PROP for nwindows property
qdev: Get just property name at error_set_from_qdev_prop_error()
qdev: Avoid using prop->name unnecessarily
qdev: Add name parameter to qdev_class_add_property()
qdev: Add name argument to PropertyInfo.create method
qdev: Wrap getters and setters in separate helpers
qdev: Move dev->realized check to qdev_property_set()
qdev: Make PropertyInfo.create return ObjectProperty*
qdev: Make qdev_class_add_property() more flexible
qdev: Move qdev_prop_tpm declaration to tpm_prop.h
qdev: Rename qdev_get_prop_ptr() to object_field_prop_ptr()
qdev: Avoid unnecessary DeviceState* variable at set_prop_arraylen()
Keqian Zhu (1):
bugfix: hostmem: Free host_nodes list right after visited
hw/core/qdev-properties-system.c | 147 +++++----------- hw/core/qdev-properties.c | 253 ++++++++++++---------------- audio/audio.h | 1 + hw/tpm/tpm_prop.h | 2 + include/hw/block/block.h | 1 + include/hw/qdev-properties-system.h | 77 +++++++++ include/hw/qdev-properties.h | 197 +++++----------------- include/net/net.h | 1 + backends/hostmem.c | 1 + backends/tpm/tpm_util.c | 14 +- hw/acpi/vmgenid.c | 1 + hw/arm/pxa2xx.c | 1 + hw/arm/strongarm.c | 1 + hw/block/fdc.c | 1 + hw/block/m25p80.c | 1 + hw/block/nand.c | 1 + hw/block/onenand.c | 1 + hw/block/pflash_cfi01.c | 1 + hw/block/pflash_cfi02.c | 1 + hw/block/vhost-user-blk.c | 1 + hw/block/xen-block.c | 10 +- hw/char/avr_usart.c | 1 + hw/char/bcm2835_aux.c | 1 + hw/char/cadence_uart.c | 1 + hw/char/cmsdk-apb-uart.c | 1 + hw/char/debugcon.c | 1 + hw/char/digic-uart.c | 1 + hw/char/escc.c | 1 + hw/char/etraxfs_ser.c | 1 + hw/char/exynos4210_uart.c | 1 + hw/char/grlib_apbuart.c | 1 + hw/char/ibex_uart.c | 1 + hw/char/imx_serial.c | 1 + hw/char/ipoctal232.c | 1 + hw/char/lm32_juart.c | 1 + hw/char/lm32_uart.c | 1 + hw/char/mcf_uart.c | 1 + hw/char/milkymist-uart.c | 1 + hw/char/nrf51_uart.c | 1 + hw/char/parallel.c | 1 + hw/char/pl011.c | 1 + hw/char/renesas_sci.c | 1 + hw/char/sclpconsole-lm.c | 1 + hw/char/sclpconsole.c | 1 + hw/char/serial-pci-multi.c | 1 + hw/char/serial.c | 1 + hw/char/spapr_vty.c | 1 + hw/char/stm32f2xx_usart.c | 1 + hw/char/terminal3270.c | 1 + hw/char/virtio-console.c | 1 + hw/char/xilinx_uartlite.c | 1 + hw/hyperv/vmbus.c | 1 + hw/i386/kvm/i8254.c | 1 + hw/ide/qdev.c | 1 + hw/ipmi/ipmi_bmc_extern.c | 1 + hw/ipmi/ipmi_bmc_sim.c | 1 + hw/misc/allwinner-sid.c | 1 + hw/misc/ivshmem.c | 1 + hw/misc/mac_via.c | 1 + hw/misc/sifive_u_otp.c | 1 + hw/net/rocker/rocker.c | 1 + hw/nvram/eeprom_at24c.c | 1 + hw/nvram/spapr_nvram.c | 1 + hw/pci-bridge/gen_pcie_root_port.c | 1 + hw/pci/pci.c | 1 + hw/ppc/pnv_pnor.c | 1 + hw/rdma/vmw/pvrdma_main.c | 1 + hw/rtc/mc146818rtc.c | 1 + hw/s390x/css.c | 12 +- hw/s390x/s390-pci-bus.c | 10 +- hw/scsi/scsi-disk.c | 1 + hw/scsi/scsi-generic.c | 1 + hw/scsi/vhost-user-scsi.c | 1 + hw/sd/sd.c | 1 + hw/usb/ccid-card-passthru.c | 1 + hw/usb/dev-serial.c | 1 + hw/usb/redirect.c | 1 + hw/vfio/pci-quirks.c | 10 +- hw/vfio/pci.c | 1 + hw/virtio/vhost-user-fs.c | 1 + hw/virtio/vhost-user-vsock.c | 1 + hw/virtio/virtio-iommu-pci.c | 1 + hw/xen/xen_pt.c | 1 + migration/migration.c | 1 + target/sparc/cpu.c | 9 +- 85 files changed, 363 insertions(+), 452 deletions(-) create mode 100644 include/hw/qdev-properties-system.h
Signature · 1 line
2.28.0
[PULL 03/15] sparc: Use DEFINE_PROP for nwindows property
Use the DEFINE_PROP macro (which will set extra fields in the struct) instead of initializing a Property struct manually.
Message-Id: <[email protected]>
--- target/sparc/cpu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
target/sparc/cpu.c +2 -1
@@ -848,7 +848,8 @@ static Property sparc_cpu_properties[] = { qdev_prop_uint64, target_ulong),DEFINE_PROP_UINT32 ("fpu-version" ,SPARCCPU , env.def.fpu_version,0 ),DEFINE_PROP_UINT32 ("mmu-version" ,SPARCCPU , env.def.mmu_version,0 ), - { .name = "nwindows", .info = &qdev_prop_nwindows }, +DEFINE_PROP ("nwindows" ,SPARCCPU , env.def.nwindows, + qdev_prop_nwindows, uint32_t), DEFINE_PROP_END_OF_LIST() };
Signature · 1 line
2.28.0
[PULL 01/15] qdev: Move softmmu properties to qdev-properties-system.h
In reply to Eduardo HabkostMove the property types and property macros implemented in qdev-properties-system.c to a new qdev-properties-system.h header.
Message-Id: <[email protected]>
--- hw/core/qdev-properties-system.c | 1 + audio/audio.h | 1 + include/hw/block/block.h | 1 + include/hw/qdev-properties-system.h | 84 +++++++++++++++++++++++++++++ include/hw/qdev-properties.h | 75 -------------------------- include/net/net.h | 1 + hw/acpi/vmgenid.c | 1 + hw/arm/pxa2xx.c | 1 + hw/arm/strongarm.c | 1 + hw/block/fdc.c | 1 + hw/block/m25p80.c | 1 + hw/block/nand.c | 1 + hw/block/onenand.c | 1 + hw/block/pflash_cfi01.c | 1 + hw/block/pflash_cfi02.c | 1 + hw/block/vhost-user-blk.c | 1 + hw/char/avr_usart.c | 1 + hw/char/bcm2835_aux.c | 1 + hw/char/cadence_uart.c | 1 + hw/char/cmsdk-apb-uart.c | 1 + hw/char/debugcon.c | 1 + hw/char/digic-uart.c | 1 + hw/char/escc.c | 1 + hw/char/etraxfs_ser.c | 1 + hw/char/exynos4210_uart.c | 1 + hw/char/grlib_apbuart.c | 1 + hw/char/ibex_uart.c | 1 + hw/char/imx_serial.c | 1 + hw/char/ipoctal232.c | 1 + hw/char/lm32_juart.c | 1 + hw/char/lm32_uart.c | 1 + hw/char/mcf_uart.c | 1 + hw/char/milkymist-uart.c | 1 + hw/char/nrf51_uart.c | 1 + hw/char/parallel.c | 1 + hw/char/pl011.c | 1 + hw/char/renesas_sci.c | 1 + hw/char/sclpconsole-lm.c | 1 + hw/char/sclpconsole.c | 1 + hw/char/serial-pci-multi.c | 1 + hw/char/serial.c | 1 + hw/char/spapr_vty.c | 1 + hw/char/stm32f2xx_usart.c | 1 + hw/char/terminal3270.c | 1 + hw/char/virtio-console.c | 1 + hw/char/xilinx_uartlite.c | 1 + hw/hyperv/vmbus.c | 1 + hw/i386/kvm/i8254.c | 1 + hw/ide/qdev.c | 1 + hw/ipmi/ipmi_bmc_extern.c | 1 + hw/ipmi/ipmi_bmc_sim.c | 1 + hw/misc/allwinner-sid.c | 1 + hw/misc/ivshmem.c | 1 + hw/misc/mac_via.c | 1 + hw/misc/sifive_u_otp.c | 1 + hw/net/rocker/rocker.c | 1 + hw/nvram/eeprom_at24c.c | 1 + hw/nvram/spapr_nvram.c | 1 + hw/pci-bridge/gen_pcie_root_port.c | 1 + hw/pci/pci.c | 1 + hw/ppc/pnv_pnor.c | 1 + hw/rdma/vmw/pvrdma_main.c | 1 + hw/rtc/mc146818rtc.c | 1 + hw/scsi/scsi-disk.c | 1 + hw/scsi/scsi-generic.c | 1 + hw/scsi/vhost-user-scsi.c | 1 + hw/sd/sd.c | 1 + hw/usb/ccid-card-passthru.c | 1 + hw/usb/dev-serial.c | 1 + hw/usb/redirect.c | 1 + hw/vfio/pci.c | 1 + hw/virtio/vhost-user-fs.c | 1 + hw/virtio/vhost-user-vsock.c | 1 + hw/virtio/virtio-iommu-pci.c | 1 + hw/xen/xen_pt.c | 1 + migration/migration.c | 1 + 76 files changed, 158 insertions(+), 75 deletions(-) create mode 100644 include/hw/qdev-properties-system.h
hw/core/qdev-properties-system.c +1 -0
@@ -12,6 +12,7 @@#include "qemu/osdep.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "qapi/error.h" #include "qapi/visitor.h" #include "qapi/qapi-types-block.h"
audio/audio.h +1 -0
@@ -28,6 +28,7 @@#include "qemu/queue.h" #include "qapi/qapi-types-audio.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" typedef void (*audio_callback_fn ) (void *opaque,int avail);
include/hw/block/block.h +1 -0
@@ -13,6 +13,7 @@#include "exec/hwaddr.h" #include "qapi/qapi-types-block-core.h" +#include "hw/qdev-properties-system.h" /* Configuration */
include/hw/qdev-properties-system.h new file +84 -0
84 lines not on this page · raw message
include/hw/qdev-properties.h +0 -75
98 lines not on this page · raw message
include/net/net.h +1 -0
@@ -4,6 +4,7 @@#include "qemu/queue.h" #include "qapi/qapi-types-net.h" #include "net/queue.h" +#include "hw/qdev-properties-system.h" #define MAC_FMT "%02X:%02X:%02X:%02X:%02X:%02X"#define MAC_ARG (x) ((uint8_t *)(x))[0], ((uint8_t *)(x))[1], \
hw/acpi/vmgenid.c +1 -0
@@ -19,6 +19,7 @@#include "hw/acpi/vmgenid.h" #include "hw/nvram/fw_cfg.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "migration/vmstate.h" #include "sysemu/reset.h"
hw/arm/pxa2xx.c +1 -0
@@ -21,6 +21,7 @@#include "hw/i2c/i2c.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/ssi/ssi.h" #include "hw/sd/sd.h" #include "chardev/char-fe.h"
hw/arm/strongarm.c +1 -0
@@ -33,6 +33,7 @@#include "hw/boards.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/sysbus.h" #include "migration/vmstate.h" #include "strongarm.h"
hw/block/fdc.c +1 -0
@@ -36,6 +36,7 @@#include "hw/irq.h" #include "hw/isa/isa.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/sysbus.h" #include "migration/vmstate.h" #include "hw/block/block.h"
hw/block/m25p80.c +1 -0
@@ -25,6 +25,7 @@#include "qemu/units.h" #include "sysemu/block-backend.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/ssi/ssi.h" #include "migration/vmstate.h" #include "qemu/bitops.h"
hw/block/nand.c +1 -0
@@ -21,6 +21,7 @@#include "qemu/osdep.h" #include "hw/hw.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/block/flash.h" #include "sysemu/block-backend.h" #include "migration/vmstate.h"
hw/block/onenand.c +1 -0
@@ -24,6 +24,7 @@#include "hw/block/flash.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "sysemu/block-backend.h" #include "exec/memory.h" #include "hw/sysbus.h"
hw/block/pflash_cfi01.c +1 -0
@@ -40,6 +40,7 @@#include "hw/block/block.h" #include "hw/block/flash.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "sysemu/block-backend.h" #include "qapi/error.h" #include "qemu/error-report.h"
hw/block/pflash_cfi02.c +1 -0
@@ -36,6 +36,7 @@#include "hw/block/block.h" #include "hw/block/flash.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "qapi/error.h" #include "qemu/error-report.h" #include "qemu/bitmap.h"
hw/block/vhost-user-blk.c +1 -0
@@ -22,6 +22,7 @@#include "qemu/cutils.h" #include "hw/qdev-core.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/virtio/vhost.h" #include "hw/virtio/vhost-user-blk.h" #include "hw/virtio/virtio.h"
hw/char/avr_usart.c +1 -0
@@ -24,6 +24,7 @@#include "qemu/log.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" static int avr_usart_can_receive (void *opaque) {
hw/char/bcm2835_aux.c +1 -0
@@ -24,6 +24,7 @@#include "hw/char/bcm2835_aux.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "migration/vmstate.h" #include "qemu/log.h" #include "qemu/module.h"
hw/char/cadence_uart.c +1 -0
@@ -32,6 +32,7 @@#include "hw/char/cadence_uart.h" #include "hw/irq.h" #include "hw/qdev-clock.h" +#include "hw/qdev-properties-system.h" #include "trace.h" #ifdef CADENCE_UART_ERR_DEBUG
hw/char/cmsdk-apb-uart.c +1 -0
@@ -27,6 +27,7 @@#include "chardev/char-serial.h" #include "hw/char/cmsdk-apb-uart.h" #include "hw/irq.h" +#include "hw/qdev-properties-system.h" REG32(DATA, 0)REG32 (STATE ,4 )
hw/char/debugcon.c +1 -0
@@ -30,6 +30,7 @@#include "chardev/char-fe.h" #include "hw/isa/isa.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "qom/object.h" #define TYPE_ISA_DEBUGCON_DEVICE "isa-debugcon"
hw/char/digic-uart.c +1 -0
@@ -35,6 +35,7 @@#include "hw/char/digic-uart.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" enum {ST_RX_RDY = (1 <<0 ),
hw/char/escc.c +1 -0
@@ -25,6 +25,7 @@#include "qemu/osdep.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/sysbus.h" #include "migration/vmstate.h" #include "qemu/module.h"
hw/char/etraxfs_ser.c +1 -0
@@ -25,6 +25,7 @@#include "qemu/osdep.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/sysbus.h" #include "chardev/char-fe.h" #include "qemu/log.h"
hw/char/exynos4210_uart.c +1 -0
@@ -32,6 +32,7 @@#include "hw/arm/exynos4210.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "trace.h" #include "qom/object.h"
hw/char/grlib_apbuart.c +1 -0
@@ -25,6 +25,7 @@#include "qemu/osdep.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/sparc/grlib.h" #include "hw/sysbus.h" #include "qemu/module.h"
hw/char/ibex_uart.c +1 -0
@@ -30,6 +30,7 @@#include "hw/irq.h" #include "hw/qdev-clock.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "migration/vmstate.h" #include "qemu/log.h" #include "qemu/module.h"
hw/char/imx_serial.c +1 -0
@@ -22,6 +22,7 @@#include "hw/char/imx_serial.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "migration/vmstate.h" #include "qemu/log.h" #include "qemu/module.h"
hw/char/ipoctal232.c +1 -0
@@ -12,6 +12,7 @@#include "hw/ipack/ipack.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "migration/vmstate.h" #include "qemu/bitops.h" #include "qemu/module.h"
hw/char/lm32_juart.c +1 -0
@@ -26,6 +26,7 @@#include "hw/char/lm32_juart.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "qom/object.h" enum {
hw/char/lm32_uart.c +1 -0
@@ -25,6 +25,7 @@#include "qemu/osdep.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/sysbus.h" #include "migration/vmstate.h" #include "trace.h"
hw/char/mcf_uart.c +1 -0
@@ -13,6 +13,7 @@#include "qapi/error.h" #include "hw/m68k/mcf.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "chardev/char-fe.h" #include "qom/object.h"
hw/char/milkymist-uart.c +1 -0
@@ -24,6 +24,7 @@#include "qemu/osdep.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/sysbus.h" #include "migration/vmstate.h" #include "trace.h"
hw/char/nrf51_uart.c +1 -0
@@ -18,6 +18,7 @@#include "hw/char/nrf51_uart.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "migration/vmstate.h" #include "trace.h"
hw/char/parallel.c +1 -0
@@ -32,6 +32,7 @@#include "hw/irq.h" #include "hw/isa/isa.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "migration/vmstate.h" #include "hw/char/parallel.h" #include "sysemu/reset.h"
hw/char/pl011.c +1 -0
@@ -23,6 +23,7 @@#include "hw/irq.h" #include "hw/sysbus.h" #include "hw/qdev-clock.h" +#include "hw/qdev-properties-system.h" #include "migration/vmstate.h" #include "chardev/char-fe.h" #include "qemu/log.h"
hw/char/renesas_sci.c +1 -0
@@ -26,6 +26,7 @@#include "hw/irq.h" #include "hw/registerfields.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/char/renesas_sci.h" #include "migration/vmstate.h"
hw/char/sclpconsole-lm.c +1 -0
@@ -23,6 +23,7 @@#include "migration/vmstate.h" #include "hw/s390x/event-facility.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/s390x/ebcdic.h" #include "qom/object.h"
hw/char/sclpconsole.c +1 -0
@@ -20,6 +20,7 @@#include "hw/s390x/sclp.h" #include "migration/vmstate.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/s390x/event-facility.h" #include "chardev/char-fe.h" #include "qom/object.h"
hw/char/serial-pci-multi.c +1 -0
@@ -33,6 +33,7 @@#include "hw/irq.h" #include "hw/pci/pci.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "migration/vmstate.h" #define PCI_SERIAL_MAX_PORTS 4
hw/char/serial.c +1 -0
@@ -36,6 +36,7 @@#include "qemu/error-report.h" #include "trace.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #define UART_LCR_DLAB 0x80/* Divisor latch access bit */
hw/char/spapr_vty.c +1 -0
@@ -8,6 +8,7 @@#include "hw/ppc/spapr.h" #include "hw/ppc/spapr_vio.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "qom/object.h" #define VTERM_BUFSIZE 16
hw/char/stm32f2xx_usart.c +1 -0
@@ -26,6 +26,7 @@#include "hw/char/stm32f2xx_usart.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "qemu/log.h" #include "qemu/module.h"
hw/char/terminal3270.c +1 -0
@@ -16,6 +16,7 @@#include "qemu/module.h" #include "chardev/char-fe.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/s390x/3270-ccw.h" #include "qom/object.h"
hw/char/virtio-console.c +1 -0
@@ -16,6 +16,7 @@#include "qemu/module.h" #include "trace.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/virtio/virtio-serial.h" #include "qapi/error.h" #include "qapi/qapi-events-char.h"
hw/char/xilinx_uartlite.c +1 -0
@@ -26,6 +26,7 @@#include "qemu/log.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/sysbus.h" #include "qemu/module.h" #include "chardev/char-fe.h"
hw/hyperv/vmbus.c +1 -0
@@ -13,6 +13,7 @@#include "qapi/error.h" #include "migration/vmstate.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/hyperv/hyperv.h" #include "hw/hyperv/vmbus.h" #include "hw/hyperv/vmbus-bridge.h"
hw/i386/kvm/i8254.c +1 -0
@@ -32,6 +32,7 @@#include "sysemu/runstate.h" #include "hw/timer/i8254.h" #include "hw/timer/i8254_internal.h" +#include "hw/qdev-properties-system.h" #include "sysemu/kvm.h" #include "qom/object.h"
hw/ide/qdev.c +1 -0
@@ -26,6 +26,7 @@#include "qemu/module.h" #include "hw/ide/internal.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "sysemu/block-backend.h" #include "sysemu/blockdev.h" #include "hw/block/block.h"
hw/ipmi/ipmi_bmc_extern.c +1 -0
@@ -35,6 +35,7 @@#include "chardev/char-fe.h" #include "hw/ipmi/ipmi.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "migration/vmstate.h" #include "qom/object.h"
hw/ipmi/ipmi_bmc_sim.c +1 -0
@@ -30,6 +30,7 @@#include "qemu/module.h" #include "hw/loader.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "migration/vmstate.h" #define IPMI_NETFN_CHASSIS 0x00
hw/misc/allwinner-sid.c +1 -0
@@ -26,6 +26,7 @@#include "qemu/guest-random.h" #include "qapi/error.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/misc/allwinner-sid.h" #include "trace.h"
hw/misc/ivshmem.c +1 -0
@@ -23,6 +23,7 @@#include "qemu/cutils.h" #include "hw/pci/pci.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/pci/msi.h" #include "hw/pci/msix.h" #include "sysemu/kvm.h"
hw/misc/mac_via.c +1 -0
@@ -28,6 +28,7 @@#include "qapi/error.h" #include "qemu/cutils.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "sysemu/block-backend.h" #include "trace.h" #include "qemu/log.h"
hw/misc/sifive_u_otp.c +1 -0
@@ -21,6 +21,7 @@#include "qemu/osdep.h" #include "qapi/error.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/sysbus.h" #include "qemu/log.h" #include "qemu/module.h"
hw/net/rocker/rocker.c +1 -0
@@ -18,6 +18,7 @@#include "qemu/osdep.h" #include "hw/pci/pci.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "migration/vmstate.h" #include "hw/pci/msix.h" #include "net/net.h"
hw/nvram/eeprom_at24c.c +1 -0
@@ -13,6 +13,7 @@#include "qemu/module.h" #include "hw/i2c/i2c.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "sysemu/block-backend.h" #include "qom/object.h"
hw/nvram/spapr_nvram.c +1 -0
@@ -39,6 +39,7 @@#include "hw/ppc/spapr.h" #include "hw/ppc/spapr_vio.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "qom/object.h" struct SpaprNvram {
hw/pci-bridge/gen_pcie_root_port.c +1 -0
@@ -16,6 +16,7 @@#include "hw/pci/msix.h" #include "hw/pci/pcie_port.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "migration/vmstate.h" #include "qom/object.h"
hw/pci/pci.c +1 -0
@@ -31,6 +31,7 @@#include "hw/pci/pci_bus.h" #include "hw/pci/pci_host.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "migration/qemu-file-types.h" #include "migration/vmstate.h" #include "monitor/monitor.h"
hw/ppc/pnv_pnor.c +1 -0
@@ -17,6 +17,7 @@#include "hw/loader.h" #include "hw/ppc/pnv_pnor.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" static uint64_t pnv_pnor_read (void *opaque,hwaddr addr,unsigned size) {
hw/rdma/vmw/pvrdma_main.c +1 -0
@@ -21,6 +21,7 @@#include "hw/pci/msi.h" #include "hw/pci/msix.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "cpu.h" #include "trace.h" #include "monitor/monitor.h"
hw/rtc/mc146818rtc.c +1 -0
@@ -30,6 +30,7 @@#include "hw/acpi/aml-build.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "qemu/timer.h" #include "sysemu/sysemu.h" #include "sysemu/replay.h"
hw/scsi/scsi-disk.c +1 -0
@@ -34,6 +34,7 @@#include "sysemu/blockdev.h" #include "hw/block/block.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "sysemu/dma.h" #include "sysemu/sysemu.h" #include "qemu/cutils.h"
hw/scsi/scsi-generic.c +1 -0
@@ -19,6 +19,7 @@#include "hw/scsi/scsi.h" #include "migration/qemu-file-types.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/scsi/emulation.h" #include "sysemu/block-backend.h" #include "trace.h"
hw/scsi/vhost-user-scsi.c +1 -0
@@ -21,6 +21,7 @@#include "hw/fw-path-provider.h" #include "hw/qdev-core.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/virtio/vhost.h" #include "hw/virtio/vhost-backend.h" #include "hw/virtio/vhost-user-scsi.h"
hw/sd/sd.c +1 -0
@@ -42,6 +42,7 @@#include "qapi/error.h" #include "qemu/bitmap.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "qemu/error-report.h" #include "qemu/timer.h" #include "qemu/log.h"
hw/usb/ccid-card-passthru.c +1 -0
@@ -14,6 +14,7 @@#include <libcacard.h> #include "chardev/char-fe.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "migration/vmstate.h" #include "qemu/error-report.h" #include "qemu/module.h"
hw/usb/dev-serial.c +1 -0
@@ -14,6 +14,7 @@#include "qemu/error-report.h" #include "qemu/module.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/usb.h" #include "migration/vmstate.h" #include "desc.h"
hw/usb/redirect.c +1 -0
@@ -42,6 +42,7 @@#include <usbredirfilter.h> #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/usb.h" #include "migration/qemu-file-types.h" #include "migration/vmstate.h"
hw/vfio/pci.c +1 -0
@@ -27,6 +27,7 @@#include "hw/pci/msix.h" #include "hw/pci/pci_bridge.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "migration/vmstate.h" #include "qemu/error-report.h" #include "qemu/main-loop.h"
hw/virtio/vhost-user-fs.c +1 -0
@@ -16,6 +16,7 @@#include "standard-headers/linux/virtio_fs.h" #include "qapi/error.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/virtio/virtio-bus.h" #include "hw/virtio/virtio-access.h" #include "qemu/error-report.h"
hw/virtio/vhost-user-vsock.c +1 -0
@@ -13,6 +13,7 @@#include "qapi/error.h" #include "qemu/error-report.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/virtio/vhost-user-vsock.h" static const int user_feature_bits[] = {
hw/virtio/virtio-iommu-pci.c +1 -0
@@ -14,6 +14,7 @@#include "virtio-pci.h" #include "hw/virtio/virtio-iommu.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "qapi/error.h" #include "hw/boards.h" #include "qom/object.h"
hw/xen/xen_pt.c +1 -0
@@ -58,6 +58,7 @@#include "hw/pci/pci.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/xen/xen.h" #include "hw/i386/pc.h" #include "hw/xen/xen-legacy-backend.h"
migration/migration.c +1 -0
@@ -52,6 +52,7 @@#include "migration/colo.h" #include "hw/boards.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "monitor/monitor.h" #include "net/announce.h" #include "qemu/queue.h"
Signature · 1 line
2.28.0
[PULL 11/15] qdev: Make qdev_class_add_property() more flexible
In reply to Eduardo HabkostSupport Property.set_default and PropertyInfo.description even if PropertyInfo.create is set.
Message-Id: <[email protected]>
--- hw/core/qdev-properties.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
hw/core/qdev-properties.c +6 -8
@@ -863,24 +863,22 @@ static void qdev_class_add_property(DeviceClass *klass, const char *name, Property *prop) {ObjectClass *oc =OBJECT_CLASS (klass); +ObjectProperty *op;if (prop->info->create) { - prop->info->create (oc, name, prop); + op = prop->info->create (oc, name, prop); }else { -ObjectProperty *op; - op =object_class_property_add (oc, name, prop->info->name,field_prop_getter (prop->info),field_prop_setter (prop->info), prop->info->release, prop); -if (prop->set_default) { - prop->info->set_default_value (op, prop); - } } -object_class_property_set_description (oc, name, - prop->info->description); +if (prop->set_default) { + prop->info->set_default_value (op, prop); + } +object_class_property_set_description (oc, name, prop->info->description); }/**
Signature · 1 line
2.28.0
[PULL 06/15] qdev: Add name parameter to qdev_class_add_property()
In reply to Eduardo HabkostThis will make it easier to remove Property.name in the future.
Message-Id: <[email protected]>
--- hw/core/qdev-properties.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
hw/core/qdev-properties.c +5 -4
@@ -887,7 +887,8 @@ void qdev_property_add_static(DeviceState *dev, Property *prop) } } -static void qdev_class_add_property (DeviceClass *klass,Property *prop) +static void qdev_class_add_property (DeviceClass *klass,const char *name, +Property *prop) {ObjectClass *oc =OBJECT_CLASS (klass);
@@ -897,7 +898,7 @@ static void qdev_class_add_property(DeviceClass *klass, Property *prop)ObjectProperty *op; op =object_class_property_add (oc, - prop->name, prop->info->name, + name, prop->info->name, prop->info->get, prop->info->set, prop->info->release, prop);
@@ -905,7 +906,7 @@ static void qdev_class_add_property(DeviceClass *klass, Property *prop) prop->info->set_default_value (op, prop); } } -object_class_property_set_description (oc, prop->name, +object_class_property_set_description (oc, name, prop->info->description); }
@@ -962,7 +963,7 @@ void device_class_set_props(DeviceClass *dc, Property *props) dc->props_ = props;for (prop = props; prop && prop->name; prop++) {qdev_class_add_legacy_property (dc, prop); -qdev_class_add_property (dc, prop); +qdev_class_add_property (dc, prop->name, prop); } }
Signature · 1 line
2.28.0
[PULL 05/15] qdev: Avoid using prop->name unnecessarily
In reply to Eduardo HabkostWe already get the property name as argument to the property getter and setters, we don't need to use prop->name. This will make it easier to remove the Property.name field in the future.
Message-Id: <[email protected]>
--- hw/core/qdev-properties-system.c | 14 +++++++------- hw/core/qdev-properties.c | 4 ++-- backends/tpm/tpm_util.c | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-)
hw/core/qdev-properties-system.c +7 -7
@@ -141,7 +141,7 @@ static void set_drive_helper(Object *obj, Visitor *v, const char *name, }if (!blk) {error_setg (errp,"Property '%s.%s' can't find value '%s'" , -object_get_typename (OBJECT (dev)), prop->name, str); +object_get_typename (OBJECT (dev)), name, str); goto fail; }if (blk_attach_dev (blk, dev) <0 ) {
@@ -262,10 +262,10 @@ static void set_chr(Object *obj, Visitor *v, const char *name, void *opaque, s =qemu_chr_find (str);if (s ==NULL ) {error_setg (errp,"Property '%s.%s' can't find value '%s'" , -object_get_typename (obj), prop->name, str); +object_get_typename (obj), name, str); }else if (!qemu_chr_fe_init (be, s, errp)) {error_prepend (errp,"Property '%s.%s' can't take value '%s': " , -object_get_typename (obj), prop->name, str); +object_get_typename (obj), name, str); }g_free (str); }
@@ -966,7 +966,7 @@ static void get_prop_pcielinkspeed(Object *obj, Visitor *v, const char *name,abort (); } -visit_type_enum (v, prop->name, &speed, prop->info->enum_table, errp); +visit_type_enum (v, name, &speed, prop->info->enum_table, errp); } static void set_prop_pcielinkspeed(Object *obj, Visitor *v, const char *name,
@@ -982,7 +982,7 @@ static void set_prop_pcielinkspeed(Object *obj, Visitor *v, const char *name,return ; } -if (!visit_type_enum (v, prop->name, &speed, prop->info->enum_table, +if (!visit_type_enum (v, name, &speed, prop->info->enum_table, errp)) {return ; }
@@ -1051,7 +1051,7 @@ static void get_prop_pcielinkwidth(Object *obj, Visitor *v, const char *name,abort (); } -visit_type_enum (v, prop->name, &width, prop->info->enum_table, errp); +visit_type_enum (v, name, &width, prop->info->enum_table, errp); } static void set_prop_pcielinkwidth(Object *obj, Visitor *v, const char *name,
@@ -1067,7 +1067,7 @@ static void set_prop_pcielinkwidth(Object *obj, Visitor *v, const char *name,return ; } -if (!visit_type_enum (v, prop->name, &width, prop->info->enum_table, +if (!visit_type_enum (v, name, &width, prop->info->enum_table, errp)) {return ; }
hw/core/qdev-properties.c +2 -2
@@ -50,7 +50,7 @@ void qdev_propinfo_get_enum(Object *obj, Visitor *v, const char *name,Property *prop = opaque;int *ptr =qdev_get_prop_ptr (obj, prop); -visit_type_enum (v, prop->name, ptr, prop->info->enum_table, errp); +visit_type_enum (v, name, ptr, prop->info->enum_table, errp); } void qdev_propinfo_set_enum(Object *obj, Visitor *v, const char *name,
@@ -65,7 +65,7 @@ void qdev_propinfo_set_enum(Object *obj, Visitor *v, const char *name,return ; } -visit_type_enum (v, prop->name, ptr, prop->info->enum_table, errp); +visit_type_enum (v, name, ptr, prop->info->enum_table, errp); } void qdev_propinfo_set_default_value_enum(ObjectProperty *op,
backends/tpm/tpm_util.c +1 -1
@@ -63,7 +63,7 @@ static void set_tpm(Object *obj, Visitor *v, const char *name, void *opaque, s =qemu_find_tpm_be (str);if (s ==NULL ) {error_setg (errp,"Property '%s.%s' can't find value '%s'" , -object_get_typename (obj), prop->name, str); +object_get_typename (obj), name, str); }else if (tpm_backend_init (s,TPM_IF (obj), errp) ==0 ) { *be = s;/* weak reference, avoid cyclic ref */ }
Signature · 1 line
2.28.0
[PULL 12/15] qdev: Move qdev_prop_tpm declaration to tpm_prop.h
In reply to Eduardo HabkostMove the variable declaration close to the macro that uses it.
Message-Id: <[email protected]>
--- hw/tpm/tpm_prop.h | 2 ++ include/hw/qdev-properties.h | 1 - 2 files changed, 2 insertions(+), 1 deletion(-)
hw/tpm/tpm_prop.h +2 -0
@@ -25,6 +25,8 @@#include "sysemu/tpm_backend.h" #include "hw/qdev-properties.h" +extern const PropertyInfo qdev_prop_tpm; +#define DEFINE_PROP_TPMBE (_n, _s, _f) \ DEFINE_PROP(_n, _s, _f, qdev_prop_tpm, TPMBackend *)
include/hw/qdev-properties.h +0 -1
@@ -56,7 +56,6 @@ extern const PropertyInfo qdev_prop_uint64;extern const PropertyInfo qdev_prop_int64;extern const PropertyInfo qdev_prop_size;extern const PropertyInfo qdev_prop_string; -extern const PropertyInfo qdev_prop_tpm;extern const PropertyInfo qdev_prop_on_off_auto;extern const PropertyInfo qdev_prop_size32;extern const PropertyInfo qdev_prop_arraylen;
Signature · 1 line
2.28.0
[PULL 02/15] qdev: Reuse DEFINE_PROP in all DEFINE_PROP_* macros
In reply to Eduardo HabkostInstead of duplicating the code that sets name, info, offset, and does type checking, make DEFINE_PROP accept a variable number of arguments and reuse it in all DEFINE_PROP_* macros.
Message-Id: <[email protected]>
--- include/hw/qdev-properties-system.h | 19 ++--- include/hw/qdev-properties.h | 114 ++++++++++------------------ 2 files changed, 46 insertions(+), 87 deletions(-)
include/hw/qdev-properties-system.h +6 -13
@@ -63,22 +63,15 @@ extern const PropertyInfo qdev_prop_pcie_link_width;DEFINE_PROP_SIGNED (_n, _s, _f, _d, qdev_prop_pcie_link_width, \ PCIExpLinkWidth) -#define DEFINE_PROP_UUID (_name, _state, _field) { \ - .name = (_name), \ - .info = &qdev_prop_uuid, \ - .offset = offsetof(_state, _field) \ - + type_check(QemuUUID, typeof_field(_state, _field)), \ - .set_default = true, \ - } +#define DEFINE_PROP_UUID (_name, _state, _field) \ + DEFINE_PROP(_name, _state, _field, qdev_prop_uuid, QemuUUID, \ + .set_default = true) +#define DEFINE_PROP_AUDIODEV (_n, _s, _f) \ DEFINE_PROP(_n, _s, _f, qdev_prop_audiodev, QEMUSoundCard) -#define DEFINE_PROP_UUID_NODEFAULT (_name, _state, _field) { \ - .name = (_name), \ - .info = &qdev_prop_uuid, \ - .offset = offsetof(_state, _field) \ - + type_check(QemuUUID, typeof_field(_state, _field)), \ - } +#define DEFINE_PROP_UUID_NODEFAULT (_name, _state, _field) \ + DEFINE_PROP(_name, _state, _field, qdev_prop_uuid, QemuUUID)#endif
include/hw/qdev-properties.h +40 -74
139 lines not on this page · raw message
Signature · 1 line
2.28.0
[PULL 07/15] qdev: Add name argument to PropertyInfo.create method
In reply to Eduardo HabkostThis will make it easier to remove the Property.name field in the future.
Message-Id: <[email protected]>
--- hw/core/qdev-properties.c | 7 ++++--- include/hw/qdev-properties.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-)
hw/core/qdev-properties.c +4 -3
@@ -851,9 +851,10 @@ const PropertyInfo qdev_prop_size = {/* --- object link property --- */ -static void create_link_property (ObjectClass *oc,Property *prop) +static void create_link_property (ObjectClass *oc,const char *name, +Property *prop) { -object_class_property_add_link (oc, prop->name, prop->link_type, +object_class_property_add_link (oc, name, prop->link_type, prop->offset, qdev_prop_allow_set_link_before_realize,OBJ_PROP_LINK_STRONG );
@@ -893,7 +894,7 @@ static void qdev_class_add_property(DeviceClass *klass, const char *name,ObjectClass *oc =OBJECT_CLASS (klass);if (prop->info->create) { - prop->info->create (oc, prop); + prop->info->create (oc, name, prop); }else {ObjectProperty *op;
include/hw/qdev-properties.h +1 -1
@@ -34,7 +34,7 @@ struct PropertyInfo {const QEnumLookup *enum_table;int (*print)(Object *obj,Property *prop,char *dest,size_t len);void (*set_default_value)(ObjectProperty *op,const Property *prop); -void (*create)(ObjectClass *oc,Property *prop); +void (*create)(ObjectClass *oc,const char *name,Property *prop);ObjectPropertyAccessor *get;ObjectPropertyAccessor *set;ObjectPropertyRelease *release;
Signature · 1 line
2.28.0
[PULL 08/15] qdev: Wrap getters and setters in separate helpers
In reply to Eduardo HabkostWe'll add extra code to the qdev property getters and setters, so add wrapper functions where additional actions can be performed.
The new functions have a "field_prop_" prefix instead of "qdev_" because the code will eventually be moved outside qdev-properties.c, to common QOM code.
Message-Id: <[email protected]>
--- hw/core/qdev-properties.c | 44 +++++++++++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 4 deletions(-)
hw/core/qdev-properties.c +40 -4
@@ -44,6 +44,40 @@ void *qdev_get_prop_ptr(Object *obj, Property *prop)return ptr; } +static void field_prop_get (Object *obj,Visitor *v,const char *name, +void *opaque,Error **errp) +{ +Property *prop = opaque; +return prop->info->get (obj, v, name, opaque, errp); +} + +/** +* field_prop_getter: Return getter function to be used for property +* +* Return value can be NULL if @info has no getter function. +*/ +static ObjectPropertyAccessor *field_prop_getter (const PropertyInfo *info) +{ +return info->get ? field_prop_get :NULL ; +} + +static void field_prop_set (Object *obj,Visitor *v,const char *name, +void *opaque,Error **errp) +{ +Property *prop = opaque; +return prop->info->set (obj, v, name, opaque, errp); +} + +/** +* field_prop_setter: Return setter function to be used for property +* +* Return value can be NULL if @info has not setter function. +*/ +static ObjectPropertyAccessor *field_prop_setter (const PropertyInfo *info) +{ +return info->set ? field_prop_set :NULL ; +} +void qdev_propinfo_get_enum (Object *obj,Visitor *v,const char *name,void *opaque,Error **errp) {
@@ -630,8 +664,8 @@ static void set_prop_arraylen(Object *obj, Visitor *v, const char *name,assert (qdev_get_prop_ptr (obj, &arrayprop->prop) == eltptr);object_property_add (obj, propname, arrayprop->prop.info->name, - arrayprop->prop.info->get, - arrayprop->prop.info->set, +field_prop_getter (arrayprop->prop.info), +field_prop_setter (arrayprop->prop.info), array_element_release, arrayprop); }
@@ -873,7 +907,8 @@ void qdev_property_add_static(DeviceState *dev, Property *prop)assert (!prop->info->create); op =object_property_add (obj, prop->name, prop->info->name, - prop->info->get, prop->info->set, +field_prop_getter (prop->info), +field_prop_setter (prop->info), prop->info->release, prop);
@@ -900,7 +935,8 @@ static void qdev_class_add_property(DeviceClass *klass, const char *name, op =object_class_property_add (oc, name, prop->info->name, - prop->info->get, prop->info->set, +field_prop_getter (prop->info), +field_prop_setter (prop->info), prop->info->release, prop);if (prop->set_default) {
Signature · 1 line
2.28.0
[PULL 13/15] qdev: Rename qdev_get_prop_ptr() to object_field_prop_ptr()
In reply to Eduardo HabkostThe function will be moved to common QOM code, as it is not specific to TYPE_DEVICE anymore.
Message-Id: <[email protected]>
--- hw/core/qdev-properties-system.c | 50 +++++++++++++------------- hw/core/qdev-properties.c | 60 ++++++++++++++++---------------- include/hw/qdev-properties.h | 2 +- backends/tpm/tpm_util.c | 6 ++-- hw/block/xen-block.c | 4 +-- hw/s390x/css.c | 4 +-- hw/s390x/s390-pci-bus.c | 4 +-- hw/vfio/pci-quirks.c | 4 +-- 8 files changed, 67 insertions(+), 67 deletions(-)
hw/core/qdev-properties-system.c +25 -25
@@ -62,7 +62,7 @@ static void get_drive(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) {Property *prop = opaque; -void **ptr =qdev_get_prop_ptr (obj, prop); +void **ptr =object_field_prop_ptr (obj, prop);const char *value;char *p;
@@ -88,7 +88,7 @@ static void set_drive_helper(Object *obj, Visitor *v, const char *name, {DeviceState *dev =DEVICE (obj);Property *prop = opaque; -void **ptr =qdev_get_prop_ptr (obj, prop); +void **ptr =object_field_prop_ptr (obj, prop);char *str;BlockBackend *blk;bool blk_created = false;
@@ -181,7 +181,7 @@ static void release_drive(Object *obj, const char *name, void *opaque) {DeviceState *dev =DEVICE (obj);Property *prop = opaque; -BlockBackend **ptr =qdev_get_prop_ptr (obj, prop); +BlockBackend **ptr =object_field_prop_ptr (obj, prop);if (*ptr) {AioContext *ctx =blk_get_aio_context (*ptr);
@@ -214,7 +214,7 @@ const PropertyInfo qdev_prop_drive_iothread = {static void get_chr (Object *obj,Visitor *v,const char *name,void *opaque,Error **errp) { -CharBackend *be =qdev_get_prop_ptr (obj, opaque); +CharBackend *be =object_field_prop_ptr (obj, opaque);char *p; p =g_strdup (be->chr && be->chr->label ? be->chr->label :"" );
@@ -226,7 +226,7 @@ static void set_chr(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) {Property *prop = opaque; -CharBackend *be =qdev_get_prop_ptr (obj, prop); +CharBackend *be =object_field_prop_ptr (obj, prop);Chardev *s;char *str;
@@ -262,7 +262,7 @@ static void set_chr(Object *obj, Visitor *v, const char *name, void *opaque,static void release_chr (Object *obj,const char *name,void *opaque) {Property *prop = opaque; -CharBackend *be =qdev_get_prop_ptr (obj, prop); +CharBackend *be =object_field_prop_ptr (obj, prop);qemu_chr_fe_deinit (be, false); }
@@ -286,7 +286,7 @@ static void get_mac(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) {Property *prop = opaque; -MACAddr *mac =qdev_get_prop_ptr (obj, prop); +MACAddr *mac =object_field_prop_ptr (obj, prop);char buffer[2 *6 +5 +1 ];char *p = buffer;
@@ -301,7 +301,7 @@ static void set_mac(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) {Property *prop = opaque; -MACAddr *mac =qdev_get_prop_ptr (obj, prop); +MACAddr *mac =object_field_prop_ptr (obj, prop);int i, pos;char *str;const char *p;
@@ -363,7 +363,7 @@ static void get_netdev(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; -NICPeers *peers_ptr =qdev_get_prop_ptr (obj, prop); +NICPeers *peers_ptr =object_field_prop_ptr (obj, prop);char *p =g_strdup (peers_ptr->ncs[0 ] ? peers_ptr->ncs[0 ]->name :"" );visit_type_str (v, name, &p, errp);
@@ -374,7 +374,7 @@ static void set_netdev(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; -NICPeers *peers_ptr =qdev_get_prop_ptr (obj, prop); +NICPeers *peers_ptr =object_field_prop_ptr (obj, prop);NetClientState **ncs = peers_ptr->ncs;NetClientState *peers[MAX_QUEUE_NUM ];int queues, err =0 , i =0 ;
@@ -436,7 +436,7 @@ static void get_audiodev(Object *obj, Visitor *v, const char* name, void *opaque, Error **errp) { Property *prop = opaque; -QEMUSoundCard *card =qdev_get_prop_ptr (obj, prop); +QEMUSoundCard *card =object_field_prop_ptr (obj, prop);char *p =g_strdup (audio_get_id (card));visit_type_str (v, name, &p, errp);
@@ -447,7 +447,7 @@ static void set_audiodev(Object *obj, Visitor *v, const char* name, void *opaque, Error **errp) { Property *prop = opaque; -QEMUSoundCard *card =qdev_get_prop_ptr (obj, prop); +QEMUSoundCard *card =object_field_prop_ptr (obj, prop);AudioState *state;int err =0 ;char *str;
@@ -549,7 +549,7 @@ static void set_blocksize(Object *obj, Visitor *v, const char *name, {DeviceState *dev =DEVICE (obj);Property *prop = opaque; -uint32_t *ptr =qdev_get_prop_ptr (obj, prop); +uint32_t *ptr =object_field_prop_ptr (obj, prop);uint64_t value;Error *local_err =NULL ;
@@ -637,7 +637,7 @@ static void get_reserved_region(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; -ReservedRegion *rr =qdev_get_prop_ptr (obj, prop); +ReservedRegion *rr =object_field_prop_ptr (obj, prop);char buffer[64 ];char *p = buffer;int rc;
@@ -653,7 +653,7 @@ static void set_reserved_region(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; -ReservedRegion *rr =qdev_get_prop_ptr (obj, prop); +ReservedRegion *rr =object_field_prop_ptr (obj, prop);Error *local_err =NULL ;const char *endptr;char *str;
@@ -715,7 +715,7 @@ static void set_pci_devfn(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; -int32_t value, *ptr =qdev_get_prop_ptr (obj, prop); +int32_t value, *ptr =object_field_prop_ptr (obj, prop);unsigned int slot, fn, n;char *str;
@@ -753,7 +753,7 @@ invalid:static int print_pci_devfn (Object *obj,Property *prop,char *dest,size_t len) { -int32_t *ptr =qdev_get_prop_ptr (obj, prop); +int32_t *ptr =object_field_prop_ptr (obj, prop);if (*ptr ==-1 ) {return snprintf (dest, len,"<unset>" );
@@ -777,7 +777,7 @@ static void get_pci_host_devaddr(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; -PCIHostDeviceAddress *addr =qdev_get_prop_ptr (obj, prop); +PCIHostDeviceAddress *addr =object_field_prop_ptr (obj, prop);char buffer[] ="ffff:ff:ff.f" ;char *p = buffer;int rc =0 ;
@@ -803,7 +803,7 @@ static void set_pci_host_devaddr(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; -PCIHostDeviceAddress *addr =qdev_get_prop_ptr (obj, prop); +PCIHostDeviceAddress *addr =object_field_prop_ptr (obj, prop);char *str, *p;char *e;unsigned long val;
@@ -893,7 +893,7 @@ static void get_prop_pcielinkspeed(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; -PCIExpLinkSpeed *p =qdev_get_prop_ptr (obj, prop); +PCIExpLinkSpeed *p =object_field_prop_ptr (obj, prop);int speed;switch (*p) {
@@ -921,7 +921,7 @@ static void set_prop_pcielinkspeed(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; -PCIExpLinkSpeed *p =qdev_get_prop_ptr (obj, prop); +PCIExpLinkSpeed *p =object_field_prop_ptr (obj, prop);int speed; if (!visit_type_enum(v, name, &speed, prop->info->enum_table,
@@ -963,7 +963,7 @@ static void get_prop_pcielinkwidth(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; -PCIExpLinkWidth *p =qdev_get_prop_ptr (obj, prop); +PCIExpLinkWidth *p =object_field_prop_ptr (obj, prop);int width;switch (*p) {
@@ -1000,7 +1000,7 @@ static void set_prop_pcielinkwidth(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; -PCIExpLinkWidth *p =qdev_get_prop_ptr (obj, prop); +PCIExpLinkWidth *p =object_field_prop_ptr (obj, prop);int width; if (!visit_type_enum(v, name, &width, prop->info->enum_table,
@@ -1051,7 +1051,7 @@ static void get_uuid(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) {Property *prop = opaque; -QemuUUID *uuid =qdev_get_prop_ptr (obj, prop); +QemuUUID *uuid =object_field_prop_ptr (obj, prop);char buffer[UUID_FMT_LEN +1 ];char *p = buffer;
@@ -1066,7 +1066,7 @@ static void set_uuid(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) {Property *prop = opaque; -QemuUUID *uuid =qdev_get_prop_ptr (obj, prop); +QemuUUID *uuid =object_field_prop_ptr (obj, prop);char *str;if (!visit_type_str (v, name, &str, errp)) {
hw/core/qdev-properties.c +30 -30
240 lines not on this page · raw message
include/hw/qdev-properties.h +1 -1
@@ -193,7 +193,7 @@ void qdev_prop_set_macaddr(DeviceState *dev, const char *name, const uint8_t *value);void qdev_prop_set_enum (DeviceState *dev,const char *name,int value); -void *qdev_get_prop_ptr (Object *obj,Property *prop); +void *object_field_prop_ptr (Object *obj,Property *prop);void qdev_prop_register_global (GlobalProperty *prop); const GlobalProperty *qdev_find_global_prop(Object *obj,
backends/tpm/tpm_util.c +3 -3
@@ -35,7 +35,7 @@static void get_tpm (Object *obj,Visitor *v,const char *name,void *opaque,Error **errp) { -TPMBackend **be =qdev_get_prop_ptr (obj, opaque); +TPMBackend **be =object_field_prop_ptr (obj, opaque);char *p; p =g_strdup (*be ? (*be)->id :"" );
@@ -47,7 +47,7 @@ static void set_tpm(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) {Property *prop = opaque; -TPMBackend *s, **be =qdev_get_prop_ptr (obj, prop); +TPMBackend *s, **be =object_field_prop_ptr (obj, prop);char *str;if (!visit_type_str (v, name, &str, errp)) {
@@ -67,7 +67,7 @@ static void set_tpm(Object *obj, Visitor *v, const char *name, void *opaque,static void release_tpm (Object *obj,const char *name,void *opaque) {Property *prop = opaque; -TPMBackend **be =qdev_get_prop_ptr (obj, prop); +TPMBackend **be =object_field_prop_ptr (obj, prop);if (*be) {tpm_backend_reset (*be);
hw/block/xen-block.c +2 -2
@@ -336,7 +336,7 @@ static void xen_block_get_vdev(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; -XenBlockVdev *vdev =qdev_get_prop_ptr (obj, prop); +XenBlockVdev *vdev =object_field_prop_ptr (obj, prop);char *str;switch (vdev->type) {
@@ -396,7 +396,7 @@ static void xen_block_set_vdev(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; -XenBlockVdev *vdev =qdev_get_prop_ptr (obj, prop); +XenBlockVdev *vdev =object_field_prop_ptr (obj, prop);char *str, *p;const char *end;
hw/s390x/css.c +2 -2
@@ -2344,7 +2344,7 @@ static void get_css_devid(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; -CssDevId *dev_id =qdev_get_prop_ptr (obj, prop); +CssDevId *dev_id =object_field_prop_ptr (obj, prop);char buffer[] ="xx.x.xxxx" ;char *p = buffer;int r;
@@ -2373,7 +2373,7 @@ static void set_css_devid(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; -CssDevId *dev_id =qdev_get_prop_ptr (obj, prop); +CssDevId *dev_id =object_field_prop_ptr (obj, prop);char *str;int num, n1, n2;unsigned int cssid, ssid, devid;
hw/s390x/s390-pci-bus.c +2 -2
@@ -1330,7 +1330,7 @@ static void s390_pci_get_fid(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; -uint32_t *ptr =qdev_get_prop_ptr (obj, prop); +uint32_t *ptr =object_field_prop_ptr (obj, prop);visit_type_uint32 (v, name, ptr, errp); }
@@ -1340,7 +1340,7 @@ static void s390_pci_set_fid(Object *obj, Visitor *v, const char *name, {S390PCIBusDevice *zpci =S390_PCI_DEVICE (obj);Property *prop = opaque; -uint32_t *ptr =qdev_get_prop_ptr (obj, prop); +uint32_t *ptr =object_field_prop_ptr (obj, prop);if (!visit_type_uint32 (v, name, ptr, errp)) {return ;
hw/vfio/pci-quirks.c +2 -2
@@ -1489,7 +1489,7 @@ static void get_nv_gpudirect_clique_id(Object *obj, Visitor *v, Error **errp) {Property *prop = opaque; -uint8_t *ptr =qdev_get_prop_ptr (obj, prop); +uint8_t *ptr =object_field_prop_ptr (obj, prop);visit_type_uint8 (v, name, ptr, errp); }
@@ -1499,7 +1499,7 @@ static void set_nv_gpudirect_clique_id(Object *obj, Visitor *v, Error **errp) {Property *prop = opaque; -uint8_t value, *ptr =qdev_get_prop_ptr (obj, prop); +uint8_t value, *ptr =object_field_prop_ptr (obj, prop);if (!visit_type_uint8 (v, name, &value, errp)) {return ;
Signature · 1 line
2.28.0
[PULL 04/15] qdev: Get just property name at error_set_from_qdev_prop_error()
In reply to Eduardo HabkostReplace Property *prop parameter with char *name, to reduce dependency of getter and setter functions on the Property struct (which will be changed in following patches).
Message-Id: <[email protected]>
--- hw/core/qdev-properties-system.c | 12 ++++++------ hw/core/qdev-properties.c | 8 ++++---- include/hw/qdev-properties.h | 2 +- hw/s390x/css.c | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-)
hw/core/qdev-properties-system.c +6 -6
@@ -354,7 +354,7 @@ static void set_mac(Object *obj, Visitor *v, const char *name, void *opaque,return ; inval: -error_set_from_qdev_prop_error (errp,EINVAL , obj, prop, str); +error_set_from_qdev_prop_error (errp,EINVAL , obj, name, str);g_free (str); }
@@ -442,7 +442,7 @@ static void set_netdev(Object *obj, Visitor *v, const char *name, peers_ptr->queues = queues; out: -error_set_from_qdev_prop_error (errp, err, obj, prop, str); +error_set_from_qdev_prop_error (errp, err, obj, name, str);g_free (str); }
@@ -494,7 +494,7 @@ static void set_audiodev(Object *obj, Visitor *v, const char* name, card->state = state; out: -error_set_from_qdev_prop_error (errp, err, obj, prop, str); +error_set_from_qdev_prop_error (errp, err, obj, name, str);g_free (str); }
@@ -792,7 +792,7 @@ static void set_pci_devfn(Object *obj, Visitor *v, const char *name,return ; invalid: -error_set_from_qdev_prop_error (errp,EINVAL , obj, prop, str); +error_set_from_qdev_prop_error (errp,EINVAL , obj, name, str);g_free (str); }
@@ -916,7 +916,7 @@ static void set_pci_host_devaddr(Object *obj, Visitor *v, const char *name,return ; inval: -error_set_from_qdev_prop_error (errp,EINVAL , obj, prop, str); +error_set_from_qdev_prop_error (errp,EINVAL , obj, name, str);g_free (str); }
@@ -1146,7 +1146,7 @@ static void set_uuid(Object *obj, Visitor *v, const char *name, void *opaque,if (!strcmp (str,UUID_VALUE_AUTO )) {qemu_uuid_generate (uuid); }else if (qemu_uuid_parse (str, uuid) <0 ) { -error_set_from_qdev_prop_error (errp,EINVAL , obj, prop, str); +error_set_from_qdev_prop_error (errp,EINVAL , obj, name, str); }g_free (str); }
hw/core/qdev-properties.c +4 -4
@@ -679,21 +679,21 @@ static Property *qdev_prop_find(DeviceState *dev, const char *name) }void error_set_from_qdev_prop_error (Error **errp,int ret,Object *obj, -Property *prop,const char *value) +const char *name,const char *value) {switch (ret) {case -EEXIST :error_setg (errp,"Property '%s.%s' can't take value '%s', it's in use" , -object_get_typename (obj), prop->name, value); +object_get_typename (obj), name, value);break ;default :case -EINVAL :error_setg (errp,QERR_PROPERTY_VALUE_BAD , -object_get_typename (obj), prop->name, value); +object_get_typename (obj), name, value);break ;case -ENOENT :error_setg (errp,"Property '%s.%s' can't find value '%s'" , -object_get_typename (obj), prop->name, value); +object_get_typename (obj), name, value);break ;case 0 :break ;
include/hw/qdev-properties.h +1 -1
@@ -201,7 +201,7 @@ const GlobalProperty *qdev_find_global_prop(Object *obj,int qdev_prop_check_globals (void );void qdev_prop_set_globals (DeviceState *dev);void error_set_from_qdev_prop_error (Error **errp,int ret,Object *obj, -Property *prop,const char *value); +const char *name,const char *value);/** * qdev_property_add_static:
hw/s390x/css.c +1 -1
@@ -2390,7 +2390,7 @@ static void set_css_devid(Object *obj, Visitor *v, const char *name, num =sscanf (str,"%2x.%1x%n.%4x%n" , &cssid, &ssid, &n1, &devid, &n2);if (num !=3 || (n2 - n1) !=5 ||strlen (str) != n2) { -error_set_from_qdev_prop_error (errp,EINVAL , obj, prop, str); +error_set_from_qdev_prop_error (errp,EINVAL , obj, name, str); goto out; }if ((cssid >MAX_CSSID ) || (ssid >MAX_SSID )) {
Signature · 1 line
2.28.0
[PULL 09/15] qdev: Move dev->realized check to qdev_property_set()
In reply to Eduardo HabkostEvery single qdev property setter function manually checks dev->realized. We can just check dev->realized inside qdev_property_set() instead.
Message-Id: <[email protected]>
--- hw/core/qdev-properties-system.c | 70 ---------------------- hw/core/qdev-properties.c | 100 ++++++------------------------- backends/tpm/tpm_util.c | 6 -- hw/block/xen-block.c | 6 -- hw/s390x/css.c | 6 -- hw/s390x/s390-pci-bus.c | 6 -- hw/vfio/pci-quirks.c | 6 -- target/sparc/cpu.c | 6 -- 8 files changed, 18 insertions(+), 188 deletions(-)
hw/core/qdev-properties-system.c +0 -70
@@ -94,11 +94,6 @@ static void set_drive_helper(Object *obj, Visitor *v, const char *name,bool blk_created = false;int ret; -if (dev->realized) { -qdev_prop_set_after_realize (dev, name, errp); -return ; - } -if (!visit_type_str (v, name, &str, errp)) {return ; }
@@ -230,17 +225,11 @@ static void get_chr(Object *obj, Visitor *v, const char *name, void *opaque,static void set_chr (Object *obj,Visitor *v,const char *name,void *opaque,Error **errp) { -DeviceState *dev =DEVICE (obj);Property *prop = opaque;CharBackend *be =qdev_get_prop_ptr (obj, prop);Chardev *s;char *str; -if (dev->realized) { -qdev_prop_set_after_realize (dev, name, errp); -return ; - } -if (!visit_type_str (v, name, &str, errp)) {return ; }
@@ -311,18 +300,12 @@ static void get_mac(Object *obj, Visitor *v, const char *name, void *opaque,static void set_mac (Object *obj,Visitor *v,const char *name,void *opaque,Error **errp) { -DeviceState *dev =DEVICE (obj);Property *prop = opaque;MACAddr *mac =qdev_get_prop_ptr (obj, prop);int i, pos;char *str;const char *p; -if (dev->realized) { -qdev_prop_set_after_realize (dev, name, errp); -return ; - } -if (!visit_type_str (v, name, &str, errp)) {return ; }
@@ -390,7 +373,6 @@ static void get_netdev(Object *obj, Visitor *v, const char *name,static void set_netdev (Object *obj,Visitor *v,const char *name,void *opaque,Error **errp) { -DeviceState *dev =DEVICE (obj);Property *prop = opaque;NICPeers *peers_ptr =qdev_get_prop_ptr (obj, prop);NetClientState **ncs = peers_ptr->ncs;
@@ -398,11 +380,6 @@ static void set_netdev(Object *obj, Visitor *v, const char *name,int queues, err =0 , i =0 ;char *str; -if (dev->realized) { -qdev_prop_set_after_realize (dev, name, errp); -return ; - } -if (!visit_type_str (v, name, &str, errp)) {return ; }
@@ -469,18 +446,12 @@ static void get_audiodev(Object *obj, Visitor *v, const char* name,static void set_audiodev (Object *obj,Visitor *v,const char * name,void *opaque,Error **errp) { -DeviceState *dev =DEVICE (obj);Property *prop = opaque;QEMUSoundCard *card =qdev_get_prop_ptr (obj, prop);AudioState *state;int err =0 ;char *str; -if (dev->realized) { -qdev_prop_set_after_realize (dev, name, errp); -return ; - } -if (!visit_type_str (v, name, &str, errp)) {return ; }
@@ -582,11 +553,6 @@ static void set_blocksize(Object *obj, Visitor *v, const char *name,uint64_t value;Error *local_err =NULL ; -if (dev->realized) { -qdev_prop_set_after_realize (dev, name, errp); -return ; - } -if (!visit_type_size (v, name, &value, errp)) {return ; }
@@ -686,7 +652,6 @@ static void get_reserved_region(Object *obj, Visitor *v, const char *name,static void set_reserved_region (Object *obj,Visitor *v,const char *name,void *opaque,Error **errp) { -DeviceState *dev =DEVICE (obj);Property *prop = opaque;ReservedRegion *rr =qdev_get_prop_ptr (obj, prop);Error *local_err =NULL ;
@@ -694,11 +659,6 @@ static void set_reserved_region(Object *obj, Visitor *v, const char *name,char *str;int ret; -if (dev->realized) { -qdev_prop_set_after_realize (dev, name, errp); -return ; - } -visit_type_str (v, name, &str, &local_err);if (local_err) {error_propagate (errp, local_err);
@@ -754,17 +714,11 @@ const PropertyInfo qdev_prop_reserved_region = {static void set_pci_devfn (Object *obj,Visitor *v,const char *name,void *opaque,Error **errp) { -DeviceState *dev =DEVICE (obj);Property *prop = opaque;int32_t value, *ptr =qdev_get_prop_ptr (obj, prop);unsigned int slot, fn, n;char *str; -if (dev->realized) { -qdev_prop_set_after_realize (dev, name, errp); -return ; - } -if (!visit_type_str (v, name, &str,NULL )) {if (!visit_type_int32 (v, name, &value, errp)) {return ;
@@ -848,7 +802,6 @@ static void get_pci_host_devaddr(Object *obj, Visitor *v, const char *name,static void set_pci_host_devaddr (Object *obj,Visitor *v,const char *name,void *opaque,Error **errp) { -DeviceState *dev =DEVICE (obj);Property *prop = opaque;PCIHostDeviceAddress *addr =qdev_get_prop_ptr (obj, prop);char *str, *p;
@@ -857,11 +810,6 @@ static void set_pci_host_devaddr(Object *obj, Visitor *v, const char *name,unsigned long dom =0 , bus =0 ;unsigned int slot =0 , func =0 ; -if (dev->realized) { -qdev_prop_set_after_realize (dev, name, errp); -return ; - } -if (!visit_type_str (v, name, &str, errp)) {return ; }
@@ -972,16 +920,10 @@ static void get_prop_pcielinkspeed(Object *obj, Visitor *v, const char *name,static void set_prop_pcielinkspeed (Object *obj,Visitor *v,const char *name,void *opaque,Error **errp) { -DeviceState *dev =DEVICE (obj);Property *prop = opaque;PCIExpLinkSpeed *p =qdev_get_prop_ptr (obj, prop);int speed; -if (dev->realized) { -qdev_prop_set_after_realize (dev, name, errp); -return ; - } -if (!visit_type_enum (v, name, &speed, prop->info->enum_table, errp)) {return ;
@@ -1057,16 +999,10 @@ static void get_prop_pcielinkwidth(Object *obj, Visitor *v, const char *name,static void set_prop_pcielinkwidth (Object *obj,Visitor *v,const char *name,void *opaque,Error **errp) { -DeviceState *dev =DEVICE (obj);Property *prop = opaque;PCIExpLinkWidth *p =qdev_get_prop_ptr (obj, prop);int width; -if (dev->realized) { -qdev_prop_set_after_realize (dev, name, errp); -return ; - } -if (!visit_type_enum (v, name, &width, prop->info->enum_table, errp)) {return ;
@@ -1129,16 +1065,10 @@ static void get_uuid(Object *obj, Visitor *v, const char *name, void *opaque,static void set_uuid (Object *obj,Visitor *v,const char *name,void *opaque,Error **errp) { -DeviceState *dev =DEVICE (obj);Property *prop = opaque;QemuUUID *uuid =qdev_get_prop_ptr (obj, prop);char *str; -if (dev->realized) { -qdev_prop_set_after_realize (dev, name, errp); -return ; - } -if (!visit_type_str (v, name, &str, errp)) {return ; }
hw/core/qdev-properties.c +18 -82
237 lines not on this page · raw message
backends/tpm/tpm_util.c +0 -6
@@ -46,16 +46,10 @@ static void get_tpm(Object *obj, Visitor *v, const char *name, void *opaque,static void set_tpm (Object *obj,Visitor *v,const char *name,void *opaque,Error **errp) { -DeviceState *dev =DEVICE (obj);Property *prop = opaque;TPMBackend *s, **be =qdev_get_prop_ptr (obj, prop);char *str; -if (dev->realized) { -qdev_prop_set_after_realize (dev, name, errp); -return ; - } -if (!visit_type_str (v, name, &str, errp)) {return ; }
hw/block/xen-block.c +0 -6
@@ -395,17 +395,11 @@ static int vbd_name_to_disk(const char *name, const char **endp,static void xen_block_set_vdev (Object *obj,Visitor *v,const char *name,void *opaque,Error **errp) { -DeviceState *dev =DEVICE (obj);Property *prop = opaque;XenBlockVdev *vdev =qdev_get_prop_ptr (obj, prop);char *str, *p;const char *end; -if (dev->realized) { -qdev_prop_set_after_realize (dev, name, errp); -return ; - } -if (!visit_type_str (v, name, &str, errp)) {return ; }
hw/s390x/css.c +0 -6
@@ -2372,18 +2372,12 @@ static void get_css_devid(Object *obj, Visitor *v, const char *name,static void set_css_devid (Object *obj,Visitor *v,const char *name,void *opaque,Error **errp) { -DeviceState *dev =DEVICE (obj);Property *prop = opaque;CssDevId *dev_id =qdev_get_prop_ptr (obj, prop);char *str;int num, n1, n2;unsigned int cssid, ssid, devid; -if (dev->realized) { -qdev_prop_set_after_realize (dev, name, errp); -return ; - } -if (!visit_type_str (v, name, &str, errp)) {return ; }
hw/s390x/s390-pci-bus.c +0 -6
@@ -1338,16 +1338,10 @@ static void s390_pci_get_fid(Object *obj, Visitor *v, const char *name,static void s390_pci_set_fid (Object *obj,Visitor *v,const char *name,void *opaque,Error **errp) { -DeviceState *dev =DEVICE (obj);S390PCIBusDevice *zpci =S390_PCI_DEVICE (obj);Property *prop = opaque;uint32_t *ptr =qdev_get_prop_ptr (obj, prop); -if (dev->realized) { -qdev_prop_set_after_realize (dev, name, errp); -return ; - } -if (!visit_type_uint32 (v, name, ptr, errp)) {return ; }
hw/vfio/pci-quirks.c +0 -6
@@ -1498,15 +1498,9 @@ static void set_nv_gpudirect_clique_id(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque;uint8_t value, *ptr =qdev_get_prop_ptr (obj, prop); -if (dev->realized) { -qdev_prop_set_after_realize (dev, name, errp); -return ; - } -if (!visit_type_uint8 (v, name, &value, errp)) {return ; }
target/sparc/cpu.c +0 -6
@@ -798,17 +798,11 @@ static void sparc_get_nwindows(Object *obj, Visitor *v, const char *name,static void sparc_set_nwindows (Object *obj,Visitor *v,const char *name,void *opaque,Error **errp) { -DeviceState *dev =DEVICE (obj);const int64_t min =MIN_NWINDOWS ;const int64_t max =MAX_NWINDOWS ;SPARCCPU *cpu =SPARC_CPU (obj);int64_t value; -if (dev->realized) { -qdev_prop_set_after_realize (dev, name, errp); -return ; - } -if (!visit_type_int (v, name, &value, errp)) {return ; }
Signature · 1 line
2.28.0
[PULL 15/15] bugfix: hostmem: Free host_nodes list right after visited
In reply to Eduardo HabkostFrom: Keqian Zhu <[email protected]>
In host_memory_backend_get_host_nodes, we build host_nodes list and output it to v (a StringOutputVisitor) but forget to free the list. This fixes the memory leak.
The memory leak stack:
Direct leak of 32 byte(s) in 2 object(s) allocated from:
#0 0xfffda30b3393 in __interceptor_calloc (/usr/lib64/libasan.so.4+0xd3393)
#1 0xfffda1d28b9b in g_malloc0 (/usr/lib64/libglib-2.0.so.0+0x58b9b)
#2 0xaaab05ca6e43 in host_memory_backend_get_host_nodes backends/hostmem.c:94
#3 0xaaab061ddf83 in object_property_get_uint16List qom/object.c:1478
#4 0xaaab05866513 in query_memdev hw/core/machine-qmp-cmds.c:312
#5 0xaaab061d980b in do_object_child_foreach qom/object.c:1001
#6 0xaaab0586779b in qmp_query_memdev hw/core/machine-qmp-cmds.c:328
#7 0xaaab0615ed3f in qmp_marshal_query_memdev qapi/qapi-commands-machine.c:327
#8 0xaaab0632d647 in do_qmp_dispatch qapi/qmp-dispatch.c:147
#9 0xaaab0632d647 in qmp_dispatch qapi/qmp-dispatch.c:190
#10 0xaaab0610f74b in monitor_qmp_dispatch monitor/qmp.c:120
#11 0xaaab0611074b in monitor_qmp_bh_dispatcher monitor/qmp.c:209
#12 0xaaab063caefb in aio_bh_poll util/async.c:117
#13 0xaaab063d30fb in aio_dispatch util/aio-posix.c:459
#14 0xaaab063cac8f in aio_ctx_dispatch util/async.c:268
#15 0xfffda1d22a6b in g_main_context_dispatch (/usr/lib64/libglib-2.0.so.0+0x52a6b)
#16 0xaaab063d0e97 in glib_pollfds_poll util/main-loop.c:218
#17 0xaaab063d0e97 in os_host_main_loop_wait util/main-loop.c:241
#18 0xaaab063d0e97 in main_loop_wait util/main-loop.c:517
#19 0xaaab05c8bfa7 in main_loop /root/rpmbuild/BUILD/qemu-4.1.0/vl.c:1791
#20 0xaaab05713bc3 in main /root/rpmbuild/BUILD/qemu-4.1.0/vl.c:4473
#21 0xfffda0a83ebf in __libc_start_main (/usr/lib64/libc.so.6+0x23ebf)
#22 0xaaab0571ed5f (aarch64-softmmu/qemu-system-aarch64+0x88ed5f)SUMMARY: AddressSanitizer: 32 byte(s) leaked in 2 allocation(s).
Message-Id: <[email protected]>
--- backends/hostmem.c | 1 + 1 file changed, 1 insertion(+)
backends/hostmem.c +1 -0
@@ -105,6 +105,7 @@ host_memory_backend_get_host_nodes(Object *obj, Visitor *v, const char *name, ret:visit_type_uint16List (v, name, &host_nodes, errp); +qapi_free_uint16List (host_nodes); } static void
Signature · 1 line
2.28.0
[PULL 14/15] qdev: Avoid unnecessary DeviceState* variable at set_prop_arraylen()
In reply to Eduardo HabkostWe're just doing pointer math with the device pointer, we can simply use obj instead.
Message-Id: <[email protected]>
--- hw/core/qdev-properties.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
hw/core/qdev-properties.c +2 -3
@@ -559,10 +559,9 @@ static void set_prop_arraylen(Object *obj, Visitor *v, const char *name,* array-length field in the device struct, we have to create the * array itself and dynamically add the corresponding properties. */ -DeviceState *dev =DEVICE (obj);Property *prop = opaque;uint32_t *alenptr =object_field_prop_ptr (obj, prop); -void **arrayptr = (void *)dev + prop->arrayoffset; +void **arrayptr = (void *)obj + prop->arrayoffset;void *eltptr;const char *arrayname;int i;
@@ -602,7 +601,7 @@ static void set_prop_arraylen(Object *obj, Visitor *v, const char *name,* they get the right answer despite the array element not actually * being inside the device struct. */ - arrayprop->prop.offset = eltptr - (void *)dev; + arrayprop->prop.offset = eltptr - (void *)obj;assert (object_field_prop_ptr (obj, &arrayprop->prop) == eltptr); object_property_add(obj, propname, arrayprop->prop.info->name,
Signature · 1 line
2.28.0
[PULL 10/15] qdev: Make PropertyInfo.create return ObjectProperty*
In reply to Eduardo HabkostReturning ObjectProperty* will be useful for new property registration code that will add additional callbacks to ObjectProperty after registering it.
Message-Id: <[email protected]>
--- hw/core/qdev-properties.c | 12 ++++++------ include/hw/qdev-properties.h | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-)
hw/core/qdev-properties.c +6 -6
@@ -821,13 +821,13 @@ const PropertyInfo qdev_prop_size = {/* --- object link property --- */ -static void create_link_property (ObjectClass *oc,const char *name, -Property *prop) +static ObjectProperty *create_link_property (ObjectClass *oc,const char *name, +Property *prop) { -object_class_property_add_link (oc, name, prop->link_type, - prop->offset, - qdev_prop_allow_set_link_before_realize, -OBJ_PROP_LINK_STRONG ); +return object_class_property_add_link (oc, name, prop->link_type, + prop->offset, + qdev_prop_allow_set_link_before_realize, +OBJ_PROP_LINK_STRONG ); }const PropertyInfo qdev_prop_link = {
include/hw/qdev-properties.h +2 -1
@@ -34,7 +34,8 @@ struct PropertyInfo {const QEnumLookup *enum_table;int (*print)(Object *obj,Property *prop,char *dest,size_t len);void (*set_default_value)(ObjectProperty *op,const Property *prop); -void (*create)(ObjectClass *oc,const char *name,Property *prop); +ObjectProperty *(*create)(ObjectClass *oc,const char *name, +Property *prop);ObjectPropertyAccessor *get;ObjectPropertyAccessor *set;ObjectPropertyRelease *release;
Signature · 1 line
2.28.0
Peter Maydell
AppliedQuoted 40 lines · Eduardo Habkost
The following changes since commit
a05f8ecd88f15273d033b6f044b850a8af84a5b8:Merge remote-tracking branch 'remotes/alistair/tags/pull-riscv-to-apply-20201217-1' into staging (2020-12-18 11:12:35 +0000)
are available in the Git repository at:
https://gitlab.com/ehabkost/qemu.git tags/machine-next-pull-request
for you to fetch changes up to
bdd5ce050d086e9f63874f1f36e9e39fa27a976c:bugfix: hostmem: Free
host_nodeslist right after visited (2020-12-18 15:20:23 -0500)----------------------------------------------------------------
Machine queue, 2020-12-23Cleanup:
* qdev code cleanup (Eduardo Habkost)Bug fix:
* hostmem: Freehost_nodeslist right after visited (Keqian Zhu)----------------------------------------------------------------
Eduardo Habkost (14):
qdev: Move softmmu properties toqdev-properties-system.h
qdev: ReuseDEFINE_PROPin all DEFINE_PROP_* macros
sparc: UseDEFINE_PROPfor nwindows property
qdev: Get just property name aterror_set_from_qdev_prop_error()
qdev: Avoid usingprop->nameunnecessarily
qdev: Add name parameter toqdev_class_add_property()
qdev: Add name argument to PropertyInfo.create method
qdev: Wrap getters and setters in separate helpers
qdev: Movedev->realizedcheck toqdev_property_set()
qdev: Make PropertyInfo.create return ObjectProperty*
qdev: Makeqdev_class_add_property()more flexible
qdev: Moveqdev_prop_tpmdeclaration totpm_prop.h
qdev: Renameqdev_get_prop_ptr()toobject_field_prop_ptr()
qdev: Avoid unnecessary DeviceState* variable atset_prop_arraylen()
Quoted 2 lines
Keqian Zhu (1):
bugfix: hostmem: Freehost_nodeslist right after visited
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/6.0
for any user-visible changes.
-- PMM