Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965418AbcJQVlG (ORCPT ); Mon, 17 Oct 2016 17:41:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38332 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965311AbcJQVlG (ORCPT ); Mon, 17 Oct 2016 17:41:06 -0400 Date: Mon, 17 Oct 2016 15:41:04 -0600 From: Alex Williamson To: Kirti Wankhede Cc: , , , , , , , , Subject: Re: [PATCH v9 00/12] Add Mediated device support Message-ID: <20161017154104.673b510a@t450s.home> In-Reply-To: <1476739332-4911-1-git-send-email-kwankhede@nvidia.com> References: <1476739332-4911-1-git-send-email-kwankhede@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 17 Oct 2016 21:41:05 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4768 Lines: 98 On Tue, 18 Oct 2016 02:52:00 +0530 Kirti Wankhede wrote: > 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. Hi, I also commented that there must be an invalidation mechanism for pages pinned by the vendor driver. This is where pfn pinning was adjusting accounting after a DMA_MAP, where the pfn should have been invalidated on user unmap. Userspace is in control of page mappings, the vendor driver cannot maintain references to pages unmapped by the user. I would suggest that minimally some sort of callback needs to be registered for every set of pinned pages to be called when the user unmaps those IOVAs. Thanks, Alex > > 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 >