PCI/DOE: Add debug messages for transaction failures
PATCH 1/1 PCI/DOE: Add debug messages for transaction failures
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
--- drivers/pci/doe.c | 40 ++++++++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-)
drivers/pci/doe.c +34 -6
@@ -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, u1if (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);
Signature · 1 line
2.54.0
[email protected]
AI reviewSashiko has reviewed this patch and found no issues. It looks great!
Quoted 15 lines
DOE feature discovery reports only
-EIOwhen 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_BLACKSN8100 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:
Quoted 5 lines
pci 0000:05:00.0: DOE: [500] response timeout, status:
0x00000001pci 0000:05:00.0: DOE: [500] failed to cache features : -5 pci 0000:05:00.0: DOE: [500] failed to create mailbox: -5Signed-off-by Saverio Miroddi <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Hi!
Quoted 8 lines · Saverio Miroddi
On a
WD_BLACKSN8100 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:
0x00000001pci 0000:05:00.0: DOE: [500] failed to cache features : -5 pci 0000:05:00.0: DOE: [500] failed to create mailbox: -5
The same happens here with a WD_BLACK SN8100 (15b7:5050) on newer firmware, 930BRI19, in a Framework Laptop 13 (AMD Ryzen AI 300) on Linux 7.0. Both errors are logged at every boot, and the drive otherwise works normally:
pci 0000:bf:00.0: DOE: [500] failed to cache features : -5 pci 0000:bf:00.0: DOE: [500] failed to create mailbox: -5
So the firmware update did not change it. As the mailbox never answers, would a quirk which skips DOE discovery for this device be acceptable, instead of the two errors at every boot?
Mitar