From: Niklas Cassel <cassel@kernel.org>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: Niklas Cassel <cassel@kernel.org>,
Shawn Lin <shawn.lin@rock-chips.com>,
linux-pci@vger.kernel.org
Subject: [PATCH] PCI: Update saved Max Read Request Size in pcie_set_readrq()
Date: Tue, 13 Oct 2026 21:53:08 +0200 [thread overview]
Message-ID: <20261013195307.181647-2-cassel@kernel.org> (raw)
pcie_set_readrq() changes the Max Read Request Size (MRRS) in the Device
Control register but leaves the copy saved by pci_save_state() alone, so
a pci_restore_state() that is not preceded by pci_save_state() puts back
the old value.
Since commit a2f1e22390ac ("PCI/ERR: Ensure error recoverability at all
times"), the PCI core saves the state of a device when the device is
added, before a driver is bound. The MRRS is usually set after that, by
the driver or by an enable fixup, some of which limit the MRRS to what
the hardware can handle, e.g. quirk_brcm_5719_limit_mrrs() and the
keystone and Loongson fixups. Unless the state is saved again, a
pci_restore_state() after a reset, e.g. in the driver's ->slot_reset()
during error recovery, puts back the MRRS that the device had when it
was added.
Update the saved copy of Device Control when pcie_set_readrq() changes
the MRRS, like pcie_set_mps() does for the Max Payload Size.
Suggested-by: Shawn Lin <shawn.lin@rock-chips.com>
Assisted-by: LLM
Signed-off-by: Niklas Cassel <cassel@kernel.org>
---
drivers/pci/pci.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 5b126cd342ca..30a583aeea65 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -5944,8 +5944,12 @@ int pcie_set_readrq(struct pci_dev *dev, int rq)
ret = pcie_capability_clear_and_set_word(dev, PCI_EXP_DEVCTL,
PCI_EXP_DEVCTL_READRQ, v);
+ if (ret)
+ return pcibios_err_to_errno(ret);
- return pcibios_err_to_errno(ret);
+ pcie_update_saved_devctl(dev, PCI_EXP_DEVCTL_READRQ, v);
+
+ return 0;
}
EXPORT_SYMBOL(pcie_set_readrq);
base-commit: 581cf67cb6f66eabc6bcd7f61dd64b2559270507
--
2.56.0
next reply other threads:[~2026-10-13 19:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-13 19:53 Niklas Cassel [this message]
2026-10-13 20:05 ` [PATCH] PCI: Update saved Max Read Request Size in pcie_set_readrq() sashiko-bot
2026-10-13 21:00 ` Niklas Cassel
2026-10-14 2:21 ` Shawn Lin
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=20261013195307.181647-2-cassel@kernel.org \
--to=cassel@kernel.org \
--cc=bhelgaas@google.com \
--cc=linux-pci@vger.kernel.org \
--cc=shawn.lin@rock-chips.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.