Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp20467879rwd; Thu, 29 Jun 2023 02:42:45 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ46C2L1aRZ3DE1MLW+mR3eCUSt8y5G2LaZfM5UrrZEjxeveNnXz+XWxrci3FSVc/cF8t01U X-Received: by 2002:a05:6830:3b85:b0:6b6:9f34:e9a8 with SMTP id dm5-20020a0568303b8500b006b69f34e9a8mr22240134otb.11.1688031765483; Thu, 29 Jun 2023 02:42:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688031765; cv=none; d=google.com; s=arc-20160816; b=dFjbvs84PROagsLdZaG8yOmY9//srx8uwPHuenA4eNrbZ3jj4Xs+HbEohcgSf71qR1 ZYxvZsB7aOQtzzHG7+pKQTtJsk/ouRyXP7T+4BjkQbR9aLKo5ovRVe87fZpTl3VAeXwX W4kv1n7bU8cRDVp8/1NtVK2aP+Cz/nN5r/lXYu+i7bkTDnt3JiK3lr8u3aFKRtMRYtae nHWJewvOAFfUBZuZYA12T51kf/+o82AAO+EOFDlzwI9f11cu6Jaq5VNDIntMHOUYiaea IR2baGlKqXaE6RoyjD0Acp/LR2gPcHCwnF6457XSATwIKgaHgDx6WP4355pS7Gj6SQHV nthw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=ejgo9Ha3IFB/uURLTL7ikLrQKDml9uYD+lWUNGD1J8Y=; fh=d6WGxOmaUkdXm4FqyYYz3DzRziIKfTEQpLYvaS8CycY=; b=VMjd6qgRThqBqoZ1z8sC3nQt0cnxBNxCT0vHYoN04XHdRpT9GF47jdLqljjcgPpQ2n TB2rRio3vbddGFjrpIK2WyeIQ5WR4DzGqKyL71nkEUt4EFi8xomMZc+1rvTxw5Qxho7a x0Dc32d0fBbsC0YeHQ/QcB56b3/62hCMRqDcrtNiIkWBQ12lMjr8ikS0UC7v1oV4G3Br y1eXUTbcul9pLDGBn0edYpSUAu3Vmk0Dfe/He2RlOD1kgqrb/eHDpBoMUjU0kMHfgHyn Eh3XjXXyFIA8NTPvKWOzTmlEPGiz61CTI94GGIw5R16plfD3Db2WQprnmxlcn11yNu+9 D+KQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Q5HZqz2n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z17-20020a634c11000000b0055384255b9bsi9354056pga.24.2023.06.29.02.42.31; Thu, 29 Jun 2023 02:42:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Q5HZqz2n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231272AbjF2JRk (ORCPT + 99 others); Thu, 29 Jun 2023 05:17:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232464AbjF2JRS (ORCPT ); Thu, 29 Jun 2023 05:17:18 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D28B12134; Thu, 29 Jun 2023 02:17:05 -0700 (PDT) Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35T8mXOb031688; Thu, 29 Jun 2023 09:16:37 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=qcppdkim1; bh=ejgo9Ha3IFB/uURLTL7ikLrQKDml9uYD+lWUNGD1J8Y=; b=Q5HZqz2n2kb+NTEAkAMXSIizloKVYik7ju104y8OZn96yjHMUHE2r8UejPxDjrhEh+ps cWd+wSjFgdc14K+PKEi3qq1azBZ4u8pIdlYimOLDmiz94hYg8zELLvYJKoMvoj5qSUlm xiUF5h+AVna9EN8O6xmE+kS2MqM4CdpARbaD3NQkgbC4GLfavjf/FtljharaTs7g7lti W5er+AR707Ti/P+vUgWcLn+r0mbJLrLF6PCLPJLahm3sSTqxYU6TXLloEYqyRTq0dHdq vQaCRNeFWUgrW34kv5/90nBcHlAXjnLhsXVO/11Eb0P2sw0E9ZHOoCkdGvjaL0iDILnZ Pg== Received: from nasanppmta04.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3rgnxr9w8g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 29 Jun 2023 09:16:37 +0000 Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 35T9GZf5010847 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 29 Jun 2023 09:16:35 GMT Received: from [10.216.42.4] (10.80.80.8) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Thu, 29 Jun 2023 02:16:28 -0700 Message-ID: Date: Thu, 29 Jun 2023 14:46:18 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH v4 10/21] soc: qcom: Add qcom's pstore minidump driver support Content-Language: en-US To: Rob Herring CC: , , , , , , , , , , , , , , , , , , , , , References: <1687955688-20809-1-git-send-email-quic_mojha@quicinc.com> <1687955688-20809-11-git-send-email-quic_mojha@quicinc.com> From: Mukesh Ojha In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: Ao0JE0wQQz6nMX3r1Yj7CGXQWb2hQpyl X-Proofpoint-GUID: Ao0JE0wQQz6nMX3r1Yj7CGXQWb2hQpyl X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-06-29_01,2023-06-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 clxscore=1015 impostorscore=0 mlxscore=0 spamscore=0 adultscore=0 bulkscore=0 suspectscore=0 phishscore=0 malwarescore=0 mlxlogscore=999 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306290082 X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/29/2023 4:27 AM, Rob Herring wrote: > On Wed, Jun 28, 2023 at 6:37 AM Mukesh Ojha wrote: >> >> This driver was inspired from the fact pstore ram region should be >> fixed and boot firmware need to have awarness about this region, >> so that it will be persistent across boot. But, there are many >> QCOM SoC which does not support warm boot from hardware but they >> have minidump support from the software, and for them, there is >> no need of this pstore ram region to be fixed, but at the same >> time have interest in the pstore frontends data. So, this driver >> get the dynamic reserved region from the ram and register the >> ramoops platform device. >> >> +---------+ +---------+ +--------+ +---------+ >> | console | | pmsg | | ftrace | | dmesg | >> +---------+ +---------+ +--------+ +---------+ >> | | | | >> | | | | >> +------------------------------------------+ >> | >> \ / >> +----------------+ >> (1) |pstore frontends| >> +----------------+ >> | >> \ / >> +------------------- + >> (2) | pstore backend(ram)| >> +--------------------+ >> | >> \ / >> +--------------------+ >> (3) |qcom_pstore_minidump| >> +--------------------+ >> | >> \ / >> +---------------+ >> (4) | qcom_minidump | >> +---------------+ >> >> This driver will route all the pstore front data to the stored >> in qcom pstore reserved region and the reason of showing an >> arrow from (3) to (4) as qcom_pstore_minidump driver will register >> all the available frontends region with qcom minidump driver >> in upcoming patch. >> >> Signed-off-by: Mukesh Ojha >> --- >> drivers/soc/qcom/Kconfig | 12 +++++ >> drivers/soc/qcom/Makefile | 1 + >> drivers/soc/qcom/qcom_pstore_minidump.c | 85 +++++++++++++++++++++++++++++++++ > > drivers/soc/ is the dumping ground for things with no other place. As > this is a pstore driver, it belongs with pstore. The inspiration of this driver was taken from drivers/platform/chrome/chromeos_pstore.c, do you think that is misplaced ? > >> 3 files changed, 98 insertions(+) >> create mode 100644 drivers/soc/qcom/qcom_pstore_minidump.c >> >> diff --git a/drivers/soc/qcom/Kconfig b/drivers/soc/qcom/Kconfig >> index 1834213fd652..fbf08e30feda 100644 >> --- a/drivers/soc/qcom/Kconfig >> +++ b/drivers/soc/qcom/Kconfig >> @@ -306,4 +306,16 @@ config QCOM_MINIDUMP_SMEM >> >> This config should be enabled if the low level minidump is implemented >> as part of SMEM. >> + >> +config QCOM_PSTORE_MINIDUMP >> + tristate "Pstore support for QCOM Minidump" >> + depends on ARCH_QCOM >> + depends on PSTORE_RAM >> + depends on QCOM_MINIDUMP >> + help >> + Enablement of this driver ensures that ramoops region can be anywhere >> + reserved in ram instead of being fixed address which needs boot firmware >> + awareness. So, this driver creates plaform device and registers available >> + frontend region with the Qualcomm's minidump driver. >> + >> endmenu >> diff --git a/drivers/soc/qcom/Makefile b/drivers/soc/qcom/Makefile >> index 737d868757ac..1ab59c1b364d 100644 >> --- a/drivers/soc/qcom/Makefile >> +++ b/drivers/soc/qcom/Makefile >> @@ -36,3 +36,4 @@ qcom_ice-objs += ice.o >> obj-$(CONFIG_QCOM_INLINE_CRYPTO_ENGINE) += qcom_ice.o >> obj-$(CONFIG_QCOM_MINIDUMP) += qcom_minidump.o >> obj-$(CONFIG_QCOM_MINIDUMP_SMEM) += qcom_minidump_smem.o >> +obj-$(CONFIG_QCOM_PSTORE_MINIDUMP) += qcom_pstore_minidump.o >> diff --git a/drivers/soc/qcom/qcom_pstore_minidump.c b/drivers/soc/qcom/qcom_pstore_minidump.c >> new file mode 100644 >> index 000000000000..b07cd10340df >> --- /dev/null >> +++ b/drivers/soc/qcom/qcom_pstore_minidump.c >> @@ -0,0 +1,85 @@ >> +// SPDX-License-Identifier: GPL-2.0-only >> + >> +/* >> + * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved. >> + */ >> + >> +#include >> +#include > > You probably don't need this include. Use the actual includes you need > and don't rely on implicit includes (because I'm trying to remove > those). Ok, will try to check.. - Mukesh > >> +#include >> +#include >> +#include >> + >> +struct qcom_ramoops_dd { >> + struct ramoops_platform_data qcom_ramoops_pdata; >> + struct platform_device *ramoops_pdev; >> +}; >> + >> +static int qcom_ramoops_probe(struct platform_device *pdev) >> +{ >> + struct device_node *of_node = pdev->dev.of_node; >> + struct qcom_ramoops_dd *qcom_rdd; >> + struct ramoops_platform_data *pdata; >> + struct reserved_mem *rmem; >> + struct device_node *node; >> + long ret; >> + >> + node = of_parse_phandle(of_node, "memory-region", 0); >> + if (!node) >> + return -ENODEV; >> + >> + rmem = of_reserved_mem_lookup(node); >> + of_node_put(node); >> + if (!rmem) { >> + dev_err(&pdev->dev, "failed to locate DT /reserved-memory resource\n"); >> + return -EINVAL; >> + } >> + >> + qcom_rdd = devm_kzalloc(&pdev->dev, sizeof(*qcom_rdd), GFP_KERNEL); >> + if (!qcom_rdd) >> + return -ENOMEM; >> + >> + pdata = &qcom_rdd->qcom_ramoops_pdata; >> + pdata->mem_size = rmem->size; >> + pdata->mem_address = rmem->base; >> + ramoops_parse_dt(pdev, pdata); >> + >> + qcom_rdd->ramoops_pdev = platform_device_register_data(NULL, "ramoops", -1, >> + pdata, sizeof(*pdata)); >> + if (IS_ERR(qcom_rdd->ramoops_pdev)) { >> + ret = PTR_ERR(qcom_rdd->ramoops_pdev); >> + dev_err(&pdev->dev, "could not create platform device: %ld\n", ret); >> + qcom_rdd->ramoops_pdev = NULL; >> + } >> + platform_set_drvdata(pdev, qcom_rdd); >> + >> + return ret; >> +} >> + >> +static void qcom_ramoops_remove(struct platform_device *pdev) >> +{ >> + struct qcom_ramoops_dd *qcom_rdd = platform_get_drvdata(pdev); >> + >> + platform_device_unregister(qcom_rdd->ramoops_pdev); >> + qcom_rdd->ramoops_pdev = NULL; >> +} >> + >> +static const struct of_device_id qcom_ramoops_of_match[] = { >> + { .compatible = "qcom,ramoops"}, >> + {} >> +}; >> +MODULE_DEVICE_TABLE(of, qcom_ramoops_of_match); >> + >> +static struct platform_driver qcom_ramoops_drv = { >> + .driver = { >> + .name = "qcom,ramoops", >> + .of_match_table = qcom_ramoops_of_match, >> + }, >> + .probe = qcom_ramoops_probe, >> + .remove_new = qcom_ramoops_remove, >> +}; >> + >> +module_platform_driver(qcom_ramoops_drv); >> + >> +MODULE_DESCRIPTION("Qualcomm ramoops minidump driver"); >> +MODULE_LICENSE("GPL"); >> -- >> 2.7.4 >>