[PATCH] remoteproc: qcom: q6v5: Request shutdown if crash is triggered host-side

Bjorn Andersson posted 1 patch 1 day, 1 hour ago
drivers/remoteproc/qcom_q6v5.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
[PATCH] remoteproc: qcom: q6v5: Request shutdown if crash is triggered host-side
Posted by Bjorn Andersson 1 day, 1 hour ago
rpmsg client drivers are allowed to invoke rproc_report_crash() on their
grandparent when they determine that the otherwise seemingly healthy
remoteproc has entered a functionally broken state.

In the crash handling path qcom_q6v5_request_stop() is invoked, which is
based on the current rproc state whether to request a graceful shutdown.

But the current rproc `state` will be RPROC_CRASHED regardless of where
the crash handler was initiated from, and empirical data shows that
unless the firmware is taking part of the shutdown the system state is
often left such that it's not possible to start the subsystem again.

Use the `running` state in the q6v5 driver to make the decision instead,
as this does represent the actual state of the firmware.

This makes it possible to reliably trigger a restart from client
drivers.

Fixes: 3cc889eb83f5 ("remoteproc: qcom: q6v5: Avoid setting smem bit in case of crash shutdown")
Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
---
 drivers/remoteproc/qcom_q6v5.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/remoteproc/qcom_q6v5.c b/drivers/remoteproc/qcom_q6v5.c
index 1075ef4027b7..fe148b4b3775 100644
--- a/drivers/remoteproc/qcom_q6v5.c
+++ b/drivers/remoteproc/qcom_q6v5.c
@@ -229,13 +229,13 @@ static irqreturn_t q6v5_stop_interrupt(int irq, void *data)
  */
 int qcom_q6v5_request_stop(struct qcom_q6v5 *q6v5, struct qcom_sysmon *sysmon)
 {
+	bool was_running = q6v5->running;
 	int ret;
 
 	q6v5->running = false;
 
-	/* Don't perform SMP2P dance if remote isn't running */
-	if ((q6v5->rproc->state != RPROC_RUNNING && q6v5->rproc->state != RPROC_ATTACHED) ||
-	    qcom_sysmon_shutdown_acked(sysmon))
+	/* A watchdog/fatal IRQ clears running; logical crashes still need a stop. */
+	if (!was_running || qcom_sysmon_shutdown_acked(sysmon))
 		return 0;
 
 	qcom_smem_state_update_bits(q6v5->state,

---
base-commit: 290aaf24a551d5a0dce037e3fab30820f9113a10
change-id: 20260722-q6v5-host-side-crash-09f1256cef71

Best regards,
--  
Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
Re: [PATCH] remoteproc: qcom: q6v5: Request shutdown if crash is triggered host-side
Posted by Mukesh Ojha 19 hours ago
On Thu, Jul 23, 2026 at 03:00:41AM +0000, Bjorn Andersson wrote:
> rpmsg client drivers are allowed to invoke rproc_report_crash() on their
> grandparent when they determine that the otherwise seemingly healthy
> remoteproc has entered a functionally broken state.
> 
> In the crash handling path qcom_q6v5_request_stop() is invoked, which is
> based on the current rproc state whether to request a graceful shutdown.
> 
> But the current rproc `state` will be RPROC_CRASHED regardless of where
> the crash handler was initiated from, and empirical data shows that
> unless the firmware is taking part of the shutdown the system state is
> often left such that it's not possible to start the subsystem again.
> 
> Use the `running` state in the q6v5 driver to make the decision instead,
> as this does represent the actual state of the firmware.
> 
> This makes it possible to reliably trigger a restart from client
> drivers.
> 
> Fixes: 3cc889eb83f5 ("remoteproc: qcom: q6v5: Avoid setting smem bit in case of crash shutdown")
> Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
> ---
>  drivers/remoteproc/qcom_q6v5.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/remoteproc/qcom_q6v5.c b/drivers/remoteproc/qcom_q6v5.c
> index 1075ef4027b7..fe148b4b3775 100644
> --- a/drivers/remoteproc/qcom_q6v5.c
> +++ b/drivers/remoteproc/qcom_q6v5.c
> @@ -229,13 +229,13 @@ static irqreturn_t q6v5_stop_interrupt(int irq, void *data)
>   */
>  int qcom_q6v5_request_stop(struct qcom_q6v5 *q6v5, struct qcom_sysmon *sysmon)
>  {
> +	bool was_running = q6v5->running;
>  	int ret;
>  
>  	q6v5->running = false;
>  
> -	/* Don't perform SMP2P dance if remote isn't running */
> -	if ((q6v5->rproc->state != RPROC_RUNNING && q6v5->rproc->state != RPROC_ATTACHED) ||
> -	    qcom_sysmon_shutdown_acked(sysmon))
> +	/* A watchdog/fatal IRQ clears running; logical crashes still need a stop. */
> +	if (!was_running || qcom_sysmon_shutdown_acked(sysmon))
>  		return 0;
>  

Reviewed-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>

-- 
-Mukesh Ojha
Re: [PATCH] remoteproc: qcom: q6v5: Request shutdown if crash is triggered host-side
Posted by Konrad Dybcio 18 hours ago
On 7/23/26 5:00 AM, Bjorn Andersson wrote:
> rpmsg client drivers are allowed to invoke rproc_report_crash() on their
> grandparent when they determine that the otherwise seemingly healthy
> remoteproc has entered a functionally broken state.
> 
> In the crash handling path qcom_q6v5_request_stop() is invoked, which is
> based on the current rproc state whether to request a graceful shutdown.
> 
> But the current rproc `state` will be RPROC_CRASHED regardless of where
> the crash handler was initiated from, and empirical data shows that
> unless the firmware is taking part of the shutdown the system state is
> often left such that it's not possible to start the subsystem again.
> 
> Use the `running` state in the q6v5 driver to make the decision instead,
> as this does represent the actual state of the firmware.
> 
> This makes it possible to reliably trigger a restart from client
> drivers.
> 
> Fixes: 3cc889eb83f5 ("remoteproc: qcom: q6v5: Avoid setting smem bit in case of crash shutdown")
> Signed-of

Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>

Konrad