]> www.infradead.org Git - users/dwmw2/linux.git/commit
ACPI / hotplug / PCI: Check presence of slot itself in get_slot_status()
authorMika Westerberg <mika.westerberg@linux.intel.com>
Mon, 12 Feb 2018 10:55:23 +0000 (13:55 +0300)
committerSasha Levin <alexander.levin@microsoft.com>
Wed, 23 May 2018 01:36:32 +0000 (21:36 -0400)
commita72042114282da974f8e7547a045af421d65bb35
tree6077397f2c0200c25ffe3eac9c34ee2cf375f823
parent291208f503c049ec062dfbb06f6e2ff332ba0f09
ACPI / hotplug / PCI: Check presence of slot itself in get_slot_status()

[ Upstream commit 13d3047c81505cc0fb9bdae7810676e70523c8bf ]

Mike Lothian reported that plugging in a USB-C device does not work
properly in his Dell Alienware system.  This system has an Intel Alpine
Ridge Thunderbolt controller providing USB-C functionality.  In these
systems the USB controller (xHCI) is hotplugged whenever a device is
connected to the port using ACPI-based hotplug.

The ACPI description of the root port in question is as follows:

  Device (RP01)
  {
      Name (_ADR, 0x001C0000)

      Device (PXSX)
      {
          Name (_ADR, 0x02)

          Method (_RMV, 0, NotSerialized)
          {
              // ...
          }
      }

Here _ADR 0x02 means device 0, function 2 on the bus under root port (RP01)
but that seems to be incorrect because device 0 is the upstream port of the
Alpine Ridge PCIe switch and it has no functions other than 0 (the bridge
itself).  When we get ACPI Notify() to the root port resulting from
connecting a USB-C device, Linux tries to read PCI_VENDOR_ID from device 0,
function 2 which of course always returns 0xffffffff because there is no
such function and we never find the device.

In Windows this works fine.

Now, since we get ACPI Notify() to the root port and not to the PXSX device
we should actually start our scan from there as well and not from the
non-existent PXSX device.  Fix this by checking presence of the slot itself
(function 0) if we fail to do that otherwise.

While there use pci_bus_read_dev_vendor_id() in get_slot_status(), which is
the recommended way to read Device and Vendor IDs of devices on PCI buses.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=198557
Reported-by: Mike Lothian <mike@fireburn.co.uk>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: stable@vger.kernel.org
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
drivers/pci/hotplug/acpiphp_glue.c