Attention is currently required from: Angel Pons, Arthur Heymans, Felix Held, Krystian Hebel, Nico Huber, Patrick Rudolph.
Michał Żygowski has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/77338?usp=email )
Change subject: device/pciexp_device.c: Fix setting Max Payload Size ......................................................................
Patch Set 10:
(1 comment)
File src/device/pciexp_device.c:
https://review.coreboot.org/c/coreboot/+/77338/comment/9d48df88_7786efb1 : PS10, Line 709: pciexp_configure_max_payload
dev == dev->bus->dev is how we identify the root device. Don't ask […]
This is what I did:
```C static bool pciexp_device_is_root_port(struct device *dev) { u16 flags; u16 cap = pci_find_capability(dev, PCI_CAP_ID_PCIE); if (!cap) return false;
flags = pci_read_config16(dev, cap + PCI_EXP_FLAGS) & PCI_EXP_FLAGS_TYPE; return ((flags >> 4) == PCI_EXP_TYPE_ROOT_PORT); }
static void pciexp_configure_max_payload_size(struct device *dev) { unsigned int root_cap, cap; struct device *pdev = dev;
/* Walk up the chain and adjust MaxPayload to the minimum supported in the chain */ while (pdev->bus && pdev->bus->dev && !pciexp_device_is_root_port(pdev)) { cap = pci_find_capability(pdev, PCI_CAP_ID_PCIE); root_cap = pci_find_capability(pdev->bus->dev, PCI_CAP_ID_PCIE); printk(BIOS_DEBUG, "Setting Max Paylaod Size for %s device and %s parent\n", dev_path(pdev), dev_path(pdev->bus->dev)); if (!cap || !root_cap) return;
if (pdev->bus->dev == pdev || pdev->bus->dev->path.type != DEVICE_PATH_PCI) break;
/* Adjust Max_Payload_Size */ pciexp_set_max_payload_size(pdev->bus->dev, root_cap, pdev, cap); pdev = pdev->bus->dev; }; }
static void pciexp_tune_dev(struct device *dev) { ... pciexp_configure_max_payload_size(dev);
pciexp_configure_ltr(root, root_cap, dev, cap); }
```
What I get in cbmem log as a result:
https://paste.dasharo.com/?d1b97978265f7ede#ABLvEctaviQN4acGhVKMgURvSWaxH43W...
As one can see, the pciexp_set_max_payload_size does not get called for the root port as it should (because pdev->bus->dev never points to a parent bridge/root port).