linux-brain/drivers/pci
Bjorn Helgaas 7c03845382 PCI: Move Apex Edge TPU class quirk to fix BAR assignment
commit 0a8f41023e8a3c100b3dc458ed2da651bf961ead upstream.

Some Google Apex Edge TPU devices have a class code of 0
(PCI_CLASS_NOT_DEFINED).  This prevents the PCI core from assigning
resources for the Apex BARs because __dev_sort_resources() ignores
classless devices, host bridges, and IOAPICs.

On x86, firmware typically assigns those resources, so this was not a
problem.  But on some architectures, firmware does *not* assign BARs, and
since the PCI core didn't do it either, the Apex device didn't work
correctly:

  apex 0000:01:00.0: can't enable device: BAR 0 [mem 0x00000000-0x00003fff 64bit pref] not claimed
  apex 0000:01:00.0: error enabling PCI device

f390d08d8b ("staging: gasket: apex: fixup undefined PCI class") added a
quirk to fix the class code, but it was in the apex driver, and if the
driver was built as a module, it was too late to help.

Move the quirk to the PCI core, where it will always run early enough that
the PCI core will assign resources if necessary.

Link: https://lore.kernel.org/r/CAEzXK1r0Er039iERnc2KJ4jn7ySNUOG9H=Ha8TD8XroVqiZjgg@mail.gmail.com
Fixes: f390d08d8b ("staging: gasket: apex: fixup undefined PCI class")
Reported-by: Luís Mendes <luis.p.mendes@gmail.com>
Debugged-by: Luís Mendes <luis.p.mendes@gmail.com>
Tested-by: Luis Mendes <luis.p.mendes@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-02 17:25:52 +02:00
..
controller PCI: iproc: Apply quirk_paxc_bridge() for module as well as built-in 2020-02-24 08:34:41 +01:00
endpoint PCI: endpoint: Fix for concurrent memory allocation in OB address region 2020-04-17 10:48:46 +02:00
hotplug PCI: pciehp: Fix indefinite wait on sysfs requests 2020-04-17 10:48:45 +02:00
pcie PCI/ASPM: Allow re-enabling Clock PM 2020-04-29 16:31:16 +02:00
switch PCI/switchtec: Fix init_completion race condition with poll_wait() 2020-04-17 10:48:40 +02:00
access.c Merge branch 'pci/vpd' 2018-04-04 13:28:40 -05:00
ats.c PCI: Enable PASID only if entire path supports End-End TLP prefixes 2018-06-30 14:10:03 -05:00
bus.c PCI: Fix is_added/is_busmaster race condition 2018-07-31 11:27:54 -05:00
ecam.c PCI: Add SPDX GPL-2.0 to replace GPL v2 boilerplate 2018-01-28 15:48:29 -06:00
host-bridge.c PCI: Tidy comments 2018-03-19 14:20:43 -05:00
iov.c PCI/IOV: Fix memory leak in pci_iov_add_virtfn() 2020-02-14 16:33:23 -05:00
irq.c PCI: Use IRQF_ONESHOT if pci_request_irq() called with no handler 2018-07-31 10:43:43 -05:00
Kconfig PCI: Collect all native drivers under drivers/pci/controller/ 2018-06-08 07:50:11 -05:00
Makefile PCI: Initialize endpoint library before controllers 2018-06-26 15:37:37 -05:00
mmap.c PCI: Tidy comments 2018-03-19 14:20:43 -05:00
msi.c PCI/MSI: Fix incorrect MSI-X masking on resume 2019-12-21 10:57:24 +01:00
of.c Merge branch 'pci/resource' 2018-08-15 14:59:01 -05:00
pci-acpi.c ACPI/PCI: PM: Add missing wakeup.flags.valid checks 2019-06-22 08:15:17 +02:00
pci-driver.c PM: ACPI/PCI: Resume all devices during hibernation 2020-01-27 14:50:59 +01:00
pci-label.c PCI: Tidy comments 2018-03-19 14:20:43 -05:00
pci-mid.c x86/cpu: Sanitize FAM6_ATOM naming 2019-05-14 19:17:53 +02:00
pci-pf-stub.c PCI/IOV: Add pci-pf-stub driver for PFs that only enable VFs 2018-04-24 16:47:16 -05:00
pci-stub.c PCI: Tidy comments 2018-03-19 14:20:43 -05:00
pci-sysfs.c PCI: sysfs: Ignore lockdep for remove attribute 2019-07-31 07:27:02 +02:00
pci.c PCI: Fix "try" semantics of bus and slot reset 2020-01-27 14:50:30 +01:00
pci.h PCI/ERR: Use slot reset if available 2019-11-20 18:47:13 +01:00
probe.c PCI: Init PCIe feature bits for managed host bridge alloc 2019-05-25 18:23:37 +02:00
proc.c proc: introduce proc_create_seq{,_data} 2018-05-16 07:23:35 +02:00
quirks.c PCI: Move Apex Edge TPU class quirk to fix BAR assignment 2020-05-02 17:25:52 +02:00
remove.c PCI/ASPM: Fix link_state teardown on device removal 2018-11-13 11:08:45 -08:00
rom.c PCI: Make pci_get_rom_size() static 2018-06-29 21:17:26 -05:00
search.c PCI: Tidy comments 2018-03-19 14:20:43 -05:00
setup-bus.c PCI: Don't disable bridge BARs when assigning bus resources 2020-02-14 16:33:23 -05:00
setup-irq.c PCI: Tidy comments 2018-03-19 14:20:43 -05:00
setup-res.c PCI: Remove messages about reassigning resources 2018-04-11 08:46:50 -05:00
slot.c PCI/ERR: Use slot reset if available 2019-11-20 18:47:13 +01:00
syscall.c PCI: Tidy comments 2018-03-19 14:20:43 -05:00
vc.c Merge branch 'pci/spdx' into next 2018-02-01 11:40:07 -06:00
vpd.c PCI/VPD: Check for VPD access completion before checking for timeout 2018-08-14 16:04:46 -05:00
xen-pcifront.c PCI: Tidy comments 2018-03-19 14:20:43 -05:00