Skip to content

Commit 368546e

Browse files
SiFiveHollandpalmer-dabbelt
authored andcommitted
riscv: Call riscv_user_isa_enable() only on the boot hart
Now that the [ms]envcfg CSR value is maintained per thread, not per hart, riscv_user_isa_enable() only needs to be called once during boot, to set the value for the init task. This also allows it to be marked as __init. Reviewed-by: Andrew Jones <ajones@ventanamicro.com> Reviewed-by: Conor Dooley <conor.dooley@microchip.com> Reviewed-by: Deepak Gupta <debug@rivosinc.com> Signed-off-by: Samuel Holland <samuel.holland@sifive.com> Reviewed-by: Charlie Jenkins <charlie@rivosinc.com> Link: https://lore.kernel.org/r/20240814081126.956287-4-samuel.holland@sifive.com Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
1 parent 5fc7355 commit 368546e

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

arch/riscv/include/asm/cpufeature.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ DECLARE_PER_CPU(struct riscv_cpuinfo, riscv_cpuinfo);
3131
/* Per-cpu ISA extensions. */
3232
extern struct riscv_isainfo hart_isa[NR_CPUS];
3333

34-
void riscv_user_isa_enable(void);
34+
void __init riscv_user_isa_enable(void);
3535

3636
#define _RISCV_ISA_EXT_DATA(_name, _id, _subset_exts, _subset_exts_size, _validate) { \
3737
.name = #_name, \

arch/riscv/kernel/cpufeature.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -920,12 +920,12 @@ unsigned long riscv_get_elf_hwcap(void)
920920
return hwcap;
921921
}
922922

923-
void riscv_user_isa_enable(void)
923+
void __init riscv_user_isa_enable(void)
924924
{
925925
if (riscv_has_extension_unlikely(RISCV_ISA_EXT_ZICBOZ))
926926
current->thread.envcfg |= ENVCFG_CBZE;
927927
else if (any_cpu_has_zicboz)
928-
pr_warn_once("Zicboz disabled as it is unavailable on some harts\n");
928+
pr_warn("Zicboz disabled as it is unavailable on some harts\n");
929929
}
930930

931931
#ifdef CONFIG_RISCV_ALTERNATIVE

arch/riscv/kernel/smpboot.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,6 @@ asmlinkage __visible void smp_callin(void)
233233
numa_add_cpu(curr_cpuid);
234234
set_cpu_online(curr_cpuid, true);
235235

236-
riscv_user_isa_enable();
237-
238236
/*
239237
* Remote cache and TLB flushes are ignored while the CPU is offline,
240238
* so flush them both right now just in case.

0 commit comments

Comments
 (0)