1. 07 6月, 2016 1 次提交
    • A
      spapr_iommu: Migrate full state · a26fdf39
      Alexey Kardashevskiy 提交于
      The source guest could have reallocated the default TCE table and
      migrate bigger/smaller table. This adds reallocation in post_load()
      if the default table size is different on source and destination.
      
      This adds @bus_offset, @page_shift to the migration stream as
      a subsection so when DDW is added, migration to older machines will
      still be possible. As @bus_offset and @page_shift are not used yet,
      this makes no change in behavior.
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      a26fdf39
  2. 03 6月, 2016 1 次提交
    • D
      e1000e: Fix build with ust trace backend · defbaec1
      Dmitry Fleytman 提交于
      ust trace backend has limitation of maximum 10
      arguments per event. Traces with more arguments
      cannot be compiled for this backend.
      
      Trace e1000e_rx_rss_ip6 introduced by previous
      commits has 11 arguments and fails to compile with
      ust trace backend.
      
      This patch fixes the problem by splitting this
      tracepoint into two successive tracepoints with
      smaller number of arguments.
      
      For more information see comment regarding TP_ARGS
      in lttng/tracepoint.h:
      
      /*
      * TP_ARGS takes tuples of type, argument separated by a comma.
      * It can take up to 10 tuples (which means that less than 10 tuples is
      * fine too).
      * Each tuple is also separated by a comma.
      */
      
      Build log generated by this problem:
      
      In file included from ./trace/generated-tracers.h:9:0,
                       from /home/travis/build/qemu/qemu/include/trace.h:4,
                       from util/oslib-posix.c:36:
      ./trace/generated-ust-provider.h:16556:3: error: unknown type name ‘_TP_EXPROTO_Bool’
      In file included from /home/travis/build/qemu/qemu/include/trace.h:4:0,
                       from util/oslib-posix.c:36:
      ./trace/generated-tracers.h: In function ‘trace_e1000e_rx_rss_ip6’:
      ./trace/generated-tracers.h:8379:431: error: expected string literal before ‘_SDT_ASM_OPERANDS_ipv6_enabled’
      ./trace/generated-tracers.h:8379:431: error: implicit declaration of function ‘__tracepoint_cb_qemu___e1000e_rx_rss_ip6’ [-Werror=implicit-function-declaration]
      ./trace/generated-tracers.h:8379:431: error: nested extern declaration of ‘__tracepoint_cb_qemu___e1000e_rx_rss_ip6’ [-Werror=nested-externs]
      cc1: all warnings being treated as errors
      make: *** [util/oslib-posix.o] Error 1
      make: *** Waiting for unfinished jobs....
      In file included from ./trace/generated-tracers.h:9:0,
                       from /home/travis/build/qemu/qemu/include/trace.h:4,
                       from util/hbitmap.c:16:
      ./trace/generated-ust-provider.h:16556:3: error: unknown type name ‘_TP_EXPROTO_Bool’
      In file included from /home/travis/build/qemu/qemu/include/trace.h:4:0,
                       from util/hbitmap.c:16:
      ./trace/generated-tracers.h: In function ‘trace_e1000e_rx_rss_ip6’:
      ./trace/generated-tracers.h:8379:431: error: expected string literal before ‘_SDT_ASM_OPERANDS_ipv6_enabled’
      ./trace/generated-tracers.h:8379:431: error: implicit declaration of function ‘__tracepoint_cb_qemu___e1000e_rx_rss_ip6’ [-Werror=implicit-function-declaration]
      ./trace/generated-tracers.h:8379:431: error: nested extern declaration of ‘__tracepoint_cb_qemu___e1000e_rx_rss_ip6’ [-Werror=nested-externs]
      cc1: all warnings being treated as errors
      make: *** [util/hbitmap.o] Error 1
      Signed-off-by: NDmitry Fleytman <dmitry@daynix.com>
      Message-id: 1464894748-27803-1-git-send-email-dmitry@daynix.com
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      defbaec1
  3. 02 6月, 2016 3 次提交
    • D
      net: Introduce e1000e device emulation · 6f3fbe4e
      Dmitry Fleytman 提交于
      This patch introduces emulation for the Intel 82574 adapter, AKA e1000e.
      
      This implementation is derived from the e1000 emulation code, and
      utilizes the TX/RX packet abstractions that were initially developed for
      the vmxnet3 device. Although some parts of the introduced code may be
      shared with e1000, the differences are substantial enough so that the
      only shared resources for the two devices are the definitions in
      hw/net/e1000_regs.h.
      
      Similarly to vmxnet3, the new device uses virtio headers for task
      offloads (for backends that support virtio extensions). Usage of
      virtio headers may be forcibly disabled via a boolean device property
      "vnet" (which is enabled by default). In such case task offloads
      will be performed in software, in the same way it is done on
      backends that do not support virtio headers.
      
      The device code is split into two parts:
      
        1. hw/net/e1000e.c: QEMU-specific code for a network device;
        2. hw/net/e1000e_core.[hc]: Device emulation according to the spec.
      
      The new device name is e1000e.
      
      Intel specifications for the 82574 controller are available at:
      http://www.intel.com/content/dam/doc/datasheet/82574l-gbe-controller-datasheet.pdf
      
      Throughput measurement results (iperf2):
      
                      Fedora 22 guest, TCP, RX
          4 ++------------------------------------------+
            |                                           |
            |                           X   X   X   X   X
        3.5 ++          X   X   X   X                   |
            |       X                                   |
            |                                           |
          3 ++                                          |
      G     |   X                                       |
      b     |                                           |
      / 2.5 ++                                          |
      s     |                                           |
            |                                           |
          2 ++                                          |
            |                                           |
            |                                           |
        1.5 X+                                          |
            |                                           |
            +   +   +   +   +   +   +   +   +   +   +   +
          1 ++--+---+---+---+---+---+---+---+---+---+---+
           32  64  128 256 512  1   2   4   8  16  32  64
            B   B   B   B   B   KB  KB  KB  KB KB  KB  KB
                             Buffer size
      
                     Fedora 22 guest, TCP, TX
        18 ++-------------------------------------------+
           |                        X                   |
        16 ++                           X   X   X   X   X
           |                   X                        |
        14 ++                                           |
           |                                            |
        12 ++                                           |
      G    |               X                            |
      b 10 ++                                           |
      /    |                                            |
      s  8 ++                                           |
           |                                            |
         6 ++          X                                |
           |                                            |
         4 ++                                           |
           |       X                                    |
         2 ++  X                                        |
           X   +   +   +   +   +    +   +   +   +   +   +
         0 ++--+---+---+---+---+----+---+---+---+---+---+
          32  64  128 256 512  1    2   4   8  16  32  64
           B   B   B   B   B   KB   KB  KB  KB KB  KB  KB
                             Buffer size
      
                      Fedora 22 guest, UDP, RX
          3 ++------------------------------------------+
            |                                           X
            |                                           |
        2.5 ++                                          |
            |                                           |
            |                                           |
          2 ++                                 X        |
      G     |                                           |
      b     |                                           |
      / 1.5 ++                                          |
      s     |                         X                 |
            |                                           |
          1 ++                                          |
            |                                           |
            |                 X                         |
        0.5 ++                                          |
            |        X                                  |
            X        +        +       +        +        +
          0 ++-------+--------+-------+--------+--------+
           32       64       128     256      512       1
            B        B         B       B        B      KB
                             Datagram size
      
                      Fedora 22 guest, UDP, TX
          1 ++------------------------------------------+
            |                                           X
        0.9 ++                                          |
            |                                           |
        0.8 ++                                          |
        0.7 ++                                          |
            |                                           |
      G 0.6 ++                                          |
      b     |                                           |
      / 0.5 ++                                          |
      s     |                                  X        |
        0.4 ++                                          |
            |                                           |
        0.3 ++                                          |
        0.2 ++                        X                 |
            |                                           |
        0.1 ++                X                         |
            X        X        +       +        +        +
          0 ++-------+--------+-------+--------+--------+
           32       64       128     256      512       1
            B        B         B       B        B      KB
                             Datagram size
      
                    Windows 2012R2 guest, TCP, RX
        3.2 ++------------------------------------------+
            |                                   X       |
          3 ++                                          |
            |                                           |
        2.8 ++                                          |
            |                                           |
        2.6 ++                              X           |
      G     |   X                   X   X           X   X
      b 2.4 ++      X       X                           |
      /     |                                           |
      s 2.2 ++                                          |
            |                                           |
          2 ++                                          |
            |           X       X                       |
        1.8 ++                                          |
            |                                           |
        1.6 X+                                          |
            +   +   +   +   +   +   +   +   +   +   +   +
        1.4 ++--+---+---+---+---+---+---+---+---+---+---+
           32  64  128 256 512  1   2   4   8  16  32  64
            B   B   B   B   B   KB  KB  KB  KB KB  KB  KB
                             Buffer size
      
                   Windows 2012R2 guest, TCP, TX
        14 ++-------------------------------------------+
           |                                            |
           |                                        X   X
        12 ++                                           |
           |                                            |
        10 ++                                           |
           |                                            |
      G    |                                            |
      b  8 ++                                           |
      /    |                                    X       |
      s  6 ++                                           |
           |                                            |
           |                                            |
         4 ++                               X           |
           |                                            |
         2 ++                                           |
           |           X   X            X               |
           +   X   X   +   +   X    X   +   +   +   +   +
         0 X+--+---+---+---+---+----+---+---+---+---+---+
          32  64  128 256 512  1    2   4   8  16  32  64
           B   B   B   B   B   KB   KB  KB  KB KB  KB  KB
                             Buffer size
      
                    Windows 2012R2 guest, UDP, RX
        1.6 ++------------------------------------------X
            |                                           |
        1.4 ++                                          |
            |                                           |
        1.2 ++                                          |
            |                                  X        |
            |                                           |
      G   1 ++                                          |
      b     |                                           |
      / 0.8 ++                                          |
      s     |                                           |
        0.6 ++                        X                 |
            |                                           |
        0.4 ++                                          |
            |                 X                         |
            |                                           |
        0.2 ++       X                                  |
            X        +        +       +        +        +
          0 ++-------+--------+-------+--------+--------+
           32       64       128     256      512       1
            B        B         B       B        B      KB
                             Datagram size
      
                    Windows 2012R2 guest, UDP, TX
        0.6 ++------------------------------------------+
            |                                           X
            |                                           |
        0.5 ++                                          |
            |                                           |
            |                                           |
        0.4 ++                                          |
      G     |                                           |
      b     |                                           |
      / 0.3 ++                                 X        |
      s     |                                           |
            |                                           |
        0.2 ++                                          |
            |                                           |
            |                         X                 |
        0.1 ++                                          |
            |                 X                         |
            X        X        +       +        +        +
          0 ++-------+--------+-------+--------+--------+
           32       64       128     256      512       1
            B        B         B       B        B      KB
                             Datagram size
      Signed-off-by: NDmitry Fleytman <dmitry.fleytman@ravellosystems.com>
      Signed-off-by: NLeonid Bloch <leonid.bloch@ravellosystems.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      6f3fbe4e
    • D
      e1000: Move out code that will be reused in e1000e · 093454e2
      Dmitry Fleytman 提交于
      Code that will be shared moved to a separate files.
      Signed-off-by: NDmitry Fleytman <dmitry.fleytman@ravellosystems.com>
      Signed-off-by: NLeonid Bloch <leonid.bloch@ravellosystems.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      093454e2
    • D
      net_pkt: Extend packet abstraction as required by e1000e functionality · eb700029
      Dmitry Fleytman 提交于
      This patch extends the TX/RX packet abstractions with features that will
      be used by the e1000e device implementation.
      
      Changes are:
      
        1. Support iovec lists for RX buffers
        2. Deeper RX packets parsing
        3. Loopback option for TX packets
        4. Extended VLAN headers handling
        5. RSS processing for RX packets
      Signed-off-by: NDmitry Fleytman <dmitry.fleytman@ravellosystems.com>
      Signed-off-by: NLeonid Bloch <leonid.bloch@ravellosystems.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      eb700029
  4. 27 5月, 2016 3 次提交
    • A
      spapr_iommu: Move table allocation to helpers · fec5d3a1
      Alexey Kardashevskiy 提交于
      At the moment presence of vfio-pci devices on a bus affect the way
      the guest view table is allocated. If there is no vfio-pci on a PHB
      and the host kernel supports KVM acceleration of H_PUT_TCE, a table
      is allocated in KVM. However, if there is vfio-pci and we do yet not
      KVM acceleration for these, the table has to be allocated by
      the userspace. At the moment the table is allocated once at boot time
      but next patches will reallocate it.
      
      This moves kvmppc_create_spapr_tce/g_malloc0 and their counterparts
      to helpers.
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Reviewed-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      fec5d3a1
    • A
      vfio/pci: Intel graphics legacy mode assignment · c4c45e94
      Alex Williamson 提交于
      Enable quirks to support SandyBridge and newer IGD devices as primary
      VM graphics.  This requires new vfio-pci device specific regions added
      in kernel v4.6 to expose the IGD OpRegion, the shadow ROM, and config
      space access to the PCI host bridge and LPC/ISA bridge.  VM firmware
      support, SeaBIOS only so far, is also required for reserving memory
      regions for IGD specific use.  In order to enable this mode, IGD must
      be assigned to the VM at PCI bus address 00:02.0, it must have a ROM,
      it must be able to enable VGA, it must have or be able to create on
      its own an LPC/ISA bridge of the proper type at PCI bus address
      00:1f.0 (sorry, not compatible with Q35 yet), and it must have the
      above noted vfio-pci kernel features and BIOS.  The intention is that
      to enable this mode, a user simply needs to assign 00:02.0 from the
      host to 00:02.0 in the VM:
      
        -device vfio-pci,host=0000:00:02.0,bus=pci.0,addr=02.0
      
      and everything either happens automatically or it doesn't.  In the
      case that it doesn't, we leave error reports, but assume the device
      will operate in universal passthrough mode (UPT), which doesn't
      require any of this, but has a much more narrow window of supported
      devices, supported use cases, and supported guest drivers.
      
      When using IGD in this mode, the VM firmware is required to reserve
      some VM RAM for the OpRegion (on the order or several 4k pages) and
      stolen memory for the GTT (up to 8MB for the latest GPUs).  An
      additional option, x-igd-gms allows the user to specify some amount
      of additional memory (value is number of 32MB chunks up to 512MB) that
      is pre-allocated for graphics use.  TBH, I don't know of anything that
      requires this or makes use of this memory, which is why we don't
      allocate any by default, but the specification suggests this is not
      actually a valid combination, so the option exists as a workaround.
      Please report if it's actually necessary in some environment.
      
      See code comments for further discussion about the actual operation
      of the quirks necessary to assign these devices.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      Reviewed-by: NGerd Hoffmann <kraxel@redhat.com>
      Tested-by: NGerd Hoffmann <kraxel@redhat.com>
      c4c45e94
    • A
      vfio: Create device specific region info helper · e61a424f
      Alex Williamson 提交于
      Given a device specific region type and sub-type, find it.  Also
      cleanup return point on error in vfio_get_region_info() so that we
      always return 0 with a valid pointer or -errno and NULL.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      Reviewed-by: NGerd Hoffmann <kraxel@redhat.com>
      Tested-by: NGerd Hoffmann <kraxel@redhat.com>
      e61a424f
  5. 26 5月, 2016 11 次提交
  6. 19 5月, 2016 1 次提交
  7. 17 5月, 2016 1 次提交
    • H
      hw/intc/arm_gic: add tracepoints · 2531088f
      Hollis Blanchard 提交于
      These are obviously critical to understanding interrupt delivery:
      gic_enable_irq
      gic_disable_irq
      gic_set_irq (inbound irq from device models)
      gic_update_set_irq (outbound irq to CPU)
      gic_acknowledge_irq
      
      The only one that I think might raise eyebrows is gic_update_bestirq, but I've
      (sadly) debugged problems that ended up being caused by unexpected priorities.
      Knowing that the GIC has an irq ready, but doesn't deliver to the CPU due to
      priority, has also proven important.
      Signed-off-by: NHollis Blanchard <hollis_blanchard@mentor.com>
      Message-id: 1461252281-22399-1-git-send-email-hollis_blanchard@mentor.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      2531088f
  8. 13 5月, 2016 1 次提交
    • S
      tcg: Clean up from 'next_tb' · 819af24b
      Sergey Fedorov 提交于
      The value returned from tcg_qemu_tb_exec() is the value passed to the
      corresponding tcg_gen_exit_tb() at translation time of the last TB
      attempted to execute. It is a little confusing to store it in a variable
      named 'next_tb'. In fact, it is a combination of 4-byte aligned pointer
      and additional information in its two least significant bits. Break it
      down right away into two variables named 'last_tb' and 'tb_exit' which
      are a pointer to the last TB attempted to execute and the TB exit
      reason, correspondingly. This simplifies the code and improves its
      readability.
      
      Correct a misleading documentation comment for tcg_qemu_tb_exec() and
      fix logging in cpu_tb_exec(). Also rename a misleading 'next_tb' in
      another couple of places.
      Signed-off-by: NSergey Fedorov <serge.fdrv@gmail.com>
      Signed-off-by: NSergey Fedorov <sergey.fedorov@linaro.org>
      Signed-off-by: NRichard Henderson <rth@twiddle.net>
      819af24b
  9. 12 5月, 2016 2 次提交
  10. 11 4月, 2016 1 次提交
    • G
      ui/virtio-gpu: add and use qemu_create_displaysurface_pixman · ca58b45f
      Gerd Hoffmann 提交于
      Add a the new qemu_create_displaysurface_pixman function, to create
      a DisplaySurface backed by an existing pixman image.  In that case
      there is no need to create a new pixman image pointing to the same
      backing storage.  We can just use the existing image directly.
      
      This does not only simplify things a bit, but most importantly it
      gets the reference counting right, so the backing storage for the
      pixman image wouldn't be released underneath us.
      
      Use new function in virtio-gpu, where using it actually fixes
      use-after-free crashes.
      
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      Message-id: 1459499240-742-1-git-send-email-kraxel@redhat.com
      ca58b45f
  11. 31 3月, 2016 1 次提交
  12. 17 3月, 2016 2 次提交
  13. 14 3月, 2016 2 次提交
  14. 11 3月, 2016 1 次提交
    • A
      vfio: Generalize region support · db0da029
      Alex Williamson 提交于
      Both platform and PCI vfio drivers create a "slow", I/O memory region
      with one or more mmap memory regions overlayed when supported by the
      device. Generalize this to a set of common helpers in the core that
      pulls the region info from vfio, fills the region data, configures
      slow mapping, and adds helpers for comleting the mmap, enable/disable,
      and teardown.  This can be immediately used by the PCI MSI-X code,
      which needs to mmap around the MSI-X vector table.
      
      This also changes VFIORegion.mem to be dynamically allocated because
      otherwise we don't know how the caller has allocated VFIORegion and
      therefore don't know whether to unreference it to destroy the
      MemoryRegion or not.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      db0da029
  15. 01 3月, 2016 4 次提交
  16. 28 2月, 2016 1 次提交
    • G
      xics: report errors with the QEMU Error API · a005b3ef
      Greg Kurz 提交于
      Using the return value to report errors is error prone:
      - xics_alloc() returns -1 on error but spapr_vio_busdev_realize() errors
        on 0
      - xics_alloc_block() returns the unclear value of ics->offset - 1 on error
        but both rtas_ibm_change_msi() and spapr_phb_realize() error on 0
      
      This patch adds an errp argument to xics_alloc() and xics_alloc_block() to
      report errors. The return value of these functions is a valid IRQ number
      if errp is NULL. It is undefined otherwise.
      
      The corresponding error traces get promotted to error messages. Note that
      the "can't allocate IRQ" error message in spapr_vio_busdev_realize() also
      moves to xics_alloc(). Similar error message consolidation isn't really
      applicable to xics_alloc_block() because callers have extra context (device
      config address, MSI or MSIX).
      
      This fixes the issues mentioned above.
      
      Based on previous work from Brian W. Hart.
      Signed-off-by: NGreg Kurz <gkurz@linux.vnet.ibm.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      a005b3ef
  17. 25 2月, 2016 1 次提交
  18. 09 2月, 2016 1 次提交
    • P
      hw: Add support for LSI SAS1068 (mptsas) device · e351b826
      Paolo Bonzini 提交于
      This adds the SAS1068 device, a SAS disk controller used in VMware that
      is oldish but widely supported and has decent performance.  Unlike
      megasas, it presents itself as a SAS controller and not as a RAID
      controller.  The device corresponds to the mptsas kernel driver in
      Linux.
      
      A few small things in the device setup are based on Don Slutz's old
      patch, but the device emulation was written from scratch based on Don's
      SeaBIOS patch and on the FreeBSD and Linux drivers.  It is 2400 lines
      shorter than Don's patch (and roughly the same size as MegaSAS---also
      because it doesn't support the similar SPI controller), implements SCSI
      task management functions (with asynchronous cancellation), supports
      big-endian hosts, has complete support for migration and follows the
      QEMU coding standards much more closely.
      
      To write the driver, I first split Don's patch in two parts, with
      the configuration bits in one file and the rest in a separate file.
      I first left mptconfig.c in place and rewrote the rest, then deleted
      mptconfig.c as well.  The configuration pages are still based mostly on
      VirtualBox's, though not exactly the same.  However, the implementation
      is completely different.  The contents of the pages themselves should
      not be copyrightable.
      Signed-off-by: NDon Slutz <Don@CloudSwitch.com>
      Message-Id: <1347382813-5662-1-git-send-email-Don@CloudSwitch.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      e351b826
  19. 20 1月, 2016 1 次提交
    • A
      vfio/pci: Lazy PBA emulation · 95239e16
      Alex Williamson 提交于
      The PCI spec recommends devices use additional alignment for MSI-X
      data structures to allow software to map them to separate processor
      pages.  One advantage of doing this is that we can emulate those data
      structures without a significant performance impact to the operation
      of the device.  Some devices fail to implement that suggestion and
      assigned device performance suffers.
      
      One such case of this is a Mellanox MT27500 series, ConnectX-3 VF,
      where the MSI-X vector table and PBA are aligned on separate 4K
      pages.  If PBA emulation is enabled, performance suffers.  It's not
      clear how much value we get from PBA emulation, but the solution here
      is to only lazily enable the emulated PBA when a masked MSI-X vector
      fires.  We then attempt to more aggresively disable the PBA memory
      region any time a vector is unmasked.  The expectation is then that
      a typical VM will run entirely with PBA emulation disabled, and only
      when used is that emulation re-enabled.
      Reported-by: NShyam Kaushik <shyam.kaushik@gmail.com>
      Tested-by: NShyam Kaushik <shyam.kaushik@gmail.com>
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      95239e16
  20. 07 1月, 2016 1 次提交