* [PATCH v3 1/2] remoteproc: k3: Report a remote crash to the remoteproc core
2026-11-22 22:17 [PATCH v3 0/2] remoteproc: k3: Recover a crashed remote core Chrispine Tinega
@ 2026-11-22 22:17 ` Chrispine Tinega
2026-11-22 22:17 ` [PATCH v3 2/2] remoteproc: k3-m4: Enable crash recovery for a core Linux booted Chrispine Tinega
1 sibling, 0 replies; 3+ messages in thread
From: Chrispine Tinega @ 2026-11-22 22:17 UTC (permalink / raw)
To: Bjorn Andersson, Mathieu Poirier
Cc: linux-remoteproc, linux-kernel, Francesco Valla, Chrispine Tinega
A K3 remote core that faults can send RP_MBOX_CRASH over the mailbox,
but k3_rproc_mbox_callback() only logs it. The remoteproc core never
learns of the crash, so its recovery never runs, the crash is not
counted, and the core stays halted with every rpmsg channel to it dead.
Call rproc_report_crash(), which may be called from atomic context, when
the core is RPROC_RUNNING, that is when Linux booted it. The core then
moves to RPROC_CRASHED and the crash is counted. Where the driver leaves
recovery enabled, recovery stops the core and boots it again. Where
recovery is disabled, the core can still be stopped and started again
through sysfs.
In any other state, keep only logging the crash:
- An IPC-only core, RPROC_DETACHED or RPROC_ATTACHED, was not booted
by Linux. Once marked crashed, rproc_detach() refuses it, and the
drivers' remove paths skip the detach and leak its resources. The R5F
has no start or stop ops in this mode at all.
- Each K3 driver requests its mailbox before devm_rproc_add(). A crash
queued then would not be cancelled if probe failed, and the work
would run on a freed rproc. The state is never RPROC_RUNNING there.
Recovery on its own cannot yet restart an R5F: the reset the R5F needs
before it starts again is applied in its unprepare() op, which sysfs
stop calls and recovery does not. The R5F driver keeps recovery
disabled, so this does not change what happens there.
Signed-off-by: Chrispine Tinega <dev@chrispinetinega.com>
---
Changes in v3:
- Guard rproc_report_crash() with rproc->state == RPROC_RUNNING and keep
the dev_err() print in other states, so IPC-only cores do not lose
detach and a crash queued before devm_rproc_add() cannot run after a
failed probe. (Sashiko review, pointed out by Francesco)
Changes in v2:
- Drop the dev_err(). rproc_report_crash() already logs the crash
and names the core. (Francesco)
- Say in the commit message that recovery cannot yet restart an R5F.
(Francesco)
drivers/remoteproc/ti_k3_common.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/remoteproc/ti_k3_common.c b/drivers/remoteproc/ti_k3_common.c
index 4b6da3363..29ca51861 100644
--- a/drivers/remoteproc/ti_k3_common.c
+++ b/drivers/remoteproc/ti_k3_common.c
@@ -61,10 +61,16 @@ void k3_rproc_mbox_callback(struct mbox_client *client, void *data)
switch (msg) {
case RP_MBOX_CRASH:
/*
- * remoteproc detected an exception, but error recovery is not
- * supported. So, just log this for now
+ * Report only a crash of a core that Linux booted. Once the
+ * remoteproc core marks an IPC-only core crashed, it can no
+ * longer detach from it. The state is never RPROC_RUNNING
+ * before devm_rproc_add(), so a failed probe cannot leave
+ * crash work queued.
*/
- dev_err(dev, "K3 rproc %s crashed\n", rproc->name);
+ if (rproc->state == RPROC_RUNNING)
+ rproc_report_crash(rproc, RPROC_FATAL_ERROR);
+ else
+ dev_err(dev, "K3 rproc %s crashed\n", rproc->name);
break;
case RP_MBOX_ECHO_REPLY:
dev_info(dev, "received echo reply from %s\n", rproc->name);
--
2.53.0
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH v3 2/2] remoteproc: k3-m4: Enable crash recovery for a core Linux booted
2026-11-22 22:17 [PATCH v3 0/2] remoteproc: k3: Recover a crashed remote core Chrispine Tinega
2026-11-22 22:17 ` [PATCH v3 1/2] remoteproc: k3: Report a remote crash to the remoteproc core Chrispine Tinega
@ 2026-11-22 22:17 ` Chrispine Tinega
1 sibling, 0 replies; 3+ messages in thread
From: Chrispine Tinega @ 2026-11-22 22:17 UTC (permalink / raw)
To: Bjorn Andersson, Mathieu Poirier
Cc: linux-remoteproc, linux-kernel, Francesco Valla, Chrispine Tinega
The M4 driver disables recovery, but nothing reported a crash to the
remoteproc core, so there was nothing to recover from. Now that
RP_MBOX_CRASH reaches rproc_report_crash(), recovery resets the M4F and
boots its firmware again, while Linux keeps running. The stop is a
plain reset, so it does not need the crashed core's cooperation.
Enable recovery by default when Linux booted the M4F. Keep it disabled
in IPC-only mode, where Linux only attached: recovery boots
rproc->firmware from Linux, which need not be the firmware started
before Linux, and nothing would tell the user it was replaced.
Userspace can still change it through
/sys/class/remoteproc/remoteprocN/recovery.
Signed-off-by: Chrispine Tinega <dev@chrispinetinega.com>
---
Changes in v3:
- No changes.
Changes in v2:
- Keep recovery disabled in IPC-only mode, where Linux only attached
and recovery could boot a different firmware unnoticed. (Francesco)
- Retitled from "remoteproc: k3-m4: Leave crash recovery enabled".
drivers/remoteproc/ti_k3_m4_remoteproc.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/remoteproc/ti_k3_m4_remoteproc.c b/drivers/remoteproc/ti_k3_m4_remoteproc.c
index 4c46f4a25..b2a187ea4 100644
--- a/drivers/remoteproc/ti_k3_m4_remoteproc.c
+++ b/drivers/remoteproc/ti_k3_m4_remoteproc.c
@@ -56,7 +56,6 @@ static int k3_m4_rproc_probe(struct platform_device *pdev)
return -ENOMEM;
rproc->has_iommu = false;
- rproc->recovery_disabled = true;
kproc = rproc->priv;
kproc->dev = dev;
kproc->rproc = rproc;
@@ -105,6 +104,11 @@ static int k3_m4_rproc_probe(struct platform_device *pdev)
/* configure devices for either remoteproc or IPC-only mode */
if (p_state) {
rproc->state = RPROC_DETACHED;
+ /*
+ * Recovery boots rproc->firmware, which is not necessarily what
+ * was started before Linux attached.
+ */
+ rproc->recovery_disabled = true;
dev_info(dev, "configured M4F for IPC-only mode\n");
} else {
dev_info(dev, "configured M4F for remoteproc mode\n");
--
2.53.0
^ permalink raw reply [flat|nested] 3+ messages in thread