From: Gavin Shan <shangw@linux.vnet.ibm.com>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: yinghai@kernel.org, linuxppc-dev@ozlabs.org,
Ram Pai <linuxram@us.ibm.com>,
Gavin Shan <shangw@linux.vnet.ibm.com>,
linux-pci@vger.kernel.org
Subject: Re: [PATCH 05/15] pci: resource assignment based on p2p alignment
Date: Thu, 19 Jul 2012 15:24:17 +0800 [thread overview]
Message-ID: <20120719072417.GA10326@shangw.(null)> (raw)
In-Reply-To: <CAErSpo79HSj+8o9u6P689UEP9qPTUWrnuNPO3NDjErQa6EbhUg@mail.gmail.com>
On Wed, Jul 18, 2012 at 10:59:52AM -0600, Bjorn Helgaas wrote:
>On Tue, Jul 17, 2012 at 10:25 PM, Ram Pai <linuxram@us.ibm.com> wrote:
>> On Tue, Jul 17, 2012 at 11:14:51AM -0600, Bjorn Helgaas wrote:
>>> On Tue, Jul 17, 2012 at 4:38 AM, Benjamin Herrenschmidt
>>> <benh@kernel.crashing.org> wrote:
>>> > On Tue, 2012-07-17 at 18:03 +0800, Ram Pai wrote:
>>> >> Lets say we passed that 'type' flag to size the minimum
>>> >> alignment constraints for that b_res. And window_alignment(bus,
>>> >> type) of your platform used that 'type' information to
>>> >> determine whether to use the alignment constraints of 32-bit
>>> >> window or 64-bit window.
>>> >>
>>> >> However, later when the b_res is actually allocated a resource,
>>> >> the pci_assign_resource() has no idea whether to allocate 32-bit
>>> >> window resource or 64-bit window resource, because the 'type'
>>> >> information is not captured anywhere in b_res.
>>> >>
>>> >> You would basically have a disconnect between what is sized and
>>> >> what is allocated. Unless offcourse you pass that 'type' to
>>> >> the b_res->flags, which is currently not the case.
>>> >
>>> > Right, we ideally would need the core to query the alignment once per
>>> > "apertures" it tries as a candidate to allocate a given resource... but
>>> > that's for later.
>>> >
>>> > For now we can probably live with giving out the max of the minimum
>>> > alignment we support for M64 and our M32 segment size.
>>>
>>> We already know the aperture we're proposing to allocate from (the
>>> result of find_free_bus_resource()), don't we? What if we passed it
>>> to pcibios_window_alignment() along with the struct pci_bus *, e.g.:
>>>
>>> resource_size_t pcibios_window_alignment(struct pci_bus *bus, struct
>>> resource *window)
>>
>> Hmm..'struct resource *window' may not yet know which aperature it is
>> allocated from. Will it? We are still in the sizing process, the allocation will
>> be done much later.
>
>Of course, you're absolutely right; I had this backwards. In
>pbus_size_io/mem(), we do "b_res = find_free_bus_resource()", so b_res
>is a bus resource that matches the desired type (IO/MEM). This
>resource represents an aperture of the upstream bridge leading to the
>bus. I was thinking that b_res->start would contain address
>information that the arch could use to decide alignment.
>
>But at this point, in pbus_size_io/mem(), we set "b_res->start =
>min_align", so obviously b_res contains no information about the
>window base that will eventually be assigned. I think b_res is
>basically the *container* into which we'll eventually put the P2P
>aperture start/end, but here, we're using that container to hold the
>information about the size and alignment we need for that aperture.
>
>The fact that we deal with alignment in pbus_size_mem() and again in
>__pci_assign_resource() (via pcibios_align_resource) is confusing to
>me -- I don't have a clear idea of what sorts of alignment are done in
>each place. Could this powerpc alignment be done in
>pcibios_align_resource()? We do have the actual proposed address
>there, as well as the pci_dev.
>
If I understood correctly, it's a bit hard to put PowerPC alignment in
the function pcibios_align_resource(). The target of those patches is
to make those I/O and memory windows of p2p bridges aligned based on
the special requirement from specific platform, so that we can put
the corresponding PCI bus directed from the p2p bridge into separate
EEH segment. Unforunately, pcibios_align_resource() was implemented
based on individual bars (resources) and individual bars doesn't
have the alignment requirement under current situation :-)
Thanks,
Gavin
>Bjorn
>_______________________________________________
>Linuxppc-dev mailing list
>Linuxppc-dev@lists.ozlabs.org
>https://lists.ozlabs.org/listinfo/linuxppc-dev
>
next prev parent reply other threads:[~2012-07-19 7:24 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1342491799-30303-1-git-send-email-shangw@linux.vnet.ibm.com>
2012-07-17 3:40 ` [PATCH v6 0/7] minimal alignment for p2p bars Ram Pai
[not found] ` <1342491799-30303-6-git-send-email-shangw@linux.vnet.ibm.com>
2012-07-17 5:05 ` [PATCH 05/15] pci: resource assignment based on p2p alignment Ram Pai
2012-07-17 5:23 ` Ram Pai
[not found] ` <20120717053648.GA18497@shangw>
2012-07-17 5:57 ` Ram Pai
2012-07-17 9:16 ` Benjamin Herrenschmidt
2012-07-17 10:03 ` Ram Pai
2012-07-17 10:38 ` Benjamin Herrenschmidt
2012-07-17 17:14 ` Bjorn Helgaas
2012-07-18 4:25 ` Ram Pai
2012-07-18 16:59 ` Bjorn Helgaas
2012-07-19 7:24 ` Gavin Shan [this message]
[not found] ` <20120718010746.GA4238@shangw>
2012-07-18 5:02 ` Ram Pai
2012-07-18 4:28 ` Ram Pai
2012-06-29 6:47 [PATCH V5 0/7] minimal alignment for p2p bars Gavin Shan
[not found] ` <1342452631-21152-5-git-send-email-shangw@linux.vnet.ibm.com>
2012-07-17 0:47 ` [PATCH 05/15] pci: resource assignment based on p2p alignment 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='20120719072417.GA10326@shangw.(null)' \
--to=shangw@linux.vnet.ibm.com \
--cc=bhelgaas@google.com \
--cc=linux-pci@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=linuxram@us.ibm.com \
--cc=yinghai@kernel.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).