]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
vfio: Include No-IOMMU mode
authorAlex Williamson <alex.williamson@redhat.com>
Thu, 15 Oct 2015 21:08:48 +0000 (15:08 -0600)
committerAlex Williamson <alex.williamson@redhat.com>
Tue, 3 Nov 2015 19:55:26 +0000 (12:55 -0700)
commitf54e0bcf65bf7d2015e1aa1c6353e5feb71c3654
treeb1d16708997f994c9f2355d637952b717b0afb6c
parent0990822c98661bd625033f0d523b5c33566657ef
vfio: Include No-IOMMU mode

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 <alex.williamson@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
drivers/vfio/Kconfig
drivers/vfio/pci/vfio_pci.c
drivers/vfio/vfio.c
include/linux/vfio.h
include/uapi/linux/vfio.h