Skip to content

Commit 9dc232a

Browse files
reijiw-kvmwilldeacon
authored andcommitted
arm64: arm64_ftr_reg->name may not be a human-readable string
The id argument of ARM64_FTR_REG_OVERRIDE() is used for two purposes: one as the system register encoding (used for the sys_id field of __ftr_reg_entry), and the other as the register name (stringified and used for the name field of arm64_ftr_reg), which is debug information. The id argument is supposed to be a macro that indicates an encoding of the register (eg. SYS_ID_AA64PFR0_EL1, etc). ARM64_FTR_REG(), which also has the same id argument, uses ARM64_FTR_REG_OVERRIDE() and passes the id to the macro. Since the id argument is completely macro-expanded before it is substituted into a macro body of ARM64_FTR_REG_OVERRIDE(), the stringified id in the body of ARM64_FTR_REG_OVERRIDE is not a human-readable register name, but a string of numeric bitwise operations. Fix this so that human-readable register names are available as debug information. Fixes: 8f266a5 ("arm64: cpufeature: Add global feature override facility") Signed-off-by: Reiji Watanabe <[email protected]> Reviewed-by: Oliver Upton <[email protected]> Acked-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent e635979 commit 9dc232a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

arch/arm64/kernel/cpufeature.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -573,15 +573,19 @@ static const struct arm64_ftr_bits ftr_raz[] = {
573573
ARM64_FTR_END,
574574
};
575575

576-
#define ARM64_FTR_REG_OVERRIDE(id, table, ovr) { \
576+
#define __ARM64_FTR_REG_OVERRIDE(id_str, id, table, ovr) { \
577577
.sys_id = id, \
578578
.reg = &(struct arm64_ftr_reg){ \
579-
.name = #id, \
579+
.name = id_str, \
580580
.override = (ovr), \
581581
.ftr_bits = &((table)[0]), \
582582
}}
583583

584-
#define ARM64_FTR_REG(id, table) ARM64_FTR_REG_OVERRIDE(id, table, &no_override)
584+
#define ARM64_FTR_REG_OVERRIDE(id, table, ovr) \
585+
__ARM64_FTR_REG_OVERRIDE(#id, id, table, ovr)
586+
587+
#define ARM64_FTR_REG(id, table) \
588+
__ARM64_FTR_REG_OVERRIDE(#id, id, table, &no_override)
585589

586590
struct arm64_ftr_override __ro_after_init id_aa64mmfr1_override;
587591
struct arm64_ftr_override __ro_after_init id_aa64pfr1_override;

0 commit comments

Comments
 (0)