1. 12 3月, 2015 1 次提交
  2. 01 3月, 2015 1 次提交
  3. 26 2月, 2015 2 次提交
  4. 12 2月, 2015 1 次提交
  5. 02 11月, 2014 1 次提交
    • M
      virtio-pci: fix migration for pci bus master · 68a27b20
      Michael S. Tsirkin 提交于
      Current support for bus master (clearing OK bit) together with the need to
      support guests which do not enable PCI bus mastering, leads to extra state in
      VIRTIO_PCI_FLAG_BUS_MASTER_BUG bit, which isn't robust in case of cross-version
      migration for the case when guests use the device before setting DRIVER_OK.
      
      Rip out this code, and replace it:
      -   Modern QEMU doesn't need VIRTIO_PCI_FLAG_BUS_MASTER_BUG
          so just drop it for latest machine type.
      -   For compat machine types, set PCI_COMMAND if DRIVER_OK
          is set.
      
      As this is needed for 2.1 for both pc and ppc, move PC_COMPAT macros from pc.h
      to a new common header.
      
      Cc: Greg Kurz <gkurz@linux.vnet.ibm.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Reviewed-by: NAlexander Graf <agraf@suse.de>
      
      68a27b20
  6. 30 10月, 2014 1 次提交
  7. 20 10月, 2014 1 次提交
    • M
      hw: Convert from BlockDriverState to BlockBackend, mostly · 4be74634
      Markus Armbruster 提交于
      Device models should access their block backends only through the
      block-backend.h API.  Convert them, and drop direct includes of
      inappropriate headers.
      
      Just four uses of BlockDriverState are left:
      
      * The Xen paravirtual block device backend (xen_disk.c) opens images
        itself when set up via xenbus, bypassing blockdev.c.  I figure it
        should go through qmp_blockdev_add() instead.
      
      * Device model "usb-storage" prompts for keys.  No other device model
        does, and this one probably shouldn't do it, either.
      
      * ide_issue_trim_cb() uses bdrv_aio_discard() instead of
        blk_aio_discard() because it fishes its backend out of a BlockAIOCB,
        which has only the BlockDriverState.
      
      * PC87312State has an unused BlockDriverState[] member.
      
      The next two commits take care of the latter two.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      4be74634
  8. 15 10月, 2014 3 次提交
  9. 30 9月, 2014 14 次提交
  10. 19 9月, 2014 2 次提交
    • M
      virtio-pci: fix migration for pci bus master · 4d43d3f3
      Michael S. Tsirkin 提交于
      Current support for bus master (clearing OK bit)
      together with the need to support guests which do not
      enable PCI bus mastering, leads to extra state in
      VIRTIO_PCI_FLAG_BUS_MASTER_BUG bit, which isn't robust
      in case of cross-version migration for the case when
      guests use the device before setting DRIVER_OK.
      
      Rip out VIRTIO_PCI_FLAG_BUS_MASTER_BUG and implement a simpler
      work-around: treat clearing of PCI_COMMAND as a virtio reset.  Old
      guests never touch this bit so they will work.
      
      As reset clears device status, DRIVER and MASTER bits are
      now in sync, so we can fix up cross-version migration simply
      by synchronising them, without need to detect a buggy guest
      explicitly.
      
      Drop tracking VIRTIO_PCI_FLAG_BUS_MASTER_BUG completely.
      
      As reset makes the device quiescent, in the future we'll be able to drop
      checking OK bit in a bunch of places.
      
      Cc: Jason Wang <jasowang@redhat.com>
      Cc: Greg Kurz <gkurz@linux.vnet.ibm.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      4d43d3f3
    • M
      virtio-pci: enable bus master for old guests · e43c0b2e
      Michael S. Tsirkin 提交于
      commit cc943c36
          pci: Use bus master address space for delivering MSI/MSI-X messages
      breaks virtio-net for rhel6.[56] x86 guests because they don't
      enable bus mastering for virtio PCI devices. For the same reason,
      rhel6.[56] ppc64 guests cannot boot on a virtio-blk disk anymore.
      
      Old guests forgot to enable bus mastering, enable it automatically on
      DRIVER (guests use some devices before DRIVER_OK).
      Reported-by: NGreg Kurz <gkurz@linux.vnet.ibm.com>
      Reviewed-by: NGreg Kurz <gkurz@linux.vnet.ibm.com>
      Tested-by: NGreg Kurz <gkurz@linux.vnet.ibm.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      e43c0b2e
  11. 18 8月, 2014 1 次提交
  12. 06 7月, 2014 2 次提交
    • P
      virtio-pci: fix MSI memory region use after free · 8b81bb3b
      Paolo Bonzini 提交于
      After memory region QOMification QEMU is stricter in detecting
      wrong usage of the memory region API.  Here it detected a
      memory_region_destroy done before the corresponding
      memory_region_del_subregion; the memory_region_destroy is
      done by msix_uninit_exclusive_bar, the memory_region_del_subregion
      is done by the PCI core's pci_unregister_io_regions before
      pc->exit is called.
      
      The problem was introduced by
      commit 06a13073
          virtio-pci: add device_unplugged callback
      As noted in that commit log, virtio device kick callbacks need to be
      stopped before generic virtio is cleaned up. This is because these are
      notifications from pci proxy to the generic virtio device so they need
      to be stopped in the unplug call before the virtio device is unrealized.
      However interrupts are notifications from the virtio device to
      the pci proxy so they need to stay around while the device
      is realized.
      
      The memory API misuse caused an assertion when hot-unplugging virtio
      devices.  Using the API correctly fixes the assertion.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      8b81bb3b
    • M
      virtio: move common virtio properties to bus class device · 85d1277e
      Ming Lei 提交于
      The two common virtio features can be defined per bus, so move all
      into bus class device to make code more clean.
      
      As discussed with cornelia, s390-virtio-blk doesn't support
      the two features at all, so keep s390-virtio as it.
      
      Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> #for s390 ccw
      Suggested-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NMing Lei <ming.lei@canonical.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      
      MST: rebase and resolve conflicts
      85d1277e
  13. 01 7月, 2014 4 次提交
  14. 30 6月, 2014 2 次提交
    • G
      virtio: add endian-ambivalent support to VirtIODevice · 616a6552
      Greg Kurz 提交于
      Some CPU families can dynamically change their endianness. This means we
      can have little endian ppc or big endian arm guests for example. This has
      an impact on legacy virtio data structures since they are target endian.
      We hence introduce a new property to track the endianness of each virtio
      device. It is reasonnably assumed that endianness won't change while the
      device is in use : we hence capture the device endianness when it gets
      reset.
      
      We migrate this property in a subsection, after the device descriptor. This
      means the load code must not rely on it until it is restored. As a consequence,
      the vring sanity checks had to be moved after the call to vmstate_load_state().
      We enforce paranoia by poisoning the property at the begining of virtio_load().
      Signed-off-by: NGreg Kurz <gkurz@linux.vnet.ibm.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      616a6552
    • G
      exec: introduce target_words_bigendian() helper · 98ed8ecf
      Greg Kurz 提交于
      We currently have a virtio_is_big_endian() helper that provides the target
      endianness to the virtio code. As of today, the helper returns a fixed
      compile-time value. Of course, this will have to change if we want to
      support target endianness changes at run-time.
      
      Let's move the TARGET_WORDS_BIGENDIAN bits out to a new helper and have
      virtio_is_big_endian() implemented on top of it.
      
      This patch doesn't change any functionality.
      Signed-off-by: NGreg Kurz <gkurz@linux.vnet.ibm.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      98ed8ecf
  15. 23 6月, 2014 1 次提交
  16. 20 3月, 2014 2 次提交
    • 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
    • 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
  17. 15 2月, 2014 1 次提交