From: Saverio Miroddi <saverio.pub2@gmail.com>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
Saverio Miroddi <saverio.pub2@gmail.com>
Subject: [PATCH] PCI/DOE: Add debug messages for transaction failures
Date: Tue, 21 Jul 2026 21:33:10 +0200 [thread overview]
Message-ID: <20260721193310.1179300-1-saverio.pub2@gmail.com> (raw)
DOE feature discovery reports only -EIO when several distinct mailbox
status and response-validation failures occur. The abort used to recover
the mailbox can then clear the status before it is captured, leaving the
existing failed-to-cache-features message insufficient to identify the
failing phase.
Add dynamic-debug messages immediately before the silent error returns.
Log the transaction phase and raw status or response length, but do not
change mailbox behavior or expose payload contents.
On a WD_BLACK SN8100 NVMe device (15b7:5050, firmware 830ZRR0A), whose
mailbox creation fails on every boot, these messages identified the
failure: the device accepts the Discovery request but never presents a
response, and the transaction times out with the Busy bit still set:
pci 0000:05:00.0: DOE: [500] response timeout, status: 0x00000001
pci 0000:05:00.0: DOE: [500] failed to cache features : -5
pci 0000:05:00.0: DOE: [500] failed to create mailbox: -5
Signed-off-by: Saverio Miroddi <saverio.pub2@gmail.com>
---
drivers/pci/doe.c | 40 ++++++++++++++++++++++++++++++++++------
1 file changed, 34 insertions(+), 6 deletions(-)
diff --git a/drivers/pci/doe.c b/drivers/pci/doe.c
index 7b41da4ec11a..3c376add3293 100644
--- a/drivers/pci/doe.c
+++ b/drivers/pci/doe.c
@@ -282,8 +282,11 @@ static int pci_doe_abort(struct pci_doe_mb *doe_mb)
/* Abort success! */
if (!FIELD_GET(PCI_DOE_STATUS_ERROR, val) &&
- !FIELD_GET(PCI_DOE_STATUS_BUSY, val))
+ !FIELD_GET(PCI_DOE_STATUS_BUSY, val)) {
+ pci_dbg(pdev, "[%x] Abort completed, status: %#010x\n",
+ offset, val);
return 0;
+ }
} while (!time_after(jiffies, timeout_jiffies));
@@ -323,13 +326,19 @@ static int pci_doe_send_req(struct pci_doe_mb *doe_mb,
if (FIELD_GET(PCI_DOE_STATUS_BUSY, val))
return -EBUSY;
- if (FIELD_GET(PCI_DOE_STATUS_ERROR, val))
+ if (FIELD_GET(PCI_DOE_STATUS_ERROR, val)) {
+ pci_dbg(pdev, "[%x] status error before request: %#010x\n",
+ offset, val);
return -EIO;
+ }
/* Length is 2 DW of header + length of payload in DW */
length = 2 + DIV_ROUND_UP(task->request_pl_sz, sizeof(__le32));
- if (length > PCI_DOE_MAX_LENGTH)
+ if (length > PCI_DOE_MAX_LENGTH) {
+ pci_dbg(pdev, "[%x] request length %zu DW exceeds maximum\n",
+ offset, length);
return -EIO;
+ }
if (length == PCI_DOE_MAX_LENGTH)
length = 0;
@@ -369,6 +378,10 @@ static bool pci_doe_data_obj_ready(struct pci_doe_mb *doe_mb)
pci_read_config_dword(pdev, offset + PCI_DOE_STATUS, &val);
if (FIELD_GET(PCI_DOE_STATUS_DATA_OBJECT_READY, val))
return true;
+
+ pci_dbg(pdev,
+ "[%x] Data Object Ready cleared prematurely, status: %#010x\n",
+ offset, val);
return false;
}
@@ -400,8 +413,11 @@ static int pci_doe_recv_resp(struct pci_doe_mb *doe_mb, struct pci_doe_task *tas
/* A value of 0x0 indicates max data object length */
if (!length)
length = PCI_DOE_MAX_LENGTH;
- if (length < 2)
+ if (length < 2) {
+ pci_dbg(pdev, "[%x] invalid response length: %zu\n",
+ offset, length);
return -EIO;
+ }
/* First 2 dwords have already been read */
length -= 2;
@@ -447,8 +463,11 @@ static int pci_doe_recv_resp(struct pci_doe_mb *doe_mb, struct pci_doe_task *tas
/* Final error check to pick up on any since Data Object Ready */
pci_read_config_dword(pdev, offset + PCI_DOE_STATUS, &val);
- if (FIELD_GET(PCI_DOE_STATUS_ERROR, val))
+ if (FIELD_GET(PCI_DOE_STATUS_ERROR, val)) {
+ pci_dbg(pdev, "[%x] status error after response: %#010x\n",
+ offset, val);
return -EIO;
+ }
return received;
}
@@ -515,12 +534,17 @@ static void doe_statemachine_work(struct work_struct *work)
retry_resp:
pci_read_config_dword(pdev, offset + PCI_DOE_STATUS, &val);
if (FIELD_GET(PCI_DOE_STATUS_ERROR, val)) {
+ pci_dbg(pdev,
+ "[%x] status error while waiting for response: %#010x\n",
+ offset, val);
signal_task_abort(task, -EIO);
return;
}
if (!FIELD_GET(PCI_DOE_STATUS_DATA_OBJECT_READY, val)) {
if (time_after(jiffies, timeout_jiffies)) {
+ pci_dbg(pdev, "[%x] response timeout, status: %#010x\n",
+ offset, val);
signal_task_abort(task, -EIO);
return;
}
@@ -564,8 +588,12 @@ static int pci_doe_discovery(struct pci_doe_mb *doe_mb, u8 capver, u8 *index, u1
if (rc < 0)
return rc;
- if (rc != sizeof(response_pl_le))
+ if (rc != sizeof(response_pl_le)) {
+ pci_dbg(doe_mb->pdev,
+ "[%x] invalid Discovery response size: %d\n",
+ doe_mb->cap_offset, rc);
return -EIO;
+ }
response_pl = le32_to_cpu(response_pl_le);
*vid = FIELD_GET(PCI_DOE_DATA_OBJECT_DISC_RSP_3_VID, response_pl);
--
2.54.0
next reply other threads:[~2026-07-21 19:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-21 19:33 Saverio Miroddi [this message]
2026-07-21 19:35 ` [PATCH] PCI/DOE: Add debug messages for transaction failures sashiko-bot
2026-11-03 23:29 ` Mitar
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=20260721193310.1179300-1-saverio.pub2@gmail.com \
--to=saverio.pub2@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 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.