| #
e655b00d |
| 10-Nov-2025 |
Mark Dykes <mark.dykes@arm.com> |
Merge changes from topic "gr/cov_fixes" into integration
* changes: fix(libc): fix coverity overflowed constant fix(libc): fix coverity overflowed constant fix(psci): fix coverity issue with o
Merge changes from topic "gr/cov_fixes" into integration
* changes: fix(libc): fix coverity overflowed constant fix(libc): fix coverity overflowed constant fix(psci): fix coverity issue with out-of-bounds read fix(fvp): fix coverity issue unsigned_compare
show more ...
|
| #
654ab9e0 |
| 31-Oct-2025 |
Govindraj Raja <govindraj.raja@arm.com> |
fix(psci): fix coverity issue with out-of-bounds read
Avoid OVERRUN on parent indices if accidental return negative value from `get_pwr_lvl_state_idx`, so convert everything to use unsigned int to a
fix(psci): fix coverity issue with out-of-bounds read
Avoid OVERRUN on parent indices if accidental return negative value from `get_pwr_lvl_state_idx`, so convert everything to use unsigned int to avoid Out-of-bounds read (OVERRUN)
Change-Id: Ie6d6fd34db9903e99b29e004fb46908aea8acd46 Signed-off-by: Govindraj Raja <govindraj.raja@arm.com>
show more ...
|
| #
35b2bbf4 |
| 28-Jul-2025 |
Manish Pandey <manish.pandey2@arm.com> |
Merge changes from topic "bk/pabandon_cleanup" into integration
* changes: feat(cpus): add pabandon support to the Alto cpu feat(psci): optimise clock init on a pabandon feat(psci): check that
Merge changes from topic "bk/pabandon_cleanup" into integration
* changes: feat(cpus): add pabandon support to the Alto cpu feat(psci): optimise clock init on a pabandon feat(psci): check that CPUs handled a pabandon feat(psci): make pabandon support generic refactor(psci): unify coherency exit between AArch64 and AArch32 refactor(psci): absorb psci_power_down_wfi() into common code refactor(platforms): remove usage of psci_power_down_wfi fix(cm): disable SPE/TRBE correctly
show more ...
|
| #
232c1892 |
| 11-Mar-2025 |
Boyan Karatotev <boyan.karatotev@arm.com> |
refactor(psci): absorb psci_power_down_wfi() into common code
The AArch64 and AArch32 variants are not that different so there is no need for them to be in assembly. They should also not be called f
refactor(psci): absorb psci_power_down_wfi() into common code
The AArch64 and AArch32 variants are not that different so there is no need for them to be in assembly. They should also not be called from non-PSCI code as PSCI is smart enough to handle this after platform hooks. So absorb the functions into common code.
This allows for a tiny bit of optimisation: there will be no branch (that can be missed or non-cached) to a non-inlineable function. Then in the terminal case we can call wfi() directly with the application of the erratum before the loop. And finally in the wakeup case, we don't have to explicitly clear the errata as that will happen automatically on the second call of prepare_cpu_pwr_dwn().
The A510 erratum requires a tsb csync before the dsb+wfi combo to turn the core off. We can do this a little bit earlier in the cpu hook and relieve common code from the responsibility. EL3 is always a prohibited region so the buffer will stay empty.
Change-Id: I5f950df3fb7b0736df4ce25a21f78b29896de215 Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
show more ...
|
| #
fcb80d7d |
| 11-Feb-2025 |
Manish Pandey <manish.pandey2@arm.com> |
Merge changes I765a7fa0,Ic33f0b6d,I8d1a88c7,I381f96be,I698fa849, ... into integration
* changes: fix(cpus): clear CPUPWRCTLR_EL1.CORE_PWRDN_EN_BIT on reset chore(docs): drop the "wfi" from `pwr_
Merge changes I765a7fa0,Ic33f0b6d,I8d1a88c7,I381f96be,I698fa849, ... into integration
* changes: fix(cpus): clear CPUPWRCTLR_EL1.CORE_PWRDN_EN_BIT on reset chore(docs): drop the "wfi" from `pwr_domain_pwr_down_wfi` chore(psci): drop skip_wfi variable feat(arm): convert arm platforms to expect a wakeup fix(cpus): avoid SME related loss of context on powerdown feat(psci): allow cores to wake up from powerdown refactor: panic after calling psci_power_down_wfi() refactor(cpus): undo errata mitigations feat(cpus): add sysreg_bit_toggle
show more ...
|
| #
db5fe4f4 |
| 08-Oct-2024 |
Boyan Karatotev <boyan.karatotev@arm.com> |
chore(docs): drop the "wfi" from `pwr_domain_pwr_down_wfi`
To allow for generic handling of a wakeup, this hook is no longer expected to call wfi itself. Update the name everywhere to reflect this e
chore(docs): drop the "wfi" from `pwr_domain_pwr_down_wfi`
To allow for generic handling of a wakeup, this hook is no longer expected to call wfi itself. Update the name everywhere to reflect this expectation so that future platform implementers don't get misled.
Change-Id: Ic33f0b6da74592ad6778fd802c2f0b85223af614 Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
show more ...
|
| #
2b5e00d4 |
| 19-Dec-2024 |
Boyan Karatotev <boyan.karatotev@arm.com> |
feat(psci): allow cores to wake up from powerdown
The simplistic view of a core's powerdown sequence is that power is atomically cut upon calling `wfi`. However, it turns out that it has lots to do
feat(psci): allow cores to wake up from powerdown
The simplistic view of a core's powerdown sequence is that power is atomically cut upon calling `wfi`. However, it turns out that it has lots to do - it has to talk to the interconnect to exit coherency, clean caches, check for RAS errors, etc. These take significant amounts of time and are certainly not atomic. As such there is a significant window of opportunity for external events to happen. Many of these steps are not destructive to context, so theoretically, the core can just "give up" half way (or roll certain actions back) and carry on running. The point in this sequence after which roll back is not possible is called the point of no return.
One of these actions is the checking for RAS errors. It is possible for one to happen during this lengthy sequence, or at least remain undiscovered until that point. If the core were to continue powerdown when that happens, there would be no (easy) way to inform anyone about it. Rejecting the powerdown and letting software handle the error is the best way to implement this.
Arm cores since at least the a510 have included this exact feature. So far it hasn't been deemed necessary to account for it in firmware due to the low likelihood of this happening. However, events like GIC wakeup requests are much more probable. Older cores will powerdown and immediately power back up when this happens. Travis and Gelas include a feature similar to the RAS case above, called powerdown abandon. The idea is that this will improve the latency to service the interrupt by saving on work which the core and software need to do.
So far firmware has relied on the `wfi` being the point of no return and if it doesn't explicitly detect a pending interrupt quite early on, it will embark onto a sequence that it expects to end with shutdown. To accommodate for it not being a point of no return, we must undo all of the system management we did, just like in the warm boot entrypoint.
To achieve that, the pwr_domain_pwr_down_wfi hook must not be terminal. Most recent platforms do some platform management and finish on the standard `wfi`, followed by a panic or an endless loop as this is expected to not return. To make this generic, any platform that wishes to support wakeups must instead let common code call `psci_power_down_wfi()` right after. Besides wakeups, this lets common code handle powerdown errata better as well.
Then, the CPU_OFF case is simple - PSCI does not allow it to return. So the best that can be done is to attempt the `wfi` a few times (the choice of 32 is arbitrary) in the hope that the wakeup is transient. If it isn't, the only choice is to panic, as the system is likely to be in a bad state, eg. interrupts weren't routed away. The same applies for SYSTEM_OFF, SYSTEM_RESET, and SYSTEM_RESET2. There the panic won't matter as the system is going offline one way or another. The RAS case will be considered in a separate patch.
Now, the CPU_SUSPEND case is more involved. First, to powerdown it must wipe its context as it is not written on warm boot. But it cannot be overwritten in case of a wakeup. To avoid the catch 22, save a copy that will only be used if powerdown fails. That is about 500 bytes on the stack so it hopefully doesn't tip anyone over any limits. In future that can be avoided by having a core manage its own context.
Second, when the core wakes up, it must undo anything it did to prepare for poweroff, which for the cores we care about, is writing CPUPWRCTLR_EL1.CORE_PWRDN_EN. The least intrusive for the cpu library way of doing this is to simply call the power off hook again and have the hook toggle the bit. If in the future there need to be more complex sequences, their direction can be advised on the value of this bit.
Third, do the actual "resume". Most of the logic is already there for the retention suspend, so that only needs a small touch up to apply to the powerdown case as well. The missing bit is the powerdown specific state management. Luckily, the warmboot entrypoint does exactly that already too, so steal that and we're done.
All of this is hidden behind a FEAT_PABANDON flag since it has a large memory and runtime cost that we don't want to burden non pabandon cores with.
Finally, do some function renaming to better reflect their purpose and make names a little bit more consistent.
Change-Id: I2405b59300c2e24ce02e266f91b7c51474c1145f Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
show more ...
|
| #
2bd3b397 |
| 21-Oct-2024 |
Boyan Karatotev <boyan.karatotev@arm.com> |
refactor: panic after calling psci_power_down_wfi()
This function doesn't return and its callers that don't return either rely on this. Drop the dead attribute and add a panic() after it to make thi
refactor: panic after calling psci_power_down_wfi()
This function doesn't return and its callers that don't return either rely on this. Drop the dead attribute and add a panic() after it to make this expectation explicit. Calling `wfi` in the powerdown sequence is terminal so even if the function was made to return, there would be no functional change.
This is useful for a following patch that makes psci_power_down_wfi() return.
Change-Id: I62ca1ee058b1eaeb046966c795081e01bf45a2eb Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
show more ...
|
| #
f532cd30 |
| 15-Jan-2025 |
Govindraj Raja <govindraj.raja@arm.com> |
Merge changes I137f69be,Ia2e7168f,I0e569d12,I614272ec,Ib68293f2 into integration
* changes: perf(psci): pass my_core_pos around instead of calling it repeatedly refactor(psci): move timestamp co
Merge changes I137f69be,Ia2e7168f,I0e569d12,I614272ec,Ib68293f2 into integration
* changes: perf(psci): pass my_core_pos around instead of calling it repeatedly refactor(psci): move timestamp collection to psci_pwrdown_cpu refactor(psci): factor common code out of the standby finisher refactor(psci): don't use PSCI_INVALID_PWR_LVL to signal OFF state docs(psci): drop outdated cache maintenance comment
show more ...
|
| #
0c836554 |
| 30-Sep-2024 |
Boyan Karatotev <boyan.karatotev@arm.com> |
refactor(psci): don't use PSCI_INVALID_PWR_LVL to signal OFF state
The target_pwrlvl field in the psci cpu data struct only stores the highest power domain that a CPU_SUSPEND call affected, and is u
refactor(psci): don't use PSCI_INVALID_PWR_LVL to signal OFF state
The target_pwrlvl field in the psci cpu data struct only stores the highest power domain that a CPU_SUSPEND call affected, and is used to resume those same domains on warm reset. If the cpu is otherwise OFF (never turned on or CPU_OFF), then this needs to be the highest power level because we don't know the highest level that will be off.
So skip the invalidation and always keep the field to the maximum value. During suspend the field will be lowered to the appropriate value and then put back after wakeup.
Also, do that in the suspend to standby path as well as it will have been written before the sleep and it might end up incorrect.
Change-Id: I614272ec387e1d83023c94700780a0f538a9a6b6 Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
show more ...
|
| #
72e8f245 |
| 08-Aug-2023 |
Manish V Badarkhe <manish.badarkhe@arm.com> |
Merge "chore: update to use Arm word across TF-A" into integration
|
| #
4c700c15 |
| 01-Aug-2023 |
Govindraj Raja <govindraj.raja@arm.com> |
chore: update to use Arm word across TF-A
Align entire TF-A to use Arm in copyright header.
Change-Id: Ief9992169efdab61d0da6bd8c5180de7a4bc2244 Signed-off-by: Govindraj Raja <govindraj.raja@arm.co
chore: update to use Arm word across TF-A
Align entire TF-A to use Arm in copyright header.
Change-Id: Ief9992169efdab61d0da6bd8c5180de7a4bc2244 Signed-off-by: Govindraj Raja <govindraj.raja@arm.com>
show more ...
|
| #
f4d011b0 |
| 12-Jun-2023 |
Manish Pandey <manish.pandey2@arm.com> |
Merge changes from topic "psci-osi" into integration
* changes: fix(psci): add optional pwr_domain_validate_suspend to plat_psci_ops_t fix(sc7280): update pwr_domain_suspend fix(fvp): update p
Merge changes from topic "psci-osi" into integration
* changes: fix(psci): add optional pwr_domain_validate_suspend to plat_psci_ops_t fix(sc7280): update pwr_domain_suspend fix(fvp): update pwr_domain_suspend
show more ...
|
| #
d3488614 |
| 04-May-2023 |
Wing Li <wingers@google.com> |
fix(psci): add optional pwr_domain_validate_suspend to plat_psci_ops_t
This patch adds a new optional member `pwr_domain_validate_suspend` to the `plat_psci_ops_t` structure that allows a platform t
fix(psci): add optional pwr_domain_validate_suspend to plat_psci_ops_t
This patch adds a new optional member `pwr_domain_validate_suspend` to the `plat_psci_ops_t` structure that allows a platform to optionally perform platform specific validations in OS-initiated mode. This is conditionally compiled into the build depending on the value of the `PSCI_OS_INIT_MODE` build option.
In https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/17682, the return type of the `pwr_domain_suspend` handler was updated from `void` to `int` to allow a platform to optionally perform platform specific validations in OS-initiated mode. However, when an error code other than `PSCI_E_SUCCESS` is returned, the current exit path does not undo the operations in `psci_suspend_to_pwrdown_start`, and as a result, the system ends up in an unexpected state.
The fix in this patch prevents the need to undo the operations in `psci_suspend_to_pwrdown_start`, by allowing the platform to first perform any necessary platform specific validations before the PSCI generic code proceeds to the point of no return where the CPU_SUSPEND request is expected to complete successfully.
Change-Id: I05d92c7ea3f5364da09af630d44d78252185db20 Signed-off-by: Wing Li <wingers@google.com>
show more ...
|
| #
f50107d3 |
| 03-May-2023 |
Manish Pandey <manish.pandey2@arm.com> |
Merge changes I9d06e0ee,I6980e84f into integration
* changes: feat(tegra): implement 'pwr_domain_off_early' handler feat(psci): introduce 'pwr_domain_off_early' hook
|
| #
6cf4ae97 |
| 25-Apr-2023 |
Varun Wadekar <vwadekar@nvidia.com> |
feat(psci): introduce 'pwr_domain_off_early' hook
This patch introduces the 'pwr_domain_off_early' hook for platforms wanting to perform housekeeping steps before the PSCI framework starts the CPU
feat(psci): introduce 'pwr_domain_off_early' hook
This patch introduces the 'pwr_domain_off_early' hook for platforms wanting to perform housekeeping steps before the PSCI framework starts the CPU power off sequence. Platforms might also want to use ths opportunity to ensure that the CPU off sequence can proceed.
The PSCI framework expects a return code of PSCI_E_DENIED, if the platform wants to halt the CPU off sequence.
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com> Change-Id: I6980e84fc4d6cb80537a178d0d3d26fb28a13853
show more ...
|
| #
92e93253 |
| 28-Mar-2023 |
Manish Pandey <manish.pandey2@arm.com> |
Merge changes from topic "psci-osi" into integration
* changes: feat(sc7280): add support for PSCI_OS_INIT_MODE feat(fvp): enable support for PSCI OS-initiated mode feat(psci): update PSCI_FEA
Merge changes from topic "psci-osi" into integration
* changes: feat(sc7280): add support for PSCI_OS_INIT_MODE feat(fvp): enable support for PSCI OS-initiated mode feat(psci): update PSCI_FEATURES feat(psci): add support for OS-initiated mode feat(psci): add support for PSCI_SET_SUSPEND_MODE build(psci): add build option for OS-initiated mode docs(psci): add design proposal for OS-initiated mode
show more ...
|
| #
9a70e69e |
| 14-Sep-2022 |
Wing Li <wingers@google.com> |
feat(psci): update PSCI_FEATURES
This patch updates the PSCI_FEATURES handler to indicate support for OS-initiated mode per section 5.15.2 of the PSCI spec (DEN0022D.b) based on the value of `FF_SUP
feat(psci): update PSCI_FEATURES
This patch updates the PSCI_FEATURES handler to indicate support for OS-initiated mode per section 5.15.2 of the PSCI spec (DEN0022D.b) based on the value of `FF_SUPPORTS_OS_INIT_MODE`, which is conditionally enabled by the `PSCI_OS_INIT_MODE` build option.
Change-Id: I5da8a989b53419ad2ab55b73ddeee6e882c25554 Signed-off-by: Wing Li <wingers@google.com>
show more ...
|
| #
606b7430 |
| 14-Sep-2022 |
Wing Li <wingers@google.com> |
feat(psci): add support for OS-initiated mode
This patch adds a `psci_validate_state_coordination` function that is called by `psci_cpu_suspend_start` in OS-initiated mode.
This function validates
feat(psci): add support for OS-initiated mode
This patch adds a `psci_validate_state_coordination` function that is called by `psci_cpu_suspend_start` in OS-initiated mode.
This function validates the request per sections 4.2.3.2, 5.4.5, and 6.3 of the PSCI spec (DEN0022D.b): - The requested power states are consistent with the system's state - The calling core is the last running core at the requested power level
This function differs from `psci_do_state_coordination` in that: - The `psci_req_local_pwr_states` map is not modified if the request were to be denied - The `state_info` argument is never modified since it contains the power states requested by the calling OS
This is conditionally compiled into the build depending on the value of the `PSCI_OS_INIT_MODE` build option.
Change-Id: I667041c842d2856e9d128c98db4d5ae4e4552df3 Signed-off-by: Wing Li <wingers@google.com>
show more ...
|
| #
b88a4416 |
| 14-Sep-2022 |
Wing Li <wingers@google.com> |
feat(psci): add support for PSCI_SET_SUSPEND_MODE
This patch adds a PSCI_SET_SUSPEND_MODE handler that validates the request per section 5.20.2 of the PSCI spec (DEN0022D.b), and updates the suspend
feat(psci): add support for PSCI_SET_SUSPEND_MODE
This patch adds a PSCI_SET_SUSPEND_MODE handler that validates the request per section 5.20.2 of the PSCI spec (DEN0022D.b), and updates the suspend mode to the requested mode.
This is conditionally compiled into the build depending on the value of the `PSCI_OS_INIT_MODE` build option.
Change-Id: Iebf65f5f7846aef6b8643ad6082db99b4dcc4bef Signed-off-by: Wing Li <wingers@google.com>
show more ...
|
| #
43636796 |
| 10-Jan-2020 |
Mark Dykes <mardyk01@review.trustedfirmware.org> |
Merge "Unify type of "cpu_idx" across PSCI module." into integration
|
| #
5b33ad17 |
| 13-Dec-2019 |
Deepika Bhavnani <deepika.bhavnani@arm.com> |
Unify type of "cpu_idx" across PSCI module.
NOTE for platform integrators: API `plat_psci_stat_get_residency()` third argument `last_cpu_idx` is changed from "signed int" to the "unsigned i
Unify type of "cpu_idx" across PSCI module.
NOTE for platform integrators: API `plat_psci_stat_get_residency()` third argument `last_cpu_idx` is changed from "signed int" to the "unsigned int" type.
Issue / Trouble points 1. cpu_idx is used as mix of `unsigned int` and `signed int` in code with typecasting at some places leading to coverity issues.
2. Underlying platform API's return cpu_idx as `unsigned int` and comparison is performed with platform specific defines `PLAFORM_xxx` which is not consistent
Misra Rule 10.4: The value of a complex expression of integer type may only be cast to a type that is narrower and of the same signedness as the underlying type of the expression.
Based on above points, cpu_idx is kept as `unsigned int` to match the API's and low-level functions and platform defines are updated where ever required
Signed-off-by: Deepika Bhavnani <deepika.bhavnani@arm.com> Change-Id: Ib26fd16e420c35527204b126b9b91e8babcc3a5c
show more ...
|
| #
41bda863 |
| 27-Sep-2019 |
Soby Mathew <soby.mathew@arm.com> |
Merge changes from topic "mp/giv3-discovery" into integration
* changes: Migrate ARM platforms to use the new GICv3 API Adding new optional PSCI hook pwr_domain_on_finish_late GICv3: Enable mu
Merge changes from topic "mp/giv3-discovery" into integration
* changes: Migrate ARM platforms to use the new GICv3 API Adding new optional PSCI hook pwr_domain_on_finish_late GICv3: Enable multi socket GIC redistributor frame discovery
show more ...
|
| #
10107707 |
| 12-Aug-2019 |
Madhukar Pappireddy <madhukar.pappireddy@arm.com> |
Adding new optional PSCI hook pwr_domain_on_finish_late
This PSCI hook is similar to pwr_domain_on_finish but is guaranteed to be invoked with the respective core and cluster are participating in co
Adding new optional PSCI hook pwr_domain_on_finish_late
This PSCI hook is similar to pwr_domain_on_finish but is guaranteed to be invoked with the respective core and cluster are participating in coherency. This will be necessary to safely invoke the new GICv3 API which modifies shared GIC data structures concurrently.
Change-Id: I8e54f05c9d4ef5712184c9c18ba45ac97a29eb7a Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com>
show more ...
|
| #
01c44ddd |
| 02-Aug-2019 |
Alexei Fedorov <Alexei.Fedorov@arm.com> |
Merge "Replace __ASSEMBLY__ with compiler-builtin __ASSEMBLER__" into integration
|