From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Bhushan Bharat-R65777 <R65777@freescale.com>
Cc: Wood Scott-B07421 <B07421@freescale.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
Yoder Stuart-B08248 <B08248@freescale.com>
Subject: Re: [Qemu-devel] [RFC] Proposal: PCI/PCIe: inbound BAR0 emulation for PCI controller (Root Complex)
Date: Fri, 08 Jun 2012 21:01:41 +1000 [thread overview]
Message-ID: <1339153301.24838.49.camel@pasglop> (raw)
In-Reply-To: <6A3DF150A5B70D4F9B66A25E3F7C888D03D71BC1@039-SN2MPN1-022.039d.mgd.msft.net>
On Fri, 2012-06-08 at 09:03 +0000, Bhushan Bharat-R65777 wrote:
> Hi All,
>
> When Freescale PCI controller configured in Root Complex mode then,
> its configuration header (type 1) have one inbound BAR (BAR0, called
> as CCSRBAR). And rest of BARs (inbound and outbound) are supported by
> ATMU registers, which are outside the Type 1 configuration header.
> This BAR0 of Type 1 configuration header always translate to CCSR
> space and is of the size of CCSR. This BAR0 (inbound window) is
> required for MSI interrupts support. With this window, the pci devices
> can write to the MPIC MSI registers to generate MSI interrupt.
So you should start with giving an overview, nobody here knows what
"ATMU" or "CCSR" are, those are device specific acronyms
As a matter of fact it looks like I misunderstood you on IRC :-) IE. I
thought your problem was that BAR0 is 'special' as it represents the
inbound memory window (as it does on some PPC 4xx for example and a
whole other collection of embedded devices). You seem to indicate that
it's in fact MMIO:
> As far as I know, as of now no emulated PCI controller supports this
> BAR0 in type 1 configuration header. But probably (I think so) that
> supporting this is not of big concern, but the point is that this
> window (BAR0) translate to mmio-regs (CCSR) and not to DDR memory.
So the 4xx case or the case where your BAR 0 actually represents system
memory are something that is bothering me but not what you are trying to
discuss here.
IE. Normal BAR operations should work for an MMIO BAR, ie register it
normally as a PCIe device and devices accessing those addresses will do
the right thing.
>From there, AFAIK, the MSI code will simply do stl_le_phys, which I
-believe- will hit a BAR that does MMIO decoding for those addresses,
but I'll let people knowing qemu more in depth reply whether that's true
or not.
There's very few devices with MSI support in hw/* so it's hard to test
with anything other than virtio.
> So I have couple of concerns here:
>
> 1. Whenever PCI device does need DMA then these windows (inbound and
> outbound ATMUs registers) need to used to translate pci address to
> system physical address (Sometime we also call this as cpu address
> space). This will probably be done by : [Qemu-devel] [PATCH 00/12]
> IOMMU Infrastructure : patch-set ( I am trying to understand these
> patches :-))
Yes, that's basically it. The patches allow you to add a set of routines
that will be used for translating DMA accesses to system memory along
with map/unmap operations etc...
Beware that this only works with drivers that use the proper accessors.
The patch series "fixes" some of them but not everything. I don't know
off hand (I don't have the code at hand right now) whether the MSI code
goes through that or not, if it does, you may need to be careful to
-not- hit the translation layer and pass the accesses on.
> 2. Hook up this inbound BAR0 in the above patch-set to translate to
> mmio-regs. As this would be controller specific, a callback will be
> registered for translation. Now it will be upto the controller
> specific code on how it translates. As this is needed only for MSI
> interrupt, maybe, initially we do not do anything initially, till we
> want MSI emulation in QEMU.
Well, virtio can make good use of MSI emulation ...
Cheers,
Ben.
> Please provide your comment.
>
> Thanks
> -Bharat
>
>
next prev parent reply other threads:[~2012-06-08 11:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-08 9:03 [Qemu-devel] [RFC] Proposal: PCI/PCIe: inbound BAR0 emulation for PCI controller (Root Complex) Bhushan Bharat-R65777
2012-06-08 11:01 ` Benjamin Herrenschmidt [this message]
2012-06-08 11:35 ` Bhushan Bharat-R65777
2012-06-08 19:08 ` Scott Wood
2012-06-08 22:51 ` Benjamin Herrenschmidt
2012-06-11 12:41 ` Bhushan Bharat-R65777
2012-06-08 18:56 ` Scott Wood
2012-06-11 5:05 ` Bhushan Bharat-R65777
2012-06-11 19:15 ` 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=1339153301.24838.49.camel@pasglop \
--to=benh@kernel.crashing.org \
--cc=B07421@freescale.com \
--cc=B08248@freescale.com \
--cc=R65777@freescale.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).