mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-26 23:04:50 +00:00
fix(psci): mask the Last in Level nibble in StateId
In the ARM recommended StateID Encoding, the index for the power level where the calling core is last to go idle use the last niblle of the StateId. Even if this nibble is necessary for OS-initiated mode, it can be used by caller even when this OSI mode is not used. In arm_validate_power_state() function, the StateId is compared with content of arm_pm_idle_states[] build with the arm_make_pwrstate_lvl2 macro, without Last in Level information. So it is safe to mask this nibble for ARM platform in all the cases, and that avoids issues with caller with use the same StateId encoding with OSI mode activated or not (in tftf tests for example, the input(power state) parameter = (0x40001022) and the associated power state is 0x40000022). Change-Id: I45e8e2b8f526fb61b94cf134d7d4aa3bac4c215d Signed-off-by: Jayanth Dodderi Chidanand <jayanthdodderi.chidanand@arm.com> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
This commit is contained in:
parent
7d00932771
commit
0a9c244b05
2 changed files with 2 additions and 7 deletions
|
@ -153,11 +153,10 @@ void arm_setup_romlib(void);
|
|||
#define ARM_LOCAL_PSTATE_WIDTH 4
|
||||
#define ARM_LOCAL_PSTATE_MASK ((1 << ARM_LOCAL_PSTATE_WIDTH) - 1)
|
||||
|
||||
#if PSCI_OS_INIT_MODE
|
||||
/* Last in Level for the OS-initiated */
|
||||
#define ARM_LAST_AT_PLVL_MASK (ARM_LOCAL_PSTATE_MASK << \
|
||||
(ARM_LOCAL_PSTATE_WIDTH * \
|
||||
(PLAT_MAX_PWR_LVL + 1)))
|
||||
#endif /* __PSCI_OS_INIT_MODE__ */
|
||||
|
||||
/* Macros to construct the composite power state */
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2015-2020, ARM Limited and Contributors. All rights reserved.
|
||||
* Copyright (c) 2015-2024, Arm Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
@ -79,12 +79,8 @@ int arm_validate_power_state(unsigned int power_state,
|
|||
* search if the number of entries justify the additional complexity.
|
||||
*/
|
||||
for (i = 0; !!arm_pm_idle_states[i]; i++) {
|
||||
#if PSCI_OS_INIT_MODE
|
||||
if ((power_state & ~ARM_LAST_AT_PLVL_MASK) ==
|
||||
arm_pm_idle_states[i])
|
||||
#else
|
||||
if (power_state == arm_pm_idle_states[i])
|
||||
#endif /* __PSCI_OS_INIT_MODE__ */
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue