perf(bl31): convert cpu_data fetching to C
The assembly routines are opaque to the compiler and it can't inline
them. There is also no requirement for them to be called without a
stack - each of their calls has a stack available. So convert them to C
so that the compiler can do its inlining magic.
On AArch32 we need to be able to call _cpu_data from the entrypoint so
it has to stay as a slight exception.
We can also straighten out the type of the cpu_ops_ptr member so we
don't have to cast it everywhere.
Change-Id: I9c2939a955b396edf26b99ef36318eebeaab13e6
Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
diff --git a/include/lib/el3_runtime/cpu_data.h b/include/lib/el3_runtime/cpu_data.h
index 3dc156a..20a6c39 100644
--- a/include/lib/el3_runtime/cpu_data.h
+++ b/include/lib/el3_runtime/cpu_data.h
@@ -138,7 +138,7 @@
void *cpu_context[CPU_DATA_CONTEXT_NUM];
#endif /* __aarch64__ */
entry_point_info_t *warmboot_ep_info;
- uintptr_t cpu_ops_ptr;
+ struct cpu_ops *cpu_ops_ptr;
struct psci_cpu_data psci_svc_cpu_data;
#if ENABLE_PAUTH
uint64_t apiakey[2];
@@ -196,16 +196,19 @@
assert_cpu_data_pmf_ts0_offset_mismatch);
#endif
-struct cpu_data *_cpu_data_by_index(uint32_t cpu_index);
+static inline cpu_data_t *_cpu_data_by_index(unsigned int cpu_index)
+{
+ return &percpu_data[cpu_index];
+}
#ifdef __aarch64__
/* Return the cpu_data structure for the current CPU. */
-static inline struct cpu_data *_cpu_data(void)
+static inline cpu_data_t *_cpu_data(void)
{
return (cpu_data_t *)read_tpidr_el3();
}
#else
-struct cpu_data *_cpu_data(void);
+cpu_data_t *_cpu_data(void);
#endif
/*