From: sashiko-bot@kernel.org
To: "Niklas Cassel" <cassel@kernel.org>
Cc: linux-amlogic@lists.infradead.org, neil.armstrong@linaro.org,
linux-pci@vger.kernel.org
Subject: Re: [RFC PATCH 3/4] PCI: Configure Root Port MPS after scanning its hierarchy
Date: Wed, 30 Sep 2026 15:06:17 +0000 [thread overview]
Message-ID: <20260930150617.CE88A1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260930145017.1356088-9-cassel@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] pci: ignoring pcie_set_mps() failures causes illegal MPS topology
--
commit 6dac99f476ff730ab7dd14051b62e9402806b339
Author: Niklas Cassel <cassel@kernel.org>
PCI: Configure Root Port MPS after scanning its hierarchy
This commit introduces logic to raise the Maximum Payload Size (MPS) for Root
Ports and their downstream hierarchies to the largest supported value during
scanning or rescan. It applies to PCIE_BUS_DEFAULT configurations to improve
efficiency. It also enables the Intel read completion coalescing quirk for the
default MPS strategy.
> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> index d8e58e5ef7309..5f37b480b51df 100644
> --- a/drivers/pci/probe.c
> +++ b/drivers/pci/probe.c
[ ... ]
> @@ -3083,6 +3083,82 @@ static int pcie_bus_configure_set(struct pci_dev *dev, void *data)
> return 0;
> }
>
> +static int pcie_raise_mps(struct pci_dev *dev, void *data)
> +{
> + int mps = *(int *)data;
> +
> + /* MPS is of type 'RsvdP' for VFs */
> + if (!pci_is_pcie(dev) || dev->is_virtfn)
> + return 0;
> +
> + if (pcie_get_mps(dev) < mps && pcie_set_mps(dev, mps))
> + pci_err(dev, "can't set Max Payload Size to %d\n", mps);
> +
> + return 0;
> +}
[Severity: Medium]
When pcie_set_mps() fails in pcie_raise_mps(), this error is logged but
swallowed by returning 0 to the pci_walk_bus() callback loop. Does this allow
the loop to continue and potentially create an illegal MPS topology where a
downstream device inherits a larger MPS than its upstream bridge?
> +
> +/*
> + * With PCIE_BUS_DEFAULT, pci_configure_mps() only matches each device to its
[ ... ]
> + * leave hierarchies alone once any of their devices may have a driver bound.
> + */
> +static void pcie_bus_raise_default_mps(struct pci_bus *bus)
> +{
> + struct pci_dev *rp = bus->self;
> + u8 smpss = rp->pcie_mpss;
> + int mps, old_mps;
> +
> + if (pci_pcie_type(rp) != PCI_EXP_TYPE_ROOT_PORT ||
> + list_empty(&bus->devices) || pci_bus_in_use(bus))
> + return;
> +
> + pci_walk_bus(bus, pcie_find_smpss, &smpss);
> + mps = 128 << smpss;
> + old_mps = pcie_get_mps(rp);
> + if (mps <= old_mps)
> + return;
> +
> + pcie_raise_mps(rp, &mps);
> + pci_walk_bus(bus, pcie_raise_mps, &mps);
[Severity: Medium]
If the call to pcie_raise_mps() for the Root Port (rp) fails to set its MPS,
does this dangerously proceed to call pci_walk_bus() and set the MPS of
downstream devices anyway? Could this result in a PCIe protocol violation
leading to Malformed TLP errors and packet drops?
> + pci_info(rp, "Max Payload Size of hierarchy set to %d (was %d)\n",
> + mps, old_mps);
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260930145017.1356088-6-cassel@kernel.org?part=3
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
next prev parent reply other threads:[~2026-09-30 15:06 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-30 14:50 [RFC PATCH 0/4] PCI: Fix and improve default MPS configuration Niklas Cassel
2026-09-30 14:50 ` [RFC PATCH 1/4] PCI: Update saved Max Payload Size in pcie_set_mps() Niklas Cassel
2026-09-30 14:58 ` sashiko-bot
2026-09-30 14:50 ` [RFC PATCH 2/4] PCI: Match the hierarchy's MPS to a device's MPSS as necessary Niklas Cassel
2026-09-30 14:57 ` sashiko-bot
2026-09-30 14:50 ` [RFC PATCH 3/4] PCI: Configure Root Port MPS after scanning its hierarchy Niklas Cassel
2026-09-30 15:06 ` sashiko-bot [this message]
2026-09-30 14:50 ` [RFC PATCH 4/4] PCI: meson: Remove redundant MPS configuration Niklas Cassel
2026-09-30 14:57 ` sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260930150617.CE88A1F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=cassel@kernel.org \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-pci@vger.kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®