From: Chris Metcalf <cmetcalf@tilera.com>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: <linux-kernel@vger.kernel.org>, <linux-pci@vger.kernel.org>,
Marek Szyprowski <m.szyprowski@samsung.com>
Subject: Re: [PATCH 3/3] tile pci: enable IOMMU to support DMA for legacy devices
Date: Wed, 18 Jul 2012 16:10:28 -0400 [thread overview]
Message-ID: <50071834.2030408@tilera.com> (raw)
In-Reply-To: <CAErSpo6XEwQcVFUBHAZO6R2wZvCSmG3w1G6va7FRcnrbc=nAfg@mail.gmail.com>
On 7/18/2012 12:50 PM, Bjorn Helgaas wrote:
> On Wed, Jul 18, 2012 at 10:15 AM, Chris Metcalf <cmetcalf@tilera.com> wrote:
>> On 7/13/2012 1:25 PM, Bjorn Helgaas wrote:
>>> On Fri, Jul 13, 2012 at 11:52:11AM -0400, Chris Metcalf wrote:
>>>> We use the same pci_iomem_resource for different domains or host
>>>> bridges, but the MMIO apertures for each bridge do not overlap because
>>>> non-overlapping resource ranges are allocated for each domains.
>>> You should not use the same pci_iomem_resource for different host bridges
>>> because that tells the PCI core that everything in pci_iomem_resource is
>>> available for devices under every host bridge, which I doubt is the case.
>>>
>>> The fact that your firmware assigns non-overlapping resources is good and
>>> works now, but if the kernel ever needs to allocate resources itself,
>> Actually, we were not using any firmware. It was indeed the kernel which
>> allocates resources from the shared pci_iomem_resource.
> Wow. I wonder how that managed to work. Is there some information
> that would have helped the PCI core do the right allocations? Or
> maybe the host bridges forward everything they receive to PCI,
> regardless of address, and any given MMIO address is only routed to
> one of the host bridges because of the routing info in the page
> tables?
Since each host bridge contains non-overlapping ranges in its bridge config
header, ioremap() locates the right host bridge for the target PCI resource
address and programs the host bridge info into the MMIO mapping. The end
result is the MMIO address is routed to the right host bridge. On Tile
processors, different host bridges are like separate IO devices, in
completely separate domains.
> I guess in that case, the "apertures" would basically be
> defined by the page tables, not by the host bridges. But that still
> doesn't explain how we would assign non-overlapping ranges to each
> domain.
Since all domains share the single resource, allocate_resource() "allocate
empty slot in the resource tree", giving non-overlapping ranges to each
devices.
Just to confirm, I'm assuming I'll ask Linus to pull this code out of my
tile tree when the merge window opens, right? Would you like me to add
your name to the commit as acked or reviewed? Thanks!
--
Chris Metcalf, Tilera Corp.
http://www.tilera.com
next prev parent reply other threads:[~2012-07-18 20:14 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-13 18:46 [PATCH 1/3] tilegx pci: support I/O to arbitrarily-cached pages Chris Metcalf
2012-06-13 18:46 ` [PATCH 2/3] arch/tile: enable ZONE_DMA for tilegx Chris Metcalf
2012-06-15 19:23 ` [PATCH 3/3] tile pci: enable IOMMU to support DMA for legacy devices Chris Metcalf
2012-06-22 11:24 ` Bjorn Helgaas
2012-07-13 15:52 ` Chris Metcalf
2012-07-13 17:25 ` Bjorn Helgaas
2012-07-18 16:15 ` Chris Metcalf
2012-07-18 16:50 ` Bjorn Helgaas
2012-07-18 20:10 ` Chris Metcalf [this message]
2012-07-18 20:30 ` Bjorn Helgaas
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=50071834.2030408@tilera.com \
--to=cmetcalf@tilera.com \
--cc=bhelgaas@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=m.szyprowski@samsung.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