From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11A26C74A5B for ; Wed, 22 Mar 2023 13:54:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230098AbjCVNyf (ORCPT ); Wed, 22 Mar 2023 09:54:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229534AbjCVNyf (ORCPT ); Wed, 22 Mar 2023 09:54:35 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 307CDF750; Wed, 22 Mar 2023 06:54:34 -0700 (PDT) Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32M43GeX026267; Wed, 22 Mar 2023 13:54:24 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=qcppdkim1; bh=C73UFqKD3C9y3/ngb6vv60XWQujvXtOIq9+3QOqJgT8=; b=XN/e57skMiI68vmiHYFDegNg3/D5Rbt0DcVn67XFZ4p3IcWbUiy9xEHREv1+Vy97KYiw BUZpOHqi1EbDUcwTBbKVqTqFFtyROjGJiJpxI5nNthmPH5TiEx9jey2G/wp0jA/gWoQK EXJ5MKH5tATL+HHgfUb6gt/8PDzC2J2DejOijTPyUBGC/JnJmj5gj/uYypJyowoZ1Frp t8TYYlTmMytehuj6aLu5vKpgwGadrpLOcvuYGAO4KOVvZhx9iSYV3mD3StnqaTlNRi4F Clfmq/RFLryli3Bti92ALLlR7xwF5XWFxEnQpzfUBc01du1P+KyXaWeL7jj7dnBDKULr ag== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3pfhnx29pf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 22 Mar 2023 13:54:24 +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 32MDsM5R014858 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 22 Mar 2023 13:54:22 GMT Received: from [10.50.8.113] (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.41; Wed, 22 Mar 2023 06:54:19 -0700 Message-ID: <321005fc-1bfd-c04d-b2b5-d85d213ac00a@quicinc.com> Date: Wed, 22 Mar 2023 19:24:16 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [PATCH V1 3/4] soc: qcom: boot_stat: Add Driver Support for Boot Stats Content-Language: en-US To: Krzysztof Kozlowski , Andy Gross , Konrad Dybcio , "Krzysztof Kozlowski" , Bjorn Andersson , Rob Herring CC: , , , , Sibi Sankar , Rajendra Nayak References: <3f385562845ae26d519940ca8098fde89282991b.1679403696.git.quic_schowdhu@quicinc.com> <611ea918-64a6-f306-b5ec-db55e41abda2@linaro.org> From: Souradeep Chowdhury In-Reply-To: <611ea918-64a6-f306-b5ec-db55e41abda2@linaro.org> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) 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: OJGSI2LAiJIyEgtTNOvMPmfBB7q6S3Tt X-Proofpoint-ORIG-GUID: OJGSI2LAiJIyEgtTNOvMPmfBB7q6S3Tt 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-03-22_11,2023-03-22_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 bulkscore=0 priorityscore=1501 adultscore=0 mlxlogscore=999 lowpriorityscore=0 impostorscore=0 clxscore=1015 phishscore=0 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303150002 definitions=main-2303220101 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org On 3/21/2023 11:07 PM, Krzysztof Kozlowski wrote: > On 21/03/2023 14:51, Souradeep Chowdhury wrote: >> All of Qualcomm's proprietary Android boot-loaders capture boot time >> stats, like the time when the bootloader started execution and at what >> point the bootloader handed over control to the kernel etc. in the IMEM >> region. This information is captured in a specific format by this driver >> by mapping a structure to the IMEM memory region and then accessing the >> members of the structure to print the information. This information is >> useful in verifying if the existing boot KPIs have regre > > >> +/** >> + * struct boot_stats - timestamp information related to boot stats >> + * @bootloader_start: Time for the starting point of the abl bootloader >> + * @bootloader_end: Time when the kernel starts loading from abl bootloader >> + */ >> +struct boot_stats { >> + u32 bootloader_start; >> + u32 bootloader_end; >> +} __packed; >> + >> +static struct boot_stats __iomem *boot_stats; >> +static void __iomem *mpm_counter_base; >> +static u32 mpm_counter_freq; > > No file-scope variables. Does not scale, not easy for review and > maintenance. Avoid such code. Ack > >> + >> +static int mpm_parse_dt(void) >> +{ >> + struct device_node *np_imem, *np_mpm2; >> + >> + np_imem = of_find_compatible_node(NULL, NULL, >> + "qcom,imem-boot_stats"); >> + if (!np_imem) { >> + pr_err("can't find qcom,imem node\n"); > > So you are printing errors everywhere, on every soc and with compile > test on every platform there is in the world... sorry, it does not work > like that. Ack > >> + return -ENODEV; >> + } >> + boot_stats = of_iomap(np_imem, 0); >> + if (!boot_stats) { >> + pr_err("boot_stats: Can't map imem\n"); >> + goto err1; >> + } > > >> + >> +static void __exit boot_stats_exit(void) >> +{ >> +} >> +module_exit(boot_stats_exit) > > > I don't think this is some special code which deserves init calls. Make > it module_platform_driver(). Since this just reads some values from the Imem region and prints it to the user and doesn't have a specific device associated with it, a generic module code is written for it and not a module_platform_driver(). > > > Best regards, > Krzysztof > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8AB77C6FD1C for ; Wed, 22 Mar 2023 13:55:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:CC:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=zzx1qMWoK/3NYfoFzBLC6X+Q4hHZtDJWBbB+fi1cHqk=; b=DEziExtEPRQQv7 0Zrqyn+EY+qlEnjQ9k57dCCiLVtHc1vceQPPzQtBJcnO/jd+ieUtl6KwqDEmzwWPud9TePbNfx4NH +acPqFVJpVa/C0jMcAgJcqIfx5LL8xYHY1xKjrSw1FuhoI7K4VrC3fdqN7vEsNy+LiisD4ruaMFCu YdexQgo+udW1gDPo8b8ySg539PQDvbp04q9bPhW/O8CsKcNa3ksbmcWqycSJcC/7ZYq9SLpkfEVbu ALvFVDdNkEL4iivivIkirh/4V//6QzZJZEVv+yhU1/rDnzt2rPN1SrzpbpjKGUsHu+izFrfpurn4Y tUr3z93W5lQYfI01SefA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1peyvA-00GCBw-02; Wed, 22 Mar 2023 13:54:32 +0000 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1peyv7-00GCBC-0b for linux-arm-kernel@lists.infradead.org; Wed, 22 Mar 2023 13:54:30 +0000 Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32M43GeX026267; Wed, 22 Mar 2023 13:54:24 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=qcppdkim1; bh=C73UFqKD3C9y3/ngb6vv60XWQujvXtOIq9+3QOqJgT8=; b=XN/e57skMiI68vmiHYFDegNg3/D5Rbt0DcVn67XFZ4p3IcWbUiy9xEHREv1+Vy97KYiw BUZpOHqi1EbDUcwTBbKVqTqFFtyROjGJiJpxI5nNthmPH5TiEx9jey2G/wp0jA/gWoQK EXJ5MKH5tATL+HHgfUb6gt/8PDzC2J2DejOijTPyUBGC/JnJmj5gj/uYypJyowoZ1Frp t8TYYlTmMytehuj6aLu5vKpgwGadrpLOcvuYGAO4KOVvZhx9iSYV3mD3StnqaTlNRi4F Clfmq/RFLryli3Bti92ALLlR7xwF5XWFxEnQpzfUBc01du1P+KyXaWeL7jj7dnBDKULr ag== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3pfhnx29pf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 22 Mar 2023 13:54:24 +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 32MDsM5R014858 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 22 Mar 2023 13:54:22 GMT Received: from [10.50.8.113] (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.41; Wed, 22 Mar 2023 06:54:19 -0700 Message-ID: <321005fc-1bfd-c04d-b2b5-d85d213ac00a@quicinc.com> Date: Wed, 22 Mar 2023 19:24:16 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [PATCH V1 3/4] soc: qcom: boot_stat: Add Driver Support for Boot Stats Content-Language: en-US To: Krzysztof Kozlowski , Andy Gross , Konrad Dybcio , "Krzysztof Kozlowski" , Bjorn Andersson , Rob Herring CC: , , , , Sibi Sankar , Rajendra Nayak References: <3f385562845ae26d519940ca8098fde89282991b.1679403696.git.quic_schowdhu@quicinc.com> <611ea918-64a6-f306-b5ec-db55e41abda2@linaro.org> From: Souradeep Chowdhury In-Reply-To: <611ea918-64a6-f306-b5ec-db55e41abda2@linaro.org> X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) 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: OJGSI2LAiJIyEgtTNOvMPmfBB7q6S3Tt X-Proofpoint-ORIG-GUID: OJGSI2LAiJIyEgtTNOvMPmfBB7q6S3Tt 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-03-22_11,2023-03-22_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 bulkscore=0 priorityscore=1501 adultscore=0 mlxlogscore=999 lowpriorityscore=0 impostorscore=0 clxscore=1015 phishscore=0 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303150002 definitions=main-2303220101 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230322_065429_358577_6654E1E4 X-CRM114-Status: GOOD ( 26.25 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 3/21/2023 11:07 PM, Krzysztof Kozlowski wrote: > On 21/03/2023 14:51, Souradeep Chowdhury wrote: >> All of Qualcomm's proprietary Android boot-loaders capture boot time >> stats, like the time when the bootloader started execution and at what >> point the bootloader handed over control to the kernel etc. in the IMEM >> region. This information is captured in a specific format by this driver >> by mapping a structure to the IMEM memory region and then accessing the >> members of the structure to print the information. This information is >> useful in verifying if the existing boot KPIs have regre > > >> +/** >> + * struct boot_stats - timestamp information related to boot stats >> + * @bootloader_start: Time for the starting point of the abl bootloader >> + * @bootloader_end: Time when the kernel starts loading from abl bootloader >> + */ >> +struct boot_stats { >> + u32 bootloader_start; >> + u32 bootloader_end; >> +} __packed; >> + >> +static struct boot_stats __iomem *boot_stats; >> +static void __iomem *mpm_counter_base; >> +static u32 mpm_counter_freq; > > No file-scope variables. Does not scale, not easy for review and > maintenance. Avoid such code. Ack > >> + >> +static int mpm_parse_dt(void) >> +{ >> + struct device_node *np_imem, *np_mpm2; >> + >> + np_imem = of_find_compatible_node(NULL, NULL, >> + "qcom,imem-boot_stats"); >> + if (!np_imem) { >> + pr_err("can't find qcom,imem node\n"); > > So you are printing errors everywhere, on every soc and with compile > test on every platform there is in the world... sorry, it does not work > like that. Ack > >> + return -ENODEV; >> + } >> + boot_stats = of_iomap(np_imem, 0); >> + if (!boot_stats) { >> + pr_err("boot_stats: Can't map imem\n"); >> + goto err1; >> + } > > >> + >> +static void __exit boot_stats_exit(void) >> +{ >> +} >> +module_exit(boot_stats_exit) > > > I don't think this is some special code which deserves init calls. Make > it module_platform_driver(). Since this just reads some values from the Imem region and prints it to the user and doesn't have a specific device associated with it, a generic module code is written for it and not a module_platform_driver(). > > > Best regards, > Krzysztof > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel