22 Dec, 2015

1 commit

  • There is really no way to safely give a user full access to a DMA
    capable device without an IOMMU to protect the host system. There is
    also no way to provide DMA translation, for use cases such as device
    assignment to virtual machines. However, there are still those users
    that want userspace drivers even under those conditions. The UIO
    driver exists for this use case, but does not provide the degree of
    device access and programming that VFIO has. In an effort to avoid
    code duplication, this introduces a No-IOMMU mode for VFIO.

    This mode requires building VFIO with CONFIG_VFIO_NOIOMMU and enabling
    the "enable_unsafe_noiommu_mode" option on the vfio driver. This
    should make it very clear that this mode is not safe. Additionally,
    CAP_SYS_RAWIO privileges are necessary to work with groups and
    containers using this mode. Groups making use of this support are
    named /dev/vfio/noiommu-$GROUP and can only make use of the special
    VFIO_NOIOMMU_IOMMU for the container. Use of this mode, specifically
    binding a device without a native IOMMU group to a VFIO bus driver
    will taint the kernel and should therefore not be considered
    supported. This patch includes no-iommu support for the vfio-pci bus
    driver only.

    Signed-off-by: Alex Williamson
    Acked-by: Michael S. Tsirkin

    Alex Williamson
     

04 Dec, 2015

1 commit

  • Revert commit 033291eccbdb ("vfio: Include No-IOMMU mode") due to lack
    of a user. This was originally intended to fill a need for the DPDK
    driver, but uptake has been slow so rather than support an unproven
    kernel interface revert it and revisit when userspace catches up.

    Signed-off-by: Alex Williamson

    Alex Williamson
     

14 Nov, 2015

1 commit

  • Pull VFIO updates from Alex Williamson:
    - Use kernel interfaces for VPD emulation (Alex Williamson)
    - Platform fix for releasing IRQs (Eric Auger)
    - Type1 IOMMU always advertises PAGE_SIZE support when smaller mapping
    sizes are available (Eric Auger)
    - Platform fixes for incorrectly using copies of structures rather than
    pointers to structures (James Morse)
    - Rework platform reset modules, fix leak, and add AMD xgbe reset
    module (Eric Auger)
    - Fix vfio_device_get_from_name() return value (Joerg Roedel)
    - No-IOMMU interface (Alex Williamson)
    - Fix potential out of bounds array access in PCI config handling (Dan
    Carpenter)

    * tag 'vfio-v4.4-rc1' of git://github.com/awilliam/linux-vfio:
    vfio/pci: make an array larger
    vfio: Include No-IOMMU mode
    vfio: Fix bug in vfio_device_get_from_name()
    VFIO: platform: reset: AMD xgbe reset module
    vfio: platform: reset: calxedaxgmac: fix ioaddr leak
    vfio: platform: add dev_info on device reset
    vfio: platform: use list of registered reset function
    vfio: platform: add compat in vfio_platform_device
    vfio: platform: reset: calxedaxgmac: add reset function registration
    vfio: platform: introduce module_vfio_reset_handler macro
    vfio: platform: add capability to register a reset function
    vfio: platform: introduce vfio-platform-base module
    vfio/platform: store mapped memory in region, instead of an on-stack copy
    vfio/type1: handle case where IOMMU does not support PAGE_SIZE size
    VFIO: platform: clear IRQ_NOAUTOEN when de-assigning the IRQ
    vfio/pci: Use kernel VPD access functions
    vfio: Whitelist PCI bridges

    Linus Torvalds
     

05 Nov, 2015

1 commit

  • There is really no way to safely give a user full access to a DMA
    capable device without an IOMMU to protect the host system. There is
    also no way to provide DMA translation, for use cases such as device
    assignment to virtual machines. However, there are still those users
    that want userspace drivers even under those conditions. The UIO
    driver exists for this use case, but does not provide the degree of
    device access and programming that VFIO has. In an effort to avoid
    code duplication, this introduces a No-IOMMU mode for VFIO.

    This mode requires building VFIO with CONFIG_VFIO_NOIOMMU and enabling
    the "enable_unsafe_noiommu_mode" option on the vfio driver. This
    should make it very clear that this mode is not safe. Additionally,
    CAP_SYS_RAWIO privileges are necessary to work with groups and
    containers using this mode. Groups making use of this support are
    named /dev/vfio/noiommu-$GROUP and can only make use of the special
    VFIO_NOIOMMU_IOMMU for the container. Use of this mode, specifically
    binding a device without a native IOMMU group to a VFIO bus driver
    will taint the kernel and should therefore not be considered
    supported. This patch includes no-iommu support for the vfio-pci bus
    driver only.

    Signed-off-by: Alex Williamson
    Acked-by: Michael S. Tsirkin

    Alex Williamson
     

01 Oct, 2015

1 commit


29 May, 2015

1 commit


17 Mar, 2015

2 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
     
  • 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
     

15 Nov, 2014

1 commit


08 Nov, 2014

1 commit


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
     

28 Mar, 2014

1 commit


20 Jun, 2013

2 commits

  • The enables VFIO on the pSeries platform, enabling user space
    programs to access PCI devices directly.

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

    Alexey Kardashevskiy
     
  • 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

3 commits

  • Add PCI device support for VFIO. PCI devices expose regions
    for accessing config space, I/O port space, and MMIO areas
    of the device. PCI config access is virtualized in the kernel,
    allowing us to ensure the integrity of the system, by preventing
    various accesses while reducing duplicate support across various
    userspace drivers. I/O port supports read/write access while
    MMIO also supports mmap of sufficiently sized regions. Support
    for INTx, MSI, and MSI-X interrupts are provided using eventfds to
    userspace.

    Signed-off-by: Alex Williamson

    Alex Williamson
     
  • 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