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: Report configuration access errors when requesting FLR
Date: Sat, 31 Oct 2026 16:16:38 +0900 [thread overview]
Message-ID: <179343099854.144556.14547372045411279536.c116@gmail.com> (raw)
PCIe and AF FLR requests can fail after pci_dev_reset_iommu_prepare()
succeeds. pcie_flr() and pci_af_flr() ignore the config access result.
A failed request can then be reported as a successful reset when an
Immediate Readiness device skips the wait or a later config read works.
Check the request access in both paths and convert PCIBIOS_* errors to
negative errno values. Use the existing done path so IOMMU cleanup still
runs after a successful prepare. Leave successful requests and readiness
handling unchanged.
Fixes: 8dd7f8036c12 ("PCI: add support for function level reset")
Fixes: 1ca887970a39 ("PCI: Extend pci_reset_function() to support PCI Advanced Features")
Signed-off-by: Baek Kyu, Kim <pocj8ur4in@gmail.com>
---
An arm64 QEMU/KVM kernel used a synthetic PCI host with the normal PCI
enumeration and sysfs reset paths. A one-shot Device Control read
failure (PCIBIOS_DEVICE_NOT_FOUND) after IOMMU prepare issued no FLR,
but the original sysfs reset returned success. The change returned
-ENODEV while preserving the IOMMU cleanup path. No physical endpoint
or ATS/IOMMU domain restoration was tested.
drivers/pci/pci.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index d79d2ee4ac69b..41fae1b1050c7 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -4429,7 +4429,12 @@ int pcie_flr(struct pci_dev *dev)
return ret;
}
- pcie_capability_set_word(dev, PCI_EXP_DEVCTL, PCI_EXP_DEVCTL_BCR_FLR);
+ ret = pcie_capability_set_word(dev, PCI_EXP_DEVCTL,
+ PCI_EXP_DEVCTL_BCR_FLR);
+ if (ret) {
+ ret = pcibios_err_to_errno(ret);
+ goto done;
+ }
if (dev->imm_ready)
goto done;
@@ -4506,7 +4511,11 @@ static int pci_af_flr(struct pci_dev *dev, bool probe)
return ret;
}
- pci_write_config_byte(dev, pos + PCI_AF_CTRL, PCI_AF_CTRL_FLR);
+ ret = pci_write_config_byte(dev, pos + PCI_AF_CTRL, PCI_AF_CTRL_FLR);
+ if (ret) {
+ ret = pcibios_err_to_errno(ret);
+ goto done;
+ }
if (dev->imm_ready)
goto done;
--
2.55.0
reply other threads:[~2026-10-31 7:16 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=179343099854.144556.14547372045411279536.c116@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®