mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Baek Kyu, Kim" <pocj8ur4in@gmail.com>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: "Baek Kyu, Kim" <pocj8ur4in@gmail.com>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] PCI: Do not cache Immediate Readiness from a failed config read
Date: Sat, 31 Oct 2026 12:42:01 +0900	[thread overview]
Message-ID: <20261031034201.161511-1-pocj8ur4in@gmail.com> (raw)

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

                 reply	other threads:[~2026-10-31  3:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261031034201.161511-1-pocj8ur4in@gmail.com \
    --to=pocj8ur4in@gmail.com \
    --cc=bhelgaas@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    /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®