Commit 80151c27 authored by Vijayenthiran Subramaniam's avatar Vijayenthiran Subramaniam
Browse files

plat/arm/sgi: include AFF3 affinity in core position calculation



AFF3 bits of MPIDR corresponds to Chip-Id in Arm multi-chip platforms.
For calculating linear core position of CPU cores from slave chips, AFF3
bits has to be used. Update `plat_arm_calc_core_pos` assembly function
to include AFF3 bits in calculation.

Change-Id: I4af2bd82ab8e31e18bc61de22705a73893954260
Signed-off-by: default avatarVijayenthiran Subramaniam <vijayenthiran.subramaniam@arm.com>
parent e4854153
/* /*
* Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2018-2020, ARM Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
...@@ -18,19 +18,22 @@ ...@@ -18,19 +18,22 @@
* unsigned int plat_arm_calc_core_pos(u_register_t mpidr) * unsigned int plat_arm_calc_core_pos(u_register_t mpidr)
* *
* Helper function to calculate the core position. * Helper function to calculate the core position.
* (ChipId * PLAT_ARM_CLUSTER_COUNT *
* CSS_SGI_MAX_CPUS_PER_CLUSTER * CSS_SGI_MAX_PE_PER_CPU) +
* (ClusterId * CSS_SGI_MAX_CPUS_PER_CLUSTER * CSS_SGI_MAX_PE_PER_CPU) + * (ClusterId * CSS_SGI_MAX_CPUS_PER_CLUSTER * CSS_SGI_MAX_PE_PER_CPU) +
* (CPUId * CSS_SGI_MAX_PE_PER_CPU) + * (CPUId * CSS_SGI_MAX_PE_PER_CPU) +
* ThreadId * ThreadId
* *
* which can be simplified as: * which can be simplified as:
* *
* ((ClusterId * CSS_SGI_MAX_CPUS_PER_CLUSTER + CPUId) * * ((((ChipId * PLAT_ARM_CLUSTER_COUNT) + ClusterId) *
* CSS_SGI_MAX_PE_PER_CPU) + ThreadId * CSS_SGI_MAX_CPUS_PER_CLUSTER) + CPUId) * CSS_SGI_MAX_PE_PER_CPU +
* ThreadId
* ------------------------------------------------------ * ------------------------------------------------------
*/ */
func plat_arm_calc_core_pos func plat_arm_calc_core_pos
mov x3, x0 mov x4, x0
/* /*
* The MT bit in MPIDR is always set for SGI platforms * The MT bit in MPIDR is always set for SGI platforms
...@@ -38,15 +41,18 @@ func plat_arm_calc_core_pos ...@@ -38,15 +41,18 @@ func plat_arm_calc_core_pos
*/ */
/* Extract individual affinity fields from MPIDR */ /* Extract individual affinity fields from MPIDR */
ubfx x0, x3, #MPIDR_AFF0_SHIFT, #MPIDR_AFFINITY_BITS ubfx x0, x4, #MPIDR_AFF0_SHIFT, #MPIDR_AFFINITY_BITS
ubfx x1, x3, #MPIDR_AFF1_SHIFT, #MPIDR_AFFINITY_BITS ubfx x1, x4, #MPIDR_AFF1_SHIFT, #MPIDR_AFFINITY_BITS
ubfx x2, x3, #MPIDR_AFF2_SHIFT, #MPIDR_AFFINITY_BITS ubfx x2, x4, #MPIDR_AFF2_SHIFT, #MPIDR_AFFINITY_BITS
ubfx x3, x4, #MPIDR_AFF3_SHIFT, #MPIDR_AFFINITY_BITS
/* Compute linear position */ /* Compute linear position */
mov x4, #PLAT_ARM_CLUSTER_COUNT
madd x2, x3, x4, x2
mov x4, #CSS_SGI_MAX_CPUS_PER_CLUSTER mov x4, #CSS_SGI_MAX_CPUS_PER_CLUSTER
madd x1, x2, x4, x1 madd x1, x2, x4, x1
mov x5, #CSS_SGI_MAX_PE_PER_CPU mov x4, #CSS_SGI_MAX_PE_PER_CPU
madd x0, x1, x5, x0 madd x0, x1, x4, x0
ret ret
endfunc plat_arm_calc_core_pos endfunc plat_arm_calc_core_pos
......
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