Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1244228

Re: [RFC PATCH 2/2] vfio: Include no-iommu mode

From Alex Williamson <alex.williamson@redhat.com>
Newsgroups linux.kernel
Subject Re: [RFC PATCH 2/2] vfio: Include no-iommu mode
Date 2015-10-11 23:20 +0200
Message-ID <qiwc9-3ta-9@gated-at.bofh.it> (permalink)
References <qhKTU-231-15@gated-at.bofh.it> <qhKTU-231-19@gated-at.bofh.it> <qik1k-2Ay-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Sun, 2015-10-11 at 11:12 +0300, Avi Kivity wrote:
> 
> On 10/09/2015 09:41 PM, Alex Williamson wrote:
> > There is really no way to safely give a user full access to a PCI
> > without an IOMMU to protect the host from errant DMA.  There is also
> > no way to provide DMA translation, for use cases such as devices
> > assignment to virtual machines.  However, there are still those users
> > that want userspace drivers 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 enabling CONFIG_VFIO_NOIOMMU and loading the vfio
> > module with the option "enable_unsafe_pci_noiommu_mode".  This should
> > make it very clear that this mode is not safe.  In this mode, there is
> > no support for unprivileged users, CAP_SYS_ADMIN is required for
> > access to the necessary dev files.
> 
> CAP_SYS_RAWIO seems a better match (in particular, it allows access to 
> /dev/mem, which is the same thing).

Sure, that seems reasonable.

> >    Mixing no-iommu and secure VFIO is
> > also unsupported, as are any VFIO IOMMU backends other than the
> > vfio-noiommu backend.  Furthermore, unsafe group files are relocated
> > to /dev/vfio-noiommu/.  Upon successful loading in this mode, the
> > kernel is tainted due to the dummy IOMMU put in place.  Unloading of
> > the module in this mode is also unsupported and will BUG due to the
> > lack of support for unregistering an IOMMU for a bus type.
> 
> I did not see an API for detecting whether memory translation is 
> provided or not.  We can have the caller guess this by looking at the 
> device name, or by requiring the user to specify this, but I think it's 
> cleaner to provide programmatic access to this attribute.

The VFIO user can probe and needs to set the IOMMU model in use before
they can access a device file descriptor.  In this mode, the
VFIO_NOIOMMU_IOMMU is the only model available, which as proposed here
provides no translation, and in fact no mapping ioctls.  Thanks,

Alex

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC PATCH 2/2] vfio: Include no-iommu mode Alex Williamson <alex.williamson@redhat.com> - 2015-10-09 20:50 +0200
  Re: [RFC PATCH 2/2] vfio: Include no-iommu mode Avi Kivity <avi@scylladb.com> - 2015-10-11 10:20 +0200
    Re: [RFC PATCH 2/2] vfio: Include no-iommu mode "Michael S. Tsirkin" <mst@redhat.com> - 2015-10-11 11:00 +0200
      Re: [RFC PATCH 2/2] vfio: Include no-iommu mode Avi Kivity <avi@scylladb.com> - 2015-10-11 11:10 +0200
        Re: [RFC PATCH 2/2] vfio: Include no-iommu mode "Michael S. Tsirkin" <mst@redhat.com> - 2015-10-11 11:30 +0200
          Re: [RFC PATCH 2/2] vfio: Include no-iommu mode Gleb Natapov <gleb@scylladb.com> - 2015-10-11 11:30 +0200
    Re: [RFC PATCH 2/2] vfio: Include no-iommu mode Alex Williamson <alex.williamson@redhat.com> - 2015-10-11 23:20 +0200
  Re: [RFC PATCH 2/2] vfio: Include no-iommu mode Stephen Hemminger <stephen@networkplumber.org> - 2015-10-12 18:00 +0200
    Re: [RFC PATCH 2/2] vfio: Include no-iommu mode "Michael S. Tsirkin" <mst@redhat.com> - 2015-10-12 18:30 +0200
      Re: [RFC PATCH 2/2] vfio: Include no-iommu mode Alex Williamson <alex.williamson@redhat.com> - 2015-10-12 19:50 +0200
        Re: [RFC PATCH 2/2] vfio: Include no-iommu mode Alex Williamson <alex.williamson@redhat.com> - 2015-10-12 20:10 +0200
    Re: [RFC PATCH 2/2] vfio: Include no-iommu mode Alex Williamson <alex.williamson@redhat.com> - 2015-10-12 18:30 +0200
      Re: [RFC PATCH 2/2] vfio: Include no-iommu mode Avi Kivity <avi@scylladb.com> - 2015-10-12 18:40 +0200

csiph-web