From: Tom Lyon <pugs@lyon-about.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Avi Kivity <avi@redhat.com>, Chris Wright <chrisw@sous-sol.org>,
Joerg Roedel <joro@8bytes.org>,
linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
hjk@linutronix.de, gregkh@suse.de, aafabbri@cisco.com,
scofeldm@cisco.com
Subject: Re: [PATCH] VFIO driver: Non-privileged user level PCI drivers
Date: Mon, 7 Jun 2010 12:01:04 -0700 [thread overview]
Message-ID: <201006071201.04418.pugs@lyon-about.com> (raw)
In-Reply-To: <20100606095450.GA26394@redhat.com>
On Sunday 06 June 2010 02:54:51 am Michael S. Tsirkin wrote:
> On Thu, Jun 03, 2010 at 02:41:38PM -0700, Tom Lyon wrote:
> > OK, in the interest of making progress, I am about to embark on the following:
> >
> > 1. Create a user-iommu-domain driver - opening it will give a new empty domain.
> > Ultimately this can also populate sysfs with the state of its world, which would
> > also be a good addition to the base iommu stuff.
> > If someone closes the fd while in use, the domain stays valid anyway until users
> > drop off.
> >
> > 2. Add DOMAIN_SET and DOMAIN_UNSET ioctls to the vfio driver. Require that
> > a domain be set before using the VFIO_DMA_MAP_IOVA ioctl
>
> Require domain to be set before you allow any access to the device:
> mmap, write, read. IMO this is the only safe way to make sure userspace
> does not corrupt memory, and this removes the need to special-case
> MSI memory, play with bus master enable and hope it can be cleared without
> reset, etc.
Michael - the light bulb finally lit for me and I now understand what you've been
saying the past few weeks. Of course you're right - we need iommu set before any
register access. I had thought that was done by default but now I see that the
dma_map_sg routine only attaches to the iommu on demand.
So I will torpedo the MAP_ANYWHERE stuff. I'd like to keep the MAP_IOVA ioctl
with the vfio fd so that the user can still do everything with one fd. I'm thinking the
fd opens and iommu bindings could be done in a program before spinning out the
program with the user driver.
>
> > (this is the one
> > that KVM wants).
>
> Not sure I understand. I think that MAP should be done on the domain,
> not the device, this handles pinning pages correctly and
> this way you don't need any special checks.
>
> > However, the VFIO_DMA_MAP_ANYWHERE ioctl is the one
> > which uses the dma_sg interface which has no expicit control of domains. I
> > intend to keep it the way it is, but expect only non-hypervisor programs would
> > want to use it.
>
> If we support MAP_IOVA, why is MAP_ANYWHERE useful? Can't
> non-hypervisors just pick an address?
>
> > 3. Clean up the docs and other nits that folks have found.
> >
> > Comments?
>
next prev parent reply other threads:[~2010-06-07 19:04 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-28 23:07 [PATCH] VFIO driver: Non-privileged user level PCI drivers Tom Lyon
2010-05-28 23:36 ` Randy Dunlap
2010-05-28 23:56 ` Randy Dunlap
2010-05-29 11:55 ` Arnd Bergmann
2010-05-29 12:16 ` Avi Kivity
2010-05-30 12:19 ` Michael S. Tsirkin
2010-05-30 12:27 ` Avi Kivity
2010-05-30 12:49 ` Michael S. Tsirkin
2010-05-30 13:01 ` Avi Kivity
2010-05-30 13:03 ` Michael S. Tsirkin
2010-05-30 13:13 ` Avi Kivity
2010-05-30 14:53 ` Michael S. Tsirkin
2010-05-31 11:50 ` Avi Kivity
2010-05-31 17:10 ` Michael S. Tsirkin
2010-06-01 8:10 ` Avi Kivity
2010-06-01 9:55 ` Michael S. Tsirkin
2010-06-01 10:28 ` Avi Kivity
2010-06-01 10:46 ` Michael S. Tsirkin
2010-06-01 12:41 ` Avi Kivity
2010-06-02 9:45 ` Joerg Roedel
2010-06-02 9:49 ` Avi Kivity
2010-06-02 10:04 ` Joerg Roedel
2010-06-02 10:09 ` Michael S. Tsirkin
2010-06-02 11:21 ` Avi Kivity
2010-06-02 16:53 ` Chris Wright
2010-06-06 13:44 ` Avi Kivity
2010-06-02 10:15 ` Michael S. Tsirkin
2010-06-02 10:26 ` Joerg Roedel
2010-06-01 21:26 ` Tom Lyon
2010-06-02 2:59 ` Avi Kivity
2010-06-02 5:29 ` Chris Wright
2010-06-02 5:40 ` Avi Kivity
2010-06-02 4:29 ` Alex Williamson
2010-06-02 4:59 ` Tom Lyon
2010-06-02 5:08 ` Avi Kivity
2010-06-02 9:53 ` Joerg Roedel
2010-06-02 9:42 ` Joerg Roedel
2010-06-02 9:50 ` Avi Kivity
2010-06-02 9:53 ` Michael S. Tsirkin
2010-06-02 10:19 ` Joerg Roedel
2010-06-02 10:21 ` Michael S. Tsirkin
2010-06-02 10:35 ` Joerg Roedel
2010-06-02 10:38 ` Michael S. Tsirkin
2010-06-02 11:12 ` Joerg Roedel
2010-06-02 11:21 ` Michael S. Tsirkin
2010-06-02 12:19 ` Joerg Roedel
2010-06-02 12:25 ` Avi Kivity
2010-06-02 12:50 ` Joerg Roedel
2010-06-02 13:06 ` Avi Kivity
2010-06-02 13:53 ` Joerg Roedel
2010-06-02 13:17 ` Michael S. Tsirkin
2010-06-02 14:01 ` Joerg Roedel
2010-06-02 12:34 ` Michael S. Tsirkin
2010-06-02 13:02 ` Joerg Roedel
2010-06-02 17:46 ` Chris Wright
2010-06-02 18:09 ` Tom Lyon
2010-06-02 19:46 ` Joerg Roedel
2010-06-03 6:23 ` Avi Kivity
2010-06-03 21:41 ` Tom Lyon
2010-06-06 9:54 ` Michael S. Tsirkin
2010-06-07 19:01 ` Tom Lyon [this message]
2010-06-08 21:22 ` Michael S. Tsirkin
2010-06-02 10:44 ` Michael S. Tsirkin
2010-05-30 12:59 ` Avi Kivity
2010-05-31 17:17 ` Alan Cox
2010-06-01 21:29 ` Tom Lyon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201006071201.04418.pugs@lyon-about.com \
--to=pugs@lyon-about.com \
--cc=aafabbri@cisco.com \
--cc=avi@redhat.com \
--cc=chrisw@sous-sol.org \
--cc=gregkh@suse.de \
--cc=hjk@linutronix.de \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=scofeldm@cisco.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.