Annotation of /trunk/kernel-alx/patches-5.4/0248-5.4.149-all-fixes.patch
Parent Directory | Revision Log
Revision 3635 -
(hide annotations)
(download)
Mon Oct 24 12:34:12 2022 UTC (19 months, 1 week ago) by niro
File size: 58360 byte(s)
Mon Oct 24 12:34:12 2022 UTC (19 months, 1 week ago) by niro
File size: 58360 byte(s)
-sync kernel patches
1 | niro | 3635 | diff --git a/Makefile b/Makefile |
2 | index b84706c6d6248..1834f47fbaf61 100644 | ||
3 | --- a/Makefile | ||
4 | +++ b/Makefile | ||
5 | @@ -1,7 +1,7 @@ | ||
6 | # SPDX-License-Identifier: GPL-2.0 | ||
7 | VERSION = 5 | ||
8 | PATCHLEVEL = 4 | ||
9 | -SUBLEVEL = 148 | ||
10 | +SUBLEVEL = 149 | ||
11 | EXTRAVERSION = | ||
12 | NAME = Kleptomaniac Octopus | ||
13 | |||
14 | diff --git a/arch/arm/include/asm/ftrace.h b/arch/arm/include/asm/ftrace.h | ||
15 | index 18b0197f23848..15bd9af13497f 100644 | ||
16 | --- a/arch/arm/include/asm/ftrace.h | ||
17 | +++ b/arch/arm/include/asm/ftrace.h | ||
18 | @@ -16,6 +16,9 @@ extern void __gnu_mcount_nc(void); | ||
19 | |||
20 | #ifdef CONFIG_DYNAMIC_FTRACE | ||
21 | struct dyn_arch_ftrace { | ||
22 | +#ifdef CONFIG_ARM_MODULE_PLTS | ||
23 | + struct module *mod; | ||
24 | +#endif | ||
25 | }; | ||
26 | |||
27 | static inline unsigned long ftrace_call_adjust(unsigned long addr) | ||
28 | diff --git a/arch/arm/include/asm/insn.h b/arch/arm/include/asm/insn.h | ||
29 | index f20e08ac85aeb..5475cbf9fb6b4 100644 | ||
30 | --- a/arch/arm/include/asm/insn.h | ||
31 | +++ b/arch/arm/include/asm/insn.h | ||
32 | @@ -13,18 +13,18 @@ arm_gen_nop(void) | ||
33 | } | ||
34 | |||
35 | unsigned long | ||
36 | -__arm_gen_branch(unsigned long pc, unsigned long addr, bool link); | ||
37 | +__arm_gen_branch(unsigned long pc, unsigned long addr, bool link, bool warn); | ||
38 | |||
39 | static inline unsigned long | ||
40 | arm_gen_branch(unsigned long pc, unsigned long addr) | ||
41 | { | ||
42 | - return __arm_gen_branch(pc, addr, false); | ||
43 | + return __arm_gen_branch(pc, addr, false, true); | ||
44 | } | ||
45 | |||
46 | static inline unsigned long | ||
47 | -arm_gen_branch_link(unsigned long pc, unsigned long addr) | ||
48 | +arm_gen_branch_link(unsigned long pc, unsigned long addr, bool warn) | ||
49 | { | ||
50 | - return __arm_gen_branch(pc, addr, true); | ||
51 | + return __arm_gen_branch(pc, addr, true, warn); | ||
52 | } | ||
53 | |||
54 | #endif | ||
55 | diff --git a/arch/arm/include/asm/module.h b/arch/arm/include/asm/module.h | ||
56 | index 182163b55546c..961fedbd810ec 100644 | ||
57 | --- a/arch/arm/include/asm/module.h | ||
58 | +++ b/arch/arm/include/asm/module.h | ||
59 | @@ -19,8 +19,18 @@ enum { | ||
60 | }; | ||
61 | #endif | ||
62 | |||
63 | +#define PLT_ENT_STRIDE L1_CACHE_BYTES | ||
64 | +#define PLT_ENT_COUNT (PLT_ENT_STRIDE / sizeof(u32)) | ||
65 | +#define PLT_ENT_SIZE (sizeof(struct plt_entries) / PLT_ENT_COUNT) | ||
66 | + | ||
67 | +struct plt_entries { | ||
68 | + u32 ldr[PLT_ENT_COUNT]; | ||
69 | + u32 lit[PLT_ENT_COUNT]; | ||
70 | +}; | ||
71 | + | ||
72 | struct mod_plt_sec { | ||
73 | struct elf32_shdr *plt; | ||
74 | + struct plt_entries *plt_ent; | ||
75 | int plt_count; | ||
76 | }; | ||
77 | |||
78 | diff --git a/arch/arm/kernel/ftrace.c b/arch/arm/kernel/ftrace.c | ||
79 | index bda949fd84e8b..12b6da56f88dd 100644 | ||
80 | --- a/arch/arm/kernel/ftrace.c | ||
81 | +++ b/arch/arm/kernel/ftrace.c | ||
82 | @@ -71,9 +71,10 @@ int ftrace_arch_code_modify_post_process(void) | ||
83 | return 0; | ||
84 | } | ||
85 | |||
86 | -static unsigned long ftrace_call_replace(unsigned long pc, unsigned long addr) | ||
87 | +static unsigned long ftrace_call_replace(unsigned long pc, unsigned long addr, | ||
88 | + bool warn) | ||
89 | { | ||
90 | - return arm_gen_branch_link(pc, addr); | ||
91 | + return arm_gen_branch_link(pc, addr, warn); | ||
92 | } | ||
93 | |||
94 | static int ftrace_modify_code(unsigned long pc, unsigned long old, | ||
95 | @@ -112,14 +113,14 @@ int ftrace_update_ftrace_func(ftrace_func_t func) | ||
96 | int ret; | ||
97 | |||
98 | pc = (unsigned long)&ftrace_call; | ||
99 | - new = ftrace_call_replace(pc, (unsigned long)func); | ||
100 | + new = ftrace_call_replace(pc, (unsigned long)func, true); | ||
101 | |||
102 | ret = ftrace_modify_code(pc, 0, new, false); | ||
103 | |||
104 | #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS | ||
105 | if (!ret) { | ||
106 | pc = (unsigned long)&ftrace_regs_call; | ||
107 | - new = ftrace_call_replace(pc, (unsigned long)func); | ||
108 | + new = ftrace_call_replace(pc, (unsigned long)func, true); | ||
109 | |||
110 | ret = ftrace_modify_code(pc, 0, new, false); | ||
111 | } | ||
112 | @@ -132,10 +133,22 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) | ||
113 | { | ||
114 | unsigned long new, old; | ||
115 | unsigned long ip = rec->ip; | ||
116 | + unsigned long aaddr = adjust_address(rec, addr); | ||
117 | + struct module *mod = NULL; | ||
118 | + | ||
119 | +#ifdef CONFIG_ARM_MODULE_PLTS | ||
120 | + mod = rec->arch.mod; | ||
121 | +#endif | ||
122 | |||
123 | old = ftrace_nop_replace(rec); | ||
124 | |||
125 | - new = ftrace_call_replace(ip, adjust_address(rec, addr)); | ||
126 | + new = ftrace_call_replace(ip, aaddr, !mod); | ||
127 | +#ifdef CONFIG_ARM_MODULE_PLTS | ||
128 | + if (!new && mod) { | ||
129 | + aaddr = get_module_plt(mod, ip, aaddr); | ||
130 | + new = ftrace_call_replace(ip, aaddr, true); | ||
131 | + } | ||
132 | +#endif | ||
133 | |||
134 | return ftrace_modify_code(rec->ip, old, new, true); | ||
135 | } | ||
136 | @@ -148,9 +161,9 @@ int ftrace_modify_call(struct dyn_ftrace *rec, unsigned long old_addr, | ||
137 | unsigned long new, old; | ||
138 | unsigned long ip = rec->ip; | ||
139 | |||
140 | - old = ftrace_call_replace(ip, adjust_address(rec, old_addr)); | ||
141 | + old = ftrace_call_replace(ip, adjust_address(rec, old_addr), true); | ||
142 | |||
143 | - new = ftrace_call_replace(ip, adjust_address(rec, addr)); | ||
144 | + new = ftrace_call_replace(ip, adjust_address(rec, addr), true); | ||
145 | |||
146 | return ftrace_modify_code(rec->ip, old, new, true); | ||
147 | } | ||
148 | @@ -160,12 +173,29 @@ int ftrace_modify_call(struct dyn_ftrace *rec, unsigned long old_addr, | ||
149 | int ftrace_make_nop(struct module *mod, | ||
150 | struct dyn_ftrace *rec, unsigned long addr) | ||
151 | { | ||
152 | + unsigned long aaddr = adjust_address(rec, addr); | ||
153 | unsigned long ip = rec->ip; | ||
154 | unsigned long old; | ||
155 | unsigned long new; | ||
156 | int ret; | ||
157 | |||
158 | - old = ftrace_call_replace(ip, adjust_address(rec, addr)); | ||
159 | +#ifdef CONFIG_ARM_MODULE_PLTS | ||
160 | + /* mod is only supplied during module loading */ | ||
161 | + if (!mod) | ||
162 | + mod = rec->arch.mod; | ||
163 | + else | ||
164 | + rec->arch.mod = mod; | ||
165 | +#endif | ||
166 | + | ||
167 | + old = ftrace_call_replace(ip, aaddr, | ||
168 | + !IS_ENABLED(CONFIG_ARM_MODULE_PLTS) || !mod); | ||
169 | +#ifdef CONFIG_ARM_MODULE_PLTS | ||
170 | + if (!old && mod) { | ||
171 | + aaddr = get_module_plt(mod, ip, aaddr); | ||
172 | + old = ftrace_call_replace(ip, aaddr, true); | ||
173 | + } | ||
174 | +#endif | ||
175 | + | ||
176 | new = ftrace_nop_replace(rec); | ||
177 | ret = ftrace_modify_code(ip, old, new, true); | ||
178 | |||
179 | diff --git a/arch/arm/kernel/insn.c b/arch/arm/kernel/insn.c | ||
180 | index 2e844b70386b3..db0acbb7d7a02 100644 | ||
181 | --- a/arch/arm/kernel/insn.c | ||
182 | +++ b/arch/arm/kernel/insn.c | ||
183 | @@ -3,8 +3,9 @@ | ||
184 | #include <linux/kernel.h> | ||
185 | #include <asm/opcodes.h> | ||
186 | |||
187 | -static unsigned long | ||
188 | -__arm_gen_branch_thumb2(unsigned long pc, unsigned long addr, bool link) | ||
189 | +static unsigned long __arm_gen_branch_thumb2(unsigned long pc, | ||
190 | + unsigned long addr, bool link, | ||
191 | + bool warn) | ||
192 | { | ||
193 | unsigned long s, j1, j2, i1, i2, imm10, imm11; | ||
194 | unsigned long first, second; | ||
195 | @@ -12,7 +13,7 @@ __arm_gen_branch_thumb2(unsigned long pc, unsigned long addr, bool link) | ||
196 | |||
197 | offset = (long)addr - (long)(pc + 4); | ||
198 | if (offset < -16777216 || offset > 16777214) { | ||
199 | - WARN_ON_ONCE(1); | ||
200 | + WARN_ON_ONCE(warn); | ||
201 | return 0; | ||
202 | } | ||
203 | |||
204 | @@ -33,8 +34,8 @@ __arm_gen_branch_thumb2(unsigned long pc, unsigned long addr, bool link) | ||
205 | return __opcode_thumb32_compose(first, second); | ||
206 | } | ||
207 | |||
208 | -static unsigned long | ||
209 | -__arm_gen_branch_arm(unsigned long pc, unsigned long addr, bool link) | ||
210 | +static unsigned long __arm_gen_branch_arm(unsigned long pc, unsigned long addr, | ||
211 | + bool link, bool warn) | ||
212 | { | ||
213 | unsigned long opcode = 0xea000000; | ||
214 | long offset; | ||
215 | @@ -44,7 +45,7 @@ __arm_gen_branch_arm(unsigned long pc, unsigned long addr, bool link) | ||
216 | |||
217 | offset = (long)addr - (long)(pc + 8); | ||
218 | if (unlikely(offset < -33554432 || offset > 33554428)) { | ||
219 | - WARN_ON_ONCE(1); | ||
220 | + WARN_ON_ONCE(warn); | ||
221 | return 0; | ||
222 | } | ||
223 | |||
224 | @@ -54,10 +55,10 @@ __arm_gen_branch_arm(unsigned long pc, unsigned long addr, bool link) | ||
225 | } | ||
226 | |||
227 | unsigned long | ||
228 | -__arm_gen_branch(unsigned long pc, unsigned long addr, bool link) | ||
229 | +__arm_gen_branch(unsigned long pc, unsigned long addr, bool link, bool warn) | ||
230 | { | ||
231 | if (IS_ENABLED(CONFIG_THUMB2_KERNEL)) | ||
232 | - return __arm_gen_branch_thumb2(pc, addr, link); | ||
233 | + return __arm_gen_branch_thumb2(pc, addr, link, warn); | ||
234 | else | ||
235 | - return __arm_gen_branch_arm(pc, addr, link); | ||
236 | + return __arm_gen_branch_arm(pc, addr, link, warn); | ||
237 | } | ||
238 | diff --git a/arch/arm/kernel/module-plts.c b/arch/arm/kernel/module-plts.c | ||
239 | index b647741c0ab06..d1c2d3bd55b64 100644 | ||
240 | --- a/arch/arm/kernel/module-plts.c | ||
241 | +++ b/arch/arm/kernel/module-plts.c | ||
242 | @@ -4,6 +4,7 @@ | ||
243 | */ | ||
244 | |||
245 | #include <linux/elf.h> | ||
246 | +#include <linux/ftrace.h> | ||
247 | #include <linux/kernel.h> | ||
248 | #include <linux/module.h> | ||
249 | #include <linux/sort.h> | ||
250 | @@ -11,10 +12,6 @@ | ||
251 | #include <asm/cache.h> | ||
252 | #include <asm/opcodes.h> | ||
253 | |||
254 | -#define PLT_ENT_STRIDE L1_CACHE_BYTES | ||
255 | -#define PLT_ENT_COUNT (PLT_ENT_STRIDE / sizeof(u32)) | ||
256 | -#define PLT_ENT_SIZE (sizeof(struct plt_entries) / PLT_ENT_COUNT) | ||
257 | - | ||
258 | #ifdef CONFIG_THUMB2_KERNEL | ||
259 | #define PLT_ENT_LDR __opcode_to_mem_thumb32(0xf8dff000 | \ | ||
260 | (PLT_ENT_STRIDE - 4)) | ||
261 | @@ -23,9 +20,11 @@ | ||
262 | (PLT_ENT_STRIDE - 8)) | ||
263 | #endif | ||
264 | |||
265 | -struct plt_entries { | ||
266 | - u32 ldr[PLT_ENT_COUNT]; | ||
267 | - u32 lit[PLT_ENT_COUNT]; | ||
268 | +static const u32 fixed_plts[] = { | ||
269 | +#ifdef CONFIG_DYNAMIC_FTRACE | ||
270 | + FTRACE_ADDR, | ||
271 | + MCOUNT_ADDR, | ||
272 | +#endif | ||
273 | }; | ||
274 | |||
275 | static bool in_init(const struct module *mod, unsigned long loc) | ||
276 | @@ -33,14 +32,40 @@ static bool in_init(const struct module *mod, unsigned long loc) | ||
277 | return loc - (u32)mod->init_layout.base < mod->init_layout.size; | ||
278 | } | ||
279 | |||
280 | +static void prealloc_fixed(struct mod_plt_sec *pltsec, struct plt_entries *plt) | ||
281 | +{ | ||
282 | + int i; | ||
283 | + | ||
284 | + if (!ARRAY_SIZE(fixed_plts) || pltsec->plt_count) | ||
285 | + return; | ||
286 | + pltsec->plt_count = ARRAY_SIZE(fixed_plts); | ||
287 | + | ||
288 | + for (i = 0; i < ARRAY_SIZE(plt->ldr); ++i) | ||
289 | + plt->ldr[i] = PLT_ENT_LDR; | ||
290 | + | ||
291 | + BUILD_BUG_ON(sizeof(fixed_plts) > sizeof(plt->lit)); | ||
292 | + memcpy(plt->lit, fixed_plts, sizeof(fixed_plts)); | ||
293 | +} | ||
294 | + | ||
295 | u32 get_module_plt(struct module *mod, unsigned long loc, Elf32_Addr val) | ||
296 | { | ||
297 | struct mod_plt_sec *pltsec = !in_init(mod, loc) ? &mod->arch.core : | ||
298 | &mod->arch.init; | ||
299 | + struct plt_entries *plt; | ||
300 | + int idx; | ||
301 | + | ||
302 | + /* cache the address, ELF header is available only during module load */ | ||
303 | + if (!pltsec->plt_ent) | ||
304 | + pltsec->plt_ent = (struct plt_entries *)pltsec->plt->sh_addr; | ||
305 | + plt = pltsec->plt_ent; | ||
306 | |||
307 | - struct plt_entries *plt = (struct plt_entries *)pltsec->plt->sh_addr; | ||
308 | - int idx = 0; | ||
309 | + prealloc_fixed(pltsec, plt); | ||
310 | + | ||
311 | + for (idx = 0; idx < ARRAY_SIZE(fixed_plts); ++idx) | ||
312 | + if (plt->lit[idx] == val) | ||
313 | + return (u32)&plt->ldr[idx]; | ||
314 | |||
315 | + idx = 0; | ||
316 | /* | ||
317 | * Look for an existing entry pointing to 'val'. Given that the | ||
318 | * relocations are sorted, this will be the last entry we allocated. | ||
319 | @@ -188,8 +213,8 @@ static unsigned int count_plts(const Elf32_Sym *syms, Elf32_Addr base, | ||
320 | int module_frob_arch_sections(Elf_Ehdr *ehdr, Elf_Shdr *sechdrs, | ||
321 | char *secstrings, struct module *mod) | ||
322 | { | ||
323 | - unsigned long core_plts = 0; | ||
324 | - unsigned long init_plts = 0; | ||
325 | + unsigned long core_plts = ARRAY_SIZE(fixed_plts); | ||
326 | + unsigned long init_plts = ARRAY_SIZE(fixed_plts); | ||
327 | Elf32_Shdr *s, *sechdrs_end = sechdrs + ehdr->e_shnum; | ||
328 | Elf32_Sym *syms = NULL; | ||
329 | |||
330 | @@ -244,6 +269,7 @@ int module_frob_arch_sections(Elf_Ehdr *ehdr, Elf_Shdr *sechdrs, | ||
331 | mod->arch.core.plt->sh_size = round_up(core_plts * PLT_ENT_SIZE, | ||
332 | sizeof(struct plt_entries)); | ||
333 | mod->arch.core.plt_count = 0; | ||
334 | + mod->arch.core.plt_ent = NULL; | ||
335 | |||
336 | mod->arch.init.plt->sh_type = SHT_NOBITS; | ||
337 | mod->arch.init.plt->sh_flags = SHF_EXECINSTR | SHF_ALLOC; | ||
338 | @@ -251,6 +277,7 @@ int module_frob_arch_sections(Elf_Ehdr *ehdr, Elf_Shdr *sechdrs, | ||
339 | mod->arch.init.plt->sh_size = round_up(init_plts * PLT_ENT_SIZE, | ||
340 | sizeof(struct plt_entries)); | ||
341 | mod->arch.init.plt_count = 0; | ||
342 | + mod->arch.init.plt_ent = NULL; | ||
343 | |||
344 | pr_debug("%s: plt=%x, init.plt=%x\n", __func__, | ||
345 | mod->arch.core.plt->sh_size, mod->arch.init.plt->sh_size); | ||
346 | diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c | ||
347 | index 0804a6af4a3b7..5a3641b5ec2cd 100644 | ||
348 | --- a/arch/arm/mm/init.c | ||
349 | +++ b/arch/arm/mm/init.c | ||
350 | @@ -469,7 +469,11 @@ static void __init free_highpages(void) | ||
351 | void __init mem_init(void) | ||
352 | { | ||
353 | #ifdef CONFIG_ARM_LPAE | ||
354 | - swiotlb_init(1); | ||
355 | + if (swiotlb_force == SWIOTLB_FORCE || | ||
356 | + max_pfn > arm_dma_pfn_limit) | ||
357 | + swiotlb_init(1); | ||
358 | + else | ||
359 | + swiotlb_force = SWIOTLB_NO_FORCE; | ||
360 | #endif | ||
361 | |||
362 | set_max_mapnr(pfn_to_page(max_pfn) - mem_map); | ||
363 | diff --git a/arch/arm64/kernel/cacheinfo.c b/arch/arm64/kernel/cacheinfo.c | ||
364 | index 7fa6828bb488a..587543c6c51cb 100644 | ||
365 | --- a/arch/arm64/kernel/cacheinfo.c | ||
366 | +++ b/arch/arm64/kernel/cacheinfo.c | ||
367 | @@ -43,7 +43,7 @@ static void ci_leaf_init(struct cacheinfo *this_leaf, | ||
368 | this_leaf->type = type; | ||
369 | } | ||
370 | |||
371 | -static int __init_cache_level(unsigned int cpu) | ||
372 | +int init_cache_level(unsigned int cpu) | ||
373 | { | ||
374 | unsigned int ctype, level, leaves, fw_level; | ||
375 | struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu); | ||
376 | @@ -78,7 +78,7 @@ static int __init_cache_level(unsigned int cpu) | ||
377 | return 0; | ||
378 | } | ||
379 | |||
380 | -static int __populate_cache_leaves(unsigned int cpu) | ||
381 | +int populate_cache_leaves(unsigned int cpu) | ||
382 | { | ||
383 | unsigned int level, idx; | ||
384 | enum cache_type type; | ||
385 | @@ -97,6 +97,3 @@ static int __populate_cache_leaves(unsigned int cpu) | ||
386 | } | ||
387 | return 0; | ||
388 | } | ||
389 | - | ||
390 | -DEFINE_SMP_CALL_CACHE_FUNCTION(init_cache_level) | ||
391 | -DEFINE_SMP_CALL_CACHE_FUNCTION(populate_cache_leaves) | ||
392 | diff --git a/arch/mips/kernel/cacheinfo.c b/arch/mips/kernel/cacheinfo.c | ||
393 | index 47312c5294102..529dab855aac9 100644 | ||
394 | --- a/arch/mips/kernel/cacheinfo.c | ||
395 | +++ b/arch/mips/kernel/cacheinfo.c | ||
396 | @@ -17,7 +17,7 @@ do { \ | ||
397 | leaf++; \ | ||
398 | } while (0) | ||
399 | |||
400 | -static int __init_cache_level(unsigned int cpu) | ||
401 | +int init_cache_level(unsigned int cpu) | ||
402 | { | ||
403 | struct cpuinfo_mips *c = ¤t_cpu_data; | ||
404 | struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu); | ||
405 | @@ -69,7 +69,7 @@ static void fill_cpumask_cluster(int cpu, cpumask_t *cpu_map) | ||
406 | cpumask_set_cpu(cpu1, cpu_map); | ||
407 | } | ||
408 | |||
409 | -static int __populate_cache_leaves(unsigned int cpu) | ||
410 | +int populate_cache_leaves(unsigned int cpu) | ||
411 | { | ||
412 | struct cpuinfo_mips *c = ¤t_cpu_data; | ||
413 | struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu); | ||
414 | @@ -98,6 +98,3 @@ static int __populate_cache_leaves(unsigned int cpu) | ||
415 | |||
416 | return 0; | ||
417 | } | ||
418 | - | ||
419 | -DEFINE_SMP_CALL_CACHE_FUNCTION(init_cache_level) | ||
420 | -DEFINE_SMP_CALL_CACHE_FUNCTION(populate_cache_leaves) | ||
421 | diff --git a/arch/riscv/kernel/cacheinfo.c b/arch/riscv/kernel/cacheinfo.c | ||
422 | index 4c90c07d8c39d..d930bd073b7b2 100644 | ||
423 | --- a/arch/riscv/kernel/cacheinfo.c | ||
424 | +++ b/arch/riscv/kernel/cacheinfo.c | ||
425 | @@ -16,7 +16,7 @@ static void ci_leaf_init(struct cacheinfo *this_leaf, | ||
426 | this_leaf->type = type; | ||
427 | } | ||
428 | |||
429 | -static int __init_cache_level(unsigned int cpu) | ||
430 | +int init_cache_level(unsigned int cpu) | ||
431 | { | ||
432 | struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu); | ||
433 | struct device_node *np = of_cpu_device_node_get(cpu); | ||
434 | @@ -58,7 +58,7 @@ static int __init_cache_level(unsigned int cpu) | ||
435 | return 0; | ||
436 | } | ||
437 | |||
438 | -static int __populate_cache_leaves(unsigned int cpu) | ||
439 | +int populate_cache_leaves(unsigned int cpu) | ||
440 | { | ||
441 | struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu); | ||
442 | struct cacheinfo *this_leaf = this_cpu_ci->info_list; | ||
443 | @@ -95,6 +95,3 @@ static int __populate_cache_leaves(unsigned int cpu) | ||
444 | |||
445 | return 0; | ||
446 | } | ||
447 | - | ||
448 | -DEFINE_SMP_CALL_CACHE_FUNCTION(init_cache_level) | ||
449 | -DEFINE_SMP_CALL_CACHE_FUNCTION(populate_cache_leaves) | ||
450 | diff --git a/arch/s390/pci/pci_mmio.c b/arch/s390/pci/pci_mmio.c | ||
451 | index 020a2c514d961..921f0fc12f1fa 100644 | ||
452 | --- a/arch/s390/pci/pci_mmio.c | ||
453 | +++ b/arch/s390/pci/pci_mmio.c | ||
454 | @@ -128,7 +128,7 @@ static long get_pfn(unsigned long user_addr, unsigned long access, | ||
455 | down_read(¤t->mm->mmap_sem); | ||
456 | ret = -EINVAL; | ||
457 | vma = find_vma(current->mm, user_addr); | ||
458 | - if (!vma) | ||
459 | + if (!vma || user_addr < vma->vm_start) | ||
460 | goto out; | ||
461 | ret = -EACCES; | ||
462 | if (!(vma->vm_flags & access)) | ||
463 | diff --git a/arch/um/drivers/virtio_uml.c b/arch/um/drivers/virtio_uml.c | ||
464 | index 18618af3835f9..936e17eab3360 100644 | ||
465 | --- a/arch/um/drivers/virtio_uml.c | ||
466 | +++ b/arch/um/drivers/virtio_uml.c | ||
467 | @@ -994,7 +994,7 @@ static int virtio_uml_probe(struct platform_device *pdev) | ||
468 | rc = os_connect_socket(pdata->socket_path); | ||
469 | } while (rc == -EINTR); | ||
470 | if (rc < 0) | ||
471 | - return rc; | ||
472 | + goto error_free; | ||
473 | vu_dev->sock = rc; | ||
474 | |||
475 | rc = vhost_user_init(vu_dev); | ||
476 | @@ -1010,6 +1010,8 @@ static int virtio_uml_probe(struct platform_device *pdev) | ||
477 | |||
478 | error_init: | ||
479 | os_close_file(vu_dev->sock); | ||
480 | +error_free: | ||
481 | + kfree(vu_dev); | ||
482 | return rc; | ||
483 | } | ||
484 | |||
485 | diff --git a/arch/x86/kernel/cpu/cacheinfo.c b/arch/x86/kernel/cpu/cacheinfo.c | ||
486 | index 30f33b75209a1..cae566567e15e 100644 | ||
487 | --- a/arch/x86/kernel/cpu/cacheinfo.c | ||
488 | +++ b/arch/x86/kernel/cpu/cacheinfo.c | ||
489 | @@ -985,7 +985,7 @@ static void ci_leaf_init(struct cacheinfo *this_leaf, | ||
490 | this_leaf->priv = base->nb; | ||
491 | } | ||
492 | |||
493 | -static int __init_cache_level(unsigned int cpu) | ||
494 | +int init_cache_level(unsigned int cpu) | ||
495 | { | ||
496 | struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu); | ||
497 | |||
498 | @@ -1014,7 +1014,7 @@ static void get_cache_id(int cpu, struct _cpuid4_info_regs *id4_regs) | ||
499 | id4_regs->id = c->apicid >> index_msb; | ||
500 | } | ||
501 | |||
502 | -static int __populate_cache_leaves(unsigned int cpu) | ||
503 | +int populate_cache_leaves(unsigned int cpu) | ||
504 | { | ||
505 | unsigned int idx, ret; | ||
506 | struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu); | ||
507 | @@ -1033,6 +1033,3 @@ static int __populate_cache_leaves(unsigned int cpu) | ||
508 | |||
509 | return 0; | ||
510 | } | ||
511 | - | ||
512 | -DEFINE_SMP_CALL_CACHE_FUNCTION(init_cache_level) | ||
513 | -DEFINE_SMP_CALL_CACHE_FUNCTION(populate_cache_leaves) | ||
514 | diff --git a/block/blk-throttle.c b/block/blk-throttle.c | ||
515 | index 18f773e52dfb1..bd870f9ae4586 100644 | ||
516 | --- a/block/blk-throttle.c | ||
517 | +++ b/block/blk-throttle.c | ||
518 | @@ -2414,6 +2414,7 @@ int blk_throtl_init(struct request_queue *q) | ||
519 | void blk_throtl_exit(struct request_queue *q) | ||
520 | { | ||
521 | BUG_ON(!q->td); | ||
522 | + del_timer_sync(&q->td->service_queue.pending_timer); | ||
523 | throtl_shutdown_wq(q); | ||
524 | blkcg_deactivate_policy(q, &blkcg_policy_throtl); | ||
525 | free_percpu(q->td->latency_buckets[READ]); | ||
526 | diff --git a/drivers/acpi/pci_mcfg.c b/drivers/acpi/pci_mcfg.c | ||
527 | index 6b347d9920cc2..47e43c9498257 100644 | ||
528 | --- a/drivers/acpi/pci_mcfg.c | ||
529 | +++ b/drivers/acpi/pci_mcfg.c | ||
530 | @@ -142,6 +142,26 @@ static struct mcfg_fixup mcfg_quirks[] = { | ||
531 | XGENE_V2_ECAM_MCFG(4, 0), | ||
532 | XGENE_V2_ECAM_MCFG(4, 1), | ||
533 | XGENE_V2_ECAM_MCFG(4, 2), | ||
534 | + | ||
535 | +#define ALTRA_ECAM_QUIRK(rev, seg) \ | ||
536 | + { "Ampere", "Altra ", rev, seg, MCFG_BUS_ANY, &pci_32b_read_ops } | ||
537 | + | ||
538 | + ALTRA_ECAM_QUIRK(1, 0), | ||
539 | + ALTRA_ECAM_QUIRK(1, 1), | ||
540 | + ALTRA_ECAM_QUIRK(1, 2), | ||
541 | + ALTRA_ECAM_QUIRK(1, 3), | ||
542 | + ALTRA_ECAM_QUIRK(1, 4), | ||
543 | + ALTRA_ECAM_QUIRK(1, 5), | ||
544 | + ALTRA_ECAM_QUIRK(1, 6), | ||
545 | + ALTRA_ECAM_QUIRK(1, 7), | ||
546 | + ALTRA_ECAM_QUIRK(1, 8), | ||
547 | + ALTRA_ECAM_QUIRK(1, 9), | ||
548 | + ALTRA_ECAM_QUIRK(1, 10), | ||
549 | + ALTRA_ECAM_QUIRK(1, 11), | ||
550 | + ALTRA_ECAM_QUIRK(1, 12), | ||
551 | + ALTRA_ECAM_QUIRK(1, 13), | ||
552 | + ALTRA_ECAM_QUIRK(1, 14), | ||
553 | + ALTRA_ECAM_QUIRK(1, 15), | ||
554 | }; | ||
555 | |||
556 | static char mcfg_oem_id[ACPI_OEM_ID_SIZE]; | ||
557 | diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig | ||
558 | index a32d0d7152475..1322461f1f3c5 100644 | ||
559 | --- a/drivers/dma/Kconfig | ||
560 | +++ b/drivers/dma/Kconfig | ||
561 | @@ -276,7 +276,7 @@ config INTEL_IDMA64 | ||
562 | |||
563 | config INTEL_IOATDMA | ||
564 | tristate "Intel I/OAT DMA support" | ||
565 | - depends on PCI && X86_64 | ||
566 | + depends on PCI && X86_64 && !UML | ||
567 | select DMA_ENGINE | ||
568 | select DMA_ENGINE_RAID | ||
569 | select DCA | ||
570 | diff --git a/drivers/dma/acpi-dma.c b/drivers/dma/acpi-dma.c | ||
571 | index dcbcb712de6e8..731f453ecb51f 100644 | ||
572 | --- a/drivers/dma/acpi-dma.c | ||
573 | +++ b/drivers/dma/acpi-dma.c | ||
574 | @@ -70,10 +70,14 @@ static int acpi_dma_parse_resource_group(const struct acpi_csrt_group *grp, | ||
575 | |||
576 | si = (const struct acpi_csrt_shared_info *)&grp[1]; | ||
577 | |||
578 | - /* Match device by MMIO and IRQ */ | ||
579 | + /* Match device by MMIO */ | ||
580 | if (si->mmio_base_low != lower_32_bits(mem) || | ||
581 | - si->mmio_base_high != upper_32_bits(mem) || | ||
582 | - si->gsi_interrupt != irq) | ||
583 | + si->mmio_base_high != upper_32_bits(mem)) | ||
584 | + return 0; | ||
585 | + | ||
586 | + /* Match device by Linux vIRQ */ | ||
587 | + ret = acpi_register_gsi(NULL, si->gsi_interrupt, si->interrupt_mode, si->interrupt_polarity); | ||
588 | + if (ret != irq) | ||
589 | return 0; | ||
590 | |||
591 | dev_dbg(&adev->dev, "matches with %.4s%04X (rev %u)\n", | ||
592 | diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c | ||
593 | index 8546ad0347208..b966115bfad1d 100644 | ||
594 | --- a/drivers/dma/sprd-dma.c | ||
595 | +++ b/drivers/dma/sprd-dma.c | ||
596 | @@ -1230,6 +1230,7 @@ static const struct of_device_id sprd_dma_match[] = { | ||
597 | { .compatible = "sprd,sc9860-dma", }, | ||
598 | {}, | ||
599 | }; | ||
600 | +MODULE_DEVICE_TABLE(of, sprd_dma_match); | ||
601 | |||
602 | static int __maybe_unused sprd_dma_runtime_suspend(struct device *dev) | ||
603 | { | ||
604 | diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c | ||
605 | index ce18bca45ff27..7729b8d22553e 100644 | ||
606 | --- a/drivers/dma/xilinx/xilinx_dma.c | ||
607 | +++ b/drivers/dma/xilinx/xilinx_dma.c | ||
608 | @@ -2703,7 +2703,7 @@ static int xilinx_dma_probe(struct platform_device *pdev) | ||
609 | xdev->ext_addr = false; | ||
610 | |||
611 | /* Set the dma mask bits */ | ||
612 | - dma_set_mask(xdev->dev, DMA_BIT_MASK(addr_width)); | ||
613 | + dma_set_mask_and_coherent(xdev->dev, DMA_BIT_MASK(addr_width)); | ||
614 | |||
615 | /* Initialize the DMA engine */ | ||
616 | xdev->common.dev = &pdev->dev; | ||
617 | diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/ctrl.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/ctrl.c | ||
618 | index b0ece71aefdee..ce774579c89d1 100644 | ||
619 | --- a/drivers/gpu/drm/nouveau/nvkm/engine/device/ctrl.c | ||
620 | +++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/ctrl.c | ||
621 | @@ -57,7 +57,7 @@ nvkm_control_mthd_pstate_info(struct nvkm_control *ctrl, void *data, u32 size) | ||
622 | args->v0.count = 0; | ||
623 | args->v0.ustate_ac = NVIF_CONTROL_PSTATE_INFO_V0_USTATE_DISABLE; | ||
624 | args->v0.ustate_dc = NVIF_CONTROL_PSTATE_INFO_V0_USTATE_DISABLE; | ||
625 | - args->v0.pwrsrc = -ENOSYS; | ||
626 | + args->v0.pwrsrc = -ENODEV; | ||
627 | args->v0.pstate = NVIF_CONTROL_PSTATE_INFO_V0_PSTATE_UNKNOWN; | ||
628 | } | ||
629 | |||
630 | diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | ||
631 | index 10d28be73f456..4e7cfd3bfcd2e 100644 | ||
632 | --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | ||
633 | +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | ||
634 | @@ -1987,6 +1987,8 @@ static void stmmac_tx_err(struct stmmac_priv *priv, u32 chan) | ||
635 | tx_q->cur_tx = 0; | ||
636 | tx_q->mss = 0; | ||
637 | netdev_tx_reset_queue(netdev_get_tx_queue(priv->dev, chan)); | ||
638 | + stmmac_init_tx_chan(priv, priv->ioaddr, priv->plat->dma_cfg, | ||
639 | + tx_q->dma_tx_phy, chan); | ||
640 | stmmac_start_tx_dma(priv, chan); | ||
641 | |||
642 | priv->dev->stats.tx_errors++; | ||
643 | diff --git a/drivers/net/phy/phy-c45.c b/drivers/net/phy/phy-c45.c | ||
644 | index a1caeee122361..bceb0dcdecbd6 100644 | ||
645 | --- a/drivers/net/phy/phy-c45.c | ||
646 | +++ b/drivers/net/phy/phy-c45.c | ||
647 | @@ -239,9 +239,10 @@ int genphy_c45_read_link(struct phy_device *phydev) | ||
648 | |||
649 | /* The link state is latched low so that momentary link | ||
650 | * drops can be detected. Do not double-read the status | ||
651 | - * in polling mode to detect such short link drops. | ||
652 | + * in polling mode to detect such short link drops except | ||
653 | + * the link was already down. | ||
654 | */ | ||
655 | - if (!phy_polling_mode(phydev)) { | ||
656 | + if (!phy_polling_mode(phydev) || !phydev->link) { | ||
657 | val = phy_read_mmd(phydev, devad, MDIO_STAT1); | ||
658 | if (val < 0) | ||
659 | return val; | ||
660 | diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c | ||
661 | index 9d0a306f05623..35ade5d21de51 100644 | ||
662 | --- a/drivers/net/phy/phy_device.c | ||
663 | +++ b/drivers/net/phy/phy_device.c | ||
664 | @@ -1766,9 +1766,10 @@ int genphy_update_link(struct phy_device *phydev) | ||
665 | |||
666 | /* The link state is latched low so that momentary link | ||
667 | * drops can be detected. Do not double-read the status | ||
668 | - * in polling mode to detect such short link drops. | ||
669 | + * in polling mode to detect such short link drops except | ||
670 | + * the link was already down. | ||
671 | */ | ||
672 | - if (!phy_polling_mode(phydev)) { | ||
673 | + if (!phy_polling_mode(phydev) || !phydev->link) { | ||
674 | status = phy_read(phydev, MII_BMSR); | ||
675 | if (status < 0) | ||
676 | return status; | ||
677 | diff --git a/drivers/parisc/dino.c b/drivers/parisc/dino.c | ||
678 | index 2f1cac89ddf5c..544287e9f449b 100644 | ||
679 | --- a/drivers/parisc/dino.c | ||
680 | +++ b/drivers/parisc/dino.c | ||
681 | @@ -156,15 +156,6 @@ static inline struct dino_device *DINO_DEV(struct pci_hba_data *hba) | ||
682 | return container_of(hba, struct dino_device, hba); | ||
683 | } | ||
684 | |||
685 | -/* Check if PCI device is behind a Card-mode Dino. */ | ||
686 | -static int pci_dev_is_behind_card_dino(struct pci_dev *dev) | ||
687 | -{ | ||
688 | - struct dino_device *dino_dev; | ||
689 | - | ||
690 | - dino_dev = DINO_DEV(parisc_walk_tree(dev->bus->bridge)); | ||
691 | - return is_card_dino(&dino_dev->hba.dev->id); | ||
692 | -} | ||
693 | - | ||
694 | /* | ||
695 | * Dino Configuration Space Accessor Functions | ||
696 | */ | ||
697 | @@ -447,6 +438,15 @@ static void quirk_cirrus_cardbus(struct pci_dev *dev) | ||
698 | DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_CIRRUS, PCI_DEVICE_ID_CIRRUS_6832, quirk_cirrus_cardbus ); | ||
699 | |||
700 | #ifdef CONFIG_TULIP | ||
701 | +/* Check if PCI device is behind a Card-mode Dino. */ | ||
702 | +static int pci_dev_is_behind_card_dino(struct pci_dev *dev) | ||
703 | +{ | ||
704 | + struct dino_device *dino_dev; | ||
705 | + | ||
706 | + dino_dev = DINO_DEV(parisc_walk_tree(dev->bus->bridge)); | ||
707 | + return is_card_dino(&dino_dev->hba.dev->id); | ||
708 | +} | ||
709 | + | ||
710 | static void pci_fixup_tulip(struct pci_dev *dev) | ||
711 | { | ||
712 | if (!pci_dev_is_behind_card_dino(dev)) | ||
713 | diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c | ||
714 | index 0538348ed843f..18753fd218a31 100644 | ||
715 | --- a/drivers/pci/controller/pci-aardvark.c | ||
716 | +++ b/drivers/pci/controller/pci-aardvark.c | ||
717 | @@ -188,6 +188,8 @@ | ||
718 | |||
719 | #define MSI_IRQ_NUM 32 | ||
720 | |||
721 | +#define CFG_RD_CRS_VAL 0xffff0001 | ||
722 | + | ||
723 | struct advk_pcie { | ||
724 | struct platform_device *pdev; | ||
725 | void __iomem *base; | ||
726 | @@ -365,7 +367,7 @@ static void advk_pcie_setup_hw(struct advk_pcie *pcie) | ||
727 | advk_writel(pcie, reg, PCIE_CORE_CMD_STATUS_REG); | ||
728 | } | ||
729 | |||
730 | -static int advk_pcie_check_pio_status(struct advk_pcie *pcie, u32 *val) | ||
731 | +static int advk_pcie_check_pio_status(struct advk_pcie *pcie, bool allow_crs, u32 *val) | ||
732 | { | ||
733 | struct device *dev = &pcie->pdev->dev; | ||
734 | u32 reg; | ||
735 | @@ -407,9 +409,30 @@ static int advk_pcie_check_pio_status(struct advk_pcie *pcie, u32 *val) | ||
736 | strcomp_status = "UR"; | ||
737 | break; | ||
738 | case PIO_COMPLETION_STATUS_CRS: | ||
739 | + if (allow_crs && val) { | ||
740 | + /* PCIe r4.0, sec 2.3.2, says: | ||
741 | + * If CRS Software Visibility is enabled: | ||
742 | + * For a Configuration Read Request that includes both | ||
743 | + * bytes of the Vendor ID field of a device Function's | ||
744 | + * Configuration Space Header, the Root Complex must | ||
745 | + * complete the Request to the host by returning a | ||
746 | + * read-data value of 0001h for the Vendor ID field and | ||
747 | + * all '1's for any additional bytes included in the | ||
748 | + * request. | ||
749 | + * | ||
750 | + * So CRS in this case is not an error status. | ||
751 | + */ | ||
752 | + *val = CFG_RD_CRS_VAL; | ||
753 | + strcomp_status = NULL; | ||
754 | + break; | ||
755 | + } | ||
756 | /* PCIe r4.0, sec 2.3.2, says: | ||
757 | * If CRS Software Visibility is not enabled, the Root Complex | ||
758 | * must re-issue the Configuration Request as a new Request. | ||
759 | + * If CRS Software Visibility is enabled: For a Configuration | ||
760 | + * Write Request or for any other Configuration Read Request, | ||
761 | + * the Root Complex must re-issue the Configuration Request as | ||
762 | + * a new Request. | ||
763 | * A Root Complex implementation may choose to limit the number | ||
764 | * of Configuration Request/CRS Completion Status loops before | ||
765 | * determining that something is wrong with the target of the | ||
766 | @@ -478,6 +501,7 @@ advk_pci_bridge_emul_pcie_conf_read(struct pci_bridge_emul *bridge, | ||
767 | case PCI_EXP_RTCTL: { | ||
768 | u32 val = advk_readl(pcie, PCIE_ISR0_MASK_REG); | ||
769 | *value = (val & PCIE_MSG_PM_PME_MASK) ? 0 : PCI_EXP_RTCTL_PMEIE; | ||
770 | + *value |= PCI_EXP_RTCAP_CRSVIS << 16; | ||
771 | return PCI_BRIDGE_EMUL_HANDLED; | ||
772 | } | ||
773 | |||
774 | @@ -559,6 +583,7 @@ static struct pci_bridge_emul_ops advk_pci_bridge_emul_ops = { | ||
775 | static int advk_sw_pci_bridge_init(struct advk_pcie *pcie) | ||
776 | { | ||
777 | struct pci_bridge_emul *bridge = &pcie->bridge; | ||
778 | + int ret; | ||
779 | |||
780 | bridge->conf.vendor = advk_readl(pcie, PCIE_CORE_DEV_ID_REG) & 0xffff; | ||
781 | bridge->conf.device = advk_readl(pcie, PCIE_CORE_DEV_ID_REG) >> 16; | ||
782 | @@ -580,7 +605,15 @@ static int advk_sw_pci_bridge_init(struct advk_pcie *pcie) | ||
783 | bridge->data = pcie; | ||
784 | bridge->ops = &advk_pci_bridge_emul_ops; | ||
785 | |||
786 | - return pci_bridge_emul_init(bridge, 0); | ||
787 | + /* PCIe config space can be initialized after pci_bridge_emul_init() */ | ||
788 | + ret = pci_bridge_emul_init(bridge, 0); | ||
789 | + if (ret < 0) | ||
790 | + return ret; | ||
791 | + | ||
792 | + /* Indicates supports for Completion Retry Status */ | ||
793 | + bridge->pcie_conf.rootcap = cpu_to_le16(PCI_EXP_RTCAP_CRSVIS); | ||
794 | + | ||
795 | + return 0; | ||
796 | } | ||
797 | |||
798 | static bool advk_pcie_valid_device(struct advk_pcie *pcie, struct pci_bus *bus, | ||
799 | @@ -625,6 +658,7 @@ static int advk_pcie_rd_conf(struct pci_bus *bus, u32 devfn, | ||
800 | int where, int size, u32 *val) | ||
801 | { | ||
802 | struct advk_pcie *pcie = bus->sysdata; | ||
803 | + bool allow_crs; | ||
804 | u32 reg; | ||
805 | int ret; | ||
806 | |||
807 | @@ -637,7 +671,24 @@ static int advk_pcie_rd_conf(struct pci_bus *bus, u32 devfn, | ||
808 | return pci_bridge_emul_conf_read(&pcie->bridge, where, | ||
809 | size, val); | ||
810 | |||
811 | + /* | ||
812 | + * Completion Retry Status is possible to return only when reading all | ||
813 | + * 4 bytes from PCI_VENDOR_ID and PCI_DEVICE_ID registers at once and | ||
814 | + * CRSSVE flag on Root Bridge is enabled. | ||
815 | + */ | ||
816 | + allow_crs = (where == PCI_VENDOR_ID) && (size == 4) && | ||
817 | + (le16_to_cpu(pcie->bridge.pcie_conf.rootctl) & | ||
818 | + PCI_EXP_RTCTL_CRSSVE); | ||
819 | + | ||
820 | if (advk_pcie_pio_is_running(pcie)) { | ||
821 | + /* | ||
822 | + * If it is possible return Completion Retry Status so caller | ||
823 | + * tries to issue the request again instead of failing. | ||
824 | + */ | ||
825 | + if (allow_crs) { | ||
826 | + *val = CFG_RD_CRS_VAL; | ||
827 | + return PCIBIOS_SUCCESSFUL; | ||
828 | + } | ||
829 | *val = 0xffffffff; | ||
830 | return PCIBIOS_SET_FAILED; | ||
831 | } | ||
832 | @@ -664,11 +715,21 @@ static int advk_pcie_rd_conf(struct pci_bus *bus, u32 devfn, | ||
833 | advk_writel(pcie, 1, PIO_START); | ||
834 | |||
835 | ret = advk_pcie_wait_pio(pcie); | ||
836 | - if (ret < 0) | ||
837 | + if (ret < 0) { | ||
838 | + /* | ||
839 | + * If it is possible return Completion Retry Status so caller | ||
840 | + * tries to issue the request again instead of failing. | ||
841 | + */ | ||
842 | + if (allow_crs) { | ||
843 | + *val = CFG_RD_CRS_VAL; | ||
844 | + return PCIBIOS_SUCCESSFUL; | ||
845 | + } | ||
846 | + *val = 0xffffffff; | ||
847 | return PCIBIOS_SET_FAILED; | ||
848 | + } | ||
849 | |||
850 | /* Check PIO status and get the read result */ | ||
851 | - ret = advk_pcie_check_pio_status(pcie, val); | ||
852 | + ret = advk_pcie_check_pio_status(pcie, allow_crs, val); | ||
853 | if (ret < 0) { | ||
854 | *val = 0xffffffff; | ||
855 | return PCIBIOS_SET_FAILED; | ||
856 | @@ -737,7 +798,7 @@ static int advk_pcie_wr_conf(struct pci_bus *bus, u32 devfn, | ||
857 | if (ret < 0) | ||
858 | return PCIBIOS_SET_FAILED; | ||
859 | |||
860 | - ret = advk_pcie_check_pio_status(pcie, NULL); | ||
861 | + ret = advk_pcie_check_pio_status(pcie, false, NULL); | ||
862 | if (ret < 0) | ||
863 | return PCIBIOS_SET_FAILED; | ||
864 | |||
865 | diff --git a/drivers/pci/ecam.c b/drivers/pci/ecam.c | ||
866 | index 1a81af0ba961a..9765d2eb79d21 100644 | ||
867 | --- a/drivers/pci/ecam.c | ||
868 | +++ b/drivers/pci/ecam.c | ||
869 | @@ -164,4 +164,14 @@ struct pci_ecam_ops pci_32b_ops = { | ||
870 | .write = pci_generic_config_write32, | ||
871 | } | ||
872 | }; | ||
873 | + | ||
874 | +/* ECAM ops for 32-bit read only (non-compliant) */ | ||
875 | +struct pci_ecam_ops pci_32b_read_ops = { | ||
876 | + .bus_shift = 20, | ||
877 | + .pci_ops = { | ||
878 | + .map_bus = pci_ecam_map_bus, | ||
879 | + .read = pci_generic_config_read32, | ||
880 | + .write = pci_generic_config_write, | ||
881 | + } | ||
882 | +}; | ||
883 | #endif | ||
884 | diff --git a/drivers/pci/pci-bridge-emul.c b/drivers/pci/pci-bridge-emul.c | ||
885 | index d3b6b9a056185..06c800595e036 100644 | ||
886 | --- a/drivers/pci/pci-bridge-emul.c | ||
887 | +++ b/drivers/pci/pci-bridge-emul.c | ||
888 | @@ -270,10 +270,10 @@ static const struct pci_bridge_reg_behavior pcie_cap_regs_behavior[] = { | ||
889 | int pci_bridge_emul_init(struct pci_bridge_emul *bridge, | ||
890 | unsigned int flags) | ||
891 | { | ||
892 | - bridge->conf.class_revision |= PCI_CLASS_BRIDGE_PCI << 16; | ||
893 | + bridge->conf.class_revision |= cpu_to_le32(PCI_CLASS_BRIDGE_PCI << 16); | ||
894 | bridge->conf.header_type = PCI_HEADER_TYPE_BRIDGE; | ||
895 | bridge->conf.cache_line_size = 0x10; | ||
896 | - bridge->conf.status = PCI_STATUS_CAP_LIST; | ||
897 | + bridge->conf.status = cpu_to_le16(PCI_STATUS_CAP_LIST); | ||
898 | bridge->pci_regs_behavior = kmemdup(pci_regs_behavior, | ||
899 | sizeof(pci_regs_behavior), | ||
900 | GFP_KERNEL); | ||
901 | @@ -284,8 +284,9 @@ int pci_bridge_emul_init(struct pci_bridge_emul *bridge, | ||
902 | bridge->conf.capabilities_pointer = PCI_CAP_PCIE_START; | ||
903 | bridge->pcie_conf.cap_id = PCI_CAP_ID_EXP; | ||
904 | /* Set PCIe v2, root port, slot support */ | ||
905 | - bridge->pcie_conf.cap = PCI_EXP_TYPE_ROOT_PORT << 4 | 2 | | ||
906 | - PCI_EXP_FLAGS_SLOT; | ||
907 | + bridge->pcie_conf.cap = | ||
908 | + cpu_to_le16(PCI_EXP_TYPE_ROOT_PORT << 4 | 2 | | ||
909 | + PCI_EXP_FLAGS_SLOT); | ||
910 | bridge->pcie_cap_regs_behavior = | ||
911 | kmemdup(pcie_cap_regs_behavior, | ||
912 | sizeof(pcie_cap_regs_behavior), | ||
913 | @@ -327,7 +328,7 @@ int pci_bridge_emul_conf_read(struct pci_bridge_emul *bridge, int where, | ||
914 | int reg = where & ~3; | ||
915 | pci_bridge_emul_read_status_t (*read_op)(struct pci_bridge_emul *bridge, | ||
916 | int reg, u32 *value); | ||
917 | - u32 *cfgspace; | ||
918 | + __le32 *cfgspace; | ||
919 | const struct pci_bridge_reg_behavior *behavior; | ||
920 | |||
921 | if (bridge->has_pcie && reg >= PCI_CAP_PCIE_END) { | ||
922 | @@ -343,11 +344,11 @@ int pci_bridge_emul_conf_read(struct pci_bridge_emul *bridge, int where, | ||
923 | if (bridge->has_pcie && reg >= PCI_CAP_PCIE_START) { | ||
924 | reg -= PCI_CAP_PCIE_START; | ||
925 | read_op = bridge->ops->read_pcie; | ||
926 | - cfgspace = (u32 *) &bridge->pcie_conf; | ||
927 | + cfgspace = (__le32 *) &bridge->pcie_conf; | ||
928 | behavior = bridge->pcie_cap_regs_behavior; | ||
929 | } else { | ||
930 | read_op = bridge->ops->read_base; | ||
931 | - cfgspace = (u32 *) &bridge->conf; | ||
932 | + cfgspace = (__le32 *) &bridge->conf; | ||
933 | behavior = bridge->pci_regs_behavior; | ||
934 | } | ||
935 | |||
936 | @@ -357,7 +358,7 @@ int pci_bridge_emul_conf_read(struct pci_bridge_emul *bridge, int where, | ||
937 | ret = PCI_BRIDGE_EMUL_NOT_HANDLED; | ||
938 | |||
939 | if (ret == PCI_BRIDGE_EMUL_NOT_HANDLED) | ||
940 | - *value = cfgspace[reg / 4]; | ||
941 | + *value = le32_to_cpu(cfgspace[reg / 4]); | ||
942 | |||
943 | /* | ||
944 | * Make sure we never return any reserved bit with a value | ||
945 | @@ -387,7 +388,7 @@ int pci_bridge_emul_conf_write(struct pci_bridge_emul *bridge, int where, | ||
946 | int mask, ret, old, new, shift; | ||
947 | void (*write_op)(struct pci_bridge_emul *bridge, int reg, | ||
948 | u32 old, u32 new, u32 mask); | ||
949 | - u32 *cfgspace; | ||
950 | + __le32 *cfgspace; | ||
951 | const struct pci_bridge_reg_behavior *behavior; | ||
952 | |||
953 | if (bridge->has_pcie && reg >= PCI_CAP_PCIE_END) | ||
954 | @@ -414,11 +415,11 @@ int pci_bridge_emul_conf_write(struct pci_bridge_emul *bridge, int where, | ||
955 | if (bridge->has_pcie && reg >= PCI_CAP_PCIE_START) { | ||
956 | reg -= PCI_CAP_PCIE_START; | ||
957 | write_op = bridge->ops->write_pcie; | ||
958 | - cfgspace = (u32 *) &bridge->pcie_conf; | ||
959 | + cfgspace = (__le32 *) &bridge->pcie_conf; | ||
960 | behavior = bridge->pcie_cap_regs_behavior; | ||
961 | } else { | ||
962 | write_op = bridge->ops->write_base; | ||
963 | - cfgspace = (u32 *) &bridge->conf; | ||
964 | + cfgspace = (__le32 *) &bridge->conf; | ||
965 | behavior = bridge->pci_regs_behavior; | ||
966 | } | ||
967 | |||
968 | @@ -431,7 +432,7 @@ int pci_bridge_emul_conf_write(struct pci_bridge_emul *bridge, int where, | ||
969 | /* Clear the W1C bits */ | ||
970 | new &= ~((value << shift) & (behavior[reg / 4].w1c & mask)); | ||
971 | |||
972 | - cfgspace[reg / 4] = new; | ||
973 | + cfgspace[reg / 4] = cpu_to_le32(new); | ||
974 | |||
975 | if (write_op) | ||
976 | write_op(bridge, reg, old, new, mask); | ||
977 | diff --git a/drivers/pci/pci-bridge-emul.h b/drivers/pci/pci-bridge-emul.h | ||
978 | index e65b1b79899d0..49bbd37ee318a 100644 | ||
979 | --- a/drivers/pci/pci-bridge-emul.h | ||
980 | +++ b/drivers/pci/pci-bridge-emul.h | ||
981 | @@ -6,65 +6,65 @@ | ||
982 | |||
983 | /* PCI configuration space of a PCI-to-PCI bridge. */ | ||
984 | struct pci_bridge_emul_conf { | ||
985 | - u16 vendor; | ||
986 | - u16 device; | ||
987 | - u16 command; | ||
988 | - u16 status; | ||
989 | - u32 class_revision; | ||
990 | + __le16 vendor; | ||
991 | + __le16 device; | ||
992 | + __le16 command; | ||
993 | + __le16 status; | ||
994 | + __le32 class_revision; | ||
995 | u8 cache_line_size; | ||
996 | u8 latency_timer; | ||
997 | u8 header_type; | ||
998 | u8 bist; | ||
999 | - u32 bar[2]; | ||
1000 | + __le32 bar[2]; | ||
1001 | u8 primary_bus; | ||
1002 | u8 secondary_bus; | ||
1003 | u8 subordinate_bus; | ||
1004 | u8 secondary_latency_timer; | ||
1005 | u8 iobase; | ||
1006 | u8 iolimit; | ||
1007 | - u16 secondary_status; | ||
1008 | - u16 membase; | ||
1009 | - u16 memlimit; | ||
1010 | - u16 pref_mem_base; | ||
1011 | - u16 pref_mem_limit; | ||
1012 | - u32 prefbaseupper; | ||
1013 | - u32 preflimitupper; | ||
1014 | - u16 iobaseupper; | ||
1015 | - u16 iolimitupper; | ||
1016 | + __le16 secondary_status; | ||
1017 | + __le16 membase; | ||
1018 | + __le16 memlimit; | ||
1019 | + __le16 pref_mem_base; | ||
1020 | + __le16 pref_mem_limit; | ||
1021 | + __le32 prefbaseupper; | ||
1022 | + __le32 preflimitupper; | ||
1023 | + __le16 iobaseupper; | ||
1024 | + __le16 iolimitupper; | ||
1025 | u8 capabilities_pointer; | ||
1026 | u8 reserve[3]; | ||
1027 | - u32 romaddr; | ||
1028 | + __le32 romaddr; | ||
1029 | u8 intline; | ||
1030 | u8 intpin; | ||
1031 | - u16 bridgectrl; | ||
1032 | + __le16 bridgectrl; | ||
1033 | }; | ||
1034 | |||
1035 | /* PCI configuration space of the PCIe capabilities */ | ||
1036 | struct pci_bridge_emul_pcie_conf { | ||
1037 | u8 cap_id; | ||
1038 | u8 next; | ||
1039 | - u16 cap; | ||
1040 | - u32 devcap; | ||
1041 | - u16 devctl; | ||
1042 | - u16 devsta; | ||
1043 | - u32 lnkcap; | ||
1044 | - u16 lnkctl; | ||
1045 | - u16 lnksta; | ||
1046 | - u32 slotcap; | ||
1047 | - u16 slotctl; | ||
1048 | - u16 slotsta; | ||
1049 | - u16 rootctl; | ||
1050 | - u16 rsvd; | ||
1051 | - u32 rootsta; | ||
1052 | - u32 devcap2; | ||
1053 | - u16 devctl2; | ||
1054 | - u16 devsta2; | ||
1055 | - u32 lnkcap2; | ||
1056 | - u16 lnkctl2; | ||
1057 | - u16 lnksta2; | ||
1058 | - u32 slotcap2; | ||
1059 | - u16 slotctl2; | ||
1060 | - u16 slotsta2; | ||
1061 | + __le16 cap; | ||
1062 | + __le32 devcap; | ||
1063 | + __le16 devctl; | ||
1064 | + __le16 devsta; | ||
1065 | + __le32 lnkcap; | ||
1066 | + __le16 lnkctl; | ||
1067 | + __le16 lnksta; | ||
1068 | + __le32 slotcap; | ||
1069 | + __le16 slotctl; | ||
1070 | + __le16 slotsta; | ||
1071 | + __le16 rootctl; | ||
1072 | + __le16 rootcap; | ||
1073 | + __le32 rootsta; | ||
1074 | + __le32 devcap2; | ||
1075 | + __le16 devctl2; | ||
1076 | + __le16 devsta2; | ||
1077 | + __le32 lnkcap2; | ||
1078 | + __le16 lnkctl2; | ||
1079 | + __le16 lnksta2; | ||
1080 | + __le32 slotcap2; | ||
1081 | + __le16 slotctl2; | ||
1082 | + __le16 slotsta2; | ||
1083 | }; | ||
1084 | |||
1085 | struct pci_bridge_emul; | ||
1086 | diff --git a/drivers/pwm/pwm-img.c b/drivers/pwm/pwm-img.c | ||
1087 | index 22c002e685b34..37f9b688661d4 100644 | ||
1088 | --- a/drivers/pwm/pwm-img.c | ||
1089 | +++ b/drivers/pwm/pwm-img.c | ||
1090 | @@ -329,23 +329,7 @@ err_pm_disable: | ||
1091 | static int img_pwm_remove(struct platform_device *pdev) | ||
1092 | { | ||
1093 | struct img_pwm_chip *pwm_chip = platform_get_drvdata(pdev); | ||
1094 | - u32 val; | ||
1095 | - unsigned int i; | ||
1096 | - int ret; | ||
1097 | - | ||
1098 | - ret = pm_runtime_get_sync(&pdev->dev); | ||
1099 | - if (ret < 0) { | ||
1100 | - pm_runtime_put(&pdev->dev); | ||
1101 | - return ret; | ||
1102 | - } | ||
1103 | - | ||
1104 | - for (i = 0; i < pwm_chip->chip.npwm; i++) { | ||
1105 | - val = img_pwm_readl(pwm_chip, PWM_CTRL_CFG); | ||
1106 | - val &= ~BIT(i); | ||
1107 | - img_pwm_writel(pwm_chip, PWM_CTRL_CFG, val); | ||
1108 | - } | ||
1109 | |||
1110 | - pm_runtime_put(&pdev->dev); | ||
1111 | pm_runtime_disable(&pdev->dev); | ||
1112 | if (!pm_runtime_status_suspended(&pdev->dev)) | ||
1113 | img_pwm_runtime_suspend(&pdev->dev); | ||
1114 | diff --git a/drivers/pwm/pwm-lpc32xx.c b/drivers/pwm/pwm-lpc32xx.c | ||
1115 | index 710d9a207d2b0..522f862eca526 100644 | ||
1116 | --- a/drivers/pwm/pwm-lpc32xx.c | ||
1117 | +++ b/drivers/pwm/pwm-lpc32xx.c | ||
1118 | @@ -120,17 +120,17 @@ static int lpc32xx_pwm_probe(struct platform_device *pdev) | ||
1119 | lpc32xx->chip.npwm = 1; | ||
1120 | lpc32xx->chip.base = -1; | ||
1121 | |||
1122 | + /* If PWM is disabled, configure the output to the default value */ | ||
1123 | + val = readl(lpc32xx->base + (lpc32xx->chip.pwms[0].hwpwm << 2)); | ||
1124 | + val &= ~PWM_PIN_LEVEL; | ||
1125 | + writel(val, lpc32xx->base + (lpc32xx->chip.pwms[0].hwpwm << 2)); | ||
1126 | + | ||
1127 | ret = pwmchip_add(&lpc32xx->chip); | ||
1128 | if (ret < 0) { | ||
1129 | dev_err(&pdev->dev, "failed to add PWM chip, error %d\n", ret); | ||
1130 | return ret; | ||
1131 | } | ||
1132 | |||
1133 | - /* When PWM is disable, configure the output to the default value */ | ||
1134 | - val = readl(lpc32xx->base + (lpc32xx->chip.pwms[0].hwpwm << 2)); | ||
1135 | - val &= ~PWM_PIN_LEVEL; | ||
1136 | - writel(val, lpc32xx->base + (lpc32xx->chip.pwms[0].hwpwm << 2)); | ||
1137 | - | ||
1138 | platform_set_drvdata(pdev, lpc32xx); | ||
1139 | |||
1140 | return 0; | ||
1141 | diff --git a/drivers/pwm/pwm-rockchip.c b/drivers/pwm/pwm-rockchip.c | ||
1142 | index 6ad6aad215cf1..8c0af705c5ae9 100644 | ||
1143 | --- a/drivers/pwm/pwm-rockchip.c | ||
1144 | +++ b/drivers/pwm/pwm-rockchip.c | ||
1145 | @@ -383,20 +383,6 @@ static int rockchip_pwm_remove(struct platform_device *pdev) | ||
1146 | { | ||
1147 | struct rockchip_pwm_chip *pc = platform_get_drvdata(pdev); | ||
1148 | |||
1149 | - /* | ||
1150 | - * Disable the PWM clk before unpreparing it if the PWM device is still | ||
1151 | - * running. This should only happen when the last PWM user left it | ||
1152 | - * enabled, or when nobody requested a PWM that was previously enabled | ||
1153 | - * by the bootloader. | ||
1154 | - * | ||
1155 | - * FIXME: Maybe the core should disable all PWM devices in | ||
1156 | - * pwmchip_remove(). In this case we'd only have to call | ||
1157 | - * clk_unprepare() after pwmchip_remove(). | ||
1158 | - * | ||
1159 | - */ | ||
1160 | - if (pwm_is_enabled(pc->chip.pwms)) | ||
1161 | - clk_disable(pc->clk); | ||
1162 | - | ||
1163 | clk_unprepare(pc->pclk); | ||
1164 | clk_unprepare(pc->clk); | ||
1165 | |||
1166 | diff --git a/drivers/pwm/pwm-stm32-lp.c b/drivers/pwm/pwm-stm32-lp.c | ||
1167 | index 67fca62524dc2..05bb1f95a7739 100644 | ||
1168 | --- a/drivers/pwm/pwm-stm32-lp.c | ||
1169 | +++ b/drivers/pwm/pwm-stm32-lp.c | ||
1170 | @@ -225,8 +225,6 @@ static int stm32_pwm_lp_remove(struct platform_device *pdev) | ||
1171 | { | ||
1172 | struct stm32_pwm_lp *priv = platform_get_drvdata(pdev); | ||
1173 | |||
1174 | - pwm_disable(&priv->chip.pwms[0]); | ||
1175 | - | ||
1176 | return pwmchip_remove(&priv->chip); | ||
1177 | } | ||
1178 | |||
1179 | diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig | ||
1180 | index 9ae7ce3f50696..0ad8d84aeb339 100644 | ||
1181 | --- a/drivers/rtc/Kconfig | ||
1182 | +++ b/drivers/rtc/Kconfig | ||
1183 | @@ -625,6 +625,7 @@ config RTC_DRV_FM3130 | ||
1184 | |||
1185 | config RTC_DRV_RX8010 | ||
1186 | tristate "Epson RX8010SJ" | ||
1187 | + select REGMAP_I2C | ||
1188 | help | ||
1189 | If you say yes here you get support for the Epson RX8010SJ RTC | ||
1190 | chip. | ||
1191 | diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c | ||
1192 | index 66cd43f963c9a..e739d1979c877 100644 | ||
1193 | --- a/drivers/staging/rtl8192u/r8192U_core.c | ||
1194 | +++ b/drivers/staging/rtl8192u/r8192U_core.c | ||
1195 | @@ -4338,7 +4338,7 @@ static void TranslateRxSignalStuff819xUsb(struct sk_buff *skb, | ||
1196 | bpacket_match_bssid = (type != IEEE80211_FTYPE_CTL) && | ||
1197 | (ether_addr_equal(priv->ieee80211->current_network.bssid, (fc & IEEE80211_FCTL_TODS) ? hdr->addr1 : (fc & IEEE80211_FCTL_FROMDS) ? hdr->addr2 : hdr->addr3)) | ||
1198 | && (!pstats->bHwError) && (!pstats->bCRC) && (!pstats->bICV); | ||
1199 | - bpacket_toself = bpacket_match_bssid & | ||
1200 | + bpacket_toself = bpacket_match_bssid && | ||
1201 | (ether_addr_equal(praddr, priv->ieee80211->dev->dev_addr)); | ||
1202 | |||
1203 | if (WLAN_FC_GET_FRAMETYPE(fc) == IEEE80211_STYPE_BEACON) | ||
1204 | diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c | ||
1205 | index fb2c55123a99e..059e3d1610c98 100644 | ||
1206 | --- a/drivers/thermal/samsung/exynos_tmu.c | ||
1207 | +++ b/drivers/thermal/samsung/exynos_tmu.c | ||
1208 | @@ -1070,6 +1070,7 @@ static int exynos_tmu_probe(struct platform_device *pdev) | ||
1209 | data->sclk = devm_clk_get(&pdev->dev, "tmu_sclk"); | ||
1210 | if (IS_ERR(data->sclk)) { | ||
1211 | dev_err(&pdev->dev, "Failed to get sclk\n"); | ||
1212 | + ret = PTR_ERR(data->sclk); | ||
1213 | goto err_clk; | ||
1214 | } else { | ||
1215 | ret = clk_prepare_enable(data->sclk); | ||
1216 | diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c | ||
1217 | index 6f013d7f5bd0f..404b80dc06b87 100644 | ||
1218 | --- a/drivers/tty/vt/vt.c | ||
1219 | +++ b/drivers/tty/vt/vt.c | ||
1220 | @@ -2070,7 +2070,7 @@ static void restore_cur(struct vc_data *vc) | ||
1221 | |||
1222 | enum { ESnormal, ESesc, ESsquare, ESgetpars, ESfunckey, | ||
1223 | EShash, ESsetG0, ESsetG1, ESpercent, EScsiignore, ESnonstd, | ||
1224 | - ESpalette, ESosc }; | ||
1225 | + ESpalette, ESosc, ESapc, ESpm, ESdcs }; | ||
1226 | |||
1227 | /* console_lock is held (except via vc_init()) */ | ||
1228 | static void reset_terminal(struct vc_data *vc, int do_clear) | ||
1229 | @@ -2124,20 +2124,28 @@ static void reset_terminal(struct vc_data *vc, int do_clear) | ||
1230 | csi_J(vc, 2); | ||
1231 | } | ||
1232 | |||
1233 | +/* is this state an ANSI control string? */ | ||
1234 | +static bool ansi_control_string(unsigned int state) | ||
1235 | +{ | ||
1236 | + if (state == ESosc || state == ESapc || state == ESpm || state == ESdcs) | ||
1237 | + return true; | ||
1238 | + return false; | ||
1239 | +} | ||
1240 | + | ||
1241 | /* console_lock is held */ | ||
1242 | static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c) | ||
1243 | { | ||
1244 | /* | ||
1245 | * Control characters can be used in the _middle_ | ||
1246 | - * of an escape sequence. | ||
1247 | + * of an escape sequence, aside from ANSI control strings. | ||
1248 | */ | ||
1249 | - if (vc->vc_state == ESosc && c>=8 && c<=13) /* ... except for OSC */ | ||
1250 | + if (ansi_control_string(vc->vc_state) && c >= 8 && c <= 13) | ||
1251 | return; | ||
1252 | switch (c) { | ||
1253 | case 0: | ||
1254 | return; | ||
1255 | case 7: | ||
1256 | - if (vc->vc_state == ESosc) | ||
1257 | + if (ansi_control_string(vc->vc_state)) | ||
1258 | vc->vc_state = ESnormal; | ||
1259 | else if (vc->vc_bell_duration) | ||
1260 | kd_mksound(vc->vc_bell_pitch, vc->vc_bell_duration); | ||
1261 | @@ -2196,6 +2204,12 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c) | ||
1262 | case ']': | ||
1263 | vc->vc_state = ESnonstd; | ||
1264 | return; | ||
1265 | + case '_': | ||
1266 | + vc->vc_state = ESapc; | ||
1267 | + return; | ||
1268 | + case '^': | ||
1269 | + vc->vc_state = ESpm; | ||
1270 | + return; | ||
1271 | case '%': | ||
1272 | vc->vc_state = ESpercent; | ||
1273 | return; | ||
1274 | @@ -2212,6 +2226,9 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c) | ||
1275 | case 'H': | ||
1276 | vc->vc_tab_stop[7 & (vc->vc_x >> 5)] |= (1 << (vc->vc_x & 31)); | ||
1277 | return; | ||
1278 | + case 'P': | ||
1279 | + vc->vc_state = ESdcs; | ||
1280 | + return; | ||
1281 | case 'Z': | ||
1282 | respond_ID(tty); | ||
1283 | return; | ||
1284 | @@ -2531,8 +2548,14 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c) | ||
1285 | vc->vc_translate = set_translate(vc->vc_G1_charset, vc); | ||
1286 | vc->vc_state = ESnormal; | ||
1287 | return; | ||
1288 | + case ESapc: | ||
1289 | + return; | ||
1290 | case ESosc: | ||
1291 | return; | ||
1292 | + case ESpm: | ||
1293 | + return; | ||
1294 | + case ESdcs: | ||
1295 | + return; | ||
1296 | default: | ||
1297 | vc->vc_state = ESnormal; | ||
1298 | } | ||
1299 | diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c | ||
1300 | index 8deee49a6b3fa..f302bbb93f32c 100644 | ||
1301 | --- a/fs/btrfs/volumes.c | ||
1302 | +++ b/fs/btrfs/volumes.c | ||
1303 | @@ -742,6 +742,8 @@ static int btrfs_free_stale_devices(const char *path, | ||
1304 | struct btrfs_device *device, *tmp_device; | ||
1305 | int ret = 0; | ||
1306 | |||
1307 | + lockdep_assert_held(&uuid_mutex); | ||
1308 | + | ||
1309 | if (path) | ||
1310 | ret = -ENOENT; | ||
1311 | |||
1312 | @@ -1181,11 +1183,12 @@ static struct btrfs_fs_devices *clone_fs_devices(struct btrfs_fs_devices *orig) | ||
1313 | struct btrfs_device *orig_dev; | ||
1314 | int ret = 0; | ||
1315 | |||
1316 | + lockdep_assert_held(&uuid_mutex); | ||
1317 | + | ||
1318 | fs_devices = alloc_fs_devices(orig->fsid, NULL); | ||
1319 | if (IS_ERR(fs_devices)) | ||
1320 | return fs_devices; | ||
1321 | |||
1322 | - mutex_lock(&orig->device_list_mutex); | ||
1323 | fs_devices->total_devices = orig->total_devices; | ||
1324 | |||
1325 | list_for_each_entry(orig_dev, &orig->devices, dev_list) { | ||
1326 | @@ -1217,10 +1220,8 @@ static struct btrfs_fs_devices *clone_fs_devices(struct btrfs_fs_devices *orig) | ||
1327 | device->fs_devices = fs_devices; | ||
1328 | fs_devices->num_devices++; | ||
1329 | } | ||
1330 | - mutex_unlock(&orig->device_list_mutex); | ||
1331 | return fs_devices; | ||
1332 | error: | ||
1333 | - mutex_unlock(&orig->device_list_mutex); | ||
1334 | free_fs_devices(fs_devices); | ||
1335 | return ERR_PTR(ret); | ||
1336 | } | ||
1337 | diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c | ||
1338 | index a49bf1fbaea82..0fad044a5752b 100644 | ||
1339 | --- a/fs/ceph/caps.c | ||
1340 | +++ b/fs/ceph/caps.c | ||
1341 | @@ -1775,6 +1775,8 @@ static u64 __mark_caps_flushing(struct inode *inode, | ||
1342 | * try to invalidate mapping pages without blocking. | ||
1343 | */ | ||
1344 | static int try_nonblocking_invalidate(struct inode *inode) | ||
1345 | + __releases(ci->i_ceph_lock) | ||
1346 | + __acquires(ci->i_ceph_lock) | ||
1347 | { | ||
1348 | struct ceph_inode_info *ci = ceph_inode(inode); | ||
1349 | u32 invalidating_gen = ci->i_rdcache_gen; | ||
1350 | diff --git a/fs/ceph/file.c b/fs/ceph/file.c | ||
1351 | index a10711a6337af..34785a203461d 100644 | ||
1352 | --- a/fs/ceph/file.c | ||
1353 | +++ b/fs/ceph/file.c | ||
1354 | @@ -1469,32 +1469,26 @@ retry_snap: | ||
1355 | goto out; | ||
1356 | } | ||
1357 | |||
1358 | - err = file_remove_privs(file); | ||
1359 | - if (err) | ||
1360 | + down_read(&osdc->lock); | ||
1361 | + map_flags = osdc->osdmap->flags; | ||
1362 | + pool_flags = ceph_pg_pool_flags(osdc->osdmap, ci->i_layout.pool_id); | ||
1363 | + up_read(&osdc->lock); | ||
1364 | + if ((map_flags & CEPH_OSDMAP_FULL) || | ||
1365 | + (pool_flags & CEPH_POOL_FLAG_FULL)) { | ||
1366 | + err = -ENOSPC; | ||
1367 | goto out; | ||
1368 | + } | ||
1369 | |||
1370 | - err = file_update_time(file); | ||
1371 | + err = file_remove_privs(file); | ||
1372 | if (err) | ||
1373 | goto out; | ||
1374 | |||
1375 | - inode_inc_iversion_raw(inode); | ||
1376 | - | ||
1377 | if (ci->i_inline_version != CEPH_INLINE_NONE) { | ||
1378 | err = ceph_uninline_data(file, NULL); | ||
1379 | if (err < 0) | ||
1380 | goto out; | ||
1381 | } | ||
1382 | |||
1383 | - down_read(&osdc->lock); | ||
1384 | - map_flags = osdc->osdmap->flags; | ||
1385 | - pool_flags = ceph_pg_pool_flags(osdc->osdmap, ci->i_layout.pool_id); | ||
1386 | - up_read(&osdc->lock); | ||
1387 | - if ((map_flags & CEPH_OSDMAP_FULL) || | ||
1388 | - (pool_flags & CEPH_POOL_FLAG_FULL)) { | ||
1389 | - err = -ENOSPC; | ||
1390 | - goto out; | ||
1391 | - } | ||
1392 | - | ||
1393 | dout("aio_write %p %llx.%llx %llu~%zd getting caps. i_size %llu\n", | ||
1394 | inode, ceph_vinop(inode), pos, count, i_size_read(inode)); | ||
1395 | if (fi->fmode & CEPH_FILE_MODE_LAZY) | ||
1396 | @@ -1507,6 +1501,12 @@ retry_snap: | ||
1397 | if (err < 0) | ||
1398 | goto out; | ||
1399 | |||
1400 | + err = file_update_time(file); | ||
1401 | + if (err) | ||
1402 | + goto out_caps; | ||
1403 | + | ||
1404 | + inode_inc_iversion_raw(inode); | ||
1405 | + | ||
1406 | dout("aio_write %p %llx.%llx %llu~%zd got cap refs on %s\n", | ||
1407 | inode, ceph_vinop(inode), pos, count, ceph_cap_string(got)); | ||
1408 | |||
1409 | @@ -1590,6 +1590,8 @@ retry_snap: | ||
1410 | } | ||
1411 | |||
1412 | goto out_unlocked; | ||
1413 | +out_caps: | ||
1414 | + ceph_put_cap_refs(ci, got); | ||
1415 | out: | ||
1416 | if (direct_lock) | ||
1417 | ceph_end_io_direct(inode); | ||
1418 | diff --git a/fs/nilfs2/sysfs.c b/fs/nilfs2/sysfs.c | ||
1419 | index c6c8a33c81d5e..28a2db3b1787f 100644 | ||
1420 | --- a/fs/nilfs2/sysfs.c | ||
1421 | +++ b/fs/nilfs2/sysfs.c | ||
1422 | @@ -64,11 +64,9 @@ static const struct sysfs_ops nilfs_##name##_attr_ops = { \ | ||
1423 | #define NILFS_DEV_INT_GROUP_TYPE(name, parent_name) \ | ||
1424 | static void nilfs_##name##_attr_release(struct kobject *kobj) \ | ||
1425 | { \ | ||
1426 | - struct nilfs_sysfs_##parent_name##_subgroups *subgroups; \ | ||
1427 | - struct the_nilfs *nilfs = container_of(kobj->parent, \ | ||
1428 | - struct the_nilfs, \ | ||
1429 | - ns_##parent_name##_kobj); \ | ||
1430 | - subgroups = nilfs->ns_##parent_name##_subgroups; \ | ||
1431 | + struct nilfs_sysfs_##parent_name##_subgroups *subgroups = container_of(kobj, \ | ||
1432 | + struct nilfs_sysfs_##parent_name##_subgroups, \ | ||
1433 | + sg_##name##_kobj); \ | ||
1434 | complete(&subgroups->sg_##name##_kobj_unregister); \ | ||
1435 | } \ | ||
1436 | static struct kobj_type nilfs_##name##_ktype = { \ | ||
1437 | @@ -94,12 +92,12 @@ static int nilfs_sysfs_create_##name##_group(struct the_nilfs *nilfs) \ | ||
1438 | err = kobject_init_and_add(kobj, &nilfs_##name##_ktype, parent, \ | ||
1439 | #name); \ | ||
1440 | if (err) \ | ||
1441 | - return err; \ | ||
1442 | - return 0; \ | ||
1443 | + kobject_put(kobj); \ | ||
1444 | + return err; \ | ||
1445 | } \ | ||
1446 | static void nilfs_sysfs_delete_##name##_group(struct the_nilfs *nilfs) \ | ||
1447 | { \ | ||
1448 | - kobject_del(&nilfs->ns_##parent_name##_subgroups->sg_##name##_kobj); \ | ||
1449 | + kobject_put(&nilfs->ns_##parent_name##_subgroups->sg_##name##_kobj); \ | ||
1450 | } | ||
1451 | |||
1452 | /************************************************************************ | ||
1453 | @@ -210,14 +208,14 @@ int nilfs_sysfs_create_snapshot_group(struct nilfs_root *root) | ||
1454 | } | ||
1455 | |||
1456 | if (err) | ||
1457 | - return err; | ||
1458 | + kobject_put(&root->snapshot_kobj); | ||
1459 | |||
1460 | - return 0; | ||
1461 | + return err; | ||
1462 | } | ||
1463 | |||
1464 | void nilfs_sysfs_delete_snapshot_group(struct nilfs_root *root) | ||
1465 | { | ||
1466 | - kobject_del(&root->snapshot_kobj); | ||
1467 | + kobject_put(&root->snapshot_kobj); | ||
1468 | } | ||
1469 | |||
1470 | /************************************************************************ | ||
1471 | @@ -1000,7 +998,7 @@ int nilfs_sysfs_create_device_group(struct super_block *sb) | ||
1472 | err = kobject_init_and_add(&nilfs->ns_dev_kobj, &nilfs_dev_ktype, NULL, | ||
1473 | "%s", sb->s_id); | ||
1474 | if (err) | ||
1475 | - goto free_dev_subgroups; | ||
1476 | + goto cleanup_dev_kobject; | ||
1477 | |||
1478 | err = nilfs_sysfs_create_mounted_snapshots_group(nilfs); | ||
1479 | if (err) | ||
1480 | @@ -1037,9 +1035,7 @@ delete_mounted_snapshots_group: | ||
1481 | nilfs_sysfs_delete_mounted_snapshots_group(nilfs); | ||
1482 | |||
1483 | cleanup_dev_kobject: | ||
1484 | - kobject_del(&nilfs->ns_dev_kobj); | ||
1485 | - | ||
1486 | -free_dev_subgroups: | ||
1487 | + kobject_put(&nilfs->ns_dev_kobj); | ||
1488 | kfree(nilfs->ns_dev_subgroups); | ||
1489 | |||
1490 | failed_create_device_group: | ||
1491 | diff --git a/fs/nilfs2/the_nilfs.c b/fs/nilfs2/the_nilfs.c | ||
1492 | index 484785cdf96e2..931870768556c 100644 | ||
1493 | --- a/fs/nilfs2/the_nilfs.c | ||
1494 | +++ b/fs/nilfs2/the_nilfs.c | ||
1495 | @@ -797,14 +797,13 @@ nilfs_find_or_create_root(struct the_nilfs *nilfs, __u64 cno) | ||
1496 | |||
1497 | void nilfs_put_root(struct nilfs_root *root) | ||
1498 | { | ||
1499 | - if (refcount_dec_and_test(&root->count)) { | ||
1500 | - struct the_nilfs *nilfs = root->nilfs; | ||
1501 | + struct the_nilfs *nilfs = root->nilfs; | ||
1502 | |||
1503 | - nilfs_sysfs_delete_snapshot_group(root); | ||
1504 | - | ||
1505 | - spin_lock(&nilfs->ns_cptree_lock); | ||
1506 | + if (refcount_dec_and_lock(&root->count, &nilfs->ns_cptree_lock)) { | ||
1507 | rb_erase(&root->rb_node, &nilfs->ns_cptree); | ||
1508 | spin_unlock(&nilfs->ns_cptree_lock); | ||
1509 | + | ||
1510 | + nilfs_sysfs_delete_snapshot_group(root); | ||
1511 | iput(root->ifile); | ||
1512 | |||
1513 | kfree(root); | ||
1514 | diff --git a/include/linux/cacheinfo.h b/include/linux/cacheinfo.h | ||
1515 | index 46b92cd61d0c8..c8c71eea237d6 100644 | ||
1516 | --- a/include/linux/cacheinfo.h | ||
1517 | +++ b/include/linux/cacheinfo.h | ||
1518 | @@ -78,24 +78,6 @@ struct cpu_cacheinfo { | ||
1519 | bool cpu_map_populated; | ||
1520 | }; | ||
1521 | |||
1522 | -/* | ||
1523 | - * Helpers to make sure "func" is executed on the cpu whose cache | ||
1524 | - * attributes are being detected | ||
1525 | - */ | ||
1526 | -#define DEFINE_SMP_CALL_CACHE_FUNCTION(func) \ | ||
1527 | -static inline void _##func(void *ret) \ | ||
1528 | -{ \ | ||
1529 | - int cpu = smp_processor_id(); \ | ||
1530 | - *(int *)ret = __##func(cpu); \ | ||
1531 | -} \ | ||
1532 | - \ | ||
1533 | -int func(unsigned int cpu) \ | ||
1534 | -{ \ | ||
1535 | - int ret; \ | ||
1536 | - smp_call_function_single(cpu, _##func, &ret, true); \ | ||
1537 | - return ret; \ | ||
1538 | -} | ||
1539 | - | ||
1540 | struct cpu_cacheinfo *get_cpu_cacheinfo(unsigned int cpu); | ||
1541 | int init_cache_level(unsigned int cpu); | ||
1542 | int populate_cache_leaves(unsigned int cpu); | ||
1543 | diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h | ||
1544 | index a1ff6b76aa8cd..19e8344c51a8c 100644 | ||
1545 | --- a/include/linux/kvm_host.h | ||
1546 | +++ b/include/linux/kvm_host.h | ||
1547 | @@ -266,7 +266,8 @@ struct kvm_vcpu { | ||
1548 | struct preempt_notifier preempt_notifier; | ||
1549 | #endif | ||
1550 | int cpu; | ||
1551 | - int vcpu_id; | ||
1552 | + int vcpu_id; /* id given by userspace at creation */ | ||
1553 | + int vcpu_idx; /* index in kvm->vcpus array */ | ||
1554 | int srcu_idx; | ||
1555 | int mode; | ||
1556 | u64 requests; | ||
1557 | @@ -571,13 +572,7 @@ static inline struct kvm_vcpu *kvm_get_vcpu_by_id(struct kvm *kvm, int id) | ||
1558 | |||
1559 | static inline int kvm_vcpu_get_idx(struct kvm_vcpu *vcpu) | ||
1560 | { | ||
1561 | - struct kvm_vcpu *tmp; | ||
1562 | - int idx; | ||
1563 | - | ||
1564 | - kvm_for_each_vcpu(idx, tmp, vcpu->kvm) | ||
1565 | - if (tmp == vcpu) | ||
1566 | - return idx; | ||
1567 | - BUG(); | ||
1568 | + return vcpu->vcpu_idx; | ||
1569 | } | ||
1570 | |||
1571 | #define kvm_for_each_memslot(memslot, slots) \ | ||
1572 | diff --git a/include/linux/pci-ecam.h b/include/linux/pci-ecam.h | ||
1573 | index a73164c85e78b..75456a66024a9 100644 | ||
1574 | --- a/include/linux/pci-ecam.h | ||
1575 | +++ b/include/linux/pci-ecam.h | ||
1576 | @@ -51,6 +51,7 @@ extern struct pci_ecam_ops pci_generic_ecam_ops; | ||
1577 | |||
1578 | #if defined(CONFIG_ACPI) && defined(CONFIG_PCI_QUIRKS) | ||
1579 | extern struct pci_ecam_ops pci_32b_ops; /* 32-bit accesses only */ | ||
1580 | +extern struct pci_ecam_ops pci_32b_read_ops; /* 32-bit read only */ | ||
1581 | extern struct pci_ecam_ops hisi_pcie_ops; /* HiSilicon */ | ||
1582 | extern struct pci_ecam_ops thunder_pem_ecam_ops; /* Cavium ThunderX 1.x & 2.x */ | ||
1583 | extern struct pci_ecam_ops pci_thunder_ecam_ops; /* Cavium ThunderX 1.x */ | ||
1584 | diff --git a/include/linux/thermal.h b/include/linux/thermal.h | ||
1585 | index e45659c759209..a41378bdf27c7 100644 | ||
1586 | --- a/include/linux/thermal.h | ||
1587 | +++ b/include/linux/thermal.h | ||
1588 | @@ -501,12 +501,13 @@ static inline void thermal_zone_device_update(struct thermal_zone_device *tz, | ||
1589 | static inline void thermal_zone_set_trips(struct thermal_zone_device *tz) | ||
1590 | { } | ||
1591 | static inline struct thermal_cooling_device * | ||
1592 | -thermal_cooling_device_register(char *type, void *devdata, | ||
1593 | +thermal_cooling_device_register(const char *type, void *devdata, | ||
1594 | const struct thermal_cooling_device_ops *ops) | ||
1595 | { return ERR_PTR(-ENODEV); } | ||
1596 | static inline struct thermal_cooling_device * | ||
1597 | thermal_of_cooling_device_register(struct device_node *np, | ||
1598 | - char *type, void *devdata, const struct thermal_cooling_device_ops *ops) | ||
1599 | + const char *type, void *devdata, | ||
1600 | + const struct thermal_cooling_device_ops *ops) | ||
1601 | { return ERR_PTR(-ENODEV); } | ||
1602 | static inline struct thermal_cooling_device * | ||
1603 | devm_thermal_of_cooling_device_register(struct device *dev, | ||
1604 | diff --git a/kernel/profile.c b/kernel/profile.c | ||
1605 | index af7c94bf5fa1d..e97e42aaf2023 100644 | ||
1606 | --- a/kernel/profile.c | ||
1607 | +++ b/kernel/profile.c | ||
1608 | @@ -41,7 +41,8 @@ struct profile_hit { | ||
1609 | #define NR_PROFILE_GRP (NR_PROFILE_HIT/PROFILE_GRPSZ) | ||
1610 | |||
1611 | static atomic_t *prof_buffer; | ||
1612 | -static unsigned long prof_len, prof_shift; | ||
1613 | +static unsigned long prof_len; | ||
1614 | +static unsigned short int prof_shift; | ||
1615 | |||
1616 | int prof_on __read_mostly; | ||
1617 | EXPORT_SYMBOL_GPL(prof_on); | ||
1618 | @@ -67,8 +68,8 @@ int profile_setup(char *str) | ||
1619 | if (str[strlen(sleepstr)] == ',') | ||
1620 | str += strlen(sleepstr) + 1; | ||
1621 | if (get_option(&str, &par)) | ||
1622 | - prof_shift = par; | ||
1623 | - pr_info("kernel sleep profiling enabled (shift: %ld)\n", | ||
1624 | + prof_shift = clamp(par, 0, BITS_PER_LONG - 1); | ||
1625 | + pr_info("kernel sleep profiling enabled (shift: %u)\n", | ||
1626 | prof_shift); | ||
1627 | #else | ||
1628 | pr_warn("kernel sleep profiling requires CONFIG_SCHEDSTATS\n"); | ||
1629 | @@ -78,21 +79,21 @@ int profile_setup(char *str) | ||
1630 | if (str[strlen(schedstr)] == ',') | ||
1631 | str += strlen(schedstr) + 1; | ||
1632 | if (get_option(&str, &par)) | ||
1633 | - prof_shift = par; | ||
1634 | - pr_info("kernel schedule profiling enabled (shift: %ld)\n", | ||
1635 | + prof_shift = clamp(par, 0, BITS_PER_LONG - 1); | ||
1636 | + pr_info("kernel schedule profiling enabled (shift: %u)\n", | ||
1637 | prof_shift); | ||
1638 | } else if (!strncmp(str, kvmstr, strlen(kvmstr))) { | ||
1639 | prof_on = KVM_PROFILING; | ||
1640 | if (str[strlen(kvmstr)] == ',') | ||
1641 | str += strlen(kvmstr) + 1; | ||
1642 | if (get_option(&str, &par)) | ||
1643 | - prof_shift = par; | ||
1644 | - pr_info("kernel KVM profiling enabled (shift: %ld)\n", | ||
1645 | + prof_shift = clamp(par, 0, BITS_PER_LONG - 1); | ||
1646 | + pr_info("kernel KVM profiling enabled (shift: %u)\n", | ||
1647 | prof_shift); | ||
1648 | } else if (get_option(&str, &par)) { | ||
1649 | - prof_shift = par; | ||
1650 | + prof_shift = clamp(par, 0, BITS_PER_LONG - 1); | ||
1651 | prof_on = CPU_PROFILING; | ||
1652 | - pr_info("kernel profiling enabled (shift: %ld)\n", | ||
1653 | + pr_info("kernel profiling enabled (shift: %u)\n", | ||
1654 | prof_shift); | ||
1655 | } | ||
1656 | return 1; | ||
1657 | @@ -468,7 +469,7 @@ read_profile(struct file *file, char __user *buf, size_t count, loff_t *ppos) | ||
1658 | unsigned long p = *ppos; | ||
1659 | ssize_t read; | ||
1660 | char *pnt; | ||
1661 | - unsigned int sample_step = 1 << prof_shift; | ||
1662 | + unsigned long sample_step = 1UL << prof_shift; | ||
1663 | |||
1664 | profile_flip_buffers(); | ||
1665 | if (p >= (prof_len+1)*sizeof(unsigned int)) | ||
1666 | diff --git a/kernel/sys.c b/kernel/sys.c | ||
1667 | index 3459a5ce0da01..b075fe84eb5a5 100644 | ||
1668 | --- a/kernel/sys.c | ||
1669 | +++ b/kernel/sys.c | ||
1670 | @@ -1927,13 +1927,6 @@ static int validate_prctl_map_addr(struct prctl_mm_map *prctl_map) | ||
1671 | |||
1672 | error = -EINVAL; | ||
1673 | |||
1674 | - /* | ||
1675 | - * @brk should be after @end_data in traditional maps. | ||
1676 | - */ | ||
1677 | - if (prctl_map->start_brk <= prctl_map->end_data || | ||
1678 | - prctl_map->brk <= prctl_map->end_data) | ||
1679 | - goto out; | ||
1680 | - | ||
1681 | /* | ||
1682 | * Neither we should allow to override limits if they set. | ||
1683 | */ | ||
1684 | diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug | ||
1685 | index ee00c6c8a373e..a846f03901dbd 100644 | ||
1686 | --- a/lib/Kconfig.debug | ||
1687 | +++ b/lib/Kconfig.debug | ||
1688 | @@ -868,7 +868,6 @@ config HARDLOCKUP_DETECTOR | ||
1689 | depends on HAVE_HARDLOCKUP_DETECTOR_PERF || HAVE_HARDLOCKUP_DETECTOR_ARCH | ||
1690 | select LOCKUP_DETECTOR | ||
1691 | select HARDLOCKUP_DETECTOR_PERF if HAVE_HARDLOCKUP_DETECTOR_PERF | ||
1692 | - select HARDLOCKUP_DETECTOR_ARCH if HAVE_HARDLOCKUP_DETECTOR_ARCH | ||
1693 | help | ||
1694 | Say Y here to enable the kernel to act as a watchdog to detect | ||
1695 | hard lockups. | ||
1696 | diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c | ||
1697 | index a3cd90a74012b..f582351d84ecb 100644 | ||
1698 | --- a/net/9p/trans_virtio.c | ||
1699 | +++ b/net/9p/trans_virtio.c | ||
1700 | @@ -605,7 +605,7 @@ static int p9_virtio_probe(struct virtio_device *vdev) | ||
1701 | chan->vc_wq = kmalloc(sizeof(wait_queue_head_t), GFP_KERNEL); | ||
1702 | if (!chan->vc_wq) { | ||
1703 | err = -ENOMEM; | ||
1704 | - goto out_free_tag; | ||
1705 | + goto out_remove_file; | ||
1706 | } | ||
1707 | init_waitqueue_head(chan->vc_wq); | ||
1708 | chan->ring_bufs_avail = 1; | ||
1709 | @@ -623,6 +623,8 @@ static int p9_virtio_probe(struct virtio_device *vdev) | ||
1710 | |||
1711 | return 0; | ||
1712 | |||
1713 | +out_remove_file: | ||
1714 | + sysfs_remove_file(&vdev->dev.kobj, &dev_attr_mount_tag.attr); | ||
1715 | out_free_tag: | ||
1716 | kfree(tag); | ||
1717 | out_free_vq: | ||
1718 | diff --git a/net/sctp/input.c b/net/sctp/input.c | ||
1719 | index db4f917aafd90..2aca37717ed1e 100644 | ||
1720 | --- a/net/sctp/input.c | ||
1721 | +++ b/net/sctp/input.c | ||
1722 | @@ -1168,6 +1168,9 @@ static struct sctp_association *__sctp_rcv_asconf_lookup( | ||
1723 | union sctp_addr_param *param; | ||
1724 | union sctp_addr paddr; | ||
1725 | |||
1726 | + if (ntohs(ch->length) < sizeof(*asconf) + sizeof(struct sctp_paramhdr)) | ||
1727 | + return NULL; | ||
1728 | + | ||
1729 | /* Skip over the ADDIP header and find the Address parameter */ | ||
1730 | param = (union sctp_addr_param *)(asconf + 1); | ||
1731 | |||
1732 | diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c | ||
1733 | index 38ca7ce8a44ed..000aa62281f46 100644 | ||
1734 | --- a/net/sctp/sm_make_chunk.c | ||
1735 | +++ b/net/sctp/sm_make_chunk.c | ||
1736 | @@ -2157,9 +2157,16 @@ static enum sctp_ierror sctp_verify_param(struct net *net, | ||
1737 | break; | ||
1738 | |||
1739 | case SCTP_PARAM_SET_PRIMARY: | ||
1740 | - if (ep->asconf_enable) | ||
1741 | - break; | ||
1742 | - goto unhandled; | ||
1743 | + if (!ep->asconf_enable) | ||
1744 | + goto unhandled; | ||
1745 | + | ||
1746 | + if (ntohs(param.p->length) < sizeof(struct sctp_addip_param) + | ||
1747 | + sizeof(struct sctp_paramhdr)) { | ||
1748 | + sctp_process_inv_paramlength(asoc, param.p, | ||
1749 | + chunk, err_chunk); | ||
1750 | + retval = SCTP_IERROR_ABORT; | ||
1751 | + } | ||
1752 | + break; | ||
1753 | |||
1754 | case SCTP_PARAM_HOST_NAME_ADDRESS: | ||
1755 | /* Tell the peer, we won't support this param. */ | ||
1756 | diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c | ||
1757 | index 47e4f2d91df75..7a8813677950f 100644 | ||
1758 | --- a/security/apparmor/apparmorfs.c | ||
1759 | +++ b/security/apparmor/apparmorfs.c | ||
1760 | @@ -1960,9 +1960,6 @@ fail2: | ||
1761 | return error; | ||
1762 | } | ||
1763 | |||
1764 | - | ||
1765 | -#define list_entry_is_head(pos, head, member) (&pos->member == (head)) | ||
1766 | - | ||
1767 | /** | ||
1768 | * __next_ns - find the next namespace to list | ||
1769 | * @root: root namespace to stop search at (NOT NULL) | ||
1770 | diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c | ||
1771 | index fc48298649c6c..77f84cbca7406 100644 | ||
1772 | --- a/virt/kvm/kvm_main.c | ||
1773 | +++ b/virt/kvm/kvm_main.c | ||
1774 | @@ -2864,7 +2864,8 @@ static int kvm_vm_ioctl_create_vcpu(struct kvm *kvm, u32 id) | ||
1775 | goto unlock_vcpu_destroy; | ||
1776 | } | ||
1777 | |||
1778 | - BUG_ON(kvm->vcpus[atomic_read(&kvm->online_vcpus)]); | ||
1779 | + vcpu->vcpu_idx = atomic_read(&kvm->online_vcpus); | ||
1780 | + BUG_ON(kvm->vcpus[vcpu->vcpu_idx]); | ||
1781 | |||
1782 | /* Now it's all set up, let userspace reach it */ | ||
1783 | kvm_get_kvm(kvm); | ||
1784 | @@ -2874,7 +2875,7 @@ static int kvm_vm_ioctl_create_vcpu(struct kvm *kvm, u32 id) | ||
1785 | goto unlock_vcpu_destroy; | ||
1786 | } | ||
1787 | |||
1788 | - kvm->vcpus[atomic_read(&kvm->online_vcpus)] = vcpu; | ||
1789 | + kvm->vcpus[vcpu->vcpu_idx] = vcpu; | ||
1790 | |||
1791 | /* | ||
1792 | * Pairs with smp_rmb() in kvm_get_vcpu. Write kvm->vcpus |