arm64: cpufeature: Fix GCIE field ordering in ftr_id_aa64pfr2
PATCH 1/1 arm64: cpufeature: Fix GCIE field ordering in ftr_id_aa64pfr2
The ftr_id_aa64pfr2[] array must be sorted in descending order of shift value so that the overlap validation in init_cpu_features() works correctly. The GCIE field (bits 15:12, shift=12) was placed last in the array, after MTEFAR (bits 11:8, shift=8) and MTESTOREONLY (bits 7:4, shift=4), causing a spurious warning at boot:
[ 0.000000] SYS_ID_AA64PFR2_EL1 has feature overlap at shift 12 [ 0.000000] WARNING: arch/arm64/kernel/cpufeature.c:989 at init_cpu_features+0x144/0x3d0, CPU#0:
swapper/0
..
[ 0.000000] pc : init_cpu_features+0x144/0x3d0 [ 0.000000] lr : init_cpu_features+0x144/0x3d0 [ 0.000000] sp : ffffc08678f03dc0
...
0.000000] x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffffc08678f14000 [ 0.000000] Call trace: [ 0.000000] init_cpu_features+0x144/0x3d0 (P) [ 0.000000] cpuinfo_store_boot_cpu+0x4c/0x5c [ 0.000000] smp_prepare_boot_cpu+0x28/0x38 [ 0.000000] start_kernel+0x1d4/0x848 [ 0.000000] __primary_switched+0x88/0x90
This is because the overlap check computes (shift + width) > prev_shift, i.e. (12 + 4) > 8, which triggers since GCIE occupies bits above MTEFAR but was listed after it.
Fix the ordering to match the register layout: FPMR(35:32), GCIE(15:12), MTEFAR(11:8), MTESTOREONLY(7:4).
--- arch/arm64/kernel/cpufeature.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kernel/cpufeature.c +1 -1
@@ -328,9 +328,9 @@ static const struct arm64_ftr_bits ftr_id_aa64pfr1[] = {static const struct arm64_ftr_bits ftr_id_aa64pfr2[] = {ARM64_FTR_BITS (FTR_VISIBLE ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64PFR2_EL1_FPMR_SHIFT ,4 ,0 ), +ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64PFR2_EL1_GCIE_SHIFT ,4 ,ID_AA64PFR2_EL1_GCIE_NI ),ARM64_FTR_BITS (FTR_VISIBLE ,FTR_NONSTRICT ,FTR_LOWER_SAFE ,ID_AA64PFR2_EL1_MTEFAR_SHIFT ,4 ,ID_AA64PFR2_EL1_MTEFAR_NI ),ARM64_FTR_BITS (FTR_VISIBLE ,FTR_NONSTRICT ,FTR_LOWER_SAFE ,ID_AA64PFR2_EL1_MTESTOREONLY_SHIFT ,4 ,ID_AA64PFR2_EL1_MTESTOREONLY_NI ), -ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64PFR2_EL1_GCIE_SHIFT ,4 ,ID_AA64PFR2_EL1_GCIE_NI ),ARM64_FTR_END , };
Signature · 1 line
2.53.0
Quoted 30 lines · Mukesh Ojha
The ftr_id_aa64pfr2[] array must be sorted in descending order of shift value so that the overlap validation in
init_cpu_features()works correctly. The GCIE field (bits 15:12, shift=12) was placed last in the array, after MTEFAR (bits 11:8, shift=8) and MTESTOREONLY (bits 7:4, shift=4), causing a spurious warning at boot:[ 0.000000] SYS_ID_AA64PFR2_EL1 has feature overlap at shift 12 [ 0.000000] WARNING: arch/arm64/kernel/cpufeature.c:989 at init_cpu_features+0x144/0x3d0, CPU#0:swapper/0
..[ 0.000000] pc : init_cpu_features+0x144/0x3d0 [ 0.000000] lr : init_cpu_features+0x144/0x3d0 [ 0.000000] sp : ffffc08678f03dc0...
0.000000] x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffffc08678f14000 [ 0.000000] Call trace: [ 0.000000] init_cpu_features+0x144/0x3d0 (P) [ 0.000000] cpuinfo_store_boot_cpu+0x4c/0x5c [ 0.000000] smp_prepare_boot_cpu+0x28/0x38 [ 0.000000] start_kernel+0x1d4/0x848 [ 0.000000] __primary_switched+0x88/0x90This is because the overlap check computes (shift + width) >
prev_shift, i.e. (12 + 4) > 8, which triggers since GCIE occupies bits above MTEFAR but was listed after it.
Quoted 5 lines
Fix the ordering to match the register layout: FPMR(35:32), GCIE(15:12), MTEFAR(11:8), MTESTOREONLY(7:4).
Fixes 899ff451fcee ("KVM: arm64: Advertise ID_AA64PFR2_EL1.GCIE")Signed-off-by Mukesh Ojha <[email protected]>
This was present in next-20260403, identified the following day, a fix proposed in [1], and the fixed commit appeared in next-20260407 (which was the subsequent -next build) as 7e629348df81b.
May I humbly suggest that you check with the latest -next branch before spending time on this sort of things? Two weeks is a pretty long time...
Thanks,
M.
[1] https://lore.kernel.org/all/[email protected]/
Signature · 1 line
Without deviation from the norm, progress is not possible.
Quoted 38 lines · Marc Zyngier
Quoted 30 lines · Mukesh Ojha
The ftr_id_aa64pfr2[] array must be sorted in descending order of shift value so that the overlap validation in
init_cpu_features()works correctly. The GCIE field (bits 15:12, shift=12) was placed last in the array, after MTEFAR (bits 11:8, shift=8) and MTESTOREONLY (bits 7:4, shift=4), causing a spurious warning at boot:[ 0.000000] SYS_ID_AA64PFR2_EL1 has feature overlap at shift 12 [ 0.000000] WARNING: arch/arm64/kernel/cpufeature.c:989 at init_cpu_features+0x144/0x3d0, CPU#0:swapper/0
..[ 0.000000] pc : init_cpu_features+0x144/0x3d0 [ 0.000000] lr : init_cpu_features+0x144/0x3d0 [ 0.000000] sp : ffffc08678f03dc0...
0.000000] x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffffc08678f14000 [ 0.000000] Call trace: [ 0.000000] init_cpu_features+0x144/0x3d0 (P) [ 0.000000] cpuinfo_store_boot_cpu+0x4c/0x5c [ 0.000000] smp_prepare_boot_cpu+0x28/0x38 [ 0.000000] start_kernel+0x1d4/0x848 [ 0.000000] __primary_switched+0x88/0x90This is because the overlap check computes (shift + width) >
prev_shift, i.e. (12 + 4) > 8, which triggers since GCIE occupies bits above MTEFAR but was listed after it.Quoted 5 lines
Fix the ordering to match the register layout: FPMR(35:32), GCIE(15:12), MTEFAR(11:8), MTESTOREONLY(7:4).
Fixes 899ff451fcee ("KVM: arm64: Advertise ID_AA64PFR2_EL1.GCIE")Signed-off-by Mukesh Ojha <[email protected]>
Quoted 7 lines
This was present in next-20260403, identified the following day, a fix proposed in [1], and the fixed commit appeared in next-20260407 (which was the subsequent -next build) as
7e629348df81b.May I humbly suggest that you check with the latest -next branch before spending time on this sort of things? Two weeks is a pretty long time...
Sure, Thank you.
Quoted 9 lines
Thanks,
M.[1] https://lore.kernel.org/all/[email protected]/
Signature · 1 line
Without deviation from the norm, progress is not possible.
Signature · 1 line
-Mukesh Ojha