aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Thoelke <andrew.thoelke@arm.com>2014-06-20 00:36:14 +0100
committerAndrew Thoelke <andrew.thoelke@arm.com>2014-06-23 14:56:12 +0100
commit6c0b45d1ceb13cb409f8d62d712d6f0c44feab6c (patch)
tree19791165a5a11459b1c176885060f3764d80dc7c
parent13ac44a5c7336657ba7518ea31c66f7e7dd7eea8 (diff)
downloadarm-trusted-firmware-6c0b45d1ceb13cb409f8d62d712d6f0c44feab6c.tar.gz
Correctly dimension the PSCI aff_map_node array
The array of affinity nodes is currently allocated for 32 entries with the PSCI_NUM_AFFS value defined in psci.h. This is not enough for large systems, and will substantially over allocate the array for small systems. This patch introduces an optional platform definition PLATFORM_NUM_AFFS to platform_def.h. If defined this value is used for PSCI_NUM_AFFS, otherwise a value of two times the number of CPU cores is used. The FVP port defines PLATFORM_NUM_AFFS to be 10 which saves nearly 1.5KB of memory. Fixes ARM-software/tf-issues#192 Change-Id: I68e30ac950de88cfbd02982ba882a18fb69c1445
-rw-r--r--docs/porting-guide.md5
-rw-r--r--include/bl31/services/psci.h3
-rw-r--r--plat/fvp/include/platform_def.h2
-rw-r--r--services/std_svc/psci/psci_private.h8
4 files changed, 15 insertions, 3 deletions
diff --git a/docs/porting-guide.md b/docs/porting-guide.md
index d970190..f854af9 100644
--- a/docs/porting-guide.md
+++ b/docs/porting-guide.md
@@ -150,6 +150,11 @@ file is found in [plat/fvp/include/platform_def.h].
Defines the maximum number of CPUs that can be implemented within a cluster
on the platform.
+* **#define : PLATFORM_NUM_AFFS**
+
+ Defines the total number of nodes in the affinity heirarchy at all affinity
+ levels used by the platform.
+
* **#define : PRIMARY_CPU**
Defines the `MPIDR` of the primary CPU on the platform. This value is used
diff --git a/include/bl31/services/psci.h b/include/bl31/services/psci.h
index 887c4ce..77f406d 100644
--- a/include/bl31/services/psci.h
+++ b/include/bl31/services/psci.h
@@ -128,9 +128,6 @@
#define psci_validate_power_state(pstate) (pstate & PSTATE_VALID_MASK)
-/* Number of affinity instances whose state this psci imp. can track */
-#define PSCI_NUM_AFFS 32ull
-
#ifndef __ASSEMBLY__
#include <stdint.h>
diff --git a/plat/fvp/include/platform_def.h b/plat/fvp/include/platform_def.h
index 46a9f24..98d3004 100644
--- a/plat/fvp/include/platform_def.h
+++ b/plat/fvp/include/platform_def.h
@@ -75,6 +75,8 @@
#define PLATFORM_CORE_COUNT (PLATFORM_CLUSTER1_CORE_COUNT + \
PLATFORM_CLUSTER0_CORE_COUNT)
#define PLATFORM_MAX_CPUS_PER_CLUSTER 4
+#define PLATFORM_NUM_AFFS (PLATFORM_CLUSTER_COUNT + \
+ PLATFORM_CORE_COUNT)
#define PRIMARY_CPU 0x0
#define MAX_IO_DEVICES 3
#define MAX_IO_HANDLES 4
diff --git a/services/std_svc/psci/psci_private.h b/services/std_svc/psci/psci_private.h
index 08a4a34..f534087 100644
--- a/services/std_svc/psci/psci_private.h
+++ b/services/std_svc/psci/psci_private.h
@@ -33,8 +33,16 @@
#include <arch.h>
#include <bakery_lock.h>
+#include <platform_def.h> /* for PLATFORM_NUM_AFFS */
#include <psci.h>
+/* Number of affinity instances whose state this psci imp. can track */
+#ifdef PLATFORM_NUM_AFFS
+#define PSCI_NUM_AFFS PLATFORM_NUM_AFFS
+#else
+#define PSCI_NUM_AFFS (2 * PLATFORM_CORE_COUNT)
+#endif
+
/*******************************************************************************
* The following two data structures hold the topology tree which in turn tracks
* the state of the all the affinity instances supported by the platform.