From patchwork Fri Feb 24 19:57:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gokul krishna Krishnakumar X-Patchwork-Id: 13151759 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 90645C64ED8 for ; Fri, 24 Feb 2023 19:58:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229744AbjBXT6j (ORCPT ); Fri, 24 Feb 2023 14:58:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229753AbjBXT6i (ORCPT ); Fri, 24 Feb 2023 14:58:38 -0500 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D30668284; Fri, 24 Feb 2023 11:58:19 -0800 (PST) Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 31O4c3F4002912; Fri, 24 Feb 2023 19:57:48 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=FmmHn3N4zLenWPZC4yrlGP8GAiod0by7RkROqldF1U4=; b=l0Yn1YGlH0UyeEYr2qVuwRVs1XrA469FPTxeVT+FvWRWc5vYyqnSS6oz3KZ5vrwQPiWU 6whpbbt/zu3LnFKBOBtaGwLTy2Rwl9wgjSXLAu8xKSYDuSMUTIsMQaa1rn3HlLTNZOyt seW+BkcGEa9F9Iv+Yint3KDh0cX5C6seMN73kZR1mYvjXLj34KRux+TUq5mM1B881DKb N9Z3vQ9KeevB2Zpt38CXUzR8Rm/D0+4LCJ8aLqNBUXCPHXp9bYdTcWEEVtNMsL4r1T34 VMMPG51UZdPe/Voxu+G8g/6hYhqSfNdnjN0UmXK69mZEcHZ087R10BLIHOZGCq4/saT3 Lg== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3nxpcqtg32-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 24 Feb 2023 19:57:48 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 31OJvluD026077 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 24 Feb 2023 19:57:47 GMT Received: from hu-gokukris-sd.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.41; Fri, 24 Feb 2023 11:57:46 -0800 From: Gokul krishna Krishnakumar To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Mathieu Poirier CC: Trilok Soni , Satya Durga Srinivasu Prabhala , Rajendra Nayak , "Elliot Berman" , Guru Das Srinagesh , Sibi Sankar , , , , Siddharth Gupta , Gokul krishna Krishnakumar Subject: [PATCH v4 1/2] remoteproc: core: Export the rproc coredump APIs Date: Fri, 24 Feb 2023 11:57:30 -0800 Message-ID: <20230224195731.324-2-quic_gokukris@quicinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230224195731.324-1-quic_gokukris@quicinc.com> References: <20230224195731.324-1-quic_gokukris@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: 0BgZz9GlSXC_zj26jI6c3-0E_m-nQ7g3 X-Proofpoint-GUID: 0BgZz9GlSXC_zj26jI6c3-0E_m-nQ7g3 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.170.22 definitions=2023-02-24_14,2023-02-24_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 phishscore=0 adultscore=0 impostorscore=0 lowpriorityscore=0 clxscore=1011 priorityscore=1501 mlxlogscore=999 spamscore=0 suspectscore=0 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2302240158 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Siddharth Gupta The remoteproc coredump APIs are currently only part of the internal remoteproc header. This prevents the remoteproc platform drivers from using these APIs when needed. This change moves the rproc_coredump() and rproc_coredump_cleanup() APIs to the linux header and marks them as exported symbols. Signed-off-by: Siddharth Gupta Signed-off-by: Gokul krishna Krishnakumar --- drivers/remoteproc/remoteproc_coredump.c | 2 ++ drivers/remoteproc/remoteproc_internal.h | 4 ---- include/linux/remoteproc.h | 4 ++++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/remoteproc/remoteproc_coredump.c b/drivers/remoteproc/remoteproc_coredump.c index 4b093420d98a..e8f1b580d1d9 100644 --- a/drivers/remoteproc/remoteproc_coredump.c +++ b/drivers/remoteproc/remoteproc_coredump.c @@ -32,6 +32,7 @@ void rproc_coredump_cleanup(struct rproc *rproc) kfree(entry); } } +EXPORT_SYMBOL(rproc_coredump_cleanup); /** * rproc_coredump_add_segment() - add segment of device memory to coredump @@ -327,6 +328,7 @@ void rproc_coredump(struct rproc *rproc) */ wait_for_completion(&dump_state.dump_done); } +EXPORT_SYMBOL(rproc_coredump); /** * rproc_coredump_using_sections() - perform coredump using section headers diff --git a/drivers/remoteproc/remoteproc_internal.h b/drivers/remoteproc/remoteproc_internal.h index d4dbb8d1d80c..f62a82d71dfa 100644 --- a/drivers/remoteproc/remoteproc_internal.h +++ b/drivers/remoteproc/remoteproc_internal.h @@ -76,10 +76,6 @@ extern struct class rproc_class; int rproc_init_sysfs(void); void rproc_exit_sysfs(void); -/* from remoteproc_coredump.c */ -void rproc_coredump_cleanup(struct rproc *rproc); -void rproc_coredump(struct rproc *rproc); - #ifdef CONFIG_REMOTEPROC_CDEV void rproc_init_cdev(void); void rproc_exit_cdev(void); diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h index fe8978eb69f1..b4795698d8c2 100644 --- a/include/linux/remoteproc.h +++ b/include/linux/remoteproc.h @@ -690,6 +690,10 @@ int rproc_detach(struct rproc *rproc); int rproc_set_firmware(struct rproc *rproc, const char *fw_name); void rproc_report_crash(struct rproc *rproc, enum rproc_crash_type type); void *rproc_da_to_va(struct rproc *rproc, u64 da, size_t len, bool *is_iomem); + +/* from remoteproc_coredump.c */ +void rproc_coredump_cleanup(struct rproc *rproc); +void rproc_coredump(struct rproc *rproc); void rproc_coredump_using_sections(struct rproc *rproc); int rproc_coredump_add_segment(struct rproc *rproc, dma_addr_t da, size_t size); int rproc_coredump_add_custom_segment(struct rproc *rproc, From patchwork Fri Feb 24 19:57:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gokul krishna Krishnakumar X-Patchwork-Id: 13151760 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 88EF2C7EE23 for ; Fri, 24 Feb 2023 19:58:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229802AbjBXT6s (ORCPT ); Fri, 24 Feb 2023 14:58:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229768AbjBXT6m (ORCPT ); Fri, 24 Feb 2023 14:58:42 -0500 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6962D231CC; Fri, 24 Feb 2023 11:58:21 -0800 (PST) Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 31OI9JNY010165; Fri, 24 Feb 2023 19:57:50 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=2KeglNGIGTjZRWimPDaOKRsBt+lnwUieaIjlGkQbDEM=; b=RpNaI/Y1nYfjLN8TRjethsyGt9gGoMdllJpVCokcq0AaafYosEuJQvXZu3Tc2/oP0I24 sRd5CiDDT/rtCFZM+2scXbQl+vQPIqzWenSPsnqYo8sL4gVZVzDvyjlo5Xq6PMqMP7il 1qyBZUpismUbw+ACFgH3JKd38WsACWkEH662u6lpTq94eKM1UfNXHAPD8RzHHQbW32C9 DMd+0XQoIThuBt0cRkLdmR7n90nwNZPjjLjZ30EQ4rfD1YlX6ewHFND4HwFK2Kj+PQmP oqqfx28KRh4ECgpHV7B6TiFCkRrUYCxPszqtYinpokI1y9fDdD4RI0KQGeiOnP+Egw2N pw== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3nwybwnrn4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 24 Feb 2023 19:57:50 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 31OJvnAr023543 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 24 Feb 2023 19:57:49 GMT Received: from hu-gokukris-sd.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.41; Fri, 24 Feb 2023 11:57:48 -0800 From: Gokul krishna Krishnakumar To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Mathieu Poirier CC: Trilok Soni , Satya Durga Srinivasu Prabhala , Rajendra Nayak , "Elliot Berman" , Guru Das Srinagesh , Sibi Sankar , , , , Siddharth Gupta , Gokul krishna Krishnakumar Subject: [PATCH v4 2/2] remoteproc: qcom: Add full coredump fallback mechanism Date: Fri, 24 Feb 2023 11:57:31 -0800 Message-ID: <20230224195731.324-3-quic_gokukris@quicinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230224195731.324-1-quic_gokukris@quicinc.com> References: <20230224195731.324-1-quic_gokukris@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: T2g4fZZ1O8NP_BAvboV88nSDrTf7vvPG X-Proofpoint-ORIG-GUID: T2g4fZZ1O8NP_BAvboV88nSDrTf7vvPG X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.170.22 definitions=2023-02-24_14,2023-02-24_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 lowpriorityscore=0 mlxlogscore=976 malwarescore=0 impostorscore=0 bulkscore=0 spamscore=0 mlxscore=0 priorityscore=1501 adultscore=0 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2302240158 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Siddharth Gupta If a remoteproc's firmware does not support minidump but the driver adds an ID, the minidump driver does not collect any coredumps when the remoteproc crashes. This hinders the purpose of coredump collection. This change adds a fallback mechanism in the event of a crash. Signed-off-by: Siddharth Gupta Signed-off-by: Gokul krishna Krishnakumar --- drivers/remoteproc/qcom_common.c | 13 +++++++++++-- drivers/remoteproc/qcom_q6v5_pas.c | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/remoteproc/qcom_common.c b/drivers/remoteproc/qcom_common.c index 7da3259be14a..280a5a821dca 100644 --- a/drivers/remoteproc/qcom_common.c +++ b/drivers/remoteproc/qcom_common.c @@ -173,12 +173,21 @@ void qcom_minidump(struct rproc *rproc, unsigned int minidump_id, */ if (subsystem->regions_baseptr == 0 || le32_to_cpu(subsystem->status) != 1 || - le32_to_cpu(subsystem->enabled) != MD_SS_ENABLED || - le32_to_cpu(subsystem->encryption_status) != MD_SS_ENCR_DONE) { + le32_to_cpu(subsystem->enabled) != MD_SS_ENABLED) { + return rproc_coredump(rproc); + } + + if (le32_to_cpu(subsystem->encryption_status) != MD_SS_ENCR_DONE) { dev_err(&rproc->dev, "Minidump not ready, skipping\n"); return; } + /** + * Clear out the dump segments populated by parse_fw before + * re-populating them with minidump segments. + */ + rproc_coredump_cleanup(rproc); + ret = qcom_add_minidump_segments(rproc, subsystem, rproc_dumpfn_t); if (ret) { dev_err(&rproc->dev, "Failed with error: %d while adding minidump entries\n", ret); diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c index 27d3a6f8c92f..d065f99b4c32 100644 --- a/drivers/remoteproc/qcom_q6v5_pas.c +++ b/drivers/remoteproc/qcom_q6v5_pas.c @@ -442,6 +442,7 @@ static const struct rproc_ops adsp_minidump_ops = { .start = adsp_start, .stop = adsp_stop, .da_to_va = adsp_da_to_va, + .parse_fw = qcom_register_dump_segments, .load = adsp_load, .panic = adsp_panic, .coredump = adsp_minidump,