1. 21 Dec, 2015 1 commit
    • Alex Williamson's avatar
      vfio: Include No-IOMMU mode · 03a76b60
      Alex Williamson authored
      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...
      03a76b60
  2. 04 Dec, 2015 1 commit
  3. 04 Nov, 2015 1 commit
    • Alex Williamson's avatar
      vfio: Include No-IOMMU mode · 033291ec
      Alex Williamson authored
      
      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: default avatarAlex Williamson <alex.williamson@redhat.com>
      Acked-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      033291ec
  4. 01 Oct, 2015 1 commit
  5. 29 May, 2015 1 commit
  6. 17 Mar, 2015 1 commit
    • Alex Williamson's avatar
      vfio: Split virqfd into a separate module for vfio bus drivers · 71be3423
      Alex Williamson authored
      An unintended consequence of commit 42ac9bd1
      
       ("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: default avatarAlex Williamson <alex.williamson@redhat.com>
      71be3423
  7. 16 Mar, 2015 1 commit
  8. 14 Nov, 2014 1 commit
  9. 07 Nov, 2014 1 commit
  10. 08 Aug, 2014 1 commit
    • Gavin Shan's avatar
      drivers/vfio: Fix EEH build error · 92d18a68
      Gavin Shan authored
      
      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: default avatarAlexey Kardashevskiy <aik@ozlabs.ru>
      Signed-off-by: default avatarGavin Shan <gwshan@linux.vnet.ibm.com>
      Signed-off-by: default avatarAlexey Kardashevskiy <aik@ozlabs.ru>
      Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
      92d18a68
  11. 27 Mar, 2014 1 commit
  12. 20 Jun, 2013 2 commits
  13. 31 Jul, 2012 3 commits
    • Alex Williamson's avatar
      vfio: Add PCI device driver · 89e1f7d4
      Alex Williamson authored
      
      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: default avatarAlex Williamson <alex.williamson@redhat.com>
      89e1f7d4
    • Alex Williamson's avatar
      vfio: Type1 IOMMU implementation · 73fa0d10
      Alex Williamson authored
      
      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: default avatarAlex Williamson <alex.williamson@redhat.com>
      73fa0d10
    • Alex Williamson's avatar
      vfio: VFIO core · cba3345c
      Alex Williamson authored
      
      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: default avatarAlex Williamson <alex.williamson@redhat.com>
      cba3345c