02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

17 Nov, 2016

1 commit

  • Design for Mediated Device Driver:
    Main purpose of this driver is to provide a common interface for mediated
    device management that can be used by different drivers of different
    devices.

    This module provides a generic interface to create the device, add it to
    mediated bus, add device to IOMMU group and then add it to vfio group.

    Below is the high Level block diagram, with Nvidia, Intel and IBM devices
    as example, since these are the devices which are going to actively use
    this module as of now.

    +---------------+
    | |
    | +-----------+ | mdev_register_driver() +--------------+
    | | | ++ | VFIO user
    | | driver | | probe()/remove() | vfio_mdev.ko | APIs
    | | | | | |
    | +-----------+ | +--------------+
    | |
    | MDEV CORE |
    | MODULE |
    | mdev.ko |
    | +-----------+ | mdev_register_device() +--------------+
    | | | + physical
    | | | +------------------------>+ | device
    | | | | callback +--------------+
    | | Physical | |
    | | device | | mdev_register_device() +--------------+
    | | interface | | physical
    | | | +------------------------>+ | device
    | | | | callback +--------------+
    | | | |
    | | | | mdev_register_device() +--------------+
    | | | + physical
    | | | +------------------------>+ | device
    | | | | callback +--------------+
    | +-----------+ |
    +---------------+

    Core driver provides two types of registration interfaces:
    1. Registration interface for mediated bus driver:

    /**
    * struct mdev_driver - Mediated device's driver
    * @name: driver name
    * @probe: called when new device created
    * @remove:called when device removed
    * @driver:device driver structure
    *
    **/
    struct mdev_driver {
    const char *name;
    int (*probe) (struct device *dev);
    void (*remove) (struct device *dev);
    struct device_driver driver;
    };

    Mediated bus driver for mdev device should use this interface to register
    and unregister with core driver respectively:

    int mdev_register_driver(struct mdev_driver *drv, struct module *owner);
    void mdev_unregister_driver(struct mdev_driver *drv);

    Mediated bus driver is responsible to add/delete mediated devices to/from
    VFIO group when devices are bound and unbound to the driver.

    2. Physical device driver interface
    This interface provides vendor driver the set APIs to manage physical
    device related work in its driver. APIs are :

    * dev_attr_groups: attributes of the parent device.
    * mdev_attr_groups: attributes of the mediated device.
    * supported_type_groups: attributes to define supported type. This is
    mandatory field.
    * create: to allocate basic resources in vendor driver for a mediated
    device. This is mandatory to be provided by vendor driver.
    * remove: to free resources in vendor driver when mediated device is
    destroyed. This is mandatory to be provided by vendor driver.
    * open: open callback of mediated device
    * release: release callback of mediated device
    * read : read emulation callback.
    * write: write emulation callback.
    * ioctl: ioctl callback.
    * mmap: mmap emulation callback.

    Drivers should use these interfaces to register and unregister device to
    mdev core driver respectively:

    extern int mdev_register_device(struct device *dev,
    const struct parent_ops *ops);
    extern void mdev_unregister_device(struct device *dev);

    There are no locks to serialize above callbacks in mdev driver and
    vfio_mdev driver. If required, vendor driver can have locks to serialize
    above APIs in their driver.

    Signed-off-by: Kirti Wankhede
    Signed-off-by: Neo Jia
    Reviewed-by: Jike Song
    Reviewed-by: Dong Jia Shi
    Signed-off-by: Alex Williamson

    Kirti Wankhede
     

17 Mar, 2015

3 commits

  • An unintended consequence of commit 42ac9bd18d4f ("vfio: initialize
    the virqfd workqueue in VFIO generic code") is that the vfio module
    is renamed to vfio_core so that it can include both vfio and virqfd.
    That's a user visible change that may break module loading scritps
    and it imposes eventfd support as a dependency on the core vfio code,
    which it's really not. virqfd is intended to be provided as a service
    to vfio bus drivers, so instead of wrapping it into vfio.ko, we can
    make it a stand-alone module toggled by vfio bus drivers. This has
    the additional benefit of removing initialization and exit from the
    core vfio code.

    Signed-off-by: Alex Williamson

    Alex Williamson
     
  • Now we have finally completely decoupled virqfd from VFIO_PCI. We can
    initialize it from the VFIO generic code, in order to safely use it from
    multiple independent VFIO bus drivers.

    Signed-off-by: Antonios Motakis
    Signed-off-by: Baptiste Reynal
    Reviewed-by: Eric Auger
    Tested-by: Eric Auger
    Signed-off-by: Alex Williamson

    Antonios Motakis
     
  • Enable building the VFIO PLATFORM driver that allows to use Linux platform
    devices with VFIO.

    Signed-off-by: Antonios Motakis
    Signed-off-by: Baptiste Reynal
    Reviewed-by: Eric Auger
    Tested-by: Eric Auger
    Signed-off-by: Alex Williamson

    Antonios Motakis
     

09 Aug, 2014

1 commit

  • The VFIO related components could be built as dynamic modules.
    Unfortunately, CONFIG_EEH can't be configured to "m". The patch
    fixes the build errors when configuring VFIO related components
    as dynamic modules as follows:

    CC [M] drivers/vfio/vfio_iommu_spapr_tce.o
    In file included from drivers/vfio/vfio.c:33:0:
    include/linux/vfio.h:101:43: warning: ‘struct pci_dev’ declared \
    inside parameter list [enabled by default]
    :
    WRAP arch/powerpc/boot/zImage.pseries
    WRAP arch/powerpc/boot/zImage.maple
    WRAP arch/powerpc/boot/zImage.pmac
    WRAP arch/powerpc/boot/zImage.epapr
    MODPOST 1818 modules
    ERROR: ".vfio_spapr_iommu_eeh_ioctl" [drivers/vfio/vfio_iommu_spapr_tce.ko]\
    undefined!
    ERROR: ".vfio_spapr_pci_eeh_open" [drivers/vfio/pci/vfio-pci.ko] undefined!
    ERROR: ".vfio_spapr_pci_eeh_release" [drivers/vfio/pci/vfio-pci.ko] undefined!

    Reported-by: Alexey Kardashevskiy
    Signed-off-by: Gavin Shan
    Signed-off-by: Alexey Kardashevskiy
    Signed-off-by: Alex Williamson

    Gavin Shan
     

05 Aug, 2014

1 commit

  • The patch adds new IOCTL commands for sPAPR VFIO container device
    to support EEH functionality for PCI devices, which have been passed
    through from host to somebody else via VFIO.

    Signed-off-by: Gavin Shan
    Acked-by: Alexander Graf
    Acked-by: Alex Williamson
    Signed-off-by: Benjamin Herrenschmidt

    Gavin Shan
     

20 Jun, 2013

1 commit

  • VFIO implements platform independent stuff such as
    a PCI driver, BAR access (via read/write on a file descriptor
    or direct mapping when possible) and IRQ signaling.

    The platform dependent part includes IOMMU initialization
    and handling. This implements an IOMMU driver for VFIO
    which does mapping/unmapping pages for the guest IO and
    provides information about DMA window (required by a POWER
    guest).

    Cc: David Gibson
    Signed-off-by: Alexey Kardashevskiy
    Signed-off-by: Paul Mackerras
    Acked-by: Alex Williamson
    Signed-off-by: Benjamin Herrenschmidt

    Alexey Kardashevskiy
     

31 Jul, 2012

2 commits

  • This VFIO IOMMU backend is designed primarily for AMD-Vi and Intel
    VT-d hardware, but is potentially usable by anything supporting
    similar mapping functionality. We arbitrarily call this a Type1
    backend for lack of a better name. This backend has no IOVA
    or host memory mapping restrictions for the user and is optimized
    for relatively static mappings. Mapped areas are pinned into system
    memory.

    Signed-off-by: Alex Williamson

    Alex Williamson
     
  • VFIO is a secure user level driver for use with both virtual machines
    and user level drivers. VFIO makes use of IOMMU groups to ensure the
    isolation of devices in use, allowing unprivileged user access. It's
    intended that VFIO will replace KVM device assignment and UIO drivers
    (in cases where the target platform includes a sufficiently capable
    IOMMU).

    New in this version of VFIO is support for IOMMU groups managed
    through the IOMMU core as well as a rework of the API, removing the
    group merge interface. We now go back to a model more similar to
    original VFIO with UIOMMU support where the file descriptor obtained
    from /dev/vfio/vfio allows access to the IOMMU, but only after a
    group is added, avoiding the previous privilege issues with this type
    of model. IOMMU support is also now fully modular as IOMMUs have
    vastly different interface requirements on different platforms. VFIO
    users are able to query and initialize the IOMMU model of their
    choice.

    Please see the follow-on Documentation commit for further description
    and usage example.

    Signed-off-by: Alex Williamson

    Alex Williamson