File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212#include <asm/unistd.h>
1313#include <asm/vdso/vdso.h>
1414
15+ #ifdef CONFIG_GENERIC_GETTIMEOFDAY
16+
1517#define VDSO_HAS_CLOCK_GETRES 1
1618
1719static __always_inline long gettimeofday_fallback (
@@ -89,6 +91,8 @@ static inline bool loongarch_vdso_hres_capable(void)
8991}
9092#define __arch_vdso_hres_capable loongarch_vdso_hres_capable
9193
94+ #endif /* CONFIG_GENERIC_GETTIMEOFDAY */
95+
9296#endif /* !__ASSEMBLER__ */
9397
9498#endif /* __ASM_VDSO_GETTIMEOFDAY_H */
Original file line number Diff line number Diff line change @@ -212,7 +212,9 @@ static struct clocksource clocksource_const = {
212212 .read = read_const_counter ,
213213 .mask = CLOCKSOURCE_MASK (64 ),
214214 .flags = CLOCK_SOURCE_IS_CONTINUOUS ,
215+ #ifdef CONFIG_GENERIC_GETTIMEOFDAY
215216 .vdso_clock_mode = VDSO_CLOCKMODE_CPU ,
217+ #endif
216218};
217219
218220int __init constant_clocksource_init (void )
Original file line number Diff line number Diff line change 44# Include the generic Makefile to check the built vdso.
55include $(srctree ) /lib/vdso/Makefile.include
66
7- obj-vdso-y := elf.o vgetcpu.o vgettimeofday.o vgetrandom.o \
7+ obj-vdso-y := elf.o vgetcpu.o vgetrandom.o \
88 vgetrandom-chacha.o sigreturn.o
9+ obj-vdso-$(CONFIG_GENERIC_GETTIMEOFDAY) += vgettimeofday.o
910
1011# Common compiler flags between ABIs.
1112ccflags-vdso := \
@@ -16,6 +17,10 @@ ccflags-vdso := \
1617 $(CLANG_FLAGS ) \
1718 -D__VDSO__
1819
20+ ifdef CONFIG_32BIT
21+ ccflags-vdso += -DBUILD_VDSO32
22+ endif
23+
1924cflags-vdso := $(ccflags-vdso ) \
2025 -isystem $(shell $(CC ) -print-file-name=include) \
2126 $(filter -W% ,$(filter-out -Wa$(comma ) % ,$(KBUILD_CFLAGS ) ) ) \
Original file line number Diff line number Diff line change 77#include <generated/asm-offsets.h>
88#include <vdso/datapage.h>
99
10- OUTPUT_FORMAT("elf64-loongarch" , "elf64-loongarch" , "elf64-loongarch" )
11-
1210OUTPUT_ARCH(loongarch)
1311
1412SECTIONS
@@ -63,9 +61,11 @@ VERSION
6361 LINUX_5.10 {
6462 global:
6563 __vdso_getcpu;
64+ #ifdef CONFIG_GENERIC_GETTIMEOFDAY
6665 __vdso_clock_getres;
6766 __vdso_clock_gettime;
6867 __vdso_gettimeofday;
68+ #endif
6969 __vdso_getrandom;
7070 __vdso_rt_sigreturn;
7171 local: *;
Original file line number Diff line number Diff line change @@ -10,11 +10,19 @@ static __always_inline int read_cpu_id(void)
1010{
1111 int cpu_id ;
1212
13+ #ifdef CONFIG_64BIT
1314 __asm__ __volatile__(
1415 " rdtime.d $zero, %0\n"
1516 : "=r" (cpu_id )
1617 :
1718 : "memory" );
19+ #else
20+ __asm__ __volatile__(
21+ " rdtimel.w $zero, %0\n"
22+ : "=r" (cpu_id )
23+ :
24+ : "memory" );
25+ #endif
1826
1927 return cpu_id ;
2028}
You can’t perform that action at this time.
0 commit comments