soc: qcom: boot_stats: Add driver support for boot_stats
cover soc: qcom: boot_stats: Add driver support for boot_stats
Qualcomm's proprietary Android boot-loaders capture boot time stats, like the time when the bootloader started execution and at what point the bootloader handed over control to the kernel etc. in the IMEM region. This information is captured in a specific format by this driver by mapping a structure to the IMEM memory region and then accessing the members of the structure to print the information. This information is useful in verifying if existing boot KPIs have regressed or not. A sample log in SM8450(waipio) device is as follows:-
KPI: Pre ABL Time = 3s
KPI: ABL Time = 14s
KPI: Kernel MPM timestamp = 890206
The Module Power Manager(MPM) sleep counter starts ticking at the PBL stage and the timestamp generated by the sleep counter is logged by the Qualcomm proprietary bootloader(ABL) at two points-> First when it starts execution which is logged here as "Pre ABL Time" and the second when it is about to load the kernel logged as "ABL Time". Both these values are read up by the driver from IMEM region and printed as above. The current sleep counter timestamp is also logged by the driver.
Souradeep Chowdhury (4):
dt-bindings: sram: qcom,imem: Add Boot Stat region within IMEM
dt-bindings: soc: qcom,mpm-sleep-counter: Add the dtschema
soc: qcom: boot_stat: Add Driver Support for Boot Stats
MAINTAINERS: Add the entry for boot_stats driver support
.../bindings/soc/qcom/qcom,mpm-sleep-counter.yaml | 40 ++++++++ .../devicetree/bindings/sram/qcom,imem.yaml | 20 ++++ MAINTAINERS | 7 ++ drivers/soc/qcom/Kconfig | 7 ++ drivers/soc/qcom/Makefile | 1 + drivers/soc/qcom/boot_stats.c | 108 +++++++++++++++++++++ 6 files changed, 183 insertions(+) create mode 100644 Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml create mode 100644 drivers/soc/qcom/boot_stats.c
Signature · 1 line
2.7.4
PATCH 2/4 dt-bindings: soc: qcom,mpm-sleep-counter: Add the dtschema
Add the device tree bindings for the module power manager sleep counter.
--- .../bindings/soc/qcom/qcom,mpm-sleep-counter.yaml | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml
Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml new file +40 -0
@@ -0,0 +1,40 @@ +# SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/soc/qcom/qcom,mpm-sleep-counter.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: MPM Sleep Counter + +maintainers: + - Souradeep Chowdhury <[email protected]> + +description: | + MPM(Module Power Manager) has a sleep counter which is used to track + various stages of the boot process in Qualcomm. + +properties: + compatible: + items: + - const: qcom,mpm2-sleep-counter + + reg: + items: + - description: MPM Sleep Counter Base + + clock-frequency: + description: Frequency for the sleep counter + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + mpm2-sleep-counter@c221000{ + compatible = "qcom,mpm2-sleep-counter"; + reg = <0xc221000 0x1000>; + clock-frequency = <32768>; + };
Signature · 1 line
2.7.4
PATCH 1/4 dt-bindings: sram: qcom,imem: Add Boot Stat region within IMEM
In reply to Souradeep ChowdhuryAll Qualcomm bootloaders log useful timestamp information related to bootloader stats in the IMEM region. Add the child node within IMEM for the boot stat region containing register address and compatible string.
--- .../devicetree/bindings/sram/qcom,imem.yaml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
Documentation/devicetree/bindings/sram/qcom,imem.yaml +20 -0
@@ -48,6 +48,26 @@ patternProperties: $ref: /schemas/remoteproc/qcom,pil-info.yaml# description: Peripheral image loader relocation region + "^boot-stat@[0-9a-f]+$": + type: object + description: + node for boot stat. + + properties: + compatible: + items: + - const: qcom,imem-boot_stats + + reg: + maxItems: 1 + description: + The base address of the register region in case of + imem boot stats. + + required: + - compatible + - reg + required: - compatible - reg
Signature · 1 line
2.7.4
PATCH 4/4 MAINTAINERS: Add the entry for boot_stats driver support
In reply to Souradeep ChowdhuryAdd the entries for all the files added as a part of driver support for boot stats.
--- MAINTAINERS | 7 +++++++ 1 file changed, 7 insertions(+)
MAINTAINERS +7 -0
@@ -17071,6 +17071,13 @@ L: [email protected] S: Supported F: drivers/net/ipa/ +QCOM BOOT_STATS DRIVER +M: Souradeep Chowdhury <[email protected]> +L: [email protected] +S: Maintained +F: Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml +F: drivers/soc/qcom/boot_stats.c + QEMU MACHINE EMULATOR AND VIRTUALIZER SUPPORT M: Gabriel Somlo <[email protected]> M: "Michael S. Tsirkin" <[email protected]>
Signature · 1 line
2.7.4
PATCH 3/4 soc: qcom: boot_stat: Add Driver Support for Boot Stats
In reply to Souradeep ChowdhuryAll of Qualcomm's proprietary Android boot-loaders capture boot time stats, like the time when the bootloader started execution and at what point the bootloader handed over control to the kernel etc. in the IMEM region. This information is captured in a specific format by this driver by mapping a structure to the IMEM memory region and then accessing the members of the structure to print the information. This information is useful in verifying if the existing boot KPIs have regressed or not. A sample log in SM8450(waipio) device is as follows:-
KPI: Pre ABL Time = 3s
KPI: ABL Time = 14s
KPI: Kernel MPM timestamp = 890206
The Module Power Manager(MPM) sleep counter starts ticking at the PBL stage and the timestamp generated by the sleep counter is logged by the Qualcomm proprietary bootloader(ABL) at two points-> First when it starts execution which is logged here as "Pre ABL Time" and the second when it is about to load the kernel logged as "ABL Time". Both are logged in the unit of seconds. The current kernel timestamp is printed by the boot_stats driver as well.
--- drivers/soc/qcom/Kconfig | 7 +++ drivers/soc/qcom/Makefile | 1 + drivers/soc/qcom/boot_stats.c | 108 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 116 insertions(+) create mode 100644 drivers/soc/qcom/boot_stats.c
drivers/soc/qcom/Kconfig +7 -0
@@ -79,6 +79,13 @@ config QCOM_DCC driver provides interface to configure DCC block and read back captured data from DCC's internal SRAM. +config QCOM_BOOTSTAT + tristate "Qualcomm Technologies, Boot Stat driver" + depends on ARCH_QCOM || COMPILE_TEST + help + This option enables driver for boot stats. Boot stat driver prints + the kernel bootloader information by accessing the imem region. + config QCOM_KRYO_L2_ACCESSORS bool depends on ARCH_QCOM && ARM64 || COMPILE_TEST
drivers/soc/qcom/Makefile +1 -0
@@ -5,6 +5,7 @@ obj-$(CONFIG_QCOM_GENI_SE) += qcom-geni-se.o obj-$(CONFIG_QCOM_COMMAND_DB) += cmd-db.o obj-$(CONFIG_QCOM_CPR) += cpr.o obj-$(CONFIG_QCOM_DCC) += dcc.o +obj-$(CONFIG_QCOM_BOOTSTAT) += boot_stats.o obj-$(CONFIG_QCOM_GSBI) += qcom_gsbi.o obj-$(CONFIG_QCOM_MDT_LOADER) += mdt_loader.o obj-$(CONFIG_QCOM_OCMEM) += ocmem.o
drivers/soc/qcom/boot_stats.c new file +108 -0
108 lines not on this page · raw message
--
2.7.4
Re: [PATCH V1 1/4] dt-bindings: sram: qcom,imem: Add Boot Stat region within IMEM
In reply to Souradeep ChowdhuryQuoted 15 lines · Souradeep Chowdhury
All Qualcomm bootloaders log useful timestamp information related to bootloader stats in the IMEM region. Add the child node within IMEM for the boot stat region containing register address and compatible string.
Signed-off-by Souradeep Chowdhury <[email protected]>--- .../devicetree/bindings/sram/qcom,imem.yaml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)Documentation/devicetree/bindings/sram/qcom,imem.yaml +0
-0
Documentation/devicetree/bindings/sram/qcom,imem.yaml patternProperties: · line 54
Quoted 7 lines
Documentation/devicetree/bindings/sram/qcom,imem.yaml +4
-0@@ -48,6 +48,26 @@ patternProperties: $ref: /schemas/remoteproc/qcom,pil-info.yaml# description: Peripheral image loader relocation region + "^boot-stat@[0-9a-f]+$": + type: object + description: + node for boot stat.
This basically copies the name of node, so not really helpful. Describe what's this.
Documentation/devicetree/bindings/sram/qcom,imem.yaml patternProperties: · line 55
Quoted 1 line
Documentation/devicetree/bindings/sram/qcom,imem.yaml +1
-0+
additionalProperties: false
Documentation/devicetree/bindings/sram/qcom,imem.yaml patternProperties: · line 58
Quoted 3 lines
Documentation/devicetree/bindings/sram/qcom,imem.yaml +3
-0+ properties: + compatible: + items:
Drop items.
Documentation/devicetree/bindings/sram/qcom,imem.yaml patternProperties: · line 59
Quoted 1 line
Documentation/devicetree/bindings/sram/qcom,imem.yaml +1
-0+ - const: qcom,imem-boot_stats
No underscores in compatibles. Why this is not SoC specific compatible?
Documentation/devicetree/bindings/sram/qcom,imem.yaml patternProperties: · line 65
Quoted 6 lines
Documentation/devicetree/bindings/sram/qcom,imem.yaml +6
-0+ + reg: + maxItems: 1 + description: + The base address of the register region in case of + imem boot stats.
Drop description, it's obvious.
Documentation/devicetree/bindings/sram/qcom,imem.yaml patternProperties: · line 70
Quoted 5 lines
Documentation/devicetree/bindings/sram/qcom,imem.yaml +5
-0+ + required: + - compatible + - reg +
Best regards,
Krzysztof
Re: [PATCH V1 2/4] dt-bindings: soc: qcom,mpm-sleep-counter: Add the dtschema
In reply to Souradeep ChowdhuryQuoted 18 lines · Souradeep Chowdhury
Add the device tree bindings for the module power manager sleep counter.
Signed-off-by Souradeep Chowdhury <[email protected]>--- .../bindings/soc/qcom/qcom,mpm-sleep-counter.yaml | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yamlDocumentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml new file +3
-0@@ -0,0 +1,40 @@ +# SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-2-Clause) +%YAML 1.2 +---
Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml line 13
Quoted 10 lines
Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml new file +10
-0+$id: http://devicetree.org/schemas/soc/qcom/qcom,mpm-sleep-counter.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: MPM Sleep Counter + +maintainers: + - Souradeep Chowdhury <[email protected]> + +description: | + MPM(Module Power Manager) has a sleep counter which is used to track
Missing space:
MPM (Module
Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml line 14
Quoted 1 line
Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml new file +1
-0+ various stages of the boot process in Qualcomm.
in Qualcomm SoC. Because you do not track it in the company...
Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml line 18
Quoted 4 lines
Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml new file +4
-0+ +properties: + compatible: + items:
Drop items.
Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml line 19
Quoted 1 line
Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml new file +1
-0+ - const: qcom,mpm2-sleep-counter
SoC specific compatible.
Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml line 23
Quoted 4 lines
Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml new file +4
-0+ + reg: + items: + - description: MPM Sleep Counter Base
just maxItems: 1
Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml line 26
Quoted 3 lines
Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml new file +3
-0+ + clock-frequency: + description: Frequency for the sleep counter
Since this does not have clocks, what frequency you are setting here?
Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml line 36
Quoted 10 lines
Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml new file +10
-0+ +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + mpm2-sleep-counter@c221000{
Node names should be generic.
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation
Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml line 40
Quoted 4 lines
Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml new file +4
-0+ compatible = "qcom,mpm2-sleep-counter"; + reg = <0xc221000 0x1000>; + clock-frequency = <32768>; + };
Best regards,
Krzysztof
Re: [PATCH V1 3/4] soc: qcom: boot_stat: Add Driver Support for Boot Stats
In reply to Souradeep ChowdhuryQuoted 12 lines · Souradeep Chowdhury
All of Qualcomm's proprietary Android boot-loaders capture boot time stats, like the time when the bootloader started execution and at what point the bootloader handed over control to the kernel etc. in the IMEM region. This information is captured in a specific format by this driver by mapping a structure to the IMEM memory region and then accessing the members of the structure to print the information. This information is useful in verifying if the existing boot KPIs have regre
drivers/soc/qcom/boot_stats.c new file +3
-0+/** +* struct boot_stats - timestamp information related to boot stats +* @bootloader_start: Time for the starting point of the abl bootloader
drivers/soc/qcom/boot_stats.c line 28
Quoted 10 lines
drivers/soc/qcom/boot_stats.c new file +10
-0+* @bootloader_end: Time when the kernel starts loading from abl bootloader +*/ +struct boot_stats { +u32 bootloader_start; +u32 bootloader_end; +} __packed; + +static struct boot_stats __iomem *boot_stats; +static void __iomem *mpm_counter_base; +static u32 mpm_counter_freq;
No file-scope variables. Does not scale, not easy for review and maintenance. Avoid such code.
drivers/soc/qcom/boot_stats.c line 37
Quoted 9 lines
drivers/soc/qcom/boot_stats.c new file +9
-0+ +static int mpm_parse_dt (void ) +{ +struct device_node *np_imem, *np_mpm2; + + np_imem =of_find_compatible_node (NULL ,NULL , +"qcom,imem-boot_stats" ); +if (!np_imem) { +pr_err ("can't find qcom,imem node\n" );
So you are printing errors everywhere, on every soc and with compile test on every platform there is in the world... sorry, it does not work like that.
Quoted 4 lines
drivers/soc/qcom/boot_stats.c new file +4
-0+return -ENODEV ; + } + boot_stats =of_iomap (np_imem,0 ); +if (!boot_stats) {
drivers/soc/qcom/boot_stats.c line 105
Quoted 10 lines
drivers/soc/qcom/boot_stats.c new file +8
-0+pr_err ("boot_stats: Can't map imem\n" ); + goto err1; + } + +static void __exit boot_stats_exit(void) +{ +} +module_exit (boot_stats_exit)
I don't think this is some special code which deserves init calls. Make it module_platform_driver().
Best regards,
Krzysztof
Re: [PATCH V1 2/4] dt-bindings: soc: qcom,mpm-sleep-counter: Add the dtschema
In reply to Souradeep ChowdhuryDocumentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml
Quoted 14 lines · Souradeep Chowdhury
Add the device tree bindings for the module power manager sleep counter.
Signed-off-by Souradeep Chowdhury <[email protected]>--- .../bindings/soc/qcom/qcom,mpm-sleep-counter.yaml | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yamlDocumentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml new file +0
-0
Your code a bit explains this... this is not a device but some memory region. Does not look like suitable for bindings as separate device.
Best regards,
Krzysztof
Re: [PATCH V1 1/4] dt-bindings: sram: qcom,imem: Add Boot Stat region within IMEM
In reply to Krzysztof KozlowskiQuoted 19 lines · Krzysztof Kozlowski
Quoted 18 lines · Souradeep Chowdhury
All Qualcomm bootloaders log useful timestamp information related to bootloader stats in the IMEM region. Add the child node within IMEM for the boot stat region containing register address and compatible string.
Signed-off-by Souradeep Chowdhury <[email protected]>--- .../devicetree/bindings/sram/qcom,imem.yaml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)Documentation/devicetree/bindings/sram/qcom,imem.yaml +0
-0@@ -48,6 +48,26 @@ patternProperties: $ref: /schemas/remoteproc/qcom,pil-info.yaml# description: Peripheral image loader relocation region
Quoted 7 lines
Documentation/devicetree/bindings/sram/qcom,imem.yaml patternProperties: · line 54
Quoted 4 lines
Documentation/devicetree/bindings/sram/qcom,imem.yaml +4
-0+ "^boot-stat@[0-9a-f]+$": + type: object + description: + node for boot stat.This basically copies the name of node, so not really helpful. Describe what's this.
Ack
Quoted 9 lines
Documentation/devicetree/bindings/sram/qcom,imem.yaml patternProperties: · line 55
Quoted 2 lines
Documentation/devicetree/bindings/sram/qcom,imem.yaml +1
-0+additionalProperties: false
Documentation/devicetree/bindings/sram/qcom,imem.yaml patternProperties: · line 58
Quoted 3 lines
Documentation/devicetree/bindings/sram/qcom,imem.yaml +3
-0+ properties: + compatible: + items:
Quoted 5 lines
Drop items.
Documentation/devicetree/bindings/sram/qcom,imem.yaml patternProperties: · line 59
Quoted 1 line
Documentation/devicetree/bindings/sram/qcom,imem.yaml +1
-0+ - const: qcom,imem-boot_statsNo underscores in compatibles. Why this is not SoC specific compatible?
Ack. The boot_stats module is not specific to a device. It is written to
read some values from this imem region which is present for almost all QCOM SoCs. So SoC specific compatible is not given in this case.
Quoted 9 lines
Documentation/devicetree/bindings/sram/qcom,imem.yaml patternProperties: · line 65
Quoted 7 lines
Documentation/devicetree/bindings/sram/qcom,imem.yaml +6
-0+ + reg: + maxItems: 1 + description: + The base address of the register region in case of + imem boot stats.Drop description, it's obvious.
Ack
Quoted 8 lines
Documentation/devicetree/bindings/sram/qcom,imem.yaml patternProperties: · line 70
Quoted 5 lines
Documentation/devicetree/bindings/sram/qcom,imem.yaml +5
-0+ + required: + - compatible + - reg +Best regards,
Krzysztof
Re: [PATCH V1 2/4] dt-bindings: soc: qcom,mpm-sleep-counter: Add the dtschema
In reply to Krzysztof KozlowskiQuoted 24 lines · Krzysztof Kozlowski
Quoted 23 lines · Souradeep Chowdhury
Add the device tree bindings for the module power manager sleep counter.
Signed-off-by Souradeep Chowdhury <[email protected]>--- .../bindings/soc/qcom/qcom,mpm-sleep-counter.yaml | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+)create mode 100644
Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yamlDocumentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml new file +8
-0@@ -0,0 +1,40 @@ +# SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/soc/qcom/qcom,mpm-sleep-counter.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: MPM Sleep Counter +
Quoted 9 lines
Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml line 13
Quoted 5 lines
Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml new file +5
-0+maintainers: + - Souradeep Chowdhury <[email protected]> + +description: | + MPM(Module Power Manager) has a sleep counter which is used to trackMissing space:
MPM (Module
Ack
Quoted 4 lines
Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml line 14
Quoted 1 line
Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml new file +1
-0+ various stages of the boot process in Qualcomm.in Qualcomm SoC. Because you do not track it in the company...
Ack
Quoted 7 lines
Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml line 18
Quoted 4 lines
Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml new file +4
-0+ +properties: + compatible: + items:Drop items.
Ack
Quoted 4 lines
Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml line 19
Quoted 1 line
Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml new file +1
-0+ - const: qcom,mpm2-sleep-counterSoC specific compatible.
This is a generic Module Power Manager Sleep Counter which is present in all Qcom Socs, so SoC specific compatible is not given here.
Quoted 7 lines
Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml line 23
Quoted 4 lines
Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml new file +4
-0+ + reg: + items: + - description: MPM Sleep Counter Basejust maxItems: 1
Ack
Quoted 5 lines
Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml line 26
Quoted 3 lines
Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml new file +3
-0+ + clock-frequency: + description: Frequency for the sleep counterSince this does not have clocks, what frequency you are setting here?
Module Power Manager(MPM) Sleep Counter is a clock that starts ticking from Primary Boot Loader(PBL) Stage. This is usually a 32 Khz clock and the frequency for the same is stored here.
Quoted 14 lines
Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml line 36
Quoted 11 lines
Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml new file +10
-0+ +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + mpm2-sleep-counter@c221000{Node names should be generic.
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation
Ack
Quoted 9 lines
Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml line 40
Quoted 5 lines
Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml new file +4
-0+ compatible = "qcom,mpm2-sleep-counter"; + reg = <0xc221000 0x1000>; + clock-frequency = <32768>; + };Best regards,
Krzysztof
Re: [PATCH V1 3/4] soc: qcom: boot_stat: Add Driver Support for Boot Stats
In reply to Krzysztof KozlowskiQuoted 10 lines · Krzysztof Kozlowski
Quoted 7 lines · Souradeep Chowdhury
All of Qualcomm's proprietary Android boot-loaders capture boot time stats, like the time when the bootloader started execution and at what point the bootloader handed over control to the kernel etc. in the IMEM region. This information is captured in a specific format by this driver by mapping a structure to the IMEM memory region and then accessing the members of the structure to print the information. This information is useful in verifying if the existing boot KPIs have regre
Quoted 16 lines
drivers/soc/qcom/boot_stats.c line 28
Quoted 13 lines
drivers/soc/qcom/boot_stats.c new file +13
-0+/** +* struct boot_stats - timestamp information related to boot stats +* @bootloader_start: Time for the starting point of the abl bootloader +* @bootloader_end: Time when the kernel starts loading from abl bootloader +*/ +struct boot_stats { +u32 bootloader_start; +u32 bootloader_end; +} __packed; + +static struct boot_stats __iomem *boot_stats; +static void __iomem *mpm_counter_base; +static u32 mpm_counter_freq;No file-scope variables. Does not scale, not easy for review and maintenance. Avoid such code.
Ack
Quoted 14 lines
drivers/soc/qcom/boot_stats.c line 37
Quoted 10 lines
drivers/soc/qcom/boot_stats.c new file +9
-0+ +static int mpm_parse_dt (void ) +{ +struct device_node *np_imem, *np_mpm2; + + np_imem =of_find_compatible_node (NULL ,NULL , +"qcom,imem-boot_stats" ); +if (!np_imem) { +pr_err ("can't find qcom,imem node\n" );So you are printing errors everywhere, on every soc and with compile test on every platform there is in the world... sorry, it does not work like that.
Ack
Quoted 10 lines
Quoted 8 lines
drivers/soc/qcom/boot_stats.c new file +7
-0+return -ENODEV ; + } + boot_stats =of_iomap (np_imem,0 ); +if (!boot_stats) { +pr_err ("boot_stats: Can't map imem\n" ); + goto err1; + }
Quoted 9 lines
drivers/soc/qcom/boot_stats.c line 105
Quoted 5 lines
drivers/soc/qcom/boot_stats.c new file +5
-0+ +static void __exit boot_stats_exit(void) +{ +} +module_exit (boot_stats_exit)I don't think this is some special code which deserves init calls. Make it
module_platform_driver().
Since this just reads some values from the Imem region and prints it to the user and doesn't have a specific device associated with it, a generic module code is written for it and not a module_platform_driver().
Quoted 5 lines
Best regards,
Krzysztof
Re: [PATCH V1 2/4] dt-bindings: soc: qcom,mpm-sleep-counter: Add the dtschema
In reply to Krzysztof KozlowskiQuoted 10 lines · Krzysztof Kozlowski
Quoted 9 lines · Souradeep Chowdhury
Add the device tree bindings for the module power manager sleep counter.
Signed-off-by Souradeep Chowdhury <[email protected]>--- .../bindings/soc/qcom/qcom,mpm-sleep-counter.yaml | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+)create mode 100644
Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml
Quoted 8 lines
Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml
Quoted 5 lines
Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml new file +0
-0Your code a bit explains this... this is not a device but some memory region. Does not look like suitable for bindings as separate device.
Ack. Can you let me know the suitable place to put the bindings for this?
Quoted 4 lines
Best regards,
Krzysztof
Re: [PATCH V1 3/4] soc: qcom: boot_stat: Add Driver Support for Boot Stats
In reply to Souradeep ChowdhuryQuoted 67 lines · Souradeep Chowdhury
Quoted 10 lines · Krzysztof Kozlowski
Quoted 7 lines · Souradeep Chowdhury
All of Qualcomm's proprietary Android boot-loaders capture boot time stats, like the time when the bootloader started execution and at what point the bootloader handed over control to the kernel etc. in the IMEM region. This information is captured in a specific format by this driver by mapping a structure to the IMEM memory region and then accessing the members of the structure to print the information. This information is useful in verifying if the existing boot KPIs have regre
Quoted 16 lines
drivers/soc/qcom/boot_stats.c line 28
Quoted 13 lines
drivers/soc/qcom/boot_stats.c new file +13
-0+/** +* struct boot_stats - timestamp information related to boot stats +* @bootloader_start: Time for the starting point of the abl bootloader +* @bootloader_end: Time when the kernel starts loading from abl bootloader +*/ +struct boot_stats { +u32 bootloader_start; +u32 bootloader_end; +} __packed; + +static struct boot_stats __iomem *boot_stats; +static void __iomem *mpm_counter_base; +static u32 mpm_counter_freq;No file-scope variables. Does not scale, not easy for review and maintenance. Avoid such code.
Ack
Quoted 14 lines
drivers/soc/qcom/boot_stats.c line 37
Quoted 10 lines
drivers/soc/qcom/boot_stats.c new file +9
-0+ +static int mpm_parse_dt (void ) +{ +struct device_node *np_imem, *np_mpm2; + + np_imem =of_find_compatible_node (NULL ,NULL , +"qcom,imem-boot_stats" ); +if (!np_imem) { +pr_err ("can't find qcom,imem node\n" );So you are printing errors everywhere, on every soc and with compile test on every platform there is in the world... sorry, it does not work like that.
Ack
Quoted 10 lines
Quoted 8 lines
drivers/soc/qcom/boot_stats.c new file +7
-0+return -ENODEV ; + } + boot_stats =of_iomap (np_imem,0 ); +if (!boot_stats) { +pr_err ("boot_stats: Can't map imem\n" ); + goto err1; + }Quoted 9 lines
drivers/soc/qcom/boot_stats.c line 105
Quoted 5 lines
drivers/soc/qcom/boot_stats.c new file +5
-0+ +static void __exit boot_stats_exit(void) +{ +} +module_exit (boot_stats_exit)I don't think this is some special code which deserves init calls. Make it
module_platform_driver().
Quoted 2 lines
Since this just reads some values from the Imem region and prints it to the user and doesn't have a specific device associated with it, a
Which is not really an argument for such antipattern, but okay...
Quoted 1 line
generic module code is written for it and not a
module_platform_driver().
... so how do you handle deferred probe?
Best regards,
Krzysztof
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH V1 1/4] dt-bindings: sram: qcom,imem: Add Boot Stat region within IMEM
In reply to Souradeep ChowdhuryQuoted 8 lines · Souradeep Chowdhury
Quoted 4 lines
Quoted 2 lines
+ - const: qcom,imem-boot_stats
No underscores in compatibles. Why this is not SoC specific compatible?
Ack. The
boot_statsmodule is not specific to a device. It is written to read some values from this imem region which is present for almost all QCOM SoCs. So SoC specific compatible is not given in this case.
Yeah, but the generic rule is that we always want SoC specific compatibles. If this is not specific to a device, then you do not need anything in DT and just instantiate it from some soc-driver...
Best regards,
Krzysztof
Re: [PATCH V1 2/4] dt-bindings: soc: qcom,mpm-sleep-counter: Add the dtschema
In reply to Souradeep ChowdhuryQuoted 7 lines · Souradeep Chowdhury
Quoted 4 lines
Quoted 1 line
+ - const: qcom,mpm2-sleep-counter
SoC specific compatible.
This is a generic Module Power Manager Sleep Counter which is present in all Qcom Socs, so SoC specific compatible is not given here.
Not really a good reason and it is actually very difficult to verify this. If I understand correctly any moment FW can change and this will stop being valid, so no.
Quoted 14 lines
Quoted 8 lines
Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml line 23
Quoted 5 lines
Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml new file +4
-0+ + reg: + items: + - description: MPM Sleep Counter Basejust maxItems: 1
Ack
Quoted 4 lines
Quoted 3 lines
Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml new file +3
-0+ + clock-frequency: + description: Frequency for the sleep counter
Quoted 5 lines
Quoted 1 line
Since this does not have clocks, what frequency you are setting here?
Module Power Manager(MPM) Sleep Counter is a clock that starts ticking from Primary Boot Loader(PBL) Stage. This is usually a 32 Khz clock and the frequency for the same is stored here.
You just said all devices have the same MPM, so I would argue that all devices have the same clock.
Anyway, this is a legacy property.
Best regards,
Krzysztof
Re: [PATCH V1 2/4] dt-bindings: soc: qcom,mpm-sleep-counter: Add the dtschema
In reply to Souradeep ChowdhuryQuoted 22 lines · Souradeep Chowdhury
Quoted 10 lines · Krzysztof Kozlowski
Quoted 9 lines · Souradeep Chowdhury
Add the device tree bindings for the module power manager sleep counter.
Signed-off-by Souradeep Chowdhury <[email protected]>--- .../bindings/soc/qcom/qcom,mpm-sleep-counter.yaml | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+)create mode 100644
Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yamlQuoted 8 lines
Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml
Quoted 5 lines
Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml new file +0
-0Your code a bit explains this... this is not a device but some memory region. Does not look like suitable for bindings as separate device.
Quoted 1 line
Ack. Can you let me know the suitable place to put the bindings for this?
Reserved memory region? Or drop from bindings entirely.
Best regards,
Krzysztof
Re: [PATCH V1 3/4] soc: qcom: boot_stat: Add Driver Support for Boot Stats
In reply to Krzysztof KozlowskiQuoted 68 lines · Krzysztof Kozlowski
Quoted 67 lines · Souradeep Chowdhury
Quoted 10 lines · Krzysztof Kozlowski
Quoted 7 lines · Souradeep Chowdhury
All of Qualcomm's proprietary Android boot-loaders capture boot time stats, like the time when the bootloader started execution and at what point the bootloader handed over control to the kernel etc. in the IMEM region. This information is captured in a specific format by this driver by mapping a structure to the IMEM memory region and then accessing the members of the structure to print the information. This information is useful in verifying if the existing boot KPIs have regre
Quoted 16 lines
drivers/soc/qcom/boot_stats.c line 28
Quoted 13 lines
drivers/soc/qcom/boot_stats.c new file +13
-0+/** +* struct boot_stats - timestamp information related to boot stats +* @bootloader_start: Time for the starting point of the abl bootloader +* @bootloader_end: Time when the kernel starts loading from abl bootloader +*/ +struct boot_stats { +u32 bootloader_start; +u32 bootloader_end; +} __packed; + +static struct boot_stats __iomem *boot_stats; +static void __iomem *mpm_counter_base; +static u32 mpm_counter_freq;No file-scope variables. Does not scale, not easy for review and maintenance. Avoid such code.
Ack
Quoted 14 lines
drivers/soc/qcom/boot_stats.c line 37
Quoted 10 lines
drivers/soc/qcom/boot_stats.c new file +9
-0+ +static int mpm_parse_dt (void ) +{ +struct device_node *np_imem, *np_mpm2; + + np_imem =of_find_compatible_node (NULL ,NULL , +"qcom,imem-boot_stats" ); +if (!np_imem) { +pr_err ("can't find qcom,imem node\n" );So you are printing errors everywhere, on every soc and with compile test on every platform there is in the world... sorry, it does not work like that.
Ack
Quoted 19 lines
Quoted 5 lines
drivers/soc/qcom/boot_stats.c new file +4
-0+return -ENODEV ; + } + boot_stats =of_iomap (np_imem,0 ); +if (!boot_stats) {drivers/soc/qcom/boot_stats.c line 105
Quoted 10 lines
drivers/soc/qcom/boot_stats.c new file +8
-0+pr_err ("boot_stats: Can't map imem\n" ); + goto err1; + } + +static void __exit boot_stats_exit(void) +{ +} +module_exit (boot_stats_exit)I don't think this is some special code which deserves init calls. Make it
module_platform_driver().
Quoted 8 lines
Quoted 2 lines
Since this just reads some values from the Imem region and prints it to the user and doesn't have a specific device associated with it, a
Which is not really an argument for such antipattern, but okay...
Quoted 1 line
generic module code is written for it and not a
module_platform_driver().... so how do you handle deferred probe?
This has no dependency on other resources except that it parses some information from DT nodes, so deferred probe handling is not needed in this case.
Quoted 4 lines
Best regards,
Krzysztof
Re: [PATCH V1 1/4] dt-bindings: sram: qcom,imem: Add Boot Stat region within IMEM
In reply to Krzysztof KozlowskiQuoted 6 lines · Krzysztof Kozlowski
Quoted 5 lines · Souradeep Chowdhury
Quoted 4 lines
Quoted 2 lines
+ - const: qcom,imem-boot_stats
No underscores in compatibles. Why this is not SoC specific compatible?
Quoted 7 lines
Quoted 3 lines
Ack. The
boot_statsmodule is not specific to a device. It is written to read some values from this imem region which is present for almost all QCOM SoCs. So SoC specific compatible is not given in this case.Yeah, but the generic rule is that we always want SoC specific compatibles. If this is not specific to a device, then you do not need anything in DT and just instantiate it from some soc-driver...
Ack. Will add SoC specific compatible here.
Quoted 4 lines
Best regards,
Krzysztof
Re: [PATCH V1 2/4] dt-bindings: soc: qcom,mpm-sleep-counter: Add the dtschema
In reply to Krzysztof KozlowskiQuoted 6 lines · Krzysztof Kozlowski
Quoted 5 lines · Souradeep Chowdhury
Quoted 4 lines
Quoted 1 line
+ - const: qcom,mpm2-sleep-counter
SoC specific compatible.
Quoted 6 lines
Quoted 2 lines
This is a generic Module Power Manager Sleep Counter which is present in all Qcom Socs, so SoC specific compatible is not given here.
Not really a good reason and it is actually very difficult to verify this. If I understand correctly any moment FW can change and this will stop being valid, so no.
Ack
Quoted 17 lines
Quoted 17 lines
Quoted 9 lines
Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml line 23
Quoted 6 lines
Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml new file +4
-0+ + reg: + items: + - description: MPM Sleep Counter Basejust maxItems: 1
Ack
Quoted 5 lines
Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml line 26
Quoted 3 lines
Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml new file +3
-0+ + clock-frequency: + description: Frequency for the sleep counterSince this does not have clocks, what frequency you are setting here?
Quoted 8 lines
Quoted 3 lines
Module Power Manager(MPM) Sleep Counter is a clock that starts ticking from Primary Boot Loader(PBL) Stage. This is usually a 32 Khz clock and the frequency for the same is stored here.
You just said all devices have the same MPM, so I would argue that all devices have the same clock.
Anyway, this is a legacy property.
Ack. Will drop clock frequency.
Quoted 4 lines
Best regards,
Krzysztof
Re: [PATCH V1 2/4] dt-bindings: soc: qcom,mpm-sleep-counter: Add the dtschema
In reply to Krzysztof KozlowskiQuoted 23 lines · Krzysztof Kozlowski
Quoted 22 lines · Souradeep Chowdhury
Quoted 18 lines · Krzysztof Kozlowski
Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml
Quoted 14 lines · Souradeep Chowdhury
Add the device tree bindings for the module power manager sleep counter.
Signed-off-by Souradeep Chowdhury <[email protected]>--- .../bindings/soc/qcom/qcom,mpm-sleep-counter.yaml | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+)create mode 100644
Documentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yamlDocumentation/devicetree/bindings/soc/qcom/qcom,mpm-sleep-counter.yaml new file +0
-0Your code a bit explains this... this is not a device but some memory region. Does not look like suitable for bindings as separate device.
Quoted 3 lines
Quoted 1 line
Ack. Can you let me know the suitable place to put the bindings for this?
Reserved memory region? Or drop from bindings entirely.
Ack. Will drop this for now.
Quoted 4 lines
Best regards,
Krzysztof
Re: [PATCH V1 3/4] soc: qcom: boot_stat: Add Driver Support for Boot Stats
In reply to Souradeep ChowdhuryQuoted 76 lines · Souradeep Chowdhury
Quoted 73 lines · Krzysztof Kozlowski
Quoted 67 lines · Souradeep Chowdhury
Quoted 10 lines · Krzysztof Kozlowski
Quoted 7 lines · Souradeep Chowdhury
All of Qualcomm's proprietary Android boot-loaders capture boot time stats, like the time when the bootloader started execution and at what point the bootloader handed over control to the kernel etc. in the IMEM region. This information is captured in a specific format by this driver by mapping a structure to the IMEM memory region and then accessing the members of the structure to print the information. This information is useful in verifying if the existing boot KPIs have regre
Quoted 16 lines
drivers/soc/qcom/boot_stats.c line 28
Quoted 13 lines
drivers/soc/qcom/boot_stats.c new file +13
-0+/** +* struct boot_stats - timestamp information related to boot stats +* @bootloader_start: Time for the starting point of the abl bootloader +* @bootloader_end: Time when the kernel starts loading from abl bootloader +*/ +struct boot_stats { +u32 bootloader_start; +u32 bootloader_end; +} __packed; + +static struct boot_stats __iomem *boot_stats; +static void __iomem *mpm_counter_base; +static u32 mpm_counter_freq;No file-scope variables. Does not scale, not easy for review and maintenance. Avoid such code.
Ack
Quoted 14 lines
drivers/soc/qcom/boot_stats.c line 37
Quoted 10 lines
drivers/soc/qcom/boot_stats.c new file +9
-0+ +static int mpm_parse_dt (void ) +{ +struct device_node *np_imem, *np_mpm2; + + np_imem =of_find_compatible_node (NULL ,NULL , +"qcom,imem-boot_stats" ); +if (!np_imem) { +pr_err ("can't find qcom,imem node\n" );So you are printing errors everywhere, on every soc and with compile test on every platform there is in the world... sorry, it does not work like that.
Ack
Quoted 10 lines
Quoted 8 lines
drivers/soc/qcom/boot_stats.c new file +7
-0+return -ENODEV ; + } + boot_stats =of_iomap (np_imem,0 ); +if (!boot_stats) { +pr_err ("boot_stats: Can't map imem\n" ); + goto err1; + }Quoted 9 lines
drivers/soc/qcom/boot_stats.c line 105
Quoted 5 lines
drivers/soc/qcom/boot_stats.c new file +5
-0+ +static void __exit boot_stats_exit(void) +{ +} +module_exit (boot_stats_exit)I don't think this is some special code which deserves init calls. Make it
module_platform_driver().Quoted 2 lines
Since this just reads some values from the Imem region and prints it to the user and doesn't have a specific device associated with it, a
Which is not really an argument for such antipattern, but okay...
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
generic module code is written for it and not a
module_platform_driver().... so how do you handle deferred probe?
This has no dependency on other resources except that it parses some information from DT nodes, so deferred probe handling is not needed in this case.
Yes, I know, but if we would ever add it how this driver can handle it? This is antipattern.
Best regards,
Krzysztof