mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] PCI: Do not cache Immediate Readiness from a failed config read
@ 2026-10-31  3:42 Baek Kyu, Kim
  0 siblings, 0 replies; only message in thread
From: Baek Kyu, Kim @ 2026-10-31  3:42 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: Baek Kyu, Kim, linux-pci, linux-kernel

pci_imm_ready_init() uses PCI_STATUS even if pci_read_config_word() fails.
The failed access leaves an all-ones response, whose Immediate Readiness
bit is set. A later FLR then skips the wait even after config space has
become accessible again, so early config restoration can be lost.

Leave imm_ready clear when the read fails or returns all ones. Keep the
existing fast path for a valid status that advertises Immediate Readiness.

Fixes: d6112f8def51 ("PCI: Add support for Immediate Readiness")
Signed-off-by: Baek Kyu, Kim <pocj8ur4in@gmail.com>
---
An arm64 QEMU kernel used the PCI core enumeration and FLR paths with a
synthetic endpoint. With one injected initial PCI_STATUS read failure,
the baseline cached imm_ready=1 and restored config immediately; the
endpoint dropped the writes. The change kept imm_ready=0, waited 103 ms,
and restored the config value. No physical endpoint was tested.

 drivers/pci/probe.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 27008e2ea5af..eb4e17ebd055 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2642,7 +2642,10 @@ static void pci_imm_ready_init(struct pci_dev *dev)
 {
 	u16 status;
 
-	pci_read_config_word(dev, PCI_STATUS, &status);
+	if (pci_read_config_word(dev, PCI_STATUS, &status) ||
+	    PCI_POSSIBLE_ERROR(status))
+		return;
+
 	if (status & PCI_STATUS_IMM_READY)
 		dev->imm_ready = 1;
 }
-- 
2.55.0

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-31  3:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-31  3:42 [PATCH] PCI: Do not cache Immediate Readiness from a failed config read Baek Kyu, Kim

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®