- Sep 12, 2014
-
-
Peter Maydell authored
Make the debug_excp_handler target specific hook into a QOM CPU method. Signed-off-by:
Peter Maydell <peter.maydell@linaro.org>
-
- Sep 04, 2014
-
-
Peter Crosthwaite authored
If "[*]" is given as the last part of a QOM property name, treat that as an array property. The added property is given the first available name, replacing the * with a decimal number counting from 0. First add with name "foo[*]" will be "foo[0]". Second "foo[1]" and so on. Callers may inspect the ObjectProperty * return value to see what number the added property was given. Signed-off-by:
Peter Crosthwaite <peter.crosthwaite@xilinx.com> Signed-off-by:
Andreas Färber <afaerber@suse.de>
-
Alexey Kardashevskiy authored
Current object_child_foreach() uses QTAILQ_FOREACH() to walk through children and that makes children removal from the callback impossible. This makes object_child_foreach() use QTAILQ_FOREACH_SAFE(). Signed-off-by:
Alexey Kardashevskiy <aik@ozlabs.ru> Reviewed-by:
Hu Tao <hutao@cn.fujitsu.com> Signed-off-by:
Andreas Färber <afaerber@suse.de>
-
- Sep 02, 2014
-
-
Chen Fan authored
string_output_get_string() uses g_string_free(str, false) to transfer the 'str' pointer to callers and never free it. Signed-off-by:
Chen Fan <chen.fan.fnst@cn.fujitsu.com> Reviewed-by:
Peter Crosthwaite <peter.crosthwaite@xilinx.com> Reviewed-by:
Hu Tao <hutao@cn.fujitsu.com> Signed-off-by:
Michael Tokarev <mjt@tls.msk.ru>
-
- Aug 17, 2014
-
-
Paolo Bonzini authored
This ensures that the unparent callback is called automatically when the parent object is finalized. Note that there's no need to keep a reference neither in object_unparent nor in object_finalize_child_property. The reference held by the child property itself will do. Reviewed-by:
Peter Crosthwaite <peter.crosthwaite@xilinx.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
This ensures that the children's unparent callback will still have a usable parent. Reviewed-by:
Peter Crosthwaite <peter.crosthwaite@xilinx.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Jul 01, 2014
-
-
Peter Crosthwaite authored
Just do nothing if passed NULL for a ref or unref. This avoids call sites that manage a combination of NULL or non-NULL pointers having to add iffery around every ref and unref. Signed-off-by:
Peter Crosthwaite <peter.crosthwaite@xilinx.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Peter Crosthwaite authored
Certain parts of the QOM framework test this pointer to determine if an object is parented. Nuke it when the object is unparented to allow for reuse of an object after unparenting. Signed-off-by:
Peter Crosthwaite <peter.crosthwaite@xilinx.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
Child properties must be unique. Fix this problem by turning their aliases into links. The resolve function that forwards to the target property does not have any knowledge of the target property's type, so it works fine. Reviewed-by:
Peter Crosthwaite <peter.crosthwaite@xilinx.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
It may be desirable to have custom link<> properties that do more than just store an object. Even the addition of a "check" function is not enough if setting the link has side effects or if a non-standard reference counting is preferrable. Avoid the assumption that the opaque field of a link<> is a LinkProperty struct, by adding a generic "resolve" callback to ObjectProperty. This fixes aliases of link properties. Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Stefan Hajnoczi authored
Sometimes an object needs to present a property which is actually on another object, or it needs to provide an alias name for an existing property. Examples: a.foo -> b.foo a.old_name -> a.new_name The new object_property_add_alias() API allows objects to alias a property on the same object or another object. The source and target names can be different. Signed-off-by:
Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by:
Peter Crosthwaite <peter.crosthwaite@xilinx.com>
-
- Jun 30, 2014
-
-
Peter Crosthwaite authored
Certain parts of the QOM framework test this pointer to determine if an object is parented. Nuke it when the object is unparented to allow for reuse of an object after unparenting. Signed-off-by:
Peter Crosthwaite <peter.crosthwaite@xilinx.com> Signed-off-by:
Andreas Färber <afaerber@suse.de>
-
- Jun 29, 2014
-
-
Greg Kurz authored
If we want to support targets that can change endianness (modern PPC and ARM for the moment), we need to add a per-CPU class method to be called from the virtio code. The virtio_ prefix in the name is a hint for people to avoid misusage (aka. anywhere but from the virtio code). The default behaviour is to return the compile-time default target endianness. Suggested-by:
Peter Maydell <peter.maydell@linaro.org> Signed-off-by:
Greg Kurz <gkurz@linux.vnet.ibm.com> Reviewed-by:
Michael S. Tsirkin <mst@redhat.com> Signed-off-by:
Michael S. Tsirkin <mst@redhat.com>
-
- Jun 19, 2014
-
-
Hu Tao authored
Signed-off-by:
Hu Tao <hutao@cn.fujitsu.com> Acked-by:
Michael S. Tsirkin <mst@redhat.com> Signed-off-by:
Michael S. Tsirkin <mst@redhat.com>
-
- Apr 25, 2014
-
-
Cole Robinson authored
Just hardcode them in the callers Cc: Luiz Capitulino <lcapitulino@redhat.com> Cc: Markus Armbruster <armbru@redhat.com> Signed-off-by:
Cole Robinson <crobinso@redhat.com> Reviewed-by:
Paolo Bonzini <pbonzini@redhat.com> Signed-off-by:
Luiz Capitulino <lcapitulino@redhat.com>
-
- Apr 11, 2014
-
-
Cole Robinson authored
Commit 9561fda8 changed the type of 'opaque' for link properties, but missed updating this call site. Reproducer: ./x86_64-softmmu/qemu-system-x86_64 -qmp unix:./qmp.sock,server & ./scripts/qmp/qmp-shell ./qmp.sock (QEMU) qom-list path=//machine/i440fx/pci.0/child[2] Reported-by:
Marcin Gibuła <m.gibula@beyond.pl> Signed-off-by:
Cole Robinson <crobinso@redhat.com> Message-id: 2f8f007ce2152ac3b65f0811199662799c509225.1397155389.git.crobinso@redhat.com Acked-by:
Andreas Färber <afaerber@suse.de> Signed-off-by:
Peter Maydell <peter.maydell@linaro.org>
-
- Mar 19, 2014
-
-
Stefan Hajnoczi authored
There are currently three types of object_property_add_link() callers: 1. The link property may be set at any time. 2. The link property of a DeviceState instance may only be set before realize. 3. The link property may never be set, it is read-only. Something similar can already be achieved with object_property_add_str()'s set() argument. Follow its example and add a check() argument to object_property_add_link(). Also provide default check() functions for case #1 and #2. Case #3 is covered by passing a NULL function pointer. Cc: Peter Crosthwaite <peter.crosthwaite@petalogix.com> Cc: Alexander Graf <agraf@suse.de> Cc: Anthony Liguori <aliguori@amazon.com> Cc: "Michael S. Tsirkin" <mst@redhat.com> Signed-off-by:
Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by:
Paolo Bonzini <pbonzini@redhat.com> [AF: Tweaked documentation comment] Signed-off-by:
Andreas Färber <afaerber@suse.de>
-
Stefan Hajnoczi authored
Some object_property_add_link() callers expect property deletion to unref the link property object. Other callers expect to manage the refcount themselves. The former are currently broken and therefore leak the link property object. This patch adds a flags argument to object_property_add_link() so the caller can specify which refcount behavior they require. The new OBJ_PROP_LINK_UNREF_ON_RELEASE flag causes the link pointer to be unreferenced when the property is deleted. This fixes refcount leaks in qdev.c, xilinx_axidma.c, xilinx_axienet.c, s390-virtio-bus.c, virtio-pci.c, virtio-rng.c, and ui/console.c. Rationale for refcount behavior: * hw/core/qdev.c - bus children are explicitly unreferenced, don't interfere - parent_bus is essentially a read-only property that doesn't hold a refcount, don't unref - hotplug_handler is leaked, do unref * hw/dma/xilinx_axidma.c - rx stream "dma" links are set using set_link, therefore they need unref - tx streams are set using set_link, therefore they need unref * hw/net/xilinx_axienet.c - same reasoning as hw/dma/xilinx_axidma.c * hw/pcmcia/pxa2xx.c - pxa2xx bypasses set_link and therefore does not use refcounts * hw/s390x/s390-virtio-bus.c * hw/virtio/virtio-pci.c * hw/virtio/virtio-rng.c * ui/console.c - set_link is used and there is no explicit unref, do unref Cc: Peter Crosthwaite <peter.crosthwaite@petalogix.com> Cc: Alexander Graf <agraf@suse.de> Cc: Anthony Liguori <aliguori@amazon.com> Cc: "Michael S. Tsirkin" <mst@redhat.com> Signed-off-by:
Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by:
Paolo Bonzini <pbonzini@redhat.com> Signed-off-by:
Andreas Färber <afaerber@suse.de>
-
Stefan Hajnoczi authored
The error behavior of object_property_set_link() is dangerous. It sets the link property object to NULL if an error occurs. A setter function should either succeed or fail, it shouldn't leave the value NULL on failure. Signed-off-by:
Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by:
Paolo Bonzini <pbonzini@redhat.com> Signed-off-by:
Andreas Färber <afaerber@suse.de>
-
Stefan Hajnoczi authored
The path resolution logic in object_property_set_link() should be a separate function. This makes the code easier to read and maintain. Signed-off-by:
Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by:
Paolo Bonzini <pbonzini@redhat.com> Signed-off-by:
Andreas Färber <afaerber@suse.de>
-
- Mar 13, 2014
-
-
Andreas Färber authored
Clear it on reset. Signed-off-by:
Andreas Färber <afaerber@suse.de>
-
Andreas Färber authored
Signed-off-by:
Andreas Färber <afaerber@suse.de>
-
Andreas Färber authored
Reset it. Signed-off-by:
Andreas Färber <afaerber@suse.de>
-
Andreas Färber authored
Rename can_do_io() to cpu_can_do_io() and change argument to CPUState. Signed-off-by:
Andreas Färber <afaerber@suse.de>
-
Andreas Färber authored
Reset them. Signed-off-by:
Andreas Färber <afaerber@suse.de>
-
Andreas Färber authored
All targets using it gain the ability to set -cpu name,key=value,... options via the default TYPE_CPU CPUClass::parse_features() implementation. Signed-off-by:
Andreas Färber <afaerber@suse.de>
-
Andreas Färber authored
CPUs who do not provide their own implementation of feature parsing will treat each option as a QOM property and set it to the supplied value. Signed-off-by:
Andreas Färber <afaerber@suse.de>
-
Andreas Färber authored
Default to false. Tidy variable naming and inline cast uses while at it. Tested-by: Jia Liu <proljc@gmail.com> (or32) Signed-off-by:
Andreas Färber <afaerber@suse.de>
-
Edgar E. Iglesias authored
cpu->exit_request is part of the execution environment and should not be cleared when a CPU resets. Otherwise, we might deadlock QEMU if a CPU resets while there is I/O going on. Signed-off-by:
Edgar E. Iglesias <edgar.iglesias@xilinx.com> Reviewed-by:
Peter Maydell <peter.maydell@linaro.org> Signed-off-by:
Andreas Färber <afaerber@suse.de>
-
Stefan Hajnoczi authored
It is often useful to find an object's child property name. Also use this new function to simplify the implementation of object_get_canonical_path(). Reviewed-by:
Andreas Färber <afaerber@suse.de> Signed-off-by:
Stefan Hajnoczi <stefanha@redhat.com>
-
- Mar 12, 2014
-
-
Stefan Hajnoczi authored
When object_property_add_str() and object_property_add_bool() fail, they leak their internal StringProperty and BoolProperty structs. Remember to free the structs on error. Luckily this is a low-impact memory leak since most QOM properties are static qdev properties that will never take the error case. object_property_add() only fails if the property name is already in use. Signed-off-by:
Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by:
Eric Blake <eblake@redhat.com> Cc: qemu-stable@nongnu.org Signed-off-by:
Andreas Färber <afaerber@suse.de>
-
- Feb 14, 2014
-
-
Paolo Bonzini authored
This will be used by "info qtree". For numbers it prints both the decimal and hex values. For sizes it rounds to the nearest power of 2^10. For strings, it puts quotes around the string and separates NULL and empty string. Reviewed-by:
Igor Mammedov <imammedo@redhat.com> Reviewed-by:
Eric Blake <eblake@redhat.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com> Signed-off-by:
Andreas Färber <afaerber@suse.de>
-
- Jan 28, 2014
-
-
Igor Mammedov authored
Introduces USER_CREATABLE interface that must be implemented by objects which are designed to created with -object CLI option or object-add QMP command. Interface provides an ability to do an optional second stage initialization of the object created with -object/object-add commands. By providing complete() callback, which is called after the object properties were set. It allows to: * prevents misusing of -object/object-add by filtering out objects that are not designed for it. * generalize second stage backend initialization instead of adding custom APIs to perform it * early error detection of backend initialization at -object/ object-add time rather than through a proxy DEVICE object that tries to use backend. Signed-off-by:
Igor Mammedov <imammedo@redhat.com> Reviewed-by:
Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by:
Luiz Capitulino <lcapitulino@redhat.com>
-
- Jan 06, 2014
-
-
Paolo Bonzini authored
Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com> Reviewed-by:
Igor Mammedov <imammedo@redhat.com> Tested-by:
Igor Mammedov <imammedo@redhat.com> Signed-off-by:
Luiz Capitulino <lcapitulino@redhat.com>
-
- Dec 24, 2013
-
-
Hervé Poussineau authored
We should not modify the type hash table while it is being iterated on. Assert that it does not happen. Signed-off-by:
Hervé Poussineau <hpoussin@reactos.org> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com> Signed-off-by:
Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by:
Andreas Färber <afaerber@suse.de>
-
Paolo Bonzini authored
There should be no need to look up nor enumerate the interface "types", whose "classes" are really just vtables. Just create the types and add them to the interface list of the parent type. Interfaces not registering their type anymore means that accessing superclass::interface by type name will fail when initializing subclass::interface. Thus, we need to pre-initialize the subclass's parent_type field before calling type_initialize. Apart from this, the interface "types" should never be used and thus it is harmless to leave them out of the hashtable. Further, the interface types had a bug with interfaces that are inherited from a superclass: The implementation type name was wrong (for example it was subclass::superclass::interface rather than just subclass::interface). This patch fixes this as well. Reported-by:
Igor Mammedov <imammedo@redhat.com> Tested-by:
Igor Mammedov <imammedo@redhat.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com> Signed-off-by:
Andreas Färber <afaerber@suse.de>
-
Peter Crosthwaite authored
The object-cast and class-cast caches cannot be shared because class caching is conditional on the target type not being an interface and object caching is unconditional. Leads to a bug when a class cast to an interface follows an object cast to the same interface type: FooObject = FOO(obj); FooClass = FOO_GET_CLASS(obj); Where TYPE_FOO is an interface. The first (object) cast will be successful and cache the casting result (i.e. TYPE_FOO will be cached). The second (class) cast will then check the shared cast cache and register a hit. The issue is, when a class cast hits in the cache it just returns a pointer cast of the input class (i.e. the concrete class). When casting to an interface, the cast itself must return the interface class, not the concrete class. The implementation of class cast caching already ensures that the returned cast result is only a pointer cast before caching. The object cast logic however does not have this check. Resolve by just splitting the object and class caches. Cc: qemu-stable@nongnu.org Signed-off-by:
Peter Crosthwaite <peter.crosthwaite@xilinx.com> Reviewed-by:
Paolo Bonzini <pbonzini@redhat.com> Tested-by:
Nathan Rossi <nathan.rossi@xilinx.com> Reviewed-by:
Edgar E. Iglesias <edgar.iglesias@gmail.com> Signed-off-by:
Andreas Färber <afaerber@suse.de>
-
- Dec 22, 2013
-
-
Markus Armbruster authored
Signed-off-by:
Markus Armbruster <armbru@redhat.com> Reviewed-by:
Peter Maydell <peter.maydell@linaro.org> Signed-off-by:
Andreas Färber <afaerber@suse.de>
-
Markus Armbruster authored
In an ideal world, machines can be built by wiring devices together with configuration, not code. Unfortunately, that's not the world we live in right now. We still have quite a few devices that need to be wired up by code. If you try to device_add such a device, it'll fail in sometimes mysterious ways. If you're lucky, you get an unmysterious immediate crash. To protect users from such badness, DeviceClass member no_user used to make device models unavailable with -device / device_add, but that regressed in commit 18b6dade. The device model is still omitted from help, but is available anyway. Attempts to fix the regression have been rejected with the argument that the purpose of no_user isn't clear, and it's prone to misuse. This commit clarifies no_user's purpose. Anthony suggested to rename it cannot_instantiate_with_device_add_yet_due_to_internal_bugs, which I shorten somewhat to keep checkpatch happy. While there, make it bool. Every use of cannot_instantiate_with_device_add_yet gets a FIXME comment asking for rationale. The next few commits will clean them all up, either by providing a rationale, or by getting rid of the use. With that done, the regression fix is hopefully acceptable. Signed-off-by:
Markus Armbruster <armbru@redhat.com> Reviewed-by:
Marcel Apfelbaum <marcel.a@redhat.com> Signed-off-by:
Andreas Färber <afaerber@suse.de>
-
- Nov 19, 2013
-
-
Vlad Yasevich authored
Save the result of the call to object_get_canonical_path() so we can free it. Cc: qemu-stable@nongnu.org Signed-off-by:
Vlad Yasevich <vyasevic@redhat.com> Reviewed-by:
Amos Kong <akong@redhat.com> Reviewed-by:
Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by:
Andreas Färber <afaerber@suse.de>
-