Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions arch/riscv/include/asm/hwprobe.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,10 @@ static inline bool riscv_hwprobe_pair_cmp(struct riscv_hwprobe *pair,
return pair->value == other_pair->value;
}

#ifdef CONFIG_MMU
void riscv_hwprobe_vdso_sync(__s64 sync_key);
#else
static inline void riscv_hwprobe_vdso_sync(__s64 sync_key) { };
#endif /* CONFIG_MMU */

#endif
16 changes: 16 additions & 0 deletions arch/riscv/kernel/sys_hwprobe.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <asm/vector.h>
#include <asm/vendor_extensions/thead_hwprobe.h>
#include <vdso/vsyscall.h>
#include <vdso/datapage.h>


static void hwprobe_arch_id(struct riscv_hwprobe *pair,
Expand Down Expand Up @@ -500,6 +501,21 @@ static int __init init_hwprobe_vdso_data(void)

arch_initcall_sync(init_hwprobe_vdso_data);

void riscv_hwprobe_vdso_sync(__s64 sync_key)
{
struct vdso_arch_data *avd = vdso_k_arch_data;
struct riscv_hwprobe pair;

pair.key = sync_key;
hwprobe_one_pair(&pair, cpu_online_mask);
/*
* Update vDSO data for the given key.
* Currently for non-ID key updates (e.g. MISALIGNED_VECTOR_PERF),
* so 'homogeneous_cpus' is not re-evaluated here.
*/
avd->all_cpu_hwprobe_values[sync_key] = pair.value;
}

#endif /* CONFIG_MMU */

SYSCALL_DEFINE5(riscv_hwprobe, struct riscv_hwprobe __user *, pairs,
Expand Down
2 changes: 1 addition & 1 deletion arch/riscv/kernel/unaligned_access_speed.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ static void check_vector_unaligned_access(struct work_struct *work __always_unus
static int __init vec_check_unaligned_access_speed_all_cpus(void *unused __always_unused)
{
schedule_on_each_cpu(check_vector_unaligned_access);

riscv_hwprobe_vdso_sync(RISCV_HWPROBE_KEY_MISALIGNED_VECTOR_PERF);
return 0;
}
#else /* CONFIG_RISCV_PROBE_VECTOR_UNALIGNED_ACCESS */
Expand Down