From: Grant Grundler <grundler@parisc-linux.org>
To: linux-hotplug@vger.kernel.org
Subject: Re: understanding PCI enumeration for hot-plug
Date: Fri, 12 Feb 2010 15:56:14 +0000 [thread overview]
Message-ID: <20100212155614.GC28684@lackof.org> (raw)
In-Reply-To: <8506939B503B404A84BBB12293FC45F606A74F8D@emailbng3.jnpr.net>
On Fri, Feb 12, 2010 at 09:52:59AM +0530, Rajat Jain wrote:
>
> Hello,
>
> I need to support hot-plug in a system where I know in advance the
> devices that can be hot-plugged into the system.
>
> I'm trying to understand the PCI enumeration / re-enumeration process in
> the context of hot-plug / unplug. I'm assuming the case where the
> firmware is really dumb and the kernel needs to manage / allocate all
> PCI resources.
>
> I'm going through the PCI specs (and PCI-to-PCI bridge specs) and here
> is what I think needs to be done when ever PCI / PCIe devices are added
> / removed from the system. I would appreciate if some one could please
> confirm my understanding and point out if I am missing something:
Interrupt routing. Parent Bridge will have some associated entries for IRQs.
If using MSI or MSI-X (preferred), can avoid IRQ lines.
> PCI-REOURCE / BUS-NUMBER MGMT
> ==============>
> [IFF NECESSARY] PCI configuration space of all the bridges needs to be
> re-written, right from the immediate parent of the device being removed
> until the host bridge in order to ensure that:
>
> a) Each parent bridge has secondary and subordinate bus range set so as
> to include all the bus numbers below it. This is required to forward
> configuration transactions.
>
> b) Each parent bridge has IO base and IO limit set so as to include all
> the IO address space below it.
>
> c) Each parent bridge has Memory base and Memory limit set so as to
> include all the Memory address space below it.
>
> d) Each parent bridge has Pre-fetch Memory base and Memory limit set so
> as to include all the Pre-fetch Memory address space below it.
>
> Note-1: The reason a/b/c/d above are marked "IFF NECESSARY" is that we
> can avoid all the above work if we can pre-allocate the above resources
> for future devices, and set these parent bridges ranges accordingly.
>
> IN other words, consider a system where we know in advance, the PCI
> device tree on the devices that can be hot-plugged into the system. Here
> we can set aside PCI bus numbers and IO / Mem / Prefetchable memory
> ranges for them in advance. And thus configure the parent bridges to
> already include those ranges. Thus later when the devices are added,
> none of the parent bridges will need to be re-programmed. Is my
> understanding correct?
I think so.
> DEVICE DETECTION & INITIALIZATION
> ================>
> e) Upon detection of the device (By attempting to read its config
> space), the most important item is to program its BARs to appropriate
> address spaces as requested by the device. The BARs need to be
> programmed such that they are included in the appropriate Base / limit
> registers of all the bridges upstream. Correct?
Yes.
> Again, if we've used the strategy specified in Note-1, we can simply use
> the range we've already aside for this device.
>
>
> MY QUESTIONS
> ======> 1) Is my above understanding correct?
>
> 2) Does anything else also needs to be done in order to make it work?
>
> 3) As I said I'm trying to make it fast and optimize for the case where
> I know the devices [thus the PCI tree] that can be plugged in. Will my
> strategy specified in Note-1 work? So all I need to configure is my
> newly detected devices / bridges and not the existing ones...
It's a bit hackish, but it should work.
grant
>
> Thanks in Advance,
>
> Rajat Jain
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
prev parent reply other threads:[~2010-02-12 15:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-12 4:34 understanding PCI enumeration for hot-plug Rajat Jain
2010-02-12 15:56 ` Grant Grundler [this message]
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=20100212155614.GC28684@lackof.org \
--to=grundler@parisc-linux.org \
--cc=linux-hotplug@vger.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).