From patchwork Tue May 9 10:52:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Souradeep Chowdhury X-Patchwork-Id: 91504 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2786806vqo; Tue, 9 May 2023 04:02:00 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4nn2zXrhBk6tUWEP454/PW9bJ7DlWcZD2+ohhrPvQb5JdgaD/ulmWsU7j9ZmgY6oaiI/F7 X-Received: by 2002:aca:f054:0:b0:38c:a32:e195 with SMTP id o81-20020acaf054000000b0038c0a32e195mr1061394oih.17.1683630119944; Tue, 09 May 2023 04:01:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683630119; cv=none; d=google.com; s=arc-20160816; b=S+VIMr9zU9RLeTgxmiBFidkYkmqrLFvmPiiynK1hkl1aZm4XHFdJUg51iOCgzQIdDF IBbO3vT5m1aAujGHLRBt27bpb2hG01Fhd16pGZEFZ3jxrS90jhVKGJI3Wa3WlnIbFpFB IRGw/AQ5TdDnEcIacEe299UCPEBWNXQhoo2Pp7EDJ75SDFNUwBPvRTkiH4Sikk2Y2Poa sKRKnPrfBemacFcywZsh49gu1fqhSZ3cByqfpTZx/gdeU2vPyAyjs8XSExheJyVlXKWl 0T+MEcQrMte0QjcvOoaZ+lGNzD+RfPCKNeXgHz5Hf5UGmJpkpnFhwbNhQSnbQ+ooV6QA mxCA== 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=HQy7LZTEoXVIP8ZLz5hi/u5H3GlffVJ2WaKKK+gTzrw=; b=c2e9DMISsIkVjhRV3GoHkj2o2Ez7yiyuAFV/PxNllwA93uaYPWEqec8cVR2OBLA/fJ GifaGxRBmgFAmq32EBZ9ipztRSq7JxygReZSU2u2iKYSEEVKwUs3/IfEjQSGNvjGpcJ0 osqQhetixCD8QI5Hd9c4ilkkTwTuk0wSBV8qvMUIkbPtx/EcUzK/rPbO7iS8wV5f0kh8 YIL206qxC6X6o+TamuERjmfMYFfLkiFf6EjFLI8dVtt3UkJfixOaVBZrrZ0r9k9DC47F gCfZCEqiHmPmHbcNeHmni405f7lDXvWiSPxK0Bk94WeJY/SabX2tdKOXLiGVQLe8B2en 9RIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=ccE7DYLg; 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 c15-20020a056808138f00b003907dc8c5ebsi1453085oiw.164.2023.05.09.04.01.45; Tue, 09 May 2023 04:01: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=ccE7DYLg; 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 S235393AbjEIKxV (ORCPT + 99 others); Tue, 9 May 2023 06:53:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235118AbjEIKxO (ORCPT ); Tue, 9 May 2023 06:53:14 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E53BA46A8; Tue, 9 May 2023 03:53:12 -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 3496Oveh028208; Tue, 9 May 2023 10:53:04 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=HQy7LZTEoXVIP8ZLz5hi/u5H3GlffVJ2WaKKK+gTzrw=; b=ccE7DYLgeJCsFYL3P5OqNpOpWB43qQ0wzf+F+fZr617B7a0O59o0OKc/mII6xhllOwiR NnnW9q0G00kMVy+BlGcYsCTW4eOWztw+OEagwmg8iZQJ3cVqKiGLRrDEToNChr1DJy+V /tjmSpe2tEy4tPG3FFBEolfuVgYNXu/pBZjqF5dMaFH4p+R8Uu/b9eIiIOYH/jCLFJKi ZjW6Ryrj/lNnGSxddlqp0Dsc8wv8tG+oiZzUXcWZpk72c+WaA3GdIHNu3SlXbfnPhuGF cBcidKtCucxQFuoVgH7sKwWI4ZrnyyHcL/OAC2x4z9jljhhDub4kxj5nIzAwkslRwTJf mg== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3qf77h9fyv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 09 May 2023 10:53:03 +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 349Ar3n0026676 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 9 May 2023 10:53:03 GMT Received: from hu-schowdhu-lv.qualcomm.com (10.49.16.6) 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; Tue, 9 May 2023 03:53:02 -0700 From: Souradeep Chowdhury To: Andy Gross , Konrad Dybcio , Krzysztof Kozlowski , Bjorn Andersson , Rob Herring CC: , , , , Sibi Sankar , Rajendra Nayak , Souradeep Chowdhury Subject: [PATCH V6 1/3] dt-bindings: sram: qcom,imem: Add Boot Stat region within IMEM Date: Tue, 9 May 2023 03:52:21 -0700 Message-ID: <343182748e12b6a4ac57d336405c50e36fc5520c.1683628357.git.quic_schowdhu@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01a.na.qualcomm.com (10.47.209.196) 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: qCtCKY5yOViBOcNDFqwhsAegcoN-6aKC X-Proofpoint-ORIG-GUID: qCtCKY5yOViBOcNDFqwhsAegcoN-6aKC 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-05-09_06,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 mlxscore=0 bulkscore=0 impostorscore=0 lowpriorityscore=0 malwarescore=0 priorityscore=1501 suspectscore=0 phishscore=0 mlxlogscore=999 adultscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305090086 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765414136394672814?= X-GMAIL-MSGID: =?utf-8?q?1765414136394672814?= 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 Reviewed-by: Krzysztof Kozlowski --- .../devicetree/bindings/sram/qcom,imem.yaml | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Documentation/devicetree/bindings/sram/qcom,imem.yaml b/Documentation/devicetree/bindings/sram/qcom,imem.yaml index 0548e8e0d30b..bb884c5c8952 100644 --- a/Documentation/devicetree/bindings/sram/qcom,imem.yaml +++ b/Documentation/devicetree/bindings/sram/qcom,imem.yaml @@ -50,6 +50,28 @@ patternProperties: $ref: /schemas/remoteproc/qcom,pil-info.yaml# description: Peripheral image loader relocation region + "^stats@[0-9a-f]+$": + type: object + description: + Imem region dedicated for storing timestamps related + information regarding bootstats. + + additionalProperties: false + + properties: + compatible: + items: + - enum: + - qcom,sm8450-bootstats + - const: qcom,imem-bootstats + + reg: + maxItems: 1 + + required: + - compatible + - reg + required: - compatible - reg From patchwork Tue May 9 10:52:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Souradeep Chowdhury X-Patchwork-Id: 91511 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2794728vqo; Tue, 9 May 2023 04:13:12 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7HNXCBkijxApm5fXYbBjj1lN97nyvsnH+eWrZcuQESW9HbLAfBIaPwQmnPnoIueP43V0o9 X-Received: by 2002:a05:6a20:3d20:b0:100:377b:2753 with SMTP id y32-20020a056a203d2000b00100377b2753mr9886131pzi.14.1683630792243; Tue, 09 May 2023 04:13:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683630792; cv=none; d=google.com; s=arc-20160816; b=z5Gaf5pHC8a7vb2Sos8wfF/5bFDEmh07GkxwEwOkJdFeGQ90v8IKHCAvy+J7r6Quxe ersrQpYlXzG/UzrvAZfdUuKLxGCGIm1Z9wHH1SX/UI8Ey0hsOAjBf/R3Cbh+ZTRL2o67 5wa5iNpFp9xm3fYXRVdbMc/gWREetOHOG9AKCd7pLGOh7XLCHZM+bd6JV/MufDIemXDG bS0UoXEpPjbeVBHHg6VTygxuKLEjmHZkSRsIygiYlnhAzUSY6dx8Pf79Svdq2sIRi+Ig 0jZFe0YaMnxAb72evrLIiYCgFj8J/1VmgcpeK4Rd/BSgWrS6IgVROoEKlx0rqI+xq6hM HJlw== 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=kYXMbnAQBGSr3KqiZGbX4/7M47r6Hp/sqQeNRV0nbxg=; b=0pXZPvhak3vegxPBbAnPrB5gjxHaort762JuRgOKuxXtTs/e8kwP3VJ4GkBNND6nvz d+5w/UK3aRAfpdgXQjb3EuVN7QJcEQZFXeLEA7UzaOvPeIxW9uo/Q+E4Jz8dTVDm8f1y rqSemS5Y8qS7BbELDUbpNwa2gALSMFd7FtVc94vYJgNsNyJrkx2+6b6yscZZKOtbVDCm 6djiCASpZl0PWeoymu7RVIf8Rlq1rkUmBIYAJ+55IGJD7uK7Wqf36OQ97PGpmVjYERjn eZEVlMooeJgdizuoLYVNmN9+T1jsY30upbxUYH45e78vmTxOJVI7s3IKCjBYTbwAoX9Y fSLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=L2mqI9FM; 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 y2-20020aa793c2000000b00643a6fa4145si2204929pff.295.2023.05.09.04.12.56; Tue, 09 May 2023 04:13:12 -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=L2mqI9FM; 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 S235408AbjEIKxZ (ORCPT + 99 others); Tue, 9 May 2023 06:53:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234584AbjEIKxQ (ORCPT ); Tue, 9 May 2023 06:53:16 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD8F33A98; Tue, 9 May 2023 03:53:14 -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 3493Dt87004982; Tue, 9 May 2023 10:53:04 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=kYXMbnAQBGSr3KqiZGbX4/7M47r6Hp/sqQeNRV0nbxg=; b=L2mqI9FM5AZ0FPWjK8XcOfIST4STMySQprr7kaZCU+Cu0Z2wXJHig4meysXI46e/IvIv orPuFR3tA2O9ql/RacRwPnO2Be0piA+PpLzgskSclROqu3O/0BAB8IWKm2lw+r51blmI JoHjtQcuzdmfPs+aSeawn200yfFdsZVBOyOcIZ2ClvunnVz/hCeJwlBCmYeqzeuUIUoe 1fWVTTVkWurL1rm5zib/UpQMhIGhJdG0D8WIUmSw0izuxVAx+EaS++qTDzMDjNQ48641 zVeNVRkVhFXaADpEU4lPaSSjs0G8hFGoqkaTOvBIuLUdh9NJTjXjpzf4BkFAHTnadSmx Ng== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3qf7861fv9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 09 May 2023 10:53:04 +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 349Ar3Ol005328 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 9 May 2023 10:53:03 GMT Received: from hu-schowdhu-lv.qualcomm.com (10.49.16.6) 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; Tue, 9 May 2023 03:53:03 -0700 From: Souradeep Chowdhury To: Andy Gross , Konrad Dybcio , Krzysztof Kozlowski , Bjorn Andersson , Rob Herring CC: , , , , Sibi Sankar , Rajendra Nayak , Souradeep Chowdhury Subject: [PATCH V6 2/3] soc: qcom: boot_stat: Add Driver Support for Boot Stats Date: Tue, 9 May 2023 03:52:22 -0700 Message-ID: <35863b47c04c2edd7ae49c57d23682aba6111d4f.1683628357.git.quic_schowdhu@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01a.na.qualcomm.com (10.47.209.196) 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: nR3ugCeBQj9_CUEhaXQ1R0A8PowfPfGq X-Proofpoint-ORIG-GUID: nR3ugCeBQj9_CUEhaXQ1R0A8PowfPfGq 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-05-09_06,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 mlxscore=0 suspectscore=0 clxscore=1015 lowpriorityscore=0 malwarescore=0 phishscore=0 impostorscore=0 mlxlogscore=999 bulkscore=0 spamscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305090086 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765414841561637422?= X-GMAIL-MSGID: =?utf-8?q?1765414841561637422?= 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 show the information within debugfs file. This information is useful in verifying if the existing boot KPIs have regressed or not. The information is shown in milliseconds, a sample log from sm8450(waipio) device is as follows:- /sys/kernel/debug/qcom_boot_stats # cat abl_time 17898 ms /sys/kernel/debug/qcom_boot_stats # cat pre_abl_time 2879 ms 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". Documentation details are also added in Documentation/ABI/testing/debugfs-driver-bootstat Signed-off-by: Souradeep Chowdhury --- .../ABI/testing/debugfs-driver-bootstat | 17 +++ drivers/soc/qcom/Kconfig | 10 ++ drivers/soc/qcom/Makefile | 1 + drivers/soc/qcom/boot_stats.c | 100 ++++++++++++++++++ 4 files changed, 128 insertions(+) create mode 100644 Documentation/ABI/testing/debugfs-driver-bootstat create mode 100644 drivers/soc/qcom/boot_stats.c diff --git a/Documentation/ABI/testing/debugfs-driver-bootstat b/Documentation/ABI/testing/debugfs-driver-bootstat new file mode 100644 index 000000000000..7127d15d9f15 --- /dev/null +++ b/Documentation/ABI/testing/debugfs-driver-bootstat @@ -0,0 +1,17 @@ +What: /sys/kernel/debug/qcom_boot_stats/pre_abl_time +Date: May 2023 +Contact: Souradeep Chowdhury +Description: + This file is used to read the KPI value pre abl time. + It shows the time in milliseconds from the starting + point of PBL to the point when the control shifted + to ABL(Qualcomm proprietary bootloader). + +What: /sys/kernel/debug/qcom_boot_stats/abl_time +Date: May 2023 +Contact: Souradeep Chowdhury +Description: + This file is used to read the KPI value abl time. + It show the duration in milliseconds from the + time control switched to ABL to the point when + the linux kernel started getting loaded. diff --git a/drivers/soc/qcom/Kconfig b/drivers/soc/qcom/Kconfig index a491718f8064..04141236dcdd 100644 --- a/drivers/soc/qcom/Kconfig +++ b/drivers/soc/qcom/Kconfig @@ -16,6 +16,16 @@ config QCOM_AOSS_QMP subsystems as well as controlling the debug clocks exposed by the Always On Subsystem (AOSS) using Qualcomm Messaging Protocol (QMP). +config QCOM_BOOTSTAT + tristate "Qualcomm Technologies, Boot Stat driver" + depends on ARCH_QCOM || COMPILE_TEST + depends on DEBUG_FS + help + This option enables driver support for boot stats. Boot stat driver logs + the kernel bootloader information by accessing the imem region. These + information are exposed in the form of debugfs files. This is used to + determine if there is any regression in boot timings. + config QCOM_COMMAND_DB tristate "Qualcomm Command DB" depends on ARCH_QCOM || COMPILE_TEST diff --git a/drivers/soc/qcom/Makefile b/drivers/soc/qcom/Makefile index 0f43a88b4894..ae7bda96a539 100644 --- a/drivers/soc/qcom/Makefile +++ b/drivers/soc/qcom/Makefile @@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 CFLAGS_rpmh-rsc.o := -I$(src) obj-$(CONFIG_QCOM_AOSS_QMP) += qcom_aoss.o +obj-$(CONFIG_QCOM_BOOTSTAT) += boot_stats.o obj-$(CONFIG_QCOM_GENI_SE) += qcom-geni-se.o obj-$(CONFIG_QCOM_COMMAND_DB) += cmd-db.o obj-$(CONFIG_QCOM_CPR) += cpr.o diff --git a/drivers/soc/qcom/boot_stats.c b/drivers/soc/qcom/boot_stats.c new file mode 100644 index 000000000000..ca67b6b5d8eb --- /dev/null +++ b/drivers/soc/qcom/boot_stats.c @@ -0,0 +1,100 @@ +// 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 +#include + +#define TO_MS(timestamp) ((timestamp * 1000) / 32768) + +/** + * struct boot_stats - timestamp information related to boot stats + * @abl_start: Time for the starting point of the abl + * @abl_end: Time when the kernel starts loading from abl + */ +struct boot_stats { + u32 abl_start; + u32 abl_end; +} __packed; + +struct bs_data { + struct boot_stats __iomem *b_stats; + struct dentry *dbg_dir; +}; + +static void populate_boot_stats(char *abl_str, char *pre_abl_str, struct bs_data *drvdata) +{ + u32 abl_time, pre_abl_time; + + abl_time = TO_MS(drvdata->b_stats->abl_end) - TO_MS(drvdata->b_stats->abl_start); + sprintf(abl_str, "%u ms", abl_time); + + pre_abl_time = TO_MS(drvdata->b_stats->abl_start); + sprintf(pre_abl_str, "%u ms", pre_abl_time); +} + +static int boot_stats_probe(struct platform_device *pdev) +{ + char abl_str[20], pre_abl_str[20], *abl, *pre_abl; + struct device *bootstat_dev = &pdev->dev; + struct bs_data *drvdata; + + drvdata = devm_kzalloc(bootstat_dev, sizeof(*drvdata), GFP_KERNEL); + if (!drvdata) + return dev_err_probe(bootstat_dev, -ENOMEM, "failed to allocate memory"); + platform_set_drvdata(pdev, drvdata); + + drvdata->b_stats = devm_of_iomap(bootstat_dev, bootstat_dev->of_node, 0, NULL); + if (IS_ERR(drvdata->b_stats)) + return dev_err_probe(bootstat_dev, PTR_ERR(drvdata->b_stats), + "failed to map imem region"); + + drvdata->dbg_dir = debugfs_create_dir("qcom_boot_stats", NULL); + if (IS_ERR(drvdata->dbg_dir)) + return dev_err_probe(bootstat_dev, PTR_ERR(drvdata->dbg_dir), + "failed to create debugfs directory"); + + populate_boot_stats(abl_str, pre_abl_str, drvdata); + abl = abl_str; + pre_abl = pre_abl_str; + + debugfs_create_str("pre_abl_time", 0400, drvdata->dbg_dir, (char **)&pre_abl); + debugfs_create_str("abl_time", 0400, drvdata->dbg_dir, (char **)&abl); + + return 0; +} + +void boot_stats_remove(struct platform_device *pdev) +{ + struct bs_data *drvdata = platform_get_drvdata(pdev); + + debugfs_remove_recursive(drvdata->dbg_dir); +} + +static const struct of_device_id boot_stats_dt_match[] = { + { .compatible = "qcom,imem-bootstats" }, + { } +}; +MODULE_DEVICE_TABLE(of, boot_stats_dt_match); + +static struct platform_driver boot_stat_driver = { + .probe = boot_stats_probe, + .remove_new = 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 Tue May 9 10:52:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Souradeep Chowdhury X-Patchwork-Id: 91516 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2798400vqo; Tue, 9 May 2023 04:19:13 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5pmeZiVMr6KKOxSOIy+3JHPR3/3vYUS8NVmTOP5ryPN5UY9NXzX8ZCykEWSO9pxKe0GbdU X-Received: by 2002:a05:6a21:329f:b0:100:24d7:545a with SMTP id yt31-20020a056a21329f00b0010024d7545amr9042646pzb.4.1683631153191; Tue, 09 May 2023 04:19:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683631153; cv=none; d=google.com; s=arc-20160816; b=iCItUeMoCXZAc8QYviSKfjO1uvQ5K8db1+nKG39DS71rZ9eWCO3Iov/c6q03O9iPeV /SSNMJth7MNsRWwsvcnFzftFwK00CidJHkLylIjVYLCsZgaxJw2LlHiHi7rsNAxrq7v/ EImh3z3tJKopWIakwqTcBVplACORIB3zWnZzGjpL9MeduyNhOv2Ssjcmebn56quPqWQs cWkcLQt4wCzZSb+9H3wf2oGx6fYy8ybwbgAln7YSVoRw8/P+HdinsnSQvLhFCXT63wzi va+c0uEmAnKV912/RXgFTCPhJO+f9FGMNBrhwdZPXOgee0fMVzRj9UQBXdqhHXz3jZyv 0xIg== 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=6xIPlERg0WLWW1Ad4YvAtuA7RnoSJimi9d2I291fhB0=; b=oB9L0uM2VLESd0oLSsqUOJ0lbzp8lJOsw4Gs/Tiy0shSJ7+ge26E5qam7u0ZwBDlrg tb67CacYYYvOkMFZy3xSqxptJEqTzbDtmnUAYTmSBlpDjvxFkGw5EtEl3Y30Ue7LtUHg TeQ1n+OaL1YnH3bIy8QZANXKWiNvU5GM7zzPbQFbi9xevgvFjhEXjoytO7Bii9HMTHws uSMjkoAANJ4pPoq/Ut/6vbIquGk2YKwo0+C4F4B40rtyzLphSd+izrt60CvCHYCvGTbm Xov7PNKctwrVz814/Zi0UDjHCe6lhPqgLpfls2pjTC5JsTbeSV60/Fem/PCwt0BOTpHt Pmeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=M1PTj9LG; 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 n17-20020a637211000000b0052c75ef69b6si1390054pgc.231.2023.05.09.04.19.00; Tue, 09 May 2023 04:19:13 -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=M1PTj9LG; 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 S235381AbjEIKxP (ORCPT + 99 others); Tue, 9 May 2023 06:53:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234584AbjEIKxN (ORCPT ); Tue, 9 May 2023 06:53:13 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C05FA3C3A; Tue, 9 May 2023 03:53:12 -0700 (PDT) Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3494a4gK001684; Tue, 9 May 2023 10:53:05 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=6xIPlERg0WLWW1Ad4YvAtuA7RnoSJimi9d2I291fhB0=; b=M1PTj9LGonJ1nYF8NycGsCJMrUAOIbI7TbaQtmx6e4BHOdk/COAGk6hRBPuInPRTiI5c lnKutIwcCRJBHlFg3EW96/IAR59otuk/2tn9Bg+MSeSZiBm07cnCrv0JkT9anEpMoosC g7rGzwX/+YY3nkK3zCgNnbqewtTu5AovbtSiEBKOg53zrGjx4NZdUhe4vIbFhH3V6xZr xZ956cBeAeB3Mi1ZlMZ2xgoHMTo7INRDpoFv1I9/d1k8vgRVKruN0f8ggL0YIXxEinMS ZCZLLhWKNEwFkWjC4nlRF9LUCouFoG+MDdRHRI0jMPDxZC+G8+0Vu9/tEvbQwLxCKx5w qA== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3qf77f1g7m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 09 May 2023 10:53:04 +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 349Ar3O4010166 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 9 May 2023 10:53:03 GMT Received: from hu-schowdhu-lv.qualcomm.com (10.49.16.6) 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; Tue, 9 May 2023 03:53:03 -0700 From: Souradeep Chowdhury To: Andy Gross , Konrad Dybcio , Krzysztof Kozlowski , Bjorn Andersson , Rob Herring CC: , , , , Sibi Sankar , Rajendra Nayak , Souradeep Chowdhury Subject: [PATCH V6 3/3] MAINTAINERS: Add the entry for boot_stats driver support Date: Tue, 9 May 2023 03:52:23 -0700 Message-ID: <9606b72bc2aa7ba5ac2d80266ae0a25ce67c28e7.1683628357.git.quic_schowdhu@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01a.na.qualcomm.com (10.47.209.196) 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: BdK8TAM4CX36yKk3-0E3h6C31in34os2 X-Proofpoint-GUID: BdK8TAM4CX36yKk3-0E3h6C31in34os2 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-05-09_06,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 mlxscore=0 lowpriorityscore=0 priorityscore=1501 spamscore=0 phishscore=0 mlxlogscore=920 suspectscore=0 malwarescore=0 adultscore=0 impostorscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305090086 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765415220455343224?= X-GMAIL-MSGID: =?utf-8?q?1765415220455343224?= Add the entries for all the files added as a part of driver support for boot stats. Signed-off-by: Souradeep Chowdhury --- MAINTAINERS | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 7e0b87d5aa2e..076891632f68 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -17182,6 +17182,13 @@ 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: Documentation/ABI/testing/debugfs-driver-bootstat +F: drivers/soc/qcom/boot_stats.c + QEMU MACHINE EMULATOR AND VIRTUALIZER SUPPORT M: Gabriel Somlo M: "Michael S. Tsirkin"