From patchwork Tue Apr 18 06:46:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Souradeep Chowdhury X-Patchwork-Id: 84601 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2628172vqo; Mon, 17 Apr 2023 23:50:54 -0700 (PDT) X-Google-Smtp-Source: AKy350YsIJbev1YSfbY5rxezlPyGkDSd7/9p48R0nZ2TlVEkF55NuBKOndOLY/AM0m3/VAwQSp2A X-Received: by 2002:a05:6a20:4325:b0:f0:65fb:6cec with SMTP id h37-20020a056a20432500b000f065fb6cecmr2786161pzk.8.1681800654071; Mon, 17 Apr 2023 23:50:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681800654; cv=none; d=google.com; s=arc-20160816; b=HBVI8se1nb7M7/FuucL7YMVy4UE4h8BEblwxAEjMw9YpmaUG7ESRHGrjIDQilrFHFY Eln7ilMEvxxDF5ChtE/225jTbC8NMRrqUwZU3vM0vvxVddEd5k6E7jI0k7z6hRCI26G7 fslFg/rx9L8e8dudQbuPVJlpJopTLFJ8qAIIAldEhoU7XRGHBWoil5fRcZQUsZjdjEoZ Z5Pn85iOIP2Vmnwd6onvG4TleM6gtl5OD46v1BjAUo4bowvXtk7VgAm9290/wkUjvomw bklyJ1xvu5dOIrM/ybgGLSyp/CRs1NSBFOqxZ2M0AKQu3HtepCqhzdGM47pRiIC+tr+4 m6nw== 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=ylu9sT18CzYuxKR77gvxM8O+qT0i9HJxTtsyYBFM95Y=; b=XyJJ4I2HfVB4Ggkqi9u19KYlqFzbIQZ6dZ4bBAbmNHffa7xtvMDRxcWgUMYS2tMIB3 cZLKUQw+R1J9hYn6OeiSpKpoldk1of6o7dbPyUbzAura9L28QiPI/6DwgLllbLahZqRd ioQaPWPTmOjS6JnkMSV0C45iE/5yttvK9tJHmIGQUS+56wRzkM86JwVJMjDPMd9VdrZn yYxzy7nf8vYeqy7BqTikLYujDrWnl52GzV1hdYjonHfBDPqtXdM/3bpOArftmf9gC+vI 17uiXTbjMyxBNFeZBCTe1Q5inowxhiT6OOtkigOU1sgZhabUH4xNLxwVnEcazPnN9EXY LkOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=LVZzm8eC; 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 bv1-20020a632e01000000b004fc274006ddsi12940505pgb.670.2023.04.17.23.50.39; Mon, 17 Apr 2023 23:50:54 -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=LVZzm8eC; 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 S230424AbjDRGqr (ORCPT + 99 others); Tue, 18 Apr 2023 02:46:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230026AbjDRGqo (ORCPT ); Tue, 18 Apr 2023 02:46:44 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C37E840D5; Mon, 17 Apr 2023 23:46:43 -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 33I6K2Id018348; Tue, 18 Apr 2023 06:46:32 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=ylu9sT18CzYuxKR77gvxM8O+qT0i9HJxTtsyYBFM95Y=; b=LVZzm8eCX9brb7emghJ5XJe1p0h4AzDuNdoGF+liRKBhbZ1ZUGuGf3U/w9PVl8MouPi3 fkGWckjjCwCnoXwB4+/+qH4Orn0YTMx15ZUKEXMgpXCWD7FJNv3jkLQfGFWGLcsu5dBT gOevqOXYcQjCATSB35towlA+twiXttNcFA/7IhR49HtIVfY4HNBACOWYxHvu/NHTmFXr DB/mtdzbwBL4g/+Etz/eUoa8QBuusUy2VyjT+25IHCAyYtCG2zNsK4J/zFSyiCTJjJYN I8ojKceWGD6vrm2nrE2rxgU6lLoyS8NXPFd0lOJndMTcG+cRAqgqY0qqAP1qRTY2mqUh IA== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3q1nr5g20r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Apr 2023 06:46:32 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 33I6kVmJ008306 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Apr 2023 06:46:31 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; Mon, 17 Apr 2023 23:46:27 -0700 From: Souradeep Chowdhury To: Andy Gross , Konrad Dybcio , Krzysztof Kozlowski , Bjorn Andersson , Rob Herring CC: , , , , Sibi Sankar , Rajendra Nayak , Souradeep Chowdhury Subject: [PATCH V5 1/3] dt-bindings: sram: qcom,imem: Add Boot Stat region within IMEM Date: Tue, 18 Apr 2023 12:16:03 +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-GUID: HAY1tU9PitpOul8NAROhqTwyePMoDpFZ X-Proofpoint-ORIG-GUID: HAY1tU9PitpOul8NAROhqTwyePMoDpFZ 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-18_03,2023-04-17_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 adultscore=0 spamscore=0 suspectscore=0 impostorscore=0 phishscore=0 mlxlogscore=999 clxscore=1015 priorityscore=1501 mlxscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304180062 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?1763495802676765698?= X-GMAIL-MSGID: =?utf-8?q?1763495802676765698?= 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 ba694ce..d028bed 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. + + 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 Apr 18 06:46:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Souradeep Chowdhury X-Patchwork-Id: 84602 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2628248vqo; Mon, 17 Apr 2023 23:51:06 -0700 (PDT) X-Google-Smtp-Source: AKy350bUwVXqskdKTvTY3XU1HtbkGs2Mibm5j5uRuzQCAvJGu0LcVltfW6NAv2DBOwLAaRMBUeh8 X-Received: by 2002:a17:902:da8a:b0:1a6:97fd:29e7 with SMTP id j10-20020a170902da8a00b001a697fd29e7mr1339896plx.27.1681800666587; Mon, 17 Apr 2023 23:51:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681800666; cv=none; d=google.com; s=arc-20160816; b=GUYoqu+gpbz/R8sDr6+d/HAApA/DtQIrW5GidBSvB6p0RrC0GRt4ov1aZo/h1N/uph rbmjAlJJtlp4E6i3J3Mclb7RYdG0DK0wPA0FtDY99QYMVSlSUU61rllupmbm4r0XCPMI 5Cn16rxa5p9OA0S4faBw/82MTz+TCu1yopZbp1SIpLjn66ojwjeYLo2cZfy0SBuo8OOI Vaw7SEdDUGhOpSmHiJKdVa66utOGYp9gjNqKsDx4y7eFoqH95GbjNE6MprvwpkEkk/1u H/doyAa/Gt0l28pi73KMTmbBPQLD3sRCFyvb1OrcLfq/1az8Hxl6biQl9aFlbR3Z+vZw 6Qqw== 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=3QUMVJZYbZcnwqGMQhM5R0p/9kYPOiZZKwn+2pmfj88=; b=cHo8/T6BJrXmfYVpvndk6fdj8AXtBZ6I/4RetVHmVcWPOH8Qm8I8jOx6N0UO5JvKbz XoOib+qm/wI6QJIwA7r5qo/+SwfCm5+xUqQGs2wE9rofhfRhYDQq94v4FDSZGkZITilf TNefcP8B3XuLrAlWVzdJI5mZ9Ya/J4fo6oFFLfNHUOv+MG41W5hFoVeM0oH6+ZFHnRgt 8kmZSQO/mUtObrQA1//RRPF/V2pApqQJumAyQHC8tAeeC2sOilHRXcy40LqK8wi1kGjL t4uasmU9VxWokhzrJAecsWj606DGMkfDefHQ0ku46CUWwXTYIZQnIwkEy/vRl5s0OSOI +1UA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=DxmK12si; 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 m22-20020a170902bb9600b0019ca3bea310si12884048pls.303.2023.04.17.23.50.52; Mon, 17 Apr 2023 23:51:06 -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=DxmK12si; 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 S231144AbjDRGqx (ORCPT + 99 others); Tue, 18 Apr 2023 02:46:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230036AbjDRGqp (ORCPT ); Tue, 18 Apr 2023 02:46:45 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F15F540DC; Mon, 17 Apr 2023 23:46:43 -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 33I6Lc8g008942; Tue, 18 Apr 2023 06:46:37 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=3QUMVJZYbZcnwqGMQhM5R0p/9kYPOiZZKwn+2pmfj88=; b=DxmK12siI0D7cwyAYIZpT9Rv4OZRkkl+bw2M2r8F6dwcrdXOpteGG9fAYhzz66n5+d/C SYRhuAuMTj1YaaFjIyOAbnLlc4myX3U4f+KHypAvaVi4PbK0Gr3xGgV2kdzF+ki0Rs4P W/2XXivE+vdN9Gt+hJgMLovRXQnkYgyS/hRnJruVpymI/20qHclfzb96v6R8UfI9UZSl /JAmN+wJB66cl7uHCn4mR4+EyzYC4XDHpX1fsKG9buYfxt/kdoikbMRVEgN9APWnxbkb 6frzMny0EpSorJboWvY15TW87uLu0mCN+sFLDLx/SXrdvy4pPgyGtTW8o8D58A+k1O1w +A== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3q12sttjua-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Apr 2023 06:46:36 +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 33I6kaa0006737 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Apr 2023 06:46: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; Mon, 17 Apr 2023 23:46:31 -0700 From: Souradeep Chowdhury To: Andy Gross , Konrad Dybcio , Krzysztof Kozlowski , Bjorn Andersson , Rob Herring CC: , , , , Sibi Sankar , Rajendra Nayak , Souradeep Chowdhury Subject: [PATCH V5 2/3] soc: qcom: boot_stat: Add Driver Support for Boot Stats Date: Tue, 18 Apr 2023 12:16:04 +0530 Message-ID: <142bfd034c12c245cda9f1dee20a05188b63494d.1681799201.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: -rS22YT5upnUzrSMqPLwvEN71dJ_wNmL X-Proofpoint-ORIG-GUID: -rS22YT5upnUzrSMqPLwvEN71dJ_wNmL 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-18_03,2023-04-17_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 suspectscore=0 mlxscore=0 impostorscore=0 adultscore=0 bulkscore=0 mlxlogscore=999 phishscore=0 clxscore=1015 spamscore=0 malwarescore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304180062 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?1763495815688575036?= X-GMAIL-MSGID: =?utf-8?q?1763495815688575036?= 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 | 101 ++++++++++++++++++++++ 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 0000000..2543029 --- /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 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 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..7ae002b --- /dev/null +++ b/drivers/soc/qcom/boot_stats.c @@ -0,0 +1,101 @@ +// 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 int abl_time_show(struct seq_file *seq, void *v) +{ + struct boot_stats *boot_stats = seq->private; + u32 abl_time = TO_MS(boot_stats->abl_end) - TO_MS(boot_stats->abl_start); + + seq_printf(seq, "%u ms\n", abl_time); + return 0; +} +DEFINE_SHOW_ATTRIBUTE(abl_time); + +static int pre_abl_time_show(struct seq_file *seq, void *v) +{ + struct boot_stats *boot_stats = seq->private; + + seq_printf(seq, "%u ms\n", TO_MS(boot_stats->abl_start)); + return 0; +} +DEFINE_SHOW_ATTRIBUTE(pre_abl_time); + +static int boot_stats_probe(struct platform_device *pdev) +{ + struct device *bootstat_dev = &pdev->dev; + struct bs_data *drvdata; + + drvdata = devm_kzalloc(bootstat_dev, sizeof(*drvdata), GFP_KERNEL); + platform_set_drvdata(pdev, drvdata); + + drvdata->dbg_dir = debugfs_create_dir(dev_name(bootstat_dev), NULL); + if (IS_ERR(drvdata->dbg_dir)) + return dev_err_probe(bootstat_dev, -ENOENT, "failed to create debugfs directory"); + + drvdata->b_stats = devm_of_iomap(bootstat_dev, bootstat_dev->of_node, 0, NULL); + if (!drvdata->b_stats) + return dev_err_probe(bootstat_dev, -ENOMEM, "failed to map imem region\n"); + + debugfs_create_file("pre_abl_time", 0200, drvdata->dbg_dir, + drvdata->b_stats, &pre_abl_time_fops); + debugfs_create_file("abl_time", 0200, drvdata->dbg_dir, drvdata->b_stats, &abl_time_fops); + + return 0; +} + +static void boot_stats_remove(struct platform_device *pdev) +{ + struct bs_data *drvdata = platform_get_drvdata(pdev); + + debugfs_remove_recursive(drvdata->dbg_dir); + iounmap(drvdata->b_stats); +} + +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_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 Apr 18 06:46:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Souradeep Chowdhury X-Patchwork-Id: 84606 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2631255vqo; Mon, 17 Apr 2023 23:58:56 -0700 (PDT) X-Google-Smtp-Source: AKy350aLbJZaemn4nPn0lX7XT6He6ioELC0fiFb3ICB9UA10zMoZYOADLlSbe7/JzCVhP6lJ0Axk X-Received: by 2002:a05:6a20:4304:b0:ef:8de0:6a5 with SMTP id h4-20020a056a20430400b000ef8de006a5mr7793301pzk.3.1681801136502; Mon, 17 Apr 2023 23:58:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681801136; cv=none; d=google.com; s=arc-20160816; b=yAYxdufytF7t3Ey2e0fk9rrBkD8YF63L7SK3ryewUVWuwxV45v36qevzosAE54Kd9Q RKH1xB4cMToOdlvZhzh/xWHnHngV9rqWH318hksf03EeMokNZMuCRzRi0SQcEi1YRzsC n7nBIdRWx5oWvBjuREuSq7W7YroMPo/c66oOmHNsHaf4WI+K76OeWQZ27nNtbH/b+bG6 lve1LreaTGiDnsv4LB5p8V1D3BPfWBwrCN2kir2eQVQCfeQcX5PFrefRtwqe78piVn5D EU9hUTrAgUl06dLTTuwdQPBL5KoDzkb4Wrj97BD7X3fQfm6jpLecfB2TJJFhQUzO14/5 9+Yg== 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=KQhL2jOpK7sHuu11SaNmmMtTA3wJjRFQjy+V5A6XMg4/ye8Oe5Nuboqumcjrz1RMbk 3IpVB+LILMx4k9/gGXMm2maLgV44cWH2f7TfsPrW+9zvZqjiI9wvYBdg09VLNwWOBPN0 4pdNqrOdByj2bDyQrz94YGO52v7ZWCQhUi4P1ZMwykSgRHTQzkhU+xJkoRHPdCkXDmT0 WVryilB5AQSZSPDxUSSV3eHWbEu/C43m/qV4hh9ZW8G48f3pRToaTs7uMd7dfpbL6z3T tsqRx7VLFChK08n+hynujDW5VGCCKiE8m6b8AjN+KGHluCMZ3OGNpx4LjAvP0mHcIu/0 90WA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=NtrBee8g; 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 g3-20020aa79dc3000000b0063b84b5b53asi6889655pfq.9.2023.04.17.23.58.41; Mon, 17 Apr 2023 23:58:56 -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=NtrBee8g; 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 S231159AbjDRGq5 (ORCPT + 99 others); Tue, 18 Apr 2023 02:46:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230482AbjDRGqs (ORCPT ); Tue, 18 Apr 2023 02:46:48 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 192F140D5; Mon, 17 Apr 2023 23:46:47 -0700 (PDT) Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33I6KBM9011080; Tue, 18 Apr 2023 06:46: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=wLg6bFDRbhWlSEd0FB3HC3klJjPMFejYMgCtToFRl/c=; b=NtrBee8gG3wa5KJCSmGXwSzOqYGGj9WpeQcqliMtmyfcaICgtAJKrO6p05uiyQfsvVQm 1woVIa2pNKsdlJM7C9eBsPpcS0GI9R1nEGxIXIA592zfEgpTRRZKNkU6l00CA7pmZb2Q qO02UayaDJrwKU22JQ9v3lj3rkSA94831YPVlZnsR5wZb6cghdfhvC4bnfF58HU18n5T 9Qf4IiVvD5If/2EUZvNtgCCrLwiRBjxzyKz6cxLIu3A9LbMOtVTva6YbSqwwg+LjPA6A QhItswwE8PPfrqQQVBrHylMljRSjYo1u0hbA8vRbiPBBC+jV7zLCXtME0T8p/5ydJmy0 jg== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3q1a6c9bb2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Apr 2023 06:46:40 +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 33I6keHh014048 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Apr 2023 06:46:40 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; Mon, 17 Apr 2023 23:46: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 V5 3/3] MAINTAINERS: Add the entry for boot_stats driver support Date: Tue, 18 Apr 2023 12:16:05 +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: Kvan52lRip5rxQa5D7MBGVvYXrJDPUPl X-Proofpoint-GUID: Kvan52lRip5rxQa5D7MBGVvYXrJDPUPl 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-18_03,2023-04-17_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 spamscore=0 mlxscore=0 malwarescore=0 phishscore=0 priorityscore=1501 mlxlogscore=906 bulkscore=0 impostorscore=0 clxscore=1015 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304180062 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?1763496308571795115?= X-GMAIL-MSGID: =?utf-8?q?1763496308571795115?= 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"