Commit 3063177e authored by Graeme Gregory's avatar Graeme Gregory
Browse files

qemu/aarch64/plat_helpers.S : calculate the position shift



Rather than re-create this file in multiple qemu variants instead
caclulate the shift needed to convert MPIDR to position.

Add a new PLATFORM_CPU_PER_CLUSTER_SHIFT define in platform_def.h
for both qemu and qemu_sbsa to enable this calculation.
Signed-off-by: default avatarGraeme Gregory <graeme@nuviainc.com>
Change-Id: I0e3a86354aa716d95150a3a34b15287cd70c8fd2
parent 337e4933
...@@ -32,7 +32,8 @@ endfunc plat_my_core_pos ...@@ -32,7 +32,8 @@ endfunc plat_my_core_pos
func plat_qemu_calc_core_pos func plat_qemu_calc_core_pos
and x1, x0, #MPIDR_CPU_MASK and x1, x0, #MPIDR_CPU_MASK
and x0, x0, #MPIDR_CLUSTER_MASK and x0, x0, #MPIDR_CLUSTER_MASK
add x0, x1, x0, LSR #6 add x0, x1, x0, LSR #(MPIDR_AFFINITY_BITS -\
PLATFORM_CPU_PER_CLUSTER_SHIFT)
ret ret
endfunc plat_qemu_calc_core_pos endfunc plat_qemu_calc_core_pos
......
...@@ -24,6 +24,14 @@ ...@@ -24,6 +24,14 @@
#define PLATFORM_CLUSTER1_CORE_COUNT U(0) #define PLATFORM_CLUSTER1_CORE_COUNT U(0)
#else #else
#define PLATFORM_MAX_CPUS_PER_CLUSTER U(4) #define PLATFORM_MAX_CPUS_PER_CLUSTER U(4)
/*
* Define the number of cores per cluster used in calculating core position.
* The cluster number is shifted by this value and added to the core ID,
* so its value represents log2(cores/cluster).
* Default is 2**(2) = 4 cores per cluster.
*/
#define PLATFORM_CPU_PER_CLUSTER_SHIFT U(2)
#define PLATFORM_CLUSTER_COUNT U(2) #define PLATFORM_CLUSTER_COUNT U(2)
#define PLATFORM_CLUSTER0_CORE_COUNT PLATFORM_MAX_CPUS_PER_CLUSTER #define PLATFORM_CLUSTER0_CORE_COUNT PLATFORM_MAX_CPUS_PER_CLUSTER
#define PLATFORM_CLUSTER1_CORE_COUNT PLATFORM_MAX_CPUS_PER_CLUSTER #define PLATFORM_CLUSTER1_CORE_COUNT PLATFORM_MAX_CPUS_PER_CLUSTER
......
...@@ -17,6 +17,13 @@ ...@@ -17,6 +17,13 @@
#define PLATFORM_STACK_SIZE 0x1000 #define PLATFORM_STACK_SIZE 0x1000
#define PLATFORM_MAX_CPUS_PER_CLUSTER U(4) #define PLATFORM_MAX_CPUS_PER_CLUSTER U(4)
/*
* Define the number of cores per cluster used in calculating core position.
* The cluster number is shifted by this value and added to the core ID,
* so its value represents log2(cores/cluster).
* Default is 2**(2) = 4 cores per cluster.
*/
#define PLATFORM_CPU_PER_CLUSTER_SHIFT U(2)
#define PLATFORM_CLUSTER_COUNT U(2) #define PLATFORM_CLUSTER_COUNT U(2)
#define PLATFORM_CLUSTER0_CORE_COUNT PLATFORM_MAX_CPUS_PER_CLUSTER #define PLATFORM_CLUSTER0_CORE_COUNT PLATFORM_MAX_CPUS_PER_CLUSTER
#define PLATFORM_CLUSTER1_CORE_COUNT PLATFORM_MAX_CPUS_PER_CLUSTER #define PLATFORM_CLUSTER1_CORE_COUNT PLATFORM_MAX_CPUS_PER_CLUSTER
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment