Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1217782
| From | "Sean O. Stalley" <sean.stalley@intel.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 2/2] PCI: Add support for Enhanced Allocation devices |
| Date | 2015-09-02 20:00 +0200 |
| Message-ID | <q4kuf-3Oz-35@gated-at.bofh.it> (permalink) |
| References | <pZBvI-2L0-7@gated-at.bofh.it> <pZBvI-2L0-5@gated-at.bofh.it> <q430l-49z-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Thanks for taking a look Yinghai.
On Tue, Sep 01, 2015 at 04:14:08PM -0700, Yinghai Lu wrote:
> On Thu, Aug 20, 2015 at 9:59 AM, Sean O. Stalley <sean.stalley@intel.com> wrote:
> > Add support for devices using Enhanced Allocation entries instead of BARs.
> > This patch allows the kernel to parse the EA Extended Capability structure
> > in PCI configspace and claim the BAR-equivalent resources.
> >
> > Signed-off-by: Sean O. Stalley <sean.stalley@intel.com>
> > ---
> > drivers/pci/pci.c | 219 ++++++++++++++++++++++++++++++++++++++++++++++++++++
> > drivers/pci/pci.h | 1 +
> > drivers/pci/probe.c | 3 +
> > 3 files changed, 223 insertions(+)
> >
> > diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> > index 0008c95..c8217a8 100644
> > --- a/drivers/pci/pci.c
> > +++ b/drivers/pci/pci.c
> ...
> > +
> > +/* Read an Enhanced Allocation (EA) entry */
> > +static int pci_ea_read(struct pci_dev *dev, int offset)
> > +{
> ...
> > + res->name = pci_name(dev);
> > + res->start = start;
> > + res->end = end;
> > + res->flags = flags;
> > +
> > + pci_ea_claim_resource(dev, res);
> > +
> > +out:
> > + return offset + ent_size;
> > +}
> > +
> > +/* Enhanced Allocation Initalization */
> > +void pci_ea_init(struct pci_dev *dev)
> > +{
> ...
> > +
> > + for (i = 0; i < num_ent; ++i) {
> > + /* parse each EA entry */
> > + dev_dbg(&dev->dev, "%s: parsing entry %i...\n", __func__, i);
> > + offset = pci_ea_read(dev, offset);
> > + }
> > +}
> > +
> > static void pci_add_saved_cap(struct pci_dev *pci_dev,
> > struct pci_cap_saved_state *new_cap)
> > {
>
> > diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> > index cefd636..4cadf35 100644
> > --- a/drivers/pci/probe.c
> > +++ b/drivers/pci/probe.c
> > @@ -1522,6 +1522,9 @@ static struct pci_dev *pci_scan_device(struct pci_bus *bus, int devfn)
> >
> > static void pci_init_capabilities(struct pci_dev *dev)
> > {
> > + /* Enhanced Allocation */
> > + pci_ea_init(dev);
> > +
> > /* MSI/MSI-X list */
> > pci_msi_init_pci_dev(dev);
> >
>
> Should not call pci_ea_claim_resource() that early.
Out of curiosity, why shouldn't resources be claimed that early?
EA resources are fixed by hardware. They are always there & will never move.
>
> For x86 and other arches, we call
> pcibios_resource_survey/pcibios_allocate_bus_resouce/pcibios_allocate_resources
> quite late.
Would it be better to modify pci_claim_resource() to support EA instead of adding pci_ea_claim_resource()?
That way, EA entries would be claimed at the same time as traditional BARs.
-Sean
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 2/2] PCI: Add support for Enhanced Allocation devices "Sean O. Stalley" <sean.stalley@intel.com> - 2015-08-20 19:10 +0200
Re: [PATCH 2/2] PCI: Add support for Enhanced Allocation devices Yinghai Lu <yinghai@kernel.org> - 2015-09-02 01:20 +0200
Re: [PATCH 2/2] PCI: Add support for Enhanced Allocation devices "Sean O. Stalley" <sean.stalley@intel.com> - 2015-09-02 20:00 +0200
Re: [PATCH 2/2] PCI: Add support for Enhanced Allocation devices Bjorn Helgaas <bhelgaas@google.com> - 2015-09-02 21:30 +0200
Re: [PATCH 2/2] PCI: Add support for Enhanced Allocation devices "Sean O. Stalley" <sean.stalley@intel.com> - 2015-09-02 22:10 +0200
Re: [PATCH 2/2] PCI: Add support for Enhanced Allocation devices Bjorn Helgaas <bhelgaas@google.com> - 2015-09-02 23:30 +0200
Re: [PATCH 2/2] PCI: Add support for Enhanced Allocation devices "Sean O. Stalley" <sean.stalley@intel.com> - 2015-09-03 02:40 +0200
Re: [PATCH 2/2] PCI: Add support for Enhanced Allocation devices Bjorn Helgaas <bhelgaas@google.com> - 2015-09-03 16:50 +0200
Re: [PATCH 2/2] PCI: Add support for Enhanced Allocation devices "Sean O. Stalley" <sean.stalley@intel.com> - 2015-09-03 20:30 +0200
csiph-web