Skip to contentSkip to conversation

Add subsystem LPM stats support for Shikra

PATCH Applied Sneh Mankad 4 participants 11 messages Sep 7 – Oct 1

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v4 cover Add subsystem LPM stats support for Shikra

SoC LPM stats are present in RPM MSGRAM and subsystem LPM stats are present in SMEM for Shikra.

For earlier targets using RPM processor like msm8974, rpm_master_stat.c was used for subsystem LPM stats since those stats were populated in RPM MSGRAM.

Here is a brief summary of previous targets and their stats configuration, along with the drivers used to display them.

+---------------|----------------------------|---------------------------+
| SoC           | subsystem LPM stats        | SoC LPM stats             |
|---------------|----------------------------|---------------------------|
| msm8974,      | RPM processor MSGRAM       | RPM processor MSGRAM      |
| msm8226       | (rpm_master_stat.c)        | (qcom_stats.c)            |
|---------------|----------------------------|---------------------------|
| sm6350,       | SMEM (DDR)                 | AOP processor MSGRAM      |
| sdm845, etc.  | (qcom_stats.c)             | (qcom_stats.c)            |
|---------------|----------------------------|---------------------------|
| Shikra        | SMEM (DDR)                 | RPM processor MSGRAM      |
|               | (qcom_stats.c)             | (qcom_stats.c)            |
+---------------|----------------------------|---------------------------+

qcom_stats.c supports both the configurations for shikra, reading subsystem LPM stats from SMEM and reading SoC LPM stats from RPM MSGRAM.

A generic "qcom,rpm-stats" compatible only reads SoC LPM stats like vmin and vlow. Add shikra rpm compatible and config to read subsystem LPM stats too along with SoC LPM stats.

Below is an example showing LPM stats for "apss" subsystem with this change:

cat /sys/kernel/debug/qcom_stats/apss
Count: 2192
Last Entered At: 5498618336
Last Exited At: 5498708046
Accumulated Duration: 2046572620.

Keep "qcom,rpm-stats" as a fallback compatible and add the bindings for the same.

---
Changes in v4:
- Add bindings support to keep "qcom,rpm-stats" as fallback compatible.
- Link to v3: https://lore.kernel.org/r/[email protected]

Changes in v3:
- added back "qcom,rpm-stats" as a fallback compatible.
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Edited commit texts to better explain the changes.
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Sneh Mankad (3):
dt-bindings: soc: qcom: stats: Add compatible for Shikra
soc: qcom: stats: Add stats compatible and config for Shikra
arm64: dts: qcom: shikra: Update rpm-stats compatible to SoC specific

 .../devicetree/bindings/soc/qcom/qcom-stats.yaml   | 25 ++++++++++++++--------
 arch/arm64/boot/dts/qcom/shikra.dtsi               |  2 +-
 drivers/soc/qcom/qcom_stats.c                      |  9 ++++++++
 3 files changed, 26 insertions(+), 10 deletions(-)

---
base-commit: 4c9d9db1697a873f78d236b4ce304272206238ac
change-id: 20260624-shikra_stats-3f01f136fb4c

Best regards,

Signature · 1 line
Sneh Mankad <[email protected]>
#1 lore raw

PATCH v4 1/3 dt-bindings: soc: qcom: stats: Add compatible for Shikra

SoC LPM stats are present in RPM MSGRAM and subsystem LPM stats are present in SMEM for Shikra.

A generic "qcom,rpm-stats" compatible only reads SoC LPM stats like vmin and vlow.

Document shikra rpm compatible to read subsystem LPM stats too along with SoC LPM stats.

Keep "qcom,rpm-stats" as a fallback for RPM targets, so that SoC level stats are still shown even without subsystem level stats support. A plain enum can't express that, since it caps compatible at one item. Add a oneOf branch with items for this pattern.

---
 .../devicetree/bindings/soc/qcom/qcom-stats.yaml   | 25 ++++++++++++++--------
 1 file changed, 16 insertions(+), 9 deletions(-)
Documentation/devicetree/bindings/soc/qcom/qcom-stats.yaml +16 -9
index 686a7ef2f48af11a0e63904ff979e40d7538de65..b384a5983d43358d9fceb6fa305f20d6a0c76504 100644
@@ -18,15 +18,22 @@ description:
 
 properties:
   compatible:
-    enum:
-      - qcom,rpmh-stats
-      - qcom,sdm845-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
+    oneOf:
+      - enum:
+          - qcom,rpmh-stats
+          - qcom,sdm845-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
+      # SoC-specific compatibles that also read subsystem-level stats,
+      # falling back to "qcom,rpm-stats" for SoC-level stats only
+      - items:
+          - enum:
+              - qcom,shikra-rpm-stats
+          - const: qcom,rpm-stats
 
   reg:
     maxItems: 1
Signature · 1 line
2.34.1
Reviewed-by on v4 1/3
#2 lore raw

Re: [PATCH v4 1/3] dt-bindings: soc: qcom: stats: Add compatible for Shikra

Quoted 9 lines · Sneh Mankad

SoC LPM stats are present in RPM MSGRAM and subsystem LPM stats are present in SMEM for Shikra.

A generic "qcom,rpm-stats" compatible only reads SoC LPM stats like vmin and vlow.

Document shikra rpm compatible to read subsystem LPM stats too along with SoC LPM stats.

Quoted 6 lines

Keep "qcom,rpm-stats" as a fallback for RPM targets, so that SoC level stats are still shown even without subsystem level stats support. A plain enum can't express that, since it caps compatible at one item. Add a oneOf branch with items for this pattern.

#3 lore raw

PATCH v4 2/3 soc: qcom: stats: Add stats compatible and config for Shikra

In reply to Sneh Mankad

SoC LPM stats are present in RPM MSGRAM and subsystem LPM stats are present in SMEM for Shikra.

For earlier targets using RPM processor like msm8974, rpm_master_stat.c was used for subsystem LPM stats since those stats were populated in RPM MSGRAM.

Here is a brief summary of previous targets and their stats configuration, along with the drivers used to display them.

+---------------|----------------------------|---------------------------+
| SoC           | subsystem LPM stats        | SoC LPM stats             |
|---------------|----------------------------|---------------------------|
| msm8974,      | RPM processor MSGRAM       | RPM processor MSGRAM      |
| msm8226       | (rpm_master_stat.c)        | (qcom_stats.c)            |
|---------------|----------------------------|---------------------------|
| sm6350,       | SMEM (DDR)                 | AOP processor MSGRAM      |
| sdm845, etc.  | (qcom_stats.c)             | (qcom_stats.c)            |
|---------------|----------------------------|---------------------------|
| Shikra        | SMEM (DDR)                 | RPM processor MSGRAM      |
|               | (qcom_stats.c)             | (qcom_stats.c)            |
+---------------|----------------------------|---------------------------+

qcom_stats.c supports both the configurations for shikra, reading subsystem LPM stats from SMEM and reading SoC LPM stats from RPM MSGRAM.

A generic "qcom,rpm-stats" compatible only reads SoC LPM stats like vmin and vlow. Add shikra rpm compatible and config to read subsystem LPM stats too along with SoC LPM stats.

Below is an example showing LPM stats for "apss" subsystem with this change:

cat /sys/kernel/debug/qcom_stats/apss
Count: 2192
Last Entered At: 5498618336
Last Exited At: 5498708046
Accumulated Duration: 2046572620.

---
 drivers/soc/qcom/qcom_stats.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/soc/qcom/qcom_stats.c +9 -0
index 2e380faf9080354fae120e74f0b9bd1f3786d3e5..2f1615e583bbc6ea596d8b73d9bb0a2a00953cfb 100644
@@ -376,6 +376,14 @@ static const struct stats_config rpm_data_dba0 = {
 	.subsystem_stats_in_smem = false,
 };
 
+static const struct stats_config rpm_data_shikra = {
+	.stats_offset = 0,
+	.num_records = 2,
+	.appended_stats_avail = true,
+	.dynamic_offset = true,
+	.subsystem_stats_in_smem = true,
+};
+
 static const struct stats_config rpmh_data_sdm845 = {
 	.stats_offset = 0x48,
 	.num_records = 2,
@@ -401,6 +409,7 @@ static const struct of_device_id qcom_stats_table[] = {
 	{ .compatible = "qcom,rpm-stats", .data = &rpm_data },
 	{ .compatible = "qcom,rpmh-stats", .data = &rpmh_data },
 	{ .compatible = "qcom,sdm845-rpmh-stats", .data = &rpmh_data_sdm845 },
+	{ .compatible = "qcom,shikra-rpm-stats", .data = &rpm_data_shikra },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, qcom_stats_table);
Signature · 1 line
2.34.1
Reviewed-by on v4 2/3
#4 lore raw

Re: [PATCH v4 2/3] soc: qcom: stats: Add stats compatible and config for Shikra

Quoted 39 lines · Sneh Mankad

SoC LPM stats are present in RPM MSGRAM and subsystem LPM stats are present in SMEM for Shikra.

For earlier targets using RPM processor like msm8974, rpm_master_stat.c was used for subsystem LPM stats since those stats were populated in RPM MSGRAM.

Here is a brief summary of previous targets and their stats configuration, along with the drivers used to display them.

+---------------|----------------------------|---------------------------+
| SoC           | subsystem LPM stats        | SoC LPM stats             |
|---------------|----------------------------|---------------------------|
| msm8974,      | RPM processor MSGRAM       | RPM processor MSGRAM      |
| msm8226       | (rpm_master_stat.c)        | (qcom_stats.c)            |
|---------------|----------------------------|---------------------------|
| sm6350,       | SMEM (DDR)                 | AOP processor MSGRAM      |
| sdm845, etc.  | (qcom_stats.c)             | (qcom_stats.c)            |
|---------------|----------------------------|---------------------------|
| Shikra        | SMEM (DDR)                 | RPM processor MSGRAM      |
|               | (qcom_stats.c)             | (qcom_stats.c)            |
+---------------|----------------------------|---------------------------+

qcom_stats.c supports both the configurations for shikra, reading subsystem LPM stats from SMEM and reading SoC LPM stats from RPM MSGRAM.

A generic "qcom,rpm-stats" compatible only reads SoC LPM stats like vmin and vlow. Add shikra rpm compatible and config to read subsystem LPM stats too along with SoC LPM stats.

Below is an example showing LPM stats for "apss" subsystem with this change:

cat /sys/kernel/debug/qcom_stats/apss
Count: 2192
Last Entered At: 5498618336
Last Exited At: 5498708046
Accumulated Duration: 2046572620.

Quoted 3 lines
Reviewed-by on v4 2/3
#5 lore raw

Re: [PATCH v4 2/3] soc: qcom: stats: Add stats compatible and config for Shikra

In reply to Sneh Mankad
Quoted 39 lines · Sneh Mankad

SoC LPM stats are present in RPM MSGRAM and subsystem LPM stats are present in SMEM for Shikra.

For earlier targets using RPM processor like msm8974, rpm_master_stat.c was used for subsystem LPM stats since those stats were populated in RPM MSGRAM.

Here is a brief summary of previous targets and their stats configuration, along with the drivers used to display them.

+---------------|----------------------------|---------------------------+
| SoC           | subsystem LPM stats        | SoC LPM stats             |
|---------------|----------------------------|---------------------------|
| msm8974,      | RPM processor MSGRAM       | RPM processor MSGRAM      |
| msm8226       | (rpm_master_stat.c)        | (qcom_stats.c)            |
|---------------|----------------------------|---------------------------|
| sm6350,       | SMEM (DDR)                 | AOP processor MSGRAM      |
| sdm845, etc.  | (qcom_stats.c)             | (qcom_stats.c)            |
|---------------|----------------------------|---------------------------|
| Shikra        | SMEM (DDR)                 | RPM processor MSGRAM      |
|               | (qcom_stats.c)             | (qcom_stats.c)            |
+---------------|----------------------------|---------------------------+

qcom_stats.c supports both the configurations for shikra, reading subsystem LPM stats from SMEM and reading SoC LPM stats from RPM MSGRAM.

A generic "qcom,rpm-stats" compatible only reads SoC LPM stats like vmin and vlow. Add shikra rpm compatible and config to read subsystem LPM stats too along with SoC LPM stats.

Below is an example showing LPM stats for "apss" subsystem with this change:

cat /sys/kernel/debug/qcom_stats/apss
Count: 2192
Last Entered At: 5498618336
Last Exited At: 5498708046
Accumulated Duration: 2046572620.

Quoted 3 lines
#6 lore raw

PATCH v4 3/3 arm64: dts: qcom: shikra: Update rpm-stats compatible to SoC specific

In reply to Sneh Mankad

A generic "qcom,rpm-stats" compatible only reads stats for SoC level LPM stats like vmin and vlow.

Shikra SoC specific compatible allows reading individual subsystem level LPM stats along with SoC level LPM stats. Change it.

Keep "qcom,rpm-stats" as fallback compatible.

---
 arch/arm64/boot/dts/qcom/shikra.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/shikra.dtsi +1 -1
index 4e5bc9e17c8ed8914733ac9fdc9b69128b40216e..b299f316e3c61858c4b380f6211d0f36ef9fecf9 100644
@@ -535,7 +535,7 @@ apss_mpm: sram@1b8 {
 		};
 
 		sram@4690000 {
-			compatible = "qcom,rpm-stats";
+			compatible = "qcom,shikra-rpm-stats", "qcom,rpm-stats";
 			reg = <0x0 0x04690000 0x0 0x14000>;
 		};
 
Signature · 1 line
2.34.1
Reviewed-by on v4 3/3
#7 lore raw

Re: [PATCH v4 3/3] arm64: dts: qcom: shikra: Update rpm-stats compatible to SoC specific

Quoted 10 lines · Sneh Mankad

A generic "qcom,rpm-stats" compatible only reads stats for SoC level LPM stats like vmin and vlow.

Shikra SoC specific compatible allows reading individual subsystem level LPM stats along with SoC level LPM stats. Change it.

Keep "qcom,rpm-stats" as fallback compatible.

Reviewed-by on v4 3/3
#8 lore raw

Re: [PATCH v4 3/3] arm64: dts: qcom: shikra: Update rpm-stats compatible to SoC specific

In reply to Sneh Mankad
Quoted 10 lines · Sneh Mankad

A generic "qcom,rpm-stats" compatible only reads stats for SoC level LPM stats like vmin and vlow.

Shikra SoC specific compatible allows reading individual subsystem level LPM stats along with SoC level LPM stats. Change it.

Keep "qcom,rpm-stats" as fallback compatible.

maintainer Applied
#9 lore raw
In reply to Sneh Mankad
Quoted 8 lines · Sneh Mankad

SoC LPM stats are present in RPM MSGRAM and subsystem LPM stats are present in SMEM for Shikra.

For earlier targets using RPM processor like msm8974, rpm_master_stat.c was used for subsystem LPM stats since those stats were populated in RPM MSGRAM.

[...]

Applied, thanks!

[1/3] dt-bindings: soc: qcom: stats: Add compatible for Shikra

      commit: 1dd7f6ae95ab28464bdf3314980e9822fadabda6
[2/3] soc: qcom: stats: Add stats compatible and config for Shikra
      commit: c12e3f05f15f13709a003e06bddb977d8845ad72

[3/3] arm64: dts: qcom: shikra: Update rpm-stats compatible to SoC specific
(no commit info)

Best regards,

Signature · 1 line
Bjorn Andersson <[email protected]>
maintainer Applied
#10 lore raw

Re: (subset) [PATCH v4 0/3] Add subsystem LPM stats support for Shikra

In reply to Sneh Mankad
Quoted 8 lines · Sneh Mankad

SoC LPM stats are present in RPM MSGRAM and subsystem LPM stats are present in SMEM for Shikra.

For earlier targets using RPM processor like msm8974, rpm_master_stat.c was used for subsystem LPM stats since those stats were populated in RPM MSGRAM.

[...]

Applied, thanks!

[3/3] arm64: dts: qcom: shikra: Update rpm-stats compatible to SoC specific

      commit: b3e06ee996cd12e96a77000c181f01fc37cca9c8

Best regards,

Signature · 1 line
Bjorn Andersson <[email protected]>