[GIT PULL] VFIO updates for v6.6-rc1

From: Alex Williamson
Date: Wed Aug 30 2023 - 18:17:21 EST


Hi Linus,

The following changes since commit 6eaae198076080886b9e7d57f4ae06fa782f90ef:

Linux 6.5-rc3 (2023-07-23 15:24:10 -0700)

are available in the Git repository at:

https://github.com/awilliam/linux-vfio.git tags/vfio-v6.6-rc1

for you to fetch changes up to 642265e22ecc7fe05c49cb8e1e0000a049df9857:

vfio/pds: Send type for SUSPEND_STATUS command (2023-08-22 13:11:57 -0600)

----------------------------------------------------------------
VFIO updates for v6.6-rc1

- VFIO direct character device (cdev) interface support. This extracts
the vfio device fd from the container and group model, and is intended
to be the native uAPI for use with IOMMUFD. (Yi Liu)

- Enhancements to the PCI hot reset interface in support of cdev usage.
(Yi Liu)

- Fix a potential race between registering and unregistering vfio files
in the kvm-vfio interface and extend use of a lock to avoid extra
drop and acquires. (Dmitry Torokhov)

- A new vfio-pci variant driver for the AMD/Pensando Distributed Services
Card (PDS) Ethernet device, supporting live migration. (Brett Creeley)

- Cleanups to remove redundant owner setup in cdx and fsl bus drivers,
and simplify driver init/exit in fsl code. (Li Zetao)

- Fix uninitialized hole in data structure and pad capability structures
for alignment. (Stefan Hajnoczi)

----------------------------------------------------------------
Brett Creeley (10):
vfio: Commonize combine_ranges for use in other VFIO drivers
vfio/pds: Initial support for pds VFIO driver
pds_core: Require callers of register/unregister to pass PF drvdata
vfio/pds: register with the pds_core PF
vfio/pds: Add VFIO live migration support
vfio/pds: Add support for dirty page tracking
vfio/pds: Add support for firmware recovery
vfio/pds: Add Kconfig and documentation
pds_core: Fix function header descriptions
vfio/pds: Send type for SUSPEND_STATUS command

Dmitry Torokhov (2):
kvm/vfio: ensure kvg instance stays around in kvm_vfio_group_add()
kvm/vfio: avoid bouncing the mutex when adding and deleting groups

Li Zetao (2):
vfio/cdx: Remove redundant initialization owner in vfio_cdx_driver
vfio/fsl-mc: Use module_fsl_mc_driver macro to simplify the code

Nicolin Chen (1):
iommufd/device: Add iommufd_access_detach() API

Stefan Hajnoczi (2):
vfio/type1: fix cap_migration information leak
vfio: align capability structures

Yang Yingliang (1):
vfio/pds: fix return value in pds_vfio_get_lm_file()

Yi Liu (35):
vfio/pci: Update comment around group_fd get in vfio_pci_ioctl_pci_hot_reset()
vfio/pci: Move the existing hot reset logic to be a helper
iommufd: Reserve all negative IDs in the iommufd xarray
iommufd: Add iommufd_ctx_has_group()
iommufd: Add helper to retrieve iommufd_ctx and devid
vfio: Mark cdev usage in vfio_device
vfio: Add helper to search vfio_device in a dev_set
vfio/pci: Extend VFIO_DEVICE_GET_PCI_HOT_RESET_INFO for vfio device cdev
vfio/pci: Copy hot-reset device info to userspace in the devices loop
vfio/pci: Allow passing zero-length fd array in VFIO_DEVICE_PCI_HOT_RESET
vfio: Allocate per device file structure
vfio: Refine vfio file kAPIs for KVM
vfio: Accept vfio device file in the KVM facing kAPI
kvm/vfio: Prepare for accepting vfio device fd
kvm/vfio: Accept vfio device file from userspace
vfio: Pass struct vfio_device_file * to vfio_device_open/close()
vfio: Block device access via device fd until device is opened
vfio: Add cdev_device_open_cnt to vfio_group
vfio: Make vfio_df_open() single open for device cdev path
vfio-iommufd: Move noiommu compat validation out of vfio_iommufd_bind()
vfio-iommufd: Split bind/attach into two steps
vfio: Record devid in vfio_device_file
vfio-iommufd: Add detach_ioas support for physical VFIO devices
vfio-iommufd: Add detach_ioas support for emulated VFIO devices
vfio: Move vfio_device_group_unregister() to be the first operation in unregister
vfio: Move device_del() before waiting for the last vfio_device registration refcount
vfio: Add cdev for vfio_device
vfio: Test kvm pointer in _vfio_device_get_kvm_safe()
iommufd: Add iommufd_ctx_from_fd()
vfio: Avoid repeated user pointer cast in vfio_device_fops_unl_ioctl()
vfio: Add VFIO_DEVICE_BIND_IOMMUFD
vfio: Add VFIO_DEVICE_[AT|DE]TACH_IOMMUFD_PT
vfio: Move the IOMMU_CAP_CACHE_COHERENCY check in __vfio_register_dev()
vfio: Compile vfio_group infrastructure optionally
docs: vfio: Add vfio device cdev description

Documentation/driver-api/vfio.rst | 147 +++++-
.../device_drivers/ethernet/amd/pds_vfio_pci.rst | 79 +++
.../networking/device_drivers/ethernet/index.rst | 1 +
Documentation/virt/kvm/devices/vfio.rst | 47 +-
MAINTAINERS | 7 +
drivers/gpu/drm/i915/gvt/kvmgt.c | 1 +
drivers/iommu/iommufd/Kconfig | 4 +-
drivers/iommu/iommufd/device.c | 116 ++++-
drivers/iommu/iommufd/iommufd_private.h | 2 +
drivers/iommu/iommufd/main.c | 26 +-
drivers/iommu/iommufd/vfio_compat.c | 2 +
drivers/net/ethernet/amd/pds_core/auxbus.c | 24 +-
drivers/s390/cio/vfio_ccw_ops.c | 1 +
drivers/s390/crypto/vfio_ap_ops.c | 1 +
drivers/vfio/Kconfig | 27 +
drivers/vfio/Makefile | 3 +-
drivers/vfio/cdx/main.c | 1 -
drivers/vfio/device_cdev.c | 228 +++++++++
drivers/vfio/fsl-mc/vfio_fsl_mc.c | 15 +-
drivers/vfio/group.c | 173 ++++---
drivers/vfio/iommufd.c | 138 +++--
drivers/vfio/pci/Kconfig | 2 +
drivers/vfio/pci/Makefile | 2 +
drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 2 +
drivers/vfio/pci/mlx5/cmd.c | 48 +-
drivers/vfio/pci/mlx5/main.c | 1 +
drivers/vfio/pci/pds/Kconfig | 19 +
drivers/vfio/pci/pds/Makefile | 11 +
drivers/vfio/pci/pds/cmds.c | 510 +++++++++++++++++++
drivers/vfio/pci/pds/cmds.h | 25 +
drivers/vfio/pci/pds/dirty.c | 564 +++++++++++++++++++++
drivers/vfio/pci/pds/dirty.h | 39 ++
drivers/vfio/pci/pds/lm.c | 434 ++++++++++++++++
drivers/vfio/pci/pds/lm.h | 41 ++
drivers/vfio/pci/pds/pci_drv.c | 209 ++++++++
drivers/vfio/pci/pds/pci_drv.h | 9 +
drivers/vfio/pci/pds/vfio_dev.c | 227 +++++++++
drivers/vfio/pci/pds/vfio_dev.h | 39 ++
drivers/vfio/pci/vfio_pci.c | 1 +
drivers/vfio/pci/vfio_pci_core.c | 261 ++++++----
drivers/vfio/platform/vfio_amba.c | 1 +
drivers/vfio/platform/vfio_platform.c | 1 +
drivers/vfio/vfio.h | 218 +++++++-
drivers/vfio/vfio_iommu_type1.c | 13 +-
drivers/vfio/vfio_main.c | 307 ++++++++++-
include/linux/iommufd.h | 7 +
include/linux/pds/pds_adminq.h | 375 ++++++++++++++
include/linux/pds/pds_common.h | 9 +-
include/linux/vfio.h | 69 ++-
include/uapi/linux/kvm.h | 13 +-
include/uapi/linux/vfio.h | 144 +++++-
samples/vfio-mdev/mbochs.c | 1 +
samples/vfio-mdev/mdpy.c | 1 +
samples/vfio-mdev/mtty.c | 1 +
virt/kvm/vfio.c | 161 +++---
55 files changed, 4350 insertions(+), 458 deletions(-)
create mode 100644 Documentation/networking/device_drivers/ethernet/amd/pds_vfio_pci.rst
create mode 100644 drivers/vfio/device_cdev.c
create mode 100644 drivers/vfio/pci/pds/Kconfig
create mode 100644 drivers/vfio/pci/pds/Makefile
create mode 100644 drivers/vfio/pci/pds/cmds.c
create mode 100644 drivers/vfio/pci/pds/cmds.h
create mode 100644 drivers/vfio/pci/pds/dirty.c
create mode 100644 drivers/vfio/pci/pds/dirty.h
create mode 100644 drivers/vfio/pci/pds/lm.c
create mode 100644 drivers/vfio/pci/pds/lm.h
create mode 100644 drivers/vfio/pci/pds/pci_drv.c
create mode 100644 drivers/vfio/pci/pds/pci_drv.h
create mode 100644 drivers/vfio/pci/pds/vfio_dev.c
create mode 100644 drivers/vfio/pci/pds/vfio_dev.h