Eliminate psci_suspend_context array
psci_suspend_context is an array of cache-line aligned structures
containing the single power_state integer per cpu. This array is
the only structure indexed by the aff_map_node.data integer.
This patch saves 2KB of BL3-1 memory by placing the CPU
power_state value directly in the aff_map_node structure. As a
result, this value is now never cached and the cache clean when
writing the value is no longer required.
Fixes ARM-software/tf-issues#195
Change-Id: Ib4c70c8f79eed295ea541e7827977a588a19ef9b
diff --git a/services/std_svc/psci/psci_afflvl_suspend.c b/services/std_svc/psci/psci_afflvl_suspend.c
index f43dced..ea90389 100644
--- a/services/std_svc/psci/psci_afflvl_suspend.c
+++ b/services/std_svc/psci/psci_afflvl_suspend.c
@@ -57,16 +57,11 @@
assert(node->mpidr == (read_mpidr() & MPIDR_AFFINITY_MASK));
assert(node->level == MPIDR_AFFLVL0);
- /* Save PSCI power state parameter for the core in suspend context */
- psci_suspend_context[node->data].power_state = power_state;
-
/*
- * Flush the suspend data to PoC since it will be accessed while
- * returning back from suspend with the caches turned off
+ * Save PSCI power state parameter for the core in suspend context.
+ * The node is in always-coherent RAM so it does not need to be flushed
*/
- flush_dcache_range(
- (unsigned long)&psci_suspend_context[node->data],
- sizeof(suspend_context_t));
+ node->power_state = power_state;
}
/*******************************************************************************
@@ -97,7 +92,7 @@
assert(node->level == MPIDR_AFFLVL0);
- power_state = psci_suspend_context[node->data].power_state;
+ power_state = node->power_state;
return ((power_state == PSCI_INVALID_DATA) ?
power_state : psci_get_pstate_afflvl(power_state));
}
@@ -117,7 +112,7 @@
assert(node);
assert(node->level == MPIDR_AFFLVL0);
- power_state = psci_suspend_context[node->data].power_state;
+ power_state = node->power_state;
return ((power_state == PSCI_INVALID_DATA) ?
power_state : psci_get_pstate_id(power_state));
}