1. 14 Oct, 2014 1 commit
  2. 06 Oct, 2014 1 commit
  3. 25 Sep, 2014 2 commits
  4. 12 Sep, 2014 3 commits
  5. 01 Jul, 2014 2 commits
    • Paolo Bonzini's avatar
      qom: add a generic mechanism to resolve paths · 64607d08
      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: default avatarPaolo Bonzini <pbonzini@redhat.com>
      64607d08
    • Stefan Hajnoczi's avatar
      qom: add object_property_add_alias() · ef7c7ff6
      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: default avatarStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: default avatarPeter Crosthwaite <peter.crosthwaite@xilinx.com>
      ef7c7ff6
  6. 29 Jun, 2014 1 commit
  7. 19 Jun, 2014 1 commit
  8. 05 Jun, 2014 1 commit
  9. 31 Mar, 2014 1 commit
    • Andreas Färber's avatar
      cpu: Avoid QOM casts for CPU() · 0d6d1ab4
      Andreas Färber authored
      CPU address spaces touching load and store helpers as well as the
      movement of (almost) all fields from CPU_COMMON to CPUState have led to
      a noticeable increase of CPU() usage in "hot" paths for both TCG and KVM.
      
      While CPU()'s OBJECT_CHECK() might help detect development errors, i.e.
      in form of crashes due to QOM vs. non-QOM mismatches rather than QOM
      type mismatches, it is not really needed at runtime since mostly used in
      CPU-specific paths, coming from a target-specific CPU subtype. If that
      pointer is damaged, other errors are highly likely to occur elsewhere
      anyway.
      
      Keep the CPU() macro for a consistent developer experience and for
      flexibility to exchange its implementation, but turn it into a pure,
      unchecked C cast for now.
      
      Compare commit 6e42be7c.
      Reported-by: default avatarLaurent Desnogues <laurent.desnogues@gmail.com>
      Suggested-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarAndreas Färber <afaerber@suse.de>
      0d6d1ab4
  10. 19 Mar, 2014 3 commits
    • Stefan Hajnoczi's avatar
      qom: Add check() argument to object_property_add_link() · 39f72ef9
      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: default avatarStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      [AF: Tweaked documentation comment]
      Signed-off-by: default avatarAndreas Färber <afaerber@suse.de>
      39f72ef9
    • Richard Henderson's avatar
      cpu: Move tcg_exit_req to the end of CPUState · 7e4fb26d
      Richard Henderson authored
      Reverse an increase in the size of generated code.
      Signed-off-by: default avatarRichard Henderson <rth@twiddle.net>
      Signed-off-by: default avatarAndreas Färber <afaerber@suse.de>
      7e4fb26d
    • Stefan Hajnoczi's avatar
      qom: Make QOM link property unref optional · 9561fda8
      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: default avatarStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarAndreas Färber <afaerber@suse.de>
      9561fda8
  11. 13 Mar, 2014 18 commits
  12. 28 Feb, 2014 1 commit
  13. 14 Feb, 2014 1 commit
  14. 11 Feb, 2014 1 commit
  15. 28 Jan, 2014 1 commit
    • Igor Mammedov's avatar
      add optional 2nd stage initialization to -object/object-add commands · 269e09f3
      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: default avatarIgor Mammedov <imammedo@redhat.com>
      Reviewed-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: default avatarLuiz Capitulino <lcapitulino@redhat.com>
      269e09f3
  16. 24 Dec, 2013 2 commits
    • Paolo Bonzini's avatar
      qom: Do not register interface "types" in the type table and fix names · b061dc41
      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: default avatarIgor Mammedov <imammedo@redhat.com>
      Tested-by: default avatarIgor Mammedov <imammedo@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarAndreas Färber <afaerber@suse.de>
      b061dc41
    • Peter Crosthwaite's avatar
      qom: Split out object and class caches · 0ab4c94c
      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: default avatarPeter Crosthwaite <peter.crosthwaite@xilinx.com>
      Reviewed-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Tested-by: default avatarNathan Rossi <nathan.rossi@xilinx.com>
      Reviewed-by: default avatarEdgar E. Iglesias <edgar.iglesias@gmail.com>
      Signed-off-by: default avatarAndreas Färber <afaerber@suse.de>
      0ab4c94c