History | View | Annotate | Download (21.2 kB)
qdev: fix hotplug when no -device is specified
The peripheral[-anon] containers are initialized lazily but since they sit onsysbus, they can not be created after realize. This was causing an abort() tooccur during hotplug if no -device option was used....
qom: introduce get/set methods for Property
This patch adds a visitor interface to Property. This way, QOM will beable to expose Properties that access a fixed field in a struct withoutexposing also the everything-is-a-string "feature" of qdev properties....
qom: distinguish "legacy" property type name from QOM type name
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qom: register qdev properties also as non-legacy properties
Push legacy properties into a "legacy-..." namespace, and make themavailable with correct types too.
For now, all properties come in both variants. This need not be thecase for string properties. We will revisit this after -device is...
qom: interpret the return value when setting legacy properties
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qom: optimize qdev_get_canonical_path using a parent link
The full tree search was a bit unreasonable.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qom: add string property type
qdev: add a qdev_get_type() function and expose as a 'type' property
qdev: provide a path resolution (v2)
There are two types of supported paths--absolute paths and partial paths.
Absolute paths are derived from the root device and can follow child<> orlink<> properties. Since they can follow link<> properties, they can be...
qom: add child properties (composition) (v3)
Child properties express a relationship of composition.
qom: add link properties (v2)
Links represent an ephemeral relationship between devices. They are meant toreplace the qdev concept of busses by allowing more informal relationshipsbetween devices.
Links are fairly limited in their usefulness without implementing QOM-style...
qom: add a reference count to qdev objects
To ensure that a device isn't removed from the graph until all of its links arebroken.
qom: add new dynamic property infrastructure based on Visitors (v2)
qdev properties are settable only during construction and static to classes.This isn't flexible enough for QOM.
This patch introduces a property interface for qdev that provides dynamic...
qom: register legacy properties as new style properties (v2)
Expose all legacy properties through the new QOM property mechanism. The qdevproperty types are exposed through the 'legacy<>' namespace. They are alwaysvisited as strings since they do their own string parsing....
qom: introduce root device
This is based on Jan's suggestion for how to do unique naming. The root deviceis the root of composition. All devices are reachable via child<> links fromthis device.
qdev: provide an interface to return canonical path from root (v2)
The canonical path is the path in the composition tree from the root to thedevice. This is effectively the name of the device.
This is an incredibly unefficient implementation that will be optimized in...
qdev: switch children device list to QTAILQ
SCSI buses will need to read the children list first-to-last. Thisrequires using a QTAILQ, because hell breaks loose if you just tryinserting at the tail (thus reversing the order of all existingvisits from last-to-first to first-to-tail)....
scsi: remove devs array from SCSIBus
Change the devs array into a linked list, and add a scsi_device_findfunction to navigate the children list instead. This lets the SCSIbus use more complex addressing, and HBAs can talk to the correct devicewhen there are multiple LUNs per target....
qdev: Add HEX8 property
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Reviewed-by: Andreas Färber <afaerber@suse.de>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
qdev: add creation function that may fail
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
blockdev: New drive_get_next(), replacing qdev_init_bdrv()
qdev_init_bdrv() doesn't belong into qdev.c; it's about drives, notqdevs. Rename to drive_get_next, move to blockdev.c, drop the bogusDeviceState argument, and return DriveInfo instead ofBlockDriverState....
qdev: Track runtime machine modifications
Create a trivial interface to track whether the machine has beenmodified since boot. Adding or removing devices will trigger thisto return true. An example usage scenario for such an interface isthe rtl8139 driver which includes a cpu_register_io_memory() value...
qdev: export qdev_find_recursive() for later use
This patch exports qdev_find_recursive() for later use.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
qdev: remove an unused function
qbus_reset_all is unused, remove it
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
qbus: register reset handler for qbus whose parent is NULL
Stefan Weil reported the regression caused byec990eb622ad46df5ddcb1e94c418c271894d416 as follows
The second regression also occurs with MIPS malta.Networking no longer works with the default pcnet nic....
Add bootindex parameter to net/block/fd device
If bootindex is specified on command line a string that describes devicein firmware readable way is added into sorted list. Later this list willbe passed into firmware to control boot order.
Signed-off-by: Gleb Natapov <gleb@redhat.com>...
Introduce new BusInfo callback get_fw_dev_path.
New get_fw_dev_path callback will be used for build device path usableby firmware in contrast to qdev qemu internal device path.
Signed-off-by: Gleb Natapov <gleb@redhat.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Introduce fw_name field to DeviceInfo structure.
Add "fw_name" to DeviceInfo to use in device path building. Incontrast to "name" "fw_name" should refer to functionality deviceprovides instead of particular device model like "name" does.
qbus: add functions to walk both devices and busses
There are some cases where you want to walk the busses, in particular, whensearching for a bus either by name or DeviceInfo.Paolo suggested that we model the return values on how GCC's walkers work which...
qdev: reset qdev along with qdev tree
This patch changes the reset handling so that qdev has no knowledge of theglobal system reset. Instead, a new bus/device level function is introducedthat allows all devices/buses on the bus/device to be reset using a depth...
qdev: introduce reset call back for qbus level
and make it called via qbus_reset_all().The qbus reset callback will be used by pci bus reset.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
qdev: trigger reset from a given device
Introduce a helper function which triggers reset from a given device.Will be used by pci bus emulation.
Rearrange block headers
Changing block.h or blockdev.h resulted in recompiling most objects.
Move DriveInfo typedef and BlockInterfaceType enum definitionsto qemu-common.h and rearrange blockdev.h use to decrease churn.
qdev: implement qdev_prop_set_bit().
implement qdev_prop_set_bit().
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
qdev: Add a get_dev_path() function to BusInfo
This function is meant to provide a stable device path for buseswhich are able to implement it. If a bus has a globally uniqueaddresses scheme, one address level may be sufficient to providea path. Other buses may need to recursively traverse up the...
qdev: Decouple qdev_prop_drive from DriveInfo
Make the property point to BlockDriverState, cutting out the DriveInfomiddleman. This prepares the ground for block devices that don't havea DriveInfo.
Currently all user-defined ones have a DriveInfo, because the only way...
block: Catch attempt to attach multiple devices to a blockdev
For instance, -device scsi-disk,drive=foo -device scsi-disk,drive=foohappily creates two SCSI disks connected to the same block device.It's all downhill from there.
Device usb-storage deliberately attaches twice to the same blockdev,...
blockdev: Collect block device code in new blockdev.c
Anything that moves hundreds of lines out of vl.c can't be all bad.
Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
qdev: Move declaration of qdev_init_bdrv() into qdev.h
qdev: New qdev_prop_set_string()
qdev: Don't leak string property value on hot unplug
parse_string() qemu_strdup()s the property value. It is never freed.It needs to be freed along with the device. Otherwise, the value ofscsi-disk property "ver" gets leaked when hot-unplugging the disk, for...
vmstate: Add support for alias ID
Some legacy users (mostly PC devices) of vmstate_register manageinstance IDs on their own, and that unfortunately in a way that isincompatible with automatically generated ones. This so far preventsswitching those users to vmstates that are registered by qdev....
Make qemu-config available for tools
To be able to use config files for blkdebug, we need to make these functionsavailable in the tools. This involves moving two functions that can only bebuilt in the context of the emulator.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
monitor: convert do_device_del() to QObject, QError
Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
monitor: convert do_device_add() to QObject
qdev: Add a DEV_NVECTORS_UNSPECIFIED enum for unspecified nr of MSI vectors
net.c used a constant to signify no MSI vectors were specified. Extendthat to all qdev devices.
Signed-off-by: Amit Shah <amit.shah@redhat.com>Reported-by: "Michael S. Tsirkin" <mst@redhat.com>...
qdev: Fix exit code for -device ?
Help was shoehorned into device creation, qdev_device_add(). Sincehelp doesn't create a device, it returns NULL, which looks to callersjust like failed device creation. Monitor handler do_device_add()doesn't care, but main() exits unsuccessfully....
qdev: add bit property type
This adds "bit" property type, which is a boolean stored in a 32 bitinteger field, with legal values on and off. Will be used by virtio forfeature bits.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>Acked-by: Gerd Hoffmann <kraxel@redhat.com>...
qdev: make compat stuff more generic
This patch renames the compat properties into global properties andmakes them more generic. The compatibility stuff is only one ofmultiple possible users now.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qdev: move DO_UPCAST() into osdep.h
Nothing qdev specific about this, make it available throughtout.
Signed-off-by: Mark McLoughlin <markmc@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
usb core: use qdev for -usbdevice
This patchs adds infrastructure to handle -usbdevice via qdev callbacks.USBDeviceInfo gets a name field (for the -usbdevice driver name) and acallback for -usbdevice parameter parsing.
The new usbdevice_create() function walks the qdev driver list and looks...
zap DeviceState->nd
No users left.Also cleanup obsolete helper functions.
qdev: add qdev_prop_exists()
Function test whenever a driver has a specific property.
qdev: mac addr property fixups
Make the mac property use the newly added type for the mac address.
qdev: add netdev property
qdev: add vlan property
qdev: add string property.
Patchworks-ID: 35755Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>Signed-off-by: Amit Shah <amit.shah@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Suppress warnings about 'warn_unused_result' attribute directive
Warn if value of qdev_init() isn't checked
After qdev_init() fails, the device is gone. Failure to check runs ahigh risk of use-after-free.
Patchworks-ID: 35166Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
New qdev_init_nofail()
Like qdev_init(), but terminate program via hw_error() instead ofreturning an error value.
Use it instead of qdev_init() where terminating the program on failureis okay, either because it's during machine construction, or because...
qemu/qdev: type safety in reset handler
Add type safety to qdev reset handlers, by declaring them asDeviceState * rather than void *.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
store a pointer to QemuOpts in DeviceState, release it when zapping a device.
qdev: device free fixups.
Two bug fixes: * When freeing a device we unregister even stuff we didn't register in the first place because the ->init() callback failed. * When freeing a device with child busses attached, we fail to zap the child bus (and the devices attached to it)....
Add exit callback to DeviceInfo.
This adds a exit callback for device destruction to DeviceInfo, sowe can hook cleanups into qdev device destruction.
Followup patches will put that into use.
qdev hotplug: infrastructure and monitor commands.
Adds device_add and device_del commands. device_add accepts acceptsthe same syntax like the -device command line switch. device_delexpects a device id. So you should tag your devices with ids if you...
allow qdev busses allocations be inplace
qdev: Add support for uint8_t
Signed-off-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Fix spelling in comment
replace Convery -> Convert
Cc: Paul Brook <paul@codesourcery.com>Signed-off-by: Stefan Weil <weil@mail.berlios.de>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Fix sys-queue.h conflict for good
Problem: Our file sys-queue.h is a copy of the BSD file, but there aresome additions and it's not entirely compatible. Because of that, there havebeen conflicts with system headers on BSD systems. Some hacks have beenintroduced in the commits 15cc9235840a22c289edbe064a9b3c19c5f49896,...
qdev: add property type for 32bit signed integers.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
qdev: integrate reset
qdev: integrate vmstate
qdev/scsi: add scsi bus support to qdev, convert drivers.
Adding scsi disks via -device works now, i.e. you can do:
-drive id=sda,if=none,......
qdev: add return value to init() callbacks.
Sorry folks, but it has to be. One more of these invasive qdev patches.
We have a serious design bug in the qdev interface: device initcallbacks can't signal failure because the init() callback has noreturn value. This patch fixes it....
move useful type definitons to osdep.h
Fix virtio-blk
Reported-by: Christoph HellwigSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>
rename "info qdrv" to "info qdm"
As requested by avi: driver != device model.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>Message-Id:
qdev/prop: add CharDriverState property.
qdev/prop: macros for creating typechecked properties.
There are DEFINE_PROP_$TYPE macros foreach property type. These macros link the qdev_prop_$name struct to thetype used by that property. typeof(struct->field) is verifyed to be the...
QemuOpts: switch over -device.
Make -device switch use the QemuOpts framework.Everything should continue to work like it did before.
New: "-set device.$id.$property=$value" works.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>...
qdev/prop: add drive property.
Adds a (host) drive property, intended to be used by virtual diskbackend drivers.
qdev/core: add monitor command to list all drivers
qdev/prop: add pci devfn property
So we can parse "$slot.$fn" strings into devfn numbers.
qdev: create default bus names.
Create a default bus name if none is passed to qbus_create().
If the parent device has DeviceState->id set it will be used to createthe bus name,. i.e. -device lsi,id=foo will give you a scsi bus named"foo.0".
If there is no id BusInfo->name (lowercased) will be used instead, i.e....
qdev: bus walker + qdev_device_add()
This patch implements a parser and qdev tree walker for bus paths andadds qdev_device_add on top of this.
A bus path can be: (1) full path, i.e. /i440FX-pcihost/pci.0/lsi/scsi.0 (2) bus name, i.e. "scsi.0". Best used together with id= to make...
qdev: add 64 bit type
Suppress a Sparse warning
Move the export to a file used by both qdev.c and sysbus.c.
qdev: add user-specified identifier to devices.
Add id field to DeviceState. Make "info qtree" print it.
This helps users and management apps identifying devices in monitoroutput, which is especially useful with otherwise identical devicessuch as two virtio disks....
qdev/compat: compat property infrastructure.
This add support for switching devices into a compatibility modeusing device properties. Machine types can have a list of propertiesfor specific devices attached to allow the easy creation of machinetypes compatible to older qemu versions....
qdev: add no_user, alias and desc
no_user: prevent users from adding certain devices.desc: description of the device.alias: to allow user friendly shortcuts on the command line, i.e. -device usbmouse instead of -device "QEMU USB Mouse" or -device lsi instead of -device lsi53c895a...
qdev: rework device properties.
This patch is a major overhaul of the device properties. The propertiesare saved directly in the device state struct now, the linked list ofproperty values is gone.
Advantages: * We don't have to maintain the list with the property values....
qdev: replace bus_type enum with bus_info struct.
BusInfo is filled with name and size (pretty much like I did forDeviceInfo as well). There is also a function pointer to printbus-specific device information to the monitor. sysbus is hookedup there, I've also added a print function for PCI....
qdev: remove DeviceType
The only purpose DeviceType serves is creating a linked list ofDeviceInfo structs. This removes DeviceType and add a next field toDeviceInfo instead, so the DeviceInfo structs can be changed that way.Elimitates a pointless extra level of indirection....
qdev: move name+size into DeviceInfo (v2)
Rationale: move device information from code to data structures.
v2: Adapt the drivers missed in the first version.
qdev: add monitor command to dump the tree.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>Signed-off-by: Paul Brook <paul@codesourcery.com>
Record device property types
Record device property types, and provide a list of properties at deviceregistration time.
Add a "device" property type that holds a reference to annother device.
Signed-off-by: Paul Brook <paul@codesourcery.com>
qdev: kill DeviceState->name
is redundant with DeviceState->type->name
Remove qdev irq sink handling
We have both IRQ sinks and GPIO inputs. These are in principle exactlythe same thing, so remove the former.
Add common BusState
Implement and use a common device bus state. The main side-effect isthat creating a bus and attaching it to a parent device are no longerseparate operations. For legacy code we allow a NULL parent, but thatshould go away eventually....
Consistently use uint64_t for int properties
I apparently failed to do this properly on the first attempt.