On 2022-06-10 23:01:31, Zhiqiang Hou wrote: > From: Hou Zhiqiang <Zhiqiang.Hou@xxxxxxx> > > The commit 27d868b5e6cf ("PCI: Set MPS to match upstream bridge") Adding Keith, as the author of that commit. > made the device's MPS matches upstream bridge for PCIE_BUS_DEFAULT > mode, so that it's more likely that a hot-added device will work in > a system with an optimized MPS configuration. > > Obviously, the Linux itself optimizes the MPS settings in the > PCIE_BUS_SAFE and PCIE_BUS_PERFORMANCE mode, so let's do this also > for these modes. > > Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@xxxxxxx> > --- I wanted to give a little more information about the issue we're seeing. We're having trouble retaining the optimized Max Payload Size (MPS) value of a PCIe endpoint after hotplug/rescan. In this case, `pcie_ports=native` and `pci=pcie_bus_safe` are set on the cmdline and we expect the Linux kernel to retain the MPS value. Commit 27d868b5e6cf preserved the MPS value when using the default PCIe bus mode (PCIE_BUS_DEFAULT) and we're hopeful that this can be extended to other modes, as well. Tyler > drivers/pci/probe.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c > index 17a969942d37..2c5a1aefd9cb 100644 > --- a/drivers/pci/probe.c > +++ b/drivers/pci/probe.c > @@ -2034,7 +2034,9 @@ static void pci_configure_mps(struct pci_dev *dev) > * Fancier MPS configuration is done later by > * pcie_bus_configure_settings() > */ > - if (pcie_bus_config != PCIE_BUS_DEFAULT) > + if (pcie_bus_config != PCIE_BUS_DEFAULT && > + pcie_bus_config != PCIE_BUS_SAFE && > + pcie_bus_config != PCIE_BUS_PERFORMANCE) > return; > > mpss = 128 << dev->pcie_mpss; > @@ -2047,7 +2049,7 @@ static void pci_configure_mps(struct pci_dev *dev) > > rc = pcie_set_mps(dev, p_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", > + pci_warn(dev, "can't set Max Payload Size to %d; if necessary, use \"pci=pcie_bus_peer2peer\" and report a bug\n", > p_mps); > return; > } > -- > 2.17.1 >