1
0
Fork 0
alistair23-linux/drivers/pci
Rafael J. Wysocki 60f75b8e97 ACPI: Try harder to resolve _ADR collisions for bridges
In theory, under a given ACPI namespace node there should be only
one child device object with _ADR whose value matches a given bus
address exactly.  In practice, however, there are systems in which
multiple child device objects under a given parent have _ADR matching
exactly the same address.  In those cases we use _STA to determine
which of the multiple matching devices is enabled, since some systems
are known to indicate which ACPI device object to associate with the
given physical (usually PCI) device this way.

Unfortunately, as it turns out, there are systems in which many
device objects under the same parent have _ADR matching exactly the
same bus address and none of them has _STA, in which case they all
should be regarded as enabled according to the spec.  Still, if
those device objects are supposed to represent bridges (e.g. this
is the case for device objects corresponding to PCIe ports), we can
try harder and skip the ones that have no child device objects in the
ACPI namespace.  With luck, we can avoid using device objects that we
are not expected to use this way.

Although this only works for bridges whose children also have ACPI
namespace representation, it is sufficient to address graphics
adapter detection issues on some systems, so rework the code finding
a matching device ACPI handle for a given bus address to implement
this idea.

Introduce a new function, acpi_find_child(), taking three arguments:
the ACPI handle of the device's parent, a bus address suitable for
the device's bus type and a bool indicating if the device is a
bridge and make it work as outlined above.  Reimplement the function
currently used for this purpose, acpi_get_child(), as a call to
acpi_find_child() with the last argument set to 'false' and make
the PCI subsystem use acpi_find_child() with the bridge information
passed as the last argument to it.  [Lan Tianyu notices that it is
not sufficient to use pci_is_bridge() for that, because the device's
subordinate pointer hasn't been set yet at this point, so use
hdr_type instead.]

This change fixes a regression introduced inadvertently by commit
33f767d (ACPI: Rework acpi_get_child() to be more efficient) which
overlooked the fact that for acpi_walk_namespace() "post-order" means
"after all children have been visited" rather than "on the way back",
so for device objects without children and for namespace walks of
depth 1, as in the acpi_get_child() case, the "post-order" callbacks
ordering is actually the same as the ordering of "pre-order" ones.
Since that commit changed the namespace walk in acpi_get_child() to
terminate after finding the first matching object instead of going
through all of them and returning the last one, it effectively
changed the result returned by that function in some rare cases and
that led to problems (the switch from a "pre-order" to a "post-order"
callback was supposed to prevent that from happening, but it was
ineffective).

As it turns out, the systems where the change made by commit
33f767d actually matters are those where there are multiple ACPI
device objects representing the same PCIe port (which effectively
is a bridge).  Moreover, only one of them, and the one we are
expected to use, has child device objects in the ACPI namespace,
so the regression can be addressed as described above.

References: https://bugzilla.kernel.org/show_bug.cgi?id=60561
Reported-by: Peter Wu <lekensteyn@gmail.com>
Tested-by: Vladimir Lalov <mail@vlalov.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: 3.9+ <stable@vger.kernel.org> # 3.9+
2013-08-07 22:55:00 +02:00
..
host PCI: mvebu: Disable prefetchable memory support in PCI-to-PCI bridge 2013-08-01 14:47:54 -06:00
hotplug PCI updates for v3.11: 2013-08-02 13:12:52 -07:00
pcie PCI: pciehp: Convert pciehp to be builtin only, not modular 2013-07-26 07:32:12 -06:00
Kconfig ARM SoC specific changes 2013-07-02 13:43:38 -07:00
Makefile pci: PCIe driver for Marvell Armada 370/XP systems 2013-05-20 19:18:44 +00:00
access.c PCI: Fix PCI Express Capability accessors for PCI_EXP_FLAGS 2013-02-15 11:46:24 -07:00
ats.c
bus.c PCI: Introduce pci_bus_{get|put}() to manage PCI bus reference count 2013-05-27 16:22:09 -06:00
host-bridge.c
hotplug-pci.c
htirq.c
ioapic.c PCI: Convert ioapic.c to module_pci_driver 2013-05-27 17:05:28 -06:00
iov.c Merge branch 'pci/jiang-bus-lock-v3' into next 2013-06-14 17:47:46 -06:00
irq.c
msi.c PCI: Allocate only as many MSI vectors as requested by driver 2013-05-28 11:31:16 -06:00
of.c
pci-acpi.c ACPI: Try harder to resolve _ADR collisions for bridges 2013-08-07 22:55:00 +02:00
pci-driver.c PM / Runtime: Rework the "runtime idle" helper routine 2013-06-03 21:49:52 +02:00
pci-label.c
pci-stub.c
pci-sysfs.c Merge branch 'pci/jiang-iov-fixes' into next 2013-06-05 12:27:19 -06:00
pci.c pci: add pcibios_release_device 2013-06-26 21:10:05 +02:00
pci.h PCI / ACPI: Use boot-time resource allocation rules during hotplug 2013-06-23 01:01:35 +02:00
probe.c pci: add pcibios_release_device 2013-06-26 21:10:05 +02:00
proc.c pci/proc: switch to fixed_size_llseek() 2013-06-29 12:57:48 +04:00
quirks.c Merge branch 'pci/misc' into next 2013-06-26 15:55:52 -06:00
remove.c PCI: Add pcibios hooks for adding and removing PCI buses 2013-04-12 15:38:25 -06:00
rom.c PCI: Add PCI ROM helper for platform-provided ROM images 2013-03-26 17:19:41 -06:00
search.c PCI: Fix reference count leak in pci_dev_present() 2013-01-25 13:49:27 -07:00
setup-bus.c PCI: Retry allocation of only the resource type that failed 2013-07-26 07:32:20 -06:00
setup-irq.c
setup-res.c PCI: Remove unused variables 2013-04-15 10:56:27 -06:00
slot.c PCI: Warn about failures instead of "must_check" functions 2013-04-17 10:21:12 -06:00
syscall.c
vpd.c
xen-pcifront.c xen/pcifront: Deal with toolstack missing 'XenbusStateClosing' state. 2013-06-14 12:28:59 -04:00