From: Alex Williamson <alex.williamson@redhat.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>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
Yoder Stuart-B08248 <B08248@freescale.com>,
"iommu@lists.linux-foundation.org"
<iommu@lists.linux-foundation.org>,
Bhushan Bharat-R65777 <R65777@freescale.com>,
Scott Wood <scottwood@freescale.com>
Subject: Re: [Qemu-devel] RFC: vfio API changes needed for powerpc
Date: Wed, 03 Apr 2013 13:23:37 -0600 [thread overview]
Message-ID: <1365017017.2882.269.camel@bling.home> (raw)
In-Reply-To: <CALRxmdDHYp1+svjwDrhMc9w2p7H8t87PphEZ1t+97C-EHDR+3g@mail.gmail.com>
On Wed, 2013-04-03 at 14:09 -0500, 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. One thing we need to do is enable the aperture...and current
> thinking is that is done on the first DMA_MAP. Similarly when the last mapping
> is unmapped we could also umap the MSI banks.
>
> Sequence would be something like:
>
> VFIO_GROUP_SET_CONTAINER // add groups to the container
>
> VFIO_SET_IOMMU(VFIO_FSL_PAMU) // set iommu model
>
> cnt = VFIO_IOMMU_GET_MSI_BANK_COUNT // returns max # of MSI banks
>
> VFIO_IOMMU_SET_ATTR(ATTR_GEOMETRY) // set overall aperture
>
> VFIO_IOMMU_SET_ATTR(ATTR_WINDOWS) // set # of windows,
> including MSI banks
>
> VFIO_IOMMU_MAP_DMA // map the guest's memory
> ---> kernel enables aperture and maps needed MSI banks here
>
> VFIO_DEVICE_SET_IRQS
> ---> kernel sets actual MSI addr/data in physical
> device here (I think)
You could also make use of the IOMMU_ENABLE/DISABLE entry points that
Alexey plans to use. Ideally I'd think that you'd want to enable the
required MSI banks for a device on DEVICE_SET_IRQs. That's effectively
what happens on x86. Perhaps some information stored in the domain
structure would let architecture hooks in MSI setup enable those
mappings for you? Thanks,
Alex
next prev parent reply other threads:[~2013-04-03 19:23 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-02 17:32 [Qemu-devel] RFC: vfio API changes needed for powerpc Yoder Stuart-B08248
2013-04-02 19:39 ` Scott Wood
2013-04-02 20:38 ` Stuart Yoder
2013-04-02 20:47 ` Scott Wood
2013-04-02 20:58 ` Stuart Yoder
2013-04-02 20:32 ` Alex Williamson
2013-04-02 20:54 ` Stuart Yoder
2013-04-02 21:16 ` Alex Williamson
2013-04-02 22:13 ` Scott Wood
2013-04-03 2:54 ` Alex Williamson
2013-04-02 20:57 ` Scott Wood
2013-04-02 21:08 ` Stuart Yoder
2013-04-02 21:38 ` Alex Williamson
2013-04-02 22:50 ` Scott Wood
2013-04-03 3:37 ` Alex Williamson
2013-04-03 19:09 ` Stuart Yoder
2013-04-03 19:18 ` Scott Wood
2013-04-03 19:43 ` Stuart Yoder
2013-04-03 20:00 ` Scott Wood
2013-04-03 19:23 ` Alex Williamson [this message]
2013-04-03 19:26 ` Scott Wood
2013-04-03 21:19 ` Scott Wood
2013-04-03 18:32 ` Stuart Yoder
2013-04-03 18:39 ` Scott Wood
2013-04-02 21:55 ` Scott Wood
2013-04-02 21:32 ` Alex Williamson
2013-04-02 22:44 ` Scott Wood
2013-04-03 3:12 ` Alex Williamson
2013-04-03 18:25 ` Stuart Yoder
2013-04-03 21:25 ` 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=1365017017.2882.269.camel@bling.home \
--to=alex.williamson@redhat.com \
--cc=B07421@freescale.com \
--cc=B08248@freescale.com \
--cc=R65777@freescale.com \
--cc=agraf@suse.de \
--cc=b08248@gmail.com \
--cc=iommu@lists.linux-foundation.org \
--cc=kvm@vger.kernel.org \
--cc=qemu-devel@nongnu.org \
--cc=scottwood@freescale.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 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).