History | View | Annotate | Download (18.1 kB)
qdev: Fix adding of ptr properties
ptr properties have neither a get/set or a print/parse which means that whenthey're added they aren't treated as static or legacy properties.
Just assume properties like this are legacy properties and treat them as such....
qom: Refine container_get() to allow using a custom root
Specify the root to search from as argument. This avoids hardcoding"/machine" in some places and makes it more flexible.
Signed-off-by: Andreas Färber <afaerber@suse.de>Cc: Paolo Bonzini <pbonzini@redhat.com>...
qdev: qdev_unplug(): use error_set()
It currently uses qerror_report(), but next commit will convertthe drive_del command to the QAPI and this requires usingerror_set().
One particularity of qerror_report() is that it knows when it'srunning on monitor context or command-line context and prints the...
qdev: give all devices a canonical path
A strong limitation of QOM right now is that unconverted ports(e.g. all...) do not give a canonical path to devices that arepart of the board. This in turn makes it impossible to replacePROP_PTR with a QOM link for example....
qdev: put all devices under /machine
Avoid cluttering too much the QOM root.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qdev: Fix qdev_try_create() semantics
Since QOM'ification, qdev_try_create() uses object_new() internally,which asserts "type != NULL" when the type is not registered.This was revealed by the combination of kvmclock's kvm_enabled() checkand early QOM type registration....
qom: Unify type registration
Replace device_init() with generalized type_init().
While at it, unify naming convention: type_init([$prefix_]register_types)Also, type_init() is a function, so add preceding blank line wherenecessary and don't put a semicolon after the closing brace....
qdev: let QOM free properties
Drop the special free callback. Instead, register a "regular" release method in the non-legacy property.
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
qdev: initialize properties via QOM
Similarly, use the object properties also to set the defaultvalues of the qdev properties. This requires reorderingregistration and initialization.
qdev: remove direct calls to print/parse
There's no need to call into ->parse and ->print manually. TheQOM legacy properties do that for us.
Furthermore, in some cases legacy and static properties have exactlythe same behavior, and we could drop the legacy properties right away....
qdev: allow reusing get/set for legacy property
In some cases, a legacy property does need a special print methodbut not a special parse method. In this case, we can reuse the get/setfrom the static (non-legacy) property.
If neither parse nor print is needed, though, do not register the...
qdev: split out common init to instance_init
This gets us closer to being able to object_new() a qdev type and have afunctioning object verses having to call qdev_create().
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qdev: refactor away qdev_create_from_info
Note that the FIXME gets fixed in series 4/4. We need to convert BusState toQOM before we can make parent_bus a link.
qdev: split out UI portions into a new function
qdev-monitor.c deals with the -device, device_add, and info qdm/qtreeinterfaces.
qdev: nuke qdev_init_chardev()
I'm sure the intentions were good here, but there's no reason this should be inqdev. Move it to qemu-char where it belongs.
qom: move properties from qdev to object
This is mostly code movement although not entirely. This makes properties partof the Object base class which means that we can now start using Object in ameaningful way outside of qdev.
qdev: implement cleanup logic in finalize
qdev: remove baked in notion of aliases (v2)
Limit them to the device_add functionality. Device aliases were a hack basedon the fact that virtio was modeled the wrong way. The mechanism for aliasingis very limited in that only one alias can exist for any device....
qdev: kill off DeviceInfo list
Teach the various bits of code that need to walk through available devices todo so via QOM.
Signed-off-by: Anthony Liguori
qdev: kill off DeviceInfo
It is no longer used in the tree since everything is done natively throughQEMU Object Model.
qdev: remove info from class
Now DeviceInfo is no longer used after object construction. All of therelevant members have been moved to DeviceClass.
qdev: allow classes to overload qdev functions
This allows us to drop per-Device registration functions by allowing theclass_init functions to overload qdev methods.
qdev: refactor device creation to allow bus_info to be set only in class
As we use class_init to set class members, DeviceInfo no longer holds thisinformation.
qdev: make DeviceInfo private
Introduce accessors and remove any code that directly accesses DeviceInfomembers.
pci: convert to QEMU Object Model
qdev: use a wrapper to access reset and promote reset to a class method
qdev: add a interface to register subclasses
In order to introduce inheritance while still using the qdev registrationinterfaces, we need to be able to use a parent other than TYPE_DEVICE. Add anew interface that allows this.
qdev: add class_init to DeviceInfo
Since we are still dynamically creating TypeInfo, we need to chain theclass_init function in order to be able to make use of it within subclasses ofTYPE_DEVICE.
This will disappear once we register TypeInfos directly....
qdev: don't access name through info
We already have a QOM interface for this so let's use it.
qdev: move qdev->info to class
Right now, DeviceInfo acts as the class for qdev. In order to switch to aproper ObjectClass derivative, we need to ween all of the callers off ofinteracting directly with the info pointer.
qdev: integrate with QEMU Object Model (v2)
This is a very shallow integration. We register a TYPE_DEVICE but only useQOM as basically a memory allocator. This will make all devices show up asQOM objects but they will all carry the TYPE_DEVICE.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>...
vga: improve VGA logic
Improve VGA selection logic, push check for device availabilty to vl.c.Create the devices at board level unconditionally.
Remove now unused pci_try_create*() functions.
Make PCI VGA devices optional.
Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com>...
qdev: fix device_del by refactoring reference counting
Commit 8eb0283 broken device_del by having too overzealous reference countingchecks. Move the reference count checks to qdev_free(), make sure to removethe parent link on free, and decrement the reference count on property removal....
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: 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: fix swapped parameters
Reviewed-by: Anthony Liguori <anthony@codemonkey.ws>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qom: push permission checks up into qdev_property_add_legacy
qdev_property_get and qdev_property_set can generate permissiondenied errors themselves. Do not duplicate this functionality inqdev_get/set_legacy_property, and clean up excessive indentation....
qom: interpret the return value when setting legacy properties
qom: optimize qdev_get_canonical_path using a parent link
The full tree search was a bit unreasonable.
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...
qdev: add explicitly named devices to the root complex
We first add a 'peripheral' container to the root device that we add usercreated devices to. This provides all user created devices with a unique andisolated namespace.
dev: add an anonymous peripheral container
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: Fix crash on -device '?=x'
Spotted by Coverity.
Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
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)....
qdev: print bus properties too
Make qdev_device_help print both device and bus properties.Helps libvirt to figure whenever bus properties such asPCI.multifunction are supported present or not.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Use glib memory allocation and free functions
qemu_malloc/qemu_free no longer exist after this commit.
hw/qdev: Don't crash if qdev_create(NULL, ...) fails
If an attempt to create a qdev device on the default sysbus (by passingNULL as the bus to qdev_create) fails, print a useful error messagerather than crashing trying to dereference a NULL pointer.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>...
qdev: Eliminate duplicate reset
qbus_reset_all_fn was registered twice, so a lot of device resetfunctions were also called twice when QEMU started.Which was introduced by 80376c3fc2c38fdd45354e4b0eb45031f35587edThis patch fixes it by making the main_system_bus creation not register...
qdev: Reset hot-plugged devices
Device models rely on the core invoking their reset handlers after init.We do this in the cold-plug case, but so far we miss this step afterhot-plug.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
net: Consistently use qemu_macaddr_default_if_unset
Drop the open-coded MAC assignment from net_init_nic and replace it withstandard qemu_macaddr_default_if_unset which is also used by qdev. Thatavoid creating colliding MACs when instantiating NICs via different...
Strip trailing '\n' from error_report()'s first argument
error_report() prepends location, and appends a newline. The messageconstructed from the arguments should not contain a newline. Fix theobvious offenders.
Signed-off-by: Markus Armbruster <armbru@redhat.com>...
net: Warn about "-net nic" options which were ignored
Diagnose the case where the user asked for a NIC via "-net nic" but the board didn't instantiate that NIC (for example where theuser asked for two NICs but the board only supports one). Notethat this diagnostic doesn't apply to NICs created through -device,...
qdev: Fix comment around qdev_init_nofail()
In previous life qdev_init_nofail() used to call hw_error() whichdid register dump and other scary things. Now it callserror_report() and does a regular exit(1). Fix the commentto match reality.
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>...
qdev: add creation function that may fail
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
blockdev: Fix regression in -drive if=scsi,index=N
Before commit 622b520f, index=12 meant bus=1,unit=5.
Since the commit, it means bus=0,unit=12. The drive is created, butnot the guest device. That's because the controllers we use withif=scsi drives (lsi53c895a and esp) support only 7 units, and...
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....
qdev: sysbus_get_default must not return a NULL pointer (fix regression)
Every system should have some sort of main system bus,so sysbus_get_default should always return a valid bus.
Without this patch, at least mipssim and malta no longerstart but raise a null pointer access exception (caused by...
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>...
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.
QemuOpts: make most qemu_*_opts static
Switch tree to lookup-by-name using qemu_find_opts().Also hook up virtfs options so qemu_find_opts works for them too.
Merge remote branch 'kwolf/for-anthony' into staging
savevm: Add DeviceState param
When available, we'd like to be able to access the DeviceStatewhen registering a savevm. For buses with a get_dev_path()function, this will allow us to create more unique savevmid strings.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>...
qdev: Don't hw_error() in qdev_init_nofail()
Some of the failures are internal errors, and hw_error() is okay then.But the common way to fail is bad user input, e.g. -globalisa-fdc.driveA=foo where drive foo has an unsupported rerror value.
exit(1) instead....
Conflicts: hw/pc.c
qbus: fix memory leak in qbus_free()
BusState::name is allocated in qbus_create_inplace().So it should be freed by qbus_free().
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
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...
Monitor: Drop QMP documentation from code
Previous commit added QMP documentation to the qemu-monitor.hxfile, it's is a copy of this information.
While it's good to keep it near code, maintaining two copies ofthe same information is too hard and has little benefit as we...
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....
qdev: Convert qdev_unplug() to QError
Note: our device unplug methods don't need conversion work, becausethey can't currently fail.
Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
monitor: convert do_device_del() to QObject, QError
error: Use QERR_INVALID_PARAMETER_VALUE instead of QERR_INVALID_PARAMETER
monitor: Use argument type 'O' for device_add
While there, improve the params help text.
monitor: convert do_device_add() to QObject
qdev: Relax parsing of bus option
Treat multiple successive slashes as a one slash. Ignore trailingslashes. This is how POSIX pathnames work.
qdev: Convert qbus_find() to QError
Revert "qdev: Use QError for 'device not found' error"
This reverts commit 3ced9f7a36189aed94d8bf86f3f5087a53012455.
The next commit will convert all of qdev_device_add() to QError, andit'll be clearer with this partial conversion reverted.
error: Convert do_device_add() to QError
Conversion to QObject is still missing.
qemu-option: Move the implied first name into QemuOptsList
We sometimes permit omitting the first option name, for example-device foo is short for -device driver=foo. The name to use("driver" in the example) is passed as argument to qemu_opts_parse()....
qdev: convert setting device properties to QError
qdev: Hide "ptr" properties from users
Users can't set them, so qdev_device_help() shouldn't list them. Fixthat. Also make qdev_prop_parse() hide them instead of printing ameaningless "has no parser" error message.
Their value means nothing to users, so qdev_print_props() shouldn't...
qdev: Factor qdev_create_from_info() out of qdev_create()
To make it obvious that -device and device_add can't die inhw_error().
qdev: Hide "no_user" devices from users
Users can't create them, so qdev_device_help() shouldn't list them.Fix that.
Also make qdev_device_add() pretend they don't exist. Before, itrejected them with a "can't be added via command line" message, which...