Magellan Linux

Contents of /trunk/kernel-alx/patches-3.18/0106-3.18.7-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2553 - (show annotations) (download)
Wed Mar 18 09:24:38 2015 UTC (9 years, 1 month ago) by niro
File size: 44258 byte(s)
-import from kernel-magellan
1 diff --git a/Makefile b/Makefile
2 index d2bff2d5ae25..0efae2279fbe 100644
3 --- a/Makefile
4 +++ b/Makefile
5 @@ -1,6 +1,6 @@
6 VERSION = 3
7 PATCHLEVEL = 18
8 -SUBLEVEL = 6
9 +SUBLEVEL = 7
10 EXTRAVERSION =
11 NAME = Diseased Newt
12
13 diff --git a/arch/arm/boot/dts/exynos4.dtsi b/arch/arm/boot/dts/exynos4.dtsi
14 index e0278ecbc816..98960b7bc518 100644
15 --- a/arch/arm/boot/dts/exynos4.dtsi
16 +++ b/arch/arm/boot/dts/exynos4.dtsi
17 @@ -368,7 +368,7 @@
18 };
19
20 i2s1: i2s@13960000 {
21 - compatible = "samsung,s5pv210-i2s";
22 + compatible = "samsung,s3c6410-i2s";
23 reg = <0x13960000 0x100>;
24 clocks = <&clock CLK_I2S1>;
25 clock-names = "iis";
26 @@ -378,7 +378,7 @@
27 };
28
29 i2s2: i2s@13970000 {
30 - compatible = "samsung,s5pv210-i2s";
31 + compatible = "samsung,s3c6410-i2s";
32 reg = <0x13970000 0x100>;
33 clocks = <&clock CLK_I2S2>;
34 clock-names = "iis";
35 diff --git a/arch/arm/mm/context.c b/arch/arm/mm/context.c
36 index 6eb97b3a7481..4370933f16cd 100644
37 --- a/arch/arm/mm/context.c
38 +++ b/arch/arm/mm/context.c
39 @@ -144,21 +144,17 @@ static void flush_context(unsigned int cpu)
40 /* Update the list of reserved ASIDs and the ASID bitmap. */
41 bitmap_clear(asid_map, 0, NUM_USER_ASIDS);
42 for_each_possible_cpu(i) {
43 - if (i == cpu) {
44 - asid = 0;
45 - } else {
46 - asid = atomic64_xchg(&per_cpu(active_asids, i), 0);
47 - /*
48 - * If this CPU has already been through a
49 - * rollover, but hasn't run another task in
50 - * the meantime, we must preserve its reserved
51 - * ASID, as this is the only trace we have of
52 - * the process it is still running.
53 - */
54 - if (asid == 0)
55 - asid = per_cpu(reserved_asids, i);
56 - __set_bit(asid & ~ASID_MASK, asid_map);
57 - }
58 + asid = atomic64_xchg(&per_cpu(active_asids, i), 0);
59 + /*
60 + * If this CPU has already been through a
61 + * rollover, but hasn't run another task in
62 + * the meantime, we must preserve its reserved
63 + * ASID, as this is the only trace we have of
64 + * the process it is still running.
65 + */
66 + if (asid == 0)
67 + asid = per_cpu(reserved_asids, i);
68 + __set_bit(asid & ~ASID_MASK, asid_map);
69 per_cpu(reserved_asids, i) = asid;
70 }
71
72 diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
73 index 64c4f0800ee3..38eead12f35b 100644
74 --- a/arch/arm64/kernel/setup.c
75 +++ b/arch/arm64/kernel/setup.c
76 @@ -43,6 +43,7 @@
77 #include <linux/of_fdt.h>
78 #include <linux/of_platform.h>
79 #include <linux/efi.h>
80 +#include <linux/personality.h>
81
82 #include <asm/fixmap.h>
83 #include <asm/cpu.h>
84 @@ -79,7 +80,6 @@ unsigned int compat_elf_hwcap2 __read_mostly;
85 #endif
86
87 static const char *cpu_name;
88 -static const char *machine_name;
89 phys_addr_t __fdt_pointer __initdata;
90
91 /*
92 @@ -311,8 +311,6 @@ static void __init setup_machine_fdt(phys_addr_t dt_phys)
93 while (true)
94 cpu_relax();
95 }
96 -
97 - machine_name = of_flat_dt_get_machine_name();
98 }
99
100 /*
101 @@ -449,14 +447,50 @@ static const char *hwcap_str[] = {
102 NULL
103 };
104
105 +#ifdef CONFIG_COMPAT
106 +static const char *compat_hwcap_str[] = {
107 + "swp",
108 + "half",
109 + "thumb",
110 + "26bit",
111 + "fastmult",
112 + "fpa",
113 + "vfp",
114 + "edsp",
115 + "java",
116 + "iwmmxt",
117 + "crunch",
118 + "thumbee",
119 + "neon",
120 + "vfpv3",
121 + "vfpv3d16",
122 + "tls",
123 + "vfpv4",
124 + "idiva",
125 + "idivt",
126 + "vfpd32",
127 + "lpae",
128 + "evtstrm"
129 +};
130 +
131 +static const char *compat_hwcap2_str[] = {
132 + "aes",
133 + "pmull",
134 + "sha1",
135 + "sha2",
136 + "crc32",
137 + NULL
138 +};
139 +#endif /* CONFIG_COMPAT */
140 +
141 static int c_show(struct seq_file *m, void *v)
142 {
143 - int i;
144 -
145 - seq_printf(m, "Processor\t: %s rev %d (%s)\n",
146 - cpu_name, read_cpuid_id() & 15, ELF_PLATFORM);
147 + int i, j;
148
149 for_each_online_cpu(i) {
150 + struct cpuinfo_arm64 *cpuinfo = &per_cpu(cpu_data, i);
151 + u32 midr = cpuinfo->reg_midr;
152 +
153 /*
154 * glibc reads /proc/cpuinfo to determine the number of
155 * online processors, looking for lines beginning with
156 @@ -465,24 +499,38 @@ static int c_show(struct seq_file *m, void *v)
157 #ifdef CONFIG_SMP
158 seq_printf(m, "processor\t: %d\n", i);
159 #endif
160 - }
161 -
162 - /* dump out the processor features */
163 - seq_puts(m, "Features\t: ");
164 -
165 - for (i = 0; hwcap_str[i]; i++)
166 - if (elf_hwcap & (1 << i))
167 - seq_printf(m, "%s ", hwcap_str[i]);
168 -
169 - seq_printf(m, "\nCPU implementer\t: 0x%02x\n", read_cpuid_id() >> 24);
170 - seq_printf(m, "CPU architecture: AArch64\n");
171 - seq_printf(m, "CPU variant\t: 0x%x\n", (read_cpuid_id() >> 20) & 15);
172 - seq_printf(m, "CPU part\t: 0x%03x\n", (read_cpuid_id() >> 4) & 0xfff);
173 - seq_printf(m, "CPU revision\t: %d\n", read_cpuid_id() & 15);
174
175 - seq_puts(m, "\n");
176 -
177 - seq_printf(m, "Hardware\t: %s\n", machine_name);
178 + /*
179 + * Dump out the common processor features in a single line.
180 + * Userspace should read the hwcaps with getauxval(AT_HWCAP)
181 + * rather than attempting to parse this, but there's a body of
182 + * software which does already (at least for 32-bit).
183 + */
184 + seq_puts(m, "Features\t:");
185 + if (personality(current->personality) == PER_LINUX32) {
186 +#ifdef CONFIG_COMPAT
187 + for (j = 0; compat_hwcap_str[j]; j++)
188 + if (compat_elf_hwcap & (1 << j))
189 + seq_printf(m, " %s", compat_hwcap_str[j]);
190 +
191 + for (j = 0; compat_hwcap2_str[j]; j++)
192 + if (compat_elf_hwcap2 & (1 << j))
193 + seq_printf(m, " %s", compat_hwcap2_str[j]);
194 +#endif /* CONFIG_COMPAT */
195 + } else {
196 + for (j = 0; hwcap_str[j]; j++)
197 + if (elf_hwcap & (1 << j))
198 + seq_printf(m, " %s", hwcap_str[j]);
199 + }
200 + seq_puts(m, "\n");
201 +
202 + seq_printf(m, "CPU implementer\t: 0x%02x\n",
203 + MIDR_IMPLEMENTOR(midr));
204 + seq_printf(m, "CPU architecture: 8\n");
205 + seq_printf(m, "CPU variant\t: 0x%x\n", MIDR_VARIANT(midr));
206 + seq_printf(m, "CPU part\t: 0x%03x\n", MIDR_PARTNUM(midr));
207 + seq_printf(m, "CPU revision\t: %d\n\n", MIDR_REVISION(midr));
208 + }
209
210 return 0;
211 }
212 diff --git a/arch/mips/cavium-octeon/smp.c b/arch/mips/cavium-octeon/smp.c
213 index ecd903dd1c45..8b1eeffa12ed 100644
214 --- a/arch/mips/cavium-octeon/smp.c
215 +++ b/arch/mips/cavium-octeon/smp.c
216 @@ -240,9 +240,7 @@ static int octeon_cpu_disable(void)
217
218 set_cpu_online(cpu, false);
219 cpu_clear(cpu, cpu_callin_map);
220 - local_irq_disable();
221 octeon_fixup_irqs();
222 - local_irq_enable();
223
224 flush_cache_all();
225 local_flush_tlb_all();
226 diff --git a/arch/mips/include/asm/mipsregs.h b/arch/mips/include/asm/mipsregs.h
227 index 22a135ac91de..f38ca68285ea 100644
228 --- a/arch/mips/include/asm/mipsregs.h
229 +++ b/arch/mips/include/asm/mipsregs.h
230 @@ -1343,12 +1343,27 @@ do { \
231 __res; \
232 })
233
234 +#define _write_32bit_cp1_register(dest, val, gas_hardfloat) \
235 +do { \
236 + __asm__ __volatile__( \
237 + " .set push \n" \
238 + " .set reorder \n" \
239 + " "STR(gas_hardfloat)" \n" \
240 + " ctc1 %0,"STR(dest)" \n" \
241 + " .set pop \n" \
242 + : : "r" (val)); \
243 +} while (0)
244 +
245 #ifdef GAS_HAS_SET_HARDFLOAT
246 #define read_32bit_cp1_register(source) \
247 _read_32bit_cp1_register(source, .set hardfloat)
248 +#define write_32bit_cp1_register(dest, val) \
249 + _write_32bit_cp1_register(dest, val, .set hardfloat)
250 #else
251 #define read_32bit_cp1_register(source) \
252 _read_32bit_cp1_register(source, )
253 +#define write_32bit_cp1_register(dest, val) \
254 + _write_32bit_cp1_register(dest, val, )
255 #endif
256
257 #ifdef HAVE_AS_DSP
258 diff --git a/arch/mips/kernel/irq_cpu.c b/arch/mips/kernel/irq_cpu.c
259 index e498f2b3646a..f5598e25e906 100644
260 --- a/arch/mips/kernel/irq_cpu.c
261 +++ b/arch/mips/kernel/irq_cpu.c
262 @@ -56,6 +56,8 @@ static struct irq_chip mips_cpu_irq_controller = {
263 .irq_mask_ack = mask_mips_irq,
264 .irq_unmask = unmask_mips_irq,
265 .irq_eoi = unmask_mips_irq,
266 + .irq_disable = mask_mips_irq,
267 + .irq_enable = unmask_mips_irq,
268 };
269
270 /*
271 @@ -92,6 +94,8 @@ static struct irq_chip mips_mt_cpu_irq_controller = {
272 .irq_mask_ack = mips_mt_cpu_irq_ack,
273 .irq_unmask = unmask_mips_irq,
274 .irq_eoi = unmask_mips_irq,
275 + .irq_disable = mask_mips_irq,
276 + .irq_enable = unmask_mips_irq,
277 };
278
279 void __init mips_cpu_irq_init(void)
280 diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
281 index c94c4e92e17d..1c0d8c50b7e1 100644
282 --- a/arch/mips/kernel/smp.c
283 +++ b/arch/mips/kernel/smp.c
284 @@ -123,10 +123,10 @@ asmlinkage void start_secondary(void)
285 unsigned int cpu;
286
287 cpu_probe();
288 - cpu_report();
289 per_cpu_trap_init(false);
290 mips_clockevent_init();
291 mp_ops->init_secondary();
292 + cpu_report();
293
294 /*
295 * XXX parity protection should be folded in here when it's converted
296 diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
297 index 22b19c275044..d255a2a1837a 100644
298 --- a/arch/mips/kernel/traps.c
299 +++ b/arch/mips/kernel/traps.c
300 @@ -1184,7 +1184,8 @@ static int enable_restore_fp_context(int msa)
301
302 /* Restore the scalar FP control & status register */
303 if (!was_fpu_owner)
304 - asm volatile("ctc1 %0, $31" : : "r"(current->thread.fpu.fcr31));
305 + write_32bit_cp1_register(CP1_STATUS,
306 + current->thread.fpu.fcr31);
307 }
308
309 out:
310 diff --git a/arch/mips/mm/tlb-r4k.c b/arch/mips/mm/tlb-r4k.c
311 index c3917e251f59..11688e50e3ee 100644
312 --- a/arch/mips/mm/tlb-r4k.c
313 +++ b/arch/mips/mm/tlb-r4k.c
314 @@ -489,6 +489,8 @@ static void r4k_tlb_configure(void)
315 #ifdef CONFIG_64BIT
316 pg |= PG_ELPA;
317 #endif
318 + if (cpu_has_rixiex)
319 + pg |= PG_IEC;
320 write_c0_pagegrain(pg);
321 }
322
323 diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
324 index 15c29096136b..36a83617eb21 100644
325 --- a/arch/x86/kernel/cpu/microcode/core.c
326 +++ b/arch/x86/kernel/cpu/microcode/core.c
327 @@ -552,7 +552,7 @@ static int __init microcode_init(void)
328 int error;
329
330 if (paravirt_enabled() || dis_ucode_ldr)
331 - return 0;
332 + return -EINVAL;
333
334 if (c->x86_vendor == X86_VENDOR_INTEL)
335 microcode_ops = init_intel_microcode();
336 diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
337 index a8612aafeca1..4d8ee827cb14 100644
338 --- a/arch/x86/mm/fault.c
339 +++ b/arch/x86/mm/fault.c
340 @@ -844,11 +844,8 @@ do_sigbus(struct pt_regs *regs, unsigned long error_code, unsigned long address,
341 unsigned int fault)
342 {
343 struct task_struct *tsk = current;
344 - struct mm_struct *mm = tsk->mm;
345 int code = BUS_ADRERR;
346
347 - up_read(&mm->mmap_sem);
348 -
349 /* Kernel mode? Handle exceptions or die: */
350 if (!(error_code & PF_USER)) {
351 no_context(regs, error_code, address, SIGBUS, BUS_ADRERR);
352 @@ -879,7 +876,6 @@ mm_fault_error(struct pt_regs *regs, unsigned long error_code,
353 unsigned long address, unsigned int fault)
354 {
355 if (fatal_signal_pending(current) && !(error_code & PF_USER)) {
356 - up_read(&current->mm->mmap_sem);
357 no_context(regs, error_code, address, 0, 0);
358 return;
359 }
360 @@ -887,14 +883,11 @@ mm_fault_error(struct pt_regs *regs, unsigned long error_code,
361 if (fault & VM_FAULT_OOM) {
362 /* Kernel mode? Handle exceptions or die: */
363 if (!(error_code & PF_USER)) {
364 - up_read(&current->mm->mmap_sem);
365 no_context(regs, error_code, address,
366 SIGSEGV, SEGV_MAPERR);
367 return;
368 }
369
370 - up_read(&current->mm->mmap_sem);
371 -
372 /*
373 * We ran out of memory, call the OOM killer, and return the
374 * userspace (which will retry the fault, or kill us if we got
375 @@ -1249,6 +1242,7 @@ good_area:
376 return;
377
378 if (unlikely(fault & VM_FAULT_ERROR)) {
379 + up_read(&mm->mmap_sem);
380 mm_fault_error(regs, error_code, address, fault);
381 return;
382 }
383 diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
384 index 7b20bccf3648..2fb384724ebb 100644
385 --- a/arch/x86/pci/common.c
386 +++ b/arch/x86/pci/common.c
387 @@ -448,6 +448,22 @@ static const struct dmi_system_id pciprobe_dmi_table[] __initconst = {
388 DMI_MATCH(DMI_PRODUCT_NAME, "ftServer"),
389 },
390 },
391 + {
392 + .callback = set_scan_all,
393 + .ident = "Stratus/NEC ftServer",
394 + .matches = {
395 + DMI_MATCH(DMI_SYS_VENDOR, "NEC"),
396 + DMI_MATCH(DMI_PRODUCT_NAME, "Express5800/R32"),
397 + },
398 + },
399 + {
400 + .callback = set_scan_all,
401 + .ident = "Stratus/NEC ftServer",
402 + .matches = {
403 + DMI_MATCH(DMI_SYS_VENDOR, "NEC"),
404 + DMI_MATCH(DMI_PRODUCT_NAME, "Express5800/R31"),
405 + },
406 + },
407 {}
408 };
409
410 diff --git a/drivers/gpio/gpio-mcp23s08.c b/drivers/gpio/gpio-mcp23s08.c
411 index 8488e2fd307c..36bc42942e89 100644
412 --- a/drivers/gpio/gpio-mcp23s08.c
413 +++ b/drivers/gpio/gpio-mcp23s08.c
414 @@ -785,9 +785,11 @@ static int mcp230xx_probe(struct i2c_client *client,
415 client->irq = irq_of_parse_and_map(client->dev.of_node, 0);
416 } else {
417 pdata = dev_get_platdata(&client->dev);
418 - if (!pdata || !gpio_is_valid(pdata->base)) {
419 - dev_dbg(&client->dev, "invalid platform data\n");
420 - return -EINVAL;
421 + if (!pdata) {
422 + pdata = devm_kzalloc(&client->dev,
423 + sizeof(struct mcp23s08_platform_data),
424 + GFP_KERNEL);
425 + pdata->base = -1;
426 }
427 }
428
429 @@ -908,10 +910,11 @@ static int mcp23s08_probe(struct spi_device *spi)
430 } else {
431 type = spi_get_device_id(spi)->driver_data;
432 pdata = dev_get_platdata(&spi->dev);
433 - if (!pdata || !gpio_is_valid(pdata->base)) {
434 - dev_dbg(&spi->dev,
435 - "invalid or missing platform data\n");
436 - return -EINVAL;
437 + if (!pdata) {
438 + pdata = devm_kzalloc(&spi->dev,
439 + sizeof(struct mcp23s08_platform_data),
440 + GFP_KERNEL);
441 + pdata->base = -1;
442 }
443
444 for (addr = 0; addr < ARRAY_SIZE(pdata->chip); addr++) {
445 diff --git a/drivers/gpio/gpiolib-sysfs.c b/drivers/gpio/gpiolib-sysfs.c
446 index 0d21396f961d..aed7dd6e9dca 100644
447 --- a/drivers/gpio/gpiolib-sysfs.c
448 +++ b/drivers/gpio/gpiolib-sysfs.c
449 @@ -630,6 +630,7 @@ int gpiod_export_link(struct device *dev, const char *name,
450 if (tdev != NULL) {
451 status = sysfs_create_link(&dev->kobj, &tdev->kobj,
452 name);
453 + put_device(tdev);
454 } else {
455 status = -ENODEV;
456 }
457 @@ -677,7 +678,7 @@ int gpiod_sysfs_set_active_low(struct gpio_desc *desc, int value)
458 }
459
460 status = sysfs_set_active_low(desc, dev, value);
461 -
462 + put_device(dev);
463 unlock:
464 mutex_unlock(&sysfs_lock);
465
466 diff --git a/drivers/gpu/drm/radeon/radeon_benchmark.c b/drivers/gpu/drm/radeon/radeon_benchmark.c
467 index 9e7f23dd14bd..87d5fb21cb61 100644
468 --- a/drivers/gpu/drm/radeon/radeon_benchmark.c
469 +++ b/drivers/gpu/drm/radeon/radeon_benchmark.c
470 @@ -34,7 +34,8 @@
471
472 static int radeon_benchmark_do_move(struct radeon_device *rdev, unsigned size,
473 uint64_t saddr, uint64_t daddr,
474 - int flag, int n)
475 + int flag, int n,
476 + struct reservation_object *resv)
477 {
478 unsigned long start_jiffies;
479 unsigned long end_jiffies;
480 @@ -47,12 +48,12 @@ static int radeon_benchmark_do_move(struct radeon_device *rdev, unsigned size,
481 case RADEON_BENCHMARK_COPY_DMA:
482 fence = radeon_copy_dma(rdev, saddr, daddr,
483 size / RADEON_GPU_PAGE_SIZE,
484 - NULL);
485 + resv);
486 break;
487 case RADEON_BENCHMARK_COPY_BLIT:
488 fence = radeon_copy_blit(rdev, saddr, daddr,
489 size / RADEON_GPU_PAGE_SIZE,
490 - NULL);
491 + resv);
492 break;
493 default:
494 DRM_ERROR("Unknown copy method\n");
495 @@ -120,7 +121,8 @@ static void radeon_benchmark_move(struct radeon_device *rdev, unsigned size,
496
497 if (rdev->asic->copy.dma) {
498 time = radeon_benchmark_do_move(rdev, size, saddr, daddr,
499 - RADEON_BENCHMARK_COPY_DMA, n);
500 + RADEON_BENCHMARK_COPY_DMA, n,
501 + dobj->tbo.resv);
502 if (time < 0)
503 goto out_cleanup;
504 if (time > 0)
505 @@ -130,7 +132,8 @@ static void radeon_benchmark_move(struct radeon_device *rdev, unsigned size,
506
507 if (rdev->asic->copy.blit) {
508 time = radeon_benchmark_do_move(rdev, size, saddr, daddr,
509 - RADEON_BENCHMARK_COPY_BLIT, n);
510 + RADEON_BENCHMARK_COPY_BLIT, n,
511 + dobj->tbo.resv);
512 if (time < 0)
513 goto out_cleanup;
514 if (time > 0)
515 diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
516 index 00ead8c2758a..2e1e9aa79cea 100644
517 --- a/drivers/gpu/drm/radeon/radeon_display.c
518 +++ b/drivers/gpu/drm/radeon/radeon_display.c
519 @@ -959,6 +959,9 @@ void radeon_compute_pll_avivo(struct radeon_pll *pll,
520 if (pll->flags & RADEON_PLL_USE_FRAC_FB_DIV &&
521 pll->flags & RADEON_PLL_USE_REF_DIV)
522 ref_div_max = pll->reference_div;
523 + else if (pll->flags & RADEON_PLL_PREFER_MINM_OVER_MAXP)
524 + /* fix for problems on RS880 */
525 + ref_div_max = min(pll->max_ref_div, 7u);
526 else
527 ref_div_max = pll->max_ref_div;
528
529 diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c
530 index c194497aa586..b4abff67c63f 100644
531 --- a/drivers/gpu/drm/radeon/radeon_gem.c
532 +++ b/drivers/gpu/drm/radeon/radeon_gem.c
533 @@ -146,7 +146,8 @@ int radeon_gem_object_open(struct drm_gem_object *obj, struct drm_file *file_pri
534 struct radeon_bo_va *bo_va;
535 int r;
536
537 - if (rdev->family < CHIP_CAYMAN) {
538 + if ((rdev->family < CHIP_CAYMAN) ||
539 + (!rdev->accel_working)) {
540 return 0;
541 }
542
543 @@ -176,7 +177,8 @@ void radeon_gem_object_close(struct drm_gem_object *obj,
544 struct radeon_bo_va *bo_va;
545 int r;
546
547 - if (rdev->family < CHIP_CAYMAN) {
548 + if ((rdev->family < CHIP_CAYMAN) ||
549 + (!rdev->accel_working)) {
550 return;
551 }
552
553 diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c
554 index 03586763ee86..8ec652722e4f 100644
555 --- a/drivers/gpu/drm/radeon/radeon_kms.c
556 +++ b/drivers/gpu/drm/radeon/radeon_kms.c
557 @@ -598,14 +598,14 @@ int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv)
558 return -ENOMEM;
559 }
560
561 - vm = &fpriv->vm;
562 - r = radeon_vm_init(rdev, vm);
563 - if (r) {
564 - kfree(fpriv);
565 - return r;
566 - }
567 -
568 if (rdev->accel_working) {
569 + vm = &fpriv->vm;
570 + r = radeon_vm_init(rdev, vm);
571 + if (r) {
572 + kfree(fpriv);
573 + return r;
574 + }
575 +
576 r = radeon_bo_reserve(rdev->ring_tmp_bo.bo, false);
577 if (r) {
578 radeon_vm_fini(rdev, vm);
579 @@ -663,9 +663,9 @@ void radeon_driver_postclose_kms(struct drm_device *dev,
580 radeon_vm_bo_rmv(rdev, vm->ib_bo_va);
581 radeon_bo_unreserve(rdev->ring_tmp_bo.bo);
582 }
583 + radeon_vm_fini(rdev, vm);
584 }
585
586 - radeon_vm_fini(rdev, vm);
587 kfree(fpriv);
588 file_priv->driver_priv = NULL;
589 }
590 diff --git a/drivers/gpu/drm/radeon/radeon_test.c b/drivers/gpu/drm/radeon/radeon_test.c
591 index 07b506b41008..791818165c76 100644
592 --- a/drivers/gpu/drm/radeon/radeon_test.c
593 +++ b/drivers/gpu/drm/radeon/radeon_test.c
594 @@ -119,11 +119,11 @@ static void radeon_do_test_moves(struct radeon_device *rdev, int flag)
595 if (ring == R600_RING_TYPE_DMA_INDEX)
596 fence = radeon_copy_dma(rdev, gtt_addr, vram_addr,
597 size / RADEON_GPU_PAGE_SIZE,
598 - NULL);
599 + vram_obj->tbo.resv);
600 else
601 fence = radeon_copy_blit(rdev, gtt_addr, vram_addr,
602 size / RADEON_GPU_PAGE_SIZE,
603 - NULL);
604 + vram_obj->tbo.resv);
605 if (IS_ERR(fence)) {
606 DRM_ERROR("Failed GTT->VRAM copy %d\n", i);
607 r = PTR_ERR(fence);
608 @@ -170,11 +170,11 @@ static void radeon_do_test_moves(struct radeon_device *rdev, int flag)
609 if (ring == R600_RING_TYPE_DMA_INDEX)
610 fence = radeon_copy_dma(rdev, vram_addr, gtt_addr,
611 size / RADEON_GPU_PAGE_SIZE,
612 - NULL);
613 + vram_obj->tbo.resv);
614 else
615 fence = radeon_copy_blit(rdev, vram_addr, gtt_addr,
616 size / RADEON_GPU_PAGE_SIZE,
617 - NULL);
618 + vram_obj->tbo.resv);
619 if (IS_ERR(fence)) {
620 DRM_ERROR("Failed VRAM->GTT copy %d\n", i);
621 r = PTR_ERR(fence);
622 diff --git a/drivers/gpu/drm/radeon/radeon_vm.c b/drivers/gpu/drm/radeon/radeon_vm.c
623 index dfde266529e2..afbdf9e685d1 100644
624 --- a/drivers/gpu/drm/radeon/radeon_vm.c
625 +++ b/drivers/gpu/drm/radeon/radeon_vm.c
626 @@ -753,9 +753,11 @@ static void radeon_vm_frag_ptes(struct radeon_device *rdev,
627 */
628
629 /* NI is optimized for 256KB fragments, SI and newer for 64KB */
630 - uint64_t frag_flags = rdev->family == CHIP_CAYMAN ?
631 + uint64_t frag_flags = ((rdev->family == CHIP_CAYMAN) ||
632 + (rdev->family == CHIP_ARUBA)) ?
633 R600_PTE_FRAG_256KB : R600_PTE_FRAG_64KB;
634 - uint64_t frag_align = rdev->family == CHIP_CAYMAN ? 0x200 : 0x80;
635 + uint64_t frag_align = ((rdev->family == CHIP_CAYMAN) ||
636 + (rdev->family == CHIP_ARUBA)) ? 0x200 : 0x80;
637
638 uint64_t frag_start = ALIGN(pe_start, frag_align);
639 uint64_t frag_end = pe_end & ~(frag_align - 1);
640 diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
641 index c1b0d52bfcb0..b98765f6f77f 100644
642 --- a/drivers/md/raid5.c
643 +++ b/drivers/md/raid5.c
644 @@ -3195,6 +3195,11 @@ static void handle_stripe_dirtying(struct r5conf *conf,
645 (unsigned long long)sh->sector,
646 rcw, qread, test_bit(STRIPE_DELAYED, &sh->state));
647 }
648 +
649 + if (rcw > disks && rmw > disks &&
650 + !test_bit(STRIPE_PREREAD_ACTIVE, &sh->state))
651 + set_bit(STRIPE_DELAYED, &sh->state);
652 +
653 /* now if nothing is locked, and if we have enough data,
654 * we can start a write request
655 */
656 diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c
657 index dfed00aa3ac0..f0fcbceee209 100644
658 --- a/drivers/pci/host/pcie-designware.c
659 +++ b/drivers/pci/host/pcie-designware.c
660 @@ -283,6 +283,9 @@ static int dw_msi_setup_irq(struct msi_chip *chip, struct pci_dev *pdev,
661 struct msi_msg msg;
662 struct pcie_port *pp = sys_to_pcie(pdev->bus->sysdata);
663
664 + if (desc->msi_attrib.is_msix)
665 + return -EINVAL;
666 +
667 irq = assign_irq(1, desc, &pos);
668 if (irq < 0)
669 return irq;
670 diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
671 index b72e2cdfd59a..04ea682ab2aa 100644
672 --- a/drivers/pci/quirks.c
673 +++ b/drivers/pci/quirks.c
674 @@ -324,18 +324,52 @@ static void quirk_s3_64M(struct pci_dev *dev)
675 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_S3, PCI_DEVICE_ID_S3_868, quirk_s3_64M);
676 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_S3, PCI_DEVICE_ID_S3_968, quirk_s3_64M);
677
678 +static void quirk_io(struct pci_dev *dev, int pos, unsigned size,
679 + const char *name)
680 +{
681 + u32 region;
682 + struct pci_bus_region bus_region;
683 + struct resource *res = dev->resource + pos;
684 +
685 + pci_read_config_dword(dev, PCI_BASE_ADDRESS_0 + (pos << 2), &region);
686 +
687 + if (!region)
688 + return;
689 +
690 + res->name = pci_name(dev);
691 + res->flags = region & ~PCI_BASE_ADDRESS_IO_MASK;
692 + res->flags |=
693 + (IORESOURCE_IO | IORESOURCE_PCI_FIXED | IORESOURCE_SIZEALIGN);
694 + region &= ~(size - 1);
695 +
696 + /* Convert from PCI bus to resource space */
697 + bus_region.start = region;
698 + bus_region.end = region + size - 1;
699 + pcibios_bus_to_resource(dev->bus, res, &bus_region);
700 +
701 + dev_info(&dev->dev, FW_BUG "%s quirk: reg 0x%x: %pR\n",
702 + name, PCI_BASE_ADDRESS_0 + (pos << 2), res);
703 +}
704 +
705 /*
706 * Some CS5536 BIOSes (for example, the Soekris NET5501 board w/ comBIOS
707 * ver. 1.33 20070103) don't set the correct ISA PCI region header info.
708 * BAR0 should be 8 bytes; instead, it may be set to something like 8k
709 * (which conflicts w/ BAR1's memory range).
710 + *
711 + * CS553x's ISA PCI BARs may also be read-only (ref:
712 + * https://bugzilla.kernel.org/show_bug.cgi?id=85991 - Comment #4 forward).
713 */
714 static void quirk_cs5536_vsa(struct pci_dev *dev)
715 {
716 + static char *name = "CS5536 ISA bridge";
717 +
718 if (pci_resource_len(dev, 0) != 8) {
719 - struct resource *res = &dev->resource[0];
720 - res->end = res->start + 8 - 1;
721 - dev_info(&dev->dev, "CS5536 ISA bridge bug detected (incorrect header); workaround applied\n");
722 + quirk_io(dev, 0, 8, name); /* SMB */
723 + quirk_io(dev, 1, 256, name); /* GPIO */
724 + quirk_io(dev, 2, 64, name); /* MFGPT */
725 + dev_info(&dev->dev, "%s bug detected (incorrect header); workaround applied\n",
726 + name);
727 }
728 }
729 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_ISA, quirk_cs5536_vsa);
730 diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
731 index cfba74cd8e8b..dd8c8d690763 100644
732 --- a/drivers/scsi/sd.c
733 +++ b/drivers/scsi/sd.c
734 @@ -2818,9 +2818,11 @@ static int sd_revalidate_disk(struct gendisk *disk)
735 */
736 sd_set_flush_flag(sdkp);
737
738 - max_xfer = min_not_zero(queue_max_hw_sectors(sdkp->disk->queue),
739 - sdkp->max_xfer_blocks);
740 + max_xfer = sdkp->max_xfer_blocks;
741 max_xfer <<= ilog2(sdp->sector_size) - 9;
742 +
743 + max_xfer = min_not_zero(queue_max_hw_sectors(sdkp->disk->queue),
744 + max_xfer);
745 blk_queue_max_hw_sectors(sdkp->disk->queue, max_xfer);
746 set_capacity(disk, sdkp->capacity);
747 sd_config_write_same(sdkp);
748 diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c
749 index 831ceb4a91f6..276a3cf864d7 100644
750 --- a/drivers/spi/spi-fsl-dspi.c
751 +++ b/drivers/spi/spi-fsl-dspi.c
752 @@ -342,8 +342,7 @@ static int dspi_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
753 /* Only alloc on first setup */
754 chip = spi_get_ctldata(spi);
755 if (chip == NULL) {
756 - chip = devm_kzalloc(&spi->dev, sizeof(struct chip_data),
757 - GFP_KERNEL);
758 + chip = kzalloc(sizeof(struct chip_data), GFP_KERNEL);
759 if (!chip)
760 return -ENOMEM;
761 }
762 @@ -382,6 +381,16 @@ static int dspi_setup(struct spi_device *spi)
763 return dspi_setup_transfer(spi, NULL);
764 }
765
766 +static void dspi_cleanup(struct spi_device *spi)
767 +{
768 + struct chip_data *chip = spi_get_ctldata((struct spi_device *)spi);
769 +
770 + dev_dbg(&spi->dev, "spi_device %u.%u cleanup\n",
771 + spi->master->bus_num, spi->chip_select);
772 +
773 + kfree(chip);
774 +}
775 +
776 static irqreturn_t dspi_interrupt(int irq, void *dev_id)
777 {
778 struct fsl_dspi *dspi = (struct fsl_dspi *)dev_id;
779 @@ -467,6 +476,7 @@ static int dspi_probe(struct platform_device *pdev)
780 dspi->bitbang.master->setup = dspi_setup;
781 dspi->bitbang.master->dev.of_node = pdev->dev.of_node;
782
783 + master->cleanup = dspi_cleanup;
784 master->mode_bits = SPI_CPOL | SPI_CPHA;
785 master->bits_per_word_mask = SPI_BPW_MASK(4) | SPI_BPW_MASK(8) |
786 SPI_BPW_MASK(16);
787 diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
788 index 3637847b5370..82269a86fd7a 100644
789 --- a/drivers/spi/spi-imx.c
790 +++ b/drivers/spi/spi-imx.c
791 @@ -823,6 +823,10 @@ static int spi_imx_sdma_init(struct device *dev, struct spi_imx_data *spi_imx,
792 struct dma_slave_config slave_config = {};
793 int ret;
794
795 + /* use pio mode for i.mx6dl chip TKT238285 */
796 + if (of_machine_is_compatible("fsl,imx6dl"))
797 + return 0;
798 +
799 /* Prepare for TX DMA: */
800 master->dma_tx = dma_request_slave_channel(dev, "tx");
801 if (!master->dma_tx) {
802 diff --git a/fs/cifs/file.c b/fs/cifs/file.c
803 index 3e4d00a06c44..9a7b6947874a 100644
804 --- a/fs/cifs/file.c
805 +++ b/fs/cifs/file.c
806 @@ -366,6 +366,7 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file)
807 struct cifsLockInfo *li, *tmp;
808 struct cifs_fid fid;
809 struct cifs_pending_open open;
810 + bool oplock_break_cancelled;
811
812 spin_lock(&cifs_file_list_lock);
813 if (--cifs_file->count > 0) {
814 @@ -397,7 +398,7 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file)
815 }
816 spin_unlock(&cifs_file_list_lock);
817
818 - cancel_work_sync(&cifs_file->oplock_break);
819 + oplock_break_cancelled = cancel_work_sync(&cifs_file->oplock_break);
820
821 if (!tcon->need_reconnect && !cifs_file->invalidHandle) {
822 struct TCP_Server_Info *server = tcon->ses->server;
823 @@ -409,6 +410,9 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file)
824 _free_xid(xid);
825 }
826
827 + if (oplock_break_cancelled)
828 + cifs_done_oplock_break(cifsi);
829 +
830 cifs_del_pending_open(&open);
831
832 /*
833 diff --git a/fs/nilfs2/nilfs.h b/fs/nilfs2/nilfs.h
834 index 91093cd74f0d..385704027575 100644
835 --- a/fs/nilfs2/nilfs.h
836 +++ b/fs/nilfs2/nilfs.h
837 @@ -141,7 +141,6 @@ enum {
838 * @ti_save: Backup of journal_info field of task_struct
839 * @ti_flags: Flags
840 * @ti_count: Nest level
841 - * @ti_garbage: List of inode to be put when releasing semaphore
842 */
843 struct nilfs_transaction_info {
844 u32 ti_magic;
845 @@ -150,7 +149,6 @@ struct nilfs_transaction_info {
846 one of other filesystems has a bug. */
847 unsigned short ti_flags;
848 unsigned short ti_count;
849 - struct list_head ti_garbage;
850 };
851
852 /* ti_magic */
853 diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
854 index 7ef18fc656c2..469086b9f99b 100644
855 --- a/fs/nilfs2/segment.c
856 +++ b/fs/nilfs2/segment.c
857 @@ -305,7 +305,6 @@ static void nilfs_transaction_lock(struct super_block *sb,
858 ti->ti_count = 0;
859 ti->ti_save = cur_ti;
860 ti->ti_magic = NILFS_TI_MAGIC;
861 - INIT_LIST_HEAD(&ti->ti_garbage);
862 current->journal_info = ti;
863
864 for (;;) {
865 @@ -332,8 +331,6 @@ static void nilfs_transaction_unlock(struct super_block *sb)
866
867 up_write(&nilfs->ns_segctor_sem);
868 current->journal_info = ti->ti_save;
869 - if (!list_empty(&ti->ti_garbage))
870 - nilfs_dispose_list(nilfs, &ti->ti_garbage, 0);
871 }
872
873 static void *nilfs_segctor_map_segsum_entry(struct nilfs_sc_info *sci,
874 @@ -746,6 +743,15 @@ static void nilfs_dispose_list(struct the_nilfs *nilfs,
875 }
876 }
877
878 +static void nilfs_iput_work_func(struct work_struct *work)
879 +{
880 + struct nilfs_sc_info *sci = container_of(work, struct nilfs_sc_info,
881 + sc_iput_work);
882 + struct the_nilfs *nilfs = sci->sc_super->s_fs_info;
883 +
884 + nilfs_dispose_list(nilfs, &sci->sc_iput_queue, 0);
885 +}
886 +
887 static int nilfs_test_metadata_dirty(struct the_nilfs *nilfs,
888 struct nilfs_root *root)
889 {
890 @@ -1900,8 +1906,8 @@ static int nilfs_segctor_collect_dirty_files(struct nilfs_sc_info *sci,
891 static void nilfs_segctor_drop_written_files(struct nilfs_sc_info *sci,
892 struct the_nilfs *nilfs)
893 {
894 - struct nilfs_transaction_info *ti = current->journal_info;
895 struct nilfs_inode_info *ii, *n;
896 + int defer_iput = false;
897
898 spin_lock(&nilfs->ns_inode_lock);
899 list_for_each_entry_safe(ii, n, &sci->sc_dirty_files, i_dirty) {
900 @@ -1912,9 +1918,24 @@ static void nilfs_segctor_drop_written_files(struct nilfs_sc_info *sci,
901 clear_bit(NILFS_I_BUSY, &ii->i_state);
902 brelse(ii->i_bh);
903 ii->i_bh = NULL;
904 - list_move_tail(&ii->i_dirty, &ti->ti_garbage);
905 + list_del_init(&ii->i_dirty);
906 + if (!ii->vfs_inode.i_nlink) {
907 + /*
908 + * Defer calling iput() to avoid a deadlock
909 + * over I_SYNC flag for inodes with i_nlink == 0
910 + */
911 + list_add_tail(&ii->i_dirty, &sci->sc_iput_queue);
912 + defer_iput = true;
913 + } else {
914 + spin_unlock(&nilfs->ns_inode_lock);
915 + iput(&ii->vfs_inode);
916 + spin_lock(&nilfs->ns_inode_lock);
917 + }
918 }
919 spin_unlock(&nilfs->ns_inode_lock);
920 +
921 + if (defer_iput)
922 + schedule_work(&sci->sc_iput_work);
923 }
924
925 /*
926 @@ -2583,6 +2604,8 @@ static struct nilfs_sc_info *nilfs_segctor_new(struct super_block *sb,
927 INIT_LIST_HEAD(&sci->sc_segbufs);
928 INIT_LIST_HEAD(&sci->sc_write_logs);
929 INIT_LIST_HEAD(&sci->sc_gc_inodes);
930 + INIT_LIST_HEAD(&sci->sc_iput_queue);
931 + INIT_WORK(&sci->sc_iput_work, nilfs_iput_work_func);
932 init_timer(&sci->sc_timer);
933
934 sci->sc_interval = HZ * NILFS_SC_DEFAULT_TIMEOUT;
935 @@ -2609,6 +2632,8 @@ static void nilfs_segctor_write_out(struct nilfs_sc_info *sci)
936 ret = nilfs_segctor_construct(sci, SC_LSEG_SR);
937 nilfs_transaction_unlock(sci->sc_super);
938
939 + flush_work(&sci->sc_iput_work);
940 +
941 } while (ret && retrycount-- > 0);
942 }
943
944 @@ -2633,6 +2658,9 @@ static void nilfs_segctor_destroy(struct nilfs_sc_info *sci)
945 || sci->sc_seq_request != sci->sc_seq_done);
946 spin_unlock(&sci->sc_state_lock);
947
948 + if (flush_work(&sci->sc_iput_work))
949 + flag = true;
950 +
951 if (flag || !nilfs_segctor_confirm(sci))
952 nilfs_segctor_write_out(sci);
953
954 @@ -2642,6 +2670,12 @@ static void nilfs_segctor_destroy(struct nilfs_sc_info *sci)
955 nilfs_dispose_list(nilfs, &sci->sc_dirty_files, 1);
956 }
957
958 + if (!list_empty(&sci->sc_iput_queue)) {
959 + nilfs_warning(sci->sc_super, __func__,
960 + "iput queue is not empty\n");
961 + nilfs_dispose_list(nilfs, &sci->sc_iput_queue, 1);
962 + }
963 +
964 WARN_ON(!list_empty(&sci->sc_segbufs));
965 WARN_ON(!list_empty(&sci->sc_write_logs));
966
967 diff --git a/fs/nilfs2/segment.h b/fs/nilfs2/segment.h
968 index 38a1d0013314..a48d6de1e02c 100644
969 --- a/fs/nilfs2/segment.h
970 +++ b/fs/nilfs2/segment.h
971 @@ -26,6 +26,7 @@
972 #include <linux/types.h>
973 #include <linux/fs.h>
974 #include <linux/buffer_head.h>
975 +#include <linux/workqueue.h>
976 #include <linux/nilfs2_fs.h>
977 #include "nilfs.h"
978
979 @@ -92,6 +93,8 @@ struct nilfs_segsum_pointer {
980 * @sc_nblk_inc: Block count of current generation
981 * @sc_dirty_files: List of files to be written
982 * @sc_gc_inodes: List of GC inodes having blocks to be written
983 + * @sc_iput_queue: list of inodes for which iput should be done
984 + * @sc_iput_work: work struct to defer iput call
985 * @sc_freesegs: array of segment numbers to be freed
986 * @sc_nfreesegs: number of segments on @sc_freesegs
987 * @sc_dsync_inode: inode whose data pages are written for a sync operation
988 @@ -135,6 +138,8 @@ struct nilfs_sc_info {
989
990 struct list_head sc_dirty_files;
991 struct list_head sc_gc_inodes;
992 + struct list_head sc_iput_queue;
993 + struct work_struct sc_iput_work;
994
995 __u64 *sc_freesegs;
996 size_t sc_nfreesegs;
997 diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
998 index e08e21e5f601..c72851328ca9 100644
999 --- a/include/linux/tracepoint.h
1000 +++ b/include/linux/tracepoint.h
1001 @@ -173,7 +173,7 @@ extern void syscall_unregfunc(void);
1002 TP_PROTO(data_proto), \
1003 TP_ARGS(data_args), \
1004 TP_CONDITION(cond),,); \
1005 - if (IS_ENABLED(CONFIG_LOCKDEP)) { \
1006 + if (IS_ENABLED(CONFIG_LOCKDEP) && (cond)) { \
1007 rcu_read_lock_sched_notrace(); \
1008 rcu_dereference_sched(__tracepoint_##name.funcs);\
1009 rcu_read_unlock_sched_notrace(); \
1010 diff --git a/include/sound/ak4113.h b/include/sound/ak4113.h
1011 index 2609048c1d44..3a34f6edc2d1 100644
1012 --- a/include/sound/ak4113.h
1013 +++ b/include/sound/ak4113.h
1014 @@ -286,7 +286,7 @@ struct ak4113 {
1015 ak4113_write_t *write;
1016 ak4113_read_t *read;
1017 void *private_data;
1018 - unsigned int init:1;
1019 + atomic_t wq_processing;
1020 spinlock_t lock;
1021 unsigned char regmap[AK4113_WRITABLE_REGS];
1022 struct snd_kcontrol *kctls[AK4113_CONTROLS];
1023 diff --git a/include/sound/ak4114.h b/include/sound/ak4114.h
1024 index 52f02a60dba7..069299a88915 100644
1025 --- a/include/sound/ak4114.h
1026 +++ b/include/sound/ak4114.h
1027 @@ -168,7 +168,7 @@ struct ak4114 {
1028 ak4114_write_t * write;
1029 ak4114_read_t * read;
1030 void * private_data;
1031 - unsigned int init: 1;
1032 + atomic_t wq_processing;
1033 spinlock_t lock;
1034 unsigned char regmap[6];
1035 unsigned char txcsb[5];
1036 diff --git a/include/trace/events/tlb.h b/include/trace/events/tlb.h
1037 index 13391d288107..0e7635765153 100644
1038 --- a/include/trace/events/tlb.h
1039 +++ b/include/trace/events/tlb.h
1040 @@ -13,11 +13,13 @@
1041 { TLB_LOCAL_SHOOTDOWN, "local shootdown" }, \
1042 { TLB_LOCAL_MM_SHOOTDOWN, "local mm shootdown" }
1043
1044 -TRACE_EVENT(tlb_flush,
1045 +TRACE_EVENT_CONDITION(tlb_flush,
1046
1047 TP_PROTO(int reason, unsigned long pages),
1048 TP_ARGS(reason, pages),
1049
1050 + TP_CONDITION(cpu_online(smp_processor_id())),
1051 +
1052 TP_STRUCT__entry(
1053 __field( int, reason)
1054 __field(unsigned long, pages)
1055 diff --git a/kernel/smpboot.c b/kernel/smpboot.c
1056 index eb89e1807408..60d35ac5d3f1 100644
1057 --- a/kernel/smpboot.c
1058 +++ b/kernel/smpboot.c
1059 @@ -279,6 +279,7 @@ int smpboot_register_percpu_thread(struct smp_hotplug_thread *plug_thread)
1060 unsigned int cpu;
1061 int ret = 0;
1062
1063 + get_online_cpus();
1064 mutex_lock(&smpboot_threads_lock);
1065 for_each_online_cpu(cpu) {
1066 ret = __smpboot_create_thread(plug_thread, cpu);
1067 @@ -291,6 +292,7 @@ int smpboot_register_percpu_thread(struct smp_hotplug_thread *plug_thread)
1068 list_add(&plug_thread->list, &hotplug_threads);
1069 out:
1070 mutex_unlock(&smpboot_threads_lock);
1071 + put_online_cpus();
1072 return ret;
1073 }
1074 EXPORT_SYMBOL_GPL(smpboot_register_percpu_thread);
1075 diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
1076 index 37e50aadd471..d8c724cda37b 100644
1077 --- a/kernel/time/hrtimer.c
1078 +++ b/kernel/time/hrtimer.c
1079 @@ -122,7 +122,7 @@ static void hrtimer_get_softirq_time(struct hrtimer_cpu_base *base)
1080 mono = ktime_get_update_offsets_tick(&off_real, &off_boot, &off_tai);
1081 boot = ktime_add(mono, off_boot);
1082 xtim = ktime_add(mono, off_real);
1083 - tai = ktime_add(xtim, off_tai);
1084 + tai = ktime_add(mono, off_tai);
1085
1086 base->clock_base[HRTIMER_BASE_REALTIME].softirq_time = xtim;
1087 base->clock_base[HRTIMER_BASE_MONOTONIC].softirq_time = mono;
1088 diff --git a/lib/checksum.c b/lib/checksum.c
1089 index 129775eb6de6..8b39e86dbab5 100644
1090 --- a/lib/checksum.c
1091 +++ b/lib/checksum.c
1092 @@ -181,6 +181,15 @@ csum_partial_copy(const void *src, void *dst, int len, __wsum sum)
1093 EXPORT_SYMBOL(csum_partial_copy);
1094
1095 #ifndef csum_tcpudp_nofold
1096 +static inline u32 from64to32(u64 x)
1097 +{
1098 + /* add up 32-bit and 32-bit for 32+c bit */
1099 + x = (x & 0xffffffff) + (x >> 32);
1100 + /* add up carry.. */
1101 + x = (x & 0xffffffff) + (x >> 32);
1102 + return (u32)x;
1103 +}
1104 +
1105 __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
1106 unsigned short len,
1107 unsigned short proto,
1108 @@ -195,8 +204,7 @@ __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
1109 #else
1110 s += (proto + len) << 8;
1111 #endif
1112 - s += (s >> 32);
1113 - return (__force __wsum)s;
1114 + return (__force __wsum)from64to32(s);
1115 }
1116 EXPORT_SYMBOL(csum_tcpudp_nofold);
1117 #endif
1118 diff --git a/mm/memcontrol.c b/mm/memcontrol.c
1119 index 4918b6eefae2..d72bdc3ca09b 100644
1120 --- a/mm/memcontrol.c
1121 +++ b/mm/memcontrol.c
1122 @@ -6589,7 +6589,7 @@ void mem_cgroup_uncharge_list(struct list_head *page_list)
1123 * mem_cgroup_migrate - migrate a charge to another page
1124 * @oldpage: currently charged page
1125 * @newpage: page to transfer the charge to
1126 - * @lrucare: both pages might be on the LRU already
1127 + * @lrucare: either or both pages might be on the LRU already
1128 *
1129 * Migrate the charge from @oldpage to @newpage.
1130 *
1131 diff --git a/mm/pagewalk.c b/mm/pagewalk.c
1132 index ad83195521f2..b264bda46e1b 100644
1133 --- a/mm/pagewalk.c
1134 +++ b/mm/pagewalk.c
1135 @@ -199,7 +199,10 @@ int walk_page_range(unsigned long addr, unsigned long end,
1136 */
1137 if ((vma->vm_start <= addr) &&
1138 (vma->vm_flags & VM_PFNMAP)) {
1139 - next = vma->vm_end;
1140 + if (walk->pte_hole)
1141 + err = walk->pte_hole(addr, next, walk);
1142 + if (err)
1143 + break;
1144 pgd = pgd_offset(walk->mm, next);
1145 continue;
1146 }
1147 diff --git a/mm/shmem.c b/mm/shmem.c
1148 index 185836ba53ef..0b4ba556703a 100644
1149 --- a/mm/shmem.c
1150 +++ b/mm/shmem.c
1151 @@ -1013,7 +1013,7 @@ static int shmem_replace_page(struct page **pagep, gfp_t gfp,
1152 */
1153 oldpage = newpage;
1154 } else {
1155 - mem_cgroup_migrate(oldpage, newpage, false);
1156 + mem_cgroup_migrate(oldpage, newpage, true);
1157 lru_cache_add_anon(newpage);
1158 *pagep = newpage;
1159 }
1160 diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
1161 index a26cc5d2a9b0..72c9dba84c5d 100644
1162 --- a/scripts/kconfig/menu.c
1163 +++ b/scripts/kconfig/menu.c
1164 @@ -548,7 +548,7 @@ static void get_prompt_str(struct gstr *r, struct property *prop,
1165 {
1166 int i, j;
1167 struct menu *submenu[8], *menu, *location = NULL;
1168 - struct jump_key *jump;
1169 + struct jump_key *jump = NULL;
1170
1171 str_printf(r, _("Prompt: %s\n"), _(prop->text));
1172 menu = prop->menu->parent;
1173 @@ -586,7 +586,7 @@ static void get_prompt_str(struct gstr *r, struct property *prop,
1174 str_printf(r, _(" Location:\n"));
1175 for (j = 4; --i >= 0; j += 2) {
1176 menu = submenu[i];
1177 - if (head && location && menu == location)
1178 + if (jump && menu == location)
1179 jump->offset = strlen(r->s);
1180 str_printf(r, "%*c-> %s", j, ' ',
1181 _(menu_get_prompt(menu)));
1182 diff --git a/sound/i2c/other/ak4113.c b/sound/i2c/other/ak4113.c
1183 index 1a3a6fa27158..c6bba99a90b2 100644
1184 --- a/sound/i2c/other/ak4113.c
1185 +++ b/sound/i2c/other/ak4113.c
1186 @@ -56,8 +56,7 @@ static inline unsigned char reg_read(struct ak4113 *ak4113, unsigned char reg)
1187
1188 static void snd_ak4113_free(struct ak4113 *chip)
1189 {
1190 - chip->init = 1; /* don't schedule new work */
1191 - mb();
1192 + atomic_inc(&chip->wq_processing); /* don't schedule new work */
1193 cancel_delayed_work_sync(&chip->work);
1194 kfree(chip);
1195 }
1196 @@ -89,6 +88,7 @@ int snd_ak4113_create(struct snd_card *card, ak4113_read_t *read,
1197 chip->write = write;
1198 chip->private_data = private_data;
1199 INIT_DELAYED_WORK(&chip->work, ak4113_stats);
1200 + atomic_set(&chip->wq_processing, 0);
1201
1202 for (reg = 0; reg < AK4113_WRITABLE_REGS ; reg++)
1203 chip->regmap[reg] = pgm[reg];
1204 @@ -139,13 +139,11 @@ static void ak4113_init_regs(struct ak4113 *chip)
1205
1206 void snd_ak4113_reinit(struct ak4113 *chip)
1207 {
1208 - chip->init = 1;
1209 - mb();
1210 - flush_delayed_work(&chip->work);
1211 + if (atomic_inc_return(&chip->wq_processing) == 1)
1212 + cancel_delayed_work_sync(&chip->work);
1213 ak4113_init_regs(chip);
1214 /* bring up statistics / event queing */
1215 - chip->init = 0;
1216 - if (chip->kctls[0])
1217 + if (atomic_dec_and_test(&chip->wq_processing))
1218 schedule_delayed_work(&chip->work, HZ / 10);
1219 }
1220 EXPORT_SYMBOL_GPL(snd_ak4113_reinit);
1221 @@ -632,8 +630,9 @@ static void ak4113_stats(struct work_struct *work)
1222 {
1223 struct ak4113 *chip = container_of(work, struct ak4113, work.work);
1224
1225 - if (!chip->init)
1226 + if (atomic_inc_return(&chip->wq_processing) == 1)
1227 snd_ak4113_check_rate_and_errors(chip, chip->check_flags);
1228
1229 - schedule_delayed_work(&chip->work, HZ / 10);
1230 + if (atomic_dec_and_test(&chip->wq_processing))
1231 + schedule_delayed_work(&chip->work, HZ / 10);
1232 }
1233 diff --git a/sound/i2c/other/ak4114.c b/sound/i2c/other/ak4114.c
1234 index c7f56339415d..b70e6eccbd03 100644
1235 --- a/sound/i2c/other/ak4114.c
1236 +++ b/sound/i2c/other/ak4114.c
1237 @@ -66,8 +66,7 @@ static void reg_dump(struct ak4114 *ak4114)
1238
1239 static void snd_ak4114_free(struct ak4114 *chip)
1240 {
1241 - chip->init = 1; /* don't schedule new work */
1242 - mb();
1243 + atomic_inc(&chip->wq_processing); /* don't schedule new work */
1244 cancel_delayed_work_sync(&chip->work);
1245 kfree(chip);
1246 }
1247 @@ -100,6 +99,7 @@ int snd_ak4114_create(struct snd_card *card,
1248 chip->write = write;
1249 chip->private_data = private_data;
1250 INIT_DELAYED_WORK(&chip->work, ak4114_stats);
1251 + atomic_set(&chip->wq_processing, 0);
1252
1253 for (reg = 0; reg < 6; reg++)
1254 chip->regmap[reg] = pgm[reg];
1255 @@ -152,13 +152,11 @@ static void ak4114_init_regs(struct ak4114 *chip)
1256
1257 void snd_ak4114_reinit(struct ak4114 *chip)
1258 {
1259 - chip->init = 1;
1260 - mb();
1261 - flush_delayed_work(&chip->work);
1262 + if (atomic_inc_return(&chip->wq_processing) == 1)
1263 + cancel_delayed_work_sync(&chip->work);
1264 ak4114_init_regs(chip);
1265 /* bring up statistics / event queing */
1266 - chip->init = 0;
1267 - if (chip->kctls[0])
1268 + if (atomic_dec_and_test(&chip->wq_processing))
1269 schedule_delayed_work(&chip->work, HZ / 10);
1270 }
1271
1272 @@ -612,10 +610,10 @@ static void ak4114_stats(struct work_struct *work)
1273 {
1274 struct ak4114 *chip = container_of(work, struct ak4114, work.work);
1275
1276 - if (!chip->init)
1277 + if (atomic_inc_return(&chip->wq_processing) == 1)
1278 snd_ak4114_check_rate_and_errors(chip, chip->check_flags);
1279 -
1280 - schedule_delayed_work(&chip->work, HZ / 10);
1281 + if (atomic_dec_and_test(&chip->wq_processing))
1282 + schedule_delayed_work(&chip->work, HZ / 10);
1283 }
1284
1285 EXPORT_SYMBOL(snd_ak4114_create);
1286 diff --git a/sound/soc/atmel/atmel_ssc_dai.c b/sound/soc/atmel/atmel_ssc_dai.c
1287 index f403f399808a..51413e239cc3 100644
1288 --- a/sound/soc/atmel/atmel_ssc_dai.c
1289 +++ b/sound/soc/atmel/atmel_ssc_dai.c
1290 @@ -345,7 +345,6 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream,
1291 struct atmel_pcm_dma_params *dma_params;
1292 int dir, channels, bits;
1293 u32 tfmr, rfmr, tcmr, rcmr;
1294 - int start_event;
1295 int ret;
1296 int fslen, fslen_ext;
1297
1298 @@ -454,19 +453,10 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream,
1299 * The SSC transmit clock is obtained from the BCLK signal on
1300 * on the TK line, and the SSC receive clock is
1301 * generated from the transmit clock.
1302 - *
1303 - * For single channel data, one sample is transferred
1304 - * on the falling edge of the LRC clock.
1305 - * For two channel data, one sample is
1306 - * transferred on both edges of the LRC clock.
1307 */
1308 - start_event = ((channels == 1)
1309 - ? SSC_START_FALLING_RF
1310 - : SSC_START_EDGE_RF);
1311 -
1312 rcmr = SSC_BF(RCMR_PERIOD, 0)
1313 | SSC_BF(RCMR_STTDLY, START_DELAY)
1314 - | SSC_BF(RCMR_START, start_event)
1315 + | SSC_BF(RCMR_START, SSC_START_FALLING_RF)
1316 | SSC_BF(RCMR_CKI, SSC_CKI_RISING)
1317 | SSC_BF(RCMR_CKO, SSC_CKO_NONE)
1318 | SSC_BF(RCMR_CKS, ssc->clk_from_rk_pin ?
1319 @@ -475,14 +465,14 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream,
1320 rfmr = SSC_BF(RFMR_FSEDGE, SSC_FSEDGE_POSITIVE)
1321 | SSC_BF(RFMR_FSOS, SSC_FSOS_NONE)
1322 | SSC_BF(RFMR_FSLEN, 0)
1323 - | SSC_BF(RFMR_DATNB, 0)
1324 + | SSC_BF(RFMR_DATNB, (channels - 1))
1325 | SSC_BIT(RFMR_MSBF)
1326 | SSC_BF(RFMR_LOOP, 0)
1327 | SSC_BF(RFMR_DATLEN, (bits - 1));
1328
1329 tcmr = SSC_BF(TCMR_PERIOD, 0)
1330 | SSC_BF(TCMR_STTDLY, START_DELAY)
1331 - | SSC_BF(TCMR_START, start_event)
1332 + | SSC_BF(TCMR_START, SSC_START_FALLING_RF)
1333 | SSC_BF(TCMR_CKI, SSC_CKI_FALLING)
1334 | SSC_BF(TCMR_CKO, SSC_CKO_NONE)
1335 | SSC_BF(TCMR_CKS, ssc->clk_from_rk_pin ?
1336 @@ -492,7 +482,7 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream,
1337 | SSC_BF(TFMR_FSDEN, 0)
1338 | SSC_BF(TFMR_FSOS, SSC_FSOS_NONE)
1339 | SSC_BF(TFMR_FSLEN, 0)
1340 - | SSC_BF(TFMR_DATNB, 0)
1341 + | SSC_BF(TFMR_DATNB, (channels - 1))
1342 | SSC_BIT(TFMR_MSBF)
1343 | SSC_BF(TFMR_DATDEF, 0)
1344 | SSC_BF(TFMR_DATLEN, (bits - 1));
1345 diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
1346 index dab9b15304af..f1287ff8dd29 100644
1347 --- a/sound/soc/codecs/sgtl5000.c
1348 +++ b/sound/soc/codecs/sgtl5000.c
1349 @@ -1452,6 +1452,9 @@ static int sgtl5000_i2c_probe(struct i2c_client *client,
1350 if (ret)
1351 return ret;
1352
1353 + /* Need 8 clocks before I2C accesses */
1354 + udelay(1);
1355 +
1356 /* read chip information */
1357 ret = regmap_read(sgtl5000->regmap, SGTL5000_CHIP_ID, &reg);
1358 if (ret)