Sammit Joshi 98859b9911 feat(per-cpu): integrate per-cpu framework into BL31/BL32
Integrate per-cpu support into BL31/BL32 by extending the following
areas:

Zero-initialization: Treats per-cpu sections like .bss and clears them
during early C runtime initialization. For platforms that enable
NUMA_AWARE_PER_CPU, invokes a platform hook to zero-initialize
node-specific per-cpu regions.

Cache maintenance: Extends the BL31 exit path to clean dcache lines
covering the per-cpu region, ensuring data written by the primary core
is visible to secondary cores.

tpidr_el3 setup: Initializes tpidr_el3 with the base address of the
current CPU’s per-cpu section. This allows per-cpu framework to
resolve local cpu accesses efficiently.

The percpu_data object is currently stored in tpidr_el3. Since the
per-cpu framework will use tpidr_el3 for this-cpu access, percpu_data
must be migrated to avoid conflict.  This commit moves percpu_data to
the per-cpu framework.

Signed-off-by: Sammit Joshi <sammit.joshi@arm.com>
Signed-off-by: Rohit Mathew <rohit.mathew@arm.com>
Change-Id: Iff0c2e1f8c0ebd25c4bb0b09bfe15dd4fbe20561
2025-11-07 21:59:41 +05:30

38 lines
765 B
C

/*
* Copyright (c) 2014-2025, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <platform_def.h>
#include <lib/cpus/cpu_ops.h>
#include <lib/el3_runtime/cpu_data.h>
#include <lib/per_cpu/per_cpu.h>
#include <plat/common/platform.h>
/* percpu_data space allocation */
PER_CPU_DEFINE(cpu_data_t, percpu_data);
#ifndef __aarch64__
cpu_data_t *_cpu_data(void)
{
return PER_CPU_CUR(percpu_data);
}
#endif
/*
* Initializes the cpu_ops_ptr if not already initialized in cpu_data.
* May only be called after the data cache is enabled.
*/
void cpu_data_init_cpu_ops(void)
{
struct cpu_ops *ops;
if (get_cpu_data(cpu_ops_ptr) == NULL) {
ops = get_cpu_ops_ptr();
set_cpu_data(cpu_ops_ptr, ops);
}
}