summaryrefslogtreecommitdiffstats
path: root/drivers/remoteproc/qcom_q6v5.c
diff options
context:
space:
mode:
authorBjorn Andersson <bjorn.andersson@linaro.org>2020-11-21 21:41:34 -0800
committerBjorn Andersson <bjorn.andersson@linaro.org>2020-11-25 23:05:24 -0600
commited5da80873a792b9b2b560a6417bc60679ba5126 (patch)
treebc9c68f1d849d8d4008a5d0d36c91d54c7950ef5 /drivers/remoteproc/qcom_q6v5.c
parent5c212aaf5457ca5bd99aba3ad29a4a17f8129939 (diff)
downloadlinux-ed5da80873a792b9b2b560a6417bc60679ba5126.tar.gz
linux-ed5da80873a792b9b2b560a6417bc60679ba5126.tar.bz2
linux-ed5da80873a792b9b2b560a6417bc60679ba5126.zip
remoteproc: qcom: q6v5: Query sysmon before graceful shutdown
Requesting a graceful shutdown through the shared memory state signals will not be acked in the event that sysmon has already successfully shut down the remote firmware. So extend the stop request API to optionally take the remoteproc's sysmon instance and query if there's already been a successful shutdown attempt, before doing the signal dance. Tested-by: Steev Klimaszewski <steev@kali.org> Reviewed-by: Rishabh Bhatnagar <rishabhb@codeaurora.org> Link: https://lore.kernel.org/r/20201122054135.802935-4-bjorn.andersson@linaro.org Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Diffstat (limited to 'drivers/remoteproc/qcom_q6v5.c')
-rw-r--r--drivers/remoteproc/qcom_q6v5.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/remoteproc/qcom_q6v5.c b/drivers/remoteproc/qcom_q6v5.c
index fd6fd36268d9..9627a950928e 100644
--- a/drivers/remoteproc/qcom_q6v5.c
+++ b/drivers/remoteproc/qcom_q6v5.c
@@ -13,6 +13,7 @@
#include <linux/soc/qcom/smem.h>
#include <linux/soc/qcom/smem_state.h>
#include <linux/remoteproc.h>
+#include "qcom_common.h"
#include "qcom_q6v5.h"
#define Q6V5_PANIC_DELAY_MS 200
@@ -146,15 +147,20 @@ static irqreturn_t q6v5_stop_interrupt(int irq, void *data)
/**
* qcom_q6v5_request_stop() - request the remote processor to stop
* @q6v5: reference to qcom_q6v5 context
+ * @sysmon: reference to the remote's sysmon instance, or NULL
*
* Return: 0 on success, negative errno on failure
*/
-int qcom_q6v5_request_stop(struct qcom_q6v5 *q6v5)
+int qcom_q6v5_request_stop(struct qcom_q6v5 *q6v5, struct qcom_sysmon *sysmon)
{
int ret;
q6v5->running = false;
+ /* Don't perform SMP2P dance if sysmon already shut down the remote */
+ if (qcom_sysmon_shutdown_acked(sysmon))
+ return 0;
+
qcom_smem_state_update_bits(q6v5->state,
BIT(q6v5->stop_bit), BIT(q6v5->stop_bit));