linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/9] PCI: Use IORESOURCE_UNSET for unassigned BARs
@ 2014-02-26 19:37 Bjorn Helgaas
  2014-02-26 19:37 ` [PATCH 1/9] resource: Add resource_contains() Bjorn Helgaas
                   ` (9 more replies)
  0 siblings, 10 replies; 25+ messages in thread
From: Bjorn Helgaas @ 2014-02-26 19:37 UTC (permalink / raw)
  To: linux-pci; +Cc: linux-kernel

I'm trying to unify the way we handle unassigned PCI BARs, i.e., resources
where we know the type and size, but we haven't assigned an address yet.
The PCI core and the various architectures don't really have a consistent
way of dealing with these.

Many places currently use "res->start == 0" to indicate unassigned
resources.  I don't think that's a good idea in general, because it's
possible for a resource to actually start at zero.  Zero is also a
perfectly good BAR value, especially for a host bridge that translates
addresses, so I want to support that, too.

The IORESOURCE_UNSET flag exists already, but is hardly used at all.  In
drivers/pci, we set it for an obscure error case, and clear it when
updating a BAR.  The microblaze and powerpc architectures use it the same
way I want to use it here: to indicate a resource with no assigned address.

Here's the outline of what this series does:

- Add resource_contains(): true iff r1 contains r2 (for minor cleanup)
- Make %pR print resource size, not address, when IORESOURCE_UNSET
- Stop advertising pci_find_parent_resource() for use in allocation
- Mark PCI resources IORESOURCE_UNSET when BIOS left decoding disabled
- Mark PCI resources IORESOURCE_UNSET while we're trying to assign addresses
- Don't enable PCI decoding when no address has been assigned to BARs

It might be too aggressive to ignore the initial value of a BAR and try to
reassign it when the BIOS left decoding disabled.  If the BIOS left
decoding *enabled*, we can have some confidence that the BAR value is
valid.  It's possible the BAR is also valid even if the BIOS turned off
decoding.  We could conceivably try to use BAR values that are inside
upstream bridge windows, even if the BAR was initially disabled.  But this
first pass just ignores the values in BARs that are disabled.

I welcome any comments :)

---

Bjorn Helgaas (9):
      resource: Add resource_contains()
      vsprintf: Add support for IORESOURCE_UNSET in %pR
      PCI: Remove pci_find_parent_resource() use for allocation
      PCI: Mark resources as IORESOURCE_UNSET if we can't assign them
      PCI: Don't clear IORESOURCE_UNSET when updating BAR
      PCI: Check IORESOURCE_UNSET before updating BAR
      PCI: Don't try to claim IORESOURCE_UNSET resources
      PCI: Ignore BAR contents when firmware left decoding disabled
      PCI: Don't enable decoding if BAR hasn't been assigned an address


 drivers/pci/host-bridge.c |    8 --------
 drivers/pci/pci.c         |   41 +++++++++++++++++++++++++----------------
 drivers/pci/probe.c       |    8 +++++++-
 drivers/pci/quirks.c      |    5 +++++
 drivers/pci/rom.c         |    2 ++
 drivers/pci/setup-res.c   |   37 +++++++++++++++++++++++++------------
 include/linux/ioport.h    |   12 +++++++++++-
 kernel/resource.c         |    8 ++------
 lib/vsprintf.c            |   13 +++++++++----
 9 files changed, 86 insertions(+), 48 deletions(-)

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2014-03-21 20:40 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-26 19:37 [PATCH 0/9] PCI: Use IORESOURCE_UNSET for unassigned BARs Bjorn Helgaas
2014-02-26 19:37 ` [PATCH 1/9] resource: Add resource_contains() Bjorn Helgaas
2014-02-26 19:37 ` [PATCH 2/9] vsprintf: Add support for IORESOURCE_UNSET in %pR Bjorn Helgaas
2014-02-26 19:37 ` [PATCH 3/9] PCI: Remove pci_find_parent_resource() use for allocation Bjorn Helgaas
2014-02-26 19:37 ` [PATCH 4/9] PCI: Mark resources as IORESOURCE_UNSET if we can't assign them Bjorn Helgaas
2014-02-26 19:37 ` [PATCH 5/9] PCI: Don't clear IORESOURCE_UNSET when updating BAR Bjorn Helgaas
2014-02-26 19:37 ` [PATCH 6/9] PCI: Check IORESOURCE_UNSET before " Bjorn Helgaas
2014-02-26 19:37 ` [PATCH 7/9] PCI: Don't try to claim IORESOURCE_UNSET resources Bjorn Helgaas
2014-02-26 19:37 ` [PATCH 8/9] PCI: Ignore BAR contents when firmware left decoding disabled Bjorn Helgaas
2014-03-13  8:51   ` Ming Lei
2014-03-13 16:08     ` Bjorn Helgaas
2014-03-14  1:48       ` Ming Lei
2014-03-18  0:27         ` Bjorn Helgaas
2014-03-19  3:32           ` Ming Lei
2014-03-19  4:52             ` Ming Lei
2014-03-19 16:45               ` Bjorn Helgaas
2014-03-20  1:32                 ` Ming Lei
2014-03-21 20:07                   ` Bjorn Helgaas
2014-03-21 20:25                     ` Sasha Levin
2014-03-21 20:40                       ` Bjorn Helgaas
2014-03-19 18:54   ` Bjorn Helgaas
2014-03-19 21:16     ` Bjorn Helgaas
2014-03-19 21:23       ` Sasha Levin
2014-02-26 19:38 ` [PATCH 9/9] PCI: Don't enable decoding if BAR hasn't been assigned an address Bjorn Helgaas
2014-03-04 20:53 ` [PATCH 0/9] PCI: Use IORESOURCE_UNSET for unassigned BARs Bjorn Helgaas

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).