mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-13 08:04:27 +00:00
refactor(cpus): directly invoke errata reporter
In all non-trivial cases the CPU specific errata functions already call generic_errata_report, this cuts out the middleman by directly calling generic_errata_report from print_errata_status. The CPU specific errata functions (cpu_ops->errata_func) can now be removed from all cores, and this field can be removed from cpu_ops. Also removes the now unused old errata reporting function and macros. Change-Id: Ie4a4fd60429aca37cf434e79c0ce2992a5ff5d68 Signed-off-by: Ryan Everett <ryan.everett@arm.com>
This commit is contained in:
parent
a3939b1bda
commit
1c20f05c5a
4 changed files with 6 additions and 143 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2023, Arm Limited and Contributors. All rights reserved.
|
||||
* Copyright (c) 2016-2024, Arm Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
@ -130,45 +130,6 @@
|
|||
#endif
|
||||
.endm
|
||||
|
||||
#if REPORT_ERRATA
|
||||
/*
|
||||
* Print status of a CPU errata
|
||||
*
|
||||
* _chosen:
|
||||
* Identifier indicating whether or not a CPU errata has been
|
||||
* compiled in.
|
||||
* _cpu:
|
||||
* Name of the CPU
|
||||
* _id:
|
||||
* Errata identifier
|
||||
* _rev_var:
|
||||
* Register containing the combined value CPU revision and variant
|
||||
* - typically the return value of cpu_get_rev_var
|
||||
*/
|
||||
.macro report_errata _chosen, _cpu, _id, _rev_var=r4
|
||||
/* Stash a string with errata ID */
|
||||
.pushsection .rodata
|
||||
\_cpu\()_errata_\_id\()_str:
|
||||
.asciz "\_id"
|
||||
.popsection
|
||||
|
||||
/* Check whether errata applies */
|
||||
mov r0, \_rev_var
|
||||
bl check_errata_\_id
|
||||
|
||||
.ifeq \_chosen
|
||||
/*
|
||||
* Errata workaround has not been compiled in. If the errata would have
|
||||
* applied had it been compiled in, print its status as missing.
|
||||
*/
|
||||
cmp r0, #0
|
||||
movne r0, #ERRATA_MISSING
|
||||
.endif
|
||||
ldr r1, =\_cpu\()_cpu_str
|
||||
ldr r2, =\_cpu\()_errata_\_id\()_str
|
||||
bl errata_print_msg
|
||||
.endm
|
||||
#endif
|
||||
/*
|
||||
* Helper macro that reads the part number of the current CPU and jumps
|
||||
* to the given label if it matches the CPU MIDR provided.
|
||||
|
|
|
@ -171,49 +171,6 @@
|
|||
\_extra1, \_extra2, \_extra3, 0, \_power_down_ops
|
||||
.endm
|
||||
|
||||
/* TODO can be deleted once all CPUs have been converted */
|
||||
#if REPORT_ERRATA
|
||||
/*
|
||||
* Print status of a CPU errata
|
||||
*
|
||||
* _chosen:
|
||||
* Identifier indicating whether or not a CPU errata has been
|
||||
* compiled in.
|
||||
* _cpu:
|
||||
* Name of the CPU
|
||||
* _id:
|
||||
* Errata identifier
|
||||
* _rev_var:
|
||||
* Register containing the combined value CPU revision and variant
|
||||
* - typically the return value of cpu_get_rev_var
|
||||
*/
|
||||
.macro report_errata _chosen, _cpu, _id, _rev_var=x8
|
||||
/* Stash a string with errata ID */
|
||||
.pushsection .rodata
|
||||
\_cpu\()_errata_\_id\()_str:
|
||||
.asciz "\_id"
|
||||
.popsection
|
||||
|
||||
/* Check whether errata applies */
|
||||
mov x0, \_rev_var
|
||||
/* Shall clobber: x0-x7 */
|
||||
bl check_errata_\_id
|
||||
|
||||
.ifeq \_chosen
|
||||
/*
|
||||
* Errata workaround has not been compiled in. If the errata would have
|
||||
* applied had it been compiled in, print its status as missing.
|
||||
*/
|
||||
cbz x0, 900f
|
||||
mov x0, #ERRATA_MISSING
|
||||
.endif
|
||||
900:
|
||||
adr x1, \_cpu\()_cpu_str
|
||||
adr x2, \_cpu\()_errata_\_id\()_str
|
||||
bl errata_print_msg
|
||||
.endm
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This macro is used on some CPUs to detect if they are vulnerable
|
||||
* to CVE-2017-5715.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2017-2023, Arm Limited and Contributors. All rights reserved.
|
||||
* Copyright (c) 2017-2024, Arm Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
@ -29,7 +29,6 @@
|
|||
#include <lib/cassert.h>
|
||||
|
||||
void print_errata_status(void);
|
||||
void errata_print_msg(unsigned int status, const char *cpu, const char *id);
|
||||
|
||||
/*
|
||||
* NOTE that this structure will be different on AArch32 and AArch64. The
|
||||
|
|
|
@ -67,7 +67,7 @@ void print_errata_status(void) {}
|
|||
* save space. This functionality is only useful on development and platform
|
||||
* bringup builds, when FEATURE_DETECTION should be used anyway
|
||||
*/
|
||||
void __unused generic_errata_report(void)
|
||||
void generic_errata_report(void)
|
||||
{
|
||||
struct cpu_ops *cpu_ops = get_cpu_ops_ptr();
|
||||
struct erratum_entry *entry = cpu_ops->errata_list_start;
|
||||
|
@ -159,70 +159,16 @@ static __unused int errata_needs_reporting(spinlock_t *lock, uint32_t *reported)
|
|||
*/
|
||||
void print_errata_status(void)
|
||||
{
|
||||
struct cpu_ops *cpu_ops;
|
||||
#ifdef IMAGE_BL1
|
||||
/*
|
||||
* BL1 doesn't have per-CPU data. So retrieve the CPU operations
|
||||
* directly.
|
||||
*/
|
||||
cpu_ops = get_cpu_ops_ptr();
|
||||
|
||||
if (cpu_ops->errata_func != NULL) {
|
||||
cpu_ops->errata_func();
|
||||
}
|
||||
generic_errata_report();
|
||||
#else /* IMAGE_BL1 */
|
||||
cpu_ops = (void *) get_cpu_data(cpu_ops_ptr);
|
||||
struct cpu_ops *cpu_ops = (void *) get_cpu_data(cpu_ops_ptr);
|
||||
|
||||
assert(cpu_ops != NULL);
|
||||
|
||||
if (cpu_ops->errata_func == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (errata_needs_reporting(cpu_ops->errata_lock, cpu_ops->errata_reported)) {
|
||||
cpu_ops->errata_func();
|
||||
generic_errata_report();
|
||||
}
|
||||
#endif /* IMAGE_BL1 */
|
||||
}
|
||||
|
||||
/*
|
||||
* Old errata status message printer
|
||||
* TODO: remove once all cpus have been converted to the new printing method
|
||||
*/
|
||||
void __unused errata_print_msg(unsigned int status, const char *cpu, const char *id)
|
||||
{
|
||||
/* Errata status strings */
|
||||
static const char *const errata_status_str[] = {
|
||||
[ERRATA_NOT_APPLIES] = "not applied",
|
||||
[ERRATA_APPLIES] = "applied",
|
||||
[ERRATA_MISSING] = "missing!"
|
||||
};
|
||||
static const char *const __unused bl_str = BL_STRING;
|
||||
const char *msg __unused;
|
||||
|
||||
|
||||
assert(status < ARRAY_SIZE(errata_status_str));
|
||||
assert(cpu != NULL);
|
||||
assert(id != NULL);
|
||||
|
||||
msg = errata_status_str[status];
|
||||
|
||||
switch (status) {
|
||||
case ERRATA_NOT_APPLIES:
|
||||
VERBOSE(ERRATA_FORMAT, bl_str, cpu, id, msg);
|
||||
break;
|
||||
|
||||
case ERRATA_APPLIES:
|
||||
INFO(ERRATA_FORMAT, bl_str, cpu, id, msg);
|
||||
break;
|
||||
|
||||
case ERRATA_MISSING:
|
||||
WARN(ERRATA_FORMAT, bl_str, cpu, id, msg);
|
||||
break;
|
||||
|
||||
default:
|
||||
WARN(ERRATA_FORMAT, bl_str, cpu, id, "unknown");
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif /* !REPORT_ERRATA */
|
||||
|
|
Loading…
Add table
Reference in a new issue