mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-09-03 12:51:04 +02:00
Merge pull request #227 from soby-mathew/sm/afflvl_fix
Fix CPU_SUSPEND when invoked with affinity level higher than get_max_aff...
This commit is contained in:
commit
02b5678ca5
@ -201,7 +201,7 @@ unsigned long mpidr_set_aff_inst(unsigned long mpidr,
|
|||||||
int psci_check_afflvl_range(int start_afflvl, int end_afflvl)
|
int psci_check_afflvl_range(int start_afflvl, int end_afflvl)
|
||||||
{
|
{
|
||||||
/* Sanity check the parameters passed */
|
/* Sanity check the parameters passed */
|
||||||
if (end_afflvl > MPIDR_MAX_AFFLVL)
|
if (end_afflvl > get_max_afflvl())
|
||||||
return PSCI_E_INVALID_PARAMS;
|
return PSCI_E_INVALID_PARAMS;
|
||||||
|
|
||||||
if (start_afflvl < MPIDR_AFFLVL0)
|
if (start_afflvl < MPIDR_AFFLVL0)
|
||||||
|
@ -86,7 +86,7 @@ int psci_cpu_suspend(unsigned int power_state,
|
|||||||
|
|
||||||
/* Sanity check the requested state */
|
/* Sanity check the requested state */
|
||||||
target_afflvl = psci_get_pstate_afflvl(power_state);
|
target_afflvl = psci_get_pstate_afflvl(power_state);
|
||||||
if (target_afflvl > MPIDR_MAX_AFFLVL)
|
if (target_afflvl > get_max_afflvl())
|
||||||
return PSCI_E_INVALID_PARAMS;
|
return PSCI_E_INVALID_PARAMS;
|
||||||
|
|
||||||
/* Determine the 'state type' in the 'power_state' parameter */
|
/* Determine the 'state type' in the 'power_state' parameter */
|
||||||
|
@ -76,6 +76,11 @@ static int psci_aff_map_get_idx(unsigned long key,
|
|||||||
if (max_idx < min_idx)
|
if (max_idx < min_idx)
|
||||||
return PSCI_E_INVALID_PARAMS;
|
return PSCI_E_INVALID_PARAMS;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Make sure we are within array limits.
|
||||||
|
*/
|
||||||
|
assert(min_idx >= 0 && max_idx < PSCI_NUM_AFFS);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Bisect the array around 'mid' and then recurse into the array chunk
|
* Bisect the array around 'mid' and then recurse into the array chunk
|
||||||
* where the key is likely to be found. The mpidrs in each node in the
|
* where the key is likely to be found. The mpidrs in each node in the
|
||||||
@ -83,6 +88,7 @@ static int psci_aff_map_get_idx(unsigned long key,
|
|||||||
* order which makes the binary search possible.
|
* order which makes the binary search possible.
|
||||||
*/
|
*/
|
||||||
mid = min_idx + ((max_idx - min_idx) >> 1); /* Divide by 2 */
|
mid = min_idx + ((max_idx - min_idx) >> 1); /* Divide by 2 */
|
||||||
|
|
||||||
if (psci_aff_map[mid].mpidr > key)
|
if (psci_aff_map[mid].mpidr > key)
|
||||||
return psci_aff_map_get_idx(key, min_idx, mid - 1);
|
return psci_aff_map_get_idx(key, min_idx, mid - 1);
|
||||||
else if (psci_aff_map[mid].mpidr < key)
|
else if (psci_aff_map[mid].mpidr < key)
|
||||||
@ -95,6 +101,9 @@ aff_map_node_t *psci_get_aff_map_node(unsigned long mpidr, int aff_lvl)
|
|||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
if (aff_lvl > get_max_afflvl())
|
||||||
|
return NULL;
|
||||||
|
|
||||||
/* Right shift the mpidr to the required affinity level */
|
/* Right shift the mpidr to the required affinity level */
|
||||||
mpidr = mpidr_mask_lower_afflvls(mpidr, aff_lvl);
|
mpidr = mpidr_mask_lower_afflvls(mpidr, aff_lvl);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user