qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Joerg Roedel <joro@8bytes.org>
To: Alexander Graf <agraf@suse.de>
Cc: chrisw <chrisw@sous-sol.org>,
	Alexey Kardashevskiy <aik@au1.ibm.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	Paul Mackerras <pmac@au1.ibm.com>,
	"Roedel, Joerg" <joerg.roedel@amd.com>,
	qemu-devel <qemu-devel@nongnu.org>, aafabbri <aafabbri@cisco.com>,
	iommu <iommu@lists.linux-foundation.org>,
	Avi Kivity <avi@redhat.com>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	linuxppc-dev <linuxppc-dev@lists.ozlabs.org>,
	"benve@cisco.com" <benve@cisco.com>
Subject: Re: [Qemu-devel] kvm PCI assignment & VFIO ramblings
Date: Fri, 26 Aug 2011 17:24:05 +0200	[thread overview]
Message-ID: <20110826152404.GF8978@8bytes.org> (raw)
In-Reply-To: <571DC890-A1A3-4528-92BE-566F033FD4BF@suse.de>

On Fri, Aug 26, 2011 at 09:07:35AM -0500, Alexander Graf wrote:
> On 26.08.2011, at 04:33, Roedel, Joerg wrote:
> > 
> > The reason is that you mean the usability for the programmer and I mean
> > it for the actual user of qemu :)
> 
> No, we mean the actual user of qemu. The reason being that making a
> device available for any user space application is an administrative
> task.
>
> Forget the KVM case for a moment and think of a user space device
> driver. I as a user am not root. But I as a user when having access to
> /dev/vfioX want to be able to access the device and manage it - and
> only it. The admin of that box needs to set it up properly for me to
> be able to access it.

Right, and that task is being performed by attaching the device(s) in
question to the vfio driver. The rights-management happens on the
/dev/vfio/$group file.

> So having two steps is really the correct way to go:
> 
>   * create VFIO group
>   * use VFIO group
> 
> because the two are done by completely different users. It's similar
> to how tun/tap works in Linux too. Of course nothing keeps you from
> also creating a group on the fly, but it shouldn't be the only
> interface available. The persistent setup is definitely more useful.

I see the use-case. But to make it as easy as possible for the end-user
we can do both.

So the user of (qemu again) does this:

# vfio-ctl attach 00:01.0
vfio-ctl: attached to group 8
# vfio-ctl attach 00:02.0
vfio-ctl: attached to group 16
$ qemu -device vfio-pci,host=00:01.0 -device vfio,host=00:01.0 ...

which should cover the usecase you prefer. Qemu still creates the
meta-group that allow the devices to share the same page-table. But what
should also be possible is:

# qemu -device vfio-pci,host=00:01.0 -device vfio-pci,host=00:02.0

In that case qemu detects that the devices are not yet bound to vfio and
will do so and also unbinds them afterwards (essentially the developer
use-case).

Your interface which requires pre-binding of devices into one group by
the administrator only makes sense if you want to force userspace to
use certain devices (which do not belong to the same hw-group) only
together. But I don't see a usecase for defining such constraints (yet).

	Joerg

  reply	other threads:[~2011-08-26 15:24 UTC|newest]

Thread overview: 93+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1311983933.8793.42.camel@pasglop>
2011-07-30 18:20 ` [Qemu-devel] kvm PCI assignment & VFIO ramblings Alex Williamson
2011-07-30 23:54   ` Benjamin Herrenschmidt
2011-08-01 18:59     ` Alex Williamson
2011-08-02  2:00       ` Benjamin Herrenschmidt
2011-07-30 23:55   ` Benjamin Herrenschmidt
2011-08-02  8:28   ` David Gibson
2011-08-02 18:14     ` Alex Williamson
2011-08-02 18:35       ` Alex Williamson
2011-08-03  2:04         ` David Gibson
2011-08-03  3:44           ` Alex Williamson
2011-08-04  0:39             ` David Gibson
2011-08-08  8:28           ` Avi Kivity
2011-08-09 23:24             ` Alex Williamson
2011-08-10  2:48               ` Benjamin Herrenschmidt
2011-08-20 16:51                 ` Alex Williamson
2011-08-22  5:55                   ` David Gibson
2011-08-22 15:45                     ` Alex Williamson
2011-08-22 21:01                       ` Benjamin Herrenschmidt
2011-08-23 19:30                         ` Alex Williamson
2011-08-23 23:51                           ` Benjamin Herrenschmidt
2011-08-24  3:40                             ` Alexander Graf
2011-08-24 14:47                             ` Alex Williamson
2011-08-24  8:43                           ` Joerg Roedel
2011-08-24 14:56                             ` Alex Williamson
2011-08-25 11:01                               ` Roedel, Joerg
2011-08-23  2:38                       ` David Gibson
2011-08-23 16:23                         ` Alex Williamson
2011-08-23 23:41                           ` Benjamin Herrenschmidt
2011-08-24  3:36                             ` Alexander Graf
2011-08-22  6:30                   ` Avi Kivity
2011-08-22 10:46                     ` Joerg Roedel
2011-08-22 10:51                       ` Avi Kivity
2011-08-22 12:36                         ` Roedel, Joerg
2011-08-22 12:42                           ` Avi Kivity
2011-08-22 12:55                             ` Roedel, Joerg
2011-08-22 13:06                               ` Avi Kivity
2011-08-22 13:15                                 ` Roedel, Joerg
2011-08-22 13:17                                   ` Avi Kivity
2011-08-22 14:37                                     ` Roedel, Joerg
2011-08-22 20:53                     ` Benjamin Herrenschmidt
2011-08-22 17:25                   ` Joerg Roedel
2011-08-22 19:17                     ` Alex Williamson
2011-08-23 13:14                       ` Roedel, Joerg
2011-08-23 17:08                         ` Alex Williamson
2011-08-24  8:52                           ` Roedel, Joerg
2011-08-24 15:07                             ` Alex Williamson
2011-08-25 12:31                               ` Roedel, Joerg
2011-08-25 13:25                                 ` Alexander Graf
2011-08-26  4:24                                   ` David Gibson
2011-08-26  9:24                                     ` Roedel, Joerg
2011-08-28 13:14                                       ` Avi Kivity
2011-08-28 13:56                                         ` Joerg Roedel
2011-08-28 14:04                                           ` Avi Kivity
2011-08-30 16:14                                             ` Joerg Roedel
2011-08-22 21:03                     ` Benjamin Herrenschmidt
2011-08-23 13:18                       ` Roedel, Joerg
2011-08-23 23:35                         ` Benjamin Herrenschmidt
2011-08-24  8:53                           ` Roedel, Joerg
2011-08-22 20:29                   ` aafabbri
2011-08-22 20:49                     ` Benjamin Herrenschmidt
2011-08-22 21:38                       ` aafabbri
2011-08-22 21:49                         ` Benjamin Herrenschmidt
2011-08-23  0:52                           ` aafabbri
2011-08-23  6:54                             ` Benjamin Herrenschmidt
2011-08-23 11:09                               ` Joerg Roedel
2011-08-23 17:01                               ` Alex Williamson
2011-08-23 17:33                                 ` Aaron Fabbri
2011-08-23 18:01                                   ` Alex Williamson
2011-08-24  9:10                                   ` Joerg Roedel
2011-08-24 21:13                                     ` Alex Williamson
2011-08-25 10:54                                       ` Roedel, Joerg
2011-08-25 15:38                                         ` Don Dutile
2011-08-25 16:46                                           ` Roedel, Joerg
2011-08-25 17:20                                         ` Alex Williamson
2011-08-25 18:05                                           ` Joerg Roedel
2011-08-26 18:04                                             ` Alex Williamson
2011-08-30 16:13                                               ` Joerg Roedel
2011-08-23 11:04                             ` Joerg Roedel
2011-08-23 16:54                               ` aafabbri
2011-08-24  9:14                                 ` Roedel, Joerg
2011-08-24  9:33                                   ` David Gibson
2011-08-24 11:03                                     ` Roedel, Joerg
2011-08-26  4:20                                       ` David Gibson
2011-08-26  9:33                                         ` Roedel, Joerg
2011-08-26 14:07                                           ` Alexander Graf
2011-08-26 15:24                                             ` Joerg Roedel [this message]
2011-08-26 15:29                                               ` Alexander Graf
2011-08-26 17:52                                             ` Aaron Fabbri
2011-08-26 19:35                                               ` Chris Wright
2011-08-26 20:17                                                 ` Aaron Fabbri
2011-08-26 21:06                                                   ` Chris Wright
2011-08-30  1:29                                                   ` David Gibson
2011-08-04 10:35   ` Joerg Roedel

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=20110826152404.GF8978@8bytes.org \
    --to=joro@8bytes.org \
    --cc=aafabbri@cisco.com \
    --cc=agraf@suse.de \
    --cc=aik@au1.ibm.com \
    --cc=avi@redhat.com \
    --cc=benve@cisco.com \
    --cc=chrisw@sous-sol.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joerg.roedel@amd.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=pmac@au1.ibm.com \
    --cc=qemu-devel@nongnu.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).