From patchwork Fri Dec 9 22:24:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Williamson X-Patchwork-Id: 9469093 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 21E44607DA for ; Fri, 9 Dec 2016 22:24:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 12AAA28692 for ; Fri, 9 Dec 2016 22:24:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ED9772869D; Fri, 9 Dec 2016 22:24:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3EC3828697 for ; Fri, 9 Dec 2016 22:24:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752892AbcLIWYg (ORCPT ); Fri, 9 Dec 2016 17:24:36 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58850 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752345AbcLIWYe (ORCPT ); Fri, 9 Dec 2016 17:24:34 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4810B638; Fri, 9 Dec 2016 22:24:34 +0000 (UTC) Received: from t450s.home (ovpn03.gateway.prod.ext.phx2.redhat.com [10.5.9.3]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uB9MOW2q026100; Fri, 9 Dec 2016 17:24:33 -0500 Date: Fri, 9 Dec 2016 15:24:32 -0700 From: Alex Williamson To: Linus Torvalds Cc: , "kvm@vger.kernel.org" , Kirti Wankhede , Neo Jia , "Song, Jike" , Cao jin , Auger Eric , Christophe JAILLET , "Tian, Kevin" , Andrew Morton , Stephen Rothwell Subject: [GIT PULL] VFIO updates for v4.10-rc1 Message-ID: <20161209152432.7a6044d2@t450s.home> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Fri, 09 Dec 2016 22:24:34 +0000 (UTC) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 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@canb.auug.org.au Signed-off-by: Stephen Rothwell Cc: Lorenzo Stoakes Cc: Michal Hocko Signed-off-by: Andrew Morton 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 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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); }