diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-06-04 23:27:54 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-06-04 23:27:54 -0400 |
commit | 0bbcce5d1ef3f771a349896f1c7574d20dc6f4bd (patch) | |
tree | 8a26c5f63eac55cbedff506bba22d32f8669fd5c | |
parent | 0ef283d4c7808cb264f904de5e29a0b661747fc4 (diff) | |
parent | e45e778f078efaac085e50366fe06d7b83c8b881 (diff) |
Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull timers and timekeeping updates from Thomas Gleixner:
- Core infrastucture work for Y2038 to address the COMPAT interfaces:
+ Add a new Y2038 safe __kernel_timespec and use it in the core
code
+ Introduce config switches which allow to control the various
compat mechanisms
+ Use the new config switch in the posix timer code to control the
32bit compat syscall implementation.
- Prevent bogus selection of CPU local clocksources which causes an
endless reselection loop
- Remove the extra kthread in the clocksource code which has no value
and just adds another level of indirection
- The usual bunch of trivial updates, cleanups and fixlets all over the
place
- More SPDX conversions
* 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (24 commits)
clocksource/drivers/mxs_timer: Switch to SPDX identifier
clocksource/drivers/timer-imx-tpm: Switch to SPDX identifier
clocksource/drivers/timer-imx-gpt: Switch to SPDX identifier
clocksource/drivers/timer-imx-gpt: Remove outdated file path
clocksource/drivers/arc_timer: Add comments about locking while read GFRC
clocksource/drivers/mips-gic-timer: Add pr_fmt and reword pr_* messages
clocksource/drivers/sprd: Fix Kconfig dependency
clocksource: Move inline keyword to the beginning of function declarations
timer_list: Remove unused function pointer typedef
timers: Adjust a kernel-doc comment
tick: Prefer a lower rating device only if it's CPU local device
clocksource: Remove kthread
time: Change nanosleep to safe __kernel_* types
time: Change types to new y2038 safe __kernel_* types
time: Fix get_timespec64() for y2038 safe compat interfaces
time: Add new y2038 safe __kernel_timespec
posix-timers: Make compat syscalls depend on CONFIG_COMPAT_32BIT_TIME
time: Introduce CONFIG_COMPAT_32BIT_TIME
time: Introduce CONFIG_64BIT_TIME in architectures
compat: Enable compat_get/put_timespec64 always
...
67 files changed, 266 insertions, 270 deletions
diff --git a/arch/Kconfig b/arch/Kconfig index b624634daea6..b695a3e3e922 100644 --- a/arch/Kconfig +++ b/arch/Kconfig | |||
@@ -871,6 +871,21 @@ config OLD_SIGACTION | |||
871 | config COMPAT_OLD_SIGACTION | 871 | config COMPAT_OLD_SIGACTION |
872 | bool | 872 | bool |
873 | 873 | ||
874 | config 64BIT_TIME | ||
875 | def_bool ARCH_HAS_64BIT_TIME | ||
876 | help | ||
877 | This should be selected by all architectures that need to support | ||
878 | new system calls with a 64-bit time_t. This is relevant on all 32-bit | ||
879 | architectures, and 64-bit architectures as part of compat syscall | ||
880 | handling. | ||
881 | |||
882 | config COMPAT_32BIT_TIME | ||
883 | def_bool (!64BIT && 64BIT_TIME) || COMPAT | ||
884 | help | ||
885 | This enables 32 bit time_t support in addition to 64 bit time_t support. | ||
886 | This is relevant on all 32-bit architectures, and 64-bit architectures | ||
887 | as part of compat syscall handling. | ||
888 | |||
874 | config ARCH_NO_COHERENT_DMA_MMAP | 889 | config ARCH_NO_COHERENT_DMA_MMAP |
875 | bool | 890 | bool |
876 | 891 | ||
diff --git a/arch/alpha/include/asm/Kbuild b/arch/alpha/include/asm/Kbuild index 9b68790013e2..0580cb8c84b2 100644 --- a/arch/alpha/include/asm/Kbuild +++ b/arch/alpha/include/asm/Kbuild | |||
@@ -1,6 +1,7 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | 1 | # SPDX-License-Identifier: GPL-2.0 |
2 | 2 | ||
3 | 3 | ||
4 | generic-y += compat.h | ||
4 | generic-y += exec.h | 5 | generic-y += exec.h |
5 | generic-y += export.h | 6 | generic-y += export.h |
6 | generic-y += fb.h | 7 | generic-y += fb.h |
diff --git a/arch/arc/include/asm/Kbuild b/arch/arc/include/asm/Kbuild index bbdcb955e18f..feed50ce89fa 100644 --- a/arch/arc/include/asm/Kbuild +++ b/arch/arc/include/asm/Kbuild | |||
@@ -1,5 +1,6 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | 1 | # SPDX-License-Identifier: GPL-2.0 |
2 | generic-y += bugs.h | 2 | generic-y += bugs.h |
3 | generic-y += compat.h | ||
3 | generic-y += device.h | 4 | generic-y += device.h |
4 | generic-y += div64.h | 5 | generic-y += div64.h |
5 | generic-y += dma-mapping.h | 6 | generic-y += dma-mapping.h |
diff --git a/arch/arm/include/asm/Kbuild b/arch/arm/include/asm/Kbuild index 873e3c189279..1d66db9c9db5 100644 --- a/arch/arm/include/asm/Kbuild +++ b/arch/arm/include/asm/Kbuild | |||
@@ -1,3 +1,4 @@ | |||
1 | generic-y += compat.h | ||
1 | generic-y += current.h | 2 | generic-y += current.h |
2 | generic-y += early_ioremap.h | 3 | generic-y += early_ioremap.h |
3 | generic-y += emergency-restart.h | 4 | generic-y += emergency-restart.h |
diff --git a/arch/arm64/include/asm/compat.h b/arch/arm64/include/asm/compat.h index c00c62e1a4a3..0030f79808b3 100644 --- a/arch/arm64/include/asm/compat.h +++ b/arch/arm64/include/asm/compat.h | |||
@@ -34,7 +34,6 @@ | |||
34 | 34 | ||
35 | typedef u32 compat_size_t; | 35 | typedef u32 compat_size_t; |
36 | typedef s32 compat_ssize_t; | 36 | typedef s32 compat_ssize_t; |
37 | typedef s32 compat_time_t; | ||
38 | typedef s32 compat_clock_t; | 37 | typedef s32 compat_clock_t; |
39 | typedef s32 compat_pid_t; | 38 | typedef s32 compat_pid_t; |
40 | typedef u16 __compat_uid_t; | 39 | typedef u16 __compat_uid_t; |
@@ -66,16 +65,6 @@ typedef u32 compat_ulong_t; | |||
66 | typedef u64 compat_u64; | 65 | typedef u64 compat_u64; |
67 | typedef u32 compat_uptr_t; | 66 | typedef u32 compat_uptr_t; |
68 | 67 | ||
69 | struct compat_timespec { | ||
70 | compat_time_t tv_sec; | ||
71 | s32 tv_nsec; | ||
72 | }; | ||
73 | |||
74 | struct compat_timeval { | ||
75 | compat_time_t tv_sec; | ||
76 | s32 tv_usec; | ||
77 | }; | ||
78 | |||
79 | struct compat_stat { | 68 | struct compat_stat { |
80 | #ifdef __AARCH64EB__ | 69 | #ifdef __AARCH64EB__ |
81 | short st_dev; | 70 | short st_dev; |
diff --git a/arch/arm64/include/asm/stat.h b/arch/arm64/include/asm/stat.h index 15e35598ac40..eab738019707 100644 --- a/arch/arm64/include/asm/stat.h +++ b/arch/arm64/include/asm/stat.h | |||
@@ -20,6 +20,7 @@ | |||
20 | 20 | ||
21 | #ifdef CONFIG_COMPAT | 21 | #ifdef CONFIG_COMPAT |
22 | 22 | ||
23 | #include <linux/compat_time.h> | ||
23 | #include <asm/compat.h> | 24 | #include <asm/compat.h> |
24 | 25 | ||
25 | /* | 26 | /* |
diff --git a/arch/arm64/kernel/hw_breakpoint.c b/arch/arm64/kernel/hw_breakpoint.c index 74bb56f656ef..413dbe530da8 100644 --- a/arch/arm64/kernel/hw_breakpoint.c +++ b/arch/arm64/kernel/hw_breakpoint.c | |||
@@ -30,7 +30,6 @@ | |||
30 | #include <linux/smp.h> | 30 | #include <linux/smp.h> |
31 | #include <linux/uaccess.h> | 31 | #include <linux/uaccess.h> |
32 | 32 | ||
33 | #include <asm/compat.h> | ||
34 | #include <asm/current.h> | 33 | #include <asm/current.h> |
35 | #include <asm/debug-monitors.h> | 34 | #include <asm/debug-monitors.h> |
36 | #include <asm/hw_breakpoint.h> | 35 | #include <asm/hw_breakpoint.h> |
diff --git a/arch/arm64/kernel/perf_regs.c b/arch/arm64/kernel/perf_regs.c index 1d091d048d04..0bbac612146e 100644 --- a/arch/arm64/kernel/perf_regs.c +++ b/arch/arm64/kernel/perf_regs.c | |||
@@ -1,11 +1,11 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | 1 | // SPDX-License-Identifier: GPL-2.0 |
2 | #include <linux/compat.h> | ||
2 | #include <linux/errno.h> | 3 | #include <linux/errno.h> |
3 | #include <linux/kernel.h> | 4 | #include <linux/kernel.h> |
4 | #include <linux/perf_event.h> | 5 | #include <linux/perf_event.h> |
5 | #include <linux/bug.h> | 6 | #include <linux/bug.h> |
6 | #include <linux/sched/task_stack.h> | 7 | #include <linux/sched/task_stack.h> |
7 | 8 | ||
8 | #include <asm/compat.h> | ||
9 | #include <asm/perf_regs.h> | 9 | #include <asm/perf_regs.h> |
10 | #include <asm/ptrace.h> | 10 | #include <asm/ptrace.h> |
11 | 11 | ||
diff --git a/arch/c6x/include/asm/Kbuild b/arch/c6x/include/asm/Kbuild index 434600e47662..33a2c94fed0d 100644 --- a/arch/c6x/include/asm/Kbuild +++ b/arch/c6x/include/asm/Kbuild | |||
@@ -1,6 +1,7 @@ | |||
1 | generic-y += atomic.h | 1 | generic-y += atomic.h |
2 | generic-y += barrier.h | 2 | generic-y += barrier.h |
3 | generic-y += bugs.h | 3 | generic-y += bugs.h |
4 | generic-y += compat.h | ||
4 | generic-y += current.h | 5 | generic-y += current.h |
5 | generic-y += device.h | 6 | generic-y += device.h |
6 | generic-y += div64.h | 7 | generic-y += div64.h |
diff --git a/arch/h8300/include/asm/Kbuild b/arch/h8300/include/asm/Kbuild index 14bac06b7116..a5d0b2991f47 100644 --- a/arch/h8300/include/asm/Kbuild +++ b/arch/h8300/include/asm/Kbuild | |||
@@ -3,6 +3,7 @@ generic-y += barrier.h | |||
3 | generic-y += bugs.h | 3 | generic-y += bugs.h |
4 | generic-y += cacheflush.h | 4 | generic-y += cacheflush.h |
5 | generic-y += checksum.h | 5 | generic-y += checksum.h |
6 | generic-y += compat.h | ||
6 | generic-y += current.h | 7 | generic-y += current.h |
7 | generic-y += delay.h | 8 | generic-y += delay.h |
8 | generic-y += device.h | 9 | generic-y += device.h |
diff --git a/arch/hexagon/include/asm/Kbuild b/arch/hexagon/include/asm/Kbuild index e9743f689fb8..dd2fd9c0d292 100644 --- a/arch/hexagon/include/asm/Kbuild +++ b/arch/hexagon/include/asm/Kbuild | |||
@@ -2,6 +2,7 @@ | |||
2 | generic-y += barrier.h | 2 | generic-y += barrier.h |
3 | generic-y += bug.h | 3 | generic-y += bug.h |
4 | generic-y += bugs.h | 4 | generic-y += bugs.h |
5 | generic-y += compat.h | ||
5 | generic-y += current.h | 6 | generic-y += current.h |
6 | generic-y += device.h | 7 | generic-y += device.h |
7 | generic-y += div64.h | 8 | generic-y += div64.h |
diff --git a/arch/ia64/include/asm/Kbuild b/arch/ia64/include/asm/Kbuild index 6dd867873364..557bbc8ba9f5 100644 --- a/arch/ia64/include/asm/Kbuild +++ b/arch/ia64/include/asm/Kbuild | |||
@@ -1,3 +1,4 @@ | |||
1 | generic-y += compat.h | ||
1 | generic-y += exec.h | 2 | generic-y += exec.h |
2 | generic-y += irq_work.h | 3 | generic-y += irq_work.h |
3 | generic-y += mcs_spinlock.h | 4 | generic-y += mcs_spinlock.h |
diff --git a/arch/m68k/include/asm/Kbuild b/arch/m68k/include/asm/Kbuild index 88a9d27df1ac..4d8d68c4e3dd 100644 --- a/arch/m68k/include/asm/Kbuild +++ b/arch/m68k/include/asm/Kbuild | |||
@@ -1,4 +1,5 @@ | |||
1 | generic-y += barrier.h | 1 | generic-y += barrier.h |
2 | generic-y += compat.h | ||
2 | generic-y += device.h | 3 | generic-y += device.h |
3 | generic-y += emergency-restart.h | 4 | generic-y += emergency-restart.h |
4 | generic-y += exec.h | 5 | generic-y += exec.h |
diff --git a/arch/microblaze/include/asm/Kbuild b/arch/microblaze/include/asm/Kbuild index 3c80a5a308ed..fe6a6c6e5003 100644 --- a/arch/microblaze/include/asm/Kbuild +++ b/arch/microblaze/include/asm/Kbuild | |||
@@ -2,6 +2,7 @@ generic-y += barrier.h | |||
2 | generic-y += bitops.h | 2 | generic-y += bitops.h |
3 | generic-y += bug.h | 3 | generic-y += bug.h |
4 | generic-y += bugs.h | 4 | generic-y += bugs.h |
5 | generic-y += compat.h | ||
5 | generic-y += device.h | 6 | generic-y += device.h |
6 | generic-y += div64.h | 7 | generic-y += div64.h |
7 | generic-y += emergency-restart.h | 8 | generic-y += emergency-restart.h |
diff --git a/arch/mips/include/asm/compat.h b/arch/mips/include/asm/compat.h index 9a0fa66b81ac..3e548ee99a2f 100644 --- a/arch/mips/include/asm/compat.h +++ b/arch/mips/include/asm/compat.h | |||
@@ -14,7 +14,6 @@ | |||
14 | 14 | ||
15 | typedef u32 compat_size_t; | 15 | typedef u32 compat_size_t; |
16 | typedef s32 compat_ssize_t; | 16 | typedef s32 compat_ssize_t; |
17 | typedef s32 compat_time_t; | ||
18 | typedef s32 compat_clock_t; | 17 | typedef s32 compat_clock_t; |
19 | typedef s32 compat_suseconds_t; | 18 | typedef s32 compat_suseconds_t; |
20 | 19 | ||
@@ -46,16 +45,6 @@ typedef u32 compat_ulong_t; | |||
46 | typedef u64 compat_u64; | 45 | typedef u64 compat_u64; |
47 | typedef u32 compat_uptr_t; | 46 | typedef u32 compat_uptr_t; |
48 | 47 | ||
49 | struct compat_timespec { | ||
50 | compat_time_t tv_sec; | ||
51 | s32 tv_nsec; | ||
52 | }; | ||
53 | |||
54 | struct compat_timeval { | ||
55 | compat_time_t tv_sec; | ||
56 | s32 tv_usec; | ||
57 | }; | ||
58 | |||
59 | struct compat_stat { | 48 | struct compat_stat { |
60 | compat_dev_t st_dev; | 49 | compat_dev_t st_dev; |
61 | s32 st_pad1[3]; | 50 | s32 st_pad1[3]; |
diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c index c4db910a8794..b5d9e1784aff 100644 --- a/arch/mips/kernel/signal32.c +++ b/arch/mips/kernel/signal32.c | |||
@@ -8,13 +8,13 @@ | |||
8 | * Copyright (C) 1999, 2000 Silicon Graphics, Inc. | 8 | * Copyright (C) 1999, 2000 Silicon Graphics, Inc. |
9 | * Copyright (C) 2016, Imagination Technologies Ltd. | 9 | * Copyright (C) 2016, Imagination Technologies Ltd. |
10 | */ | 10 | */ |
11 | #include <linux/compat.h> | ||
11 | #include <linux/compiler.h> | 12 | #include <linux/compiler.h> |
12 | #include <linux/errno.h> | 13 | #include <linux/errno.h> |
13 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
14 | #include <linux/signal.h> | 15 | #include <linux/signal.h> |
15 | #include <linux/syscalls.h> | 16 | #include <linux/syscalls.h> |
16 | 17 | ||
17 | #include <asm/compat.h> | ||
18 | #include <asm/compat-signal.h> | 18 | #include <asm/compat-signal.h> |
19 | #include <linux/uaccess.h> | 19 | #include <linux/uaccess.h> |
20 | #include <asm/unistd.h> | 20 | #include <asm/unistd.h> |
diff --git a/arch/nds32/include/asm/Kbuild b/arch/nds32/include/asm/Kbuild index 6f5cc29ed07f..dbc4e5422550 100644 --- a/arch/nds32/include/asm/Kbuild +++ b/arch/nds32/include/asm/Kbuild | |||
@@ -9,6 +9,7 @@ generic-y += checksum.h | |||
9 | generic-y += clkdev.h | 9 | generic-y += clkdev.h |
10 | generic-y += cmpxchg.h | 10 | generic-y += cmpxchg.h |
11 | generic-y += cmpxchg-local.h | 11 | generic-y += cmpxchg-local.h |
12 | generic-y += compat.h | ||
12 | generic-y += cputime.h | 13 | generic-y += cputime.h |
13 | generic-y += device.h | 14 | generic-y += device.h |
14 | generic-y += div64.h | 15 | generic-y += div64.h |
diff --git a/arch/nios2/include/asm/Kbuild b/arch/nios2/include/asm/Kbuild index d232da2cbb38..64ed3d656956 100644 --- a/arch/nios2/include/asm/Kbuild +++ b/arch/nios2/include/asm/Kbuild | |||
@@ -4,6 +4,7 @@ generic-y += bitops.h | |||
4 | generic-y += bug.h | 4 | generic-y += bug.h |
5 | generic-y += bugs.h | 5 | generic-y += bugs.h |
6 | generic-y += cmpxchg.h | 6 | generic-y += cmpxchg.h |
7 | generic-y += compat.h | ||
7 | generic-y += current.h | 8 | generic-y += current.h |
8 | generic-y += device.h | 9 | generic-y += device.h |
9 | generic-y += div64.h | 10 | generic-y += div64.h |
diff --git a/arch/openrisc/include/asm/Kbuild b/arch/openrisc/include/asm/Kbuild index f05c722a21f8..65964d390b10 100644 --- a/arch/openrisc/include/asm/Kbuild +++ b/arch/openrisc/include/asm/Kbuild | |||
@@ -2,6 +2,7 @@ generic-y += barrier.h | |||
2 | generic-y += bug.h | 2 | generic-y += bug.h |
3 | generic-y += bugs.h | 3 | generic-y += bugs.h |
4 | generic-y += checksum.h | 4 | generic-y += checksum.h |
5 | generic-y += compat.h | ||
5 | generic-y += current.h | 6 | generic-y += current.h |
6 | generic-y += device.h | 7 | generic-y += device.h |
7 | generic-y += div64.h | 8 | generic-y += div64.h |
diff --git a/arch/parisc/include/asm/compat.h b/arch/parisc/include/asm/compat.h index 57b8b2a2fd4e..0cdfec8857bd 100644 --- a/arch/parisc/include/asm/compat.h +++ b/arch/parisc/include/asm/compat.h | |||
@@ -13,7 +13,6 @@ | |||
13 | 13 | ||
14 | typedef u32 compat_size_t; | 14 | typedef u32 compat_size_t; |
15 | typedef s32 compat_ssize_t; | 15 | typedef s32 compat_ssize_t; |
16 | typedef s32 compat_time_t; | ||
17 | typedef s32 compat_clock_t; | 16 | typedef s32 compat_clock_t; |
18 | typedef s32 compat_pid_t; | 17 | typedef s32 compat_pid_t; |
19 | typedef u32 __compat_uid_t; | 18 | typedef u32 __compat_uid_t; |
@@ -40,16 +39,6 @@ typedef u32 compat_ulong_t; | |||
40 | typedef u64 compat_u64; | 39 | typedef u64 compat_u64; |
41 | typedef u32 compat_uptr_t; | 40 | typedef u32 compat_uptr_t; |
42 | 41 | ||
43 | struct compat_timespec { | ||
44 | compat_time_t tv_sec; | ||
45 | s32 tv_nsec; | ||
46 | }; | ||
47 | |||
48 | struct compat_timeval { | ||
49 | compat_time_t tv_sec; | ||
50 | s32 tv_usec; | ||
51 | }; | ||
52 | |||
53 | struct compat_stat { | 42 | struct compat_stat { |
54 | compat_dev_t st_dev; /* dev_t is 32 bits on parisc */ | 43 | compat_dev_t st_dev; /* dev_t is 32 bits on parisc */ |
55 | compat_ino_t st_ino; /* 32 bits */ | 44 | compat_ino_t st_ino; /* 32 bits */ |
diff --git a/arch/powerpc/include/asm/compat.h b/arch/powerpc/include/asm/compat.h index 62168e1158f1..b4773c81f7d5 100644 --- a/arch/powerpc/include/asm/compat.h +++ b/arch/powerpc/include/asm/compat.h | |||
@@ -17,7 +17,6 @@ | |||
17 | 17 | ||
18 | typedef u32 compat_size_t; | 18 | typedef u32 compat_size_t; |
19 | typedef s32 compat_ssize_t; | 19 | typedef s32 compat_ssize_t; |
20 | typedef s32 compat_time_t; | ||
21 | typedef s32 compat_clock_t; | 20 | typedef s32 compat_clock_t; |
22 | typedef s32 compat_pid_t; | 21 | typedef s32 compat_pid_t; |
23 | typedef u32 __compat_uid_t; | 22 | typedef u32 __compat_uid_t; |
@@ -45,16 +44,6 @@ typedef u32 compat_ulong_t; | |||
45 | typedef u64 compat_u64; | 44 | typedef u64 compat_u64; |
46 | typedef u32 compat_uptr_t; | 45 | typedef u32 compat_uptr_t; |
47 | 46 | ||
48 | struct compat_timespec { | ||
49 | compat_time_t tv_sec; | ||
50 | s32 tv_nsec; | ||
51 | }; | ||
52 | |||
53 | struct compat_timeval { | ||
54 | compat_time_t tv_sec; | ||
55 | s32 tv_usec; | ||
56 | }; | ||
57 | |||
58 | struct compat_stat { | 47 | struct compat_stat { |
59 | compat_dev_t st_dev; | 48 | compat_dev_t st_dev; |
60 | compat_ino_t st_ino; | 49 | compat_ino_t st_ino; |
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c index 373dc1d6ef44..8817c5a6bcc2 100644 --- a/arch/powerpc/kernel/asm-offsets.c +++ b/arch/powerpc/kernel/asm-offsets.c | |||
@@ -13,6 +13,7 @@ | |||
13 | * 2 of the License, or (at your option) any later version. | 13 | * 2 of the License, or (at your option) any later version. |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <linux/compat.h> | ||
16 | #include <linux/signal.h> | 17 | #include <linux/signal.h> |
17 | #include <linux/sched.h> | 18 | #include <linux/sched.h> |
18 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
@@ -42,7 +43,6 @@ | |||
42 | #include <asm/paca.h> | 43 | #include <asm/paca.h> |
43 | #include <asm/lppaca.h> | 44 | #include <asm/lppaca.h> |
44 | #include <asm/cache.h> | 45 | #include <asm/cache.h> |
45 | #include <asm/compat.h> | ||
46 | #include <asm/mmu.h> | 46 | #include <asm/mmu.h> |
47 | #include <asm/hvcall.h> | 47 | #include <asm/hvcall.h> |
48 | #include <asm/xics.h> | 48 | #include <asm/xics.h> |
diff --git a/arch/powerpc/oprofile/backtrace.c b/arch/powerpc/oprofile/backtrace.c index ecc66d5f02c9..ad054dd0d666 100644 --- a/arch/powerpc/oprofile/backtrace.c +++ b/arch/powerpc/oprofile/backtrace.c | |||
@@ -7,6 +7,7 @@ | |||
7 | * 2 of the License, or (at your option) any later version. | 7 | * 2 of the License, or (at your option) any later version. |
8 | **/ | 8 | **/ |
9 | 9 | ||
10 | #include <linux/compat_time.h> | ||
10 | #include <linux/oprofile.h> | 11 | #include <linux/oprofile.h> |
11 | #include <linux/sched.h> | 12 | #include <linux/sched.h> |
12 | #include <asm/processor.h> | 13 | #include <asm/processor.h> |
diff --git a/arch/s390/hypfs/hypfs_sprp.c b/arch/s390/hypfs/hypfs_sprp.c index ae0ed8dd5f1b..5d85a039391c 100644 --- a/arch/s390/hypfs/hypfs_sprp.c +++ b/arch/s390/hypfs/hypfs_sprp.c | |||
@@ -13,7 +13,6 @@ | |||
13 | #include <linux/string.h> | 13 | #include <linux/string.h> |
14 | #include <linux/types.h> | 14 | #include <linux/types.h> |
15 | #include <linux/uaccess.h> | 15 | #include <linux/uaccess.h> |
16 | #include <asm/compat.h> | ||
17 | #include <asm/diag.h> | 16 | #include <asm/diag.h> |
18 | #include <asm/sclp.h> | 17 | #include <asm/sclp.h> |
19 | #include "hypfs.h" | 18 | #include "hypfs.h" |
diff --git a/arch/s390/include/asm/compat.h b/arch/s390/include/asm/compat.h index 9830fb6b076e..501aaff85304 100644 --- a/arch/s390/include/asm/compat.h +++ b/arch/s390/include/asm/compat.h | |||
@@ -53,7 +53,6 @@ | |||
53 | 53 | ||
54 | typedef u32 compat_size_t; | 54 | typedef u32 compat_size_t; |
55 | typedef s32 compat_ssize_t; | 55 | typedef s32 compat_ssize_t; |
56 | typedef s32 compat_time_t; | ||
57 | typedef s32 compat_clock_t; | 56 | typedef s32 compat_clock_t; |
58 | typedef s32 compat_pid_t; | 57 | typedef s32 compat_pid_t; |
59 | typedef u16 __compat_uid_t; | 58 | typedef u16 __compat_uid_t; |
@@ -97,16 +96,6 @@ typedef struct { | |||
97 | u32 gprs_high[NUM_GPRS]; | 96 | u32 gprs_high[NUM_GPRS]; |
98 | } s390_compat_regs_high; | 97 | } s390_compat_regs_high; |
99 | 98 | ||
100 | struct compat_timespec { | ||
101 | compat_time_t tv_sec; | ||
102 | s32 tv_nsec; | ||
103 | }; | ||
104 | |||
105 | struct compat_timeval { | ||
106 | compat_time_t tv_sec; | ||
107 | s32 tv_usec; | ||
108 | }; | ||
109 | |||
110 | struct compat_stat { | 99 | struct compat_stat { |
111 | compat_dev_t st_dev; | 100 | compat_dev_t st_dev; |
112 | u16 __pad1; | 101 | u16 __pad1; |
diff --git a/arch/s390/include/asm/elf.h b/arch/s390/include/asm/elf.h index 1a61b1b997f2..7d22a474a040 100644 --- a/arch/s390/include/asm/elf.h +++ b/arch/s390/include/asm/elf.h | |||
@@ -125,8 +125,9 @@ | |||
125 | * ELF register definitions.. | 125 | * ELF register definitions.. |
126 | */ | 126 | */ |
127 | 127 | ||
128 | #include <linux/compat.h> | ||
129 | |||
128 | #include <asm/ptrace.h> | 130 | #include <asm/ptrace.h> |
129 | #include <asm/compat.h> | ||
130 | #include <asm/syscall.h> | 131 | #include <asm/syscall.h> |
131 | #include <asm/user.h> | 132 | #include <asm/user.h> |
132 | 133 | ||
@@ -136,7 +137,6 @@ typedef s390_regs elf_gregset_t; | |||
136 | typedef s390_fp_regs compat_elf_fpregset_t; | 137 | typedef s390_fp_regs compat_elf_fpregset_t; |
137 | typedef s390_compat_regs compat_elf_gregset_t; | 138 | typedef s390_compat_regs compat_elf_gregset_t; |
138 | 139 | ||
139 | #include <linux/compat.h> | ||
140 | #include <linux/sched/mm.h> /* for task_struct */ | 140 | #include <linux/sched/mm.h> /* for task_struct */ |
141 | #include <asm/mmu_context.h> | 141 | #include <asm/mmu_context.h> |
142 | 142 | ||
diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c index ebfa0442e569..a3bce0e84346 100644 --- a/arch/s390/kvm/priv.c +++ b/arch/s390/kvm/priv.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <asm/gmap.h> | 26 | #include <asm/gmap.h> |
27 | #include <asm/io.h> | 27 | #include <asm/io.h> |
28 | #include <asm/ptrace.h> | 28 | #include <asm/ptrace.h> |
29 | #include <asm/compat.h> | ||
30 | #include <asm/sclp.h> | 29 | #include <asm/sclp.h> |
31 | #include "gaccess.h" | 30 | #include "gaccess.h" |
32 | #include "kvm-s390.h" | 31 | #include "kvm-s390.h" |
diff --git a/arch/s390/pci/pci_clp.c b/arch/s390/pci/pci_clp.c index 93cd0f1ca12b..19b2d2a9b43d 100644 --- a/arch/s390/pci/pci_clp.c +++ b/arch/s390/pci/pci_clp.c | |||
@@ -19,7 +19,6 @@ | |||
19 | #include <linux/uaccess.h> | 19 | #include <linux/uaccess.h> |
20 | #include <asm/pci_debug.h> | 20 | #include <asm/pci_debug.h> |
21 | #include <asm/pci_clp.h> | 21 | #include <asm/pci_clp.h> |
22 | #include <asm/compat.h> | ||
23 | #include <asm/clp.h> | 22 | #include <asm/clp.h> |
24 | #include <uapi/asm/clp.h> | 23 | #include <uapi/asm/clp.h> |
25 | 24 | ||
diff --git a/arch/sh/include/asm/Kbuild b/arch/sh/include/asm/Kbuild index 1efcce74997b..46dd82ab2c29 100644 --- a/arch/sh/include/asm/Kbuild +++ b/arch/sh/include/asm/Kbuild | |||
@@ -1,3 +1,4 @@ | |||
1 | generic-y += compat.h | ||
1 | generic-y += current.h | 2 | generic-y += current.h |
2 | generic-y += delay.h | 3 | generic-y += delay.h |
3 | generic-y += div64.h | 4 | generic-y += div64.h |
diff --git a/arch/sparc/include/asm/compat.h b/arch/sparc/include/asm/compat.h index 615283e16f22..1910c44521e3 100644 --- a/arch/sparc/include/asm/compat.h +++ b/arch/sparc/include/asm/compat.h | |||
@@ -11,7 +11,6 @@ | |||
11 | 11 | ||
12 | typedef u32 compat_size_t; | 12 | typedef u32 compat_size_t; |
13 | typedef s32 compat_ssize_t; | 13 | typedef s32 compat_ssize_t; |
14 | typedef s32 compat_time_t; | ||
15 | typedef s32 compat_clock_t; | 14 | typedef s32 compat_clock_t; |
16 | typedef s32 compat_pid_t; | 15 | typedef s32 compat_pid_t; |
17 | typedef u16 __compat_uid_t; | 16 | typedef u16 __compat_uid_t; |
@@ -39,16 +38,6 @@ typedef u32 compat_ulong_t; | |||
39 | typedef u64 compat_u64; | 38 | typedef u64 compat_u64; |
40 | typedef u32 compat_uptr_t; | 39 | typedef u32 compat_uptr_t; |
41 | 40 | ||
42 | struct compat_timespec { | ||
43 | compat_time_t tv_sec; | ||
44 | s32 tv_nsec; | ||
45 | }; | ||
46 | |||
47 | struct compat_timeval { | ||
48 | compat_time_t tv_sec; | ||
49 | s32 tv_usec; | ||
50 | }; | ||
51 | |||
52 | struct compat_stat { | 41 | struct compat_stat { |
53 | compat_dev_t st_dev; | 42 | compat_dev_t st_dev; |
54 | compat_ino_t st_ino; | 43 | compat_ino_t st_ino; |
@@ -168,6 +157,7 @@ static inline compat_uptr_t ptr_to_compat(void __user *uptr) | |||
168 | return (u32)(unsigned long)uptr; | 157 | return (u32)(unsigned long)uptr; |
169 | } | 158 | } |
170 | 159 | ||
160 | #ifdef CONFIG_COMPAT | ||
171 | static inline void __user *arch_compat_alloc_user_space(long len) | 161 | static inline void __user *arch_compat_alloc_user_space(long len) |
172 | { | 162 | { |
173 | struct pt_regs *regs = current_thread_info()->kregs; | 163 | struct pt_regs *regs = current_thread_info()->kregs; |
@@ -184,6 +174,7 @@ static inline void __user *arch_compat_alloc_user_space(long len) | |||
184 | 174 | ||
185 | return (void __user *) usp; | 175 | return (void __user *) usp; |
186 | } | 176 | } |
177 | #endif | ||
187 | 178 | ||
188 | struct compat_ipc64_perm { | 179 | struct compat_ipc64_perm { |
189 | compat_key_t key; | 180 | compat_key_t key; |
@@ -243,6 +234,7 @@ struct compat_shmid64_ds { | |||
243 | unsigned int __unused2; | 234 | unsigned int __unused2; |
244 | }; | 235 | }; |
245 | 236 | ||
237 | #ifdef CONFIG_COMPAT | ||
246 | static inline int is_compat_task(void) | 238 | static inline int is_compat_task(void) |
247 | { | 239 | { |
248 | return test_thread_flag(TIF_32BIT); | 240 | return test_thread_flag(TIF_32BIT); |
@@ -254,5 +246,6 @@ static inline bool in_compat_syscall(void) | |||
254 | return pt_regs_trap_type(current_pt_regs()) == 0x110; | 246 | return pt_regs_trap_type(current_pt_regs()) == 0x110; |
255 | } | 247 | } |
256 | #define in_compat_syscall in_compat_syscall | 248 | #define in_compat_syscall in_compat_syscall |
249 | #endif | ||
257 | 250 | ||
258 | #endif /* _ASM_SPARC64_COMPAT_H */ | 251 | #endif /* _ASM_SPARC64_COMPAT_H */ |
diff --git a/arch/um/include/asm/Kbuild b/arch/um/include/asm/Kbuild index bb5a196c3061..b10dde6cb793 100644 --- a/arch/um/include/asm/Kbuild +++ b/arch/um/include/asm/Kbuild | |||
@@ -1,6 +1,7 @@ | |||
1 | generic-y += barrier.h | 1 | generic-y += barrier.h |
2 | generic-y += bpf_perf_event.h | 2 | generic-y += bpf_perf_event.h |
3 | generic-y += bug.h | 3 | generic-y += bug.h |
4 | generic-y += compat.h | ||
4 | generic-y += current.h | 5 | generic-y += current.h |
5 | generic-y += delay.h | 6 | generic-y += delay.h |
6 | generic-y += device.h | 7 | generic-y += device.h |
diff --git a/arch/unicore32/include/asm/Kbuild b/arch/unicore32/include/asm/Kbuild index 6f70c76c81fc..bfc7abe77905 100644 --- a/arch/unicore32/include/asm/Kbuild +++ b/arch/unicore32/include/asm/Kbuild | |||
@@ -1,5 +1,6 @@ | |||
1 | generic-y += atomic.h | 1 | generic-y += atomic.h |
2 | generic-y += bugs.h | 2 | generic-y += bugs.h |
3 | generic-y += compat.h | ||
3 | generic-y += current.h | 4 | generic-y += current.h |
4 | generic-y += device.h | 5 | generic-y += device.h |
5 | generic-y += div64.h | 6 | generic-y += div64.h |
diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c index 45b2b1c93d04..6e461fb1e0d4 100644 --- a/arch/x86/events/core.c +++ b/arch/x86/events/core.c | |||
@@ -2397,7 +2397,7 @@ static unsigned long get_segment_base(unsigned int segment) | |||
2397 | 2397 | ||
2398 | #ifdef CONFIG_IA32_EMULATION | 2398 | #ifdef CONFIG_IA32_EMULATION |
2399 | 2399 | ||
2400 | #include <asm/compat.h> | 2400 | #include <linux/compat.h> |
2401 | 2401 | ||
2402 | static inline int | 2402 | static inline int |
2403 | perf_callchain_user32(struct pt_regs *regs, struct perf_callchain_entry_ctx *entry) | 2403 | perf_callchain_user32(struct pt_regs *regs, struct perf_callchain_entry_ctx *entry) |
diff --git a/arch/x86/include/asm/compat.h b/arch/x86/include/asm/compat.h index e1c8dab86670..7cd314b71c51 100644 --- a/arch/x86/include/asm/compat.h +++ b/arch/x86/include/asm/compat.h | |||
@@ -17,7 +17,6 @@ | |||
17 | 17 | ||
18 | typedef u32 compat_size_t; | 18 | typedef u32 compat_size_t; |
19 | typedef s32 compat_ssize_t; | 19 | typedef s32 compat_ssize_t; |
20 | typedef s32 compat_time_t; | ||
21 | typedef s32 compat_clock_t; | 20 | typedef s32 compat_clock_t; |
22 | typedef s32 compat_pid_t; | 21 | typedef s32 compat_pid_t; |
23 | typedef u16 __compat_uid_t; | 22 | typedef u16 __compat_uid_t; |
@@ -46,16 +45,6 @@ typedef u32 compat_u32; | |||
46 | typedef u64 __attribute__((aligned(4))) compat_u64; | 45 | typedef u64 __attribute__((aligned(4))) compat_u64; |
47 | typedef u32 compat_uptr_t; | 46 | typedef u32 compat_uptr_t; |
48 | 47 | ||
49 | struct compat_timespec { | ||
50 | compat_time_t tv_sec; | ||
51 | s32 tv_nsec; | ||
52 | }; | ||
53 | |||
54 | struct compat_timeval { | ||
55 | compat_time_t tv_sec; | ||
56 | s32 tv_usec; | ||
57 | }; | ||
58 | |||
59 | struct compat_stat { | 48 | struct compat_stat { |
60 | compat_dev_t st_dev; | 49 | compat_dev_t st_dev; |
61 | u16 __pad1; | 50 | u16 __pad1; |
diff --git a/arch/x86/include/asm/ftrace.h b/arch/x86/include/asm/ftrace.h index cc8f8fcf9b4a..c18ed65287d5 100644 --- a/arch/x86/include/asm/ftrace.h +++ b/arch/x86/include/asm/ftrace.h | |||
@@ -63,7 +63,7 @@ static inline bool arch_syscall_match_sym_name(const char *sym, const char *name | |||
63 | #ifndef COMPILE_OFFSETS | 63 | #ifndef COMPILE_OFFSETS |
64 | 64 | ||
65 | #if defined(CONFIG_FTRACE_SYSCALLS) && defined(CONFIG_IA32_EMULATION) | 65 | #if defined(CONFIG_FTRACE_SYSCALLS) && defined(CONFIG_IA32_EMULATION) |
66 | #include <asm/compat.h> | 66 | #include <linux/compat.h> |
67 | 67 | ||
68 | /* | 68 | /* |
69 | * Because ia32 syscalls do not map to x86_64 syscall numbers | 69 | * Because ia32 syscalls do not map to x86_64 syscall numbers |
diff --git a/arch/x86/kernel/sys_x86_64.c b/arch/x86/kernel/sys_x86_64.c index a3f15ed545b5..6a78d4b36a79 100644 --- a/arch/x86/kernel/sys_x86_64.c +++ b/arch/x86/kernel/sys_x86_64.c | |||
@@ -1,4 +1,5 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | 1 | // SPDX-License-Identifier: GPL-2.0 |
2 | #include <linux/compat.h> | ||
2 | #include <linux/errno.h> | 3 | #include <linux/errno.h> |
3 | #include <linux/sched.h> | 4 | #include <linux/sched.h> |
4 | #include <linux/sched/mm.h> | 5 | #include <linux/sched/mm.h> |
@@ -19,7 +20,6 @@ | |||
19 | #include <linux/elf.h> | 20 | #include <linux/elf.h> |
20 | 21 | ||
21 | #include <asm/elf.h> | 22 | #include <asm/elf.h> |
22 | #include <asm/compat.h> | ||
23 | #include <asm/ia32.h> | 23 | #include <asm/ia32.h> |
24 | #include <asm/syscalls.h> | 24 | #include <asm/syscalls.h> |
25 | #include <asm/mpx.h> | 25 | #include <asm/mpx.h> |
diff --git a/arch/xtensa/include/asm/Kbuild b/arch/xtensa/include/asm/Kbuild index 436b20337168..e5e1e61c538c 100644 --- a/arch/xtensa/include/asm/Kbuild +++ b/arch/xtensa/include/asm/Kbuild | |||
@@ -1,4 +1,5 @@ | |||
1 | generic-y += bug.h | 1 | generic-y += bug.h |
2 | generic-y += compat.h | ||
2 | generic-y += device.h | 3 | generic-y += device.h |
3 | generic-y += div64.h | 4 | generic-y += div64.h |
4 | generic-y += dma-contiguous.h | 5 | generic-y += dma-contiguous.h |
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig index 8e8a09755d10..dec0dd88ec15 100644 --- a/drivers/clocksource/Kconfig +++ b/drivers/clocksource/Kconfig | |||
@@ -450,8 +450,10 @@ config MTK_TIMER | |||
450 | Support for Mediatek timer driver. | 450 | Support for Mediatek timer driver. |
451 | 451 | ||
452 | config SPRD_TIMER | 452 | config SPRD_TIMER |
453 | bool "Spreadtrum timer driver" if COMPILE_TEST | 453 | bool "Spreadtrum timer driver" if EXPERT |
454 | depends on HAS_IOMEM | 454 | depends on HAS_IOMEM |
455 | depends on (ARCH_SPRD || COMPILE_TEST) | ||
456 | default ARCH_SPRD | ||
455 | select TIMER_OF | 457 | select TIMER_OF |
456 | help | 458 | help |
457 | Enables support for the Spreadtrum timer driver. | 459 | Enables support for the Spreadtrum timer driver. |
diff --git a/drivers/clocksource/arc_timer.c b/drivers/clocksource/arc_timer.c index 471b428d8034..20da9b1d7f7d 100644 --- a/drivers/clocksource/arc_timer.c +++ b/drivers/clocksource/arc_timer.c | |||
@@ -61,6 +61,20 @@ static u64 arc_read_gfrc(struct clocksource *cs) | |||
61 | unsigned long flags; | 61 | unsigned long flags; |
62 | u32 l, h; | 62 | u32 l, h; |
63 | 63 | ||
64 | /* | ||
65 | * From a programming model pov, there seems to be just one instance of | ||
66 | * MCIP_CMD/MCIP_READBACK however micro-architecturally there's | ||
67 | * an instance PER ARC CORE (not per cluster), and there are dedicated | ||
68 | * hardware decode logic (per core) inside ARConnect to handle | ||
69 | * simultaneous read/write accesses from cores via those two registers. | ||
70 | * So several concurrent commands to ARConnect are OK if they are | ||
71 | * trying to access two different sub-components (like GFRC, | ||
72 | * inter-core interrupt, etc...). HW also supports simultaneously | ||
73 | * accessing GFRC by multiple cores. | ||
74 | * That's why it is safe to disable hard interrupts on the local CPU | ||
75 | * before access to GFRC instead of taking global MCIP spinlock | ||
76 | * defined in arch/arc/kernel/mcip.c | ||
77 | */ | ||
64 | local_irq_save(flags); | 78 | local_irq_save(flags); |
65 | 79 | ||
66 | __mcip_cmd(CMD_GFRC_READ_LO, 0); | 80 | __mcip_cmd(CMD_GFRC_READ_LO, 0); |
diff --git a/drivers/clocksource/mips-gic-timer.c b/drivers/clocksource/mips-gic-timer.c index 986b6796b631..54f8a331b53a 100644 --- a/drivers/clocksource/mips-gic-timer.c +++ b/drivers/clocksource/mips-gic-timer.c | |||
@@ -5,6 +5,9 @@ | |||
5 | * | 5 | * |
6 | * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved. | 6 | * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved. |
7 | */ | 7 | */ |
8 | |||
9 | #define pr_fmt(fmt) "mips-gic-timer: " fmt | ||
10 | |||
8 | #include <linux/clk.h> | 11 | #include <linux/clk.h> |
9 | #include <linux/clockchips.h> | 12 | #include <linux/clockchips.h> |
10 | #include <linux/cpu.h> | 13 | #include <linux/cpu.h> |
@@ -136,8 +139,7 @@ static int gic_clockevent_init(void) | |||
136 | 139 | ||
137 | ret = setup_percpu_irq(gic_timer_irq, &gic_compare_irqaction); | 140 | ret = setup_percpu_irq(gic_timer_irq, &gic_compare_irqaction); |
138 | if (ret < 0) { | 141 | if (ret < 0) { |
139 | pr_err("GIC timer IRQ %d setup failed: %d\n", | 142 | pr_err("IRQ %d setup failed (%d)\n", gic_timer_irq, ret); |
140 | gic_timer_irq, ret); | ||
141 | return ret; | 143 | return ret; |
142 | } | 144 | } |
143 | 145 | ||
@@ -176,7 +178,7 @@ static int __init __gic_clocksource_init(void) | |||
176 | 178 | ||
177 | ret = clocksource_register_hz(&gic_clocksource, gic_frequency); | 179 | ret = clocksource_register_hz(&gic_clocksource, gic_frequency); |
178 | if (ret < 0) | 180 | if (ret < 0) |
179 | pr_warn("GIC: Unable to register clocksource\n"); | 181 | pr_warn("Unable to register clocksource\n"); |
180 | 182 | ||
181 | return ret; | 183 | return ret; |
182 | } | 184 | } |
@@ -188,7 +190,7 @@ static int __init gic_clocksource_of_init(struct device_node *node) | |||
188 | 190 | ||
189 | if (!mips_gic_present() || !node->parent || | 191 | if (!mips_gic_present() || !node->parent || |
190 | !of_device_is_compatible(node->parent, "mti,gic")) { | 192 | !of_device_is_compatible(node->parent, "mti,gic")) { |
191 | pr_warn("No DT definition for the mips gic driver\n"); | 193 | pr_warn("No DT definition\n"); |
192 | return -ENXIO; | 194 | return -ENXIO; |
193 | } | 195 | } |
194 | 196 | ||
@@ -196,7 +198,7 @@ static int __init gic_clocksource_of_init(struct device_node *node) | |||
196 | if (!IS_ERR(clk)) { | 198 | if (!IS_ERR(clk)) { |
197 | ret = clk_prepare_enable(clk); | 199 | ret = clk_prepare_enable(clk); |
198 | if (ret < 0) { | 200 | if (ret < 0) { |
199 | pr_err("GIC failed to enable clock\n"); | 201 | pr_err("Failed to enable clock\n"); |
200 | clk_put(clk); | 202 | clk_put(clk); |
201 | return ret; | 203 | return ret; |
202 | } | 204 | } |
@@ -204,12 +206,12 @@ static int __init gic_clocksource_of_init(struct device_node *node) | |||
204 | gic_frequency = clk_get_rate(clk); | 206 | gic_frequency = clk_get_rate(clk); |
205 | } else if (of_property_read_u32(node, "clock-frequency", | 207 | } else if (of_property_read_u32(node, "clock-frequency", |
206 | &gic_frequency)) { | 208 | &gic_frequency)) { |
207 | pr_err("GIC frequency not specified.\n"); | 209 | pr_err("Frequency not specified\n"); |
208 | return -EINVAL; | 210 | return -EINVAL; |
209 | } | 211 | } |
210 | gic_timer_irq = irq_of_parse_and_map(node, 0); | 212 | gic_timer_irq = irq_of_parse_and_map(node, 0); |
211 | if (!gic_timer_irq) { | 213 | if (!gic_timer_irq) { |
212 | pr_err("GIC timer IRQ not specified.\n"); | 214 | pr_err("IRQ not specified\n"); |
213 | return -EINVAL; | 215 | return -EINVAL; |
214 | } | 216 | } |
215 | 217 | ||
@@ -220,7 +222,7 @@ static int __init gic_clocksource_of_init(struct device_node *node) | |||
220 | ret = gic_clockevent_init(); | 222 | ret = gic_clockevent_init(); |
221 | if (!ret && !IS_ERR(clk)) { | 223 | if (!ret && !IS_ERR(clk)) { |
222 | if (clk_notifier_register(clk, &gic_clk_nb) < 0) | 224 | if (clk_notifier_register(clk, &gic_clk_nb) < 0) |
223 | pr_warn("GIC: Unable to register clock notifier\n"); | 225 | pr_warn("Unable to register clock notifier\n"); |
224 | } | 226 | } |
225 | 227 | ||
226 | /* And finally start the counter */ | 228 | /* And finally start the counter */ |
diff --git a/drivers/clocksource/mxs_timer.c b/drivers/clocksource/mxs_timer.c index a03434e9fe8f..f6ddae30933f 100644 --- a/drivers/clocksource/mxs_timer.c +++ b/drivers/clocksource/mxs_timer.c | |||
@@ -1,24 +1,10 @@ | |||
1 | /* | 1 | // SPDX-License-Identifier: GPL-2.0+ |
2 | * Copyright (C) 2000-2001 Deep Blue Solutions | 2 | // |
3 | * Copyright (C) 2002 Shane Nay (shane@minirl.com) | 3 | // Copyright (C) 2000-2001 Deep Blue Solutions |
4 | * Copyright (C) 2006-2007 Pavel Pisa (ppisa@pikron.com) | 4 | // Copyright (C) 2002 Shane Nay (shane@minirl.com) |
5 | * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de) | 5 | // Copyright (C) 2006-2007 Pavel Pisa (ppisa@pikron.com) |
6 | * Copyright (C) 2010 Freescale Semiconductor, Inc. All Rights Reserved. | 6 | // Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de) |
7 | * | 7 | // Copyright (C) 2010 Freescale Semiconductor, Inc. All Rights Reserved. |
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License | ||
10 | * as published by the Free Software Foundation; either version 2 | ||
11 | * of the License, or (at your option) any later version. | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | ||
20 | * MA 02110-1301, USA. | ||
21 | */ | ||
22 | 8 | ||
23 | #include <linux/err.h> | 9 | #include <linux/err.h> |
24 | #include <linux/interrupt.h> | 10 | #include <linux/interrupt.h> |
diff --git a/drivers/clocksource/timer-imx-gpt.c b/drivers/clocksource/timer-imx-gpt.c index 6ec6d79b237c..165fbbb1c9a0 100644 --- a/drivers/clocksource/timer-imx-gpt.c +++ b/drivers/clocksource/timer-imx-gpt.c | |||
@@ -1,25 +1,9 @@ | |||
1 | /* | 1 | // SPDX-License-Identifier: GPL-2.0+ |
2 | * linux/arch/arm/plat-mxc/time.c | 2 | // |
3 | * | 3 | // Copyright (C) 2000-2001 Deep Blue Solutions |
4 | * Copyright (C) 2000-2001 Deep Blue Solutions | 4 | // Copyright (C) 2002 Shane Nay (shane@minirl.com) |
5 | * Copyright (C) 2002 Shane Nay (shane@minirl.com) | 5 | // Copyright (C) 2006-2007 Pavel Pisa (ppisa@pikron.com) |
6 | * Copyright (C) 2006-2007 Pavel Pisa (ppisa@pikron.com) | 6 | // Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de) |
7 | * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de) | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or | ||
10 | * modify it under the terms of the GNU General Public License | ||
11 | * as published by the Free Software Foundation; either version 2 | ||
12 | * of the License, or (at your option) any later version. | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | ||
21 | * MA 02110-1301, USA. | ||
22 | */ | ||
23 | 7 | ||
24 | #include <linux/interrupt.h> | 8 | #include <linux/interrupt.h> |
25 | #include <linux/irq.h> | 9 | #include <linux/irq.h> |
diff --git a/drivers/clocksource/timer-imx-tpm.c b/drivers/clocksource/timer-imx-tpm.c index 6c8318470b48..b7aa2b817078 100644 --- a/drivers/clocksource/timer-imx-tpm.c +++ b/drivers/clocksource/timer-imx-tpm.c | |||
@@ -1,12 +1,7 @@ | |||
1 | /* | 1 | // SPDX-License-Identifier: GPL-2.0+ |
2 | * Copyright 2016 Freescale Semiconductor, Inc. | 2 | // |
3 | * Copyright 2017 NXP | 3 | // Copyright 2016 Freescale Semiconductor, Inc. |
4 | * | 4 | // Copyright 2017 NXP |
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU General Public License | ||
7 | * as published by the Free Software Foundation; either version 2 | ||
8 | * of the License, or (at your option) any later version. | ||
9 | */ | ||
10 | 5 | ||
11 | #include <linux/clk.h> | 6 | #include <linux/clk.h> |
12 | #include <linux/clockchips.h> | 7 | #include <linux/clockchips.h> |
diff --git a/drivers/s390/block/dasd_ioctl.c b/drivers/s390/block/dasd_ioctl.c index 7bdc6aaa0ba3..2016e0ed5865 100644 --- a/drivers/s390/block/dasd_ioctl.c +++ b/drivers/s390/block/dasd_ioctl.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <linux/fs.h> | 18 | #include <linux/fs.h> |
19 | #include <linux/blkpg.h> | 19 | #include <linux/blkpg.h> |
20 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
21 | #include <asm/compat.h> | ||
22 | #include <asm/ccwdev.h> | 21 | #include <asm/ccwdev.h> |
23 | #include <asm/schid.h> | 22 | #include <asm/schid.h> |
24 | #include <asm/cmb.h> | 23 | #include <asm/cmb.h> |
diff --git a/drivers/s390/char/fs3270.c b/drivers/s390/char/fs3270.c index 61822480a2a0..16a4e8528bbc 100644 --- a/drivers/s390/char/fs3270.c +++ b/drivers/s390/char/fs3270.c | |||
@@ -19,7 +19,6 @@ | |||
19 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
20 | #include <linux/types.h> | 20 | #include <linux/types.h> |
21 | 21 | ||
22 | #include <asm/compat.h> | ||
23 | #include <asm/ccwdev.h> | 22 | #include <asm/ccwdev.h> |
24 | #include <asm/cio.h> | 23 | #include <asm/cio.h> |
25 | #include <asm/ebcdic.h> | 24 | #include <asm/ebcdic.h> |
diff --git a/drivers/s390/char/sclp_ctl.c b/drivers/s390/char/sclp_ctl.c index a78cea0c3a09..248b5db3eaa8 100644 --- a/drivers/s390/char/sclp_ctl.c +++ b/drivers/s390/char/sclp_ctl.c | |||
@@ -14,7 +14,6 @@ | |||
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <linux/ioctl.h> | 15 | #include <linux/ioctl.h> |
16 | #include <linux/fs.h> | 16 | #include <linux/fs.h> |
17 | #include <asm/compat.h> | ||
18 | #include <asm/sclp_ctl.h> | 17 | #include <asm/sclp_ctl.h> |
19 | #include <asm/sclp.h> | 18 | #include <asm/sclp.h> |
20 | 19 | ||
diff --git a/drivers/s390/char/vmcp.c b/drivers/s390/char/vmcp.c index 17e411c57576..948ce82a7725 100644 --- a/drivers/s390/char/vmcp.c +++ b/drivers/s390/char/vmcp.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include <linux/mutex.h> | 23 | #include <linux/mutex.h> |
24 | #include <linux/cma.h> | 24 | #include <linux/cma.h> |
25 | #include <linux/mm.h> | 25 | #include <linux/mm.h> |
26 | #include <asm/compat.h> | ||
27 | #include <asm/cpcmd.h> | 26 | #include <asm/cpcmd.h> |
28 | #include <asm/debug.h> | 27 | #include <asm/debug.h> |
29 | #include <asm/vmcp.h> | 28 | #include <asm/vmcp.h> |
diff --git a/drivers/s390/cio/chsc_sch.c b/drivers/s390/cio/chsc_sch.c index 0015729d917d..8d9f36625ba5 100644 --- a/drivers/s390/cio/chsc_sch.c +++ b/drivers/s390/cio/chsc_sch.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include <linux/miscdevice.h> | 16 | #include <linux/miscdevice.h> |
17 | #include <linux/kernel_stat.h> | 17 | #include <linux/kernel_stat.h> |
18 | 18 | ||
19 | #include <asm/compat.h> | ||
20 | #include <asm/cio.h> | 19 | #include <asm/cio.h> |
21 | #include <asm/chsc.h> | 20 | #include <asm/chsc.h> |
22 | #include <asm/isc.h> | 21 | #include <asm/isc.h> |
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index dffd820731f2..f5a0d894d9ad 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #define KMSG_COMPONENT "qeth" | 10 | #define KMSG_COMPONENT "qeth" |
11 | #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt | 11 | #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt |
12 | 12 | ||
13 | #include <linux/compat.h> | ||
13 | #include <linux/module.h> | 14 | #include <linux/module.h> |
14 | #include <linux/moduleparam.h> | 15 | #include <linux/moduleparam.h> |
15 | #include <linux/string.h> | 16 | #include <linux/string.h> |
@@ -32,7 +33,6 @@ | |||
32 | #include <asm/chpid.h> | 33 | #include <asm/chpid.h> |
33 | #include <asm/io.h> | 34 | #include <asm/io.h> |
34 | #include <asm/sysinfo.h> | 35 | #include <asm/sysinfo.h> |
35 | #include <asm/compat.h> | ||
36 | #include <asm/diag.h> | 36 | #include <asm/diag.h> |
37 | #include <asm/cio.h> | 37 | #include <asm/cio.h> |
38 | #include <asm/ccwdev.h> | 38 | #include <asm/ccwdev.h> |
diff --git a/include/asm-generic/compat.h b/include/asm-generic/compat.h new file mode 100644 index 000000000000..28819451b6d1 --- /dev/null +++ b/include/asm-generic/compat.h | |||
@@ -0,0 +1,3 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
2 | |||
3 | /* This is an empty stub for 32-bit-only architectures */ | ||
diff --git a/include/linux/compat.h b/include/linux/compat.h index ad192057b887..b1a5562b3215 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h | |||
@@ -7,8 +7,7 @@ | |||
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/types.h> | 9 | #include <linux/types.h> |
10 | 10 | #include <linux/compat_time.h> | |
11 | #ifdef CONFIG_COMPAT | ||
12 | 11 | ||
13 | #include <linux/stat.h> | 12 | #include <linux/stat.h> |
14 | #include <linux/param.h> /* for HZ */ | 13 | #include <linux/param.h> /* for HZ */ |
@@ -21,8 +20,11 @@ | |||
21 | #include <linux/unistd.h> | 20 | #include <linux/unistd.h> |
22 | 21 | ||
23 | #include <asm/compat.h> | 22 | #include <asm/compat.h> |
23 | |||
24 | #ifdef CONFIG_COMPAT | ||
24 | #include <asm/siginfo.h> | 25 | #include <asm/siginfo.h> |
25 | #include <asm/signal.h> | 26 | #include <asm/signal.h> |
27 | #endif | ||
26 | 28 | ||
27 | #ifdef CONFIG_ARCH_HAS_SYSCALL_WRAPPER | 29 | #ifdef CONFIG_ARCH_HAS_SYSCALL_WRAPPER |
28 | /* | 30 | /* |
@@ -83,6 +85,8 @@ | |||
83 | static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) | 85 | static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) |
84 | #endif /* COMPAT_SYSCALL_DEFINEx */ | 86 | #endif /* COMPAT_SYSCALL_DEFINEx */ |
85 | 87 | ||
88 | #ifdef CONFIG_COMPAT | ||
89 | |||
86 | #ifndef compat_user_stack_pointer | 90 | #ifndef compat_user_stack_pointer |
87 | #define compat_user_stack_pointer() current_user_stack_pointer() | 91 | #define compat_user_stack_pointer() current_user_stack_pointer() |
88 | #endif | 92 | #endif |
@@ -290,8 +294,6 @@ extern int compat_get_timespec(struct timespec *, const void __user *); | |||
290 | extern int compat_put_timespec(const struct timespec *, void __user *); | 294 | extern int compat_put_timespec(const struct timespec *, void __user *); |
291 | extern int compat_get_timeval(struct timeval *, const void __user *); | 295 | extern int compat_get_timeval(struct timeval *, const void __user *); |
292 | extern int compat_put_timeval(const struct timeval *, void __user *); | 296 | extern int compat_put_timeval(const struct timeval *, void __user *); |
293 | extern int compat_get_timespec64(struct timespec64 *, const void __user *); | ||
294 | extern int compat_put_timespec64(const struct timespec64 *, void __user *); | ||
295 | extern int get_compat_itimerspec64(struct itimerspec64 *its, | 297 | extern int get_compat_itimerspec64(struct itimerspec64 *its, |
296 | const struct compat_itimerspec __user *uits); | 298 | const struct compat_itimerspec __user *uits); |
297 | extern int put_compat_itimerspec64(const struct itimerspec64 *its, | 299 | extern int put_compat_itimerspec64(const struct itimerspec64 *its, |
@@ -1023,7 +1025,9 @@ static inline struct compat_timeval ns_to_compat_timeval(s64 nsec) | |||
1023 | #else /* !CONFIG_COMPAT */ | 1025 | #else /* !CONFIG_COMPAT */ |
1024 | 1026 | ||
1025 | #define is_compat_task() (0) | 1027 | #define is_compat_task() (0) |
1028 | #ifndef in_compat_syscall | ||
1026 | static inline bool in_compat_syscall(void) { return false; } | 1029 | static inline bool in_compat_syscall(void) { return false; } |
1030 | #endif | ||
1027 | 1031 | ||
1028 | #endif /* CONFIG_COMPAT */ | 1032 | #endif /* CONFIG_COMPAT */ |
1029 | 1033 | ||
diff --git a/include/linux/compat_time.h b/include/linux/compat_time.h new file mode 100644 index 000000000000..31f2774f1994 --- /dev/null +++ b/include/linux/compat_time.h | |||
@@ -0,0 +1,23 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
2 | #ifndef _LINUX_COMPAT_TIME_H | ||
3 | #define _LINUX_COMPAT_TIME_H | ||
4 | |||
5 | #include <linux/types.h> | ||
6 | #include <linux/time64.h> | ||
7 | |||
8 | typedef s32 compat_time_t; | ||
9 | |||
10 | struct compat_timespec { | ||
11 | compat_time_t tv_sec; | ||
12 | s32 tv_nsec; | ||
13 | }; | ||
14 | |||
15 | struct compat_timeval { | ||
16 | compat_time_t tv_sec; | ||
17 | s32 tv_usec; | ||
18 | }; | ||
19 | |||
20 | extern int compat_get_timespec64(struct timespec64 *, const void __user *); | ||
21 | extern int compat_put_timespec64(const struct timespec64 *, void __user *); | ||
22 | |||
23 | #endif /* _LINUX_COMPAT_TIME_H */ | ||
diff --git a/include/linux/restart_block.h b/include/linux/restart_block.h index bcfdb918cd81..5d83d0c1d06c 100644 --- a/include/linux/restart_block.h +++ b/include/linux/restart_block.h | |||
@@ -7,6 +7,7 @@ | |||
7 | 7 | ||
8 | #include <linux/compiler.h> | 8 | #include <linux/compiler.h> |
9 | #include <linux/types.h> | 9 | #include <linux/types.h> |
10 | #include <linux/time64.h> | ||
10 | 11 | ||
11 | struct timespec; | 12 | struct timespec; |
12 | struct compat_timespec; | 13 | struct compat_timespec; |
@@ -15,9 +16,7 @@ struct pollfd; | |||
15 | enum timespec_type { | 16 | enum timespec_type { |
16 | TT_NONE = 0, | 17 | TT_NONE = 0, |
17 | TT_NATIVE = 1, | 18 | TT_NATIVE = 1, |
18 | #ifdef CONFIG_COMPAT | ||
19 | TT_COMPAT = 2, | 19 | TT_COMPAT = 2, |
20 | #endif | ||
21 | }; | 20 | }; |
22 | 21 | ||
23 | /* | 22 | /* |
@@ -40,10 +39,8 @@ struct restart_block { | |||
40 | clockid_t clockid; | 39 | clockid_t clockid; |
41 | enum timespec_type type; | 40 | enum timespec_type type; |
42 | union { | 41 | union { |
43 | struct timespec __user *rmtp; | 42 | struct __kernel_timespec __user *rmtp; |
44 | #ifdef CONFIG_COMPAT | ||
45 | struct compat_timespec __user *compat_rmtp; | 43 | struct compat_timespec __user *compat_rmtp; |
46 | #endif | ||
47 | }; | 44 | }; |
48 | u64 expires; | 45 | u64 expires; |
49 | } nanosleep; | 46 | } nanosleep; |
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index 811172fcb916..796ea267f1c7 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h | |||
@@ -542,7 +542,8 @@ asmlinkage long sys_set_robust_list(struct robust_list_head __user *head, | |||
542 | size_t len); | 542 | size_t len); |
543 | 543 | ||
544 | /* kernel/hrtimer.c */ | 544 | /* kernel/hrtimer.c */ |
545 | asmlinkage long sys_nanosleep(struct timespec __user *rqtp, struct timespec __user *rmtp); | 545 | asmlinkage long sys_nanosleep(struct __kernel_timespec __user *rqtp, |
546 | struct __kernel_timespec __user *rmtp); | ||
546 | 547 | ||
547 | /* kernel/itimer.c */ | 548 | /* kernel/itimer.c */ |
548 | asmlinkage long sys_getitimer(int which, struct itimerval __user *value); | 549 | asmlinkage long sys_getitimer(int which, struct itimerval __user *value); |
@@ -573,14 +574,14 @@ asmlinkage long sys_timer_settime(timer_t timer_id, int flags, | |||
573 | struct itimerspec __user *old_setting); | 574 | struct itimerspec __user *old_setting); |
574 | asmlinkage long sys_timer_delete(timer_t timer_id); | 575 | asmlinkage long sys_timer_delete(timer_t timer_id); |
575 | asmlinkage long sys_clock_settime(clockid_t which_clock, | 576 | asmlinkage long sys_clock_settime(clockid_t which_clock, |
576 | const struct timespec __user *tp); | 577 | const struct __kernel_timespec __user *tp); |
577 | asmlinkage long sys_clock_gettime(clockid_t which_clock, | 578 | asmlinkage long sys_clock_gettime(clockid_t which_clock, |
578 | struct timespec __user *tp); | 579 | struct __kernel_timespec __user *tp); |
579 | asmlinkage long sys_clock_getres(clockid_t which_clock, | 580 | asmlinkage long sys_clock_getres(clockid_t which_clock, |
580 | struct timespec __user *tp); | 581 | struct __kernel_timespec __user *tp); |
581 | asmlinkage long sys_clock_nanosleep(clockid_t which_clock, int flags, | 582 | asmlinkage long sys_clock_nanosleep(clockid_t which_clock, int flags, |
582 | const struct timespec __user *rqtp, | 583 | const struct __kernel_timespec __user *rqtp, |
583 | struct timespec __user *rmtp); | 584 | struct __kernel_timespec __user *rmtp); |
584 | 585 | ||
585 | /* kernel/printk.c */ | 586 | /* kernel/printk.c */ |
586 | asmlinkage long sys_syslog(int type, char __user *buf, int len); | 587 | asmlinkage long sys_syslog(int type, char __user *buf, int len); |
diff --git a/include/linux/time.h b/include/linux/time.h index 4b62a2c0a661..aed74463592d 100644 --- a/include/linux/time.h +++ b/include/linux/time.h | |||
@@ -10,9 +10,9 @@ | |||
10 | extern struct timezone sys_tz; | 10 | extern struct timezone sys_tz; |
11 | 11 | ||
12 | int get_timespec64(struct timespec64 *ts, | 12 | int get_timespec64(struct timespec64 *ts, |
13 | const struct timespec __user *uts); | 13 | const struct __kernel_timespec __user *uts); |
14 | int put_timespec64(const struct timespec64 *ts, | 14 | int put_timespec64(const struct timespec64 *ts, |
15 | struct timespec __user *uts); | 15 | struct __kernel_timespec __user *uts); |
16 | int get_itimerspec64(struct itimerspec64 *it, | 16 | int get_itimerspec64(struct itimerspec64 *it, |
17 | const struct itimerspec __user *uit); | 17 | const struct itimerspec __user *uit); |
18 | int put_itimerspec64(const struct itimerspec64 *it, | 18 | int put_itimerspec64(const struct itimerspec64 *it, |
diff --git a/include/linux/time64.h b/include/linux/time64.h index 93d39499838e..0d96887ba4e0 100644 --- a/include/linux/time64.h +++ b/include/linux/time64.h | |||
@@ -2,12 +2,20 @@ | |||
2 | #ifndef _LINUX_TIME64_H | 2 | #ifndef _LINUX_TIME64_H |
3 | #define _LINUX_TIME64_H | 3 | #define _LINUX_TIME64_H |
4 | 4 | ||
5 | #include <uapi/linux/time.h> | ||
6 | #include <linux/math64.h> | 5 | #include <linux/math64.h> |
7 | 6 | ||
8 | typedef __s64 time64_t; | 7 | typedef __s64 time64_t; |
9 | typedef __u64 timeu64_t; | 8 | typedef __u64 timeu64_t; |
10 | 9 | ||
10 | /* CONFIG_64BIT_TIME enables new 64 bit time_t syscalls in the compat path | ||
11 | * and 32-bit emulation. | ||
12 | */ | ||
13 | #ifndef CONFIG_64BIT_TIME | ||
14 | #define __kernel_timespec timespec | ||
15 | #endif | ||
16 | |||
17 | #include <uapi/linux/time.h> | ||
18 | |||
11 | #if __BITS_PER_LONG == 64 | 19 | #if __BITS_PER_LONG == 64 |
12 | /* this trick allows us to optimize out timespec64_to_timespec */ | 20 | /* this trick allows us to optimize out timespec64_to_timespec */ |
13 | # define timespec64 timespec | 21 | # define timespec64 timespec |
diff --git a/include/uapi/asm-generic/posix_types.h b/include/uapi/asm-generic/posix_types.h index 5e6ea22bd525..f0733a26ebfc 100644 --- a/include/uapi/asm-generic/posix_types.h +++ b/include/uapi/asm-generic/posix_types.h | |||
@@ -87,6 +87,7 @@ typedef struct { | |||
87 | typedef __kernel_long_t __kernel_off_t; | 87 | typedef __kernel_long_t __kernel_off_t; |
88 | typedef long long __kernel_loff_t; | 88 | typedef long long __kernel_loff_t; |
89 | typedef __kernel_long_t __kernel_time_t; | 89 | typedef __kernel_long_t __kernel_time_t; |
90 | typedef long long __kernel_time64_t; | ||
90 | typedef __kernel_long_t __kernel_clock_t; | 91 | typedef __kernel_long_t __kernel_clock_t; |
91 | typedef int __kernel_timer_t; | 92 | typedef int __kernel_timer_t; |
92 | typedef int __kernel_clockid_t; | 93 | typedef int __kernel_clockid_t; |
diff --git a/include/uapi/linux/time.h b/include/uapi/linux/time.h index 4c0338ea308a..fcf936656493 100644 --- a/include/uapi/linux/time.h +++ b/include/uapi/linux/time.h | |||
@@ -42,6 +42,13 @@ struct itimerval { | |||
42 | struct timeval it_value; /* current value */ | 42 | struct timeval it_value; /* current value */ |
43 | }; | 43 | }; |
44 | 44 | ||
45 | #ifndef __kernel_timespec | ||
46 | struct __kernel_timespec { | ||
47 | __kernel_time64_t tv_sec; /* seconds */ | ||
48 | long long tv_nsec; /* nanoseconds */ | ||
49 | }; | ||
50 | #endif | ||
51 | |||
45 | /* | 52 | /* |
46 | * legacy timeval structure, only embedded in structures that | 53 | * legacy timeval structure, only embedded in structures that |
47 | * traditionally used 'timeval' to pass time intervals (not absolute | 54 | * traditionally used 'timeval' to pass time intervals (not absolute |
diff --git a/kernel/compat.c b/kernel/compat.c index 92d8c98c0f57..702aa846ddac 100644 --- a/kernel/compat.c +++ b/kernel/compat.c | |||
@@ -121,50 +121,6 @@ static int __compat_put_timespec(const struct timespec *ts, struct compat_timesp | |||
121 | __put_user(ts->tv_nsec, &cts->tv_nsec)) ? -EFAULT : 0; | 121 | __put_user(ts->tv_nsec, &cts->tv_nsec)) ? -EFAULT : 0; |
122 | } | 122 | } |
123 | 123 | ||
124 | static int __compat_get_timespec64(struct timespec64 *ts64, | ||
125 | const struct compat_timespec __user *cts) | ||
126 | { | ||
127 | struct compat_timespec ts; | ||
128 | int ret; | ||
129 | |||
130 | ret = copy_from_user(&ts, cts, sizeof(ts)); | ||
131 | if (ret) | ||
132 | return -EFAULT; | ||
133 | |||
134 | ts64->tv_sec = ts.tv_sec; | ||
135 | ts64->tv_nsec = ts.tv_nsec; | ||
136 | |||
137 | return 0; | ||
138 | } | ||
139 | |||
140 | static int __compat_put_timespec64(const struct timespec64 *ts64, | ||
141 | struct compat_timespec __user *cts) | ||
142 | { | ||
143 | struct compat_timespec ts = { | ||
144 | .tv_sec = ts64->tv_sec, | ||
145 | .tv_nsec = ts64->tv_nsec | ||
146 | }; | ||
147 | return copy_to_user(cts, &ts, sizeof(ts)) ? -EFAULT : 0; | ||
148 | } | ||
149 | |||
150 | int compat_get_timespec64(struct timespec64 *ts, const void __user *uts) | ||
151 | { | ||
152 | if (COMPAT_USE_64BIT_TIME) | ||
153 | return copy_from_user(ts, uts, sizeof(*ts)) ? -EFAULT : 0; | ||
154 | else | ||
155 | return __compat_get_timespec64(ts, uts); | ||
156 | } | ||
157 | EXPORT_SYMBOL_GPL(compat_get_timespec64); | ||
158 | |||
159 | int compat_put_timespec64(const struct timespec64 *ts, void __user *uts) | ||
160 | { | ||
161 | if (COMPAT_USE_64BIT_TIME) | ||
162 | return copy_to_user(uts, ts, sizeof(*ts)) ? -EFAULT : 0; | ||
163 | else | ||
164 | return __compat_put_timespec64(ts, uts); | ||
165 | } | ||
166 | EXPORT_SYMBOL_GPL(compat_put_timespec64); | ||
167 | |||
168 | int compat_get_timeval(struct timeval *tv, const void __user *utv) | 124 | int compat_get_timeval(struct timeval *tv, const void __user *utv) |
169 | { | 125 | { |
170 | if (COMPAT_USE_64BIT_TIME) | 126 | if (COMPAT_USE_64BIT_TIME) |
@@ -368,6 +324,14 @@ COMPAT_SYSCALL_DEFINE3(sched_getaffinity, compat_pid_t, pid, unsigned int, len, | |||
368 | return ret; | 324 | return ret; |
369 | } | 325 | } |
370 | 326 | ||
327 | /* Todo: Delete these extern declarations when get/put_compat_itimerspec64() | ||
328 | * are moved to kernel/time/time.c . | ||
329 | */ | ||
330 | extern int __compat_get_timespec64(struct timespec64 *ts64, | ||
331 | const struct compat_timespec __user *cts); | ||
332 | extern int __compat_put_timespec64(const struct timespec64 *ts64, | ||
333 | struct compat_timespec __user *cts); | ||
334 | |||
371 | int get_compat_itimerspec64(struct itimerspec64 *its, | 335 | int get_compat_itimerspec64(struct itimerspec64 *its, |
372 | const struct compat_itimerspec __user *uits) | 336 | const struct compat_itimerspec __user *uits) |
373 | { | 337 | { |
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c index 84f37420fcf5..f89a78e2792b 100644 --- a/kernel/time/clocksource.c +++ b/kernel/time/clocksource.c | |||
@@ -129,31 +129,19 @@ static void inline clocksource_watchdog_unlock(unsigned long *flags) | |||
129 | spin_unlock_irqrestore(&watchdog_lock, *flags); | 129 | spin_unlock_irqrestore(&watchdog_lock, *flags); |
130 | } | 130 | } |
131 | 131 | ||
132 | static int clocksource_watchdog_kthread(void *data); | ||
133 | static void __clocksource_change_rating(struct clocksource *cs, int rating); | ||
134 | |||
135 | /* | 132 | /* |
136 | * Interval: 0.5sec Threshold: 0.0625s | 133 | * Interval: 0.5sec Threshold: 0.0625s |
137 | */ | 134 | */ |
138 | #define WATCHDOG_INTERVAL (HZ >> 1) | 135 | #define WATCHDOG_INTERVAL (HZ >> 1) |
139 | #define WATCHDOG_THRESHOLD (NSEC_PER_SEC >> 4) | 136 | #define WATCHDOG_THRESHOLD (NSEC_PER_SEC >> 4) |
140 | 137 | ||
141 | static void clocksource_watchdog_work(struct work_struct *work) | ||
142 | { | ||
143 | /* | ||
144 | * If kthread_run fails the next watchdog scan over the | ||
145 | * watchdog_list will find the unstable clock again. | ||
146 | */ | ||
147 | kthread_run(clocksource_watchdog_kthread, NULL, "kwatchdog"); | ||
148 | } | ||
149 | |||
150 | static void __clocksource_unstable(struct clocksource *cs) | 138 | static void __clocksource_unstable(struct clocksource *cs) |
151 | { | 139 | { |
152 | cs->flags &= ~(CLOCK_SOURCE_VALID_FOR_HRES | CLOCK_SOURCE_WATCHDOG); | 140 | cs->flags &= ~(CLOCK_SOURCE_VALID_FOR_HRES | CLOCK_SOURCE_WATCHDOG); |
153 | cs->flags |= CLOCK_SOURCE_UNSTABLE; | 141 | cs->flags |= CLOCK_SOURCE_UNSTABLE; |
154 | 142 | ||
155 | /* | 143 | /* |
156 | * If the clocksource is registered clocksource_watchdog_kthread() will | 144 | * If the clocksource is registered clocksource_watchdog_work() will |
157 | * re-rate and re-select. | 145 | * re-rate and re-select. |
158 | */ | 146 | */ |
159 | if (list_empty(&cs->list)) { | 147 | if (list_empty(&cs->list)) { |
@@ -164,7 +152,7 @@ static void __clocksource_unstable(struct clocksource *cs) | |||
164 | if (cs->mark_unstable) | 152 | if (cs->mark_unstable) |
165 | cs->mark_unstable(cs); | 153 | cs->mark_unstable(cs); |
166 | 154 | ||
167 | /* kick clocksource_watchdog_kthread() */ | 155 | /* kick clocksource_watchdog_work() */ |
168 | if (finished_booting) | 156 | if (finished_booting) |
169 | schedule_work(&watchdog_work); | 157 | schedule_work(&watchdog_work); |
170 | } | 158 | } |
@@ -174,7 +162,7 @@ static void __clocksource_unstable(struct clocksource *cs) | |||
174 | * @cs: clocksource to be marked unstable | 162 | * @cs: clocksource to be marked unstable |
175 | * | 163 | * |
176 | * This function is called by the x86 TSC code to mark clocksources as unstable; | 164 | * This function is called by the x86 TSC code to mark clocksources as unstable; |
177 | * it defers demotion and re-selection to a kthread. | 165 | * it defers demotion and re-selection to a work. |
178 | */ | 166 | */ |
179 | void clocksource_mark_unstable(struct clocksource *cs) | 167 | void clocksource_mark_unstable(struct clocksource *cs) |
180 | { | 168 | { |
@@ -399,7 +387,9 @@ static void clocksource_dequeue_watchdog(struct clocksource *cs) | |||
399 | } | 387 | } |
400 | } | 388 | } |
401 | 389 | ||
402 | static int __clocksource_watchdog_kthread(void) | 390 | static void __clocksource_change_rating(struct clocksource *cs, int rating); |
391 | |||
392 | static int __clocksource_watchdog_work(void) | ||
403 | { | 393 | { |
404 | struct clocksource *cs, *tmp; | 394 | struct clocksource *cs, *tmp; |
405 | unsigned long flags; | 395 | unsigned long flags; |
@@ -424,13 +414,12 @@ static int __clocksource_watchdog_kthread(void) | |||
424 | return select; | 414 | return select; |
425 | } | 415 | } |
426 | 416 | ||
427 | static int clocksource_watchdog_kthread(void *data) | 417 | static void clocksource_watchdog_work(struct work_struct *work) |
428 | { | 418 | { |
429 | mutex_lock(&clocksource_mutex); | 419 | mutex_lock(&clocksource_mutex); |
430 | if (__clocksource_watchdog_kthread()) | 420 | if (__clocksource_watchdog_work()) |
431 | clocksource_select(); | 421 | clocksource_select(); |
432 | mutex_unlock(&clocksource_mutex); | 422 | mutex_unlock(&clocksource_mutex); |
433 | return 0; | ||
434 | } | 423 | } |
435 | 424 | ||
436 | static bool clocksource_is_watchdog(struct clocksource *cs) | 425 | static bool clocksource_is_watchdog(struct clocksource *cs) |
@@ -449,12 +438,12 @@ static void clocksource_enqueue_watchdog(struct clocksource *cs) | |||
449 | static void clocksource_select_watchdog(bool fallback) { } | 438 | static void clocksource_select_watchdog(bool fallback) { } |
450 | static inline void clocksource_dequeue_watchdog(struct clocksource *cs) { } | 439 | static inline void clocksource_dequeue_watchdog(struct clocksource *cs) { } |
451 | static inline void clocksource_resume_watchdog(void) { } | 440 | static inline void clocksource_resume_watchdog(void) { } |
452 | static inline int __clocksource_watchdog_kthread(void) { return 0; } | 441 | static inline int __clocksource_watchdog_work(void) { return 0; } |
453 | static bool clocksource_is_watchdog(struct clocksource *cs) { return false; } | 442 | static bool clocksource_is_watchdog(struct clocksource *cs) { return false; } |
454 | void clocksource_mark_unstable(struct clocksource *cs) { } | 443 | void clocksource_mark_unstable(struct clocksource *cs) { } |
455 | 444 | ||
456 | static void inline clocksource_watchdog_lock(unsigned long *flags) { } | 445 | static inline void clocksource_watchdog_lock(unsigned long *flags) { } |
457 | static void inline clocksource_watchdog_unlock(unsigned long *flags) { } | 446 | static inline void clocksource_watchdog_unlock(unsigned long *flags) { } |
458 | 447 | ||
459 | #endif /* CONFIG_CLOCKSOURCE_WATCHDOG */ | 448 | #endif /* CONFIG_CLOCKSOURCE_WATCHDOG */ |
460 | 449 | ||
@@ -683,7 +672,7 @@ static int __init clocksource_done_booting(void) | |||
683 | /* | 672 | /* |
684 | * Run the watchdog first to eliminate unstable clock sources | 673 | * Run the watchdog first to eliminate unstable clock sources |
685 | */ | 674 | */ |
686 | __clocksource_watchdog_kthread(); | 675 | __clocksource_watchdog_work(); |
687 | clocksource_select(); | 676 | clocksource_select(); |
688 | mutex_unlock(&clocksource_mutex); | 677 | mutex_unlock(&clocksource_mutex); |
689 | return 0; | 678 | return 0; |
diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c index 14e858753d76..055a4a728c00 100644 --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c | |||
@@ -1759,8 +1759,10 @@ out: | |||
1759 | return ret; | 1759 | return ret; |
1760 | } | 1760 | } |
1761 | 1761 | ||
1762 | SYSCALL_DEFINE2(nanosleep, struct timespec __user *, rqtp, | 1762 | #if !defined(CONFIG_64BIT_TIME) || defined(CONFIG_64BIT) |
1763 | struct timespec __user *, rmtp) | 1763 | |
1764 | SYSCALL_DEFINE2(nanosleep, struct __kernel_timespec __user *, rqtp, | ||
1765 | struct __kernel_timespec __user *, rmtp) | ||
1764 | { | 1766 | { |
1765 | struct timespec64 tu; | 1767 | struct timespec64 tu; |
1766 | 1768 | ||
@@ -1775,7 +1777,9 @@ SYSCALL_DEFINE2(nanosleep, struct timespec __user *, rqtp, | |||
1775 | return hrtimer_nanosleep(&tu, HRTIMER_MODE_REL, CLOCK_MONOTONIC); | 1777 | return hrtimer_nanosleep(&tu, HRTIMER_MODE_REL, CLOCK_MONOTONIC); |
1776 | } | 1778 | } |
1777 | 1779 | ||
1778 | #ifdef CONFIG_COMPAT | 1780 | #endif |
1781 | |||
1782 | #ifdef CONFIG_COMPAT_32BIT_TIME | ||
1779 | 1783 | ||
1780 | COMPAT_SYSCALL_DEFINE2(nanosleep, struct compat_timespec __user *, rqtp, | 1784 | COMPAT_SYSCALL_DEFINE2(nanosleep, struct compat_timespec __user *, rqtp, |
1781 | struct compat_timespec __user *, rmtp) | 1785 | struct compat_timespec __user *, rmtp) |
diff --git a/kernel/time/posix-stubs.c b/kernel/time/posix-stubs.c index 69a937c3cd81..26aa9569e24a 100644 --- a/kernel/time/posix-stubs.c +++ b/kernel/time/posix-stubs.c | |||
@@ -59,7 +59,7 @@ SYS_NI(alarm); | |||
59 | */ | 59 | */ |
60 | 60 | ||
61 | SYSCALL_DEFINE2(clock_settime, const clockid_t, which_clock, | 61 | SYSCALL_DEFINE2(clock_settime, const clockid_t, which_clock, |
62 | const struct timespec __user *, tp) | 62 | const struct __kernel_timespec __user *, tp) |
63 | { | 63 | { |
64 | struct timespec64 new_tp; | 64 | struct timespec64 new_tp; |
65 | 65 | ||
@@ -90,7 +90,7 @@ int do_clock_gettime(clockid_t which_clock, struct timespec64 *tp) | |||
90 | return 0; | 90 | return 0; |
91 | } | 91 | } |
92 | SYSCALL_DEFINE2(clock_gettime, const clockid_t, which_clock, | 92 | SYSCALL_DEFINE2(clock_gettime, const clockid_t, which_clock, |
93 | struct timespec __user *, tp) | 93 | struct __kernel_timespec __user *, tp) |
94 | { | 94 | { |
95 | int ret; | 95 | int ret; |
96 | struct timespec64 kernel_tp; | 96 | struct timespec64 kernel_tp; |
@@ -104,7 +104,7 @@ SYSCALL_DEFINE2(clock_gettime, const clockid_t, which_clock, | |||
104 | return 0; | 104 | return 0; |
105 | } | 105 | } |
106 | 106 | ||
107 | SYSCALL_DEFINE2(clock_getres, const clockid_t, which_clock, struct timespec __user *, tp) | 107 | SYSCALL_DEFINE2(clock_getres, const clockid_t, which_clock, struct __kernel_timespec __user *, tp) |
108 | { | 108 | { |
109 | struct timespec64 rtn_tp = { | 109 | struct timespec64 rtn_tp = { |
110 | .tv_sec = 0, | 110 | .tv_sec = 0, |
@@ -124,8 +124,8 @@ SYSCALL_DEFINE2(clock_getres, const clockid_t, which_clock, struct timespec __us | |||
124 | } | 124 | } |
125 | 125 | ||
126 | SYSCALL_DEFINE4(clock_nanosleep, const clockid_t, which_clock, int, flags, | 126 | SYSCALL_DEFINE4(clock_nanosleep, const clockid_t, which_clock, int, flags, |
127 | const struct timespec __user *, rqtp, | 127 | const struct __kernel_timespec __user *, rqtp, |
128 | struct timespec __user *, rmtp) | 128 | struct __kernel_timespec __user *, rmtp) |
129 | { | 129 | { |
130 | struct timespec64 t; | 130 | struct timespec64 t; |
131 | 131 | ||
@@ -158,7 +158,9 @@ COMPAT_SYS_NI(timer_settime); | |||
158 | COMPAT_SYS_NI(timer_gettime); | 158 | COMPAT_SYS_NI(timer_gettime); |
159 | COMPAT_SYS_NI(getitimer); | 159 | COMPAT_SYS_NI(getitimer); |
160 | COMPAT_SYS_NI(setitimer); | 160 | COMPAT_SYS_NI(setitimer); |
161 | #endif | ||
161 | 162 | ||
163 | #ifdef CONFIG_COMPAT_32BIT_TIME | ||
162 | COMPAT_SYSCALL_DEFINE2(clock_settime, const clockid_t, which_clock, | 164 | COMPAT_SYSCALL_DEFINE2(clock_settime, const clockid_t, which_clock, |
163 | struct compat_timespec __user *, tp) | 165 | struct compat_timespec __user *, tp) |
164 | { | 166 | { |
diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c index 10b7186d0638..e08ce3f27447 100644 --- a/kernel/time/posix-timers.c +++ b/kernel/time/posix-timers.c | |||
@@ -1040,7 +1040,7 @@ void exit_itimers(struct signal_struct *sig) | |||
1040 | } | 1040 | } |
1041 | 1041 | ||
1042 | SYSCALL_DEFINE2(clock_settime, const clockid_t, which_clock, | 1042 | SYSCALL_DEFINE2(clock_settime, const clockid_t, which_clock, |
1043 | const struct timespec __user *, tp) | 1043 | const struct __kernel_timespec __user *, tp) |
1044 | { | 1044 | { |
1045 | const struct k_clock *kc = clockid_to_kclock(which_clock); | 1045 | const struct k_clock *kc = clockid_to_kclock(which_clock); |
1046 | struct timespec64 new_tp; | 1046 | struct timespec64 new_tp; |
@@ -1055,7 +1055,7 @@ SYSCALL_DEFINE2(clock_settime, const clockid_t, which_clock, | |||
1055 | } | 1055 | } |
1056 | 1056 | ||
1057 | SYSCALL_DEFINE2(clock_gettime, const clockid_t, which_clock, | 1057 | SYSCALL_DEFINE2(clock_gettime, const clockid_t, which_clock, |
1058 | struct timespec __user *,tp) | 1058 | struct __kernel_timespec __user *, tp) |
1059 | { | 1059 | { |
1060 | const struct k_clock *kc = clockid_to_kclock(which_clock); | 1060 | const struct k_clock *kc = clockid_to_kclock(which_clock); |
1061 | struct timespec64 kernel_tp; | 1061 | struct timespec64 kernel_tp; |
@@ -1096,7 +1096,7 @@ SYSCALL_DEFINE2(clock_adjtime, const clockid_t, which_clock, | |||
1096 | } | 1096 | } |
1097 | 1097 | ||
1098 | SYSCALL_DEFINE2(clock_getres, const clockid_t, which_clock, | 1098 | SYSCALL_DEFINE2(clock_getres, const clockid_t, which_clock, |
1099 | struct timespec __user *, tp) | 1099 | struct __kernel_timespec __user *, tp) |
1100 | { | 1100 | { |
1101 | const struct k_clock *kc = clockid_to_kclock(which_clock); | 1101 | const struct k_clock *kc = clockid_to_kclock(which_clock); |
1102 | struct timespec64 rtn_tp; | 1102 | struct timespec64 rtn_tp; |
@@ -1113,7 +1113,7 @@ SYSCALL_DEFINE2(clock_getres, const clockid_t, which_clock, | |||
1113 | return error; | 1113 | return error; |
1114 | } | 1114 | } |
1115 | 1115 | ||
1116 | #ifdef CONFIG_COMPAT | 1116 | #ifdef CONFIG_COMPAT_32BIT_TIME |
1117 | 1117 | ||
1118 | COMPAT_SYSCALL_DEFINE2(clock_settime, clockid_t, which_clock, | 1118 | COMPAT_SYSCALL_DEFINE2(clock_settime, clockid_t, which_clock, |
1119 | struct compat_timespec __user *, tp) | 1119 | struct compat_timespec __user *, tp) |
@@ -1148,6 +1148,10 @@ COMPAT_SYSCALL_DEFINE2(clock_gettime, clockid_t, which_clock, | |||
1148 | return err; | 1148 | return err; |
1149 | } | 1149 | } |
1150 | 1150 | ||
1151 | #endif | ||
1152 | |||
1153 | #ifdef CONFIG_COMPAT | ||
1154 | |||
1151 | COMPAT_SYSCALL_DEFINE2(clock_adjtime, clockid_t, which_clock, | 1155 | COMPAT_SYSCALL_DEFINE2(clock_adjtime, clockid_t, which_clock, |
1152 | struct compat_timex __user *, utp) | 1156 | struct compat_timex __user *, utp) |
1153 | { | 1157 | { |
@@ -1172,6 +1176,10 @@ COMPAT_SYSCALL_DEFINE2(clock_adjtime, clockid_t, which_clock, | |||
1172 | return err; | 1176 | return err; |
1173 | } | 1177 | } |
1174 | 1178 | ||
1179 | #endif | ||
1180 | |||
1181 | #ifdef CONFIG_COMPAT_32BIT_TIME | ||
1182 | |||
1175 | COMPAT_SYSCALL_DEFINE2(clock_getres, clockid_t, which_clock, | 1183 | COMPAT_SYSCALL_DEFINE2(clock_getres, clockid_t, which_clock, |
1176 | struct compat_timespec __user *, tp) | 1184 | struct compat_timespec __user *, tp) |
1177 | { | 1185 | { |
@@ -1203,8 +1211,8 @@ static int common_nsleep(const clockid_t which_clock, int flags, | |||
1203 | } | 1211 | } |
1204 | 1212 | ||
1205 | SYSCALL_DEFINE4(clock_nanosleep, const clockid_t, which_clock, int, flags, | 1213 | SYSCALL_DEFINE4(clock_nanosleep, const clockid_t, which_clock, int, flags, |
1206 | const struct timespec __user *, rqtp, | 1214 | const struct __kernel_timespec __user *, rqtp, |
1207 | struct timespec __user *, rmtp) | 1215 | struct __kernel_timespec __user *, rmtp) |
1208 | { | 1216 | { |
1209 | const struct k_clock *kc = clockid_to_kclock(which_clock); | 1217 | const struct k_clock *kc = clockid_to_kclock(which_clock); |
1210 | struct timespec64 t; | 1218 | struct timespec64 t; |
@@ -1227,7 +1235,8 @@ SYSCALL_DEFINE4(clock_nanosleep, const clockid_t, which_clock, int, flags, | |||
1227 | return kc->nsleep(which_clock, flags, &t); | 1235 | return kc->nsleep(which_clock, flags, &t); |
1228 | } | 1236 | } |
1229 | 1237 | ||
1230 | #ifdef CONFIG_COMPAT | 1238 | #ifdef CONFIG_COMPAT_32BIT_TIME |
1239 | |||
1231 | COMPAT_SYSCALL_DEFINE4(clock_nanosleep, clockid_t, which_clock, int, flags, | 1240 | COMPAT_SYSCALL_DEFINE4(clock_nanosleep, clockid_t, which_clock, int, flags, |
1232 | struct compat_timespec __user *, rqtp, | 1241 | struct compat_timespec __user *, rqtp, |
1233 | struct compat_timespec __user *, rmtp) | 1242 | struct compat_timespec __user *, rmtp) |
@@ -1252,6 +1261,7 @@ COMPAT_SYSCALL_DEFINE4(clock_nanosleep, clockid_t, which_clock, int, flags, | |||
1252 | 1261 | ||
1253 | return kc->nsleep(which_clock, flags, &t); | 1262 | return kc->nsleep(which_clock, flags, &t); |
1254 | } | 1263 | } |
1264 | |||
1255 | #endif | 1265 | #endif |
1256 | 1266 | ||
1257 | static const struct k_clock clock_realtime = { | 1267 | static const struct k_clock clock_realtime = { |
diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c index 49edc1c4f3e6..78e598334007 100644 --- a/kernel/time/tick-common.c +++ b/kernel/time/tick-common.c | |||
@@ -277,7 +277,8 @@ static bool tick_check_preferred(struct clock_event_device *curdev, | |||
277 | */ | 277 | */ |
278 | return !curdev || | 278 | return !curdev || |
279 | newdev->rating > curdev->rating || | 279 | newdev->rating > curdev->rating || |
280 | !cpumask_equal(curdev->cpumask, newdev->cpumask); | 280 | (!cpumask_equal(curdev->cpumask, newdev->cpumask) && |
281 | !tick_check_percpu(curdev, newdev, smp_processor_id())); | ||
281 | } | 282 | } |
282 | 283 | ||
283 | /* | 284 | /* |
diff --git a/kernel/time/time.c b/kernel/time/time.c index 3044d48ebe56..ccd751e95fcb 100644 --- a/kernel/time/time.c +++ b/kernel/time/time.c | |||
@@ -853,9 +853,9 @@ struct timespec64 timespec64_add_safe(const struct timespec64 lhs, | |||
853 | } | 853 | } |
854 | 854 | ||
855 | int get_timespec64(struct timespec64 *ts, | 855 | int get_timespec64(struct timespec64 *ts, |
856 | const struct timespec __user *uts) | 856 | const struct __kernel_timespec __user *uts) |
857 | { | 857 | { |
858 | struct timespec kts; | 858 | struct __kernel_timespec kts; |
859 | int ret; | 859 | int ret; |
860 | 860 | ||
861 | ret = copy_from_user(&kts, uts, sizeof(kts)); | 861 | ret = copy_from_user(&kts, uts, sizeof(kts)); |
@@ -863,6 +863,11 @@ int get_timespec64(struct timespec64 *ts, | |||
863 | return -EFAULT; | 863 | return -EFAULT; |
864 | 864 | ||
865 | ts->tv_sec = kts.tv_sec; | 865 | ts->tv_sec = kts.tv_sec; |
866 | |||
867 | /* Zero out the padding for 32 bit systems or in compat mode */ | ||
868 | if (IS_ENABLED(CONFIG_64BIT_TIME) && (!IS_ENABLED(CONFIG_64BIT) || in_compat_syscall())) | ||
869 | kts.tv_nsec &= 0xFFFFFFFFUL; | ||
870 | |||
866 | ts->tv_nsec = kts.tv_nsec; | 871 | ts->tv_nsec = kts.tv_nsec; |
867 | 872 | ||
868 | return 0; | 873 | return 0; |
@@ -870,16 +875,61 @@ int get_timespec64(struct timespec64 *ts, | |||
870 | EXPORT_SYMBOL_GPL(get_timespec64); | 875 | EXPORT_SYMBOL_GPL(get_timespec64); |
871 | 876 | ||
872 | int put_timespec64(const struct timespec64 *ts, | 877 | int put_timespec64(const struct timespec64 *ts, |
873 | struct timespec __user *uts) | 878 | struct __kernel_timespec __user *uts) |
874 | { | 879 | { |
875 | struct timespec kts = { | 880 | struct __kernel_timespec kts = { |
876 | .tv_sec = ts->tv_sec, | 881 | .tv_sec = ts->tv_sec, |
877 | .tv_nsec = ts->tv_nsec | 882 | .tv_nsec = ts->tv_nsec |
878 | }; | 883 | }; |
884 | |||
879 | return copy_to_user(uts, &kts, sizeof(kts)) ? -EFAULT : 0; | 885 | return copy_to_user(uts, &kts, sizeof(kts)) ? -EFAULT : 0; |
880 | } | 886 | } |
881 | EXPORT_SYMBOL_GPL(put_timespec64); | 887 | EXPORT_SYMBOL_GPL(put_timespec64); |
882 | 888 | ||
889 | int __compat_get_timespec64(struct timespec64 *ts64, | ||
890 | const struct compat_timespec __user *cts) | ||
891 | { | ||
892 | struct compat_timespec ts; | ||
893 | int ret; | ||
894 | |||
895 | ret = copy_from_user(&ts, cts, sizeof(ts)); | ||
896 | if (ret) | ||
897 | return -EFAULT; | ||
898 | |||
899 | ts64->tv_sec = ts.tv_sec; | ||
900 | ts64->tv_nsec = ts.tv_nsec; | ||
901 | |||
902 | return 0; | ||
903 | } | ||
904 | |||
905 | int __compat_put_timespec64(const struct timespec64 *ts64, | ||
906 | struct compat_timespec __user *cts) | ||
907 | { | ||
908 | struct compat_timespec ts = { | ||
909 | .tv_sec = ts64->tv_sec, | ||
910 | .tv_nsec = ts64->tv_nsec | ||
911 | }; | ||
912 | return copy_to_user(cts, &ts, sizeof(ts)) ? -EFAULT : 0; | ||
913 | } | ||
914 | |||
915 | int compat_get_timespec64(struct timespec64 *ts, const void __user *uts) | ||
916 | { | ||
917 | if (COMPAT_USE_64BIT_TIME) | ||
918 | return copy_from_user(ts, uts, sizeof(*ts)) ? -EFAULT : 0; | ||
919 | else | ||
920 | return __compat_get_timespec64(ts, uts); | ||
921 | } | ||
922 | EXPORT_SYMBOL_GPL(compat_get_timespec64); | ||
923 | |||
924 | int compat_put_timespec64(const struct timespec64 *ts, void __user *uts) | ||
925 | { | ||
926 | if (COMPAT_USE_64BIT_TIME) | ||
927 | return copy_to_user(uts, ts, sizeof(*ts)) ? -EFAULT : 0; | ||
928 | else | ||
929 | return __compat_put_timespec64(ts, uts); | ||
930 | } | ||
931 | EXPORT_SYMBOL_GPL(compat_put_timespec64); | ||
932 | |||
883 | int get_itimerspec64(struct itimerspec64 *it, | 933 | int get_itimerspec64(struct itimerspec64 *it, |
884 | const struct itimerspec __user *uit) | 934 | const struct itimerspec __user *uit) |
885 | { | 935 | { |
diff --git a/kernel/time/timer.c b/kernel/time/timer.c index 4a4fd567fb26..cc2d23e6ff61 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c | |||
@@ -1251,18 +1251,18 @@ EXPORT_SYMBOL(try_to_del_timer_sync); | |||
1251 | * | 1251 | * |
1252 | * Note: For !irqsafe timers, you must not hold locks that are held in | 1252 | * Note: For !irqsafe timers, you must not hold locks that are held in |
1253 | * interrupt context while calling this function. Even if the lock has | 1253 | * interrupt context while calling this function. Even if the lock has |
1254 | * nothing to do with the timer in question. Here's why: | 1254 | * nothing to do with the timer in question. Here's why:: |
1255 | * | 1255 | * |
1256 | * CPU0 CPU1 | 1256 | * CPU0 CPU1 |
1257 | * ---- ---- | 1257 | * ---- ---- |
1258 | * <SOFTIRQ> | 1258 | * <SOFTIRQ> |
1259 | * call_timer_fn(); | 1259 | * call_timer_fn(); |
1260 | * base->running_timer = mytimer; | 1260 | * base->running_timer = mytimer; |
1261 | * spin_lock_irq(somelock); | 1261 | * spin_lock_irq(somelock); |
1262 | * <IRQ> | 1262 | * <IRQ> |
1263 | * spin_lock(somelock); | 1263 | * spin_lock(somelock); |
1264 | * del_timer_sync(mytimer); | 1264 | * del_timer_sync(mytimer); |
1265 | * while (base->running_timer == mytimer); | 1265 | * while (base->running_timer == mytimer); |
1266 | * | 1266 | * |
1267 | * Now del_timer_sync() will never return and never release somelock. | 1267 | * Now del_timer_sync() will never return and never release somelock. |
1268 | * The interrupt on the other CPU is waiting to grab somelock but | 1268 | * The interrupt on the other CPU is waiting to grab somelock but |
diff --git a/kernel/time/timer_list.c b/kernel/time/timer_list.c index 675c4e9563a9..d647dabdac97 100644 --- a/kernel/time/timer_list.c +++ b/kernel/time/timer_list.c | |||
@@ -28,8 +28,6 @@ struct timer_list_iter { | |||
28 | u64 now; | 28 | u64 now; |
29 | }; | 29 | }; |
30 | 30 | ||
31 | typedef void (*print_fn_t)(struct seq_file *m, unsigned int *classes); | ||
32 | |||
33 | /* | 31 | /* |
34 | * This allows printing both to /proc/timer_list and | 32 | * This allows printing both to /proc/timer_list and |
35 | * to the console (on SysRq-Q): | 33 | * to the console (on SysRq-Q): |