Skip to content
Snippets Groups Projects
Commit 0a8f4102 authored by Bjorn Helgaas's avatar Bjorn Helgaas
Browse files

PCI: Move Apex Edge TPU class quirk to fix BAR assignment

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

f390d08d ("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: f390d08d ("staging: gasket: apex: fixup undefined PCI class")
Reported-by: default avatarLuís Mendes <luis.p.mendes@gmail.com>
Debugged-by: default avatarLuís Mendes <luis.p.mendes@gmail.com>
Tested-by: default avatarLuis Mendes <luis.p.mendes@gmail.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Cc: Todd Poynor <toddpoynor@google.com>
parent 8f3d9f35
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment