Introduce RPM Master stats
v2 cover Introduce RPM Master stats
v1 -> v2:
- Drop the - in /properties/compatible to make our entry be of the correct type [1/2]
- Change %s to %d for printing out the iterator [2/2]
v1: https://lore.kernel.org/r/[email protected]
The RPM MSG ram includes per-subsystem low-power mode entry/exit/ residence/etc. statistics which are very useful for trying to debug what I'd call "SoC insomnia", or IOW the plaftorm refusing to drop the voltage rails to a minimum and gate the non-critical clocks.
This series adds a very short and simple driver to query that data and expose it through debugfs.
The base used for writing this driver is:
https://github.com/sonyxperiadev/kernel/blob/aosp/LA.UM.9.14.r1/drivers/soc/qcom/rpm_master_stat.c
---
Konrad Dybcio (2):
dt-bindings: soc: qcom: Add RPM Master stats
soc: qcom: Introduce RPM master stats driver
.../bindings/soc/qcom/rpm-master-stats.yaml | 53 +++++++ drivers/soc/qcom/Kconfig | 11 ++ drivers/soc/qcom/Makefile | 1 + drivers/soc/qcom/rpm_master_stats.c | 160 +++++++++++++++++++++ 4 files changed, 225 insertions(+)
---
base-commit: e134c93f788fb93fd6a3ec3af9af850a2048c7e6
change-id: 20230405-topic-master_stats-ba201a9af93d
Best regards,
Signature · 1 line
Konrad Dybcio <[email protected]>
PATCH v2 1/2 dt-bindings: soc: qcom: Add RPM Master stats
The RPM MSG RAM contains per-RPM-master (e.g. APPS, ADSP etc.) sleep statistics. They let one assess which core is actively preventing the system from entering a true low-power mode.
--- .../bindings/soc/qcom/rpm-master-stats.yaml | 53 ++++++++++++++++++++++ 1 file changed, 53 insertions(+)
Documentation/devicetree/bindings/soc/qcom/rpm-master-stats.yaml new file +53 -0
@@ -0,0 +1,53 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/soc/qcom/rpm-master-stats.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Qualcomm Technologies, Inc. (QTI) RPM Master Stats + +maintainers: + - Konrad Dybcio <[email protected]> + +description: + Per-RPM-Master (e.g. APSS, ADSP, etc.) sleep statistics. + +properties: + compatible: + const: qcom,rpm-master-stats + + qcom,rpm-msg-ram: + $ref: /schemas/types.yaml#/definitions/phandle-array + description: Phandle to an RPM MSG RAM slice containing the master stats + minItems: 1 + maxItems: 5 + + qcom,master-names: + $ref: /schemas/types.yaml#/definitions/string-array + description: RPM Master name + minItems: 1 + maxItems: 5 + +required: + - compatible + - qcom,rpm-msg-ram + - qcom,master-names + +additionalProperties: false + +examples: + - | + stats { + compatible = "qcom,rpm-master-stats"; + qcom,rpm-msg-ram = <&apss_master_stats>, + <&mpss_master_stats>, + <&adsp_master_stats>, + <&cdsp_master_stats>, + <&tz_master_stats>; + qcom,master-names = "APSS", + "MPSS", + "ADSP", + "CDSP", + "TZ"; + }; +...
Signature · 1 line
2.40.0
Rob Herring
maintainerRe: [PATCH v2 1/2] dt-bindings: soc: qcom: Add RPM Master stats
Quoted 3 lines · Konrad Dybcio
The RPM MSG RAM contains per-RPM-master (e.g. APPS, ADSP etc.) sleep statistics. They let one assess which core is actively preventing the system from entering a true low-power mode.
Just curious, is that a debug thing or something the OS uses?
Quoted 4 lines
Signed-off-by Konrad Dybcio <[email protected]>--- .../bindings/soc/qcom/rpm-master-stats.yaml | 53 ++++++++++++++++++++++
qcom,rpm-master-stats.yaml
Quoted 65 lines
1 file changed, 53 insertions(+)Documentation/devicetree/bindings/soc/qcom/rpm-master-stats.yaml new file +53
-0@@ -0,0 +1,53 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/soc/qcom/rpm-master-stats.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Qualcomm Technologies, Inc. (QTI) RPM Master Stats + +maintainers: + - Konrad Dybcio <[email protected]> + +description: + Per-RPM-Master (e.g. APSS, ADSP, etc.) sleep statistics. + +properties: + compatible: + const: qcom,rpm-master-stats + + qcom,rpm-msg-ram: + $ref: /schemas/types.yaml#/definitions/phandle-array + description: Phandle to an RPM MSG RAM slice containing the master stats + minItems: 1 + maxItems: 5 + + qcom,master-names: + $ref: /schemas/types.yaml#/definitions/string-array + description: RPM Master name + minItems: 1 + maxItems: 5 + +required: + - compatible + - qcom,rpm-msg-ram + - qcom,master-names + +additionalProperties: false + +examples: + - | + stats { + compatible = "qcom,rpm-master-stats"; + qcom,rpm-msg-ram = <&apss_master_stats>, + <&mpss_master_stats>, + <&adsp_master_stats>, + <&cdsp_master_stats>, + <&tz_master_stats>; + qcom,master-names = "APSS", + "MPSS", + "ADSP", + "CDSP", + "TZ"; + }; +...Signature · 2 lines
-- 2.40.0
Re: [PATCH v2 1/2] dt-bindings: soc: qcom: Add RPM Master stats
Quoted 6 lines · Rob Herring
Quoted 3 lines · Konrad Dybcio
The RPM MSG RAM contains per-RPM-master (e.g. APPS, ADSP etc.) sleep statistics. They let one assess which core is actively preventing the system from entering a true low-power mode.
Just curious, is that a debug thing or something the OS uses?
Debug, pretty much the only way of knowing how deep the sleep was other than shoving a multimiter under the chip and checking if the power rails went off.. :/
Quoted 7 lines
Quoted 5 lines
Signed-off-by Konrad Dybcio <[email protected]>--- .../bindings/soc/qcom/rpm-master-stats.yaml | 53 ++++++++++++++++++++++qcom,rpm-master-stats.yaml
Ack
Konrad
Quoted 66 lines
Quoted 66 lines
1 file changed, 53 insertions(+)Documentation/devicetree/bindings/soc/qcom/rpm-master-stats.yaml new file +53
-0@@ -0,0 +1,53 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/soc/qcom/rpm-master-stats.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Qualcomm Technologies, Inc. (QTI) RPM Master Stats + +maintainers: + - Konrad Dybcio <[email protected]> + +description: + Per-RPM-Master (e.g. APSS, ADSP, etc.) sleep statistics. + +properties: + compatible: + const: qcom,rpm-master-stats + + qcom,rpm-msg-ram: + $ref: /schemas/types.yaml#/definitions/phandle-array + description: Phandle to an RPM MSG RAM slice containing the master stats + minItems: 1 + maxItems: 5 + + qcom,master-names: + $ref: /schemas/types.yaml#/definitions/string-array + description: RPM Master name + minItems: 1 + maxItems: 5 + +required: + - compatible + - qcom,rpm-msg-ram + - qcom,master-names + +additionalProperties: false + +examples: + - | + stats { + compatible = "qcom,rpm-master-stats"; + qcom,rpm-msg-ram = <&apss_master_stats>, + <&mpss_master_stats>, + <&adsp_master_stats>, + <&cdsp_master_stats>, + <&tz_master_stats>; + qcom,master-names = "APSS", + "MPSS", + "ADSP", + "CDSP", + "TZ"; + }; +...Signature · 2 lines
-- 2.40.0
PATCH v2 2/2 soc: qcom: Introduce RPM master stats driver
In reply to Konrad DybcioIntroduce a driver to query and expose detailed, per-subsystem (as opposed to the existing qcom_stats driver which exposes SoC-wide data) about low power mode states of a given RPM master. That includes the APSS (ARM), MPSS (modem) and other remote cores, depending on the platform configuration.
This is a vastly cleaned up and restructured version of a similar driver found in msm-5.4.
--- drivers/soc/qcom/Kconfig | 11 +++ drivers/soc/qcom/Makefile | 1 + drivers/soc/qcom/rpm_master_stats.c | 160 ++++++++++++++++++++++++++++++++++++ 3 files changed, 172 insertions(+)
drivers/soc/qcom/Kconfig +11 -0
@@ -135,6 +135,17 @@ config QCOM_RMTFS_MEM Say y here if you intend to boot the modem remoteproc. +config QCOM_RPM_MASTER_STATS + tristate "Qualcomm RPM Master stats" + depends on ARCH_QCOM || COMPILE_TEST + help + The RPM Master sleep stats driver provides detailed per-subsystem + sleep/wake data, read from the RPM message RAM. It can be used to + assess whether all the low-power modes available are entered as + expected or to check which part of the SoC prevents it from sleeping. + + Say y here if you intend to debug or monitor platform sleep. + config QCOM_RPMH tristate "Qualcomm RPM-Hardened (RPMH) Communication" depends on ARCH_QCOM || COMPILE_TEST
drivers/soc/qcom/Makefile +1 -0
@@ -14,6 +14,7 @@ obj-$(CONFIG_QCOM_QMI_HELPERS) += qmi_helpers.o qmi_helpers-y += qmi_encdec.o qmi_interface.o obj-$(CONFIG_QCOM_RAMP_CTRL) += ramp_controller.o obj-$(CONFIG_QCOM_RMTFS_MEM) += rmtfs_mem.o +obj-$(CONFIG_QCOM_RPM_MASTER_STATS) += rpm_master_stats.o obj-$(CONFIG_QCOM_RPMH) += qcom_rpmh.o qcom_rpmh-y += rpmh-rsc.o qcom_rpmh-y += rpmh.o
drivers/soc/qcom/rpm_master_stats.c new file +160 -0
160 lines not on this page · raw message
Signature · 1 line
2.40.0