From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/3] PCI: ARM: add support for virtual PCI host controller
Date: Thu, 6 Feb 2014 20:31:14 +0000 [thread overview]
Message-ID: <20140206203114.GW26684@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <201402060928.53310.arnd@arndb.de>
On Thu, Feb 06, 2014 at 09:28:52AM +0100, Arnd Bergmann wrote:
> It certainly seems workable. OTOH if we just manage to do a
> helper that scans the OF ranges, allocates the I/O window,
> remaps it and calls the existing pci_add_resource_offset()
> helper, PCI host drivers don't need to worry about the
> io_offsets computation either and just need to pull out the
> correct window locations if they need to set up the hardware
> translation windows (which I'd hope we can often let the boot
> loader take care of).
Wrong. Think about it for a moment.
Let's say you have two host bridges. One host bridge has an IO window
which maps to bus I/O address 0 at 0x40000000. The other host bridge
has it's IO window which maps bus I/O address 0 to 0x48000000.
So, the contents of the /hardware/ BARs is going to be in the range
of 0x0000 to 0xffff. That means the value found in them is meaningless
without knowing which bus it's on.
Now, remember we said that I/O was going to be in a fixed location of
a fixed size, that being 0xfee00000 and 1MB in size. So, we map the
first IO window to 0xfee00000. What about the other one? Well,
that could be mapped to 0xfee10000.
However, we need the IO addresses visible to the Linux kernel to be
offset by 0x10000 for the second bus - merely reading the BAR and
storing that in a resource, for the driver to later pick up and pass
into inb()/outb() won't work. There needs to be offsetting. This is
the exact reason why we have the offsetting for IO windows.
Exactly the same goes for memory windows as well. It's no good working
in the hosts physical address space when looking at BARs, because they're
not in that address space. They're in the bus address space which can
be entirely different.
So, whenever you enumerate a PCI bus, and read the resource information
out of the BARs, you /must/ know how that address region specified in
the BAR as a /bus/ address maps to the /host/ address space.
--
FTTC broadband for 0.8mile line: 5.8Mbps down 500kbps up. Estimation
in database were 13.1 to 19Mbit for a good line, about 7.5+ for a bad.
Estimate before purchase was "up to 13.2Mbit".
next prev parent reply other threads:[~2014-02-06 20:31 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-04 16:53 [PATCH 0/3] ARM: PCI: implement virtual PCI host controller Will Deacon
2014-02-04 16:53 ` [PATCH 1/3] ARM: bios32: use pci_enable_resource to enable PCI resources Will Deacon
2014-02-12 1:06 ` Bjorn Helgaas
2014-02-12 16:18 ` Will Deacon
2014-02-04 16:53 ` [PATCH 2/3] PCI: ARM: add support for virtual PCI host controller Will Deacon
2014-02-04 19:13 ` Arnd Bergmann
2014-02-05 19:09 ` Will Deacon
2014-02-05 19:27 ` Jason Gunthorpe
2014-02-05 19:41 ` Peter Maydell
2014-02-05 20:26 ` Arnd Bergmann
2014-02-05 20:53 ` Jason Gunthorpe
2014-02-06 8:28 ` Arnd Bergmann
2014-02-06 20:31 ` Russell King - ARM Linux [this message]
2014-02-09 20:18 ` Arnd Bergmann
2014-02-09 20:34 ` Russell King - ARM Linux
2014-02-11 19:15 ` Arnd Bergmann
2014-02-07 11:46 ` Will Deacon
2014-02-07 17:54 ` Jason Gunthorpe
2014-02-12 18:10 ` Will Deacon
2014-02-12 18:19 ` Jason Gunthorpe
2014-02-12 18:21 ` Will Deacon
2014-02-09 20:30 ` Arnd Bergmann
2014-02-10 17:34 ` Jason Gunthorpe
2014-02-11 10:42 ` Arnd Bergmann
2014-02-12 19:43 ` Jason Gunthorpe
2014-02-12 20:07 ` Arnd Bergmann
2014-02-12 20:33 ` Bjorn Helgaas
2014-02-12 21:15 ` Thomas Petazzoni
2014-02-12 22:24 ` Jason Gunthorpe
2014-02-12 19:49 ` Will Deacon
2014-02-06 8:54 ` Anup Patel
2014-02-06 10:26 ` Arnd Bergmann
2014-02-06 10:52 ` Anup Patel
2014-02-06 10:54 ` Liviu Dudau
2014-02-06 11:00 ` Will Deacon
2014-02-06 11:28 ` Arnd Bergmann
2014-02-04 16:53 ` [PATCH 3/3] ARM: mach-virt: allow PCI support to be selected Will Deacon
2014-04-03 22:07 ` [PATCH 0/3] ARM: PCI: implement virtual PCI host controller Bjorn Helgaas
2014-04-14 17:13 ` Will Deacon
2014-04-14 18:48 ` Arnd Bergmann
2014-04-15 14:47 ` Will Deacon
2014-04-15 15:26 ` Arnd Bergmann
2014-04-16 13:58 ` Will Deacon
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=20140206203114.GW26684@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=linux-arm-kernel@lists.infradead.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).