This is a follow up to my previous series to get us started in the QOM direction. A few things are different this time around. Most notably:
1) Devices no longer have names. Instead, path names are always used to identify devices. 2) In order to support (1), dynamic properties are now supported. 3) The concept of a "root device" has been introduced. The root device is roughly modelling the motherboard of a machine. This type is a container type and it's best to think of it as something like a PCB board I guess. To try it out, here's an example session: Launch: anthony@titi:~/build/qemu$ x86_64-softmmu/qemu-system-x86_64 -hda ~/images/linux.img -snapshot -device virtio-balloon-pci,id=foo -qmp unix:/tmp/server.sock,server,nowait Explore the object model: anthony@titi:~/git/qemu/QMP$ ./qom-list / peripheral/ i440fx/ anthony@titi:~/git/qemu/QMP$ ./qom-list /i440fx/ piix3/ anthony@titi:~/git/qemu/QMP$ ./qom-list /i440fx/piix3 rtc/ anthony@titi:~/git/qemu/QMP$ ./qom-list /i440fx/piix3/rtc date base_year anthony@titi:~/git/qemu/QMP$ ./qom-get /i440fx/piix3/rtc.date tm_sec: 33 tm_hour: 21 tm_mday: 30 tm_year: 111 tm_mon: 10 tm_min: 2 anthony@titi:~/git/qemu/QMP$ ./qom-get rtc.date tm_sec: 38 tm_hour: 21 tm_mday: 30 tm_year: 111 tm_mon: 10 tm_min: 2 anthony@titi:~/git/qemu/QMP$ ./qom-list /peripheral foo/ anthony@titi:~/git/qemu/QMP$ ./qom-list /peripheral/foo event_idx indirect_desc Anthony Liguori (197): qom: add a reference count to qdev objects qom: add new dynamic property infrastructure based on Visitors (v2) qom: register legacy properties as new style properties (v2) qom: introduce root device qdev: provide an interface to return canonical path from root (v2) qdev: provide a path resolution (v2) qom: add child properties (composition) (v2) qom: add link properties (v2) qapi: allow a 'gen' key to suppress code generation qmp: add qom-list command qom: qom_{get,set} monitor commands (v2) qdev: add explicitly named devices to the root complex dev: add an anonymous peripheral container rtc: make piix3 set the rtc as a child (v2) rtc: add a dynamic property for retrieving the date qom: optimize qdev_get_canonical_path using a parent link qmp: make qmp.py easier to use qom: add test tools (v2) bug fix spotted by paolo qom: add vga node to the pc composition tree qom: add string property type qdev: add a qdev_get_type() function and expose as a 'type' property pc: fill out most of the composition tree i440fx: split out piix3 device i440fx: rename piix_pci -> i440fx qom: add qobject rename qobject -> object more renames Start integration of qom w/qdev. qdev: move qdev->info to class qdev: don't access name through info qdev: user a wrapper to access reset and promote reset to a class method a little better approach to this qdev: add isa-device as a subclass of device isa: more isa stuff qom: make pcidevice part of the hierarchy get rid of DO_UPCAST ccid card and usb virtio-serial-port get rid of more DO_UPCAST add class_init to deviceinfo isa: move methods from isadeviceinfo to isadeviceclass kill off ISADeviceInfo usb: don't access dev->info directly usb: get rid of info pointer usb: promote all of the methods for USBDevice to class methods usb: use a factory instead of doing silly things for legacy usb: kill USBDeviceInfo usb-hid: simply class initialization a bit accessors for scsideviceinfo drop info link in SCSIDeviceInfo move methods out of SCSIDeviceInfo into SCSIDeviceClass kill off SCSIDeviceInfo get rid of CCIDCardInfo rename i2c_slave -> I2CSlave add I2CSlave to the type hierarchy add SMBusDevice to the type hiearchy fixup type registration kill off SMBusDeviceInfo add guards killall I2CSlaveInfo killall HDACodecDeviceInfo make spapr a bit more patch monkey friendly killall VIOsPAPRDeviceInfo qxl: be more patch monkey friendly make es1370 more script monkey friendly remove arrays of PCIDeviceInfo Patch monkey PCIDeviceInfo conversion patch monkey, that funky monkey fixup for patch monkey Mr. Patch Monkey at it again Get rid of PCIDeviceInfo More cleanups from PCIDeviceInfo removal Make sysbus a QOM type Remove SysBusDeviceInfo fixup some pci issues fixup some ehci issues fixup rtl8139 fixups for patch monkey Here comes the monkey... little fix pm fix patch monkey pm fixups patch monkey little fix little fix prep virtio-9p for the monkey stoopid monkey Get rid of VirtIOSerialPortInfo patch monkey virtio-console is doing something bad small fix to virtioserialportinfo removal killall SSIDeviceInfo patch monkey fixup unin_pci.c fixup some network devices fixup patch monkey problem with I2CSlave fixup killall ssislaveinfo bump version to enable Werror prep_pci is busted macio is busted fix mips malta after piix4 pm refactoring networking fix hack to fix marvell audio fixup patch monkey bug networking fix fixup patch monkey problem fixup networking fixup patch monkey problem ppc4xx_pci is busted openpic is busted fixup of spapr remove evil hack networking fixup 1 2 Separate out legacy usb registration fixup usb_qdev_register convert sysbus_register_withprop convert spapr scsi pci_qdev_register isadevice conversion hda-codec i2c_register_slave checkpoint the pm Update patch monkey pm pm qdev: make DeviceInfo private qdev: remove info from class drop IDEDeviceInfo allow classes to overload qdev functions killall isa_qdev_register killall hda_codec_register killall pci_qdev_register add object_class_by_name Refactor device creation make device_info_list private killall scsi_qdev_register killall spapr_vio_bus_register_withprop killall sysbus_register_withprop killall usb_qdev_register killall ccid_card_qdev_register & virtio_serial_port_qdev_register killall ide_qdev_register killall i2c_register_slave_subclass killall qdev_register fix info qdm kill off device list add pm2 script convert SSISlave to QOM add type_register_static_alias fixup pm2 add proper impl of alias first round of QOM conversions cleanup killall smbus_register_device round2 round3 make more pm friendly round4 round5 round7 get rid of DeviceInfo convert ide remove dead call usb-linux 9pfs qdev: move property creation to instance_init qdev: refactor properties pci: use base class to add properties move scsi device properties i2c properties hda_codec_device spapr_vio_device usb_device ccid-card virtio-serial-port ide-device split out setting parent_bus make parent_bus optional qdev: split out monitor functionality qdev: move all of the remaining monitor bits to qdev-monitor.c split out serial.h serial through composition add uart as a child isa-serial: split out split out mm-serial fix isa-serial bug add copyrights and clean some things up more serial cleanup more cleanups more cleanups more cleanups more cleanups more cleanup Makefile.objs | 10 +- Makefile.target | 3 +- QMP/qmp.py | 6 + QMP/qom-get | 26 + QMP/qom-list | 30 ++ QMP/qom-set | 21 + VERSION | 2 +- hw/9pfs/virtio-9p-device.c | 46 ++- hw/a9mpcore.c | 29 +- hw/ac97.c | 43 ++- hw/acpi_piix4.c | 70 ++-- hw/ads7846.c | 20 +- hw/alpha_dp264.c | 7 +- hw/alpha_typhoon.c | 21 +- hw/apb_pci.c | 82 +++-- hw/apic.c | 37 +- hw/applesmc.c | 34 +- hw/arm11mpcore.c | 58 ++- hw/arm_sysctl.c | 35 +- hw/arm_timer.c | 32 ++- hw/armv7m.c | 29 +- hw/armv7m_nvic.c | 16 +- hw/bitbang_i2c.c | 21 +- hw/bonito.c | 55 ++- hw/ccid-card-emulated.c | 48 ++- hw/ccid-card-passthru.c | 41 +- hw/ccid.h | 27 +- hw/cirrus_vga.c | 45 ++- hw/container.c | 29 ++ hw/cs4231.c | 31 +- hw/cs4231a.c | 36 +- hw/debugcon.c | 32 +- hw/dec_pci.c | 82 +++- hw/ds1225y.c | 33 +- hw/ds1338.c | 34 +- hw/e1000.c | 49 ++- hw/eccmemctl.c | 33 +- hw/eepro100.c | 6 +- hw/empty_slot.c | 18 +- hw/es1370.c | 40 +- hw/escc.c | 51 ++- hw/esp.c | 31 +- hw/etraxfs_eth.c | 37 +- hw/etraxfs_pic.c | 29 +- hw/etraxfs_ser.c | 21 +- hw/etraxfs_timer.c | 17 +- hw/fdc.c | 110 +++-- hw/fw_cfg.c | 37 +- hw/g364fb.c | 37 +- hw/grackle_pci.c | 45 ++- hw/grlib_apbuart.c | 29 +- hw/grlib_gptimer.c | 35 +- hw/grlib_irqmp.c | 33 +- hw/gt64xxx.c | 43 ++- hw/gus.c | 38 +- hw/hda-audio.c | 64 ++- hw/hpet.c | 37 +- hw/hw.h | 4 +- hw/i2c.c | 131 ++++-- hw/i2c.h | 47 +- hw/i440fx.c | 395 ++++++++++++++++ hw/i8254.c | 36 +- hw/i8259.c | 40 +- hw/ide/cmd646.c | 43 +- hw/ide/ich.c | 40 +- hw/ide/internal.h | 20 +- hw/ide/isa.c | 36 +- hw/ide/pci.c | 11 +- hw/ide/piix.c | 101 +++-- hw/ide/qdev.c | 153 ++++--- hw/ide/via.c | 31 +- hw/integratorcp.c | 45 ++- hw/intel-hda.c | 124 ++++-- hw/intel-hda.h | 25 +- hw/ioapic.c | 25 +- hw/ioh3420.c | 63 ++-- hw/isa-bus.c | 63 ++- hw/isa-serial.c | 157 +++++++ hw/isa-serial.h | 82 ++++ hw/isa.h | 21 +- hw/ivshmem.c | 51 ++- hw/kvmclock.c | 28 +- hw/kvmclock.h | 5 +- hw/lan9118.c | 33 +- hw/lance.c | 37 +- hw/lm32_juart.c | 23 +- hw/lm32_pic.c | 23 +- hw/lm32_sys.c | 33 +- hw/lm32_timer.c | 35 +- hw/lm32_uart.c | 23 +- hw/lm832x.c | 37 +- hw/lsi53c895a.c | 38 +- hw/m48t59.c | 71 ++- hw/macio.c | 5 + hw/marvell_88w8618_audio.c | 39 +- hw/max111x.c | 40 ++- hw/max7310.c | 39 +- hw/mc146818rtc.c | 59 ++- hw/milkymist-ac97.c | 23 +- hw/milkymist-hpdmc.c | 23 +- hw/milkymist-memcard.c | 23 +- hw/milkymist-minimac2.c | 41 +- hw/milkymist-pfpu.c | 23 +- hw/milkymist-softusb.c | 47 +- hw/milkymist-sysctl.c | 47 ++- hw/milkymist-tmu2.c | 23 +- hw/milkymist-uart.c | 23 +- hw/milkymist-vgafb.c | 35 +- hw/mips_fulong2e.c | 5 +- hw/mips_jazz.c | 1 + hw/mips_malta.c | 13 +- hw/mips_mipssim.c | 11 +- hw/mips_r4k.c | 6 +- hw/mipsnet.c | 37 +- hw/mm-serial.c | 129 ++++++ hw/mm-serial.h | 60 +++ hw/mpc8544_guts.c | 18 +- hw/mst_fpga.c | 23 +- hw/musicpal.c | 183 ++++++--- hw/nand.c | 37 +- hw/ne2000-isa.c | 34 +- hw/ne2000.c | 41 +- hw/object.c | 515 +++++++++++++++++++++ hw/object.h | 499 ++++++++++++++++++++ hw/omap_gpio.c | 78 ++-- hw/omap_intc.c | 70 ++- hw/omap_uart.c | 3 +- hw/onenand.c | 39 +- hw/opencores_eth.c | 35 +- hw/openpic.c | 5 + hw/parallel.c | 34 +- hw/pc.c | 101 +++-- hw/pc.h | 70 +-- hw/pc_piix.c | 64 ++- hw/pci.c | 186 ++++---- hw/pci.h | 80 ++-- hw/pci_bridge.c | 2 +- hw/pcie.c | 2 +- hw/pckbd.c | 22 +- hw/pcnet-pci.c | 43 ++- hw/pcnet.c | 2 +- hw/petalogix_ml605_mmu.c | 1 + hw/piix3.c | 198 ++++++++ hw/piix3.h | 37 ++ hw/piix4.c | 37 +- hw/piix_pci.c | 568 ----------------------- hw/pl011.c | 38 ++- hw/pl022.c | 16 +- hw/pl031.c | 23 +- hw/pl041.c | 38 +- hw/pl050.c | 42 ++- hw/pl061.c | 42 ++- hw/pl080.c | 46 ++- hw/pl110.c | 69 ++- hw/pl181.c | 16 +- hw/pl190.c | 25 +- hw/ppc405_uc.c | 1 + hw/ppc440.c | 1 + hw/ppc4xx_pci.c | 5 + hw/ppc_prep.c | 9 +- hw/ppce500_mpc8544ds.c | 1 + hw/ppce500_pci.c | 46 ++- hw/ppce500_spin.c | 18 +- hw/prep_pci.c | 5 + hw/pxa2xx.c | 109 +++-- hw/pxa2xx_dma.c | 33 +- hw/pxa2xx_gpio.c | 33 +- hw/pxa2xx_pic.c | 23 +- hw/pxa2xx_timer.c | 74 ++- hw/qdev-monitor.c | 495 ++++++++++++++++++++ hw/qdev-properties.c | 50 +-- hw/qdev.c | 1085 ++++++++++++++++++++++++-------------------- hw/qdev.h | 370 ++++++++++++++-- hw/qxl.c | 70 ++- hw/realview.c | 18 +- hw/realview_gic.c | 17 +- hw/rtl8139.c | 47 ++- hw/s390-virtio-bus.c | 25 +- hw/sb16.c | 40 +- hw/sbi.c | 23 +- hw/scsi-bus.c | 125 ++++-- hw/scsi-disk.c | 177 +++++--- hw/scsi-generic.c | 41 +- hw/scsi.h | 30 +- hw/serial.c | 366 +++------------- hw/serial.h | 172 +++++++ hw/sga.c | 20 +- hw/sh_pci.c | 41 ++- hw/slavio_intctl.c | 23 +- hw/slavio_misc.c | 41 ++- hw/slavio_timer.c | 33 +- hw/sm501.c | 1 + hw/smbus.c | 85 ++-- hw/smbus.h | 39 +- hw/smbus_eeprom.c | 39 +- hw/smc91c111.c | 35 +- hw/spapr_llan.c | 45 ++- hw/spapr_pci.c | 37 ++- hw/spapr_vio.c | 100 +++-- hw/spapr_vio.h | 39 +- hw/spapr_vscsi.c | 39 +- hw/spapr_vty.c | 41 ++- hw/sparc32_dma.c | 35 +- hw/spitz.c | 110 +++-- hw/ssd0303.c | 37 +- hw/ssd0323.c | 20 +- hw/ssi-sd.c | 20 +- hw/ssi.c | 39 ++- hw/ssi.h | 18 +- hw/stellaris.c | 71 +++- hw/stellaris_enet.c | 31 +- hw/strongarm.c | 148 +++++-- hw/sun4c_intctl.c | 23 +- hw/sun4m.c | 92 +++-- hw/sun4m_iommu.c | 33 +- hw/sun4u.c | 88 +++-- hw/syborg_fb.c | 31 +- hw/syborg_interrupt.c | 29 +- hw/syborg_keyboard.c | 29 +- hw/syborg_pointer.c | 31 +- hw/syborg_rtc.c | 16 +- hw/syborg_serial.c | 31 +- hw/syborg_timer.c | 29 +- hw/syborg_virtio.c | 41 +- hw/sysbus.c | 50 ++- hw/sysbus.h | 23 +- hw/tcx.c | 41 +- hw/tmp105.c | 41 +- hw/tosa.c | 54 ++- hw/tusb6010.c | 21 +- hw/twl92230.c | 39 +- hw/unin_pci.c | 180 ++++++-- hw/usb-bt.c | 35 +- hw/usb-bus.c | 203 +++++++-- hw/usb-ccid.c | 151 +++++-- hw/usb-desc.c | 18 +- hw/usb-ehci.c | 67 ++- hw/usb-hid.c | 116 +++-- hw/usb-hub.c | 37 +- hw/usb-msd.c | 56 ++- hw/usb-net.c | 52 ++- hw/usb-ohci.c | 76 ++-- hw/usb-serial.c | 96 +++-- hw/usb-uhci.c | 205 ++++++--- hw/usb-uhci.h | 2 +- hw/usb-wacom.c | 39 +- hw/usb.c | 24 +- hw/usb.h | 97 +++-- hw/versatile_pci.c | 58 ++- hw/versatilepb.c | 23 +- hw/vga-isa.c | 22 +- hw/vga-pci.c | 36 +- hw/virtex_ml507.c | 1 + hw/virtio-console.c | 77 ++-- hw/virtio-net.c | 2 +- hw/virtio-pci.c | 222 ++++++---- hw/virtio-serial-bus.c | 98 +++-- hw/virtio-serial.h | 84 ++-- hw/vmmouse.c | 34 +- hw/vmport.c | 20 +- hw/vmware_vga.c | 38 +- hw/vmware_vga.h | 6 +- hw/vt82c686.c | 136 ++++-- hw/wdt_i6300esb.c | 37 +- hw/wdt_ib700.c | 22 +- hw/wm8750.c | 41 +- hw/xen_platform.c | 38 +- hw/xilinx_axidma.c | 31 +- hw/xilinx_axienet.c | 39 +- hw/xilinx_ethlite.c | 35 +- hw/xilinx_intc.c | 29 +- hw/xilinx_timer.c | 31 +- hw/xilinx_uartlite.c | 17 +- hw/xio3130_downstream.c | 63 ++-- hw/xio3130_upstream.c | 57 ++- hw/z2.c | 60 ++- hw/zaurus.c | 31 +- monitor.h | 4 + qapi-schema.json | 107 +++++ qemu-common.h | 1 - qerror.c | 4 + qerror.h | 3 + qmp-commands.hx | 18 + qmp.c | 93 ++++ scripts/patch-monkey.py | 130 ++++++ scripts/pm2.py | 176 +++++++ scripts/qapi-commands.py | 1 + scripts/qapi-types.py | 1 + usb-bsd.c | 29 +- usb-linux.c | 58 ++- usb-redir.c | 33 +- 291 files changed, 11875 insertions(+), 5338 deletions(-) create mode 100755 QMP/qom-get create mode 100755 QMP/qom-list create mode 100755 QMP/qom-set create mode 100644 hw/container.c create mode 100644 hw/i440fx.c create mode 100644 hw/isa-serial.c create mode 100644 hw/isa-serial.h create mode 100644 hw/mm-serial.c create mode 100644 hw/mm-serial.h create mode 100644 hw/object.c create mode 100644 hw/object.h create mode 100644 hw/piix3.c create mode 100644 hw/piix3.h delete mode 100644 hw/piix_pci.c create mode 100644 hw/qdev-monitor.c create mode 100644 hw/serial.h create mode 100644 scripts/patch-monkey.py create mode 100644 scripts/pm2.py -- 1.7.4.1