summaryrefslogtreecommitdiffstats
path: root/hw/qdev.c
Commit message (Collapse)AuthorAgeFilesLines
* qdev: Prepare "realized" propertyAndreas Färber2013-01-151-23/+71
| | | | | | | | | | | | | | | Introduce the QOM realizefn suggested by Anthony. Detailed documentation is supplied in the qdev header. For now this implements a default DeviceClass::realize callback that just wraps DeviceClass::init, which it deprecates. Once all devices have been converted to DeviceClass::realize, DeviceClass::init is to be removed. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de> Cc: Anthony Liguori <anthony@codemonkey.ws> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qdev: Fold state enum into bool realizedAndreas Färber2013-01-151-6/+6
| | | | | | | | | | Whether the device was initialized or not is QOM-level information and currently unused. Drop it from device. This leaves the boolean state of whether or not DeviceClass::init was called or not, a.k.a. "realized". Suggested-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qdev: add qbus_reset_allPaolo Bonzini2013-01-101-1/+6
| | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Make all static TypeInfos constAndreas Färber2013-01-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Since 39bffca2030950ef6efe57c2fac8327a45ae1015 (qdev: register all types natively through QEMU Object Model), TypeInfo as used in the common, non-iterative pattern is no longer amended with information and should therefore be const. Fix the documented QOM examples: sed -i 's/static TypeInfo/static const TypeInfo/g' include/qom/object.h Since frequently the wrong examples are being copied by contributors of new devices, fix all types in the tree: sed -i 's/^static TypeInfo/static const TypeInfo/g' */*.c sed -i 's/^static TypeInfo/static const TypeInfo/g' */*/*.c This also avoids to piggy-back these changes onto real functional changes or other refactorings. Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qdev: Don't assume existence of parent bus on unparentingAndreas Färber2013-01-081-3/+5
| | | | | | | | | | | | | | | | | | Commit 667d22d1ae59da46b4c1fbd094ca61145f19b8c3 (qdev: move bus removal to object_unparent) made the assumption that at unparenting time parent_bus is not NULL. This assumption is unjustified since object_unparent() may well be called directly after object_initialize(), without any qdev_set_parent_bus(). This did not cause any issues yet because qdev_[try_]create() does call qdev_set_parent_bus(), falling back to SysBus if unsupplied. While at it, ensure that this new function uses the device_ prefix and make the name more neutral in light of this semantic change. Reported-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de> Tested-by: Igor Mammedov <imammedo@redhat.com>
* Merge branch 'master' of git://git.qemu.org/qemu into qom-cpuAndreas Färber2012-12-231-3/+3
|\ | | | | | | | | | | Adapt header include paths. Signed-off-by: Andreas Färber <afaerber@suse.de>
| * softmmu: move include files to include/sysemu/Paolo Bonzini2012-12-191-1/+1
| | | | | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * qapi: move include files to include/qobject/Paolo Bonzini2012-12-191-2/+2
| | | | | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * net: reorganize headersPaolo Bonzini2012-12-191-1/+1
| | | | | | | | | | | | | | | | | | Move public headers to include/net, and leave private headers in net/. Put the virtio headers in include/net/tap.h, removing the multiple copies that existed. Leave include/net/tap.h as the interface for NICs, and net/tap_int.h as the interface for OS-specific parts of the tap backend. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* | qdev-properties.c: Separate core from the code used only by qemu-system-*Eduardo Habkost2012-12-191-14/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This separates the qdev properties code in two parts: - qdev-properties.c, that contains most of the qdev properties code; - qdev-properties-system.c for code specific for qemu-system-*, containing: - Property types: drive, chr, netdev, vlan, that depend on code that won't be included on *-user - qemu_add_globals(), that depends on qemu-config.o. This change should help on two things: - Allowing DeviceState to be used by *-user without pulling dependencies that are specific for qemu-system-*; - Writing qdev unit tests without pulling too many dependencies. The copyright/license of qdev-properties.c isn't explicitly stated at the file, so add a simple copyright/license header pointing to the commit ID of the original file. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
* | qdev: Coding style fixesEduardo Habkost2012-12-191-1/+2
|/ | | | | | | Add missing braces and break lines larger than 80 chars. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
* qdev: qdev_create(): use error_report() instead of hw_error()Eduardo Habkost2012-12-061-3/+5
| | | | | | | | | | | | | | hw_error() is specific for fatal hardware emulation errors, not for internal errors related to the qdev object/class abstraction or object initialization. Replace it with an error_report() call, followed by abort(). This will also help reduce dependencies of the qdev code (as hw_error() is from cpus.o, and depends on the CPU list from exec.o). Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
* qdev: simplify (de)allocation of busesPaolo Bonzini2012-11-261-9/+1
| | | | | | | | | All conditional deallocation can now be done with object_delete. Remove the @qom_allocated and @glib_allocated fields; replace the latter with a direct assignment of the @free function pointer. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qdev: move bus removal to object_unparentPaolo Bonzini2012-11-261-3/+13
| | | | | | | | | | | | | Add an ObjectClass method that is done at object_unparent time. It should remove any backlinks to the object in the composition tree, so that object_delete will be able to drop the last reference and free the object. Use it for qdev buses. Reviewed-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qdev: Split up header so it can be used in cpu.hAnthony Liguori2012-11-151-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Header file dependency is a frickin' nightmare right now. cpu.h tends to get included in our 'include everything' header files but qdev also needs to include those headers mainly for qdev-properties since it knows about CharDriverState and friends. We can solve this for now by splitting out qdev.h along the same lines that we previously split the C file. Then cpu.h just needs to include qdev-core.h. hw/qdev.h is split into following new headers: hw/qdev-core.h hw/qdev-properties.h hw/qdev-monitor.h Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> [ehabkost: re-add DEFINE_PROP_PCI_HOST_DEVADDR, that was removed on the original patch (by mistake, I guess)] [ehabkost: kill qdev_prop_set_vlan() declaration] [ehabkost: moved get_fw_dev_path() comment to the original location (I don't know why it was moved)] [ehabkost: removed qdev_exists() declaration] [ehabkost: keep using 'QemuOpts' instead of 'struct QemuOpts', as qdev-core.h includes qemu-option.h] Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
* qdev: allow multiple qdev_init_gpio_in() callsPeter A. G. Crosthwaite2012-10-101-3/+3
| | | | | | | | | | | Allow multiple qdev_init_gpio_in() calls for the one device. The first call will define GPIOs 0-N-1, the next GPIOs N- ... . Allows different GPIOs to be handled with different handlers. Needed when two levels of the QOM class heirachy both define GPIO functionality, as a single GPIO handler with an index selecter is not possible. Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
* Merge branch 'trivial-patches' of git://github.com/stefanha/qemuAurelien Jarno2012-10-061-1/+0
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'trivial-patches' of git://github.com/stefanha/qemu: versatilepb: Use symbolic indices for ARM PIC qdev: kill bogus comment qemu-barrier: Fix compiler version check for future gcc versions hw: Add missing 'static' attribute for QEMUMachine cleanup useless return sentence qemu-sockets: Fix compiler warning (regression for MinGW) vnc: Fix spelling (hellmen -> hellman) in comment slirp: Fix spelling in comment (enought -> enough, insure -> ensure) tcg/arm: Use tcg_out_mov_reg rather than inline equivalent code cpu: Add missing 'static' attribute to qemu_global_mutex configure: Support empty target list (--target-list=) hw: Fix return value check for bdrv_read, bdrv_write
| * qdev: kill bogus commentEduardo Habkost2012-10-051-1/+0
| | | | | | | | | | | | | | | | | | When the DeviceInfo code was removed, the comment describing qdev_subclass_init() was left in the code by mistake. Remove it. Cc: qemu-trivial@nongnu.org Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
* | vl.c: convert *vga_enabled functions to QOMAurelien Jarno2012-10-061-5/+0
| | | | | | | | | | | | And get rid of qdev_exists(). Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* | scsi, pci, qdev, isa-bus, sysbus: don't let *_get_fw_dev_path return NULLJim Meyering2012-10-051-1/+1
|/ | | | | | | | | | | | | Use g_strdup rather than strdup, because the sole caller (qdev_get_fw_dev_path_helper) assumes it gets non-NULL, and dereferences it. Besides, in that caller, the allocated buffer is already freed with g_free, so it's better to allocate with a matching g_strdup. In one case, (scsi-bus.c) it was trivial, so I replaced an snprintf+ g_strdup combination with an equivalent g_strdup_printf use. Signed-off-by: Jim Meyering <meyering@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qom: object_delete should unparent the object firstPaolo Bonzini2012-08-231-2/+0
| | | | | | | | | | | | | | | | object_deinit is only called when the reference count goes to zero, and yet tries to do an object_unparent. Now, object_unparent either does nothing or it will decrease the reference count. Because we know the reference count is zero, the object_unparent call in object_deinit is useless. Instead, we need to disconnect the object from its parent just before we remove the last reference apart from the parent's. This happens in object_delete. Once we do this, all calls to object_unparent peppered through QEMU can go away. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: Remove VLANStateStefan Hajnoczi2012-08-011-2/+0
| | | | | | | | VLANState is no longer used and can be removed. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* qdev: fix use-after-free in the error path of qdev_init_nofailAnthony Liguori2012-06-271-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | From Markus: Before: $ qemu-system-x86_64 -display none -drive if=ide qemu-system-x86_64: Device needs media, but drive is empty qemu-system-x86_64: Initialization of device ide-hd failed [Exit 1 ] After: $ qemu-system-x86_64 -display none -drive if=ide qemu-system-x86_64: Device needs media, but drive is empty Segmentation fault (core dumped) [Exit 139 (SIGSEGV)] This error always existed as qdev_init() frees the object. But QOM goes a bit further and purposefully sets the class pointer to NULL to help find use-after-free. It worked :-) Cc: Andreas Faerber <afaerber@suse.de> Reported-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Merge remote-tracking branch 'afaerber-or/qom-next-2' into stagingAnthony Liguori2012-06-181-101/+199
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * afaerber-or/qom-next-2: (22 commits) qom: Push error reporting to object_property_find() qdev: Remove qdev_prop_exists() qbus: Initialize in standard way qbus: Make child devices links qdev: Connect busses with their parent devices qdev: Convert busses to QEMU Object Model qdev: Move SysBus initialization to sysbus.c qdev: Use wrapper for qdev_get_path qdev: Remove qdev_prop_set_defaults qdev: Clean up global properties qdev: Move bus properties to abstract superclasses qdev: Move bus properties to a separate global qdev: Push "type" property up to Object arm_l2x0: Rename "type" property to "cache-type" m48t59: Rename "type" property to "model" qom: Assert that public types have a non-NULL parent field qom: Drop type_register_static_alias() macro qom: Make Object a type qom: Add class_base_init qom: Add object_child_foreach() ...
| * qom: Push error reporting to object_property_find()Paolo Bonzini2012-06-181-1/+1
| | | | | | | | | | | | | | | | Avoids duplicated error_set(). Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> [AF: Also drop error_set() in object_property_del().] Signed-off-by: Andreas Färber <afaerber@suse.de>
| * qdev: Remove qdev_prop_exists()Paolo Bonzini2012-06-181-1/+1
| | | | | | | | | | | | | | Can be replaced everywhere with object_property_find(). Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
| * qbus: Initialize in standard wayAnthony Liguori2012-06-181-32/+48
| | | | | | | | | | | | | | | | | | Move code to an initfn and finalizer. Replace do_qbus_create_inplace() with qbus_realize(). Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
| * qbus: Make child devices linksAnthony Liguori2012-06-181-11/+53
| | | | | | | | | | | | | | | | | | | | | | | | Make qbus children show up as link<> properties. There is no stable addressing for qbus children so we use an unstable naming convention. This is okay in QOM though because the composition name is expected to be what's stable. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
| * qdev: Connect busses with their parent devicesAnthony Liguori2012-06-181-0/+4
| | | | | | | | | | | | | | | | | | This makes SysBus part of the root hierarchy and all busses children of their respective parent DeviceState. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
| * qdev: Convert busses to QEMU Object ModelAnthony Liguori2012-06-181-20/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is far less interesting than it sounds. We simply add an Object to each BusState and then register the types appropriately. Most of the interesting refactoring will follow in the next patches. Since we're changing fundamental type names (BusInfo -> BusClass), it all needs to convert at once. Fortunately, not a lot of code is affected. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> [AF: Made all new bus TypeInfos static const.] [AF: Made qbus_free() call object_delete(), required {qom,glib}_allocated] Signed-off-by: Andreas Färber <afaerber@suse.de>
| * qdev: Move SysBus initialization to sysbus.cPaolo Bonzini2012-06-181-24/+2
| | | | | | | | | | | | | | | | TYPE_SYSTEM_BUS will be local to hw/sysbus.c, so move existing references to main_system_bus and system_bus_info there. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
| * qdev: Use wrapper for qdev_get_pathAnthony Liguori2012-06-181-0/+16
| | | | | | | | | | | | | | | | | | This makes it easier to remove it from BusInfo. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> [AF: Drop now unnecessary NULL initialization in scsibus_get_dev_path()] Signed-off-by: Andreas Färber <afaerber@suse.de>
| * qdev: Remove qdev_prop_set_defaultsPaolo Bonzini2012-06-181-3/+23
| | | | | | | | | | | | | | | | Instead, qdev_property_add_static can set the default. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
| * qdev: Clean up global propertiesPaolo Bonzini2012-06-181-1/+1
| | | | | | | | | | | | | | | | Now that global properties do not depend on buses anymore, set them directly in the device instance_init function. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
| * qdev: Move bus properties to abstract superclassesPaolo Bonzini2012-06-181-26/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In qdev, each bus in practice identified an abstract superclass, but this was mostly hidden. In QOM, instead, these abstract classes are explicit so we can move bus properties there. All bus property walks are removed, and all device property walks are changed to look along the class hierarchy instead. We would have duplicates if class A defines some properties and its subclass B does not define any, because class_b->props will be left equal to class_a->props. The solution here is to reintroduce the class_base_init TypeInfo callback, that was present in one of the early QOM versions but removed (on my request...) before committing. This breaks global bus properties, an obscure feature when used with the command-line which is actually useful and used when used by backwards-compatible machine types. So this patch also adjusts the global bus properties in hw/pc_piix.c to refer to the abstract class. Globals and other properties must be modified in the same patch to avoid complications related to initialization ordering. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
| * qdev: Push "type" property up to ObjectPaolo Bonzini2012-06-181-6/+0
| | | | | | | | | | | | | | | | Now that Object is a type, add an instance_init function and push the "type" property from qdev to there. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
* | qdev: release parent properties on dc->init failureJason Baron2012-06-111-0/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | | | While looking into hot-plugging bridges, I can create a qemu segfault via: $ device_add pci-bridge Bridge chassis not specified. Each bridge is required to be assigned a unique chassis id > 0. ** ERROR:qom/object.c:389:object_delete: assertion failed: (obj->ref == 0) I'm proposing to fix this by adding a call to 'object_unparent()', before the call to qdev_free(). I see there is already a precedent for this usage pattern as seen in qdev_simple_unplug_cb(): /* can be used as ->unplug() callback for the simple cases */ int qdev_simple_unplug_cb(DeviceState *dev) { /* just zap it */ object_unparent(OBJECT(dev)); qdev_free(dev); return 0; } Signed-off-by: Jason Baron <jbaron@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* qdev: Fix adding of ptr propertiesAnthony Liguori2012-05-121-1/+4
| | | | | | | | | | | ptr properties have neither a get/set or a print/parse which means that when they're added they aren't treated as static or legacy properties. Just assume properties like this are legacy properties and treat them as such. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
* qom: Refine container_get() to allow using a custom rootAndreas Färber2012-04-241-3/+4
| | | | | | | | | | 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> Cc: Anthony Liguori <anthony@codemonkey.ws> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qdev: qdev_unplug(): use error_set()Luiz Capitulino2012-04-091-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | It currently uses qerror_report(), but next commit will convert the drive_del command to the QAPI and this requires using error_set(). One particularity of qerror_report() is that it knows when it's running on monitor context or command-line context and prints the error message accordingly. error_set() doesn't do this, so we have to be careful not to drop error messages. qdev_unplug() has three kinds of usages: 1. It's called when hot adding a device fails, to undo anything that has been done before hitting the error 2. It's called by function monitor functions like device_del(), to unplug a device 3. It's used by xen_platform.c in a way that doesn't _seem_ to be in monitor context Only item 2 can print an error message to the user, this commit maintains that. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* qdev: put all devices under /machinePaolo Bonzini2012-04-021-1/+12
| | | | | | | 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: give all devices a canonical pathPaolo Bonzini2012-04-021-3/+13
| | | | | | | | | | | A strong limitation of QOM right now is that unconverted ports (e.g. all...) do not give a canonical path to devices that are part of the board. This in turn makes it impossible to replace PROP_PTR with a QOM link for example. 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>
* qdev: Fix qdev_try_create() semanticsAndreas Färber2012-02-171-0/+3
| | | | | | | | | | | | | | | 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() check and early QOM type registration. Check whether the class exists before calling object_new(), so that the caller (e.g., qdev_create) can fail gracefully, telling us which device could not be created. Signed-off-by: Andreas Färber <afaerber@suse.de> Cc: Anthony Liguori <aliguori@codemonkey.ws> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qom: Unify type registrationAndreas Färber2012-02-151-2/+2
| | | | | | | | | | | | | 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 where necessary and don't put a semicolon after the closing brace. Signed-off-by: Andreas Färber <afaerber@suse.de> Cc: Anthony Liguori <anthony@codemonkey.ws> Cc: malc <av1474@comtv.ru> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qdev: initialize properties via QOMPaolo Bonzini2012-02-071-2/+2
| | | | | | | | | Similarly, use the object properties also to set the default values of the qdev properties. This requires reordering registration and initialization. Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* qdev: let QOM free propertiesPaolo Bonzini2012-02-071-7/+1
| | | | | | | | 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: allow reusing get/set for legacy propertyPaolo Bonzini2012-02-071-4/+7
| | | | | | | | | | | | | In some cases, a legacy property does need a special print method but not a special parse method. In this case, we can reuse the get/set from the static (non-legacy) property. If neither parse nor print is needed, though, do not register the legacy property at all. The previous patch ensures that the right fallback will be used. Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* qdev: remove direct calls to print/parsePaolo Bonzini2012-02-071-0/+9
| | | | | | | | | | | | There's no need to call into ->parse and ->print manually. The QOM legacy properties do that for us. Furthermore, in some cases legacy and static properties have exactly the same behavior, and we could drop the legacy properties right away. Add an appropriate fallback to prepare for this. Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* qdev: implement cleanup logic in finalizeAnthony Liguori2012-02-031-25/+32
| | | | Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qom: move properties from qdev to objectAnthony Liguori2012-02-031-474/+17
| | | | | | | | This is mostly code movement although not entirely. This makes properties part of the Object base class which means that we can now start using Object in a meaningful way outside of qdev. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
OpenPOWER on IntegriCloud