Skip to content

Commit 78c8516

Browse files
fvincenzoKAGA-KOKO
authored andcommitted
arm: vdso: Enable arm to use common headers
Enable arm to use only the common headers in the implementation of the vDSO library. Signed-off-by: Vincenzo Frascino <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: Russell King <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent abc2241 commit 78c8516

File tree

5 files changed

+64
-31
lines changed

5 files changed

+64
-31
lines changed

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

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: 2 additions & 2 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

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)