Skip to content

Commit dbb381b

Browse files
committed
Merge tag 'timers-core-2020-03-30' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull timekeeping and timer updates from Thomas Gleixner: "Core: - Consolidation of the vDSO build infrastructure to address the difficulties of cross-builds for ARM64 compat vDSO libraries by restricting the exposure of header content to the vDSO build. This is achieved by splitting out header content into separate headers. which contain only the minimaly required information which is necessary to build the vDSO. These new headers are included from the kernel headers and the vDSO specific files. - Enhancements to the generic vDSO library allowing more fine grained control over the compiled in code, further reducing architecture specific storage and preparing for adopting the generic library by PPC. - Cleanup and consolidation of the exit related code in posix CPU timers. - Small cleanups and enhancements here and there Drivers: - The obligatory new drivers: Ingenic JZ47xx and X1000 TCU support - Correct the clock rate of PIT64b global clock - setup_irq() cleanup - Preparation for PWM and suspend support for the TI DM timer - Expand the fttmr010 driver to support ast2600 systems - The usual small fixes, enhancements and cleanups all over the place" * tag 'timers-core-2020-03-30' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (80 commits) Revert "clocksource/drivers/timer-probe: Avoid creating dead devices" vdso: Fix clocksource.h macro detection um: Fix header inclusion arm64: vdso32: Enable Clang Compilation lib/vdso: Enable common headers arm: vdso: Enable arm to use common headers x86/vdso: Enable x86 to use common headers mips: vdso: Enable mips to use common headers arm64: vdso32: Include common headers in the vdso library arm64: vdso: Include common headers in the vdso library arm64: Introduce asm/vdso/processor.h arm64: vdso32: Code clean up linux/elfnote.h: Replace elf.h with UAPI equivalent scripts: Fix the inclusion order in modpost common: Introduce processor.h linux/ktime.h: Extract common header for vDSO linux/jiffies.h: Extract common header for vDSO linux/time64.h: Extract common header for vDSO linux/time32.h: Extract common header for vDSO linux/time.h: Extract common header for vDSO ...
2 parents 336622e + 4479730 commit dbb381b

File tree

123 files changed

+1289
-927
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+1289
-927
lines changed

Documentation/devicetree/bindings/timer/faraday,fttmr010.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Required properties:
1111
"moxa,moxart-timer", "faraday,fttmr010"
1212
"aspeed,ast2400-timer"
1313
"aspeed,ast2500-timer"
14+
"aspeed,ast2600-timer"
1415

1516
- reg : Should contain registers location and length
1617
- interrupts : Should contain the three timer interrupts usually with

Documentation/devicetree/bindings/timer/ingenic,tcu.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Required properties:
1010
* ingenic,jz4740-tcu
1111
* ingenic,jz4725b-tcu
1212
* ingenic,jz4770-tcu
13+
* ingenic,x1000-tcu
1314
followed by "simple-mfd".
1415
- reg: Should be the offset/length value corresponding to the TCU registers
1516
- clocks: List of phandle & clock specifiers for clocks external to the TCU.

arch/arm/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ config ARM
33
bool
44
default y
55
select ARCH_32BIT_OFF_T
6-
select ARCH_CLOCKSOURCE_DATA
76
select ARCH_HAS_BINFMT_FLAT
87
select ARCH_HAS_DEBUG_VIRTUAL if MMU
98
select ARCH_HAS_DEVMEM_IS_ALLOWED

arch/arm/include/asm/clocksource.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
12
#ifndef _ASM_CLOCKSOURCE_H
23
#define _ASM_CLOCKSOURCE_H
34

4-
struct arch_clocksource_data {
5-
bool vdso_direct; /* Usable for direct VDSO access? */
6-
};
5+
#include <asm/vdso/clocksource.h>
76

8-
#endif
7+
#endif /* _ASM_CLOCKSOURCE_H */

arch/arm/include/asm/cp15.h

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -50,25 +50,7 @@
5050

5151
#ifdef CONFIG_CPU_CP15
5252

53-
#define __ACCESS_CP15(CRn, Op1, CRm, Op2) \
54-
"mrc", "mcr", __stringify(p15, Op1, %0, CRn, CRm, Op2), u32
55-
#define __ACCESS_CP15_64(Op1, CRm) \
56-
"mrrc", "mcrr", __stringify(p15, Op1, %Q0, %R0, CRm), u64
57-
58-
#define __read_sysreg(r, w, c, t) ({ \
59-
t __val; \
60-
asm volatile(r " " c : "=r" (__val)); \
61-
__val; \
62-
})
63-
#define read_sysreg(...) __read_sysreg(__VA_ARGS__)
64-
65-
#define __write_sysreg(v, r, w, c, t) asm volatile(w " " c : : "r" ((t)(v)))
66-
#define write_sysreg(v, ...) __write_sysreg(v, __VA_ARGS__)
67-
68-
#define BPIALL __ACCESS_CP15(c7, 0, c5, 6)
69-
#define ICIALLU __ACCESS_CP15(c7, 0, c5, 0)
70-
71-
#define CNTVCT __ACCESS_CP15_64(1, c14)
53+
#include <asm/vdso/cp15.h>
7254

7355
extern unsigned long cr_alignment; /* defined in entry-armv.S */
7456

arch/arm/include/asm/processor.h

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <asm/ptrace.h>
1515
#include <asm/types.h>
1616
#include <asm/unified.h>
17+
#include <asm/vdso/processor.h>
1718

1819
#ifdef __KERNEL__
1920
#define STACK_TOP ((current->personality & ADDR_LIMIT_32BIT) ? \
@@ -85,16 +86,6 @@ extern void release_thread(struct task_struct *);
8586

8687
unsigned long get_wchan(struct task_struct *p);
8788

88-
#if __LINUX_ARM_ARCH__ == 6 || defined(CONFIG_ARM_ERRATA_754327)
89-
#define cpu_relax() \
90-
do { \
91-
smp_mb(); \
92-
__asm__ __volatile__("nop; nop; nop; nop; nop; nop; nop; nop; nop; nop;"); \
93-
} while (0)
94-
#else
95-
#define cpu_relax() barrier()
96-
#endif
97-
9889
#define task_pt_regs(p) \
9990
((struct pt_regs *)(THREAD_START_SP + task_stack_page(p)) - 1)
10091

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
#ifndef __ASM_VDSOCLOCKSOURCE_H
3+
#define __ASM_VDSOCLOCKSOURCE_H
4+
5+
#define VDSO_ARCH_CLOCKMODES \
6+
VDSO_CLOCKMODE_ARCHTIMER
7+
8+
#endif /* __ASM_VDSOCLOCKSOURCE_H */

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

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/* SPDX-License-Identifier: GPL-2.0-only */
2+
/*
3+
* Copyright (C) 2020 ARM Ltd.
4+
*/
5+
#ifndef __ASM_VDSO_CP15_H
6+
#define __ASM_VDSO_CP15_H
7+
8+
#ifndef __ASSEMBLY__
9+
10+
#ifdef CONFIG_CPU_CP15
11+
12+
#include <linux/stringify.h>
13+
14+
#define __ACCESS_CP15(CRn, Op1, CRm, Op2) \
15+
"mrc", "mcr", __stringify(p15, Op1, %0, CRn, CRm, Op2), u32
16+
#define __ACCESS_CP15_64(Op1, CRm) \
17+
"mrrc", "mcrr", __stringify(p15, Op1, %Q0, %R0, CRm), u64
18+
19+
#define __read_sysreg(r, w, c, t) ({ \
20+
t __val; \
21+
asm volatile(r " " c : "=r" (__val)); \
22+
__val; \
23+
})
24+
#define read_sysreg(...) __read_sysreg(__VA_ARGS__)
25+
26+
#define __write_sysreg(v, r, w, c, t) asm volatile(w " " c : : "r" ((t)(v)))
27+
#define write_sysreg(v, ...) __write_sysreg(v, __VA_ARGS__)
28+
29+
#define BPIALL __ACCESS_CP15(c7, 0, c5, 6)
30+
#define ICIALLU __ACCESS_CP15(c7, 0, c5, 0)
31+
32+
#define CNTVCT __ACCESS_CP15_64(1, c14)
33+
34+
#endif /* CONFIG_CPU_CP15 */
35+
36+
#endif /* __ASSEMBLY__ */
37+
38+
#endif /* __ASM_VDSO_CP15_H */

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

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
#ifndef __ASSEMBLY__
99

10-
#include <asm/barrier.h>
11-
#include <asm/cp15.h>
10+
#include <asm/errno.h>
1211
#include <asm/unistd.h>
12+
#include <asm/vdso/cp15.h>
1313
#include <uapi/linux/time.h>
1414

1515
#define VDSO_HAS_CLOCK_GETRES 1
@@ -106,20 +106,32 @@ static __always_inline int clock_getres32_fallback(
106106
return ret;
107107
}
108108

109+
static inline bool arm_vdso_hres_capable(void)
110+
{
111+
return IS_ENABLED(CONFIG_ARM_ARCH_TIMER);
112+
}
113+
#define __arch_vdso_hres_capable arm_vdso_hres_capable
114+
109115
static __always_inline u64 __arch_get_hw_counter(int clock_mode)
110116
{
111117
#ifdef CONFIG_ARM_ARCH_TIMER
112118
u64 cycle_now;
113119

114-
if (!clock_mode)
115-
return -EINVAL;
120+
/*
121+
* Core checks for mode already, so this raced against a concurrent
122+
* update. Return something. Core will do another round and then
123+
* see the mode change and fallback to the syscall.
124+
*/
125+
if (clock_mode == VDSO_CLOCKMODE_NONE)
126+
return 0;
116127

117128
isb();
118129
cycle_now = read_sysreg(CNTVCT);
119130

120131
return cycle_now;
121132
#else
122-
return -EINVAL; /* use fallback */
133+
/* Make GCC happy. This is compiled out anyway */
134+
return 0;
123135
#endif
124136
}
125137

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/* SPDX-License-Identifier: GPL-2.0-only */
2+
/*
3+
* Copyright (C) 2020 ARM Ltd.
4+
*/
5+
#ifndef __ASM_VDSO_PROCESSOR_H
6+
#define __ASM_VDSO_PROCESSOR_H
7+
8+
#ifndef __ASSEMBLY__
9+
10+
#if __LINUX_ARM_ARCH__ == 6 || defined(CONFIG_ARM_ERRATA_754327)
11+
#define cpu_relax() \
12+
do { \
13+
smp_mb(); \
14+
__asm__ __volatile__("nop; nop; nop; nop; nop; nop; nop; nop; nop; nop;"); \
15+
} while (0)
16+
#else
17+
#define cpu_relax() barrier()
18+
#endif
19+
20+
#endif /* __ASSEMBLY__ */
21+
22+
#endif /* __ASM_VDSO_PROCESSOR_H */

0 commit comments

Comments
 (0)