pci: Fixes MaxPayloadSize (MPS) programming for RCiEP devices.
Subsystems (2)
PATCH 1/1 pci: Fixes MaxPayloadSize (MPS) programming for RCiEP devices.
Root Complex Integrated devices (RCiEP) do not have a Root Port before the device. pci_configure_mps() should simply stick the max value for MaxPayload size in Device Control, and for MaxReadReq. Unless pcie=pcie_bus-peer2peer is used in kernel commandline PCIE_BUS_PEER2PEER.
When MPS is configured lower, it could result in reduced performance.
To: Bjorn Helgaas <[email protected]>
To: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: Ashok Raj <[email protected]>
--- drivers/pci/probe.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-)
drivers/pci/probe.c +22 -1
@@ -1895,13 +1895,34 @@ static void pci_configure_mps(struct pci_dev *dev)struct pci_dev *bridge =pci_upstream_bridge (dev);int mps, mpss, p_mps, rc; -if (!pci_is_pcie (dev) || !bridge || !pci_is_pcie (bridge)) +if (!pci_is_pcie (dev))return ;/* MPS and MRRS fields are of type 'RsvdP' for VFs, short-circuit out */ if (dev->is_virtfn)return ; +/* +* If this is a Root Complex Integrated Endpoint +* Simply program the max value from DEVCAP. No additional +* Lookup is necessary +*/ +if (pci_pcie_type (dev) ==PCI_EXP_TYPE_RC_END ) { +if (pcie_bus_config ==PCIE_BUS_PEER2PEER ) + mps =128 ; +else + mps =128 << dev->pcie_mpss; + rc =pcie_set_mps (dev, mps); +if (rc) { +pci_warn (dev,"can't set Max Payload Size to %d; if necessary, use \"pci=pcie_bus_safe\" and report a bug\n" , + mps); +return ; + } + } + +if (!bridge || !pci_is_pcie (bridge)) +return ; + mps =pcie_get_mps (dev); p_mps =pcie_get_mps (bridge);
Signature · 1 line
2.7.4
Sasha Levin
maintainerHi
[This is an automated email]
This commit has been processed because it contains a "Fixes:" tag
fixing commit: 9dae3a97297f ("PCI: Move MPS configuration check to pci_configure_device()").
The bot has tested the following trees: v5.5.13, v5.4.28, v4.19.113, v4.14.174, v4.9.217, v4.4.217.
v5.5.13: Build OK!
v5.4.28: Build OK!
v4.19.113: Build OK!
v4.14.174: Build OK!
v4.9.217: Build OK!
v4.4.217: Build failed! Errors:
drivers/pci/probe.c:1357:4: error: implicit declaration of function ‘pci_warn’; did you mean ‘pr_warn’? [-Werror=implicit-function-declaration]
NOTE: The patch will not be queued to stable trees until it is upstream.
How should we proceed with this patch?
Signature · 2 lines
Thanks Sasha
Bjorn Helgaas
AppliedQuoted 7 lines · Ashok Raj
Root Complex Integrated devices (RCiEP) do not have a Root Port before the device.
pci_configure_mps()should simply stick the max value for MaxPayload size in Device Control, and for MaxReadReq. Unless pcie=pcie_bus-peer2peer is used in kernel commandlinePCIE_BUS_PEER2PEER.When MPS is configured lower, it could result in reduced performance.
Quoted 8 lines
Fixes 9dae3a97297f ("PCI: Move MPS configuration check to pci_configure_device()")Signed-off-by Ashok Raj <[email protected]>Tested-by Dave Jiang <[email protected]>To: Bjorn Helgaas <[email protected]>
To: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: Ashok Raj <[email protected]>
Applied to pci/enumeration for v5.8, thanks!
Quoted 47 lines
--- drivers/pci/probe.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-)drivers/pci/probe.c +22
-1@@ -1895,13 +1895,34 @@ static void pci_configure_mps(struct pci_dev *dev)struct pci_dev *bridge =pci_upstream_bridge (dev);int mps, mpss, p_mps, rc; -if (!pci_is_pcie (dev) || !bridge || !pci_is_pcie (bridge)) +if (!pci_is_pcie (dev))return ;/* MPS and MRRS fields are of type 'RsvdP' for VFs, short-circuit out */ if (dev->is_virtfn)return ; +/* +* If this is a Root Complex Integrated Endpoint +* Simply program the max value from DEVCAP. No additional +* Lookup is necessary +*/ +if (pci_pcie_type (dev) ==PCI_EXP_TYPE_RC_END ) { +if (pcie_bus_config ==PCIE_BUS_PEER2PEER ) + mps =128 ; +else + mps =128 << dev->pcie_mpss; + rc =pcie_set_mps (dev, mps); +if (rc) { +pci_warn (dev,"can't set Max Payload Size to %d; if necessary, use \"pci=pcie_bus_safe\" and report a bug\n" , + mps); +return ; + } + } + +if (!bridge || !pci_is_pcie (bridge)) +return ; + mps =pcie_get_mps (dev); p_mps =pcie_get_mps (bridge);Signature · 1 line
2.7.4