From patchwork Fri Apr 7 14:04:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Souradeep Chowdhury X-Patchwork-Id: 80846 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp317804vqo; Fri, 7 Apr 2023 07:17:26 -0700 (PDT) X-Google-Smtp-Source: AKy350a5Xr7krO/R5yKeJLS54nr/dhPysPmWGfK3Yj6qXhNgo6afXdTL9SNdaRbi7qAssXEJuKG5 X-Received: by 2002:a17:907:37a:b0:933:9f43:5c3b with SMTP id rs26-20020a170907037a00b009339f435c3bmr2674038ejb.59.1680877046285; Fri, 07 Apr 2023 07:17:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680877046; cv=none; d=google.com; s=arc-20160816; b=mE874I2nwtWpkZZr02FZbI0HNqQWpb8phfNpHdfJO4jllQhW+U7GljBYrKk1y8Roih QBZFzapm9hRdWMK6NERmbVDmentDX99cMkXD6ZcM0Wer0L2VNWBhI24UDzSuJ/Ts5Gj3 K5/wr2NXlWsEJVMC59E6bi7U689F37wtcEIz2lyiRIEq7+5W0JZ6O4cUYE4+k/MSfG5a 1JonA8RhEBEORPX3wrTIqI6NZMyxqMsi0hApBJrTIt0XTl5haMoIFi+j8O6u5NkdVg+F 9d8Bf1o8IycqxRts1v3isWy3jvRJIck/RDDlVTavZP7njRUqc706wnCZCnh7eNVivExl KFDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=pJhBOZwjfFN3H2w0yxFRU+GX1a5B/BNLnWlVtGU7Ctg=; b=xffEjcSK3VEnQJHL+WqRoUj/pim2GGD3iB6UKiyTuhKSKEWJF/MGfr1GGW6PPuQV8v 4/r4RvZpx0qX1ZC0ks1hwDakaXf/TrzcybkRAigSBEcrx2t9V22K5Ecf7Ak2iLZzuxRx fhJWWOF3GNGgQBZPpDtuPzbwsPS7Bu1mTsIWtmDeiN5g5JCuVEXqJtRNId42huwVhBNh /GwbxN6tlsddgqe8NxRrRpoI9btAE3ac1duUYFauHrkXUmVjzKvoZSbbud8b0dyxe2KK FQV3MK7mK+VlNatmnJUYoWSe+PTYyiId/JWuvQO0DrdCMGIkACIgIFU/1svpb74CmxPq dPwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=k8LhxF6M; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qo3-20020a170907212300b0093dc4b82132si459005ejb.968.2023.04.07.07.17.01; Fri, 07 Apr 2023 07:17:26 -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=k8LhxF6M; 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 S234041AbjDGOG5 (ORCPT + 99 others); Fri, 7 Apr 2023 10:06:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233982AbjDGOGw (ORCPT ); Fri, 7 Apr 2023 10:06:52 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 909E4AF3F; Fri, 7 Apr 2023 07:06:48 -0700 (PDT) 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 3379BYYb021562; Fri, 7 Apr 2023 14:06:41 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-type; s=qcppdkim1; bh=pJhBOZwjfFN3H2w0yxFRU+GX1a5B/BNLnWlVtGU7Ctg=; b=k8LhxF6MGeduu0DH10hmNODRYs29bmm7ynwYQOcYIInlEdSQsm3SRoDv9XRDaddlsy52 Uac/8w2R/+iMxOFHxZZrsn7ivy1IEBxM1Gjy5CgrtrNlhBbjF0l/xH+enfkA+RRnTzpq lxzmCTMRHRDlKW8TGkzCu+YtON+ft72pWA6mxsBYlYFNHHrx942rIU/fmlkq2nHEL+3R +q35xOwBHzHiYuVz/6pwURb78+lQ8vQ8awW08tQrSM+Xd/TgBspDgmWrhOx/yWpMwnxP fqbFFFtMWMlF9QE9PzKAZvckRNuHV82r7PdMq5gWUox2/NTSkKkNuL/WWkoeh9kL7oK9 Gg== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3pt5s9snhw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 07 Apr 2023 14:06:40 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 337E6aWB005831 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 7 Apr 2023 14:06:36 GMT Received: from blr-ubuntu-525.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.42; Fri, 7 Apr 2023 07:06:32 -0700 From: Souradeep Chowdhury To: Andy Gross , Konrad Dybcio , Krzysztof Kozlowski , Bjorn Andersson , Rob Herring CC: , , , , Sibi Sankar , Rajendra Nayak , Souradeep Chowdhury Subject: [PATCH V2 1/3] dt-bindings: sram: qcom,imem: Add Boot Stat region within IMEM Date: Fri, 7 Apr 2023 19:34:35 +0530 Message-ID: <96601c1f9e433ef8fbc608d5ca09365b9c0d8132.1680874520.git.quic_schowdhu@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: 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) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: 3HN21Rrd-uNzM1aC5FRhf7Qgv79uDN8N X-Proofpoint-ORIG-GUID: 3HN21Rrd-uNzM1aC5FRhf7Qgv79uDN8N X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-07_08,2023-04-06_03,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 bulkscore=0 adultscore=0 phishscore=0 lowpriorityscore=0 impostorscore=0 mlxlogscore=924 priorityscore=1501 clxscore=1015 spamscore=0 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304070129 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762527329912366302?= X-GMAIL-MSGID: =?utf-8?q?1762527329912366302?= All Qualcomm bootloaders log useful timestamp information related to bootloader stats in the IMEM region. Add the child node within IMEM for the boot stat region containing register address and compatible string. Signed-off-by: Souradeep Chowdhury --- .../devicetree/bindings/sram/qcom,imem.yaml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Documentation/devicetree/bindings/sram/qcom,imem.yaml b/Documentation/devicetree/bindings/sram/qcom,imem.yaml index 665c06e..9998d65 100644 --- a/Documentation/devicetree/bindings/sram/qcom,imem.yaml +++ b/Documentation/devicetree/bindings/sram/qcom,imem.yaml @@ -26,6 +26,7 @@ properties: - qcom,sdm845-imem - qcom,sdx55-imem - qcom,sdx65-imem + - qcom,sm8450-imem - const: syscon - const: simple-mfd @@ -48,6 +49,26 @@ patternProperties: $ref: /schemas/remoteproc/qcom,pil-info.yaml# description: Peripheral image loader relocation region + "^boot-stat@[0-9a-f]+$": + type: object + description: + Imem region dedicated for storing timestamps related + information regarding bootstats. + + properties: + compatible: + items: + - enum: + - qcom,sm8450-bootstats + - const: qcom,imem-bootstats + + reg: + maxItems: 1 + + required: + - compatible + - reg + required: - compatible - reg From patchwork Fri Apr 7 14:04:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Souradeep Chowdhury X-Patchwork-Id: 80838 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp310858vqo; Fri, 7 Apr 2023 07:07:59 -0700 (PDT) X-Google-Smtp-Source: AKy350aj0byJrTgqKg8WXQHR1Fx8xaRoa+WodGN1LwjpBYsHQAZHCuHq2ZMfBb6DGDhRhdZOqnCM X-Received: by 2002:a17:90b:4a4e:b0:246:5a79:a0f2 with SMTP id lb14-20020a17090b4a4e00b002465a79a0f2mr1806467pjb.47.1680876479112; Fri, 07 Apr 2023 07:07:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680876479; cv=none; d=google.com; s=arc-20160816; b=HCet3p0zoWMkLAVC0K6mgjFYige28bXbrtE2REHkogbr83PuCeUJuUUXZ2vGVrl/uW wvHP7WRE1PIs4wMQL3ZQAmOJA/kOqnGKsrEsbGgL5srZBmNAbWmzi5sYpk7LyW+0D9fW sw2I+U9KdYvhsiqypoR1QR+U+R02VHnC6O3R/SumvsXWssNwx7ttzf1FSSq2FK9Ekxjv hcvaO0+xngGqT+AkzxW4wKzh9eKMQErCmE4r1XKKm9GuF+AEoxvIl9D016345XL+QuRU OuQEL0yq29Vd7BnJ6/epsaYFCuYuo2Eu6KdqvCDgIi69frYzEWK7mHdQYHa8G41PSAhX dMvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=dR5hsH0YjVOrcxCTKV/JJnRf8WXDP6gF0YttNyCiG9k=; b=Ef3AjonA1y/gViatqWf3uVqryo/0gYRxYlz40uQPtWv4pWPSEftqQ2ngrzxJya7nzO p1kIECeWJMGKputYBg9BqBSxoW860Q2QZH0XtqdtQ31qE5YhdBMnD8OoujmP0m6+IQi7 5oY6SiB8awlDhHhx3AMN0id71dLnwQXHG/w7O9uvyNm689grBZ/lhhE0BCyu55IiZoLR Nxdmj9CrhngjV5PZNX03698sr6YAlNDD7R/IpcZUlCqxuOyWVqOzkNqIxpFqb0vVBiyj o4ZAqGjz/Ve8si4OOpKNlYIXQRO2IPdtlniKGX2Xcm8ByEWoxH8y0zSDH8eGraADodab uhiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=C9W7xb88; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gn2-20020a17090ac78200b002409cd01ef4si3563873pjb.58.2023.04.07.07.07.40; Fri, 07 Apr 2023 07:07:59 -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=C9W7xb88; 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 S240303AbjDGOHB (ORCPT + 99 others); Fri, 7 Apr 2023 10:07:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239731AbjDGOGy (ORCPT ); Fri, 7 Apr 2023 10:06:54 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1013061BA; Fri, 7 Apr 2023 07:06:52 -0700 (PDT) Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 337E1hs3024072; Fri, 7 Apr 2023 14:06:42 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-type; s=qcppdkim1; bh=dR5hsH0YjVOrcxCTKV/JJnRf8WXDP6gF0YttNyCiG9k=; b=C9W7xb88LSAfAgfcvjxqKMQcd+tObj8IZO4xjOaSnHTxxeTejFW5cQ0aMYPFGnSMpaIc p4mJkNIAAEXNIGkBUXhszlX9Q2HMDLwe80cln0uZw0SW0oK7V5WxZD1pwjqmIMsFYQSC 2eDLQtWpm3PkA51VPqMWWlK5G9O2+8/fXPbZiLLc3igwjWS79a5Hv/yLacLuVwofvz8e tN/KDV/PChYFzl4DTN4JRYyMvasGJKdnqiDe6USOPcPaVa9QNSW9PfLruBXfMj/cPeOo s77fECQcrl92J0PzJVWCzD/Sp+J2iogEvo2wPVmHCppWc2QTGMlfm/PYZzrA+k5VKLJ5 TA== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3ptb9wh2r2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 07 Apr 2023 14:06:42 +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 337E6fQk029617 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 7 Apr 2023 14:06:41 GMT Received: from blr-ubuntu-525.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.42; Fri, 7 Apr 2023 07:06:36 -0700 From: Souradeep Chowdhury To: Andy Gross , Konrad Dybcio , Krzysztof Kozlowski , Bjorn Andersson , Rob Herring CC: , , , , Sibi Sankar , Rajendra Nayak , Souradeep Chowdhury Subject: [PATCH V2 2/3] soc: qcom: boot_stat: Add Driver Support for Boot Stats Date: Fri, 7 Apr 2023 19:34:36 +0530 Message-ID: <5eeeb46e9b3f61656a37cb77c2ad6a04e383c16d.1680874520.git.quic_schowdhu@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: 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) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: a2q5MDYc7Vq_tJORb45hiNNKpu5zcY-p X-Proofpoint-ORIG-GUID: a2q5MDYc7Vq_tJORb45hiNNKpu5zcY-p X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-07_08,2023-04-06_03,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 spamscore=0 phishscore=0 malwarescore=0 bulkscore=0 adultscore=0 suspectscore=0 priorityscore=1501 mlxscore=0 impostorscore=0 mlxlogscore=999 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304070129 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762526735210761065?= X-GMAIL-MSGID: =?utf-8?q?1762526735210761065?= All of Qualcomm's proprietary Android boot-loaders capture boot time stats, like the time when the bootloader started execution and at what point the bootloader handed over control to the kernel etc. in the IMEM region. This information is captured in a specific format by this driver by mapping a structure to the IMEM memory region and then accessing the members of the structure to print the information. This information is useful in verifying if the existing boot KPIs have regressed or not. A sample log in SM8450(waipio) device is as follows:- KPI: Pre ABL Time = 3s KPI: ABL Time = 14s KPI: Kernel MPM timestamp = 890206 The Module Power Manager(MPM) sleep counter starts ticking at the PBL stage and the timestamp generated by the sleep counter is logged by the Qualcomm proprietary bootloader(ABL) at two points-> First when it starts execution which is logged here as "Pre ABL Time" and the second when it is about to load the kernel logged as "ABL Time". Both are logged in the unit of seconds. The current kernel timestamp is printed by the boot_stats driver as well. Signed-off-by: Souradeep Chowdhury --- drivers/soc/qcom/Kconfig | 7 ++++ drivers/soc/qcom/Makefile | 1 + drivers/soc/qcom/boot_stats.c | 95 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 103 insertions(+) create mode 100644 drivers/soc/qcom/boot_stats.c diff --git a/drivers/soc/qcom/Kconfig b/drivers/soc/qcom/Kconfig index d11bda2..2cfdbb7 100644 --- a/drivers/soc/qcom/Kconfig +++ b/drivers/soc/qcom/Kconfig @@ -79,6 +79,13 @@ config QCOM_DCC driver provides interface to configure DCC block and read back captured data from DCC's internal SRAM. +config QCOM_BOOTSTAT + tristate "Qualcomm Technologies, Boot Stat driver" + depends on ARCH_QCOM || COMPILE_TEST + help + This option enables driver for boot stats. Boot stat driver prints + the kernel bootloader information by accessing the imem region. + config QCOM_KRYO_L2_ACCESSORS bool depends on ARCH_QCOM && ARM64 || COMPILE_TEST diff --git a/drivers/soc/qcom/Makefile b/drivers/soc/qcom/Makefile index 3b92c6c..8a9d995 100644 --- a/drivers/soc/qcom/Makefile +++ b/drivers/soc/qcom/Makefile @@ -5,6 +5,7 @@ obj-$(CONFIG_QCOM_GENI_SE) += qcom-geni-se.o obj-$(CONFIG_QCOM_COMMAND_DB) += cmd-db.o obj-$(CONFIG_QCOM_CPR) += cpr.o obj-$(CONFIG_QCOM_DCC) += dcc.o +obj-$(CONFIG_QCOM_BOOTSTAT) += boot_stats_new.o obj-$(CONFIG_QCOM_GSBI) += qcom_gsbi.o obj-$(CONFIG_QCOM_MDT_LOADER) += mdt_loader.o obj-$(CONFIG_QCOM_OCMEM) += ocmem.o diff --git a/drivers/soc/qcom/boot_stats.c b/drivers/soc/qcom/boot_stats.c new file mode 100644 index 0000000..080e820 --- /dev/null +++ b/drivers/soc/qcom/boot_stats.c @@ -0,0 +1,95 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (c) 2013-2019, 2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#define MPM_COUNTER_FREQ 32768 + +/** + * struct boot_stats - timestamp information related to boot stats + * @bootloader_start: Time for the starting point of the abl bootloader + * @bootloader_end: Time when the kernel starts loading from abl bootloader + */ +struct boot_stats { + u32 bootloader_start; + u32 bootloader_end; +} __packed; + +struct boot_stats __iomem *boot_stats; +void __iomem *mpm_counter_base; + +static void print_boot_stats(void) +{ + u32 pre_abl_time = readl_relaxed(&boot_stats->bootloader_start) / MPM_COUNTER_FREQ; + u32 abl_time = readl_relaxed(&boot_stats->bootloader_end) / MPM_COUNTER_FREQ; + + pr_info("KPI: Pre ABL Time = %us\n", pre_abl_time); + pr_info("KPI: ABL Time = %us\n", abl_time); + pr_info("KPI: Kernel MPM timestamp = %u\n", readl_relaxed(mpm_counter_base)); +} + +static int boot_stats_probe(struct platform_device *pdev) +{ + struct device_node *np_mpm2; + struct device *boot_stat = &pdev->dev; + + boot_stats = of_iomap(boot_stat->of_node->child, 0); + if (!boot_stats) + return dev_err_probe(&pdev->dev, -ENOMEM, + "failed to map imem region\n"); + + np_mpm2 = of_find_compatible_node(NULL, NULL, + "qcom,mpm2-sleep-counter"); + if (!np_mpm2) { + return dev_err_probe(&pdev->dev, -EINVAL, + "failed to get the counter node\n"); + } + + if (of_get_address(np_mpm2, 0, NULL, NULL)) { + mpm_counter_base = of_iomap(np_mpm2, 0); + if (!mpm_counter_base) { + return dev_err_probe(&pdev->dev, -ENOMEM, + "failed to map the counter\n"); + } + } + print_boot_stats(); + + return 0; +} + +static int boot_stats_remove(struct platform_device *pdev) +{ + iounmap(boot_stats); + iounmap(mpm_counter_base); + + return 0; +} + +static const struct of_device_id boot_stats_dt_match[] = { + { .compatible = "qcom,sm8450-imem" }, + { } +}; +MODULE_DEVICE_TABLE(of, boot_stats_dt_match); + +static struct platform_driver boot_stat_driver = { + .probe = boot_stats_probe, + .remove = boot_stats_remove, + .driver = { + .name = "qcom-boot-stats", + .of_match_table = boot_stats_dt_match, + }, +}; +module_platform_driver(boot_stat_driver); + +MODULE_DESCRIPTION("Qualcomm Technologies Inc. Boot Stat driver"); +MODULE_LICENSE("GPL"); From patchwork Fri Apr 7 14:04:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Souradeep Chowdhury X-Patchwork-Id: 80839 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp311310vqo; Fri, 7 Apr 2023 07:08:28 -0700 (PDT) X-Google-Smtp-Source: AKy350ZyJICnQEodCZfpM2aYb+bvPDrLOrvi8bCduZh+zKPHVsUvm74cp48A69rdZFuEQIfeYu1g X-Received: by 2002:a17:90b:1e50:b0:233:f394:d83 with SMTP id pi16-20020a17090b1e5000b00233f3940d83mr2290576pjb.48.1680876508735; Fri, 07 Apr 2023 07:08:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680876508; cv=none; d=google.com; s=arc-20160816; b=SxhEU5gaEK+naGDwI6ahtRgoVLA3g/0dT8Q1gPg0yFHCaudtXWpPxRTrwvLE4b+X/i ERQCZM6CHHTI/lUQ2Exq+2QDJF9wDQG2eh1o4bFuj8RP/u/bEH4XSvvxPMkPd4de1iFp 39CmW/323h67sLHjEa8p0dS+BcKNL0a5ybs9qohRTT4byeI7eAzycra7a8FTHqchGPqc O6vO0AkOQ0xIbdazqxT20MAkqoT6QTwUurPZKZ7RNXleU9Ngm8J9tYi5fL4/zSJRbdFA g/AfWAqodcg12L32+H0p4EFtfYbanwmfXtsprpaJrr6JK+j02ATBBpElp/G1rCbSBi+4 Y8eA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=nUIpIqqCfTUgi+eWWw0Gtsf+cKupOLPw8gVVhpAckm8=; b=xVt6UPmcUQT1GwUnnKDEdvLOahDC0uKLIaRI7Op3GjZUhUna+3n/4XvgqPQhd8YlTP 1OyzWuSr/1TIJlyR4MfV9QqEPRedQ8wbxGd1DmaX1c5GehaAiA9jj8oSBGf/jM8kIZZR oI/tet3dbwYUKm3lASfN2iNEdC6UGNu+/UMGRWXW9nfA41f8edHdx4DMdcc65mIBITZL UADaajX9CRvqZCg4Et+qosbL+LfUbQR3TP4Oa24+rHNZrgbD86ZHbJrcFx/l+ti5rYdR Q6hA3An4qHw6SOXSaP34Eh+D35DK7VOmnh+efxcAxF6zO6zw/w57jd8obvIN6BBYSzjs 29IA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=hxIkf4bu; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h21-20020a17090aa89500b0023f9cb53c90si3582580pjq.70.2023.04.07.07.08.08; Fri, 07 Apr 2023 07:08:28 -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=hxIkf4bu; 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 S240378AbjDGOHE (ORCPT + 99 others); Fri, 7 Apr 2023 10:07:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240170AbjDGOG4 (ORCPT ); Fri, 7 Apr 2023 10:06:56 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 455FB59F2; Fri, 7 Apr 2023 07:06:55 -0700 (PDT) Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 337DuWnV018844; Fri, 7 Apr 2023 14:06:46 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-type; s=qcppdkim1; bh=nUIpIqqCfTUgi+eWWw0Gtsf+cKupOLPw8gVVhpAckm8=; b=hxIkf4buHF/wUMneglFet5XqyTV/ooy1DLxMdxoYXjmdnrEvMVg9udKHOVTwACsM+UBm 47mrVwyqdK5GvC90iEqIQ0BQ8QE7fPmMvKfw/ydcHynrxMYTmKfDh23qK+6KAc2K/2Gk Ea+cjCJLmuIlyszQlyanju5tiHB477IOdKwS+Dn2zeu8mzqk369qEQctkP9mlPnp8MyX bsM8oKQojSBek+bzW7Z3FoSW5tbJut7dPvDaohBf4HQu4Hg5RqwZ0+YRUhIK42H1+vS9 xhLwF0A1zhINp+P5OZUdoLI82qjzvw1lPBjwbniwSx4gZHSiVjIy1yxmXWFeZ6OkAmn+ Zw== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3ptgpk0ffk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 07 Apr 2023 14:06:46 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 337E6jf1017412 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 7 Apr 2023 14:06:45 GMT Received: from blr-ubuntu-525.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.42; Fri, 7 Apr 2023 07:06:41 -0700 From: Souradeep Chowdhury To: Andy Gross , Konrad Dybcio , Krzysztof Kozlowski , Bjorn Andersson , Rob Herring CC: , , , , Sibi Sankar , Rajendra Nayak , Souradeep Chowdhury Subject: [PATCH V2 3/3] MAINTAINERS: Add the entry for boot_stats driver support Date: Fri, 7 Apr 2023 19:34:37 +0530 Message-ID: X-Mailer: git-send-email 2.7.4 In-Reply-To: References: 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) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: Its-cE4DU8oE1szGzGhwBGfCiZoPaD00 X-Proofpoint-GUID: Its-cE4DU8oE1szGzGhwBGfCiZoPaD00 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-07_08,2023-04-06_03,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 adultscore=0 clxscore=1015 lowpriorityscore=0 spamscore=0 suspectscore=0 malwarescore=0 priorityscore=1501 mlxscore=0 phishscore=0 bulkscore=0 mlxlogscore=867 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304070129 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762526766017465490?= X-GMAIL-MSGID: =?utf-8?q?1762526766017465490?= Add the entries for all the files added as a part of driver support for boot stats. Signed-off-by: Souradeep Chowdhury --- MAINTAINERS | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index f2c3d47..c591dff 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -17071,6 +17071,12 @@ L: netdev@vger.kernel.org S: Supported F: drivers/net/ipa/ +QCOM BOOT_STATS DRIVER +M: Souradeep Chowdhury +L: linux-arm-msm@vger.kernel.org +S: Maintained +F: drivers/soc/qcom/boot_stats.c + QEMU MACHINE EMULATOR AND VIRTUALIZER SUPPORT M: Gabriel Somlo M: "Michael S. Tsirkin"