Magellan Linux

Contents of /trunk/kernel-alx/patches-4.1/0106-4.1.7-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2748 - (show annotations) (download)
Mon Jan 11 12:00:45 2016 UTC (8 years, 4 months ago) by niro
File size: 104870 byte(s)
-linux-4.1 patches up to 4.1.15
1 diff --git a/Makefile b/Makefile
2 index 838dabcb7f48..b8591e5f79b8 100644
3 --- a/Makefile
4 +++ b/Makefile
5 @@ -1,6 +1,6 @@
6 VERSION = 4
7 PATCHLEVEL = 1
8 -SUBLEVEL = 6
9 +SUBLEVEL = 7
10 EXTRAVERSION =
11 NAME = Series 4800
12
13 diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
14 index f03a091cd076..dfcc0dd637e5 100644
15 --- a/arch/arm/boot/dts/dra7.dtsi
16 +++ b/arch/arm/boot/dts/dra7.dtsi
17 @@ -116,7 +116,7 @@
18 ranges = <0 0x2000 0x2000>;
19
20 scm_conf: scm_conf@0 {
21 - compatible = "syscon";
22 + compatible = "syscon", "simple-bus";
23 reg = <0x0 0x1400>;
24 #address-cells = <1>;
25 #size-cells = <1>;
26 diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi
27 index f74a8ded515f..38c786018a09 100644
28 --- a/arch/arm/boot/dts/imx6qdl.dtsi
29 +++ b/arch/arm/boot/dts/imx6qdl.dtsi
30 @@ -153,10 +153,10 @@
31 interrupt-names = "msi";
32 #interrupt-cells = <1>;
33 interrupt-map-mask = <0 0 0 0x7>;
34 - interrupt-map = <0 0 0 1 &intc GIC_SPI 123 IRQ_TYPE_LEVEL_HIGH>,
35 - <0 0 0 2 &intc GIC_SPI 122 IRQ_TYPE_LEVEL_HIGH>,
36 - <0 0 0 3 &intc GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>,
37 - <0 0 0 4 &intc GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>;
38 + interrupt-map = <0 0 0 1 &gpc GIC_SPI 123 IRQ_TYPE_LEVEL_HIGH>,
39 + <0 0 0 2 &gpc GIC_SPI 122 IRQ_TYPE_LEVEL_HIGH>,
40 + <0 0 0 3 &gpc GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>,
41 + <0 0 0 4 &gpc GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>;
42 clocks = <&clks IMX6QDL_CLK_PCIE_AXI>,
43 <&clks IMX6QDL_CLK_LVDS1_GATE>,
44 <&clks IMX6QDL_CLK_PCIE_REF_125M>;
45 diff --git a/arch/arm/boot/dts/omap2430.dtsi b/arch/arm/boot/dts/omap2430.dtsi
46 index 11a7963be003..2390f387c271 100644
47 --- a/arch/arm/boot/dts/omap2430.dtsi
48 +++ b/arch/arm/boot/dts/omap2430.dtsi
49 @@ -51,7 +51,8 @@
50 };
51
52 scm_conf: scm_conf@270 {
53 - compatible = "syscon";
54 + compatible = "syscon",
55 + "simple-bus";
56 reg = <0x270 0x240>;
57 #address-cells = <1>;
58 #size-cells = <1>;
59 diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
60 index f884d6adb71e..84be9da74c7e 100644
61 --- a/arch/arm/boot/dts/omap4.dtsi
62 +++ b/arch/arm/boot/dts/omap4.dtsi
63 @@ -191,7 +191,8 @@
64 };
65
66 omap4_padconf_global: omap4_padconf_global@5a0 {
67 - compatible = "syscon";
68 + compatible = "syscon",
69 + "simple-bus";
70 reg = <0x5a0 0x170>;
71 #address-cells = <1>;
72 #size-cells = <1>;
73 diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi
74 index 7d24ae0306b5..874a26f9dc0f 100644
75 --- a/arch/arm/boot/dts/omap5.dtsi
76 +++ b/arch/arm/boot/dts/omap5.dtsi
77 @@ -180,7 +180,8 @@
78 };
79
80 omap5_padconf_global: omap5_padconf_global@5a0 {
81 - compatible = "syscon";
82 + compatible = "syscon",
83 + "simple-bus";
84 reg = <0x5a0 0xec>;
85 #address-cells = <1>;
86 #size-cells = <1>;
87 diff --git a/arch/arm/mach-bcm/Makefile b/arch/arm/mach-bcm/Makefile
88 index 4c38674c73ec..54d274da7ccb 100644
89 --- a/arch/arm/mach-bcm/Makefile
90 +++ b/arch/arm/mach-bcm/Makefile
91 @@ -43,5 +43,5 @@ obj-$(CONFIG_ARCH_BCM_63XX) := bcm63xx.o
92 ifeq ($(CONFIG_ARCH_BRCMSTB),y)
93 CFLAGS_platsmp-brcmstb.o += -march=armv7-a
94 obj-y += brcmstb.o
95 -obj-$(CONFIG_SMP) += headsmp-brcmstb.o platsmp-brcmstb.o
96 +obj-$(CONFIG_SMP) += platsmp-brcmstb.o
97 endif
98 diff --git a/arch/arm/mach-bcm/brcmstb.h b/arch/arm/mach-bcm/brcmstb.h
99 deleted file mode 100644
100 index ec0c3d112b36..000000000000
101 --- a/arch/arm/mach-bcm/brcmstb.h
102 +++ /dev/null
103 @@ -1,19 +0,0 @@
104 -/*
105 - * Copyright (C) 2013-2014 Broadcom Corporation
106 - *
107 - * This program is free software; you can redistribute it and/or
108 - * modify it under the terms of the GNU General Public License as
109 - * published by the Free Software Foundation version 2.
110 - *
111 - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
112 - * kind, whether express or implied; without even the implied warranty
113 - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
114 - * GNU General Public License for more details.
115 - */
116 -
117 -#ifndef __BRCMSTB_H__
118 -#define __BRCMSTB_H__
119 -
120 -void brcmstb_secondary_startup(void);
121 -
122 -#endif /* __BRCMSTB_H__ */
123 diff --git a/arch/arm/mach-bcm/headsmp-brcmstb.S b/arch/arm/mach-bcm/headsmp-brcmstb.S
124 deleted file mode 100644
125 index 199c1ea58248..000000000000
126 --- a/arch/arm/mach-bcm/headsmp-brcmstb.S
127 +++ /dev/null
128 @@ -1,33 +0,0 @@
129 -/*
130 - * SMP boot code for secondary CPUs
131 - * Based on arch/arm/mach-tegra/headsmp.S
132 - *
133 - * Copyright (C) 2010 NVIDIA, Inc.
134 - * Copyright (C) 2013-2014 Broadcom Corporation
135 - *
136 - * This program is free software; you can redistribute it and/or
137 - * modify it under the terms of the GNU General Public License as
138 - * published by the Free Software Foundation version 2.
139 - *
140 - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
141 - * kind, whether express or implied; without even the implied warranty
142 - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
143 - * GNU General Public License for more details.
144 - */
145 -
146 -#include <asm/assembler.h>
147 -#include <linux/linkage.h>
148 -#include <linux/init.h>
149 -
150 - .section ".text.head", "ax"
151 -
152 -ENTRY(brcmstb_secondary_startup)
153 - /*
154 - * Ensure CPU is in a sane state by disabling all IRQs and switching
155 - * into SVC mode.
156 - */
157 - setmode PSR_I_BIT | PSR_F_BIT | SVC_MODE, r0
158 -
159 - bl v7_invalidate_l1
160 - b secondary_startup
161 -ENDPROC(brcmstb_secondary_startup)
162 diff --git a/arch/arm/mach-bcm/platsmp-brcmstb.c b/arch/arm/mach-bcm/platsmp-brcmstb.c
163 index e209e6fc7caf..44d6bddf7a4e 100644
164 --- a/arch/arm/mach-bcm/platsmp-brcmstb.c
165 +++ b/arch/arm/mach-bcm/platsmp-brcmstb.c
166 @@ -30,8 +30,6 @@
167 #include <asm/mach-types.h>
168 #include <asm/smp_plat.h>
169
170 -#include "brcmstb.h"
171 -
172 enum {
173 ZONE_MAN_CLKEN_MASK = BIT(0),
174 ZONE_MAN_RESET_CNTL_MASK = BIT(1),
175 @@ -153,7 +151,7 @@ static void brcmstb_cpu_boot(u32 cpu)
176 * Set the reset vector to point to the secondary_startup
177 * routine
178 */
179 - cpu_set_boot_addr(cpu, virt_to_phys(brcmstb_secondary_startup));
180 + cpu_set_boot_addr(cpu, virt_to_phys(secondary_startup));
181
182 /* Unhalt the cpu */
183 cpu_rst_cfg_set(cpu, 0);
184 diff --git a/arch/arm/mach-berlin/headsmp.S b/arch/arm/mach-berlin/headsmp.S
185 index 4a4c56a58ad3..dc82a3486b05 100644
186 --- a/arch/arm/mach-berlin/headsmp.S
187 +++ b/arch/arm/mach-berlin/headsmp.S
188 @@ -12,12 +12,6 @@
189 #include <linux/init.h>
190 #include <asm/assembler.h>
191
192 -ENTRY(berlin_secondary_startup)
193 - ARM_BE8(setend be)
194 - bl v7_invalidate_l1
195 - b secondary_startup
196 -ENDPROC(berlin_secondary_startup)
197 -
198 /*
199 * If the following instruction is set in the reset exception vector, CPUs
200 * will fetch the value of the software reset address vector when being
201 diff --git a/arch/arm/mach-berlin/platsmp.c b/arch/arm/mach-berlin/platsmp.c
202 index 702e7982015a..34a3753e7356 100644
203 --- a/arch/arm/mach-berlin/platsmp.c
204 +++ b/arch/arm/mach-berlin/platsmp.c
205 @@ -22,7 +22,6 @@
206 #define RESET_VECT 0x00
207 #define SW_RESET_ADDR 0x94
208
209 -extern void berlin_secondary_startup(void);
210 extern u32 boot_inst;
211
212 static void __iomem *cpu_ctrl;
213 @@ -85,7 +84,7 @@ static void __init berlin_smp_prepare_cpus(unsigned int max_cpus)
214 * Write the secondary startup address into the SW reset address
215 * vector. This is used by boot_inst.
216 */
217 - writel(virt_to_phys(berlin_secondary_startup), vectors_base + SW_RESET_ADDR);
218 + writel(virt_to_phys(secondary_startup), vectors_base + SW_RESET_ADDR);
219
220 iounmap(vectors_base);
221 unmap_scu:
222 diff --git a/arch/arm/mach-hisi/Makefile b/arch/arm/mach-hisi/Makefile
223 index 6b7b3033de0b..659db1933ed3 100644
224 --- a/arch/arm/mach-hisi/Makefile
225 +++ b/arch/arm/mach-hisi/Makefile
226 @@ -6,4 +6,4 @@ CFLAGS_platmcpm.o := -march=armv7-a
227
228 obj-y += hisilicon.o
229 obj-$(CONFIG_MCPM) += platmcpm.o
230 -obj-$(CONFIG_SMP) += platsmp.o hotplug.o headsmp.o
231 +obj-$(CONFIG_SMP) += platsmp.o hotplug.o
232 diff --git a/arch/arm/mach-hisi/core.h b/arch/arm/mach-hisi/core.h
233 index 92a682d8e939..c7648ef1825c 100644
234 --- a/arch/arm/mach-hisi/core.h
235 +++ b/arch/arm/mach-hisi/core.h
236 @@ -12,7 +12,6 @@ extern void hi3xxx_cpu_die(unsigned int cpu);
237 extern int hi3xxx_cpu_kill(unsigned int cpu);
238 extern void hi3xxx_set_cpu(int cpu, bool enable);
239
240 -extern void hisi_secondary_startup(void);
241 extern struct smp_operations hix5hd2_smp_ops;
242 extern void hix5hd2_set_cpu(int cpu, bool enable);
243 extern void hix5hd2_cpu_die(unsigned int cpu);
244 diff --git a/arch/arm/mach-hisi/headsmp.S b/arch/arm/mach-hisi/headsmp.S
245 deleted file mode 100644
246 index 81e35b159e75..000000000000
247 --- a/arch/arm/mach-hisi/headsmp.S
248 +++ /dev/null
249 @@ -1,16 +0,0 @@
250 -/*
251 - * Copyright (c) 2014 Hisilicon Limited.
252 - * Copyright (c) 2014 Linaro Ltd.
253 - *
254 - * This program is free software; you can redistribute it and/or modify
255 - * it under the terms of the GNU General Public License version 2 as
256 - * published by the Free Software Foundation.
257 - */
258 -#include <linux/linkage.h>
259 -#include <linux/init.h>
260 -
261 - __CPUINIT
262 -
263 -ENTRY(hisi_secondary_startup)
264 - bl v7_invalidate_l1
265 - b secondary_startup
266 diff --git a/arch/arm/mach-hisi/platsmp.c b/arch/arm/mach-hisi/platsmp.c
267 index 8880c8e8b296..51744127db66 100644
268 --- a/arch/arm/mach-hisi/platsmp.c
269 +++ b/arch/arm/mach-hisi/platsmp.c
270 @@ -118,7 +118,7 @@ static int hix5hd2_boot_secondary(unsigned int cpu, struct task_struct *idle)
271 {
272 phys_addr_t jumpaddr;
273
274 - jumpaddr = virt_to_phys(hisi_secondary_startup);
275 + jumpaddr = virt_to_phys(secondary_startup);
276 hix5hd2_set_scu_boot_addr(HIX5HD2_BOOT_ADDRESS, jumpaddr);
277 hix5hd2_set_cpu(cpu, true);
278 arch_send_wakeup_ipi_mask(cpumask_of(cpu));
279 @@ -156,7 +156,7 @@ static int hip01_boot_secondary(unsigned int cpu, struct task_struct *idle)
280 struct device_node *node;
281
282
283 - jumpaddr = virt_to_phys(hisi_secondary_startup);
284 + jumpaddr = virt_to_phys(secondary_startup);
285 hip01_set_boot_addr(HIP01_BOOT_ADDRESS, jumpaddr);
286
287 node = of_find_compatible_node(NULL, NULL, "hisilicon,hip01-sysctrl");
288 diff --git a/arch/arm/mach-imx/headsmp.S b/arch/arm/mach-imx/headsmp.S
289 index de5047c8a6c8..b5e976816b63 100644
290 --- a/arch/arm/mach-imx/headsmp.S
291 +++ b/arch/arm/mach-imx/headsmp.S
292 @@ -25,7 +25,6 @@ diag_reg_offset:
293 .endm
294
295 ENTRY(v7_secondary_startup)
296 - bl v7_invalidate_l1
297 set_diag_reg
298 b secondary_startup
299 ENDPROC(v7_secondary_startup)
300 diff --git a/arch/arm/mach-mvebu/headsmp-a9.S b/arch/arm/mach-mvebu/headsmp-a9.S
301 index 08d5ed46b996..48e4c4b3cd1c 100644
302 --- a/arch/arm/mach-mvebu/headsmp-a9.S
303 +++ b/arch/arm/mach-mvebu/headsmp-a9.S
304 @@ -21,7 +21,6 @@
305
306 ENTRY(mvebu_cortex_a9_secondary_startup)
307 ARM_BE8(setend be)
308 - bl v7_invalidate_l1
309 bl armada_38x_scu_power_up
310 b secondary_startup
311 ENDPROC(mvebu_cortex_a9_secondary_startup)
312 diff --git a/arch/arm/mach-omap2/omap-wakeupgen.c b/arch/arm/mach-omap2/omap-wakeupgen.c
313 index 3b56722dfd8a..6833df45d7b1 100644
314 --- a/arch/arm/mach-omap2/omap-wakeupgen.c
315 +++ b/arch/arm/mach-omap2/omap-wakeupgen.c
316 @@ -392,6 +392,7 @@ static struct irq_chip wakeupgen_chip = {
317 .irq_mask = wakeupgen_mask,
318 .irq_unmask = wakeupgen_unmask,
319 .irq_retrigger = irq_chip_retrigger_hierarchy,
320 + .irq_set_type = irq_chip_set_type_parent,
321 .flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MASK_ON_SUSPEND,
322 #ifdef CONFIG_SMP
323 .irq_set_affinity = irq_chip_set_affinity_parent,
324 diff --git a/arch/arm/mach-prima2/headsmp.S b/arch/arm/mach-prima2/headsmp.S
325 index d86fe33c5f53..209d9fc5c16c 100644
326 --- a/arch/arm/mach-prima2/headsmp.S
327 +++ b/arch/arm/mach-prima2/headsmp.S
328 @@ -15,7 +15,6 @@
329 * ready for them to initialise.
330 */
331 ENTRY(sirfsoc_secondary_startup)
332 - bl v7_invalidate_l1
333 mrc p15, 0, r0, c0, c0, 5
334 and r0, r0, #15
335 adr r4, 1f
336 diff --git a/arch/arm/mach-rockchip/core.h b/arch/arm/mach-rockchip/core.h
337 index 39bca96b555a..492c048813da 100644
338 --- a/arch/arm/mach-rockchip/core.h
339 +++ b/arch/arm/mach-rockchip/core.h
340 @@ -17,4 +17,3 @@ extern char rockchip_secondary_trampoline;
341 extern char rockchip_secondary_trampoline_end;
342
343 extern unsigned long rockchip_boot_fn;
344 -extern void rockchip_secondary_startup(void);
345 diff --git a/arch/arm/mach-rockchip/headsmp.S b/arch/arm/mach-rockchip/headsmp.S
346 index 46c22dedf632..d69708b07282 100644
347 --- a/arch/arm/mach-rockchip/headsmp.S
348 +++ b/arch/arm/mach-rockchip/headsmp.S
349 @@ -15,14 +15,6 @@
350 #include <linux/linkage.h>
351 #include <linux/init.h>
352
353 -ENTRY(rockchip_secondary_startup)
354 - mrc p15, 0, r0, c0, c0, 0 @ read main ID register
355 - ldr r1, =0x00000c09 @ Cortex-A9 primary part number
356 - teq r0, r1
357 - beq v7_invalidate_l1
358 - b secondary_startup
359 -ENDPROC(rockchip_secondary_startup)
360 -
361 ENTRY(rockchip_secondary_trampoline)
362 ldr pc, 1f
363 ENDPROC(rockchip_secondary_trampoline)
364 diff --git a/arch/arm/mach-rockchip/platsmp.c b/arch/arm/mach-rockchip/platsmp.c
365 index 5b4ca3c3c879..2e6ab67e2284 100644
366 --- a/arch/arm/mach-rockchip/platsmp.c
367 +++ b/arch/arm/mach-rockchip/platsmp.c
368 @@ -149,8 +149,7 @@ static int __cpuinit rockchip_boot_secondary(unsigned int cpu,
369 * sram_base_addr + 8: start address for pc
370 * */
371 udelay(10);
372 - writel(virt_to_phys(rockchip_secondary_startup),
373 - sram_base_addr + 8);
374 + writel(virt_to_phys(secondary_startup), sram_base_addr + 8);
375 writel(0xDEADBEAF, sram_base_addr + 4);
376 dsb_sev();
377 }
378 @@ -189,7 +188,7 @@ static int __init rockchip_smp_prepare_sram(struct device_node *node)
379 }
380
381 /* set the boot function for the sram code */
382 - rockchip_boot_fn = virt_to_phys(rockchip_secondary_startup);
383 + rockchip_boot_fn = virt_to_phys(secondary_startup);
384
385 /* copy the trampoline to sram, that runs during startup of the core */
386 memcpy(sram_base_addr, &rockchip_secondary_trampoline, trampoline_sz);
387 diff --git a/arch/arm/mach-shmobile/common.h b/arch/arm/mach-shmobile/common.h
388 index afc60bad6fd6..476092b86c6e 100644
389 --- a/arch/arm/mach-shmobile/common.h
390 +++ b/arch/arm/mach-shmobile/common.h
391 @@ -14,7 +14,6 @@ extern void shmobile_smp_sleep(void);
392 extern void shmobile_smp_hook(unsigned int cpu, unsigned long fn,
393 unsigned long arg);
394 extern int shmobile_smp_cpu_disable(unsigned int cpu);
395 -extern void shmobile_invalidate_start(void);
396 extern void shmobile_boot_scu(void);
397 extern void shmobile_smp_scu_prepare_cpus(unsigned int max_cpus);
398 extern void shmobile_smp_scu_cpu_die(unsigned int cpu);
399 diff --git a/arch/arm/mach-shmobile/headsmp-scu.S b/arch/arm/mach-shmobile/headsmp-scu.S
400 index 69df8bfac167..fa5248c52399 100644
401 --- a/arch/arm/mach-shmobile/headsmp-scu.S
402 +++ b/arch/arm/mach-shmobile/headsmp-scu.S
403 @@ -22,7 +22,7 @@
404 * Boot code for secondary CPUs.
405 *
406 * First we turn on L1 cache coherency for our CPU. Then we jump to
407 - * shmobile_invalidate_start that invalidates the cache and hands over control
408 + * secondary_startup that invalidates the cache and hands over control
409 * to the common ARM startup code.
410 */
411 ENTRY(shmobile_boot_scu)
412 @@ -36,7 +36,7 @@ ENTRY(shmobile_boot_scu)
413 bic r2, r2, r3 @ Clear bits of our CPU (Run Mode)
414 str r2, [r0, #8] @ write back
415
416 - b shmobile_invalidate_start
417 + b secondary_startup
418 ENDPROC(shmobile_boot_scu)
419
420 .text
421 diff --git a/arch/arm/mach-shmobile/headsmp.S b/arch/arm/mach-shmobile/headsmp.S
422 index 50c491567e11..330c1fc63197 100644
423 --- a/arch/arm/mach-shmobile/headsmp.S
424 +++ b/arch/arm/mach-shmobile/headsmp.S
425 @@ -16,13 +16,6 @@
426 #include <asm/assembler.h>
427 #include <asm/memory.h>
428
429 -#ifdef CONFIG_SMP
430 -ENTRY(shmobile_invalidate_start)
431 - bl v7_invalidate_l1
432 - b secondary_startup
433 -ENDPROC(shmobile_invalidate_start)
434 -#endif
435 -
436 /*
437 * Reset vector for secondary CPUs.
438 * This will be mapped at address 0 by SBAR register.
439 diff --git a/arch/arm/mach-shmobile/platsmp-apmu.c b/arch/arm/mach-shmobile/platsmp-apmu.c
440 index f483b560b066..b0790fc32282 100644
441 --- a/arch/arm/mach-shmobile/platsmp-apmu.c
442 +++ b/arch/arm/mach-shmobile/platsmp-apmu.c
443 @@ -133,7 +133,7 @@ void __init shmobile_smp_apmu_prepare_cpus(unsigned int max_cpus,
444 int shmobile_smp_apmu_boot_secondary(unsigned int cpu, struct task_struct *idle)
445 {
446 /* For this particular CPU register boot vector */
447 - shmobile_smp_hook(cpu, virt_to_phys(shmobile_invalidate_start), 0);
448 + shmobile_smp_hook(cpu, virt_to_phys(secondary_startup), 0);
449
450 return apmu_wrap(cpu, apmu_power_on);
451 }
452 diff --git a/arch/arm/mach-socfpga/core.h b/arch/arm/mach-socfpga/core.h
453 index a0f3b1cd497c..767c09e954a0 100644
454 --- a/arch/arm/mach-socfpga/core.h
455 +++ b/arch/arm/mach-socfpga/core.h
456 @@ -31,7 +31,6 @@
457
458 #define RSTMGR_MPUMODRST_CPU1 0x2 /* CPU1 Reset */
459
460 -extern void socfpga_secondary_startup(void);
461 extern void __iomem *socfpga_scu_base_addr;
462
463 extern void socfpga_init_clocks(void);
464 diff --git a/arch/arm/mach-socfpga/headsmp.S b/arch/arm/mach-socfpga/headsmp.S
465 index f65ea0af4af3..5bb016427107 100644
466 --- a/arch/arm/mach-socfpga/headsmp.S
467 +++ b/arch/arm/mach-socfpga/headsmp.S
468 @@ -30,8 +30,3 @@ ENTRY(secondary_trampoline)
469 1: .long .
470 .long socfpga_cpu1start_addr
471 ENTRY(secondary_trampoline_end)
472 -
473 -ENTRY(socfpga_secondary_startup)
474 - bl v7_invalidate_l1
475 - b secondary_startup
476 -ENDPROC(socfpga_secondary_startup)
477 diff --git a/arch/arm/mach-socfpga/platsmp.c b/arch/arm/mach-socfpga/platsmp.c
478 index c64d89b7c0ca..79c5336c569f 100644
479 --- a/arch/arm/mach-socfpga/platsmp.c
480 +++ b/arch/arm/mach-socfpga/platsmp.c
481 @@ -40,7 +40,7 @@ static int socfpga_boot_secondary(unsigned int cpu, struct task_struct *idle)
482
483 memcpy(phys_to_virt(0), &secondary_trampoline, trampoline_size);
484
485 - writel(virt_to_phys(socfpga_secondary_startup),
486 + writel(virt_to_phys(secondary_startup),
487 sys_manager_base_addr + (socfpga_cpu1start_addr & 0x000000ff));
488
489 flush_cache_all();
490 diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile
491 index e48a74458c25..fffad2426ee4 100644
492 --- a/arch/arm/mach-tegra/Makefile
493 +++ b/arch/arm/mach-tegra/Makefile
494 @@ -19,7 +19,7 @@ obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += pm-tegra30.o
495 ifeq ($(CONFIG_CPU_IDLE),y)
496 obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += cpuidle-tegra30.o
497 endif
498 -obj-$(CONFIG_SMP) += platsmp.o headsmp.o
499 +obj-$(CONFIG_SMP) += platsmp.o
500 obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
501
502 obj-$(CONFIG_ARCH_TEGRA_114_SOC) += sleep-tegra30.o
503 diff --git a/arch/arm/mach-tegra/headsmp.S b/arch/arm/mach-tegra/headsmp.S
504 deleted file mode 100644
505 index 2072e7322c39..000000000000
506 --- a/arch/arm/mach-tegra/headsmp.S
507 +++ /dev/null
508 @@ -1,12 +0,0 @@
509 -#include <linux/linkage.h>
510 -#include <linux/init.h>
511 -
512 -#include "sleep.h"
513 -
514 - .section ".text.head", "ax"
515 -
516 -ENTRY(tegra_secondary_startup)
517 - check_cpu_part_num 0xc09, r8, r9
518 - bleq v7_invalidate_l1
519 - b secondary_startup
520 -ENDPROC(tegra_secondary_startup)
521 diff --git a/arch/arm/mach-tegra/reset.c b/arch/arm/mach-tegra/reset.c
522 index 894c5c472184..6fd9db54887e 100644
523 --- a/arch/arm/mach-tegra/reset.c
524 +++ b/arch/arm/mach-tegra/reset.c
525 @@ -94,7 +94,7 @@ void __init tegra_cpu_reset_handler_init(void)
526 __tegra_cpu_reset_handler_data[TEGRA_RESET_MASK_PRESENT] =
527 *((u32 *)cpu_possible_mask);
528 __tegra_cpu_reset_handler_data[TEGRA_RESET_STARTUP_SECONDARY] =
529 - virt_to_phys((void *)tegra_secondary_startup);
530 + virt_to_phys((void *)secondary_startup);
531 #endif
532
533 #ifdef CONFIG_PM_SLEEP
534 diff --git a/arch/arm/mach-tegra/reset.h b/arch/arm/mach-tegra/reset.h
535 index 29c3dec0126a..9c479c7925b8 100644
536 --- a/arch/arm/mach-tegra/reset.h
537 +++ b/arch/arm/mach-tegra/reset.h
538 @@ -37,7 +37,6 @@ void __tegra_cpu_reset_handler_start(void);
539 void __tegra_cpu_reset_handler(void);
540 void __tegra20_cpu1_resettable_status_offset(void);
541 void __tegra_cpu_reset_handler_end(void);
542 -void tegra_secondary_startup(void);
543
544 #ifdef CONFIG_PM_SLEEP
545 #define tegra_cpu_lp1_mask \
546 diff --git a/arch/arm/mach-zynq/common.h b/arch/arm/mach-zynq/common.h
547 index 382c60e9aa16..7038cae95ddc 100644
548 --- a/arch/arm/mach-zynq/common.h
549 +++ b/arch/arm/mach-zynq/common.h
550 @@ -17,8 +17,6 @@
551 #ifndef __MACH_ZYNQ_COMMON_H__
552 #define __MACH_ZYNQ_COMMON_H__
553
554 -void zynq_secondary_startup(void);
555 -
556 extern int zynq_slcr_init(void);
557 extern int zynq_early_slcr_init(void);
558 extern void zynq_slcr_system_reset(void);
559 diff --git a/arch/arm/mach-zynq/headsmp.S b/arch/arm/mach-zynq/headsmp.S
560 index dd8c071941e7..045c72720a4d 100644
561 --- a/arch/arm/mach-zynq/headsmp.S
562 +++ b/arch/arm/mach-zynq/headsmp.S
563 @@ -22,8 +22,3 @@ zynq_secondary_trampoline_jump:
564 .globl zynq_secondary_trampoline_end
565 zynq_secondary_trampoline_end:
566 ENDPROC(zynq_secondary_trampoline)
567 -
568 -ENTRY(zynq_secondary_startup)
569 - bl v7_invalidate_l1
570 - b secondary_startup
571 -ENDPROC(zynq_secondary_startup)
572 diff --git a/arch/arm/mach-zynq/platsmp.c b/arch/arm/mach-zynq/platsmp.c
573 index 52d768ff7857..f66816c49186 100644
574 --- a/arch/arm/mach-zynq/platsmp.c
575 +++ b/arch/arm/mach-zynq/platsmp.c
576 @@ -87,10 +87,9 @@ int zynq_cpun_start(u32 address, int cpu)
577 }
578 EXPORT_SYMBOL(zynq_cpun_start);
579
580 -static int zynq_boot_secondary(unsigned int cpu,
581 - struct task_struct *idle)
582 +static int zynq_boot_secondary(unsigned int cpu, struct task_struct *idle)
583 {
584 - return zynq_cpun_start(virt_to_phys(zynq_secondary_startup), cpu);
585 + return zynq_cpun_start(virt_to_phys(secondary_startup), cpu);
586 }
587
588 /*
589 diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S
590 index 3d1054f11a8a..7911f14c2157 100644
591 --- a/arch/arm/mm/proc-v7.S
592 +++ b/arch/arm/mm/proc-v7.S
593 @@ -268,7 +268,10 @@ __v7_ca15mp_setup:
594 __v7_b15mp_setup:
595 __v7_ca17mp_setup:
596 mov r10, #0
597 -1:
598 +1: adr r12, __v7_setup_stack @ the local stack
599 + stmia r12, {r0-r5, lr} @ v7_invalidate_l1 touches r0-r6
600 + bl v7_invalidate_l1
601 + ldmia r12, {r0-r5, lr}
602 #ifdef CONFIG_SMP
603 ALT_SMP(mrc p15, 0, r0, c1, c0, 1)
604 ALT_UP(mov r0, #(1 << 6)) @ fake it for UP
605 @@ -277,7 +280,7 @@ __v7_ca17mp_setup:
606 orreq r0, r0, r10 @ Enable CPU-specific SMP bits
607 mcreq p15, 0, r0, c1, c0, 1
608 #endif
609 - b __v7_setup
610 + b __v7_setup_cont
611
612 __v7_pj4b_setup:
613 #ifdef CONFIG_CPU_PJ4B
614 @@ -335,10 +338,11 @@ __v7_pj4b_setup:
615
616 __v7_setup:
617 adr r12, __v7_setup_stack @ the local stack
618 - stmia r12, {r0-r5, r7, r9, r11, lr}
619 - bl v7_flush_dcache_louis
620 - ldmia r12, {r0-r5, r7, r9, r11, lr}
621 + stmia r12, {r0-r5, lr} @ v7_invalidate_l1 touches r0-r6
622 + bl v7_invalidate_l1
623 + ldmia r12, {r0-r5, lr}
624
625 +__v7_setup_cont:
626 mrc p15, 0, r0, c0, c0, 0 @ read main ID register
627 and r10, r0, #0xff000000 @ ARM?
628 teq r10, #0x41000000
629 @@ -460,7 +464,7 @@ ENDPROC(__v7_setup)
630
631 .align 2
632 __v7_setup_stack:
633 - .space 4 * 11 @ 11 registers
634 + .space 4 * 7 @ 12 registers
635
636 __INITDATA
637
638 diff --git a/arch/arm/vdso/Makefile b/arch/arm/vdso/Makefile
639 index 8aa791051029..1160434eece0 100644
640 --- a/arch/arm/vdso/Makefile
641 +++ b/arch/arm/vdso/Makefile
642 @@ -6,9 +6,15 @@ obj-vdso := vgettimeofday.o datapage.o
643 targets := $(obj-vdso) vdso.so vdso.so.dbg vdso.so.raw vdso.lds
644 obj-vdso := $(addprefix $(obj)/, $(obj-vdso))
645
646 -ccflags-y := -shared -fPIC -fno-common -fno-builtin -fno-stack-protector
647 -ccflags-y += -nostdlib -Wl,-soname=linux-vdso.so.1 -DDISABLE_BRANCH_PROFILING
648 -ccflags-y += -Wl,--no-undefined $(call cc-ldoption, -Wl$(comma)--hash-style=sysv)
649 +ccflags-y := -fPIC -fno-common -fno-builtin -fno-stack-protector
650 +ccflags-y += -DDISABLE_BRANCH_PROFILING
651 +
652 +VDSO_LDFLAGS := -Wl,-Bsymbolic -Wl,--no-undefined -Wl,-soname=linux-vdso.so.1
653 +VDSO_LDFLAGS += -Wl,-z,max-page-size=4096 -Wl,-z,common-page-size=4096
654 +VDSO_LDFLAGS += -nostdlib -shared
655 +VDSO_LDFLAGS += $(call cc-ldoption, -Wl$(comma)--hash-style=sysv)
656 +VDSO_LDFLAGS += $(call cc-ldoption, -Wl$(comma)--build-id)
657 +VDSO_LDFLAGS += $(call cc-ldoption, -fuse-ld=bfd)
658
659 obj-$(CONFIG_VDSO) += vdso.o
660 extra-$(CONFIG_VDSO) += vdso.lds
661 @@ -40,10 +46,8 @@ $(obj)/%.so: $(obj)/%.so.dbg FORCE
662
663 # Actual build commands
664 quiet_cmd_vdsold = VDSO $@
665 - cmd_vdsold = $(CC) $(c_flags) -Wl,-T $(filter %.lds,$^) $(filter %.o,$^) \
666 - $(call cc-ldoption, -Wl$(comma)--build-id) \
667 - -Wl,-Bsymbolic -Wl,-z,max-page-size=4096 \
668 - -Wl,-z,common-page-size=4096 -o $@
669 + cmd_vdsold = $(CC) $(c_flags) $(VDSO_LDFLAGS) \
670 + -Wl,-T $(filter %.lds,$^) $(filter %.o,$^) -o $@
671
672 quiet_cmd_vdsomunge = MUNGE $@
673 cmd_vdsomunge = $(objtree)/$(obj)/vdsomunge $< $@
674 diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c
675 index cce18c85d2e8..7778453762d8 100644
676 --- a/arch/arm64/kernel/perf_event.c
677 +++ b/arch/arm64/kernel/perf_event.c
678 @@ -1318,7 +1318,7 @@ static int armpmu_device_probe(struct platform_device *pdev)
679 /* Don't bother with PPIs; they're already affine */
680 irq = platform_get_irq(pdev, 0);
681 if (irq >= 0 && irq_is_percpu(irq))
682 - return 0;
683 + goto out;
684
685 irqs = kcalloc(pdev->num_resources, sizeof(*irqs), GFP_KERNEL);
686 if (!irqs)
687 @@ -1355,6 +1355,7 @@ static int armpmu_device_probe(struct platform_device *pdev)
688 else
689 kfree(irqs);
690
691 +out:
692 cpu_pmu->plat_device = pdev;
693 return 0;
694 }
695 diff --git a/arch/arm64/kvm/inject_fault.c b/arch/arm64/kvm/inject_fault.c
696 index f02530e726f6..85c57158dcd9 100644
697 --- a/arch/arm64/kvm/inject_fault.c
698 +++ b/arch/arm64/kvm/inject_fault.c
699 @@ -168,8 +168,8 @@ void kvm_inject_dabt(struct kvm_vcpu *vcpu, unsigned long addr)
700 {
701 if (!(vcpu->arch.hcr_el2 & HCR_RW))
702 inject_abt32(vcpu, false, addr);
703 -
704 - inject_abt64(vcpu, false, addr);
705 + else
706 + inject_abt64(vcpu, false, addr);
707 }
708
709 /**
710 @@ -184,8 +184,8 @@ void kvm_inject_pabt(struct kvm_vcpu *vcpu, unsigned long addr)
711 {
712 if (!(vcpu->arch.hcr_el2 & HCR_RW))
713 inject_abt32(vcpu, true, addr);
714 -
715 - inject_abt64(vcpu, true, addr);
716 + else
717 + inject_abt64(vcpu, true, addr);
718 }
719
720 /**
721 @@ -198,6 +198,6 @@ void kvm_inject_undefined(struct kvm_vcpu *vcpu)
722 {
723 if (!(vcpu->arch.hcr_el2 & HCR_RW))
724 inject_undef32(vcpu);
725 -
726 - inject_undef64(vcpu);
727 + else
728 + inject_undef64(vcpu);
729 }
730 diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S
731 index ad4d44635c76..a6f6b762c47a 100644
732 --- a/arch/mips/kernel/scall64-64.S
733 +++ b/arch/mips/kernel/scall64-64.S
734 @@ -80,7 +80,7 @@ syscall_trace_entry:
735 SAVE_STATIC
736 move s0, t2
737 move a0, sp
738 - daddiu a1, v0, __NR_64_Linux
739 + move a1, v0
740 jal syscall_trace_enter
741
742 bltz v0, 2f # seccomp failed? Skip syscall
743 diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
744 index 446cc654da56..4b2010654c46 100644
745 --- a/arch/mips/kernel/scall64-n32.S
746 +++ b/arch/mips/kernel/scall64-n32.S
747 @@ -72,7 +72,7 @@ n32_syscall_trace_entry:
748 SAVE_STATIC
749 move s0, t2
750 move a0, sp
751 - daddiu a1, v0, __NR_N32_Linux
752 + move a1, v0
753 jal syscall_trace_enter
754
755 bltz v0, 2f # seccomp failed? Skip syscall
756 diff --git a/arch/x86/include/asm/sigcontext.h b/arch/x86/include/asm/sigcontext.h
757 index 6fe6b182c998..9dfce4e0417d 100644
758 --- a/arch/x86/include/asm/sigcontext.h
759 +++ b/arch/x86/include/asm/sigcontext.h
760 @@ -57,9 +57,9 @@ struct sigcontext {
761 unsigned long ip;
762 unsigned long flags;
763 unsigned short cs;
764 - unsigned short __pad2; /* Was called gs, but was always zero. */
765 - unsigned short __pad1; /* Was called fs, but was always zero. */
766 - unsigned short ss;
767 + unsigned short gs;
768 + unsigned short fs;
769 + unsigned short __pad0;
770 unsigned long err;
771 unsigned long trapno;
772 unsigned long oldmask;
773 diff --git a/arch/x86/include/uapi/asm/sigcontext.h b/arch/x86/include/uapi/asm/sigcontext.h
774 index 16dc4e8a2cd3..d8b9f9081e86 100644
775 --- a/arch/x86/include/uapi/asm/sigcontext.h
776 +++ b/arch/x86/include/uapi/asm/sigcontext.h
777 @@ -177,24 +177,9 @@ struct sigcontext {
778 __u64 rip;
779 __u64 eflags; /* RFLAGS */
780 __u16 cs;
781 -
782 - /*
783 - * Prior to 2.5.64 ("[PATCH] x86-64 updates for 2.5.64-bk3"),
784 - * Linux saved and restored fs and gs in these slots. This
785 - * was counterproductive, as fsbase and gsbase were never
786 - * saved, so arch_prctl was presumably unreliable.
787 - *
788 - * If these slots are ever needed for any other purpose, there
789 - * is some risk that very old 64-bit binaries could get
790 - * confused. I doubt that many such binaries still work,
791 - * though, since the same patch in 2.5.64 also removed the
792 - * 64-bit set_thread_area syscall, so it appears that there is
793 - * no TLS API that works in both pre- and post-2.5.64 kernels.
794 - */
795 - __u16 __pad2; /* Was gs. */
796 - __u16 __pad1; /* Was fs. */
797 -
798 - __u16 ss;
799 + __u16 gs;
800 + __u16 fs;
801 + __u16 __pad0;
802 __u64 err;
803 __u64 trapno;
804 __u64 oldmask;
805 diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
806 index dcb52850a28f..cde732c1b495 100644
807 --- a/arch/x86/kernel/apic/apic.c
808 +++ b/arch/x86/kernel/apic/apic.c
809 @@ -1424,7 +1424,7 @@ static inline void __x2apic_disable(void)
810 {
811 u64 msr;
812
813 - if (cpu_has_apic)
814 + if (!cpu_has_apic)
815 return;
816
817 rdmsrl(MSR_IA32_APICBASE, msr);
818 @@ -1483,10 +1483,13 @@ void x2apic_setup(void)
819
820 static __init void x2apic_disable(void)
821 {
822 - u32 x2apic_id;
823 + u32 x2apic_id, state = x2apic_state;
824
825 - if (x2apic_state != X2APIC_ON)
826 - goto out;
827 + x2apic_mode = 0;
828 + x2apic_state = X2APIC_DISABLED;
829 +
830 + if (state != X2APIC_ON)
831 + return;
832
833 x2apic_id = read_apic_id();
834 if (x2apic_id >= 255)
835 @@ -1494,9 +1497,6 @@ static __init void x2apic_disable(void)
836
837 __x2apic_disable();
838 register_lapic_address(mp_lapic_addr);
839 -out:
840 - x2apic_state = X2APIC_DISABLED;
841 - x2apic_mode = 0;
842 }
843
844 static __init void x2apic_enable(void)
845 diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
846 index 6e338e3b1dc0..971743774248 100644
847 --- a/arch/x86/kernel/process.c
848 +++ b/arch/x86/kernel/process.c
849 @@ -453,6 +453,7 @@ static int prefer_mwait_c1_over_halt(const struct cpuinfo_x86 *c)
850 static void mwait_idle(void)
851 {
852 if (!current_set_polling_and_test()) {
853 + trace_cpu_idle_rcuidle(1, smp_processor_id());
854 if (this_cpu_has(X86_BUG_CLFLUSH_MONITOR)) {
855 smp_mb(); /* quirk */
856 clflush((void *)&current_thread_info()->flags);
857 @@ -464,6 +465,7 @@ static void mwait_idle(void)
858 __sti_mwait(0, 0);
859 else
860 local_irq_enable();
861 + trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, smp_processor_id());
862 } else {
863 local_irq_enable();
864 }
865 diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c
866 index 1ea14fd53933..e0fd5f47fbb9 100644
867 --- a/arch/x86/kernel/signal.c
868 +++ b/arch/x86/kernel/signal.c
869 @@ -93,8 +93,15 @@ int restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
870 COPY(r15);
871 #endif /* CONFIG_X86_64 */
872
873 +#ifdef CONFIG_X86_32
874 COPY_SEG_CPL3(cs);
875 COPY_SEG_CPL3(ss);
876 +#else /* !CONFIG_X86_32 */
877 + /* Kernel saves and restores only the CS segment register on signals,
878 + * which is the bare minimum needed to allow mixed 32/64-bit code.
879 + * App's signal handler can save/restore other segments if needed. */
880 + COPY_SEG_CPL3(cs);
881 +#endif /* CONFIG_X86_32 */
882
883 get_user_ex(tmpflags, &sc->flags);
884 regs->flags = (regs->flags & ~FIX_EFLAGS) | (tmpflags & FIX_EFLAGS);
885 @@ -154,9 +161,8 @@ int setup_sigcontext(struct sigcontext __user *sc, void __user *fpstate,
886 #else /* !CONFIG_X86_32 */
887 put_user_ex(regs->flags, &sc->flags);
888 put_user_ex(regs->cs, &sc->cs);
889 - put_user_ex(0, &sc->__pad2);
890 - put_user_ex(0, &sc->__pad1);
891 - put_user_ex(regs->ss, &sc->ss);
892 + put_user_ex(0, &sc->gs);
893 + put_user_ex(0, &sc->fs);
894 #endif /* CONFIG_X86_32 */
895
896 put_user_ex(fpstate, &sc->fpstate);
897 @@ -450,19 +456,9 @@ static int __setup_rt_frame(int sig, struct ksignal *ksig,
898
899 regs->sp = (unsigned long)frame;
900
901 - /*
902 - * Set up the CS and SS registers to run signal handlers in
903 - * 64-bit mode, even if the handler happens to be interrupting
904 - * 32-bit or 16-bit code.
905 - *
906 - * SS is subtle. In 64-bit mode, we don't need any particular
907 - * SS descriptor, but we do need SS to be valid. It's possible
908 - * that the old SS is entirely bogus -- this can happen if the
909 - * signal we're trying to deliver is #GP or #SS caused by a bad
910 - * SS value.
911 - */
912 + /* Set up the CS register to run signal handlers in 64-bit mode,
913 + even if the handler happens to be interrupting 32-bit code. */
914 regs->cs = __USER_CS;
915 - regs->ss = __USER_DS;
916
917 return 0;
918 }
919 diff --git a/arch/x86/xen/Kconfig b/arch/x86/xen/Kconfig
920 index e88fda867a33..484145368a24 100644
921 --- a/arch/x86/xen/Kconfig
922 +++ b/arch/x86/xen/Kconfig
923 @@ -8,7 +8,7 @@ config XEN
924 select PARAVIRT_CLOCK
925 select XEN_HAVE_PVMMU
926 depends on X86_64 || (X86_32 && X86_PAE)
927 - depends on X86_TSC
928 + depends on X86_LOCAL_APIC && X86_TSC
929 help
930 This is the Linux Xen port. Enabling this will allow the
931 kernel to boot in a paravirtualized environment under the
932 @@ -17,7 +17,7 @@ config XEN
933 config XEN_DOM0
934 def_bool y
935 depends on XEN && PCI_XEN && SWIOTLB_XEN
936 - depends on X86_LOCAL_APIC && X86_IO_APIC && ACPI && PCI
937 + depends on X86_IO_APIC && ACPI && PCI
938
939 config XEN_PVHVM
940 def_bool y
941 diff --git a/arch/x86/xen/Makefile b/arch/x86/xen/Makefile
942 index 7322755f337a..4b6e29ac0968 100644
943 --- a/arch/x86/xen/Makefile
944 +++ b/arch/x86/xen/Makefile
945 @@ -13,13 +13,13 @@ CFLAGS_mmu.o := $(nostackp)
946 obj-y := enlighten.o setup.o multicalls.o mmu.o irq.o \
947 time.o xen-asm.o xen-asm_$(BITS).o \
948 grant-table.o suspend.o platform-pci-unplug.o \
949 - p2m.o
950 + p2m.o apic.o
951
952 obj-$(CONFIG_EVENT_TRACING) += trace.o
953
954 obj-$(CONFIG_SMP) += smp.o
955 obj-$(CONFIG_PARAVIRT_SPINLOCKS)+= spinlock.o
956 obj-$(CONFIG_XEN_DEBUG_FS) += debugfs.o
957 -obj-$(CONFIG_XEN_DOM0) += apic.o vga.o
958 +obj-$(CONFIG_XEN_DOM0) += vga.o
959 obj-$(CONFIG_SWIOTLB_XEN) += pci-swiotlb-xen.o
960 obj-$(CONFIG_XEN_EFI) += efi.o
961 diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h
962 index 9e195c683549..bef30cbb56c4 100644
963 --- a/arch/x86/xen/xen-ops.h
964 +++ b/arch/x86/xen/xen-ops.h
965 @@ -101,17 +101,15 @@ struct dom0_vga_console_info;
966
967 #ifdef CONFIG_XEN_DOM0
968 void __init xen_init_vga(const struct dom0_vga_console_info *, size_t size);
969 -void __init xen_init_apic(void);
970 #else
971 static inline void __init xen_init_vga(const struct dom0_vga_console_info *info,
972 size_t size)
973 {
974 }
975 -static inline void __init xen_init_apic(void)
976 -{
977 -}
978 #endif
979
980 +void __init xen_init_apic(void);
981 +
982 #ifdef CONFIG_XEN_EFI
983 extern void xen_efi_init(void);
984 #else
985 diff --git a/block/blk-settings.c b/block/blk-settings.c
986 index 12600bfffca9..e0057d035200 100644
987 --- a/block/blk-settings.c
988 +++ b/block/blk-settings.c
989 @@ -241,8 +241,8 @@ EXPORT_SYMBOL(blk_queue_bounce_limit);
990 * Description:
991 * Enables a low level driver to set a hard upper limit,
992 * max_hw_sectors, on the size of requests. max_hw_sectors is set by
993 - * the device driver based upon the combined capabilities of I/O
994 - * controller and storage device.
995 + * the device driver based upon the capabilities of the I/O
996 + * controller.
997 *
998 * max_sectors is a soft limit imposed by the block layer for
999 * filesystem type requests. This value can be overridden on a
1000 diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
1001 index 41c99be9bd41..e0064d180f04 100644
1002 --- a/drivers/ata/libata-core.c
1003 +++ b/drivers/ata/libata-core.c
1004 @@ -694,11 +694,11 @@ static int ata_rwcmd_protocol(struct ata_taskfile *tf, struct ata_device *dev)
1005 * RETURNS:
1006 * Block address read from @tf.
1007 */
1008 -u64 ata_tf_read_block(const struct ata_taskfile *tf, struct ata_device *dev)
1009 +u64 ata_tf_read_block(struct ata_taskfile *tf, struct ata_device *dev)
1010 {
1011 u64 block = 0;
1012
1013 - if (!dev || tf->flags & ATA_TFLAG_LBA) {
1014 + if (tf->flags & ATA_TFLAG_LBA) {
1015 if (tf->flags & ATA_TFLAG_LBA48) {
1016 block |= (u64)tf->hob_lbah << 40;
1017 block |= (u64)tf->hob_lbam << 32;
1018 @@ -2147,24 +2147,6 @@ static int ata_dev_config_ncq(struct ata_device *dev,
1019 return 0;
1020 }
1021
1022 -static void ata_dev_config_sense_reporting(struct ata_device *dev)
1023 -{
1024 - unsigned int err_mask;
1025 -
1026 - if (!ata_id_has_sense_reporting(dev->id))
1027 - return;
1028 -
1029 - if (ata_id_sense_reporting_enabled(dev->id))
1030 - return;
1031 -
1032 - err_mask = ata_dev_set_feature(dev, SETFEATURE_SENSE_DATA, 0x1);
1033 - if (err_mask) {
1034 - ata_dev_dbg(dev,
1035 - "failed to enable Sense Data Reporting, Emask 0x%x\n",
1036 - err_mask);
1037 - }
1038 -}
1039 -
1040 /**
1041 * ata_dev_configure - Configure the specified ATA/ATAPI device
1042 * @dev: Target device to configure
1043 @@ -2387,7 +2369,7 @@ int ata_dev_configure(struct ata_device *dev)
1044 dev->devslp_timing[i] = sata_setting[j];
1045 }
1046 }
1047 - ata_dev_config_sense_reporting(dev);
1048 +
1049 dev->cdb_len = 16;
1050 }
1051
1052 @@ -4248,6 +4230,8 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
1053 ATA_HORKAGE_ZERO_AFTER_TRIM, },
1054 { "Samsung SSD 8*", NULL, ATA_HORKAGE_NO_NCQ_TRIM |
1055 ATA_HORKAGE_ZERO_AFTER_TRIM, },
1056 + { "FCCT*M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM |
1057 + ATA_HORKAGE_ZERO_AFTER_TRIM, },
1058
1059 /* devices that don't properly handle TRIM commands */
1060 { "SuperSSpeed S238*", NULL, ATA_HORKAGE_NOTRIM, },
1061 diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
1062 index 7465031a893c..cb0508af1459 100644
1063 --- a/drivers/ata/libata-eh.c
1064 +++ b/drivers/ata/libata-eh.c
1065 @@ -1592,8 +1592,6 @@ static int ata_eh_read_log_10h(struct ata_device *dev,
1066 tf->hob_lbah = buf[10];
1067 tf->nsect = buf[12];
1068 tf->hob_nsect = buf[13];
1069 - if (ata_id_has_ncq_autosense(dev->id))
1070 - tf->auxiliary = buf[14] << 16 | buf[15] << 8 | buf[16];
1071
1072 return 0;
1073 }
1074 @@ -1630,70 +1628,6 @@ unsigned int atapi_eh_tur(struct ata_device *dev, u8 *r_sense_key)
1075 }
1076
1077 /**
1078 - * ata_eh_request_sense - perform REQUEST_SENSE_DATA_EXT
1079 - * @dev: device to perform REQUEST_SENSE_SENSE_DATA_EXT to
1080 - * @sense_buf: result sense data buffer (SCSI_SENSE_BUFFERSIZE bytes long)
1081 - * @dfl_sense_key: default sense key to use
1082 - *
1083 - * Perform REQUEST_SENSE_DATA_EXT after the device reported CHECK
1084 - * SENSE. This function is EH helper.
1085 - *
1086 - * LOCKING:
1087 - * Kernel thread context (may sleep).
1088 - *
1089 - * RETURNS:
1090 - * encoded sense data on success, 0 on failure or if sense data
1091 - * is not available.
1092 - */
1093 -static u32 ata_eh_request_sense(struct ata_queued_cmd *qc,
1094 - struct scsi_cmnd *cmd)
1095 -{
1096 - struct ata_device *dev = qc->dev;
1097 - struct ata_taskfile tf;
1098 - unsigned int err_mask;
1099 -
1100 - if (!cmd)
1101 - return 0;
1102 -
1103 - DPRINTK("ATA request sense\n");
1104 - ata_dev_warn(dev, "request sense\n");
1105 - if (!ata_id_sense_reporting_enabled(dev->id)) {
1106 - ata_dev_warn(qc->dev, "sense data reporting disabled\n");
1107 - return 0;
1108 - }
1109 - ata_tf_init(dev, &tf);
1110 -
1111 - tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
1112 - tf.flags |= ATA_TFLAG_LBA | ATA_TFLAG_LBA48;
1113 - tf.command = ATA_CMD_REQ_SENSE_DATA;
1114 - tf.protocol = ATA_PROT_NODATA;
1115 -
1116 - err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0);
1117 - /*
1118 - * ACS-4 states:
1119 - * The device may set the SENSE DATA AVAILABLE bit to one in the
1120 - * STATUS field and clear the ERROR bit to zero in the STATUS field
1121 - * to indicate that the command returned completion without an error
1122 - * and the sense data described in table 306 is available.
1123 - *
1124 - * IOW the 'ATA_SENSE' bit might not be set even though valid
1125 - * sense data is available.
1126 - * So check for both.
1127 - */
1128 - if ((tf.command & ATA_SENSE) ||
1129 - tf.lbah != 0 || tf.lbam != 0 || tf.lbal != 0) {
1130 - ata_scsi_set_sense(cmd, tf.lbah, tf.lbam, tf.lbal);
1131 - qc->flags |= ATA_QCFLAG_SENSE_VALID;
1132 - ata_dev_warn(dev, "sense data %02x/%02x/%02x\n",
1133 - tf.lbah, tf.lbam, tf.lbal);
1134 - } else {
1135 - ata_dev_warn(dev, "request sense failed stat %02x emask %x\n",
1136 - tf.command, err_mask);
1137 - }
1138 - return err_mask;
1139 -}
1140 -
1141 -/**
1142 * atapi_eh_request_sense - perform ATAPI REQUEST_SENSE
1143 * @dev: device to perform REQUEST_SENSE to
1144 * @sense_buf: result sense data buffer (SCSI_SENSE_BUFFERSIZE bytes long)
1145 @@ -1855,19 +1789,6 @@ void ata_eh_analyze_ncq_error(struct ata_link *link)
1146 memcpy(&qc->result_tf, &tf, sizeof(tf));
1147 qc->result_tf.flags = ATA_TFLAG_ISADDR | ATA_TFLAG_LBA | ATA_TFLAG_LBA48;
1148 qc->err_mask |= AC_ERR_DEV | AC_ERR_NCQ;
1149 - if (qc->result_tf.auxiliary) {
1150 - char sense_key, asc, ascq;
1151 -
1152 - sense_key = (qc->result_tf.auxiliary >> 16) & 0xff;
1153 - asc = (qc->result_tf.auxiliary >> 8) & 0xff;
1154 - ascq = qc->result_tf.auxiliary & 0xff;
1155 - ata_dev_dbg(dev, "NCQ Autosense %02x/%02x/%02x\n",
1156 - sense_key, asc, ascq);
1157 - ata_scsi_set_sense(qc->scsicmd, sense_key, asc, ascq);
1158 - ata_scsi_set_sense_information(qc->scsicmd, &qc->result_tf);
1159 - qc->flags |= ATA_QCFLAG_SENSE_VALID;
1160 - }
1161 -
1162 ehc->i.err_mask &= ~AC_ERR_DEV;
1163 }
1164
1165 @@ -1897,27 +1818,6 @@ static unsigned int ata_eh_analyze_tf(struct ata_queued_cmd *qc,
1166 return ATA_EH_RESET;
1167 }
1168
1169 - /*
1170 - * Sense data reporting does not work if the
1171 - * device fault bit is set.
1172 - */
1173 - if ((stat & ATA_SENSE) && !(stat & ATA_DF) &&
1174 - !(qc->flags & ATA_QCFLAG_SENSE_VALID)) {
1175 - if (!(qc->ap->pflags & ATA_PFLAG_FROZEN)) {
1176 - tmp = ata_eh_request_sense(qc, qc->scsicmd);
1177 - if (tmp)
1178 - qc->err_mask |= tmp;
1179 - else
1180 - ata_scsi_set_sense_information(qc->scsicmd, tf);
1181 - } else {
1182 - ata_dev_warn(qc->dev, "sense data available but port frozen\n");
1183 - }
1184 - }
1185 -
1186 - /* Set by NCQ autosense or request sense above */
1187 - if (qc->flags & ATA_QCFLAG_SENSE_VALID)
1188 - return 0;
1189 -
1190 if (stat & (ATA_ERR | ATA_DF))
1191 qc->err_mask |= AC_ERR_DEV;
1192 else
1193 @@ -2661,15 +2561,14 @@ static void ata_eh_link_report(struct ata_link *link)
1194
1195 #ifdef CONFIG_ATA_VERBOSE_ERROR
1196 if (res->command & (ATA_BUSY | ATA_DRDY | ATA_DF | ATA_DRQ |
1197 - ATA_SENSE | ATA_ERR)) {
1198 + ATA_ERR)) {
1199 if (res->command & ATA_BUSY)
1200 ata_dev_err(qc->dev, "status: { Busy }\n");
1201 else
1202 - ata_dev_err(qc->dev, "status: { %s%s%s%s%s}\n",
1203 + ata_dev_err(qc->dev, "status: { %s%s%s%s}\n",
1204 res->command & ATA_DRDY ? "DRDY " : "",
1205 res->command & ATA_DF ? "DF " : "",
1206 res->command & ATA_DRQ ? "DRQ " : "",
1207 - res->command & ATA_SENSE ? "SENSE " : "",
1208 res->command & ATA_ERR ? "ERR " : "");
1209 }
1210
1211 diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
1212 index 641a61a59e89..0d7f0da3a269 100644
1213 --- a/drivers/ata/libata-scsi.c
1214 +++ b/drivers/ata/libata-scsi.c
1215 @@ -270,28 +270,13 @@ DEVICE_ATTR(unload_heads, S_IRUGO | S_IWUSR,
1216 ata_scsi_park_show, ata_scsi_park_store);
1217 EXPORT_SYMBOL_GPL(dev_attr_unload_heads);
1218
1219 -void ata_scsi_set_sense(struct scsi_cmnd *cmd, u8 sk, u8 asc, u8 ascq)
1220 +static void ata_scsi_set_sense(struct scsi_cmnd *cmd, u8 sk, u8 asc, u8 ascq)
1221 {
1222 - if (!cmd)
1223 - return;
1224 -
1225 cmd->result = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION;
1226
1227 scsi_build_sense_buffer(0, cmd->sense_buffer, sk, asc, ascq);
1228 }
1229
1230 -void ata_scsi_set_sense_information(struct scsi_cmnd *cmd,
1231 - const struct ata_taskfile *tf)
1232 -{
1233 - u64 information;
1234 -
1235 - if (!cmd)
1236 - return;
1237 -
1238 - information = ata_tf_read_block(tf, NULL);
1239 - scsi_set_sense_information(cmd->sense_buffer, information);
1240 -}
1241 -
1242 static ssize_t
1243 ata_scsi_em_message_store(struct device *dev, struct device_attribute *attr,
1244 const char *buf, size_t count)
1245 @@ -1792,9 +1777,7 @@ static void ata_scsi_qc_complete(struct ata_queued_cmd *qc)
1246 ((cdb[2] & 0x20) || need_sense)) {
1247 ata_gen_passthru_sense(qc);
1248 } else {
1249 - if (qc->flags & ATA_QCFLAG_SENSE_VALID) {
1250 - cmd->result = SAM_STAT_CHECK_CONDITION;
1251 - } else if (!need_sense) {
1252 + if (!need_sense) {
1253 cmd->result = SAM_STAT_GOOD;
1254 } else {
1255 /* TODO: decide which descriptor format to use
1256 diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h
1257 index a998a175f9f1..f840ca18a7c0 100644
1258 --- a/drivers/ata/libata.h
1259 +++ b/drivers/ata/libata.h
1260 @@ -67,8 +67,7 @@ extern struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev, int tag);
1261 extern int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev,
1262 u64 block, u32 n_block, unsigned int tf_flags,
1263 unsigned int tag);
1264 -extern u64 ata_tf_read_block(const struct ata_taskfile *tf,
1265 - struct ata_device *dev);
1266 +extern u64 ata_tf_read_block(struct ata_taskfile *tf, struct ata_device *dev);
1267 extern unsigned ata_exec_internal(struct ata_device *dev,
1268 struct ata_taskfile *tf, const u8 *cdb,
1269 int dma_dir, void *buf, unsigned int buflen,
1270 @@ -138,9 +137,6 @@ extern int ata_scsi_add_hosts(struct ata_host *host,
1271 struct scsi_host_template *sht);
1272 extern void ata_scsi_scan_host(struct ata_port *ap, int sync);
1273 extern int ata_scsi_offline_dev(struct ata_device *dev);
1274 -extern void ata_scsi_set_sense(struct scsi_cmnd *cmd, u8 sk, u8 asc, u8 ascq);
1275 -extern void ata_scsi_set_sense_information(struct scsi_cmnd *cmd,
1276 - const struct ata_taskfile *tf);
1277 extern void ata_scsi_media_change_notify(struct ata_device *dev);
1278 extern void ata_scsi_hotplug(struct work_struct *work);
1279 extern void ata_schedule_scsi_eh(struct Scsi_Host *shost);
1280 diff --git a/drivers/base/regmap/regcache-rbtree.c b/drivers/base/regmap/regcache-rbtree.c
1281 index 81751a49d8bf..56486d92c4e7 100644
1282 --- a/drivers/base/regmap/regcache-rbtree.c
1283 +++ b/drivers/base/regmap/regcache-rbtree.c
1284 @@ -296,11 +296,20 @@ static int regcache_rbtree_insert_to_block(struct regmap *map,
1285 if (!blk)
1286 return -ENOMEM;
1287
1288 - present = krealloc(rbnode->cache_present,
1289 - BITS_TO_LONGS(blklen) * sizeof(*present), GFP_KERNEL);
1290 - if (!present) {
1291 - kfree(blk);
1292 - return -ENOMEM;
1293 + if (BITS_TO_LONGS(blklen) > BITS_TO_LONGS(rbnode->blklen)) {
1294 + present = krealloc(rbnode->cache_present,
1295 + BITS_TO_LONGS(blklen) * sizeof(*present),
1296 + GFP_KERNEL);
1297 + if (!present) {
1298 + kfree(blk);
1299 + return -ENOMEM;
1300 + }
1301 +
1302 + memset(present + BITS_TO_LONGS(rbnode->blklen), 0,
1303 + (BITS_TO_LONGS(blklen) - BITS_TO_LONGS(rbnode->blklen))
1304 + * sizeof(*present));
1305 + } else {
1306 + present = rbnode->cache_present;
1307 }
1308
1309 /* insert the register value in the correct place in the rbnode block */
1310 diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c
1311 index 713fc9ff1149..3e9ec9523f73 100644
1312 --- a/drivers/block/xen-blkback/blkback.c
1313 +++ b/drivers/block/xen-blkback/blkback.c
1314 @@ -362,8 +362,8 @@ static void purge_persistent_gnt(struct xen_blkif *blkif)
1315 return;
1316 }
1317
1318 - if (work_pending(&blkif->persistent_purge_work)) {
1319 - pr_alert_ratelimited("Scheduled work from previous purge is still pending, cannot purge list\n");
1320 + if (work_busy(&blkif->persistent_purge_work)) {
1321 + pr_alert_ratelimited("Scheduled work from previous purge is still busy, cannot purge list\n");
1322 return;
1323 }
1324
1325 diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
1326 index 2c61cf8c6f61..89c7371ab2dc 100644
1327 --- a/drivers/block/xen-blkfront.c
1328 +++ b/drivers/block/xen-blkfront.c
1329 @@ -1118,8 +1118,10 @@ static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info,
1330 * Add the used indirect page back to the list of
1331 * available pages for indirect grefs.
1332 */
1333 - indirect_page = pfn_to_page(s->indirect_grants[i]->pfn);
1334 - list_add(&indirect_page->lru, &info->indirect_pages);
1335 + if (!info->feature_persistent) {
1336 + indirect_page = pfn_to_page(s->indirect_grants[i]->pfn);
1337 + list_add(&indirect_page->lru, &info->indirect_pages);
1338 + }
1339 s->indirect_grants[i]->gref = GRANT_INVALID_REF;
1340 list_add_tail(&s->indirect_grants[i]->node, &info->grants);
1341 }
1342 diff --git a/drivers/clk/pxa/clk-pxa3xx.c b/drivers/clk/pxa/clk-pxa3xx.c
1343 index 4b93a1efb36d..ac03ba49e9d1 100644
1344 --- a/drivers/clk/pxa/clk-pxa3xx.c
1345 +++ b/drivers/clk/pxa/clk-pxa3xx.c
1346 @@ -126,7 +126,7 @@ PARENTS(pxa3xx_ac97_bus) = { "ring_osc_60mhz", "ac97" };
1347 PARENTS(pxa3xx_sbus) = { "ring_osc_60mhz", "system_bus" };
1348 PARENTS(pxa3xx_smemcbus) = { "ring_osc_60mhz", "smemc" };
1349
1350 -#define CKEN_AB(bit) ((CKEN_ ## bit > 31) ? &CKENA : &CKENB)
1351 +#define CKEN_AB(bit) ((CKEN_ ## bit > 31) ? &CKENB : &CKENA)
1352 #define PXA3XX_CKEN(dev_id, con_id, parents, mult_lp, div_lp, mult_hp, \
1353 div_hp, bit, is_lp, flags) \
1354 PXA_CKEN(dev_id, con_id, bit, parents, mult_lp, div_lp, \
1355 diff --git a/drivers/crypto/caam/caamhash.c b/drivers/crypto/caam/caamhash.c
1356 index 332c8ef8dae2..0436997e054b 100644
1357 --- a/drivers/crypto/caam/caamhash.c
1358 +++ b/drivers/crypto/caam/caamhash.c
1359 @@ -909,13 +909,14 @@ static int ahash_final_ctx(struct ahash_request *req)
1360 state->buflen_1;
1361 u32 *sh_desc = ctx->sh_desc_fin, *desc;
1362 dma_addr_t ptr = ctx->sh_desc_fin_dma;
1363 - int sec4_sg_bytes;
1364 + int sec4_sg_bytes, sec4_sg_src_index;
1365 int digestsize = crypto_ahash_digestsize(ahash);
1366 struct ahash_edesc *edesc;
1367 int ret = 0;
1368 int sh_len;
1369
1370 - sec4_sg_bytes = (1 + (buflen ? 1 : 0)) * sizeof(struct sec4_sg_entry);
1371 + sec4_sg_src_index = 1 + (buflen ? 1 : 0);
1372 + sec4_sg_bytes = sec4_sg_src_index * sizeof(struct sec4_sg_entry);
1373
1374 /* allocate space for base edesc and hw desc commands, link tables */
1375 edesc = kmalloc(sizeof(struct ahash_edesc) + DESC_JOB_IO_LEN +
1376 @@ -942,7 +943,7 @@ static int ahash_final_ctx(struct ahash_request *req)
1377 state->buf_dma = try_buf_map_to_sec4_sg(jrdev, edesc->sec4_sg + 1,
1378 buf, state->buf_dma, buflen,
1379 last_buflen);
1380 - (edesc->sec4_sg + sec4_sg_bytes - 1)->len |= SEC4_SG_LEN_FIN;
1381 + (edesc->sec4_sg + sec4_sg_src_index - 1)->len |= SEC4_SG_LEN_FIN;
1382
1383 edesc->sec4_sg_dma = dma_map_single(jrdev, edesc->sec4_sg,
1384 sec4_sg_bytes, DMA_TO_DEVICE);
1385 diff --git a/drivers/crypto/nx/nx-sha256.c b/drivers/crypto/nx/nx-sha256.c
1386 index 08f8d5cd6334..becb738c897b 100644
1387 --- a/drivers/crypto/nx/nx-sha256.c
1388 +++ b/drivers/crypto/nx/nx-sha256.c
1389 @@ -71,7 +71,6 @@ static int nx_sha256_update(struct shash_desc *desc, const u8 *data,
1390 struct sha256_state *sctx = shash_desc_ctx(desc);
1391 struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(&desc->tfm->base);
1392 struct nx_csbcpb *csbcpb = (struct nx_csbcpb *)nx_ctx->csbcpb;
1393 - struct nx_sg *in_sg;
1394 struct nx_sg *out_sg;
1395 u64 to_process = 0, leftover, total;
1396 unsigned long irq_flags;
1397 @@ -97,7 +96,6 @@ static int nx_sha256_update(struct shash_desc *desc, const u8 *data,
1398 NX_CPB_FDM(csbcpb) |= NX_FDM_INTERMEDIATE;
1399 NX_CPB_FDM(csbcpb) |= NX_FDM_CONTINUATION;
1400
1401 - in_sg = nx_ctx->in_sg;
1402 max_sg_len = min_t(u64, nx_ctx->ap->sglen,
1403 nx_driver.of.max_sg_len/sizeof(struct nx_sg));
1404 max_sg_len = min_t(u64, max_sg_len,
1405 @@ -114,17 +112,12 @@ static int nx_sha256_update(struct shash_desc *desc, const u8 *data,
1406 }
1407
1408 do {
1409 - /*
1410 - * to_process: the SHA256_BLOCK_SIZE data chunk to process in
1411 - * this update. This value is also restricted by the sg list
1412 - * limits.
1413 - */
1414 - to_process = total - to_process;
1415 - to_process = to_process & ~(SHA256_BLOCK_SIZE - 1);
1416 + int used_sgs = 0;
1417 + struct nx_sg *in_sg = nx_ctx->in_sg;
1418
1419 if (buf_len) {
1420 data_len = buf_len;
1421 - in_sg = nx_build_sg_list(nx_ctx->in_sg,
1422 + in_sg = nx_build_sg_list(in_sg,
1423 (u8 *) sctx->buf,
1424 &data_len,
1425 max_sg_len);
1426 @@ -133,15 +126,27 @@ static int nx_sha256_update(struct shash_desc *desc, const u8 *data,
1427 rc = -EINVAL;
1428 goto out;
1429 }
1430 + used_sgs = in_sg - nx_ctx->in_sg;
1431 }
1432
1433 + /* to_process: SHA256_BLOCK_SIZE aligned chunk to be
1434 + * processed in this iteration. This value is restricted
1435 + * by sg list limits and number of sgs we already used
1436 + * for leftover data. (see above)
1437 + * In ideal case, we could allow NX_PAGE_SIZE * max_sg_len,
1438 + * but because data may not be aligned, we need to account
1439 + * for that too. */
1440 + to_process = min_t(u64, total,
1441 + (max_sg_len - 1 - used_sgs) * NX_PAGE_SIZE);
1442 + to_process = to_process & ~(SHA256_BLOCK_SIZE - 1);
1443 +
1444 data_len = to_process - buf_len;
1445 in_sg = nx_build_sg_list(in_sg, (u8 *) data,
1446 &data_len, max_sg_len);
1447
1448 nx_ctx->op.inlen = (nx_ctx->in_sg - in_sg) * sizeof(struct nx_sg);
1449
1450 - to_process = (data_len + buf_len);
1451 + to_process = data_len + buf_len;
1452 leftover = total - to_process;
1453
1454 /*
1455 diff --git a/drivers/crypto/nx/nx-sha512.c b/drivers/crypto/nx/nx-sha512.c
1456 index aff0fe58eac0..b6e183d58d73 100644
1457 --- a/drivers/crypto/nx/nx-sha512.c
1458 +++ b/drivers/crypto/nx/nx-sha512.c
1459 @@ -71,7 +71,6 @@ static int nx_sha512_update(struct shash_desc *desc, const u8 *data,
1460 struct sha512_state *sctx = shash_desc_ctx(desc);
1461 struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(&desc->tfm->base);
1462 struct nx_csbcpb *csbcpb = (struct nx_csbcpb *)nx_ctx->csbcpb;
1463 - struct nx_sg *in_sg;
1464 struct nx_sg *out_sg;
1465 u64 to_process, leftover = 0, total;
1466 unsigned long irq_flags;
1467 @@ -97,7 +96,6 @@ static int nx_sha512_update(struct shash_desc *desc, const u8 *data,
1468 NX_CPB_FDM(csbcpb) |= NX_FDM_INTERMEDIATE;
1469 NX_CPB_FDM(csbcpb) |= NX_FDM_CONTINUATION;
1470
1471 - in_sg = nx_ctx->in_sg;
1472 max_sg_len = min_t(u64, nx_ctx->ap->sglen,
1473 nx_driver.of.max_sg_len/sizeof(struct nx_sg));
1474 max_sg_len = min_t(u64, max_sg_len,
1475 @@ -114,18 +112,12 @@ static int nx_sha512_update(struct shash_desc *desc, const u8 *data,
1476 }
1477
1478 do {
1479 - /*
1480 - * to_process: the SHA512_BLOCK_SIZE data chunk to process in
1481 - * this update. This value is also restricted by the sg list
1482 - * limits.
1483 - */
1484 - to_process = total - leftover;
1485 - to_process = to_process & ~(SHA512_BLOCK_SIZE - 1);
1486 - leftover = total - to_process;
1487 + int used_sgs = 0;
1488 + struct nx_sg *in_sg = nx_ctx->in_sg;
1489
1490 if (buf_len) {
1491 data_len = buf_len;
1492 - in_sg = nx_build_sg_list(nx_ctx->in_sg,
1493 + in_sg = nx_build_sg_list(in_sg,
1494 (u8 *) sctx->buf,
1495 &data_len, max_sg_len);
1496
1497 @@ -133,8 +125,20 @@ static int nx_sha512_update(struct shash_desc *desc, const u8 *data,
1498 rc = -EINVAL;
1499 goto out;
1500 }
1501 + used_sgs = in_sg - nx_ctx->in_sg;
1502 }
1503
1504 + /* to_process: SHA512_BLOCK_SIZE aligned chunk to be
1505 + * processed in this iteration. This value is restricted
1506 + * by sg list limits and number of sgs we already used
1507 + * for leftover data. (see above)
1508 + * In ideal case, we could allow NX_PAGE_SIZE * max_sg_len,
1509 + * but because data may not be aligned, we need to account
1510 + * for that too. */
1511 + to_process = min_t(u64, total,
1512 + (max_sg_len - 1 - used_sgs) * NX_PAGE_SIZE);
1513 + to_process = to_process & ~(SHA512_BLOCK_SIZE - 1);
1514 +
1515 data_len = to_process - buf_len;
1516 in_sg = nx_build_sg_list(in_sg, (u8 *) data,
1517 &data_len, max_sg_len);
1518 @@ -146,7 +150,7 @@ static int nx_sha512_update(struct shash_desc *desc, const u8 *data,
1519 goto out;
1520 }
1521
1522 - to_process = (data_len + buf_len);
1523 + to_process = data_len + buf_len;
1524 leftover = total - to_process;
1525
1526 /*
1527 diff --git a/drivers/edac/ppc4xx_edac.c b/drivers/edac/ppc4xx_edac.c
1528 index 3515b381c131..711d8ad74f11 100644
1529 --- a/drivers/edac/ppc4xx_edac.c
1530 +++ b/drivers/edac/ppc4xx_edac.c
1531 @@ -920,7 +920,7 @@ static int ppc4xx_edac_init_csrows(struct mem_ctl_info *mci, u32 mcopt1)
1532 */
1533
1534 for (row = 0; row < mci->nr_csrows; row++) {
1535 - struct csrow_info *csi = &mci->csrows[row];
1536 + struct csrow_info *csi = mci->csrows[row];
1537
1538 /*
1539 * Get the configuration settings for this
1540 diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
1541 index 60b0c13d7ff5..aebc4595afa0 100644
1542 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
1543 +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
1544 @@ -559,7 +559,7 @@ static int atmel_hlcdc_dc_drm_remove(struct platform_device *pdev)
1545 return 0;
1546 }
1547
1548 -#ifdef CONFIG_PM
1549 +#ifdef CONFIG_PM_SLEEP
1550 static int atmel_hlcdc_dc_drm_suspend(struct device *dev)
1551 {
1552 struct drm_device *drm_dev = dev_get_drvdata(dev);
1553 diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
1554 index d714a4b5711e..b1fe32b119ef 100644
1555 --- a/drivers/gpu/drm/i915/intel_dp.c
1556 +++ b/drivers/gpu/drm/i915/intel_dp.c
1557 @@ -1150,6 +1150,19 @@ intel_dp_sink_rates(struct intel_dp *intel_dp, const int **sink_rates)
1558 return (intel_dp_max_link_bw(intel_dp) >> 3) + 1;
1559 }
1560
1561 +static bool intel_dp_source_supports_hbr2(struct drm_device *dev)
1562 +{
1563 + /* WaDisableHBR2:skl */
1564 + if (IS_SKYLAKE(dev) && INTEL_REVID(dev) <= SKL_REVID_B0)
1565 + return false;
1566 +
1567 + if ((IS_HASWELL(dev) && !IS_HSW_ULX(dev)) || IS_BROADWELL(dev) ||
1568 + (INTEL_INFO(dev)->gen >= 9))
1569 + return true;
1570 + else
1571 + return false;
1572 +}
1573 +
1574 static int
1575 intel_dp_source_rates(struct drm_device *dev, const int **source_rates)
1576 {
1577 @@ -1163,11 +1176,8 @@ intel_dp_source_rates(struct drm_device *dev, const int **source_rates)
1578
1579 *source_rates = default_rates;
1580
1581 - if (IS_SKYLAKE(dev) && INTEL_REVID(dev) <= SKL_REVID_B0)
1582 - /* WaDisableHBR2:skl */
1583 - return (DP_LINK_BW_2_7 >> 3) + 1;
1584 - else if (INTEL_INFO(dev)->gen >= 8 ||
1585 - (IS_HASWELL(dev) && !IS_HSW_ULX(dev)))
1586 + /* This depends on the fact that 5.4 is last value in the array */
1587 + if (intel_dp_source_supports_hbr2(dev))
1588 return (DP_LINK_BW_5_4 >> 3) + 1;
1589 else
1590 return (DP_LINK_BW_2_7 >> 3) + 1;
1591 @@ -3783,10 +3793,15 @@ intel_dp_get_dpcd(struct intel_dp *intel_dp)
1592 }
1593 }
1594
1595 - /* Training Pattern 3 support, both source and sink */
1596 + /* Training Pattern 3 support, Intel platforms that support HBR2 alone
1597 + * have support for TP3 hence that check is used along with dpcd check
1598 + * to ensure TP3 can be enabled.
1599 + * SKL < B0: due it's WaDisableHBR2 is the only exception where TP3 is
1600 + * supported but still not enabled.
1601 + */
1602 if (intel_dp->dpcd[DP_DPCD_REV] >= 0x12 &&
1603 intel_dp->dpcd[DP_MAX_LANE_COUNT] & DP_TPS3_SUPPORTED &&
1604 - (IS_HASWELL(dev_priv) || INTEL_INFO(dev_priv)->gen >= 8)) {
1605 + intel_dp_source_supports_hbr2(dev)) {
1606 intel_dp->use_tps3 = true;
1607 DRM_DEBUG_KMS("Displayport TPS3 supported\n");
1608 } else
1609 diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
1610 index 424e62197787..9ab7c1c758ae 100644
1611 --- a/drivers/gpu/drm/i915/intel_lrc.c
1612 +++ b/drivers/gpu/drm/i915/intel_lrc.c
1613 @@ -848,6 +848,8 @@ static int intel_lr_context_pin(struct intel_engine_cs *ring,
1614 ret = intel_pin_and_map_ringbuffer_obj(ring->dev, ringbuf);
1615 if (ret)
1616 goto unpin_ctx_obj;
1617 +
1618 + ctx_obj->dirty = true;
1619 }
1620
1621 return ret;
1622 diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
1623 index 654c8daeb5ab..97ad3bcb99a7 100644
1624 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
1625 +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
1626 @@ -2492,7 +2492,7 @@ int vmw_execbuf_process(struct drm_file *file_priv,
1627 ret = ttm_eu_reserve_buffers(&ticket, &sw_context->validate_nodes,
1628 true, NULL);
1629 if (unlikely(ret != 0))
1630 - goto out_err;
1631 + goto out_err_nores;
1632
1633 ret = vmw_validate_buffers(dev_priv, sw_context);
1634 if (unlikely(ret != 0))
1635 @@ -2536,6 +2536,7 @@ int vmw_execbuf_process(struct drm_file *file_priv,
1636 vmw_resource_relocations_free(&sw_context->res_relocations);
1637
1638 vmw_fifo_commit(dev_priv, command_size);
1639 + mutex_unlock(&dev_priv->binding_mutex);
1640
1641 vmw_query_bo_switch_commit(dev_priv, sw_context);
1642 ret = vmw_execbuf_fence_commands(file_priv, dev_priv,
1643 @@ -2551,7 +2552,6 @@ int vmw_execbuf_process(struct drm_file *file_priv,
1644 DRM_ERROR("Fence submission error. Syncing.\n");
1645
1646 vmw_resource_list_unreserve(&sw_context->resource_list, false);
1647 - mutex_unlock(&dev_priv->binding_mutex);
1648
1649 ttm_eu_fence_buffer_objects(&ticket, &sw_context->validate_nodes,
1650 (void *) fence);
1651 diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
1652 index 008e89bf6f3c..32d52d29cc68 100644
1653 --- a/drivers/hid/hid-input.c
1654 +++ b/drivers/hid/hid-input.c
1655 @@ -462,12 +462,15 @@ out:
1656
1657 static void hidinput_cleanup_battery(struct hid_device *dev)
1658 {
1659 + const struct power_supply_desc *psy_desc;
1660 +
1661 if (!dev->battery)
1662 return;
1663
1664 + psy_desc = dev->battery->desc;
1665 power_supply_unregister(dev->battery);
1666 - kfree(dev->battery->desc->name);
1667 - kfree(dev->battery->desc);
1668 + kfree(psy_desc->name);
1669 + kfree(psy_desc);
1670 dev->battery = NULL;
1671 }
1672 #else /* !CONFIG_HID_BATTERY_STRENGTH */
1673 diff --git a/drivers/hid/hid-uclogic.c b/drivers/hid/hid-uclogic.c
1674 index 94167310e15a..b905d501e752 100644
1675 --- a/drivers/hid/hid-uclogic.c
1676 +++ b/drivers/hid/hid-uclogic.c
1677 @@ -858,7 +858,7 @@ static int uclogic_tablet_enable(struct hid_device *hdev)
1678 for (p = drvdata->rdesc;
1679 p <= drvdata->rdesc + drvdata->rsize - 4;) {
1680 if (p[0] == 0xFE && p[1] == 0xED && p[2] == 0x1D &&
1681 - p[3] < sizeof(params)) {
1682 + p[3] < ARRAY_SIZE(params)) {
1683 v = params[p[3]];
1684 put_unaligned(cpu_to_le32(v), (s32 *)p);
1685 p += 4;
1686 diff --git a/drivers/input/keyboard/gpio_keys_polled.c b/drivers/input/keyboard/gpio_keys_polled.c
1687 index 097d7216d98e..c6dc644aa580 100644
1688 --- a/drivers/input/keyboard/gpio_keys_polled.c
1689 +++ b/drivers/input/keyboard/gpio_keys_polled.c
1690 @@ -246,7 +246,7 @@ static int gpio_keys_polled_probe(struct platform_device *pdev)
1691 * convert it to descriptor.
1692 */
1693 if (!button->gpiod && gpio_is_valid(button->gpio)) {
1694 - unsigned flags = 0;
1695 + unsigned flags = GPIOF_IN;
1696
1697 if (button->active_low)
1698 flags |= GPIOF_ACTIVE_LOW;
1699 diff --git a/drivers/irqchip/irq-crossbar.c b/drivers/irqchip/irq-crossbar.c
1700 index 692fe2bc8197..c12bb93334ff 100644
1701 --- a/drivers/irqchip/irq-crossbar.c
1702 +++ b/drivers/irqchip/irq-crossbar.c
1703 @@ -68,7 +68,9 @@ static struct irq_chip crossbar_chip = {
1704 .irq_mask = irq_chip_mask_parent,
1705 .irq_unmask = irq_chip_unmask_parent,
1706 .irq_retrigger = irq_chip_retrigger_hierarchy,
1707 - .irq_set_wake = irq_chip_set_wake_parent,
1708 + .irq_set_type = irq_chip_set_type_parent,
1709 + .flags = IRQCHIP_MASK_ON_SUSPEND |
1710 + IRQCHIP_SKIP_SET_WAKE,
1711 #ifdef CONFIG_SMP
1712 .irq_set_affinity = irq_chip_set_affinity_parent,
1713 #endif
1714 diff --git a/drivers/md/dm-thin-metadata.c b/drivers/md/dm-thin-metadata.c
1715 index 79f694120ddf..cde1d6749017 100644
1716 --- a/drivers/md/dm-thin-metadata.c
1717 +++ b/drivers/md/dm-thin-metadata.c
1718 @@ -1295,8 +1295,8 @@ static int __release_metadata_snap(struct dm_pool_metadata *pmd)
1719 return r;
1720
1721 disk_super = dm_block_data(copy);
1722 - dm_sm_dec_block(pmd->metadata_sm, le64_to_cpu(disk_super->data_mapping_root));
1723 - dm_sm_dec_block(pmd->metadata_sm, le64_to_cpu(disk_super->device_details_root));
1724 + dm_btree_del(&pmd->info, le64_to_cpu(disk_super->data_mapping_root));
1725 + dm_btree_del(&pmd->details_info, le64_to_cpu(disk_super->device_details_root));
1726 dm_sm_dec_block(pmd->metadata_sm, held_root);
1727
1728 return dm_tm_unlock(pmd->tm, copy);
1729 diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c
1730 index 6ca6dfab50eb..6523903e15fe 100644
1731 --- a/drivers/mfd/arizona-core.c
1732 +++ b/drivers/mfd/arizona-core.c
1733 @@ -912,10 +912,6 @@ int arizona_dev_init(struct arizona *arizona)
1734 arizona->pdata.gpio_defaults[i]);
1735 }
1736
1737 - pm_runtime_set_autosuspend_delay(arizona->dev, 100);
1738 - pm_runtime_use_autosuspend(arizona->dev);
1739 - pm_runtime_enable(arizona->dev);
1740 -
1741 /* Chip default */
1742 if (!arizona->pdata.clk32k_src)
1743 arizona->pdata.clk32k_src = ARIZONA_32KZ_MCLK2;
1744 @@ -1012,11 +1008,17 @@ int arizona_dev_init(struct arizona *arizona)
1745 arizona->pdata.spk_fmt[i]);
1746 }
1747
1748 + pm_runtime_set_active(arizona->dev);
1749 + pm_runtime_enable(arizona->dev);
1750 +
1751 /* Set up for interrupts */
1752 ret = arizona_irq_init(arizona);
1753 if (ret != 0)
1754 goto err_reset;
1755
1756 + pm_runtime_set_autosuspend_delay(arizona->dev, 100);
1757 + pm_runtime_use_autosuspend(arizona->dev);
1758 +
1759 arizona_request_irq(arizona, ARIZONA_IRQ_CLKGEN_ERR, "CLKGEN error",
1760 arizona_clkgen_err, arizona);
1761 arizona_request_irq(arizona, ARIZONA_IRQ_OVERCLOCKED, "Overclocked",
1762 @@ -1045,10 +1047,6 @@ int arizona_dev_init(struct arizona *arizona)
1763 goto err_irq;
1764 }
1765
1766 -#ifdef CONFIG_PM
1767 - regulator_disable(arizona->dcvdd);
1768 -#endif
1769 -
1770 return 0;
1771
1772 err_irq:
1773 diff --git a/drivers/net/can/usb/peak_usb/pcan_usb.c b/drivers/net/can/usb/peak_usb/pcan_usb.c
1774 index 72427f21edff..edfec540c893 100644
1775 --- a/drivers/net/can/usb/peak_usb/pcan_usb.c
1776 +++ b/drivers/net/can/usb/peak_usb/pcan_usb.c
1777 @@ -855,6 +855,18 @@ static int pcan_usb_probe(struct usb_interface *intf)
1778 /*
1779 * describe the PCAN-USB adapter
1780 */
1781 +static const struct can_bittiming_const pcan_usb_const = {
1782 + .name = "pcan_usb",
1783 + .tseg1_min = 1,
1784 + .tseg1_max = 16,
1785 + .tseg2_min = 1,
1786 + .tseg2_max = 8,
1787 + .sjw_max = 4,
1788 + .brp_min = 1,
1789 + .brp_max = 64,
1790 + .brp_inc = 1,
1791 +};
1792 +
1793 const struct peak_usb_adapter pcan_usb = {
1794 .name = "PCAN-USB",
1795 .device_id = PCAN_USB_PRODUCT_ID,
1796 @@ -863,17 +875,7 @@ const struct peak_usb_adapter pcan_usb = {
1797 .clock = {
1798 .freq = PCAN_USB_CRYSTAL_HZ / 2 ,
1799 },
1800 - .bittiming_const = {
1801 - .name = "pcan_usb",
1802 - .tseg1_min = 1,
1803 - .tseg1_max = 16,
1804 - .tseg2_min = 1,
1805 - .tseg2_max = 8,
1806 - .sjw_max = 4,
1807 - .brp_min = 1,
1808 - .brp_max = 64,
1809 - .brp_inc = 1,
1810 - },
1811 + .bittiming_const = &pcan_usb_const,
1812
1813 /* size of device private data */
1814 .sizeof_dev_private = sizeof(struct pcan_usb),
1815 diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_core.c b/drivers/net/can/usb/peak_usb/pcan_usb_core.c
1816 index 7921cff93a63..5a2e341a6d1e 100644
1817 --- a/drivers/net/can/usb/peak_usb/pcan_usb_core.c
1818 +++ b/drivers/net/can/usb/peak_usb/pcan_usb_core.c
1819 @@ -792,9 +792,9 @@ static int peak_usb_create_dev(const struct peak_usb_adapter *peak_usb_adapter,
1820 dev->ep_msg_out = peak_usb_adapter->ep_msg_out[ctrl_idx];
1821
1822 dev->can.clock = peak_usb_adapter->clock;
1823 - dev->can.bittiming_const = &peak_usb_adapter->bittiming_const;
1824 + dev->can.bittiming_const = peak_usb_adapter->bittiming_const;
1825 dev->can.do_set_bittiming = peak_usb_set_bittiming;
1826 - dev->can.data_bittiming_const = &peak_usb_adapter->data_bittiming_const;
1827 + dev->can.data_bittiming_const = peak_usb_adapter->data_bittiming_const;
1828 dev->can.do_set_data_bittiming = peak_usb_set_data_bittiming;
1829 dev->can.do_set_mode = peak_usb_set_mode;
1830 dev->can.do_get_berr_counter = peak_usb_adapter->do_get_berr_counter;
1831 diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_core.h b/drivers/net/can/usb/peak_usb/pcan_usb_core.h
1832 index 9e624f05ad4d..506fe506c9d3 100644
1833 --- a/drivers/net/can/usb/peak_usb/pcan_usb_core.h
1834 +++ b/drivers/net/can/usb/peak_usb/pcan_usb_core.h
1835 @@ -48,8 +48,8 @@ struct peak_usb_adapter {
1836 u32 device_id;
1837 u32 ctrlmode_supported;
1838 struct can_clock clock;
1839 - const struct can_bittiming_const bittiming_const;
1840 - const struct can_bittiming_const data_bittiming_const;
1841 + const struct can_bittiming_const * const bittiming_const;
1842 + const struct can_bittiming_const * const data_bittiming_const;
1843 unsigned int ctrl_count;
1844
1845 int (*intf_probe)(struct usb_interface *intf);
1846 diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_fd.c b/drivers/net/can/usb/peak_usb/pcan_usb_fd.c
1847 index 09d14e70abd7..ce44a033f63b 100644
1848 --- a/drivers/net/can/usb/peak_usb/pcan_usb_fd.c
1849 +++ b/drivers/net/can/usb/peak_usb/pcan_usb_fd.c
1850 @@ -990,6 +990,30 @@ static void pcan_usb_fd_free(struct peak_usb_device *dev)
1851 }
1852
1853 /* describes the PCAN-USB FD adapter */
1854 +static const struct can_bittiming_const pcan_usb_fd_const = {
1855 + .name = "pcan_usb_fd",
1856 + .tseg1_min = 1,
1857 + .tseg1_max = 64,
1858 + .tseg2_min = 1,
1859 + .tseg2_max = 16,
1860 + .sjw_max = 16,
1861 + .brp_min = 1,
1862 + .brp_max = 1024,
1863 + .brp_inc = 1,
1864 +};
1865 +
1866 +static const struct can_bittiming_const pcan_usb_fd_data_const = {
1867 + .name = "pcan_usb_fd",
1868 + .tseg1_min = 1,
1869 + .tseg1_max = 16,
1870 + .tseg2_min = 1,
1871 + .tseg2_max = 8,
1872 + .sjw_max = 4,
1873 + .brp_min = 1,
1874 + .brp_max = 1024,
1875 + .brp_inc = 1,
1876 +};
1877 +
1878 const struct peak_usb_adapter pcan_usb_fd = {
1879 .name = "PCAN-USB FD",
1880 .device_id = PCAN_USBFD_PRODUCT_ID,
1881 @@ -999,28 +1023,8 @@ const struct peak_usb_adapter pcan_usb_fd = {
1882 .clock = {
1883 .freq = PCAN_UFD_CRYSTAL_HZ,
1884 },
1885 - .bittiming_const = {
1886 - .name = "pcan_usb_fd",
1887 - .tseg1_min = 1,
1888 - .tseg1_max = 64,
1889 - .tseg2_min = 1,
1890 - .tseg2_max = 16,
1891 - .sjw_max = 16,
1892 - .brp_min = 1,
1893 - .brp_max = 1024,
1894 - .brp_inc = 1,
1895 - },
1896 - .data_bittiming_const = {
1897 - .name = "pcan_usb_fd",
1898 - .tseg1_min = 1,
1899 - .tseg1_max = 16,
1900 - .tseg2_min = 1,
1901 - .tseg2_max = 8,
1902 - .sjw_max = 4,
1903 - .brp_min = 1,
1904 - .brp_max = 1024,
1905 - .brp_inc = 1,
1906 - },
1907 + .bittiming_const = &pcan_usb_fd_const,
1908 + .data_bittiming_const = &pcan_usb_fd_data_const,
1909
1910 /* size of device private data */
1911 .sizeof_dev_private = sizeof(struct pcan_usb_fd_device),
1912 @@ -1058,6 +1062,30 @@ const struct peak_usb_adapter pcan_usb_fd = {
1913 };
1914
1915 /* describes the PCAN-USB Pro FD adapter */
1916 +static const struct can_bittiming_const pcan_usb_pro_fd_const = {
1917 + .name = "pcan_usb_pro_fd",
1918 + .tseg1_min = 1,
1919 + .tseg1_max = 64,
1920 + .tseg2_min = 1,
1921 + .tseg2_max = 16,
1922 + .sjw_max = 16,
1923 + .brp_min = 1,
1924 + .brp_max = 1024,
1925 + .brp_inc = 1,
1926 +};
1927 +
1928 +static const struct can_bittiming_const pcan_usb_pro_fd_data_const = {
1929 + .name = "pcan_usb_pro_fd",
1930 + .tseg1_min = 1,
1931 + .tseg1_max = 16,
1932 + .tseg2_min = 1,
1933 + .tseg2_max = 8,
1934 + .sjw_max = 4,
1935 + .brp_min = 1,
1936 + .brp_max = 1024,
1937 + .brp_inc = 1,
1938 +};
1939 +
1940 const struct peak_usb_adapter pcan_usb_pro_fd = {
1941 .name = "PCAN-USB Pro FD",
1942 .device_id = PCAN_USBPROFD_PRODUCT_ID,
1943 @@ -1067,28 +1095,8 @@ const struct peak_usb_adapter pcan_usb_pro_fd = {
1944 .clock = {
1945 .freq = PCAN_UFD_CRYSTAL_HZ,
1946 },
1947 - .bittiming_const = {
1948 - .name = "pcan_usb_pro_fd",
1949 - .tseg1_min = 1,
1950 - .tseg1_max = 64,
1951 - .tseg2_min = 1,
1952 - .tseg2_max = 16,
1953 - .sjw_max = 16,
1954 - .brp_min = 1,
1955 - .brp_max = 1024,
1956 - .brp_inc = 1,
1957 - },
1958 - .data_bittiming_const = {
1959 - .name = "pcan_usb_pro_fd",
1960 - .tseg1_min = 1,
1961 - .tseg1_max = 16,
1962 - .tseg2_min = 1,
1963 - .tseg2_max = 8,
1964 - .sjw_max = 4,
1965 - .brp_min = 1,
1966 - .brp_max = 1024,
1967 - .brp_inc = 1,
1968 - },
1969 + .bittiming_const = &pcan_usb_pro_fd_const,
1970 + .data_bittiming_const = &pcan_usb_pro_fd_data_const,
1971
1972 /* size of device private data */
1973 .sizeof_dev_private = sizeof(struct pcan_usb_fd_device),
1974 diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c
1975 index dec51717635e..a5ad2e6aa73a 100644
1976 --- a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c
1977 +++ b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c
1978 @@ -1004,6 +1004,18 @@ int pcan_usb_pro_probe(struct usb_interface *intf)
1979 /*
1980 * describe the PCAN-USB Pro adapter
1981 */
1982 +static const struct can_bittiming_const pcan_usb_pro_const = {
1983 + .name = "pcan_usb_pro",
1984 + .tseg1_min = 1,
1985 + .tseg1_max = 16,
1986 + .tseg2_min = 1,
1987 + .tseg2_max = 8,
1988 + .sjw_max = 4,
1989 + .brp_min = 1,
1990 + .brp_max = 1024,
1991 + .brp_inc = 1,
1992 +};
1993 +
1994 const struct peak_usb_adapter pcan_usb_pro = {
1995 .name = "PCAN-USB Pro",
1996 .device_id = PCAN_USBPRO_PRODUCT_ID,
1997 @@ -1012,17 +1024,7 @@ const struct peak_usb_adapter pcan_usb_pro = {
1998 .clock = {
1999 .freq = PCAN_USBPRO_CRYSTAL_HZ,
2000 },
2001 - .bittiming_const = {
2002 - .name = "pcan_usb_pro",
2003 - .tseg1_min = 1,
2004 - .tseg1_max = 16,
2005 - .tseg2_min = 1,
2006 - .tseg2_max = 8,
2007 - .sjw_max = 4,
2008 - .brp_min = 1,
2009 - .brp_max = 1024,
2010 - .brp_inc = 1,
2011 - },
2012 + .bittiming_const = &pcan_usb_pro_const,
2013
2014 /* size of device private data */
2015 .sizeof_dev_private = sizeof(struct pcan_usb_pro_device),
2016 diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c
2017 index 37e6a6f91487..699a4802835f 100644
2018 --- a/drivers/net/wireless/iwlwifi/pcie/trans.c
2019 +++ b/drivers/net/wireless/iwlwifi/pcie/trans.c
2020 @@ -457,10 +457,16 @@ static void iwl_pcie_apm_stop(struct iwl_trans *trans, bool op_mode_leave)
2021 if (trans->cfg->device_family == IWL_DEVICE_FAMILY_7000)
2022 iwl_set_bits_prph(trans, APMG_PCIDEV_STT_REG,
2023 APMG_PCIDEV_STT_VAL_WAKE_ME);
2024 - else if (trans->cfg->device_family == IWL_DEVICE_FAMILY_8000)
2025 + else if (trans->cfg->device_family == IWL_DEVICE_FAMILY_8000) {
2026 + iwl_set_bit(trans, CSR_DBG_LINK_PWR_MGMT_REG,
2027 + CSR_RESET_LINK_PWR_MGMT_DISABLED);
2028 iwl_set_bit(trans, CSR_HW_IF_CONFIG_REG,
2029 CSR_HW_IF_CONFIG_REG_PREPARE |
2030 CSR_HW_IF_CONFIG_REG_ENABLE_PME);
2031 + mdelay(1);
2032 + iwl_clear_bit(trans, CSR_DBG_LINK_PWR_MGMT_REG,
2033 + CSR_RESET_LINK_PWR_MGMT_DISABLED);
2034 + }
2035 mdelay(5);
2036 }
2037
2038 @@ -555,6 +561,10 @@ static int iwl_pcie_prepare_card_hw(struct iwl_trans *trans)
2039 if (ret >= 0)
2040 return 0;
2041
2042 + iwl_set_bit(trans, CSR_DBG_LINK_PWR_MGMT_REG,
2043 + CSR_RESET_LINK_PWR_MGMT_DISABLED);
2044 + msleep(1);
2045 +
2046 for (iter = 0; iter < 10; iter++) {
2047 /* If HW is not ready, prepare the conditions to check again */
2048 iwl_set_bit(trans, CSR_HW_IF_CONFIG_REG,
2049 @@ -562,8 +572,10 @@ static int iwl_pcie_prepare_card_hw(struct iwl_trans *trans)
2050
2051 do {
2052 ret = iwl_pcie_set_hw_ready(trans);
2053 - if (ret >= 0)
2054 - return 0;
2055 + if (ret >= 0) {
2056 + ret = 0;
2057 + goto out;
2058 + }
2059
2060 usleep_range(200, 1000);
2061 t += 200;
2062 @@ -573,6 +585,10 @@ static int iwl_pcie_prepare_card_hw(struct iwl_trans *trans)
2063
2064 IWL_ERR(trans, "Couldn't prepare the card\n");
2065
2066 +out:
2067 + iwl_clear_bit(trans, CSR_DBG_LINK_PWR_MGMT_REG,
2068 + CSR_RESET_LINK_PWR_MGMT_DISABLED);
2069 +
2070 return ret;
2071 }
2072
2073 diff --git a/drivers/net/wireless/rsi/rsi_91x_sdio_ops.c b/drivers/net/wireless/rsi/rsi_91x_sdio_ops.c
2074 index b6cc9ff47fc2..1c6788aecc62 100644
2075 --- a/drivers/net/wireless/rsi/rsi_91x_sdio_ops.c
2076 +++ b/drivers/net/wireless/rsi/rsi_91x_sdio_ops.c
2077 @@ -172,6 +172,7 @@ static int rsi_load_ta_instructions(struct rsi_common *common)
2078 (struct rsi_91x_sdiodev *)adapter->rsi_dev;
2079 u32 len;
2080 u32 num_blocks;
2081 + const u8 *fw;
2082 const struct firmware *fw_entry = NULL;
2083 u32 block_size = dev->tx_blk_size;
2084 int status = 0;
2085 @@ -200,6 +201,10 @@ static int rsi_load_ta_instructions(struct rsi_common *common)
2086 return status;
2087 }
2088
2089 + /* Copy firmware into DMA-accessible memory */
2090 + fw = kmemdup(fw_entry->data, fw_entry->size, GFP_KERNEL);
2091 + if (!fw)
2092 + return -ENOMEM;
2093 len = fw_entry->size;
2094
2095 if (len % 4)
2096 @@ -210,7 +215,8 @@ static int rsi_load_ta_instructions(struct rsi_common *common)
2097 rsi_dbg(INIT_ZONE, "%s: Instruction size:%d\n", __func__, len);
2098 rsi_dbg(INIT_ZONE, "%s: num blocks: %d\n", __func__, num_blocks);
2099
2100 - status = rsi_copy_to_card(common, fw_entry->data, len, num_blocks);
2101 + status = rsi_copy_to_card(common, fw, len, num_blocks);
2102 + kfree(fw);
2103 release_firmware(fw_entry);
2104 return status;
2105 }
2106 diff --git a/drivers/net/wireless/rsi/rsi_91x_usb_ops.c b/drivers/net/wireless/rsi/rsi_91x_usb_ops.c
2107 index 1106ce76707e..30c2cf7fa93b 100644
2108 --- a/drivers/net/wireless/rsi/rsi_91x_usb_ops.c
2109 +++ b/drivers/net/wireless/rsi/rsi_91x_usb_ops.c
2110 @@ -146,7 +146,10 @@ static int rsi_load_ta_instructions(struct rsi_common *common)
2111 return status;
2112 }
2113
2114 + /* Copy firmware into DMA-accessible memory */
2115 fw = kmemdup(fw_entry->data, fw_entry->size, GFP_KERNEL);
2116 + if (!fw)
2117 + return -ENOMEM;
2118 len = fw_entry->size;
2119
2120 if (len % 4)
2121 @@ -158,6 +161,7 @@ static int rsi_load_ta_instructions(struct rsi_common *common)
2122 rsi_dbg(INIT_ZONE, "%s: num blocks: %d\n", __func__, num_blocks);
2123
2124 status = rsi_copy_to_card(common, fw, len, num_blocks);
2125 + kfree(fw);
2126 release_firmware(fw_entry);
2127 return status;
2128 }
2129 diff --git a/drivers/net/wireless/rtlwifi/core.c b/drivers/net/wireless/rtlwifi/core.c
2130 index 3b3a88b53b11..585d0883c7e5 100644
2131 --- a/drivers/net/wireless/rtlwifi/core.c
2132 +++ b/drivers/net/wireless/rtlwifi/core.c
2133 @@ -1015,9 +1015,12 @@ static void send_beacon_frame(struct ieee80211_hw *hw,
2134 {
2135 struct rtl_priv *rtlpriv = rtl_priv(hw);
2136 struct sk_buff *skb = ieee80211_beacon_get(hw, vif);
2137 + struct rtl_tcb_desc tcb_desc;
2138
2139 - if (skb)
2140 - rtlpriv->intf_ops->adapter_tx(hw, NULL, skb, NULL);
2141 + if (skb) {
2142 + memset(&tcb_desc, 0, sizeof(struct rtl_tcb_desc));
2143 + rtlpriv->intf_ops->adapter_tx(hw, NULL, skb, &tcb_desc);
2144 + }
2145 }
2146
2147 static void rtl_op_bss_info_changed(struct ieee80211_hw *hw,
2148 diff --git a/drivers/net/wireless/rtlwifi/rtl8723be/sw.c b/drivers/net/wireless/rtlwifi/rtl8723be/sw.c
2149 index 1017f02d7bf7..7bf88d9dcdc3 100644
2150 --- a/drivers/net/wireless/rtlwifi/rtl8723be/sw.c
2151 +++ b/drivers/net/wireless/rtlwifi/rtl8723be/sw.c
2152 @@ -385,6 +385,7 @@ module_param_named(debug, rtl8723be_mod_params.debug, int, 0444);
2153 module_param_named(ips, rtl8723be_mod_params.inactiveps, bool, 0444);
2154 module_param_named(swlps, rtl8723be_mod_params.swctrl_lps, bool, 0444);
2155 module_param_named(fwlps, rtl8723be_mod_params.fwctrl_lps, bool, 0444);
2156 +module_param_named(msi, rtl8723be_mod_params.msi_support, bool, 0444);
2157 module_param_named(disable_watchdog, rtl8723be_mod_params.disable_watchdog,
2158 bool, 0444);
2159 MODULE_PARM_DESC(swenc, "Set to 1 for software crypto (default 0)\n");
2160 diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig
2161 index 73de4efcbe6e..944f50015ed0 100644
2162 --- a/drivers/pci/Kconfig
2163 +++ b/drivers/pci/Kconfig
2164 @@ -2,7 +2,7 @@
2165 # PCI configuration
2166 #
2167 config PCI_BUS_ADDR_T_64BIT
2168 - def_bool y if (ARCH_DMA_ADDR_T_64BIT || 64BIT)
2169 + def_bool y if (ARCH_DMA_ADDR_T_64BIT || (64BIT && !PARISC))
2170 depends on PCI
2171
2172 config PCI_MSI
2173 diff --git a/drivers/scsi/fnic/fnic.h b/drivers/scsi/fnic/fnic.h
2174 index 26270c351624..ce129e595b55 100644
2175 --- a/drivers/scsi/fnic/fnic.h
2176 +++ b/drivers/scsi/fnic/fnic.h
2177 @@ -39,7 +39,7 @@
2178
2179 #define DRV_NAME "fnic"
2180 #define DRV_DESCRIPTION "Cisco FCoE HBA Driver"
2181 -#define DRV_VERSION "1.6.0.17"
2182 +#define DRV_VERSION "1.6.0.17a"
2183 #define PFX DRV_NAME ": "
2184 #define DFX DRV_NAME "%d: "
2185
2186 diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c
2187 index 155b286f1a9d..25436cd2860c 100644
2188 --- a/drivers/scsi/fnic/fnic_scsi.c
2189 +++ b/drivers/scsi/fnic/fnic_scsi.c
2190 @@ -425,6 +425,7 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc, void (*done)(struct scsi_
2191 unsigned long ptr;
2192 struct fc_rport_priv *rdata;
2193 spinlock_t *io_lock = NULL;
2194 + int io_lock_acquired = 0;
2195
2196 if (unlikely(fnic_chk_state_flags_locked(fnic, FNIC_FLAGS_IO_BLOCKED)))
2197 return SCSI_MLQUEUE_HOST_BUSY;
2198 @@ -518,6 +519,7 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc, void (*done)(struct scsi_
2199 spin_lock_irqsave(io_lock, flags);
2200
2201 /* initialize rest of io_req */
2202 + io_lock_acquired = 1;
2203 io_req->port_id = rport->port_id;
2204 io_req->start_time = jiffies;
2205 CMD_STATE(sc) = FNIC_IOREQ_CMD_PENDING;
2206 @@ -571,7 +573,7 @@ out:
2207 (((u64)CMD_FLAGS(sc) >> 32) | CMD_STATE(sc)));
2208
2209 /* if only we issued IO, will we have the io lock */
2210 - if (CMD_FLAGS(sc) & FNIC_IO_INITIALIZED)
2211 + if (io_lock_acquired)
2212 spin_unlock_irqrestore(io_lock, flags);
2213
2214 atomic_dec(&fnic->in_flight);
2215 diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c
2216 index 1b3a09473452..30f9ef0c0d4f 100644
2217 --- a/drivers/scsi/libfc/fc_exch.c
2218 +++ b/drivers/scsi/libfc/fc_exch.c
2219 @@ -733,8 +733,6 @@ static bool fc_invoke_resp(struct fc_exch *ep, struct fc_seq *sp,
2220 if (resp) {
2221 resp(sp, fp, arg);
2222 res = true;
2223 - } else if (!IS_ERR(fp)) {
2224 - fc_frame_free(fp);
2225 }
2226
2227 spin_lock_bh(&ep->ex_lock);
2228 @@ -1596,7 +1594,8 @@ static void fc_exch_recv_seq_resp(struct fc_exch_mgr *mp, struct fc_frame *fp)
2229 * If new exch resp handler is valid then call that
2230 * first.
2231 */
2232 - fc_invoke_resp(ep, sp, fp);
2233 + if (!fc_invoke_resp(ep, sp, fp))
2234 + fc_frame_free(fp);
2235
2236 fc_exch_release(ep);
2237 return;
2238 @@ -1695,7 +1694,8 @@ static void fc_exch_abts_resp(struct fc_exch *ep, struct fc_frame *fp)
2239 fc_exch_hold(ep);
2240 if (!rc)
2241 fc_exch_delete(ep);
2242 - fc_invoke_resp(ep, sp, fp);
2243 + if (!fc_invoke_resp(ep, sp, fp))
2244 + fc_frame_free(fp);
2245 if (has_rec)
2246 fc_exch_timer_set(ep, ep->r_a_tov);
2247 fc_exch_release(ep);
2248 diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c
2249 index c6795941b45d..2d5909c4685c 100644
2250 --- a/drivers/scsi/libfc/fc_fcp.c
2251 +++ b/drivers/scsi/libfc/fc_fcp.c
2252 @@ -1039,11 +1039,26 @@ restart:
2253 fc_fcp_pkt_hold(fsp);
2254 spin_unlock_irqrestore(&si->scsi_queue_lock, flags);
2255
2256 - if (!fc_fcp_lock_pkt(fsp)) {
2257 + spin_lock_bh(&fsp->scsi_pkt_lock);
2258 + if (!(fsp->state & FC_SRB_COMPL)) {
2259 + fsp->state |= FC_SRB_COMPL;
2260 + /*
2261 + * TODO: dropping scsi_pkt_lock and then reacquiring
2262 + * again around fc_fcp_cleanup_cmd() is required,
2263 + * since fc_fcp_cleanup_cmd() calls into
2264 + * fc_seq_set_resp() and that func preempts cpu using
2265 + * schedule. May be schedule and related code should be
2266 + * removed instead of unlocking here to avoid scheduling
2267 + * while atomic bug.
2268 + */
2269 + spin_unlock_bh(&fsp->scsi_pkt_lock);
2270 +
2271 fc_fcp_cleanup_cmd(fsp, error);
2272 +
2273 + spin_lock_bh(&fsp->scsi_pkt_lock);
2274 fc_io_compl(fsp);
2275 - fc_fcp_unlock_pkt(fsp);
2276 }
2277 + spin_unlock_bh(&fsp->scsi_pkt_lock);
2278
2279 fc_fcp_pkt_release(fsp);
2280 spin_lock_irqsave(&si->scsi_queue_lock, flags);
2281 diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
2282 index 8053f24f0349..98d9bb6ff725 100644
2283 --- a/drivers/scsi/libiscsi.c
2284 +++ b/drivers/scsi/libiscsi.c
2285 @@ -2941,10 +2941,10 @@ void iscsi_conn_teardown(struct iscsi_cls_conn *cls_conn)
2286 {
2287 struct iscsi_conn *conn = cls_conn->dd_data;
2288 struct iscsi_session *session = conn->session;
2289 - unsigned long flags;
2290
2291 del_timer_sync(&conn->transport_timer);
2292
2293 + mutex_lock(&session->eh_mutex);
2294 spin_lock_bh(&session->frwd_lock);
2295 conn->c_stage = ISCSI_CONN_CLEANUP_WAIT;
2296 if (session->leadconn == conn) {
2297 @@ -2956,28 +2956,6 @@ void iscsi_conn_teardown(struct iscsi_cls_conn *cls_conn)
2298 }
2299 spin_unlock_bh(&session->frwd_lock);
2300
2301 - /*
2302 - * Block until all in-progress commands for this connection
2303 - * time out or fail.
2304 - */
2305 - for (;;) {
2306 - spin_lock_irqsave(session->host->host_lock, flags);
2307 - if (!atomic_read(&session->host->host_busy)) { /* OK for ERL == 0 */
2308 - spin_unlock_irqrestore(session->host->host_lock, flags);
2309 - break;
2310 - }
2311 - spin_unlock_irqrestore(session->host->host_lock, flags);
2312 - msleep_interruptible(500);
2313 - iscsi_conn_printk(KERN_INFO, conn, "iscsi conn_destroy(): "
2314 - "host_busy %d host_failed %d\n",
2315 - atomic_read(&session->host->host_busy),
2316 - session->host->host_failed);
2317 - /*
2318 - * force eh_abort() to unblock
2319 - */
2320 - wake_up(&conn->ehwait);
2321 - }
2322 -
2323 /* flush queued up work because we free the connection below */
2324 iscsi_suspend_tx(conn);
2325
2326 @@ -2994,6 +2972,7 @@ void iscsi_conn_teardown(struct iscsi_cls_conn *cls_conn)
2327 if (session->leadconn == conn)
2328 session->leadconn = NULL;
2329 spin_unlock_bh(&session->frwd_lock);
2330 + mutex_unlock(&session->eh_mutex);
2331
2332 iscsi_destroy_conn(cls_conn);
2333 }
2334 diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
2335 index 59c31bf88d92..ce6c770d74d5 100644
2336 --- a/drivers/scsi/scsi_error.c
2337 +++ b/drivers/scsi/scsi_error.c
2338 @@ -26,7 +26,6 @@
2339 #include <linux/blkdev.h>
2340 #include <linux/delay.h>
2341 #include <linux/jiffies.h>
2342 -#include <asm/unaligned.h>
2343
2344 #include <scsi/scsi.h>
2345 #include <scsi/scsi_cmnd.h>
2346 @@ -2587,33 +2586,3 @@ void scsi_build_sense_buffer(int desc, u8 *buf, u8 key, u8 asc, u8 ascq)
2347 }
2348 }
2349 EXPORT_SYMBOL(scsi_build_sense_buffer);
2350 -
2351 -/**
2352 - * scsi_set_sense_information - set the information field in a
2353 - * formatted sense data buffer
2354 - * @buf: Where to build sense data
2355 - * @info: 64-bit information value to be set
2356 - *
2357 - **/
2358 -void scsi_set_sense_information(u8 *buf, u64 info)
2359 -{
2360 - if ((buf[0] & 0x7f) == 0x72) {
2361 - u8 *ucp, len;
2362 -
2363 - len = buf[7];
2364 - ucp = (char *)scsi_sense_desc_find(buf, len + 8, 0);
2365 - if (!ucp) {
2366 - buf[7] = len + 0xa;
2367 - ucp = buf + 8 + len;
2368 - }
2369 - ucp[0] = 0;
2370 - ucp[1] = 0xa;
2371 - ucp[2] = 0x80; /* Valid bit */
2372 - ucp[3] = 0;
2373 - put_unaligned_be64(info, &ucp[4]);
2374 - } else if ((buf[0] & 0x7f) == 0x70) {
2375 - buf[0] |= 0x80;
2376 - put_unaligned_be64(info, &buf[3]);
2377 - }
2378 -}
2379 -EXPORT_SYMBOL(scsi_set_sense_information);
2380 diff --git a/drivers/scsi/scsi_pm.c b/drivers/scsi/scsi_pm.c
2381 index 9e43ae1d2163..e4b799837948 100644
2382 --- a/drivers/scsi/scsi_pm.c
2383 +++ b/drivers/scsi/scsi_pm.c
2384 @@ -217,15 +217,15 @@ static int sdev_runtime_suspend(struct device *dev)
2385 {
2386 const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
2387 struct scsi_device *sdev = to_scsi_device(dev);
2388 - int err;
2389 + int err = 0;
2390
2391 - err = blk_pre_runtime_suspend(sdev->request_queue);
2392 - if (err)
2393 - return err;
2394 - if (pm && pm->runtime_suspend)
2395 + if (pm && pm->runtime_suspend) {
2396 + err = blk_pre_runtime_suspend(sdev->request_queue);
2397 + if (err)
2398 + return err;
2399 err = pm->runtime_suspend(dev);
2400 - blk_post_runtime_suspend(sdev->request_queue, err);
2401 -
2402 + blk_post_runtime_suspend(sdev->request_queue, err);
2403 + }
2404 return err;
2405 }
2406
2407 @@ -248,11 +248,11 @@ static int sdev_runtime_resume(struct device *dev)
2408 const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
2409 int err = 0;
2410
2411 - blk_pre_runtime_resume(sdev->request_queue);
2412 - if (pm && pm->runtime_resume)
2413 + if (pm && pm->runtime_resume) {
2414 + blk_pre_runtime_resume(sdev->request_queue);
2415 err = pm->runtime_resume(dev);
2416 - blk_post_runtime_resume(sdev->request_queue, err);
2417 -
2418 + blk_post_runtime_resume(sdev->request_queue, err);
2419 + }
2420 return err;
2421 }
2422
2423 diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
2424 index 7f9d65fe4fd9..11ea52b2c36b 100644
2425 --- a/drivers/scsi/sd.c
2426 +++ b/drivers/scsi/sd.c
2427 @@ -2770,9 +2770,9 @@ static int sd_revalidate_disk(struct gendisk *disk)
2428 max_xfer = sdkp->max_xfer_blocks;
2429 max_xfer <<= ilog2(sdp->sector_size) - 9;
2430
2431 - max_xfer = min_not_zero(queue_max_hw_sectors(sdkp->disk->queue),
2432 - max_xfer);
2433 - blk_queue_max_hw_sectors(sdkp->disk->queue, max_xfer);
2434 + sdkp->disk->queue->limits.max_sectors =
2435 + min_not_zero(queue_max_hw_sectors(sdkp->disk->queue), max_xfer);
2436 +
2437 set_capacity(disk, sdkp->capacity);
2438 sd_config_write_same(sdkp);
2439 kfree(buffer);
2440 diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
2441 index 305a5cbc099a..0ab6e2efd28c 100644
2442 --- a/drivers/target/iscsi/iscsi_target.c
2443 +++ b/drivers/target/iscsi/iscsi_target.c
2444 @@ -968,9 +968,9 @@ int iscsit_setup_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
2445 cmd->cmd_flags |= ICF_NON_IMMEDIATE_UNSOLICITED_DATA;
2446
2447 conn->sess->init_task_tag = cmd->init_task_tag = hdr->itt;
2448 - if (hdr->flags & ISCSI_FLAG_CMD_READ) {
2449 + if (hdr->flags & ISCSI_FLAG_CMD_READ)
2450 cmd->targ_xfer_tag = session_get_next_ttt(conn->sess);
2451 - } else if (hdr->flags & ISCSI_FLAG_CMD_WRITE)
2452 + else
2453 cmd->targ_xfer_tag = 0xFFFFFFFF;
2454 cmd->cmd_sn = be32_to_cpu(hdr->cmdsn);
2455 cmd->exp_stat_sn = be32_to_cpu(hdr->exp_statsn);
2456 diff --git a/drivers/xen/xenbus/xenbus_client.c b/drivers/xen/xenbus/xenbus_client.c
2457 index 96b2011d25f3..658be6cc3db6 100644
2458 --- a/drivers/xen/xenbus/xenbus_client.c
2459 +++ b/drivers/xen/xenbus/xenbus_client.c
2460 @@ -814,8 +814,10 @@ static int xenbus_unmap_ring_vfree_hvm(struct xenbus_device *dev, void *vaddr)
2461
2462 rv = xenbus_unmap_ring(dev, node->handles, node->nr_handles,
2463 addrs);
2464 - if (!rv)
2465 + if (!rv) {
2466 vunmap(vaddr);
2467 + free_xenballooned_pages(node->nr_handles, node->hvm.pages);
2468 + }
2469 else
2470 WARN(1, "Leaking %p, size %u page(s)\n", vaddr,
2471 node->nr_handles);
2472 diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h
2473 index 45c39a37f924..8bc073d297db 100644
2474 --- a/include/drm/drm_pciids.h
2475 +++ b/include/drm/drm_pciids.h
2476 @@ -172,6 +172,7 @@
2477 {0x1002, 0x6610, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \
2478 {0x1002, 0x6611, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \
2479 {0x1002, 0x6613, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \
2480 + {0x1002, 0x6617, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
2481 {0x1002, 0x6620, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
2482 {0x1002, 0x6621, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
2483 {0x1002, 0x6623, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
2484 diff --git a/include/linux/ata.h b/include/linux/ata.h
2485 index 533dbb6428f5..5dfbcd8887bb 100644
2486 --- a/include/linux/ata.h
2487 +++ b/include/linux/ata.h
2488 @@ -385,8 +385,6 @@ enum {
2489 SATA_SSP = 0x06, /* Software Settings Preservation */
2490 SATA_DEVSLP = 0x09, /* Device Sleep */
2491
2492 - SETFEATURE_SENSE_DATA = 0xC3, /* Sense Data Reporting feature */
2493 -
2494 /* feature values for SET_MAX */
2495 ATA_SET_MAX_ADDR = 0x00,
2496 ATA_SET_MAX_PASSWD = 0x01,
2497 @@ -530,8 +528,6 @@ struct ata_bmdma_prd {
2498 #define ata_id_cdb_intr(id) (((id)[ATA_ID_CONFIG] & 0x60) == 0x20)
2499 #define ata_id_has_da(id) ((id)[ATA_ID_SATA_CAPABILITY_2] & (1 << 4))
2500 #define ata_id_has_devslp(id) ((id)[ATA_ID_FEATURE_SUPP] & (1 << 8))
2501 -#define ata_id_has_ncq_autosense(id) \
2502 - ((id)[ATA_ID_FEATURE_SUPP] & (1 << 7))
2503
2504 static inline bool ata_id_has_hipm(const u16 *id)
2505 {
2506 @@ -710,20 +706,6 @@ static inline bool ata_id_has_read_log_dma_ext(const u16 *id)
2507 return id[ATA_ID_COMMAND_SET_3] & (1 << 3);
2508 }
2509
2510 -static inline bool ata_id_has_sense_reporting(const u16 *id)
2511 -{
2512 - if (!(id[ATA_ID_CFS_ENABLE_2] & (1 << 15)))
2513 - return false;
2514 - return id[ATA_ID_COMMAND_SET_3] & (1 << 6);
2515 -}
2516 -
2517 -static inline bool ata_id_sense_reporting_enabled(const u16 *id)
2518 -{
2519 - if (!(id[ATA_ID_CFS_ENABLE_2] & (1 << 15)))
2520 - return false;
2521 - return id[ATA_ID_COMMAND_SET_4] & (1 << 6);
2522 -}
2523 -
2524 /**
2525 * ata_id_major_version - get ATA level of drive
2526 * @id: Identify data
2527 diff --git a/include/linux/irq.h b/include/linux/irq.h
2528 index 62c6901cab55..3532dca843f4 100644
2529 --- a/include/linux/irq.h
2530 +++ b/include/linux/irq.h
2531 @@ -467,6 +467,7 @@ extern int irq_chip_set_affinity_parent(struct irq_data *data,
2532 const struct cpumask *dest,
2533 bool force);
2534 extern int irq_chip_set_wake_parent(struct irq_data *data, unsigned int on);
2535 +extern int irq_chip_set_type_parent(struct irq_data *data, unsigned int type);
2536 #endif
2537
2538 /* Handling of unhandled and spurious interrupts: */
2539 diff --git a/include/scsi/scsi_eh.h b/include/scsi/scsi_eh.h
2540 index 5a4bb5bb66b3..1e1421b06565 100644
2541 --- a/include/scsi/scsi_eh.h
2542 +++ b/include/scsi/scsi_eh.h
2543 @@ -59,7 +59,6 @@ extern int scsi_get_sense_info_fld(const u8 * sense_buffer, int sb_len,
2544 u64 * info_out);
2545
2546 extern void scsi_build_sense_buffer(int desc, u8 *buf, u8 key, u8 asc, u8 ascq);
2547 -extern void scsi_set_sense_information(u8 *buf, u64 info);
2548
2549 extern int scsi_ioctl_reset(struct scsi_device *, int __user *);
2550
2551 diff --git a/ipc/sem.c b/ipc/sem.c
2552 index d1a6edd17eba..c50aa5755c62 100644
2553 --- a/ipc/sem.c
2554 +++ b/ipc/sem.c
2555 @@ -253,6 +253,16 @@ static void sem_rcu_free(struct rcu_head *head)
2556 }
2557
2558 /*
2559 + * spin_unlock_wait() and !spin_is_locked() are not memory barriers, they
2560 + * are only control barriers.
2561 + * The code must pair with spin_unlock(&sem->lock) or
2562 + * spin_unlock(&sem_perm.lock), thus just the control barrier is insufficient.
2563 + *
2564 + * smp_rmb() is sufficient, as writes cannot pass the control barrier.
2565 + */
2566 +#define ipc_smp_acquire__after_spin_is_unlocked() smp_rmb()
2567 +
2568 +/*
2569 * Wait until all currently ongoing simple ops have completed.
2570 * Caller must own sem_perm.lock.
2571 * New simple ops cannot start, because simple ops first check
2572 @@ -275,6 +285,7 @@ static void sem_wait_array(struct sem_array *sma)
2573 sem = sma->sem_base + i;
2574 spin_unlock_wait(&sem->lock);
2575 }
2576 + ipc_smp_acquire__after_spin_is_unlocked();
2577 }
2578
2579 /*
2580 @@ -327,13 +338,12 @@ static inline int sem_lock(struct sem_array *sma, struct sembuf *sops,
2581 /* Then check that the global lock is free */
2582 if (!spin_is_locked(&sma->sem_perm.lock)) {
2583 /*
2584 - * The ipc object lock check must be visible on all
2585 - * cores before rechecking the complex count. Otherwise
2586 - * we can race with another thread that does:
2587 + * We need a memory barrier with acquire semantics,
2588 + * otherwise we can race with another thread that does:
2589 * complex_count++;
2590 * spin_unlock(sem_perm.lock);
2591 */
2592 - smp_rmb();
2593 + ipc_smp_acquire__after_spin_is_unlocked();
2594
2595 /*
2596 * Now repeat the test of complex_count:
2597 @@ -2074,17 +2084,28 @@ void exit_sem(struct task_struct *tsk)
2598 rcu_read_lock();
2599 un = list_entry_rcu(ulp->list_proc.next,
2600 struct sem_undo, list_proc);
2601 - if (&un->list_proc == &ulp->list_proc)
2602 - semid = -1;
2603 - else
2604 - semid = un->semid;
2605 + if (&un->list_proc == &ulp->list_proc) {
2606 + /*
2607 + * We must wait for freeary() before freeing this ulp,
2608 + * in case we raced with last sem_undo. There is a small
2609 + * possibility where we exit while freeary() didn't
2610 + * finish unlocking sem_undo_list.
2611 + */
2612 + spin_unlock_wait(&ulp->lock);
2613 + rcu_read_unlock();
2614 + break;
2615 + }
2616 + spin_lock(&ulp->lock);
2617 + semid = un->semid;
2618 + spin_unlock(&ulp->lock);
2619
2620 + /* exit_sem raced with IPC_RMID, nothing to do */
2621 if (semid == -1) {
2622 rcu_read_unlock();
2623 - break;
2624 + continue;
2625 }
2626
2627 - sma = sem_obtain_object_check(tsk->nsproxy->ipc_ns, un->semid);
2628 + sma = sem_obtain_object_check(tsk->nsproxy->ipc_ns, semid);
2629 /* exit_sem raced with IPC_RMID, nothing to do */
2630 if (IS_ERR(sma)) {
2631 rcu_read_unlock();
2632 diff --git a/kernel/cpuset.c b/kernel/cpuset.c
2633 index ee14e3a35a29..f0acff0f66c9 100644
2634 --- a/kernel/cpuset.c
2635 +++ b/kernel/cpuset.c
2636 @@ -1223,7 +1223,7 @@ static int update_nodemask(struct cpuset *cs, struct cpuset *trialcs,
2637 spin_unlock_irq(&callback_lock);
2638
2639 /* use trialcs->mems_allowed as a temp variable */
2640 - update_nodemasks_hier(cs, &cs->mems_allowed);
2641 + update_nodemasks_hier(cs, &trialcs->mems_allowed);
2642 done:
2643 return retval;
2644 }
2645 diff --git a/kernel/events/core.c b/kernel/events/core.c
2646 index 0ceb386777ae..94817491407b 100644
2647 --- a/kernel/events/core.c
2648 +++ b/kernel/events/core.c
2649 @@ -1886,8 +1886,6 @@ event_sched_in(struct perf_event *event,
2650
2651 perf_pmu_disable(event->pmu);
2652
2653 - event->tstamp_running += tstamp - event->tstamp_stopped;
2654 -
2655 perf_set_shadow_time(event, ctx, tstamp);
2656
2657 perf_log_itrace_start(event);
2658 @@ -1899,6 +1897,8 @@ event_sched_in(struct perf_event *event,
2659 goto out;
2660 }
2661
2662 + event->tstamp_running += tstamp - event->tstamp_stopped;
2663 +
2664 if (!is_software_event(event))
2665 cpuctx->active_oncpu++;
2666 if (!ctx->nr_active++)
2667 @@ -3976,28 +3976,21 @@ static void perf_event_for_each(struct perf_event *event,
2668 perf_event_for_each_child(sibling, func);
2669 }
2670
2671 -static int perf_event_period(struct perf_event *event, u64 __user *arg)
2672 -{
2673 - struct perf_event_context *ctx = event->ctx;
2674 - int ret = 0, active;
2675 +struct period_event {
2676 + struct perf_event *event;
2677 u64 value;
2678 +};
2679
2680 - if (!is_sampling_event(event))
2681 - return -EINVAL;
2682 -
2683 - if (copy_from_user(&value, arg, sizeof(value)))
2684 - return -EFAULT;
2685 -
2686 - if (!value)
2687 - return -EINVAL;
2688 +static int __perf_event_period(void *info)
2689 +{
2690 + struct period_event *pe = info;
2691 + struct perf_event *event = pe->event;
2692 + struct perf_event_context *ctx = event->ctx;
2693 + u64 value = pe->value;
2694 + bool active;
2695
2696 - raw_spin_lock_irq(&ctx->lock);
2697 + raw_spin_lock(&ctx->lock);
2698 if (event->attr.freq) {
2699 - if (value > sysctl_perf_event_sample_rate) {
2700 - ret = -EINVAL;
2701 - goto unlock;
2702 - }
2703 -
2704 event->attr.sample_freq = value;
2705 } else {
2706 event->attr.sample_period = value;
2707 @@ -4016,11 +4009,53 @@ static int perf_event_period(struct perf_event *event, u64 __user *arg)
2708 event->pmu->start(event, PERF_EF_RELOAD);
2709 perf_pmu_enable(ctx->pmu);
2710 }
2711 + raw_spin_unlock(&ctx->lock);
2712
2713 -unlock:
2714 + return 0;
2715 +}
2716 +
2717 +static int perf_event_period(struct perf_event *event, u64 __user *arg)
2718 +{
2719 + struct period_event pe = { .event = event, };
2720 + struct perf_event_context *ctx = event->ctx;
2721 + struct task_struct *task;
2722 + u64 value;
2723 +
2724 + if (!is_sampling_event(event))
2725 + return -EINVAL;
2726 +
2727 + if (copy_from_user(&value, arg, sizeof(value)))
2728 + return -EFAULT;
2729 +
2730 + if (!value)
2731 + return -EINVAL;
2732 +
2733 + if (event->attr.freq && value > sysctl_perf_event_sample_rate)
2734 + return -EINVAL;
2735 +
2736 + task = ctx->task;
2737 + pe.value = value;
2738 +
2739 + if (!task) {
2740 + cpu_function_call(event->cpu, __perf_event_period, &pe);
2741 + return 0;
2742 + }
2743 +
2744 +retry:
2745 + if (!task_function_call(task, __perf_event_period, &pe))
2746 + return 0;
2747 +
2748 + raw_spin_lock_irq(&ctx->lock);
2749 + if (ctx->is_active) {
2750 + raw_spin_unlock_irq(&ctx->lock);
2751 + task = ctx->task;
2752 + goto retry;
2753 + }
2754 +
2755 + __perf_event_period(&pe);
2756 raw_spin_unlock_irq(&ctx->lock);
2757
2758 - return ret;
2759 + return 0;
2760 }
2761
2762 static const struct file_operations perf_fops;
2763 @@ -4766,12 +4801,20 @@ static const struct file_operations perf_fops = {
2764 * to user-space before waking everybody up.
2765 */
2766
2767 +static inline struct fasync_struct **perf_event_fasync(struct perf_event *event)
2768 +{
2769 + /* only the parent has fasync state */
2770 + if (event->parent)
2771 + event = event->parent;
2772 + return &event->fasync;
2773 +}
2774 +
2775 void perf_event_wakeup(struct perf_event *event)
2776 {
2777 ring_buffer_wakeup(event);
2778
2779 if (event->pending_kill) {
2780 - kill_fasync(&event->fasync, SIGIO, event->pending_kill);
2781 + kill_fasync(perf_event_fasync(event), SIGIO, event->pending_kill);
2782 event->pending_kill = 0;
2783 }
2784 }
2785 @@ -6117,7 +6160,7 @@ static int __perf_event_overflow(struct perf_event *event,
2786 else
2787 perf_event_output(event, data, regs);
2788
2789 - if (event->fasync && event->pending_kill) {
2790 + if (*perf_event_fasync(event) && event->pending_kill) {
2791 event->pending_wakeup = 1;
2792 irq_work_queue(&event->pending);
2793 }
2794 diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c
2795 index 725c416085e3..a7604c81168e 100644
2796 --- a/kernel/events/ring_buffer.c
2797 +++ b/kernel/events/ring_buffer.c
2798 @@ -547,11 +547,13 @@ static void __rb_free_aux(struct ring_buffer *rb)
2799 rb->aux_priv = NULL;
2800 }
2801
2802 - for (pg = 0; pg < rb->aux_nr_pages; pg++)
2803 - rb_free_aux_page(rb, pg);
2804 + if (rb->aux_nr_pages) {
2805 + for (pg = 0; pg < rb->aux_nr_pages; pg++)
2806 + rb_free_aux_page(rb, pg);
2807
2808 - kfree(rb->aux_pages);
2809 - rb->aux_nr_pages = 0;
2810 + kfree(rb->aux_pages);
2811 + rb->aux_nr_pages = 0;
2812 + }
2813 }
2814
2815 void rb_free_aux(struct ring_buffer *rb)
2816 diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
2817 index eb9a4ea394ab..94bbd8fee90d 100644
2818 --- a/kernel/irq/chip.c
2819 +++ b/kernel/irq/chip.c
2820 @@ -934,6 +934,23 @@ int irq_chip_set_affinity_parent(struct irq_data *data,
2821 }
2822
2823 /**
2824 + * irq_chip_set_type_parent - Set IRQ type on the parent interrupt
2825 + * @data: Pointer to interrupt specific data
2826 + * @type: IRQ_TYPE_{LEVEL,EDGE}_* value - see include/linux/irq.h
2827 + *
2828 + * Conditional, as the underlying parent chip might not implement it.
2829 + */
2830 +int irq_chip_set_type_parent(struct irq_data *data, unsigned int type)
2831 +{
2832 + data = data->parent_data;
2833 +
2834 + if (data->chip->irq_set_type)
2835 + return data->chip->irq_set_type(data, type);
2836 +
2837 + return -ENOSYS;
2838 +}
2839 +
2840 +/**
2841 * irq_chip_retrigger_hierarchy - Retrigger an interrupt in hardware
2842 * @data: Pointer to interrupt specific data
2843 *
2844 @@ -946,7 +963,7 @@ int irq_chip_retrigger_hierarchy(struct irq_data *data)
2845 if (data->chip && data->chip->irq_retrigger)
2846 return data->chip->irq_retrigger(data);
2847
2848 - return -ENOSYS;
2849 + return 0;
2850 }
2851
2852 /**
2853 diff --git a/mm/memory-failure.c b/mm/memory-failure.c
2854 index 501820c815b3..9f48145c884f 100644
2855 --- a/mm/memory-failure.c
2856 +++ b/mm/memory-failure.c
2857 @@ -1558,6 +1558,8 @@ static int get_any_page(struct page *page, unsigned long pfn, int flags)
2858 */
2859 ret = __get_any_page(page, pfn, 0);
2860 if (!PageLRU(page)) {
2861 + /* Drop page reference which is from __get_any_page() */
2862 + put_page(page);
2863 pr_info("soft_offline: %#lx: unknown non LRU page type %lx\n",
2864 pfn, page->flags);
2865 return -EIO;
2866 @@ -1587,13 +1589,12 @@ static int soft_offline_huge_page(struct page *page, int flags)
2867 unlock_page(hpage);
2868
2869 ret = isolate_huge_page(hpage, &pagelist);
2870 - if (ret) {
2871 - /*
2872 - * get_any_page() and isolate_huge_page() takes a refcount each,
2873 - * so need to drop one here.
2874 - */
2875 - put_page(hpage);
2876 - } else {
2877 + /*
2878 + * get_any_page() and isolate_huge_page() takes a refcount each,
2879 + * so need to drop one here.
2880 + */
2881 + put_page(hpage);
2882 + if (!ret) {
2883 pr_info("soft offline: %#lx hugepage failed to isolate\n", pfn);
2884 return -EBUSY;
2885 }
2886 diff --git a/net/9p/client.c b/net/9p/client.c
2887 index 81925b923318..fcf6fe063d82 100644
2888 --- a/net/9p/client.c
2889 +++ b/net/9p/client.c
2890 @@ -1541,6 +1541,7 @@ p9_client_read(struct p9_fid *fid, u64 offset, struct iov_iter *to, int *err)
2891 struct p9_client *clnt = fid->clnt;
2892 struct p9_req_t *req;
2893 int total = 0;
2894 + *err = 0;
2895
2896 p9_debug(P9_DEBUG_9P, ">>> TREAD fid %d offset %llu %d\n",
2897 fid->fid, (unsigned long long) offset, (int)iov_iter_count(to));
2898 @@ -1616,6 +1617,7 @@ p9_client_write(struct p9_fid *fid, u64 offset, struct iov_iter *from, int *err)
2899 struct p9_client *clnt = fid->clnt;
2900 struct p9_req_t *req;
2901 int total = 0;
2902 + *err = 0;
2903
2904 p9_debug(P9_DEBUG_9P, ">>> TWRITE fid %d offset %llu count %zd\n",
2905 fid->fid, (unsigned long long) offset,
2906 diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c
2907 index 247552a7f6c2..3ece7d1034c8 100644
2908 --- a/net/mac80211/rc80211_minstrel.c
2909 +++ b/net/mac80211/rc80211_minstrel.c
2910 @@ -92,14 +92,15 @@ int minstrel_get_tp_avg(struct minstrel_rate *mr, int prob_ewma)
2911 static inline void
2912 minstrel_sort_best_tp_rates(struct minstrel_sta_info *mi, int i, u8 *tp_list)
2913 {
2914 - int j = MAX_THR_RATES;
2915 - struct minstrel_rate_stats *tmp_mrs = &mi->r[j - 1].stats;
2916 + int j;
2917 + struct minstrel_rate_stats *tmp_mrs;
2918 struct minstrel_rate_stats *cur_mrs = &mi->r[i].stats;
2919
2920 - while (j > 0 && (minstrel_get_tp_avg(&mi->r[i], cur_mrs->prob_ewma) >
2921 - minstrel_get_tp_avg(&mi->r[tp_list[j - 1]], tmp_mrs->prob_ewma))) {
2922 - j--;
2923 + for (j = MAX_THR_RATES; j > 0; --j) {
2924 tmp_mrs = &mi->r[tp_list[j - 1]].stats;
2925 + if (minstrel_get_tp_avg(&mi->r[i], cur_mrs->prob_ewma) <=
2926 + minstrel_get_tp_avg(&mi->r[tp_list[j - 1]], tmp_mrs->prob_ewma))
2927 + break;
2928 }
2929
2930 if (j < MAX_THR_RATES - 1)
2931 diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl
2932 index 9cb8522d8d22..f3d3fb42b873 100755
2933 --- a/scripts/kconfig/streamline_config.pl
2934 +++ b/scripts/kconfig/streamline_config.pl
2935 @@ -137,7 +137,7 @@ my $ksource = ($ARGV[0] ? $ARGV[0] : '.');
2936 my $kconfig = $ARGV[1];
2937 my $lsmod_file = $ENV{'LSMOD'};
2938
2939 -my @makefiles = `find $ksource -name Makefile 2>/dev/null`;
2940 +my @makefiles = `find $ksource -name Makefile -or -name Kbuild 2>/dev/null`;
2941 chomp @makefiles;
2942
2943 my %depends;
2944 diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
2945 index 5645481af3d9..36e8f1236637 100644
2946 --- a/sound/pci/hda/hda_codec.c
2947 +++ b/sound/pci/hda/hda_codec.c
2948 @@ -3259,7 +3259,7 @@ static int add_std_chmaps(struct hda_codec *codec)
2949 struct snd_pcm_chmap *chmap;
2950 const struct snd_pcm_chmap_elem *elem;
2951
2952 - if (!pcm || pcm->own_chmap ||
2953 + if (!pcm || !pcm->pcm || pcm->own_chmap ||
2954 !hinfo->substreams)
2955 continue;
2956 elem = hinfo->chmap ? hinfo->chmap : snd_pcm_std_chmaps;
2957 diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
2958 index ac0db1679f09..5bc7f2e2715c 100644
2959 --- a/sound/pci/hda/hda_generic.c
2960 +++ b/sound/pci/hda/hda_generic.c
2961 @@ -671,7 +671,8 @@ static bool is_active_nid(struct hda_codec *codec, hda_nid_t nid,
2962 }
2963 for (i = 0; i < path->depth; i++) {
2964 if (path->path[i] == nid) {
2965 - if (dir == HDA_OUTPUT || path->idx[i] == idx)
2966 + if (dir == HDA_OUTPUT || idx == -1 ||
2967 + path->idx[i] == idx)
2968 return true;
2969 break;
2970 }
2971 @@ -682,7 +683,7 @@ static bool is_active_nid(struct hda_codec *codec, hda_nid_t nid,
2972
2973 /* check whether the NID is referred by any active paths */
2974 #define is_active_nid_for_any(codec, nid) \
2975 - is_active_nid(codec, nid, HDA_OUTPUT, 0)
2976 + is_active_nid(codec, nid, HDA_OUTPUT, -1)
2977
2978 /* get the default amp value for the target state */
2979 static int get_amp_val_to_activate(struct hda_codec *codec, hda_nid_t nid,
2980 @@ -883,8 +884,7 @@ void snd_hda_activate_path(struct hda_codec *codec, struct nid_path *path,
2981 struct hda_gen_spec *spec = codec->spec;
2982 int i;
2983
2984 - if (!enable)
2985 - path->active = false;
2986 + path->active = enable;
2987
2988 /* make sure the widget is powered up */
2989 if (enable && (spec->power_down_unused || codec->power_save_node))
2990 @@ -902,9 +902,6 @@ void snd_hda_activate_path(struct hda_codec *codec, struct nid_path *path,
2991 if (has_amp_out(codec, path, i))
2992 activate_amp_out(codec, path, i, enable);
2993 }
2994 -
2995 - if (enable)
2996 - path->active = true;
2997 }
2998 EXPORT_SYMBOL_GPL(snd_hda_activate_path);
2999
3000 diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
3001 index 78b719b5b34d..06cc9d57ba3d 100644
3002 --- a/sound/pci/hda/patch_conexant.c
3003 +++ b/sound/pci/hda/patch_conexant.c
3004 @@ -200,12 +200,33 @@ static int cx_auto_init(struct hda_codec *codec)
3005 return 0;
3006 }
3007
3008 -#define cx_auto_free snd_hda_gen_free
3009 +static void cx_auto_reboot_notify(struct hda_codec *codec)
3010 +{
3011 + struct conexant_spec *spec = codec->spec;
3012 +
3013 + if (codec->core.vendor_id != 0x14f150f2)
3014 + return;
3015 +
3016 + /* Turn the CX20722 codec into D3 to avoid spurious noises
3017 + from the internal speaker during (and after) reboot */
3018 + cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, false);
3019 +
3020 + snd_hda_codec_set_power_to_all(codec, codec->core.afg, AC_PWRST_D3);
3021 + snd_hda_codec_write(codec, codec->core.afg, 0,
3022 + AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
3023 +}
3024 +
3025 +static void cx_auto_free(struct hda_codec *codec)
3026 +{
3027 + cx_auto_reboot_notify(codec);
3028 + snd_hda_gen_free(codec);
3029 +}
3030
3031 static const struct hda_codec_ops cx_auto_patch_ops = {
3032 .build_controls = cx_auto_build_controls,
3033 .build_pcms = snd_hda_gen_build_pcms,
3034 .init = cx_auto_init,
3035 + .reboot_notify = cx_auto_reboot_notify,
3036 .free = cx_auto_free,
3037 .unsol_event = snd_hda_jack_unsol_event,
3038 #ifdef CONFIG_PM
3039 diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
3040 index 1e99f075a5ab..91f6928560e1 100644
3041 --- a/sound/pci/hda/patch_realtek.c
3042 +++ b/sound/pci/hda/patch_realtek.c
3043 @@ -5119,6 +5119,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
3044 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
3045 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
3046 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC292_FIXUP_DISABLE_AAMIX),
3047 + SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC292_FIXUP_DISABLE_AAMIX),
3048 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
3049 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
3050 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
3051 diff --git a/sound/usb/card.c b/sound/usb/card.c
3052 index 1fab9778807a..0450593980fd 100644
3053 --- a/sound/usb/card.c
3054 +++ b/sound/usb/card.c
3055 @@ -638,7 +638,7 @@ int snd_usb_autoresume(struct snd_usb_audio *chip)
3056 int err = -ENODEV;
3057
3058 down_read(&chip->shutdown_rwsem);
3059 - if (chip->probing && chip->in_pm)
3060 + if (chip->probing || chip->in_pm)
3061 err = 0;
3062 else if (!chip->shutdown)
3063 err = usb_autopm_get_interface(chip->pm_intf);
3064 diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
3065 index 754e689596a2..00ebc0ca008e 100644
3066 --- a/sound/usb/quirks.c
3067 +++ b/sound/usb/quirks.c
3068 @@ -1268,6 +1268,7 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip,
3069 return SNDRV_PCM_FMTBIT_DSD_U32_BE;
3070 break;
3071
3072 + case USB_ID(0x20b1, 0x000a): /* Gustard DAC-X20U */
3073 case USB_ID(0x20b1, 0x2009): /* DIYINHK DSD DXD 384kHz USB to I2S/DSD */
3074 case USB_ID(0x20b1, 0x2023): /* JLsounds I2SoverUSB */
3075 if (fp->altsetting == 3)