mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 22:14:03 +02:00
riscv: Annotate unaligned access init functions
Several functions used in unaligned access probing are only run at
init time. Annotate them appropriately.
Fixes: f413aae96c ("riscv: Set unaligned access speed at compile time")
Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Signed-off-by: Andrew Jones <ajones@ventanamicro.com>
Link: https://lore.kernel.org/r/20250304120014.143628-11-ajones@ventanamicro.com
Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
This commit is contained in:
parent
4701f33a10
commit
a00e022be5
|
|
@ -63,7 +63,7 @@ void __init riscv_user_isa_enable(void);
|
||||||
#define __RISCV_ISA_EXT_SUPERSET_VALIDATE(_name, _id, _sub_exts, _validate) \
|
#define __RISCV_ISA_EXT_SUPERSET_VALIDATE(_name, _id, _sub_exts, _validate) \
|
||||||
_RISCV_ISA_EXT_DATA(_name, _id, _sub_exts, ARRAY_SIZE(_sub_exts), _validate)
|
_RISCV_ISA_EXT_DATA(_name, _id, _sub_exts, ARRAY_SIZE(_sub_exts), _validate)
|
||||||
|
|
||||||
bool check_unaligned_access_emulated_all_cpus(void);
|
bool __init check_unaligned_access_emulated_all_cpus(void);
|
||||||
#if defined(CONFIG_RISCV_SCALAR_MISALIGNED)
|
#if defined(CONFIG_RISCV_SCALAR_MISALIGNED)
|
||||||
void check_unaligned_access_emulated(struct work_struct *work __always_unused);
|
void check_unaligned_access_emulated(struct work_struct *work __always_unused);
|
||||||
void unaligned_emulation_finish(void);
|
void unaligned_emulation_finish(void);
|
||||||
|
|
@ -76,7 +76,7 @@ static inline bool unaligned_ctl_available(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool check_vector_unaligned_access_emulated_all_cpus(void);
|
bool __init check_vector_unaligned_access_emulated_all_cpus(void);
|
||||||
#if defined(CONFIG_RISCV_VECTOR_MISALIGNED)
|
#if defined(CONFIG_RISCV_VECTOR_MISALIGNED)
|
||||||
void check_vector_unaligned_access_emulated(struct work_struct *work __always_unused);
|
void check_vector_unaligned_access_emulated(struct work_struct *work __always_unused);
|
||||||
DECLARE_PER_CPU(long, vector_misaligned_access);
|
DECLARE_PER_CPU(long, vector_misaligned_access);
|
||||||
|
|
|
||||||
|
|
@ -605,7 +605,7 @@ void check_vector_unaligned_access_emulated(struct work_struct *work __always_un
|
||||||
kernel_vector_end();
|
kernel_vector_end();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool check_vector_unaligned_access_emulated_all_cpus(void)
|
bool __init check_vector_unaligned_access_emulated_all_cpus(void)
|
||||||
{
|
{
|
||||||
int cpu;
|
int cpu;
|
||||||
|
|
||||||
|
|
@ -625,7 +625,7 @@ bool check_vector_unaligned_access_emulated_all_cpus(void)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
bool check_vector_unaligned_access_emulated_all_cpus(void)
|
bool __init check_vector_unaligned_access_emulated_all_cpus(void)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -659,7 +659,7 @@ void check_unaligned_access_emulated(struct work_struct *work __always_unused)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool check_unaligned_access_emulated_all_cpus(void)
|
bool __init check_unaligned_access_emulated_all_cpus(void)
|
||||||
{
|
{
|
||||||
int cpu;
|
int cpu;
|
||||||
|
|
||||||
|
|
@ -684,7 +684,7 @@ bool unaligned_ctl_available(void)
|
||||||
return unaligned_ctl;
|
return unaligned_ctl;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
bool check_unaligned_access_emulated_all_cpus(void)
|
bool __init check_unaligned_access_emulated_all_cpus(void)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,7 @@ static int check_unaligned_access(void *param)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void check_unaligned_access_nonboot_cpu(void *param)
|
static void __init check_unaligned_access_nonboot_cpu(void *param)
|
||||||
{
|
{
|
||||||
unsigned int cpu = smp_processor_id();
|
unsigned int cpu = smp_processor_id();
|
||||||
struct page **pages = param;
|
struct page **pages = param;
|
||||||
|
|
@ -175,7 +175,7 @@ static void set_unaligned_access_static_branches(void)
|
||||||
modify_unaligned_access_branches(&fast_and_online, num_online_cpus());
|
modify_unaligned_access_branches(&fast_and_online, num_online_cpus());
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lock_and_set_unaligned_access_static_branch(void)
|
static int __init lock_and_set_unaligned_access_static_branch(void)
|
||||||
{
|
{
|
||||||
cpus_read_lock();
|
cpus_read_lock();
|
||||||
set_unaligned_access_static_branches();
|
set_unaligned_access_static_branches();
|
||||||
|
|
@ -218,7 +218,7 @@ static int riscv_offline_cpu(unsigned int cpu)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Measure unaligned access speed on all CPUs present at boot in parallel. */
|
/* Measure unaligned access speed on all CPUs present at boot in parallel. */
|
||||||
static int check_unaligned_access_speed_all_cpus(void)
|
static int __init check_unaligned_access_speed_all_cpus(void)
|
||||||
{
|
{
|
||||||
unsigned int cpu;
|
unsigned int cpu;
|
||||||
unsigned int cpu_count = num_possible_cpus();
|
unsigned int cpu_count = num_possible_cpus();
|
||||||
|
|
@ -264,7 +264,7 @@ static int check_unaligned_access_speed_all_cpus(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#else /* CONFIG_RISCV_PROBE_UNALIGNED_ACCESS */
|
#else /* CONFIG_RISCV_PROBE_UNALIGNED_ACCESS */
|
||||||
static int check_unaligned_access_speed_all_cpus(void)
|
static int __init check_unaligned_access_speed_all_cpus(void)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -379,7 +379,7 @@ static int riscv_online_cpu_vec(unsigned int cpu)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Measure unaligned access speed on all CPUs present at boot in parallel. */
|
/* Measure unaligned access speed on all CPUs present at boot in parallel. */
|
||||||
static int vec_check_unaligned_access_speed_all_cpus(void *unused __always_unused)
|
static int __init vec_check_unaligned_access_speed_all_cpus(void *unused __always_unused)
|
||||||
{
|
{
|
||||||
schedule_on_each_cpu(check_vector_unaligned_access);
|
schedule_on_each_cpu(check_vector_unaligned_access);
|
||||||
|
|
||||||
|
|
@ -393,13 +393,13 @@ static int vec_check_unaligned_access_speed_all_cpus(void *unused __always_unuse
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#else /* CONFIG_RISCV_PROBE_VECTOR_UNALIGNED_ACCESS */
|
#else /* CONFIG_RISCV_PROBE_VECTOR_UNALIGNED_ACCESS */
|
||||||
static int vec_check_unaligned_access_speed_all_cpus(void *unused __always_unused)
|
static int __init vec_check_unaligned_access_speed_all_cpus(void *unused __always_unused)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int check_unaligned_access_all_cpus(void)
|
static int __init check_unaligned_access_all_cpus(void)
|
||||||
{
|
{
|
||||||
bool all_cpus_emulated, all_cpus_vec_unsupported;
|
bool all_cpus_emulated, all_cpus_vec_unsupported;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user