1. 09 9月, 2015 4 次提交
  2. 15 8月, 2015 1 次提交
    • P
      exec: drop cpu_can_do_io, just read cpu->can_do_io · 414b15c9
      Paolo Bonzini 提交于
      After commit 626cf8f4 (icount: set can_do_io outside TB execution,
      2014-12-08), can_do_io is set to 1 if not executing code.  It is
      no longer necessary to make this assumption in cpu_can_do_io.
      
      It is also possible to remove the use_icount test, simply by
      never setting cpu->can_do_io to 0 unless use_icount is true.
      
      With these changes cpu_can_do_io boils down to a read of
      cpu->can_do_io.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      414b15c9
  3. 09 7月, 2015 3 次提交
  4. 07 7月, 2015 1 次提交
  5. 20 6月, 2015 5 次提交
    • D
      qom: Don't pass string table to object_get_enum() function · a3590dac
      Daniel P. Berrange 提交于
      Now that properties can be explicitly registered as an enum
      type, there is no need to pass the string table to the
      object_get_enum() function. The object property registration
      already has a pointer to the string table.
      
      In changing this method signature, the hostmem backend object
      has to be converted to use the new enum property registration
      code, which simplifies it somewhat.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NAndreas Färber <afaerber@suse.de>
      a3590dac
    • D
      qom: Add an object_property_add_enum() helper function · a8e3fbed
      Daniel P. Berrange 提交于
      A QOM property can be parsed as enum using the visit_type_enum()
      helper function, but this forces callers to use the more complex
      generic object_property_add() method when registering it. It
      also requires that users of that object have access to the
      string map when they want to read the property value.
      
      This patch introduces a specialized object_property_add_enum()
      method which simplifies the use of enum properties, so the
      setters/getters directly get passed the int value.
      
        typedef enum {
           MYDEV_TYPE_FROG,
           MYDEV_TYPE_ALLIGATOR,
           MYDEV_TYPE_PLATYPUS,
      
           MYDEV_TYPE_LAST
        } MyDevType;
      
      Then provide a table of enum <-> string mappings
      
        static const char *const mydevtypemap[MYDEV_TYPE_LAST + 1] = {
           [MYDEV_TYPE_FROG] = "frog",
           [MYDEV_TYPE_ALLIGATOR] = "alligator",
           [MYDEV_TYPE_PLATYPUS] = "platypus",
           [MYDEV_TYPE_LAST] = NULL,
        };
      
      Assuming an object struct of
      
         typedef struct {
            Object parent_obj;
            MyDevType devtype;
            ...other fields...
         } MyDev;
      
      The property can then be registered as follows:
      
         static int mydev_prop_get_devtype(Object *obj,
                                           Error **errp G_GNUC_UNUSED)
         {
             MyDev *dev = MYDEV(obj);
      
             return dev->devtype;
         }
      
         static void mydev_prop_set_devtype(Object *obj,
                                            int value,
                                            Error **errp G_GNUC_UNUSED)
         {
             MyDev *dev = MYDEV(obj);
      
             dev->devtype = value;
         }
      
         object_property_add_enum(obj, "devtype",
                                  mydevtypemap, "MyDevType",
                                  mydev_prop_get_devtype,
                                  mydev_prop_set_devtype,
                                  NULL);
      
      Note there is no need to check the range of 'value' in
      the setter, because the string->enum conversion code will
      have already done that and reported an error as required.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NAndreas Färber <afaerber@suse.de>
      a8e3fbed
    • D
      qom: Make enum string tables const-correct · 2e4450ff
      Daniel P. Berrange 提交于
      The enum string table parameters in various QOM/QAPI methods
      are declared 'const char *strings[]'. This results in const
      warnings if passed a variable that was declared as
      
         static const char * const strings[] = { .... };
      
      Add the extra const annotation to the parameters, since
      neither the string elements, nor the array itself should
      ever be modified.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NAndreas Färber <afaerber@suse.de>
      2e4450ff
    • D
      qom: Add object_new_with_props() / object_new_withpropv() helpers · a31bdae5
      Daniel P. Berrange 提交于
      It is reasonably common to want to create an object, set a
      number of properties, register it in the hierarchy and then
      mark it as complete (if a user creatable type). This requires
      quite a lot of error prone, verbose, boilerplate code to achieve.
      
      First a pair of functions object_set_props() / object_set_propv()
      are added which allow for a list of objects to be set in
      one single API call.
      
      Then object_new_with_props() / object_new_with_propv() constructors
      are added which simplify the sequence of calls to create an
      object, populate properties, register in the object composition
      tree and mark the object complete, into a single method call.
      
      Usage would be:
      
         Error *err = NULL;
         Object *obj;
         obj = object_new_with_propv(TYPE_MEMORY_BACKEND_FILE,
                                     object_get_objects_root(),
                                     "hostmem0",
                                     &err,
                                     "share", "yes",
                                     "mem-path", "/dev/shm/somefile",
                                     "prealloc", "yes",
                                     "size", "1048576",
                                     NULL);
      
      Note all property values are passed in string form and will
      be parsed into their required data types, using normal QOM
      semantics for parsing from string format.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NAndreas Färber <afaerber@suse.de>
      a31bdae5
    • D
      qom: Add helper function for getting user objects root · bc2256c4
      Daniel P. Berrange 提交于
      Add object_get_objects_root() function which is a convenience for
      obtaining the Object * located at /objects in the object
      composition tree. Convert existing code over to use the new
      API where appropriate.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NAndreas Färber <afaerber@suse.de>
      bc2256c4
  6. 05 6月, 2015 1 次提交
  7. 26 4月, 2015 1 次提交
  8. 01 4月, 2015 1 次提交
  9. 19 3月, 2015 1 次提交
    • S
      Fix remaining warnings from Sparse (void return) · e7ae771f
      Stefan Weil 提交于
      Sparse report:
      
      hw/display/vga.c:2000:5: warning: returning void-valued expression
      hw/intc/arm_gic.c:707:9: warning: returning void-valued expression
      hw/intc/etraxfs_pic.c:138:9: warning: returning void-valued expression
      hw/nvram/fw_cfg.c:475:5: warning: returning void-valued expression
      hw/timer/a9gtimer.c:124:5: warning: returning void-valued expression
      hw/tpm/tpm_tis.c:794:5: warning: returning void-valued expression
      hw/usb/hcd-musb.c:558:9: warning: returning void-valued expression
      hw/usb/hcd-musb.c:776:13: warning: returning void-valued expression
      hw/usb/hcd-musb.c:867:5: warning: returning void-valued expression
      hw/usb/hcd-musb.c:932:5: warning: returning void-valued expression
      include/qom/cpu.h:584:5: warning: returning void-valued expression
      monitor.c:4686:13: warning: returning void-valued expression
      monitor.c:4690:13: warning: returning void-valued expression
      
      Cc: Edgar E. Iglesias <edgar.iglesias@gmail.com>
      Cc: Gerd Hoffmann <kraxel@redhat.com>
      Cc: Andreas Färber <afaerber@suse.de>
      Cc: Luiz Capitulino <lcapitulino@redhat.com>
      Signed-off-by: NStefan Weil <sw@weilnetz.de>
      Signed-off-by: NMichael Tokarev <mjt@tls.msk.ru>
      e7ae771f
  10. 11 3月, 2015 1 次提交
  11. 09 3月, 2015 1 次提交
  12. 17 2月, 2015 1 次提交
    • P
      exec: make iotlb RCU-friendly · 9d82b5a7
      Paolo Bonzini 提交于
      After the previous patch, TLBs will be flushed on every change to
      the memory mapping.  This patch augments that with synchronization
      of the MemoryRegionSections referred to in the iotlb array.
      
      With this change, it is guaranteed that iotlb_to_region will access
      the correct memory map, even once the TLB will be accessed outside
      the BQL.
      Reviewed-by: NFam Zheng <famz@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      9d82b5a7
  13. 16 2月, 2015 1 次提交
  14. 15 10月, 2014 1 次提交
  15. 06 10月, 2014 1 次提交
  16. 26 9月, 2014 2 次提交
  17. 12 9月, 2014 3 次提交
  18. 01 7月, 2014 2 次提交
    • P
      qom: add a generic mechanism to resolve paths · 64607d08
      Paolo Bonzini 提交于
      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: NPaolo Bonzini <pbonzini@redhat.com>
      64607d08
    • S
      qom: add object_property_add_alias() · ef7c7ff6
      Stefan Hajnoczi 提交于
      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: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NPeter Crosthwaite <peter.crosthwaite@xilinx.com>
      ef7c7ff6
  19. 30 6月, 2014 1 次提交
  20. 19 6月, 2014 1 次提交
  21. 05 6月, 2014 1 次提交
  22. 01 4月, 2014 1 次提交
    • A
      cpu: Avoid QOM casts for CPU() · 0d6d1ab4
      Andreas Färber 提交于
      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: NLaurent Desnogues <laurent.desnogues@gmail.com>
      Suggested-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NAndreas Färber <afaerber@suse.de>
      0d6d1ab4
  23. 20 3月, 2014 3 次提交
    • S
      qom: Add check() argument to object_property_add_link() · 39f72ef9
      Stefan Hajnoczi 提交于
      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: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
      [AF: Tweaked documentation comment]
      Signed-off-by: NAndreas Färber <afaerber@suse.de>
      39f72ef9
    • R
      cpu: Move tcg_exit_req to the end of CPUState · 7e4fb26d
      Richard Henderson 提交于
      Reverse an increase in the size of generated code.
      Signed-off-by: NRichard Henderson <rth@twiddle.net>
      Signed-off-by: NAndreas Färber <afaerber@suse.de>
      7e4fb26d
    • S
      qom: Make QOM link property unref optional · 9561fda8
      Stefan Hajnoczi 提交于
      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: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NAndreas Färber <afaerber@suse.de>
      9561fda8
  24. 14 3月, 2014 2 次提交