Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: qemu/qemu
base: 2ff49e96accc
Choose a base ref
...
head repository: qemu/qemu
compare: fcb237e64f9d
Choose a head ref
  • 12 commits
  • 41 files changed
  • 6 contributors

Commits on Jul 10, 2023

  1. hw/vfio/pci-quirks: Sanitize capability pointer

    Coverity reports a tained scalar when traversing the capabilities
    chain (CID 1516589).  In practice I've never seen a device with a
    chain so broken as to cause an issue, but it's also pretty easy to
    sanitize.
    
    Fixes: f6b30c1 ("hw/vfio/pci-quirks: Support alternate offset for GPUDirect Cliques")
    Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
    Reviewed-by: Cédric Le Goater <clg@redhat.com>
    Signed-off-by: Cédric Le Goater <clg@redhat.com>
    awilliam authored and legoater committed Jul 10, 2023
    Copy the full SHA
    0ddcb39 View commit details
    Browse the repository at this point in the history
  2. vfio/pci: Disable INTx in vfio_realize error path

    When vfio realize fails, INTx isn't disabled if it has been enabled.
    This may confuse host side with unhandled interrupt report.
    
    Fixes: c5478fe ("vfio/pci: Respond to KVM irqchip change notifier")
    Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
    Reviewed-by: Joao Martins <joao.m.martins@oracle.com>
    Reviewed-by: Cédric Le Goater <clg@redhat.com>
    Signed-off-by: Cédric Le Goater <clg@redhat.com>
    duanzhenzhong authored and legoater committed Jul 10, 2023
    Copy the full SHA
    adee0da View commit details
    Browse the repository at this point in the history
  3. vfio/migration: Change vIOMMU blocker from global to per device

    Contrary to multiple device blocker which needs to consider already-attached
    devices to unblock/block dynamically, the vIOMMU migration blocker is a device
    specific config. Meaning it only needs to know whether the device is bypassing
    or not the vIOMMU (via machine property, or per pxb-pcie::bypass_iommu), and
    does not need the state of currently present devices. For this reason, the
    vIOMMU global migration blocker can be consolidated into the per-device
    migration blocker, allowing us to remove some unnecessary code.
    
    This change also makes vfio_mig_active() more accurate as it doesn't check for
    global blocker.
    
    Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
    Reviewed-by: Joao Martins <joao.m.martins@oracle.com>
    Reviewed-by: Cédric Le Goater <clg@redhat.com>
    Signed-off-by: Cédric Le Goater <clg@redhat.com>
    duanzhenzhong authored and legoater committed Jul 10, 2023
    Copy the full SHA
    3c26c80 View commit details
    Browse the repository at this point in the history
  4. vfio/migration: Free resources when vfio_migration_realize fails

    When vfio_realize() succeeds, hot unplug will call vfio_exitfn()
    to free resources allocated in vfio_realize(); when vfio_realize()
    fails, vfio_exitfn() is never called and we need to free resources
    in vfio_realize().
    
    In the case that vfio_migration_realize() fails,
    e.g: with -only-migratable & enable-migration=off, we see below:
    
    (qemu) device_add vfio-pci,host=81:11.1,id=vfio1,bus=root1,enable-migration=off
    0000:81:11.1: Migration disabled
    Error: disallowing migration blocker (--only-migratable) for: 0000:81:11.1: Migration is disabled for VFIO device
    
    If we hotplug again we should see same log as above, but we see:
    (qemu) device_add vfio-pci,host=81:11.1,id=vfio1,bus=root1,enable-migration=off
    Error: vfio 0000:81:11.1: device is already attached
    
    That's because some references to VFIO device isn't released.
    For resources allocated in vfio_migration_realize(), free them by
    jumping to out_deinit path with calling a new function
    vfio_migration_deinit(). For resources allocated in vfio_realize(),
    free them by jumping to de-register path in vfio_realize().
    
    Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
    Fixes: a226510 ("vfio: Make vfio-pci device migration capable")
    Reviewed-by: Cédric Le Goater <clg@redhat.com>
    Reviewed-by: Joao Martins <joao.m.martins@oracle.com>
    Signed-off-by: Cédric Le Goater <clg@redhat.com>
    duanzhenzhong authored and legoater committed Jul 10, 2023
    Copy the full SHA
    2b43b29 View commit details
    Browse the repository at this point in the history
  5. vfio/migration: Remove print of "Migration disabled"

    Property enable_migration supports [on/off/auto].
    In ON mode, error pointer is passed to errp and logged.
    In OFF mode, we doesn't need to log "Migration disabled" as it's intentional.
    In AUTO mode, we should only ever see errors or warnings if the device
    supports migration and an error or incompatibility occurs while further
    probing or configuring it. Lack of support for migration shoundn't
    generate an error or warning.
    
    Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
    Reviewed-by: Joao Martins <joao.m.martins@oracle.com>
    Reviewed-by: Cédric Le Goater <clg@redhat.com>
    Signed-off-by: Cédric Le Goater <clg@redhat.com>
    duanzhenzhong authored and legoater committed Jul 10, 2023
    Copy the full SHA
    0520d63 View commit details
    Browse the repository at this point in the history
  6. vfio/migration: Return bool type for vfio_migration_realize()

    Make vfio_migration_realize() adhere to the convention of other realize()
    callbacks(like qdev_realize) by returning bool instead of int.
    
    Suggested-by: Cédric Le Goater <clg@redhat.com>
    Suggested-by: Joao Martins <joao.m.martins@oracle.com>
    Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
    Reviewed-by: Joao Martins <joao.m.martins@oracle.com>
    Reviewed-by: Cédric Le Goater <clg@redhat.com>
    Signed-off-by: Cédric Le Goater <clg@redhat.com>
    duanzhenzhong authored and legoater committed Jul 10, 2023
    Copy the full SHA
    d4a2af7 View commit details
    Browse the repository at this point in the history
  7. vfio: Fix null pointer dereference bug in vfio_bars_finalize()

    vfio_realize() has the following flow:
    1. vfio_bars_prepare() -- sets VFIOBAR->size.
    2. msix_early_setup().
    3. vfio_bars_register() -- allocates VFIOBAR->mr.
    
    After vfio_bars_prepare() is called msix_early_setup() can fail. If it
    does fail, vfio_bars_register() is never called and VFIOBAR->mr is not
    allocated.
    
    In this case, vfio_bars_finalize() is called as part of the error flow
    to free the bars' resources. However, vfio_bars_finalize() calls
    object_unparent() for VFIOBAR->mr after checking only VFIOBAR->size, and
    thus we get a null pointer dereference.
    
    Fix it by checking VFIOBAR->mr in vfio_bars_finalize().
    
    Fixes: 89d5202 ("vfio/pci: Allow relocating MSI-X MMIO")
    Signed-off-by: Avihai Horon <avihaih@nvidia.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Reviewed-by: Cédric Le Goater <clg@redhat.com>
    Reviewed-by: Alex Williamson <alex.williamson@redhat.com>
    Signed-off-by: Cédric Le Goater <clg@redhat.com>
    avihai1122 authored and legoater committed Jul 10, 2023
    Copy the full SHA
    8af87a3 View commit details
    Browse the repository at this point in the history
  8. linux-headers: update to v6.5-rc1

    Reviewed-by: Thomas Huth <thuth@redhat.com>
    Signed-off-by: Cédric Le Goater <clg@redhat.com>
    legoater committed Jul 10, 2023
    Copy the full SHA
    d0bf492 View commit details
    Browse the repository at this point in the history
  9. s390x/ap: Wire up the device request notifier interface

    Let's wire up the device request notifier interface to handle device unplug
    requests for AP.
    
    Signed-off-by: Tony Krowiak <akrowiak@linux.ibm.com>
    Link: https://lore.kernel.org/qemu-devel/20230530225544.280031-1-akrowiak@linux.ibm.com/
    Signed-off-by: Cédric Le Goater <clg@redhat.com>
    Tony Krowiak authored and legoater committed Jul 10, 2023
    Copy the full SHA
    1360b2a View commit details
    Browse the repository at this point in the history
  10. pcie: Add a PCIe capability version helper

    Report the PCIe capability version for a device
    
    Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
    Reviewed-by: Cédric Le Goater <clg@redhat.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Tested-by: Robin Voetter <robin@streamhpc.com>
    Signed-off-by: Cédric Le Goater <clg@redhat.com>
    awilliam authored and legoater committed Jul 10, 2023
    Copy the full SHA
    cf2916f View commit details
    Browse the repository at this point in the history
  11. vfio/pci: Enable AtomicOps completers on root ports

    Dynamically enable Atomic Ops completer support around realize/exit of
    vfio-pci devices reporting host support for these accesses and adhering
    to a minimal configuration standard.  While the Atomic Ops completer
    bits in the root port device capabilities2 register are read-only, the
    PCIe spec does allow RO bits to change to reflect hardware state.  We
    take advantage of that here around the realize and exit functions of
    the vfio-pci device.
    
    Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Reviewed-by: Robin Voetter <robin@streamhpc.com>
    Tested-by: Robin Voetter <robin@streamhpc.com>
    Signed-off-by: Cédric Le Goater <clg@redhat.com>
    awilliam authored and legoater committed Jul 10, 2023
    Copy the full SHA
    c00aac6 View commit details
    Browse the repository at this point in the history
  12. Merge tag 'pull-vfio-20230710' of https://github.com/legoater/qemu in…

    …to staging
    
    vfio queue:
    
    * Fixes in error handling paths of VFIO PCI devices
    * Improvements of reported errors for VFIO migration
    * Linux header update
    * Enablement of AtomicOps completers on root ports
    * Fix for unplug of passthrough AP devices
    
    # -----BEGIN PGP SIGNATURE-----
    #
    # iQIzBAABCAAdFiEEoPZlSPBIlev+awtgUaNDx8/77KEFAmSrug0ACgkQUaNDx8/7
    # 7KHYCRAAt6UeZi8nKPlN+cs6guOagCcAJOu13nm7XN0bFxjYf/Q2t618cpM7PLSk
    # h+4VGsMUVJ1dumcCkBmv7LAn0G6CpVR3VDi5QuGfMODRhpWfSoaypPIizRgrbarL
    # lSyaVaPIaddlDZ4AIfFA9Ebnytvm5/ecsyTr0cv7OejVKWI/jN6bC/v36AmNQKKQ
    # J5RCDpQ6fOsdqf0Dzvn7xjuHRE4DYtsWkVoslDoBQMgPWHLF8UwRu/OPD6cBQYAR
    # /fmgoOkkNDMdN3laqwAyfAUjKfOFpLuZzJ5KNFjtkBiktm66dw4Y8/lWoChVR+S6
    # PRZ3nk0HxyzB96zCytfggBX905PBD54LIuockRaYKTlTxT19C3fDjDz5tsjKNhLR
    # aFec4KiJaUJj0fa/Vw8DB/WUbCgbOXGHiWhY8vNdpVoc9AZe8xj9z4nB3hmzx1i/
    # lZhsM/s3kTNHpVGlW7vTfbToFBmt1eoglu+ILe/HeHLi8LjzCsHy+wR5c0n0/HVI
    # fLUuUS1AGQvi8+HCCUi7gwzpJkl4rPJsPx51wfXJk+q/3GQ8g9Mg9qotHNHm4N60
    # zq/I5VqqEkJzdaMjup04ZqsMAWqGrnU2f4aNPvBhgaeO9CQE/buIsA34buQRwiG4
    # wTodqm0jrkx0Z59jliZ0mFU/LxMvhMaQCEh+OdyZ9vRtfLBjF4c=
    # =U2Hc
    # -----END PGP SIGNATURE-----
    # gpg: Signature made Mon 10 Jul 2023 08:58:05 AM BST
    # gpg:                using RSA key A0F66548F04895EBFE6B0B6051A343C7CFFBECA1
    # gpg: Good signature from "Cédric Le Goater <clg@kaod.org>" [undefined]
    # 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: A0F6 6548 F048 95EB FE6B  0B60 51A3 43C7 CFFB ECA1
    
    * tag 'pull-vfio-20230710' of https://github.com/legoater/qemu:
      vfio/pci: Enable AtomicOps completers on root ports
      pcie: Add a PCIe capability version helper
      s390x/ap: Wire up the device request notifier interface
      linux-headers: update to v6.5-rc1
      vfio: Fix null pointer dereference bug in vfio_bars_finalize()
      vfio/migration: Return bool type for vfio_migration_realize()
      vfio/migration: Remove print of "Migration disabled"
      vfio/migration: Free resources when vfio_migration_realize fails
      vfio/migration: Change vIOMMU blocker from global to per device
      vfio/pci: Disable INTx in vfio_realize error path
      hw/vfio/pci-quirks: Sanitize capability pointer
    
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    rth7680 committed Jul 10, 2023
    Copy the full SHA
    fcb237e View commit details
    Browse the repository at this point in the history