On 12/12/2011 02:29 PM, Anthony Liguori wrote:
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.
See my other mail for a description of my merge plan for QOM.
Applied.
Regards,
Anthony Liguori
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 (20):
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) (v3)
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
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
Makefile.objs | 2 +-
hw/acpi_piix4.c | 7 +-
hw/cirrus_vga.c | 8 +-
hw/container.c | 20 ++
hw/ide/pci.c | 11 +-
hw/kvmclock.c | 5 +-
hw/kvmclock.h | 5 +-
hw/mc146818rtc.c | 27 +++
hw/mips_malta.c | 5 +-
hw/pc.c | 75 +++++--
hw/pc.h | 51 +++--
hw/pc_piix.c | 61 ++++--
hw/piix_pci.c | 11 +-
hw/qdev.c | 555 +++++++++++++++++++++++++++++++++++++++++++++-
hw/qdev.h | 281 +++++++++++++++++++++++
hw/usb-uhci.c | 4 +-
hw/usb-uhci.h | 2 +-
hw/vga-pci.c | 5 +-
hw/vmware_vga.h | 6 +-
monitor.h | 4 +
qapi-schema.json | 107 +++++++++
qerror.c | 4 +
qerror.h | 3 +
qmp-commands.hx | 18 ++
qmp.c | 93 ++++++++
scripts/qapi-commands.py | 1 +
scripts/qapi-types.py | 1 +
27 files changed, 1289 insertions(+), 83 deletions(-)
create mode 100644 hw/container.c