Message ID | 20250408-wdt_reset_reason-v1-0-e6ec30c2c926@oss.qualcomm.com |
---|---|
Headers | show |
Series | Add support to read the restart reason from IMEM | expand |
On 08/04/2025 10:49, Kathiravan Thirumoorthy wrote: > Add a devicetree binding for the Qualcomm IPQ SOCs restart reason > information region found in the IMEM, allowing the system to identify > the cause of a restart. > > Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com> > --- > .../bindings/watchdog/qcom,restart-reason.yaml | 46 ++++++++++++++++++++++ > 1 file changed, 46 insertions(+) > > diff --git a/Documentation/devicetree/bindings/watchdog/qcom,restart-reason.yaml b/Documentation/devicetree/bindings/watchdog/qcom,restart-reason.yaml > new file mode 100644 > index 0000000000000000000000000000000000000000..babbaa70b114f9691018ed6cb10bfa78e18fad64 > --- /dev/null > +++ b/Documentation/devicetree/bindings/watchdog/qcom,restart-reason.yaml > @@ -0,0 +1,46 @@ > +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/watchdog/qcom,restart-reason.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Qualcomm IPQ SoC restart reason location > + > +maintainers: > + - Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com> > + > +description: > + The Qualcomm IPQ SoC restart reason memory region, in IMEM, is used to > + identify the cause of the system restart. This will be helpful to identify > + the cause when the RAM dump collection is disabled. > + > +properties: > + compatible: > + const: qcom,restart-reason-info No generic compatibles. OTOH, I don't see much of a value of this being a separate node. > + > + reg: > + maxItems: 1 > + > +required: > + - compatible > + - reg > + > +additionalProperties: false > + > +examples: > + - | > + imem@8600000 { > + compatible = "qcom,ipq5424-imem", "syscon", "simple-mfd"; > + reg = <0x08600000 0x1000>; > + > + #address-cells = <1>; > + #size-cells = <1>; > + > + ranges = <0 0x08600000 0x1000>; Drop all above. > + > + restart-reason@7b0 { > + compatible = "qcom,restart-reason-info"; > + reg = <0x7b0 0x4>; > + }; > + }; > +... > Best regards, Krzysztof
On 4/8/25 10:49 AM, Kathiravan Thirumoorthy wrote: > In Qualcomm IPQ SoC, if the system is rebooted due to the watchdog > timeout, there is no way to identify it. Current approach of checking > the EXPIRED_STATUS in WDT_STS is not working. > > To achieve this, if the system is rebooted due to watchdog timeout, the > information is captured in the IMEM by the bootloader (along with other > reason codes as well). > > This series attempts to address this by adding the support to read the > IMEM and populate the information via bootstatus sysfs file. As of now, > we are handling only the non secure watchdog timeout reason. > > Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com> > --- So I think it would be easier to model this as nvram (something like "nvmem-rmem" with imem perhaps modeled as "mmio-sram") and then consume that value through in-kernel APIs (or write to it, as necessary) Taking a quick look at mobile, it seems like "reboot bootloader" and friends use a similar mechanism Konrad
On 4/9/2025 12:30 PM, Krzysztof Kozlowski wrote: > On 08/04/2025 10:49, Kathiravan Thirumoorthy wrote: >> Add a devicetree binding for the Qualcomm IPQ SOCs restart reason >> information region found in the IMEM, allowing the system to identify >> the cause of a restart. >> >> Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com> >> --- >> .../bindings/watchdog/qcom,restart-reason.yaml | 46 ++++++++++++++++++++++ >> 1 file changed, 46 insertions(+) >> >> diff --git a/Documentation/devicetree/bindings/watchdog/qcom,restart-reason.yaml b/Documentation/devicetree/bindings/watchdog/qcom,restart-reason.yaml >> new file mode 100644 >> index 0000000000000000000000000000000000000000..babbaa70b114f9691018ed6cb10bfa78e18fad64 >> --- /dev/null >> +++ b/Documentation/devicetree/bindings/watchdog/qcom,restart-reason.yaml >> @@ -0,0 +1,46 @@ >> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) >> +%YAML 1.2 >> +--- >> +$id: http://devicetree.org/schemas/watchdog/qcom,restart-reason.yaml# >> +$schema: http://devicetree.org/meta-schemas/core.yaml# >> + >> +title: Qualcomm IPQ SoC restart reason location >> + >> +maintainers: >> + - Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com> >> + >> +description: >> + The Qualcomm IPQ SoC restart reason memory region, in IMEM, is used to >> + identify the cause of the system restart. This will be helpful to identify >> + the cause when the RAM dump collection is disabled. >> + >> +properties: >> + compatible: >> + const: qcom,restart-reason-info > No generic compatibles. > > OTOH, I don't see much of a value of this being a separate node. I leveraged this based on the qcom,pil-info.yaml [1]. I guess, I see the point. I will drop all these. Just define IMEM node and in the watchdog driver, I will get the regmap of the syscon / IMEM node and do regmap_read at the desired offset. Please let me know if this approach is fine. [1] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/Documentation/devicetree/bindings/remoteproc/qcom,pil-info.yaml
In Qualcomm IPQ SoC, if the system is rebooted due to the watchdog timeout, there is no way to identify it. Current approach of checking the EXPIRED_STATUS in WDT_STS is not working. To achieve this, if the system is rebooted due to watchdog timeout, the information is captured in the IMEM by the bootloader (along with other reason codes as well). This series attempts to address this by adding the support to read the IMEM and populate the information via bootstatus sysfs file. As of now, we are handling only the non secure watchdog timeout reason. Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com> --- Kathiravan Thirumoorthy (6): dt-bindings: sram: qcom,imem: Document IPQ5424 compatible arm64: dts: qcom: ipq5424: Add the IMEM node dt-bindings: watchdog: Add Qualcomm restart reason binding dt-bindings: sram: qcom,imem: add the support for restart reason watchdog: qcom-wdt: add support to read the restart reason from IMEM arm64: dts: qcom: ipq5424: add node for the restart reason information .../devicetree/bindings/sram/qcom,imem.yaml | 25 ++++++++++++ .../bindings/watchdog/qcom,restart-reason.yaml | 46 ++++++++++++++++++++++ arch/arm64/boot/dts/qcom/ipq5424.dtsi | 14 +++++++ drivers/watchdog/qcom-wdt.c | 40 ++++++++++++++++++- 4 files changed, 124 insertions(+), 1 deletion(-) --- base-commit: 7702d0130dc002bab2c3571ddb6ff68f82d99aea change-id: 20250408-wdt_reset_reason-e12921963fa6 Best regards,