1. 19 1月, 2017 6 次提交
    • L
      fw-cfg: turn FW_CFG_FILE_SLOTS into a device property · e12f3a13
      Laszlo Ersek 提交于
      We'd like to raise the value of FW_CFG_FILE_SLOTS. Doing it naively could
      lead to problems with backward migration: a more recent QEMU (running an
      older machine type) would allow the guest, in fw_cfg_select(), to select a
      high key value that is unavailable in the same machine type implemented by
      the older (target) QEMU. On the target host, fw_cfg_data_read() for
      example could dereference nonexistent entries.
      
      As first step, size the FWCfgState.entries[*] and FWCfgState.entry_order
      arrays dynamically. All three array sizes will be influenced by the new
      field FWCfgState.file_slots (and matching device property).
      
      Make the following changes:
      
      - Replace the FW_CFG_FILE_SLOTS macro with FW_CFG_FILE_SLOTS_MIN (minimum
        count of fw_cfg file slots) in the header file. The value remains 0x10.
      
      - Replace all uses of FW_CFG_FILE_SLOTS with a helper function called
        fw_cfg_file_slots(), returning the new property.
      
      - Eliminate the macro FW_CFG_MAX_ENTRY, and replace all its uses with a
        helper function called fw_cfg_max_entry().
      
      - In the MMIO- and IO-mapped realize functions both, allocate all three
        arrays dynamically, based on the new property.
      
      - The new property defaults to FW_CFG_FILE_SLOTS_MIN. This is going to be
        customized in the following patches.
      
      Cc: "Gabriel L. Somlo" <somlo@cmu.edu>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Gerd Hoffmann <kraxel@redhat.com>
      Cc: Igor Mammedov <imammedo@redhat.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NLaszlo Ersek <lersek@redhat.com>
      Acked-by: NGabriel Somlo <somlo@cmu.edu>
      Tested-by: NGabriel Somlo <somlo@cmu.edu>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Reviewed-by: NEduardo Habkost <ehabkost@redhat.com>
      e12f3a13
    • M
      fw-cfg: support writeable blobs · baf2d5bf
      Michael S. Tsirkin 提交于
      Useful to send guest data back to QEMU.
      
      Changes from Laszlo Ersek <lersek@redhat.com>:
      - rebase the patch from Michael Tsirkin's original postings at [1] and [2]
        to the following patches:
        - loader: Allow a custom AddressSpace when loading ROMs
        - loader: Add AddressSpace loading support to uImages
        - loader: fix handling of custom address spaces when adding ROM blobs
      - reject such writes immediately that would exceed the end of the array,
        rather than performing a partial write before setting the error bit: see
        the (len != dma.length) condition
      - document the write interface
      
      [1] http://lists.nongnu.org/archive/html/qemu-devel/2016-02/msg04968.html
      [2] http://lists.nongnu.org/archive/html/qemu-devel/2016-03/msg02735.html
      
      Cc: "Gabriel L. Somlo" <somlo@cmu.edu>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Gerd Hoffmann <kraxel@redhat.com>
      Cc: Igor Mammedov <imammedo@redhat.com>
      Cc: Michael Walle <michael@walle.cc>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Peter Maydell <peter.maydell@linaro.org>
      Cc: Shannon Zhao <zhaoshenglong@huawei.com>
      Cc: qemu-arm@nongnu.org
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NLaszlo Ersek <lersek@redhat.com>
      Reviewed-by: NMarcel Apfelbaum <marcel@redhat.com>
      Acked-by: NGabriel Somlo <somlo@cmu.edu>
      Tested-by: NGabriel Somlo <somlo@cmu.edu>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Reviewed-by: NEduardo Habkost <ehabkost@redhat.com>
      baf2d5bf
    • J
      vhost_net: device IOTLB support · c471ad0e
      Jason Wang 提交于
      This patches implements Device IOTLB support for vhost kernel. This is
      done through:
      
      1) switch to use dma helpers when map/unmap vrings from vhost codes
      2) introduce a set of VhostOps to:
         - setting up device IOTLB request callback
         - processing device IOTLB request
         - processing device IOTLB invalidation
      2) kernel support for Device IOTLB API:
      
      - allow vhost-net to query the IOMMU IOTLB entry through eventfd
      - enable the ability for qemu to update a specified mapping of vhost
      - through ioctl.
      - enable the ability to invalidate a specified range of iova for the
        device IOTLB of vhost through ioctl. In x86/intel_iommu case this is
        triggered through iommu memory region notifier from device IOTLB
        invalidation descriptor processing routine.
      
      With all the above, kernel vhost_net can co-operate with userspace
      IOMMU. For vhost-user, the support could be easily done on top by
      implementing the VhostOps.
      
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      c471ad0e
    • S
      virtio: disable notifications again after poll succeeded · 1448c133
      Stefan Hajnoczi 提交于
      While AioContext is in polling mode virtqueue notifications are not
      necessary.  Some device virtqueue handlers enable notifications.  Make
      sure they stay disabled to avoid unnecessary vmexits.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Tested-by: NRichard Henderson <rth@twiddle.net>
      Tested-by: NLaszlo Ersek <lersek@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      1448c133
    • S
      Revert "virtio: turn vq->notification into a nested counter" · 332fa82d
      Stefan Hajnoczi 提交于
      This reverts commit aff8fd18.
      
      Both virtio-net and virtio-crypto do not balance
      virtio_queue_set_notification() enable and disable calls.  This makes
      the notifications_disabled counter unreliable and Doug Goldstein
      reported the following assertion failure:
      
        #3  0x00007ffff44d1c62 in __GI___assert_fail (
            assertion=assertion@entry=0x555555ae8e8a "vq->notification_disabled > 0",
            file=file@entry=0x555555ae89c0 "/home/doug/work/qemu/hw/virtio/virtio.c",
            line=line@entry=215,
            function=function@entry=0x555555ae9630 <__PRETTY_FUNCTION__.43707>
            "virtio_queue_set_notification") at assert.c:101
        #4  0x00005555557f25d6 in virtio_queue_set_notification (vq=0x55555666aa90,
            enable=enable@entry=1) at /home/doug/work/qemu/hw/virtio/virtio.c:215
        #5  0x00005555557dc311 in virtio_net_has_buffers (q=<optimized out>,
            q=<optimized out>, bufsize=102)
            at /home/doug/work/qemu/hw/net/virtio-net.c:1008
        #6  virtio_net_receive (nc=<optimized out>, buf=0x555557386b88 "", size=102)
            at /home/doug/work/qemu/hw/net/virtio-net.c:1148
        #7  0x00005555559cad33 in nc_sendv_compat (flags=<optimized out>, iovcnt=1,
            iov=0x7fffead746d0, nc=0x55555788b340) at net/net.c:705
        #8  qemu_deliver_packet_iov (sender=<optimized out>, flags=<optimized out>,
            iov=0x7fffead746d0, iovcnt=1, opaque=0x55555788b340) at net/net.c:732
        #9  0x00005555559cd929 in qemu_net_queue_deliver (size=<optimized out>,
            data=<optimized out>, flags=<optimized out>, sender=<optimized out>,
            queue=0x55555788b550) at net/queue.c:164
        #10 qemu_net_queue_flush (queue=0x55555788b550) at net/queue.c:261
      
      This patch is safe to revert since it's just an optimization for
      virtqueue polling.  The next patch will improve the situation again
      without resorting to nesting.
      Reported-by: NDoug Goldstein <cardoe@cardoe.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Tested-by: NRichard Henderson <rth@twiddle.net>
      Tested-by: NLaszlo Ersek <lersek@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      332fa82d
    • P
      virtio-net: enable ioeventfd even if vhost=off · 4a3f03ba
      Paolo Bonzini 提交于
      virtio-net-pci does not enable ioeventfd for historical reasons (and
      nobody ever checked whether it should be revisited).  Note that other
      backends do enable ioeventfd for virtio-net.
      
      However, it has a major effect on performance.  On Windows, throughput is
      _multiplied_ by 2 or 3 on TCP_STREAM (on small packets it is "only" a 30%
      improvement) and a little less so on TCP_MAERTS albeit still very much
      statistically significant.  Latency also has a single digit improvement.
      
      This is not visible when using vhost, which forces ioeventfd=on, but it
      is substantial without vhost.  In addition, also on Windows and with the
      RHEL 7.3 kernel, APICv seems to slow down virtio-net performance a bit,
      but the penalty with this patch goes from -25% to -7%.
      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>
      4a3f03ba
  2. 17 1月, 2017 3 次提交
    • P
      Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2017-01-16' into staging · 23eb9e6b
      Peter Maydell 提交于
      QAPI patches for 2017-01-16
      
      # gpg: Signature made Mon 16 Jan 2017 09:26:49 GMT
      # gpg:                using RSA key 0x3870B400EB918653
      # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>"
      # gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>"
      # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653
      
      * remotes/armbru/tags/pull-qapi-2017-01-16: (180 commits)
        build-sys: add qapi doc generation targets
        build-sys: add txt documentation rules
        build-sys: use a generic TEXI2MAN rule
        build-sys: remove dvi doc generation
        build-sys: use --no-split for info
        docs: add qemu logo to pdf
        qapi: add qapi2texi script
        qmp-events: move 'MIGRATION_PASS' doc to schema
        qmp-events: move 'DUMP_COMPLETED' doc to schema
        qmp-events: move 'MEM_UNPLUG_ERROR' doc to schema
        qmp-events: move 'VSERPORT_CHANGE' doc to schema
        qmp-events: move 'QUORUM_REPORT_BAD' doc to schema
        qmp-events: move 'QUORUM_FAILURE' doc to schema
        qmp-events: move 'GUEST_PANICKED' doc to schema
        qmp-events: move 'BALLOON_CHANGE' doc to schema
        qmp-events: move 'ACPI_DEVICE_OST' doc to schema
        qmp-events: move 'MIGRATION' doc to schema
        qmp-events: move 'SPICE_MIGRATE_COMPLETED' doc to schema
        qmp-events: move 'SPICE_DISCONNECTED' doc to schema
        qmp-events: move 'SPICE_INITIALIZED' doc to schema
        ...
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      23eb9e6b
    • P
      Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging · 02b351d8
      Peter Maydell 提交于
      # gpg: Signature made Mon 16 Jan 2017 13:38:52 GMT
      # gpg:                using RSA key 0x9CA4ABB381AB73C8
      # gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
      # gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"
      # Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35  775A 9CA4 ABB3 81AB 73C8
      
      * remotes/stefanha/tags/block-pull-request:
        async: optimize aio_bh_poll
        aio: document locking
        aio-win32: remove walking_handlers, protecting AioHandler list with list_lock
        aio-posix: remove walking_handlers, protecting AioHandler list with list_lock
        aio: tweak walking in dispatch phase
        aio-posix: split aio_dispatch_handlers out of aio_dispatch
        qemu-thread: optimize QemuLockCnt with futexes on Linux
        aio: make ctx->list_lock a QemuLockCnt, subsuming ctx->walking_bh
        qemu-thread: introduce QemuLockCnt
        aio: rename bh_lock to list_lock
        block: get rid of bdrv_io_unplugged_begin/end
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      02b351d8
    • P
      Merge remote-tracking branch... · a8c611e1
      Peter Maydell 提交于
      Merge remote-tracking branch 'remotes/stsquad/tags/pull-tcg-common-tlb-reset-20170113-r1' into staging
      
      This is the same as the v3 posted except a re-base and a few extra signoffs
      
      # gpg: Signature made Fri 13 Jan 2017 14:26:46 GMT
      # gpg:                using RSA key 0xFBD0DB095A9E2A44
      # gpg: Good signature from "Alex Bennée (Master Work Key) <alex.bennee@linaro.org>"
      # Primary key fingerprint: 6685 AE99 E751 67BC AFC8  DF35 FBD0 DB09 5A9E 2A44
      
      * remotes/stsquad/tags/pull-tcg-common-tlb-reset-20170113-r1:
        cputlb: drop flush_global flag from tlb_flush
        cpu_common_reset: wrap TCG specific code in tcg_enabled()
        qom/cpu: move tlb_flush to cpu_common_reset
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      a8c611e1
  3. 16 1月, 2017 31 次提交