From: jgunthorpe@obsidianresearch.com (Jason Gunthorpe)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC v1 08/16] arm: mvebu: the core PCIe driver
Date: Thu, 13 Dec 2012 15:27:00 -0700 [thread overview]
Message-ID: <20121213222700.GA8129@obsidianresearch.com> (raw)
In-Reply-To: <201212132146.05829.arnd@arndb.de>
On Thu, Dec 13, 2012 at 09:46:05PM +0000, Arnd Bergmann wrote:
> > Hum, not sure to follow you here. What sort of finer granularity does
> > PCIe requires?
PCIe requires 4k alignment of bridge IO addresses and 1M alignment
of bridge memory addresses.. I was thinking the mismatch of 4k vs 64k
in the mbus kills the idea, but some cleverness with the VM is
possible to fix it up. See below
> Maybe it works correctly if you set up all ten I/O windows to point
> to the same addresses? I don't have the documentation, so it might
> say that this is unsupported, but otherwise it may be worth trying.
The kirkwood docs say windows must never overlap.
> > > By far the easiest thing is to keep them as separate PCI busses and
> > > require DT to manage each one individually, address ranges and
> > > all. :(
> >
> > Does that mean that your earlier suggestion of emulating a PCI-to-PCI
> > bridge in software is no longer your preferred suggestion?
>
> If the child buses of that virtual bridge can't use the same I/O
> space window, that would require significant changes to the Linux
> PCI implementation, which does not sound right.
The default value for ARM's IO_SPACE_LIMIT is 1048575 so can fit 16
64k IO regions within PCI_IO_VIRT_BASE space. So far the marvell
drivers have assigned a unique 64k io region to each PEX.
The Linux PCI implementation has no problem with a > 16 bit IO
address, it just truncates it when it goes into configuration
registers, which matches what the HW does.
However, if you want to make each PEX into a compliant virtual root
port bridge then you have to live with PCIe rules, which means the
host bridge gets a 64k region and each virtual root port bridge gets
configured for a 4k aligned sub region.
So you have to match this to the 64k IO decoding windows that marvell
supports.
Here is a possible way using the VM subsystem:
- You reserve 10*64k of physical address space for bridge IO decoding
- The Host bridge and linux are told to map only 64k of IO from 0 to 0xFFFF
- When linux asks the root port bridge to allocate an IO range it is
aligned to a 4K boundary (PCIe requires this)
- The root port bridge grabs an mbus window and one of the 64k
physical blocks and sets that up.
- The root port bridge uses pci_ioremap_io to assign the virtual addresses
for the 4k aligned range that was assigned by linux to a
portion of the physical addresses within the 64k physical window.
eg:
PEX 0: Physical IO window 0x10000 -> 0x1ffff
PEX 1: Physical IO window 0x20000 -> 0x2ffff
PEX 0: Bridge is configured to claim IO range 0x0 -> 0xfff
PEX 1: Bridge is configured to claim IO range 0x3000 -> 0x3fff
pci_ioremap_io does:
PCI_IO_VIRT_BASE + 0 -> 0xfff == physical 0x10000 -> 0x10fff
PCI_IO_VIRT_BASE + 0x3000 -> 0x3fff == physical 0x23000 -> 0x23fff
So via pci_ioremap_io we stitch together a single 64k IO space across
all 10 PEX's using page granular portions of the physical 640K
allocated for the mbus mapping.
It would be a bit tidier if the PCIe core code could learn that these
particular root port bridges have a 64k alignment requirement for IO,
but I didn't see any easy way to do that .... ?
Regards,
Jason
next prev parent reply other threads:[~2012-12-13 22:27 UTC|newest]
Thread overview: 133+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-07 22:04 [RFC v1] PCIe support for the Armada 370 and Armada XP SoCs Thomas Petazzoni
2012-12-07 22:04 ` [RFC v1 01/16] lib: devres: don't enclose pcim_*() functions in CONFIG_HAS_IOPORT Thomas Petazzoni
2012-12-07 22:04 ` Thomas Petazzoni
2012-12-11 10:43 ` Arnd Bergmann
2012-12-11 10:43 ` Arnd Bergmann
2012-12-11 16:03 ` Thomas Petazzoni
2012-12-11 16:03 ` Thomas Petazzoni
2012-12-11 16:15 ` Arnd Bergmann
2012-12-11 16:15 ` Arnd Bergmann
2012-12-11 16:23 ` Russell King - ARM Linux
2012-12-11 16:23 ` Russell King - ARM Linux
2012-12-11 16:38 ` Thomas Petazzoni
2012-12-11 16:38 ` Thomas Petazzoni
2012-12-11 16:50 ` Russell King - ARM Linux
2012-12-11 16:50 ` Russell King - ARM Linux
2012-12-11 17:29 ` Alan Cox
2012-12-11 17:29 ` Alan Cox
2012-12-11 22:20 ` Arnd Bergmann
2012-12-11 22:20 ` Arnd Bergmann
2012-12-11 22:34 ` Arnd Bergmann
2012-12-11 22:34 ` Arnd Bergmann
2012-12-11 16:30 ` Thomas Petazzoni
2012-12-11 16:30 ` Thomas Petazzoni
2012-12-11 16:46 ` Russell King - ARM Linux
2012-12-11 16:46 ` Russell King - ARM Linux
2012-12-11 17:32 ` Alan Cox
2012-12-11 17:32 ` Alan Cox
2012-12-11 22:28 ` Arnd Bergmann
2012-12-11 22:28 ` Arnd Bergmann
2012-12-11 16:55 ` Russell King - ARM Linux
2012-12-11 16:55 ` Russell King - ARM Linux
2012-12-11 16:26 ` Russell King - ARM Linux
2012-12-11 16:26 ` Russell King - ARM Linux
2012-12-11 17:16 ` Alan Cox
2012-12-11 17:16 ` Alan Cox
2012-12-11 17:34 ` Russell King - ARM Linux
2012-12-11 17:34 ` Russell King - ARM Linux
2012-12-11 17:45 ` Alan Cox
2012-12-11 17:45 ` Alan Cox
2012-12-11 17:51 ` Russell King - ARM Linux
2012-12-11 17:51 ` Russell King - ARM Linux
2012-12-07 22:04 ` [RFC v1 02/16] clk: mvebu: create parent-child relation for PCIe clocks on Armada 370 Thomas Petazzoni
2012-12-07 22:04 ` [RFC v1 03/16] arm: plat-orion: introduce WIN_CTRL_ENABLE in address mapping code Thomas Petazzoni
2012-12-07 22:04 ` [RFC v1 04/16] arm: plat-orion: refactor the orion_disable_wins() function Thomas Petazzoni
2012-12-07 22:04 ` [RFC v1 05/16] arm: plat-orion: introduce orion_{alloc, free}_cpu_win() functions Thomas Petazzoni
2012-12-08 11:53 ` [RFC v1 05/16] arm: plat-orion: introduce orion_{alloc,free}_cpu_win() functions Andrew Lunn
2012-12-08 12:15 ` Thomas Petazzoni
2012-12-07 22:04 ` [RFC v1 06/16] arm: mvebu: add functions to alloc/free PCIe decoding windows Thomas Petazzoni
2012-12-07 22:04 ` [RFC v1 07/16] arm: plat-orion: make common PCIe code usable on mvebu Thomas Petazzoni
2012-12-07 22:04 ` [RFC v1 08/16] arm: mvebu: the core PCIe driver Thomas Petazzoni
2012-12-10 8:28 ` Andrew Lunn
2012-12-10 8:45 ` Thomas Petazzoni
2012-12-10 19:08 ` Jason Gunthorpe
2012-12-11 10:56 ` Arnd Bergmann
2012-12-12 15:58 ` Thomas Petazzoni
2012-12-12 21:51 ` Jason Gunthorpe
2012-12-13 14:58 ` Arnd Bergmann
2012-12-13 17:40 ` Jason Gunthorpe
2012-12-13 19:09 ` Thomas Petazzoni
2012-12-14 19:34 ` Rob Herring
2012-12-13 12:19 ` Arnd Bergmann
2012-12-13 17:54 ` Jason Gunthorpe
2012-12-13 19:12 ` Thomas Petazzoni
2012-12-13 21:46 ` Arnd Bergmann
2012-12-13 22:27 ` Jason Gunthorpe [this message]
2012-12-07 22:04 ` [RFC v1 09/16] arm: mvebu: PCIe support is now available on mvebu Thomas Petazzoni
2012-12-07 22:04 ` [RFC v1 10/16] arm: mvebu: add PCIe Device Tree informations for Armada 370 Thomas Petazzoni
2012-12-07 22:04 ` [RFC v1 11/16] arm: mvebu: add PCIe Device Tree informations for Armada XP Thomas Petazzoni
2012-12-07 22:04 ` [RFC v1 12/16] arm: mvebu: PCIe Device Tree informations for OpenBlocks AX3-4 Thomas Petazzoni
2012-12-07 22:04 ` [RFC v1 13/16] arm: mvebu: PCIe Device Tree informations for Armada XP DB Thomas Petazzoni
2012-12-07 22:04 ` [RFC v1 14/16] arm: mvebu: PCIe Device Tree informations for Armada 370 Mirabox Thomas Petazzoni
2012-12-07 22:04 ` [RFC v1 15/16] arm: mvebu: PCIe Device Tree informations for Armada 370 DB Thomas Petazzoni
2012-12-07 22:04 ` [RFC v1 16/16] arm: mvebu: update defconfig with PCI and USB support Thomas Petazzoni
2012-12-07 23:33 ` [RFC v1] PCIe support for the Armada 370 and Armada XP SoCs Jason Gunthorpe
2012-12-10 17:52 ` Stephen Warren
2012-12-10 18:05 ` Thomas Petazzoni
2012-12-10 18:16 ` Stephen Warren
2012-12-10 18:59 ` Thomas Petazzoni
2012-12-10 19:07 ` Jason Gunthorpe
2012-12-10 20:08 ` Stephen Warren
2012-12-10 18:44 ` Jason Gunthorpe
2012-12-10 19:03 ` Thomas Petazzoni
2012-12-10 19:18 ` Jason Gunthorpe
2012-12-12 16:04 ` Thomas Petazzoni
2012-12-12 20:09 ` Jason Gunthorpe
2012-12-16 13:02 ` Thierry Reding
2012-12-11 7:52 ` Thierry Reding
2012-12-11 21:21 ` Stephen Warren
2012-12-12 20:34 ` Thierry Reding
2012-12-12 22:30 ` Stephen Warren
2012-12-13 7:03 ` Thierry Reding
2012-12-13 8:04 ` Jason Gunthorpe
2012-12-13 8:23 ` Thierry Reding
2012-12-13 18:12 ` Stephen Warren
2012-12-13 20:42 ` Thierry Reding
2012-12-13 20:47 ` Jason Gunthorpe
2012-12-13 21:16 ` Thierry Reding
2012-12-14 10:05 ` Thierry Reding
2012-12-14 15:10 ` Thierry Reding
2012-12-14 17:27 ` Jason Gunthorpe
2012-12-16 12:33 ` Thierry Reding
2012-12-17 18:29 ` Jason Gunthorpe
2012-12-17 19:41 ` Thierry Reding
2012-12-18 2:10 ` Stephen Warren
2012-12-18 2:51 ` Jason Gunthorpe
2012-12-18 17:03 ` Stephen Warren
2012-12-20 15:32 ` Thierry Reding
2012-12-21 13:38 ` Jay Agarwal
2012-12-21 14:03 ` Thierry Reding
2012-12-22 14:50 ` Thomas Petazzoni
2012-12-28 21:06 ` Thierry Reding
2012-12-28 21:16 ` Thomas Petazzoni
2012-12-28 23:49 ` Stephen Warren
2012-12-29 8:09 ` Thomas Petazzoni
2012-12-31 16:40 ` Stephen Warren
2012-12-29 9:33 ` Thierry Reding
2012-12-31 16:44 ` Stephen Warren
2013-01-02 20:09 ` Jason Gunthorpe
2013-01-03 14:20 ` Thierry Reding
2012-12-28 23:51 ` Stephen Warren
2012-12-18 7:32 ` Thierry Reding
2013-01-03 14:39 ` Thierry Reding
2013-01-03 14:39 ` Thierry Reding
2013-01-03 15:00 ` Bjorn Helgaas
2013-01-03 15:00 ` Bjorn Helgaas
2013-01-03 15:11 ` Thierry Reding
2013-01-03 15:11 ` Thierry Reding
2013-01-03 15:09 ` Thomas Petazzoni
2013-01-03 15:09 ` Thomas Petazzoni
2013-01-03 15:56 ` Arnd Bergmann
2013-01-03 15:56 ` Arnd Bergmann
2013-01-03 16:01 ` Thierry Reding
2013-01-03 16:01 ` Thierry Reding
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=20121213222700.GA8129@obsidianresearch.com \
--to=jgunthorpe@obsidianresearch.com \
--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 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.