On Tue, 18 Oct 2016 02:52:00 +0530
Kirti Wankhede <kwankh...@nvidia.com> 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 [<type-id>] 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
> 

Reply via email to