2019-06-02 22:44:50 -07:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2017-07-10 18:07:09 -07:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2012 ARM Limited
|
|
|
|
* Copyright (C) 2014 Regents of the University of California
|
|
|
|
* Copyright (C) 2017 SiFive
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _ASM_RISCV_VDSO_H
|
|
|
|
#define _ASM_RISCV_VDSO_H
|
|
|
|
|
2021-08-31 19:46:19 -07:00
|
|
|
/*
|
|
|
|
* All systems with an MMU have a VDSO, but systems without an MMU don't
|
2022-09-24 17:47:57 -07:00
|
|
|
* support shared libraries and therefore don't have one.
|
2021-08-31 19:46:19 -07:00
|
|
|
*/
|
|
|
|
#ifdef CONFIG_MMU
|
2017-07-10 18:07:09 -07:00
|
|
|
|
2021-08-31 20:20:25 -07:00
|
|
|
#define __VVAR_PAGES 2
|
riscv/vdso: Move vdso data page up front
As commit 601255ae3c98 ("arm64: vdso: move data page before code pages"), the
same issue exists on riscv, testcase is shown below, make sure that vdso.so is
bigger than page size,
struct timespec tp;
clock_gettime(5, &tp);
printf("tv_sec: %ld, tv_nsec: %ld\n", tp.tv_sec, tp.tv_nsec);
without this patch, test result : tv_sec: 0, tv_nsec: 0
with this patch, test result : tv_sec: 1629271537, tv_nsec: 748000000
Move the vdso data page in front of the VDSO area to fix the issue.
Fixes: ad5d1122b82fb ("riscv: use vDSO common flow to reduce the latency of the time-related functions")
Signed-off-by: Tong Tiangen <tongtiangen@huawei.com>
Reviewed-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
2021-08-31 19:46:20 -07:00
|
|
|
|
2021-08-31 19:46:19 -07:00
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
#include <generated/vdso-offsets.h>
|
2017-07-10 18:07:09 -07:00
|
|
|
|
|
|
|
#define VDSO_SYMBOL(base, name) \
|
2021-08-04 10:32:14 -07:00
|
|
|
(void __user *)((unsigned long)(base) + __vdso_##name##_offset)
|
2022-04-05 00:13:10 -07:00
|
|
|
|
|
|
|
#ifdef CONFIG_COMPAT
|
|
|
|
#include <generated/compat_vdso-offsets.h>
|
|
|
|
|
|
|
|
#define COMPAT_VDSO_SYMBOL(base, name) \
|
|
|
|
(void __user *)((unsigned long)(base) + compat__vdso_##name##_offset)
|
|
|
|
|
2023-01-28 10:28:53 -07:00
|
|
|
extern char compat_vdso_start[], compat_vdso_end[];
|
|
|
|
|
2022-04-05 00:13:10 -07:00
|
|
|
#endif /* CONFIG_COMPAT */
|
|
|
|
|
2023-01-28 10:28:53 -07:00
|
|
|
extern char vdso_start[], vdso_end[];
|
|
|
|
|
2021-08-31 19:46:19 -07:00
|
|
|
#endif /* !__ASSEMBLY__ */
|
|
|
|
|
|
|
|
#endif /* CONFIG_MMU */
|
2017-10-25 14:32:16 -07:00
|
|
|
|
2017-07-10 18:07:09 -07:00
|
|
|
#endif /* _ASM_RISCV_VDSO_H */
|