From patchwork Thu Apr 13 09:28:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Souradeep Chowdhury X-Patchwork-Id: 82881 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp903571vqo; Thu, 13 Apr 2023 02:32:10 -0700 (PDT) X-Google-Smtp-Source: AKy350buMb6XUWGC4/LTgbF2j7EapT6QQzbGWjX/wu0tfDVMrfNpJk6y66UmX5HuiTw5hs7abhfi X-Received: by 2002:a17:902:ab0d:b0:1a6:3b88:9ebb with SMTP id ik13-20020a170902ab0d00b001a63b889ebbmr1471740plb.33.1681378329985; Thu, 13 Apr 2023 02:32:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681378329; cv=none; d=google.com; s=arc-20160816; b=kSSSjSEHrY/PIvbf5o07ue35H2HfVdg1+/RKHPKqDaFFB6RDZFAb4GXGfq9p3LZgMR 2+jcBSCi1spKDbMh5SnNxACICuvMxeVnq2qVu0IXAHdw48uho0fIgvliTvFzBCwmCJb0 CoG7AqgZUTT1qZ+uKcJvSdvB2/NbHOXMoUuuNCjWAXbZP1Tbu9LQWfDEZfd5Ta6N0/Cz 4S4SrAe8D06QRKYyUmpnBQjx/I1HDuxL2pXdM/Pe+bDLuLhiPkLe4yIi2gIOa/DPG3KA 52Zm4vWaYRyCl9dsB/0S1JQ96/2xbJ712EEra9FztudEHyq5EMihITQOQ/kfrl9niV+J xEmw== 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=O67QoG1hp0SUoJhVSij6T4ikMWym8/XfXIXVcd4MYEA=; b=nVZUOWT3b5stGsIoWJbCiY6WqWd4xvoFjxU2FJzVmLBDoUl1dCvZqynpBoPf8omOYs P0HjRtqjq5SH68NnRhwjbrAU7ytFeRF7Oqk7nvzWlKDg6nT21AzeR5BmQomwf4XhGD+2 EkHG/3oNz+ERcY70p+j9MDEbQrvPYBZ/Ym57yV4ovXjVO3uV8S07RP5I3N5RhNtN7KSH O5vur/PCE9wfKRMjrAsJS9UPhhsXPhg51PiBnQh4OqzH90WXFq+m4/w10I+evuD7khqM 6/rkzqe2SWF+ee7ZllXLs+NFbVMQMRc9ZtfZEfDz6aYvfFzrtkB8Xjc1AENR1ZtQ5V2o aryA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=WdfbI49S; 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 y12-20020a63e24c000000b00517ba74c173si1615164pgj.506.2023.04.13.02.31.57; Thu, 13 Apr 2023 02:32:09 -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=WdfbI49S; 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 S230081AbjDMJ3G (ORCPT + 99 others); Thu, 13 Apr 2023 05:29:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229917AbjDMJ3A (ORCPT ); Thu, 13 Apr 2023 05:29:00 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAE4683C1; Thu, 13 Apr 2023 02:28:59 -0700 (PDT) Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33D8RTke002131; Thu, 13 Apr 2023 09:28: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-type; s=qcppdkim1; bh=O67QoG1hp0SUoJhVSij6T4ikMWym8/XfXIXVcd4MYEA=; b=WdfbI49S9BaMJMcqK3UWBKtt72C3F9bM82ISzkPi9EEsbevC/fsg67JAsKH+vubwegn2 ++c4JsZ4cXfnpApn1DLhI2w6K7diGZ4aCm/MW2pKokX7E6bbZ7iZGaznAs4Njiu1BcYI +jmlrAcpCIoQDweNO9mpfCJtYCOwIV9wIofeR1KiLk864nvbvBIvYJ5K78Gmft9cLBq7 pIRHTXx3/bTjAn3SvpY3/Zrh5nhkBVgEufZ059/uv2hGUZfhy/096robB3xy3gESVF2g pdEVpBLKYd9X5YbEjabmCOmEfzwPWLMG0YSFyZgoQnbHKEDp//Xp8X9Dp3YmqOm98bsn gA== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3pwqnq31vh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Apr 2023 09:28: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 33D9SnA4031466 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Apr 2023 09:28:49 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; Thu, 13 Apr 2023 02:28:44 -0700 From: Souradeep Chowdhury To: Andy Gross , Konrad Dybcio , Krzysztof Kozlowski , Bjorn Andersson , Rob Herring CC: , , , , Sibi Sankar , Rajendra Nayak , Souradeep Chowdhury Subject: [PATCH V3 1/3] dt-bindings: sram: qcom,imem: Add Boot Stat region within IMEM Date: Thu, 13 Apr 2023 14:58:16 +0530 Message-ID: <0e48ef5a9558c0bab5c2918af3c15ed4425b07be.1681375949.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-ORIG-GUID: tnul9fZq8v2lYKcG03v_F2GaWCVLSHO3 X-Proofpoint-GUID: tnul9fZq8v2lYKcG03v_F2GaWCVLSHO3 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-13_05,2023-04-12_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 impostorscore=0 suspectscore=0 bulkscore=0 priorityscore=1501 mlxscore=0 phishscore=0 clxscore=1015 spamscore=0 adultscore=0 mlxlogscore=999 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304130085 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, 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?1763052963419723635?= X-GMAIL-MSGID: =?utf-8?q?1763052963419723635?= 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 | 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 ba694ce..c1e1e9b 100644 --- a/Documentation/devicetree/bindings/sram/qcom,imem.yaml +++ b/Documentation/devicetree/bindings/sram/qcom,imem.yaml @@ -49,6 +49,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. + + properties: + compatible: + items: + - enum: + - qcom,sm8450-bootstats + - const: qcom,imem-bootstats + + reg: + maxItems: 1 + + required: + - compatible + - reg + + additionalProperties: false + required: - compatible - reg From patchwork Thu Apr 13 09:28:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Souradeep Chowdhury X-Patchwork-Id: 82884 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp906372vqo; Thu, 13 Apr 2023 02:38:56 -0700 (PDT) X-Google-Smtp-Source: AKy350ZZt1c93NIK5D5RF4NV6WYZVDcdYB5DAq2rXsn0HlV/qNT9jwIeHbf/Jto+BUizCVWn/7VY X-Received: by 2002:a17:906:ce56:b0:94a:7186:83a0 with SMTP id se22-20020a170906ce5600b0094a718683a0mr2285654ejb.35.1681378735938; Thu, 13 Apr 2023 02:38:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681378735; cv=none; d=google.com; s=arc-20160816; b=otcHc1Y8fZnjvcxxrswgVp4Glnyk+I4cZgwSx2NU6tmoSsX4YktwAdQSu1cc/zUFdX MgKbP4otdihaPHUQOskoANHxyGy4yufK9EMfEtVHaCdF+2Qq0O+wvcOLMx1QH/i1MtOC VtLbHl4EoDTdAI55CaNGZ+FrG5Uql4rYsMPX7TdGEackLUtP6GmDz7iN1yWxTTlejFY2 1Hr00txw/cSj5SL8U3LVORqQc+6aj23vb/AnGvl+TC2oAP4rVu8JezWHNzRBnaF4VI8w z38+td6coRii0PRWFhzczOG+u+XG7fziV06sMAzWVerPdsaV5bEzuNpOsgsioDKFnDb/ 2uUg== 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=lxfGHeWYk+q4GyNLqS+gJ9Z61ofKxRzkhLElDiiPixg=; b=yPy/J1PXzVMQUrg7M6G6ILp23RGmN3GJ1d5ipmHAWuCFPtoaMFSrRsBK0cZoj5598x DIg4KiVMbC50LRIMmaS5L6YnTLATAAfLaJfU7PRLEFV77Jl01b7c9ih0sumbrN2SDX20 J7uMEbmwo8IpmKUM35WCtpbmXTkkpXHPWRCd3Om9TLftxxLEqdrYlOKgqHiwnnPMf9j8 1jYYqQl7yN8D4Ll/It/PxKNt8tlMPMNS7shDGSaZqkvrXw1YmQaH4Gx26E4B6QakoTsc w6pbcsrLHSjVBukgYlADBZowodb8DAn5Z5tQQ1+ySdy1B9gBxZetIejnDjBn5KjjMHHv 9I3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=lWIrco+u; 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 v16-20020aa7d650000000b005029d15aa77si1385338edr.15.2023.04.13.02.38.32; Thu, 13 Apr 2023 02:38:55 -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=lWIrco+u; 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 S230309AbjDMJ3I (ORCPT + 99 others); Thu, 13 Apr 2023 05:29:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230163AbjDMJ3E (ORCPT ); Thu, 13 Apr 2023 05:29:04 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16BBA83D7; Thu, 13 Apr 2023 02:29:03 -0700 (PDT) Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33D8QfJX005774; Thu, 13 Apr 2023 09:28:54 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=lxfGHeWYk+q4GyNLqS+gJ9Z61ofKxRzkhLElDiiPixg=; b=lWIrco+uEYpH0vYFoyOg0Yr3ShmLmbkV03uUtKC55KB3Ul+sFsYGKPcTw10ien3BEIVi pVeiABxZ7BCf5qh3NNM4rCWNh4ybU3Orx3dTeasGVxOq+DBAEwwWJGVnUxdiGEPwwjTd 4eleMn2UumLgFOZ4OSNLXpapP8mkswfYgh2G4lbwonnPUogGKgY8okR1t2LfJjSdc+Kt KgagL6aLW6yMnsBA1D87e8ymgpz8xKx9+2WwicLqoNZa3HMifEqIQRlvQGjBmhFG14on LhmGPPkqTjIyl3D/BjVXOSa/DY6QR8GQLr6IJPsl6buJsnMvR8t8WN8jNPXusrCoXT1w Eg== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3px5pks2bb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Apr 2023 09:28:54 +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 33D9SrH8005566 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Apr 2023 09:28:53 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; Thu, 13 Apr 2023 02:28:49 -0700 From: Souradeep Chowdhury To: Andy Gross , Konrad Dybcio , Krzysztof Kozlowski , Bjorn Andersson , Rob Herring CC: , , , , Sibi Sankar , Rajendra Nayak , Souradeep Chowdhury Subject: [PATCH V3 2/3] soc: qcom: boot_stat: Add Driver Support for Boot Stats Date: Thu, 13 Apr 2023 14:58:17 +0530 Message-ID: <65b1db8d7d95bf09f8314ed3bfd9d007d1edbf3b.1681375949.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-ORIG-GUID: -G-X4FFjlSF7gGDwHmb5qOuQt_AKEMOe X-Proofpoint-GUID: -G-X4FFjlSF7gGDwHmb5qOuQt_AKEMOe 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-13_05,2023-04-12_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 adultscore=0 malwarescore=0 impostorscore=0 mlxscore=0 suspectscore=0 lowpriorityscore=0 clxscore=1015 mlxlogscore=999 bulkscore=0 priorityscore=1501 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304130085 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, 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?1763053389584436670?= X-GMAIL-MSGID: =?utf-8?q?1763053389584436670?= 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/146aa6b0.boot_stats # cat abl_time 17898 ms /sys/kernel/debug/146aa6b0.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 --- Documentation/ABI/testing/debugfs-driver-bootstat | 17 ++++ drivers/soc/qcom/Kconfig | 9 ++ drivers/soc/qcom/Makefile | 1 + drivers/soc/qcom/boot_stats.c | 109 ++++++++++++++++++++++ 4 files changed, 136 insertions(+) create mode 100644 Documentation/ABI/testing/debugfs-driver-bootstat create mode 100644 drivers/soc/qcom/boot_stats.c -- 2.7.4 diff --git a/Documentation/ABI/testing/debugfs-driver-bootstat b/Documentation/ABI/testing/debugfs-driver-bootstat new file mode 100644 index 0000000..37d8e32 --- /dev/null +++ b/Documentation/ABI/testing/debugfs-driver-bootstat @@ -0,0 +1,17 @@ +What: /sys/kernel/debug/...stats/pre_abl_time +Date: April 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/...stats/abl_time +Date: April 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 a8f2830..0d2cbd3 100644 --- a/drivers/soc/qcom/Kconfig +++ b/drivers/soc/qcom/Kconfig @@ -16,6 +16,15 @@ 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 + help + This option enables driver support for boot stats. Boot stat driver logs + the kernel bootloader information by accessing the imem region. These + information is 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 6e88da8..bdaa41a 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 0000000..9b65aa1 --- /dev/null +++ b/drivers/soc/qcom/boot_stats.c @@ -0,0 +1,109 @@ +// 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; + +static struct boot_stats __iomem *boot_stats; +static struct dentry *dbg_dir; + +static ssize_t abl_read(struct file *filp, char __user *userbuf, + size_t count, loff_t *ppos) +{ + char buf[20]; + + u32 abl_time = TO_MS(boot_stats->abl_end) - TO_MS(boot_stats->abl_start); + + sprintf(buf, "%u ms\n", abl_time); + return simple_read_from_buffer(userbuf, count, ppos, buf, strlen(buf)); +} + +static const struct file_operations abl_fops = { + .read = abl_read, + .open = simple_open, + .llseek = generic_file_llseek, +}; + +static ssize_t pre_abl_read(struct file *filp, char __user *userbuf, + size_t count, loff_t *ppos) +{ + char buf[20]; + + sprintf(buf, "%u ms\n", TO_MS(boot_stats->abl_start)); + return simple_read_from_buffer(userbuf, count, ppos, buf, strlen(buf)); +} + +static const struct file_operations pre_abl_fops = { + .read = pre_abl_read, + .open = simple_open, + .llseek = generic_file_llseek, +}; + +static int boot_stats_probe(struct platform_device *pdev) +{ + struct device *boot_stat = &pdev->dev; + + dbg_dir = debugfs_create_dir(dev_name(&pdev->dev), NULL); + if (IS_ERR(dbg_dir)) + return dev_err_probe(&pdev->dev, -ENOENT, + "failed to create debugfs directory"); + + boot_stats = of_iomap(boot_stat->of_node, 0); + if (!boot_stats) + return dev_err_probe(&pdev->dev, -ENOMEM, + "failed to map imem region\n"); + + debugfs_create_file("pre_abl_time", 0200, dbg_dir, NULL, &pre_abl_fops); + debugfs_create_file("abl_time", 0200, dbg_dir, NULL, &abl_fops); + + return 0; +} + +static int boot_stats_remove(struct platform_device *pdev) +{ + debugfs_remove_recursive(dbg_dir); + iounmap(boot_stats); + + return 0; +} + +static const struct of_device_id boot_stats_dt_match[] = { + { .compatible = "qcom,sm8450-bootstats" }, + { } +}; +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 Thu Apr 13 09:28:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Souradeep Chowdhury X-Patchwork-Id: 82882 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp903935vqo; Thu, 13 Apr 2023 02:32:55 -0700 (PDT) X-Google-Smtp-Source: AKy350YeeERWckb7htKO6GNzlc6rD0W1OHAqcJj/B2m4XZS42rL5cUFKjsQcE04KMFQi/L32HldY X-Received: by 2002:a05:6a20:2986:b0:e4:2a2c:86a2 with SMTP id f6-20020a056a20298600b000e42a2c86a2mr1513740pzh.41.1681378375239; Thu, 13 Apr 2023 02:32:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681378375; cv=none; d=google.com; s=arc-20160816; b=ZjY/epVLpllibd6WJnxZVLKzd9Bipp4PZYX4sbDPgqEUVi6Zdt2/uodeiZqeDZ5eDY bnxagtnMRIvaeGbtktQthbqCVhHmQeVrG6N/qbvbUvsWI8e84ttjBcoJemewZy0z6Bg8 LozK2qRD30SrLWRUmwLdW0y400ObRMpJWn0kiU+LQDbjDwOnkRqCEUMC4mp6iT19iTZl pTnTFJ4PsmevQubnXMeGYF+v12O21cxge2tsc0Cee6JGYGLhja8Bn2vcZUepCieeZbns V7Czi5IzKwMQrMNICrxHmDP5GW3YsMCWiIoFiEFfxBxGxgEGIHvJ0Xz2JSsP3ufGnulT 2HSw== 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=wLg6bFDRbhWlSEd0FB3HC3klJjPMFejYMgCtToFRl/c=; b=rbCzLDQUcg0IAvo8bqIM9zXN0QKdOnNGRUa20n7D0MzMPjVv6cnErBkD8y8SVC41w8 90tteYJafDsHAzqm1EgsZbio4cI1EKjbIL57hppW3hoKtNSgxZ3b9+pt3VtoTDAk85QT lYv+VUF/Rt7eXLKToPLFy4uBoRhoNLoOTiBkUoI4J6QFxbOaVp5VXZb5SPpUc1QD2DZL CGUc4irQoeNrcwvNvql/HsaJpXKPLdK/lCdUayzem5R22DlpGOit5OHkZiD3Wj4FPB67 Fdqd7hRA/es43CDljKSQJ1IDE5FaUawPXuKRK2OnmxX8cWNVtcjzU1vcROhjbyXrQZIB uSwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Z9PCHBe6; 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 c2-20020a63d142000000b005139e8ca7b1si1811688pgj.494.2023.04.13.02.32.43; Thu, 13 Apr 2023 02:32:55 -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=Z9PCHBe6; 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 S230223AbjDMJ3R (ORCPT + 99 others); Thu, 13 Apr 2023 05:29:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230204AbjDMJ3G (ORCPT ); Thu, 13 Apr 2023 05:29:06 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2AAF07D96; Thu, 13 Apr 2023 02:29:05 -0700 (PDT) Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33D9Qnrl004679; Thu, 13 Apr 2023 09:28:58 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=wLg6bFDRbhWlSEd0FB3HC3klJjPMFejYMgCtToFRl/c=; b=Z9PCHBe6HcFBJc9gTz5i4GTPM2A/dsgYu3aI83nvMs0/rPSmQQ00sKW+vCWsCv0en4Ws LKDKyg5Pq2IFVPXNTiG0dABekGqUI+DWIG5mKQwsikP0oH4nLvXJQn1+xanx0RkXUwPZ zOHbuyCyc4lkdJA3iCDxqFCLfWAmYBD+g68dc6zDZau+i+8eUChgmWeu8/OXwh41cIVr 30f4KTbXVDxqkn0mFP/vz2wh9i+TeMBGlrNlq6Ah7PkFma5tLLI8NLeXYJypsv3Kvym/ Yv0odXzpRq18JNi8KFQBIAxFHUe1p7FmXLEGTdLamC07uqNnp8vBWWFWOW9d83+FLQGj lg== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3pwqnq31vu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Apr 2023 09:28:58 +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 33D9Sv91031979 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Apr 2023 09:28:57 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; Thu, 13 Apr 2023 02:28:53 -0700 From: Souradeep Chowdhury To: Andy Gross , Konrad Dybcio , Krzysztof Kozlowski , Bjorn Andersson , Rob Herring CC: , , , , Sibi Sankar , Rajendra Nayak , Souradeep Chowdhury Subject: [PATCH V3 3/3] MAINTAINERS: Add the entry for boot_stats driver support Date: Thu, 13 Apr 2023 14:58:18 +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: xn4VlJZMtegzw9rjUrXuYqsJ2zE7k1EA X-Proofpoint-GUID: xn4VlJZMtegzw9rjUrXuYqsJ2zE7k1EA 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-13_05,2023-04-12_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 impostorscore=0 suspectscore=0 bulkscore=0 priorityscore=1501 mlxscore=0 phishscore=0 clxscore=1015 spamscore=0 adultscore=0 mlxlogscore=905 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304130085 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, 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?1763053011444708900?= X-GMAIL-MSGID: =?utf-8?q?1763053011444708900?= 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 0e64787..20b96e9 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -17055,6 +17055,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"