Skip to content

Commit 052e76a

Browse files
fvincenzoRussell King
authored andcommitted
ARM: 8931/1: Add clock_getres entry point
The generic vDSO library provides an implementation of clock_getres() that can be leveraged by each architecture. Add clock_getres() entry point on arm to be on pair with arm64. Signed-off-by: Vincenzo Frascino <[email protected]> Signed-off-by: Russell King <[email protected]>
1 parent 20e2fc4 commit 052e76a

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

arch/arm/include/asm/vdso/gettimeofday.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
#include <asm/unistd.h>
1313
#include <uapi/linux/time.h>
1414

15+
#define VDSO_HAS_CLOCK_GETRES 1
16+
1517
extern struct vdso_data *__get_datapage(void);
1618

1719
static __always_inline int gettimeofday_fallback(
@@ -50,6 +52,24 @@ static __always_inline long clock_gettime_fallback(
5052
return ret;
5153
}
5254

55+
static __always_inline int clock_getres_fallback(
56+
clockid_t _clkid,
57+
struct __kernel_timespec *_ts)
58+
{
59+
register struct __kernel_timespec *ts asm("r1") = _ts;
60+
register clockid_t clkid asm("r0") = _clkid;
61+
register long ret asm ("r0");
62+
register long nr asm("r7") = __NR_clock_getres_time64;
63+
64+
asm volatile(
65+
" swi #0\n"
66+
: "=r" (ret)
67+
: "r" (clkid), "r" (ts), "r" (nr)
68+
: "memory");
69+
70+
return ret;
71+
}
72+
5373
static __always_inline u64 __arch_get_hw_counter(int clock_mode)
5474
{
5575
#ifdef CONFIG_ARM_ARCH_TIMER

arch/arm/vdso/vdso.lds.S

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ VERSION
7171
global:
7272
__vdso_clock_gettime;
7373
__vdso_gettimeofday;
74+
__vdso_clock_getres;
7475
local: *;
7576
};
7677
}

arch/arm/vdso/vgettimeofday.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ int __vdso_gettimeofday(struct __kernel_old_timeval *tv,
1919
return __cvdso_gettimeofday(tv, tz);
2020
}
2121

22+
int __vdso_clock_getres(clockid_t clock_id,
23+
struct old_timespec32 *res)
24+
{
25+
return __cvdso_clock_getres_time32(clock_id, res);
26+
}
27+
2228
/* Avoid unresolved references emitted by GCC */
2329

2430
void __aeabi_unwind_cpp_pr0(void)

0 commit comments

Comments
 (0)