--- arch/riscv/kernel/traps_misaligned.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/arch/riscv/kernel/traps_misaligned.c b/arch/riscv/kernel/traps_misaligned.c index f3ab84bc4632..1449c6a4ac21 100644 --- a/arch/riscv/kernel/traps_misaligned.c +++ b/arch/riscv/kernel/traps_misaligned.c @@ -647,6 +647,10 @@ bool __init check_vector_unaligned_access_emulated_all_cpus(void) } #endif +#ifdef CONFIG_RISCV_SCALAR_MISALIGNED + +static bool unaligned_ctl __read_mostly; + static bool all_cpus_unaligned_scalar_access_emulated(void) { int cpu; @@ -659,10 +663,6 @@ static bool all_cpus_unaligned_scalar_access_emulated(void) return true; } -#ifdef CONFIG_RISCV_SCALAR_MISALIGNED - -static bool unaligned_ctl __read_mostly; - static void check_unaligned_access_emulated(void *arg __always_unused) { int cpu = smp_processor_id(); @@ -716,6 +716,10 @@ bool unaligned_ctl_available(void) return unaligned_ctl; } #else +static bool all_cpus_unaligned_scalar_access_emulated(void) +{ + return false; +} bool __init check_unaligned_access_emulated_all_cpus(void) { return false; -- 2.43.0 - Charlie > > Thanks, > > Clément > > > > > - Charlie > > > >> + RISCV_HWPROBE_MISALIGNED_SCALAR_EMULATED) > >> + return false; > >> + > >> + return true; > >> +} > >> + > >> #ifdef CONFIG_RISCV_SCALAR_MISALIGNED > >> > >> static bool unaligned_ctl __read_mostly; > >> @@ -685,8 +697,6 @@ static int cpu_online_check_unaligned_access_emulated(unsigned int cpu) > >> > >> bool __init check_unaligned_access_emulated_all_cpus(void) > >> { > >> - int cpu; > >> - > >> /* > >> * We can only support PR_UNALIGN controls if all CPUs have misaligned > >> * accesses emulated since tasks requesting such control can run on any > >> @@ -694,10 +704,8 @@ bool __init check_unaligned_access_emulated_all_cpus(void) > >> */ > >> on_each_cpu(check_unaligned_access_emulated, NULL, 1); > >> > >> - for_each_online_cpu(cpu) > >> - if (per_cpu(misaligned_access_speed, cpu) > >> - != RISCV_HWPROBE_MISALIGNED_SCALAR_EMULATED) > >> - return false; > >> + if (!all_cpus_unaligned_scalar_access_emulated()) > >> + return false; > >> > >> unaligned_ctl = true; > >> return true; > >> -- > >> 2.49.0 > >> > >> > >> _______________________________________________ > >> linux-riscv mailing list > >> linux-riscv@xxxxxxxxxxxxxxxxxxx > >> http://lists.infradead.org/mailman/listinfo/linux-riscv >