From patchwork Mon Apr 17 15:08:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Souradeep Chowdhury X-Patchwork-Id: 84290 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2199059vqo; Mon, 17 Apr 2023 08:13:11 -0700 (PDT) X-Google-Smtp-Source: AKy350ahcjBXI3GcB/jwwgOLt/yjBT2y5vJtOQHyVx9i/ygS6j85KofsGIbCQiHLOd3At6JXqdsT X-Received: by 2002:a05:6a20:2907:b0:e6:f7e8:1e4d with SMTP id t7-20020a056a20290700b000e6f7e81e4dmr14195208pzf.33.1681744391025; Mon, 17 Apr 2023 08:13:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681744391; cv=none; d=google.com; s=arc-20160816; b=RwTMV9g2FHazV47q7VjKNOR552COm1lTPkF1QGGN2KvA5aeQtamB2UWodb2BP8SLLd 5Q8YJDF14UjnrkiqUo/jDZDXmboLp8EJ3Ct7Z1j78J07Dly8EReT2JyMJGwyaKlu90Vd AjYX8rsXnyZkpLWgYtHYvSUtGDFCThLXKB7vawz4UwIv0+kZevD3HXM+m6QsWfnIT6Nx 5gqWT+VReFYlWPxRcsmEEdA9kPLM2PiEQ+JBD6QI4ssLJEIOhNgX3NcscpwGPQ23amlf i+9Nuwc7ubPxWjhAcSQLy3aqbE1kKH/VPxC/rPWVCIGW6ECs+9FMaAUY6/EP2haf0tkl Flrw== 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=rxeXDgzb5RkH+fkQl585sIEOAZ5pbn46pKedPTQjGim5C2ay1tfkeyTKrlvo0Na0xS XbDBUGR8hESK4coUlUfrpH81YvYk42stO2KM9NbpMY1muOOvEwj/XgmfgXK0l1Mpfofu APAjbc6vGoR1RszfzFrEbJeZJfSC6yBXqUpCt43vO53MMD2wjSyQYCP9mtevPuQ3UAAU f4bIX79WJ3CgVm9bWWYJxku8hC/IQFnqhyOF0vHp7rN/9vfgRQlj1tWWZdzhHbIBPsVk 7ByVGdsZN1RnDSB/fFxh2JRSXW358aoEOrAm6tH8oIZBwaXS3m23WWDM9Vccv6RfJ0D0 C4SQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=j4Hs9Oq1; 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 w3-20020a655343000000b00517f0c53076si12198783pgr.463.2023.04.17.08.12.58; Mon, 17 Apr 2023 08:13:11 -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=j4Hs9Oq1; 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 S230102AbjDQPLE (ORCPT + 99 others); Mon, 17 Apr 2023 11:11:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230283AbjDQPK4 (ORCPT ); Mon, 17 Apr 2023 11:10:56 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEF577EEB; Mon, 17 Apr 2023 08:10:54 -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 33HCvTM3005790; Mon, 17 Apr 2023 15:10:47 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=j4Hs9Oq1Rq2ofdybO1u0WGauqBUPpJ8YnYxh7o0gDydyodlJGxagmfcHJDs6XAg2R8pW pnzBCA4k5hg5fJZXagO6uW+vNTnrMf+yYLhZuI9iYtQ1G3Gb940ibFPr99EaBZKmhHYv urOnnoKnpjNbI4QOwRNj+RtX3IAojk0XW7j5GPsDNQvtjfzddoMMKySmMXieLUVmL1gx m459CqjE0YoEHklTjbCSeTgp5+57xN8x5lSUoBdyd2g8H6TDerJVdJzjWjpdFh6TWIL/ xMYQvpIaKWWeMgIT62GEKmoz154xBU8eXVN3Uatf6Nbmf9VOvCcbYsq4u9izJhf0J8ml jg== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3q12strxg2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Apr 2023 15:10:47 +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 33HFAkxg002153 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Apr 2023 15:10:46 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 08:10:42 -0700 From: Souradeep Chowdhury To: Andy Gross , Konrad Dybcio , Krzysztof Kozlowski , Bjorn Andersson , Rob Herring CC: , , , , Sibi Sankar , Rajendra Nayak , Souradeep Chowdhury Subject: [PATCH V4 1/3] dt-bindings: sram: qcom,imem: Add Boot Stat region within IMEM Date: Mon, 17 Apr 2023 20:38:14 +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: tO0o0Zf1dx0fE6hfD_qLTtYwB7-SKw1o X-Proofpoint-ORIG-GUID: tO0o0Zf1dx0fE6hfD_qLTtYwB7-SKw1o 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-17_10,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-2304170136 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 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?1763436806213361933?= X-GMAIL-MSGID: =?utf-8?q?1763436806213361933?= 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 Mon Apr 17 15:08:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Souradeep Chowdhury X-Patchwork-Id: 84294 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2203434vqo; Mon, 17 Apr 2023 08:19:15 -0700 (PDT) X-Google-Smtp-Source: AKy350ZPMIHGtR/GavBeHj1Ok9O+yX98Jusrwv+bGmUiqDlSb1SowzT1Q2nUVV3bPjaatl/MQjdZ X-Received: by 2002:a05:6a20:3d8c:b0:ee:6dc9:e794 with SMTP id s12-20020a056a203d8c00b000ee6dc9e794mr13469329pzi.56.1681744754905; Mon, 17 Apr 2023 08:19:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681744754; cv=none; d=google.com; s=arc-20160816; b=JMB+owg0YGWPNQhvOKHODUah6l8gli9GQ0HkCjm4QcI/5W2p9kVKjVwxqiBO8l7SsS vKqbIzgRK0gkW9bRH9cx423b8xCQYBaiWXEb2SabwiFhPbVJKsdkPIim9g7yZ9Kiuaar oSxcmfwBXm0PO15sqdgArWiDfblEQe9sLVzyRYxYDta0psNPKPgvbJmUx8Ke3cprwwic ePvOWWaAdxUNOEOGgUsRCRnVLmhO29ccJdOF9PWIWSvI2MMPz+qihcWRob+rYxoTOuoG R7+NQmx7y1DCATl1AMdrCe1/AUXAZfUclOVsPHiaAa7zgMEE9tvY32//AnIAZ6Lj9bpK hEfQ== 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=StVwNnB1r9VK8TFrtyaECzWcMoP+yp1/25ZyNgWQlsI=; b=GP0HDn/Y+TFMBytAhWyCvnz9xYSY1NzF9vLKwQhsZ1RO6ilsl7EfMb4iArrzfqdxzT Ip6xUlLWoD+bKkt4K1G+f1CJKs4gtXvsbbRWvMZsQ7leXN34xy5cqAp/w2A21MjZwn4h KhbdSKdcrSS+LyQN4JpBNnnIQOKli4mMZ8c8cnPfRCK9aAXQXKJ4MJYJUrpnEKeP84x2 Zrw1TslrV62pv938mb156rVe5SomGsTLPYkZVFsHopFGEkzQNX91ILKl8kdRTHpkWpe9 S3Sa6IympcL21CEsBh8mQJJResvZwSHHEOY1geDyM2YQjW9WW5R4uhQRoy1lSLZaW5Yp 7RqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=OxEH1726; 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 65-20020a630844000000b0051322a6bf76si11491218pgi.77.2023.04.17.08.19.00; Mon, 17 Apr 2023 08:19:14 -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=OxEH1726; 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 S231251AbjDQPMO (ORCPT + 99 others); Mon, 17 Apr 2023 11:12:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231300AbjDQPLs (ORCPT ); Mon, 17 Apr 2023 11:11:48 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 472BF8A49; Mon, 17 Apr 2023 08:11:43 -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 33H8v07d023855; Mon, 17 Apr 2023 15:11:29 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=StVwNnB1r9VK8TFrtyaECzWcMoP+yp1/25ZyNgWQlsI=; b=OxEH1726OpZgXwkFZZge/p52Ffn8eb8iwe/NHS0dTvWyaM9b0o1hqSSNoWMun9qcSx/p vwB4ubwmTc0IIdp28uYmaLKRye7leDypCWc4Wv8/xShjT8MncUsJyJ4Qek2c006Gm1QV rkjywZbiCaNujKtTGH+PYamd/bgH9FsVl07EHyQ+q0LbThtvile4lQkqUPwLHTBnIauX XKFRCzy9X/t/boQvC1B+uqLS7uuH4YE0PAsC97col6FQNr+gO+FYrQcCW4FUoWVZCzOm NUZXo076coGrjuQCagXroIwIiEzBNItZak1qbM6A7iTNef+laoaFAYg+U/3wWRWGeD5s 5A== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3pymkj3wsg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Apr 2023 15:11:27 +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 33HFApZl029982 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Apr 2023 15:10:51 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 08:10:46 -0700 From: Souradeep Chowdhury To: Andy Gross , Konrad Dybcio , Krzysztof Kozlowski , Bjorn Andersson , Rob Herring CC: , , , , Sibi Sankar , Rajendra Nayak , Souradeep Chowdhury Subject: [PATCH V4 2/3] soc: qcom: boot_stat: Add Driver Support for Boot Stats Date: Mon, 17 Apr 2023 20:38:15 +0530 Message-ID: <2ef76ce292c059c144e559123a9a54201ae2d0cf.1681742910.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: vfzvOEARhW5lHl5YpPEl9t8g-e5zJ7Wo X-Proofpoint-ORIG-GUID: vfzvOEARhW5lHl5YpPEl9t8g-e5zJ7Wo 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-17_10,2023-04-17_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 impostorscore=0 clxscore=1015 phishscore=0 malwarescore=0 mlxscore=0 mlxlogscore=999 spamscore=0 adultscore=0 lowpriorityscore=0 priorityscore=1501 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304170136 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 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?1763437188136394690?= X-GMAIL-MSGID: =?utf-8?q?1763437188136394690?= 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..7fa8efb --- /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; +} + +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 Mon Apr 17 15:08: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: 84291 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2199382vqo; Mon, 17 Apr 2023 08:13:39 -0700 (PDT) X-Google-Smtp-Source: AKy350YCpWDOTp6JrhwtcS81jlQ+wSTnoNeKI7hZKLXIgXWD9Yz57evn0FYammmON0+zbNIMcsWc X-Received: by 2002:a05:6808:2225:b0:38c:603f:7d7d with SMTP id bd37-20020a056808222500b0038c603f7d7dmr3430589oib.29.1681744418994; Mon, 17 Apr 2023 08:13:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681744418; cv=none; d=google.com; s=arc-20160816; b=uZiu12aN+b5005m0rj09k9f8hK9X/qFrOwrGGRknWEgODNdYIEMclrWYzmRd7pxr9S S1RK+2GakR7fw2EL4US5tmo+SH8qj/z16nZGYCR/cdhXhHlQBynKFP+Rq9Y/MQ8Ey9KX 4YiT3o+yfoqE0pGNOyzLdHiA/T4fjgDzQ0/lJcJyt8dyR9zxR2ynoWhmpct++ywDSrDb 8aXAuutQncdQYr6Lpj2SbpOcyN1tHavYpUt1wbzCVk+tL09VET4o39aNKKgt7iUkTWGM 2JbMAtw4htQ/0Vy9/FAQWwFy7m+AkwHS7DEHphLxvY6i5XwyXLCBA9c4tXmcntIVdt/h 0W4g== 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=of1rTTRlLP2yoc2pF8T/jWhAu8l745kfVxybfpaPVlzC5NZl+IH7Fvgbr+qEpVICr2 DV4tvL/sSUCJVNJOFHW2Jw25BBLCq0l+iDIzc0v8Lx3G8fDXRdrCgFGrX6CRFANAzPfc 1OUTp2p0xQ5lztG75rHchtrKJ440Ip/+IcpOiyLtltQyhNzhwvCvqgm7jxqkltjwbv+P B1zPCNA2yfiC4ZtNDRiapGvBq33a7yRrhBdbuCEBuYH+Ngc1Jpv7mHsM6eC7OugL/Oct rO0pAggPKPSskZ8lik/DfLXL084z7Sh/apkANatYBAL7arI52f49ADNNb9CBX9jm3CKo eYfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=dfyYxyFN; 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 s4-20020a0568080b0400b003897c1db849si9881024oij.48.2023.04.17.08.13.23; Mon, 17 Apr 2023 08:13:38 -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=dfyYxyFN; 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 S230338AbjDQPLf (ORCPT + 99 others); Mon, 17 Apr 2023 11:11:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230254AbjDQPLE (ORCPT ); Mon, 17 Apr 2023 11:11:04 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5DC9B444; Mon, 17 Apr 2023 08:11:03 -0700 (PDT) Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33HDsVIW012081; Mon, 17 Apr 2023 15:10:56 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=dfyYxyFNlhu+oEFAUEdeNKPYWrFSI6/TbFy3xl+j4ZfcbPRlXRXwUYCJetNxGYMWWHDt MbNYbqwqwyWfLKucdpJnzDTw1t+ZGJOjSHN94h0+fL4iMV0wxUHfj0WCDQoVDTpx7kVD pLli6YPuAOI6lhQggwPHeAsnXBWz8MJeohPtgpSM+2JI7e2EtK+RCbuXx5dffwNtntxG b+mvU2q8VEi6En9xQjF8xpYqexaTr199KFwtoarmy8y9ra7EU7WL09lIh/6O1ImS+peB ojrKzdFY6t7nMzJ6UNaBp30q9gqpNMtTKaIwlT/H0s8TzZcRZYLE3Y7/1uDpsTPr8LK5 Zg== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3q12ut8y0h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Apr 2023 15:10:56 +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 33HFAtG0009201 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Apr 2023 15:10:55 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 08:10:51 -0700 From: Souradeep Chowdhury To: Andy Gross , Konrad Dybcio , Krzysztof Kozlowski , Bjorn Andersson , Rob Herring CC: , , , , Sibi Sankar , Rajendra Nayak , Souradeep Chowdhury Subject: [PATCH V4 3/3] MAINTAINERS: Add the entry for boot_stats driver support Date: Mon, 17 Apr 2023 20:38:16 +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: u5wnTeyo-QGnzKsO8CfVRxSlFebWSrM8 X-Proofpoint-ORIG-GUID: u5wnTeyo-QGnzKsO8CfVRxSlFebWSrM8 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-17_10,2023-04-17_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 priorityscore=1501 mlxlogscore=906 lowpriorityscore=0 adultscore=0 phishscore=0 mlxscore=0 clxscore=1015 suspectscore=0 impostorscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304170136 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 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?1763436835882607244?= X-GMAIL-MSGID: =?utf-8?q?1763436835882607244?= 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"