From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1033989AbcJQVVI (ORCPT ); Mon, 17 Oct 2016 17:21:08 -0400 Received: from hqemgate14.nvidia.com ([216.228.121.143]:15615 "EHLO hqemgate14.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1032716AbcJQVVA (ORCPT ); Mon, 17 Oct 2016 17:21:00 -0400 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Mon, 17 Oct 2016 14:20:58 -0700 From: Kirti Wankhede To: , , , CC: , , , , , , Kirti Wankhede Subject: [PATCH v9 00/12] Add Mediated device support Date: Tue, 18 Oct 2016 02:52:00 +0530 Message-ID: <1476739332-4911-1-git-send-email-kwankhede@nvidia.com> X-Mailer: git-send-email 2.7.0 X-NVConfidentiality: public MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This series adds Mediated device support to Linux host kernel. Purpose of this series is to provide a common interface for mediated device management that can be used by different devices. This series introduces Mdev core module that creates and manages mediated devices, VFIO based driver for mediated devices that are created by mdev core module and update VFIO type1 IOMMU module to support pinning & unpinning for mediated devices. What changed in v9? mdev-core: - added class named 'mdev_bus' that contains links to devices that are registered with the mdev core driver. - The [] name is created by adding the the device driver string as a prefix to the string provided by the vendor driver. - 'device_api' attribute should be provided by vendor driver and should show which device API is being created, for example, "vfio-pci" for a PCI device. - Renamed link to its type in mdev device directory to 'mdev_type' vfio: - Split commits in multple individual commits - Added function to get device_api string based on vfio_device_info.flags. vfio_iommu_type1: - Handled the case if all devices attached to the normal IOMMU API domain go away and mdev device still exist in domain. Updated page accounting for local domain. - Similarly if device is attached to normal IOMMU API domain, mappings are establised and page accounting is updated accordingly. - Tested hot-plug and hot-unplug of vGPU and GPU pass through device with Linux VM. Documentation: - Updated Documentation and sample driver, mtty.c, accordingly. Kirti Wankhede (12): vfio: Mediated device Core driver vfio: VFIO based driver for Mediated devices vfio: Rearrange functions to get vfio_group from dev vfio iommu: Add support for mediated devices 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: Add function to get device_api string from vfio_device_info.flags docs: Add Documentation for Mediated devices docs: Sample driver to demonstrate how to use Mediated device framework. Documentation/vfio-mdev/Makefile | 13 + Documentation/vfio-mdev/mtty.c | 1429 ++++++++++++++++++++++ Documentation/vfio-mdev/vfio-mediated-device.txt | 389 ++++++ drivers/vfio/Kconfig | 1 + drivers/vfio/Makefile | 1 + drivers/vfio/mdev/Kconfig | 18 + drivers/vfio/mdev/Makefile | 5 + drivers/vfio/mdev/mdev_core.c | 372 ++++++ drivers/vfio/mdev/mdev_driver.c | 128 ++ drivers/vfio/mdev/mdev_private.h | 41 + drivers/vfio/mdev/mdev_sysfs.c | 296 +++++ drivers/vfio/mdev/vfio_mdev.c | 148 +++ drivers/vfio/pci/vfio_pci.c | 101 +- drivers/vfio/platform/vfio_platform_common.c | 31 +- drivers/vfio/vfio.c | 287 ++++- drivers/vfio/vfio_iommu_type1.c | 692 +++++++++-- include/linux/mdev.h | 177 +++ include/linux/vfio.h | 23 +- 18 files changed, 3948 insertions(+), 204 deletions(-) create mode 100644 Documentation/vfio-mdev/Makefile create mode 100644 Documentation/vfio-mdev/mtty.c create mode 100644 Documentation/vfio-mdev/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 -- 2.7.0 From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55112) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwFLH-0006zy-SZ for qemu-devel@nongnu.org; Mon, 17 Oct 2016 17:21:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bwFLD-0003UJ-0i for qemu-devel@nongnu.org; Mon, 17 Oct 2016 17:21:07 -0400 Received: from hqemgate14.nvidia.com ([216.228.121.143]:15618) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bwFLC-0003S7-Oh for qemu-devel@nongnu.org; Mon, 17 Oct 2016 17:21:02 -0400 From: Kirti Wankhede Date: Tue, 18 Oct 2016 02:52:00 +0530 Message-ID: <1476739332-4911-1-git-send-email-kwankhede@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [PATCH v9 00/12] Add Mediated device support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: alex.williamson@redhat.com, pbonzini@redhat.com, kraxel@redhat.com, cjia@nvidia.com Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, kevin.tian@intel.com, jike.song@intel.com, bjsdjshi@linux.vnet.ibm.com, linux-kernel@vger.kernel.org, Kirti Wankhede This series adds Mediated device support to Linux host kernel. Purpose of this series is to provide a common interface for mediated device management that can be used by different devices. This series introduces Mdev core module that creates and manages mediated devices, VFIO based driver for mediated devices that are created by mdev core module and update VFIO type1 IOMMU module to support pinning & unpinning for mediated devices. What changed in v9? mdev-core: - added class named 'mdev_bus' that contains links to devices that are registered with the mdev core driver. - The [] name is created by adding the the device driver string as a prefix to the string provided by the vendor driver. - 'device_api' attribute should be provided by vendor driver and should show which device API is being created, for example, "vfio-pci" for a PCI device. - Renamed link to its type in mdev device directory to 'mdev_type' vfio: - Split commits in multple individual commits - Added function to get device_api string based on vfio_device_info.flags. vfio_iommu_type1: - Handled the case if all devices attached to the normal IOMMU API domain go away and mdev device still exist in domain. Updated page accounting for local domain. - Similarly if device is attached to normal IOMMU API domain, mappings are establised and page accounting is updated accordingly. - Tested hot-plug and hot-unplug of vGPU and GPU pass through device with Linux VM. Documentation: - Updated Documentation and sample driver, mtty.c, accordingly. Kirti Wankhede (12): vfio: Mediated device Core driver vfio: VFIO based driver for Mediated devices vfio: Rearrange functions to get vfio_group from dev vfio iommu: Add support for mediated devices 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: Add function to get device_api string from vfio_device_info.flags docs: Add Documentation for Mediated devices docs: Sample driver to demonstrate how to use Mediated device framework. Documentation/vfio-mdev/Makefile | 13 + Documentation/vfio-mdev/mtty.c | 1429 ++++++++++++++++++++++ Documentation/vfio-mdev/vfio-mediated-device.txt | 389 ++++++ drivers/vfio/Kconfig | 1 + drivers/vfio/Makefile | 1 + drivers/vfio/mdev/Kconfig | 18 + drivers/vfio/mdev/Makefile | 5 + drivers/vfio/mdev/mdev_core.c | 372 ++++++ drivers/vfio/mdev/mdev_driver.c | 128 ++ drivers/vfio/mdev/mdev_private.h | 41 + drivers/vfio/mdev/mdev_sysfs.c | 296 +++++ drivers/vfio/mdev/vfio_mdev.c | 148 +++ drivers/vfio/pci/vfio_pci.c | 101 +- drivers/vfio/platform/vfio_platform_common.c | 31 +- drivers/vfio/vfio.c | 287 ++++- drivers/vfio/vfio_iommu_type1.c | 692 +++++++++-- include/linux/mdev.h | 177 +++ include/linux/vfio.h | 23 +- 18 files changed, 3948 insertions(+), 204 deletions(-) create mode 100644 Documentation/vfio-mdev/Makefile create mode 100644 Documentation/vfio-mdev/mtty.c create mode 100644 Documentation/vfio-mdev/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 -- 2.7.0