[GIT PULL] VFIO updates for v4.10-rc1

From: Alex Williamson
Date: Fri Dec 09 2016 - 17:24:39 EST


Hi Linus,

The following changes since commit a25f0944ba9b1d8a6813fd6f1a86f1bd59ac25a6:

Linux 4.9-rc5 (2016-11-13 10:32:32 -0800)

are available in the git repository at:

git://github.com/awilliam/linux-vfio.git tags/vfio-v4.10-rc1

for you to fetch changes up to 2b8bb1d771f736b8b34bf160115aee1b12d29f83:

vfio iommu type1: Fix size argument to vfio_find_dma() in pin_pages/unpin_pages (2016-12-06 12:35:53 -0700)

----------------------------------------------------------------
VFIO updates for v4.10-rc1

- VFIO updates for v4.10 primarily include a new Mediated Device
interface, which essentially allows software defined devices to be
exposed to users through VFIO. The host vendor driver providing
this virtual device polices, or mediates user access to the device.
These devices often incorporate portions of real devices, for
instance the primary initial users of this interface expose vGPUs
which allow the user to map mediated devices, or mdevs, to a
portion of a physical GPU. QEMU composes these mdevs into PCI
representations using the existing VFIO user API. This enables
both Intel KVM-GT support, which is also expected to arrive into
Linux mainline during the v4.10 merge window, as well as NVIDIA
vGPU, and also Channel I/O devices (aka CCW devices) for s390
virtualization support. (Kirti Wankhede, Neo Jia)

- Drop unnecessary uses of pcibios_err_to_errno() (Cao Jin)

- Fixes to VFIO capability chain handling (Eric Auger)

- Error handling fixes for fallout from mdev (Christophe JAILLET)

- Notifiers to expose struct kvm to mdev vendor drivers (Jike Song)

- type1 IOMMU model search fixes (Kirti Wankhede, Neo Jia)

----------------------------------------------------------------
Cao jin (1):
vfio/pci: Drop unnecessary pcibios_err_to_errno()

Christophe JAILLET (1):
vfio: Fix handling of error returned by 'vfio_group_get_from_dev()'

Eric Auger (1):
vfio: fix vfio_info_cap_add/shift

Jike Song (3):
vfio: vfio_register_notifier: classify iommu notifier
vfio: support notifier chain in vfio_group
kvm: set/clear kvm to/from vfio_group when group add/delete

Kirti Wankhede (24):
vfio: Mediated device Core driver
vfio: VFIO based driver for Mediated devices
vfio: Rearrange functions to get vfio_group from dev
vfio: Common function to increment container_users
vfio iommu: Added pin and unpin callback functions to vfio_iommu_driver_ops
vfio iommu type1: Update arguments of vfio_lock_acct
vfio iommu type1: Update argument of vaddr_get_pfn()
vfio iommu type1: Add find_iommu_group() function
vfio iommu type1: Add task structure to vfio_dma
vfio iommu type1: Add support for mediated devices
vfio iommu: Add blocking notifier to notify DMA_UNMAP
vfio: Introduce common function to add capabilities
vfio_pci: Update vfio_pci to use vfio_info_add_capability()
vfio: Introduce vfio_set_irqs_validate_and_prepare()
vfio_pci: Updated to use vfio_set_irqs_validate_and_prepare()
vfio_platform: Updated to use vfio_set_irqs_validate_and_prepare()
vfio: Define device_api strings
docs: Add Documentation for Mediated devices
docs: Sysfs ABI for mediated device framework
docs: Sample driver to demonstrate how to use Mediated device framework.
MAINTAINERS: Add entry VFIO based Mediated device drivers
vfio iommu type1: WARN_ON if notifier block is not unregistered
vfio iommu type1: Fix size argument to vfio_find_dma() during DMA UNMAP.
vfio iommu type1: Fix size argument to vfio_find_dma() in pin_pages/unpin_pages

Documentation/ABI/testing/sysfs-bus-vfio-mdev | 111 ++
Documentation/vfio-mediated-device.txt | 398 +++++++
MAINTAINERS | 9 +
drivers/vfio/Kconfig | 1 +
drivers/vfio/Makefile | 1 +
drivers/vfio/mdev/Kconfig | 17 +
drivers/vfio/mdev/Makefile | 5 +
drivers/vfio/mdev/mdev_core.c | 385 +++++++
drivers/vfio/mdev/mdev_driver.c | 119 ++
drivers/vfio/mdev/mdev_private.h | 41 +
drivers/vfio/mdev/mdev_sysfs.c | 286 +++++
drivers/vfio/mdev/vfio_mdev.c | 148 +++
drivers/vfio/pci/vfio_pci.c | 83 +-
drivers/vfio/pci/vfio_pci_config.c | 10 +-
drivers/vfio/platform/vfio_platform_common.c | 31 +-
drivers/vfio/vfio.c | 461 +++++++-
drivers/vfio/vfio_iommu_type1.c | 885 ++++++++++++---
include/linux/mdev.h | 168 +++
include/linux/vfio.h | 48 +-
include/uapi/linux/vfio.h | 10 +
samples/vfio-mdev/Makefile | 13 +
samples/vfio-mdev/mtty.c | 1503 +++++++++++++++++++++++++
virt/kvm/vfio.c | 18 +
23 files changed, 4486 insertions(+), 265 deletions(-)
create mode 100644 Documentation/ABI/testing/sysfs-bus-vfio-mdev
create mode 100644 Documentation/vfio-mediated-device.txt
create mode 100644 drivers/vfio/mdev/Kconfig
create mode 100644 drivers/vfio/mdev/Makefile
create mode 100644 drivers/vfio/mdev/mdev_core.c
create mode 100644 drivers/vfio/mdev/mdev_driver.c
create mode 100644 drivers/vfio/mdev/mdev_private.h
create mode 100644 drivers/vfio/mdev/mdev_sysfs.c
create mode 100644 drivers/vfio/mdev/vfio_mdev.c
create mode 100644 include/linux/mdev.h
create mode 100644 samples/vfio-mdev/Makefile
create mode 100644 samples/vfio-mdev/mtty.c

---
Merge note: Stephen Rothwell has identified an API change conflict in
linux-next for get_user_pages_remote(). Depending on the ordering of
merges versus akpm's branches, a fixup may be necessary as Stephen has
provided in linux-next 20161209 as:

commit 53fa4eed56cb11d8cea7e15a299cd1054ddc0425
Author: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>
Date: Wed Dec 7 11:02:15 2016 +1100

vfio iommu type1: merge fix for get_user_pages_remote API change

Link: http://lkml.kernel.org/r/20161122210511.024ec341@xxxxxxxxxxxxxxxx
Signed-off-by: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>
Cc: Lorenzo Stoakes <lstoakes@xxxxxxxxx>
Cc: Michal Hocko <mhocko@xxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>

diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c
index 9815e45..f3726ba 100644
--- a/drivers/vfio/vfio_iommu_type1.c
+++ b/drivers/vfio/vfio_iommu_type1.c
@@ -362,7 +362,7 @@ static int vaddr_get_pfn(struct mm_struct *mm, unsigned long vaddr,

down_read(&mm->mmap_sem);
ret = get_user_pages_remote(NULL, mm, vaddr, 1, flags, page,
- NULL);
+ NULL, NULL);
up_read(&mm->mmap_sem);
}


I'm not sure how these are typically handled, but I'm hoping to queue
these changes towards the front of the merge window to allow Intel to
get in their dependent changes. No merge issues vs current mainline as
of v4.9-rc8+ (a37102dcd7ec). Thanks,

Alex