Skip to contentSkip to conversation

PCI: Don't try to read CLS from PCIe devices in pci_apply_final_quirks

PATCH In review Heiner Kallweit 2 participants 4 messages Dec 8, 2020 – Apr 1, 2021 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI: Don't try to read CLS from PCIe devices in pci_apply_final_quirks

Don't try to read CLS from PCIe devices in pci_apply_final_quirks(). This value has no meaning for PCIe.

---
 drivers/pci/quirks.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/pci/quirks.c +3 -0
index d9cbe69b8..ac8ce9118 100644
@@ -163,6 +163,9 @@ static int __init pci_apply_final_quirks(void)
 	pci_apply_fixup_final_quirks = true;
 	for_each_pci_dev(dev) {
 		pci_fixup_device(pci_fixup_final, dev);
+
+		if (pci_is_pcie(dev))
+			continue;
 		/*
 		 * If arch hasn't set it explicitly yet, use the CLS
 		 * value shared by all PCI devices.  If there's a
Signature · 1 line
2.29.2
#1 lore raw
Quoted 13 lines · Heiner Kallweit

Don't try to read CLS from PCIe devices in pci_apply_final_quirks(). This value has no meaning for PCIe.

---
 drivers/pci/quirks.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/pci/quirks.c +0 -0
index d9cbe69b8..ac8ce9118 100644

drivers/pci/quirks.c static int __init pci_apply_final_quirks(void) · line 168

Quoted 6 lines
drivers/pci/quirks.c +3 -0
@@ -163,6 +163,9 @@ static int __init pci_apply_final_quirks(void)
 	pci_apply_fixup_final_quirks = true;
 	for_each_pci_dev(dev) {
 		pci_fixup_device(pci_fixup_final, dev);
+
+		if (pci_is_pcie(dev))
+			continue;

This loop tries to deduce the platform's cache line size by looking at the CLS of every PCI device. It doesn't *write* CLS for any devices.

IIUC skipping PCIe devices would only make a difference if a PCIe device had a non-zero CLS different from the CLS of other devices. In that case we would print a "CLS mismatch" message and fall back to pci_dfl_cache_line_size.

The power-up value is zero, so if we read a non-zero CLS, it means firmware set it to something. It would be strange if firmware set it to something other than the platform's cache line size.

Skipping PCIe devices probably doesn't hurt anything, but I don't really see a benefit either. What do you think? In general I think we should add code to check PCI vs PCIe only if it makes a difference.

Quoted 6 lines
drivers/pci/quirks.c +0 -0
 		/*
 		 * If arch hasn't set it explicitly yet, use the CLS
 		 * value shared by all PCI devices.  If there's a
Signature · 1 line
2.29.2
#2 lore raw
Quoted 29 lines · Bjorn Helgaas
Quoted 13 lines · Heiner Kallweit

Don't try to read CLS from PCIe devices in pci_apply_final_quirks(). This value has no meaning for PCIe.

---
 drivers/pci/quirks.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/pci/quirks.c +0 -0
index d9cbe69b8..ac8ce9118 100644

drivers/pci/quirks.c static int __init pci_apply_final_quirks(void) · line 168

Quoted 6 lines
drivers/pci/quirks.c +3 -0
@@ -163,6 +163,9 @@ static int __init pci_apply_final_quirks(void)
 	pci_apply_fixup_final_quirks = true;
 	for_each_pci_dev(dev) {
 		pci_fixup_device(pci_fixup_final, dev);
+
+		if (pci_is_pcie(dev))
+			continue;

This loop tries to deduce the platform's cache line size by looking at the CLS of every PCI device. It doesn't *write* CLS for any devices.

IIUC skipping PCIe devices would only make a difference if a PCIe device had a non-zero CLS different from the CLS of other devices. In that case we would print a "CLS mismatch" message and fall back to pci_dfl_cache_line_size.

Quoted 8 lines

The power-up value is zero, so if we read a non-zero CLS, it means firmware set it to something. It would be strange if firmware set it to something other than the platform's cache line size.

Skipping PCIe devices probably doesn't hurt anything, but I don't really see a benefit either. What do you think? In general I think we should add code to check PCI vs PCIe only if it makes a difference.

There is no functional change, right. The benefit is just that we avoid some unnecessary traffic on the PCI bus.
If you think that this is not really worth a patch, then this is also fine with me.

Quoted 6 lines
Quoted 6 lines
drivers/pci/quirks.c +0 -0
 		/*
 		 * If arch hasn't set it explicitly yet, use the CLS
 		 * value shared by all PCI devices.  If there's a
Signature · 1 line
2.29.2
#3 lore raw
Quoted 34 lines · Heiner Kallweit
Quoted 33 lines · Bjorn Helgaas
Quoted 13 lines · Heiner Kallweit

Don't try to read CLS from PCIe devices in pci_apply_final_quirks(). This value has no meaning for PCIe.

---
 drivers/pci/quirks.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/pci/quirks.c +0 -0
index d9cbe69b8..ac8ce9118 100644

drivers/pci/quirks.c static int __init pci_apply_final_quirks(void) · line 168

Quoted 6 lines
drivers/pci/quirks.c +3 -0
@@ -163,6 +163,9 @@ static int __init pci_apply_final_quirks(void)
 	pci_apply_fixup_final_quirks = true;
 	for_each_pci_dev(dev) {
 		pci_fixup_device(pci_fixup_final, dev);
+
+		if (pci_is_pcie(dev))
+			continue;

This loop tries to deduce the platform's cache line size by looking at the CLS of every PCI device. It doesn't *write* CLS for any devices.

IIUC skipping PCIe devices would only make a difference if a PCIe device had a non-zero CLS different from the CLS of other devices. In that case we would print a "CLS mismatch" message and fall back to pci_dfl_cache_line_size.

The power-up value is zero, so if we read a non-zero CLS, it means firmware set it to something. It would be strange if firmware set it to something other than the platform's cache line size.

Quoted 8 lines
Quoted 4 lines

Skipping PCIe devices probably doesn't hurt anything, but I don't really see a benefit either. What do you think? In general I think we should add code to check PCI vs PCIe only if it makes a difference.

There is no functional change, right. The benefit is just that we avoid some unnecessary traffic on the PCI bus.
If you think that this is not really worth a patch, then this is also fine with me.

OK, I think I'll drop it just to avoid the cost of convincing ourselves that there's no risk. If we see "CLS mismatch" warnings or if is a real performance cost, we should do something. But I don't think the extra PCI traffic will be measurable in this case.

Quoted 7 lines
Quoted 6 lines
Quoted 6 lines
drivers/pci/quirks.c +0 -0
 		/*
 		 * If arch hasn't set it explicitly yet, use the CLS
 		 * value shared by all PCI devices.  If there's a
Signature · 1 line
2.29.2