LoongArch: Adjust VDSO/VSYSCALL for 32BIT/64BIT
Adjust VDSO/VSYSCALL because read_cpu_id() for 32BIT/64BIT are different, and LoongArch32 doesn't support GENERIC_GETTIMEOFDAY now (will be supported in future). Reviewed-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>pull/1354/merge
parent
b15dfdacd9
commit
4cd09f356e
|
|
@ -12,6 +12,8 @@
|
||||||
#include <asm/unistd.h>
|
#include <asm/unistd.h>
|
||||||
#include <asm/vdso/vdso.h>
|
#include <asm/vdso/vdso.h>
|
||||||
|
|
||||||
|
#ifdef CONFIG_GENERIC_GETTIMEOFDAY
|
||||||
|
|
||||||
#define VDSO_HAS_CLOCK_GETRES 1
|
#define VDSO_HAS_CLOCK_GETRES 1
|
||||||
|
|
||||||
static __always_inline long gettimeofday_fallback(
|
static __always_inline long gettimeofday_fallback(
|
||||||
|
|
@ -89,6 +91,8 @@ static inline bool loongarch_vdso_hres_capable(void)
|
||||||
}
|
}
|
||||||
#define __arch_vdso_hres_capable loongarch_vdso_hres_capable
|
#define __arch_vdso_hres_capable loongarch_vdso_hres_capable
|
||||||
|
|
||||||
|
#endif /* CONFIG_GENERIC_GETTIMEOFDAY */
|
||||||
|
|
||||||
#endif /* !__ASSEMBLER__ */
|
#endif /* !__ASSEMBLER__ */
|
||||||
|
|
||||||
#endif /* __ASM_VDSO_GETTIMEOFDAY_H */
|
#endif /* __ASM_VDSO_GETTIMEOFDAY_H */
|
||||||
|
|
|
||||||
|
|
@ -212,7 +212,9 @@ static struct clocksource clocksource_const = {
|
||||||
.read = read_const_counter,
|
.read = read_const_counter,
|
||||||
.mask = CLOCKSOURCE_MASK(64),
|
.mask = CLOCKSOURCE_MASK(64),
|
||||||
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
|
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
|
||||||
|
#ifdef CONFIG_GENERIC_GETTIMEOFDAY
|
||||||
.vdso_clock_mode = VDSO_CLOCKMODE_CPU,
|
.vdso_clock_mode = VDSO_CLOCKMODE_CPU,
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
int __init constant_clocksource_init(void)
|
int __init constant_clocksource_init(void)
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,9 @@
|
||||||
# Include the generic Makefile to check the built vdso.
|
# Include the generic Makefile to check the built vdso.
|
||||||
include $(srctree)/lib/vdso/Makefile.include
|
include $(srctree)/lib/vdso/Makefile.include
|
||||||
|
|
||||||
obj-vdso-y := elf.o vgetcpu.o vgettimeofday.o vgetrandom.o \
|
obj-vdso-y := elf.o vgetcpu.o vgetrandom.o \
|
||||||
vgetrandom-chacha.o sigreturn.o
|
vgetrandom-chacha.o sigreturn.o
|
||||||
|
obj-vdso-$(CONFIG_GENERIC_GETTIMEOFDAY) += vgettimeofday.o
|
||||||
|
|
||||||
# Common compiler flags between ABIs.
|
# Common compiler flags between ABIs.
|
||||||
ccflags-vdso := \
|
ccflags-vdso := \
|
||||||
|
|
@ -16,6 +17,10 @@ ccflags-vdso := \
|
||||||
$(CLANG_FLAGS) \
|
$(CLANG_FLAGS) \
|
||||||
-D__VDSO__
|
-D__VDSO__
|
||||||
|
|
||||||
|
ifdef CONFIG_32BIT
|
||||||
|
ccflags-vdso += -DBUILD_VDSO32
|
||||||
|
endif
|
||||||
|
|
||||||
cflags-vdso := $(ccflags-vdso) \
|
cflags-vdso := $(ccflags-vdso) \
|
||||||
-isystem $(shell $(CC) -print-file-name=include) \
|
-isystem $(shell $(CC) -print-file-name=include) \
|
||||||
$(filter -W%,$(filter-out -Wa$(comma)%,$(KBUILD_CFLAGS))) \
|
$(filter -W%,$(filter-out -Wa$(comma)%,$(KBUILD_CFLAGS))) \
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,6 @@
|
||||||
#include <generated/asm-offsets.h>
|
#include <generated/asm-offsets.h>
|
||||||
#include <vdso/datapage.h>
|
#include <vdso/datapage.h>
|
||||||
|
|
||||||
OUTPUT_FORMAT("elf64-loongarch", "elf64-loongarch", "elf64-loongarch")
|
|
||||||
|
|
||||||
OUTPUT_ARCH(loongarch)
|
OUTPUT_ARCH(loongarch)
|
||||||
|
|
||||||
SECTIONS
|
SECTIONS
|
||||||
|
|
@ -63,9 +61,11 @@ VERSION
|
||||||
LINUX_5.10 {
|
LINUX_5.10 {
|
||||||
global:
|
global:
|
||||||
__vdso_getcpu;
|
__vdso_getcpu;
|
||||||
|
#ifdef CONFIG_GENERIC_GETTIMEOFDAY
|
||||||
__vdso_clock_getres;
|
__vdso_clock_getres;
|
||||||
__vdso_clock_gettime;
|
__vdso_clock_gettime;
|
||||||
__vdso_gettimeofday;
|
__vdso_gettimeofday;
|
||||||
|
#endif
|
||||||
__vdso_getrandom;
|
__vdso_getrandom;
|
||||||
__vdso_rt_sigreturn;
|
__vdso_rt_sigreturn;
|
||||||
local: *;
|
local: *;
|
||||||
|
|
|
||||||
|
|
@ -10,11 +10,19 @@ static __always_inline int read_cpu_id(void)
|
||||||
{
|
{
|
||||||
int cpu_id;
|
int cpu_id;
|
||||||
|
|
||||||
|
#ifdef CONFIG_64BIT
|
||||||
__asm__ __volatile__(
|
__asm__ __volatile__(
|
||||||
" rdtime.d $zero, %0\n"
|
" rdtime.d $zero, %0\n"
|
||||||
: "=r" (cpu_id)
|
: "=r" (cpu_id)
|
||||||
:
|
:
|
||||||
: "memory");
|
: "memory");
|
||||||
|
#else
|
||||||
|
__asm__ __volatile__(
|
||||||
|
" rdtimel.w $zero, %0\n"
|
||||||
|
: "=r" (cpu_id)
|
||||||
|
:
|
||||||
|
: "memory");
|
||||||
|
#endif
|
||||||
|
|
||||||
return cpu_id;
|
return cpu_id;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue