Skip to content

Commit 977509f

Browse files
committed
PCI: Apply _HPX settings only to relevant devices
Previously we didn't check the type of device before trying to apply Type 1 (PCI-X) or Type 2 (PCIe) Setting Records from _HPX. We don't support PCI-X Setting Records, so this was harmless, but the warning was useless. We do support PCIe Setting Records, and we didn't check whether a device was PCIe before applying settings. I don't think anything bad happened on non-PCIe devices because pcie_capability_clear_and_set_word(), pcie_cap_has_lnkctl(), etc., would fail before doing any harm. But it's ugly to depend on those internals. Check the device type before attempting to apply Type 1 and Type 2 Setting Records (Type 0 records are applicable to PCI, PCI-X, and PCIe devices). A side benefit is that this prevents useless "not supported" warnings when a BIOS supplies a Type 1 (PCI-X) Setting Record and we try to apply it to every single device: pci 0000:00:00.0: PCI-X settings not supported After this patch, we'll get the warning only when a BIOS supplies a Type 1 record and we have a PCI-X device to which it should be applied. Link: https://bugzilla.kernel.org/show_bug.cgi?id=187731 Signed-off-by: Bjorn Helgaas <[email protected]>
1 parent 7ce7d89 commit 977509f

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

drivers/pci/probe.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,8 +1554,16 @@ static void program_hpp_type0(struct pci_dev *dev, struct hpp_type0 *hpp)
15541554

15551555
static void program_hpp_type1(struct pci_dev *dev, struct hpp_type1 *hpp)
15561556
{
1557-
if (hpp)
1558-
dev_warn(&dev->dev, "PCI-X settings not supported\n");
1557+
int pos;
1558+
1559+
if (!hpp)
1560+
return;
1561+
1562+
pos = pci_find_capability(dev, PCI_CAP_ID_PCIX);
1563+
if (!pos)
1564+
return;
1565+
1566+
dev_warn(&dev->dev, "PCI-X settings not supported\n");
15591567
}
15601568

15611569
static bool pcie_root_rcb_set(struct pci_dev *dev)
@@ -1581,6 +1589,9 @@ static void program_hpp_type2(struct pci_dev *dev, struct hpp_type2 *hpp)
15811589
if (!hpp)
15821590
return;
15831591

1592+
if (!pci_is_pcie(dev))
1593+
return;
1594+
15841595
if (hpp->revision > 1) {
15851596
dev_warn(&dev->dev, "PCIe settings rev %d not supported\n",
15861597
hpp->revision);

0 commit comments

Comments
 (0)