All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] Add RPM sleep stats for MSM8916
@ 2021-11-19 21:39 Stephan Gerhold
  2021-11-19 21:39 ` [PATCH v2 1/3] dt-bindings: soc: qcom: stats: Document compatibles with fixed offset Stephan Gerhold
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Stephan Gerhold @ 2021-11-19 21:39 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Andy Gross, linux-arm-msm, Rob Herring, devicetree,
	~postmarketos/upstreaming, Maulik Shah, Stephan Gerhold

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 RPM firmware versions.

To be absolutely sure, this series adds new SoC-specific compatibles
for the older SoC that read the sleep stats from a fixed offset of 0xdba0.

This approach was originally suggested by Maulik Shah in:
https://lore.kernel.org/linux-arm-msm/c22d57cc-025b-5a8c-91d5-5385292da49f@codeaurora.org/
Bjorn suggested using SoC-specific compatibles instead of a generic
qcom,rpm-legacy-stats since there seem to be more legacy variants
on even older SoCs.

Changes in v2:
  - Use SoC-specific compatibles instead of qcom,rpm-legacy-stats

Stephan Gerhold (3):
  dt-bindings: soc: qcom: stats: Document compatibles with fixed offset
  soc: qcom: stats: Add fixed sleep stats offset for older RPM firmwares
  arm64: dts: qcom: msm8916: Add RPM sleep stats

 .../devicetree/bindings/soc/qcom/qcom-stats.yaml    |  5 +++++
 arch/arm64/boot/dts/qcom/msm8916.dtsi               |  5 +++++
 drivers/soc/qcom/qcom_stats.c                       | 13 +++++++++++++
 3 files changed, 23 insertions(+)

-- 
2.34.0


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 1/3] dt-bindings: soc: qcom: stats: Document compatibles with fixed offset
  2021-11-19 21:39 [PATCH v2 0/3] Add RPM sleep stats for MSM8916 Stephan Gerhold
@ 2021-11-19 21:39 ` Stephan Gerhold
  2021-11-21  0:39   ` Bjorn Andersson
  2021-11-30  1:47   ` Rob Herring
  2021-11-19 21:39 ` [PATCH v2 2/3] soc: qcom: stats: Add fixed sleep stats offset for older RPM firmwares Stephan Gerhold
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 9+ messages in thread
From: Stephan Gerhold @ 2021-11-19 21:39 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Andy Gross, linux-arm-msm, Rob Herring, devicetree,
	~postmarketos/upstreaming, Maulik Shah, Stephan Gerhold

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 <mkshah@codeaurora.org>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
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
-- 
2.34.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 2/3] soc: qcom: stats: Add fixed sleep stats offset for older RPM firmwares
  2021-11-19 21:39 [PATCH v2 0/3] Add RPM sleep stats for MSM8916 Stephan Gerhold
  2021-11-19 21:39 ` [PATCH v2 1/3] dt-bindings: soc: qcom: stats: Document compatibles with fixed offset Stephan Gerhold
@ 2021-11-19 21:39 ` Stephan Gerhold
  2021-11-21  0:39   ` Bjorn Andersson
  2021-11-19 21:39 ` [PATCH v2 3/3] arm64: dts: qcom: msm8916: Add RPM sleep stats Stephan Gerhold
  2021-12-01 15:13 ` (subset) [PATCH v2 0/3] Add RPM sleep stats for MSM8916 Bjorn Andersson
  3 siblings, 1 reply; 9+ messages in thread
From: Stephan Gerhold @ 2021-11-19 21:39 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Andy Gross, linux-arm-msm, Rob Herring, devicetree,
	~postmarketos/upstreaming, Maulik Shah, Stephan Gerhold

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 <mkshah@codeaurora.org>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
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 },
 	{ }
-- 
2.34.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 3/3] arm64: dts: qcom: msm8916: Add RPM sleep stats
  2021-11-19 21:39 [PATCH v2 0/3] Add RPM sleep stats for MSM8916 Stephan Gerhold
  2021-11-19 21:39 ` [PATCH v2 1/3] dt-bindings: soc: qcom: stats: Document compatibles with fixed offset Stephan Gerhold
  2021-11-19 21:39 ` [PATCH v2 2/3] soc: qcom: stats: Add fixed sleep stats offset for older RPM firmwares Stephan Gerhold
@ 2021-11-19 21:39 ` Stephan Gerhold
  2021-12-01 15:13   ` (subset) " Bjorn Andersson
  2021-12-01 15:13 ` (subset) [PATCH v2 0/3] Add RPM sleep stats for MSM8916 Bjorn Andersson
  3 siblings, 1 reply; 9+ messages in thread
From: Stephan Gerhold @ 2021-11-19 21:39 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Andy Gross, linux-arm-msm, Rob Herring, devicetree,
	~postmarketos/upstreaming, Maulik Shah, Stephan Gerhold

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 <mkshah@codeaurora.org>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
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>;
-- 
2.34.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 1/3] dt-bindings: soc: qcom: stats: Document compatibles with fixed offset
  2021-11-19 21:39 ` [PATCH v2 1/3] dt-bindings: soc: qcom: stats: Document compatibles with fixed offset Stephan Gerhold
@ 2021-11-21  0:39   ` Bjorn Andersson
  2021-11-30  1:47   ` Rob Herring
  1 sibling, 0 replies; 9+ messages in thread
From: Bjorn Andersson @ 2021-11-21  0:39 UTC (permalink / raw)
  To: Stephan Gerhold
  Cc: Andy Gross, linux-arm-msm, Rob Herring, devicetree,
	~postmarketos/upstreaming, Maulik Shah

On Fri 19 Nov 13:39 PST 2021, Stephan Gerhold wrote:

> 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.
> 

Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>

Regards,
Bjorn

> Cc: Maulik Shah <mkshah@codeaurora.org>
> Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
> ---
> 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
> -- 
> 2.34.0
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 2/3] soc: qcom: stats: Add fixed sleep stats offset for older RPM firmwares
  2021-11-19 21:39 ` [PATCH v2 2/3] soc: qcom: stats: Add fixed sleep stats offset for older RPM firmwares Stephan Gerhold
@ 2021-11-21  0:39   ` Bjorn Andersson
  0 siblings, 0 replies; 9+ messages in thread
From: Bjorn Andersson @ 2021-11-21  0:39 UTC (permalink / raw)
  To: Stephan Gerhold
  Cc: Andy Gross, linux-arm-msm, Rob Herring, devicetree,
	~postmarketos/upstreaming, Maulik Shah

On Fri 19 Nov 13:39 PST 2021, Stephan Gerhold wrote:

> 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 <mkshah@codeaurora.org>
> Signed-off-by: Stephan Gerhold <stephan@gerhold.net>

Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>

Regards,
Bjorn

> ---
> 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 },
>  	{ }
> -- 
> 2.34.0
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 1/3] dt-bindings: soc: qcom: stats: Document compatibles with fixed offset
  2021-11-19 21:39 ` [PATCH v2 1/3] dt-bindings: soc: qcom: stats: Document compatibles with fixed offset Stephan Gerhold
  2021-11-21  0:39   ` Bjorn Andersson
@ 2021-11-30  1:47   ` Rob Herring
  1 sibling, 0 replies; 9+ messages in thread
From: Rob Herring @ 2021-11-30  1:47 UTC (permalink / raw)
  To: Stephan Gerhold
  Cc: Rob Herring, ~postmarketos/upstreaming, linux-arm-msm,
	Bjorn Andersson, devicetree, Andy Gross, Maulik Shah

On Fri, 19 Nov 2021 22:39:51 +0100, Stephan Gerhold wrote:
> 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 <mkshah@codeaurora.org>
> Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
> ---
> 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(+)
> 

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: (subset) [PATCH v2 0/3] Add RPM sleep stats for MSM8916
  2021-11-19 21:39 [PATCH v2 0/3] Add RPM sleep stats for MSM8916 Stephan Gerhold
                   ` (2 preceding siblings ...)
  2021-11-19 21:39 ` [PATCH v2 3/3] arm64: dts: qcom: msm8916: Add RPM sleep stats Stephan Gerhold
@ 2021-12-01 15:13 ` Bjorn Andersson
  3 siblings, 0 replies; 9+ messages in thread
From: Bjorn Andersson @ 2021-12-01 15:13 UTC (permalink / raw)
  To: Stephan Gerhold
  Cc: linux-arm-msm, Rob Herring, ~postmarketos/upstreaming,
	devicetree, Andy Gross, Maulik Shah

On Fri, 19 Nov 2021 22:39:50 +0100, Stephan Gerhold wrote:
> 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 RPM firmware versions.
> 
> To be absolutely sure, this series adds new SoC-specific compatibles
> for the older SoC that read the sleep stats from a fixed offset of 0xdba0.
> 
> [...]

Applied, thanks!

[1/3] dt-bindings: soc: qcom: stats: Document compatibles with fixed offset
      commit: 0a023bc0dd3ce6db6d87026c6fce3e2381c30192
[2/3] soc: qcom: stats: Add fixed sleep stats offset for older RPM firmwares
      commit: 569fc4015a93267f50d37f4e85ca6f70428123b2

Best regards,
-- 
Bjorn Andersson <bjorn.andersson@linaro.org>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: (subset) [PATCH v2 3/3] arm64: dts: qcom: msm8916: Add RPM sleep stats
  2021-11-19 21:39 ` [PATCH v2 3/3] arm64: dts: qcom: msm8916: Add RPM sleep stats Stephan Gerhold
@ 2021-12-01 15:13   ` Bjorn Andersson
  0 siblings, 0 replies; 9+ messages in thread
From: Bjorn Andersson @ 2021-12-01 15:13 UTC (permalink / raw)
  To: Stephan Gerhold
  Cc: linux-arm-msm, Rob Herring, ~postmarketos/upstreaming,
	devicetree, Andy Gross, Maulik Shah

On Fri, 19 Nov 2021 22:39:53 +0100, Stephan Gerhold wrote:
> 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.
> 
> [...]

Applied, thanks!

[3/3] arm64: dts: qcom: msm8916: Add RPM sleep stats
      commit: 1c0ac047bbfb3efd6549d18c3ca47aa0afedcfbe

Best regards,
-- 
Bjorn Andersson <bjorn.andersson@linaro.org>

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-12-01 15:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-19 21:39 [PATCH v2 0/3] Add RPM sleep stats for MSM8916 Stephan Gerhold
2021-11-19 21:39 ` [PATCH v2 1/3] dt-bindings: soc: qcom: stats: Document compatibles with fixed offset Stephan Gerhold
2021-11-21  0:39   ` Bjorn Andersson
2021-11-30  1:47   ` Rob Herring
2021-11-19 21:39 ` [PATCH v2 2/3] soc: qcom: stats: Add fixed sleep stats offset for older RPM firmwares Stephan Gerhold
2021-11-21  0:39   ` Bjorn Andersson
2021-11-19 21:39 ` [PATCH v2 3/3] arm64: dts: qcom: msm8916: Add RPM sleep stats Stephan Gerhold
2021-12-01 15:13   ` (subset) " Bjorn Andersson
2021-12-01 15:13 ` (subset) [PATCH v2 0/3] Add RPM sleep stats for MSM8916 Bjorn Andersson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.