Am 26.07.2013 14:19, schrieb Andreas Färber:
> Am 25.07.2013 18:19, schrieb Michael S. Tsirkin:
>> On Thu, Jul 25, 2013 at 05:50:55PM +0200, Andreas Färber wrote:
>>> Am 24.07.2013 18:01, schrieb Michael S. Tsirkin:
>>>> This code can also be found here:
>>>> git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git acpi
>>>>
>>>> Please review, and consider for 1.6.
>>>
>>> Quite frankly, this is still not looking the way I imagined it based on
>>> the KVM call discussion and Anthony's comments that I remember:
>>>
>>> I believe Anthony asked to extract the information from the QOM tree,
>>> originally from the SeaBIOS side, then later agreeing to do it on the
>>> QEMU side.
>>>
>>> However here I am still seeing *functions* added in device code to check
>>> device existence and to extract individual fields. I was assuming (and
>>> clearly prefer) such code to live in a central place, be it acpi-build.c
>>> or something else, and to use QOM *API*s to obtain information when
>>> needed rather than building up lots of new structs duplicating that
>>> data. That would at the same time be a test case for how useful the QOM
>>> tree is
>>>
>>> I'm not sure if there was a misunderstanding or whether the PC QOM model
>>> still sucks^W is incomplete? Anthony and Ping Fang(?) had both posted
>>> patches to improve the composition tree once. If there's properties
>>> missing that you need to access for ACPI, we should simply add them.
>>> For i440fx we have /machine/i440fx.
>>> For q35 I encountered an mch child on q35-pcihost, but what's trivially
>>> missing apparently is to add q35-pcihost as a child to /machine, e.g.
>>> /machine/q35.
>>> Then you'll end up doing
>>> Object *obj = object_resolve_path_component(qdev_get_machine(), "q35/mch");
>>> object_property_get_int(obj, "foo", &err);
>>> object_property_get_string(obj, "bar", &err);
>>> and so on. No need to do the TYPE_... based search for everything.
>>>
>>> User-added -devices will show up in /machine/peripheral or
>>> /machine/peripheral-anon depending on whether id= is used, so there a
>>> type-based search probably makes sense. And there is nothing wrong with
>>> moving the TYPE_* constants to a device header where not yet the case,
>>> to allow that from generic code.
>>>
>>> Similarly, please don't open-code OBJECT_CHECK()s, do a trivial patch
>>> with a macro that we can then reuse elsewhere. I'd be happy to review
>>> such QOM patches and help fast-track them into master.
>>>
>>> Will take a closer look at the implementation later.
>>
>> This is not my understanding of previous comments on list
>> or on KVM call.
>>
>> Basically it sounds like you want to make my work depend on completion
>> of QOM conversion.
>> I think we explicitly agreed full QOM convertion is not a blocker.
>
> Not sure what you mean with "completion of QOM conversion" or "full QOM
> conversion". What I am saying is that instead of spending time adding
> functions to devices that fulfill your own ACPI needs only, that time
> were better spent adding QOM properties where not yet existent.
>
> Because then what you can access for ACPI can also be accessed by
> libvirt and other management tools as well as qtest - I consider it a
> test case. QMP does not offer an instance/path search by type.
To clarify for everyone what we're talking about here, I'm attaching
/machine composition tree dumps for pc,accel=kvm and q35,accel=kvm plus
the rudimentary script I used to generate it.
It shows for instance the mentioned /machine/i440fx and lack of
/machine/q35. It also shows that there would be a /machine/fw_cfg.
Paths starting with /machine/unassigned shouldn't be hardcoded anywhere
(that's the nobody-added-it-as-a-child<> bucket), except maybe for
/machine/unassigned/sysbus. But whenever there's a link from a named
device to a /machine/unassigned/device[n] that may of course be used
dynamically, e.g. /machine/icc-bridge/icc to discover CPUs and APICs.
HTH,
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
/machine
type: container
/machine/i440fx
parent_bus: /machine/unattached/sysbus
realized: True
type: i440FX-pcihost
/machine/i440fx/ioapic
parent_bus: /machine/unattached/sysbus
gsi_base: 0
realized: True
type: kvm-ioapic
/machine/i440fx/pci.0
child[5]: /machine/unattached/device[23]
child[4]: /machine/unattached/device[21]
child[3]: /machine/unattached/device[20]
child[2]: /machine/unattached/device[8]
child[1]: /machine/unattached/device[5]
child[0]: /machine/unattached/device[4]
type: PCI
/machine/fw_cfg
parent_bus: /machine/unattached/sysbus
data_iobase: 1297
legacy-data_iobase: 0x511
ctl_iobase: 1296
legacy-ctl_iobase: 0x510
realized: True
type: fw_cfg
/machine/icc-bridge
parent_bus: /machine/unattached/sysbus
realized: True
type: icc-bridge
/machine/icc-bridge/icc
child[1]: /machine/unattached/device[0]/apic
child[0]: /machine/unattached/device[0]
type: icc-bus
/machine/unattached
type: container
/machine/unattached/device[32]
parent_bus: /machine/unattached/device[5]/isa.0
ioport: 1285
realized: True
type: pvpanic
/machine/unattached/device[31]
parent_bus: /machine/unattached/device[23]/i2c
address: 87
legacy-data: <EXCEPTION>
realized: True
type: smbus-eeprom
/machine/unattached/device[30]
parent_bus: /machine/unattached/device[23]/i2c
address: 86
legacy-data: <EXCEPTION>
realized: True
type: smbus-eeprom
/machine/unattached/device[29]
parent_bus: /machine/unattached/device[23]/i2c
address: 85
legacy-data: <EXCEPTION>
realized: True
type: smbus-eeprom
/machine/unattached/device[28]
parent_bus: /machine/unattached/device[23]/i2c
address: 84
legacy-data: <EXCEPTION>
realized: True
type: smbus-eeprom
/machine/unattached/device[27]
parent_bus: /machine/unattached/device[23]/i2c
address: 83
legacy-data: <EXCEPTION>
realized: True
type: smbus-eeprom
/machine/unattached/device[26]
parent_bus: /machine/unattached/device[23]/i2c
address: 82
legacy-data: <EXCEPTION>
realized: True
type: smbus-eeprom
/machine/unattached/device[25]
parent_bus: /machine/unattached/device[23]/i2c
address: 81
legacy-data: <EXCEPTION>
realized: True
type: smbus-eeprom
/machine/unattached/device[24]
parent_bus: /machine/unattached/device[23]/i2c
address: 80
legacy-data: <EXCEPTION>
realized: True
type: smbus-eeprom
/machine/unattached/device[23]
parent_bus: /machine/i440fx/pci.0
command_serr_enable: True
legacy-command_serr_enable: on
multifunction: False
legacy-multifunction: off
rombar: 1
romfile:
legacy-romfile: <null>
addr: 11
legacy-addr: 01.3
s4_val: 2
disable_s4: 0
disable_s3: 0
smb_io_base: 45312
realized: True
type: PIIX4_PM
/machine/unattached/device[23]/i2c
child[7]: /machine/unattached/device[31]
child[6]: /machine/unattached/device[30]
child[5]: /machine/unattached/device[29]
child[4]: /machine/unattached/device[28]
child[3]: /machine/unattached/device[27]
child[2]: /machine/unattached/device[26]
child[1]: /machine/unattached/device[25]
child[0]: /machine/unattached/device[24]
type: i2c-bus
/machine/unattached/device[22]
parent_bus: /machine/unattached/device[21]/ide.1
unit: 0
model:
legacy-model: <null>
serial: QM00003
legacy-serial: "QM00003"
wwn: 0
legacy-wwn: 0x0
ver: 1.5.50
legacy-ver: "1.5.50"
discard_granularity: 512
bootindex: -1
opt_io_size: 0
min_io_size: 0
physical_block_size: 512
logical_block_size: 512
drive: ide1-cd0
realized: True
type: ide-cd
/machine/unattached/device[21]
parent_bus: /machine/i440fx/pci.0
command_serr_enable: True
legacy-command_serr_enable: on
multifunction: False
legacy-multifunction: off
rombar: 1
romfile:
legacy-romfile: <null>
addr: 9
legacy-addr: 01.1
realized: True
type: piix3-ide
/machine/unattached/device[21]/ide.1
child[0]: /machine/unattached/device[22]
type: IDE
/machine/unattached/device[21]/ide.0
type: IDE
/machine/unattached/device[20]
parent_bus: /machine/i440fx/pci.0
command_serr_enable: True
legacy-command_serr_enable: on
multifunction: False
legacy-multifunction: off
rombar: 1
romfile: efi-e1000.rom
legacy-romfile: "efi-e1000.rom"
addr: 24
legacy-addr: 03.0
autonegotiation: True
legacy-autonegotiation: on
bootindex: -1
netdev: hub0port0
vlan: 0
legacy-vlan: 0
mac: 52:54:00:12:34:56
realized: True
type: e1000
/machine/unattached/device[19]
parent_bus: /machine/unattached/device[5]/isa.0
check_media_rate: True
legacy-check_media_rate: on
bootindexB: -1
bootindexA: -1
driveB:
driveA: floppy0
dma: 2
irq: 6
iobase: 1008
legacy-iobase: 0x3f0
realized: True
type: isa-fdc
/machine/unattached/device[18]
parent_bus: /machine/unattached/device[5]/isa.0
realized: True
type: port92
/machine/unattached/device[17]
parent_bus: /machine/unattached/device[5]/isa.0
legacy-ps2_mouse: <EXCEPTION>
realized: True
type: vmmouse
/machine/unattached/device[16]
parent_bus: /machine/unattached/device[5]/isa.0
realized: True
type: vmport
/machine/unattached/device[15]
parent_bus: /machine/unattached/device[5]/isa.0
realized: True
type: i8042
/machine/unattached/device[14]
parent_bus: /machine/unattached/device[5]/isa.0
chardev: parallel0
irq: 7
iobase: 888
legacy-iobase: 0x378
index: 0
realized: True
type: isa-parallel
/machine/unattached/device[13]
parent_bus: /machine/unattached/device[5]/isa.0
wakeup: 0
chardev: serial0
irq: 4
iobase: 1016
legacy-iobase: 0x3f8
index: 0
realized: True
type: isa-serial
/machine/unattached/device[12]
parent_bus: /machine/unattached/device[5]/isa.0
legacy-pit: <EXCEPTION>
iobase: 97
legacy-iobase: 0x61
realized: True
type: isa-pcspk
/machine/unattached/device[11]
parent_bus: /machine/unattached/device[5]/isa.0
lost_tick_policy: delay
iobase: 64
legacy-iobase: 0x40
realized: True
type: kvm-pit
/machine/unattached/device[10]
date: {u'tm_sec': 31, u'tm_hour': 23, u'tm_mday': 27, u'tm_year': 113,
u'tm_mon': 6, u'tm_min': 5}
parent_bus: /machine/unattached/device[5]/isa.0
lost_tick_policy: discard
base_year: 0
realized: True
type: mc146818rtc
/machine/unattached/device[9]
parent_bus: /machine/unattached/sysbus
msi: False
legacy-msi: off
timers: 3
realized: True
type: hpet
/machine/unattached/device[8]
parent_bus: /machine/i440fx/pci.0
command_serr_enable: True
legacy-command_serr_enable: on
multifunction: False
legacy-multifunction: off
rombar: 1
romfile: vgabios-cirrus.bin
legacy-romfile: "vgabios-cirrus.bin"
addr: 16
legacy-addr: 02.0
vgamem_mb: 8
realized: True
type: cirrus-vga
/machine/unattached/device[7]
parent_bus: /machine/unattached/device[5]/isa.0
master: False
legacy-master: off
elcr_mask: 222
legacy-elcr_mask: 0xde
elcr_addr: 1233
legacy-elcr_addr: 0x4d1
iobase: 160
legacy-iobase: 0xa0
realized: True
type: kvm-i8259
/machine/unattached/device[6]
parent_bus: /machine/unattached/device[5]/isa.0
master: True
legacy-master: on
elcr_mask: 248
legacy-elcr_mask: 0xf8
elcr_addr: 1232
legacy-elcr_addr: 0x4d0
iobase: 32
legacy-iobase: 0x20
realized: True
type: kvm-i8259
/machine/unattached/device[5]
parent_bus: /machine/i440fx/pci.0
command_serr_enable: True
legacy-command_serr_enable: on
multifunction: True
legacy-multifunction: on
rombar: 1
romfile:
legacy-romfile: <null>
addr: 8
legacy-addr: 01.0
realized: True
type: PIIX3
/machine/unattached/device[5]/isa.0
child[12]: /machine/unattached/device[32]
child[11]: /machine/unattached/device[19]
child[10]: /machine/unattached/device[18]
child[9]: /machine/unattached/device[17]
child[8]: /machine/unattached/device[16]
child[7]: /machine/unattached/device[15]
child[6]: /machine/unattached/device[14]
child[5]: /machine/unattached/device[13]
child[4]: /machine/unattached/device[12]
child[3]: /machine/unattached/device[11]
child[2]: /machine/unattached/device[10]
child[1]: /machine/unattached/device[7]
child[0]: /machine/unattached/device[6]
type: ISA
/machine/unattached/device[4]
parent_bus: /machine/i440fx/pci.0
command_serr_enable: True
legacy-command_serr_enable: on
multifunction: False
legacy-multifunction: off
rombar: 1
romfile:
legacy-romfile: <null>
addr: 0
legacy-addr: 00.0
realized: True
type: i440FX
/machine/unattached/device[3]
parent_bus: /machine/unattached/sysbus
rom_only: 1
isapc_ram_fw: 0
realized: True
type: pc-sysfw
/machine/unattached/device[2]
parent_bus: /machine/unattached/sysbus
realized: True
type: kvmclock
/machine/unattached/device[1]
parent_bus: /machine/unattached/sysbus
realized: True
type: kvmvapic
/machine/unattached/device[0]
filtered-features: [{u'cpuid-register': u'EDX', u'cpuid-input-eax':
2147483658, u'features': 0}, {u'cpuid-register': u'EAX', u'cpuid-input-eax':
1073741825, u'features': 0}, {u'cpuid-register': u'EDX', u'cpuid-input-eax':
3221225473, u'features': 0}, {u'cpuid-register': u'ECX', u'cpuid-input-eax':
2147483649, u'features': 100}, {u'cpuid-register': u'EDX', u'cpuid-input-eax':
2147483649, u'features': 0}, {u'cpuid-register': u'EBX', u'cpuid-input-eax': 7,
u'features': 0, u'cpuid-input-ecx': 0}, {u'cpuid-register': u'ECX',
u'cpuid-input-eax': 1, u'features': 0}, {u'cpuid-register': u'EDX',
u'cpuid-input-eax': 1, u'features': 0}]
feature-words: [{u'cpuid-register': u'EDX', u'cpuid-input-eax': 2147483658,
u'features': 0}, {u'cpuid-register': u'EAX', u'cpuid-input-eax': 1073741825,
u'features': 16777339}, {u'cpuid-register': u'EDX', u'cpuid-input-eax':
3221225473, u'features': 0}, {u'cpuid-register': u'ECX', u'cpuid-input-eax':
2147483649, u'features': 1}, {u'cpuid-register': u'EDX', u'cpuid-input-eax':
2147483649, u'features': 563194877}, {u'cpuid-register': u'EBX',
u'cpuid-input-eax': 7, u'features': 0, u'cpuid-input-ecx': 0},
{u'cpuid-register': u'ECX', u'cpuid-input-eax': 1, u'features': 2155880449},
{u'cpuid-register': u'EDX', u'cpuid-input-eax': 1, u'features': 126614525}]
apic-id: 0
tsc-frequency: 0
model-id: QEMU Virtual CPU version 1.5.50
vendor: GenuineIntel
xlevel: 2147483658
level: 4
stepping: 3
model: 2
family: 6
parent_bus: /machine/icc-bridge/icc
realized: True
type: x86_64-cpu
/machine/unattached/device[0]/apic
parent_bus: /machine/icc-bridge/icc
vapic: True
legacy-vapic: on
id: 0
realized: True
type: kvm-apic
/machine/unattached/sysbus
child[7]: /machine/unattached/device[9]
child[6]: /machine/i440fx/ioapic
child[5]: /machine/i440fx
child[4]: /machine/fw_cfg
child[3]: /machine/unattached/device[3]
child[2]: /machine/unattached/device[2]
child[1]: /machine/unattached/device[1]
child[0]: /machine/icc-bridge
type: System
/machine/peripheral
type: container
/machine/peripheral-anon
type: container
/machine
type: container
/machine/fw_cfg
parent_bus: /machine/unattached/sysbus
data_iobase: 1297
legacy-data_iobase: 0x511
ctl_iobase: 1296
legacy-ctl_iobase: 0x510
realized: True
type: fw_cfg
/machine/icc-bridge
parent_bus: /machine/unattached/sysbus
realized: True
type: icc-bridge
/machine/icc-bridge/icc
child[1]: /machine/unattached/device[0]/apic
child[0]: /machine/unattached/device[0]
type: icc-bus
/machine/unattached
type: container
/machine/unattached/device[32]
parent_bus: /machine/unattached/device[5]/isa.0
ioport: 1285
realized: True
type: pvpanic
/machine/unattached/device[31]
parent_bus: /machine/unattached/device[4]/pcie.0
command_serr_enable: True
legacy-command_serr_enable: on
multifunction: False
legacy-multifunction: off
rombar: 1
romfile: efi-e1000.rom
legacy-romfile: "efi-e1000.rom"
addr: 16
legacy-addr: 02.0
autonegotiation: True
legacy-autonegotiation: on
bootindex: -1
netdev: hub0port0
vlan: 0
legacy-vlan: 0
mac: 52:54:00:12:34:56
realized: True
type: e1000
/machine/unattached/device[30]
parent_bus: /machine/unattached/device[4]/pcie.0
command_serr_enable: True
legacy-command_serr_enable: on
multifunction: False
legacy-multifunction: off
rombar: 1
romfile: vgabios-cirrus.bin
legacy-romfile: "vgabios-cirrus.bin"
addr: 8
legacy-addr: 01.0
vgamem_mb: 8
realized: True
type: cirrus-vga
/machine/unattached/device[29]
parent_bus: /machine/unattached/device[21]/i2c
address: 87
legacy-data: <EXCEPTION>
realized: True
type: smbus-eeprom
/machine/unattached/device[28]
parent_bus: /machine/unattached/device[21]/i2c
address: 86
legacy-data: <EXCEPTION>
realized: True
type: smbus-eeprom
/machine/unattached/device[27]
parent_bus: /machine/unattached/device[21]/i2c
address: 85
legacy-data: <EXCEPTION>
realized: True
type: smbus-eeprom
/machine/unattached/device[26]
parent_bus: /machine/unattached/device[21]/i2c
address: 84
legacy-data: <EXCEPTION>
realized: True
type: smbus-eeprom
/machine/unattached/device[25]
parent_bus: /machine/unattached/device[21]/i2c
address: 83
legacy-data: <EXCEPTION>
realized: True
type: smbus-eeprom
/machine/unattached/device[24]
parent_bus: /machine/unattached/device[21]/i2c
address: 82
legacy-data: <EXCEPTION>
realized: True
type: smbus-eeprom
/machine/unattached/device[23]
parent_bus: /machine/unattached/device[21]/i2c
address: 81
legacy-data: <EXCEPTION>
realized: True
type: smbus-eeprom
/machine/unattached/device[22]
parent_bus: /machine/unattached/device[21]/i2c
address: 80
legacy-data: <EXCEPTION>
realized: True
type: smbus-eeprom
/machine/unattached/device[21]
parent_bus: /machine/unattached/device[4]/pcie.0
command_serr_enable: True
legacy-command_serr_enable: on
multifunction: True
legacy-multifunction: on
rombar: 1
romfile:
legacy-romfile: <null>
addr: 251
legacy-addr: 1f.3
realized: True
type: ICH9 SMB
/machine/unattached/device[21]/i2c
child[7]: /machine/unattached/device[29]
child[6]: /machine/unattached/device[28]
child[5]: /machine/unattached/device[27]
child[4]: /machine/unattached/device[26]
child[3]: /machine/unattached/device[25]
child[2]: /machine/unattached/device[24]
child[1]: /machine/unattached/device[23]
child[0]: /machine/unattached/device[22]
type: i2c-bus
/machine/unattached/device[20]
parent_bus: /machine/unattached/device[4]/pcie.0
command_serr_enable: True
legacy-command_serr_enable: on
multifunction: True
legacy-multifunction: on
rombar: 1
romfile:
legacy-romfile: <null>
addr: 250
legacy-addr: 1f.2
realized: True
type: ich9-ahci
/machine/unattached/device[20]/ide.5
type: IDE
/machine/unattached/device[20]/ide.4
type: IDE
/machine/unattached/device[20]/ide.3
type: IDE
/machine/unattached/device[20]/ide.2
type: IDE
/machine/unattached/device[20]/ide.1
type: IDE
/machine/unattached/device[20]/ide.0
type: IDE
/machine/unattached/device[19]
parent_bus: /machine/unattached/device[5]/isa.0
check_media_rate: True
legacy-check_media_rate: on
bootindexB: -1
bootindexA: -1
driveB:
driveA: floppy0
dma: 2
irq: 6
iobase: 1008
legacy-iobase: 0x3f0
realized: True
type: isa-fdc
/machine/unattached/device[18]
parent_bus: /machine/unattached/device[5]/isa.0
realized: True
type: port92
/machine/unattached/device[17]
parent_bus: /machine/unattached/device[5]/isa.0
legacy-ps2_mouse: <EXCEPTION>
realized: True
type: vmmouse
/machine/unattached/device[16]
parent_bus: /machine/unattached/device[5]/isa.0
realized: True
type: vmport
/machine/unattached/device[15]
parent_bus: /machine/unattached/device[5]/isa.0
realized: True
type: i8042
/machine/unattached/device[14]
parent_bus: /machine/unattached/device[5]/isa.0
chardev: parallel0
irq: 7
iobase: 888
legacy-iobase: 0x378
index: 0
realized: True
type: isa-parallel
/machine/unattached/device[13]
parent_bus: /machine/unattached/device[5]/isa.0
wakeup: 0
chardev: serial0
irq: 4
iobase: 1016
legacy-iobase: 0x3f8
index: 0
realized: True
type: isa-serial
/machine/unattached/device[12]
parent_bus: /machine/unattached/device[5]/isa.0
legacy-pit: <EXCEPTION>
iobase: 97
legacy-iobase: 0x61
realized: True
type: isa-pcspk
/machine/unattached/device[11]
parent_bus: /machine/unattached/device[5]/isa.0
lost_tick_policy: delay
iobase: 64
legacy-iobase: 0x40
realized: True
type: kvm-pit
/machine/unattached/device[10]
date: {u'tm_sec': 42, u'tm_hour': 23, u'tm_mday': 27, u'tm_year': 113,
u'tm_mon': 6, u'tm_min': 4}
parent_bus: /machine/unattached/device[5]/isa.0
lost_tick_policy: discard
base_year: 0
realized: True
type: mc146818rtc
/machine/unattached/device[9]
parent_bus: /machine/unattached/sysbus
msi: False
legacy-msi: off
timers: 3
realized: True
type: hpet
/machine/unattached/device[8]
parent_bus: /machine/unattached/sysbus
gsi_base: 0
realized: True
type: kvm-ioapic
/machine/unattached/device[7]
parent_bus: /machine/unattached/device[5]/isa.0
master: False
legacy-master: off
elcr_mask: 222
legacy-elcr_mask: 0xde
elcr_addr: 1233
legacy-elcr_addr: 0x4d1
iobase: 160
legacy-iobase: 0xa0
realized: True
type: kvm-i8259
/machine/unattached/device[6]
parent_bus: /machine/unattached/device[5]/isa.0
master: True
legacy-master: on
elcr_mask: 248
legacy-elcr_mask: 0xf8
elcr_addr: 1232
legacy-elcr_addr: 0x4d0
iobase: 32
legacy-iobase: 0x20
realized: True
type: kvm-i8259
/machine/unattached/device[5]
parent_bus: /machine/unattached/device[4]/pcie.0
command_serr_enable: True
legacy-command_serr_enable: on
multifunction: True
legacy-multifunction: on
rombar: 1
romfile:
legacy-romfile: <null>
addr: 248
legacy-addr: 1f.0
realized: True
type: ICH9 LPC
/machine/unattached/device[5]/isa.0
child[12]: /machine/unattached/device[32]
child[11]: /machine/unattached/device[19]
child[10]: /machine/unattached/device[18]
child[9]: /machine/unattached/device[17]
child[8]: /machine/unattached/device[16]
child[7]: /machine/unattached/device[15]
child[6]: /machine/unattached/device[14]
child[5]: /machine/unattached/device[13]
child[4]: /machine/unattached/device[12]
child[3]: /machine/unattached/device[11]
child[2]: /machine/unattached/device[10]
child[1]: /machine/unattached/device[7]
child[0]: /machine/unattached/device[6]
type: ISA
/machine/unattached/device[4]
parent_bus: /machine/unattached/sysbus
MCFG: -1
realized: True
type: q35-pcihost
/machine/unattached/device[4]/pcie.0
child[5]: /machine/unattached/device[31]
child[4]: /machine/unattached/device[30]
child[3]: /machine/unattached/device[21]
child[2]: /machine/unattached/device[20]
child[1]: /machine/unattached/device[5]
child[0]: /machine/unattached/device[4]/mch
type: PCIE
/machine/unattached/device[4]/mch
parent_bus: /machine/unattached/device[4]/pcie.0
command_serr_enable: True
legacy-command_serr_enable: on
multifunction: False
legacy-multifunction: off
rombar: 1
romfile:
legacy-romfile: <null>
addr: 0
legacy-addr: 00.0
realized: True
type: mch
/machine/unattached/device[3]
parent_bus: /machine/unattached/sysbus
rom_only: 1
isapc_ram_fw: 0
realized: True
type: pc-sysfw
/machine/unattached/device[2]
parent_bus: /machine/unattached/sysbus
realized: True
type: kvmclock
/machine/unattached/device[1]
parent_bus: /machine/unattached/sysbus
realized: True
type: kvmvapic
/machine/unattached/device[0]
filtered-features: [{u'cpuid-register': u'EDX', u'cpuid-input-eax':
2147483658, u'features': 0}, {u'cpuid-register': u'EAX', u'cpuid-input-eax':
1073741825, u'features': 0}, {u'cpuid-register': u'EDX', u'cpuid-input-eax':
3221225473, u'features': 0}, {u'cpuid-register': u'ECX', u'cpuid-input-eax':
2147483649, u'features': 100}, {u'cpuid-register': u'EDX', u'cpuid-input-eax':
2147483649, u'features': 0}, {u'cpuid-register': u'EBX', u'cpuid-input-eax': 7,
u'features': 0, u'cpuid-input-ecx': 0}, {u'cpuid-register': u'ECX',
u'cpuid-input-eax': 1, u'features': 0}, {u'cpuid-register': u'EDX',
u'cpuid-input-eax': 1, u'features': 0}]
feature-words: [{u'cpuid-register': u'EDX', u'cpuid-input-eax': 2147483658,
u'features': 0}, {u'cpuid-register': u'EAX', u'cpuid-input-eax': 1073741825,
u'features': 16777339}, {u'cpuid-register': u'EDX', u'cpuid-input-eax':
3221225473, u'features': 0}, {u'cpuid-register': u'ECX', u'cpuid-input-eax':
2147483649, u'features': 1}, {u'cpuid-register': u'EDX', u'cpuid-input-eax':
2147483649, u'features': 563194877}, {u'cpuid-register': u'EBX',
u'cpuid-input-eax': 7, u'features': 0, u'cpuid-input-ecx': 0},
{u'cpuid-register': u'ECX', u'cpuid-input-eax': 1, u'features': 2155880449},
{u'cpuid-register': u'EDX', u'cpuid-input-eax': 1, u'features': 126614525}]
apic-id: 0
tsc-frequency: 0
model-id: QEMU Virtual CPU version 1.5.50
vendor: GenuineIntel
xlevel: 2147483658
level: 4
stepping: 3
model: 2
family: 6
parent_bus: /machine/icc-bridge/icc
realized: True
type: x86_64-cpu
/machine/unattached/device[0]/apic
parent_bus: /machine/icc-bridge/icc
vapic: True
legacy-vapic: on
id: 0
realized: True
type: kvm-apic
/machine/unattached/sysbus
child[7]: /machine/unattached/device[9]
child[6]: /machine/unattached/device[8]
child[5]: /machine/unattached/device[4]
child[4]: /machine/fw_cfg
child[3]: /machine/unattached/device[3]
child[2]: /machine/unattached/device[2]
child[1]: /machine/unattached/device[1]
child[0]: /machine/icc-bridge
type: System
/machine/peripheral
type: container
/machine/peripheral-anon
type: container
#!/usr/bin/python
##
# QEMU Object Model test tools
#
# Copyright IBM, Corp. 2011
#
# Authors:
# Anthony Liguori <[email protected]>
# Andreas Faerber <[email protected]>
#
# This work is licensed under the terms of the GNU GPL, version 2 or later. See
# the COPYING file in the top-level directory.
##
import sys
import os
from qmp import QEMUMonitorProtocol
cmd, args = sys.argv[0], sys.argv[1:]
socket_path = None
path = None
prop = None
def usage():
return '''environment variables:
QMP_SOCKET=<path | addr:port>
usage:
%s [-h] [-s <QMP socket path | addr:port>] [<path>]
''' % cmd
def usage_error(error_msg = "unspecified error"):
sys.stderr.write('%s\nERROR: %s\n' % (usage(), error_msg))
exit(1)
if len(args) > 0:
if args[0] == "-h":
print usage()
exit(0);
elif args[0] == "-s":
try:
socket_path = args[1]
except:
usage_error("missing argument: QMP socket path or address");
args = args[2:]
if not socket_path:
if os.environ.has_key('QMP_SOCKET'):
socket_path = os.environ['QMP_SOCKET']
else:
usage_error("no QMP socket path or address given");
srv = QEMUMonitorProtocol(socket_path)
srv.connect()
def list_node(path):
print '%s' % path
items = srv.command('qom-list', path=path)
for item in items:
if not item['type'].startswith('child<'): #and not
item['type'].startswith('link<'):
try:
print ' %s: %s' % (item['name'], srv.command('qom-get',
path=path, property=item['name']))
except:
print ' %s: <EXCEPTION>' % item['name']
print ''
for item in items:
if item['type'].startswith('child<'):
list_node(path + '/' + item['name'])
list_node('/machine')