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>
This commit is contained in:
Родитель
5c212aaf54
Коммит
ed5da80873
|
@ -13,6 +13,7 @@
|
||||||
#include <linux/soc/qcom/smem.h>
|
#include <linux/soc/qcom/smem.h>
|
||||||
#include <linux/soc/qcom/smem_state.h>
|
#include <linux/soc/qcom/smem_state.h>
|
||||||
#include <linux/remoteproc.h>
|
#include <linux/remoteproc.h>
|
||||||
|
#include "qcom_common.h"
|
||||||
#include "qcom_q6v5.h"
|
#include "qcom_q6v5.h"
|
||||||
|
|
||||||
#define Q6V5_PANIC_DELAY_MS 200
|
#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
|
* qcom_q6v5_request_stop() - request the remote processor to stop
|
||||||
* @q6v5: reference to qcom_q6v5 context
|
* @q6v5: reference to qcom_q6v5 context
|
||||||
|
* @sysmon: reference to the remote's sysmon instance, or NULL
|
||||||
*
|
*
|
||||||
* Return: 0 on success, negative errno on failure
|
* 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;
|
int ret;
|
||||||
|
|
||||||
q6v5->running = false;
|
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,
|
qcom_smem_state_update_bits(q6v5->state,
|
||||||
BIT(q6v5->stop_bit), BIT(q6v5->stop_bit));
|
BIT(q6v5->stop_bit), BIT(q6v5->stop_bit));
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
struct rproc;
|
struct rproc;
|
||||||
struct qcom_smem_state;
|
struct qcom_smem_state;
|
||||||
|
struct qcom_sysmon;
|
||||||
|
|
||||||
struct qcom_q6v5 {
|
struct qcom_q6v5 {
|
||||||
struct device *dev;
|
struct device *dev;
|
||||||
|
@ -40,7 +41,7 @@ int qcom_q6v5_init(struct qcom_q6v5 *q6v5, struct platform_device *pdev,
|
||||||
|
|
||||||
int qcom_q6v5_prepare(struct qcom_q6v5 *q6v5);
|
int qcom_q6v5_prepare(struct qcom_q6v5 *q6v5);
|
||||||
int qcom_q6v5_unprepare(struct qcom_q6v5 *q6v5);
|
int qcom_q6v5_unprepare(struct qcom_q6v5 *q6v5);
|
||||||
int qcom_q6v5_request_stop(struct qcom_q6v5 *q6v5);
|
int qcom_q6v5_request_stop(struct qcom_q6v5 *q6v5, struct qcom_sysmon *sysmon);
|
||||||
int qcom_q6v5_wait_for_start(struct qcom_q6v5 *q6v5, int timeout);
|
int qcom_q6v5_wait_for_start(struct qcom_q6v5 *q6v5, int timeout);
|
||||||
unsigned long qcom_q6v5_panic(struct qcom_q6v5 *q6v5);
|
unsigned long qcom_q6v5_panic(struct qcom_q6v5 *q6v5);
|
||||||
|
|
||||||
|
|
|
@ -264,7 +264,7 @@ static int adsp_stop(struct rproc *rproc)
|
||||||
int handover;
|
int handover;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = qcom_q6v5_request_stop(&adsp->q6v5);
|
ret = qcom_q6v5_request_stop(&adsp->q6v5, adsp->sysmon);
|
||||||
if (ret == -ETIMEDOUT)
|
if (ret == -ETIMEDOUT)
|
||||||
dev_err(adsp->dev, "timed out on wait\n");
|
dev_err(adsp->dev, "timed out on wait\n");
|
||||||
|
|
||||||
|
|
|
@ -1383,7 +1383,7 @@ static int q6v5_stop(struct rproc *rproc)
|
||||||
struct q6v5 *qproc = (struct q6v5 *)rproc->priv;
|
struct q6v5 *qproc = (struct q6v5 *)rproc->priv;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = qcom_q6v5_request_stop(&qproc->q6v5);
|
ret = qcom_q6v5_request_stop(&qproc->q6v5, qproc->sysmon);
|
||||||
if (ret == -ETIMEDOUT)
|
if (ret == -ETIMEDOUT)
|
||||||
dev_err(qproc->dev, "timed out on wait\n");
|
dev_err(qproc->dev, "timed out on wait\n");
|
||||||
|
|
||||||
|
|
|
@ -214,7 +214,7 @@ static int adsp_stop(struct rproc *rproc)
|
||||||
int handover;
|
int handover;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = qcom_q6v5_request_stop(&adsp->q6v5);
|
ret = qcom_q6v5_request_stop(&adsp->q6v5, adsp->sysmon);
|
||||||
if (ret == -ETIMEDOUT)
|
if (ret == -ETIMEDOUT)
|
||||||
dev_err(adsp->dev, "timed out on wait\n");
|
dev_err(adsp->dev, "timed out on wait\n");
|
||||||
|
|
||||||
|
|
|
@ -390,7 +390,7 @@ static int q6v5_wcss_stop(struct rproc *rproc)
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* WCSS powerdown */
|
/* WCSS powerdown */
|
||||||
ret = qcom_q6v5_request_stop(&wcss->q6v5);
|
ret = qcom_q6v5_request_stop(&wcss->q6v5, NULL);
|
||||||
if (ret == -ETIMEDOUT) {
|
if (ret == -ETIMEDOUT) {
|
||||||
dev_err(wcss->dev, "timed out on wait\n");
|
dev_err(wcss->dev, "timed out on wait\n");
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче