* [PATCH] pci: Fixes MaxPayloadSize (MPS) programming for RCiEP devices.
@ 2020-03-27 21:16 Ashok Raj
2020-03-31 13:11 ` Sasha Levin
2020-05-14 23:27 ` Bjorn Helgaas
0 siblings, 2 replies; 3+ messages in thread
From: Ashok Raj @ 2020-03-27 21:16 UTC (permalink / raw)
To: linux-pci, Bjorn Helgaas; +Cc: Ashok Raj, linux-kernel, stable
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.
Fixes: 9dae3a97297f ("PCI: Move MPS configuration check to pci_configure_device()")
Signed-off-by: Ashok Raj <ashok.raj@intel.com>
Tested-by: Dave Jiang <dave.jiang@intel.com>
To: Bjorn Helgaas <bhelgaas@google.com>
To: linux-pci@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
Cc: Ashok Raj <ashok.raj@intel.com>
---
drivers/pci/probe.c | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index eeff8a07..a738b1c 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -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);
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] pci: Fixes MaxPayloadSize (MPS) programming for RCiEP devices.
2020-03-27 21:16 [PATCH] pci: Fixes MaxPayloadSize (MPS) programming for RCiEP devices Ashok Raj
@ 2020-03-31 13:11 ` Sasha Levin
2020-05-14 23:27 ` Bjorn Helgaas
1 sibling, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2020-03-31 13:11 UTC (permalink / raw)
To: Sasha Levin, Ashok Raj, linux-pci, Bjorn Helgaas, Bjorn Helgaas,
linux-pci
Cc: Ashok Raj, linux-kernel, linux-kernel, stable, Ashok Raj, stable
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 716 bytes --]
Hi
[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?
--
Thanks
Sasha
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] pci: Fixes MaxPayloadSize (MPS) programming for RCiEP devices.
2020-03-27 21:16 [PATCH] pci: Fixes MaxPayloadSize (MPS) programming for RCiEP devices Ashok Raj
2020-03-31 13:11 ` Sasha Levin
@ 2020-05-14 23:27 ` Bjorn Helgaas
1 sibling, 0 replies; 3+ messages in thread
From: Bjorn Helgaas @ 2020-05-14 23:27 UTC (permalink / raw)
To: Ashok Raj; +Cc: linux-pci, Bjorn Helgaas, linux-kernel, stable
On Fri, Mar 27, 2020 at 02:16:15PM -0700, Ashok Raj wrote:
> 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.
>
> Fixes: 9dae3a97297f ("PCI: Move MPS configuration check to pci_configure_device()")
> Signed-off-by: Ashok Raj <ashok.raj@intel.com>
> Tested-by: Dave Jiang <dave.jiang@intel.com>
> To: Bjorn Helgaas <bhelgaas@google.com>
> To: linux-pci@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Cc: stable@vger.kernel.org
> Cc: Ashok Raj <ashok.raj@intel.com>
Applied to pci/enumeration for v5.8, thanks!
> ---
> drivers/pci/probe.c | 23 ++++++++++++++++++++++-
> 1 file changed, 22 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> index eeff8a07..a738b1c 100644
> --- a/drivers/pci/probe.c
> +++ b/drivers/pci/probe.c
> @@ -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);
>
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-05-14 23:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-27 21:16 [PATCH] pci: Fixes MaxPayloadSize (MPS) programming for RCiEP devices Ashok Raj
2020-03-31 13:11 ` Sasha Levin
2020-05-14 23:27 ` Bjorn Helgaas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).