All of lore.kernel.org
 help / color / mirror / Atom feed
From: Scott Wood <scottwood-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
To: Stuart Yoder <b08248-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Wood Scott-B07421
	<B07421-KZfg59tc24xl57MIdRCFDg@public.gmane.org>,
	"kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"agraf-l3A5Bk7waGM@public.gmane.org"
	<agraf-l3A5Bk7waGM@public.gmane.org>,
	"iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org"
	<iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>,
	"qemu-devel-qX2TKyscuCcdnm+yROfE0A@public.gmane.org"
	<qemu-devel-qX2TKyscuCcdnm+yROfE0A@public.gmane.org>,
	Yoder Stuart-B08248
	<B08248-KZfg59tc24xl57MIdRCFDg@public.gmane.org>,
	Bhushan Bharat-R65777
	<R65777-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
Subject: Re: RFC: vfio API changes needed for powerpc
Date: Wed, 3 Apr 2013 14:18:02 -0500	[thread overview]
Message-ID: <1365016682.25627.6@snotra> (raw)
In-Reply-To: <CALRxmdDHYp1+svjwDrhMc9w2p7H8t87PphEZ1t+97C-EHDR+3g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> (from b08248-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org on Wed Apr  3 14:09:45 2013)

On 04/03/2013 02:09:45 PM, Stuart Yoder wrote:
> > Would is be possible for userspace to simply leave room for MSI bank
> > mapping (how much room could be determined by something like
> > VFIO_IOMMU_GET_MSI_BANK_COUNT) then document the API that userspace  
> can
> > DMA_MAP starting at the 0x0 address of the aperture, growing up, and
> > VFIO will map banks on demand at the top of the aperture, growing  
> down?
> > Wouldn't that avoid a lot of issues with userspace needing to know
> > anything about MSI banks (other than count) and coordinating irq  
> numbers
> > and enabling handlers?
> 
> This is basically option #A in the original proposals sent.   I like
> this approach, in that it
> is simpler and keeps user space mostly out of this...which is
> consistent with how things are done
> on x86.  User space just needs to know how many windows to leave at
> the top of the aperture.
> The kernel then has the flexibility to use those windows how it wants.
> 
> But one question, is when should the kernel actually map (and unmap)
> the MSI banks.

I think userspace should explicitly request it.  Userspace still  
wouldn't need to know anything but the count:

count = VFIO_IOMMU_GET_MSI_BANK_COUNT
VFIO_IOMMU_SET_ATTR(ATTR_GEOMETRY)
VFIO_IOMMU_SET_ATTR(ATTR_WINDOWS)
// do other DMA maps now, or later, or not at all, doesn't matter
for (i = 0; i < count; i++)
	VFIO_IOMMU_MAP_MSI_BANK(iova, i);
// The kernel now knows where each bank has been mapped, and can update  
PCI config space appropriately.

> One thing we need to do is enable the aperture...and current
> thinking is that is done on the first DMA_MAP.

What if there are no other mappings required?

-Scott

WARNING: multiple messages have this Message-ID (diff)
From: Scott Wood <scottwood@freescale.com>
To: Stuart Yoder <b08248@gmail.com>
Cc: Wood Scott-B07421 <B07421@freescale.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"agraf@suse.de" <agraf@suse.de>,
	"iommu@lists.linux-foundation.org"
	<iommu@lists.linux-foundation.org>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	Yoder Stuart-B08248 <B08248@freescale.com>,
	Alex Williamson <alex.williamson@redhat.com>,
	Bhushan Bharat-R65777 <R65777@freescale.com>
Subject: Re: [Qemu-devel] RFC: vfio API changes needed for powerpc
Date: Wed, 3 Apr 2013 14:18:02 -0500	[thread overview]
Message-ID: <1365016682.25627.6@snotra> (raw)
In-Reply-To: <CALRxmdDHYp1+svjwDrhMc9w2p7H8t87PphEZ1t+97C-EHDR+3g@mail.gmail.com> (from b08248@gmail.com on Wed Apr  3 14:09:45 2013)

On 04/03/2013 02:09:45 PM, Stuart Yoder wrote:
> > Would is be possible for userspace to simply leave room for MSI bank
> > mapping (how much room could be determined by something like
> > VFIO_IOMMU_GET_MSI_BANK_COUNT) then document the API that userspace  
> can
> > DMA_MAP starting at the 0x0 address of the aperture, growing up, and
> > VFIO will map banks on demand at the top of the aperture, growing  
> down?
> > Wouldn't that avoid a lot of issues with userspace needing to know
> > anything about MSI banks (other than count) and coordinating irq  
> numbers
> > and enabling handlers?
> 
> This is basically option #A in the original proposals sent.   I like
> this approach, in that it
> is simpler and keeps user space mostly out of this...which is
> consistent with how things are done
> on x86.  User space just needs to know how many windows to leave at
> the top of the aperture.
> The kernel then has the flexibility to use those windows how it wants.
> 
> But one question, is when should the kernel actually map (and unmap)
> the MSI banks.

I think userspace should explicitly request it.  Userspace still  
wouldn't need to know anything but the count:

count = VFIO_IOMMU_GET_MSI_BANK_COUNT
VFIO_IOMMU_SET_ATTR(ATTR_GEOMETRY)
VFIO_IOMMU_SET_ATTR(ATTR_WINDOWS)
// do other DMA maps now, or later, or not at all, doesn't matter
for (i = 0; i < count; i++)
	VFIO_IOMMU_MAP_MSI_BANK(iova, i);
// The kernel now knows where each bank has been mapped, and can update  
PCI config space appropriately.

> One thing we need to do is enable the aperture...and current
> thinking is that is done on the first DMA_MAP.

What if there are no other mappings required?

-Scott

  parent reply	other threads:[~2013-04-03 19:18 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-02 17:32 RFC: vfio API changes needed for powerpc Yoder Stuart-B08248
2013-04-02 17:32 ` [Qemu-devel] " Yoder Stuart-B08248
     [not found] ` <9F6FE96B71CF29479FF1CDC8046E15035A0F13-TcFNo7jSaXOLgTCmFNXF2K4g8xLGJsHaLnY5E4hWTkheoWH0uzbU5w@public.gmane.org>
2013-04-02 19:39   ` Scott Wood
2013-04-02 19:39     ` [Qemu-devel] " Scott Wood
2013-04-02 20:38     ` Stuart Yoder
2013-04-02 20:38       ` [Qemu-devel] " Stuart Yoder
2013-04-02 20:47       ` Scott Wood
2013-04-02 20:47         ` [Qemu-devel] " Scott Wood
2013-04-02 20:58         ` Stuart Yoder
2013-04-02 20:58           ` [Qemu-devel] " Stuart Yoder
2013-04-02 20:32   ` Alex Williamson
2013-04-02 20:32     ` [Qemu-devel] " Alex Williamson
     [not found]     ` <1364934737.2882.149.camel-xdHQ/5r00wBBDLzU/O5InQ@public.gmane.org>
2013-04-02 20:54       ` Stuart Yoder
2013-04-02 20:54         ` [Qemu-devel] " Stuart Yoder
     [not found]         ` <CALRxmdBrW5HUpprhWLr9-U8_t5LBuaPEtWP9vQGOAfyOQ0eV9A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-04-02 21:16           ` Alex Williamson
2013-04-02 21:16             ` [Qemu-devel] " Alex Williamson
     [not found]             ` <1364937371.2882.166.camel-xdHQ/5r00wBBDLzU/O5InQ@public.gmane.org>
2013-04-02 22:13               ` Scott Wood
2013-04-02 22:13                 ` [Qemu-devel] " Scott Wood
2013-04-03  2:54                 ` Alex Williamson
2013-04-03  2:54                   ` [Qemu-devel] " Alex Williamson
2013-04-02 20:57       ` Scott Wood
2013-04-02 20:57         ` [Qemu-devel] " Scott Wood
2013-04-02 21:08         ` Stuart Yoder
2013-04-02 21:08           ` [Qemu-devel] " Stuart Yoder
     [not found]           ` <CALRxmdCe-RMZuhPSviQsQUxWZbxXABOZDsM8ZoNaqrp=xH+TaA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-04-02 21:38             ` Alex Williamson
2013-04-02 21:38               ` [Qemu-devel] " Alex Williamson
     [not found]               ` <1364938725.2882.184.camel-xdHQ/5r00wBBDLzU/O5InQ@public.gmane.org>
2013-04-02 22:50                 ` Scott Wood
2013-04-02 22:50                   ` [Qemu-devel] " Scott Wood
2013-04-03  3:37                   ` Alex Williamson
2013-04-03  3:37                     ` [Qemu-devel] " Alex Williamson
2013-04-03 19:09                     ` Stuart Yoder
2013-04-03 19:09                       ` [Qemu-devel] " Stuart Yoder
     [not found]                       ` <CALRxmdDHYp1+svjwDrhMc9w2p7H8t87PphEZ1t+97C-EHDR+3g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-04-03 19:18                         ` Scott Wood [this message]
2013-04-03 19:18                           ` Scott Wood
2013-04-03 19:43                           ` Stuart Yoder
2013-04-03 19:43                             ` [Qemu-devel] " Stuart Yoder
     [not found]                             ` <CALRxmdAbVFbPUCDV1fHauAeQxDQWDC8SjsQn-Xyn3PbzKhFjmQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-04-03 20:00                               ` Scott Wood
2013-04-03 20:00                                 ` [Qemu-devel] " Scott Wood
2013-04-03 19:23                         ` Alex Williamson
2013-04-03 19:23                           ` [Qemu-devel] " Alex Williamson
2013-04-03 19:26                       ` Scott Wood
2013-04-03 19:26                         ` [Qemu-devel] " Scott Wood
     [not found]                     ` <1364960240.2882.230.camel-xdHQ/5r00wBBDLzU/O5InQ@public.gmane.org>
2013-04-03 21:19                       ` Scott Wood
2013-04-03 21:19                         ` [Qemu-devel] " Scott Wood
2013-04-03 18:32                   ` Stuart Yoder
2013-04-03 18:32                     ` [Qemu-devel] " Stuart Yoder
2013-04-03 18:39                     ` Scott Wood
2013-04-03 18:39                       ` [Qemu-devel] " Scott Wood
2013-04-02 21:55             ` Scott Wood
2013-04-02 21:55               ` [Qemu-devel] " Scott Wood
2013-04-02 21:32         ` Alex Williamson
2013-04-02 21:32           ` [Qemu-devel] " Alex Williamson
     [not found]           ` <1364938324.2882.179.camel-xdHQ/5r00wBBDLzU/O5InQ@public.gmane.org>
2013-04-02 22:44             ` Scott Wood
2013-04-02 22:44               ` [Qemu-devel] " Scott Wood
2013-04-03  3:12               ` Alex Williamson
2013-04-03  3:12                 ` [Qemu-devel] " Alex Williamson
2013-04-03 18:25                 ` Stuart Yoder
2013-04-03 18:25                   ` [Qemu-devel] " Stuart Yoder
     [not found]                 ` <1364958751.2882.209.camel-xdHQ/5r00wBBDLzU/O5InQ@public.gmane.org>
2013-04-03 21:25                   ` Scott Wood
2013-04-03 21:25                     ` [Qemu-devel] " Scott Wood

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=1365016682.25627.6@snotra \
    --to=scottwood-kzfg59tc24xl57midrcfdg@public.gmane.org \
    --cc=B07421-KZfg59tc24xl57MIdRCFDg@public.gmane.org \
    --cc=B08248-KZfg59tc24xl57MIdRCFDg@public.gmane.org \
    --cc=R65777-KZfg59tc24xl57MIdRCFDg@public.gmane.org \
    --cc=agraf-l3A5Bk7waGM@public.gmane.org \
    --cc=b08248-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=qemu-devel-qX2TKyscuCcdnm+yROfE0A@public.gmane.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 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.