Repository navigation
power: reset: Introduce Power State Change Reasons Recording (PSCRR) framework - #1208
Salendarsingh Gaud (sgaud-quic) merged 12 commits into
Conversation
|
Merge Check Failed: No CR Numbers Found Error: No Change Request numbers were found. Please add Change Request numbers to your pull request description in the format CRs-Fixed: 12345 or link GitHub issues that are associated with Change Requests. |
32b021d to
ec9413f
Compare
PR #1208 — validate-patchPR: #1208
Final Summary
|
PR #1208 — checker-log-analyzerPR: #1208
Detailed report: Full report
|
PR #1208 — validate-patchPR: #1208
Final Summary
|
PR #1208 — checker-log-analyzerPR: #1208
Detailed report: Full report
|
ec9413f to
783e94c
Compare
PR #1208 — validate-patchPR: #1208
Final Summary
|
PR #1208 — checker-log-analyzerPR: #1208
Detailed report: Full report
|
Test Matrix
|
LAVA Failed Case Triage SummaryPR: #1208 Job 262484 | SoC qcs6490-rb3gen2LAVA job: https://lava-oss.qualcomm.com/scheduler/job/262484 Failed test cases in LAVA job 262484 (SoC: qcs6490-rb3gen2).
Job 262485 | SoC hamoa-evkLAVA job: https://lava-oss.qualcomm.com/scheduler/job/262485 Failed test cases in LAVA job 262485 (SoC: hamoa-evk).
Job 262486 | SoC qcs615-rideLAVA job: https://lava-oss.qualcomm.com/scheduler/job/262486 Failed test cases in LAVA job 262486 (SoC: qcs615-ride).
Job 262487 | SoC lemans-evkLAVA job: https://lava-oss.qualcomm.com/scheduler/job/262487 Failed test cases in LAVA job 262487 (SoC: lemans-evk).
Job 262488 | SoC shikra-iqs-evkLAVA job: https://lava-oss.qualcomm.com/scheduler/job/262488 Failed test cases in LAVA job 262488 (SoC: shikra-iqs-evk).
Job 262489 | SoC qcs8300-rideLAVA job: https://lava-oss.qualcomm.com/scheduler/job/262489 Failed test cases in LAVA job 262489 (SoC: qcs8300-ride).
Job 262490 | SoC monaco-evkLAVA job: https://lava-oss.qualcomm.com/scheduler/job/262490 Failed test cases in LAVA job 262490 (SoC: monaco-evk).
Job 262491 | SoC purwa-evkLAVA job: https://lava-oss.qualcomm.com/scheduler/job/262491 Failed test cases in LAVA job 262491 (SoC: purwa-evk).
Job 262492 | SoC qcs9100-rideLAVA job: https://lava-oss.qualcomm.com/scheduler/job/262492 Failed test cases in LAVA job 262492 (SoC: qcs9100-ride).
|
|
Faruque Ansari (@faruque-ansari) please rebase your PR on tip |
Prepare for the introduction of the Power State Change Reason Recorder (PSCRR) framework by expanding the power_on_reason.h header. This extension includes new power-on reasons: - POWER_ON_REASON_OVER_CURRENT for over-current conditions. - POWER_ON_REASON_REGULATOR_FAILURE for regulator failures. - POWER_ON_REASON_OVER_TEMPERATURE for over temperature situations. - POWER_ON_REASON_EC_PANIC for EC panics. - POWER_ON_REASON_EXTERNAL for an external reset source. Co-developed-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com> Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@oss.qualcomm.com> Signed-off-by: Faruque Ansari <faruque.ansari@oss.qualcomm.com> Link: https://lore.kernel.org/r/20261019-pscrr-framework-v17-1-69ea6cdf4731@oss.qualcomm.com
…tdown/reboot reasons instead of strings
Prepares the kernel for the Power State Change Reason (PSCR) recorder,
which will store shutdown and reboot reasons in persistent storage.
Instead of using string-based reason descriptions, which are often too
large to fit within limited storage spaces (e.g., RTC clocks with only 8
bits of battery-backed storage), we introduce `enum psc_reason`. This
enumerates predefined reasons for power state changes, making it
efficient to store and retrieve shutdown causes.
Key changes:
- Introduced `enum psc_reason`, defining structured reasons for power state
changes.
- Replaced string-based shutdown reasons with `psc_reason` identifiers.
- Implemented `get_psc_reason()` and `set_psc_reason()` for tracking the
last shutdown cause.
- Added `psc_reason_to_str()` to map enum values to human-readable strings.
- Updated `hw_protection_trigger()` to use `psc_reason` instead of string
parameters.
- Updated all consumers of `hw_protection_trigger()` to pass an appropriate
`psc_reason` value instead of a string.
- All structured logs now go through a single `pr_emerg()` in
`__hw_protection_trigger()`, providing consistent output:
HARDWARE PROTECTION <action>: <reason-code> (<reason-string>)
Co-developed-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com>
Acked-by: Mark Brown <broonie@kernel.org>
Acked-by: Tzung-Bi Shih <tzungbi@kernel.org>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Reviewed-by: Bradley Morgan <brads@mainlining.org>
Reviewed-by: Daniel Lezcano <daniel.lezcano@oss.qualcomm.com>
Signed-off-by: Faruque Ansari <faruque.ansari@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20261019-pscrr-framework-v17-2-69ea6cdf4731@oss.qualcomm.com
psc_reason_to_str() returns human-readable labels that contain spaces (e.g. "over temperature"). Those are fine for logs but unusable as values in a space-separated sysfs list or as a write target. Extend the single reason descriptor table with a stable, space-free token next to the existing label, and add psc_reason_to_token() and psc_reason_from_token() so consumers can emit and parse reasons without inventing their own string table. Co-developed-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com> Reviewed-by: Bradley Morgan <brads@mainlining.org> Reviewed-by: Daniel Lezcano <daniel.lezcano@oss.qualcomm.com> Signed-off-by: Faruque Ansari <faruque.ansari@oss.qualcomm.com> Link: https://lore.kernel.org/r/20261019-pscrr-framework-v17-3-69ea6cdf4731@oss.qualcomm.com
psc_reason covered only the protection reasons. Extend it to mirror the full POWER_ON_REASON_* vocabulary - power-on, watchdog, software, external, RTC, reset button, CPU clock and crystal failures - so a provider can report why the system last powered on, not only why it was shut down. New values are appended to keep the existing numeric ABI. Co-developed-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com> Reviewed-by: Bradley Morgan <brads@mainlining.org> Signed-off-by: Faruque Ansari <faruque.ansari@oss.qualcomm.com> Link: https://lore.kernel.org/r/20261019-pscrr-framework-v17-4-69ea6cdf4731@oss.qualcomm.com
…latile Storage Introduce the Power State Change Reasons Recording (PSCRR) framework: a generic mechanism to record why the last power state change (shutdown or reboot) happened - under-voltage, thermal, watchdog, software-triggered, etc. - so a postmortem reason survives a reboot or an abrupt power loss. PSCRR is built around providers. A provider is either a hardware reason source (a PMIC, SoC reset controller or watchdog exposing a reset cause) or a recorder that persists the reason across a power cycle (an NVMEM or RTC scratch cell). Each provider gets a directory under /sys/kernel/pscrr/providerN/ exposing its name, backing device, the set of observed reasons (as tokens), its capabilities, the reasons it supports and - for recorders - a record policy. The reason set is deliberately not collapsed to a single winning cause, since resets are often multi-causal. Reasons are the numeric enum psc_reason values from reboot.h, shared with the POWER_ON_REASON_* vocabulary, so they store compactly in small battery-backed cells. The current reason (get/set_psc_reason(), set by the thermal/regulator/hw_protection paths) is written to every recorder from the reboot notifier. Co-developed-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Reported-by: Francesco Valla <francesco@valla.it> Closes: https://lore.kernel.org/all/178749889134.204450.5740187753642158305.b4-review@b4/ Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@oss.qualcomm.com> Reviewed-by: Bradley Morgan <brads@mainlining.org> Signed-off-by: Faruque Ansari <faruque.ansari@oss.qualcomm.com> Link: https://lore.kernel.org/r/20261019-pscrr-framework-v17-5-69ea6cdf4731@oss.qualcomm.com
Document the Power State Change Reasons Recording (PSCRR) sysfs interface under /sys/kernel/pscrr/: the per-provider directories and their name, device, reason, caps, supported_reasons and record_policy attributes, including the stable reason token values. Co-developed-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@oss.qualcomm.com> Signed-off-by: Faruque Ansari <faruque.ansari@oss.qualcomm.com> Link: https://lore.kernel.org/r/20261019-pscrr-framework-v17-6-69ea6cdf4731@oss.qualcomm.com
Kernel panic resets are not recorded in NVMEM, causing subsequent boots to report PSCR_UNKNOWN and making post-mortem analysis more difficult. Register a panic notifier to preserve the shutdown reason across panic -triggered resets. Add PSCR_KERNEL_PANIC as a dedicated reset reason code and its corresponding reason string to identify kernel panic resets on subsequent boots. Link: https://lore.kernel.org/r/20260805-pscrr-reboot-reason-v4-1-54ef517084cc@oss.qualcomm.com Signed-off-by: Faruque Ansari <faruque.ansari@oss.qualcomm.com>
Watchdog pretimeout resets are not recorded with a dedicated reason, causing subsequent boots to report PSCR_UNKNOWN and making it difficult to distinguish them from other unexpected resets. Add PSCR_WATCHDOG_PRETIMEOUT as a dedicated reason code and prevent the panic notifier from overwriting a watchdog pretimeout reason with PSCR_KERNEL_PANIC when the pretimeout governor triggers a panic. Link: https://lore.kernel.org/r/20260805-pscrr-reboot-reason-v4-2-54ef517084cc@oss.qualcomm.com Signed-off-by: Faruque Ansari <faruque.ansari@oss.qualcomm.com>
… governor Update the PSC reset reason by invoking set_psc_reason(PSCR_WATCHDOG_PRETIMEOUT) from the panic governor pretimeout handler before calling panic(), so the reset cause is committed to persistent storage before the system goes down. Link: https://lore.kernel.org/r/20260805-pscrr-reboot-reason-v4-3-54ef517084cc@oss.qualcomm.com Acked-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Faruque Ansari <faruque.ansari@oss.qualcomm.com>
Add a schema for the PSCRR NVMEM layout, which persists the power state change reason in a single NVMEM cell so it survives a power cycle and can be read back on the next boot. Link: https://lore.kernel.org/r/20261023-pscrr-provider-v4-1-e70fabb7e927@oss.qualcomm.com Reviewed-by: Rob Herring (Arm) <robh@kernel.org> Signed-off-by: Faruque Ansari <faruque.ansari@oss.qualcomm.com>
Record the power state change reason into a NVMEM cell (a PMIC SDAM byte, RTC scratch register, or EEPROM) and read it back on the next boot, so the cause survives a power cycle. The recorder is implemented as an NVMEM layout driver: it owns the single cell described by its layout binding and adds it to the parent NVMEM device, rather than acting as a standalone consumer of someone else's cell. Link: https://lore.kernel.org/r/20261023-pscrr-provider-v4-2-e70fabb7e927@oss.qualcomm.com Co-developed-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Faruque Ansari <faruque.ansari@oss.qualcomm.com>
The PSCRR NVMEM recorder needs a persistent storage cell to save the power state change reason before shutdown or reset. Without a described NVMEM cell, the recorder has no platform storage where it can preserve that reason for the next boot. Add a pscrr-nvmem layout under the PMIC SDAM and describe a one-byte cell at offset 0x49. The recorder uses the lower four bits of this cell to persist the power state change reason across resets. Link: https://lore.kernel.org/r/20261023-pscrr-provider-v4-3-e70fabb7e927@oss.qualcomm.com Reviewed-by: Abel Vesa <abel.vesa@oss.qualcomm.com> Signed-off-by: Faruque Ansari <faruque.ansari@oss.qualcomm.com>
783e94c to
fd57c60
Compare
PR #1208 — validate-patchPR: #1208
Final Summary
|
PR #1208 — checker-log-analyzerPR: #1208
Detailed report: Full report
|
Test Matrix
|
LAVA Failed Case Triage SummaryPR: #1208 Job 269729 | SoC qcs9100-rideLAVA job: https://lava-oss.qualcomm.com/scheduler/job/269729 Failed test cases in LAVA job 269729 (SoC: qcs9100-ride).
Job 269730 | SoC purwa-evkLAVA job: https://lava-oss.qualcomm.com/scheduler/job/269730 Failed test cases in LAVA job 269730 (SoC: purwa-evk).
Job 269731 | SoC qcs615-rideLAVA job: https://lava-oss.qualcomm.com/scheduler/job/269731 Failed test cases in LAVA job 269731 (SoC: qcs615-ride).
Job 269732 | SoC monaco-evkLAVA job: https://lava-oss.qualcomm.com/scheduler/job/269732 Failed test cases in LAVA job 269732 (SoC: monaco-evk).
Job 269733 | SoC hamoa-evkLAVA job: https://lava-oss.qualcomm.com/scheduler/job/269733 Failed test cases in LAVA job 269733 (SoC: hamoa-evk).
Job 269734 | SoC qcs8300-rideLAVA job: https://lava-oss.qualcomm.com/scheduler/job/269734 Failed test cases in LAVA job 269734 (SoC: qcs8300-ride).
Job 269735 | SoC shikra-iqs-evkLAVA job: https://lava-oss.qualcomm.com/scheduler/job/269735 Failed test cases in LAVA job 269735 (SoC: shikra-iqs-evk).
Job 269736 | SoC lemans-evkLAVA job: https://lava-oss.qualcomm.com/scheduler/job/269736 Failed test cases in LAVA job 269736 (SoC: lemans-evk).
Job 269737 | SoC qcs6490-rb3gen2LAVA job: https://lava-oss.qualcomm.com/scheduler/job/269737 Failed test cases in LAVA job 269737 (SoC: qcs6490-rb3gen2).
|
9bdb150
into
qualcomm-linux:qcom-6.18.y
Adds the PSCRR framework: a central sysfs interface (/sys/kernel/pscrr/)
where multiple providers (bootloader, watchdog, panic, NVMEM) can report
power-state-change reasons side by side, without collapsing them into a
single cause.
Includes:
Core framework + built-in /chosen/reset-source provider
Reboot reason infrastructure (parsable tokens, extended causes)
Kernel panic and watchdog pretimeout reason tracking
NVMEM-cell recorder provider + lemans DT wiring
CRs-Fixed: 4693541