Add RPM sleep stats for MSM8916
cover Add RPM sleep stats for MSM8916
MSM8916 is similar to the other SoCs that had the RPM stats node added in commit 290bc68 ("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 a new qcom,rpm-legacy-stats compatible that reads 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/[email protected]/
Stephan Gerhold (3):
dt-bindings: soc: qcom: stats: Document qcom,rpm-legacy-stats
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 | 2 ++ arch/arm64/boot/dts/qcom/msm8916.dtsi | 5 +++++ drivers/soc/qcom/qcom_stats.c | 10 ++++++++++ 3 files changed, 17 insertions(+)
Signature · 1 line
2.33.0
PATCH 1/3 dt-bindings: soc: qcom: stats: Document qcom,rpm-legacy-stats
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.
--- Documentation/devicetree/bindings/soc/qcom/qcom-stats.yaml | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/soc/qcom/qcom-stats.yaml +2 -0
@@ -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
Signature · 1 line
2.33.0
Re: [PATCH 1/3] dt-bindings: soc: qcom: stats: Document qcom,rpm-legacy-stats
Hi,
Thanks,
Maulik
Quoted 24 lines · Stephan Gerhold
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 <[email protected]>Signed-off-by Stephan Gerhold <[email protected]>--- Documentation/devicetree/bindings/soc/qcom/qcom-stats.yaml | 2 ++ 1 file changed, 2 insertions(+)Documentation/devicetree/bindings/soc/qcom/qcom-stats.yaml +2
-0@@ -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
Signature · 1 line
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Re: [PATCH 1/3] dt-bindings: soc: qcom: stats: Document qcom,rpm-legacy-stats
In reply to Stephan GerholdQuoted 10 lines · Stephan Gerhold
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 <[email protected]>Signed-off-by Stephan Gerhold <[email protected]>--- Documentation/devicetree/bindings/soc/qcom/qcom-stats.yaml | 2 ++ 1 file changed, 2 insertions(+)
PATCH 2/3 soc: qcom: stats: Add fixed sleep stats offset for older RPM firmwares
In reply to Stephan GerholdNot 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.
--- drivers/soc/qcom/qcom_stats.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/soc/qcom/qcom_stats.c +10 -0
@@ -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 }, { } };
Signature · 1 line
2.33.0
Re: [PATCH 2/3] soc: qcom: stats: Add fixed sleep stats offset for older RPM firmwares
Hi,
Thanks,
Maulik
Quoted 41 lines · Stephan Gerhold
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 <[email protected]>Signed-off-by Stephan Gerhold <[email protected]>--- drivers/soc/qcom/qcom_stats.c | 10 ++++++++++ 1 file changed, 10 insertions(+)drivers/soc/qcom/qcom_stats.c +10
-0@@ -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 }, { } };
Signature · 1 line
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Re: [PATCH 2/3] soc: qcom: stats: Add fixed sleep stats offset for older RPM firmwares
In reply to Stephan GerholdQuoted 18 lines · Stephan Gerhold
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 <[email protected]>Signed-off-by Stephan Gerhold <[email protected]>--- drivers/soc/qcom/qcom_stats.c | 10 ++++++++++ 1 file changed, 10 insertions(+)drivers/soc/qcom/qcom_stats.c +0
-0@@ -237,6 +237,15 @@ static const struct stats_config rpm_data = { .subsystem_stats_in_smem = false,
drivers/soc/qcom/qcom_stats.c static const struct stats_config rpm_data = { · line 247
Quoted 10 lines
drivers/soc/qcom/qcom_stats.c +8
-0}; +/* 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, +};
Is this the only variation that existed back in the "legacy" days? Will we end up with multiple "legacy" variants?
drivers/soc/qcom/qcom_stats.c static const struct stats_config rpmh_data = { · line 259
Quoted 9 lines
drivers/soc/qcom/qcom_stats.c +2
-0+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 },
'l' < 's'...
Regards,
Bjorn
Quoted 6 lines
drivers/soc/qcom/qcom_stats.c +0
-0{ .compatible = "qcom,rpmh-stats", .data = &rpmh_data }, { } };Signature · 1 line
2.33.0
Re: [PATCH 2/3] soc: qcom: stats: Add fixed sleep stats offset for older RPM firmwares
Quoted 22 lines · Bjorn Andersson
Quoted 20 lines · Stephan Gerhold
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 <[email protected]>Signed-off-by Stephan Gerhold <[email protected]>--- drivers/soc/qcom/qcom_stats.c | 10 ++++++++++ 1 file changed, 10 insertions(+)drivers/soc/qcom/qcom_stats.c +0
-0@@ -237,6 +237,15 @@ static const struct stats_config rpm_data = { .subsystem_stats_in_smem = false, };
Quoted 12 lines
drivers/soc/qcom/qcom_stats.c static const struct stats_config rpm_data = { · line 247
Quoted 8 lines
drivers/soc/qcom/qcom_stats.c +8
-0+/* 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, +};Is this the only variation that existed back in the "legacy" days? Will we end up with multiple "legacy" variants?
I think most old platforms that are still somewhat maintained use 0xdba0 (e.g. MSM8916, MSM8974, APQ8084, MSM8226).
I found a different offset for APQ8064, MSM8960, but they also seem to use a different stats format ("v1" instead of "v2") which is not currently supported by the qcom_stats driver here.
I guess I could add SoC-specific compatibles if you prefer (e.g. "qcom,rpm-stats-msm8916"), or do you have any other suggestion?
Thanks,
Stephan
Re: [PATCH 2/3] soc: qcom: stats: Add fixed sleep stats offset for older RPM firmwares
Quoted 36 lines · Stephan Gerhold
Quoted 22 lines · Bjorn Andersson
Quoted 20 lines · Stephan Gerhold
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 <[email protected]>Signed-off-by Stephan Gerhold <[email protected]>--- drivers/soc/qcom/qcom_stats.c | 10 ++++++++++ 1 file changed, 10 insertions(+)drivers/soc/qcom/qcom_stats.c +0
-0@@ -237,6 +237,15 @@ static const struct stats_config rpm_data = { .subsystem_stats_in_smem = false, };Quoted 12 lines
drivers/soc/qcom/qcom_stats.c static const struct stats_config rpm_data = { · line 247
Quoted 8 lines
drivers/soc/qcom/qcom_stats.c +8
-0+/* 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, +};Is this the only variation that existed back in the "legacy" days? Will we end up with multiple "legacy" variants?
Quoted 6 lines
I think most old platforms that are still somewhat maintained use
0xdba0(e.g. MSM8916, MSM8974, APQ8084, MSM8226).
I found a different offset for APQ8064, MSM8960, but they also seem to use a different stats format ("v1" instead of "v2") which is not currently supported by theqcom_statsdriver here.
Okay, so there's an even more legacy format as well...
Quoted 3 lines
I guess I could add SoC-specific compatibles if you prefer (e.g. "qcom,rpm-stats-msm8916"), or do you have any other suggestion?
Yes, as we have examples of another "legacy format" I would prefer that we sprinkle some platform names in there; and as newer platforms all seems to use the same format this effort should be bound to whatever old platforms we end up supporting.
Nit. I would prefer the qcom,msm8916-rpm-stats format though.
Regards,
Bjorn
Re: [PATCH 2/3] soc: qcom: stats: Add fixed sleep stats offset for older RPM firmwares
Quoted 38 lines · Bjorn Andersson
Quoted 36 lines · Stephan Gerhold
Quoted 34 lines · Bjorn Andersson
Quoted 18 lines · Stephan Gerhold
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 <[email protected]>Signed-off-by Stephan Gerhold <[email protected]>--- drivers/soc/qcom/qcom_stats.c | 10 ++++++++++ 1 file changed, 10 insertions(+)drivers/soc/qcom/qcom_stats.c +0
-0@@ -237,6 +237,15 @@ static const struct stats_config rpm_data = { .subsystem_stats_in_smem = false,drivers/soc/qcom/qcom_stats.c static const struct stats_config rpm_data = { · line 247
Quoted 10 lines
drivers/soc/qcom/qcom_stats.c +8
-0}; +/* 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, +};Is this the only variation that existed back in the "legacy" days? Will we end up with multiple "legacy" variants?
Quoted 9 lines
Quoted 6 lines
I think most old platforms that are still somewhat maintained use
0xdba0(e.g. MSM8916, MSM8974, APQ8084, MSM8226).
I found a different offset for APQ8064, MSM8960, but they also seem to use a different stats format ("v1" instead of "v2") which is not currently supported by theqcom_statsdriver here.Okay, so there's an even more legacy format as well...
We could use qcom,rpm-even-more-legacy-stats for those. ;D (just kidding)
Quoted 11 lines
Quoted 3 lines
I guess I could add SoC-specific compatibles if you prefer (e.g. "qcom,rpm-stats-msm8916"), or do you have any other suggestion?
Yes, as we have examples of another "legacy format" I would prefer that we sprinkle some platform names in there; and as newer platforms all seems to use the same format this effort should be bound to whatever old platforms we end up supporting.
Nit. I would prefer the qcom,msm8916-rpm-stats format though.
Both sound good to me, I will send a v2 with the
"qcom,msm8916-rpm-stats" compatible instead.
Thanks,
Stephan
PATCH 3/3 arm64: dts: qcom: msm8916: Add RPM sleep stats
In reply to Stephan GerholdMSM8916 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
--- arch/arm64/boot/dts/qcom/msm8916.dtsi | 5 +++++ 1 file changed, 5 insertions(+)
arch/arm64/boot/dts/qcom/msm8916.dtsi +5 -0
@@ -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>;
Signature · 1 line
2.33.0
Re: [PATCH 3/3] arm64: dts: qcom: msm8916: Add RPM sleep stats
Hi,
Thanks,
Maulik
Quoted 45 lines · 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 at0x14seems 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 of0xdba0.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: 0x0Cc Maulik Shah <[email protected]>Signed-off-by Stephan Gerhold <[email protected]>--- arch/arm64/boot/dts/qcom/msm8916.dtsi | 5 +++++ 1 file changed, 5 insertions(+)arch/arm64/boot/dts/qcom/msm8916.dtsi +5
-0@@ -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>;
Signature · 1 line
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation