Skip to content

Commit 1317045

Browse files
clementlegerpalmer-dabbelt
authored andcommitted
riscv: misaligned: declare misaligned_access_speed under CONFIG_RISCV_MISALIGNED
While misaligned_access_speed was defined in a file compile with CONFIG_RISCV_MISALIGNED, its definition was under CONFIG_RISCV_SCALAR_MISALIGNED. This resulted in compilation problems when using it in a file compiled with CONFIG_RISCV_MISALIGNED. Move the declaration under CONFIG_RISCV_MISALIGNED so that it can be used unconditionnally when compiled with that config and remove the check for that variable in traps_misaligned.c. Signed-off-by: Clément Léger <[email protected]> Reviewed-by: Charlie Jenkins <[email protected]> Tested-by: Charlie Jenkins <[email protected]> Reviewed-by: Andrew Jones <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent 9f9f6fd commit 1317045

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

arch/riscv/include/asm/cpufeature.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,17 @@ int cpu_online_unaligned_access_init(unsigned int cpu);
7272
#if defined(CONFIG_RISCV_SCALAR_MISALIGNED)
7373
void unaligned_emulation_finish(void);
7474
bool unaligned_ctl_available(void);
75-
DECLARE_PER_CPU(long, misaligned_access_speed);
7675
#else
7776
static inline bool unaligned_ctl_available(void)
7877
{
7978
return false;
8079
}
8180
#endif
8281

82+
#if defined(CONFIG_RISCV_MISALIGNED)
83+
DECLARE_PER_CPU(long, misaligned_access_speed);
84+
#endif
85+
8386
bool __init check_vector_unaligned_access_emulated_all_cpus(void);
8487
#if defined(CONFIG_RISCV_VECTOR_MISALIGNED)
8588
void check_vector_unaligned_access_emulated(struct work_struct *work __always_unused);

arch/riscv/kernel/traps_misaligned.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,9 +369,7 @@ static int handle_scalar_misaligned_load(struct pt_regs *regs)
369369

370370
perf_sw_event(PERF_COUNT_SW_ALIGNMENT_FAULTS, 1, regs, addr);
371371

372-
#ifdef CONFIG_RISCV_PROBE_UNALIGNED_ACCESS
373372
*this_cpu_ptr(&misaligned_access_speed) = RISCV_HWPROBE_MISALIGNED_SCALAR_EMULATED;
374-
#endif
375373

376374
if (!unaligned_enabled)
377375
return -1;

0 commit comments

Comments
 (0)