coreboot-kgpe-d16/src/device
Nico Huber 968ef75988 pciexp_device: Rewrite LTR configuration
I was bugged by spurious "Failed to enable LTR" messages for years.
Looking at the the current algorithm, it is flawed in multiple ways:

* It looks like the author didn't know they implemented a
  recursive algorithm (pciexp_enable_ltr()) inside another
  recursive algorithm (pciexp_scan_bridge()). Thus, at every
  tree level, everything is run again for the whole sub-
  tree.

* LTR is enabled no matter if `.set_ltr_max_latencies` is
  implemented or not. Leaving the endpoints' LTR settings
  at 0: They are told to always report zero tolerance.
  In theory, depending on the root-complex implementation,
  this may result in higher power consumption than without
  LTR messages.

* `.set_ltr_max_latencies` is only considered for the direct
  parent of a device. Thus, even with it implemented, an
  endpoint below a (non-root) bridge may suffer from the 0
  settings as described above.

* Due to the double-recursive nature, LTR is enabled starting
  with the endpoints, then moving up the tree, while the PCIe
  spec tells us to do it in the exact opposite order.

With the current implementation of pciexp_scan_bridge(), it is
hard to hook anything in that runs for each device from top to
bottom. So the proposed solution still adds some redundancy:

First, for every device that uses pciexp_scan_bus(), we enable
LTR if possible (see below). Then, when returning from the bus-
scanning recursion, we enable LTR for every device and configure
the maximum latencies (if supported). The latter runs again on
all bridges, because it's hard to know if pciexp_scan_bus() was
used for them.

When to enable LTR:

* For all devices that implement `.set_ltr_max_latencies`.
* For all devices below a bridge that has it enabled already.

Change-Id: I2c5b8658f1fc8cec15e8b0824464c6fc9bee7e0e
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/51328
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2021-03-15 06:04:38 +00:00
..
dram device/dram: Move SPD manufacturer names out of arch/x86 2021-02-16 10:43:11 +00:00
oprom device/oprom/include/x86emu/fpu_regs.h: Fix lint error 2021-02-01 08:46:11 +00:00
azalia_device.c device/azalia_device: Add mainboard hook to program codecs 2021-02-10 07:21:11 +00:00
cardbus_device.c src: Never set ISA Enable on PCI bridges 2020-07-28 10:54:02 +00:00
cpu_device.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
device.c device/device.c: Rename .disable to .vga_disable 2021-02-24 11:28:16 +00:00
device_const.c device: correct code style 2021-02-05 09:42:19 +00:00
device_util.c device: correct code style 2021-02-05 09:42:19 +00:00
gpio.c device + util/sconfig: introduce new device gpio 2020-12-28 17:47:04 +00:00
i2c.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
i2c_bus.c device: correct code style 2021-02-05 09:42:19 +00:00
Kconfig device: Add unit to Kconfig option name: PRE_GRAPHICS_DELAY_MS 2021-02-15 17:05:18 +00:00
Makefile.inc device + util/sconfig: introduce new device gpio 2020-12-28 17:47:04 +00:00
mmio.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
pci_class.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
pci_device.c device/pciexp_device.c: Remove CPP guarding 2021-03-14 19:27:18 +00:00
pci_early.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
pci_ops.c device: Move pci_dev_is_wake_source function 2020-11-09 07:37:57 +00:00
pci_rom.c soc/amd/common/block/graphics/graphics: GOP: load VBIOS 2021-03-13 02:44:40 +00:00
pciexp_device.c pciexp_device: Rewrite LTR configuration 2021-03-15 06:04:38 +00:00
pcix_device.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
pnp_device.c device/pnp: add register PNP_IO4 2020-12-28 21:01:08 +00:00
resource_allocator_common.c src/device: Remove unused <console/console.h> 2021-02-15 10:48:28 +00:00
resource_allocator_v3.c device/resource_allocator_v3: Do not set IORESOURCE_ASSIGNED for size 0 resource 2020-05-26 15:15:54 +00:00
resource_allocator_v4.c device/resource_allocator_v4: Improve the logging in resource allocator 2020-05-28 09:43:44 +00:00
root_device.c device: Export enable_static_device() function 2020-10-21 15:35:24 +00:00
smbus_ops.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
software_i2c.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
xhci.c device/xhci.c: Remove repeated word 2021-01-18 07:33:25 +00:00