1. 01 6月, 2018 5 次提交
  2. 25 5月, 2018 15 次提交
  3. 24 5月, 2018 11 次提交
    • P
      Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging · 45eabb2e
      Peter Maydell 提交于
      pc, pci, virtio, vhost: fixes, features
      
      Beginning of merging vDPA, new PCI ID, a new virtio balloon stat, intel
      iommu rework fixing a couple of security problems (no CVEs yet), fixes
      all over the place.
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      
      # gpg: Signature made Wed 23 May 2018 15:41:32 BST
      # gpg:                using RSA key 281F0DB8D28D5469
      # gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>"
      # gpg:                 aka "Michael S. Tsirkin <mst@redhat.com>"
      # Primary key fingerprint: 0270 606B 6F3C DF3D 0B17  0970 C350 3912 AFBE 8E67
      #      Subkey fingerprint: 5D09 FD08 71C8 F85B 94CA  8A0D 281F 0DB8 D28D 5469
      
      * remotes/mst/tags/for_upstream: (28 commits)
        intel-iommu: rework the page walk logic
        util: implement simple iova tree
        intel-iommu: trace domain id during page walk
        intel-iommu: pass in address space when page walk
        intel-iommu: introduce vtd_page_walk_info
        intel-iommu: only do page walk for MAP notifiers
        intel-iommu: add iommu lock
        intel-iommu: remove IntelIOMMUNotifierNode
        intel-iommu: send PSI always even if across PDEs
        nvdimm: fix typo in label-size definition
        contrib/vhost-user-blk: enable protocol feature for vhost-user-blk
        hw/virtio: Fix brace Werror with clang 6.0.0
        libvhost-user: Send messages with no data
        vhost-user+postcopy: Use qemu_set_nonblock
        virtio: support setting memory region based host notifier
        vhost-user: support receiving file descriptors in slave_read
        vhost-user: add Net prefix to internal state structure
        linux-headers: add kvm header for mips
        linux-headers: add unistd.h on all arches
        update-linux-headers.sh: unistd.h, kvm consistency
        ...
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      45eabb2e
    • P
      Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging · 37cbe4da
      Peter Maydell 提交于
      Block layer patches:
      
      - Generic background jobs
      - qemu-iotests fixes for NFS and the 'migration' group
      - sheepdog: Minor code simplification
      
      # gpg: Signature made Wed 23 May 2018 13:33:49 BST
      # gpg:                using RSA key 7F09B272C88F2FD6
      # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>"
      # Primary key fingerprint: DC3D EB15 9A9A F95D 3D74  56FE 7F09 B272 C88F 2FD6
      
      * remotes/kevin/tags/for-upstream: (46 commits)
        qemu-iotests: Test job-* with block jobs
        iotests: Move qmp_to_opts() to VM
        blockjob: Remove BlockJob.driver
        job: Add query-jobs QMP command
        job: Add lifecycle QMP commands
        job: Add JOB_STATUS_CHANGE QMP event
        job: Introduce qapi/job.json
        job: Move progress fields to Job
        job: Add job_transition_to_ready()
        job: Add job_is_ready()
        job: Add job_dismiss()
        job: Add job_yield()
        block: Cancel job in bdrv_close_all() callers
        job: Move completion and cancellation to Job
        job: Move transactions to Job
        job: Switch transactions to JobTxn
        job: Move job_finish_sync() to Job
        job: Move .complete callback to Job
        job: Add job_drain()
        job: Convert block_job_cancel_async() to Job
        ...
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      37cbe4da
    • P
      Merge remote-tracking branch 'remotes/sstabellini-http/tags/xen-20180522-tag' into staging · 5ff2a4b9
      Peter Maydell 提交于
      Xen 2018/05/22
      
      # gpg: Signature made Tue 22 May 2018 19:44:06 BST
      # gpg:                using RSA key 894F8F4870E1AE90
      # gpg: Good signature from "Stefano Stabellini <stefano.stabellini@eu.citrix.com>"
      # gpg:                 aka "Stefano Stabellini <sstabellini@kernel.org>"
      # Primary key fingerprint: D04E 33AB A51F 67BA 07D3  0AEA 894F 8F48 70E1 AE90
      
      * remotes/sstabellini-http/tags/xen-20180522-tag:
        xen_disk: be consistent with use of xendev and blkdev->xendev
        xen_disk: use a single entry iovec
        xen_backend: make the xen_feature_grant_copy flag private
        xen_disk: remove use of grant map/unmap
        xen_backend: add an emulation of grant copy
        xen: remove other open-coded use of libxengnttab
        xen_disk: remove open-coded use of libxengnttab
        xen_backend: add grant table helpers
        xen: add a meaningful declaration of grant_copy_segment into xen_common.h
        checkpatch: generalize xen handle matching in the list of types
        xen-hvm: create separate function for ioreq server initialization
        xen_pt: Present the size of 64 bit BARs correctly
        configure: Add explanation for --enable-xen-pci-passthrough
        xen/pt: use address_space_memory object for memory region hooks
        xen-pvdevice: Introduce a simplistic xen-pvdevice save state
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      5ff2a4b9
    • P
      Merge remote-tracking branch 'remotes/mwalle/tags/lm32-queue/20180521' into staging · 9cac60db
      Peter Maydell 提交于
      target/lm32: BQL patch
      
      # gpg: Signature made Tue 22 May 2018 19:25:30 BST
      # gpg:                using RSA key B458ABB0D8D378E3
      # gpg: Good signature from "Michael Walle <michael@walle.cc>"
      # gpg: WARNING: This key is not certified with a trusted signature!
      # gpg:          There is no indication that the signature belongs to the owner.
      # Primary key fingerprint: 2190 3E48 4537 A7C2 90CE  3EB2 B458 ABB0 D8D3 78E3
      
      * remotes/mwalle/tags/lm32-queue/20180521:
        lm32: take BQL before writing IP/IM register
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      9cac60db
    • G
      MAINTAINERS: add vga entries · dbb2e472
      Gerd Hoffmann 提交于
      Add entries for standard vga, virtio-gpu and cirrus.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Reviewed-by: NPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Message-id: 20180522165058.15404-7-kraxel@redhat.com
      dbb2e472
    • G
      bochs-display: add pcie support · f2581064
      Gerd Hoffmann 提交于
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      Message-id: 20180522165058.15404-6-kraxel@redhat.com
      f2581064
    • G
      bochs-display: add dirty tracking support · 33ebad54
      Gerd Hoffmann 提交于
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-id: 20180522165058.15404-5-kraxel@redhat.com
      33ebad54
    • G
      hw/display: add new bochs-display device · 765c9429
      Gerd Hoffmann 提交于
      After writing up the virtual mdev device emulating a display supporting
      the bochs vbe dispi interface (mbochs.ko) and seeing how simple it
      actually is I've figured that would be useful for qemu too.
      
      So, here it is, -device bochs-display.  It is basically -device VGA
      without legacy vga emulation.  PCI bar 0 is the framebuffer, PCI bar 2
      is mmio with the registers.  The vga registers are simply not there
      though, neither in the legacy ioport location nor in the mmio bar.
      Consequently it is PCI class DISPLAY_OTHER not DISPLAY_VGA.
      
      So there is no text mode emulation, no weird video modes (planar,
      256color palette), no memory window at 0xa0000.  Just a linear
      framebuffer in the pci memory bar.  And the amount of code to emulate
      this (and therefore the attack surface) is an order of magnitude smaller
      when compared to vga emulation.
      
      Compatibility wise it works with OVMF (latest git master).
      The bochs-drm.ko linux kernel module can handle it just fine too.
      So UEFI guests should not see any functional difference to VGA.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      Tested-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-id: 20180522165058.15404-4-kraxel@redhat.com
      765c9429
    • G
      vga-pci: use PCI_VGA_MMIO_SIZE · 83ff909f
      Gerd Hoffmann 提交于
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Reviewed-by: NPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Message-id: 20180522165058.15404-3-kraxel@redhat.com
      83ff909f
    • G
      vga: move bochs vbe defines to header file · a3ee49f0
      Gerd Hoffmann 提交于
      Create a new header file, move the bochs vbe dispi interface
      defines to it, so they can be used outside vga code.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      Reviewed-by: NPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-id: 20180522165058.15404-2-kraxel@redhat.com
      a3ee49f0
    • G
      vga: catch depth 0 · a89fe6c3
      Gerd Hoffmann 提交于
      depth == 0 is used to indicate 256 color modes.  Our region calculation
      goes wrong in that case.  So detect that and just take the safe code
      path we already have for the wraparound case.
      
      While being at it also catch depth == 15 (where our region size
      calculation goes wrong too).  And make the comment more verbose,
      explaining what is going on here.
      
      Without this windows guest install might trigger an assert due to trying
      to check dirty bitmap outside the snapshot region.
      
      Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1575541Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      Message-id: 20180514103117.21059-1-kraxel@redhat.com
      a89fe6c3
  4. 23 5月, 2018 9 次提交
    • P
      intel-iommu: rework the page walk logic · 63b88968
      Peter Xu 提交于
      This patch fixes a potential small window that the DMA page table might
      be incomplete or invalid when the guest sends domain/context
      invalidations to a device.  This can cause random DMA errors for
      assigned devices.
      
      This is a major change to the VT-d shadow page walking logic. It
      includes but is not limited to:
      
      - For each VTDAddressSpace, now we maintain what IOVA ranges we have
        mapped and what we have not.  With that information, now we only send
        MAP or UNMAP when necessary.  Say, we don't send MAP notifies if we
        know we have already mapped the range, meanwhile we don't send UNMAP
        notifies if we know we never mapped the range at all.
      
      - Introduce vtd_sync_shadow_page_table[_range] APIs so that we can call
        in any places to resync the shadow page table for a device.
      
      - When we receive domain/context invalidation, we should not really run
        the replay logic, instead we use the new sync shadow page table API to
        resync the whole shadow page table without unmapping the whole
        region.  After this change, we'll only do the page walk once for each
        domain invalidations (before this, it can be multiple, depending on
        number of notifiers per address space).
      
      While at it, the page walking logic is also refactored to be simpler.
      
      CC: QEMU Stable <qemu-stable@nongnu.org>
      Reported-by: NJintack Lim <jintack@cs.columbia.edu>
      Tested-by: NJintack Lim <jintack@cs.columbia.edu>
      Signed-off-by: NPeter Xu <peterx@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      63b88968
    • P
      util: implement simple iova tree · eecf5eed
      Peter Xu 提交于
      Introduce a simplest iova tree implementation based on GTree.
      
      CC: QEMU Stable <qemu-stable@nongnu.org>
      Signed-off-by: NPeter Xu <peterx@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      eecf5eed
    • P
      intel-iommu: trace domain id during page walk · d118c06e
      Peter Xu 提交于
      This patch only modifies the trace points.
      
      Previously we were tracing page walk levels.  They are redundant since
      we have page mask (size) already.  Now we trace something much more
      useful which is the domain ID of the page walking.  That can be very
      useful when we trace more than one devices on the same system, so that
      we can know which map is for which domain.
      
      CC: QEMU Stable <qemu-stable@nongnu.org>
      Signed-off-by: NPeter Xu <peterx@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      d118c06e
    • P
      intel-iommu: pass in address space when page walk · 2f764fa8
      Peter Xu 提交于
      We pass in the VTDAddressSpace too.  It'll be used in the follow up
      patches.
      
      CC: QEMU Stable <qemu-stable@nongnu.org>
      Signed-off-by: NPeter Xu <peterx@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      2f764fa8
    • P
      intel-iommu: introduce vtd_page_walk_info · fe215b0c
      Peter Xu 提交于
      During the recursive page walking of IOVA page tables, some stack
      variables are constant variables and never changed during the whole page
      walking procedure.  Isolate them into a struct so that we don't need to
      pass those contants down the stack every time and multiple times.
      
      CC: QEMU Stable <qemu-stable@nongnu.org>
      Signed-off-by: NPeter Xu <peterx@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      fe215b0c
    • P
      intel-iommu: only do page walk for MAP notifiers · 4f8a62a9
      Peter Xu 提交于
      For UNMAP-only IOMMU notifiers, we don't need to walk the page tables.
      Fasten that procedure by skipping the page table walk.  That should
      boost performance for UNMAP-only notifiers like vhost.
      
      CC: QEMU Stable <qemu-stable@nongnu.org>
      Signed-off-by: NPeter Xu <peterx@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      4f8a62a9
    • P
      intel-iommu: add iommu lock · 1d9efa73
      Peter Xu 提交于
      SECURITY IMPLICATION: this patch fixes a potential race when multiple
      threads access the IOMMU IOTLB cache.
      
      Add a per-iommu big lock to protect IOMMU status.  Currently the only
      thing to be protected is the IOTLB/context cache, since that can be
      accessed even without BQL, e.g., in IO dataplane.
      
      Note that we don't need to protect device page tables since that's fully
      controlled by the guest kernel.  However there is still possibility that
      malicious drivers will program the device to not obey the rule.  In that
      case QEMU can't really do anything useful, instead the guest itself will
      be responsible for all uncertainties.
      
      CC: QEMU Stable <qemu-stable@nongnu.org>
      Reported-by: NFam Zheng <famz@redhat.com>
      Signed-off-by: NPeter Xu <peterx@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      1d9efa73
    • P
      intel-iommu: remove IntelIOMMUNotifierNode · b4a4ba0d
      Peter Xu 提交于
      That is not really necessary.  Removing that node struct and put the
      list entry directly into VTDAddressSpace.  It simplfies the code a lot.
      Since at it, rename the old notifiers_list into vtd_as_with_notifiers.
      
      CC: QEMU Stable <qemu-stable@nongnu.org>
      Signed-off-by: NPeter Xu <peterx@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      b4a4ba0d
    • P
      intel-iommu: send PSI always even if across PDEs · 36d2d52b
      Peter Xu 提交于
      SECURITY IMPLICATION: without this patch, any guest with both assigned
      device and a vIOMMU might encounter stale IO page mappings even if guest
      has already unmapped the page, which may lead to guest memory
      corruption.  The stale mappings will only be limited to the guest's own
      memory range, so it should not affect the host memory or other guests on
      the host.
      
      During IOVA page table walking, there is a special case when the PSI
      covers one whole PDE (Page Directory Entry, which contains 512 Page
      Table Entries) or more.  In the past, we skip that entry and we don't
      notify the IOMMU notifiers.  This is not correct.  We should send UNMAP
      notification to registered UNMAP notifiers in this case.
      
      For UNMAP only notifiers, this might cause IOTLBs cached in the devices
      even if they were already invalid.  For MAP/UNMAP notifiers like
      vfio-pci, this will cause stale page mappings.
      
      This special case doesn't trigger often, but it is very easy to be
      triggered by nested device assignments, since in that case we'll
      possibly map the whole L2 guest RAM region into the device's IOVA
      address space (several GBs at least), which is far bigger than normal
      kernel driver usages of the device (tens of MBs normally).
      
      Without this patch applied to L1 QEMU, nested device assignment to L2
      guests will dump some errors like:
      
      qemu-system-x86_64: VFIO_MAP_DMA: -17
      qemu-system-x86_64: vfio_dma_map(0x557305420c30, 0xad000, 0x1000,
                          0x7f89a920d000) = -17 (File exists)
      
      CC: QEMU Stable <qemu-stable@nongnu.org>
      Acked-by: NJason Wang <jasowang@redhat.com>
      [peterx: rewrite the commit message]
      Signed-off-by: NPeter Xu <peterx@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      36d2d52b