[PATCH 1/2] mmc: cqhci: Log error IRQ details and card R1 status on recovery

From: Athira Palliprath via B4 Relay

Date: Tue Dec 01 2026 - 12:20:20 EST


From: Athira Palliprath <palliprath@xxxxxxxxxxxx>

Currently cqhci_error_irq() only logs the error IRQ status, cmd_error,
data_error, and TERRI at pr_debug() level and never reads CQHCI_CRI or
CQHCI_CRA (the eMMC R1 card response status on Response Error Detected).
As a result, production kernel logs on CQE-enabled devices only record
"running CQE recovery" without indicating whether recovery was triggered
by an uncorrectable NAND ECC error (R1_CARD_ECC_FAILED), a bus CRC error
(-EILSEQ), or a host timeout (-ETIMEDOUT).

Log these error details via pr_err_ratelimited() once per recovery
trigger (after the recovery_halt guard and idle check so normal I/O and
in-progress recoveries emit zero extra messages), including CRI and CRA
when CQHCI_IS_RED is set.

Signed-off-by: Athira Palliprath <palliprath@xxxxxxxxxxxx>
---
drivers/mmc/host/cqhci-core.c | 13 +++++++++++++
1 file changed, 13 insertions(+)

diff --git a/drivers/mmc/host/cqhci-core.c b/drivers/mmc/host/cqhci-core.c
index a466cd88b..69b125c1e 100644
--- a/drivers/mmc/host/cqhci-core.c
+++ b/drivers/mmc/host/cqhci-core.c
@@ -724,6 +724,19 @@ static void cqhci_error_irq(struct mmc_host *mmc, u32 status, int cmd_error,
goto out_unlock;
}

+ if (status & CQHCI_IS_RED) {
+ u32 cri = cqhci_readl(cq_host, CQHCI_CRI);
+ u32 cra = cqhci_readl(cq_host, CQHCI_CRA);
+
+ pr_err_ratelimited("%s: cqhci: error IRQ status: 0x%08x cmd error %d data error %d TERRI: 0x%08x CRI: 0x%08x CRA: 0x%08x\n",
+ mmc_hostname(mmc), status, cmd_error,
+ data_error, terri, cri, cra);
+ } else {
+ pr_err_ratelimited("%s: cqhci: error IRQ status: 0x%08x cmd error %d data error %d TERRI: 0x%08x\n",
+ mmc_hostname(mmc), status, cmd_error,
+ data_error, terri);
+ }
+
if (CQHCI_TERRI_C_VALID(terri)) {
tag = CQHCI_TERRI_C_TASK(terri);
slot = &cq_host->slot[tag];

--
2.56.1.839.g22a8290db9-goog