From patchwork Fri Nov 19 21:39:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 12629583 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 839E7C4321E for ; Fri, 19 Nov 2021 21:40:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230436AbhKSVn6 (ORCPT ); Fri, 19 Nov 2021 16:43:58 -0500 Received: from mo4-p01-ob.smtp.rzone.de ([85.215.255.53]:34899 "EHLO mo4-p01-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229633AbhKSVn6 (ORCPT ); Fri, 19 Nov 2021 16:43:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1637358046; 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=oiRitK5VJP7/t+9OumbYNHeEIbRBna47wZNgODpkra8=; b=obBot1J1Z6Sm4kR/HPLP0Yt1zs5WMQ9Ec+MvKyiVIXxx9OBIUFmgSCU3aODmoUE50r QiT0M5GE32AkYJll7GUk9DMN5zw/6oSFcWhnG3p38a0U0G/wi3kfoOx0cynqRs8adJ0l 1i7x8SIq8GtNaNe5XrTVJIqYMnV0qKCA/3ionxoqHlm1o/gR5Pfys1IVRXQXQCKxPUQj 3nyek3WTA54s6F2yXIysfO8YfOMw8saFjahbe3KTDaytmJZjd05hqqSPa5QIjCVonOV3 JHYo2UOreH1BmLP/dOV4klWxS1DyTrCzkFu1JG2LyAylSLhCUoXDhkdklXirSTsyrEXu KDmQ== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVORvLd4SsytBXQ7UOGqRde+a0fiL0Iik=" X-RZG-CLASS-ID: mo00 Received: from droid.. by smtp.strato.de (RZmta 47.34.5 AUTH) with ESMTPSA id j05669xAJLek0CR (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Fri, 19 Nov 2021 22:40:46 +0100 (CET) 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 v2 1/3] dt-bindings: soc: qcom: stats: Document compatibles with fixed offset Date: Fri, 19 Nov 2021 22:39:51 +0100 Message-Id: <20211119213953.31970-2-stephan@gerhold.net> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20211119213953.31970-1-stephan@gerhold.net> References: <20211119213953.31970-1-stephan@gerhold.net> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Document additional compatibles 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. The exact offset might vary depending on the SoC so use SoC-specific compatible names to avoid confusion. Cc: Maulik Shah Signed-off-by: Stephan Gerhold Reviewed-by: Bjorn Andersson Acked-by: Rob Herring --- Changes in v2: - Use SoC-specific compatibles instead of qcom,rpm-legacy-stats --- Documentation/devicetree/bindings/soc/qcom/qcom-stats.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/devicetree/bindings/soc/qcom/qcom-stats.yaml b/Documentation/devicetree/bindings/soc/qcom/qcom-stats.yaml index 99dff7d73b7e..473adca4e973 100644 --- a/Documentation/devicetree/bindings/soc/qcom/qcom-stats.yaml +++ b/Documentation/devicetree/bindings/soc/qcom/qcom-stats.yaml @@ -21,6 +21,11 @@ properties: enum: - qcom,rpmh-stats - qcom,rpm-stats + # For older RPM firmware versions with fixed offset for the sleep stats + - qcom,apq8084-rpm-stats + - qcom,msm8226-rpm-stats + - qcom,msm8916-rpm-stats + - qcom,msm8974-rpm-stats reg: maxItems: 1 From patchwork Fri Nov 19 21:39:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 12629581 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 0061CC433EF for ; Fri, 19 Nov 2021 21:40:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230098AbhKSVn5 (ORCPT ); Fri, 19 Nov 2021 16:43:57 -0500 Received: from mo4-p02-ob.smtp.rzone.de ([85.215.255.81]:19738 "EHLO mo4-p02-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229633AbhKSVn4 (ORCPT ); Fri, 19 Nov 2021 16:43:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1637358047; 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=lxU9ltijgRM9c3gqZrDShRHSK5pywwb4iBM4yfM5rSM=; b=MMTXpc5kMQV2ylB1Kg6UCfSAcScRGkpHpxqrvq4YbeCwFShMVWBObG4W34SZn4zmAL xrL0Nmc0qwukZX5yTyxl27K3rcEz34Cf+bLTiJNDVWOVKZePGiZMJ1QRoPEHVtIa6h3A SY6rkELsFRRJhO7/71zOhI0YhGMTDFqkx9mM419UPCYU9U327qW0ESAkpHmEyCBwTjLN yxK68JPjl+pJPdhv0gBBWWxWjRDcLxn6qq9BwUmssk7RO3eGfdZI0MiVcqvraLajmrW6 iUHCykElL+Bvm0Fm4fLtBqlEtTJZpdSxnu5dQocm6VpTzsArCBEnipskK77Cm2C9kolk XGAA== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVORvLd4SsytBXQ7UOGqRde+a0fiL0Iik=" X-RZG-CLASS-ID: mo00 Received: from droid.. by smtp.strato.de (RZmta 47.34.5 AUTH) with ESMTPSA id j05669xAJLek0CS (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Fri, 19 Nov 2021 22:40:46 +0100 (CET) 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 v2 2/3] soc: qcom: stats: Add fixed sleep stats offset for older RPM firmwares Date: Fri, 19 Nov 2021 22:39:52 +0100 Message-Id: <20211119213953.31970-3-stephan@gerhold.net> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20211119213953.31970-1-stephan@gerhold.net> References: <20211119213953.31970-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. Most older versions use a fixed offset of 0xdba0. Add support for this using new SoC-specific compatibles for APQ8084, MSM8226, MSM8916 and MSM8974. Even older SoCs seem to use a different offset and stats format. If needed those could be supported in the future by adding separate compatibles for those with a different stats_config. Cc: Maulik Shah Signed-off-by: Stephan Gerhold Reviewed-by: Bjorn Andersson --- Changes in v2: - Use SoC-specific compatibles instead of qcom,rpm-legacy-stats --- drivers/soc/qcom/qcom_stats.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/soc/qcom/qcom_stats.c b/drivers/soc/qcom/qcom_stats.c index 131d24caabf8..d6bfd1bbdc2a 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_data_dba0 = { + .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, @@ -246,6 +255,10 @@ static const struct stats_config rpmh_data = { }; static const struct of_device_id qcom_stats_table[] = { + { .compatible = "qcom,apq8084-rpm-stats", .data = &rpm_data_dba0 }, + { .compatible = "qcom,msm8226-rpm-stats", .data = &rpm_data_dba0 }, + { .compatible = "qcom,msm8916-rpm-stats", .data = &rpm_data_dba0 }, + { .compatible = "qcom,msm8974-rpm-stats", .data = &rpm_data_dba0 }, { .compatible = "qcom,rpm-stats", .data = &rpm_data }, { .compatible = "qcom,rpmh-stats", .data = &rpmh_data }, { } From patchwork Fri Nov 19 21:39:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 12629579 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 B27B7C433F5 for ; Fri, 19 Nov 2021 21:40:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229843AbhKSVn4 (ORCPT ); Fri, 19 Nov 2021 16:43:56 -0500 Received: from mo4-p02-ob.smtp.rzone.de ([85.215.255.83]:27666 "EHLO mo4-p02-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229604AbhKSVn4 (ORCPT ); Fri, 19 Nov 2021 16:43:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1637358047; 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=PFFG3zsTAGfI5MIKIY2r8uirf+fqz5UpQlO0sBjSEE4=; b=cXo4Oy9aDJeTVX4BXXWnqd9sGTktTABBDFWrrrCKG/LFY3cysI2g4t+55o/8Lg7d7U Mz83wQ5MpW+SnNTDf/nVftHeZwZsqBCbWoIgqmKJkZYaCvTMChbDMmvH7foAkSXSBA9A 61E6g/s/CmPWnpdjMNeZGWxChHm8y5NXdIzjyYMf/b3dZhlgpNqgzscwMNfIa1XbvJ1C sS0KVXPI3cQNlmAOoUBDW1Fo+zZTFwx0bCsCtbxetNbQIpCKpKRDZQi87EJlngOMYLHC xBGmK/B8I5UQnkPXNg7HRg+9cNoTVWhlxAjDRhQxr63biZWwqazuKpguKhnsphJHMUNV oQcw== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVORvLd4SsytBXQ7UOGqRde+a0fiL0Iik=" X-RZG-CLASS-ID: mo00 Received: from droid.. by smtp.strato.de (RZmta 47.34.5 AUTH) with ESMTPSA id j05669xAJLel0CT (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Fri, 19 Nov 2021 22:40:47 +0100 (CET) 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 v2 3/3] arm64: dts: qcom: msm8916: Add RPM sleep stats Date: Fri, 19 Nov 2021 22:39:53 +0100 Message-Id: <20211119213953.31970-4-stephan@gerhold.net> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20211119213953.31970-1-stephan@gerhold.net> References: <20211119213953.31970-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,msm8916-rpm-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 --- Changes in v2: - Use SoC-specific compatible qcom,msm8916-rpm-stats --- 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 c1c42f26b61e..9044eb41a81d 100644 --- a/arch/arm64/boot/dts/qcom/msm8916.dtsi +++ b/arch/arm64/boot/dts/qcom/msm8916.dtsi @@ -453,6 +453,11 @@ rpm_msg_ram: sram@60000 { reg = <0x00060000 0x8000>; }; + sram@290000 { + compatible = "qcom,msm8916-rpm-stats"; + reg = <0x00290000 0x10000>; + }; + bimc: interconnect@400000 { compatible = "qcom,msm8916-bimc"; reg = <0x00400000 0x62000>;