aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2017-11-29 01:11:24 -0500
committerIngo Molnar <mingo@kernel.org>2017-11-29 01:11:24 -0500
commit4fc31ba13d052c2933bf91095c063cf9a39effd0 (patch)
treebeabb73c2fe245e6541126732895da62e55bc8ee /include/linux
parent0e18dd12064e07519f7cbff4149ca7fff620cbed (diff)
parentb29c6ef7bb1257853c1e31616d84f55e561cf631 (diff)
Merge branch 'linus' into perf/urgent, to pick up dependent commits
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/atomic.h4
-rw-r--r--include/linux/average.h10
-rw-r--r--include/linux/bitmap.h114
-rw-r--r--include/linux/bitops.h4
-rw-r--r--include/linux/compiler-clang.h2
-rw-r--r--include/linux/compiler-gcc.h2
-rw-r--r--include/linux/compiler-intel.h2
-rw-r--r--include/linux/compiler.h286
-rw-r--r--include/linux/compiler_types.h274
-rw-r--r--include/linux/completion.h18
-rw-r--r--include/linux/cpu.h30
-rw-r--r--include/linux/cpuhotplug.h1
-rw-r--r--include/linux/cpumask.h16
-rw-r--r--include/linux/dcache.h4
-rw-r--r--include/linux/dynamic_queue_limits.h2
-rw-r--r--include/linux/fs.h1
-rw-r--r--include/linux/genetlink.h2
-rw-r--r--include/linux/genhd.h22
-rw-r--r--include/linux/gpio-fan.h36
-rw-r--r--include/linux/huge_mm.h2
-rw-r--r--include/linux/hypervisor.h8
-rw-r--r--include/linux/ide.h2
-rw-r--r--include/linux/if_team.h2
-rw-r--r--include/linux/ioport.h7
-rw-r--r--include/linux/ioprio.h3
-rw-r--r--include/linux/irq.h22
-rw-r--r--include/linux/irq_work.h3
-rw-r--r--include/linux/irqchip/arm-gic-v3.h4
-rw-r--r--include/linux/irqchip/arm-gic-v4.h9
-rw-r--r--include/linux/irqchip/irq-omap-intc.h2
-rw-r--r--include/linux/irqdesc.h1
-rw-r--r--include/linux/irqdomain.h20
-rw-r--r--include/linux/jump_label.h14
-rw-r--r--include/linux/jump_label_ratelimit.h6
-rw-r--r--include/linux/kallsyms.h10
-rw-r--r--include/linux/kexec.h2
-rw-r--r--include/linux/kprobes.h36
-rw-r--r--include/linux/kthread.h10
-rw-r--r--include/linux/ktime.h1
-rw-r--r--include/linux/linkage.h2
-rw-r--r--include/linux/llist.h2
-rw-r--r--include/linux/lockdep.h20
-rw-r--r--include/linux/log2.h42
-rw-r--r--include/linux/math64.h27
-rw-r--r--include/linux/mem_encrypt.h7
-rw-r--r--include/linux/mfd/axp20x.h3
-rw-r--r--include/linux/mfd/rtsx_pci.h1
-rw-r--r--include/linux/mfd/tps65218.h19
-rw-r--r--include/linux/mm.h2
-rw-r--r--include/linux/mmc/host.h11
-rw-r--r--include/linux/mmc/sdhci-pci-data.h3
-rw-r--r--include/linux/mmzone.h6
-rw-r--r--include/linux/module.h7
-rw-r--r--include/linux/msi.h5
-rw-r--r--include/linux/netfilter/nfnetlink.h2
-rw-r--r--include/linux/parport.h1
-rw-r--r--include/linux/percpu-defs.h15
-rw-r--r--include/linux/perf_event.h32
-rw-r--r--include/linux/platform_data/sht15.h38
-rw-r--r--include/linux/pm_runtime.h2
-rw-r--r--include/linux/printk.h3
-rw-r--r--include/linux/rculist.h4
-rw-r--r--include/linux/rcupdate.h4
-rw-r--r--include/linux/regmap.h64
-rw-r--r--include/linux/regulator/da9211.h5
-rw-r--r--include/linux/rtc.h43
-rw-r--r--include/linux/rtnetlink.h2
-rw-r--r--include/linux/rwlock.h12
-rw-r--r--include/linux/rwlock_api_smp.h2
-rw-r--r--include/linux/rwsem.h1
-rw-r--r--include/linux/sched.h19
-rw-r--r--include/linux/sched/isolation.h51
-rw-r--r--include/linux/sched/rt.h11
-rw-r--r--include/linux/sched/sysctl.h6
-rw-r--r--include/linux/spi/spi-fsl-dspi.h31
-rw-r--r--include/linux/spinlock.h15
-rw-r--r--include/linux/spinlock_up.h11
-rw-r--r--include/linux/tick.h39
-rw-r--r--include/linux/time.h207
-rw-r--r--include/linux/time32.h221
-rw-r--r--include/linux/time64.h78
-rw-r--r--include/linux/timekeeper_internal.h6
-rw-r--r--include/linux/timekeeping.h138
-rw-r--r--include/linux/timekeeping32.h151
-rw-r--r--include/linux/timer.h57
-rw-r--r--include/linux/workqueue.h19
86 files changed, 1319 insertions, 1122 deletions
diff --git a/include/linux/atomic.h b/include/linux/atomic.h
index cd18203d6ff3..8b276fd9a127 100644
--- a/include/linux/atomic.h
+++ b/include/linux/atomic.h
@@ -654,6 +654,8 @@ static inline int atomic_dec_if_positive(atomic_t *v)
654} 654}
655#endif 655#endif
656 656
657#define atomic_cond_read_acquire(v, c) smp_cond_load_acquire(&(v)->counter, (c))
658
657#ifdef CONFIG_GENERIC_ATOMIC64 659#ifdef CONFIG_GENERIC_ATOMIC64
658#include <asm-generic/atomic64.h> 660#include <asm-generic/atomic64.h>
659#endif 661#endif
@@ -1073,6 +1075,8 @@ static inline long long atomic64_fetch_andnot_release(long long i, atomic64_t *v
1073} 1075}
1074#endif 1076#endif
1075 1077
1078#define atomic64_cond_read_acquire(v, c) smp_cond_load_acquire(&(v)->counter, (c))
1079
1076#include <asm-generic/atomic-long.h> 1080#include <asm-generic/atomic-long.h>
1077 1081
1078#endif /* _LINUX_ATOMIC_H */ 1082#endif /* _LINUX_ATOMIC_H */
diff --git a/include/linux/average.h b/include/linux/average.h
index 1b6f5560c264..a1a8f09631ce 100644
--- a/include/linux/average.h
+++ b/include/linux/average.h
@@ -2,6 +2,10 @@
2#ifndef _LINUX_AVERAGE_H 2#ifndef _LINUX_AVERAGE_H
3#define _LINUX_AVERAGE_H 3#define _LINUX_AVERAGE_H
4 4
5#include <linux/bug.h>
6#include <linux/compiler.h>
7#include <linux/log2.h>
8
5/* 9/*
6 * Exponentially weighted moving average (EWMA) 10 * Exponentially weighted moving average (EWMA)
7 * 11 *
@@ -49,7 +53,7 @@
49 static inline void ewma_##name##_add(struct ewma_##name *e, \ 53 static inline void ewma_##name##_add(struct ewma_##name *e, \
50 unsigned long val) \ 54 unsigned long val) \
51 { \ 55 { \
52 unsigned long internal = ACCESS_ONCE(e->internal); \ 56 unsigned long internal = READ_ONCE(e->internal); \
53 unsigned long weight_rcp = ilog2(_weight_rcp); \ 57 unsigned long weight_rcp = ilog2(_weight_rcp); \
54 unsigned long precision = _precision; \ 58 unsigned long precision = _precision; \
55 \ 59 \
@@ -58,10 +62,10 @@
58 BUILD_BUG_ON((_precision) > 30); \ 62 BUILD_BUG_ON((_precision) > 30); \
59 BUILD_BUG_ON_NOT_POWER_OF_2(_weight_rcp); \ 63 BUILD_BUG_ON_NOT_POWER_OF_2(_weight_rcp); \
60 \ 64 \
61 ACCESS_ONCE(e->internal) = internal ? \ 65 WRITE_ONCE(e->internal, internal ? \
62 (((internal << weight_rcp) - internal) + \ 66 (((internal << weight_rcp) - internal) + \
63 (val << precision)) >> weight_rcp : \ 67 (val << precision)) >> weight_rcp : \
64 (val << precision); \ 68 (val << precision)); \
65 } 69 }
66 70
67#endif /* _LINUX_AVERAGE_H */ 71#endif /* _LINUX_AVERAGE_H */
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index 19748a5b0e77..3489253e38fc 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -22,65 +22,74 @@
22 * See lib/bitmap.c for more details. 22 * See lib/bitmap.c for more details.
23 */ 23 */
24 24
25/* 25/**
26 * DOC: bitmap overview
27 *
26 * The available bitmap operations and their rough meaning in the 28 * The available bitmap operations and their rough meaning in the
27 * case that the bitmap is a single unsigned long are thus: 29 * case that the bitmap is a single unsigned long are thus:
28 * 30 *
29 * Note that nbits should be always a compile time evaluable constant. 31 * Note that nbits should be always a compile time evaluable constant.
30 * Otherwise many inlines will generate horrible code. 32 * Otherwise many inlines will generate horrible code.
31 * 33 *
32 * bitmap_zero(dst, nbits) *dst = 0UL 34 * ::
33 * bitmap_fill(dst, nbits) *dst = ~0UL 35 *
34 * bitmap_copy(dst, src, nbits) *dst = *src 36 * bitmap_zero(dst, nbits) *dst = 0UL
35 * bitmap_and(dst, src1, src2, nbits) *dst = *src1 & *src2 37 * bitmap_fill(dst, nbits) *dst = ~0UL
36 * bitmap_or(dst, src1, src2, nbits) *dst = *src1 | *src2 38 * bitmap_copy(dst, src, nbits) *dst = *src
37 * bitmap_xor(dst, src1, src2, nbits) *dst = *src1 ^ *src2 39 * bitmap_and(dst, src1, src2, nbits) *dst = *src1 & *src2
38 * bitmap_andnot(dst, src1, src2, nbits) *dst = *src1 & ~(*src2) 40 * bitmap_or(dst, src1, src2, nbits) *dst = *src1 | *src2
39 * bitmap_complement(dst, src, nbits) *dst = ~(*src) 41 * bitmap_xor(dst, src1, src2, nbits) *dst = *src1 ^ *src2
40 * bitmap_equal(src1, src2, nbits) Are *src1 and *src2 equal? 42 * bitmap_andnot(dst, src1, src2, nbits) *dst = *src1 & ~(*src2)
41 * bitmap_intersects(src1, src2, nbits) Do *src1 and *src2 overlap? 43 * bitmap_complement(dst, src, nbits) *dst = ~(*src)
42 * bitmap_subset(src1, src2, nbits) Is *src1 a subset of *src2? 44 * bitmap_equal(src1, src2, nbits) Are *src1 and *src2 equal?
43 * bitmap_empty(src, nbits) Are all bits zero in *src? 45 * bitmap_intersects(src1, src2, nbits) Do *src1 and *src2 overlap?
44 * bitmap_full(src, nbits) Are all bits set in *src? 46 * bitmap_subset(src1, src2, nbits) Is *src1 a subset of *src2?
45 * bitmap_weight(src, nbits) Hamming Weight: number set bits 47 * bitmap_empty(src, nbits) Are all bits zero in *src?
46 * bitmap_set(dst, pos, nbits) Set specified bit area 48 * bitmap_full(src, nbits) Are all bits set in *src?
47 * bitmap_clear(dst, pos, nbits) Clear specified bit area 49 * bitmap_weight(src, nbits) Hamming Weight: number set bits
48 * bitmap_find_next_zero_area(buf, len, pos, n, mask) Find bit free area 50 * bitmap_set(dst, pos, nbits) Set specified bit area
49 * bitmap_find_next_zero_area_off(buf, len, pos, n, mask) as above 51 * bitmap_clear(dst, pos, nbits) Clear specified bit area
50 * bitmap_shift_right(dst, src, n, nbits) *dst = *src >> n 52 * bitmap_find_next_zero_area(buf, len, pos, n, mask) Find bit free area
51 * bitmap_shift_left(dst, src, n, nbits) *dst = *src << n 53 * bitmap_find_next_zero_area_off(buf, len, pos, n, mask) as above
52 * bitmap_remap(dst, src, old, new, nbits) *dst = map(old, new)(src) 54 * bitmap_shift_right(dst, src, n, nbits) *dst = *src >> n
53 * bitmap_bitremap(oldbit, old, new, nbits) newbit = map(old, new)(oldbit) 55 * bitmap_shift_left(dst, src, n, nbits) *dst = *src << n
54 * bitmap_onto(dst, orig, relmap, nbits) *dst = orig relative to relmap 56 * bitmap_remap(dst, src, old, new, nbits) *dst = map(old, new)(src)
55 * bitmap_fold(dst, orig, sz, nbits) dst bits = orig bits mod sz 57 * bitmap_bitremap(oldbit, old, new, nbits) newbit = map(old, new)(oldbit)
56 * bitmap_parse(buf, buflen, dst, nbits) Parse bitmap dst from kernel buf 58 * bitmap_onto(dst, orig, relmap, nbits) *dst = orig relative to relmap
57 * bitmap_parse_user(ubuf, ulen, dst, nbits) Parse bitmap dst from user buf 59 * bitmap_fold(dst, orig, sz, nbits) dst bits = orig bits mod sz
58 * bitmap_parselist(buf, dst, nbits) Parse bitmap dst from kernel buf 60 * bitmap_parse(buf, buflen, dst, nbits) Parse bitmap dst from kernel buf
59 * bitmap_parselist_user(buf, dst, nbits) Parse bitmap dst from user buf 61 * bitmap_parse_user(ubuf, ulen, dst, nbits) Parse bitmap dst from user buf
60 * bitmap_find_free_region(bitmap, bits, order) Find and allocate bit region 62 * bitmap_parselist(buf, dst, nbits) Parse bitmap dst from kernel buf
61 * bitmap_release_region(bitmap, pos, order) Free specified bit region 63 * bitmap_parselist_user(buf, dst, nbits) Parse bitmap dst from user buf
62 * bitmap_allocate_region(bitmap, pos, order) Allocate specified bit region 64 * bitmap_find_free_region(bitmap, bits, order) Find and allocate bit region
63 * bitmap_from_u32array(dst, nbits, buf, nwords) *dst = *buf (nwords 32b words) 65 * bitmap_release_region(bitmap, pos, order) Free specified bit region
64 * bitmap_to_u32array(buf, nwords, src, nbits) *buf = *dst (nwords 32b words) 66 * bitmap_allocate_region(bitmap, pos, order) Allocate specified bit region
67 * bitmap_from_u32array(dst, nbits, buf, nwords) *dst = *buf (nwords 32b words)
68 * bitmap_to_u32array(buf, nwords, src, nbits) *buf = *dst (nwords 32b words)
69 *
65 */ 70 */
66 71
67/* 72/**
68 * Also the following operations in asm/bitops.h apply to bitmaps. 73 * DOC: bitmap bitops
74 *
75 * Also the following operations in asm/bitops.h apply to bitmaps.::
76 *
77 * set_bit(bit, addr) *addr |= bit
78 * clear_bit(bit, addr) *addr &= ~bit
79 * change_bit(bit, addr) *addr ^= bit
80 * test_bit(bit, addr) Is bit set in *addr?
81 * test_and_set_bit(bit, addr) Set bit and return old value
82 * test_and_clear_bit(bit, addr) Clear bit and return old value
83 * test_and_change_bit(bit, addr) Change bit and return old value
84 * find_first_zero_bit(addr, nbits) Position first zero bit in *addr
85 * find_first_bit(addr, nbits) Position first set bit in *addr
86 * find_next_zero_bit(addr, nbits, bit) Position next zero bit in *addr >= bit
87 * find_next_bit(addr, nbits, bit) Position next set bit in *addr >= bit
69 * 88 *
70 * set_bit(bit, addr) *addr |= bit
71 * clear_bit(bit, addr) *addr &= ~bit
72 * change_bit(bit, addr) *addr ^= bit
73 * test_bit(bit, addr) Is bit set in *addr?
74 * test_and_set_bit(bit, addr) Set bit and return old value
75 * test_and_clear_bit(bit, addr) Clear bit and return old value
76 * test_and_change_bit(bit, addr) Change bit and return old value
77 * find_first_zero_bit(addr, nbits) Position first zero bit in *addr
78 * find_first_bit(addr, nbits) Position first set bit in *addr
79 * find_next_zero_bit(addr, nbits, bit) Position next zero bit in *addr >= bit
80 * find_next_bit(addr, nbits, bit) Position next set bit in *addr >= bit
81 */ 89 */
82 90
83/* 91/**
92 * DOC: declare bitmap
84 * The DECLARE_BITMAP(name,bits) macro, in linux/types.h, can be used 93 * The DECLARE_BITMAP(name,bits) macro, in linux/types.h, can be used
85 * to declare an array named 'name' of just enough unsigned longs to 94 * to declare an array named 'name' of just enough unsigned longs to
86 * contain all bit positions from 0 to 'bits' - 1. 95 * contain all bit positions from 0 to 'bits' - 1.
@@ -361,8 +370,9 @@ static inline int bitmap_parse(const char *buf, unsigned int buflen,
361 return __bitmap_parse(buf, buflen, 0, maskp, nmaskbits); 370 return __bitmap_parse(buf, buflen, 0, maskp, nmaskbits);
362} 371}
363 372
364/* 373/**
365 * BITMAP_FROM_U64() - Represent u64 value in the format suitable for bitmap. 374 * BITMAP_FROM_U64() - Represent u64 value in the format suitable for bitmap.
375 * @n: u64 value
366 * 376 *
367 * Linux bitmaps are internally arrays of unsigned longs, i.e. 32-bit 377 * Linux bitmaps are internally arrays of unsigned longs, i.e. 32-bit
368 * integers in 32-bit environment, and 64-bit integers in 64-bit one. 378 * integers in 32-bit environment, and 64-bit integers in 64-bit one.
@@ -393,14 +403,14 @@ static inline int bitmap_parse(const char *buf, unsigned int buflen,
393 ((unsigned long) ((u64)(n) >> 32)) 403 ((unsigned long) ((u64)(n) >> 32))
394#endif 404#endif
395 405
396/* 406/**
397 * bitmap_from_u64 - Check and swap words within u64. 407 * bitmap_from_u64 - Check and swap words within u64.
398 * @mask: source bitmap 408 * @mask: source bitmap
399 * @dst: destination bitmap 409 * @dst: destination bitmap
400 * 410 *
401 * In 32-bit Big Endian kernel, when using (u32 *)(&val)[*] 411 * In 32-bit Big Endian kernel, when using ``(u32 *)(&val)[*]``
402 * to read u64 mask, we will get the wrong word. 412 * to read u64 mask, we will get the wrong word.
403 * That is "(u32 *)(&val)[0]" gets the upper 32 bits, 413 * That is ``(u32 *)(&val)[0]`` gets the upper 32 bits,
404 * but we expect the lower 32-bits of u64. 414 * but we expect the lower 32-bits of u64.
405 */ 415 */
406static inline void bitmap_from_u64(unsigned long *dst, u64 mask) 416static inline void bitmap_from_u64(unsigned long *dst, u64 mask)
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index d03c5dd6185d..c537ac7435ad 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -237,7 +237,7 @@ static inline unsigned long __ffs64(u64 word)
237 typeof(*ptr) old, new; \ 237 typeof(*ptr) old, new; \
238 \ 238 \
239 do { \ 239 do { \
240 old = ACCESS_ONCE(*ptr); \ 240 old = READ_ONCE(*ptr); \
241 new = (old & ~mask) | bits; \ 241 new = (old & ~mask) | bits; \
242 } while (cmpxchg(ptr, old, new) != old); \ 242 } while (cmpxchg(ptr, old, new) != old); \
243 \ 243 \
@@ -252,7 +252,7 @@ static inline unsigned long __ffs64(u64 word)
252 typeof(*ptr) old, new; \ 252 typeof(*ptr) old, new; \
253 \ 253 \
254 do { \ 254 do { \
255 old = ACCESS_ONCE(*ptr); \ 255 old = READ_ONCE(*ptr); \
256 new = old & ~clear; \ 256 new = old & ~clear; \
257 } while (!(old & test) && \ 257 } while (!(old & test) && \
258 cmpxchg(ptr, old, new) != old); \ 258 cmpxchg(ptr, old, new) != old); \
diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h
index 54dfef70a072..a06583e41f80 100644
--- a/include/linux/compiler-clang.h
+++ b/include/linux/compiler-clang.h
@@ -1,5 +1,5 @@
1/* SPDX-License-Identifier: GPL-2.0 */ 1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __LINUX_COMPILER_H 2#ifndef __LINUX_COMPILER_TYPES_H
3#error "Please don't include <linux/compiler-clang.h> directly, include <linux/compiler.h> instead." 3#error "Please don't include <linux/compiler-clang.h> directly, include <linux/compiler.h> instead."
4#endif 4#endif
5 5
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index bb78e5bdff26..2272ded07496 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -1,5 +1,5 @@
1/* SPDX-License-Identifier: GPL-2.0 */ 1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __LINUX_COMPILER_H 2#ifndef __LINUX_COMPILER_TYPES_H
3#error "Please don't include <linux/compiler-gcc.h> directly, include <linux/compiler.h> instead." 3#error "Please don't include <linux/compiler-gcc.h> directly, include <linux/compiler.h> instead."
4#endif 4#endif
5 5
diff --git a/include/linux/compiler-intel.h b/include/linux/compiler-intel.h
index 523d1b74550f..bfa08160db3a 100644
--- a/include/linux/compiler-intel.h
+++ b/include/linux/compiler-intel.h
@@ -1,5 +1,5 @@
1/* SPDX-License-Identifier: GPL-2.0 */ 1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __LINUX_COMPILER_H 2#ifndef __LINUX_COMPILER_TYPES_H
3#error "Please don't include <linux/compiler-intel.h> directly, include <linux/compiler.h> instead." 3#error "Please don't include <linux/compiler-intel.h> directly, include <linux/compiler.h> instead."
4#endif 4#endif
5 5
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 202710420d6d..3672353a0acd 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -2,111 +2,12 @@
2#ifndef __LINUX_COMPILER_H 2#ifndef __LINUX_COMPILER_H
3#define __LINUX_COMPILER_H 3#define __LINUX_COMPILER_H
4 4
5#ifndef __ASSEMBLY__ 5#include <linux/compiler_types.h>
6 6
7#ifdef __CHECKER__ 7#ifndef __ASSEMBLY__
8# define __user __attribute__((noderef, address_space(1)))
9# define __kernel __attribute__((address_space(0)))
10# define __safe __attribute__((safe))
11# define __force __attribute__((force))
12# define __nocast __attribute__((nocast))
13# define __iomem __attribute__((noderef, address_space(2)))
14# define __must_hold(x) __attribute__((context(x,1,1)))
15# define __acquires(x) __attribute__((context(x,0,1)))
16# define __releases(x) __attribute__((context(x,1,0)))
17# define __acquire(x) __context__(x,1)
18# define __release(x) __context__(x,-1)
19# define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0)
20# define __percpu __attribute__((noderef, address_space(3)))
21# define __rcu __attribute__((noderef, address_space(4)))
22# define __private __attribute__((noderef))
23extern void __chk_user_ptr(const volatile void __user *);
24extern void __chk_io_ptr(const volatile void __iomem *);
25# define ACCESS_PRIVATE(p, member) (*((typeof((p)->member) __force *) &(p)->member))
26#else /* __CHECKER__ */
27# ifdef STRUCTLEAK_PLUGIN
28# define __user __attribute__((user))
29# else
30# define __user
31# endif
32# define __kernel
33# define __safe
34# define __force
35# define __nocast
36# define __iomem
37# define __chk_user_ptr(x) (void)0
38# define __chk_io_ptr(x) (void)0
39# define __builtin_warning(x, y...) (1)
40# define __must_hold(x)
41# define __acquires(x)
42# define __releases(x)
43# define __acquire(x) (void)0
44# define __release(x) (void)0
45# define __cond_lock(x,c) (c)
46# define __percpu
47# define __rcu
48# define __private
49# define ACCESS_PRIVATE(p, member) ((p)->member)
50#endif /* __CHECKER__ */
51
52/* Indirect macros required for expanded argument pasting, eg. __LINE__. */
53#define ___PASTE(a,b) a##b
54#define __PASTE(a,b) ___PASTE(a,b)
55 8
56#ifdef __KERNEL__ 9#ifdef __KERNEL__
57 10
58#ifdef __GNUC__
59#include <linux/compiler-gcc.h>
60#endif
61
62#if defined(CC_USING_HOTPATCH) && !defined(__CHECKER__)
63#define notrace __attribute__((hotpatch(0,0)))
64#else
65#define notrace __attribute__((no_instrument_function))
66#endif
67
68/* Intel compiler defines __GNUC__. So we will overwrite implementations
69 * coming from above header files here
70 */
71#ifdef __INTEL_COMPILER
72# include <linux/compiler-intel.h>
73#endif
74
75/* Clang compiler defines __GNUC__. So we will overwrite implementations
76 * coming from above header files here
77 */
78#ifdef __clang__
79#include <linux/compiler-clang.h>
80#endif
81
82/*
83 * Generic compiler-dependent macros required for kernel
84 * build go below this comment. Actual compiler/compiler version
85 * specific implementations come from the above header files
86 */
87
88struct ftrace_branch_data {
89 const char *func;
90 const char *file;
91 unsigned line;
92 union {
93 struct {
94 unsigned long correct;
95 unsigned long incorrect;
96 };
97 struct {
98 unsigned long miss;
99 unsigned long hit;
100 };
101 unsigned long miss_hit[2];
102 };
103};
104
105struct ftrace_likely_data {
106 struct ftrace_branch_data data;
107 unsigned long constant;
108};
109
110/* 11/*
111 * Note: DISABLE_BRANCH_PROFILING can be used by special lowlevel code 12 * Note: DISABLE_BRANCH_PROFILING can be used by special lowlevel code
112 * to disable branch tracing on a per file basis. 13 * to disable branch tracing on a per file basis.
@@ -333,6 +234,7 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
333 * with an explicit memory barrier or atomic instruction that provides the 234 * with an explicit memory barrier or atomic instruction that provides the
334 * required ordering. 235 * required ordering.
335 */ 236 */
237#include <asm/barrier.h>
336 238
337#define __READ_ONCE(x, check) \ 239#define __READ_ONCE(x, check) \
338({ \ 240({ \
@@ -341,6 +243,7 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
341 __read_once_size(&(x), __u.__c, sizeof(x)); \ 243 __read_once_size(&(x), __u.__c, sizeof(x)); \
342 else \ 244 else \
343 __read_once_size_nocheck(&(x), __u.__c, sizeof(x)); \ 245 __read_once_size_nocheck(&(x), __u.__c, sizeof(x)); \
246 smp_read_barrier_depends(); /* Enforce dependency ordering from x */ \
344 __u.__val; \ 247 __u.__val; \
345}) 248})
346#define READ_ONCE(x) __READ_ONCE(x, 1) 249#define READ_ONCE(x) __READ_ONCE(x, 1)
@@ -363,167 +266,6 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
363 266
364#endif /* __ASSEMBLY__ */ 267#endif /* __ASSEMBLY__ */
365 268
366#ifdef __KERNEL__
367/*
368 * Allow us to mark functions as 'deprecated' and have gcc emit a nice
369 * warning for each use, in hopes of speeding the functions removal.
370 * Usage is:
371 * int __deprecated foo(void)
372 */
373#ifndef __deprecated
374# define __deprecated /* unimplemented */
375#endif
376
377#ifdef MODULE
378#define __deprecated_for_modules __deprecated
379#else
380#define __deprecated_for_modules
381#endif
382
383#ifndef __must_check
384#define __must_check
385#endif
386
387#ifndef CONFIG_ENABLE_MUST_CHECK
388#undef __must_check
389#define __must_check
390#endif
391#ifndef CONFIG_ENABLE_WARN_DEPRECATED
392#undef __deprecated
393#undef __deprecated_for_modules
394#define __deprecated
395#define __deprecated_for_modules
396#endif
397
398#ifndef __malloc
399#define __malloc
400#endif
401
402/*
403 * Allow us to avoid 'defined but not used' warnings on functions and data,
404 * as well as force them to be emitted to the assembly file.
405 *
406 * As of gcc 3.4, static functions that are not marked with attribute((used))
407 * may be elided from the assembly file. As of gcc 3.4, static data not so
408 * marked will not be elided, but this may change in a future gcc version.
409 *
410 * NOTE: Because distributions shipped with a backported unit-at-a-time
411 * compiler in gcc 3.3, we must define __used to be __attribute__((used))
412 * for gcc >=3.3 instead of 3.4.
413 *
414 * In prior versions of gcc, such functions and data would be emitted, but
415 * would be warned about except with attribute((unused)).
416 *
417 * Mark functions that are referenced only in inline assembly as __used so
418 * the code is emitted even though it appears to be unreferenced.
419 */
420#ifndef __used
421# define __used /* unimplemented */
422#endif
423
424#ifndef __maybe_unused
425# define __maybe_unused /* unimplemented */
426#endif
427
428#ifndef __always_unused
429# define __always_unused /* unimplemented */
430#endif
431
432#ifndef noinline
433#define noinline
434#endif
435
436/*
437 * Rather then using noinline to prevent stack consumption, use
438 * noinline_for_stack instead. For documentation reasons.
439 */
440#define noinline_for_stack noinline
441
442#ifndef __always_inline
443#define __always_inline inline
444#endif
445
446#endif /* __KERNEL__ */
447
448/*
449 * From the GCC manual:
450 *
451 * Many functions do not examine any values except their arguments,
452 * and have no effects except the return value. Basically this is
453 * just slightly more strict class than the `pure' attribute above,
454 * since function is not allowed to read global memory.
455 *
456 * Note that a function that has pointer arguments and examines the
457 * data pointed to must _not_ be declared `const'. Likewise, a
458 * function that calls a non-`const' function usually must not be
459 * `const'. It does not make sense for a `const' function to return
460 * `void'.
461 */
462#ifndef __attribute_const__
463# define __attribute_const__ /* unimplemented */
464#endif
465
466#ifndef __designated_init
467# define __designated_init
468#endif
469
470#ifndef __latent_entropy
471# define __latent_entropy
472#endif
473
474#ifndef __randomize_layout
475# define __randomize_layout __designated_init
476#endif
477
478#ifndef __no_randomize_layout
479# define __no_randomize_layout
480#endif
481
482#ifndef randomized_struct_fields_start
483# define randomized_struct_fields_start
484# define randomized_struct_fields_end
485#endif
486
487/*
488 * Tell gcc if a function is cold. The compiler will assume any path
489 * directly leading to the call is unlikely.
490 */
491
492#ifndef __cold
493#define __cold
494#endif
495
496/* Simple shorthand for a section definition */
497#ifndef __section
498# define __section(S) __attribute__ ((__section__(#S)))
499#endif
500
501#ifndef __visible
502#define __visible
503#endif
504
505#ifndef __nostackprotector
506# define __nostackprotector
507#endif
508
509/*
510 * Assume alignment of return value.
511 */
512#ifndef __assume_aligned
513#define __assume_aligned(a, ...)
514#endif
515
516
517/* Are two types/vars the same type (ignoring qualifiers)? */
518#ifndef __same_type
519# define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
520#endif
521
522/* Is this type a native word size -- useful for atomic operations */
523#ifndef __native_word
524# define __native_word(t) (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long))
525#endif
526
527/* Compile time object size, -1 for unknown */ 269/* Compile time object size, -1 for unknown */
528#ifndef __compiletime_object_size 270#ifndef __compiletime_object_size
529# define __compiletime_object_size(obj) -1 271# define __compiletime_object_size(obj) -1
@@ -605,24 +347,4 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
605 (volatile typeof(x) *)&(x); }) 347 (volatile typeof(x) *)&(x); })
606#define ACCESS_ONCE(x) (*__ACCESS_ONCE(x)) 348#define ACCESS_ONCE(x) (*__ACCESS_ONCE(x))
607 349
608/**
609 * lockless_dereference() - safely load a pointer for later dereference
610 * @p: The pointer to load
611 *
612 * Similar to rcu_dereference(), but for situations where the pointed-to
613 * object's lifetime is managed by something other than RCU. That
614 * "something other" might be reference counting or simple immortality.
615 *
616 * The seemingly unused variable ___typecheck_p validates that @p is
617 * indeed a pointer type by using a pointer to typeof(*p) as the type.
618 * Taking a pointer to typeof(*p) again is needed in case p is void *.
619 */
620#define lockless_dereference(p) \
621({ \
622 typeof(p) _________p1 = READ_ONCE(p); \
623 typeof(*(p)) *___typecheck_p __maybe_unused; \
624 smp_read_barrier_depends(); /* Dependency order vs. p above. */ \
625 (_________p1); \
626})
627
628#endif /* __LINUX_COMPILER_H */ 350#endif /* __LINUX_COMPILER_H */
diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h
new file mode 100644
index 000000000000..6b79a9bba9a7
--- /dev/null
+++ b/include/linux/compiler_types.h
@@ -0,0 +1,274 @@
1#ifndef __LINUX_COMPILER_TYPES_H
2#define __LINUX_COMPILER_TYPES_H
3
4#ifndef __ASSEMBLY__
5
6#ifdef __CHECKER__
7# define __user __attribute__((noderef, address_space(1)))
8# define __kernel __attribute__((address_space(0)))
9# define __safe __attribute__((safe))
10# define __force __attribute__((force))
11# define __nocast __attribute__((nocast))
12# define __iomem __attribute__((noderef, address_space(2)))
13# define __must_hold(x) __attribute__((context(x,1,1)))
14# define __acquires(x) __attribute__((context(x,0,1)))
15# define __releases(x) __attribute__((context(x,1,0)))
16# define __acquire(x) __context__(x,1)
17# define __release(x) __context__(x,-1)
18# define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0)
19# define __percpu __attribute__((noderef, address_space(3)))
20# define __rcu __attribute__((noderef, address_space(4)))
21# define __private __attribute__((noderef))
22extern void __chk_user_ptr(const volatile void __user *);
23extern void __chk_io_ptr(const volatile void __iomem *);
24# define ACCESS_PRIVATE(p, member) (*((typeof((p)->member) __force *) &(p)->member))
25#else /* __CHECKER__ */
26# ifdef STRUCTLEAK_PLUGIN
27# define __user __attribute__((user))
28# else
29# define __user
30# endif
31# define __kernel
32# define __safe
33# define __force
34# define __nocast
35# define __iomem
36# define __chk_user_ptr(x) (void)0
37# define __chk_io_ptr(x) (void)0
38# define __builtin_warning(x, y...) (1)
39# define __must_hold(x)
40# define __acquires(x)
41# define __releases(x)
42# define __acquire(x) (void)0
43# define __release(x) (void)0
44# define __cond_lock(x,c) (c)
45# define __percpu
46# define __rcu
47# define __private
48# define ACCESS_PRIVATE(p, member) ((p)->member)
49#endif /* __CHECKER__ */
50
51/* Indirect macros required for expanded argument pasting, eg. __LINE__. */
52#define ___PASTE(a,b) a##b
53#define __PASTE(a,b) ___PASTE(a,b)
54
55#ifdef __KERNEL__
56
57#ifdef __GNUC__
58#include <linux/compiler-gcc.h>
59#endif
60
61#if defined(CC_USING_HOTPATCH) && !defined(__CHECKER__)
62#define notrace __attribute__((hotpatch(0,0)))
63#else
64#define notrace __attribute__((no_instrument_function))
65#endif
66
67/* Intel compiler defines __GNUC__. So we will overwrite implementations
68 * coming from above header files here
69 */
70#ifdef __INTEL_COMPILER
71# include <linux/compiler-intel.h>
72#endif
73
74/* Clang compiler defines __GNUC__. So we will overwrite implementations
75 * coming from above header files here
76 */
77#ifdef __clang__
78#include <linux/compiler-clang.h>
79#endif
80
81/*
82 * Generic compiler-dependent macros required for kernel
83 * build go below this comment. Actual compiler/compiler version
84 * specific implementations come from the above header files
85 */
86
87struct ftrace_branch_data {
88 const char *func;
89 const char *file;
90 unsigned line;
91 union {
92 struct {
93 unsigned long correct;
94 unsigned long incorrect;
95 };
96 struct {
97 unsigned long miss;
98 unsigned long hit;
99 };
100 unsigned long miss_hit[2];
101 };
102};
103
104struct ftrace_likely_data {
105 struct ftrace_branch_data data;
106 unsigned long constant;
107};
108
109#endif /* __KERNEL__ */
110
111#endif /* __ASSEMBLY__ */
112
113#ifdef __KERNEL__
114/*
115 * Allow us to mark functions as 'deprecated' and have gcc emit a nice
116 * warning for each use, in hopes of speeding the functions removal.
117 * Usage is:
118 * int __deprecated foo(void)
119 */
120#ifndef __deprecated
121# define __deprecated /* unimplemented */
122#endif
123
124#ifdef MODULE
125#define __deprecated_for_modules __deprecated
126#else
127#define __deprecated_for_modules
128#endif
129
130#ifndef __must_check
131#define __must_check
132#endif
133
134#ifndef CONFIG_ENABLE_MUST_CHECK
135#undef __must_check
136#define __must_check
137#endif
138#ifndef CONFIG_ENABLE_WARN_DEPRECATED
139#undef __deprecated
140#undef __deprecated_for_modules
141#define __deprecated
142#define __deprecated_for_modules
143#endif
144
145#ifndef __malloc
146#define __malloc
147#endif
148
149/*
150 * Allow us to avoid 'defined but not used' warnings on functions and data,
151 * as well as force them to be emitted to the assembly file.
152 *
153 * As of gcc 3.4, static functions that are not marked with attribute((used))
154 * may be elided from the assembly file. As of gcc 3.4, static data not so
155 * marked will not be elided, but this may change in a future gcc version.
156 *
157 * NOTE: Because distributions shipped with a backported unit-at-a-time
158 * compiler in gcc 3.3, we must define __used to be __attribute__((used))
159 * for gcc >=3.3 instead of 3.4.
160 *
161 * In prior versions of gcc, such functions and data would be emitted, but
162 * would be warned about except with attribute((unused)).
163 *
164 * Mark functions that are referenced only in inline assembly as __used so
165 * the code is emitted even though it appears to be unreferenced.
166 */
167#ifndef __used
168# define __used /* unimplemented */
169#endif
170
171#ifndef __maybe_unused
172# define __maybe_unused /* unimplemented */
173#endif
174
175#ifndef __always_unused
176# define __always_unused /* unimplemented */
177#endif
178
179#ifndef noinline
180#define noinline
181#endif
182
183/*
184 * Rather then using noinline to prevent stack consumption, use
185 * noinline_for_stack instead. For documentation reasons.
186 */
187#define noinline_for_stack noinline
188
189#ifndef __always_inline
190#define __always_inline inline
191#endif
192
193#endif /* __KERNEL__ */
194
195/*
196 * From the GCC manual:
197 *
198 * Many functions do not examine any values except their arguments,
199 * and have no effects except the return value. Basically this is
200 * just slightly more strict class than the `pure' attribute above,
201 * since function is not allowed to read global memory.
202 *
203 * Note that a function that has pointer arguments and examines the
204 * data pointed to must _not_ be declared `const'. Likewise, a
205 * function that calls a non-`const' function usually must not be
206 * `const'. It does not make sense for a `const' function to return
207 * `void'.
208 */
209#ifndef __attribute_const__
210# define __attribute_const__ /* unimplemented */
211#endif
212
213#ifndef __designated_init
214# define __designated_init
215#endif
216
217#ifndef __latent_entropy
218# define __latent_entropy
219#endif
220
221#ifndef __randomize_layout
222# define __randomize_layout __designated_init
223#endif
224
225#ifndef __no_randomize_layout
226# define __no_randomize_layout
227#endif
228
229#ifndef randomized_struct_fields_start
230# define randomized_struct_fields_start
231# define randomized_struct_fields_end
232#endif
233
234/*
235 * Tell gcc if a function is cold. The compiler will assume any path
236 * directly leading to the call is unlikely.
237 */
238
239#ifndef __cold
240#define __cold
241#endif
242
243/* Simple shorthand for a section definition */
244#ifndef __section
245# define __section(S) __attribute__ ((__section__(#S)))
246#endif
247
248#ifndef __visible
249#define __visible
250#endif
251
252#ifndef __nostackprotector
253# define __nostackprotector
254#endif
255
256/*
257 * Assume alignment of return value.
258 */
259#ifndef __assume_aligned
260#define __assume_aligned(a, ...)
261#endif
262
263
264/* Are two types/vars the same type (ignoring qualifiers)? */
265#ifndef __same_type
266# define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
267#endif
268
269/* Is this type a native word size -- useful for atomic operations */
270#ifndef __native_word
271# define __native_word(t) (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long))
272#endif
273
274#endif /* __LINUX_COMPILER_TYPES_H */
diff --git a/include/linux/completion.h b/include/linux/completion.h
index 7828451e161a..0662a417febe 100644
--- a/include/linux/completion.h
+++ b/include/linux/completion.h
@@ -50,15 +50,23 @@ static inline void complete_release_commit(struct completion *x)
50 lock_commit_crosslock((struct lockdep_map *)&x->map); 50 lock_commit_crosslock((struct lockdep_map *)&x->map);
51} 51}
52 52
53#define init_completion_map(x, m) \
54do { \
55 lockdep_init_map_crosslock((struct lockdep_map *)&(x)->map, \
56 (m)->name, (m)->key, 0); \
57 __init_completion(x); \
58} while (0)
59
53#define init_completion(x) \ 60#define init_completion(x) \
54do { \ 61do { \
55 static struct lock_class_key __key; \ 62 static struct lock_class_key __key; \
56 lockdep_init_map_crosslock((struct lockdep_map *)&(x)->map, \ 63 lockdep_init_map_crosslock((struct lockdep_map *)&(x)->map, \
57 "(complete)" #x, \ 64 "(completion)" #x, \
58 &__key, 0); \ 65 &__key, 0); \
59 __init_completion(x); \ 66 __init_completion(x); \
60} while (0) 67} while (0)
61#else 68#else
69#define init_completion_map(x, m) __init_completion(x)
62#define init_completion(x) __init_completion(x) 70#define init_completion(x) __init_completion(x)
63static inline void complete_acquire(struct completion *x) {} 71static inline void complete_acquire(struct completion *x) {}
64static inline void complete_release(struct completion *x) {} 72static inline void complete_release(struct completion *x) {}
@@ -68,12 +76,15 @@ static inline void complete_release_commit(struct completion *x) {}
68#ifdef CONFIG_LOCKDEP_COMPLETIONS 76#ifdef CONFIG_LOCKDEP_COMPLETIONS
69#define COMPLETION_INITIALIZER(work) \ 77#define COMPLETION_INITIALIZER(work) \
70 { 0, __WAIT_QUEUE_HEAD_INITIALIZER((work).wait), \ 78 { 0, __WAIT_QUEUE_HEAD_INITIALIZER((work).wait), \
71 STATIC_CROSS_LOCKDEP_MAP_INIT("(complete)" #work, &(work)) } 79 STATIC_CROSS_LOCKDEP_MAP_INIT("(completion)" #work, &(work)) }
72#else 80#else
73#define COMPLETION_INITIALIZER(work) \ 81#define COMPLETION_INITIALIZER(work) \
74 { 0, __WAIT_QUEUE_HEAD_INITIALIZER((work).wait) } 82 { 0, __WAIT_QUEUE_HEAD_INITIALIZER((work).wait) }
75#endif 83#endif
76 84
85#define COMPLETION_INITIALIZER_ONSTACK_MAP(work, map) \
86 (*({ init_completion_map(&(work), &(map)); &(work); }))
87
77#define COMPLETION_INITIALIZER_ONSTACK(work) \ 88#define COMPLETION_INITIALIZER_ONSTACK(work) \
78 (*({ init_completion(&work); &work; })) 89 (*({ init_completion(&work); &work; }))
79 90
@@ -103,8 +114,11 @@ static inline void complete_release_commit(struct completion *x) {}
103#ifdef CONFIG_LOCKDEP 114#ifdef CONFIG_LOCKDEP
104# define DECLARE_COMPLETION_ONSTACK(work) \ 115# define DECLARE_COMPLETION_ONSTACK(work) \
105 struct completion work = COMPLETION_INITIALIZER_ONSTACK(work) 116 struct completion work = COMPLETION_INITIALIZER_ONSTACK(work)
117# define DECLARE_COMPLETION_ONSTACK_MAP(work, map) \
118 struct completion work = COMPLETION_INITIALIZER_ONSTACK_MAP(work, map)
106#else 119#else
107# define DECLARE_COMPLETION_ONSTACK(work) DECLARE_COMPLETION(work) 120# define DECLARE_COMPLETION_ONSTACK(work) DECLARE_COMPLETION(work)
121# define DECLARE_COMPLETION_ONSTACK_MAP(work, map) DECLARE_COMPLETION(work)
108#endif 122#endif
109 123
110/** 124/**
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 938ea8ae0ba4..a04ef7c15c6a 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -56,27 +56,17 @@ extern void unregister_cpu(struct cpu *cpu);
56extern ssize_t arch_cpu_probe(const char *, size_t); 56extern ssize_t arch_cpu_probe(const char *, size_t);
57extern ssize_t arch_cpu_release(const char *, size_t); 57extern ssize_t arch_cpu_release(const char *, size_t);
58#endif 58#endif
59struct notifier_block; 59
60 60/*
61#define CPU_ONLINE 0x0002 /* CPU (unsigned)v is up */ 61 * These states are not related to the core CPU hotplug mechanism. They are
62#define CPU_UP_PREPARE 0x0003 /* CPU (unsigned)v coming up */ 62 * used by various (sub)architectures to track internal state
63#define CPU_DEAD 0x0007 /* CPU (unsigned)v dead */
64#define CPU_POST_DEAD 0x0009 /* CPU (unsigned)v dead, cpu_hotplug
65 * lock is dropped */
66#define CPU_BROKEN 0x000B /* CPU (unsigned)v did not die properly,
67 * perhaps due to preemption. */
68
69/* Used for CPU hotplug events occurring while tasks are frozen due to a suspend
70 * operation in progress
71 */ 63 */
72#define CPU_TASKS_FROZEN 0x0010 64#define CPU_ONLINE 0x0002 /* CPU is up */
73 65#define CPU_UP_PREPARE 0x0003 /* CPU coming up */
74#define CPU_ONLINE_FROZEN (CPU_ONLINE | CPU_TASKS_FROZEN) 66#define CPU_DEAD 0x0007 /* CPU dead */
75#define CPU_UP_PREPARE_FROZEN (CPU_UP_PREPARE | CPU_TASKS_FROZEN) 67#define CPU_DEAD_FROZEN 0x0008 /* CPU timed out on unplug */
76#define CPU_UP_CANCELED_FROZEN (CPU_UP_CANCELED | CPU_TASKS_FROZEN) 68#define CPU_POST_DEAD 0x0009 /* CPU successfully unplugged */
77#define CPU_DOWN_PREPARE_FROZEN (CPU_DOWN_PREPARE | CPU_TASKS_FROZEN) 69#define CPU_BROKEN 0x000B /* CPU did not die properly */
78#define CPU_DOWN_FAILED_FROZEN (CPU_DOWN_FAILED | CPU_TASKS_FROZEN)
79#define CPU_DEAD_FROZEN (CPU_DEAD | CPU_TASKS_FROZEN)
80 70
81#ifdef CONFIG_SMP 71#ifdef CONFIG_SMP
82extern bool cpuhp_tasks_frozen; 72extern bool cpuhp_tasks_frozen;
diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
index 2477a5cb5bd5..ec32c4c5eb30 100644
--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
@@ -99,6 +99,7 @@ enum cpuhp_state {
99 CPUHP_AP_IRQ_HIP04_STARTING, 99 CPUHP_AP_IRQ_HIP04_STARTING,
100 CPUHP_AP_IRQ_ARMADA_XP_STARTING, 100 CPUHP_AP_IRQ_ARMADA_XP_STARTING,
101 CPUHP_AP_IRQ_BCM2836_STARTING, 101 CPUHP_AP_IRQ_BCM2836_STARTING,
102 CPUHP_AP_IRQ_MIPS_GIC_STARTING,
102 CPUHP_AP_ARM_MVEBU_COHERENCY, 103 CPUHP_AP_ARM_MVEBU_COHERENCY,
103 CPUHP_AP_PERF_X86_AMD_UNCORE_STARTING, 104 CPUHP_AP_PERF_X86_AMD_UNCORE_STARTING,
104 CPUHP_AP_PERF_X86_STARTING, 105 CPUHP_AP_PERF_X86_STARTING,
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 8d3125c493b2..75b565194437 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -131,6 +131,11 @@ static inline unsigned int cpumask_first(const struct cpumask *srcp)
131 return 0; 131 return 0;
132} 132}
133 133
134static inline unsigned int cpumask_last(const struct cpumask *srcp)
135{
136 return 0;
137}
138
134/* Valid inputs for n are -1 and 0. */ 139/* Valid inputs for n are -1 and 0. */
135static inline unsigned int cpumask_next(int n, const struct cpumask *srcp) 140static inline unsigned int cpumask_next(int n, const struct cpumask *srcp)
136{ 141{
@@ -179,6 +184,17 @@ static inline unsigned int cpumask_first(const struct cpumask *srcp)
179 return find_first_bit(cpumask_bits(srcp), nr_cpumask_bits); 184 return find_first_bit(cpumask_bits(srcp), nr_cpumask_bits);
180} 185}
181 186
187/**
188 * cpumask_last - get the last CPU in a cpumask
189 * @srcp: - the cpumask pointer
190 *
191 * Returns >= nr_cpumask_bits if no CPUs set.
192 */
193static inline unsigned int cpumask_last(const struct cpumask *srcp)
194{
195 return find_last_bit(cpumask_bits(srcp), nr_cpumask_bits);
196}
197
182unsigned int cpumask_next(int n, const struct cpumask *srcp); 198unsigned int cpumask_next(int n, const struct cpumask *srcp);
183 199
184/** 200/**
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index f05a659cdf34..65cd8ab60b7a 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -520,7 +520,7 @@ static inline struct inode *d_inode(const struct dentry *dentry)
520} 520}
521 521
522/** 522/**
523 * d_inode_rcu - Get the actual inode of this dentry with ACCESS_ONCE() 523 * d_inode_rcu - Get the actual inode of this dentry with READ_ONCE()
524 * @dentry: The dentry to query 524 * @dentry: The dentry to query
525 * 525 *
526 * This is the helper normal filesystems should use to get at their own inodes 526 * This is the helper normal filesystems should use to get at their own inodes
@@ -528,7 +528,7 @@ static inline struct inode *d_inode(const struct dentry *dentry)
528 */ 528 */
529static inline struct inode *d_inode_rcu(const struct dentry *dentry) 529static inline struct inode *d_inode_rcu(const struct dentry *dentry)
530{ 530{
531 return ACCESS_ONCE(dentry->d_inode); 531 return READ_ONCE(dentry->d_inode);
532} 532}
533 533
534/** 534/**
diff --git a/include/linux/dynamic_queue_limits.h b/include/linux/dynamic_queue_limits.h
index 34c0a5464c74..023eae69398c 100644
--- a/include/linux/dynamic_queue_limits.h
+++ b/include/linux/dynamic_queue_limits.h
@@ -89,7 +89,7 @@ static inline void dql_queued(struct dql *dql, unsigned int count)
89/* Returns how many objects can be queued, < 0 indicates over limit. */ 89/* Returns how many objects can be queued, < 0 indicates over limit. */
90static inline int dql_avail(const struct dql *dql) 90static inline int dql_avail(const struct dql *dql)
91{ 91{
92 return ACCESS_ONCE(dql->adj_limit) - ACCESS_ONCE(dql->num_queued); 92 return READ_ONCE(dql->adj_limit) - READ_ONCE(dql->num_queued);
93} 93}
94 94
95/* Record number of completed objects and recalculate the limit. */ 95/* Record number of completed objects and recalculate the limit. */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 885266aae2d7..e1f75a3b4af5 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2793,6 +2793,7 @@ extern int do_pipe_flags(int *, int);
2793 id(KEXEC_IMAGE, kexec-image) \ 2793 id(KEXEC_IMAGE, kexec-image) \
2794 id(KEXEC_INITRAMFS, kexec-initramfs) \ 2794 id(KEXEC_INITRAMFS, kexec-initramfs) \
2795 id(POLICY, security-policy) \ 2795 id(POLICY, security-policy) \
2796 id(X509_CERTIFICATE, x509-certificate) \
2796 id(MAX_ID, ) 2797 id(MAX_ID, )
2797 2798
2798#define __fid_enumify(ENUM, dummy) READING_ ## ENUM, 2799#define __fid_enumify(ENUM, dummy) READING_ ## ENUM,
diff --git a/include/linux/genetlink.h b/include/linux/genetlink.h
index b96dd4e1e663..ecc2928e8046 100644
--- a/include/linux/genetlink.h
+++ b/include/linux/genetlink.h
@@ -31,7 +31,7 @@ extern wait_queue_head_t genl_sk_destructing_waitq;
31 * @p: The pointer to read, prior to dereferencing 31 * @p: The pointer to read, prior to dereferencing
32 * 32 *
33 * Return the value of the specified RCU-protected pointer, but omit 33 * Return the value of the specified RCU-protected pointer, but omit
34 * both the smp_read_barrier_depends() and the ACCESS_ONCE(), because 34 * both the smp_read_barrier_depends() and the READ_ONCE(), because
35 * caller holds genl mutex. 35 * caller holds genl mutex.
36 */ 36 */
37#define genl_dereference(p) \ 37#define genl_dereference(p) \
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 44790523057f..eaefb7a62f83 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -207,6 +207,7 @@ struct gendisk {
207#endif /* CONFIG_BLK_DEV_INTEGRITY */ 207#endif /* CONFIG_BLK_DEV_INTEGRITY */
208 int node_id; 208 int node_id;
209 struct badblocks *bb; 209 struct badblocks *bb;
210 struct lockdep_map lockdep_map;
210}; 211};
211 212
212static inline struct gendisk *part_to_disk(struct hd_struct *part) 213static inline struct gendisk *part_to_disk(struct hd_struct *part)
@@ -591,8 +592,7 @@ extern void __delete_partition(struct percpu_ref *);
591extern void delete_partition(struct gendisk *, int); 592extern void delete_partition(struct gendisk *, int);
592extern void printk_all_partitions(void); 593extern void printk_all_partitions(void);
593 594
594extern struct gendisk *alloc_disk_node(int minors, int node_id); 595extern struct gendisk *__alloc_disk_node(int minors, int node_id);
595extern struct gendisk *alloc_disk(int minors);
596extern struct kobject *get_disk(struct gendisk *disk); 596extern struct kobject *get_disk(struct gendisk *disk);
597extern void put_disk(struct gendisk *disk); 597extern void put_disk(struct gendisk *disk);
598extern void blk_register_region(dev_t devt, unsigned long range, 598extern void blk_register_region(dev_t devt, unsigned long range,
@@ -616,6 +616,24 @@ extern ssize_t part_fail_store(struct device *dev,
616 const char *buf, size_t count); 616 const char *buf, size_t count);
617#endif /* CONFIG_FAIL_MAKE_REQUEST */ 617#endif /* CONFIG_FAIL_MAKE_REQUEST */
618 618
619#define alloc_disk_node(minors, node_id) \
620({ \
621 static struct lock_class_key __key; \
622 const char *__name; \
623 struct gendisk *__disk; \
624 \
625 __name = "(gendisk_completion)"#minors"("#node_id")"; \
626 \
627 __disk = __alloc_disk_node(minors, node_id); \
628 \
629 if (__disk) \
630 lockdep_init_map(&__disk->lockdep_map, __name, &__key, 0); \
631 \
632 __disk; \
633})
634
635#define alloc_disk(minors) alloc_disk_node(minors, NUMA_NO_NODE)
636
619static inline int hd_ref_init(struct hd_struct *part) 637static inline int hd_ref_init(struct hd_struct *part)
620{ 638{
621 if (percpu_ref_init(&part->ref, __delete_partition, 0, 639 if (percpu_ref_init(&part->ref, __delete_partition, 0,
diff --git a/include/linux/gpio-fan.h b/include/linux/gpio-fan.h
deleted file mode 100644
index 096659169215..000000000000
--- a/include/linux/gpio-fan.h
+++ /dev/null
@@ -1,36 +0,0 @@
1/*
2 * include/linux/gpio-fan.h
3 *
4 * Platform data structure for GPIO fan driver
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#ifndef __LINUX_GPIO_FAN_H
12#define __LINUX_GPIO_FAN_H
13
14struct gpio_fan_alarm {
15 unsigned gpio;
16 unsigned active_low;
17};
18
19struct gpio_fan_speed {
20 int rpm;
21 int ctrl_val;
22};
23
24struct gpio_fan_platform_data {
25 int num_ctrl;
26 unsigned *ctrl; /* fan control GPIOs. */
27 struct gpio_fan_alarm *alarm; /* fan alarm GPIO. */
28 /*
29 * Speed conversion array: rpm from/to GPIO bit field.
30 * This array _must_ be sorted in ascending rpm order.
31 */
32 int num_speed;
33 struct gpio_fan_speed *speed;
34};
35
36#endif /* __LINUX_GPIO_FAN_H */
diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
index 87067d23a48b..a8a126259bc4 100644
--- a/include/linux/huge_mm.h
+++ b/include/linux/huge_mm.h
@@ -222,7 +222,7 @@ extern struct page *huge_zero_page;
222 222
223static inline bool is_huge_zero_page(struct page *page) 223static inline bool is_huge_zero_page(struct page *page)
224{ 224{
225 return ACCESS_ONCE(huge_zero_page) == page; 225 return READ_ONCE(huge_zero_page) == page;
226} 226}
227 227
228static inline bool is_huge_zero_pmd(pmd_t pmd) 228static inline bool is_huge_zero_pmd(pmd_t pmd)
diff --git a/include/linux/hypervisor.h b/include/linux/hypervisor.h
index b4054fd5b6f6..b19563f9a8eb 100644
--- a/include/linux/hypervisor.h
+++ b/include/linux/hypervisor.h
@@ -7,8 +7,12 @@
7 * Juergen Gross <jgross@suse.com> 7 * Juergen Gross <jgross@suse.com>
8 */ 8 */
9 9
10#ifdef CONFIG_HYPERVISOR_GUEST 10#ifdef CONFIG_X86
11#include <asm/hypervisor.h> 11#include <asm/x86_init.h>
12static inline void hypervisor_pin_vcpu(int cpu)
13{
14 x86_platform.hyper.pin_vcpu(cpu);
15}
12#else 16#else
13static inline void hypervisor_pin_vcpu(int cpu) 17static inline void hypervisor_pin_vcpu(int cpu)
14{ 18{
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 70db3af04541..771989d25ef8 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -1212,7 +1212,7 @@ extern int ide_wait_not_busy(ide_hwif_t *hwif, unsigned long timeout);
1212 1212
1213extern void ide_stall_queue(ide_drive_t *drive, unsigned long timeout); 1213extern void ide_stall_queue(ide_drive_t *drive, unsigned long timeout);
1214 1214
1215extern void ide_timer_expiry(unsigned long); 1215extern void ide_timer_expiry(struct timer_list *t);
1216extern irqreturn_t ide_intr(int irq, void *dev_id); 1216extern irqreturn_t ide_intr(int irq, void *dev_id);
1217extern void do_ide_request(struct request_queue *); 1217extern void do_ide_request(struct request_queue *);
1218extern void ide_requeue_and_plug(ide_drive_t *drive, struct request *rq); 1218extern void ide_requeue_and_plug(ide_drive_t *drive, struct request *rq);
diff --git a/include/linux/if_team.h b/include/linux/if_team.h
index 30294603526f..d95cae09dea0 100644
--- a/include/linux/if_team.h
+++ b/include/linux/if_team.h
@@ -247,7 +247,7 @@ static inline struct team_port *team_get_port_by_index(struct team *team,
247 247
248static inline int team_num_to_port_index(struct team *team, unsigned int num) 248static inline int team_num_to_port_index(struct team *team, unsigned int num)
249{ 249{
250 int en_port_count = ACCESS_ONCE(team->en_port_count); 250 int en_port_count = READ_ONCE(team->en_port_count);
251 251
252 if (unlikely(!en_port_count)) 252 if (unlikely(!en_port_count))
253 return 0; 253 return 0;
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 83c8d6530f0f..93b4183cf53d 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -271,11 +271,14 @@ extern int
271walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages, 271walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages,
272 void *arg, int (*func)(unsigned long, unsigned long, void *)); 272 void *arg, int (*func)(unsigned long, unsigned long, void *));
273extern int 273extern int
274walk_mem_res(u64 start, u64 end, void *arg,
275 int (*func)(struct resource *, void *));
276extern int
274walk_system_ram_res(u64 start, u64 end, void *arg, 277walk_system_ram_res(u64 start, u64 end, void *arg,
275 int (*func)(u64, u64, void *)); 278 int (*func)(struct resource *, void *));
276extern int 279extern int
277walk_iomem_res_desc(unsigned long desc, unsigned long flags, u64 start, u64 end, 280walk_iomem_res_desc(unsigned long desc, unsigned long flags, u64 start, u64 end,
278 void *arg, int (*func)(u64, u64, void *)); 281 void *arg, int (*func)(struct resource *, void *));
279 282
280/* True if any part of r1 overlaps r2 */ 283/* True if any part of r1 overlaps r2 */
281static inline bool resource_overlaps(struct resource *r1, struct resource *r2) 284static inline bool resource_overlaps(struct resource *r1, struct resource *r2)
diff --git a/include/linux/ioprio.h b/include/linux/ioprio.h
index 2cdd74809899..627efac73e6d 100644
--- a/include/linux/ioprio.h
+++ b/include/linux/ioprio.h
@@ -3,6 +3,7 @@
3#define IOPRIO_H 3#define IOPRIO_H
4 4
5#include <linux/sched.h> 5#include <linux/sched.h>
6#include <linux/sched/rt.h>
6#include <linux/iocontext.h> 7#include <linux/iocontext.h>
7 8
8/* 9/*
@@ -63,7 +64,7 @@ static inline int task_nice_ioclass(struct task_struct *task)
63{ 64{
64 if (task->policy == SCHED_IDLE) 65 if (task->policy == SCHED_IDLE)
65 return IOPRIO_CLASS_IDLE; 66 return IOPRIO_CLASS_IDLE;
66 else if (task->policy == SCHED_FIFO || task->policy == SCHED_RR) 67 else if (task_is_realtime(task))
67 return IOPRIO_CLASS_RT; 68 return IOPRIO_CLASS_RT;
68 else 69 else
69 return IOPRIO_CLASS_BE; 70 return IOPRIO_CLASS_BE;
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 4536286cc4d2..b01d06db9101 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -1114,6 +1114,28 @@ static inline u32 irq_reg_readl(struct irq_chip_generic *gc,
1114 return readl(gc->reg_base + reg_offset); 1114 return readl(gc->reg_base + reg_offset);
1115} 1115}
1116 1116
1117struct irq_matrix;
1118struct irq_matrix *irq_alloc_matrix(unsigned int matrix_bits,
1119 unsigned int alloc_start,
1120 unsigned int alloc_end);
1121void irq_matrix_online(struct irq_matrix *m);
1122void irq_matrix_offline(struct irq_matrix *m);
1123void irq_matrix_assign_system(struct irq_matrix *m, unsigned int bit, bool replace);
1124int irq_matrix_reserve_managed(struct irq_matrix *m, const struct cpumask *msk);
1125void irq_matrix_remove_managed(struct irq_matrix *m, const struct cpumask *msk);
1126int irq_matrix_alloc_managed(struct irq_matrix *m, unsigned int cpu);
1127void irq_matrix_reserve(struct irq_matrix *m);
1128void irq_matrix_remove_reserved(struct irq_matrix *m);
1129int irq_matrix_alloc(struct irq_matrix *m, const struct cpumask *msk,
1130 bool reserved, unsigned int *mapped_cpu);
1131void irq_matrix_free(struct irq_matrix *m, unsigned int cpu,
1132 unsigned int bit, bool managed);
1133void irq_matrix_assign(struct irq_matrix *m, unsigned int bit);
1134unsigned int irq_matrix_available(struct irq_matrix *m, bool cpudown);
1135unsigned int irq_matrix_allocated(struct irq_matrix *m);
1136unsigned int irq_matrix_reserved(struct irq_matrix *m);
1137void irq_matrix_debug_show(struct seq_file *sf, struct irq_matrix *m, int ind);
1138
1117/* Contrary to Linux irqs, for hardware irqs the irq number 0 is valid */ 1139/* Contrary to Linux irqs, for hardware irqs the irq number 0 is valid */
1118#define INVALID_HWIRQ (~0UL) 1140#define INVALID_HWIRQ (~0UL)
1119irq_hw_number_t ipi_get_hwirq(unsigned int irq, unsigned int cpu); 1141irq_hw_number_t ipi_get_hwirq(unsigned int irq, unsigned int cpu);
diff --git a/include/linux/irq_work.h b/include/linux/irq_work.h
index 9270d73ea682..0e81035b678f 100644
--- a/include/linux/irq_work.h
+++ b/include/linux/irq_work.h
@@ -34,10 +34,7 @@ void init_irq_work(struct irq_work *work, void (*func)(struct irq_work *))
34#define DEFINE_IRQ_WORK(name, _f) struct irq_work name = { .func = (_f), } 34#define DEFINE_IRQ_WORK(name, _f) struct irq_work name = { .func = (_f), }
35 35
36bool irq_work_queue(struct irq_work *work); 36bool irq_work_queue(struct irq_work *work);
37
38#ifdef CONFIG_SMP
39bool irq_work_queue_on(struct irq_work *work, int cpu); 37bool irq_work_queue_on(struct irq_work *work, int cpu);
40#endif
41 38
42void irq_work_tick(void); 39void irq_work_tick(void);
43void irq_work_sync(struct irq_work *work); 40void irq_work_sync(struct irq_work *work);
diff --git a/include/linux/irqchip/arm-gic-v3.h b/include/linux/irqchip/arm-gic-v3.h
index 14b74f22d43c..c00c4c33e432 100644
--- a/include/linux/irqchip/arm-gic-v3.h
+++ b/include/linux/irqchip/arm-gic-v3.h
@@ -68,6 +68,7 @@
68#define GICD_CTLR_ENABLE_SS_G1 (1U << 1) 68#define GICD_CTLR_ENABLE_SS_G1 (1U << 1)
69#define GICD_CTLR_ENABLE_SS_G0 (1U << 0) 69#define GICD_CTLR_ENABLE_SS_G0 (1U << 0)
70 70
71#define GICD_TYPER_RSS (1U << 26)
71#define GICD_TYPER_LPIS (1U << 17) 72#define GICD_TYPER_LPIS (1U << 17)
72#define GICD_TYPER_MBIS (1U << 16) 73#define GICD_TYPER_MBIS (1U << 16)
73 74
@@ -461,6 +462,7 @@
461#define ICC_CTLR_EL1_SEIS_MASK (0x1 << ICC_CTLR_EL1_SEIS_SHIFT) 462#define ICC_CTLR_EL1_SEIS_MASK (0x1 << ICC_CTLR_EL1_SEIS_SHIFT)
462#define ICC_CTLR_EL1_A3V_SHIFT 15 463#define ICC_CTLR_EL1_A3V_SHIFT 15
463#define ICC_CTLR_EL1_A3V_MASK (0x1 << ICC_CTLR_EL1_A3V_SHIFT) 464#define ICC_CTLR_EL1_A3V_MASK (0x1 << ICC_CTLR_EL1_A3V_SHIFT)
465#define ICC_CTLR_EL1_RSS (0x1 << 18)
464#define ICC_PMR_EL1_SHIFT 0 466#define ICC_PMR_EL1_SHIFT 0
465#define ICC_PMR_EL1_MASK (0xff << ICC_PMR_EL1_SHIFT) 467#define ICC_PMR_EL1_MASK (0xff << ICC_PMR_EL1_SHIFT)
466#define ICC_BPR0_EL1_SHIFT 0 468#define ICC_BPR0_EL1_SHIFT 0
@@ -549,6 +551,8 @@
549#define ICC_SGI1R_AFFINITY_2_SHIFT 32 551#define ICC_SGI1R_AFFINITY_2_SHIFT 32
550#define ICC_SGI1R_AFFINITY_2_MASK (0xffULL << ICC_SGI1R_AFFINITY_2_SHIFT) 552#define ICC_SGI1R_AFFINITY_2_MASK (0xffULL << ICC_SGI1R_AFFINITY_2_SHIFT)
551#define ICC_SGI1R_IRQ_ROUTING_MODE_BIT 40 553#define ICC_SGI1R_IRQ_ROUTING_MODE_BIT 40
554#define ICC_SGI1R_RS_SHIFT 44
555#define ICC_SGI1R_RS_MASK (0xfULL << ICC_SGI1R_RS_SHIFT)
552#define ICC_SGI1R_AFFINITY_3_SHIFT 48 556#define ICC_SGI1R_AFFINITY_3_SHIFT 48
553#define ICC_SGI1R_AFFINITY_3_MASK (0xffULL << ICC_SGI1R_AFFINITY_3_SHIFT) 557#define ICC_SGI1R_AFFINITY_3_MASK (0xffULL << ICC_SGI1R_AFFINITY_3_SHIFT)
554 558
diff --git a/include/linux/irqchip/arm-gic-v4.h b/include/linux/irqchip/arm-gic-v4.h
index 58a4d89aa82c..447da8ca2156 100644
--- a/include/linux/irqchip/arm-gic-v4.h
+++ b/include/linux/irqchip/arm-gic-v4.h
@@ -20,6 +20,12 @@
20 20
21struct its_vpe; 21struct its_vpe;
22 22
23/*
24 * Maximum number of ITTs when GITS_TYPER.VMOVP == 0, using the
25 * ITSList mechanism to perform inter-ITS synchronization.
26 */
27#define GICv4_ITS_LIST_MAX 16
28
23/* Embedded in kvm.arch */ 29/* Embedded in kvm.arch */
24struct its_vm { 30struct its_vm {
25 struct fwnode_handle *fwnode; 31 struct fwnode_handle *fwnode;
@@ -30,6 +36,7 @@ struct its_vm {
30 irq_hw_number_t db_lpi_base; 36 irq_hw_number_t db_lpi_base;
31 unsigned long *db_bitmap; 37 unsigned long *db_bitmap;
32 int nr_db_lpis; 38 int nr_db_lpis;
39 u32 vlpi_count[GICv4_ITS_LIST_MAX];
33}; 40};
34 41
35/* Embedded in kvm_vcpu.arch */ 42/* Embedded in kvm_vcpu.arch */
@@ -64,12 +71,14 @@ struct its_vpe {
64 * @vm: Pointer to the GICv4 notion of a VM 71 * @vm: Pointer to the GICv4 notion of a VM
65 * @vpe: Pointer to the GICv4 notion of a virtual CPU (VPE) 72 * @vpe: Pointer to the GICv4 notion of a virtual CPU (VPE)
66 * @vintid: Virtual LPI number 73 * @vintid: Virtual LPI number
74 * @properties: Priority and enable bits (as written in the prop table)
67 * @db_enabled: Is the VPE doorbell to be generated? 75 * @db_enabled: Is the VPE doorbell to be generated?
68 */ 76 */
69struct its_vlpi_map { 77struct its_vlpi_map {
70 struct its_vm *vm; 78 struct its_vm *vm;
71 struct its_vpe *vpe; 79 struct its_vpe *vpe;
72 u32 vintid; 80 u32 vintid;
81 u8 properties;
73 bool db_enabled; 82 bool db_enabled;
74}; 83};
75 84
diff --git a/include/linux/irqchip/irq-omap-intc.h b/include/linux/irqchip/irq-omap-intc.h
index 2e3d1afeb674..f19ccee7749f 100644
--- a/include/linux/irqchip/irq-omap-intc.h
+++ b/include/linux/irqchip/irq-omap-intc.h
@@ -18,8 +18,6 @@
18#ifndef __INCLUDE_LINUX_IRQCHIP_IRQ_OMAP_INTC_H 18#ifndef __INCLUDE_LINUX_IRQCHIP_IRQ_OMAP_INTC_H
19#define __INCLUDE_LINUX_IRQCHIP_IRQ_OMAP_INTC_H 19#define __INCLUDE_LINUX_IRQCHIP_IRQ_OMAP_INTC_H
20 20
21void omap3_init_irq(void);
22
23int omap_irq_pending(void); 21int omap_irq_pending(void);
24void omap_intc_save_context(void); 22void omap_intc_save_context(void);
25void omap_intc_restore_context(void); 23void omap_intc_restore_context(void);
diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h
index b6084898d330..60e3100b0809 100644
--- a/include/linux/irqdesc.h
+++ b/include/linux/irqdesc.h
@@ -94,6 +94,7 @@ struct irq_desc {
94#endif 94#endif
95#ifdef CONFIG_GENERIC_IRQ_DEBUGFS 95#ifdef CONFIG_GENERIC_IRQ_DEBUGFS
96 struct dentry *debugfs_file; 96 struct dentry *debugfs_file;
97 const char *dev_name;
97#endif 98#endif
98#ifdef CONFIG_SPARSE_IRQ 99#ifdef CONFIG_SPARSE_IRQ
99 struct rcu_head rcu; 100 struct rcu_head rcu;
diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index b1037dfc47e4..a34355d19546 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -33,6 +33,7 @@
33#include <linux/types.h> 33#include <linux/types.h>
34#include <linux/irqhandler.h> 34#include <linux/irqhandler.h>
35#include <linux/of.h> 35#include <linux/of.h>
36#include <linux/mutex.h>
36#include <linux/radix-tree.h> 37#include <linux/radix-tree.h>
37 38
38struct device_node; 39struct device_node;
@@ -41,6 +42,7 @@ struct of_device_id;
41struct irq_chip; 42struct irq_chip;
42struct irq_data; 43struct irq_data;
43struct cpumask; 44struct cpumask;
45struct seq_file;
44 46
45/* Number of irqs reserved for a legacy isa controller */ 47/* Number of irqs reserved for a legacy isa controller */
46#define NUM_ISA_INTERRUPTS 16 48#define NUM_ISA_INTERRUPTS 16
@@ -105,18 +107,21 @@ struct irq_domain_ops {
105 int (*xlate)(struct irq_domain *d, struct device_node *node, 107 int (*xlate)(struct irq_domain *d, struct device_node *node,
106 const u32 *intspec, unsigned int intsize, 108 const u32 *intspec, unsigned int intsize,
107 unsigned long *out_hwirq, unsigned int *out_type); 109 unsigned long *out_hwirq, unsigned int *out_type);
108
109#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY 110#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
110 /* extended V2 interfaces to support hierarchy irq_domains */ 111 /* extended V2 interfaces to support hierarchy irq_domains */
111 int (*alloc)(struct irq_domain *d, unsigned int virq, 112 int (*alloc)(struct irq_domain *d, unsigned int virq,
112 unsigned int nr_irqs, void *arg); 113 unsigned int nr_irqs, void *arg);
113 void (*free)(struct irq_domain *d, unsigned int virq, 114 void (*free)(struct irq_domain *d, unsigned int virq,
114 unsigned int nr_irqs); 115 unsigned int nr_irqs);
115 void (*activate)(struct irq_domain *d, struct irq_data *irq_data); 116 int (*activate)(struct irq_domain *d, struct irq_data *irqd, bool early);
116 void (*deactivate)(struct irq_domain *d, struct irq_data *irq_data); 117 void (*deactivate)(struct irq_domain *d, struct irq_data *irq_data);
117 int (*translate)(struct irq_domain *d, struct irq_fwspec *fwspec, 118 int (*translate)(struct irq_domain *d, struct irq_fwspec *fwspec,
118 unsigned long *out_hwirq, unsigned int *out_type); 119 unsigned long *out_hwirq, unsigned int *out_type);
119#endif 120#endif
121#ifdef CONFIG_GENERIC_IRQ_DEBUGFS
122 void (*debug_show)(struct seq_file *m, struct irq_domain *d,
123 struct irq_data *irqd, int ind);
124#endif
120}; 125};
121 126
122extern struct irq_domain_ops irq_generic_chip_ops; 127extern struct irq_domain_ops irq_generic_chip_ops;
@@ -134,8 +139,8 @@ struct irq_domain_chip_generic;
134 * @mapcount: The number of mapped interrupts 139 * @mapcount: The number of mapped interrupts
135 * 140 *
136 * Optional elements 141 * Optional elements
137 * @of_node: Pointer to device tree nodes associated with the irq_domain. Used 142 * @fwnode: Pointer to firmware node associated with the irq_domain. Pretty easy
138 * when decoding device tree interrupt specifiers. 143 * to swap it for the of_node via the irq_domain_get_of_node accessor
139 * @gc: Pointer to a list of generic chips. There is a helper function for 144 * @gc: Pointer to a list of generic chips. There is a helper function for
140 * setting up one or more generic chips for interrupt controllers 145 * setting up one or more generic chips for interrupt controllers
141 * drivers using the generic chip library which uses this pointer. 146 * drivers using the generic chip library which uses this pointer.
@@ -173,6 +178,7 @@ struct irq_domain {
173 unsigned int revmap_direct_max_irq; 178 unsigned int revmap_direct_max_irq;
174 unsigned int revmap_size; 179 unsigned int revmap_size;
175 struct radix_tree_root revmap_tree; 180 struct radix_tree_root revmap_tree;
181 struct mutex revmap_tree_mutex;
176 unsigned int linear_revmap[]; 182 unsigned int linear_revmap[];
177}; 183};
178 184
@@ -438,7 +444,7 @@ extern int __irq_domain_alloc_irqs(struct irq_domain *domain, int irq_base,
438 unsigned int nr_irqs, int node, void *arg, 444 unsigned int nr_irqs, int node, void *arg,
439 bool realloc, const struct cpumask *affinity); 445 bool realloc, const struct cpumask *affinity);
440extern void irq_domain_free_irqs(unsigned int virq, unsigned int nr_irqs); 446extern void irq_domain_free_irqs(unsigned int virq, unsigned int nr_irqs);
441extern void irq_domain_activate_irq(struct irq_data *irq_data); 447extern int irq_domain_activate_irq(struct irq_data *irq_data, bool early);
442extern void irq_domain_deactivate_irq(struct irq_data *irq_data); 448extern void irq_domain_deactivate_irq(struct irq_data *irq_data);
443 449
444static inline int irq_domain_alloc_irqs(struct irq_domain *domain, 450static inline int irq_domain_alloc_irqs(struct irq_domain *domain,
@@ -508,8 +514,6 @@ static inline bool irq_domain_is_msi_remap(struct irq_domain *domain)
508extern bool irq_domain_hierarchical_is_msi_remap(struct irq_domain *domain); 514extern bool irq_domain_hierarchical_is_msi_remap(struct irq_domain *domain);
509 515
510#else /* CONFIG_IRQ_DOMAIN_HIERARCHY */ 516#else /* CONFIG_IRQ_DOMAIN_HIERARCHY */
511static inline void irq_domain_activate_irq(struct irq_data *data) { }
512static inline void irq_domain_deactivate_irq(struct irq_data *data) { }
513static inline int irq_domain_alloc_irqs(struct irq_domain *domain, 517static inline int irq_domain_alloc_irqs(struct irq_domain *domain,
514 unsigned int nr_irqs, int node, void *arg) 518 unsigned int nr_irqs, int node, void *arg)
515{ 519{
@@ -558,8 +562,6 @@ irq_domain_hierarchical_is_msi_remap(struct irq_domain *domain)
558 562
559#else /* CONFIG_IRQ_DOMAIN */ 563#else /* CONFIG_IRQ_DOMAIN */
560static inline void irq_dispose_mapping(unsigned int virq) { } 564static inline void irq_dispose_mapping(unsigned int virq) { }
561static inline void irq_domain_activate_irq(struct irq_data *data) { }
562static inline void irq_domain_deactivate_irq(struct irq_data *data) { }
563static inline struct irq_domain *irq_find_matching_fwnode( 565static inline struct irq_domain *irq_find_matching_fwnode(
564 struct fwnode_handle *fwnode, enum irq_domain_bus_token bus_token) 566 struct fwnode_handle *fwnode, enum irq_domain_bus_token bus_token)
565{ 567{
diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h
index 3b7675bcca64..c7b368c734af 100644
--- a/include/linux/jump_label.h
+++ b/include/linux/jump_label.h
@@ -82,9 +82,9 @@
82 82
83extern bool static_key_initialized; 83extern bool static_key_initialized;
84 84
85#define STATIC_KEY_CHECK_USE() WARN(!static_key_initialized, \ 85#define STATIC_KEY_CHECK_USE(key) WARN(!static_key_initialized, \
86 "%s used before call to jump_label_init", \ 86 "%s(): static key '%pS' used before call to jump_label_init()", \
87 __func__) 87 __func__, (key))
88 88
89#ifdef HAVE_JUMP_LABEL 89#ifdef HAVE_JUMP_LABEL
90 90
@@ -212,13 +212,13 @@ static __always_inline bool static_key_true(struct static_key *key)
212 212
213static inline void static_key_slow_inc(struct static_key *key) 213static inline void static_key_slow_inc(struct static_key *key)
214{ 214{
215 STATIC_KEY_CHECK_USE(); 215 STATIC_KEY_CHECK_USE(key);
216 atomic_inc(&key->enabled); 216 atomic_inc(&key->enabled);
217} 217}
218 218
219static inline void static_key_slow_dec(struct static_key *key) 219static inline void static_key_slow_dec(struct static_key *key)
220{ 220{
221 STATIC_KEY_CHECK_USE(); 221 STATIC_KEY_CHECK_USE(key);
222 atomic_dec(&key->enabled); 222 atomic_dec(&key->enabled);
223} 223}
224 224
@@ -237,7 +237,7 @@ static inline int jump_label_apply_nops(struct module *mod)
237 237
238static inline void static_key_enable(struct static_key *key) 238static inline void static_key_enable(struct static_key *key)
239{ 239{
240 STATIC_KEY_CHECK_USE(); 240 STATIC_KEY_CHECK_USE(key);
241 241
242 if (atomic_read(&key->enabled) != 0) { 242 if (atomic_read(&key->enabled) != 0) {
243 WARN_ON_ONCE(atomic_read(&key->enabled) != 1); 243 WARN_ON_ONCE(atomic_read(&key->enabled) != 1);
@@ -248,7 +248,7 @@ static inline void static_key_enable(struct static_key *key)
248 248
249static inline void static_key_disable(struct static_key *key) 249static inline void static_key_disable(struct static_key *key)
250{ 250{
251 STATIC_KEY_CHECK_USE(); 251 STATIC_KEY_CHECK_USE(key);
252 252
253 if (atomic_read(&key->enabled) != 1) { 253 if (atomic_read(&key->enabled) != 1) {
254 WARN_ON_ONCE(atomic_read(&key->enabled) != 0); 254 WARN_ON_ONCE(atomic_read(&key->enabled) != 0);
diff --git a/include/linux/jump_label_ratelimit.h b/include/linux/jump_label_ratelimit.h
index fc13ff289903..baa8eabbaa56 100644
--- a/include/linux/jump_label_ratelimit.h
+++ b/include/linux/jump_label_ratelimit.h
@@ -25,18 +25,18 @@ struct static_key_deferred {
25}; 25};
26static inline void static_key_slow_dec_deferred(struct static_key_deferred *key) 26static inline void static_key_slow_dec_deferred(struct static_key_deferred *key)
27{ 27{
28 STATIC_KEY_CHECK_USE(); 28 STATIC_KEY_CHECK_USE(key);
29 static_key_slow_dec(&key->key); 29 static_key_slow_dec(&key->key);
30} 30}
31static inline void static_key_deferred_flush(struct static_key_deferred *key) 31static inline void static_key_deferred_flush(struct static_key_deferred *key)
32{ 32{
33 STATIC_KEY_CHECK_USE(); 33 STATIC_KEY_CHECK_USE(key);
34} 34}
35static inline void 35static inline void
36jump_label_rate_limit(struct static_key_deferred *key, 36jump_label_rate_limit(struct static_key_deferred *key,
37 unsigned long rl) 37 unsigned long rl)
38{ 38{
39 STATIC_KEY_CHECK_USE(); 39 STATIC_KEY_CHECK_USE(key);
40} 40}
41#endif /* HAVE_JUMP_LABEL */ 41#endif /* HAVE_JUMP_LABEL */
42#endif /* _LINUX_JUMP_LABEL_RATELIMIT_H */ 42#endif /* _LINUX_JUMP_LABEL_RATELIMIT_H */
diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h
index 0a777c5216b1..708f337d780b 100644
--- a/include/linux/kallsyms.h
+++ b/include/linux/kallsyms.h
@@ -14,8 +14,6 @@
14#define KSYM_SYMBOL_LEN (sizeof("%s+%#lx/%#lx [%s]") + (KSYM_NAME_LEN - 1) + \ 14#define KSYM_SYMBOL_LEN (sizeof("%s+%#lx/%#lx [%s]") + (KSYM_NAME_LEN - 1) + \
15 2*(BITS_PER_LONG*3/10) + (MODULE_NAME_LEN - 1) + 1) 15 2*(BITS_PER_LONG*3/10) + (MODULE_NAME_LEN - 1) + 1)
16 16
17/* How and when do we show kallsyms values? */
18extern int kallsyms_show_value(void);
19#ifndef CONFIG_64BIT 17#ifndef CONFIG_64BIT
20# define KALLSYM_FMT "%08lx" 18# define KALLSYM_FMT "%08lx"
21#else 19#else
@@ -54,6 +52,9 @@ extern void __print_symbol(const char *fmt, unsigned long address);
54int lookup_symbol_name(unsigned long addr, char *symname); 52int lookup_symbol_name(unsigned long addr, char *symname);
55int lookup_symbol_attrs(unsigned long addr, unsigned long *size, unsigned long *offset, char *modname, char *name); 53int lookup_symbol_attrs(unsigned long addr, unsigned long *size, unsigned long *offset, char *modname, char *name);
56 54
55/* How and when do we show kallsyms values? */
56extern int kallsyms_show_value(void);
57
57#else /* !CONFIG_KALLSYMS */ 58#else /* !CONFIG_KALLSYMS */
58 59
59static inline unsigned long kallsyms_lookup_name(const char *name) 60static inline unsigned long kallsyms_lookup_name(const char *name)
@@ -112,6 +113,11 @@ static inline int lookup_symbol_attrs(unsigned long addr, unsigned long *size, u
112 return -ERANGE; 113 return -ERANGE;
113} 114}
114 115
116static inline int kallsyms_show_value(void)
117{
118 return false;
119}
120
115/* Stupid that this does nothing, but I didn't create this mess. */ 121/* Stupid that this does nothing, but I didn't create this mess. */
116#define __print_symbol(fmt, addr) 122#define __print_symbol(fmt, addr)
117#endif /*CONFIG_KALLSYMS*/ 123#endif /*CONFIG_KALLSYMS*/
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index 1c08c925cefb..f16f6ceb3875 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -160,7 +160,7 @@ struct kexec_buf {
160}; 160};
161 161
162int __weak arch_kexec_walk_mem(struct kexec_buf *kbuf, 162int __weak arch_kexec_walk_mem(struct kexec_buf *kbuf,
163 int (*func)(u64, u64, void *)); 163 int (*func)(struct resource *, void *));
164extern int kexec_add_buffer(struct kexec_buf *kbuf); 164extern int kexec_add_buffer(struct kexec_buf *kbuf);
165int kexec_locate_mem_hole(struct kexec_buf *kbuf); 165int kexec_locate_mem_hole(struct kexec_buf *kbuf);
166#endif /* CONFIG_KEXEC_FILE */ 166#endif /* CONFIG_KEXEC_FILE */
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index bd2684700b74..9440a2fc8893 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -391,10 +391,6 @@ int register_kprobes(struct kprobe **kps, int num);
391void unregister_kprobes(struct kprobe **kps, int num); 391void unregister_kprobes(struct kprobe **kps, int num);
392int setjmp_pre_handler(struct kprobe *, struct pt_regs *); 392int setjmp_pre_handler(struct kprobe *, struct pt_regs *);
393int longjmp_break_handler(struct kprobe *, struct pt_regs *); 393int longjmp_break_handler(struct kprobe *, struct pt_regs *);
394int register_jprobe(struct jprobe *p);
395void unregister_jprobe(struct jprobe *p);
396int register_jprobes(struct jprobe **jps, int num);
397void unregister_jprobes(struct jprobe **jps, int num);
398void jprobe_return(void); 394void jprobe_return(void);
399unsigned long arch_deref_entry_point(void *); 395unsigned long arch_deref_entry_point(void *);
400 396
@@ -443,20 +439,6 @@ static inline void unregister_kprobe(struct kprobe *p)
443static inline void unregister_kprobes(struct kprobe **kps, int num) 439static inline void unregister_kprobes(struct kprobe **kps, int num)
444{ 440{
445} 441}
446static inline int register_jprobe(struct jprobe *p)
447{
448 return -ENOSYS;
449}
450static inline int register_jprobes(struct jprobe **jps, int num)
451{
452 return -ENOSYS;
453}
454static inline void unregister_jprobe(struct jprobe *p)
455{
456}
457static inline void unregister_jprobes(struct jprobe **jps, int num)
458{
459}
460static inline void jprobe_return(void) 442static inline void jprobe_return(void)
461{ 443{
462} 444}
@@ -486,6 +468,20 @@ static inline int enable_kprobe(struct kprobe *kp)
486 return -ENOSYS; 468 return -ENOSYS;
487} 469}
488#endif /* CONFIG_KPROBES */ 470#endif /* CONFIG_KPROBES */
471static inline int register_jprobe(struct jprobe *p)
472{
473 return -ENOSYS;
474}
475static inline int register_jprobes(struct jprobe **jps, int num)
476{
477 return -ENOSYS;
478}
479static inline void unregister_jprobe(struct jprobe *p)
480{
481}
482static inline void unregister_jprobes(struct jprobe **jps, int num)
483{
484}
489static inline int disable_kretprobe(struct kretprobe *rp) 485static inline int disable_kretprobe(struct kretprobe *rp)
490{ 486{
491 return disable_kprobe(&rp->kp); 487 return disable_kprobe(&rp->kp);
@@ -496,11 +492,11 @@ static inline int enable_kretprobe(struct kretprobe *rp)
496} 492}
497static inline int disable_jprobe(struct jprobe *jp) 493static inline int disable_jprobe(struct jprobe *jp)
498{ 494{
499 return disable_kprobe(&jp->kp); 495 return -ENOSYS;
500} 496}
501static inline int enable_jprobe(struct jprobe *jp) 497static inline int enable_jprobe(struct jprobe *jp)
502{ 498{
503 return enable_kprobe(&jp->kp); 499 return -ENOSYS;
504} 500}
505 501
506#ifndef CONFIG_KPROBES 502#ifndef CONFIG_KPROBES
diff --git a/include/linux/kthread.h b/include/linux/kthread.h
index 4e26609c77d4..86d53a3cb497 100644
--- a/include/linux/kthread.h
+++ b/include/linux/kthread.h
@@ -76,7 +76,7 @@ extern int tsk_fork_get_node(struct task_struct *tsk);
76 */ 76 */
77struct kthread_work; 77struct kthread_work;
78typedef void (*kthread_work_func_t)(struct kthread_work *work); 78typedef void (*kthread_work_func_t)(struct kthread_work *work);
79void kthread_delayed_work_timer_fn(unsigned long __data); 79void kthread_delayed_work_timer_fn(struct timer_list *t);
80 80
81enum { 81enum {
82 KTW_FREEZABLE = 1 << 0, /* freeze during suspend */ 82 KTW_FREEZABLE = 1 << 0, /* freeze during suspend */
@@ -117,8 +117,8 @@ struct kthread_delayed_work {
117 117
118#define KTHREAD_DELAYED_WORK_INIT(dwork, fn) { \ 118#define KTHREAD_DELAYED_WORK_INIT(dwork, fn) { \
119 .work = KTHREAD_WORK_INIT((dwork).work, (fn)), \ 119 .work = KTHREAD_WORK_INIT((dwork).work, (fn)), \
120 .timer = __TIMER_INITIALIZER(kthread_delayed_work_timer_fn, \ 120 .timer = __TIMER_INITIALIZER((TIMER_FUNC_TYPE)kthread_delayed_work_timer_fn,\
121 0, (unsigned long)&(dwork), \ 121 (TIMER_DATA_TYPE)&(dwork.timer), \
122 TIMER_IRQSAFE), \ 122 TIMER_IRQSAFE), \
123 } 123 }
124 124
@@ -165,8 +165,8 @@ extern void __kthread_init_worker(struct kthread_worker *worker,
165 do { \ 165 do { \
166 kthread_init_work(&(dwork)->work, (fn)); \ 166 kthread_init_work(&(dwork)->work, (fn)); \
167 __setup_timer(&(dwork)->timer, \ 167 __setup_timer(&(dwork)->timer, \
168 kthread_delayed_work_timer_fn, \ 168 (TIMER_FUNC_TYPE)kthread_delayed_work_timer_fn,\
169 (unsigned long)(dwork), \ 169 (TIMER_DATA_TYPE)&(dwork)->timer, \
170 TIMER_IRQSAFE); \ 170 TIMER_IRQSAFE); \
171 } while (0) 171 } while (0)
172 172
diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index 0c8bd45c8206..5b9fddbaac41 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -270,5 +270,6 @@ static inline ktime_t ms_to_ktime(u64 ms)
270} 270}
271 271
272# include <linux/timekeeping.h> 272# include <linux/timekeeping.h>
273# include <linux/timekeeping32.h>
273 274
274#endif 275#endif
diff --git a/include/linux/linkage.h b/include/linux/linkage.h
index 2e6f90bd52aa..f68db9e450eb 100644
--- a/include/linux/linkage.h
+++ b/include/linux/linkage.h
@@ -2,7 +2,7 @@
2#ifndef _LINUX_LINKAGE_H 2#ifndef _LINUX_LINKAGE_H
3#define _LINUX_LINKAGE_H 3#define _LINUX_LINKAGE_H
4 4
5#include <linux/compiler.h> 5#include <linux/compiler_types.h>
6#include <linux/stringify.h> 6#include <linux/stringify.h>
7#include <linux/export.h> 7#include <linux/export.h>
8#include <asm/linkage.h> 8#include <asm/linkage.h>
diff --git a/include/linux/llist.h b/include/linux/llist.h
index 1957635e6d5f..85abc2915e8d 100644
--- a/include/linux/llist.h
+++ b/include/linux/llist.h
@@ -198,7 +198,7 @@ static inline void init_llist_head(struct llist_head *list)
198 */ 198 */
199static inline bool llist_empty(const struct llist_head *head) 199static inline bool llist_empty(const struct llist_head *head)
200{ 200{
201 return ACCESS_ONCE(head->first) == NULL; 201 return READ_ONCE(head->first) == NULL;
202} 202}
203 203
204static inline struct llist_node *llist_next(struct llist_node *node) 204static inline struct llist_node *llist_next(struct llist_node *node)
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index f301d31b473c..a842551fe044 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -528,6 +528,11 @@ static inline void lockdep_on(void)
528 */ 528 */
529struct lock_class_key { }; 529struct lock_class_key { };
530 530
531/*
532 * The lockdep_map takes no space if lockdep is disabled:
533 */
534struct lockdep_map { };
535
531#define lockdep_depth(tsk) (0) 536#define lockdep_depth(tsk) (0)
532 537
533#define lockdep_is_held_type(l, r) (1) 538#define lockdep_is_held_type(l, r) (1)
@@ -720,9 +725,24 @@ do { \
720 lock_acquire(&(lock)->dep_map, 0, 0, 1, 1, NULL, _THIS_IP_); \ 725 lock_acquire(&(lock)->dep_map, 0, 0, 1, 1, NULL, _THIS_IP_); \
721 lock_release(&(lock)->dep_map, 0, _THIS_IP_); \ 726 lock_release(&(lock)->dep_map, 0, _THIS_IP_); \
722} while (0) 727} while (0)
728
729#define lockdep_assert_irqs_enabled() do { \
730 WARN_ONCE(debug_locks && !current->lockdep_recursion && \
731 !current->hardirqs_enabled, \
732 "IRQs not enabled as expected\n"); \
733 } while (0)
734
735#define lockdep_assert_irqs_disabled() do { \
736 WARN_ONCE(debug_locks && !current->lockdep_recursion && \
737 current->hardirqs_enabled, \
738 "IRQs not disabled as expected\n"); \
739 } while (0)
740
723#else 741#else
724# define might_lock(lock) do { } while (0) 742# define might_lock(lock) do { } while (0)
725# define might_lock_read(lock) do { } while (0) 743# define might_lock_read(lock) do { } while (0)
744# define lockdep_assert_irqs_enabled() do { } while (0)
745# define lockdep_assert_irqs_disabled() do { } while (0)
726#endif 746#endif
727 747
728#ifdef CONFIG_LOCKDEP 748#ifdef CONFIG_LOCKDEP
diff --git a/include/linux/log2.h b/include/linux/log2.h
index c373295f359f..41a1ae010993 100644
--- a/include/linux/log2.h
+++ b/include/linux/log2.h
@@ -37,19 +37,23 @@ int __ilog2_u64(u64 n)
37} 37}
38#endif 38#endif
39 39
40/* 40/**
41 * Determine whether some value is a power of two, where zero is 41 * is_power_of_2() - check if a value is a power of two
42 * @n: the value to check
43 *
44 * Determine whether some value is a power of two, where zero is
42 * *not* considered a power of two. 45 * *not* considered a power of two.
46 * Return: true if @n is a power of 2, otherwise false.
43 */ 47 */
44
45static inline __attribute__((const)) 48static inline __attribute__((const))
46bool is_power_of_2(unsigned long n) 49bool is_power_of_2(unsigned long n)
47{ 50{
48 return (n != 0 && ((n & (n - 1)) == 0)); 51 return (n != 0 && ((n & (n - 1)) == 0));
49} 52}
50 53
51/* 54/**
52 * round up to nearest power of two 55 * __roundup_pow_of_two() - round up to nearest power of two
56 * @n: value to round up
53 */ 57 */
54static inline __attribute__((const)) 58static inline __attribute__((const))
55unsigned long __roundup_pow_of_two(unsigned long n) 59unsigned long __roundup_pow_of_two(unsigned long n)
@@ -57,8 +61,9 @@ unsigned long __roundup_pow_of_two(unsigned long n)
57 return 1UL << fls_long(n - 1); 61 return 1UL << fls_long(n - 1);
58} 62}
59 63
60/* 64/**
61 * round down to nearest power of two 65 * __rounddown_pow_of_two() - round down to nearest power of two
66 * @n: value to round down
62 */ 67 */
63static inline __attribute__((const)) 68static inline __attribute__((const))
64unsigned long __rounddown_pow_of_two(unsigned long n) 69unsigned long __rounddown_pow_of_two(unsigned long n)
@@ -67,12 +72,12 @@ unsigned long __rounddown_pow_of_two(unsigned long n)
67} 72}
68 73
69/** 74/**
70 * ilog2 - log of base 2 of 32-bit or a 64-bit unsigned value 75 * ilog2 - log base 2 of 32-bit or a 64-bit unsigned value
71 * @n - parameter 76 * @n: parameter
72 * 77 *
73 * constant-capable log of base 2 calculation 78 * constant-capable log of base 2 calculation
74 * - this can be used to initialise global variables from constant data, hence 79 * - this can be used to initialise global variables from constant data, hence
75 * the massive ternary operator construction 80 * the massive ternary operator construction
76 * 81 *
77 * selects the appropriately-sized optimised version depending on sizeof(n) 82 * selects the appropriately-sized optimised version depending on sizeof(n)
78 */ 83 */
@@ -150,7 +155,7 @@ unsigned long __rounddown_pow_of_two(unsigned long n)
150 155
151/** 156/**
152 * roundup_pow_of_two - round the given value up to nearest power of two 157 * roundup_pow_of_two - round the given value up to nearest power of two
153 * @n - parameter 158 * @n: parameter
154 * 159 *
155 * round the given value up to the nearest power of two 160 * round the given value up to the nearest power of two
156 * - the result is undefined when n == 0 161 * - the result is undefined when n == 0
@@ -167,7 +172,7 @@ unsigned long __rounddown_pow_of_two(unsigned long n)
167 172
168/** 173/**
169 * rounddown_pow_of_two - round the given value down to nearest power of two 174 * rounddown_pow_of_two - round the given value down to nearest power of two
170 * @n - parameter 175 * @n: parameter
171 * 176 *
172 * round the given value down to the nearest power of two 177 * round the given value down to the nearest power of two
173 * - the result is undefined when n == 0 178 * - the result is undefined when n == 0
@@ -180,6 +185,12 @@ unsigned long __rounddown_pow_of_two(unsigned long n)
180 __rounddown_pow_of_two(n) \ 185 __rounddown_pow_of_two(n) \
181 ) 186 )
182 187
188static inline __attribute_const__
189int __order_base_2(unsigned long n)
190{
191 return n > 1 ? ilog2(n - 1) + 1 : 0;
192}
193
183/** 194/**
184 * order_base_2 - calculate the (rounded up) base 2 order of the argument 195 * order_base_2 - calculate the (rounded up) base 2 order of the argument
185 * @n: parameter 196 * @n: parameter
@@ -193,13 +204,6 @@ unsigned long __rounddown_pow_of_two(unsigned long n)
193 * ob2(5) = 3 204 * ob2(5) = 3
194 * ... and so on. 205 * ... and so on.
195 */ 206 */
196
197static inline __attribute_const__
198int __order_base_2(unsigned long n)
199{
200 return n > 1 ? ilog2(n - 1) + 1 : 0;
201}
202
203#define order_base_2(n) \ 207#define order_base_2(n) \
204( \ 208( \
205 __builtin_constant_p(n) ? ( \ 209 __builtin_constant_p(n) ? ( \
diff --git a/include/linux/math64.h b/include/linux/math64.h
index 082de345b73c..837f2f2d1d34 100644
--- a/include/linux/math64.h
+++ b/include/linux/math64.h
@@ -12,6 +12,11 @@
12 12
13/** 13/**
14 * div_u64_rem - unsigned 64bit divide with 32bit divisor with remainder 14 * div_u64_rem - unsigned 64bit divide with 32bit divisor with remainder
15 * @dividend: unsigned 64bit dividend
16 * @divisor: unsigned 32bit divisor
17 * @remainder: pointer to unsigned 32bit remainder
18 *
19 * Return: sets ``*remainder``, then returns dividend / divisor
15 * 20 *
16 * This is commonly provided by 32bit archs to provide an optimized 64bit 21 * This is commonly provided by 32bit archs to provide an optimized 64bit
17 * divide. 22 * divide.
@@ -24,6 +29,11 @@ static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder)
24 29
25/** 30/**
26 * div_s64_rem - signed 64bit divide with 32bit divisor with remainder 31 * div_s64_rem - signed 64bit divide with 32bit divisor with remainder
32 * @dividend: signed 64bit dividend
33 * @divisor: signed 32bit divisor
34 * @remainder: pointer to signed 32bit remainder
35 *
36 * Return: sets ``*remainder``, then returns dividend / divisor
27 */ 37 */
28static inline s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder) 38static inline s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder)
29{ 39{
@@ -33,6 +43,11 @@ static inline s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder)
33 43
34/** 44/**
35 * div64_u64_rem - unsigned 64bit divide with 64bit divisor and remainder 45 * div64_u64_rem - unsigned 64bit divide with 64bit divisor and remainder
46 * @dividend: unsigned 64bit dividend
47 * @divisor: unsigned 64bit divisor
48 * @remainder: pointer to unsigned 64bit remainder
49 *
50 * Return: sets ``*remainder``, then returns dividend / divisor
36 */ 51 */
37static inline u64 div64_u64_rem(u64 dividend, u64 divisor, u64 *remainder) 52static inline u64 div64_u64_rem(u64 dividend, u64 divisor, u64 *remainder)
38{ 53{
@@ -42,6 +57,10 @@ static inline u64 div64_u64_rem(u64 dividend, u64 divisor, u64 *remainder)
42 57
43/** 58/**
44 * div64_u64 - unsigned 64bit divide with 64bit divisor 59 * div64_u64 - unsigned 64bit divide with 64bit divisor
60 * @dividend: unsigned 64bit dividend
61 * @divisor: unsigned 64bit divisor
62 *
63 * Return: dividend / divisor
45 */ 64 */
46static inline u64 div64_u64(u64 dividend, u64 divisor) 65static inline u64 div64_u64(u64 dividend, u64 divisor)
47{ 66{
@@ -50,6 +69,10 @@ static inline u64 div64_u64(u64 dividend, u64 divisor)
50 69
51/** 70/**
52 * div64_s64 - signed 64bit divide with 64bit divisor 71 * div64_s64 - signed 64bit divide with 64bit divisor
72 * @dividend: signed 64bit dividend
73 * @divisor: signed 64bit divisor
74 *
75 * Return: dividend / divisor
53 */ 76 */
54static inline s64 div64_s64(s64 dividend, s64 divisor) 77static inline s64 div64_s64(s64 dividend, s64 divisor)
55{ 78{
@@ -89,6 +112,8 @@ extern s64 div64_s64(s64 dividend, s64 divisor);
89 112
90/** 113/**
91 * div_u64 - unsigned 64bit divide with 32bit divisor 114 * div_u64 - unsigned 64bit divide with 32bit divisor
115 * @dividend: unsigned 64bit dividend
116 * @divisor: unsigned 32bit divisor
92 * 117 *
93 * This is the most common 64bit divide and should be used if possible, 118 * This is the most common 64bit divide and should be used if possible,
94 * as many 32bit archs can optimize this variant better than a full 64bit 119 * as many 32bit archs can optimize this variant better than a full 64bit
@@ -104,6 +129,8 @@ static inline u64 div_u64(u64 dividend, u32 divisor)
104 129
105/** 130/**
106 * div_s64 - signed 64bit divide with 32bit divisor 131 * div_s64 - signed 64bit divide with 32bit divisor
132 * @dividend: signed 64bit dividend
133 * @divisor: signed 32bit divisor
107 */ 134 */
108#ifndef div_s64 135#ifndef div_s64
109static inline s64 div_s64(s64 dividend, s32 divisor) 136static inline s64 div_s64(s64 dividend, s32 divisor)
diff --git a/include/linux/mem_encrypt.h b/include/linux/mem_encrypt.h
index 265a9cd21cb4..b310a9c18113 100644
--- a/include/linux/mem_encrypt.h
+++ b/include/linux/mem_encrypt.h
@@ -23,11 +23,14 @@
23 23
24#define sme_me_mask 0ULL 24#define sme_me_mask 0ULL
25 25
26static inline bool sme_active(void) { return false; }
27static inline bool sev_active(void) { return false; }
28
26#endif /* CONFIG_ARCH_HAS_MEM_ENCRYPT */ 29#endif /* CONFIG_ARCH_HAS_MEM_ENCRYPT */
27 30
28static inline bool sme_active(void) 31static inline bool mem_encrypt_active(void)
29{ 32{
30 return !!sme_me_mask; 33 return sme_me_mask;
31} 34}
32 35
33static inline u64 sme_get_me_mask(void) 36static inline u64 sme_get_me_mask(void)
diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
index e9c908c4fba8..78dc85365c4f 100644
--- a/include/linux/mfd/axp20x.h
+++ b/include/linux/mfd/axp20x.h
@@ -131,6 +131,9 @@ enum axp20x_variants {
131#define AXP803_DCDC6_V_OUT 0x25 131#define AXP803_DCDC6_V_OUT 0x25
132#define AXP803_DCDC_FREQ_CTRL 0x3b 132#define AXP803_DCDC_FREQ_CTRL 0x3b
133 133
134/* Other DCDC regulator control registers are the same as AXP803 */
135#define AXP813_DCDC7_V_OUT 0x26
136
134/* Interrupt */ 137/* Interrupt */
135#define AXP152_IRQ1_EN 0x40 138#define AXP152_IRQ1_EN 0x40
136#define AXP152_IRQ2_EN 0x41 139#define AXP152_IRQ2_EN 0x41
diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h
index 116816fb9110..7815d8db7eca 100644
--- a/include/linux/mfd/rtsx_pci.h
+++ b/include/linux/mfd/rtsx_pci.h
@@ -334,6 +334,7 @@
334#define DCM_DRP_RD_DATA_H 0xFC29 334#define DCM_DRP_RD_DATA_H 0xFC29
335#define SD_VPCLK0_CTL 0xFC2A 335#define SD_VPCLK0_CTL 0xFC2A
336#define SD_VPCLK1_CTL 0xFC2B 336#define SD_VPCLK1_CTL 0xFC2B
337#define PHASE_SELECT_MASK 0x1F
337#define SD_DCMPS0_CTL 0xFC2C 338#define SD_DCMPS0_CTL 0xFC2C
338#define SD_DCMPS1_CTL 0xFC2D 339#define SD_DCMPS1_CTL 0xFC2D
339#define SD_VPTX_CTL SD_VPCLK0_CTL 340#define SD_VPTX_CTL SD_VPCLK0_CTL
diff --git a/include/linux/mfd/tps65218.h b/include/linux/mfd/tps65218.h
index bccd2d68b1e3..f069c518c0ed 100644
--- a/include/linux/mfd/tps65218.h
+++ b/include/linux/mfd/tps65218.h
@@ -246,24 +246,6 @@ enum tps65218_irqs {
246}; 246};
247 247
248/** 248/**
249 * struct tps_info - packages regulator constraints
250 * @id: Id of the regulator
251 * @name: Voltage regulator name
252 * @min_uV: minimum micro volts
253 * @max_uV: minimum micro volts
254 * @strobe: sequencing strobe value for the regulator
255 *
256 * This data is used to check the regualtor voltage limits while setting.
257 */
258struct tps_info {
259 int id;
260 const char *name;
261 int min_uV;
262 int max_uV;
263 int strobe;
264};
265
266/**
267 * struct tps65218 - tps65218 sub-driver chip access routines 249 * struct tps65218 - tps65218 sub-driver chip access routines
268 * 250 *
269 * Device data may be used to access the TPS65218 chip 251 * Device data may be used to access the TPS65218 chip
@@ -280,7 +262,6 @@ struct tps65218 {
280 u32 irq_mask; 262 u32 irq_mask;
281 struct regmap_irq_chip_data *irq_data; 263 struct regmap_irq_chip_data *irq_data;
282 struct regulator_desc desc[TPS65218_NUM_REGULATOR]; 264 struct regulator_desc desc[TPS65218_NUM_REGULATOR];
283 struct tps_info *info[TPS65218_NUM_REGULATOR];
284 struct regmap *regmap; 265 struct regmap *regmap;
285 u8 *strobes; 266 u8 *strobes;
286}; 267};
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 43edf659453b..91b46f99b4d2 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -2496,7 +2496,7 @@ void vmemmap_populate_print_last(void);
2496void vmemmap_free(unsigned long start, unsigned long end); 2496void vmemmap_free(unsigned long start, unsigned long end);
2497#endif 2497#endif
2498void register_page_bootmem_memmap(unsigned long section_nr, struct page *map, 2498void register_page_bootmem_memmap(unsigned long section_nr, struct page *map,
2499 unsigned long size); 2499 unsigned long nr_pages);
2500 2500
2501enum mf_flags { 2501enum mf_flags {
2502 MF_COUNT_INCREASED = 1 << 0, 2502 MF_COUNT_INCREASED = 1 << 0,
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 9a43763a68ad..e7743eca1021 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -255,6 +255,10 @@ struct mmc_supply {
255 struct regulator *vqmmc; /* Optional Vccq supply */ 255 struct regulator *vqmmc; /* Optional Vccq supply */
256}; 256};
257 257
258struct mmc_ctx {
259 struct task_struct *task;
260};
261
258struct mmc_host { 262struct mmc_host {
259 struct device *parent; 263 struct device *parent;
260 struct device class_dev; 264 struct device class_dev;
@@ -350,6 +354,8 @@ struct mmc_host {
350#define MMC_CAP2_CQE (1 << 23) /* Has eMMC command queue engine */ 354#define MMC_CAP2_CQE (1 << 23) /* Has eMMC command queue engine */
351#define MMC_CAP2_CQE_DCMD (1 << 24) /* CQE can issue a direct command */ 355#define MMC_CAP2_CQE_DCMD (1 << 24) /* CQE can issue a direct command */
352 356
357 int fixed_drv_type; /* fixed driver type for non-removable media */
358
353 mmc_pm_flag_t pm_caps; /* supported pm features */ 359 mmc_pm_flag_t pm_caps; /* supported pm features */
354 360
355 /* host specific block data */ 361 /* host specific block data */
@@ -388,8 +394,9 @@ struct mmc_host {
388 struct mmc_card *card; /* device attached to this host */ 394 struct mmc_card *card; /* device attached to this host */
389 395
390 wait_queue_head_t wq; 396 wait_queue_head_t wq;
391 struct task_struct *claimer; /* task that has host claimed */ 397 struct mmc_ctx *claimer; /* context that has host claimed */
392 int claim_cnt; /* "claim" nesting count */ 398 int claim_cnt; /* "claim" nesting count */
399 struct mmc_ctx default_ctx; /* default context */
393 400
394 struct delayed_work detect; 401 struct delayed_work detect;
395 int detect_change; /* card detect flag */ 402 int detect_change; /* card detect flag */
@@ -469,6 +476,8 @@ void mmc_detect_change(struct mmc_host *, unsigned long delay);
469void mmc_request_done(struct mmc_host *, struct mmc_request *); 476void mmc_request_done(struct mmc_host *, struct mmc_request *);
470void mmc_command_done(struct mmc_host *host, struct mmc_request *mrq); 477void mmc_command_done(struct mmc_host *host, struct mmc_request *mrq);
471 478
479void mmc_cqe_request_done(struct mmc_host *host, struct mmc_request *mrq);
480
472static inline void mmc_signal_sdio_irq(struct mmc_host *host) 481static inline void mmc_signal_sdio_irq(struct mmc_host *host)
473{ 482{
474 host->ops->enable_sdio_irq(host, 0); 483 host->ops->enable_sdio_irq(host, 0);
diff --git a/include/linux/mmc/sdhci-pci-data.h b/include/linux/mmc/sdhci-pci-data.h
index 36f986d4a59a..1d42872d22f3 100644
--- a/include/linux/mmc/sdhci-pci-data.h
+++ b/include/linux/mmc/sdhci-pci-data.h
@@ -15,7 +15,4 @@ struct sdhci_pci_data {
15 15
16extern struct sdhci_pci_data *(*sdhci_pci_get_data)(struct pci_dev *pdev, 16extern struct sdhci_pci_data *(*sdhci_pci_get_data)(struct pci_dev *pdev,
17 int slotno); 17 int slotno);
18
19extern int sdhci_pci_spt_drive_strength;
20
21#endif 18#endif
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index c9c4a81b9767..a507f43ad221 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -1151,13 +1151,17 @@ struct mem_section {
1151#define SECTION_ROOT_MASK (SECTIONS_PER_ROOT - 1) 1151#define SECTION_ROOT_MASK (SECTIONS_PER_ROOT - 1)
1152 1152
1153#ifdef CONFIG_SPARSEMEM_EXTREME 1153#ifdef CONFIG_SPARSEMEM_EXTREME
1154extern struct mem_section *mem_section[NR_SECTION_ROOTS]; 1154extern struct mem_section **mem_section;
1155#else 1155#else
1156extern struct mem_section mem_section[NR_SECTION_ROOTS][SECTIONS_PER_ROOT]; 1156extern struct mem_section mem_section[NR_SECTION_ROOTS][SECTIONS_PER_ROOT];
1157#endif 1157#endif
1158 1158
1159static inline struct mem_section *__nr_to_section(unsigned long nr) 1159static inline struct mem_section *__nr_to_section(unsigned long nr)
1160{ 1160{
1161#ifdef CONFIG_SPARSEMEM_EXTREME
1162 if (!mem_section)
1163 return NULL;
1164#endif
1161 if (!mem_section[SECTION_NR_TO_ROOT(nr)]) 1165 if (!mem_section[SECTION_NR_TO_ROOT(nr)])
1162 return NULL; 1166 return NULL;
1163 return &mem_section[SECTION_NR_TO_ROOT(nr)][nr & SECTION_ROOT_MASK]; 1167 return &mem_section[SECTION_NR_TO_ROOT(nr)][nr & SECTION_ROOT_MASK];
diff --git a/include/linux/module.h b/include/linux/module.h
index fe5aa3736707..c69b49abe877 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -639,6 +639,8 @@ static inline bool is_livepatch_module(struct module *mod)
639} 639}
640#endif /* CONFIG_LIVEPATCH */ 640#endif /* CONFIG_LIVEPATCH */
641 641
642bool is_module_sig_enforced(void);
643
642#else /* !CONFIG_MODULES... */ 644#else /* !CONFIG_MODULES... */
643 645
644static inline struct module *__module_address(unsigned long addr) 646static inline struct module *__module_address(unsigned long addr)
@@ -753,6 +755,11 @@ static inline bool module_requested_async_probing(struct module *module)
753 return false; 755 return false;
754} 756}
755 757
758static inline bool is_module_sig_enforced(void)
759{
760 return false;
761}
762
756#endif /* CONFIG_MODULES */ 763#endif /* CONFIG_MODULES */
757 764
758#ifdef CONFIG_SYSFS 765#ifdef CONFIG_SYSFS
diff --git a/include/linux/msi.h b/include/linux/msi.h
index cdd069cf9ed8..1f1bbb5b4679 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -284,6 +284,11 @@ enum {
284 MSI_FLAG_PCI_MSIX = (1 << 3), 284 MSI_FLAG_PCI_MSIX = (1 << 3),
285 /* Needs early activate, required for PCI */ 285 /* Needs early activate, required for PCI */
286 MSI_FLAG_ACTIVATE_EARLY = (1 << 4), 286 MSI_FLAG_ACTIVATE_EARLY = (1 << 4),
287 /*
288 * Must reactivate when irq is started even when
289 * MSI_FLAG_ACTIVATE_EARLY has been set.
290 */
291 MSI_FLAG_MUST_REACTIVATE = (1 << 5),
287}; 292};
288 293
289int msi_domain_set_affinity(struct irq_data *data, const struct cpumask *mask, 294int msi_domain_set_affinity(struct irq_data *data, const struct cpumask *mask,
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index 414a5e769fde..495ba4dd9da5 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -67,7 +67,7 @@ static inline bool lockdep_nfnl_is_held(__u8 subsys_id)
67 * @ss: The nfnetlink subsystem ID 67 * @ss: The nfnetlink subsystem ID
68 * 68 *
69 * Return the value of the specified RCU-protected pointer, but omit 69 * Return the value of the specified RCU-protected pointer, but omit
70 * both the smp_read_barrier_depends() and the ACCESS_ONCE(), because 70 * both the smp_read_barrier_depends() and the READ_ONCE(), because
71 * caller holds the NFNL subsystem mutex. 71 * caller holds the NFNL subsystem mutex.
72 */ 72 */
73#define nfnl_dereference(p, ss) \ 73#define nfnl_dereference(p, ss) \
diff --git a/include/linux/parport.h b/include/linux/parport.h
index 58e3c64c6b49..397607a0c0eb 100644
--- a/include/linux/parport.h
+++ b/include/linux/parport.h
@@ -225,6 +225,7 @@ struct parport {
225 struct pardevice *waittail; 225 struct pardevice *waittail;
226 226
227 struct list_head list; 227 struct list_head list;
228 struct timer_list timer;
228 unsigned int flags; 229 unsigned int flags;
229 230
230 void *sysctl_table; 231 void *sysctl_table;
diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h
index 8f16299ca068..2d2096ba1cfe 100644
--- a/include/linux/percpu-defs.h
+++ b/include/linux/percpu-defs.h
@@ -173,6 +173,21 @@
173 DEFINE_PER_CPU_SECTION(type, name, "..read_mostly") 173 DEFINE_PER_CPU_SECTION(type, name, "..read_mostly")
174 174
175/* 175/*
176 * Declaration/definition used for per-CPU variables that should be accessed
177 * as decrypted when memory encryption is enabled in the guest.
178 */
179#if defined(CONFIG_VIRTUALIZATION) && defined(CONFIG_AMD_MEM_ENCRYPT)
180
181#define DECLARE_PER_CPU_DECRYPTED(type, name) \
182 DECLARE_PER_CPU_SECTION(type, name, "..decrypted")
183
184#define DEFINE_PER_CPU_DECRYPTED(type, name) \
185 DEFINE_PER_CPU_SECTION(type, name, "..decrypted")
186#else
187#define DEFINE_PER_CPU_DECRYPTED(type, name) DEFINE_PER_CPU(type, name)
188#endif
189
190/*
176 * Intermodule exports for per-CPU variables. sparse forgets about 191 * Intermodule exports for per-CPU variables. sparse forgets about
177 * address space across EXPORT_SYMBOL(), change EXPORT_SYMBOL() to 192 * address space across EXPORT_SYMBOL(), change EXPORT_SYMBOL() to
178 * noop if __CHECKER__. 193 * noop if __CHECKER__.
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 8e22f24ded6a..874b71a70058 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -485,9 +485,9 @@ struct perf_addr_filters_head {
485}; 485};
486 486
487/** 487/**
488 * enum perf_event_active_state - the states of a event 488 * enum perf_event_state - the states of a event
489 */ 489 */
490enum perf_event_active_state { 490enum perf_event_state {
491 PERF_EVENT_STATE_DEAD = -4, 491 PERF_EVENT_STATE_DEAD = -4,
492 PERF_EVENT_STATE_EXIT = -3, 492 PERF_EVENT_STATE_EXIT = -3,
493 PERF_EVENT_STATE_ERROR = -2, 493 PERF_EVENT_STATE_ERROR = -2,
@@ -578,7 +578,7 @@ struct perf_event {
578 struct pmu *pmu; 578 struct pmu *pmu;
579 void *pmu_private; 579 void *pmu_private;
580 580
581 enum perf_event_active_state state; 581 enum perf_event_state state;
582 unsigned int attach_state; 582 unsigned int attach_state;
583 local64_t count; 583 local64_t count;
584 atomic64_t child_count; 584 atomic64_t child_count;
@@ -588,26 +588,10 @@ struct perf_event {
588 * has been enabled (i.e. eligible to run, and the task has 588 * has been enabled (i.e. eligible to run, and the task has
589 * been scheduled in, if this is a per-task event) 589 * been scheduled in, if this is a per-task event)
590 * and running (scheduled onto the CPU), respectively. 590 * and running (scheduled onto the CPU), respectively.
591 *
592 * They are computed from tstamp_enabled, tstamp_running and
593 * tstamp_stopped when the event is in INACTIVE or ACTIVE state.
594 */ 591 */
595 u64 total_time_enabled; 592 u64 total_time_enabled;
596 u64 total_time_running; 593 u64 total_time_running;
597 594 u64 tstamp;
598 /*
599 * These are timestamps used for computing total_time_enabled
600 * and total_time_running when the event is in INACTIVE or
601 * ACTIVE state, measured in nanoseconds from an arbitrary point
602 * in time.
603 * tstamp_enabled: the notional time when the event was enabled
604 * tstamp_running: the notional time when the event was scheduled on
605 * tstamp_stopped: in INACTIVE state, the notional time when the
606 * event was scheduled off.
607 */
608 u64 tstamp_enabled;
609 u64 tstamp_running;
610 u64 tstamp_stopped;
611 595
612 /* 596 /*
613 * timestamp shadows the actual context timing but it can 597 * timestamp shadows the actual context timing but it can
@@ -699,7 +683,6 @@ struct perf_event {
699 683
700#ifdef CONFIG_CGROUP_PERF 684#ifdef CONFIG_CGROUP_PERF
701 struct perf_cgroup *cgrp; /* cgroup event is attach to */ 685 struct perf_cgroup *cgrp; /* cgroup event is attach to */
702 int cgrp_defer_enabled;
703#endif 686#endif
704 687
705 struct list_head sb_list; 688 struct list_head sb_list;
@@ -806,6 +789,7 @@ struct perf_output_handle {
806struct bpf_perf_event_data_kern { 789struct bpf_perf_event_data_kern {
807 struct pt_regs *regs; 790 struct pt_regs *regs;
808 struct perf_sample_data *data; 791 struct perf_sample_data *data;
792 struct perf_event *event;
809}; 793};
810 794
811#ifdef CONFIG_CGROUP_PERF 795#ifdef CONFIG_CGROUP_PERF
@@ -884,7 +868,8 @@ perf_event_create_kernel_counter(struct perf_event_attr *attr,
884 void *context); 868 void *context);
885extern void perf_pmu_migrate_context(struct pmu *pmu, 869extern void perf_pmu_migrate_context(struct pmu *pmu,
886 int src_cpu, int dst_cpu); 870 int src_cpu, int dst_cpu);
887int perf_event_read_local(struct perf_event *event, u64 *value); 871int perf_event_read_local(struct perf_event *event, u64 *value,
872 u64 *enabled, u64 *running);
888extern u64 perf_event_read_value(struct perf_event *event, 873extern u64 perf_event_read_value(struct perf_event *event,
889 u64 *enabled, u64 *running); 874 u64 *enabled, u64 *running);
890 875
@@ -1286,7 +1271,8 @@ static inline const struct perf_event_attr *perf_event_attrs(struct perf_event *
1286{ 1271{
1287 return ERR_PTR(-EINVAL); 1272 return ERR_PTR(-EINVAL);
1288} 1273}
1289static inline int perf_event_read_local(struct perf_event *event, u64 *value) 1274static inline int perf_event_read_local(struct perf_event *event, u64 *value,
1275 u64 *enabled, u64 *running)
1290{ 1276{
1291 return -EINVAL; 1277 return -EINVAL;
1292} 1278}
diff --git a/include/linux/platform_data/sht15.h b/include/linux/platform_data/sht15.h
deleted file mode 100644
index 12289c1e9413..000000000000
--- a/include/linux/platform_data/sht15.h
+++ /dev/null
@@ -1,38 +0,0 @@
1/*
2 * sht15.h - support for the SHT15 Temperature and Humidity Sensor
3 *
4 * Copyright (c) 2009 Jonathan Cameron
5 *
6 * Copyright (c) 2007 Wouter Horre
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * For further information, see the Documentation/hwmon/sht15 file.
13 */
14
15#ifndef _PDATA_SHT15_H
16#define _PDATA_SHT15_H
17
18/**
19 * struct sht15_platform_data - sht15 connectivity info
20 * @gpio_data: no. of gpio to which bidirectional data line is
21 * connected.
22 * @gpio_sck: no. of gpio to which the data clock is connected.
23 * @supply_mv: supply voltage in mv. Overridden by regulator if
24 * available.
25 * @checksum: flag to indicate the checksum should be validated.
26 * @no_otp_reload: flag to indicate no reload from OTP.
27 * @low_resolution: flag to indicate the temp/humidity resolution to use.
28 */
29struct sht15_platform_data {
30 int gpio_data;
31 int gpio_sck;
32 int supply_mv;
33 bool checksum;
34 bool no_otp_reload;
35 bool low_resolution;
36};
37
38#endif /* _PDATA_SHT15_H */
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index 2efb08a60e63..f0fc4700b6ff 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -105,7 +105,7 @@ static inline bool pm_runtime_callbacks_present(struct device *dev)
105 105
106static inline void pm_runtime_mark_last_busy(struct device *dev) 106static inline void pm_runtime_mark_last_busy(struct device *dev)
107{ 107{
108 ACCESS_ONCE(dev->power.last_busy) = jiffies; 108 WRITE_ONCE(dev->power.last_busy, jiffies);
109} 109}
110 110
111static inline bool pm_runtime_is_irq_safe(struct device *dev) 111static inline bool pm_runtime_is_irq_safe(struct device *dev)
diff --git a/include/linux/printk.h b/include/linux/printk.h
index 335926039adc..905bba92f015 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -189,7 +189,6 @@ extern bool printk_timed_ratelimit(unsigned long *caller_jiffies,
189 189
190extern int printk_delay_msec; 190extern int printk_delay_msec;
191extern int dmesg_restrict; 191extern int dmesg_restrict;
192extern int kptr_restrict;
193 192
194extern int 193extern int
195devkmsg_sysctl_set_loglvl(struct ctl_table *table, int write, void __user *buf, 194devkmsg_sysctl_set_loglvl(struct ctl_table *table, int write, void __user *buf,
@@ -280,6 +279,8 @@ static inline void printk_safe_flush_on_panic(void)
280} 279}
281#endif 280#endif
282 281
282extern int kptr_restrict;
283
283extern asmlinkage void dump_stack(void) __cold; 284extern asmlinkage void dump_stack(void) __cold;
284 285
285#ifndef pr_fmt 286#ifndef pr_fmt
diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index c2cdd45a880a..127f534fec94 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -275,7 +275,7 @@ static inline void list_splice_tail_init_rcu(struct list_head *list,
275 * primitives such as list_add_rcu() as long as it's guarded by rcu_read_lock(). 275 * primitives such as list_add_rcu() as long as it's guarded by rcu_read_lock().
276 */ 276 */
277#define list_entry_rcu(ptr, type, member) \ 277#define list_entry_rcu(ptr, type, member) \
278 container_of(lockless_dereference(ptr), type, member) 278 container_of(READ_ONCE(ptr), type, member)
279 279
280/* 280/*
281 * Where are list_empty_rcu() and list_first_entry_rcu()? 281 * Where are list_empty_rcu() and list_first_entry_rcu()?
@@ -368,7 +368,7 @@ static inline void list_splice_tail_init_rcu(struct list_head *list,
368 * example is when items are added to the list, but never deleted. 368 * example is when items are added to the list, but never deleted.
369 */ 369 */
370#define list_entry_lockless(ptr, type, member) \ 370#define list_entry_lockless(ptr, type, member) \
371 container_of((typeof(ptr))lockless_dereference(ptr), type, member) 371 container_of((typeof(ptr))READ_ONCE(ptr), type, member)
372 372
373/** 373/**
374 * list_for_each_entry_lockless - iterate over rcu list of given type 374 * list_for_each_entry_lockless - iterate over rcu list of given type
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 1a9f70d44af9..a6ddc42f87a5 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -346,7 +346,7 @@ static inline void rcu_preempt_sleep_check(void) { }
346#define __rcu_dereference_check(p, c, space) \ 346#define __rcu_dereference_check(p, c, space) \
347({ \ 347({ \
348 /* Dependency order vs. p above. */ \ 348 /* Dependency order vs. p above. */ \
349 typeof(*p) *________p1 = (typeof(*p) *__force)lockless_dereference(p); \ 349 typeof(*p) *________p1 = (typeof(*p) *__force)READ_ONCE(p); \
350 RCU_LOCKDEP_WARN(!(c), "suspicious rcu_dereference_check() usage"); \ 350 RCU_LOCKDEP_WARN(!(c), "suspicious rcu_dereference_check() usage"); \
351 rcu_dereference_sparse(p, space); \ 351 rcu_dereference_sparse(p, space); \
352 ((typeof(*p) __force __kernel *)(________p1)); \ 352 ((typeof(*p) __force __kernel *)(________p1)); \
@@ -360,7 +360,7 @@ static inline void rcu_preempt_sleep_check(void) { }
360#define rcu_dereference_raw(p) \ 360#define rcu_dereference_raw(p) \
361({ \ 361({ \
362 /* Dependency order vs. p above. */ \ 362 /* Dependency order vs. p above. */ \
363 typeof(p) ________p1 = lockless_dereference(p); \ 363 typeof(p) ________p1 = READ_ONCE(p); \
364 ((typeof(*p) __force __kernel *)(________p1)); \ 364 ((typeof(*p) __force __kernel *)(________p1)); \
365}) 365})
366 366
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 978abfbac617..15eddc1353ba 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -120,21 +120,65 @@ struct reg_sequence {
120 */ 120 */
121#define regmap_read_poll_timeout(map, addr, val, cond, sleep_us, timeout_us) \ 121#define regmap_read_poll_timeout(map, addr, val, cond, sleep_us, timeout_us) \
122({ \ 122({ \
123 ktime_t timeout = ktime_add_us(ktime_get(), timeout_us); \ 123 u64 __timeout_us = (timeout_us); \
124 unsigned long __sleep_us = (sleep_us); \
125 ktime_t __timeout = ktime_add_us(ktime_get(), __timeout_us); \
126 int __ret; \
127 might_sleep_if(__sleep_us); \
128 for (;;) { \
129 __ret = regmap_read((map), (addr), &(val)); \
130 if (__ret) \
131 break; \
132 if (cond) \
133 break; \
134 if ((__timeout_us) && \
135 ktime_compare(ktime_get(), __timeout) > 0) { \
136 __ret = regmap_read((map), (addr), &(val)); \
137 break; \
138 } \
139 if (__sleep_us) \
140 usleep_range((__sleep_us >> 2) + 1, __sleep_us); \
141 } \
142 __ret ?: ((cond) ? 0 : -ETIMEDOUT); \
143})
144
145/**
146 * regmap_field_read_poll_timeout - Poll until a condition is met or timeout
147 *
148 * @field: Regmap field to read from
149 * @val: Unsigned integer variable to read the value into
150 * @cond: Break condition (usually involving @val)
151 * @sleep_us: Maximum time to sleep between reads in us (0
152 * tight-loops). Should be less than ~20ms since usleep_range
153 * is used (see Documentation/timers/timers-howto.txt).
154 * @timeout_us: Timeout in us, 0 means never timeout
155 *
156 * Returns 0 on success and -ETIMEDOUT upon a timeout or the regmap_field_read
157 * error return value in case of a error read. In the two former cases,
158 * the last read value at @addr is stored in @val. Must not be called
159 * from atomic context if sleep_us or timeout_us are used.
160 *
161 * This is modelled after the readx_poll_timeout macros in linux/iopoll.h.
162 */
163#define regmap_field_read_poll_timeout(field, val, cond, sleep_us, timeout_us) \
164({ \
165 u64 __timeout_us = (timeout_us); \
166 unsigned long __sleep_us = (sleep_us); \
167 ktime_t timeout = ktime_add_us(ktime_get(), __timeout_us); \
124 int pollret; \ 168 int pollret; \
125 might_sleep_if(sleep_us); \ 169 might_sleep_if(__sleep_us); \
126 for (;;) { \ 170 for (;;) { \
127 pollret = regmap_read((map), (addr), &(val)); \ 171 pollret = regmap_field_read((field), &(val)); \
128 if (pollret) \ 172 if (pollret) \
129 break; \ 173 break; \
130 if (cond) \ 174 if (cond) \
131 break; \ 175 break; \
132 if (timeout_us && ktime_compare(ktime_get(), timeout) > 0) { \ 176 if (__timeout_us && ktime_compare(ktime_get(), timeout) > 0) { \
133 pollret = regmap_read((map), (addr), &(val)); \ 177 pollret = regmap_field_read((field), &(val)); \
134 break; \ 178 break; \
135 } \ 179 } \
136 if (sleep_us) \ 180 if (__sleep_us) \
137 usleep_range((sleep_us >> 2) + 1, sleep_us); \ 181 usleep_range((__sleep_us >> 2) + 1, __sleep_us); \
138 } \ 182 } \
139 pollret ?: ((cond) ? 0 : -ETIMEDOUT); \ 183 pollret ?: ((cond) ? 0 : -ETIMEDOUT); \
140}) 184})
@@ -273,6 +317,9 @@ typedef void (*regmap_unlock)(void *);
273 * 317 *
274 * @ranges: Array of configuration entries for virtual address ranges. 318 * @ranges: Array of configuration entries for virtual address ranges.
275 * @num_ranges: Number of range configuration entries. 319 * @num_ranges: Number of range configuration entries.
320 * @hwlock_id: Specify the hardware spinlock id.
321 * @hwlock_mode: The hardware spinlock mode, should be HWLOCK_IRQSTATE,
322 * HWLOCK_IRQ or 0.
276 */ 323 */
277struct regmap_config { 324struct regmap_config {
278 const char *name; 325 const char *name;
@@ -317,6 +364,9 @@ struct regmap_config {
317 364
318 const struct regmap_range_cfg *ranges; 365 const struct regmap_range_cfg *ranges;
319 unsigned int num_ranges; 366 unsigned int num_ranges;
367
368 unsigned int hwlock_id;
369 unsigned int hwlock_mode;
320}; 370};
321 371
322/** 372/**
diff --git a/include/linux/regulator/da9211.h b/include/linux/regulator/da9211.h
index 80cb40b7c88d..f2fd2d3bf58f 100644
--- a/include/linux/regulator/da9211.h
+++ b/include/linux/regulator/da9211.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * da9211.h - Regulator device driver for DA9211/DA9212 2 * da9211.h - Regulator device driver for DA9211/DA9212
3 * /DA9213/DA9214/DA9215 3 * /DA9213/DA9223/DA9214/DA9224/DA9215/DA9225
4 * Copyright (C) 2015 Dialog Semiconductor Ltd. 4 * Copyright (C) 2015 Dialog Semiconductor Ltd.
5 * 5 *
6 * This program is free software; you can redistribute it and/or 6 * This program is free software; you can redistribute it and/or
@@ -25,8 +25,11 @@ enum da9211_chip_id {
25 DA9211, 25 DA9211,
26 DA9212, 26 DA9212,
27 DA9213, 27 DA9213,
28 DA9223,
28 DA9214, 29 DA9214,
30 DA9224,
29 DA9215, 31 DA9215,
32 DA9225,
30}; 33};
31 34
32struct da9211_pdata { 35struct da9211_pdata {
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index f6d7ee98d93c..41319a2e409b 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -136,6 +136,14 @@ struct rtc_device {
136 /* Some hardware can't support UIE mode */ 136 /* Some hardware can't support UIE mode */
137 int uie_unsupported; 137 int uie_unsupported;
138 138
139 /* Number of nsec it takes to set the RTC clock. This influences when
140 * the set ops are called. An offset:
141 * - of 0.5 s will call RTC set for wall clock time 10.0 s at 9.5 s
142 * - of 1.5 s will call RTC set for wall clock time 10.0 s at 8.5 s
143 * - of -0.5 s will call RTC set for wall clock time 10.0 s at 10.5 s
144 */
145 long set_offset_nsec;
146
139 bool registered; 147 bool registered;
140 148
141 struct nvmem_config *nvmem_config; 149 struct nvmem_config *nvmem_config;
@@ -173,7 +181,7 @@ extern void devm_rtc_device_unregister(struct device *dev,
173 181
174extern int rtc_read_time(struct rtc_device *rtc, struct rtc_time *tm); 182extern int rtc_read_time(struct rtc_device *rtc, struct rtc_time *tm);
175extern int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm); 183extern int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm);
176extern int rtc_set_ntp_time(struct timespec64 now); 184extern int rtc_set_ntp_time(struct timespec64 now, unsigned long *target_nsec);
177int __rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm); 185int __rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm);
178extern int rtc_read_alarm(struct rtc_device *rtc, 186extern int rtc_read_alarm(struct rtc_device *rtc,
179 struct rtc_wkalrm *alrm); 187 struct rtc_wkalrm *alrm);
@@ -222,6 +230,39 @@ static inline bool is_leap_year(unsigned int year)
222 return (!(year % 4) && (year % 100)) || !(year % 400); 230 return (!(year % 4) && (year % 100)) || !(year % 400);
223} 231}
224 232
233/* Determine if we can call to driver to set the time. Drivers can only be
234 * called to set a second aligned time value, and the field set_offset_nsec
235 * specifies how far away from the second aligned time to call the driver.
236 *
237 * This also computes 'to_set' which is the time we are trying to set, and has
238 * a zero in tv_nsecs, such that:
239 * to_set - set_delay_nsec == now +/- FUZZ
240 *
241 */
242static inline bool rtc_tv_nsec_ok(s64 set_offset_nsec,
243 struct timespec64 *to_set,
244 const struct timespec64 *now)
245{
246 /* Allowed error in tv_nsec, arbitarily set to 5 jiffies in ns. */
247 const unsigned long TIME_SET_NSEC_FUZZ = TICK_NSEC * 5;
248 struct timespec64 delay = {.tv_sec = 0,
249 .tv_nsec = set_offset_nsec};
250
251 *to_set = timespec64_add(*now, delay);
252
253 if (to_set->tv_nsec < TIME_SET_NSEC_FUZZ) {
254 to_set->tv_nsec = 0;
255 return true;
256 }
257
258 if (to_set->tv_nsec > NSEC_PER_SEC - TIME_SET_NSEC_FUZZ) {
259 to_set->tv_sec++;
260 to_set->tv_nsec = 0;
261 return true;
262 }
263 return false;
264}
265
225#define rtc_register_device(device) \ 266#define rtc_register_device(device) \
226 __rtc_register_device(THIS_MODULE, device) 267 __rtc_register_device(THIS_MODULE, device)
227 268
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index ff3dd2ec44b4..54bcd970bfd3 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -68,7 +68,7 @@ static inline bool lockdep_rtnl_is_held(void)
68 * @p: The pointer to read, prior to dereferencing 68 * @p: The pointer to read, prior to dereferencing
69 * 69 *
70 * Return the value of the specified RCU-protected pointer, but omit 70 * Return the value of the specified RCU-protected pointer, but omit
71 * both the smp_read_barrier_depends() and the ACCESS_ONCE(), because 71 * both the smp_read_barrier_depends() and the READ_ONCE(), because
72 * caller holds RTNL. 72 * caller holds RTNL.
73 */ 73 */
74#define rtnl_dereference(p) \ 74#define rtnl_dereference(p) \
diff --git a/include/linux/rwlock.h b/include/linux/rwlock.h
index bc2994ed66e1..3dcd617e65ae 100644
--- a/include/linux/rwlock.h
+++ b/include/linux/rwlock.h
@@ -38,6 +38,15 @@ do { \
38 extern int do_raw_write_trylock(rwlock_t *lock); 38 extern int do_raw_write_trylock(rwlock_t *lock);
39 extern void do_raw_write_unlock(rwlock_t *lock) __releases(lock); 39 extern void do_raw_write_unlock(rwlock_t *lock) __releases(lock);
40#else 40#else
41
42#ifndef arch_read_lock_flags
43# define arch_read_lock_flags(lock, flags) arch_read_lock(lock)
44#endif
45
46#ifndef arch_write_lock_flags
47# define arch_write_lock_flags(lock, flags) arch_write_lock(lock)
48#endif
49
41# define do_raw_read_lock(rwlock) do {__acquire(lock); arch_read_lock(&(rwlock)->raw_lock); } while (0) 50# define do_raw_read_lock(rwlock) do {__acquire(lock); arch_read_lock(&(rwlock)->raw_lock); } while (0)
42# define do_raw_read_lock_flags(lock, flags) \ 51# define do_raw_read_lock_flags(lock, flags) \
43 do {__acquire(lock); arch_read_lock_flags(&(lock)->raw_lock, *(flags)); } while (0) 52 do {__acquire(lock); arch_read_lock_flags(&(lock)->raw_lock, *(flags)); } while (0)
@@ -50,9 +59,6 @@ do { \
50# define do_raw_write_unlock(rwlock) do {arch_write_unlock(&(rwlock)->raw_lock); __release(lock); } while (0) 59# define do_raw_write_unlock(rwlock) do {arch_write_unlock(&(rwlock)->raw_lock); __release(lock); } while (0)
51#endif 60#endif
52 61
53#define read_can_lock(rwlock) arch_read_can_lock(&(rwlock)->raw_lock)
54#define write_can_lock(rwlock) arch_write_can_lock(&(rwlock)->raw_lock)
55
56/* 62/*
57 * Define the various rw_lock methods. Note we define these 63 * Define the various rw_lock methods. Note we define these
58 * regardless of whether CONFIG_SMP or CONFIG_PREEMPT are set. The various 64 * regardless of whether CONFIG_SMP or CONFIG_PREEMPT are set. The various
diff --git a/include/linux/rwlock_api_smp.h b/include/linux/rwlock_api_smp.h
index 5b9b84b20407..86ebb4bf9c6e 100644
--- a/include/linux/rwlock_api_smp.h
+++ b/include/linux/rwlock_api_smp.h
@@ -211,7 +211,7 @@ static inline void __raw_write_lock(rwlock_t *lock)
211 LOCK_CONTENDED(lock, do_raw_write_trylock, do_raw_write_lock); 211 LOCK_CONTENDED(lock, do_raw_write_trylock, do_raw_write_lock);
212} 212}
213 213
214#endif /* CONFIG_PREEMPT */ 214#endif /* !CONFIG_GENERIC_LOCKBREAK || CONFIG_DEBUG_LOCK_ALLOC */
215 215
216static inline void __raw_write_unlock(rwlock_t *lock) 216static inline void __raw_write_unlock(rwlock_t *lock)
217{ 217{
diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h
index dfa34d803439..56707d5ff6ad 100644
--- a/include/linux/rwsem.h
+++ b/include/linux/rwsem.h
@@ -112,6 +112,7 @@ static inline int rwsem_is_contended(struct rw_semaphore *sem)
112 * lock for reading 112 * lock for reading
113 */ 113 */
114extern void down_read(struct rw_semaphore *sem); 114extern void down_read(struct rw_semaphore *sem);
115extern int __must_check down_read_killable(struct rw_semaphore *sem);
115 116
116/* 117/*
117 * trylock for reading -- returns 1 if successful, 0 if contention 118 * trylock for reading -- returns 1 if successful, 0 if contention
diff --git a/include/linux/sched.h b/include/linux/sched.h
index fdf74f27acf1..a5dc7c98b0a2 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -166,8 +166,6 @@ struct task_group;
166/* Task command name length: */ 166/* Task command name length: */
167#define TASK_COMM_LEN 16 167#define TASK_COMM_LEN 16
168 168
169extern cpumask_var_t cpu_isolated_map;
170
171extern void scheduler_tick(void); 169extern void scheduler_tick(void);
172 170
173#define MAX_SCHEDULE_TIMEOUT LONG_MAX 171#define MAX_SCHEDULE_TIMEOUT LONG_MAX
@@ -332,9 +330,11 @@ struct load_weight {
332struct sched_avg { 330struct sched_avg {
333 u64 last_update_time; 331 u64 last_update_time;
334 u64 load_sum; 332 u64 load_sum;
333 u64 runnable_load_sum;
335 u32 util_sum; 334 u32 util_sum;
336 u32 period_contrib; 335 u32 period_contrib;
337 unsigned long load_avg; 336 unsigned long load_avg;
337 unsigned long runnable_load_avg;
338 unsigned long util_avg; 338 unsigned long util_avg;
339}; 339};
340 340
@@ -377,6 +377,7 @@ struct sched_statistics {
377struct sched_entity { 377struct sched_entity {
378 /* For load-balancing: */ 378 /* For load-balancing: */
379 struct load_weight load; 379 struct load_weight load;
380 unsigned long runnable_weight;
380 struct rb_node run_node; 381 struct rb_node run_node;
381 struct list_head group_node; 382 struct list_head group_node;
382 unsigned int on_rq; 383 unsigned int on_rq;
@@ -472,10 +473,10 @@ struct sched_dl_entity {
472 * conditions between the inactive timer handler and the wakeup 473 * conditions between the inactive timer handler and the wakeup
473 * code. 474 * code.
474 */ 475 */
475 int dl_throttled; 476 int dl_throttled : 1;
476 int dl_boosted; 477 int dl_boosted : 1;
477 int dl_yielded; 478 int dl_yielded : 1;
478 int dl_non_contending; 479 int dl_non_contending : 1;
479 480
480 /* 481 /*
481 * Bandwidth enforcement timer. Each -deadline task has its 482 * Bandwidth enforcement timer. Each -deadline task has its
@@ -1246,7 +1247,7 @@ static inline pid_t task_pgrp_nr(struct task_struct *tsk)
1246#define TASK_REPORT_IDLE (TASK_REPORT + 1) 1247#define TASK_REPORT_IDLE (TASK_REPORT + 1)
1247#define TASK_REPORT_MAX (TASK_REPORT_IDLE << 1) 1248#define TASK_REPORT_MAX (TASK_REPORT_IDLE << 1)
1248 1249
1249static inline unsigned int __get_task_state(struct task_struct *tsk) 1250static inline unsigned int task_state_index(struct task_struct *tsk)
1250{ 1251{
1251 unsigned int tsk_state = READ_ONCE(tsk->state); 1252 unsigned int tsk_state = READ_ONCE(tsk->state);
1252 unsigned int state = (tsk_state | tsk->exit_state) & TASK_REPORT; 1253 unsigned int state = (tsk_state | tsk->exit_state) & TASK_REPORT;
@@ -1259,7 +1260,7 @@ static inline unsigned int __get_task_state(struct task_struct *tsk)
1259 return fls(state); 1260 return fls(state);
1260} 1261}
1261 1262
1262static inline char __task_state_to_char(unsigned int state) 1263static inline char task_index_to_char(unsigned int state)
1263{ 1264{
1264 static const char state_char[] = "RSDTtXZPI"; 1265 static const char state_char[] = "RSDTtXZPI";
1265 1266
@@ -1270,7 +1271,7 @@ static inline char __task_state_to_char(unsigned int state)
1270 1271
1271static inline char task_state_to_char(struct task_struct *tsk) 1272static inline char task_state_to_char(struct task_struct *tsk)
1272{ 1273{
1273 return __task_state_to_char(__get_task_state(tsk)); 1274 return task_index_to_char(task_state_index(tsk));
1274} 1275}
1275 1276
1276/** 1277/**
diff --git a/include/linux/sched/isolation.h b/include/linux/sched/isolation.h
new file mode 100644
index 000000000000..d849431c8060
--- /dev/null
+++ b/include/linux/sched/isolation.h
@@ -0,0 +1,51 @@
1#ifndef _LINUX_SCHED_ISOLATION_H
2#define _LINUX_SCHED_ISOLATION_H
3
4#include <linux/cpumask.h>
5#include <linux/init.h>
6#include <linux/tick.h>
7
8enum hk_flags {
9 HK_FLAG_TIMER = 1,
10 HK_FLAG_RCU = (1 << 1),
11 HK_FLAG_MISC = (1 << 2),
12 HK_FLAG_SCHED = (1 << 3),
13 HK_FLAG_TICK = (1 << 4),
14 HK_FLAG_DOMAIN = (1 << 5),
15};
16
17#ifdef CONFIG_CPU_ISOLATION
18DECLARE_STATIC_KEY_FALSE(housekeeping_overriden);
19extern int housekeeping_any_cpu(enum hk_flags flags);
20extern const struct cpumask *housekeeping_cpumask(enum hk_flags flags);
21extern void housekeeping_affine(struct task_struct *t, enum hk_flags flags);
22extern bool housekeeping_test_cpu(int cpu, enum hk_flags flags);
23extern void __init housekeeping_init(void);
24
25#else
26
27static inline int housekeeping_any_cpu(enum hk_flags flags)
28{
29 return smp_processor_id();
30}
31
32static inline const struct cpumask *housekeeping_cpumask(enum hk_flags flags)
33{
34 return cpu_possible_mask;
35}
36
37static inline void housekeeping_affine(struct task_struct *t,
38 enum hk_flags flags) { }
39static inline void housekeeping_init(void) { }
40#endif /* CONFIG_CPU_ISOLATION */
41
42static inline bool housekeeping_cpu(int cpu, enum hk_flags flags)
43{
44#ifdef CONFIG_CPU_ISOLATION
45 if (static_branch_unlikely(&housekeeping_overriden))
46 return housekeeping_test_cpu(cpu, flags);
47#endif
48 return true;
49}
50
51#endif /* _LINUX_SCHED_ISOLATION_H */
diff --git a/include/linux/sched/rt.h b/include/linux/sched/rt.h
index db865ed25ef3..e5af028c08b4 100644
--- a/include/linux/sched/rt.h
+++ b/include/linux/sched/rt.h
@@ -18,6 +18,17 @@ static inline int rt_task(struct task_struct *p)
18 return rt_prio(p->prio); 18 return rt_prio(p->prio);
19} 19}
20 20
21static inline bool task_is_realtime(struct task_struct *tsk)
22{
23 int policy = tsk->policy;
24
25 if (policy == SCHED_FIFO || policy == SCHED_RR)
26 return true;
27 if (policy == SCHED_DEADLINE)
28 return true;
29 return false;
30}
31
21#ifdef CONFIG_RT_MUTEXES 32#ifdef CONFIG_RT_MUTEXES
22/* 33/*
23 * Must hold either p->pi_lock or task_rq(p)->lock. 34 * Must hold either p->pi_lock or task_rq(p)->lock.
diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h
index d6a18a3839cc..1c1a1512ec55 100644
--- a/include/linux/sched/sysctl.h
+++ b/include/linux/sched/sysctl.h
@@ -38,9 +38,9 @@ extern unsigned int sysctl_numa_balancing_scan_period_max;
38extern unsigned int sysctl_numa_balancing_scan_size; 38extern unsigned int sysctl_numa_balancing_scan_size;
39 39
40#ifdef CONFIG_SCHED_DEBUG 40#ifdef CONFIG_SCHED_DEBUG
41extern unsigned int sysctl_sched_migration_cost; 41extern __read_mostly unsigned int sysctl_sched_migration_cost;
42extern unsigned int sysctl_sched_nr_migrate; 42extern __read_mostly unsigned int sysctl_sched_nr_migrate;
43extern unsigned int sysctl_sched_time_avg; 43extern __read_mostly unsigned int sysctl_sched_time_avg;
44 44
45int sched_proc_update_handler(struct ctl_table *table, int write, 45int sched_proc_update_handler(struct ctl_table *table, int write,
46 void __user *buffer, size_t *length, 46 void __user *buffer, size_t *length,
diff --git a/include/linux/spi/spi-fsl-dspi.h b/include/linux/spi/spi-fsl-dspi.h
new file mode 100644
index 000000000000..74c9bae20bf2
--- /dev/null
+++ b/include/linux/spi/spi-fsl-dspi.h
@@ -0,0 +1,31 @@
1/*
2 * Freescale DSPI controller driver
3 *
4 * Copyright (c) 2017 Angelo Dureghello <angelo@sysam.it>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#ifndef SPI_FSL_DSPI_HEADER_H
17#define SPI_FSL_DSPI_HEADER_H
18
19/**
20 * struct fsl_dspi_platform_data - platform data for the Freescale DSPI driver
21 * @bus_num: board specific identifier for this DSPI driver.
22 * @cs_num: number of chip selects supported by this DSPI driver.
23 */
24struct fsl_dspi_platform_data {
25 u32 cs_num;
26 u32 bus_num;
27 u32 sck_cs_delay;
28 u32 cs_sck_delay;
29};
30
31#endif /* SPI_FSL_DSPI_HEADER_H */
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index 341e1a12bfc7..a39186194cd6 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -166,6 +166,10 @@ static inline void do_raw_spin_lock(raw_spinlock_t *lock) __acquires(lock)
166 arch_spin_lock(&lock->raw_lock); 166 arch_spin_lock(&lock->raw_lock);
167} 167}
168 168
169#ifndef arch_spin_lock_flags
170#define arch_spin_lock_flags(lock, flags) arch_spin_lock(lock)
171#endif
172
169static inline void 173static inline void
170do_raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long *flags) __acquires(lock) 174do_raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long *flags) __acquires(lock)
171{ 175{
@@ -279,12 +283,6 @@ static inline void do_raw_spin_unlock(raw_spinlock_t *lock) __releases(lock)
279 1 : ({ local_irq_restore(flags); 0; }); \ 283 1 : ({ local_irq_restore(flags); 0; }); \
280}) 284})
281 285
282/**
283 * raw_spin_can_lock - would raw_spin_trylock() succeed?
284 * @lock: the spinlock in question.
285 */
286#define raw_spin_can_lock(lock) (!raw_spin_is_locked(lock))
287
288/* Include rwlock functions */ 286/* Include rwlock functions */
289#include <linux/rwlock.h> 287#include <linux/rwlock.h>
290 288
@@ -397,11 +395,6 @@ static __always_inline int spin_is_contended(spinlock_t *lock)
397 return raw_spin_is_contended(&lock->rlock); 395 return raw_spin_is_contended(&lock->rlock);
398} 396}
399 397
400static __always_inline int spin_can_lock(spinlock_t *lock)
401{
402 return raw_spin_can_lock(&lock->rlock);
403}
404
405#define assert_spin_locked(lock) assert_raw_spin_locked(&(lock)->rlock) 398#define assert_spin_locked(lock) assert_raw_spin_locked(&(lock)->rlock)
406 399
407/* 400/*
diff --git a/include/linux/spinlock_up.h b/include/linux/spinlock_up.h
index 612fb530af41..0ac9112c1bbe 100644
--- a/include/linux/spinlock_up.h
+++ b/include/linux/spinlock_up.h
@@ -32,14 +32,6 @@ static inline void arch_spin_lock(arch_spinlock_t *lock)
32 barrier(); 32 barrier();
33} 33}
34 34
35static inline void
36arch_spin_lock_flags(arch_spinlock_t *lock, unsigned long flags)
37{
38 local_irq_save(flags);
39 lock->slock = 0;
40 barrier();
41}
42
43static inline int arch_spin_trylock(arch_spinlock_t *lock) 35static inline int arch_spin_trylock(arch_spinlock_t *lock)
44{ 36{
45 char oldval = lock->slock; 37 char oldval = lock->slock;
@@ -77,7 +69,4 @@ static inline void arch_spin_unlock(arch_spinlock_t *lock)
77 69
78#define arch_spin_is_contended(lock) (((void)(lock), 0)) 70#define arch_spin_is_contended(lock) (((void)(lock), 0))
79 71
80#define arch_read_can_lock(lock) (((void)(lock), 1))
81#define arch_write_can_lock(lock) (((void)(lock), 1))
82
83#endif /* __LINUX_SPINLOCK_UP_H */ 72#endif /* __LINUX_SPINLOCK_UP_H */
diff --git a/include/linux/tick.h b/include/linux/tick.h
index cf413b344ddb..f442d1a42025 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -138,7 +138,6 @@ static inline u64 get_cpu_iowait_time_us(int cpu, u64 *unused) { return -1; }
138#ifdef CONFIG_NO_HZ_FULL 138#ifdef CONFIG_NO_HZ_FULL
139extern bool tick_nohz_full_running; 139extern bool tick_nohz_full_running;
140extern cpumask_var_t tick_nohz_full_mask; 140extern cpumask_var_t tick_nohz_full_mask;
141extern cpumask_var_t housekeeping_mask;
142 141
143static inline bool tick_nohz_full_enabled(void) 142static inline bool tick_nohz_full_enabled(void)
144{ 143{
@@ -162,11 +161,6 @@ static inline void tick_nohz_full_add_cpus_to(struct cpumask *mask)
162 cpumask_or(mask, mask, tick_nohz_full_mask); 161 cpumask_or(mask, mask, tick_nohz_full_mask);
163} 162}
164 163
165static inline int housekeeping_any_cpu(void)
166{
167 return cpumask_any_and(housekeeping_mask, cpu_online_mask);
168}
169
170extern void tick_nohz_dep_set(enum tick_dep_bits bit); 164extern void tick_nohz_dep_set(enum tick_dep_bits bit);
171extern void tick_nohz_dep_clear(enum tick_dep_bits bit); 165extern void tick_nohz_dep_clear(enum tick_dep_bits bit);
172extern void tick_nohz_dep_set_cpu(int cpu, enum tick_dep_bits bit); 166extern void tick_nohz_dep_set_cpu(int cpu, enum tick_dep_bits bit);
@@ -235,11 +229,8 @@ static inline void tick_dep_clear_signal(struct signal_struct *signal,
235 229
236extern void tick_nohz_full_kick_cpu(int cpu); 230extern void tick_nohz_full_kick_cpu(int cpu);
237extern void __tick_nohz_task_switch(void); 231extern void __tick_nohz_task_switch(void);
232extern void __init tick_nohz_full_setup(cpumask_var_t cpumask);
238#else 233#else
239static inline int housekeeping_any_cpu(void)
240{
241 return smp_processor_id();
242}
243static inline bool tick_nohz_full_enabled(void) { return false; } 234static inline bool tick_nohz_full_enabled(void) { return false; }
244static inline bool tick_nohz_full_cpu(int cpu) { return false; } 235static inline bool tick_nohz_full_cpu(int cpu) { return false; }
245static inline void tick_nohz_full_add_cpus_to(struct cpumask *mask) { } 236static inline void tick_nohz_full_add_cpus_to(struct cpumask *mask) { }
@@ -259,35 +250,9 @@ static inline void tick_dep_clear_signal(struct signal_struct *signal,
259 250
260static inline void tick_nohz_full_kick_cpu(int cpu) { } 251static inline void tick_nohz_full_kick_cpu(int cpu) { }
261static inline void __tick_nohz_task_switch(void) { } 252static inline void __tick_nohz_task_switch(void) { }
253static inline void tick_nohz_full_setup(cpumask_var_t cpumask) { }
262#endif 254#endif
263 255
264static inline const struct cpumask *housekeeping_cpumask(void)
265{
266#ifdef CONFIG_NO_HZ_FULL
267 if (tick_nohz_full_enabled())
268 return housekeeping_mask;
269#endif
270 return cpu_possible_mask;
271}
272
273static inline bool is_housekeeping_cpu(int cpu)
274{
275#ifdef CONFIG_NO_HZ_FULL
276 if (tick_nohz_full_enabled())
277 return cpumask_test_cpu(cpu, housekeeping_mask);
278#endif
279 return true;
280}
281
282static inline void housekeeping_affine(struct task_struct *t)
283{
284#ifdef CONFIG_NO_HZ_FULL
285 if (tick_nohz_full_enabled())
286 set_cpus_allowed_ptr(t, housekeeping_mask);
287
288#endif
289}
290
291static inline void tick_nohz_task_switch(void) 256static inline void tick_nohz_task_switch(void)
292{ 257{
293 if (tick_nohz_full_enabled()) 258 if (tick_nohz_full_enabled())
diff --git a/include/linux/time.h b/include/linux/time.h
index 87c36cf1cec2..4b62a2c0a661 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -18,149 +18,10 @@ int get_itimerspec64(struct itimerspec64 *it,
18int put_itimerspec64(const struct itimerspec64 *it, 18int put_itimerspec64(const struct itimerspec64 *it,
19 struct itimerspec __user *uit); 19 struct itimerspec __user *uit);
20 20
21#define TIME_T_MAX (time_t)((1UL << ((sizeof(time_t) << 3) - 1)) - 1)
22
23static inline int timespec_equal(const struct timespec *a,
24 const struct timespec *b)
25{
26 return (a->tv_sec == b->tv_sec) && (a->tv_nsec == b->tv_nsec);
27}
28
29/*
30 * lhs < rhs: return <0
31 * lhs == rhs: return 0
32 * lhs > rhs: return >0
33 */
34static inline int timespec_compare(const struct timespec *lhs, const struct timespec *rhs)
35{
36 if (lhs->tv_sec < rhs->tv_sec)
37 return -1;
38 if (lhs->tv_sec > rhs->tv_sec)
39 return 1;
40 return lhs->tv_nsec - rhs->tv_nsec;
41}
42
43static inline int timeval_compare(const struct timeval *lhs, const struct timeval *rhs)
44{
45 if (lhs->tv_sec < rhs->tv_sec)
46 return -1;
47 if (lhs->tv_sec > rhs->tv_sec)
48 return 1;
49 return lhs->tv_usec - rhs->tv_usec;
50}
51
52extern time64_t mktime64(const unsigned int year, const unsigned int mon, 21extern time64_t mktime64(const unsigned int year, const unsigned int mon,
53 const unsigned int day, const unsigned int hour, 22 const unsigned int day, const unsigned int hour,
54 const unsigned int min, const unsigned int sec); 23 const unsigned int min, const unsigned int sec);
55 24
56/**
57 * Deprecated. Use mktime64().
58 */
59static inline unsigned long mktime(const unsigned int year,
60 const unsigned int mon, const unsigned int day,
61 const unsigned int hour, const unsigned int min,
62 const unsigned int sec)
63{
64 return mktime64(year, mon, day, hour, min, sec);
65}
66
67extern void set_normalized_timespec(struct timespec *ts, time_t sec, s64 nsec);
68
69/*
70 * timespec_add_safe assumes both values are positive and checks
71 * for overflow. It will return TIME_T_MAX if the reutrn would be
72 * smaller then either of the arguments.
73 */
74extern struct timespec timespec_add_safe(const struct timespec lhs,
75 const struct timespec rhs);
76
77
78static inline struct timespec timespec_add(struct timespec lhs,
79 struct timespec rhs)
80{
81 struct timespec ts_delta;
82 set_normalized_timespec(&ts_delta, lhs.tv_sec + rhs.tv_sec,
83 lhs.tv_nsec + rhs.tv_nsec);
84 return ts_delta;
85}
86
87/*
88 * sub = lhs - rhs, in normalized form
89 */
90static inline struct timespec timespec_sub(struct timespec lhs,
91 struct timespec rhs)
92{
93 struct timespec ts_delta;
94 set_normalized_timespec(&ts_delta, lhs.tv_sec - rhs.tv_sec,
95 lhs.tv_nsec - rhs.tv_nsec);
96 return ts_delta;
97}
98
99/*
100 * Returns true if the timespec is norm, false if denorm:
101 */
102static inline bool timespec_valid(const struct timespec *ts)
103{
104 /* Dates before 1970 are bogus */
105 if (ts->tv_sec < 0)
106 return false;
107 /* Can't have more nanoseconds then a second */
108 if ((unsigned long)ts->tv_nsec >= NSEC_PER_SEC)
109 return false;
110 return true;
111}
112
113static inline bool timespec_valid_strict(const struct timespec *ts)
114{
115 if (!timespec_valid(ts))
116 return false;
117 /* Disallow values that could overflow ktime_t */
118 if ((unsigned long long)ts->tv_sec >= KTIME_SEC_MAX)
119 return false;
120 return true;
121}
122
123static inline bool timeval_valid(const struct timeval *tv)
124{
125 /* Dates before 1970 are bogus */
126 if (tv->tv_sec < 0)
127 return false;
128
129 /* Can't have more microseconds then a second */
130 if (tv->tv_usec < 0 || tv->tv_usec >= USEC_PER_SEC)
131 return false;
132
133 return true;
134}
135
136extern struct timespec timespec_trunc(struct timespec t, unsigned gran);
137
138/*
139 * Validates if a timespec/timeval used to inject a time offset is valid.
140 * Offsets can be postive or negative. The value of the timeval/timespec
141 * is the sum of its fields, but *NOTE*: the field tv_usec/tv_nsec must
142 * always be non-negative.
143 */
144static inline bool timeval_inject_offset_valid(const struct timeval *tv)
145{
146 /* We don't check the tv_sec as it can be positive or negative */
147
148 /* Can't have more microseconds then a second */
149 if (tv->tv_usec < 0 || tv->tv_usec >= USEC_PER_SEC)
150 return false;
151 return true;
152}
153
154static inline bool timespec_inject_offset_valid(const struct timespec *ts)
155{
156 /* We don't check the tv_sec as it can be positive or negative */
157
158 /* Can't have more nanoseconds then a second */
159 if (ts->tv_nsec < 0 || ts->tv_nsec >= NSEC_PER_SEC)
160 return false;
161 return true;
162}
163
164/* Some architectures do not supply their own clocksource. 25/* Some architectures do not supply their own clocksource.
165 * This is mainly the case in architectures that get their 26 * This is mainly the case in architectures that get their
166 * inter-tick times by reading the counter on their interval 27 * inter-tick times by reading the counter on their interval
@@ -209,73 +70,7 @@ struct tm {
209 70
210void time64_to_tm(time64_t totalsecs, int offset, struct tm *result); 71void time64_to_tm(time64_t totalsecs, int offset, struct tm *result);
211 72
212/** 73# include <linux/time32.h>
213 * time_to_tm - converts the calendar time to local broken-down time
214 *
215 * @totalsecs the number of seconds elapsed since 00:00:00 on January 1, 1970,
216 * Coordinated Universal Time (UTC).
217 * @offset offset seconds adding to totalsecs.
218 * @result pointer to struct tm variable to receive broken-down time
219 */
220static inline void time_to_tm(time_t totalsecs, int offset, struct tm *result)
221{
222 time64_to_tm(totalsecs, offset, result);
223}
224
225/**
226 * timespec_to_ns - Convert timespec to nanoseconds
227 * @ts: pointer to the timespec variable to be converted
228 *
229 * Returns the scalar nanosecond representation of the timespec
230 * parameter.
231 */
232static inline s64 timespec_to_ns(const struct timespec *ts)
233{
234 return ((s64) ts->tv_sec * NSEC_PER_SEC) + ts->tv_nsec;
235}
236
237/**
238 * timeval_to_ns - Convert timeval to nanoseconds
239 * @ts: pointer to the timeval variable to be converted
240 *
241 * Returns the scalar nanosecond representation of the timeval
242 * parameter.
243 */
244static inline s64 timeval_to_ns(const struct timeval *tv)
245{
246 return ((s64) tv->tv_sec * NSEC_PER_SEC) +
247 tv->tv_usec * NSEC_PER_USEC;
248}
249
250/**
251 * ns_to_timespec - Convert nanoseconds to timespec
252 * @nsec: the nanoseconds value to be converted
253 *
254 * Returns the timespec representation of the nsec parameter.
255 */
256extern struct timespec ns_to_timespec(const s64 nsec);
257
258/**
259 * ns_to_timeval - Convert nanoseconds to timeval
260 * @nsec: the nanoseconds value to be converted
261 *
262 * Returns the timeval representation of the nsec parameter.
263 */
264extern struct timeval ns_to_timeval(const s64 nsec);
265
266/**
267 * timespec_add_ns - Adds nanoseconds to a timespec
268 * @a: pointer to timespec to be incremented
269 * @ns: unsigned nanoseconds value to be added
270 *
271 * This must always be inlined because its used from the x86-64 vdso,
272 * which cannot call other kernel functions.
273 */
274static __always_inline void timespec_add_ns(struct timespec *a, u64 ns)
275{
276 a->tv_sec += __iter_div_u64_rem(a->tv_nsec + ns, NSEC_PER_SEC, &ns);
277 a->tv_nsec = ns;
278}
279 74
280static inline bool itimerspec64_valid(const struct itimerspec64 *its) 75static inline bool itimerspec64_valid(const struct itimerspec64 *its)
281{ 76{
diff --git a/include/linux/time32.h b/include/linux/time32.h
new file mode 100644
index 000000000000..65b1de25198d
--- /dev/null
+++ b/include/linux/time32.h
@@ -0,0 +1,221 @@
1#ifndef _LINUX_TIME32_H
2#define _LINUX_TIME32_H
3/*
4 * These are all interfaces based on the old time_t definition
5 * that overflows in 2038 on 32-bit architectures. New code
6 * should use the replacements based on time64_t and timespec64.
7 *
8 * Any interfaces in here that become unused as we migrate
9 * code to time64_t should get removed.
10 */
11
12#include <linux/time64.h>
13
14#define TIME_T_MAX (time_t)((1UL << ((sizeof(time_t) << 3) - 1)) - 1)
15
16#if __BITS_PER_LONG == 64
17
18/* timespec64 is defined as timespec here */
19static inline struct timespec timespec64_to_timespec(const struct timespec64 ts64)
20{
21 return ts64;
22}
23
24static inline struct timespec64 timespec_to_timespec64(const struct timespec ts)
25{
26 return ts;
27}
28
29# define timespec_equal timespec64_equal
30# define timespec_compare timespec64_compare
31# define set_normalized_timespec set_normalized_timespec64
32# define timespec_add timespec64_add
33# define timespec_sub timespec64_sub
34# define timespec_valid timespec64_valid
35# define timespec_valid_strict timespec64_valid_strict
36# define timespec_to_ns timespec64_to_ns
37# define ns_to_timespec ns_to_timespec64
38# define timespec_add_ns timespec64_add_ns
39
40#else
41static inline struct timespec timespec64_to_timespec(const struct timespec64 ts64)
42{
43 struct timespec ret;
44
45 ret.tv_sec = (time_t)ts64.tv_sec;
46 ret.tv_nsec = ts64.tv_nsec;
47 return ret;
48}
49
50static inline struct timespec64 timespec_to_timespec64(const struct timespec ts)
51{
52 struct timespec64 ret;
53
54 ret.tv_sec = ts.tv_sec;
55 ret.tv_nsec = ts.tv_nsec;
56 return ret;
57}
58
59static inline int timespec_equal(const struct timespec *a,
60 const struct timespec *b)
61{
62 return (a->tv_sec == b->tv_sec) && (a->tv_nsec == b->tv_nsec);
63}
64
65/*
66 * lhs < rhs: return <0
67 * lhs == rhs: return 0
68 * lhs > rhs: return >0
69 */
70static inline int timespec_compare(const struct timespec *lhs, const struct timespec *rhs)
71{
72 if (lhs->tv_sec < rhs->tv_sec)
73 return -1;
74 if (lhs->tv_sec > rhs->tv_sec)
75 return 1;
76 return lhs->tv_nsec - rhs->tv_nsec;
77}
78
79extern void set_normalized_timespec(struct timespec *ts, time_t sec, s64 nsec);
80
81static inline struct timespec timespec_add(struct timespec lhs,
82 struct timespec rhs)
83{
84 struct timespec ts_delta;
85
86 set_normalized_timespec(&ts_delta, lhs.tv_sec + rhs.tv_sec,
87 lhs.tv_nsec + rhs.tv_nsec);
88 return ts_delta;
89}
90
91/*
92 * sub = lhs - rhs, in normalized form
93 */
94static inline struct timespec timespec_sub(struct timespec lhs,
95 struct timespec rhs)
96{
97 struct timespec ts_delta;
98
99 set_normalized_timespec(&ts_delta, lhs.tv_sec - rhs.tv_sec,
100 lhs.tv_nsec - rhs.tv_nsec);
101 return ts_delta;
102}
103
104/*
105 * Returns true if the timespec is norm, false if denorm:
106 */
107static inline bool timespec_valid(const struct timespec *ts)
108{
109 /* Dates before 1970 are bogus */
110 if (ts->tv_sec < 0)
111 return false;
112 /* Can't have more nanoseconds then a second */
113 if ((unsigned long)ts->tv_nsec >= NSEC_PER_SEC)
114 return false;
115 return true;
116}
117
118static inline bool timespec_valid_strict(const struct timespec *ts)
119{
120 if (!timespec_valid(ts))
121 return false;
122 /* Disallow values that could overflow ktime_t */
123 if ((unsigned long long)ts->tv_sec >= KTIME_SEC_MAX)
124 return false;
125 return true;
126}
127
128/**
129 * timespec_to_ns - Convert timespec to nanoseconds
130 * @ts: pointer to the timespec variable to be converted
131 *
132 * Returns the scalar nanosecond representation of the timespec
133 * parameter.
134 */
135static inline s64 timespec_to_ns(const struct timespec *ts)
136{
137 return ((s64) ts->tv_sec * NSEC_PER_SEC) + ts->tv_nsec;
138}
139
140/**
141 * ns_to_timespec - Convert nanoseconds to timespec
142 * @nsec: the nanoseconds value to be converted
143 *
144 * Returns the timespec representation of the nsec parameter.
145 */
146extern struct timespec ns_to_timespec(const s64 nsec);
147
148/**
149 * timespec_add_ns - Adds nanoseconds to a timespec
150 * @a: pointer to timespec to be incremented
151 * @ns: unsigned nanoseconds value to be added
152 *
153 * This must always be inlined because its used from the x86-64 vdso,
154 * which cannot call other kernel functions.
155 */
156static __always_inline void timespec_add_ns(struct timespec *a, u64 ns)
157{
158 a->tv_sec += __iter_div_u64_rem(a->tv_nsec + ns, NSEC_PER_SEC, &ns);
159 a->tv_nsec = ns;
160}
161
162#endif
163
164/**
165 * time_to_tm - converts the calendar time to local broken-down time
166 *
167 * @totalsecs the number of seconds elapsed since 00:00:00 on January 1, 1970,
168 * Coordinated Universal Time (UTC).
169 * @offset offset seconds adding to totalsecs.
170 * @result pointer to struct tm variable to receive broken-down time
171 */
172static inline void time_to_tm(time_t totalsecs, int offset, struct tm *result)
173{
174 time64_to_tm(totalsecs, offset, result);
175}
176
177static inline unsigned long mktime(const unsigned int year,
178 const unsigned int mon, const unsigned int day,
179 const unsigned int hour, const unsigned int min,
180 const unsigned int sec)
181{
182 return mktime64(year, mon, day, hour, min, sec);
183}
184
185static inline bool timeval_valid(const struct timeval *tv)
186{
187 /* Dates before 1970 are bogus */
188 if (tv->tv_sec < 0)
189 return false;
190
191 /* Can't have more microseconds then a second */
192 if (tv->tv_usec < 0 || tv->tv_usec >= USEC_PER_SEC)
193 return false;
194
195 return true;
196}
197
198extern struct timespec timespec_trunc(struct timespec t, unsigned int gran);
199
200/**
201 * timeval_to_ns - Convert timeval to nanoseconds
202 * @ts: pointer to the timeval variable to be converted
203 *
204 * Returns the scalar nanosecond representation of the timeval
205 * parameter.
206 */
207static inline s64 timeval_to_ns(const struct timeval *tv)
208{
209 return ((s64) tv->tv_sec * NSEC_PER_SEC) +
210 tv->tv_usec * NSEC_PER_USEC;
211}
212
213/**
214 * ns_to_timeval - Convert nanoseconds to timeval
215 * @nsec: the nanoseconds value to be converted
216 *
217 * Returns the timeval representation of the nsec parameter.
218 */
219extern struct timeval ns_to_timeval(const s64 nsec);
220
221#endif
diff --git a/include/linux/time64.h b/include/linux/time64.h
index ad33260618f7..93d39499838e 100644
--- a/include/linux/time64.h
+++ b/include/linux/time64.h
@@ -8,11 +8,8 @@
8typedef __s64 time64_t; 8typedef __s64 time64_t;
9typedef __u64 timeu64_t; 9typedef __u64 timeu64_t;
10 10
11/*
12 * This wants to go into uapi/linux/time.h once we agreed about the
13 * userspace interfaces.
14 */
15#if __BITS_PER_LONG == 64 11#if __BITS_PER_LONG == 64
12/* this trick allows us to optimize out timespec64_to_timespec */
16# define timespec64 timespec 13# define timespec64 timespec
17#define itimerspec64 itimerspec 14#define itimerspec64 itimerspec
18#else 15#else
@@ -42,77 +39,6 @@ struct itimerspec64 {
42#define KTIME_MAX ((s64)~((u64)1 << 63)) 39#define KTIME_MAX ((s64)~((u64)1 << 63))
43#define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC) 40#define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC)
44 41
45#if __BITS_PER_LONG == 64
46
47static inline struct timespec timespec64_to_timespec(const struct timespec64 ts64)
48{
49 return ts64;
50}
51
52static inline struct timespec64 timespec_to_timespec64(const struct timespec ts)
53{
54 return ts;
55}
56
57static inline struct itimerspec itimerspec64_to_itimerspec(struct itimerspec64 *its64)
58{
59 return *its64;
60}
61
62static inline struct itimerspec64 itimerspec_to_itimerspec64(struct itimerspec *its)
63{
64 return *its;
65}
66
67# define timespec64_equal timespec_equal
68# define timespec64_compare timespec_compare
69# define set_normalized_timespec64 set_normalized_timespec
70# define timespec64_add timespec_add
71# define timespec64_sub timespec_sub
72# define timespec64_valid timespec_valid
73# define timespec64_valid_strict timespec_valid_strict
74# define timespec64_to_ns timespec_to_ns
75# define ns_to_timespec64 ns_to_timespec
76# define timespec64_add_ns timespec_add_ns
77
78#else
79
80static inline struct timespec timespec64_to_timespec(const struct timespec64 ts64)
81{
82 struct timespec ret;
83
84 ret.tv_sec = (time_t)ts64.tv_sec;
85 ret.tv_nsec = ts64.tv_nsec;
86 return ret;
87}
88
89static inline struct timespec64 timespec_to_timespec64(const struct timespec ts)
90{
91 struct timespec64 ret;
92
93 ret.tv_sec = ts.tv_sec;
94 ret.tv_nsec = ts.tv_nsec;
95 return ret;
96}
97
98static inline struct itimerspec itimerspec64_to_itimerspec(struct itimerspec64 *its64)
99{
100 struct itimerspec ret;
101
102 ret.it_interval = timespec64_to_timespec(its64->it_interval);
103 ret.it_value = timespec64_to_timespec(its64->it_value);
104 return ret;
105}
106
107static inline struct itimerspec64 itimerspec_to_itimerspec64(struct itimerspec *its)
108{
109 struct itimerspec64 ret;
110
111 ret.it_interval = timespec_to_timespec64(its->it_interval);
112 ret.it_value = timespec_to_timespec64(its->it_value);
113 return ret;
114}
115
116static inline int timespec64_equal(const struct timespec64 *a, 42static inline int timespec64_equal(const struct timespec64 *a,
117 const struct timespec64 *b) 43 const struct timespec64 *b)
118{ 44{
@@ -214,8 +140,6 @@ static __always_inline void timespec64_add_ns(struct timespec64 *a, u64 ns)
214 a->tv_nsec = ns; 140 a->tv_nsec = ns;
215} 141}
216 142
217#endif
218
219/* 143/*
220 * timespec64_add_safe assumes both values are positive and checks for 144 * timespec64_add_safe assumes both values are positive and checks for
221 * overflow. It will return TIME64_MAX in case of overflow. 145 * overflow. It will return TIME64_MAX in case of overflow.
diff --git a/include/linux/timekeeper_internal.h b/include/linux/timekeeper_internal.h
index 97154c61e5d2..7e9011101cb0 100644
--- a/include/linux/timekeeper_internal.h
+++ b/include/linux/timekeeper_internal.h
@@ -14,19 +14,22 @@
14/** 14/**
15 * struct tk_read_base - base structure for timekeeping readout 15 * struct tk_read_base - base structure for timekeeping readout
16 * @clock: Current clocksource used for timekeeping. 16 * @clock: Current clocksource used for timekeeping.
17 * @read: Read function of @clock
18 * @mask: Bitmask for two's complement subtraction of non 64bit clocks 17 * @mask: Bitmask for two's complement subtraction of non 64bit clocks
19 * @cycle_last: @clock cycle value at last update 18 * @cycle_last: @clock cycle value at last update
20 * @mult: (NTP adjusted) multiplier for scaled math conversion 19 * @mult: (NTP adjusted) multiplier for scaled math conversion
21 * @shift: Shift value for scaled math conversion 20 * @shift: Shift value for scaled math conversion
22 * @xtime_nsec: Shifted (fractional) nano seconds offset for readout 21 * @xtime_nsec: Shifted (fractional) nano seconds offset for readout
23 * @base: ktime_t (nanoseconds) base time for readout 22 * @base: ktime_t (nanoseconds) base time for readout
23 * @base_real: Nanoseconds base value for clock REALTIME readout
24 * 24 *
25 * This struct has size 56 byte on 64 bit. Together with a seqcount it 25 * This struct has size 56 byte on 64 bit. Together with a seqcount it
26 * occupies a single 64byte cache line. 26 * occupies a single 64byte cache line.
27 * 27 *
28 * The struct is separate from struct timekeeper as it is also used 28 * The struct is separate from struct timekeeper as it is also used
29 * for a fast NMI safe accessors. 29 * for a fast NMI safe accessors.
30 *
31 * @base_real is for the fast NMI safe accessor to allow reading clock
32 * realtime from any context.
30 */ 33 */
31struct tk_read_base { 34struct tk_read_base {
32 struct clocksource *clock; 35 struct clocksource *clock;
@@ -36,6 +39,7 @@ struct tk_read_base {
36 u32 shift; 39 u32 shift;
37 u64 xtime_nsec; 40 u64 xtime_nsec;
38 ktime_t base; 41 ktime_t base;
42 u64 base_real;
39}; 43};
40 44
41/** 45/**
diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h
index 0021575fe871..c198ab40c04f 100644
--- a/include/linux/timekeeping.h
+++ b/include/linux/timekeeping.h
@@ -16,27 +16,16 @@ extern void xtime_update(unsigned long ticks);
16/* 16/*
17 * Get and set timeofday 17 * Get and set timeofday
18 */ 18 */
19extern void do_gettimeofday(struct timeval *tv);
20extern int do_settimeofday64(const struct timespec64 *ts); 19extern int do_settimeofday64(const struct timespec64 *ts);
21extern int do_sys_settimeofday64(const struct timespec64 *tv, 20extern int do_sys_settimeofday64(const struct timespec64 *tv,
22 const struct timezone *tz); 21 const struct timezone *tz);
23/* 22/*
24 * Kernel time accessors 23 * Kernel time accessors
25 */ 24 */
26unsigned long get_seconds(void);
27struct timespec64 current_kernel_time64(void); 25struct timespec64 current_kernel_time64(void);
28/* does not take xtime_lock */
29struct timespec __current_kernel_time(void);
30
31static inline struct timespec current_kernel_time(void)
32{
33 struct timespec64 now = current_kernel_time64();
34
35 return timespec64_to_timespec(now);
36}
37 26
38/* 27/*
39 * timespec based interfaces 28 * timespec64 based interfaces
40 */ 29 */
41struct timespec64 get_monotonic_coarse64(void); 30struct timespec64 get_monotonic_coarse64(void);
42extern void getrawmonotonic64(struct timespec64 *ts); 31extern void getrawmonotonic64(struct timespec64 *ts);
@@ -48,116 +37,6 @@ extern int __getnstimeofday64(struct timespec64 *tv);
48extern void getnstimeofday64(struct timespec64 *tv); 37extern void getnstimeofday64(struct timespec64 *tv);
49extern void getboottime64(struct timespec64 *ts); 38extern void getboottime64(struct timespec64 *ts);
50 39
51#if BITS_PER_LONG == 64
52/**
53 * Deprecated. Use do_settimeofday64().
54 */
55static inline int do_settimeofday(const struct timespec *ts)
56{
57 return do_settimeofday64(ts);
58}
59
60static inline int __getnstimeofday(struct timespec *ts)
61{
62 return __getnstimeofday64(ts);
63}
64
65static inline void getnstimeofday(struct timespec *ts)
66{
67 getnstimeofday64(ts);
68}
69
70static inline void ktime_get_ts(struct timespec *ts)
71{
72 ktime_get_ts64(ts);
73}
74
75static inline void ktime_get_real_ts(struct timespec *ts)
76{
77 getnstimeofday64(ts);
78}
79
80static inline void getrawmonotonic(struct timespec *ts)
81{
82 getrawmonotonic64(ts);
83}
84
85static inline struct timespec get_monotonic_coarse(void)
86{
87 return get_monotonic_coarse64();
88}
89
90static inline void getboottime(struct timespec *ts)
91{
92 return getboottime64(ts);
93}
94#else
95/**
96 * Deprecated. Use do_settimeofday64().
97 */
98static inline int do_settimeofday(const struct timespec *ts)
99{
100 struct timespec64 ts64;
101
102 ts64 = timespec_to_timespec64(*ts);
103 return do_settimeofday64(&ts64);
104}
105
106static inline int __getnstimeofday(struct timespec *ts)
107{
108 struct timespec64 ts64;
109 int ret = __getnstimeofday64(&ts64);
110
111 *ts = timespec64_to_timespec(ts64);
112 return ret;
113}
114
115static inline void getnstimeofday(struct timespec *ts)
116{
117 struct timespec64 ts64;
118
119 getnstimeofday64(&ts64);
120 *ts = timespec64_to_timespec(ts64);
121}
122
123static inline void ktime_get_ts(struct timespec *ts)
124{
125 struct timespec64 ts64;
126
127 ktime_get_ts64(&ts64);
128 *ts = timespec64_to_timespec(ts64);
129}
130
131static inline void ktime_get_real_ts(struct timespec *ts)
132{
133 struct timespec64 ts64;
134
135 getnstimeofday64(&ts64);
136 *ts = timespec64_to_timespec(ts64);
137}
138
139static inline void getrawmonotonic(struct timespec *ts)
140{
141 struct timespec64 ts64;
142
143 getrawmonotonic64(&ts64);
144 *ts = timespec64_to_timespec(ts64);
145}
146
147static inline struct timespec get_monotonic_coarse(void)
148{
149 return timespec64_to_timespec(get_monotonic_coarse64());
150}
151
152static inline void getboottime(struct timespec *ts)
153{
154 struct timespec64 ts64;
155
156 getboottime64(&ts64);
157 *ts = timespec64_to_timespec(ts64);
158}
159#endif
160
161#define ktime_get_real_ts64(ts) getnstimeofday64(ts) 40#define ktime_get_real_ts64(ts) getnstimeofday64(ts)
162 41
163/* 42/*
@@ -240,25 +119,16 @@ static inline u64 ktime_get_raw_ns(void)
240extern u64 ktime_get_mono_fast_ns(void); 119extern u64 ktime_get_mono_fast_ns(void);
241extern u64 ktime_get_raw_fast_ns(void); 120extern u64 ktime_get_raw_fast_ns(void);
242extern u64 ktime_get_boot_fast_ns(void); 121extern u64 ktime_get_boot_fast_ns(void);
122extern u64 ktime_get_real_fast_ns(void);
243 123
244/* 124/*
245 * Timespec interfaces utilizing the ktime based ones 125 * timespec64 interfaces utilizing the ktime based ones
246 */ 126 */
247static inline void get_monotonic_boottime(struct timespec *ts)
248{
249 *ts = ktime_to_timespec(ktime_get_boottime());
250}
251
252static inline void get_monotonic_boottime64(struct timespec64 *ts) 127static inline void get_monotonic_boottime64(struct timespec64 *ts)
253{ 128{
254 *ts = ktime_to_timespec64(ktime_get_boottime()); 129 *ts = ktime_to_timespec64(ktime_get_boottime());
255} 130}
256 131
257static inline void timekeeping_clocktai(struct timespec *ts)
258{
259 *ts = ktime_to_timespec(ktime_get_clocktai());
260}
261
262static inline void timekeeping_clocktai64(struct timespec64 *ts) 132static inline void timekeeping_clocktai64(struct timespec64 *ts)
263{ 133{
264 *ts = ktime_to_timespec64(ktime_get_clocktai()); 134 *ts = ktime_to_timespec64(ktime_get_clocktai());
@@ -341,10 +211,8 @@ extern void ktime_get_snapshot(struct system_time_snapshot *systime_snapshot);
341 */ 211 */
342extern int persistent_clock_is_local; 212extern int persistent_clock_is_local;
343 213
344extern void read_persistent_clock(struct timespec *ts);
345extern void read_persistent_clock64(struct timespec64 *ts); 214extern void read_persistent_clock64(struct timespec64 *ts);
346extern void read_boot_clock64(struct timespec64 *ts); 215extern void read_boot_clock64(struct timespec64 *ts);
347extern int update_persistent_clock(struct timespec now);
348extern int update_persistent_clock64(struct timespec64 now); 216extern int update_persistent_clock64(struct timespec64 now);
349 217
350 218
diff --git a/include/linux/timekeeping32.h b/include/linux/timekeeping32.h
new file mode 100644
index 000000000000..af4114d5dc17
--- /dev/null
+++ b/include/linux/timekeeping32.h
@@ -0,0 +1,151 @@
1#ifndef _LINUX_TIMEKEEPING32_H
2#define _LINUX_TIMEKEEPING32_H
3/*
4 * These interfaces are all based on the old timespec type
5 * and should get replaced with the timespec64 based versions
6 * over time so we can remove the file here.
7 */
8
9extern void do_gettimeofday(struct timeval *tv);
10unsigned long get_seconds(void);
11
12/* does not take xtime_lock */
13struct timespec __current_kernel_time(void);
14
15static inline struct timespec current_kernel_time(void)
16{
17 struct timespec64 now = current_kernel_time64();
18
19 return timespec64_to_timespec(now);
20}
21
22#if BITS_PER_LONG == 64
23/**
24 * Deprecated. Use do_settimeofday64().
25 */
26static inline int do_settimeofday(const struct timespec *ts)
27{
28 return do_settimeofday64(ts);
29}
30
31static inline int __getnstimeofday(struct timespec *ts)
32{
33 return __getnstimeofday64(ts);
34}
35
36static inline void getnstimeofday(struct timespec *ts)
37{
38 getnstimeofday64(ts);
39}
40
41static inline void ktime_get_ts(struct timespec *ts)
42{
43 ktime_get_ts64(ts);
44}
45
46static inline void ktime_get_real_ts(struct timespec *ts)
47{
48 getnstimeofday64(ts);
49}
50
51static inline void getrawmonotonic(struct timespec *ts)
52{
53 getrawmonotonic64(ts);
54}
55
56static inline struct timespec get_monotonic_coarse(void)
57{
58 return get_monotonic_coarse64();
59}
60
61static inline void getboottime(struct timespec *ts)
62{
63 return getboottime64(ts);
64}
65#else
66/**
67 * Deprecated. Use do_settimeofday64().
68 */
69static inline int do_settimeofday(const struct timespec *ts)
70{
71 struct timespec64 ts64;
72
73 ts64 = timespec_to_timespec64(*ts);
74 return do_settimeofday64(&ts64);
75}
76
77static inline int __getnstimeofday(struct timespec *ts)
78{
79 struct timespec64 ts64;
80 int ret = __getnstimeofday64(&ts64);
81
82 *ts = timespec64_to_timespec(ts64);
83 return ret;
84}
85
86static inline void getnstimeofday(struct timespec *ts)
87{
88 struct timespec64 ts64;
89
90 getnstimeofday64(&ts64);
91 *ts = timespec64_to_timespec(ts64);
92}
93
94static inline void ktime_get_ts(struct timespec *ts)
95{
96 struct timespec64 ts64;
97
98 ktime_get_ts64(&ts64);
99 *ts = timespec64_to_timespec(ts64);
100}
101
102static inline void ktime_get_real_ts(struct timespec *ts)
103{
104 struct timespec64 ts64;
105
106 getnstimeofday64(&ts64);
107 *ts = timespec64_to_timespec(ts64);
108}
109
110static inline void getrawmonotonic(struct timespec *ts)
111{
112 struct timespec64 ts64;
113
114 getrawmonotonic64(&ts64);
115 *ts = timespec64_to_timespec(ts64);
116}
117
118static inline struct timespec get_monotonic_coarse(void)
119{
120 return timespec64_to_timespec(get_monotonic_coarse64());
121}
122
123static inline void getboottime(struct timespec *ts)
124{
125 struct timespec64 ts64;
126
127 getboottime64(&ts64);
128 *ts = timespec64_to_timespec(ts64);
129}
130#endif
131
132/*
133 * Timespec interfaces utilizing the ktime based ones
134 */
135static inline void get_monotonic_boottime(struct timespec *ts)
136{
137 *ts = ktime_to_timespec(ktime_get_boottime());
138}
139
140static inline void timekeeping_clocktai(struct timespec *ts)
141{
142 *ts = ktime_to_timespec(ktime_get_clocktai());
143}
144
145/*
146 * Persistent clock related interfaces
147 */
148extern void read_persistent_clock(struct timespec *ts);
149extern int update_persistent_clock(struct timespec now);
150
151#endif
diff --git a/include/linux/timer.h b/include/linux/timer.h
index ac66f29c6916..bf781acfc6d8 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -64,31 +64,21 @@ struct timer_list {
64 64
65#define TIMER_TRACE_FLAGMASK (TIMER_MIGRATING | TIMER_DEFERRABLE | TIMER_PINNED | TIMER_IRQSAFE) 65#define TIMER_TRACE_FLAGMASK (TIMER_MIGRATING | TIMER_DEFERRABLE | TIMER_PINNED | TIMER_IRQSAFE)
66 66
67#define __TIMER_INITIALIZER(_function, _expires, _data, _flags) { \ 67#define TIMER_DATA_TYPE unsigned long
68#define TIMER_FUNC_TYPE void (*)(TIMER_DATA_TYPE)
69
70#define __TIMER_INITIALIZER(_function, _data, _flags) { \
68 .entry = { .next = TIMER_ENTRY_STATIC }, \ 71 .entry = { .next = TIMER_ENTRY_STATIC }, \
69 .function = (_function), \ 72 .function = (_function), \
70 .expires = (_expires), \
71 .data = (_data), \ 73 .data = (_data), \
72 .flags = (_flags), \ 74 .flags = (_flags), \
73 __TIMER_LOCKDEP_MAP_INITIALIZER( \ 75 __TIMER_LOCKDEP_MAP_INITIALIZER( \
74 __FILE__ ":" __stringify(__LINE__)) \ 76 __FILE__ ":" __stringify(__LINE__)) \
75 } 77 }
76 78
77#define TIMER_INITIALIZER(_function, _expires, _data) \ 79#define DEFINE_TIMER(_name, _function) \
78 __TIMER_INITIALIZER((_function), (_expires), (_data), 0)
79
80#define TIMER_PINNED_INITIALIZER(_function, _expires, _data) \
81 __TIMER_INITIALIZER((_function), (_expires), (_data), TIMER_PINNED)
82
83#define TIMER_DEFERRED_INITIALIZER(_function, _expires, _data) \
84 __TIMER_INITIALIZER((_function), (_expires), (_data), TIMER_DEFERRABLE)
85
86#define TIMER_PINNED_DEFERRED_INITIALIZER(_function, _expires, _data) \
87 __TIMER_INITIALIZER((_function), (_expires), (_data), TIMER_DEFERRABLE | TIMER_PINNED)
88
89#define DEFINE_TIMER(_name, _function, _expires, _data) \
90 struct timer_list _name = \ 80 struct timer_list _name = \
91 TIMER_INITIALIZER(_function, _expires, _data) 81 __TIMER_INITIALIZER((TIMER_FUNC_TYPE)_function, 0, 0)
92 82
93void init_timer_key(struct timer_list *timer, unsigned int flags, 83void init_timer_key(struct timer_list *timer, unsigned int flags,
94 const char *name, struct lock_class_key *key); 84 const char *name, struct lock_class_key *key);
@@ -129,14 +119,6 @@ static inline void init_timer_on_stack_key(struct timer_list *timer,
129 119
130#define init_timer(timer) \ 120#define init_timer(timer) \
131 __init_timer((timer), 0) 121 __init_timer((timer), 0)
132#define init_timer_pinned(timer) \
133 __init_timer((timer), TIMER_PINNED)
134#define init_timer_deferrable(timer) \
135 __init_timer((timer), TIMER_DEFERRABLE)
136#define init_timer_pinned_deferrable(timer) \
137 __init_timer((timer), TIMER_DEFERRABLE | TIMER_PINNED)
138#define init_timer_on_stack(timer) \
139 __init_timer_on_stack((timer), 0)
140 122
141#define __setup_timer(_timer, _fn, _data, _flags) \ 123#define __setup_timer(_timer, _fn, _data, _flags) \
142 do { \ 124 do { \
@@ -169,9 +151,7 @@ static inline void init_timer_on_stack_key(struct timer_list *timer,
169#define setup_pinned_deferrable_timer_on_stack(timer, fn, data) \ 151#define setup_pinned_deferrable_timer_on_stack(timer, fn, data) \
170 __setup_timer_on_stack((timer), (fn), (data), TIMER_DEFERRABLE | TIMER_PINNED) 152 __setup_timer_on_stack((timer), (fn), (data), TIMER_DEFERRABLE | TIMER_PINNED)
171 153
172#define TIMER_DATA_TYPE unsigned long 154#ifndef CONFIG_LOCKDEP
173#define TIMER_FUNC_TYPE void (*)(TIMER_DATA_TYPE)
174
175static inline void timer_setup(struct timer_list *timer, 155static inline void timer_setup(struct timer_list *timer,
176 void (*callback)(struct timer_list *), 156 void (*callback)(struct timer_list *),
177 unsigned int flags) 157 unsigned int flags)
@@ -180,6 +160,28 @@ static inline void timer_setup(struct timer_list *timer,
180 (TIMER_DATA_TYPE)timer, flags); 160 (TIMER_DATA_TYPE)timer, flags);
181} 161}
182 162
163static inline void timer_setup_on_stack(struct timer_list *timer,
164 void (*callback)(struct timer_list *),
165 unsigned int flags)
166{
167 __setup_timer_on_stack(timer, (TIMER_FUNC_TYPE)callback,
168 (TIMER_DATA_TYPE)timer, flags);
169}
170#else
171/*
172 * Under LOCKDEP, the timer lock_class_key (set up in __init_timer) needs
173 * to be tied to the caller's context, so an inline (above) won't work. We
174 * do want to keep the inline for argument type checking, though.
175 */
176# define timer_setup(timer, callback, flags) \
177 __setup_timer((timer), (TIMER_FUNC_TYPE)(callback), \
178 (TIMER_DATA_TYPE)(timer), (flags))
179# define timer_setup_on_stack(timer, callback, flags) \
180 __setup_timer_on_stack((timer), \
181 (TIMER_FUNC_TYPE)(callback), \
182 (TIMER_DATA_TYPE)(timer), (flags))
183#endif
184
183#define from_timer(var, callback_timer, timer_fieldname) \ 185#define from_timer(var, callback_timer, timer_fieldname) \
184 container_of(callback_timer, typeof(*var), timer_fieldname) 186 container_of(callback_timer, typeof(*var), timer_fieldname)
185 187
@@ -202,6 +204,7 @@ extern void add_timer_on(struct timer_list *timer, int cpu);
202extern int del_timer(struct timer_list * timer); 204extern int del_timer(struct timer_list * timer);
203extern int mod_timer(struct timer_list *timer, unsigned long expires); 205extern int mod_timer(struct timer_list *timer, unsigned long expires);
204extern int mod_timer_pending(struct timer_list *timer, unsigned long expires); 206extern int mod_timer_pending(struct timer_list *timer, unsigned long expires);
207extern int timer_reduce(struct timer_list *timer, unsigned long expires);
205 208
206/* 209/*
207 * The jiffies value which is added to now, when there is no timer 210 * The jiffies value which is added to now, when there is no timer
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 0eae11fc7a23..01a050fc6650 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -18,7 +18,7 @@ struct workqueue_struct;
18 18
19struct work_struct; 19struct work_struct;
20typedef void (*work_func_t)(struct work_struct *work); 20typedef void (*work_func_t)(struct work_struct *work);
21void delayed_work_timer_fn(unsigned long __data); 21void delayed_work_timer_fn(struct timer_list *t);
22 22
23/* 23/*
24 * The first word is the work queue pointer and the flags rolled into 24 * The first word is the work queue pointer and the flags rolled into
@@ -176,8 +176,8 @@ struct execute_work {
176 176
177#define __DELAYED_WORK_INITIALIZER(n, f, tflags) { \ 177#define __DELAYED_WORK_INITIALIZER(n, f, tflags) { \
178 .work = __WORK_INITIALIZER((n).work, (f)), \ 178 .work = __WORK_INITIALIZER((n).work, (f)), \
179 .timer = __TIMER_INITIALIZER(delayed_work_timer_fn, \ 179 .timer = __TIMER_INITIALIZER((TIMER_FUNC_TYPE)delayed_work_timer_fn,\
180 0, (unsigned long)&(n), \ 180 (TIMER_DATA_TYPE)&(n.timer), \
181 (tflags) | TIMER_IRQSAFE), \ 181 (tflags) | TIMER_IRQSAFE), \
182 } 182 }
183 183
@@ -219,7 +219,7 @@ static inline unsigned int work_static(struct work_struct *work) { return 0; }
219 \ 219 \
220 __init_work((_work), _onstack); \ 220 __init_work((_work), _onstack); \
221 (_work)->data = (atomic_long_t) WORK_DATA_INIT(); \ 221 (_work)->data = (atomic_long_t) WORK_DATA_INIT(); \
222 lockdep_init_map(&(_work)->lockdep_map, #_work, &__key, 0); \ 222 lockdep_init_map(&(_work)->lockdep_map, "(work_completion)"#_work, &__key, 0); \
223 INIT_LIST_HEAD(&(_work)->entry); \ 223 INIT_LIST_HEAD(&(_work)->entry); \
224 (_work)->func = (_func); \ 224 (_work)->func = (_func); \
225 } while (0) 225 } while (0)
@@ -242,8 +242,9 @@ static inline unsigned int work_static(struct work_struct *work) { return 0; }
242#define __INIT_DELAYED_WORK(_work, _func, _tflags) \ 242#define __INIT_DELAYED_WORK(_work, _func, _tflags) \
243 do { \ 243 do { \
244 INIT_WORK(&(_work)->work, (_func)); \ 244 INIT_WORK(&(_work)->work, (_func)); \
245 __setup_timer(&(_work)->timer, delayed_work_timer_fn, \ 245 __setup_timer(&(_work)->timer, \
246 (unsigned long)(_work), \ 246 (TIMER_FUNC_TYPE)delayed_work_timer_fn, \
247 (TIMER_DATA_TYPE)&(_work)->timer, \
247 (_tflags) | TIMER_IRQSAFE); \ 248 (_tflags) | TIMER_IRQSAFE); \
248 } while (0) 249 } while (0)
249 250
@@ -251,8 +252,8 @@ static inline unsigned int work_static(struct work_struct *work) { return 0; }
251 do { \ 252 do { \
252 INIT_WORK_ONSTACK(&(_work)->work, (_func)); \ 253 INIT_WORK_ONSTACK(&(_work)->work, (_func)); \
253 __setup_timer_on_stack(&(_work)->timer, \ 254 __setup_timer_on_stack(&(_work)->timer, \
254 delayed_work_timer_fn, \ 255 (TIMER_FUNC_TYPE)delayed_work_timer_fn,\
255 (unsigned long)(_work), \ 256 (TIMER_DATA_TYPE)&(_work)->timer,\
256 (_tflags) | TIMER_IRQSAFE); \ 257 (_tflags) | TIMER_IRQSAFE); \
257 } while (0) 258 } while (0)
258 259
@@ -399,7 +400,7 @@ __alloc_workqueue_key(const char *fmt, unsigned int flags, int max_active,
399 static struct lock_class_key __key; \ 400 static struct lock_class_key __key; \
400 const char *__lock_name; \ 401 const char *__lock_name; \
401 \ 402 \
402 __lock_name = #fmt#args; \ 403 __lock_name = "(wq_completion)"#fmt#args; \
403 \ 404 \
404 __alloc_workqueue_key((fmt), (flags), (max_active), \ 405 __alloc_workqueue_key((fmt), (flags), (max_active), \
405 &__key, __lock_name, ##args); \ 406 &__key, __lock_name, ##args); \