From patchwork Mon Oct 18 11:08:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 12566011 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 793ACC4332F for ; Mon, 18 Oct 2021 11:10:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5C5A961360 for ; Mon, 18 Oct 2021 11:10:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229657AbhJRLMz (ORCPT ); Mon, 18 Oct 2021 07:12:55 -0400 Received: from mo4-p02-ob.smtp.rzone.de ([85.215.255.81]:31516 "EHLO mo4-p02-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229699AbhJRLMy (ORCPT ); Mon, 18 Oct 2021 07:12:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1634555437; s=strato-dkim-0002; d=gerhold.net; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=PnF9fnRz1o1owlgAEPgqtGCoSlSZKVU2JM4V6EtRi+E=; b=OjShHuG8ejK8xhzKjTiyUVa52JyRUmLKLIf9c+yegbkRg1nseqcEG00Q3QxBv0uYYD 4de4rV4omcQ/TTQ+uAIhC7oKDdu2TwNqP6aw3de1GkZuyAK3wRVWHwzT1o5vqAl8ctCi cimTcYmNCnF/LUUf+ORK7kKmJFjFFQwxTey5qscI4Tvc5QrKXjlj4JtpZtzR8ccvPRiC HRphgFZniQ0boUgdvbTDmwooaxRekEmb1MCWOcHhR4w++eyhijHZ8AddSH7psoF3cbsK H4mggr0OhuZN0acEVUq8qvdwNvF6JvX3/k5w3e5lnsDGpeBR/9qTfOiAH3wAuX9nhfOs 3trQ== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVORvLd4SsytBXQ7UOGqRde+a0fiL1OfxR" X-RZG-CLASS-ID: mo00 Received: from droid.. by smtp.strato.de (RZmta 47.33.8 AUTH) with ESMTPSA id 301038x9IBAbVhL (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Mon, 18 Oct 2021 13:10:37 +0200 (CEST) From: Stephan Gerhold To: Bjorn Andersson Cc: Andy Gross , linux-arm-msm@vger.kernel.org, Rob Herring , devicetree@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Maulik Shah , Stephan Gerhold Subject: [PATCH 1/3] dt-bindings: soc: qcom: stats: Document qcom,rpm-legacy-stats Date: Mon, 18 Oct 2021 13:08:01 +0200 Message-Id: <20211018110803.32777-2-stephan@gerhold.net> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211018110803.32777-1-stephan@gerhold.net> References: <20211018110803.32777-1-stephan@gerhold.net> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Document an additional qcom,rpm-legacy-stats compatible that can be used similarly to qcom,rpm-stats for older RPM firmware versions that have the sleep stats at a fixed offset rather than a dynamic one. Cc: Maulik Shah Signed-off-by: Stephan Gerhold Reviewed-by: Maulik Shah Acked-by: Rob Herring --- Documentation/devicetree/bindings/soc/qcom/qcom-stats.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/soc/qcom/qcom-stats.yaml b/Documentation/devicetree/bindings/soc/qcom/qcom-stats.yaml index 99dff7d73b7e..566678d02008 100644 --- a/Documentation/devicetree/bindings/soc/qcom/qcom-stats.yaml +++ b/Documentation/devicetree/bindings/soc/qcom/qcom-stats.yaml @@ -21,6 +21,8 @@ properties: enum: - qcom,rpmh-stats - qcom,rpm-stats + # For older RPM firmware versions with fixed offset for the sleep stats + - qcom,rpm-legacy-stats reg: maxItems: 1 From patchwork Mon Oct 18 11:08:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 12566013 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6B2BC43217 for ; Mon, 18 Oct 2021 11:10:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AF4E661351 for ; Mon, 18 Oct 2021 11:10:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230354AbhJRLMz (ORCPT ); Mon, 18 Oct 2021 07:12:55 -0400 Received: from mo4-p02-ob.smtp.rzone.de ([85.215.255.80]:16054 "EHLO mo4-p02-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229519AbhJRLMy (ORCPT ); Mon, 18 Oct 2021 07:12:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1634555438; s=strato-dkim-0002; d=gerhold.net; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=DueWk7PS68Aynz42TauXnxWh163QWN8HTBz8dvEB9gU=; b=s5joQlzVJZ+dmtkl0MPCBho1UN5IStEuYJ09XprxpxqpjbkBUbFPrcuaekA8nbf8u0 1BvnBxbuT2tMdtub42UEePwG6UP72vG/h4tguGKyLrFB8iSxVv++1YitDJD3yul1qCyJ lnlI88109qmdXU/vnOG0ge+E484O6YXSRZAa/PHqaQ6QaQyTCZ8YZllmZAi5XhNFd6cm kV7WutgQL3wXuYlPthvz/qE5RQd6fuD82+IpMjG4/C/2ZHz6oMQjHotLPza6uZgZjaD1 qTvWwwZkquIUS1HJIma1GzVSKFAt8Dvp8yQLLqc6zmywLdGdB/Pl82MkrgrrwacktwX6 vEXA== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVORvLd4SsytBXQ7UOGqRde+a0fiL1OfxR" X-RZG-CLASS-ID: mo00 Received: from droid.. by smtp.strato.de (RZmta 47.33.8 AUTH) with ESMTPSA id 301038x9IBAbVhM (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Mon, 18 Oct 2021 13:10:37 +0200 (CEST) From: Stephan Gerhold To: Bjorn Andersson Cc: Andy Gross , linux-arm-msm@vger.kernel.org, Rob Herring , devicetree@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Maulik Shah , Stephan Gerhold Subject: [PATCH 2/3] soc: qcom: stats: Add fixed sleep stats offset for older RPM firmwares Date: Mon, 18 Oct 2021 13:08:02 +0200 Message-Id: <20211018110803.32777-3-stephan@gerhold.net> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211018110803.32777-1-stephan@gerhold.net> References: <20211018110803.32777-1-stephan@gerhold.net> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Not all RPM firmware versions have the dynamic sleep stats offset available. Older versions use a fixed offset of 0xdba0. Add support for this using a new qcom,rpm-legacy-stats compatible that can be used for older SoCs like MSM8916. Suggested-by: Maulik Shah Signed-off-by: Stephan Gerhold Reviewed-by: Maulik Shah --- drivers/soc/qcom/qcom_stats.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/soc/qcom/qcom_stats.c b/drivers/soc/qcom/qcom_stats.c index 817505bd99b5..67728de718fd 100644 --- a/drivers/soc/qcom/qcom_stats.c +++ b/drivers/soc/qcom/qcom_stats.c @@ -237,6 +237,15 @@ static const struct stats_config rpm_data = { .subsystem_stats_in_smem = false, }; +/* Older RPM firmwares have the stats at a fixed offset instead */ +static const struct stats_config rpm_legacy_data = { + .stats_offset = 0xdba0, + .num_records = 2, + .appended_stats_avail = true, + .dynamic_offset = false, + .subsystem_stats_in_smem = false, +}; + static const struct stats_config rpmh_data = { .stats_offset = 0x48, .num_records = 3, @@ -247,6 +256,7 @@ static const struct stats_config rpmh_data = { static const struct of_device_id qcom_stats_table[] = { { .compatible = "qcom,rpm-stats", .data = &rpm_data }, + { .compatible = "qcom,rpm-legacy-stats", .data = &rpm_legacy_data }, { .compatible = "qcom,rpmh-stats", .data = &rpmh_data }, { } }; From patchwork Mon Oct 18 11:08:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 12566015 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BCB98C4321E for ; Mon, 18 Oct 2021 11:10:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A1DC56128A for ; Mon, 18 Oct 2021 11:10:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230383AbhJRLM5 (ORCPT ); Mon, 18 Oct 2021 07:12:57 -0400 Received: from mo4-p03-ob.smtp.rzone.de ([85.215.255.104]:27888 "EHLO mo4-p03-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230321AbhJRLM5 (ORCPT ); Mon, 18 Oct 2021 07:12:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1634555438; s=strato-dkim-0002; d=gerhold.net; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=j86B15A9rsPXASzroXA2bFaDcU9X63WEGm7bZxaZ5wU=; b=jmHxh+lS3N09C6E4uPAVE4wtkKF73Hhd+0X9PrWg9GwHJTvrztcCWSTzZvqf9wcJy3 18nFxs9yl4gua2Tk7b4uj2Xy9t8IMPRis8EG6qJMIH/GCiF8QSzXGR/X4cuSmXbTZiHI iHWIeQ0mAwgII6/nXMnlDIfXEwCUrd0wxKhUsCGfzBSibLDBjqe53YJV1AO8sP/EB/sw 0XZ9hDr9M8HwDoiWF6uh6IZ+RKdvtEwKBvq81zG3EQqNeqsOG+5aknzkAUYeF+UFA1No NyHNS3Qd0aHFLTu1qV3TO8nQ5m3o0MBy+eoMJ6DKKfHRxsrx1UiequwdtsWOlITPT0L6 Y89g== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVORvLd4SsytBXQ7UOGqRde+a0fiL1OfxR" X-RZG-CLASS-ID: mo00 Received: from droid.. by smtp.strato.de (RZmta 47.33.8 AUTH) with ESMTPSA id 301038x9IBAcVhN (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Mon, 18 Oct 2021 13:10:38 +0200 (CEST) From: Stephan Gerhold To: Bjorn Andersson Cc: Andy Gross , linux-arm-msm@vger.kernel.org, Rob Herring , devicetree@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Maulik Shah , Stephan Gerhold Subject: [PATCH 3/3] arm64: dts: qcom: msm8916: Add RPM sleep stats Date: Mon, 18 Oct 2021 13:08:03 +0200 Message-Id: <20211018110803.32777-4-stephan@gerhold.net> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211018110803.32777-1-stephan@gerhold.net> References: <20211018110803.32777-1-stephan@gerhold.net> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org MSM8916 is similar to the other SoCs that had the RPM stats node added in commit 290bc6846547 ("arm64: dts: qcom: Enable RPM Sleep stats"). However, the dynamic offset readable at 0x14 seems only available on some of the newer firmware versions. To be absolutely sure, make use of the new qcom,rpm-legacy-stats compatible that reads the sleep stats from a fixed offset of 0xdba0. Statistics are available for a "vmin" and "xosd" low power mode: $ cat /sys/kernel/debug/qcom_stats/vmin Count: 0 Last Entered At: 0 Last Exited At: 0 Accumulated Duration: 0 Client Votes: 0x0 $ cat /sys/kernel/debug/qcom_stats/xosd Count: 0 Last Entered At: 0 Last Exited At: 0 Accumulated Duration: 0 Client Votes: 0x0 Cc: Maulik Shah Signed-off-by: Stephan Gerhold Reviewed-by: Maulik Shah --- arch/arm64/boot/dts/qcom/msm8916.dtsi | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/msm8916.dtsi b/arch/arm64/boot/dts/qcom/msm8916.dtsi index 43464ac64f3e..99f7999aad2d 100644 --- a/arch/arm64/boot/dts/qcom/msm8916.dtsi +++ b/arch/arm64/boot/dts/qcom/msm8916.dtsi @@ -445,6 +445,11 @@ rpm_msg_ram: sram@60000 { reg = <0x00060000 0x8000>; }; + sram@290000 { + compatible = "qcom,rpm-legacy-stats"; + reg = <0x00290000 0x10000>; + }; + bimc: interconnect@400000 { compatible = "qcom,msm8916-bimc"; reg = <0x00400000 0x62000>;