From patchwork Mon May 30 06:22:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sibi Sankar X-Patchwork-Id: 12864322 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 739CAC433F5 for ; Mon, 30 May 2022 06:23:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232771AbiE3GXM (ORCPT ); Mon, 30 May 2022 02:23:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232767AbiE3GXK (ORCPT ); Mon, 30 May 2022 02:23:10 -0400 Received: from alexa-out.qualcomm.com (alexa-out.qualcomm.com [129.46.98.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B00C2B487; Sun, 29 May 2022 23:23:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1653891790; x=1685427790; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=Zhjw5wjT4DU/ZqIbobCSO5u3VL9ubyxGEYoFZFgyKcA=; b=ANVfcTbBi/nb/9KH1Wi7DfVBp29hQ9PHWzAigdPGASCm1/5KbPJ5DUiB Cpd2QLh54Udsfj+eqM9fn+lIwfzzfF26VNn7mcu8FHn2Eckjgd1vafu4s UvQlQNF3qVjGFKG8IpUkoj8zaIzecHmJqWw3t+Bq+9hxKheVYzGv0stwJ 4=; Received: from ironmsg-lv-alpha.qualcomm.com ([10.47.202.13]) by alexa-out.qualcomm.com with ESMTP; 29 May 2022 23:23:09 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg-lv-alpha.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 May 2022 23:23:08 -0700 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Sun, 29 May 2022 23:23:08 -0700 Received: from blr-ubuntu-87.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Sun, 29 May 2022 23:23:05 -0700 From: Sibi Sankar To: CC: , , , , , , , Sibi Sankar Subject: [V2 1/6] remoteproc: qcom: pas: Add decrypt shutdown support for modem Date: Mon, 30 May 2022 11:52:46 +0530 Message-ID: <1653891771-17103-2-git-send-email-quic_sibis@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1653891771-17103-1-git-send-email-quic_sibis@quicinc.com> References: <1653891771-17103-1-git-send-email-quic_sibis@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org The initial shutdown request to modem on SM8450 SoCs would start the decryption process and will keep returning errors until the modem shutdown is complete. Fix this by retrying shutdowns in fixed intervals. Err Logs on modem shutdown: qcom_q6v5_pas 4080000.remoteproc: failed to shutdown: -22 remoteproc remoteproc3: can't stop rproc: -22 Fixes: 5cef9b48458d ("remoteproc: qcom: pas: Add SM8450 remoteproc support") Signed-off-by: Sibi Sankar --- drivers/remoteproc/qcom_q6v5_pas.c | 67 +++++++++++++++++++++++++++++++++++++- 1 file changed, 66 insertions(+), 1 deletion(-) diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c index 6ae39c5653b1..02435810dc7c 100644 --- a/drivers/remoteproc/qcom_q6v5_pas.c +++ b/drivers/remoteproc/qcom_q6v5_pas.c @@ -8,6 +8,7 @@ */ #include +#include #include #include #include @@ -29,6 +30,8 @@ #include "qcom_q6v5.h" #include "remoteproc_internal.h" +#define ADSP_DECRYPT_SHUTDOWN_DELAY_MS 100 + struct adsp_data { int crash_reason_smem; const char *firmware_name; @@ -36,6 +39,7 @@ struct adsp_data { unsigned int minidump_id; bool has_aggre2_clk; bool auto_boot; + bool decrypt_shutdown; char **proxy_pd_names; @@ -65,6 +69,7 @@ struct qcom_adsp { unsigned int minidump_id; int crash_reason_smem; bool has_aggre2_clk; + bool decrypt_shutdown; const char *info_name; struct completion start_done; @@ -128,6 +133,20 @@ static void adsp_pds_disable(struct qcom_adsp *adsp, struct device **pds, } } +static int adsp_decrypt_shutdown(struct qcom_adsp *adsp) +{ + int retry_num = 50; + int ret = -EINVAL; + + while (retry_num && ret) { + msleep(ADSP_DECRYPT_SHUTDOWN_DELAY_MS); + ret = qcom_scm_pas_shutdown(adsp->pas_id); + retry_num--; + } + + return ret; +} + static int adsp_unprepare(struct rproc *rproc) { struct qcom_adsp *adsp = (struct qcom_adsp *)rproc->priv; @@ -249,6 +268,9 @@ static int adsp_stop(struct rproc *rproc) dev_err(adsp->dev, "timed out on wait\n"); ret = qcom_scm_pas_shutdown(adsp->pas_id); + if (ret && adsp->decrypt_shutdown) + ret = adsp_decrypt_shutdown(adsp); + if (ret) dev_err(adsp->dev, "failed to shutdown: %d\n", ret); @@ -459,6 +481,7 @@ static int adsp_probe(struct platform_device *pdev) adsp->pas_id = desc->pas_id; adsp->has_aggre2_clk = desc->has_aggre2_clk; adsp->info_name = desc->sysmon_name; + adsp->decrypt_shutdown = desc->decrypt_shutdown; platform_set_drvdata(pdev, adsp); device_wakeup_enable(adsp->dev); @@ -533,6 +556,7 @@ static const struct adsp_data adsp_resource_init = { .pas_id = 1, .has_aggre2_clk = false, .auto_boot = true, + .decrypt_shutdown = false, .ssr_name = "lpass", .sysmon_name = "adsp", .ssctl_id = 0x14, @@ -544,6 +568,7 @@ static const struct adsp_data sdm845_adsp_resource_init = { .pas_id = 1, .has_aggre2_clk = false, .auto_boot = true, + .decrypt_shutdown = false, .load_state = "adsp", .ssr_name = "lpass", .sysmon_name = "adsp", @@ -556,6 +581,7 @@ static const struct adsp_data sm6350_adsp_resource = { .pas_id = 1, .has_aggre2_clk = false, .auto_boot = true, + .decrypt_shutdown = false, .proxy_pd_names = (char*[]){ "lcx", "lmx", @@ -573,6 +599,7 @@ static const struct adsp_data sm8150_adsp_resource = { .pas_id = 1, .has_aggre2_clk = false, .auto_boot = true, + .decrypt_shutdown = false, .proxy_pd_names = (char*[]){ "cx", NULL @@ -589,6 +616,7 @@ static const struct adsp_data sm8250_adsp_resource = { .pas_id = 1, .has_aggre2_clk = false, .auto_boot = true, + .decrypt_shutdown = false, .proxy_pd_names = (char*[]){ "lcx", "lmx", @@ -606,6 +634,7 @@ static const struct adsp_data sm8350_adsp_resource = { .pas_id = 1, .has_aggre2_clk = false, .auto_boot = true, + .decrypt_shutdown = false, .proxy_pd_names = (char*[]){ "lcx", "lmx", @@ -623,6 +652,7 @@ static const struct adsp_data msm8996_adsp_resource = { .pas_id = 1, .has_aggre2_clk = false, .auto_boot = true, + .decrypt_shutdown = false, .proxy_pd_names = (char*[]){ "cx", NULL @@ -638,6 +668,7 @@ static const struct adsp_data cdsp_resource_init = { .pas_id = 18, .has_aggre2_clk = false, .auto_boot = true, + .decrypt_shutdown = false, .ssr_name = "cdsp", .sysmon_name = "cdsp", .ssctl_id = 0x17, @@ -649,6 +680,7 @@ static const struct adsp_data sdm845_cdsp_resource_init = { .pas_id = 18, .has_aggre2_clk = false, .auto_boot = true, + .decrypt_shutdown = false, .load_state = "cdsp", .ssr_name = "cdsp", .sysmon_name = "cdsp", @@ -661,6 +693,7 @@ static const struct adsp_data sm6350_cdsp_resource = { .pas_id = 18, .has_aggre2_clk = false, .auto_boot = true, + .decrypt_shutdown = false, .proxy_pd_names = (char*[]){ "cx", "mx", @@ -678,6 +711,7 @@ static const struct adsp_data sm8150_cdsp_resource = { .pas_id = 18, .has_aggre2_clk = false, .auto_boot = true, + .decrypt_shutdown = false, .proxy_pd_names = (char*[]){ "cx", NULL @@ -694,6 +728,7 @@ static const struct adsp_data sm8250_cdsp_resource = { .pas_id = 18, .has_aggre2_clk = false, .auto_boot = true, + .decrypt_shutdown = false, .proxy_pd_names = (char*[]){ "cx", NULL @@ -710,6 +745,7 @@ static const struct adsp_data sc8280xp_nsp0_resource = { .pas_id = 18, .has_aggre2_clk = false, .auto_boot = true, + .decrypt_shutdown = false, .proxy_pd_names = (char*[]){ "nsp", NULL @@ -725,6 +761,7 @@ static const struct adsp_data sc8280xp_nsp1_resource = { .pas_id = 30, .has_aggre2_clk = false, .auto_boot = true, + .decrypt_shutdown = false, .proxy_pd_names = (char*[]){ "nsp", NULL @@ -740,6 +777,7 @@ static const struct adsp_data sm8350_cdsp_resource = { .pas_id = 18, .has_aggre2_clk = false, .auto_boot = true, + .decrypt_shutdown = false, .proxy_pd_names = (char*[]){ "cx", "mxc", @@ -758,6 +796,7 @@ static const struct adsp_data mpss_resource_init = { .minidump_id = 3, .has_aggre2_clk = false, .auto_boot = false, + .decrypt_shutdown = false, .proxy_pd_names = (char*[]){ "cx", "mss", @@ -775,6 +814,7 @@ static const struct adsp_data sc8180x_mpss_resource = { .pas_id = 4, .has_aggre2_clk = false, .auto_boot = false, + .decrypt_shutdown = false, .proxy_pd_names = (char*[]){ "cx", NULL @@ -791,6 +831,7 @@ static const struct adsp_data slpi_resource_init = { .pas_id = 12, .has_aggre2_clk = true, .auto_boot = true, + .decrypt_shutdown = false, .proxy_pd_names = (char*[]){ "ssc_cx", NULL @@ -806,6 +847,7 @@ static const struct adsp_data sm8150_slpi_resource = { .pas_id = 12, .has_aggre2_clk = false, .auto_boot = true, + .decrypt_shutdown = false, .proxy_pd_names = (char*[]){ "lcx", "lmx", @@ -823,6 +865,7 @@ static const struct adsp_data sm8250_slpi_resource = { .pas_id = 12, .has_aggre2_clk = false, .auto_boot = true, + .decrypt_shutdown = false, .proxy_pd_names = (char*[]){ "lcx", "lmx", @@ -840,6 +883,7 @@ static const struct adsp_data sm8350_slpi_resource = { .pas_id = 12, .has_aggre2_clk = false, .auto_boot = true, + .decrypt_shutdown = false, .proxy_pd_names = (char*[]){ "lcx", "lmx", @@ -856,6 +900,7 @@ static const struct adsp_data wcss_resource_init = { .firmware_name = "wcnss.mdt", .pas_id = 6, .auto_boot = true, + .decrypt_shutdown = false, .ssr_name = "mpss", .sysmon_name = "wcnss", .ssctl_id = 0x12, @@ -867,6 +912,7 @@ static const struct adsp_data sdx55_mpss_resource = { .pas_id = 4, .has_aggre2_clk = false, .auto_boot = true, + .decrypt_shutdown = false, .proxy_pd_names = (char*[]){ "cx", "mss", @@ -877,6 +923,25 @@ static const struct adsp_data sdx55_mpss_resource = { .ssctl_id = 0x22, }; +static const struct adsp_data sm8450_mpss_resource = { + .crash_reason_smem = 421, + .firmware_name = "modem.mdt", + .pas_id = 4, + .minidump_id = 3, + .has_aggre2_clk = false, + .auto_boot = false, + .decrypt_shutdown = true, + .proxy_pd_names = (char*[]){ + "cx", + "mss", + NULL + }, + .load_state = "modem", + .ssr_name = "mpss", + .sysmon_name = "modem", + .ssctl_id = 0x12, +}; + static const struct of_device_id adsp_of_match[] = { { .compatible = "qcom,msm8226-adsp-pil", .data = &adsp_resource_init}, { .compatible = "qcom,msm8974-adsp-pil", .data = &adsp_resource_init}, @@ -916,7 +981,7 @@ static const struct of_device_id adsp_of_match[] = { { .compatible = "qcom,sm8450-adsp-pas", .data = &sm8350_adsp_resource}, { .compatible = "qcom,sm8450-cdsp-pas", .data = &sm8350_cdsp_resource}, { .compatible = "qcom,sm8450-slpi-pas", .data = &sm8350_slpi_resource}, - { .compatible = "qcom,sm8450-mpss-pas", .data = &mpss_resource_init}, + { .compatible = "qcom,sm8450-mpss-pas", .data = &sm8450_mpss_resource}, { }, }; MODULE_DEVICE_TABLE(of, adsp_of_match); From patchwork Mon May 30 06:22:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sibi Sankar X-Patchwork-Id: 12864323 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD855C4332F for ; Mon, 30 May 2022 06:23:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232726AbiE3GXO (ORCPT ); Mon, 30 May 2022 02:23:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232763AbiE3GXN (ORCPT ); Mon, 30 May 2022 02:23:13 -0400 Received: from alexa-out-sd-02.qualcomm.com (alexa-out-sd-02.qualcomm.com [199.106.114.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E82C0B487; Sun, 29 May 2022 23:23:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1653891792; x=1685427792; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=0i3gn/3yKDdO1BXy5oG4c7hzmUFAu5PnWrdid69AP3o=; b=Y+heJaijpfu+1m62IIsOHEFAXJWKLvOkdfPoWBnm6r3Gc32WGkyD5eUb 5tB9Eu8R/G9yiiPRij+k6aR7CiEeWE89Sr+VM3DcOz/A3L/KQBTN+lzgy /WeHyJrABdbpuYC9jtmv72uUz0prMYSThxcKdoSapleiyqAIwBDflZcUI Q=; Received: from unknown (HELO ironmsg04-sd.qualcomm.com) ([10.53.140.144]) by alexa-out-sd-02.qualcomm.com with ESMTP; 29 May 2022 23:23:12 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg04-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 May 2022 23:23:12 -0700 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Sun, 29 May 2022 23:23:12 -0700 Received: from blr-ubuntu-87.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Sun, 29 May 2022 23:23:08 -0700 From: Sibi Sankar To: CC: , , , , , , , Siddharth Gupta , Sibi Sankar Subject: [V2 2/6] remoteproc: qcom: pas: Mark va as io memory Date: Mon, 30 May 2022 11:52:47 +0530 Message-ID: <1653891771-17103-3-git-send-email-quic_sibis@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1653891771-17103-1-git-send-email-quic_sibis@quicinc.com> References: <1653891771-17103-1-git-send-email-quic_sibis@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org From: Siddharth Gupta The pas driver remaps the entire carveout region using the dev_ioremap_wc() call, which is then used in the adsp_da_to_va() calls made by the rproc framework. This change marks the va returned by this call as an iomem va. Signed-off-by: Siddharth Gupta Signed-off-by: Sibi Sankar --- drivers/remoteproc/qcom_q6v5_pas.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c index 02435810dc7c..eb817809d5d4 100644 --- a/drivers/remoteproc/qcom_q6v5_pas.c +++ b/drivers/remoteproc/qcom_q6v5_pas.c @@ -290,6 +290,9 @@ static void *adsp_da_to_va(struct rproc *rproc, u64 da, size_t len, bool *is_iom if (offset < 0 || offset + len > adsp->mem_size) return NULL; + if (is_iomem) + *is_iomem = true; + return adsp->mem_region + offset; } From patchwork Mon May 30 06:22:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sibi Sankar X-Patchwork-Id: 12864324 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 679DAC433FE for ; Mon, 30 May 2022 06:23:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232763AbiE3GX1 (ORCPT ); Mon, 30 May 2022 02:23:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232767AbiE3GXS (ORCPT ); Mon, 30 May 2022 02:23:18 -0400 Received: from alexa-out-sd-01.qualcomm.com (alexa-out-sd-01.qualcomm.com [199.106.114.38]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4F10B49A; Sun, 29 May 2022 23:23:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1653891797; x=1685427797; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=McfwcvKWW0TNLIO3cncs6dQjZ0QsI6YIBZWV+ZrCtdE=; b=MKTn/FzjLkJDMVA+Krc0BZmfakYmjT2I28UN76Rq7uiOn+iPrJVPYNKH 0zAsPlFvQ1+VFYQqlEG8NBqRvKUeN4zhGEkG5ykfR7w/SpS7UIZJJ3FuJ HjuMZcBS56aQBfFml6KlU3Hi9iUAEflJoYHki4k2KfQRBWiT+wBJhx3/V g=; Received: from unknown (HELO ironmsg02-sd.qualcomm.com) ([10.53.140.142]) by alexa-out-sd-01.qualcomm.com with ESMTP; 29 May 2022 23:23:16 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg02-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 May 2022 23:23:16 -0700 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Sun, 29 May 2022 23:23:15 -0700 Received: from blr-ubuntu-87.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Sun, 29 May 2022 23:23:12 -0700 From: Sibi Sankar To: CC: , , , , , , , Siddharth Gupta , Sibi Sankar Subject: [V2 3/6] remoteproc: qcom: pas: Mark devices as wakeup capable Date: Mon, 30 May 2022 11:52:48 +0530 Message-ID: <1653891771-17103-4-git-send-email-quic_sibis@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1653891771-17103-1-git-send-email-quic_sibis@quicinc.com> References: <1653891771-17103-1-git-send-email-quic_sibis@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org From: Siddharth Gupta device_wakeup_enable() on its own is not capable of setting device as wakeup capable, it needs to be used in conjunction with device_set_wakeup_capable(). The device_init_wakeup() calls both these functions on the device passed. Fixes: a781e5aa5911 ("remoteproc: core: Prevent system suspend during remoteproc recovery") Signed-off-by: Siddharth Gupta Signed-off-by: Sibi Sankar --- drivers/remoteproc/qcom_q6v5_pas.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c index eb817809d5d4..22736723448a 100644 --- a/drivers/remoteproc/qcom_q6v5_pas.c +++ b/drivers/remoteproc/qcom_q6v5_pas.c @@ -487,7 +487,9 @@ static int adsp_probe(struct platform_device *pdev) adsp->decrypt_shutdown = desc->decrypt_shutdown; platform_set_drvdata(pdev, adsp); - device_wakeup_enable(adsp->dev); + ret = device_init_wakeup(adsp->dev, true); + if (ret) + goto free_rproc; ret = adsp_alloc_memory_region(adsp); if (ret) From patchwork Mon May 30 06:22:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sibi Sankar X-Patchwork-Id: 12864326 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2E6FC4332F for ; Mon, 30 May 2022 06:23:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232798AbiE3GXa (ORCPT ); Mon, 30 May 2022 02:23:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232788AbiE3GXV (ORCPT ); Mon, 30 May 2022 02:23:21 -0400 Received: from alexa-out.qualcomm.com (alexa-out.qualcomm.com [129.46.98.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9601B7C1; Sun, 29 May 2022 23:23:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1653891801; x=1685427801; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=E2jHDHi18Z+mWHWAL+E/cky65ceubcR6Tm6q2NH1E+4=; b=ZWX4PvUIwOIfTft6lPAKG6t+sMvda63wUKbCSEBn3Vd6UBin5Qf4nOJ5 sDeG+HLv1HJUThGddjGNVjFrQipBdwe1FXaAdIKLAwg7nXD1nD6mODVdf XsFHTHUbmud5/s8tLQUkvcAi6oB6z+PuDDPpOXa+3Kyz4uiWDmibhWh1c M=; Received: from ironmsg09-lv.qualcomm.com ([10.47.202.153]) by alexa-out.qualcomm.com with ESMTP; 29 May 2022 23:23:20 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg09-lv.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 May 2022 23:23:19 -0700 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Sun, 29 May 2022 23:23:19 -0700 Received: from blr-ubuntu-87.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Sun, 29 May 2022 23:23:15 -0700 From: Sibi Sankar To: CC: , , , , , , , Siddharth Gupta , Sibi Sankar Subject: [V2 4/6] remoteproc: qcom: pas: Check if coredump is enabled Date: Mon, 30 May 2022 11:52:49 +0530 Message-ID: <1653891771-17103-5-git-send-email-quic_sibis@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1653891771-17103-1-git-send-email-quic_sibis@quicinc.com> References: <1653891771-17103-1-git-send-email-quic_sibis@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org From: Siddharth Gupta Client drivers need to check if coredump is enabled for the rproc before continuing with coredump generation. This change adds a check in the PAS driver. Fixes: 8ed8485c4f05 ("remoteproc: qcom: Add capability to collect minidumps") Signed-off-by: Siddharth Gupta Signed-off-by: Sibi Sankar --- drivers/remoteproc/qcom_q6v5_pas.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c index 22736723448a..dd3f89fbac78 100644 --- a/drivers/remoteproc/qcom_q6v5_pas.c +++ b/drivers/remoteproc/qcom_q6v5_pas.c @@ -92,6 +92,9 @@ static void adsp_minidump(struct rproc *rproc) { struct qcom_adsp *adsp = rproc->priv; + if (rproc->dump_conf == RPROC_COREDUMP_DISABLED) + return; + qcom_minidump(rproc, adsp->minidump_id); } From patchwork Mon May 30 06:22:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sibi Sankar X-Patchwork-Id: 12864325 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 254A6C433EF for ; Mon, 30 May 2022 06:23:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232803AbiE3GX3 (ORCPT ); Mon, 30 May 2022 02:23:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231684AbiE3GX0 (ORCPT ); Mon, 30 May 2022 02:23:26 -0400 Received: from alexa-out-sd-01.qualcomm.com (alexa-out-sd-01.qualcomm.com [199.106.114.38]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4557B7C8; Sun, 29 May 2022 23:23:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1653891803; x=1685427803; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=kQsY5dppdnct/ZNtz2heoo4zsfgJCzMJGLniMhE5u8c=; b=pJfKj9ms2EMEvLepLh0TJEvd+PGxgJ/He2h8PLr0JS4HN8pLSK6gqt4K /tHrmyFfMr7daVkHBIWLgF6mydUXijRkbGSN/WhPR61bUkRkOxQKTBPHo epQsHy/RUrjD5/HojdTqIAEdLZDQVHCuaqYyd1aRwk8sU5mhHgrTBXTzi k=; Received: from unknown (HELO ironmsg05-sd.qualcomm.com) ([10.53.140.145]) by alexa-out-sd-01.qualcomm.com with ESMTP; 29 May 2022 23:23:23 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg05-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 May 2022 23:23:23 -0700 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Sun, 29 May 2022 23:23:23 -0700 Received: from blr-ubuntu-87.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Sun, 29 May 2022 23:23:19 -0700 From: Sibi Sankar To: CC: , , , , , , , Siddharth Gupta , Sibi Sankar Subject: [V2 5/6] remoteproc: q6v5: Set q6 state to offline on receiving wdog irq Date: Mon, 30 May 2022 11:52:50 +0530 Message-ID: <1653891771-17103-6-git-send-email-quic_sibis@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1653891771-17103-1-git-send-email-quic_sibis@quicinc.com> References: <1653891771-17103-1-git-send-email-quic_sibis@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org From: Siddharth Gupta Due to firmware bugs on the Q6 the hardware watchdog irq can be triggered multiple times. As the remoteproc framework schedules work items for the recovery process, if the other threads do not get a chance to run before recovery is completed the proceeding threads will see the state of the remoteproc as running and kill the remoteproc while it is running. This can result in various SMMU and NOC errors. This change sets the state of the remoteproc to offline whenever a watchdog irq is received. Signed-off-by: Siddharth Gupta Signed-off-by: Sibi Sankar --- drivers/remoteproc/qcom_q6v5.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/remoteproc/qcom_q6v5.c b/drivers/remoteproc/qcom_q6v5.c index 5280ec9b5449..497acfb33f8f 100644 --- a/drivers/remoteproc/qcom_q6v5.c +++ b/drivers/remoteproc/qcom_q6v5.c @@ -112,6 +112,7 @@ static irqreturn_t q6v5_wdog_interrupt(int irq, void *data) else dev_err(q6v5->dev, "watchdog without message\n"); + q6v5->running = false; rproc_report_crash(q6v5->rproc, RPROC_WATCHDOG); return IRQ_HANDLED; @@ -123,6 +124,9 @@ static irqreturn_t q6v5_fatal_interrupt(int irq, void *data) size_t len; char *msg; + if (!q6v5->running) + return IRQ_HANDLED; + msg = qcom_smem_get(QCOM_SMEM_HOST_ANY, q6v5->crash_reason, &len); if (!IS_ERR(msg) && len > 0 && msg[0]) dev_err(q6v5->dev, "fatal error received: %s\n", msg); From patchwork Mon May 30 06:22:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sibi Sankar X-Patchwork-Id: 12864327 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40A6EC433EF for ; Mon, 30 May 2022 06:23:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232816AbiE3GXh (ORCPT ); Mon, 30 May 2022 02:23:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232801AbiE3GX2 (ORCPT ); Mon, 30 May 2022 02:23:28 -0400 Received: from alexa-out.qualcomm.com (alexa-out.qualcomm.com [129.46.98.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BEE7B487; Sun, 29 May 2022 23:23:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1653891807; x=1685427807; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=shTB0DnuQEAQMrBnn3hQIHFMKfWKIyiEX/Amn09n/BM=; b=Q+EXTRUfBlfgZrTKmjbC2c+8fT4OL+zkUWMJe2jqskfatjPyHTSJfVv6 gN8JMV0qy9Z8gp3oyzB2If0gcucoKd9eV9B3fnEi+OLvxqZjc+STSJ2Pj 2AMGWW3qWsQwTxQ7COxhh4++2CkEHpeonh+lLxpjF8McI6s5XfgKT4ruW A=; Received: from ironmsg08-lv.qualcomm.com ([10.47.202.152]) by alexa-out.qualcomm.com with ESMTP; 29 May 2022 23:23:27 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg08-lv.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 May 2022 23:23:26 -0700 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Sun, 29 May 2022 23:23:26 -0700 Received: from blr-ubuntu-87.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Sun, 29 May 2022 23:23:23 -0700 From: Sibi Sankar To: CC: , , , , , , , Siddharth Gupta , Sibi Sankar Subject: [V2 6/6] remoteproc: sysmon: Send sysmon state only for running rprocs Date: Mon, 30 May 2022 11:52:51 +0530 Message-ID: <1653891771-17103-7-git-send-email-quic_sibis@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1653891771-17103-1-git-send-email-quic_sibis@quicinc.com> References: <1653891771-17103-1-git-send-email-quic_sibis@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org From: Siddharth Gupta When a new remoteproc boots up, send the sysmon state notification of only running remoteprocs. Sending state of remoteprocs booting up in parallel can cause a race between SSR clients of the remoteproc that is booting up and the sysmon notification for the same remoteproc, resulting in an inconsistency between which state the remoteproc that is booting up in parallel. For example - if remoteproc A and B crash one after the other, after remoteproc A boots up, if the remoteproc A tries to get the state of remoteproc B before the sysmon subdevice for B is invoked but after the ssr subdevice of B has been invoked, clients on remoteproc A might get confused when the sysmon notification indicates a different state. Signed-off-by: Siddharth Gupta Signed-off-by: Sibi Sankar --- drivers/remoteproc/qcom_sysmon.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/remoteproc/qcom_sysmon.c b/drivers/remoteproc/qcom_sysmon.c index a9f04dd83ab6..57dde2a69b9d 100644 --- a/drivers/remoteproc/qcom_sysmon.c +++ b/drivers/remoteproc/qcom_sysmon.c @@ -512,10 +512,12 @@ static int sysmon_start(struct rproc_subdev *subdev) mutex_lock(&sysmon_lock); list_for_each_entry(target, &sysmon_list, node) { - if (target == sysmon) + mutex_lock(&target->state_lock); + if (target == sysmon || target->state != SSCTL_SSR_EVENT_AFTER_POWERUP) { + mutex_unlock(&target->state_lock); continue; + } - mutex_lock(&target->state_lock); event.subsys_name = target->name; event.ssr_event = target->state;