diff options
author | Tejun Heo <tj@kernel.org> | 2014-02-10 19:34:30 -0500 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2014-02-10 19:34:30 -0500 |
commit | a8fa94e0f2ab665f9aa665195618178b61ed8304 (patch) | |
tree | 4060502fffd7f56d379372d517f8dcc31bf63955 /arch | |
parent | 9561a8961c708ff6ba3e71a817af0f16bdc1d885 (diff) | |
parent | b28a960c42fcd9cfc987441fa6d1c1a471f0f9ed (diff) |
Merge branch 'master' into driver-core-next-test-merge-rc2
da9846ae1518 ("kernfs: make kernfs_deactivate() honor KERNFS_LOCKDEP
flag") in driver-core-linus conflicts with kernfs_drain() updates in
driver-core-next. The former just adds the missing KERNFS_LOCKDEP
checks which are already handled by kernfs_lockdep() checks in
driver-core-next. The conflict can be resolved by taking code from
driver-core-next.
Conflicts:
fs/kernfs/dir.c
Diffstat (limited to 'arch')
51 files changed, 404 insertions, 240 deletions
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index dd4327f09ba4..27bbcfc7202a 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig | |||
@@ -36,6 +36,7 @@ config ARM64 | |||
36 | select HAVE_GENERIC_DMA_COHERENT | 36 | select HAVE_GENERIC_DMA_COHERENT |
37 | select HAVE_HW_BREAKPOINT if PERF_EVENTS | 37 | select HAVE_HW_BREAKPOINT if PERF_EVENTS |
38 | select HAVE_MEMBLOCK | 38 | select HAVE_MEMBLOCK |
39 | select HAVE_PATA_PLATFORM | ||
39 | select HAVE_PERF_EVENTS | 40 | select HAVE_PERF_EVENTS |
40 | select IRQ_DOMAIN | 41 | select IRQ_DOMAIN |
41 | select MODULES_USE_ELF_RELA | 42 | select MODULES_USE_ELF_RELA |
diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig index 84139be62ae6..7959dd0ca5d5 100644 --- a/arch/arm64/configs/defconfig +++ b/arch/arm64/configs/defconfig | |||
@@ -1,4 +1,3 @@ | |||
1 | CONFIG_EXPERIMENTAL=y | ||
2 | # CONFIG_LOCALVERSION_AUTO is not set | 1 | # CONFIG_LOCALVERSION_AUTO is not set |
3 | # CONFIG_SWAP is not set | 2 | # CONFIG_SWAP is not set |
4 | CONFIG_SYSVIPC=y | 3 | CONFIG_SYSVIPC=y |
@@ -19,6 +18,7 @@ CONFIG_BLK_DEV_INITRD=y | |||
19 | CONFIG_KALLSYMS_ALL=y | 18 | CONFIG_KALLSYMS_ALL=y |
20 | # CONFIG_COMPAT_BRK is not set | 19 | # CONFIG_COMPAT_BRK is not set |
21 | CONFIG_PROFILING=y | 20 | CONFIG_PROFILING=y |
21 | CONFIG_JUMP_LABEL=y | ||
22 | CONFIG_MODULES=y | 22 | CONFIG_MODULES=y |
23 | CONFIG_MODULE_UNLOAD=y | 23 | CONFIG_MODULE_UNLOAD=y |
24 | # CONFIG_BLK_DEV_BSG is not set | 24 | # CONFIG_BLK_DEV_BSG is not set |
@@ -27,6 +27,7 @@ CONFIG_ARCH_VEXPRESS=y | |||
27 | CONFIG_ARCH_XGENE=y | 27 | CONFIG_ARCH_XGENE=y |
28 | CONFIG_SMP=y | 28 | CONFIG_SMP=y |
29 | CONFIG_PREEMPT=y | 29 | CONFIG_PREEMPT=y |
30 | CONFIG_CMA=y | ||
30 | CONFIG_CMDLINE="console=ttyAMA0" | 31 | CONFIG_CMDLINE="console=ttyAMA0" |
31 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set | 32 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set |
32 | CONFIG_COMPAT=y | 33 | CONFIG_COMPAT=y |
@@ -42,14 +43,17 @@ CONFIG_IP_PNP_BOOTP=y | |||
42 | # CONFIG_WIRELESS is not set | 43 | # CONFIG_WIRELESS is not set |
43 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | 44 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" |
44 | CONFIG_DEVTMPFS=y | 45 | CONFIG_DEVTMPFS=y |
45 | CONFIG_BLK_DEV=y | 46 | CONFIG_DMA_CMA=y |
46 | CONFIG_SCSI=y | 47 | CONFIG_SCSI=y |
47 | # CONFIG_SCSI_PROC_FS is not set | 48 | # CONFIG_SCSI_PROC_FS is not set |
48 | CONFIG_BLK_DEV_SD=y | 49 | CONFIG_BLK_DEV_SD=y |
49 | # CONFIG_SCSI_LOWLEVEL is not set | 50 | # CONFIG_SCSI_LOWLEVEL is not set |
51 | CONFIG_ATA=y | ||
52 | CONFIG_PATA_PLATFORM=y | ||
53 | CONFIG_PATA_OF_PLATFORM=y | ||
50 | CONFIG_NETDEVICES=y | 54 | CONFIG_NETDEVICES=y |
51 | CONFIG_MII=y | ||
52 | CONFIG_SMC91X=y | 55 | CONFIG_SMC91X=y |
56 | CONFIG_SMSC911X=y | ||
53 | # CONFIG_WLAN is not set | 57 | # CONFIG_WLAN is not set |
54 | CONFIG_INPUT_EVDEV=y | 58 | CONFIG_INPUT_EVDEV=y |
55 | # CONFIG_SERIO_I8042 is not set | 59 | # CONFIG_SERIO_I8042 is not set |
@@ -62,13 +66,19 @@ CONFIG_SERIAL_AMBA_PL011=y | |||
62 | CONFIG_SERIAL_AMBA_PL011_CONSOLE=y | 66 | CONFIG_SERIAL_AMBA_PL011_CONSOLE=y |
63 | # CONFIG_HW_RANDOM is not set | 67 | # CONFIG_HW_RANDOM is not set |
64 | # CONFIG_HWMON is not set | 68 | # CONFIG_HWMON is not set |
69 | CONFIG_REGULATOR=y | ||
70 | CONFIG_REGULATOR_FIXED_VOLTAGE=y | ||
65 | CONFIG_FB=y | 71 | CONFIG_FB=y |
66 | # CONFIG_VGA_CONSOLE is not set | 72 | # CONFIG_VGA_CONSOLE is not set |
67 | CONFIG_FRAMEBUFFER_CONSOLE=y | 73 | CONFIG_FRAMEBUFFER_CONSOLE=y |
68 | CONFIG_LOGO=y | 74 | CONFIG_LOGO=y |
69 | # CONFIG_LOGO_LINUX_MONO is not set | 75 | # CONFIG_LOGO_LINUX_MONO is not set |
70 | # CONFIG_LOGO_LINUX_VGA16 is not set | 76 | # CONFIG_LOGO_LINUX_VGA16 is not set |
71 | # CONFIG_USB_SUPPORT is not set | 77 | CONFIG_USB=y |
78 | CONFIG_USB_ISP1760_HCD=y | ||
79 | CONFIG_USB_STORAGE=y | ||
80 | CONFIG_MMC=y | ||
81 | CONFIG_MMC_ARMMMCI=y | ||
72 | # CONFIG_IOMMU_SUPPORT is not set | 82 | # CONFIG_IOMMU_SUPPORT is not set |
73 | CONFIG_EXT2_FS=y | 83 | CONFIG_EXT2_FS=y |
74 | CONFIG_EXT3_FS=y | 84 | CONFIG_EXT3_FS=y |
diff --git a/arch/arm64/include/asm/atomic.h b/arch/arm64/include/asm/atomic.h index 01de5aaa3edc..0237f0867e37 100644 --- a/arch/arm64/include/asm/atomic.h +++ b/arch/arm64/include/asm/atomic.h | |||
@@ -54,8 +54,7 @@ static inline void atomic_add(int i, atomic_t *v) | |||
54 | " stxr %w1, %w0, %2\n" | 54 | " stxr %w1, %w0, %2\n" |
55 | " cbnz %w1, 1b" | 55 | " cbnz %w1, 1b" |
56 | : "=&r" (result), "=&r" (tmp), "+Q" (v->counter) | 56 | : "=&r" (result), "=&r" (tmp), "+Q" (v->counter) |
57 | : "Ir" (i) | 57 | : "Ir" (i)); |
58 | : "cc"); | ||
59 | } | 58 | } |
60 | 59 | ||
61 | static inline int atomic_add_return(int i, atomic_t *v) | 60 | static inline int atomic_add_return(int i, atomic_t *v) |
@@ -64,14 +63,15 @@ static inline int atomic_add_return(int i, atomic_t *v) | |||
64 | int result; | 63 | int result; |
65 | 64 | ||
66 | asm volatile("// atomic_add_return\n" | 65 | asm volatile("// atomic_add_return\n" |
67 | "1: ldaxr %w0, %2\n" | 66 | "1: ldxr %w0, %2\n" |
68 | " add %w0, %w0, %w3\n" | 67 | " add %w0, %w0, %w3\n" |
69 | " stlxr %w1, %w0, %2\n" | 68 | " stlxr %w1, %w0, %2\n" |
70 | " cbnz %w1, 1b" | 69 | " cbnz %w1, 1b" |
71 | : "=&r" (result), "=&r" (tmp), "+Q" (v->counter) | 70 | : "=&r" (result), "=&r" (tmp), "+Q" (v->counter) |
72 | : "Ir" (i) | 71 | : "Ir" (i) |
73 | : "cc", "memory"); | 72 | : "memory"); |
74 | 73 | ||
74 | smp_mb(); | ||
75 | return result; | 75 | return result; |
76 | } | 76 | } |
77 | 77 | ||
@@ -86,8 +86,7 @@ static inline void atomic_sub(int i, atomic_t *v) | |||
86 | " stxr %w1, %w0, %2\n" | 86 | " stxr %w1, %w0, %2\n" |
87 | " cbnz %w1, 1b" | 87 | " cbnz %w1, 1b" |
88 | : "=&r" (result), "=&r" (tmp), "+Q" (v->counter) | 88 | : "=&r" (result), "=&r" (tmp), "+Q" (v->counter) |
89 | : "Ir" (i) | 89 | : "Ir" (i)); |
90 | : "cc"); | ||
91 | } | 90 | } |
92 | 91 | ||
93 | static inline int atomic_sub_return(int i, atomic_t *v) | 92 | static inline int atomic_sub_return(int i, atomic_t *v) |
@@ -96,14 +95,15 @@ static inline int atomic_sub_return(int i, atomic_t *v) | |||
96 | int result; | 95 | int result; |
97 | 96 | ||
98 | asm volatile("// atomic_sub_return\n" | 97 | asm volatile("// atomic_sub_return\n" |
99 | "1: ldaxr %w0, %2\n" | 98 | "1: ldxr %w0, %2\n" |
100 | " sub %w0, %w0, %w3\n" | 99 | " sub %w0, %w0, %w3\n" |
101 | " stlxr %w1, %w0, %2\n" | 100 | " stlxr %w1, %w0, %2\n" |
102 | " cbnz %w1, 1b" | 101 | " cbnz %w1, 1b" |
103 | : "=&r" (result), "=&r" (tmp), "+Q" (v->counter) | 102 | : "=&r" (result), "=&r" (tmp), "+Q" (v->counter) |
104 | : "Ir" (i) | 103 | : "Ir" (i) |
105 | : "cc", "memory"); | 104 | : "memory"); |
106 | 105 | ||
106 | smp_mb(); | ||
107 | return result; | 107 | return result; |
108 | } | 108 | } |
109 | 109 | ||
@@ -112,17 +112,20 @@ static inline int atomic_cmpxchg(atomic_t *ptr, int old, int new) | |||
112 | unsigned long tmp; | 112 | unsigned long tmp; |
113 | int oldval; | 113 | int oldval; |
114 | 114 | ||
115 | smp_mb(); | ||
116 | |||
115 | asm volatile("// atomic_cmpxchg\n" | 117 | asm volatile("// atomic_cmpxchg\n" |
116 | "1: ldaxr %w1, %2\n" | 118 | "1: ldxr %w1, %2\n" |
117 | " cmp %w1, %w3\n" | 119 | " cmp %w1, %w3\n" |
118 | " b.ne 2f\n" | 120 | " b.ne 2f\n" |
119 | " stlxr %w0, %w4, %2\n" | 121 | " stxr %w0, %w4, %2\n" |
120 | " cbnz %w0, 1b\n" | 122 | " cbnz %w0, 1b\n" |
121 | "2:" | 123 | "2:" |
122 | : "=&r" (tmp), "=&r" (oldval), "+Q" (ptr->counter) | 124 | : "=&r" (tmp), "=&r" (oldval), "+Q" (ptr->counter) |
123 | : "Ir" (old), "r" (new) | 125 | : "Ir" (old), "r" (new) |
124 | : "cc", "memory"); | 126 | : "cc"); |
125 | 127 | ||
128 | smp_mb(); | ||
126 | return oldval; | 129 | return oldval; |
127 | } | 130 | } |
128 | 131 | ||
@@ -173,8 +176,7 @@ static inline void atomic64_add(u64 i, atomic64_t *v) | |||
173 | " stxr %w1, %0, %2\n" | 176 | " stxr %w1, %0, %2\n" |
174 | " cbnz %w1, 1b" | 177 | " cbnz %w1, 1b" |
175 | : "=&r" (result), "=&r" (tmp), "+Q" (v->counter) | 178 | : "=&r" (result), "=&r" (tmp), "+Q" (v->counter) |
176 | : "Ir" (i) | 179 | : "Ir" (i)); |
177 | : "cc"); | ||
178 | } | 180 | } |
179 | 181 | ||
180 | static inline long atomic64_add_return(long i, atomic64_t *v) | 182 | static inline long atomic64_add_return(long i, atomic64_t *v) |
@@ -183,14 +185,15 @@ static inline long atomic64_add_return(long i, atomic64_t *v) | |||
183 | unsigned long tmp; | 185 | unsigned long tmp; |
184 | 186 | ||
185 | asm volatile("// atomic64_add_return\n" | 187 | asm volatile("// atomic64_add_return\n" |
186 | "1: ldaxr %0, %2\n" | 188 | "1: ldxr %0, %2\n" |
187 | " add %0, %0, %3\n" | 189 | " add %0, %0, %3\n" |
188 | " stlxr %w1, %0, %2\n" | 190 | " stlxr %w1, %0, %2\n" |
189 | " cbnz %w1, 1b" | 191 | " cbnz %w1, 1b" |
190 | : "=&r" (result), "=&r" (tmp), "+Q" (v->counter) | 192 | : "=&r" (result), "=&r" (tmp), "+Q" (v->counter) |
191 | : "Ir" (i) | 193 | : "Ir" (i) |
192 | : "cc", "memory"); | 194 | : "memory"); |
193 | 195 | ||
196 | smp_mb(); | ||
194 | return result; | 197 | return result; |
195 | } | 198 | } |
196 | 199 | ||
@@ -205,8 +208,7 @@ static inline void atomic64_sub(u64 i, atomic64_t *v) | |||
205 | " stxr %w1, %0, %2\n" | 208 | " stxr %w1, %0, %2\n" |
206 | " cbnz %w1, 1b" | 209 | " cbnz %w1, 1b" |
207 | : "=&r" (result), "=&r" (tmp), "+Q" (v->counter) | 210 | : "=&r" (result), "=&r" (tmp), "+Q" (v->counter) |
208 | : "Ir" (i) | 211 | : "Ir" (i)); |
209 | : "cc"); | ||
210 | } | 212 | } |
211 | 213 | ||
212 | static inline long atomic64_sub_return(long i, atomic64_t *v) | 214 | static inline long atomic64_sub_return(long i, atomic64_t *v) |
@@ -215,14 +217,15 @@ static inline long atomic64_sub_return(long i, atomic64_t *v) | |||
215 | unsigned long tmp; | 217 | unsigned long tmp; |
216 | 218 | ||
217 | asm volatile("// atomic64_sub_return\n" | 219 | asm volatile("// atomic64_sub_return\n" |
218 | "1: ldaxr %0, %2\n" | 220 | "1: ldxr %0, %2\n" |
219 | " sub %0, %0, %3\n" | 221 | " sub %0, %0, %3\n" |
220 | " stlxr %w1, %0, %2\n" | 222 | " stlxr %w1, %0, %2\n" |
221 | " cbnz %w1, 1b" | 223 | " cbnz %w1, 1b" |
222 | : "=&r" (result), "=&r" (tmp), "+Q" (v->counter) | 224 | : "=&r" (result), "=&r" (tmp), "+Q" (v->counter) |
223 | : "Ir" (i) | 225 | : "Ir" (i) |
224 | : "cc", "memory"); | 226 | : "memory"); |
225 | 227 | ||
228 | smp_mb(); | ||
226 | return result; | 229 | return result; |
227 | } | 230 | } |
228 | 231 | ||
@@ -231,17 +234,20 @@ static inline long atomic64_cmpxchg(atomic64_t *ptr, long old, long new) | |||
231 | long oldval; | 234 | long oldval; |
232 | unsigned long res; | 235 | unsigned long res; |
233 | 236 | ||
237 | smp_mb(); | ||
238 | |||
234 | asm volatile("// atomic64_cmpxchg\n" | 239 | asm volatile("// atomic64_cmpxchg\n" |
235 | "1: ldaxr %1, %2\n" | 240 | "1: ldxr %1, %2\n" |
236 | " cmp %1, %3\n" | 241 | " cmp %1, %3\n" |
237 | " b.ne 2f\n" | 242 | " b.ne 2f\n" |
238 | " stlxr %w0, %4, %2\n" | 243 | " stxr %w0, %4, %2\n" |
239 | " cbnz %w0, 1b\n" | 244 | " cbnz %w0, 1b\n" |
240 | "2:" | 245 | "2:" |
241 | : "=&r" (res), "=&r" (oldval), "+Q" (ptr->counter) | 246 | : "=&r" (res), "=&r" (oldval), "+Q" (ptr->counter) |
242 | : "Ir" (old), "r" (new) | 247 | : "Ir" (old), "r" (new) |
243 | : "cc", "memory"); | 248 | : "cc"); |
244 | 249 | ||
250 | smp_mb(); | ||
245 | return oldval; | 251 | return oldval; |
246 | } | 252 | } |
247 | 253 | ||
@@ -253,11 +259,12 @@ static inline long atomic64_dec_if_positive(atomic64_t *v) | |||
253 | unsigned long tmp; | 259 | unsigned long tmp; |
254 | 260 | ||
255 | asm volatile("// atomic64_dec_if_positive\n" | 261 | asm volatile("// atomic64_dec_if_positive\n" |
256 | "1: ldaxr %0, %2\n" | 262 | "1: ldxr %0, %2\n" |
257 | " subs %0, %0, #1\n" | 263 | " subs %0, %0, #1\n" |
258 | " b.mi 2f\n" | 264 | " b.mi 2f\n" |
259 | " stlxr %w1, %0, %2\n" | 265 | " stlxr %w1, %0, %2\n" |
260 | " cbnz %w1, 1b\n" | 266 | " cbnz %w1, 1b\n" |
267 | " dmb ish\n" | ||
261 | "2:" | 268 | "2:" |
262 | : "=&r" (result), "=&r" (tmp), "+Q" (v->counter) | 269 | : "=&r" (result), "=&r" (tmp), "+Q" (v->counter) |
263 | : | 270 | : |
diff --git a/arch/arm64/include/asm/barrier.h b/arch/arm64/include/asm/barrier.h index 78e20ba8806b..409ca370cfe2 100644 --- a/arch/arm64/include/asm/barrier.h +++ b/arch/arm64/include/asm/barrier.h | |||
@@ -25,7 +25,7 @@ | |||
25 | #define wfi() asm volatile("wfi" : : : "memory") | 25 | #define wfi() asm volatile("wfi" : : : "memory") |
26 | 26 | ||
27 | #define isb() asm volatile("isb" : : : "memory") | 27 | #define isb() asm volatile("isb" : : : "memory") |
28 | #define dsb() asm volatile("dsb sy" : : : "memory") | 28 | #define dsb(opt) asm volatile("dsb sy" : : : "memory") |
29 | 29 | ||
30 | #define mb() dsb() | 30 | #define mb() dsb() |
31 | #define rmb() asm volatile("dsb ld" : : : "memory") | 31 | #define rmb() asm volatile("dsb ld" : : : "memory") |
diff --git a/arch/arm64/include/asm/cacheflush.h b/arch/arm64/include/asm/cacheflush.h index fea9ee327206..889324981aa4 100644 --- a/arch/arm64/include/asm/cacheflush.h +++ b/arch/arm64/include/asm/cacheflush.h | |||
@@ -116,6 +116,7 @@ extern void flush_dcache_page(struct page *); | |||
116 | static inline void __flush_icache_all(void) | 116 | static inline void __flush_icache_all(void) |
117 | { | 117 | { |
118 | asm("ic ialluis"); | 118 | asm("ic ialluis"); |
119 | dsb(); | ||
119 | } | 120 | } |
120 | 121 | ||
121 | #define flush_dcache_mmap_lock(mapping) \ | 122 | #define flush_dcache_mmap_lock(mapping) \ |
diff --git a/arch/arm64/include/asm/cmpxchg.h b/arch/arm64/include/asm/cmpxchg.h index 56166d7f4a25..57c0fa7bf711 100644 --- a/arch/arm64/include/asm/cmpxchg.h +++ b/arch/arm64/include/asm/cmpxchg.h | |||
@@ -29,44 +29,45 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr, int size | |||
29 | switch (size) { | 29 | switch (size) { |
30 | case 1: | 30 | case 1: |
31 | asm volatile("// __xchg1\n" | 31 | asm volatile("// __xchg1\n" |
32 | "1: ldaxrb %w0, %2\n" | 32 | "1: ldxrb %w0, %2\n" |
33 | " stlxrb %w1, %w3, %2\n" | 33 | " stlxrb %w1, %w3, %2\n" |
34 | " cbnz %w1, 1b\n" | 34 | " cbnz %w1, 1b\n" |
35 | : "=&r" (ret), "=&r" (tmp), "+Q" (*(u8 *)ptr) | 35 | : "=&r" (ret), "=&r" (tmp), "+Q" (*(u8 *)ptr) |
36 | : "r" (x) | 36 | : "r" (x) |
37 | : "cc", "memory"); | 37 | : "memory"); |
38 | break; | 38 | break; |
39 | case 2: | 39 | case 2: |
40 | asm volatile("// __xchg2\n" | 40 | asm volatile("// __xchg2\n" |
41 | "1: ldaxrh %w0, %2\n" | 41 | "1: ldxrh %w0, %2\n" |
42 | " stlxrh %w1, %w3, %2\n" | 42 | " stlxrh %w1, %w3, %2\n" |
43 | " cbnz %w1, 1b\n" | 43 | " cbnz %w1, 1b\n" |
44 | : "=&r" (ret), "=&r" (tmp), "+Q" (*(u16 *)ptr) | 44 | : "=&r" (ret), "=&r" (tmp), "+Q" (*(u16 *)ptr) |
45 | : "r" (x) | 45 | : "r" (x) |
46 | : "cc", "memory"); | 46 | : "memory"); |
47 | break; | 47 | break; |
48 | case 4: | 48 | case 4: |
49 | asm volatile("// __xchg4\n" | 49 | asm volatile("// __xchg4\n" |
50 | "1: ldaxr %w0, %2\n" | 50 | "1: ldxr %w0, %2\n" |
51 | " stlxr %w1, %w3, %2\n" | 51 | " stlxr %w1, %w3, %2\n" |
52 | " cbnz %w1, 1b\n" | 52 | " cbnz %w1, 1b\n" |
53 | : "=&r" (ret), "=&r" (tmp), "+Q" (*(u32 *)ptr) | 53 | : "=&r" (ret), "=&r" (tmp), "+Q" (*(u32 *)ptr) |
54 | : "r" (x) | 54 | : "r" (x) |
55 | : "cc", "memory"); | 55 | : "memory"); |
56 | break; | 56 | break; |
57 | case 8: | 57 | case 8: |
58 | asm volatile("// __xchg8\n" | 58 | asm volatile("// __xchg8\n" |
59 | "1: ldaxr %0, %2\n" | 59 | "1: ldxr %0, %2\n" |
60 | " stlxr %w1, %3, %2\n" | 60 | " stlxr %w1, %3, %2\n" |
61 | " cbnz %w1, 1b\n" | 61 | " cbnz %w1, 1b\n" |
62 | : "=&r" (ret), "=&r" (tmp), "+Q" (*(u64 *)ptr) | 62 | : "=&r" (ret), "=&r" (tmp), "+Q" (*(u64 *)ptr) |
63 | : "r" (x) | 63 | : "r" (x) |
64 | : "cc", "memory"); | 64 | : "memory"); |
65 | break; | 65 | break; |
66 | default: | 66 | default: |
67 | BUILD_BUG(); | 67 | BUILD_BUG(); |
68 | } | 68 | } |
69 | 69 | ||
70 | smp_mb(); | ||
70 | return ret; | 71 | return ret; |
71 | } | 72 | } |
72 | 73 | ||
diff --git a/arch/arm64/include/asm/esr.h b/arch/arm64/include/asm/esr.h index 78834123a32e..c4a7f940b387 100644 --- a/arch/arm64/include/asm/esr.h +++ b/arch/arm64/include/asm/esr.h | |||
@@ -42,7 +42,7 @@ | |||
42 | #define ESR_EL1_EC_SP_ALIGN (0x26) | 42 | #define ESR_EL1_EC_SP_ALIGN (0x26) |
43 | #define ESR_EL1_EC_FP_EXC32 (0x28) | 43 | #define ESR_EL1_EC_FP_EXC32 (0x28) |
44 | #define ESR_EL1_EC_FP_EXC64 (0x2C) | 44 | #define ESR_EL1_EC_FP_EXC64 (0x2C) |
45 | #define ESR_EL1_EC_SERRROR (0x2F) | 45 | #define ESR_EL1_EC_SERROR (0x2F) |
46 | #define ESR_EL1_EC_BREAKPT_EL0 (0x30) | 46 | #define ESR_EL1_EC_BREAKPT_EL0 (0x30) |
47 | #define ESR_EL1_EC_BREAKPT_EL1 (0x31) | 47 | #define ESR_EL1_EC_BREAKPT_EL1 (0x31) |
48 | #define ESR_EL1_EC_SOFTSTP_EL0 (0x32) | 48 | #define ESR_EL1_EC_SOFTSTP_EL0 (0x32) |
diff --git a/arch/arm64/include/asm/futex.h b/arch/arm64/include/asm/futex.h index 78cc3aba5d69..5f750dc96e0f 100644 --- a/arch/arm64/include/asm/futex.h +++ b/arch/arm64/include/asm/futex.h | |||
@@ -24,10 +24,11 @@ | |||
24 | 24 | ||
25 | #define __futex_atomic_op(insn, ret, oldval, uaddr, tmp, oparg) \ | 25 | #define __futex_atomic_op(insn, ret, oldval, uaddr, tmp, oparg) \ |
26 | asm volatile( \ | 26 | asm volatile( \ |
27 | "1: ldaxr %w1, %2\n" \ | 27 | "1: ldxr %w1, %2\n" \ |
28 | insn "\n" \ | 28 | insn "\n" \ |
29 | "2: stlxr %w3, %w0, %2\n" \ | 29 | "2: stlxr %w3, %w0, %2\n" \ |
30 | " cbnz %w3, 1b\n" \ | 30 | " cbnz %w3, 1b\n" \ |
31 | " dmb ish\n" \ | ||
31 | "3:\n" \ | 32 | "3:\n" \ |
32 | " .pushsection .fixup,\"ax\"\n" \ | 33 | " .pushsection .fixup,\"ax\"\n" \ |
33 | " .align 2\n" \ | 34 | " .align 2\n" \ |
@@ -40,7 +41,7 @@ | |||
40 | " .popsection\n" \ | 41 | " .popsection\n" \ |
41 | : "=&r" (ret), "=&r" (oldval), "+Q" (*uaddr), "=&r" (tmp) \ | 42 | : "=&r" (ret), "=&r" (oldval), "+Q" (*uaddr), "=&r" (tmp) \ |
42 | : "r" (oparg), "Ir" (-EFAULT) \ | 43 | : "r" (oparg), "Ir" (-EFAULT) \ |
43 | : "cc", "memory") | 44 | : "memory") |
44 | 45 | ||
45 | static inline int | 46 | static inline int |
46 | futex_atomic_op_inuser (int encoded_op, u32 __user *uaddr) | 47 | futex_atomic_op_inuser (int encoded_op, u32 __user *uaddr) |
@@ -111,11 +112,12 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, | |||
111 | return -EFAULT; | 112 | return -EFAULT; |
112 | 113 | ||
113 | asm volatile("// futex_atomic_cmpxchg_inatomic\n" | 114 | asm volatile("// futex_atomic_cmpxchg_inatomic\n" |
114 | "1: ldaxr %w1, %2\n" | 115 | "1: ldxr %w1, %2\n" |
115 | " sub %w3, %w1, %w4\n" | 116 | " sub %w3, %w1, %w4\n" |
116 | " cbnz %w3, 3f\n" | 117 | " cbnz %w3, 3f\n" |
117 | "2: stlxr %w3, %w5, %2\n" | 118 | "2: stlxr %w3, %w5, %2\n" |
118 | " cbnz %w3, 1b\n" | 119 | " cbnz %w3, 1b\n" |
120 | " dmb ish\n" | ||
119 | "3:\n" | 121 | "3:\n" |
120 | " .pushsection .fixup,\"ax\"\n" | 122 | " .pushsection .fixup,\"ax\"\n" |
121 | "4: mov %w0, %w6\n" | 123 | "4: mov %w0, %w6\n" |
@@ -127,7 +129,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, | |||
127 | " .popsection\n" | 129 | " .popsection\n" |
128 | : "+r" (ret), "=&r" (val), "+Q" (*uaddr), "=&r" (tmp) | 130 | : "+r" (ret), "=&r" (val), "+Q" (*uaddr), "=&r" (tmp) |
129 | : "r" (oldval), "r" (newval), "Ir" (-EFAULT) | 131 | : "r" (oldval), "r" (newval), "Ir" (-EFAULT) |
130 | : "cc", "memory"); | 132 | : "memory"); |
131 | 133 | ||
132 | *uval = val; | 134 | *uval = val; |
133 | return ret; | 135 | return ret; |
diff --git a/arch/arm64/include/asm/kvm_arm.h b/arch/arm64/include/asm/kvm_arm.h index c98ef4771c73..0eb398655378 100644 --- a/arch/arm64/include/asm/kvm_arm.h +++ b/arch/arm64/include/asm/kvm_arm.h | |||
@@ -231,7 +231,7 @@ | |||
231 | #define ESR_EL2_EC_SP_ALIGN (0x26) | 231 | #define ESR_EL2_EC_SP_ALIGN (0x26) |
232 | #define ESR_EL2_EC_FP_EXC32 (0x28) | 232 | #define ESR_EL2_EC_FP_EXC32 (0x28) |
233 | #define ESR_EL2_EC_FP_EXC64 (0x2C) | 233 | #define ESR_EL2_EC_FP_EXC64 (0x2C) |
234 | #define ESR_EL2_EC_SERRROR (0x2F) | 234 | #define ESR_EL2_EC_SERROR (0x2F) |
235 | #define ESR_EL2_EC_BREAKPT (0x30) | 235 | #define ESR_EL2_EC_BREAKPT (0x30) |
236 | #define ESR_EL2_EC_BREAKPT_HYP (0x31) | 236 | #define ESR_EL2_EC_BREAKPT_HYP (0x31) |
237 | #define ESR_EL2_EC_SOFTSTP (0x32) | 237 | #define ESR_EL2_EC_SOFTSTP (0x32) |
diff --git a/arch/arm64/include/asm/spinlock.h b/arch/arm64/include/asm/spinlock.h index 3d5cf064d7a1..c45b7b1b7197 100644 --- a/arch/arm64/include/asm/spinlock.h +++ b/arch/arm64/include/asm/spinlock.h | |||
@@ -132,7 +132,7 @@ static inline void arch_write_lock(arch_rwlock_t *rw) | |||
132 | " cbnz %w0, 2b\n" | 132 | " cbnz %w0, 2b\n" |
133 | : "=&r" (tmp), "+Q" (rw->lock) | 133 | : "=&r" (tmp), "+Q" (rw->lock) |
134 | : "r" (0x80000000) | 134 | : "r" (0x80000000) |
135 | : "cc", "memory"); | 135 | : "memory"); |
136 | } | 136 | } |
137 | 137 | ||
138 | static inline int arch_write_trylock(arch_rwlock_t *rw) | 138 | static inline int arch_write_trylock(arch_rwlock_t *rw) |
@@ -146,7 +146,7 @@ static inline int arch_write_trylock(arch_rwlock_t *rw) | |||
146 | "1:\n" | 146 | "1:\n" |
147 | : "=&r" (tmp), "+Q" (rw->lock) | 147 | : "=&r" (tmp), "+Q" (rw->lock) |
148 | : "r" (0x80000000) | 148 | : "r" (0x80000000) |
149 | : "cc", "memory"); | 149 | : "memory"); |
150 | 150 | ||
151 | return !tmp; | 151 | return !tmp; |
152 | } | 152 | } |
@@ -187,7 +187,7 @@ static inline void arch_read_lock(arch_rwlock_t *rw) | |||
187 | " cbnz %w1, 2b\n" | 187 | " cbnz %w1, 2b\n" |
188 | : "=&r" (tmp), "=&r" (tmp2), "+Q" (rw->lock) | 188 | : "=&r" (tmp), "=&r" (tmp2), "+Q" (rw->lock) |
189 | : | 189 | : |
190 | : "cc", "memory"); | 190 | : "memory"); |
191 | } | 191 | } |
192 | 192 | ||
193 | static inline void arch_read_unlock(arch_rwlock_t *rw) | 193 | static inline void arch_read_unlock(arch_rwlock_t *rw) |
@@ -201,7 +201,7 @@ static inline void arch_read_unlock(arch_rwlock_t *rw) | |||
201 | " cbnz %w1, 1b\n" | 201 | " cbnz %w1, 1b\n" |
202 | : "=&r" (tmp), "=&r" (tmp2), "+Q" (rw->lock) | 202 | : "=&r" (tmp), "=&r" (tmp2), "+Q" (rw->lock) |
203 | : | 203 | : |
204 | : "cc", "memory"); | 204 | : "memory"); |
205 | } | 205 | } |
206 | 206 | ||
207 | static inline int arch_read_trylock(arch_rwlock_t *rw) | 207 | static inline int arch_read_trylock(arch_rwlock_t *rw) |
@@ -216,7 +216,7 @@ static inline int arch_read_trylock(arch_rwlock_t *rw) | |||
216 | "1:\n" | 216 | "1:\n" |
217 | : "=&r" (tmp), "+r" (tmp2), "+Q" (rw->lock) | 217 | : "=&r" (tmp), "+r" (tmp2), "+Q" (rw->lock) |
218 | : | 218 | : |
219 | : "cc", "memory"); | 219 | : "memory"); |
220 | 220 | ||
221 | return !tmp2; | 221 | return !tmp2; |
222 | } | 222 | } |
diff --git a/arch/arm64/include/asm/unistd32.h b/arch/arm64/include/asm/unistd32.h index 58125bf008d3..bb8eb8a78e67 100644 --- a/arch/arm64/include/asm/unistd32.h +++ b/arch/arm64/include/asm/unistd32.h | |||
@@ -399,7 +399,10 @@ __SYSCALL(374, compat_sys_sendmmsg) | |||
399 | __SYSCALL(375, sys_setns) | 399 | __SYSCALL(375, sys_setns) |
400 | __SYSCALL(376, compat_sys_process_vm_readv) | 400 | __SYSCALL(376, compat_sys_process_vm_readv) |
401 | __SYSCALL(377, compat_sys_process_vm_writev) | 401 | __SYSCALL(377, compat_sys_process_vm_writev) |
402 | __SYSCALL(378, sys_ni_syscall) /* 378 for kcmp */ | 402 | __SYSCALL(378, sys_kcmp) |
403 | __SYSCALL(379, sys_finit_module) | ||
404 | __SYSCALL(380, sys_sched_setattr) | ||
405 | __SYSCALL(381, sys_sched_getattr) | ||
403 | 406 | ||
404 | #define __NR_compat_syscalls 379 | 407 | #define __NR_compat_syscalls 379 |
405 | 408 | ||
diff --git a/arch/arm64/kernel/kuser32.S b/arch/arm64/kernel/kuser32.S index 63c48ffdf230..7787208e8cc6 100644 --- a/arch/arm64/kernel/kuser32.S +++ b/arch/arm64/kernel/kuser32.S | |||
@@ -38,12 +38,13 @@ __kuser_cmpxchg64: // 0xffff0f60 | |||
38 | .inst 0xe92d00f0 // push {r4, r5, r6, r7} | 38 | .inst 0xe92d00f0 // push {r4, r5, r6, r7} |
39 | .inst 0xe1c040d0 // ldrd r4, r5, [r0] | 39 | .inst 0xe1c040d0 // ldrd r4, r5, [r0] |
40 | .inst 0xe1c160d0 // ldrd r6, r7, [r1] | 40 | .inst 0xe1c160d0 // ldrd r6, r7, [r1] |
41 | .inst 0xe1b20e9f // 1: ldaexd r0, r1, [r2] | 41 | .inst 0xe1b20f9f // 1: ldrexd r0, r1, [r2] |
42 | .inst 0xe0303004 // eors r3, r0, r4 | 42 | .inst 0xe0303004 // eors r3, r0, r4 |
43 | .inst 0x00313005 // eoreqs r3, r1, r5 | 43 | .inst 0x00313005 // eoreqs r3, r1, r5 |
44 | .inst 0x01a23e96 // stlexdeq r3, r6, [r2] | 44 | .inst 0x01a23e96 // stlexdeq r3, r6, [r2] |
45 | .inst 0x03330001 // teqeq r3, #1 | 45 | .inst 0x03330001 // teqeq r3, #1 |
46 | .inst 0x0afffff9 // beq 1b | 46 | .inst 0x0afffff9 // beq 1b |
47 | .inst 0xf57ff05b // dmb ish | ||
47 | .inst 0xe2730000 // rsbs r0, r3, #0 | 48 | .inst 0xe2730000 // rsbs r0, r3, #0 |
48 | .inst 0xe8bd00f0 // pop {r4, r5, r6, r7} | 49 | .inst 0xe8bd00f0 // pop {r4, r5, r6, r7} |
49 | .inst 0xe12fff1e // bx lr | 50 | .inst 0xe12fff1e // bx lr |
@@ -55,11 +56,12 @@ __kuser_memory_barrier: // 0xffff0fa0 | |||
55 | 56 | ||
56 | .align 5 | 57 | .align 5 |
57 | __kuser_cmpxchg: // 0xffff0fc0 | 58 | __kuser_cmpxchg: // 0xffff0fc0 |
58 | .inst 0xe1923e9f // 1: ldaex r3, [r2] | 59 | .inst 0xe1923f9f // 1: ldrex r3, [r2] |
59 | .inst 0xe0533000 // subs r3, r3, r0 | 60 | .inst 0xe0533000 // subs r3, r3, r0 |
60 | .inst 0x01823e91 // stlexeq r3, r1, [r2] | 61 | .inst 0x01823e91 // stlexeq r3, r1, [r2] |
61 | .inst 0x03330001 // teqeq r3, #1 | 62 | .inst 0x03330001 // teqeq r3, #1 |
62 | .inst 0x0afffffa // beq 1b | 63 | .inst 0x0afffffa // beq 1b |
64 | .inst 0xf57ff05b // dmb ish | ||
63 | .inst 0xe2730000 // rsbs r0, r3, #0 | 65 | .inst 0xe2730000 // rsbs r0, r3, #0 |
64 | .inst 0xe12fff1e // bx lr | 66 | .inst 0xe12fff1e // bx lr |
65 | 67 | ||
diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c index 65d40cf6945a..a7149cae1615 100644 --- a/arch/arm64/kernel/vdso.c +++ b/arch/arm64/kernel/vdso.c | |||
@@ -238,6 +238,8 @@ void update_vsyscall(struct timekeeper *tk) | |||
238 | vdso_data->use_syscall = use_syscall; | 238 | vdso_data->use_syscall = use_syscall; |
239 | vdso_data->xtime_coarse_sec = xtime_coarse.tv_sec; | 239 | vdso_data->xtime_coarse_sec = xtime_coarse.tv_sec; |
240 | vdso_data->xtime_coarse_nsec = xtime_coarse.tv_nsec; | 240 | vdso_data->xtime_coarse_nsec = xtime_coarse.tv_nsec; |
241 | vdso_data->wtm_clock_sec = tk->wall_to_monotonic.tv_sec; | ||
242 | vdso_data->wtm_clock_nsec = tk->wall_to_monotonic.tv_nsec; | ||
241 | 243 | ||
242 | if (!use_syscall) { | 244 | if (!use_syscall) { |
243 | vdso_data->cs_cycle_last = tk->clock->cycle_last; | 245 | vdso_data->cs_cycle_last = tk->clock->cycle_last; |
@@ -245,8 +247,6 @@ void update_vsyscall(struct timekeeper *tk) | |||
245 | vdso_data->xtime_clock_nsec = tk->xtime_nsec; | 247 | vdso_data->xtime_clock_nsec = tk->xtime_nsec; |
246 | vdso_data->cs_mult = tk->mult; | 248 | vdso_data->cs_mult = tk->mult; |
247 | vdso_data->cs_shift = tk->shift; | 249 | vdso_data->cs_shift = tk->shift; |
248 | vdso_data->wtm_clock_sec = tk->wall_to_monotonic.tv_sec; | ||
249 | vdso_data->wtm_clock_nsec = tk->wall_to_monotonic.tv_nsec; | ||
250 | } | 250 | } |
251 | 251 | ||
252 | smp_wmb(); | 252 | smp_wmb(); |
diff --git a/arch/arm64/kernel/vdso/Makefile b/arch/arm64/kernel/vdso/Makefile index d8064af42e62..6d20b7d162d8 100644 --- a/arch/arm64/kernel/vdso/Makefile +++ b/arch/arm64/kernel/vdso/Makefile | |||
@@ -48,7 +48,7 @@ $(obj-vdso): %.o: %.S | |||
48 | 48 | ||
49 | # Actual build commands | 49 | # Actual build commands |
50 | quiet_cmd_vdsold = VDSOL $@ | 50 | quiet_cmd_vdsold = VDSOL $@ |
51 | cmd_vdsold = $(CC) $(c_flags) -Wl,-T $^ -o $@ | 51 | cmd_vdsold = $(CC) $(c_flags) -Wl,-n -Wl,-T $^ -o $@ |
52 | quiet_cmd_vdsoas = VDSOA $@ | 52 | quiet_cmd_vdsoas = VDSOA $@ |
53 | cmd_vdsoas = $(CC) $(a_flags) -c -o $@ $< | 53 | cmd_vdsoas = $(CC) $(a_flags) -c -o $@ $< |
54 | 54 | ||
diff --git a/arch/arm64/kernel/vdso/gettimeofday.S b/arch/arm64/kernel/vdso/gettimeofday.S index f0a6d10b5211..fe652ffd34c2 100644 --- a/arch/arm64/kernel/vdso/gettimeofday.S +++ b/arch/arm64/kernel/vdso/gettimeofday.S | |||
@@ -103,6 +103,8 @@ ENTRY(__kernel_clock_gettime) | |||
103 | bl __do_get_tspec | 103 | bl __do_get_tspec |
104 | seqcnt_check w9, 1b | 104 | seqcnt_check w9, 1b |
105 | 105 | ||
106 | mov x30, x2 | ||
107 | |||
106 | cmp w0, #CLOCK_MONOTONIC | 108 | cmp w0, #CLOCK_MONOTONIC |
107 | b.ne 6f | 109 | b.ne 6f |
108 | 110 | ||
@@ -118,6 +120,9 @@ ENTRY(__kernel_clock_gettime) | |||
118 | ccmp w0, #CLOCK_MONOTONIC_COARSE, #0x4, ne | 120 | ccmp w0, #CLOCK_MONOTONIC_COARSE, #0x4, ne |
119 | b.ne 8f | 121 | b.ne 8f |
120 | 122 | ||
123 | /* xtime_coarse_nsec is already right-shifted */ | ||
124 | mov x12, #0 | ||
125 | |||
121 | /* Get coarse timespec. */ | 126 | /* Get coarse timespec. */ |
122 | adr vdso_data, _vdso_data | 127 | adr vdso_data, _vdso_data |
123 | 3: seqcnt_acquire | 128 | 3: seqcnt_acquire |
@@ -156,7 +161,7 @@ ENTRY(__kernel_clock_gettime) | |||
156 | lsr x11, x11, x12 | 161 | lsr x11, x11, x12 |
157 | stp x10, x11, [x1, #TSPEC_TV_SEC] | 162 | stp x10, x11, [x1, #TSPEC_TV_SEC] |
158 | mov x0, xzr | 163 | mov x0, xzr |
159 | ret x2 | 164 | ret |
160 | 7: | 165 | 7: |
161 | mov x30, x2 | 166 | mov x30, x2 |
162 | 8: /* Syscall fallback. */ | 167 | 8: /* Syscall fallback. */ |
diff --git a/arch/arm64/lib/bitops.S b/arch/arm64/lib/bitops.S index e5db797790d3..7dac371cc9a2 100644 --- a/arch/arm64/lib/bitops.S +++ b/arch/arm64/lib/bitops.S | |||
@@ -46,11 +46,12 @@ ENTRY( \name ) | |||
46 | mov x2, #1 | 46 | mov x2, #1 |
47 | add x1, x1, x0, lsr #3 // Get word offset | 47 | add x1, x1, x0, lsr #3 // Get word offset |
48 | lsl x4, x2, x3 // Create mask | 48 | lsl x4, x2, x3 // Create mask |
49 | 1: ldaxr x2, [x1] | 49 | 1: ldxr x2, [x1] |
50 | lsr x0, x2, x3 // Save old value of bit | 50 | lsr x0, x2, x3 // Save old value of bit |
51 | \instr x2, x2, x4 // toggle bit | 51 | \instr x2, x2, x4 // toggle bit |
52 | stlxr w5, x2, [x1] | 52 | stlxr w5, x2, [x1] |
53 | cbnz w5, 1b | 53 | cbnz w5, 1b |
54 | dmb ish | ||
54 | and x0, x0, #1 | 55 | and x0, x0, #1 |
55 | 3: ret | 56 | 3: ret |
56 | ENDPROC(\name ) | 57 | ENDPROC(\name ) |
diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c index 45b5ab54c9ee..fbd76785c5db 100644 --- a/arch/arm64/mm/dma-mapping.c +++ b/arch/arm64/mm/dma-mapping.c | |||
@@ -45,6 +45,7 @@ static void *arm64_swiotlb_alloc_coherent(struct device *dev, size_t size, | |||
45 | if (IS_ENABLED(CONFIG_DMA_CMA)) { | 45 | if (IS_ENABLED(CONFIG_DMA_CMA)) { |
46 | struct page *page; | 46 | struct page *page; |
47 | 47 | ||
48 | size = PAGE_ALIGN(size); | ||
48 | page = dma_alloc_from_contiguous(dev, size >> PAGE_SHIFT, | 49 | page = dma_alloc_from_contiguous(dev, size >> PAGE_SHIFT, |
49 | get_order(size)); | 50 | get_order(size)); |
50 | if (!page) | 51 | if (!page) |
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index f557ebbe7013..f8dc7e8fce6f 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c | |||
@@ -203,10 +203,18 @@ static void __init alloc_init_pmd(pud_t *pud, unsigned long addr, | |||
203 | do { | 203 | do { |
204 | next = pmd_addr_end(addr, end); | 204 | next = pmd_addr_end(addr, end); |
205 | /* try section mapping first */ | 205 | /* try section mapping first */ |
206 | if (((addr | next | phys) & ~SECTION_MASK) == 0) | 206 | if (((addr | next | phys) & ~SECTION_MASK) == 0) { |
207 | pmd_t old_pmd =*pmd; | ||
207 | set_pmd(pmd, __pmd(phys | prot_sect_kernel)); | 208 | set_pmd(pmd, __pmd(phys | prot_sect_kernel)); |
208 | else | 209 | /* |
210 | * Check for previous table entries created during | ||
211 | * boot (__create_page_tables) and flush them. | ||
212 | */ | ||
213 | if (!pmd_none(old_pmd)) | ||
214 | flush_tlb_all(); | ||
215 | } else { | ||
209 | alloc_init_pte(pmd, addr, next, __phys_to_pfn(phys)); | 216 | alloc_init_pte(pmd, addr, next, __phys_to_pfn(phys)); |
217 | } | ||
210 | phys += next - addr; | 218 | phys += next - addr; |
211 | } while (pmd++, addr = next, addr != end); | 219 | } while (pmd++, addr = next, addr != end); |
212 | } | 220 | } |
diff --git a/arch/arm64/mm/pgd.c b/arch/arm64/mm/pgd.c index 7083cdada657..62c6101df260 100644 --- a/arch/arm64/mm/pgd.c +++ b/arch/arm64/mm/pgd.c | |||
@@ -32,17 +32,10 @@ | |||
32 | 32 | ||
33 | pgd_t *pgd_alloc(struct mm_struct *mm) | 33 | pgd_t *pgd_alloc(struct mm_struct *mm) |
34 | { | 34 | { |
35 | pgd_t *new_pgd; | ||
36 | |||
37 | if (PGD_SIZE == PAGE_SIZE) | 35 | if (PGD_SIZE == PAGE_SIZE) |
38 | new_pgd = (pgd_t *)get_zeroed_page(GFP_KERNEL); | 36 | return (pgd_t *)get_zeroed_page(GFP_KERNEL); |
39 | else | 37 | else |
40 | new_pgd = kzalloc(PGD_SIZE, GFP_KERNEL); | 38 | return kzalloc(PGD_SIZE, GFP_KERNEL); |
41 | |||
42 | if (!new_pgd) | ||
43 | return NULL; | ||
44 | |||
45 | return new_pgd; | ||
46 | } | 39 | } |
47 | 40 | ||
48 | void pgd_free(struct mm_struct *mm, pgd_t *pgd) | 41 | void pgd_free(struct mm_struct *mm, pgd_t *pgd) |
diff --git a/arch/ia64/include/asm/unistd.h b/arch/ia64/include/asm/unistd.h index afd45e0d552e..ae763d8bf55a 100644 --- a/arch/ia64/include/asm/unistd.h +++ b/arch/ia64/include/asm/unistd.h | |||
@@ -11,7 +11,7 @@ | |||
11 | 11 | ||
12 | 12 | ||
13 | 13 | ||
14 | #define NR_syscalls 312 /* length of syscall table */ | 14 | #define NR_syscalls 314 /* length of syscall table */ |
15 | 15 | ||
16 | /* | 16 | /* |
17 | * The following defines stop scripts/checksyscalls.sh from complaining about | 17 | * The following defines stop scripts/checksyscalls.sh from complaining about |
diff --git a/arch/ia64/include/uapi/asm/unistd.h b/arch/ia64/include/uapi/asm/unistd.h index 34fd6fe46da1..715e85f858de 100644 --- a/arch/ia64/include/uapi/asm/unistd.h +++ b/arch/ia64/include/uapi/asm/unistd.h | |||
@@ -325,5 +325,7 @@ | |||
325 | #define __NR_process_vm_writev 1333 | 325 | #define __NR_process_vm_writev 1333 |
326 | #define __NR_accept4 1334 | 326 | #define __NR_accept4 1334 |
327 | #define __NR_finit_module 1335 | 327 | #define __NR_finit_module 1335 |
328 | #define __NR_sched_setattr 1336 | ||
329 | #define __NR_sched_getattr 1337 | ||
328 | 330 | ||
329 | #endif /* _UAPI_ASM_IA64_UNISTD_H */ | 331 | #endif /* _UAPI_ASM_IA64_UNISTD_H */ |
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S index ddea607f948a..fa8d61a312a7 100644 --- a/arch/ia64/kernel/entry.S +++ b/arch/ia64/kernel/entry.S | |||
@@ -1773,6 +1773,8 @@ sys_call_table: | |||
1773 | data8 sys_process_vm_writev | 1773 | data8 sys_process_vm_writev |
1774 | data8 sys_accept4 | 1774 | data8 sys_accept4 |
1775 | data8 sys_finit_module // 1335 | 1775 | data8 sys_finit_module // 1335 |
1776 | data8 sys_sched_setattr | ||
1777 | data8 sys_sched_getattr | ||
1776 | 1778 | ||
1777 | .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls | 1779 | .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls |
1778 | #endif /* __IA64_ASM_PARAVIRTUALIZED_NATIVE */ | 1780 | #endif /* __IA64_ASM_PARAVIRTUALIZED_NATIVE */ |
diff --git a/arch/mips/alchemy/devboards/db1000.c b/arch/mips/alchemy/devboards/db1000.c index 11f3ad20321c..5483906e0f86 100644 --- a/arch/mips/alchemy/devboards/db1000.c +++ b/arch/mips/alchemy/devboards/db1000.c | |||
@@ -534,13 +534,10 @@ static int __init db1000_dev_init(void) | |||
534 | s0 = AU1100_GPIO1_INT; | 534 | s0 = AU1100_GPIO1_INT; |
535 | s1 = AU1100_GPIO4_INT; | 535 | s1 = AU1100_GPIO4_INT; |
536 | 536 | ||
537 | gpio_request(19, "sd0_cd"); | ||
538 | gpio_request(20, "sd1_cd"); | ||
537 | gpio_direction_input(19); /* sd0 cd# */ | 539 | gpio_direction_input(19); /* sd0 cd# */ |
538 | gpio_direction_input(20); /* sd1 cd# */ | 540 | gpio_direction_input(20); /* sd1 cd# */ |
539 | gpio_direction_input(21); /* touch pendown# */ | ||
540 | gpio_direction_input(207); /* SPI MISO */ | ||
541 | gpio_direction_output(208, 0); /* SPI MOSI */ | ||
542 | gpio_direction_output(209, 1); /* SPI SCK */ | ||
543 | gpio_direction_output(210, 1); /* SPI CS# */ | ||
544 | 541 | ||
545 | /* spi_gpio on SSI0 pins */ | 542 | /* spi_gpio on SSI0 pins */ |
546 | pfc = __raw_readl((void __iomem *)SYS_PINFUNC); | 543 | pfc = __raw_readl((void __iomem *)SYS_PINFUNC); |
diff --git a/arch/mips/include/asm/fpu.h b/arch/mips/include/asm/fpu.h index cfe092fc720d..6b9749540edf 100644 --- a/arch/mips/include/asm/fpu.h +++ b/arch/mips/include/asm/fpu.h | |||
@@ -74,6 +74,8 @@ static inline int __enable_fpu(enum fpu_mode mode) | |||
74 | default: | 74 | default: |
75 | BUG(); | 75 | BUG(); |
76 | } | 76 | } |
77 | |||
78 | return SIGFPE; | ||
77 | } | 79 | } |
78 | 80 | ||
79 | #define __disable_fpu() \ | 81 | #define __disable_fpu() \ |
diff --git a/arch/mips/include/uapi/asm/unistd.h b/arch/mips/include/uapi/asm/unistd.h index 1dee279f9665..d6e154a9e6a5 100644 --- a/arch/mips/include/uapi/asm/unistd.h +++ b/arch/mips/include/uapi/asm/unistd.h | |||
@@ -369,16 +369,18 @@ | |||
369 | #define __NR_process_vm_writev (__NR_Linux + 346) | 369 | #define __NR_process_vm_writev (__NR_Linux + 346) |
370 | #define __NR_kcmp (__NR_Linux + 347) | 370 | #define __NR_kcmp (__NR_Linux + 347) |
371 | #define __NR_finit_module (__NR_Linux + 348) | 371 | #define __NR_finit_module (__NR_Linux + 348) |
372 | #define __NR_sched_setattr (__NR_Linux + 349) | ||
373 | #define __NR_sched_getattr (__NR_Linux + 350) | ||
372 | 374 | ||
373 | /* | 375 | /* |
374 | * Offset of the last Linux o32 flavoured syscall | 376 | * Offset of the last Linux o32 flavoured syscall |
375 | */ | 377 | */ |
376 | #define __NR_Linux_syscalls 348 | 378 | #define __NR_Linux_syscalls 350 |
377 | 379 | ||
378 | #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ | 380 | #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ |
379 | 381 | ||
380 | #define __NR_O32_Linux 4000 | 382 | #define __NR_O32_Linux 4000 |
381 | #define __NR_O32_Linux_syscalls 348 | 383 | #define __NR_O32_Linux_syscalls 350 |
382 | 384 | ||
383 | #if _MIPS_SIM == _MIPS_SIM_ABI64 | 385 | #if _MIPS_SIM == _MIPS_SIM_ABI64 |
384 | 386 | ||
@@ -695,16 +697,18 @@ | |||
695 | #define __NR_kcmp (__NR_Linux + 306) | 697 | #define __NR_kcmp (__NR_Linux + 306) |
696 | #define __NR_finit_module (__NR_Linux + 307) | 698 | #define __NR_finit_module (__NR_Linux + 307) |
697 | #define __NR_getdents64 (__NR_Linux + 308) | 699 | #define __NR_getdents64 (__NR_Linux + 308) |
700 | #define __NR_sched_setattr (__NR_Linux + 309) | ||
701 | #define __NR_sched_getattr (__NR_Linux + 310) | ||
698 | 702 | ||
699 | /* | 703 | /* |
700 | * Offset of the last Linux 64-bit flavoured syscall | 704 | * Offset of the last Linux 64-bit flavoured syscall |
701 | */ | 705 | */ |
702 | #define __NR_Linux_syscalls 308 | 706 | #define __NR_Linux_syscalls 310 |
703 | 707 | ||
704 | #endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ | 708 | #endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ |
705 | 709 | ||
706 | #define __NR_64_Linux 5000 | 710 | #define __NR_64_Linux 5000 |
707 | #define __NR_64_Linux_syscalls 308 | 711 | #define __NR_64_Linux_syscalls 310 |
708 | 712 | ||
709 | #if _MIPS_SIM == _MIPS_SIM_NABI32 | 713 | #if _MIPS_SIM == _MIPS_SIM_NABI32 |
710 | 714 | ||
@@ -1025,15 +1029,17 @@ | |||
1025 | #define __NR_process_vm_writev (__NR_Linux + 310) | 1029 | #define __NR_process_vm_writev (__NR_Linux + 310) |
1026 | #define __NR_kcmp (__NR_Linux + 311) | 1030 | #define __NR_kcmp (__NR_Linux + 311) |
1027 | #define __NR_finit_module (__NR_Linux + 312) | 1031 | #define __NR_finit_module (__NR_Linux + 312) |
1032 | #define __NR_sched_setattr (__NR_Linux + 313) | ||
1033 | #define __NR_sched_getattr (__NR_Linux + 314) | ||
1028 | 1034 | ||
1029 | /* | 1035 | /* |
1030 | * Offset of the last N32 flavoured syscall | 1036 | * Offset of the last N32 flavoured syscall |
1031 | */ | 1037 | */ |
1032 | #define __NR_Linux_syscalls 312 | 1038 | #define __NR_Linux_syscalls 314 |
1033 | 1039 | ||
1034 | #endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ | 1040 | #endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ |
1035 | 1041 | ||
1036 | #define __NR_N32_Linux 6000 | 1042 | #define __NR_N32_Linux 6000 |
1037 | #define __NR_N32_Linux_syscalls 312 | 1043 | #define __NR_N32_Linux_syscalls 314 |
1038 | 1044 | ||
1039 | #endif /* _UAPI_ASM_UNISTD_H */ | 1045 | #endif /* _UAPI_ASM_UNISTD_H */ |
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S index e8e541b40d86..a5b14f48e1af 100644 --- a/arch/mips/kernel/scall32-o32.S +++ b/arch/mips/kernel/scall32-o32.S | |||
@@ -563,3 +563,5 @@ EXPORT(sys_call_table) | |||
563 | PTR sys_process_vm_writev | 563 | PTR sys_process_vm_writev |
564 | PTR sys_kcmp | 564 | PTR sys_kcmp |
565 | PTR sys_finit_module | 565 | PTR sys_finit_module |
566 | PTR sys_sched_setattr | ||
567 | PTR sys_sched_getattr /* 4350 */ | ||
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S index 57e3742fec59..b56e254beb15 100644 --- a/arch/mips/kernel/scall64-64.S +++ b/arch/mips/kernel/scall64-64.S | |||
@@ -425,4 +425,6 @@ EXPORT(sys_call_table) | |||
425 | PTR sys_kcmp | 425 | PTR sys_kcmp |
426 | PTR sys_finit_module | 426 | PTR sys_finit_module |
427 | PTR sys_getdents64 | 427 | PTR sys_getdents64 |
428 | PTR sys_sched_setattr | ||
429 | PTR sys_sched_getattr /* 5310 */ | ||
428 | .size sys_call_table,.-sys_call_table | 430 | .size sys_call_table,.-sys_call_table |
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S index 2f48f5934399..f7e5b72cf481 100644 --- a/arch/mips/kernel/scall64-n32.S +++ b/arch/mips/kernel/scall64-n32.S | |||
@@ -418,4 +418,6 @@ EXPORT(sysn32_call_table) | |||
418 | PTR compat_sys_process_vm_writev /* 6310 */ | 418 | PTR compat_sys_process_vm_writev /* 6310 */ |
419 | PTR sys_kcmp | 419 | PTR sys_kcmp |
420 | PTR sys_finit_module | 420 | PTR sys_finit_module |
421 | PTR sys_sched_setattr | ||
422 | PTR sys_sched_getattr | ||
421 | .size sysn32_call_table,.-sysn32_call_table | 423 | .size sysn32_call_table,.-sysn32_call_table |
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S index f1acdb429f4f..6788727d91af 100644 --- a/arch/mips/kernel/scall64-o32.S +++ b/arch/mips/kernel/scall64-o32.S | |||
@@ -541,4 +541,6 @@ EXPORT(sys32_call_table) | |||
541 | PTR compat_sys_process_vm_writev | 541 | PTR compat_sys_process_vm_writev |
542 | PTR sys_kcmp | 542 | PTR sys_kcmp |
543 | PTR sys_finit_module | 543 | PTR sys_finit_module |
544 | PTR sys_sched_setattr | ||
545 | PTR sys_sched_getattr /* 4350 */ | ||
544 | .size sys32_call_table,.-sys32_call_table | 546 | .size sys32_call_table,.-sys32_call_table |
diff --git a/arch/parisc/hpux/fs.c b/arch/parisc/hpux/fs.c index 88d0962de65a..2bedafea3d94 100644 --- a/arch/parisc/hpux/fs.c +++ b/arch/parisc/hpux/fs.c | |||
@@ -33,22 +33,9 @@ | |||
33 | 33 | ||
34 | int hpux_execve(struct pt_regs *regs) | 34 | int hpux_execve(struct pt_regs *regs) |
35 | { | 35 | { |
36 | int error; | 36 | return do_execve(getname((const char __user *) regs->gr[26]), |
37 | struct filename *filename; | ||
38 | |||
39 | filename = getname((const char __user *) regs->gr[26]); | ||
40 | error = PTR_ERR(filename); | ||
41 | if (IS_ERR(filename)) | ||
42 | goto out; | ||
43 | |||
44 | error = do_execve(filename->name, | ||
45 | (const char __user *const __user *) regs->gr[25], | 37 | (const char __user *const __user *) regs->gr[25], |
46 | (const char __user *const __user *) regs->gr[24]); | 38 | (const char __user *const __user *) regs->gr[24]); |
47 | |||
48 | putname(filename); | ||
49 | |||
50 | out: | ||
51 | return error; | ||
52 | } | 39 | } |
53 | 40 | ||
54 | struct hpux_dirent { | 41 | struct hpux_dirent { |
diff --git a/arch/s390/crypto/aes_s390.c b/arch/s390/crypto/aes_s390.c index b3feabd39f31..cf3c0089bef2 100644 --- a/arch/s390/crypto/aes_s390.c +++ b/arch/s390/crypto/aes_s390.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/err.h> | 25 | #include <linux/err.h> |
26 | #include <linux/module.h> | 26 | #include <linux/module.h> |
27 | #include <linux/init.h> | 27 | #include <linux/init.h> |
28 | #include <linux/spinlock.h> | ||
28 | #include "crypt_s390.h" | 29 | #include "crypt_s390.h" |
29 | 30 | ||
30 | #define AES_KEYLEN_128 1 | 31 | #define AES_KEYLEN_128 1 |
@@ -32,6 +33,7 @@ | |||
32 | #define AES_KEYLEN_256 4 | 33 | #define AES_KEYLEN_256 4 |
33 | 34 | ||
34 | static u8 *ctrblk; | 35 | static u8 *ctrblk; |
36 | static DEFINE_SPINLOCK(ctrblk_lock); | ||
35 | static char keylen_flag; | 37 | static char keylen_flag; |
36 | 38 | ||
37 | struct s390_aes_ctx { | 39 | struct s390_aes_ctx { |
@@ -758,43 +760,67 @@ static int ctr_aes_set_key(struct crypto_tfm *tfm, const u8 *in_key, | |||
758 | return aes_set_key(tfm, in_key, key_len); | 760 | return aes_set_key(tfm, in_key, key_len); |
759 | } | 761 | } |
760 | 762 | ||
763 | static unsigned int __ctrblk_init(u8 *ctrptr, unsigned int nbytes) | ||
764 | { | ||
765 | unsigned int i, n; | ||
766 | |||
767 | /* only use complete blocks, max. PAGE_SIZE */ | ||
768 | n = (nbytes > PAGE_SIZE) ? PAGE_SIZE : nbytes & ~(AES_BLOCK_SIZE - 1); | ||
769 | for (i = AES_BLOCK_SIZE; i < n; i += AES_BLOCK_SIZE) { | ||
770 | memcpy(ctrptr + i, ctrptr + i - AES_BLOCK_SIZE, | ||
771 | AES_BLOCK_SIZE); | ||
772 | crypto_inc(ctrptr + i, AES_BLOCK_SIZE); | ||
773 | } | ||
774 | return n; | ||
775 | } | ||
776 | |||
761 | static int ctr_aes_crypt(struct blkcipher_desc *desc, long func, | 777 | static int ctr_aes_crypt(struct blkcipher_desc *desc, long func, |
762 | struct s390_aes_ctx *sctx, struct blkcipher_walk *walk) | 778 | struct s390_aes_ctx *sctx, struct blkcipher_walk *walk) |
763 | { | 779 | { |
764 | int ret = blkcipher_walk_virt_block(desc, walk, AES_BLOCK_SIZE); | 780 | int ret = blkcipher_walk_virt_block(desc, walk, AES_BLOCK_SIZE); |
765 | unsigned int i, n, nbytes; | 781 | unsigned int n, nbytes; |
766 | u8 buf[AES_BLOCK_SIZE]; | 782 | u8 buf[AES_BLOCK_SIZE], ctrbuf[AES_BLOCK_SIZE]; |
767 | u8 *out, *in; | 783 | u8 *out, *in, *ctrptr = ctrbuf; |
768 | 784 | ||
769 | if (!walk->nbytes) | 785 | if (!walk->nbytes) |
770 | return ret; | 786 | return ret; |
771 | 787 | ||
772 | memcpy(ctrblk, walk->iv, AES_BLOCK_SIZE); | 788 | if (spin_trylock(&ctrblk_lock)) |
789 | ctrptr = ctrblk; | ||
790 | |||
791 | memcpy(ctrptr, walk->iv, AES_BLOCK_SIZE); | ||
773 | while ((nbytes = walk->nbytes) >= AES_BLOCK_SIZE) { | 792 | while ((nbytes = walk->nbytes) >= AES_BLOCK_SIZE) { |
774 | out = walk->dst.virt.addr; | 793 | out = walk->dst.virt.addr; |
775 | in = walk->src.virt.addr; | 794 | in = walk->src.virt.addr; |
776 | while (nbytes >= AES_BLOCK_SIZE) { | 795 | while (nbytes >= AES_BLOCK_SIZE) { |
777 | /* only use complete blocks, max. PAGE_SIZE */ | 796 | if (ctrptr == ctrblk) |
778 | n = (nbytes > PAGE_SIZE) ? PAGE_SIZE : | 797 | n = __ctrblk_init(ctrptr, nbytes); |
779 | nbytes & ~(AES_BLOCK_SIZE - 1); | 798 | else |
780 | for (i = AES_BLOCK_SIZE; i < n; i += AES_BLOCK_SIZE) { | 799 | n = AES_BLOCK_SIZE; |
781 | memcpy(ctrblk + i, ctrblk + i - AES_BLOCK_SIZE, | 800 | ret = crypt_s390_kmctr(func, sctx->key, out, in, |
782 | AES_BLOCK_SIZE); | 801 | n, ctrptr); |
783 | crypto_inc(ctrblk + i, AES_BLOCK_SIZE); | 802 | if (ret < 0 || ret != n) { |
784 | } | 803 | if (ctrptr == ctrblk) |
785 | ret = crypt_s390_kmctr(func, sctx->key, out, in, n, ctrblk); | 804 | spin_unlock(&ctrblk_lock); |
786 | if (ret < 0 || ret != n) | ||
787 | return -EIO; | 805 | return -EIO; |
806 | } | ||
788 | if (n > AES_BLOCK_SIZE) | 807 | if (n > AES_BLOCK_SIZE) |
789 | memcpy(ctrblk, ctrblk + n - AES_BLOCK_SIZE, | 808 | memcpy(ctrptr, ctrptr + n - AES_BLOCK_SIZE, |
790 | AES_BLOCK_SIZE); | 809 | AES_BLOCK_SIZE); |
791 | crypto_inc(ctrblk, AES_BLOCK_SIZE); | 810 | crypto_inc(ctrptr, AES_BLOCK_SIZE); |
792 | out += n; | 811 | out += n; |
793 | in += n; | 812 | in += n; |
794 | nbytes -= n; | 813 | nbytes -= n; |
795 | } | 814 | } |
796 | ret = blkcipher_walk_done(desc, walk, nbytes); | 815 | ret = blkcipher_walk_done(desc, walk, nbytes); |
797 | } | 816 | } |
817 | if (ctrptr == ctrblk) { | ||
818 | if (nbytes) | ||
819 | memcpy(ctrbuf, ctrptr, AES_BLOCK_SIZE); | ||
820 | else | ||
821 | memcpy(walk->iv, ctrptr, AES_BLOCK_SIZE); | ||
822 | spin_unlock(&ctrblk_lock); | ||
823 | } | ||
798 | /* | 824 | /* |
799 | * final block may be < AES_BLOCK_SIZE, copy only nbytes | 825 | * final block may be < AES_BLOCK_SIZE, copy only nbytes |
800 | */ | 826 | */ |
@@ -802,14 +828,15 @@ static int ctr_aes_crypt(struct blkcipher_desc *desc, long func, | |||
802 | out = walk->dst.virt.addr; | 828 | out = walk->dst.virt.addr; |
803 | in = walk->src.virt.addr; | 829 | in = walk->src.virt.addr; |
804 | ret = crypt_s390_kmctr(func, sctx->key, buf, in, | 830 | ret = crypt_s390_kmctr(func, sctx->key, buf, in, |
805 | AES_BLOCK_SIZE, ctrblk); | 831 | AES_BLOCK_SIZE, ctrbuf); |
806 | if (ret < 0 || ret != AES_BLOCK_SIZE) | 832 | if (ret < 0 || ret != AES_BLOCK_SIZE) |
807 | return -EIO; | 833 | return -EIO; |
808 | memcpy(out, buf, nbytes); | 834 | memcpy(out, buf, nbytes); |
809 | crypto_inc(ctrblk, AES_BLOCK_SIZE); | 835 | crypto_inc(ctrbuf, AES_BLOCK_SIZE); |
810 | ret = blkcipher_walk_done(desc, walk, 0); | 836 | ret = blkcipher_walk_done(desc, walk, 0); |
837 | memcpy(walk->iv, ctrbuf, AES_BLOCK_SIZE); | ||
811 | } | 838 | } |
812 | memcpy(walk->iv, ctrblk, AES_BLOCK_SIZE); | 839 | |
813 | return ret; | 840 | return ret; |
814 | } | 841 | } |
815 | 842 | ||
diff --git a/arch/s390/crypto/des_s390.c b/arch/s390/crypto/des_s390.c index 200f2a1b599d..0a5aac8a9412 100644 --- a/arch/s390/crypto/des_s390.c +++ b/arch/s390/crypto/des_s390.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #define DES3_KEY_SIZE (3 * DES_KEY_SIZE) | 25 | #define DES3_KEY_SIZE (3 * DES_KEY_SIZE) |
26 | 26 | ||
27 | static u8 *ctrblk; | 27 | static u8 *ctrblk; |
28 | static DEFINE_SPINLOCK(ctrblk_lock); | ||
28 | 29 | ||
29 | struct s390_des_ctx { | 30 | struct s390_des_ctx { |
30 | u8 iv[DES_BLOCK_SIZE]; | 31 | u8 iv[DES_BLOCK_SIZE]; |
@@ -105,29 +106,35 @@ static int ecb_desall_crypt(struct blkcipher_desc *desc, long func, | |||
105 | } | 106 | } |
106 | 107 | ||
107 | static int cbc_desall_crypt(struct blkcipher_desc *desc, long func, | 108 | static int cbc_desall_crypt(struct blkcipher_desc *desc, long func, |
108 | u8 *iv, struct blkcipher_walk *walk) | 109 | struct blkcipher_walk *walk) |
109 | { | 110 | { |
111 | struct s390_des_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); | ||
110 | int ret = blkcipher_walk_virt(desc, walk); | 112 | int ret = blkcipher_walk_virt(desc, walk); |
111 | unsigned int nbytes = walk->nbytes; | 113 | unsigned int nbytes = walk->nbytes; |
114 | struct { | ||
115 | u8 iv[DES_BLOCK_SIZE]; | ||
116 | u8 key[DES3_KEY_SIZE]; | ||
117 | } param; | ||
112 | 118 | ||
113 | if (!nbytes) | 119 | if (!nbytes) |
114 | goto out; | 120 | goto out; |
115 | 121 | ||
116 | memcpy(iv, walk->iv, DES_BLOCK_SIZE); | 122 | memcpy(param.iv, walk->iv, DES_BLOCK_SIZE); |
123 | memcpy(param.key, ctx->key, DES3_KEY_SIZE); | ||
117 | do { | 124 | do { |
118 | /* only use complete blocks */ | 125 | /* only use complete blocks */ |
119 | unsigned int n = nbytes & ~(DES_BLOCK_SIZE - 1); | 126 | unsigned int n = nbytes & ~(DES_BLOCK_SIZE - 1); |
120 | u8 *out = walk->dst.virt.addr; | 127 | u8 *out = walk->dst.virt.addr; |
121 | u8 *in = walk->src.virt.addr; | 128 | u8 *in = walk->src.virt.addr; |
122 | 129 | ||
123 | ret = crypt_s390_kmc(func, iv, out, in, n); | 130 | ret = crypt_s390_kmc(func, ¶m, out, in, n); |
124 | if (ret < 0 || ret != n) | 131 | if (ret < 0 || ret != n) |
125 | return -EIO; | 132 | return -EIO; |
126 | 133 | ||
127 | nbytes &= DES_BLOCK_SIZE - 1; | 134 | nbytes &= DES_BLOCK_SIZE - 1; |
128 | ret = blkcipher_walk_done(desc, walk, nbytes); | 135 | ret = blkcipher_walk_done(desc, walk, nbytes); |
129 | } while ((nbytes = walk->nbytes)); | 136 | } while ((nbytes = walk->nbytes)); |
130 | memcpy(walk->iv, iv, DES_BLOCK_SIZE); | 137 | memcpy(walk->iv, param.iv, DES_BLOCK_SIZE); |
131 | 138 | ||
132 | out: | 139 | out: |
133 | return ret; | 140 | return ret; |
@@ -179,22 +186,20 @@ static int cbc_des_encrypt(struct blkcipher_desc *desc, | |||
179 | struct scatterlist *dst, struct scatterlist *src, | 186 | struct scatterlist *dst, struct scatterlist *src, |
180 | unsigned int nbytes) | 187 | unsigned int nbytes) |
181 | { | 188 | { |
182 | struct s390_des_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); | ||
183 | struct blkcipher_walk walk; | 189 | struct blkcipher_walk walk; |
184 | 190 | ||
185 | blkcipher_walk_init(&walk, dst, src, nbytes); | 191 | blkcipher_walk_init(&walk, dst, src, nbytes); |
186 | return cbc_desall_crypt(desc, KMC_DEA_ENCRYPT, ctx->iv, &walk); | 192 | return cbc_desall_crypt(desc, KMC_DEA_ENCRYPT, &walk); |
187 | } | 193 | } |
188 | 194 | ||
189 | static int cbc_des_decrypt(struct blkcipher_desc *desc, | 195 | static int cbc_des_decrypt(struct blkcipher_desc *desc, |
190 | struct scatterlist *dst, struct scatterlist *src, | 196 | struct scatterlist *dst, struct scatterlist *src, |
191 | unsigned int nbytes) | 197 | unsigned int nbytes) |
192 | { | 198 | { |
193 | struct s390_des_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); | ||
194 | struct blkcipher_walk walk; | 199 | struct blkcipher_walk walk; |
195 | 200 | ||
196 | blkcipher_walk_init(&walk, dst, src, nbytes); | 201 | blkcipher_walk_init(&walk, dst, src, nbytes); |
197 | return cbc_desall_crypt(desc, KMC_DEA_DECRYPT, ctx->iv, &walk); | 202 | return cbc_desall_crypt(desc, KMC_DEA_DECRYPT, &walk); |
198 | } | 203 | } |
199 | 204 | ||
200 | static struct crypto_alg cbc_des_alg = { | 205 | static struct crypto_alg cbc_des_alg = { |
@@ -327,22 +332,20 @@ static int cbc_des3_encrypt(struct blkcipher_desc *desc, | |||
327 | struct scatterlist *dst, struct scatterlist *src, | 332 | struct scatterlist *dst, struct scatterlist *src, |
328 | unsigned int nbytes) | 333 | unsigned int nbytes) |
329 | { | 334 | { |
330 | struct s390_des_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); | ||
331 | struct blkcipher_walk walk; | 335 | struct blkcipher_walk walk; |
332 | 336 | ||
333 | blkcipher_walk_init(&walk, dst, src, nbytes); | 337 | blkcipher_walk_init(&walk, dst, src, nbytes); |
334 | return cbc_desall_crypt(desc, KMC_TDEA_192_ENCRYPT, ctx->iv, &walk); | 338 | return cbc_desall_crypt(desc, KMC_TDEA_192_ENCRYPT, &walk); |
335 | } | 339 | } |
336 | 340 | ||
337 | static int cbc_des3_decrypt(struct blkcipher_desc *desc, | 341 | static int cbc_des3_decrypt(struct blkcipher_desc *desc, |
338 | struct scatterlist *dst, struct scatterlist *src, | 342 | struct scatterlist *dst, struct scatterlist *src, |
339 | unsigned int nbytes) | 343 | unsigned int nbytes) |
340 | { | 344 | { |
341 | struct s390_des_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); | ||
342 | struct blkcipher_walk walk; | 345 | struct blkcipher_walk walk; |
343 | 346 | ||
344 | blkcipher_walk_init(&walk, dst, src, nbytes); | 347 | blkcipher_walk_init(&walk, dst, src, nbytes); |
345 | return cbc_desall_crypt(desc, KMC_TDEA_192_DECRYPT, ctx->iv, &walk); | 348 | return cbc_desall_crypt(desc, KMC_TDEA_192_DECRYPT, &walk); |
346 | } | 349 | } |
347 | 350 | ||
348 | static struct crypto_alg cbc_des3_alg = { | 351 | static struct crypto_alg cbc_des3_alg = { |
@@ -366,54 +369,80 @@ static struct crypto_alg cbc_des3_alg = { | |||
366 | } | 369 | } |
367 | }; | 370 | }; |
368 | 371 | ||
372 | static unsigned int __ctrblk_init(u8 *ctrptr, unsigned int nbytes) | ||
373 | { | ||
374 | unsigned int i, n; | ||
375 | |||
376 | /* align to block size, max. PAGE_SIZE */ | ||
377 | n = (nbytes > PAGE_SIZE) ? PAGE_SIZE : nbytes & ~(DES_BLOCK_SIZE - 1); | ||
378 | for (i = DES_BLOCK_SIZE; i < n; i += DES_BLOCK_SIZE) { | ||
379 | memcpy(ctrptr + i, ctrptr + i - DES_BLOCK_SIZE, DES_BLOCK_SIZE); | ||
380 | crypto_inc(ctrptr + i, DES_BLOCK_SIZE); | ||
381 | } | ||
382 | return n; | ||
383 | } | ||
384 | |||
369 | static int ctr_desall_crypt(struct blkcipher_desc *desc, long func, | 385 | static int ctr_desall_crypt(struct blkcipher_desc *desc, long func, |
370 | struct s390_des_ctx *ctx, struct blkcipher_walk *walk) | 386 | struct s390_des_ctx *ctx, |
387 | struct blkcipher_walk *walk) | ||
371 | { | 388 | { |
372 | int ret = blkcipher_walk_virt_block(desc, walk, DES_BLOCK_SIZE); | 389 | int ret = blkcipher_walk_virt_block(desc, walk, DES_BLOCK_SIZE); |
373 | unsigned int i, n, nbytes; | 390 | unsigned int n, nbytes; |
374 | u8 buf[DES_BLOCK_SIZE]; | 391 | u8 buf[DES_BLOCK_SIZE], ctrbuf[DES_BLOCK_SIZE]; |
375 | u8 *out, *in; | 392 | u8 *out, *in, *ctrptr = ctrbuf; |
393 | |||
394 | if (!walk->nbytes) | ||
395 | return ret; | ||
376 | 396 | ||
377 | memcpy(ctrblk, walk->iv, DES_BLOCK_SIZE); | 397 | if (spin_trylock(&ctrblk_lock)) |
398 | ctrptr = ctrblk; | ||
399 | |||
400 | memcpy(ctrptr, walk->iv, DES_BLOCK_SIZE); | ||
378 | while ((nbytes = walk->nbytes) >= DES_BLOCK_SIZE) { | 401 | while ((nbytes = walk->nbytes) >= DES_BLOCK_SIZE) { |
379 | out = walk->dst.virt.addr; | 402 | out = walk->dst.virt.addr; |
380 | in = walk->src.virt.addr; | 403 | in = walk->src.virt.addr; |
381 | while (nbytes >= DES_BLOCK_SIZE) { | 404 | while (nbytes >= DES_BLOCK_SIZE) { |
382 | /* align to block size, max. PAGE_SIZE */ | 405 | if (ctrptr == ctrblk) |
383 | n = (nbytes > PAGE_SIZE) ? PAGE_SIZE : | 406 | n = __ctrblk_init(ctrptr, nbytes); |
384 | nbytes & ~(DES_BLOCK_SIZE - 1); | 407 | else |
385 | for (i = DES_BLOCK_SIZE; i < n; i += DES_BLOCK_SIZE) { | 408 | n = DES_BLOCK_SIZE; |
386 | memcpy(ctrblk + i, ctrblk + i - DES_BLOCK_SIZE, | 409 | ret = crypt_s390_kmctr(func, ctx->key, out, in, |
387 | DES_BLOCK_SIZE); | 410 | n, ctrptr); |
388 | crypto_inc(ctrblk + i, DES_BLOCK_SIZE); | 411 | if (ret < 0 || ret != n) { |
389 | } | 412 | if (ctrptr == ctrblk) |
390 | ret = crypt_s390_kmctr(func, ctx->key, out, in, n, ctrblk); | 413 | spin_unlock(&ctrblk_lock); |
391 | if (ret < 0 || ret != n) | ||
392 | return -EIO; | 414 | return -EIO; |
415 | } | ||
393 | if (n > DES_BLOCK_SIZE) | 416 | if (n > DES_BLOCK_SIZE) |
394 | memcpy(ctrblk, ctrblk + n - DES_BLOCK_SIZE, | 417 | memcpy(ctrptr, ctrptr + n - DES_BLOCK_SIZE, |
395 | DES_BLOCK_SIZE); | 418 | DES_BLOCK_SIZE); |
396 | crypto_inc(ctrblk, DES_BLOCK_SIZE); | 419 | crypto_inc(ctrptr, DES_BLOCK_SIZE); |
397 | out += n; | 420 | out += n; |
398 | in += n; | 421 | in += n; |
399 | nbytes -= n; | 422 | nbytes -= n; |
400 | } | 423 | } |
401 | ret = blkcipher_walk_done(desc, walk, nbytes); | 424 | ret = blkcipher_walk_done(desc, walk, nbytes); |
402 | } | 425 | } |
403 | 426 | if (ctrptr == ctrblk) { | |
427 | if (nbytes) | ||
428 | memcpy(ctrbuf, ctrptr, DES_BLOCK_SIZE); | ||
429 | else | ||
430 | memcpy(walk->iv, ctrptr, DES_BLOCK_SIZE); | ||
431 | spin_unlock(&ctrblk_lock); | ||
432 | } | ||
404 | /* final block may be < DES_BLOCK_SIZE, copy only nbytes */ | 433 | /* final block may be < DES_BLOCK_SIZE, copy only nbytes */ |
405 | if (nbytes) { | 434 | if (nbytes) { |
406 | out = walk->dst.virt.addr; | 435 | out = walk->dst.virt.addr; |
407 | in = walk->src.virt.addr; | 436 | in = walk->src.virt.addr; |
408 | ret = crypt_s390_kmctr(func, ctx->key, buf, in, | 437 | ret = crypt_s390_kmctr(func, ctx->key, buf, in, |
409 | DES_BLOCK_SIZE, ctrblk); | 438 | DES_BLOCK_SIZE, ctrbuf); |
410 | if (ret < 0 || ret != DES_BLOCK_SIZE) | 439 | if (ret < 0 || ret != DES_BLOCK_SIZE) |
411 | return -EIO; | 440 | return -EIO; |
412 | memcpy(out, buf, nbytes); | 441 | memcpy(out, buf, nbytes); |
413 | crypto_inc(ctrblk, DES_BLOCK_SIZE); | 442 | crypto_inc(ctrbuf, DES_BLOCK_SIZE); |
414 | ret = blkcipher_walk_done(desc, walk, 0); | 443 | ret = blkcipher_walk_done(desc, walk, 0); |
444 | memcpy(walk->iv, ctrbuf, DES_BLOCK_SIZE); | ||
415 | } | 445 | } |
416 | memcpy(walk->iv, ctrblk, DES_BLOCK_SIZE); | ||
417 | return ret; | 446 | return ret; |
418 | } | 447 | } |
419 | 448 | ||
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 940e50ebfafa..0af5250d914f 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -444,6 +444,7 @@ config X86_INTEL_MID | |||
444 | bool "Intel MID platform support" | 444 | bool "Intel MID platform support" |
445 | depends on X86_32 | 445 | depends on X86_32 |
446 | depends on X86_EXTENDED_PLATFORM | 446 | depends on X86_EXTENDED_PLATFORM |
447 | depends on X86_PLATFORM_DEVICES | ||
447 | depends on PCI | 448 | depends on PCI |
448 | depends on PCI_GOANY | 449 | depends on PCI_GOANY |
449 | depends on X86_IO_APIC | 450 | depends on X86_IO_APIC |
@@ -1051,9 +1052,9 @@ config MICROCODE_INTEL | |||
1051 | This options enables microcode patch loading support for Intel | 1052 | This options enables microcode patch loading support for Intel |
1052 | processors. | 1053 | processors. |
1053 | 1054 | ||
1054 | For latest news and information on obtaining all the required | 1055 | For the current Intel microcode data package go to |
1055 | Intel ingredients for this driver, check: | 1056 | <https://downloadcenter.intel.com> and search for |
1056 | <http://www.urbanmyth.org/microcode/>. | 1057 | 'Linux Processor Microcode Data File'. |
1057 | 1058 | ||
1058 | config MICROCODE_AMD | 1059 | config MICROCODE_AMD |
1059 | bool "AMD microcode loading support" | 1060 | bool "AMD microcode loading support" |
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug index 0f3621ed1db6..321a52ccf63a 100644 --- a/arch/x86/Kconfig.debug +++ b/arch/x86/Kconfig.debug | |||
@@ -184,6 +184,7 @@ config HAVE_MMIOTRACE_SUPPORT | |||
184 | config X86_DECODER_SELFTEST | 184 | config X86_DECODER_SELFTEST |
185 | bool "x86 instruction decoder selftest" | 185 | bool "x86 instruction decoder selftest" |
186 | depends on DEBUG_KERNEL && KPROBES | 186 | depends on DEBUG_KERNEL && KPROBES |
187 | depends on !COMPILE_TEST | ||
187 | ---help--- | 188 | ---help--- |
188 | Perform x86 instruction decoder selftests at build time. | 189 | Perform x86 instruction decoder selftests at build time. |
189 | This option is useful for checking the sanity of x86 instruction | 190 | This option is useful for checking the sanity of x86 instruction |
diff --git a/arch/x86/include/asm/amd_nb.h b/arch/x86/include/asm/amd_nb.h index a54ee1d054d9..aaac3b2fb746 100644 --- a/arch/x86/include/asm/amd_nb.h +++ b/arch/x86/include/asm/amd_nb.h | |||
@@ -19,7 +19,7 @@ extern int amd_cache_northbridges(void); | |||
19 | extern void amd_flush_garts(void); | 19 | extern void amd_flush_garts(void); |
20 | extern int amd_numa_init(void); | 20 | extern int amd_numa_init(void); |
21 | extern int amd_get_subcaches(int); | 21 | extern int amd_get_subcaches(int); |
22 | extern int amd_set_subcaches(int, int); | 22 | extern int amd_set_subcaches(int, unsigned long); |
23 | 23 | ||
24 | struct amd_l3_cache { | 24 | struct amd_l3_cache { |
25 | unsigned indices; | 25 | unsigned indices; |
diff --git a/arch/x86/include/asm/tlbflush.h b/arch/x86/include/asm/tlbflush.h index e6d90babc245..04905bfc508b 100644 --- a/arch/x86/include/asm/tlbflush.h +++ b/arch/x86/include/asm/tlbflush.h | |||
@@ -62,7 +62,7 @@ static inline void __flush_tlb_all(void) | |||
62 | 62 | ||
63 | static inline void __flush_tlb_one(unsigned long addr) | 63 | static inline void __flush_tlb_one(unsigned long addr) |
64 | { | 64 | { |
65 | count_vm_event(NR_TLB_LOCAL_FLUSH_ONE); | 65 | count_vm_tlb_event(NR_TLB_LOCAL_FLUSH_ONE); |
66 | __flush_tlb_single(addr); | 66 | __flush_tlb_single(addr); |
67 | } | 67 | } |
68 | 68 | ||
@@ -93,13 +93,13 @@ static inline void __flush_tlb_one(unsigned long addr) | |||
93 | */ | 93 | */ |
94 | static inline void __flush_tlb_up(void) | 94 | static inline void __flush_tlb_up(void) |
95 | { | 95 | { |
96 | count_vm_event(NR_TLB_LOCAL_FLUSH_ALL); | 96 | count_vm_tlb_event(NR_TLB_LOCAL_FLUSH_ALL); |
97 | __flush_tlb(); | 97 | __flush_tlb(); |
98 | } | 98 | } |
99 | 99 | ||
100 | static inline void flush_tlb_all(void) | 100 | static inline void flush_tlb_all(void) |
101 | { | 101 | { |
102 | count_vm_event(NR_TLB_LOCAL_FLUSH_ALL); | 102 | count_vm_tlb_event(NR_TLB_LOCAL_FLUSH_ALL); |
103 | __flush_tlb_all(); | 103 | __flush_tlb_all(); |
104 | } | 104 | } |
105 | 105 | ||
diff --git a/arch/x86/include/asm/xen/page.h b/arch/x86/include/asm/xen/page.h index 787e1bb5aafc..3e276eb23d1b 100644 --- a/arch/x86/include/asm/xen/page.h +++ b/arch/x86/include/asm/xen/page.h | |||
@@ -52,8 +52,7 @@ extern unsigned long set_phys_range_identity(unsigned long pfn_s, | |||
52 | extern int m2p_add_override(unsigned long mfn, struct page *page, | 52 | extern int m2p_add_override(unsigned long mfn, struct page *page, |
53 | struct gnttab_map_grant_ref *kmap_op); | 53 | struct gnttab_map_grant_ref *kmap_op); |
54 | extern int m2p_remove_override(struct page *page, | 54 | extern int m2p_remove_override(struct page *page, |
55 | struct gnttab_map_grant_ref *kmap_op, | 55 | struct gnttab_map_grant_ref *kmap_op); |
56 | unsigned long mfn); | ||
57 | extern struct page *m2p_find_override(unsigned long mfn); | 56 | extern struct page *m2p_find_override(unsigned long mfn); |
58 | extern unsigned long m2p_find_override_pfn(unsigned long mfn, unsigned long pfn); | 57 | extern unsigned long m2p_find_override_pfn(unsigned long mfn, unsigned long pfn); |
59 | 58 | ||
@@ -122,7 +121,7 @@ static inline unsigned long mfn_to_pfn(unsigned long mfn) | |||
122 | pfn = m2p_find_override_pfn(mfn, ~0); | 121 | pfn = m2p_find_override_pfn(mfn, ~0); |
123 | } | 122 | } |
124 | 123 | ||
125 | /* | 124 | /* |
126 | * pfn is ~0 if there are no entries in the m2p for mfn or if the | 125 | * pfn is ~0 if there are no entries in the m2p for mfn or if the |
127 | * entry doesn't map back to the mfn and m2p_override doesn't have a | 126 | * entry doesn't map back to the mfn and m2p_override doesn't have a |
128 | * valid entry for it. | 127 | * valid entry for it. |
diff --git a/arch/x86/kernel/amd_nb.c b/arch/x86/kernel/amd_nb.c index 59554dca96ec..dec8de4e1663 100644 --- a/arch/x86/kernel/amd_nb.c +++ b/arch/x86/kernel/amd_nb.c | |||
@@ -179,7 +179,7 @@ int amd_get_subcaches(int cpu) | |||
179 | return (mask >> (4 * cuid)) & 0xf; | 179 | return (mask >> (4 * cuid)) & 0xf; |
180 | } | 180 | } |
181 | 181 | ||
182 | int amd_set_subcaches(int cpu, int mask) | 182 | int amd_set_subcaches(int cpu, unsigned long mask) |
183 | { | 183 | { |
184 | static unsigned int reset, ban; | 184 | static unsigned int reset, ban; |
185 | struct amd_northbridge *nb = node_to_amd_nb(amd_get_nb_id(cpu)); | 185 | struct amd_northbridge *nb = node_to_amd_nb(amd_get_nb_id(cpu)); |
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index d3153e281d72..c67ffa686064 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c | |||
@@ -767,10 +767,7 @@ static unsigned int amd_size_cache(struct cpuinfo_x86 *c, unsigned int size) | |||
767 | 767 | ||
768 | static void cpu_set_tlb_flushall_shift(struct cpuinfo_x86 *c) | 768 | static void cpu_set_tlb_flushall_shift(struct cpuinfo_x86 *c) |
769 | { | 769 | { |
770 | tlb_flushall_shift = 5; | 770 | tlb_flushall_shift = 6; |
771 | |||
772 | if (c->x86 <= 0x11) | ||
773 | tlb_flushall_shift = 4; | ||
774 | } | 771 | } |
775 | 772 | ||
776 | static void cpu_detect_tlb_amd(struct cpuinfo_x86 *c) | 773 | static void cpu_detect_tlb_amd(struct cpuinfo_x86 *c) |
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c index 3db61c644e44..5cd9bfabd645 100644 --- a/arch/x86/kernel/cpu/intel.c +++ b/arch/x86/kernel/cpu/intel.c | |||
@@ -640,21 +640,17 @@ static void intel_tlb_flushall_shift_set(struct cpuinfo_x86 *c) | |||
640 | case 0x61d: /* six-core 45 nm xeon "Dunnington" */ | 640 | case 0x61d: /* six-core 45 nm xeon "Dunnington" */ |
641 | tlb_flushall_shift = -1; | 641 | tlb_flushall_shift = -1; |
642 | break; | 642 | break; |
643 | case 0x63a: /* Ivybridge */ | ||
644 | tlb_flushall_shift = 2; | ||
645 | break; | ||
643 | case 0x61a: /* 45 nm nehalem, "Bloomfield" */ | 646 | case 0x61a: /* 45 nm nehalem, "Bloomfield" */ |
644 | case 0x61e: /* 45 nm nehalem, "Lynnfield" */ | 647 | case 0x61e: /* 45 nm nehalem, "Lynnfield" */ |
645 | case 0x625: /* 32 nm nehalem, "Clarkdale" */ | 648 | case 0x625: /* 32 nm nehalem, "Clarkdale" */ |
646 | case 0x62c: /* 32 nm nehalem, "Gulftown" */ | 649 | case 0x62c: /* 32 nm nehalem, "Gulftown" */ |
647 | case 0x62e: /* 45 nm nehalem-ex, "Beckton" */ | 650 | case 0x62e: /* 45 nm nehalem-ex, "Beckton" */ |
648 | case 0x62f: /* 32 nm Xeon E7 */ | 651 | case 0x62f: /* 32 nm Xeon E7 */ |
649 | tlb_flushall_shift = 6; | ||
650 | break; | ||
651 | case 0x62a: /* SandyBridge */ | 652 | case 0x62a: /* SandyBridge */ |
652 | case 0x62d: /* SandyBridge, "Romely-EP" */ | 653 | case 0x62d: /* SandyBridge, "Romely-EP" */ |
653 | tlb_flushall_shift = 5; | ||
654 | break; | ||
655 | case 0x63a: /* Ivybridge */ | ||
656 | tlb_flushall_shift = 1; | ||
657 | break; | ||
658 | default: | 654 | default: |
659 | tlb_flushall_shift = 6; | 655 | tlb_flushall_shift = 6; |
660 | } | 656 | } |
diff --git a/arch/x86/kernel/cpu/microcode/amd_early.c b/arch/x86/kernel/cpu/microcode/amd_early.c index 8384c0fa206f..617a9e284245 100644 --- a/arch/x86/kernel/cpu/microcode/amd_early.c +++ b/arch/x86/kernel/cpu/microcode/amd_early.c | |||
@@ -285,6 +285,15 @@ static void __init collect_cpu_sig_on_bsp(void *arg) | |||
285 | 285 | ||
286 | uci->cpu_sig.sig = cpuid_eax(0x00000001); | 286 | uci->cpu_sig.sig = cpuid_eax(0x00000001); |
287 | } | 287 | } |
288 | |||
289 | static void __init get_bsp_sig(void) | ||
290 | { | ||
291 | unsigned int bsp = boot_cpu_data.cpu_index; | ||
292 | struct ucode_cpu_info *uci = ucode_cpu_info + bsp; | ||
293 | |||
294 | if (!uci->cpu_sig.sig) | ||
295 | smp_call_function_single(bsp, collect_cpu_sig_on_bsp, NULL, 1); | ||
296 | } | ||
288 | #else | 297 | #else |
289 | void load_ucode_amd_ap(void) | 298 | void load_ucode_amd_ap(void) |
290 | { | 299 | { |
@@ -337,31 +346,37 @@ void load_ucode_amd_ap(void) | |||
337 | 346 | ||
338 | int __init save_microcode_in_initrd_amd(void) | 347 | int __init save_microcode_in_initrd_amd(void) |
339 | { | 348 | { |
349 | unsigned long cont; | ||
340 | enum ucode_state ret; | 350 | enum ucode_state ret; |
341 | u32 eax; | 351 | u32 eax; |
342 | 352 | ||
343 | #ifdef CONFIG_X86_32 | 353 | if (!container) |
344 | unsigned int bsp = boot_cpu_data.cpu_index; | 354 | return -EINVAL; |
345 | struct ucode_cpu_info *uci = ucode_cpu_info + bsp; | ||
346 | |||
347 | if (!uci->cpu_sig.sig) | ||
348 | smp_call_function_single(bsp, collect_cpu_sig_on_bsp, NULL, 1); | ||
349 | 355 | ||
356 | #ifdef CONFIG_X86_32 | ||
357 | get_bsp_sig(); | ||
358 | cont = (unsigned long)container; | ||
359 | #else | ||
350 | /* | 360 | /* |
351 | * Take into account the fact that the ramdisk might get relocated | 361 | * We need the physical address of the container for both bitness since |
352 | * and therefore we need to recompute the container's position in | 362 | * boot_params.hdr.ramdisk_image is a physical address. |
353 | * virtual memory space. | ||
354 | */ | 363 | */ |
355 | container = (u8 *)(__va((u32)relocated_ramdisk) + | 364 | cont = __pa(container); |
356 | ((u32)container - boot_params.hdr.ramdisk_image)); | ||
357 | #endif | 365 | #endif |
366 | |||
367 | /* | ||
368 | * Take into account the fact that the ramdisk might get relocated and | ||
369 | * therefore we need to recompute the container's position in virtual | ||
370 | * memory space. | ||
371 | */ | ||
372 | if (relocated_ramdisk) | ||
373 | container = (u8 *)(__va(relocated_ramdisk) + | ||
374 | (cont - boot_params.hdr.ramdisk_image)); | ||
375 | |||
358 | if (ucode_new_rev) | 376 | if (ucode_new_rev) |
359 | pr_info("microcode: updated early to new patch_level=0x%08x\n", | 377 | pr_info("microcode: updated early to new patch_level=0x%08x\n", |
360 | ucode_new_rev); | 378 | ucode_new_rev); |
361 | 379 | ||
362 | if (!container) | ||
363 | return -EINVAL; | ||
364 | |||
365 | eax = cpuid_eax(0x00000001); | 380 | eax = cpuid_eax(0x00000001); |
366 | eax = ((eax >> 8) & 0xf) + ((eax >> 20) & 0xff); | 381 | eax = ((eax >> 8) & 0xf) + ((eax >> 20) & 0xff); |
367 | 382 | ||
diff --git a/arch/x86/kernel/cpu/mtrr/generic.c b/arch/x86/kernel/cpu/mtrr/generic.c index ce2d0a2c3e4f..0e25a1bc5ab5 100644 --- a/arch/x86/kernel/cpu/mtrr/generic.c +++ b/arch/x86/kernel/cpu/mtrr/generic.c | |||
@@ -683,7 +683,7 @@ static void prepare_set(void) __acquires(set_atomicity_lock) | |||
683 | } | 683 | } |
684 | 684 | ||
685 | /* Flush all TLBs via a mov %cr3, %reg; mov %reg, %cr3 */ | 685 | /* Flush all TLBs via a mov %cr3, %reg; mov %reg, %cr3 */ |
686 | count_vm_event(NR_TLB_LOCAL_FLUSH_ALL); | 686 | count_vm_tlb_event(NR_TLB_LOCAL_FLUSH_ALL); |
687 | __flush_tlb(); | 687 | __flush_tlb(); |
688 | 688 | ||
689 | /* Save MTRR state */ | 689 | /* Save MTRR state */ |
@@ -697,7 +697,7 @@ static void prepare_set(void) __acquires(set_atomicity_lock) | |||
697 | static void post_set(void) __releases(set_atomicity_lock) | 697 | static void post_set(void) __releases(set_atomicity_lock) |
698 | { | 698 | { |
699 | /* Flush TLBs (no need to flush caches - they are disabled) */ | 699 | /* Flush TLBs (no need to flush caches - they are disabled) */ |
700 | count_vm_event(NR_TLB_LOCAL_FLUSH_ALL); | 700 | count_vm_tlb_event(NR_TLB_LOCAL_FLUSH_ALL); |
701 | __flush_tlb(); | 701 | __flush_tlb(); |
702 | 702 | ||
703 | /* Intel (P6) standard MTRRs */ | 703 | /* Intel (P6) standard MTRRs */ |
diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c index dbb60878b744..d99f31d9a750 100644 --- a/arch/x86/kernel/irq.c +++ b/arch/x86/kernel/irq.c | |||
@@ -266,6 +266,14 @@ __visible void smp_trace_x86_platform_ipi(struct pt_regs *regs) | |||
266 | EXPORT_SYMBOL_GPL(vector_used_by_percpu_irq); | 266 | EXPORT_SYMBOL_GPL(vector_used_by_percpu_irq); |
267 | 267 | ||
268 | #ifdef CONFIG_HOTPLUG_CPU | 268 | #ifdef CONFIG_HOTPLUG_CPU |
269 | |||
270 | /* These two declarations are only used in check_irq_vectors_for_cpu_disable() | ||
271 | * below, which is protected by stop_machine(). Putting them on the stack | ||
272 | * results in a stack frame overflow. Dynamically allocating could result in a | ||
273 | * failure so declare these two cpumasks as global. | ||
274 | */ | ||
275 | static struct cpumask affinity_new, online_new; | ||
276 | |||
269 | /* | 277 | /* |
270 | * This cpu is going to be removed and its vectors migrated to the remaining | 278 | * This cpu is going to be removed and its vectors migrated to the remaining |
271 | * online cpus. Check to see if there are enough vectors in the remaining cpus. | 279 | * online cpus. Check to see if there are enough vectors in the remaining cpus. |
@@ -277,7 +285,6 @@ int check_irq_vectors_for_cpu_disable(void) | |||
277 | unsigned int this_cpu, vector, this_count, count; | 285 | unsigned int this_cpu, vector, this_count, count; |
278 | struct irq_desc *desc; | 286 | struct irq_desc *desc; |
279 | struct irq_data *data; | 287 | struct irq_data *data; |
280 | struct cpumask affinity_new, online_new; | ||
281 | 288 | ||
282 | this_cpu = smp_processor_id(); | 289 | this_cpu = smp_processor_id(); |
283 | cpumask_copy(&online_new, cpu_online_mask); | 290 | cpumask_copy(&online_new, cpu_online_mask); |
diff --git a/arch/x86/kernel/quirks.c b/arch/x86/kernel/quirks.c index 04ee1e2e4c02..7c6acd4b8995 100644 --- a/arch/x86/kernel/quirks.c +++ b/arch/x86/kernel/quirks.c | |||
@@ -571,3 +571,40 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_NB_F5, | |||
571 | quirk_amd_nb_node); | 571 | quirk_amd_nb_node); |
572 | 572 | ||
573 | #endif | 573 | #endif |
574 | |||
575 | #ifdef CONFIG_PCI | ||
576 | /* | ||
577 | * Processor does not ensure DRAM scrub read/write sequence | ||
578 | * is atomic wrt accesses to CC6 save state area. Therefore | ||
579 | * if a concurrent scrub read/write access is to same address | ||
580 | * the entry may appear as if it is not written. This quirk | ||
581 | * applies to Fam16h models 00h-0Fh | ||
582 | * | ||
583 | * See "Revision Guide" for AMD F16h models 00h-0fh, | ||
584 | * document 51810 rev. 3.04, Nov 2013 | ||
585 | */ | ||
586 | static void amd_disable_seq_and_redirect_scrub(struct pci_dev *dev) | ||
587 | { | ||
588 | u32 val; | ||
589 | |||
590 | /* | ||
591 | * Suggested workaround: | ||
592 | * set D18F3x58[4:0] = 00h and set D18F3x5C[0] = 0b | ||
593 | */ | ||
594 | pci_read_config_dword(dev, 0x58, &val); | ||
595 | if (val & 0x1F) { | ||
596 | val &= ~(0x1F); | ||
597 | pci_write_config_dword(dev, 0x58, val); | ||
598 | } | ||
599 | |||
600 | pci_read_config_dword(dev, 0x5C, &val); | ||
601 | if (val & BIT(0)) { | ||
602 | val &= ~BIT(0); | ||
603 | pci_write_config_dword(dev, 0x5c, val); | ||
604 | } | ||
605 | } | ||
606 | |||
607 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_16H_NB_F3, | ||
608 | amd_disable_seq_and_redirect_scrub); | ||
609 | |||
610 | #endif | ||
diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c index 81b2750f3666..27aa0455fab3 100644 --- a/arch/x86/mm/numa.c +++ b/arch/x86/mm/numa.c | |||
@@ -493,14 +493,6 @@ static int __init numa_register_memblks(struct numa_meminfo *mi) | |||
493 | struct numa_memblk *mb = &mi->blk[i]; | 493 | struct numa_memblk *mb = &mi->blk[i]; |
494 | memblock_set_node(mb->start, mb->end - mb->start, | 494 | memblock_set_node(mb->start, mb->end - mb->start, |
495 | &memblock.memory, mb->nid); | 495 | &memblock.memory, mb->nid); |
496 | |||
497 | /* | ||
498 | * At this time, all memory regions reserved by memblock are | ||
499 | * used by the kernel. Set the nid in memblock.reserved will | ||
500 | * mark out all the nodes the kernel resides in. | ||
501 | */ | ||
502 | memblock_set_node(mb->start, mb->end - mb->start, | ||
503 | &memblock.reserved, mb->nid); | ||
504 | } | 496 | } |
505 | 497 | ||
506 | /* | 498 | /* |
@@ -565,10 +557,21 @@ static void __init numa_init_array(void) | |||
565 | static void __init numa_clear_kernel_node_hotplug(void) | 557 | static void __init numa_clear_kernel_node_hotplug(void) |
566 | { | 558 | { |
567 | int i, nid; | 559 | int i, nid; |
568 | nodemask_t numa_kernel_nodes; | 560 | nodemask_t numa_kernel_nodes = NODE_MASK_NONE; |
569 | unsigned long start, end; | 561 | unsigned long start, end; |
570 | struct memblock_type *type = &memblock.reserved; | 562 | struct memblock_type *type = &memblock.reserved; |
571 | 563 | ||
564 | /* | ||
565 | * At this time, all memory regions reserved by memblock are | ||
566 | * used by the kernel. Set the nid in memblock.reserved will | ||
567 | * mark out all the nodes the kernel resides in. | ||
568 | */ | ||
569 | for (i = 0; i < numa_meminfo.nr_blks; i++) { | ||
570 | struct numa_memblk *mb = &numa_meminfo.blk[i]; | ||
571 | memblock_set_node(mb->start, mb->end - mb->start, | ||
572 | &memblock.reserved, mb->nid); | ||
573 | } | ||
574 | |||
572 | /* Mark all kernel nodes. */ | 575 | /* Mark all kernel nodes. */ |
573 | for (i = 0; i < type->cnt; i++) | 576 | for (i = 0; i < type->cnt; i++) |
574 | node_set(type->regions[i].nid, numa_kernel_nodes); | 577 | node_set(type->regions[i].nid, numa_kernel_nodes); |
diff --git a/arch/x86/mm/numa_32.c b/arch/x86/mm/numa_32.c index 0342d27ca798..47b6436e41c2 100644 --- a/arch/x86/mm/numa_32.c +++ b/arch/x86/mm/numa_32.c | |||
@@ -52,6 +52,8 @@ void memory_present(int nid, unsigned long start, unsigned long end) | |||
52 | nid, start, end); | 52 | nid, start, end); |
53 | printk(KERN_DEBUG " Setting physnode_map array to node %d for pfns:\n", nid); | 53 | printk(KERN_DEBUG " Setting physnode_map array to node %d for pfns:\n", nid); |
54 | printk(KERN_DEBUG " "); | 54 | printk(KERN_DEBUG " "); |
55 | start = round_down(start, PAGES_PER_SECTION); | ||
56 | end = round_up(end, PAGES_PER_SECTION); | ||
55 | for (pfn = start; pfn < end; pfn += PAGES_PER_SECTION) { | 57 | for (pfn = start; pfn < end; pfn += PAGES_PER_SECTION) { |
56 | physnode_map[pfn / PAGES_PER_SECTION] = nid; | 58 | physnode_map[pfn / PAGES_PER_SECTION] = nid; |
57 | printk(KERN_CONT "%lx ", pfn); | 59 | printk(KERN_CONT "%lx ", pfn); |
diff --git a/arch/x86/mm/srat.c b/arch/x86/mm/srat.c index 1a25187e151e..1953e9c9391a 100644 --- a/arch/x86/mm/srat.c +++ b/arch/x86/mm/srat.c | |||
@@ -42,15 +42,25 @@ static __init inline int srat_disabled(void) | |||
42 | return acpi_numa < 0; | 42 | return acpi_numa < 0; |
43 | } | 43 | } |
44 | 44 | ||
45 | /* Callback for SLIT parsing */ | 45 | /* |
46 | * Callback for SLIT parsing. pxm_to_node() returns NUMA_NO_NODE for | ||
47 | * I/O localities since SRAT does not list them. I/O localities are | ||
48 | * not supported at this point. | ||
49 | */ | ||
46 | void __init acpi_numa_slit_init(struct acpi_table_slit *slit) | 50 | void __init acpi_numa_slit_init(struct acpi_table_slit *slit) |
47 | { | 51 | { |
48 | int i, j; | 52 | int i, j; |
49 | 53 | ||
50 | for (i = 0; i < slit->locality_count; i++) | 54 | for (i = 0; i < slit->locality_count; i++) { |
51 | for (j = 0; j < slit->locality_count; j++) | 55 | if (pxm_to_node(i) == NUMA_NO_NODE) |
56 | continue; | ||
57 | for (j = 0; j < slit->locality_count; j++) { | ||
58 | if (pxm_to_node(j) == NUMA_NO_NODE) | ||
59 | continue; | ||
52 | numa_set_distance(pxm_to_node(i), pxm_to_node(j), | 60 | numa_set_distance(pxm_to_node(i), pxm_to_node(j), |
53 | slit->entry[slit->locality_count * i + j]); | 61 | slit->entry[slit->locality_count * i + j]); |
62 | } | ||
63 | } | ||
54 | } | 64 | } |
55 | 65 | ||
56 | /* Callback for Proximity Domain -> x2APIC mapping */ | 66 | /* Callback for Proximity Domain -> x2APIC mapping */ |
diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c index ae699b3bbac8..dd8dda167a24 100644 --- a/arch/x86/mm/tlb.c +++ b/arch/x86/mm/tlb.c | |||
@@ -103,7 +103,7 @@ static void flush_tlb_func(void *info) | |||
103 | if (f->flush_mm != this_cpu_read(cpu_tlbstate.active_mm)) | 103 | if (f->flush_mm != this_cpu_read(cpu_tlbstate.active_mm)) |
104 | return; | 104 | return; |
105 | 105 | ||
106 | count_vm_event(NR_TLB_REMOTE_FLUSH_RECEIVED); | 106 | count_vm_tlb_event(NR_TLB_REMOTE_FLUSH_RECEIVED); |
107 | if (this_cpu_read(cpu_tlbstate.state) == TLBSTATE_OK) { | 107 | if (this_cpu_read(cpu_tlbstate.state) == TLBSTATE_OK) { |
108 | if (f->flush_end == TLB_FLUSH_ALL) | 108 | if (f->flush_end == TLB_FLUSH_ALL) |
109 | local_flush_tlb(); | 109 | local_flush_tlb(); |
@@ -131,7 +131,7 @@ void native_flush_tlb_others(const struct cpumask *cpumask, | |||
131 | info.flush_start = start; | 131 | info.flush_start = start; |
132 | info.flush_end = end; | 132 | info.flush_end = end; |
133 | 133 | ||
134 | count_vm_event(NR_TLB_REMOTE_FLUSH); | 134 | count_vm_tlb_event(NR_TLB_REMOTE_FLUSH); |
135 | if (is_uv_system()) { | 135 | if (is_uv_system()) { |
136 | unsigned int cpu; | 136 | unsigned int cpu; |
137 | 137 | ||
@@ -151,44 +151,19 @@ void flush_tlb_current_task(void) | |||
151 | 151 | ||
152 | preempt_disable(); | 152 | preempt_disable(); |
153 | 153 | ||
154 | count_vm_event(NR_TLB_LOCAL_FLUSH_ALL); | 154 | count_vm_tlb_event(NR_TLB_LOCAL_FLUSH_ALL); |
155 | local_flush_tlb(); | 155 | local_flush_tlb(); |
156 | if (cpumask_any_but(mm_cpumask(mm), smp_processor_id()) < nr_cpu_ids) | 156 | if (cpumask_any_but(mm_cpumask(mm), smp_processor_id()) < nr_cpu_ids) |
157 | flush_tlb_others(mm_cpumask(mm), mm, 0UL, TLB_FLUSH_ALL); | 157 | flush_tlb_others(mm_cpumask(mm), mm, 0UL, TLB_FLUSH_ALL); |
158 | preempt_enable(); | 158 | preempt_enable(); |
159 | } | 159 | } |
160 | 160 | ||
161 | /* | ||
162 | * It can find out the THP large page, or | ||
163 | * HUGETLB page in tlb_flush when THP disabled | ||
164 | */ | ||
165 | static inline unsigned long has_large_page(struct mm_struct *mm, | ||
166 | unsigned long start, unsigned long end) | ||
167 | { | ||
168 | pgd_t *pgd; | ||
169 | pud_t *pud; | ||
170 | pmd_t *pmd; | ||
171 | unsigned long addr = ALIGN(start, HPAGE_SIZE); | ||
172 | for (; addr < end; addr += HPAGE_SIZE) { | ||
173 | pgd = pgd_offset(mm, addr); | ||
174 | if (likely(!pgd_none(*pgd))) { | ||
175 | pud = pud_offset(pgd, addr); | ||
176 | if (likely(!pud_none(*pud))) { | ||
177 | pmd = pmd_offset(pud, addr); | ||
178 | if (likely(!pmd_none(*pmd))) | ||
179 | if (pmd_large(*pmd)) | ||
180 | return addr; | ||
181 | } | ||
182 | } | ||
183 | } | ||
184 | return 0; | ||
185 | } | ||
186 | |||
187 | void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start, | 161 | void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start, |
188 | unsigned long end, unsigned long vmflag) | 162 | unsigned long end, unsigned long vmflag) |
189 | { | 163 | { |
190 | unsigned long addr; | 164 | unsigned long addr; |
191 | unsigned act_entries, tlb_entries = 0; | 165 | unsigned act_entries, tlb_entries = 0; |
166 | unsigned long nr_base_pages; | ||
192 | 167 | ||
193 | preempt_disable(); | 168 | preempt_disable(); |
194 | if (current->active_mm != mm) | 169 | if (current->active_mm != mm) |
@@ -210,21 +185,20 @@ void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start, | |||
210 | tlb_entries = tlb_lli_4k[ENTRIES]; | 185 | tlb_entries = tlb_lli_4k[ENTRIES]; |
211 | else | 186 | else |
212 | tlb_entries = tlb_lld_4k[ENTRIES]; | 187 | tlb_entries = tlb_lld_4k[ENTRIES]; |
188 | |||
213 | /* Assume all of TLB entries was occupied by this task */ | 189 | /* Assume all of TLB entries was occupied by this task */ |
214 | act_entries = mm->total_vm > tlb_entries ? tlb_entries : mm->total_vm; | 190 | act_entries = tlb_entries >> tlb_flushall_shift; |
191 | act_entries = mm->total_vm > act_entries ? act_entries : mm->total_vm; | ||
192 | nr_base_pages = (end - start) >> PAGE_SHIFT; | ||
215 | 193 | ||
216 | /* tlb_flushall_shift is on balance point, details in commit log */ | 194 | /* tlb_flushall_shift is on balance point, details in commit log */ |
217 | if ((end - start) >> PAGE_SHIFT > act_entries >> tlb_flushall_shift) { | 195 | if (nr_base_pages > act_entries) { |
218 | count_vm_event(NR_TLB_LOCAL_FLUSH_ALL); | 196 | count_vm_tlb_event(NR_TLB_LOCAL_FLUSH_ALL); |
219 | local_flush_tlb(); | 197 | local_flush_tlb(); |
220 | } else { | 198 | } else { |
221 | if (has_large_page(mm, start, end)) { | ||
222 | local_flush_tlb(); | ||
223 | goto flush_all; | ||
224 | } | ||
225 | /* flush range by one by one 'invlpg' */ | 199 | /* flush range by one by one 'invlpg' */ |
226 | for (addr = start; addr < end; addr += PAGE_SIZE) { | 200 | for (addr = start; addr < end; addr += PAGE_SIZE) { |
227 | count_vm_event(NR_TLB_LOCAL_FLUSH_ONE); | 201 | count_vm_tlb_event(NR_TLB_LOCAL_FLUSH_ONE); |
228 | __flush_tlb_single(addr); | 202 | __flush_tlb_single(addr); |
229 | } | 203 | } |
230 | 204 | ||
@@ -262,7 +236,7 @@ void flush_tlb_page(struct vm_area_struct *vma, unsigned long start) | |||
262 | 236 | ||
263 | static void do_flush_tlb_all(void *info) | 237 | static void do_flush_tlb_all(void *info) |
264 | { | 238 | { |
265 | count_vm_event(NR_TLB_REMOTE_FLUSH_RECEIVED); | 239 | count_vm_tlb_event(NR_TLB_REMOTE_FLUSH_RECEIVED); |
266 | __flush_tlb_all(); | 240 | __flush_tlb_all(); |
267 | if (this_cpu_read(cpu_tlbstate.state) == TLBSTATE_LAZY) | 241 | if (this_cpu_read(cpu_tlbstate.state) == TLBSTATE_LAZY) |
268 | leave_mm(smp_processor_id()); | 242 | leave_mm(smp_processor_id()); |
@@ -270,7 +244,7 @@ static void do_flush_tlb_all(void *info) | |||
270 | 244 | ||
271 | void flush_tlb_all(void) | 245 | void flush_tlb_all(void) |
272 | { | 246 | { |
273 | count_vm_event(NR_TLB_REMOTE_FLUSH); | 247 | count_vm_tlb_event(NR_TLB_REMOTE_FLUSH); |
274 | on_each_cpu(do_flush_tlb_all, NULL, 1); | 248 | on_each_cpu(do_flush_tlb_all, NULL, 1); |
275 | } | 249 | } |
276 | 250 | ||
diff --git a/arch/x86/platform/efi/efi-bgrt.c b/arch/x86/platform/efi/efi-bgrt.c index 7145ec63c520..4df9591eadad 100644 --- a/arch/x86/platform/efi/efi-bgrt.c +++ b/arch/x86/platform/efi/efi-bgrt.c | |||
@@ -49,7 +49,8 @@ void __init efi_bgrt_init(void) | |||
49 | 49 | ||
50 | image = efi_lookup_mapped_addr(bgrt_tab->image_address); | 50 | image = efi_lookup_mapped_addr(bgrt_tab->image_address); |
51 | if (!image) { | 51 | if (!image) { |
52 | image = ioremap(bgrt_tab->image_address, sizeof(bmp_header)); | 52 | image = early_memremap(bgrt_tab->image_address, |
53 | sizeof(bmp_header)); | ||
53 | ioremapped = true; | 54 | ioremapped = true; |
54 | if (!image) | 55 | if (!image) |
55 | return; | 56 | return; |
@@ -57,7 +58,7 @@ void __init efi_bgrt_init(void) | |||
57 | 58 | ||
58 | memcpy_fromio(&bmp_header, image, sizeof(bmp_header)); | 59 | memcpy_fromio(&bmp_header, image, sizeof(bmp_header)); |
59 | if (ioremapped) | 60 | if (ioremapped) |
60 | iounmap(image); | 61 | early_iounmap(image, sizeof(bmp_header)); |
61 | bgrt_image_size = bmp_header.size; | 62 | bgrt_image_size = bmp_header.size; |
62 | 63 | ||
63 | bgrt_image = kmalloc(bgrt_image_size, GFP_KERNEL); | 64 | bgrt_image = kmalloc(bgrt_image_size, GFP_KERNEL); |
@@ -65,7 +66,8 @@ void __init efi_bgrt_init(void) | |||
65 | return; | 66 | return; |
66 | 67 | ||
67 | if (ioremapped) { | 68 | if (ioremapped) { |
68 | image = ioremap(bgrt_tab->image_address, bmp_header.size); | 69 | image = early_memremap(bgrt_tab->image_address, |
70 | bmp_header.size); | ||
69 | if (!image) { | 71 | if (!image) { |
70 | kfree(bgrt_image); | 72 | kfree(bgrt_image); |
71 | bgrt_image = NULL; | 73 | bgrt_image = NULL; |
@@ -75,5 +77,5 @@ void __init efi_bgrt_init(void) | |||
75 | 77 | ||
76 | memcpy_fromio(bgrt_image, image, bgrt_image_size); | 78 | memcpy_fromio(bgrt_image, image, bgrt_image_size); |
77 | if (ioremapped) | 79 | if (ioremapped) |
78 | iounmap(image); | 80 | early_iounmap(image, bmp_header.size); |
79 | } | 81 | } |
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index a4d7b647867f..201d09a7c46b 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c | |||
@@ -1473,6 +1473,18 @@ static void xen_pvh_set_cr_flags(int cpu) | |||
1473 | * X86_CR0_TS, X86_CR0_PE, X86_CR0_ET are set by Xen for HVM guests | 1473 | * X86_CR0_TS, X86_CR0_PE, X86_CR0_ET are set by Xen for HVM guests |
1474 | * (which PVH shared codepaths), while X86_CR0_PG is for PVH. */ | 1474 | * (which PVH shared codepaths), while X86_CR0_PG is for PVH. */ |
1475 | write_cr0(read_cr0() | X86_CR0_MP | X86_CR0_NE | X86_CR0_WP | X86_CR0_AM); | 1475 | write_cr0(read_cr0() | X86_CR0_MP | X86_CR0_NE | X86_CR0_WP | X86_CR0_AM); |
1476 | |||
1477 | if (!cpu) | ||
1478 | return; | ||
1479 | /* | ||
1480 | * For BSP, PSE PGE are set in probe_page_size_mask(), for APs | ||
1481 | * set them here. For all, OSFXSR OSXMMEXCPT are set in fpu_init. | ||
1482 | */ | ||
1483 | if (cpu_has_pse) | ||
1484 | set_in_cr4(X86_CR4_PSE); | ||
1485 | |||
1486 | if (cpu_has_pge) | ||
1487 | set_in_cr4(X86_CR4_PGE); | ||
1476 | } | 1488 | } |
1477 | 1489 | ||
1478 | /* | 1490 | /* |
diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c index 8009acbe41e4..696c694986d0 100644 --- a/arch/x86/xen/p2m.c +++ b/arch/x86/xen/p2m.c | |||
@@ -899,6 +899,13 @@ int m2p_add_override(unsigned long mfn, struct page *page, | |||
899 | "m2p_add_override: pfn %lx not mapped", pfn)) | 899 | "m2p_add_override: pfn %lx not mapped", pfn)) |
900 | return -EINVAL; | 900 | return -EINVAL; |
901 | } | 901 | } |
902 | WARN_ON(PagePrivate(page)); | ||
903 | SetPagePrivate(page); | ||
904 | set_page_private(page, mfn); | ||
905 | page->index = pfn_to_mfn(pfn); | ||
906 | |||
907 | if (unlikely(!set_phys_to_machine(pfn, FOREIGN_FRAME(mfn)))) | ||
908 | return -ENOMEM; | ||
902 | 909 | ||
903 | if (kmap_op != NULL) { | 910 | if (kmap_op != NULL) { |
904 | if (!PageHighMem(page)) { | 911 | if (!PageHighMem(page)) { |
@@ -937,16 +944,19 @@ int m2p_add_override(unsigned long mfn, struct page *page, | |||
937 | } | 944 | } |
938 | EXPORT_SYMBOL_GPL(m2p_add_override); | 945 | EXPORT_SYMBOL_GPL(m2p_add_override); |
939 | int m2p_remove_override(struct page *page, | 946 | int m2p_remove_override(struct page *page, |
940 | struct gnttab_map_grant_ref *kmap_op, | 947 | struct gnttab_map_grant_ref *kmap_op) |
941 | unsigned long mfn) | ||
942 | { | 948 | { |
943 | unsigned long flags; | 949 | unsigned long flags; |
950 | unsigned long mfn; | ||
944 | unsigned long pfn; | 951 | unsigned long pfn; |
945 | unsigned long uninitialized_var(address); | 952 | unsigned long uninitialized_var(address); |
946 | unsigned level; | 953 | unsigned level; |
947 | pte_t *ptep = NULL; | 954 | pte_t *ptep = NULL; |
948 | 955 | ||
949 | pfn = page_to_pfn(page); | 956 | pfn = page_to_pfn(page); |
957 | mfn = get_phys_to_machine(pfn); | ||
958 | if (mfn == INVALID_P2M_ENTRY || !(mfn & FOREIGN_FRAME_BIT)) | ||
959 | return -EINVAL; | ||
950 | 960 | ||
951 | if (!PageHighMem(page)) { | 961 | if (!PageHighMem(page)) { |
952 | address = (unsigned long)__va(pfn << PAGE_SHIFT); | 962 | address = (unsigned long)__va(pfn << PAGE_SHIFT); |
@@ -960,7 +970,10 @@ int m2p_remove_override(struct page *page, | |||
960 | spin_lock_irqsave(&m2p_override_lock, flags); | 970 | spin_lock_irqsave(&m2p_override_lock, flags); |
961 | list_del(&page->lru); | 971 | list_del(&page->lru); |
962 | spin_unlock_irqrestore(&m2p_override_lock, flags); | 972 | spin_unlock_irqrestore(&m2p_override_lock, flags); |
973 | WARN_ON(!PagePrivate(page)); | ||
974 | ClearPagePrivate(page); | ||
963 | 975 | ||
976 | set_phys_to_machine(pfn, page->index); | ||
964 | if (kmap_op != NULL) { | 977 | if (kmap_op != NULL) { |
965 | if (!PageHighMem(page)) { | 978 | if (!PageHighMem(page)) { |
966 | struct multicall_space mcs; | 979 | struct multicall_space mcs; |