Skip to content

Commit 05ee21f

Browse files
jones-drewAlexandre Ghiti
authored andcommitted
riscv: Fix set up of cpu hotplug callbacks
CPU hotplug callbacks should be set up even if we detected all current cpus emulate misaligned accesses, since we want to ensure our expectations of all cpus emulating is maintained. Fixes: 6e5ce7f ("riscv: Decouple emulated unaligned accesses from access speed") Fixes: e7c9d66 ("RISC-V: Report vector unaligned access speed hwprobe") Reviewed-by: Clément Léger <cleger@rivosinc.com> Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com> Signed-off-by: Andrew Jones <ajones@ventanamicro.com> Link: https://lore.kernel.org/r/20250304120014.143628-15-ajones@ventanamicro.com Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
1 parent 813d39b commit 05ee21f

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

arch/riscv/kernel/unaligned_access_speed.c

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -247,13 +247,6 @@ static void __init check_unaligned_access_speed_all_cpus(void)
247247
/* Check core 0. */
248248
smp_call_on_cpu(0, check_unaligned_access, bufs[0], true);
249249

250-
/*
251-
* Setup hotplug callbacks for any new CPUs that come online or go
252-
* offline.
253-
*/
254-
cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, "riscv:online",
255-
riscv_online_cpu, riscv_offline_cpu);
256-
257250
out:
258251
for_each_cpu(cpu, cpu_online_mask) {
259252
if (bufs[cpu])
@@ -383,13 +376,6 @@ static int __init vec_check_unaligned_access_speed_all_cpus(void *unused __alway
383376
{
384377
schedule_on_each_cpu(check_vector_unaligned_access);
385378

386-
/*
387-
* Setup hotplug callbacks for any new CPUs that come online or go
388-
* offline.
389-
*/
390-
cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, "riscv:online",
391-
riscv_online_cpu_vec, NULL);
392-
393379
return 0;
394380
}
395381
#else /* CONFIG_RISCV_PROBE_VECTOR_UNALIGNED_ACCESS */
@@ -415,6 +401,19 @@ static int __init check_unaligned_access_all_cpus(void)
415401
NULL, "vec_check_unaligned_access_speed_all_cpus");
416402
}
417403

404+
/*
405+
* Setup hotplug callbacks for any new CPUs that come online or go
406+
* offline.
407+
*/
408+
#ifdef CONFIG_RISCV_PROBE_UNALIGNED_ACCESS
409+
cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, "riscv:online",
410+
riscv_online_cpu, riscv_offline_cpu);
411+
#endif
412+
#ifdef CONFIG_RISCV_PROBE_VECTOR_UNALIGNED_ACCESS
413+
cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, "riscv:online",
414+
riscv_online_cpu_vec, NULL);
415+
#endif
416+
418417
return 0;
419418
}
420419

0 commit comments

Comments
 (0)