* [PATCH] arm64: arm64_ftr_reg->name may not be a human-readable string
@ 2021-11-01 4:54 Reiji Watanabe
2021-11-01 10:25 ` Marc Zyngier
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Reiji Watanabe @ 2021-11-01 4:54 UTC (permalink / raw)
To: Catalin Marinas, Will Deacon
Cc: Marc Zyngier, linux-arm-kernel, Peter Shier, Ricardo Koller,
Oliver Upton, Jing Zhang, Raghavendra Rao Anata, Reiji Watanabe
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: 8f266a5d878a ("arm64: cpufeature: Add global feature override facility")
Signed-off-by: Reiji Watanabe <reijiw@google.com>
---
arch/arm64/kernel/cpufeature.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
index 6ec7036ef7e1..7553c98f379f 100644
--- a/arch/arm64/kernel/cpufeature.c
+++ b/arch/arm64/kernel/cpufeature.c
@@ -573,15 +573,19 @@ static const struct arm64_ftr_bits ftr_raz[] = {
ARM64_FTR_END,
};
-#define ARM64_FTR_REG_OVERRIDE(id, table, ovr) { \
+#define __ARM64_FTR_REG_OVERRIDE(id_str, id, table, ovr) { \
.sys_id = id, \
.reg = &(struct arm64_ftr_reg){ \
- .name = #id, \
+ .name = id_str, \
.override = (ovr), \
.ftr_bits = &((table)[0]), \
}}
-#define ARM64_FTR_REG(id, table) ARM64_FTR_REG_OVERRIDE(id, table, &no_override)
+#define ARM64_FTR_REG_OVERRIDE(id, table, ovr) \
+ __ARM64_FTR_REG_OVERRIDE(#id, id, table, ovr)
+
+#define ARM64_FTR_REG(id, table) \
+ __ARM64_FTR_REG_OVERRIDE(#id, id, table, &no_override)
struct arm64_ftr_override __ro_after_init id_aa64mmfr1_override;
struct arm64_ftr_override __ro_after_init id_aa64pfr1_override;
--
2.33.1.1089.g2158813163f-goog
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] arm64: arm64_ftr_reg->name may not be a human-readable string
2021-11-01 4:54 [PATCH] arm64: arm64_ftr_reg->name may not be a human-readable string Reiji Watanabe
@ 2021-11-01 10:25 ` Marc Zyngier
2021-11-01 16:59 ` Oliver Upton
2021-11-03 17:08 ` Will Deacon
2 siblings, 0 replies; 4+ messages in thread
From: Marc Zyngier @ 2021-11-01 10:25 UTC (permalink / raw)
To: Reiji Watanabe
Cc: Catalin Marinas, Will Deacon, linux-arm-kernel, Peter Shier,
Ricardo Koller, Oliver Upton, Jing Zhang, Raghavendra Rao Anata
On Mon, 01 Nov 2021 04:54:21 +0000,
Reiji Watanabe <reijiw@google.com> wrote:
>
> 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: 8f266a5d878a ("arm64: cpufeature: Add global feature override facility")
> Signed-off-by: Reiji Watanabe <reijiw@google.com>
> ---
> arch/arm64/kernel/cpufeature.c | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
> index 6ec7036ef7e1..7553c98f379f 100644
> --- a/arch/arm64/kernel/cpufeature.c
> +++ b/arch/arm64/kernel/cpufeature.c
> @@ -573,15 +573,19 @@ static const struct arm64_ftr_bits ftr_raz[] = {
> ARM64_FTR_END,
> };
>
> -#define ARM64_FTR_REG_OVERRIDE(id, table, ovr) { \
> +#define __ARM64_FTR_REG_OVERRIDE(id_str, id, table, ovr) { \
> .sys_id = id, \
> .reg = &(struct arm64_ftr_reg){ \
> - .name = #id, \
> + .name = id_str, \
> .override = (ovr), \
> .ftr_bits = &((table)[0]), \
> }}
>
> -#define ARM64_FTR_REG(id, table) ARM64_FTR_REG_OVERRIDE(id, table, &no_override)
> +#define ARM64_FTR_REG_OVERRIDE(id, table, ovr) \
> + __ARM64_FTR_REG_OVERRIDE(#id, id, table, ovr)
> +
> +#define ARM64_FTR_REG(id, table) \
> + __ARM64_FTR_REG_OVERRIDE(#id, id, table, &no_override)
>
> struct arm64_ftr_override __ro_after_init id_aa64mmfr1_override;
> struct arm64_ftr_override __ro_after_init id_aa64pfr1_override;
Seems reasonable to me.
Acked-by: Marc Zyngier <maz@kernel.org>
M.
--
Without deviation from the norm, progress is not possible.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] arm64: arm64_ftr_reg->name may not be a human-readable string
2021-11-01 4:54 [PATCH] arm64: arm64_ftr_reg->name may not be a human-readable string Reiji Watanabe
2021-11-01 10:25 ` Marc Zyngier
@ 2021-11-01 16:59 ` Oliver Upton
2021-11-03 17:08 ` Will Deacon
2 siblings, 0 replies; 4+ messages in thread
From: Oliver Upton @ 2021-11-01 16:59 UTC (permalink / raw)
To: Reiji Watanabe
Cc: Catalin Marinas, Will Deacon, Marc Zyngier, linux-arm-kernel,
Peter Shier, Ricardo Koller, Jing Zhang, Raghavendra Rao Anata
On Sun, Oct 31, 2021 at 9:54 PM Reiji Watanabe <reijiw@google.com> wrote:
>
> 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: 8f266a5d878a ("arm64: cpufeature: Add global feature override facility")
> Signed-off-by: Reiji Watanabe <reijiw@google.com>
Reviewed-by: Oliver Upton <oupton@google.com>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] arm64: arm64_ftr_reg->name may not be a human-readable string
2021-11-01 4:54 [PATCH] arm64: arm64_ftr_reg->name may not be a human-readable string Reiji Watanabe
2021-11-01 10:25 ` Marc Zyngier
2021-11-01 16:59 ` Oliver Upton
@ 2021-11-03 17:08 ` Will Deacon
2 siblings, 0 replies; 4+ messages in thread
From: Will Deacon @ 2021-11-03 17:08 UTC (permalink / raw)
To: Reiji Watanabe, Catalin Marinas
Cc: kernel-team, Will Deacon, linux-arm-kernel, Marc Zyngier,
Jing Zhang, Raghavendra Rao Anata, Oliver Upton, Ricardo Koller,
Peter Shier
On Sun, 31 Oct 2021 21:54:21 -0700, Reiji Watanabe wrote:
> 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).
>
> [...]
Applied to arm64 (for-next/core), thanks!
[1/1] arm64: arm64_ftr_reg->name may not be a human-readable string
https://git.kernel.org/arm64/c/b0f364414a23
Cheers,
--
Will
https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-11-03 17:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-01 4:54 [PATCH] arm64: arm64_ftr_reg->name may not be a human-readable string Reiji Watanabe
2021-11-01 10:25 ` Marc Zyngier
2021-11-01 16:59 ` Oliver Upton
2021-11-03 17:08 ` Will Deacon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).