Magellan Linux

Annotation of /trunk/kernel-alx/patches-5.4/0261-5.4.162-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3637 - (hide annotations) (download)
Mon Oct 24 12:40:44 2022 UTC (19 months, 3 weeks ago) by niro
File size: 123910 byte(s)
-add missing
1 niro 3637 diff --git a/Makefile b/Makefile
2     index f552556966f1d..e8b05f7d3b238 100644
3     --- a/Makefile
4     +++ b/Makefile
5     @@ -1,7 +1,7 @@
6     # SPDX-License-Identifier: GPL-2.0
7     VERSION = 5
8     PATCHLEVEL = 4
9     -SUBLEVEL = 161
10     +SUBLEVEL = 162
11     EXTRAVERSION =
12     NAME = Kleptomaniac Octopus
13    
14     diff --git a/arch/arm/boot/dts/bcm-nsp.dtsi b/arch/arm/boot/dts/bcm-nsp.dtsi
15     index 43ff85d31dc12..5a1352fd90d16 100644
16     --- a/arch/arm/boot/dts/bcm-nsp.dtsi
17     +++ b/arch/arm/boot/dts/bcm-nsp.dtsi
18     @@ -77,7 +77,7 @@
19     interrupt-affinity = <&cpu0>, <&cpu1>;
20     };
21    
22     - mpcore@19000000 {
23     + mpcore-bus@19000000 {
24     compatible = "simple-bus";
25     ranges = <0x00000000 0x19000000 0x00023000>;
26     #address-cells = <1>;
27     @@ -217,7 +217,7 @@
28     #dma-cells = <1>;
29     };
30    
31     - sdio: sdhci@21000 {
32     + sdio: mmc@21000 {
33     compatible = "brcm,sdhci-iproc-cygnus";
34     reg = <0x21000 0x100>;
35     interrupts = <GIC_SPI 145 IRQ_TYPE_LEVEL_HIGH>;
36     diff --git a/arch/arm/boot/dts/ls1021a-tsn.dts b/arch/arm/boot/dts/ls1021a-tsn.dts
37     index 5b7689094b70e..7235ce2a32936 100644
38     --- a/arch/arm/boot/dts/ls1021a-tsn.dts
39     +++ b/arch/arm/boot/dts/ls1021a-tsn.dts
40     @@ -247,7 +247,7 @@
41    
42     flash@0 {
43     /* Rev. A uses 64MB flash, Rev. B & C use 32MB flash */
44     - compatible = "jedec,spi-nor", "s25fl256s1", "s25fl512s";
45     + compatible = "jedec,spi-nor";
46     spi-max-frequency = <20000000>;
47     #address-cells = <1>;
48     #size-cells = <1>;
49     diff --git a/arch/arm/boot/dts/ls1021a.dtsi b/arch/arm/boot/dts/ls1021a.dtsi
50     index c62fcca7b4263..aeb8a40b6b601 100644
51     --- a/arch/arm/boot/dts/ls1021a.dtsi
52     +++ b/arch/arm/boot/dts/ls1021a.dtsi
53     @@ -311,39 +311,6 @@
54     #thermal-sensor-cells = <1>;
55     };
56    
57     - thermal-zones {
58     - cpu_thermal: cpu-thermal {
59     - polling-delay-passive = <1000>;
60     - polling-delay = <5000>;
61     -
62     - thermal-sensors = <&tmu 0>;
63     -
64     - trips {
65     - cpu_alert: cpu-alert {
66     - temperature = <85000>;
67     - hysteresis = <2000>;
68     - type = "passive";
69     - };
70     - cpu_crit: cpu-crit {
71     - temperature = <95000>;
72     - hysteresis = <2000>;
73     - type = "critical";
74     - };
75     - };
76     -
77     - cooling-maps {
78     - map0 {
79     - trip = <&cpu_alert>;
80     - cooling-device =
81     - <&cpu0 THERMAL_NO_LIMIT
82     - THERMAL_NO_LIMIT>,
83     - <&cpu1 THERMAL_NO_LIMIT
84     - THERMAL_NO_LIMIT>;
85     - };
86     - };
87     - };
88     - };
89     -
90     dspi0: spi@2100000 {
91     compatible = "fsl,ls1021a-v1.0-dspi";
92     #address-cells = <1>;
93     @@ -984,4 +951,37 @@
94     };
95    
96     };
97     +
98     + thermal-zones {
99     + cpu_thermal: cpu-thermal {
100     + polling-delay-passive = <1000>;
101     + polling-delay = <5000>;
102     +
103     + thermal-sensors = <&tmu 0>;
104     +
105     + trips {
106     + cpu_alert: cpu-alert {
107     + temperature = <85000>;
108     + hysteresis = <2000>;
109     + type = "passive";
110     + };
111     + cpu_crit: cpu-crit {
112     + temperature = <95000>;
113     + hysteresis = <2000>;
114     + type = "critical";
115     + };
116     + };
117     +
118     + cooling-maps {
119     + map0 {
120     + trip = <&cpu_alert>;
121     + cooling-device =
122     + <&cpu0 THERMAL_NO_LIMIT
123     + THERMAL_NO_LIMIT>,
124     + <&cpu1 THERMAL_NO_LIMIT
125     + THERMAL_NO_LIMIT>;
126     + };
127     + };
128     + };
129     + };
130     };
131     diff --git a/arch/arm/boot/dts/omap-gpmc-smsc9221.dtsi b/arch/arm/boot/dts/omap-gpmc-smsc9221.dtsi
132     index 7f6aefd134514..e7534fe9c53cf 100644
133     --- a/arch/arm/boot/dts/omap-gpmc-smsc9221.dtsi
134     +++ b/arch/arm/boot/dts/omap-gpmc-smsc9221.dtsi
135     @@ -29,7 +29,7 @@
136     compatible = "smsc,lan9221","smsc,lan9115";
137     bank-width = <2>;
138    
139     - gpmc,mux-add-data;
140     + gpmc,mux-add-data = <0>;
141     gpmc,cs-on-ns = <0>;
142     gpmc,cs-rd-off-ns = <42>;
143     gpmc,cs-wr-off-ns = <36>;
144     diff --git a/arch/arm/boot/dts/omap3-overo-tobiduo-common.dtsi b/arch/arm/boot/dts/omap3-overo-tobiduo-common.dtsi
145     index e5da3bc6f1050..218a10c0d8159 100644
146     --- a/arch/arm/boot/dts/omap3-overo-tobiduo-common.dtsi
147     +++ b/arch/arm/boot/dts/omap3-overo-tobiduo-common.dtsi
148     @@ -22,7 +22,7 @@
149     compatible = "smsc,lan9221","smsc,lan9115";
150     bank-width = <2>;
151    
152     - gpmc,mux-add-data;
153     + gpmc,mux-add-data = <0>;
154     gpmc,cs-on-ns = <0>;
155     gpmc,cs-rd-off-ns = <42>;
156     gpmc,cs-wr-off-ns = <36>;
157     diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi
158     index 407ebdb35cd2e..6b1b728de9e9c 100644
159     --- a/arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi
160     +++ b/arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi
161     @@ -637,56 +637,56 @@
162     };
163    
164     cluster1_core0_watchdog: wdt@c000000 {
165     - compatible = "arm,sp805-wdt", "arm,primecell";
166     + compatible = "arm,sp805", "arm,primecell";
167     reg = <0x0 0xc000000 0x0 0x1000>;
168     clocks = <&clockgen 4 3>, <&clockgen 4 3>;
169     clock-names = "wdog_clk", "apb_pclk";
170     };
171    
172     cluster1_core1_watchdog: wdt@c010000 {
173     - compatible = "arm,sp805-wdt", "arm,primecell";
174     + compatible = "arm,sp805", "arm,primecell";
175     reg = <0x0 0xc010000 0x0 0x1000>;
176     clocks = <&clockgen 4 3>, <&clockgen 4 3>;
177     clock-names = "wdog_clk", "apb_pclk";
178     };
179    
180     cluster1_core2_watchdog: wdt@c020000 {
181     - compatible = "arm,sp805-wdt", "arm,primecell";
182     + compatible = "arm,sp805", "arm,primecell";
183     reg = <0x0 0xc020000 0x0 0x1000>;
184     clocks = <&clockgen 4 3>, <&clockgen 4 3>;
185     clock-names = "wdog_clk", "apb_pclk";
186     };
187    
188     cluster1_core3_watchdog: wdt@c030000 {
189     - compatible = "arm,sp805-wdt", "arm,primecell";
190     + compatible = "arm,sp805", "arm,primecell";
191     reg = <0x0 0xc030000 0x0 0x1000>;
192     clocks = <&clockgen 4 3>, <&clockgen 4 3>;
193     clock-names = "wdog_clk", "apb_pclk";
194     };
195    
196     cluster2_core0_watchdog: wdt@c100000 {
197     - compatible = "arm,sp805-wdt", "arm,primecell";
198     + compatible = "arm,sp805", "arm,primecell";
199     reg = <0x0 0xc100000 0x0 0x1000>;
200     clocks = <&clockgen 4 3>, <&clockgen 4 3>;
201     clock-names = "wdog_clk", "apb_pclk";
202     };
203    
204     cluster2_core1_watchdog: wdt@c110000 {
205     - compatible = "arm,sp805-wdt", "arm,primecell";
206     + compatible = "arm,sp805", "arm,primecell";
207     reg = <0x0 0xc110000 0x0 0x1000>;
208     clocks = <&clockgen 4 3>, <&clockgen 4 3>;
209     clock-names = "wdog_clk", "apb_pclk";
210     };
211    
212     cluster2_core2_watchdog: wdt@c120000 {
213     - compatible = "arm,sp805-wdt", "arm,primecell";
214     + compatible = "arm,sp805", "arm,primecell";
215     reg = <0x0 0xc120000 0x0 0x1000>;
216     clocks = <&clockgen 4 3>, <&clockgen 4 3>;
217     clock-names = "wdog_clk", "apb_pclk";
218     };
219    
220     cluster2_core3_watchdog: wdt@c130000 {
221     - compatible = "arm,sp805-wdt", "arm,primecell";
222     + compatible = "arm,sp805", "arm,primecell";
223     reg = <0x0 0xc130000 0x0 0x1000>;
224     clocks = <&clockgen 4 3>, <&clockgen 4 3>;
225     clock-names = "wdog_clk", "apb_pclk";
226     diff --git a/arch/arm64/boot/dts/freescale/fsl-ls208xa.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls208xa.dtsi
227     index 82f0fe6acbfb7..4bf4a22faa61a 100644
228     --- a/arch/arm64/boot/dts/freescale/fsl-ls208xa.dtsi
229     +++ b/arch/arm64/boot/dts/freescale/fsl-ls208xa.dtsi
230     @@ -227,56 +227,56 @@
231     };
232    
233     cluster1_core0_watchdog: wdt@c000000 {
234     - compatible = "arm,sp805-wdt", "arm,primecell";
235     + compatible = "arm,sp805", "arm,primecell";
236     reg = <0x0 0xc000000 0x0 0x1000>;
237     clocks = <&clockgen 4 3>, <&clockgen 4 3>;
238     clock-names = "wdog_clk", "apb_pclk";
239     };
240    
241     cluster1_core1_watchdog: wdt@c010000 {
242     - compatible = "arm,sp805-wdt", "arm,primecell";
243     + compatible = "arm,sp805", "arm,primecell";
244     reg = <0x0 0xc010000 0x0 0x1000>;
245     clocks = <&clockgen 4 3>, <&clockgen 4 3>;
246     clock-names = "wdog_clk", "apb_pclk";
247     };
248    
249     cluster2_core0_watchdog: wdt@c100000 {
250     - compatible = "arm,sp805-wdt", "arm,primecell";
251     + compatible = "arm,sp805", "arm,primecell";
252     reg = <0x0 0xc100000 0x0 0x1000>;
253     clocks = <&clockgen 4 3>, <&clockgen 4 3>;
254     clock-names = "wdog_clk", "apb_pclk";
255     };
256    
257     cluster2_core1_watchdog: wdt@c110000 {
258     - compatible = "arm,sp805-wdt", "arm,primecell";
259     + compatible = "arm,sp805", "arm,primecell";
260     reg = <0x0 0xc110000 0x0 0x1000>;
261     clocks = <&clockgen 4 3>, <&clockgen 4 3>;
262     clock-names = "wdog_clk", "apb_pclk";
263     };
264    
265     cluster3_core0_watchdog: wdt@c200000 {
266     - compatible = "arm,sp805-wdt", "arm,primecell";
267     + compatible = "arm,sp805", "arm,primecell";
268     reg = <0x0 0xc200000 0x0 0x1000>;
269     clocks = <&clockgen 4 3>, <&clockgen 4 3>;
270     clock-names = "wdog_clk", "apb_pclk";
271     };
272    
273     cluster3_core1_watchdog: wdt@c210000 {
274     - compatible = "arm,sp805-wdt", "arm,primecell";
275     + compatible = "arm,sp805", "arm,primecell";
276     reg = <0x0 0xc210000 0x0 0x1000>;
277     clocks = <&clockgen 4 3>, <&clockgen 4 3>;
278     clock-names = "wdog_clk", "apb_pclk";
279     };
280    
281     cluster4_core0_watchdog: wdt@c300000 {
282     - compatible = "arm,sp805-wdt", "arm,primecell";
283     + compatible = "arm,sp805", "arm,primecell";
284     reg = <0x0 0xc300000 0x0 0x1000>;
285     clocks = <&clockgen 4 3>, <&clockgen 4 3>;
286     clock-names = "wdog_clk", "apb_pclk";
287     };
288    
289     cluster4_core1_watchdog: wdt@c310000 {
290     - compatible = "arm,sp805-wdt", "arm,primecell";
291     + compatible = "arm,sp805", "arm,primecell";
292     reg = <0x0 0xc310000 0x0 0x1000>;
293     clocks = <&clockgen 4 3>, <&clockgen 4 3>;
294     clock-names = "wdog_clk", "apb_pclk";
295     diff --git a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
296     index 253cc345f143a..0c88b72094774 100644
297     --- a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
298     +++ b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
299     @@ -1086,7 +1086,7 @@
300     };
301    
302     watchdog0: watchdog@e8a06000 {
303     - compatible = "arm,sp805-wdt", "arm,primecell";
304     + compatible = "arm,sp805", "arm,primecell";
305     reg = <0x0 0xe8a06000 0x0 0x1000>;
306     interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>;
307     clocks = <&crg_ctrl HI3660_OSC32K>;
308     @@ -1094,7 +1094,7 @@
309     };
310    
311     watchdog1: watchdog@e8a07000 {
312     - compatible = "arm,sp805-wdt", "arm,primecell";
313     + compatible = "arm,sp805", "arm,primecell";
314     reg = <0x0 0xe8a07000 0x0 0x1000>;
315     interrupts = <GIC_SPI 45 IRQ_TYPE_LEVEL_HIGH>;
316     clocks = <&crg_ctrl HI3660_OSC32K>;
317     diff --git a/arch/arm64/boot/dts/hisilicon/hi6220.dtsi b/arch/arm64/boot/dts/hisilicon/hi6220.dtsi
318     index 108e2a4227f66..568faaba7ace9 100644
319     --- a/arch/arm64/boot/dts/hisilicon/hi6220.dtsi
320     +++ b/arch/arm64/boot/dts/hisilicon/hi6220.dtsi
321     @@ -839,7 +839,7 @@
322     };
323    
324     watchdog0: watchdog@f8005000 {
325     - compatible = "arm,sp805-wdt", "arm,primecell";
326     + compatible = "arm,sp805", "arm,primecell";
327     reg = <0x0 0xf8005000 0x0 0x1000>;
328     interrupts = <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>;
329     clocks = <&ao_ctrl HI6220_WDT0_PCLK>;
330     diff --git a/arch/arm64/boot/dts/qcom/msm8998.dtsi b/arch/arm64/boot/dts/qcom/msm8998.dtsi
331     index ccd535edbf4e1..dcb79003ca0e6 100644
332     --- a/arch/arm64/boot/dts/qcom/msm8998.dtsi
333     +++ b/arch/arm64/boot/dts/qcom/msm8998.dtsi
334     @@ -246,38 +246,42 @@
335     LITTLE_CPU_SLEEP_0: cpu-sleep-0-0 {
336     compatible = "arm,idle-state";
337     idle-state-name = "little-retention";
338     + /* CPU Retention (C2D), L2 Active */
339     arm,psci-suspend-param = <0x00000002>;
340     entry-latency-us = <81>;
341     exit-latency-us = <86>;
342     - min-residency-us = <200>;
343     + min-residency-us = <504>;
344     };
345    
346     LITTLE_CPU_SLEEP_1: cpu-sleep-0-1 {
347     compatible = "arm,idle-state";
348     idle-state-name = "little-power-collapse";
349     + /* CPU + L2 Power Collapse (C3, D4) */
350     arm,psci-suspend-param = <0x40000003>;
351     - entry-latency-us = <273>;
352     - exit-latency-us = <612>;
353     - min-residency-us = <1000>;
354     + entry-latency-us = <814>;
355     + exit-latency-us = <4562>;
356     + min-residency-us = <9183>;
357     local-timer-stop;
358     };
359    
360     BIG_CPU_SLEEP_0: cpu-sleep-1-0 {
361     compatible = "arm,idle-state";
362     idle-state-name = "big-retention";
363     + /* CPU Retention (C2D), L2 Active */
364     arm,psci-suspend-param = <0x00000002>;
365     entry-latency-us = <79>;
366     exit-latency-us = <82>;
367     - min-residency-us = <200>;
368     + min-residency-us = <1302>;
369     };
370    
371     BIG_CPU_SLEEP_1: cpu-sleep-1-1 {
372     compatible = "arm,idle-state";
373     idle-state-name = "big-power-collapse";
374     + /* CPU + L2 Power Collapse (C3, D4) */
375     arm,psci-suspend-param = <0x40000003>;
376     - entry-latency-us = <336>;
377     - exit-latency-us = <525>;
378     - min-residency-us = <1000>;
379     + entry-latency-us = <724>;
380     + exit-latency-us = <2027>;
381     + min-residency-us = <9419>;
382     local-timer-stop;
383     };
384     };
385     diff --git a/arch/arm64/boot/dts/xilinx/zynqmp-zc1751-xm016-dc2.dts b/arch/arm64/boot/dts/xilinx/zynqmp-zc1751-xm016-dc2.dts
386     index 2421ec71a201c..41a66787247b6 100644
387     --- a/arch/arm64/boot/dts/xilinx/zynqmp-zc1751-xm016-dc2.dts
388     +++ b/arch/arm64/boot/dts/xilinx/zynqmp-zc1751-xm016-dc2.dts
389     @@ -131,7 +131,7 @@
390     reg = <0>;
391    
392     partition@0 {
393     - label = "data";
394     + label = "spi0-data";
395     reg = <0x0 0x100000>;
396     };
397     };
398     @@ -149,7 +149,7 @@
399     reg = <0>;
400    
401     partition@0 {
402     - label = "data";
403     + label = "spi1-data";
404     reg = <0x0 0x84000>;
405     };
406     };
407     diff --git a/arch/arm64/boot/dts/xilinx/zynqmp.dtsi b/arch/arm64/boot/dts/xilinx/zynqmp.dtsi
408     index a2645262f8623..b92549fb32400 100644
409     --- a/arch/arm64/boot/dts/xilinx/zynqmp.dtsi
410     +++ b/arch/arm64/boot/dts/xilinx/zynqmp.dtsi
411     @@ -582,7 +582,7 @@
412     };
413    
414     uart0: serial@ff000000 {
415     - compatible = "cdns,uart-r1p12", "xlnx,xuartps";
416     + compatible = "xlnx,zynqmp-uart", "cdns,uart-r1p12";
417     status = "disabled";
418     interrupt-parent = <&gic>;
419     interrupts = <0 21 4>;
420     @@ -591,7 +591,7 @@
421     };
422    
423     uart1: serial@ff010000 {
424     - compatible = "cdns,uart-r1p12", "xlnx,xuartps";
425     + compatible = "xlnx,zynqmp-uart", "cdns,uart-r1p12";
426     status = "disabled";
427     interrupt-parent = <&gic>;
428     interrupts = <0 22 4>;
429     diff --git a/arch/arm64/kernel/vdso32/Makefile b/arch/arm64/kernel/vdso32/Makefile
430     index 40dffe60b8454..894791f03596d 100644
431     --- a/arch/arm64/kernel/vdso32/Makefile
432     +++ b/arch/arm64/kernel/vdso32/Makefile
433     @@ -32,7 +32,8 @@ cc32-as-instr = $(call try-run,\
434     # As a result we set our own flags here.
435    
436     # KBUILD_CPPFLAGS and NOSTDINC_FLAGS from top-level Makefile
437     -VDSO_CPPFLAGS := -D__KERNEL__ -nostdinc -isystem $(shell $(CC_COMPAT) -print-file-name=include)
438     +VDSO_CPPFLAGS := -D__KERNEL__ -nostdinc
439     +VDSO_CPPFLAGS += -isystem $(shell $(CC_COMPAT) -print-file-name=include 2>/dev/null)
440     VDSO_CPPFLAGS += $(LINUXINCLUDE)
441    
442     # Common C and assembly flags
443     diff --git a/arch/hexagon/lib/io.c b/arch/hexagon/lib/io.c
444     index d35d69d6588c4..55f75392857b0 100644
445     --- a/arch/hexagon/lib/io.c
446     +++ b/arch/hexagon/lib/io.c
447     @@ -27,6 +27,7 @@ void __raw_readsw(const void __iomem *addr, void *data, int len)
448     *dst++ = *src;
449    
450     }
451     +EXPORT_SYMBOL(__raw_readsw);
452    
453     /*
454     * __raw_writesw - read words a short at a time
455     @@ -47,6 +48,7 @@ void __raw_writesw(void __iomem *addr, const void *data, int len)
456    
457    
458     }
459     +EXPORT_SYMBOL(__raw_writesw);
460    
461     /* Pretty sure len is pre-adjusted for the length of the access already */
462     void __raw_readsl(const void __iomem *addr, void *data, int len)
463     @@ -62,6 +64,7 @@ void __raw_readsl(const void __iomem *addr, void *data, int len)
464    
465    
466     }
467     +EXPORT_SYMBOL(__raw_readsl);
468    
469     void __raw_writesl(void __iomem *addr, const void *data, int len)
470     {
471     @@ -76,3 +79,4 @@ void __raw_writesl(void __iomem *addr, const void *data, int len)
472    
473    
474     }
475     +EXPORT_SYMBOL(__raw_writesl);
476     diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
477     index 041d34975ea2c..9749818eed6d6 100644
478     --- a/arch/mips/Kconfig
479     +++ b/arch/mips/Kconfig
480     @@ -294,6 +294,9 @@ config BCM63XX
481     select SYS_SUPPORTS_32BIT_KERNEL
482     select SYS_SUPPORTS_BIG_ENDIAN
483     select SYS_HAS_EARLY_PRINTK
484     + select SYS_HAS_CPU_BMIPS32_3300
485     + select SYS_HAS_CPU_BMIPS4350
486     + select SYS_HAS_CPU_BMIPS4380
487     select SWAP_IO_SPACE
488     select GPIOLIB
489     select HAVE_CLK
490     diff --git a/arch/mips/bcm63xx/clk.c b/arch/mips/bcm63xx/clk.c
491     index 164115944a7fd..aba6e2d6a736c 100644
492     --- a/arch/mips/bcm63xx/clk.c
493     +++ b/arch/mips/bcm63xx/clk.c
494     @@ -381,6 +381,12 @@ void clk_disable(struct clk *clk)
495    
496     EXPORT_SYMBOL(clk_disable);
497    
498     +struct clk *clk_get_parent(struct clk *clk)
499     +{
500     + return NULL;
501     +}
502     +EXPORT_SYMBOL(clk_get_parent);
503     +
504     unsigned long clk_get_rate(struct clk *clk)
505     {
506     if (!clk)
507     diff --git a/arch/mips/generic/yamon-dt.c b/arch/mips/generic/yamon-dt.c
508     index a3aa22c77cadc..a07a5edbcda78 100644
509     --- a/arch/mips/generic/yamon-dt.c
510     +++ b/arch/mips/generic/yamon-dt.c
511     @@ -75,7 +75,7 @@ static unsigned int __init gen_fdt_mem_array(
512     __init int yamon_dt_append_memory(void *fdt,
513     const struct yamon_mem_region *regions)
514     {
515     - unsigned long phys_memsize, memsize;
516     + unsigned long phys_memsize = 0, memsize;
517     __be32 mem_array[2 * MAX_MEM_ARRAY_ENTRIES];
518     unsigned int mem_entries;
519     int i, err, mem_off;
520     diff --git a/arch/mips/lantiq/clk.c b/arch/mips/lantiq/clk.c
521     index dd819e31fcbbf..4916cccf378fd 100644
522     --- a/arch/mips/lantiq/clk.c
523     +++ b/arch/mips/lantiq/clk.c
524     @@ -158,6 +158,12 @@ void clk_deactivate(struct clk *clk)
525     }
526     EXPORT_SYMBOL(clk_deactivate);
527    
528     +struct clk *clk_get_parent(struct clk *clk)
529     +{
530     + return NULL;
531     +}
532     +EXPORT_SYMBOL(clk_get_parent);
533     +
534     static inline u32 get_counter_resolution(void)
535     {
536     u32 res;
537     diff --git a/arch/mips/sni/time.c b/arch/mips/sni/time.c
538     index dbace1f3e1a97..745ceb945fc50 100644
539     --- a/arch/mips/sni/time.c
540     +++ b/arch/mips/sni/time.c
541     @@ -18,14 +18,14 @@ static int a20r_set_periodic(struct clock_event_device *evt)
542     {
543     *(volatile u8 *)(A20R_PT_CLOCK_BASE + 12) = 0x34;
544     wmb();
545     - *(volatile u8 *)(A20R_PT_CLOCK_BASE + 0) = SNI_COUNTER0_DIV;
546     + *(volatile u8 *)(A20R_PT_CLOCK_BASE + 0) = SNI_COUNTER0_DIV & 0xff;
547     wmb();
548     *(volatile u8 *)(A20R_PT_CLOCK_BASE + 0) = SNI_COUNTER0_DIV >> 8;
549     wmb();
550    
551     *(volatile u8 *)(A20R_PT_CLOCK_BASE + 12) = 0xb4;
552     wmb();
553     - *(volatile u8 *)(A20R_PT_CLOCK_BASE + 8) = SNI_COUNTER2_DIV;
554     + *(volatile u8 *)(A20R_PT_CLOCK_BASE + 8) = SNI_COUNTER2_DIV & 0xff;
555     wmb();
556     *(volatile u8 *)(A20R_PT_CLOCK_BASE + 8) = SNI_COUNTER2_DIV >> 8;
557     wmb();
558     diff --git a/arch/powerpc/boot/dts/charon.dts b/arch/powerpc/boot/dts/charon.dts
559     index 408b486b13dff..cd589539f313f 100644
560     --- a/arch/powerpc/boot/dts/charon.dts
561     +++ b/arch/powerpc/boot/dts/charon.dts
562     @@ -35,7 +35,7 @@
563     };
564     };
565    
566     - memory {
567     + memory@0 {
568     device_type = "memory";
569     reg = <0x00000000 0x08000000>; // 128MB
570     };
571     diff --git a/arch/powerpc/boot/dts/digsy_mtc.dts b/arch/powerpc/boot/dts/digsy_mtc.dts
572     index 0e5e9d3acf79f..19a14e62e65f4 100644
573     --- a/arch/powerpc/boot/dts/digsy_mtc.dts
574     +++ b/arch/powerpc/boot/dts/digsy_mtc.dts
575     @@ -16,7 +16,7 @@
576     model = "intercontrol,digsy-mtc";
577     compatible = "intercontrol,digsy-mtc";
578    
579     - memory {
580     + memory@0 {
581     reg = <0x00000000 0x02000000>; // 32MB
582     };
583    
584     diff --git a/arch/powerpc/boot/dts/lite5200.dts b/arch/powerpc/boot/dts/lite5200.dts
585     index cb2782dd6132c..e7b194775d783 100644
586     --- a/arch/powerpc/boot/dts/lite5200.dts
587     +++ b/arch/powerpc/boot/dts/lite5200.dts
588     @@ -32,7 +32,7 @@
589     };
590     };
591    
592     - memory {
593     + memory@0 {
594     device_type = "memory";
595     reg = <0x00000000 0x04000000>; // 64MB
596     };
597     diff --git a/arch/powerpc/boot/dts/lite5200b.dts b/arch/powerpc/boot/dts/lite5200b.dts
598     index 2b86c81f90485..547cbe726ff23 100644
599     --- a/arch/powerpc/boot/dts/lite5200b.dts
600     +++ b/arch/powerpc/boot/dts/lite5200b.dts
601     @@ -31,7 +31,7 @@
602     led4 { gpios = <&gpio_simple 2 1>; };
603     };
604    
605     - memory {
606     + memory@0 {
607     reg = <0x00000000 0x10000000>; // 256MB
608     };
609    
610     diff --git a/arch/powerpc/boot/dts/media5200.dts b/arch/powerpc/boot/dts/media5200.dts
611     index 61cae9dcddef4..f3188018faceb 100644
612     --- a/arch/powerpc/boot/dts/media5200.dts
613     +++ b/arch/powerpc/boot/dts/media5200.dts
614     @@ -32,7 +32,7 @@
615     };
616     };
617    
618     - memory {
619     + memory@0 {
620     reg = <0x00000000 0x08000000>; // 128MB RAM
621     };
622    
623     diff --git a/arch/powerpc/boot/dts/mpc5200b.dtsi b/arch/powerpc/boot/dts/mpc5200b.dtsi
624     index 648fe31795f49..8b796f3b11da7 100644
625     --- a/arch/powerpc/boot/dts/mpc5200b.dtsi
626     +++ b/arch/powerpc/boot/dts/mpc5200b.dtsi
627     @@ -33,7 +33,7 @@
628     };
629     };
630    
631     - memory: memory {
632     + memory: memory@0 {
633     device_type = "memory";
634     reg = <0x00000000 0x04000000>; // 64MB
635     };
636     diff --git a/arch/powerpc/boot/dts/o2d.dts b/arch/powerpc/boot/dts/o2d.dts
637     index 24a46f65e5299..e0a8d3034417f 100644
638     --- a/arch/powerpc/boot/dts/o2d.dts
639     +++ b/arch/powerpc/boot/dts/o2d.dts
640     @@ -12,7 +12,7 @@
641     model = "ifm,o2d";
642     compatible = "ifm,o2d";
643    
644     - memory {
645     + memory@0 {
646     reg = <0x00000000 0x08000000>; // 128MB
647     };
648    
649     diff --git a/arch/powerpc/boot/dts/o2d.dtsi b/arch/powerpc/boot/dts/o2d.dtsi
650     index 6661955a2be47..b55a9e5bd828c 100644
651     --- a/arch/powerpc/boot/dts/o2d.dtsi
652     +++ b/arch/powerpc/boot/dts/o2d.dtsi
653     @@ -19,7 +19,7 @@
654     model = "ifm,o2d";
655     compatible = "ifm,o2d";
656    
657     - memory {
658     + memory@0 {
659     reg = <0x00000000 0x04000000>; // 64MB
660     };
661    
662     diff --git a/arch/powerpc/boot/dts/o2dnt2.dts b/arch/powerpc/boot/dts/o2dnt2.dts
663     index eeba7f5507d5d..c2eedbd1f5fcb 100644
664     --- a/arch/powerpc/boot/dts/o2dnt2.dts
665     +++ b/arch/powerpc/boot/dts/o2dnt2.dts
666     @@ -12,7 +12,7 @@
667     model = "ifm,o2dnt2";
668     compatible = "ifm,o2d";
669    
670     - memory {
671     + memory@0 {
672     reg = <0x00000000 0x08000000>; // 128MB
673     };
674    
675     diff --git a/arch/powerpc/boot/dts/o3dnt.dts b/arch/powerpc/boot/dts/o3dnt.dts
676     index fd00396b0593e..e4c1bdd412716 100644
677     --- a/arch/powerpc/boot/dts/o3dnt.dts
678     +++ b/arch/powerpc/boot/dts/o3dnt.dts
679     @@ -12,7 +12,7 @@
680     model = "ifm,o3dnt";
681     compatible = "ifm,o2d";
682    
683     - memory {
684     + memory@0 {
685     reg = <0x00000000 0x04000000>; // 64MB
686     };
687    
688     diff --git a/arch/powerpc/boot/dts/pcm032.dts b/arch/powerpc/boot/dts/pcm032.dts
689     index c259c6b3ac5ab..5674f978b9830 100644
690     --- a/arch/powerpc/boot/dts/pcm032.dts
691     +++ b/arch/powerpc/boot/dts/pcm032.dts
692     @@ -22,7 +22,7 @@
693     model = "phytec,pcm032";
694     compatible = "phytec,pcm032";
695    
696     - memory {
697     + memory@0 {
698     reg = <0x00000000 0x08000000>; // 128MB
699     };
700    
701     diff --git a/arch/powerpc/boot/dts/tqm5200.dts b/arch/powerpc/boot/dts/tqm5200.dts
702     index 9ed0bc78967e1..5bb25a9e40a01 100644
703     --- a/arch/powerpc/boot/dts/tqm5200.dts
704     +++ b/arch/powerpc/boot/dts/tqm5200.dts
705     @@ -32,7 +32,7 @@
706     };
707     };
708    
709     - memory {
710     + memory@0 {
711     device_type = "memory";
712     reg = <0x00000000 0x04000000>; // 64MB
713     };
714     diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
715     index f9c7326672b95..c9c6619564ffa 100644
716     --- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S
717     +++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
718     @@ -2535,7 +2535,7 @@ hcall_real_table:
719     .globl hcall_real_table_end
720     hcall_real_table_end:
721    
722     -_GLOBAL(kvmppc_h_set_xdabr)
723     +_GLOBAL_TOC(kvmppc_h_set_xdabr)
724     EXPORT_SYMBOL_GPL(kvmppc_h_set_xdabr)
725     andi. r0, r5, DABRX_USER | DABRX_KERNEL
726     beq 6f
727     @@ -2545,7 +2545,7 @@ EXPORT_SYMBOL_GPL(kvmppc_h_set_xdabr)
728     6: li r3, H_PARAMETER
729     blr
730    
731     -_GLOBAL(kvmppc_h_set_dabr)
732     +_GLOBAL_TOC(kvmppc_h_set_dabr)
733     EXPORT_SYMBOL_GPL(kvmppc_h_set_dabr)
734     li r5, DABRX_USER | DABRX_KERNEL
735     3:
736     diff --git a/arch/powerpc/sysdev/dcr-low.S b/arch/powerpc/sysdev/dcr-low.S
737     index efeeb1b885a17..329b9c4ae5429 100644
738     --- a/arch/powerpc/sysdev/dcr-low.S
739     +++ b/arch/powerpc/sysdev/dcr-low.S
740     @@ -11,7 +11,7 @@
741     #include <asm/export.h>
742    
743     #define DCR_ACCESS_PROLOG(table) \
744     - cmpli cr0,r3,1024; \
745     + cmplwi cr0,r3,1024; \
746     rlwinm r3,r3,4,18,27; \
747     lis r5,table@h; \
748     ori r5,r5,table@l; \
749     diff --git a/arch/s390/include/asm/kexec.h b/arch/s390/include/asm/kexec.h
750     index ea398a05f6432..7f3c9ac34bd8d 100644
751     --- a/arch/s390/include/asm/kexec.h
752     +++ b/arch/s390/include/asm/kexec.h
753     @@ -74,6 +74,12 @@ void *kexec_file_add_components(struct kimage *image,
754     int arch_kexec_do_relocs(int r_type, void *loc, unsigned long val,
755     unsigned long addr);
756    
757     +#define ARCH_HAS_KIMAGE_ARCH
758     +
759     +struct kimage_arch {
760     + void *ipl_buf;
761     +};
762     +
763     extern const struct kexec_file_ops s390_kexec_image_ops;
764     extern const struct kexec_file_ops s390_kexec_elf_ops;
765    
766     diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c
767     index 6837affc19e81..7795cdee6427d 100644
768     --- a/arch/s390/kernel/ipl.c
769     +++ b/arch/s390/kernel/ipl.c
770     @@ -1783,7 +1783,7 @@ void *ipl_report_finish(struct ipl_report *report)
771    
772     buf = vzalloc(report->size);
773     if (!buf)
774     - return ERR_PTR(-ENOMEM);
775     + goto out;
776     ptr = buf;
777    
778     memcpy(ptr, report->ipib, report->ipib->hdr.len);
779     @@ -1822,6 +1822,7 @@ void *ipl_report_finish(struct ipl_report *report)
780     }
781    
782     BUG_ON(ptr > buf + report->size);
783     +out:
784     return buf;
785     }
786    
787     diff --git a/arch/s390/kernel/machine_kexec_file.c b/arch/s390/kernel/machine_kexec_file.c
788     index f9e4baa64b675..e7435f3a3d2d2 100644
789     --- a/arch/s390/kernel/machine_kexec_file.c
790     +++ b/arch/s390/kernel/machine_kexec_file.c
791     @@ -12,6 +12,7 @@
792     #include <linux/kexec.h>
793     #include <linux/module_signature.h>
794     #include <linux/verification.h>
795     +#include <linux/vmalloc.h>
796     #include <asm/boot_data.h>
797     #include <asm/ipl.h>
798     #include <asm/setup.h>
799     @@ -170,6 +171,7 @@ static int kexec_file_add_ipl_report(struct kimage *image,
800     struct kexec_buf buf;
801     unsigned long addr;
802     void *ptr, *end;
803     + int ret;
804    
805     buf.image = image;
806    
807     @@ -199,9 +201,13 @@ static int kexec_file_add_ipl_report(struct kimage *image,
808     ptr += len;
809     }
810    
811     + ret = -ENOMEM;
812     buf.buffer = ipl_report_finish(data->report);
813     + if (!buf.buffer)
814     + goto out;
815     buf.bufsz = data->report->size;
816     buf.memsz = buf.bufsz;
817     + image->arch.ipl_buf = buf.buffer;
818    
819     data->memsz += buf.memsz;
820    
821     @@ -209,7 +215,9 @@ static int kexec_file_add_ipl_report(struct kimage *image,
822     data->kernel_buf + offsetof(struct lowcore, ipl_parmblock_ptr);
823     *lc_ipl_parmblock_ptr = (__u32)buf.mem;
824    
825     - return kexec_add_buffer(&buf);
826     + ret = kexec_add_buffer(&buf);
827     +out:
828     + return ret;
829     }
830    
831     void *kexec_file_add_components(struct kimage *image,
832     @@ -321,3 +329,11 @@ int arch_kexec_kernel_image_probe(struct kimage *image, void *buf,
833    
834     return kexec_image_probe_default(image, buf, buf_len);
835     }
836     +
837     +int arch_kimage_file_post_load_cleanup(struct kimage *image)
838     +{
839     + vfree(image->arch.ipl_buf);
840     + image->arch.ipl_buf = NULL;
841     +
842     + return kexec_image_post_load_cleanup_default(image);
843     +}
844     diff --git a/arch/sh/Kconfig.debug b/arch/sh/Kconfig.debug
845     index 010b6c33bbba2..71acd3d9b9e83 100644
846     --- a/arch/sh/Kconfig.debug
847     +++ b/arch/sh/Kconfig.debug
848     @@ -58,6 +58,7 @@ config DUMP_CODE
849    
850     config DWARF_UNWINDER
851     bool "Enable the DWARF unwinder for stacktraces"
852     + depends on DEBUG_KERNEL
853     select FRAME_POINTER
854     depends on SUPERH32
855     default n
856     diff --git a/arch/sh/include/asm/sfp-machine.h b/arch/sh/include/asm/sfp-machine.h
857     index cbc7cf8c97ce6..2d2423478b71d 100644
858     --- a/arch/sh/include/asm/sfp-machine.h
859     +++ b/arch/sh/include/asm/sfp-machine.h
860     @@ -13,6 +13,14 @@
861     #ifndef _SFP_MACHINE_H
862     #define _SFP_MACHINE_H
863    
864     +#ifdef __BIG_ENDIAN__
865     +#define __BYTE_ORDER __BIG_ENDIAN
866     +#define __LITTLE_ENDIAN 0
867     +#else
868     +#define __BYTE_ORDER __LITTLE_ENDIAN
869     +#define __BIG_ENDIAN 0
870     +#endif
871     +
872     #define _FP_W_TYPE_SIZE 32
873     #define _FP_W_TYPE unsigned long
874     #define _FP_WS_TYPE signed long
875     diff --git a/arch/sh/kernel/cpu/sh4a/smp-shx3.c b/arch/sh/kernel/cpu/sh4a/smp-shx3.c
876     index f8a2bec0f260b..1261dc7b84e8b 100644
877     --- a/arch/sh/kernel/cpu/sh4a/smp-shx3.c
878     +++ b/arch/sh/kernel/cpu/sh4a/smp-shx3.c
879     @@ -73,8 +73,9 @@ static void shx3_prepare_cpus(unsigned int max_cpus)
880     BUILD_BUG_ON(SMP_MSG_NR >= 8);
881    
882     for (i = 0; i < SMP_MSG_NR; i++)
883     - request_irq(104 + i, ipi_interrupt_handler,
884     - IRQF_PERCPU, "IPI", (void *)(long)i);
885     + if (request_irq(104 + i, ipi_interrupt_handler,
886     + IRQF_PERCPU, "IPI", (void *)(long)i))
887     + pr_err("Failed to request irq %d\n", i);
888    
889     for (i = 0; i < max_cpus; i++)
890     set_cpu_present(i, true);
891     diff --git a/arch/sh/math-emu/math.c b/arch/sh/math-emu/math.c
892     index e8be0eca0444a..615ba932c398e 100644
893     --- a/arch/sh/math-emu/math.c
894     +++ b/arch/sh/math-emu/math.c
895     @@ -467,109 +467,6 @@ static int fpu_emulate(u16 code, struct sh_fpu_soft_struct *fregs, struct pt_reg
896     return id_sys(fregs, regs, code);
897     }
898    
899     -/**
900     - * denormal_to_double - Given denormalized float number,
901     - * store double float
902     - *
903     - * @fpu: Pointer to sh_fpu_soft structure
904     - * @n: Index to FP register
905     - */
906     -static void denormal_to_double(struct sh_fpu_soft_struct *fpu, int n)
907     -{
908     - unsigned long du, dl;
909     - unsigned long x = fpu->fpul;
910     - int exp = 1023 - 126;
911     -
912     - if (x != 0 && (x & 0x7f800000) == 0) {
913     - du = (x & 0x80000000);
914     - while ((x & 0x00800000) == 0) {
915     - x <<= 1;
916     - exp--;
917     - }
918     - x &= 0x007fffff;
919     - du |= (exp << 20) | (x >> 3);
920     - dl = x << 29;
921     -
922     - fpu->fp_regs[n] = du;
923     - fpu->fp_regs[n+1] = dl;
924     - }
925     -}
926     -
927     -/**
928     - * ieee_fpe_handler - Handle denormalized number exception
929     - *
930     - * @regs: Pointer to register structure
931     - *
932     - * Returns 1 when it's handled (should not cause exception).
933     - */
934     -static int ieee_fpe_handler(struct pt_regs *regs)
935     -{
936     - unsigned short insn = *(unsigned short *)regs->pc;
937     - unsigned short finsn;
938     - unsigned long nextpc;
939     - int nib[4] = {
940     - (insn >> 12) & 0xf,
941     - (insn >> 8) & 0xf,
942     - (insn >> 4) & 0xf,
943     - insn & 0xf};
944     -
945     - if (nib[0] == 0xb ||
946     - (nib[0] == 0x4 && nib[2] == 0x0 && nib[3] == 0xb)) /* bsr & jsr */
947     - regs->pr = regs->pc + 4;
948     -
949     - if (nib[0] == 0xa || nib[0] == 0xb) { /* bra & bsr */
950     - nextpc = regs->pc + 4 + ((short) ((insn & 0xfff) << 4) >> 3);
951     - finsn = *(unsigned short *) (regs->pc + 2);
952     - } else if (nib[0] == 0x8 && nib[1] == 0xd) { /* bt/s */
953     - if (regs->sr & 1)
954     - nextpc = regs->pc + 4 + ((char) (insn & 0xff) << 1);
955     - else
956     - nextpc = regs->pc + 4;
957     - finsn = *(unsigned short *) (regs->pc + 2);
958     - } else if (nib[0] == 0x8 && nib[1] == 0xf) { /* bf/s */
959     - if (regs->sr & 1)
960     - nextpc = regs->pc + 4;
961     - else
962     - nextpc = regs->pc + 4 + ((char) (insn & 0xff) << 1);
963     - finsn = *(unsigned short *) (regs->pc + 2);
964     - } else if (nib[0] == 0x4 && nib[3] == 0xb &&
965     - (nib[2] == 0x0 || nib[2] == 0x2)) { /* jmp & jsr */
966     - nextpc = regs->regs[nib[1]];
967     - finsn = *(unsigned short *) (regs->pc + 2);
968     - } else if (nib[0] == 0x0 && nib[3] == 0x3 &&
969     - (nib[2] == 0x0 || nib[2] == 0x2)) { /* braf & bsrf */
970     - nextpc = regs->pc + 4 + regs->regs[nib[1]];
971     - finsn = *(unsigned short *) (regs->pc + 2);
972     - } else if (insn == 0x000b) { /* rts */
973     - nextpc = regs->pr;
974     - finsn = *(unsigned short *) (regs->pc + 2);
975     - } else {
976     - nextpc = regs->pc + 2;
977     - finsn = insn;
978     - }
979     -
980     - if ((finsn & 0xf1ff) == 0xf0ad) { /* fcnvsd */
981     - struct task_struct *tsk = current;
982     -
983     - if ((tsk->thread.xstate->softfpu.fpscr & (1 << 17))) {
984     - /* FPU error */
985     - denormal_to_double (&tsk->thread.xstate->softfpu,
986     - (finsn >> 8) & 0xf);
987     - tsk->thread.xstate->softfpu.fpscr &=
988     - ~(FPSCR_CAUSE_MASK | FPSCR_FLAG_MASK);
989     - task_thread_info(tsk)->status |= TS_USEDFPU;
990     - } else {
991     - force_sig_fault(SIGFPE, FPE_FLTINV,
992     - (void __user *)regs->pc);
993     - }
994     -
995     - regs->pc = nextpc;
996     - return 1;
997     - }
998     -
999     - return 0;
1000     -}
1001     -
1002     /**
1003     * fpu_init - Initialize FPU registers
1004     * @fpu: Pointer to software emulated FPU registers.
1005     diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c
1006     index 9096a1693942d..0f61f46e6086f 100644
1007     --- a/arch/x86/events/intel/uncore_snbep.c
1008     +++ b/arch/x86/events/intel/uncore_snbep.c
1009     @@ -3479,6 +3479,9 @@ static int skx_cha_hw_config(struct intel_uncore_box *box, struct perf_event *ev
1010     struct hw_perf_event_extra *reg1 = &event->hw.extra_reg;
1011     struct extra_reg *er;
1012     int idx = 0;
1013     + /* Any of the CHA events may be filtered by Thread/Core-ID.*/
1014     + if (event->hw.config & SNBEP_CBO_PMON_CTL_TID_EN)
1015     + idx = SKX_CHA_MSR_PMON_BOX_FILTER_TID;
1016    
1017     for (er = skx_uncore_cha_extra_regs; er->msr; er++) {
1018     if (er->event != (event->hw.config & er->config_mask))
1019     @@ -3546,6 +3549,7 @@ static struct event_constraint skx_uncore_iio_constraints[] = {
1020     UNCORE_EVENT_CONSTRAINT(0xc0, 0xc),
1021     UNCORE_EVENT_CONSTRAINT(0xc5, 0xc),
1022     UNCORE_EVENT_CONSTRAINT(0xd4, 0xc),
1023     + UNCORE_EVENT_CONSTRAINT(0xd5, 0xc),
1024     EVENT_CONSTRAINT_END
1025     };
1026    
1027     diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c
1028     index 812db1ac8cb11..df4a4a9dc1e84 100644
1029     --- a/arch/x86/hyperv/hv_init.c
1030     +++ b/arch/x86/hyperv/hv_init.c
1031     @@ -163,6 +163,9 @@ void set_hv_tscchange_cb(void (*cb)(void))
1032     return;
1033     }
1034    
1035     + if (!hv_vp_index)
1036     + return;
1037     +
1038     hv_reenlightenment_cb = cb;
1039    
1040     /* Make sure callback is registered before we write to MSRs */
1041     diff --git a/drivers/base/firmware_loader/main.c b/drivers/base/firmware_loader/main.c
1042     index 249349f64bfe9..4f6b76bd957ef 100644
1043     --- a/drivers/base/firmware_loader/main.c
1044     +++ b/drivers/base/firmware_loader/main.c
1045     @@ -98,12 +98,15 @@ static struct firmware_cache fw_cache;
1046     extern struct builtin_fw __start_builtin_fw[];
1047     extern struct builtin_fw __end_builtin_fw[];
1048    
1049     -static void fw_copy_to_prealloc_buf(struct firmware *fw,
1050     +static bool fw_copy_to_prealloc_buf(struct firmware *fw,
1051     void *buf, size_t size)
1052     {
1053     - if (!buf || size < fw->size)
1054     - return;
1055     + if (!buf)
1056     + return true;
1057     + if (size < fw->size)
1058     + return false;
1059     memcpy(buf, fw->data, fw->size);
1060     + return true;
1061     }
1062    
1063     static bool fw_get_builtin_firmware(struct firmware *fw, const char *name,
1064     @@ -115,9 +118,7 @@ static bool fw_get_builtin_firmware(struct firmware *fw, const char *name,
1065     if (strcmp(name, b_fw->name) == 0) {
1066     fw->size = b_fw->size;
1067     fw->data = b_fw->data;
1068     - fw_copy_to_prealloc_buf(fw, buf, size);
1069     -
1070     - return true;
1071     + return fw_copy_to_prealloc_buf(fw, buf, size);
1072     }
1073     }
1074    
1075     diff --git a/drivers/clk/clk-ast2600.c b/drivers/clk/clk-ast2600.c
1076     index af957179b135e..48122f574cb65 100644
1077     --- a/drivers/clk/clk-ast2600.c
1078     +++ b/drivers/clk/clk-ast2600.c
1079     @@ -48,6 +48,8 @@ static DEFINE_SPINLOCK(aspeed_g6_clk_lock);
1080     static struct clk_hw_onecell_data *aspeed_g6_clk_data;
1081    
1082     static void __iomem *scu_g6_base;
1083     +/* AST2600 revision: A0, A1, A2, etc */
1084     +static u8 soc_rev;
1085    
1086     /*
1087     * Clocks marked with CLK_IS_CRITICAL:
1088     @@ -190,9 +192,8 @@ static struct clk_hw *ast2600_calc_pll(const char *name, u32 val)
1089     static struct clk_hw *ast2600_calc_apll(const char *name, u32 val)
1090     {
1091     unsigned int mult, div;
1092     - u32 chip_id = readl(scu_g6_base + ASPEED_G6_SILICON_REV);
1093    
1094     - if (((chip_id & CHIP_REVISION_ID) >> 16) >= 2) {
1095     + if (soc_rev >= 2) {
1096     if (val & BIT(24)) {
1097     /* Pass through mode */
1098     mult = div = 1;
1099     @@ -664,7 +665,7 @@ static const u32 ast2600_a1_axi_ahb200_tbl[] = {
1100     static void __init aspeed_g6_cc(struct regmap *map)
1101     {
1102     struct clk_hw *hw;
1103     - u32 val, div, divbits, chip_id, axi_div, ahb_div;
1104     + u32 val, div, divbits, axi_div, ahb_div;
1105    
1106     clk_hw_register_fixed_rate(NULL, "clkin", NULL, 0, 25000000);
1107    
1108     @@ -695,8 +696,7 @@ static void __init aspeed_g6_cc(struct regmap *map)
1109     axi_div = 2;
1110    
1111     divbits = (val >> 11) & 0x3;
1112     - regmap_read(map, ASPEED_G6_SILICON_REV, &chip_id);
1113     - if (chip_id & BIT(16)) {
1114     + if (soc_rev >= 1) {
1115     if (!divbits) {
1116     ahb_div = ast2600_a1_axi_ahb200_tbl[(val >> 8) & 0x3];
1117     if (val & BIT(16))
1118     @@ -741,6 +741,8 @@ static void __init aspeed_g6_cc_init(struct device_node *np)
1119     if (!scu_g6_base)
1120     return;
1121    
1122     + soc_rev = (readl(scu_g6_base + ASPEED_G6_SILICON_REV) & CHIP_REVISION_ID) >> 16;
1123     +
1124     aspeed_g6_clk_data = kzalloc(struct_size(aspeed_g6_clk_data, hws,
1125     ASPEED_G6_NUM_CLKS), GFP_KERNEL);
1126     if (!aspeed_g6_clk_data)
1127     diff --git a/drivers/clk/imx/clk-imx6ul.c b/drivers/clk/imx/clk-imx6ul.c
1128     index bc931988fe7b2..f3ac5a524f4ed 100644
1129     --- a/drivers/clk/imx/clk-imx6ul.c
1130     +++ b/drivers/clk/imx/clk-imx6ul.c
1131     @@ -161,7 +161,6 @@ static void __init imx6ul_clocks_init(struct device_node *ccm_node)
1132     hws[IMX6UL_PLL5_BYPASS] = imx_clk_hw_mux_flags("pll5_bypass", base + 0xa0, 16, 1, pll5_bypass_sels, ARRAY_SIZE(pll5_bypass_sels), CLK_SET_RATE_PARENT);
1133     hws[IMX6UL_PLL6_BYPASS] = imx_clk_hw_mux_flags("pll6_bypass", base + 0xe0, 16, 1, pll6_bypass_sels, ARRAY_SIZE(pll6_bypass_sels), CLK_SET_RATE_PARENT);
1134     hws[IMX6UL_PLL7_BYPASS] = imx_clk_hw_mux_flags("pll7_bypass", base + 0x20, 16, 1, pll7_bypass_sels, ARRAY_SIZE(pll7_bypass_sels), CLK_SET_RATE_PARENT);
1135     - hws[IMX6UL_CLK_CSI_SEL] = imx_clk_hw_mux_flags("csi_sel", base + 0x3c, 9, 2, csi_sels, ARRAY_SIZE(csi_sels), CLK_SET_RATE_PARENT);
1136    
1137     /* Do not bypass PLLs initially */
1138     clk_set_parent(hws[IMX6UL_PLL1_BYPASS]->clk, hws[IMX6UL_CLK_PLL1]->clk);
1139     @@ -270,6 +269,7 @@ static void __init imx6ul_clocks_init(struct device_node *ccm_node)
1140     hws[IMX6UL_CLK_ECSPI_SEL] = imx_clk_hw_mux("ecspi_sel", base + 0x38, 18, 1, ecspi_sels, ARRAY_SIZE(ecspi_sels));
1141     hws[IMX6UL_CLK_LCDIF_PRE_SEL] = imx_clk_hw_mux_flags("lcdif_pre_sel", base + 0x38, 15, 3, lcdif_pre_sels, ARRAY_SIZE(lcdif_pre_sels), CLK_SET_RATE_PARENT);
1142     hws[IMX6UL_CLK_LCDIF_SEL] = imx_clk_hw_mux("lcdif_sel", base + 0x38, 9, 3, lcdif_sels, ARRAY_SIZE(lcdif_sels));
1143     + hws[IMX6UL_CLK_CSI_SEL] = imx_clk_hw_mux("csi_sel", base + 0x3c, 9, 2, csi_sels, ARRAY_SIZE(csi_sels));
1144    
1145     hws[IMX6UL_CLK_LDB_DI0_DIV_SEL] = imx_clk_hw_mux("ldb_di0", base + 0x20, 10, 1, ldb_di0_div_sels, ARRAY_SIZE(ldb_di0_div_sels));
1146     hws[IMX6UL_CLK_LDB_DI1_DIV_SEL] = imx_clk_hw_mux("ldb_di1", base + 0x20, 11, 1, ldb_di1_div_sels, ARRAY_SIZE(ldb_di1_div_sels));
1147     diff --git a/drivers/clk/ingenic/cgu.c b/drivers/clk/ingenic/cgu.c
1148     index 7490d4f4d9366..dff759c0f6193 100644
1149     --- a/drivers/clk/ingenic/cgu.c
1150     +++ b/drivers/clk/ingenic/cgu.c
1151     @@ -426,15 +426,15 @@ ingenic_clk_calc_div(const struct ingenic_cgu_clk_info *clk_info,
1152     }
1153    
1154     /* Impose hardware constraints */
1155     - div = min_t(unsigned, div, 1 << clk_info->div.bits);
1156     - div = max_t(unsigned, div, 1);
1157     + div = clamp_t(unsigned int, div, clk_info->div.div,
1158     + clk_info->div.div << clk_info->div.bits);
1159    
1160     /*
1161     * If the divider value itself must be divided before being written to
1162     * the divider register, we must ensure we don't have any bits set that
1163     * would be lost as a result of doing so.
1164     */
1165     - div /= clk_info->div.div;
1166     + div = DIV_ROUND_UP(div, clk_info->div.div);
1167     div *= clk_info->div.div;
1168    
1169     return div;
1170     diff --git a/drivers/clk/qcom/gcc-msm8996.c b/drivers/clk/qcom/gcc-msm8996.c
1171     index d004cdaa0e39a..c1e1148f0261d 100644
1172     --- a/drivers/clk/qcom/gcc-msm8996.c
1173     +++ b/drivers/clk/qcom/gcc-msm8996.c
1174     @@ -2937,20 +2937,6 @@ static struct clk_branch gcc_smmu_aggre0_ahb_clk = {
1175     },
1176     };
1177    
1178     -static struct clk_branch gcc_aggre1_pnoc_ahb_clk = {
1179     - .halt_reg = 0x82014,
1180     - .clkr = {
1181     - .enable_reg = 0x82014,
1182     - .enable_mask = BIT(0),
1183     - .hw.init = &(struct clk_init_data){
1184     - .name = "gcc_aggre1_pnoc_ahb_clk",
1185     - .parent_names = (const char *[]){ "periph_noc_clk_src" },
1186     - .num_parents = 1,
1187     - .ops = &clk_branch2_ops,
1188     - },
1189     - },
1190     -};
1191     -
1192     static struct clk_branch gcc_aggre2_ufs_axi_clk = {
1193     .halt_reg = 0x83014,
1194     .clkr = {
1195     @@ -3453,7 +3439,6 @@ static struct clk_regmap *gcc_msm8996_clocks[] = {
1196     [GCC_AGGRE0_CNOC_AHB_CLK] = &gcc_aggre0_cnoc_ahb_clk.clkr,
1197     [GCC_SMMU_AGGRE0_AXI_CLK] = &gcc_smmu_aggre0_axi_clk.clkr,
1198     [GCC_SMMU_AGGRE0_AHB_CLK] = &gcc_smmu_aggre0_ahb_clk.clkr,
1199     - [GCC_AGGRE1_PNOC_AHB_CLK] = &gcc_aggre1_pnoc_ahb_clk.clkr,
1200     [GCC_AGGRE2_UFS_AXI_CLK] = &gcc_aggre2_ufs_axi_clk.clkr,
1201     [GCC_AGGRE2_USB3_AXI_CLK] = &gcc_aggre2_usb3_axi_clk.clkr,
1202     [GCC_QSPI_AHB_CLK] = &gcc_qspi_ahb_clk.clkr,
1203     diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
1204     index cda0a76a733d3..0d39e386f6e9c 100644
1205     --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
1206     +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
1207     @@ -829,6 +829,7 @@ static int amdgpu_connector_vga_get_modes(struct drm_connector *connector)
1208    
1209     amdgpu_connector_get_edid(connector);
1210     ret = amdgpu_connector_ddc_get_modes(connector);
1211     + amdgpu_get_native_mode(connector);
1212    
1213     return ret;
1214     }
1215     diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
1216     index abc8c42b8b0c1..85583f9146305 100644
1217     --- a/drivers/gpu/drm/i915/display/intel_dp.c
1218     +++ b/drivers/gpu/drm/i915/display/intel_dp.c
1219     @@ -166,6 +166,12 @@ static void vlv_steal_power_sequencer(struct drm_i915_private *dev_priv,
1220     enum pipe pipe);
1221     static void intel_dp_unset_edid(struct intel_dp *intel_dp);
1222    
1223     +static void intel_dp_set_default_sink_rates(struct intel_dp *intel_dp)
1224     +{
1225     + intel_dp->sink_rates[0] = 162000;
1226     + intel_dp->num_sink_rates = 1;
1227     +}
1228     +
1229     /* update sink rates from dpcd */
1230     static void intel_dp_set_sink_rates(struct intel_dp *intel_dp)
1231     {
1232     @@ -4261,6 +4267,9 @@ intel_edp_init_dpcd(struct intel_dp *intel_dp)
1233     */
1234     intel_psr_init_dpcd(intel_dp);
1235    
1236     + /* Clear the default sink rates */
1237     + intel_dp->num_sink_rates = 0;
1238     +
1239     /* Read the eDP 1.4+ supported link rates. */
1240     if (intel_dp->edp_dpcd[0] >= DP_EDP_14) {
1241     __le16 sink_rates[DP_MAX_SUPPORTED_RATES];
1242     @@ -7167,6 +7176,8 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
1243     return false;
1244    
1245     intel_dp_set_source_rates(intel_dp);
1246     + intel_dp_set_default_sink_rates(intel_dp);
1247     + intel_dp_set_common_rates(intel_dp);
1248    
1249     intel_dp->reset_link_params = true;
1250     intel_dp->pps_pipe = INVALID_PIPE;
1251     diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
1252     index 5347e5bdee8cc..e18938972a895 100644
1253     --- a/drivers/gpu/drm/nouveau/nouveau_drm.c
1254     +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
1255     @@ -779,7 +779,7 @@ nouveau_drm_device_remove(struct drm_device *dev)
1256     struct nvkm_client *client;
1257     struct nvkm_device *device;
1258    
1259     - drm_dev_unregister(dev);
1260     + drm_dev_unplug(dev);
1261    
1262     dev->irq_enabled = false;
1263     client = nvxx_client(&drm->client.base);
1264     diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigv100.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigv100.c
1265     index 6e3c450eaacef..3ff49344abc77 100644
1266     --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigv100.c
1267     +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigv100.c
1268     @@ -62,7 +62,6 @@ gv100_hdmi_ctrl(struct nvkm_ior *ior, int head, bool enable, u8 max_ac_packet,
1269     nvkm_wr32(device, 0x6f0108 + hdmi, vendor_infoframe.header);
1270     nvkm_wr32(device, 0x6f010c + hdmi, vendor_infoframe.subpack0_low);
1271     nvkm_wr32(device, 0x6f0110 + hdmi, vendor_infoframe.subpack0_high);
1272     - nvkm_wr32(device, 0x6f0110 + hdmi, 0x00000000);
1273     nvkm_wr32(device, 0x6f0114 + hdmi, 0x00000000);
1274     nvkm_wr32(device, 0x6f0118 + hdmi, 0x00000000);
1275     nvkm_wr32(device, 0x6f011c + hdmi, 0x00000000);
1276     diff --git a/drivers/gpu/drm/udl/udl_connector.c b/drivers/gpu/drm/udl/udl_connector.c
1277     index ddb61a60c6104..ef69773b5bed5 100644
1278     --- a/drivers/gpu/drm/udl/udl_connector.c
1279     +++ b/drivers/gpu/drm/udl/udl_connector.c
1280     @@ -29,7 +29,7 @@ static int udl_get_edid_block(void *data, u8 *buf, unsigned int block,
1281     ret = usb_control_msg(udl->udev,
1282     usb_rcvctrlpipe(udl->udev, 0),
1283     (0x02), (0x80 | (0x02 << 5)), bval,
1284     - 0xA1, read_buff, 2, HZ);
1285     + 0xA1, read_buff, 2, 1000);
1286     if (ret < 1) {
1287     DRM_ERROR("Read EDID byte %d failed err %x\n", i, ret);
1288     kfree(read_buff);
1289     diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
1290     index 057a4b0100106..8850da8e25d69 100644
1291     --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
1292     +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
1293     @@ -1015,6 +1015,8 @@ static int st_lsm6dsx_set_odr(struct st_lsm6dsx_sensor *sensor, u16 req_odr)
1294     int err;
1295    
1296     switch (sensor->id) {
1297     + case ST_LSM6DSX_ID_GYRO:
1298     + break;
1299     case ST_LSM6DSX_ID_EXT0:
1300     case ST_LSM6DSX_ID_EXT1:
1301     case ST_LSM6DSX_ID_EXT2:
1302     @@ -1040,8 +1042,8 @@ static int st_lsm6dsx_set_odr(struct st_lsm6dsx_sensor *sensor, u16 req_odr)
1303     }
1304     break;
1305     }
1306     - default:
1307     - break;
1308     + default: /* should never occur */
1309     + return -EINVAL;
1310     }
1311    
1312     if (req_odr > 0) {
1313     diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
1314     index a96f9142fe08e..dd006b177b544 100644
1315     --- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
1316     +++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
1317     @@ -3081,8 +3081,11 @@ static void bnxt_re_process_res_ud_wc(struct bnxt_re_qp *qp,
1318     struct ib_wc *wc,
1319     struct bnxt_qplib_cqe *cqe)
1320     {
1321     + struct bnxt_re_dev *rdev;
1322     + u16 vlan_id = 0;
1323     u8 nw_type;
1324    
1325     + rdev = qp->rdev;
1326     wc->opcode = IB_WC_RECV;
1327     wc->status = __rc_to_ib_wc_status(cqe->status);
1328    
1329     @@ -3094,9 +3097,12 @@ static void bnxt_re_process_res_ud_wc(struct bnxt_re_qp *qp,
1330     memcpy(wc->smac, cqe->smac, ETH_ALEN);
1331     wc->wc_flags |= IB_WC_WITH_SMAC;
1332     if (cqe->flags & CQ_RES_UD_FLAGS_META_FORMAT_VLAN) {
1333     - wc->vlan_id = (cqe->cfa_meta & 0xFFF);
1334     - if (wc->vlan_id < 0x1000)
1335     - wc->wc_flags |= IB_WC_WITH_VLAN;
1336     + vlan_id = (cqe->cfa_meta & 0xFFF);
1337     + }
1338     + /* Mark only if vlan_id is non zero */
1339     + if (vlan_id && bnxt_re_check_if_vlan_valid(rdev, vlan_id)) {
1340     + wc->vlan_id = vlan_id;
1341     + wc->wc_flags |= IB_WC_WITH_VLAN;
1342     }
1343     nw_type = (cqe->flags & CQ_RES_UD_FLAGS_ROCE_IP_VER_MASK) >>
1344     CQ_RES_UD_FLAGS_ROCE_IP_VER_SFT;
1345     diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_init_ops.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_init_ops.h
1346     index 1835d2e451c01..fc7fce642666c 100644
1347     --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_init_ops.h
1348     +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_init_ops.h
1349     @@ -635,11 +635,13 @@ static int bnx2x_ilt_client_mem_op(struct bnx2x *bp, int cli_num,
1350     {
1351     int i, rc;
1352     struct bnx2x_ilt *ilt = BP_ILT(bp);
1353     - struct ilt_client_info *ilt_cli = &ilt->clients[cli_num];
1354     + struct ilt_client_info *ilt_cli;
1355    
1356     if (!ilt || !ilt->lines)
1357     return -1;
1358    
1359     + ilt_cli = &ilt->clients[cli_num];
1360     +
1361     if (ilt_cli->flags & (ILT_CLIENT_SKIP_INIT | ILT_CLIENT_SKIP_MEM))
1362     return 0;
1363    
1364     diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
1365     index 7af7cc7c8669a..34540e604f748 100644
1366     --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
1367     +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
1368     @@ -3616,10 +3616,10 @@ static int dpaa2_eth_remove(struct fsl_mc_device *ls_dev)
1369    
1370     fsl_mc_portal_free(priv->mc_io);
1371    
1372     - free_netdev(net_dev);
1373     -
1374     dev_dbg(net_dev->dev.parent, "Removed interface %s\n", net_dev->name);
1375    
1376     + free_netdev(net_dev);
1377     +
1378     return 0;
1379     }
1380    
1381     diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h
1382     index e571c6116c4b7..f8422dbfd54e6 100644
1383     --- a/drivers/net/ethernet/intel/i40e/i40e.h
1384     +++ b/drivers/net/ethernet/intel/i40e/i40e.h
1385     @@ -169,6 +169,7 @@ enum i40e_vsi_state_t {
1386     __I40E_VSI_OVERFLOW_PROMISC,
1387     __I40E_VSI_REINIT_REQUESTED,
1388     __I40E_VSI_DOWN_REQUESTED,
1389     + __I40E_VSI_RELEASING,
1390     /* This must be last as it determines the size of the BITMAP */
1391     __I40E_VSI_STATE_SIZE__,
1392     };
1393     @@ -1146,6 +1147,7 @@ void i40e_ptp_save_hw_time(struct i40e_pf *pf);
1394     void i40e_ptp_restore_hw_time(struct i40e_pf *pf);
1395     void i40e_ptp_init(struct i40e_pf *pf);
1396     void i40e_ptp_stop(struct i40e_pf *pf);
1397     +int i40e_update_adq_vsi_queues(struct i40e_vsi *vsi, int vsi_offset);
1398     int i40e_is_vsi_uplink_mode_veb(struct i40e_vsi *vsi);
1399     i40e_status i40e_get_partition_bw_setting(struct i40e_pf *pf);
1400     i40e_status i40e_set_partition_bw_setting(struct i40e_pf *pf);
1401     diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
1402     index 917be10a5cf5c..ce237da003ddb 100644
1403     --- a/drivers/net/ethernet/intel/i40e/i40e_main.c
1404     +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
1405     @@ -1776,6 +1776,7 @@ static void i40e_vsi_setup_queue_map(struct i40e_vsi *vsi,
1406     bool is_add)
1407     {
1408     struct i40e_pf *pf = vsi->back;
1409     + u16 num_tc_qps = 0;
1410     u16 sections = 0;
1411     u8 netdev_tc = 0;
1412     u16 numtc = 1;
1413     @@ -1783,13 +1784,33 @@ static void i40e_vsi_setup_queue_map(struct i40e_vsi *vsi,
1414     u8 offset;
1415     u16 qmap;
1416     int i;
1417     - u16 num_tc_qps = 0;
1418    
1419     sections = I40E_AQ_VSI_PROP_QUEUE_MAP_VALID;
1420     offset = 0;
1421     + /* zero out queue mapping, it will get updated on the end of the function */
1422     + memset(ctxt->info.queue_mapping, 0, sizeof(ctxt->info.queue_mapping));
1423     +
1424     + if (vsi->type == I40E_VSI_MAIN) {
1425     + /* This code helps add more queue to the VSI if we have
1426     + * more cores than RSS can support, the higher cores will
1427     + * be served by ATR or other filters. Furthermore, the
1428     + * non-zero req_queue_pairs says that user requested a new
1429     + * queue count via ethtool's set_channels, so use this
1430     + * value for queues distribution across traffic classes
1431     + */
1432     + if (vsi->req_queue_pairs > 0)
1433     + vsi->num_queue_pairs = vsi->req_queue_pairs;
1434     + else if (pf->flags & I40E_FLAG_MSIX_ENABLED)
1435     + vsi->num_queue_pairs = pf->num_lan_msix;
1436     + }
1437    
1438     /* Number of queues per enabled TC */
1439     - num_tc_qps = vsi->alloc_queue_pairs;
1440     + if (vsi->type == I40E_VSI_MAIN ||
1441     + (vsi->type == I40E_VSI_SRIOV && vsi->num_queue_pairs != 0))
1442     + num_tc_qps = vsi->num_queue_pairs;
1443     + else
1444     + num_tc_qps = vsi->alloc_queue_pairs;
1445     +
1446     if (enabled_tc && (vsi->back->flags & I40E_FLAG_DCB_ENABLED)) {
1447     /* Find numtc from enabled TC bitmap */
1448     for (i = 0, numtc = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) {
1449     @@ -1867,15 +1888,11 @@ static void i40e_vsi_setup_queue_map(struct i40e_vsi *vsi,
1450     }
1451     ctxt->info.tc_mapping[i] = cpu_to_le16(qmap);
1452     }
1453     -
1454     - /* Set actual Tx/Rx queue pairs */
1455     - vsi->num_queue_pairs = offset;
1456     - if ((vsi->type == I40E_VSI_MAIN) && (numtc == 1)) {
1457     - if (vsi->req_queue_pairs > 0)
1458     - vsi->num_queue_pairs = vsi->req_queue_pairs;
1459     - else if (pf->flags & I40E_FLAG_MSIX_ENABLED)
1460     - vsi->num_queue_pairs = pf->num_lan_msix;
1461     - }
1462     + /* Do not change previously set num_queue_pairs for PFs and VFs*/
1463     + if ((vsi->type == I40E_VSI_MAIN && numtc != 1) ||
1464     + (vsi->type == I40E_VSI_SRIOV && vsi->num_queue_pairs == 0) ||
1465     + (vsi->type != I40E_VSI_MAIN && vsi->type != I40E_VSI_SRIOV))
1466     + vsi->num_queue_pairs = offset;
1467    
1468     /* Scheduler section valid can only be set for ADD VSI */
1469     if (is_add) {
1470     @@ -2609,7 +2626,8 @@ static void i40e_sync_filters_subtask(struct i40e_pf *pf)
1471    
1472     for (v = 0; v < pf->num_alloc_vsi; v++) {
1473     if (pf->vsi[v] &&
1474     - (pf->vsi[v]->flags & I40E_VSI_FLAG_FILTER_CHANGED)) {
1475     + (pf->vsi[v]->flags & I40E_VSI_FLAG_FILTER_CHANGED) &&
1476     + !test_bit(__I40E_VSI_RELEASING, pf->vsi[v]->state)) {
1477     int ret = i40e_sync_vsi_filters(pf->vsi[v]);
1478    
1479     if (ret) {
1480     @@ -5371,6 +5389,58 @@ static void i40e_vsi_update_queue_map(struct i40e_vsi *vsi,
1481     sizeof(vsi->info.tc_mapping));
1482     }
1483    
1484     +/**
1485     + * i40e_update_adq_vsi_queues - update queue mapping for ADq VSI
1486     + * @vsi: the VSI being reconfigured
1487     + * @vsi_offset: offset from main VF VSI
1488     + */
1489     +int i40e_update_adq_vsi_queues(struct i40e_vsi *vsi, int vsi_offset)
1490     +{
1491     + struct i40e_vsi_context ctxt = {};
1492     + struct i40e_pf *pf;
1493     + struct i40e_hw *hw;
1494     + int ret;
1495     +
1496     + if (!vsi)
1497     + return I40E_ERR_PARAM;
1498     + pf = vsi->back;
1499     + hw = &pf->hw;
1500     +
1501     + ctxt.seid = vsi->seid;
1502     + ctxt.pf_num = hw->pf_id;
1503     + ctxt.vf_num = vsi->vf_id + hw->func_caps.vf_base_id + vsi_offset;
1504     + ctxt.uplink_seid = vsi->uplink_seid;
1505     + ctxt.connection_type = I40E_AQ_VSI_CONN_TYPE_NORMAL;
1506     + ctxt.flags = I40E_AQ_VSI_TYPE_VF;
1507     + ctxt.info = vsi->info;
1508     +
1509     + i40e_vsi_setup_queue_map(vsi, &ctxt, vsi->tc_config.enabled_tc,
1510     + false);
1511     + if (vsi->reconfig_rss) {
1512     + vsi->rss_size = min_t(int, pf->alloc_rss_size,
1513     + vsi->num_queue_pairs);
1514     + ret = i40e_vsi_config_rss(vsi);
1515     + if (ret) {
1516     + dev_info(&pf->pdev->dev, "Failed to reconfig rss for num_queues\n");
1517     + return ret;
1518     + }
1519     + vsi->reconfig_rss = false;
1520     + }
1521     +
1522     + ret = i40e_aq_update_vsi_params(hw, &ctxt, NULL);
1523     + if (ret) {
1524     + dev_info(&pf->pdev->dev, "Update vsi config failed, err %s aq_err %s\n",
1525     + i40e_stat_str(hw, ret),
1526     + i40e_aq_str(hw, hw->aq.asq_last_status));
1527     + return ret;
1528     + }
1529     + /* update the local VSI info with updated queue map */
1530     + i40e_vsi_update_queue_map(vsi, &ctxt);
1531     + vsi->info.valid_sections = 0;
1532     +
1533     + return ret;
1534     +}
1535     +
1536     /**
1537     * i40e_vsi_config_tc - Configure VSI Tx Scheduler for given TC map
1538     * @vsi: VSI to be configured
1539     @@ -5661,24 +5731,6 @@ static void i40e_remove_queue_channels(struct i40e_vsi *vsi)
1540     INIT_LIST_HEAD(&vsi->ch_list);
1541     }
1542    
1543     -/**
1544     - * i40e_is_any_channel - channel exist or not
1545     - * @vsi: ptr to VSI to which channels are associated with
1546     - *
1547     - * Returns true or false if channel(s) exist for associated VSI or not
1548     - **/
1549     -static bool i40e_is_any_channel(struct i40e_vsi *vsi)
1550     -{
1551     - struct i40e_channel *ch, *ch_tmp;
1552     -
1553     - list_for_each_entry_safe(ch, ch_tmp, &vsi->ch_list, list) {
1554     - if (ch->initialized)
1555     - return true;
1556     - }
1557     -
1558     - return false;
1559     -}
1560     -
1561     /**
1562     * i40e_get_max_queues_for_channel
1563     * @vsi: ptr to VSI to which channels are associated with
1564     @@ -6186,26 +6238,15 @@ int i40e_create_queue_channel(struct i40e_vsi *vsi,
1565     /* By default we are in VEPA mode, if this is the first VF/VMDq
1566     * VSI to be added switch to VEB mode.
1567     */
1568     - if ((!(pf->flags & I40E_FLAG_VEB_MODE_ENABLED)) ||
1569     - (!i40e_is_any_channel(vsi))) {
1570     - if (!is_power_of_2(vsi->tc_config.tc_info[0].qcount)) {
1571     - dev_dbg(&pf->pdev->dev,
1572     - "Failed to create channel. Override queues (%u) not power of 2\n",
1573     - vsi->tc_config.tc_info[0].qcount);
1574     - return -EINVAL;
1575     - }
1576    
1577     - if (!(pf->flags & I40E_FLAG_VEB_MODE_ENABLED)) {
1578     - pf->flags |= I40E_FLAG_VEB_MODE_ENABLED;
1579     + if (!(pf->flags & I40E_FLAG_VEB_MODE_ENABLED)) {
1580     + pf->flags |= I40E_FLAG_VEB_MODE_ENABLED;
1581    
1582     - if (vsi->type == I40E_VSI_MAIN) {
1583     - if (pf->flags & I40E_FLAG_TC_MQPRIO)
1584     - i40e_do_reset(pf, I40E_PF_RESET_FLAG,
1585     - true);
1586     - else
1587     - i40e_do_reset_safe(pf,
1588     - I40E_PF_RESET_FLAG);
1589     - }
1590     + if (vsi->type == I40E_VSI_MAIN) {
1591     + if (pf->flags & I40E_FLAG_TC_MQPRIO)
1592     + i40e_do_reset(pf, I40E_PF_RESET_FLAG, true);
1593     + else
1594     + i40e_do_reset_safe(pf, I40E_PF_RESET_FLAG);
1595     }
1596     /* now onwards for main VSI, number of queues will be value
1597     * of TC0's queue count
1598     @@ -7497,12 +7538,20 @@ config_tc:
1599     vsi->seid);
1600     need_reset = true;
1601     goto exit;
1602     - } else {
1603     - dev_info(&vsi->back->pdev->dev,
1604     - "Setup channel (id:%u) utilizing num_queues %d\n",
1605     - vsi->seid, vsi->tc_config.tc_info[0].qcount);
1606     + } else if (enabled_tc &&
1607     + (!is_power_of_2(vsi->tc_config.tc_info[0].qcount))) {
1608     + netdev_info(netdev,
1609     + "Failed to create channel. Override queues (%u) not power of 2\n",
1610     + vsi->tc_config.tc_info[0].qcount);
1611     + ret = -EINVAL;
1612     + need_reset = true;
1613     + goto exit;
1614     }
1615    
1616     + dev_info(&vsi->back->pdev->dev,
1617     + "Setup channel (id:%u) utilizing num_queues %d\n",
1618     + vsi->seid, vsi->tc_config.tc_info[0].qcount);
1619     +
1620     if (pf->flags & I40E_FLAG_TC_MQPRIO) {
1621     if (vsi->mqprio_qopt.max_rate[0]) {
1622     u64 max_tx_rate = vsi->mqprio_qopt.max_rate[0];
1623     @@ -8067,9 +8116,8 @@ static int i40e_configure_clsflower(struct i40e_vsi *vsi,
1624     err = i40e_add_del_cloud_filter(vsi, filter, true);
1625    
1626     if (err) {
1627     - dev_err(&pf->pdev->dev,
1628     - "Failed to add cloud filter, err %s\n",
1629     - i40e_stat_str(&pf->hw, err));
1630     + dev_err(&pf->pdev->dev, "Failed to add cloud filter, err %d\n",
1631     + err);
1632     goto err;
1633     }
1634    
1635     @@ -13388,7 +13436,7 @@ int i40e_vsi_release(struct i40e_vsi *vsi)
1636     dev_info(&pf->pdev->dev, "Can't remove PF VSI\n");
1637     return -ENODEV;
1638     }
1639     -
1640     + set_bit(__I40E_VSI_RELEASING, vsi->state);
1641     uplink_seid = vsi->uplink_seid;
1642     if (vsi->type != I40E_VSI_SRIOV) {
1643     if (vsi->netdev_registered) {
1644     diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
1645     index e561073054865..6e61aea42a0dd 100644
1646     --- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
1647     +++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
1648     @@ -621,14 +621,13 @@ static int i40e_config_vsi_rx_queue(struct i40e_vf *vf, u16 vsi_id,
1649     u16 vsi_queue_id,
1650     struct virtchnl_rxq_info *info)
1651     {
1652     + u16 pf_queue_id = i40e_vc_get_pf_queue_id(vf, vsi_id, vsi_queue_id);
1653     struct i40e_pf *pf = vf->pf;
1654     + struct i40e_vsi *vsi = pf->vsi[vf->lan_vsi_idx];
1655     struct i40e_hw *hw = &pf->hw;
1656     struct i40e_hmc_obj_rxq rx_ctx;
1657     - u16 pf_queue_id;
1658     int ret = 0;
1659    
1660     - pf_queue_id = i40e_vc_get_pf_queue_id(vf, vsi_id, vsi_queue_id);
1661     -
1662     /* clear the context structure first */
1663     memset(&rx_ctx, 0, sizeof(struct i40e_hmc_obj_rxq));
1664    
1665     @@ -666,6 +665,10 @@ static int i40e_config_vsi_rx_queue(struct i40e_vf *vf, u16 vsi_id,
1666     }
1667     rx_ctx.rxmax = info->max_pkt_size;
1668    
1669     + /* if port VLAN is configured increase the max packet size */
1670     + if (vsi->info.pvid)
1671     + rx_ctx.rxmax += VLAN_HLEN;
1672     +
1673     /* enable 32bytes desc always */
1674     rx_ctx.dsize = 1;
1675    
1676     @@ -2097,11 +2100,12 @@ static int i40e_vc_config_queues_msg(struct i40e_vf *vf, u8 *msg)
1677     struct virtchnl_vsi_queue_config_info *qci =
1678     (struct virtchnl_vsi_queue_config_info *)msg;
1679     struct virtchnl_queue_pair_info *qpi;
1680     - struct i40e_pf *pf = vf->pf;
1681     u16 vsi_id, vsi_queue_id = 0;
1682     - u16 num_qps_all = 0;
1683     + struct i40e_pf *pf = vf->pf;
1684     i40e_status aq_ret = 0;
1685     int i, j = 0, idx = 0;
1686     + struct i40e_vsi *vsi;
1687     + u16 num_qps_all = 0;
1688    
1689     if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states)) {
1690     aq_ret = I40E_ERR_PARAM;
1691     @@ -2190,9 +2194,15 @@ static int i40e_vc_config_queues_msg(struct i40e_vf *vf, u8 *msg)
1692     pf->vsi[vf->lan_vsi_idx]->num_queue_pairs =
1693     qci->num_queue_pairs;
1694     } else {
1695     - for (i = 0; i < vf->num_tc; i++)
1696     - pf->vsi[vf->ch[i].vsi_idx]->num_queue_pairs =
1697     - vf->ch[i].num_qps;
1698     + for (i = 0; i < vf->num_tc; i++) {
1699     + vsi = pf->vsi[vf->ch[i].vsi_idx];
1700     + vsi->num_queue_pairs = vf->ch[i].num_qps;
1701     +
1702     + if (i40e_update_adq_vsi_queues(vsi, i)) {
1703     + aq_ret = I40E_ERR_CONFIG;
1704     + goto error_param;
1705     + }
1706     + }
1707     }
1708    
1709     error_param:
1710     @@ -4050,34 +4060,6 @@ error_param:
1711     return ret;
1712     }
1713    
1714     -/**
1715     - * i40e_vsi_has_vlans - True if VSI has configured VLANs
1716     - * @vsi: pointer to the vsi
1717     - *
1718     - * Check if a VSI has configured any VLANs. False if we have a port VLAN or if
1719     - * we have no configured VLANs. Do not call while holding the
1720     - * mac_filter_hash_lock.
1721     - */
1722     -static bool i40e_vsi_has_vlans(struct i40e_vsi *vsi)
1723     -{
1724     - bool have_vlans;
1725     -
1726     - /* If we have a port VLAN, then the VSI cannot have any VLANs
1727     - * configured, as all MAC/VLAN filters will be assigned to the PVID.
1728     - */
1729     - if (vsi->info.pvid)
1730     - return false;
1731     -
1732     - /* Since we don't have a PVID, we know that if the device is in VLAN
1733     - * mode it must be because of a VLAN filter configured on this VSI.
1734     - */
1735     - spin_lock_bh(&vsi->mac_filter_hash_lock);
1736     - have_vlans = i40e_is_vsi_in_vlan(vsi);
1737     - spin_unlock_bh(&vsi->mac_filter_hash_lock);
1738     -
1739     - return have_vlans;
1740     -}
1741     -
1742     /**
1743     * i40e_ndo_set_vf_port_vlan
1744     * @netdev: network interface device structure
1745     @@ -4134,19 +4116,9 @@ int i40e_ndo_set_vf_port_vlan(struct net_device *netdev, int vf_id,
1746     /* duplicate request, so just return success */
1747     goto error_pvid;
1748    
1749     - if (i40e_vsi_has_vlans(vsi)) {
1750     - dev_err(&pf->pdev->dev,
1751     - "VF %d has already configured VLAN filters and the administrator is requesting a port VLAN override.\nPlease unload and reload the VF driver for this change to take effect.\n",
1752     - vf_id);
1753     - /* Administrator Error - knock the VF offline until he does
1754     - * the right thing by reconfiguring his network correctly
1755     - * and then reloading the VF driver.
1756     - */
1757     - i40e_vc_disable_vf(vf);
1758     - /* During reset the VF got a new VSI, so refresh the pointer. */
1759     - vsi = pf->vsi[vf->lan_vsi_idx];
1760     - }
1761     -
1762     + i40e_vc_disable_vf(vf);
1763     + /* During reset the VF got a new VSI, so refresh a pointer. */
1764     + vsi = pf->vsi[vf->lan_vsi_idx];
1765     /* Locked once because multiple functions below iterate list */
1766     spin_lock_bh(&vsi->mac_filter_hash_lock);
1767    
1768     diff --git a/drivers/net/ethernet/intel/iavf/iavf_ethtool.c b/drivers/net/ethernet/intel/iavf/iavf_ethtool.c
1769     index 758bef02a2a86..ad1e796e5544a 100644
1770     --- a/drivers/net/ethernet/intel/iavf/iavf_ethtool.c
1771     +++ b/drivers/net/ethernet/intel/iavf/iavf_ethtool.c
1772     @@ -962,14 +962,13 @@ static int iavf_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key,
1773    
1774     if (hfunc)
1775     *hfunc = ETH_RSS_HASH_TOP;
1776     - if (!indir)
1777     - return 0;
1778     -
1779     - memcpy(key, adapter->rss_key, adapter->rss_key_size);
1780     + if (key)
1781     + memcpy(key, adapter->rss_key, adapter->rss_key_size);
1782    
1783     - /* Each 32 bits pointed by 'indir' is stored with a lut entry */
1784     - for (i = 0; i < adapter->rss_lut_size; i++)
1785     - indir[i] = (u32)adapter->rss_lut[i];
1786     + if (indir)
1787     + /* Each 32 bits pointed by 'indir' is stored with a lut entry */
1788     + for (i = 0; i < adapter->rss_lut_size; i++)
1789     + indir[i] = (u32)adapter->rss_lut[i];
1790    
1791     return 0;
1792     }
1793     diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c
1794     index bc46c262b42d8..484c2a6f1625d 100644
1795     --- a/drivers/net/ethernet/intel/iavf/iavf_main.c
1796     +++ b/drivers/net/ethernet/intel/iavf/iavf_main.c
1797     @@ -1626,8 +1626,7 @@ static int iavf_process_aq_command(struct iavf_adapter *adapter)
1798     iavf_set_promiscuous(adapter, FLAG_VF_MULTICAST_PROMISC);
1799     return 0;
1800     }
1801     -
1802     - if ((adapter->aq_required & IAVF_FLAG_AQ_RELEASE_PROMISC) &&
1803     + if ((adapter->aq_required & IAVF_FLAG_AQ_RELEASE_PROMISC) ||
1804     (adapter->aq_required & IAVF_FLAG_AQ_RELEASE_ALLMULTI)) {
1805     iavf_set_promiscuous(adapter, 0);
1806     return 0;
1807     @@ -2057,8 +2056,8 @@ static void iavf_disable_vf(struct iavf_adapter *adapter)
1808    
1809     iavf_free_misc_irq(adapter);
1810     iavf_reset_interrupt_capability(adapter);
1811     - iavf_free_queues(adapter);
1812     iavf_free_q_vectors(adapter);
1813     + iavf_free_queues(adapter);
1814     memset(adapter->vf_res, 0, IAVF_VIRTCHNL_VF_RESOURCE_SIZE);
1815     iavf_shutdown_adminq(&adapter->hw);
1816     adapter->netdev->flags &= ~IFF_UP;
1817     @@ -2342,7 +2341,7 @@ static void iavf_adminq_task(struct work_struct *work)
1818    
1819     /* check for error indications */
1820     val = rd32(hw, hw->aq.arq.len);
1821     - if (val == 0xdeadbeef) /* indicates device in reset */
1822     + if (val == 0xdeadbeef || val == 0xffffffff) /* device in reset */
1823     goto freedom;
1824     oldval = val;
1825     if (val & IAVF_VF_ARQLEN1_ARQVFE_MASK) {
1826     @@ -3034,11 +3033,11 @@ static int iavf_configure_clsflower(struct iavf_adapter *adapter,
1827     /* start out with flow type and eth type IPv4 to begin with */
1828     filter->f.flow_type = VIRTCHNL_TCP_V4_FLOW;
1829     err = iavf_parse_cls_flower(adapter, cls_flower, filter);
1830     - if (err < 0)
1831     + if (err)
1832     goto err;
1833    
1834     err = iavf_handle_tclass(adapter, tc, filter);
1835     - if (err < 0)
1836     + if (err)
1837     goto err;
1838    
1839     /* add filter to the list */
1840     @@ -3425,7 +3424,8 @@ static netdev_features_t iavf_fix_features(struct net_device *netdev,
1841     {
1842     struct iavf_adapter *adapter = netdev_priv(netdev);
1843    
1844     - if (!(adapter->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN))
1845     + if (adapter->vf_res &&
1846     + !(adapter->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN))
1847     features &= ~(NETIF_F_HW_VLAN_CTAG_TX |
1848     NETIF_F_HW_VLAN_CTAG_RX |
1849     NETIF_F_HW_VLAN_CTAG_FILTER);
1850     diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
1851     index d0ccb7ad447b1..6370e96ebfacc 100644
1852     --- a/drivers/net/ethernet/intel/ice/ice_main.c
1853     +++ b/drivers/net/ethernet/intel/ice/ice_main.c
1854     @@ -3005,9 +3005,6 @@ static void ice_remove(struct pci_dev *pdev)
1855     struct ice_pf *pf = pci_get_drvdata(pdev);
1856     int i;
1857    
1858     - if (!pf)
1859     - return;
1860     -
1861     for (i = 0; i < ICE_MAX_RESET_WAIT; i++) {
1862     if (!ice_is_reset_in_progress(pf->state))
1863     break;
1864     diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
1865     index dac0e51e6aafd..16a390c77d198 100644
1866     --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
1867     +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
1868     @@ -4545,7 +4545,7 @@ static int mvpp2_port_init(struct mvpp2_port *port)
1869     struct mvpp2 *priv = port->priv;
1870     struct mvpp2_txq_pcpu *txq_pcpu;
1871     unsigned int thread;
1872     - int queue, err, val;
1873     + int queue, err;
1874    
1875     /* Checks for hardware constraints */
1876     if (port->first_rxq + port->nrxqs >
1877     @@ -4559,18 +4559,6 @@ static int mvpp2_port_init(struct mvpp2_port *port)
1878     mvpp2_egress_disable(port);
1879     mvpp2_port_disable(port);
1880    
1881     - if (mvpp2_is_xlg(port->phy_interface)) {
1882     - val = readl(port->base + MVPP22_XLG_CTRL0_REG);
1883     - val &= ~MVPP22_XLG_CTRL0_FORCE_LINK_PASS;
1884     - val |= MVPP22_XLG_CTRL0_FORCE_LINK_DOWN;
1885     - writel(val, port->base + MVPP22_XLG_CTRL0_REG);
1886     - } else {
1887     - val = readl(port->base + MVPP2_GMAC_AUTONEG_CONFIG);
1888     - val &= ~MVPP2_GMAC_FORCE_LINK_PASS;
1889     - val |= MVPP2_GMAC_FORCE_LINK_DOWN;
1890     - writel(val, port->base + MVPP2_GMAC_AUTONEG_CONFIG);
1891     - }
1892     -
1893     port->tx_time_coal = MVPP2_TXDONE_COAL_USEC;
1894    
1895     port->txqs = devm_kcalloc(dev, port->ntxqs, sizeof(*port->txqs),
1896     diff --git a/drivers/net/tun.c b/drivers/net/tun.c
1897     index 7c40ae058e6d1..10211ea605140 100644
1898     --- a/drivers/net/tun.c
1899     +++ b/drivers/net/tun.c
1900     @@ -1071,6 +1071,7 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev)
1901     {
1902     struct tun_struct *tun = netdev_priv(dev);
1903     int txq = skb->queue_mapping;
1904     + struct netdev_queue *queue;
1905     struct tun_file *tfile;
1906     int len = skb->len;
1907    
1908     @@ -1117,6 +1118,10 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev)
1909     if (ptr_ring_produce(&tfile->tx_ring, skb))
1910     goto drop;
1911    
1912     + /* NETIF_F_LLTX requires to do our own update of trans_start */
1913     + queue = netdev_get_tx_queue(dev, txq);
1914     + queue->trans_start = jiffies;
1915     +
1916     /* Notify and wake up reader process */
1917     if (tfile->flags & TUN_FASYNC)
1918     kill_fasync(&tfile->fasync, SIGIO, POLL_IN);
1919     diff --git a/drivers/platform/x86/hp_accel.c b/drivers/platform/x86/hp_accel.c
1920     index 8c0867bda8280..0dfaa1a43b674 100644
1921     --- a/drivers/platform/x86/hp_accel.c
1922     +++ b/drivers/platform/x86/hp_accel.c
1923     @@ -372,9 +372,11 @@ static int lis3lv02d_add(struct acpi_device *device)
1924     INIT_WORK(&hpled_led.work, delayed_set_status_worker);
1925     ret = led_classdev_register(NULL, &hpled_led.led_classdev);
1926     if (ret) {
1927     + i8042_remove_filter(hp_accel_i8042_filter);
1928     lis3lv02d_joystick_disable(&lis3_dev);
1929     lis3lv02d_poweroff(&lis3_dev);
1930     flush_work(&hpled_led.work);
1931     + lis3lv02d_remove_fs(&lis3_dev);
1932     return ret;
1933     }
1934    
1935     diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
1936     index a242a62caaa16..7b3e52ff5f516 100644
1937     --- a/drivers/scsi/advansys.c
1938     +++ b/drivers/scsi/advansys.c
1939     @@ -3366,8 +3366,8 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
1940     shost->host_no);
1941    
1942     seq_printf(m,
1943     - " iop_base 0x%lx, cable_detect: %X, err_code %u\n",
1944     - (unsigned long)v->iop_base,
1945     + " iop_base 0x%p, cable_detect: %X, err_code %u\n",
1946     + v->iop_base,
1947     AdvReadWordRegister(iop_base,IOPW_SCSI_CFG1) & CABLE_DETECT,
1948     v->err_code);
1949    
1950     diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
1951     index 4a7ceaa34341c..51bab0979527b 100644
1952     --- a/drivers/scsi/lpfc/lpfc_sli.c
1953     +++ b/drivers/scsi/lpfc/lpfc_sli.c
1954     @@ -19692,6 +19692,7 @@ lpfc_drain_txq(struct lpfc_hba *phba)
1955     fail_msg,
1956     piocbq->iotag, piocbq->sli4_xritag);
1957     list_add_tail(&piocbq->list, &completions);
1958     + fail_msg = NULL;
1959     }
1960     spin_unlock_irqrestore(&pring->ring_lock, iflags);
1961     }
1962     diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
1963     index 12064ce76777d..16432d42a50aa 100644
1964     --- a/drivers/scsi/scsi_sysfs.c
1965     +++ b/drivers/scsi/scsi_sysfs.c
1966     @@ -776,6 +776,7 @@ store_state_field(struct device *dev, struct device_attribute *attr,
1967     int i, ret;
1968     struct scsi_device *sdev = to_scsi_device(dev);
1969     enum scsi_device_state state = 0;
1970     + bool rescan_dev = false;
1971    
1972     for (i = 0; i < ARRAY_SIZE(sdev_states); i++) {
1973     const int len = strlen(sdev_states[i].name);
1974     @@ -794,20 +795,27 @@ store_state_field(struct device *dev, struct device_attribute *attr,
1975     }
1976    
1977     mutex_lock(&sdev->state_mutex);
1978     - ret = scsi_device_set_state(sdev, state);
1979     - /*
1980     - * If the device state changes to SDEV_RUNNING, we need to
1981     - * run the queue to avoid I/O hang, and rescan the device
1982     - * to revalidate it. Running the queue first is necessary
1983     - * because another thread may be waiting inside
1984     - * blk_mq_freeze_queue_wait() and because that call may be
1985     - * waiting for pending I/O to finish.
1986     - */
1987     - if (ret == 0 && state == SDEV_RUNNING) {
1988     + if (sdev->sdev_state == SDEV_RUNNING && state == SDEV_RUNNING) {
1989     + ret = count;
1990     + } else {
1991     + ret = scsi_device_set_state(sdev, state);
1992     + if (ret == 0 && state == SDEV_RUNNING)
1993     + rescan_dev = true;
1994     + }
1995     + mutex_unlock(&sdev->state_mutex);
1996     +
1997     + if (rescan_dev) {
1998     + /*
1999     + * If the device state changes to SDEV_RUNNING, we need to
2000     + * run the queue to avoid I/O hang, and rescan the device
2001     + * to revalidate it. Running the queue first is necessary
2002     + * because another thread may be waiting inside
2003     + * blk_mq_freeze_queue_wait() and because that call may be
2004     + * waiting for pending I/O to finish.
2005     + */
2006     blk_mq_run_hw_queues(sdev->request_queue, true);
2007     scsi_rescan_device(dev);
2008     }
2009     - mutex_unlock(&sdev->state_mutex);
2010    
2011     return ret == 0 ? count : -EINVAL;
2012     }
2013     diff --git a/drivers/sh/maple/maple.c b/drivers/sh/maple/maple.c
2014     index e5d7fb81ad665..44a931d41a132 100644
2015     --- a/drivers/sh/maple/maple.c
2016     +++ b/drivers/sh/maple/maple.c
2017     @@ -835,8 +835,10 @@ static int __init maple_bus_init(void)
2018    
2019     maple_queue_cache = KMEM_CACHE(maple_buffer, SLAB_HWCACHE_ALIGN);
2020    
2021     - if (!maple_queue_cache)
2022     + if (!maple_queue_cache) {
2023     + retval = -ENOMEM;
2024     goto cleanup_bothirqs;
2025     + }
2026    
2027     INIT_LIST_HEAD(&maple_waitq);
2028     INIT_LIST_HEAD(&maple_sentq);
2029     @@ -849,6 +851,7 @@ static int __init maple_bus_init(void)
2030     if (!mdev[i]) {
2031     while (i-- > 0)
2032     maple_free_dev(mdev[i]);
2033     + retval = -ENOMEM;
2034     goto cleanup_cache;
2035     }
2036     baseunits[i] = mdev[i];
2037     diff --git a/drivers/target/target_core_alua.c b/drivers/target/target_core_alua.c
2038     index 385e4cf9cfa63..0fc3135d3e4f6 100644
2039     --- a/drivers/target/target_core_alua.c
2040     +++ b/drivers/target/target_core_alua.c
2041     @@ -1702,7 +1702,6 @@ int core_alua_set_tg_pt_gp_id(
2042     pr_err("Maximum ALUA alua_tg_pt_gps_count:"
2043     " 0x0000ffff reached\n");
2044     spin_unlock(&dev->t10_alua.tg_pt_gps_lock);
2045     - kmem_cache_free(t10_alua_tg_pt_gp_cache, tg_pt_gp);
2046     return -ENOSPC;
2047     }
2048     again:
2049     diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c
2050     index 2d19f0e332b01..20fe287039857 100644
2051     --- a/drivers/target/target_core_device.c
2052     +++ b/drivers/target/target_core_device.c
2053     @@ -758,6 +758,8 @@ struct se_device *target_alloc_device(struct se_hba *hba, const char *name)
2054     INIT_LIST_HEAD(&dev->t10_alua.lba_map_list);
2055     spin_lock_init(&dev->t10_alua.lba_map_lock);
2056    
2057     + INIT_WORK(&dev->delayed_cmd_work, target_do_delayed_work);
2058     +
2059     dev->t10_wwn.t10_dev = dev;
2060     dev->t10_alua.t10_dev = dev;
2061    
2062     diff --git a/drivers/target/target_core_internal.h b/drivers/target/target_core_internal.h
2063     index e7b3c6e5d5744..e4f072a680d41 100644
2064     --- a/drivers/target/target_core_internal.h
2065     +++ b/drivers/target/target_core_internal.h
2066     @@ -150,6 +150,7 @@ int transport_dump_vpd_ident(struct t10_vpd *, unsigned char *, int);
2067     void transport_clear_lun_ref(struct se_lun *);
2068     sense_reason_t target_cmd_size_check(struct se_cmd *cmd, unsigned int size);
2069     void target_qf_do_work(struct work_struct *work);
2070     +void target_do_delayed_work(struct work_struct *work);
2071     bool target_check_wce(struct se_device *dev);
2072     bool target_check_fua(struct se_device *dev);
2073     void __target_execute_cmd(struct se_cmd *, bool);
2074     diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
2075     index 5cf9e7677926f..f52fe40002259 100644
2076     --- a/drivers/target/target_core_transport.c
2077     +++ b/drivers/target/target_core_transport.c
2078     @@ -2021,32 +2021,35 @@ static bool target_handle_task_attr(struct se_cmd *cmd)
2079     */
2080     switch (cmd->sam_task_attr) {
2081     case TCM_HEAD_TAG:
2082     + atomic_inc_mb(&dev->non_ordered);
2083     pr_debug("Added HEAD_OF_QUEUE for CDB: 0x%02x\n",
2084     cmd->t_task_cdb[0]);
2085     return false;
2086     case TCM_ORDERED_TAG:
2087     - atomic_inc_mb(&dev->dev_ordered_sync);
2088     + atomic_inc_mb(&dev->delayed_cmd_count);
2089    
2090     pr_debug("Added ORDERED for CDB: 0x%02x to ordered list\n",
2091     cmd->t_task_cdb[0]);
2092     -
2093     - /*
2094     - * Execute an ORDERED command if no other older commands
2095     - * exist that need to be completed first.
2096     - */
2097     - if (!atomic_read(&dev->simple_cmds))
2098     - return false;
2099     break;
2100     default:
2101     /*
2102     * For SIMPLE and UNTAGGED Task Attribute commands
2103     */
2104     - atomic_inc_mb(&dev->simple_cmds);
2105     + atomic_inc_mb(&dev->non_ordered);
2106     +
2107     + if (atomic_read(&dev->delayed_cmd_count) == 0)
2108     + return false;
2109     break;
2110     }
2111    
2112     - if (atomic_read(&dev->dev_ordered_sync) == 0)
2113     - return false;
2114     + if (cmd->sam_task_attr != TCM_ORDERED_TAG) {
2115     + atomic_inc_mb(&dev->delayed_cmd_count);
2116     + /*
2117     + * We will account for this when we dequeue from the delayed
2118     + * list.
2119     + */
2120     + atomic_dec_mb(&dev->non_ordered);
2121     + }
2122    
2123     spin_lock(&dev->delayed_cmd_lock);
2124     list_add_tail(&cmd->se_delayed_node, &dev->delayed_cmd_list);
2125     @@ -2054,6 +2057,12 @@ static bool target_handle_task_attr(struct se_cmd *cmd)
2126    
2127     pr_debug("Added CDB: 0x%02x Task Attr: 0x%02x to delayed CMD listn",
2128     cmd->t_task_cdb[0], cmd->sam_task_attr);
2129     + /*
2130     + * We may have no non ordered cmds when this function started or we
2131     + * could have raced with the last simple/head cmd completing, so kick
2132     + * the delayed handler here.
2133     + */
2134     + schedule_work(&dev->delayed_cmd_work);
2135     return true;
2136     }
2137    
2138     @@ -2091,29 +2100,48 @@ EXPORT_SYMBOL(target_execute_cmd);
2139     * Process all commands up to the last received ORDERED task attribute which
2140     * requires another blocking boundary
2141     */
2142     -static void target_restart_delayed_cmds(struct se_device *dev)
2143     +void target_do_delayed_work(struct work_struct *work)
2144     {
2145     - for (;;) {
2146     + struct se_device *dev = container_of(work, struct se_device,
2147     + delayed_cmd_work);
2148     +
2149     + spin_lock(&dev->delayed_cmd_lock);
2150     + while (!dev->ordered_sync_in_progress) {
2151     struct se_cmd *cmd;
2152    
2153     - spin_lock(&dev->delayed_cmd_lock);
2154     - if (list_empty(&dev->delayed_cmd_list)) {
2155     - spin_unlock(&dev->delayed_cmd_lock);
2156     + if (list_empty(&dev->delayed_cmd_list))
2157     break;
2158     - }
2159    
2160     cmd = list_entry(dev->delayed_cmd_list.next,
2161     struct se_cmd, se_delayed_node);
2162     +
2163     + if (cmd->sam_task_attr == TCM_ORDERED_TAG) {
2164     + /*
2165     + * Check if we started with:
2166     + * [ordered] [simple] [ordered]
2167     + * and we are now at the last ordered so we have to wait
2168     + * for the simple cmd.
2169     + */
2170     + if (atomic_read(&dev->non_ordered) > 0)
2171     + break;
2172     +
2173     + dev->ordered_sync_in_progress = true;
2174     + }
2175     +
2176     list_del(&cmd->se_delayed_node);
2177     + atomic_dec_mb(&dev->delayed_cmd_count);
2178     spin_unlock(&dev->delayed_cmd_lock);
2179    
2180     + if (cmd->sam_task_attr != TCM_ORDERED_TAG)
2181     + atomic_inc_mb(&dev->non_ordered);
2182     +
2183     cmd->transport_state |= CMD_T_SENT;
2184    
2185     __target_execute_cmd(cmd, true);
2186    
2187     - if (cmd->sam_task_attr == TCM_ORDERED_TAG)
2188     - break;
2189     + spin_lock(&dev->delayed_cmd_lock);
2190     }
2191     + spin_unlock(&dev->delayed_cmd_lock);
2192     }
2193    
2194     /*
2195     @@ -2131,14 +2159,17 @@ static void transport_complete_task_attr(struct se_cmd *cmd)
2196     goto restart;
2197    
2198     if (cmd->sam_task_attr == TCM_SIMPLE_TAG) {
2199     - atomic_dec_mb(&dev->simple_cmds);
2200     + atomic_dec_mb(&dev->non_ordered);
2201     dev->dev_cur_ordered_id++;
2202     } else if (cmd->sam_task_attr == TCM_HEAD_TAG) {
2203     + atomic_dec_mb(&dev->non_ordered);
2204     dev->dev_cur_ordered_id++;
2205     pr_debug("Incremented dev_cur_ordered_id: %u for HEAD_OF_QUEUE\n",
2206     dev->dev_cur_ordered_id);
2207     } else if (cmd->sam_task_attr == TCM_ORDERED_TAG) {
2208     - atomic_dec_mb(&dev->dev_ordered_sync);
2209     + spin_lock(&dev->delayed_cmd_lock);
2210     + dev->ordered_sync_in_progress = false;
2211     + spin_unlock(&dev->delayed_cmd_lock);
2212    
2213     dev->dev_cur_ordered_id++;
2214     pr_debug("Incremented dev_cur_ordered_id: %u for ORDERED\n",
2215     @@ -2147,7 +2178,8 @@ static void transport_complete_task_attr(struct se_cmd *cmd)
2216     cmd->se_cmd_flags &= ~SCF_TASK_ATTR_SET;
2217    
2218     restart:
2219     - target_restart_delayed_cmds(dev);
2220     + if (atomic_read(&dev->delayed_cmd_count) > 0)
2221     + schedule_work(&dev->delayed_cmd_work);
2222     }
2223    
2224     static void transport_complete_qf(struct se_cmd *cmd)
2225     diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c
2226     index ec145a59f1993..bb148dbfbb88f 100644
2227     --- a/drivers/tty/tty_buffer.c
2228     +++ b/drivers/tty/tty_buffer.c
2229     @@ -534,6 +534,9 @@ static void flush_to_ldisc(struct work_struct *work)
2230     if (!count)
2231     break;
2232     head->read += count;
2233     +
2234     + if (need_resched())
2235     + cond_resched();
2236     }
2237    
2238     mutex_unlock(&buf->lock);
2239     diff --git a/drivers/usb/host/max3421-hcd.c b/drivers/usb/host/max3421-hcd.c
2240     index 5ef0747225f6b..e0b25dd869094 100644
2241     --- a/drivers/usb/host/max3421-hcd.c
2242     +++ b/drivers/usb/host/max3421-hcd.c
2243     @@ -125,8 +125,6 @@ struct max3421_hcd {
2244    
2245     struct task_struct *spi_thread;
2246    
2247     - struct max3421_hcd *next;
2248     -
2249     enum max3421_rh_state rh_state;
2250     /* lower 16 bits contain port status, upper 16 bits the change mask: */
2251     u32 port_status;
2252     @@ -174,8 +172,6 @@ struct max3421_ep {
2253     u8 retransmit; /* packet needs retransmission */
2254     };
2255    
2256     -static struct max3421_hcd *max3421_hcd_list;
2257     -
2258     #define MAX3421_FIFO_SIZE 64
2259    
2260     #define MAX3421_SPI_DIR_RD 0 /* read register from MAX3421 */
2261     @@ -1882,9 +1878,8 @@ max3421_probe(struct spi_device *spi)
2262     }
2263     set_bit(HCD_FLAG_POLL_RH, &hcd->flags);
2264     max3421_hcd = hcd_to_max3421(hcd);
2265     - max3421_hcd->next = max3421_hcd_list;
2266     - max3421_hcd_list = max3421_hcd;
2267     INIT_LIST_HEAD(&max3421_hcd->ep_list);
2268     + spi_set_drvdata(spi, max3421_hcd);
2269    
2270     max3421_hcd->tx = kmalloc(sizeof(*max3421_hcd->tx), GFP_KERNEL);
2271     if (!max3421_hcd->tx)
2272     @@ -1934,28 +1929,18 @@ error:
2273     static int
2274     max3421_remove(struct spi_device *spi)
2275     {
2276     - struct max3421_hcd *max3421_hcd = NULL, **prev;
2277     - struct usb_hcd *hcd = NULL;
2278     + struct max3421_hcd *max3421_hcd;
2279     + struct usb_hcd *hcd;
2280     unsigned long flags;
2281    
2282     - for (prev = &max3421_hcd_list; *prev; prev = &(*prev)->next) {
2283     - max3421_hcd = *prev;
2284     - hcd = max3421_to_hcd(max3421_hcd);
2285     - if (hcd->self.controller == &spi->dev)
2286     - break;
2287     - }
2288     - if (!max3421_hcd) {
2289     - dev_err(&spi->dev, "no MAX3421 HCD found for SPI device %p\n",
2290     - spi);
2291     - return -ENODEV;
2292     - }
2293     + max3421_hcd = spi_get_drvdata(spi);
2294     + hcd = max3421_to_hcd(max3421_hcd);
2295    
2296     usb_remove_hcd(hcd);
2297    
2298     spin_lock_irqsave(&max3421_hcd->lock, flags);
2299    
2300     kthread_stop(max3421_hcd->spi_thread);
2301     - *prev = max3421_hcd->next;
2302    
2303     spin_unlock_irqrestore(&max3421_hcd->lock, flags);
2304    
2305     diff --git a/drivers/usb/host/ohci-tmio.c b/drivers/usb/host/ohci-tmio.c
2306     index fed43c6dd85cc..b611c8b09a89f 100644
2307     --- a/drivers/usb/host/ohci-tmio.c
2308     +++ b/drivers/usb/host/ohci-tmio.c
2309     @@ -199,7 +199,7 @@ static int ohci_hcd_tmio_drv_probe(struct platform_device *dev)
2310     if (usb_disabled())
2311     return -ENODEV;
2312    
2313     - if (!cell)
2314     + if (!cell || !regs || !config || !sram)
2315     return -EINVAL;
2316    
2317     if (irq < 0)
2318     diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c
2319     index 4ecfbf6bb1fa8..902507da8aa85 100644
2320     --- a/drivers/usb/musb/tusb6010.c
2321     +++ b/drivers/usb/musb/tusb6010.c
2322     @@ -1103,6 +1103,11 @@ static int tusb_musb_init(struct musb *musb)
2323    
2324     /* dma address for async dma */
2325     mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
2326     + if (!mem) {
2327     + pr_debug("no async dma resource?\n");
2328     + ret = -ENODEV;
2329     + goto done;
2330     + }
2331     musb->async = mem->start;
2332    
2333     /* dma address for sync dma */
2334     diff --git a/drivers/usb/typec/tps6598x.c b/drivers/usb/typec/tps6598x.c
2335     index a38d1409f15b7..67bebee693301 100644
2336     --- a/drivers/usb/typec/tps6598x.c
2337     +++ b/drivers/usb/typec/tps6598x.c
2338     @@ -109,7 +109,7 @@ tps6598x_block_read(struct tps6598x *tps, u8 reg, void *val, size_t len)
2339     u8 data[TPS_MAX_LEN + 1];
2340     int ret;
2341    
2342     - if (WARN_ON(len + 1 > sizeof(data)))
2343     + if (len + 1 > sizeof(data))
2344     return -EINVAL;
2345    
2346     if (!tps->i2c_protocol)
2347     diff --git a/drivers/video/console/sticon.c b/drivers/video/console/sticon.c
2348     index 79c9bd8d30254..559a7305cadaa 100644
2349     --- a/drivers/video/console/sticon.c
2350     +++ b/drivers/video/console/sticon.c
2351     @@ -291,13 +291,13 @@ static unsigned long sticon_getxy(struct vc_data *conp, unsigned long pos,
2352     static u8 sticon_build_attr(struct vc_data *conp, u8 color, u8 intens,
2353     u8 blink, u8 underline, u8 reverse, u8 italic)
2354     {
2355     - u8 attr = ((color & 0x70) >> 1) | ((color & 7));
2356     + u8 fg = color & 7;
2357     + u8 bg = (color & 0x70) >> 4;
2358    
2359     - if (reverse) {
2360     - color = ((color >> 3) & 0x7) | ((color & 0x7) << 3);
2361     - }
2362     -
2363     - return attr;
2364     + if (reverse)
2365     + return (fg << 3) | bg;
2366     + else
2367     + return (bg << 3) | fg;
2368     }
2369    
2370     static void sticon_invert_region(struct vc_data *conp, u16 *p, int count)
2371     diff --git a/fs/btrfs/async-thread.c b/fs/btrfs/async-thread.c
2372     index 11be02459b876..eb592b92aa9cd 100644
2373     --- a/fs/btrfs/async-thread.c
2374     +++ b/fs/btrfs/async-thread.c
2375     @@ -237,6 +237,13 @@ static void run_ordered_work(struct __btrfs_workqueue *wq,
2376     ordered_list);
2377     if (!test_bit(WORK_DONE_BIT, &work->flags))
2378     break;
2379     + /*
2380     + * Orders all subsequent loads after reading WORK_DONE_BIT,
2381     + * paired with the smp_mb__before_atomic in btrfs_work_helper
2382     + * this guarantees that the ordered function will see all
2383     + * updates from ordinary work function.
2384     + */
2385     + smp_rmb();
2386    
2387     /*
2388     * we are going to call the ordered done function, but
2389     @@ -325,6 +332,13 @@ static void btrfs_work_helper(struct work_struct *normal_work)
2390     thresh_exec_hook(wq);
2391     work->func(work);
2392     if (need_order) {
2393     + /*
2394     + * Ensures all memory accesses done in the work function are
2395     + * ordered before setting the WORK_DONE_BIT. Ensuring the thread
2396     + * which is going to executed the ordered work sees them.
2397     + * Pairs with the smp_rmb in run_ordered_work.
2398     + */
2399     + smp_mb__before_atomic();
2400     set_bit(WORK_DONE_BIT, &work->flags);
2401     run_ordered_work(wq, work);
2402     }
2403     diff --git a/fs/udf/dir.c b/fs/udf/dir.c
2404     index c19dba45aa209..d0f92a52e3bab 100644
2405     --- a/fs/udf/dir.c
2406     +++ b/fs/udf/dir.c
2407     @@ -31,6 +31,7 @@
2408     #include <linux/mm.h>
2409     #include <linux/slab.h>
2410     #include <linux/bio.h>
2411     +#include <linux/iversion.h>
2412    
2413     #include "udf_i.h"
2414     #include "udf_sb.h"
2415     @@ -44,7 +45,7 @@ static int udf_readdir(struct file *file, struct dir_context *ctx)
2416     struct fileIdentDesc *fi = NULL;
2417     struct fileIdentDesc cfi;
2418     udf_pblk_t block, iblock;
2419     - loff_t nf_pos;
2420     + loff_t nf_pos, emit_pos = 0;
2421     int flen;
2422     unsigned char *fname = NULL, *copy_name = NULL;
2423     unsigned char *nameptr;
2424     @@ -58,6 +59,7 @@ static int udf_readdir(struct file *file, struct dir_context *ctx)
2425     int i, num, ret = 0;
2426     struct extent_position epos = { NULL, 0, {0, 0} };
2427     struct super_block *sb = dir->i_sb;
2428     + bool pos_valid = false;
2429    
2430     if (ctx->pos == 0) {
2431     if (!dir_emit_dot(file, ctx))
2432     @@ -68,6 +70,21 @@ static int udf_readdir(struct file *file, struct dir_context *ctx)
2433     if (nf_pos >= size)
2434     goto out;
2435    
2436     + /*
2437     + * Something changed since last readdir (either lseek was called or dir
2438     + * changed)? We need to verify the position correctly points at the
2439     + * beginning of some dir entry so that the directory parsing code does
2440     + * not get confused. Since UDF does not have any reliable way of
2441     + * identifying beginning of dir entry (names are under user control),
2442     + * we need to scan the directory from the beginning.
2443     + */
2444     + if (!inode_eq_iversion(dir, file->f_version)) {
2445     + emit_pos = nf_pos;
2446     + nf_pos = 0;
2447     + } else {
2448     + pos_valid = true;
2449     + }
2450     +
2451     fname = kmalloc(UDF_NAME_LEN, GFP_NOFS);
2452     if (!fname) {
2453     ret = -ENOMEM;
2454     @@ -123,13 +140,21 @@ static int udf_readdir(struct file *file, struct dir_context *ctx)
2455    
2456     while (nf_pos < size) {
2457     struct kernel_lb_addr tloc;
2458     + loff_t cur_pos = nf_pos;
2459    
2460     - ctx->pos = (nf_pos >> 2) + 1;
2461     + /* Update file position only if we got past the current one */
2462     + if (nf_pos >= emit_pos) {
2463     + ctx->pos = (nf_pos >> 2) + 1;
2464     + pos_valid = true;
2465     + }
2466    
2467     fi = udf_fileident_read(dir, &nf_pos, &fibh, &cfi, &epos, &eloc,
2468     &elen, &offset);
2469     if (!fi)
2470     goto out;
2471     + /* Still not at offset where user asked us to read from? */
2472     + if (cur_pos < emit_pos)
2473     + continue;
2474    
2475     liu = le16_to_cpu(cfi.lengthOfImpUse);
2476     lfi = cfi.lengthFileIdent;
2477     @@ -187,8 +212,11 @@ static int udf_readdir(struct file *file, struct dir_context *ctx)
2478     } /* end while */
2479    
2480     ctx->pos = (nf_pos >> 2) + 1;
2481     + pos_valid = true;
2482    
2483     out:
2484     + if (pos_valid)
2485     + file->f_version = inode_query_iversion(dir);
2486     if (fibh.sbh != fibh.ebh)
2487     brelse(fibh.ebh);
2488     brelse(fibh.sbh);
2489     diff --git a/fs/udf/namei.c b/fs/udf/namei.c
2490     index 3c3d3b20889c8..3c009562375d3 100644
2491     --- a/fs/udf/namei.c
2492     +++ b/fs/udf/namei.c
2493     @@ -30,6 +30,7 @@
2494     #include <linux/sched.h>
2495     #include <linux/crc-itu-t.h>
2496     #include <linux/exportfs.h>
2497     +#include <linux/iversion.h>
2498    
2499     static inline int udf_match(int len1, const unsigned char *name1, int len2,
2500     const unsigned char *name2)
2501     @@ -135,6 +136,8 @@ int udf_write_fi(struct inode *inode, struct fileIdentDesc *cfi,
2502     mark_buffer_dirty_inode(fibh->ebh, inode);
2503     mark_buffer_dirty_inode(fibh->sbh, inode);
2504     }
2505     + inode_inc_iversion(inode);
2506     +
2507     return 0;
2508     }
2509    
2510     diff --git a/fs/udf/super.c b/fs/udf/super.c
2511     index 5663bae95700c..5193b94c06834 100644
2512     --- a/fs/udf/super.c
2513     +++ b/fs/udf/super.c
2514     @@ -57,6 +57,7 @@
2515     #include <linux/crc-itu-t.h>
2516     #include <linux/log2.h>
2517     #include <asm/byteorder.h>
2518     +#include <linux/iversion.h>
2519    
2520     #include "udf_sb.h"
2521     #include "udf_i.h"
2522     @@ -149,6 +150,7 @@ static struct inode *udf_alloc_inode(struct super_block *sb)
2523     init_rwsem(&ei->i_data_sem);
2524     ei->cached_extent.lstart = -1;
2525     spin_lock_init(&ei->i_extent_cache_lock);
2526     + inode_set_iversion(&ei->vfs_inode, 1);
2527    
2528     return &ei->vfs_inode;
2529     }
2530     diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h
2531     index c716ea81e6531..46294ef620ff9 100644
2532     --- a/include/asm-generic/tlb.h
2533     +++ b/include/asm-generic/tlb.h
2534     @@ -495,6 +495,38 @@ static inline void tlb_end_vma(struct mmu_gather *tlb, struct vm_area_struct *vm
2535     }
2536     #endif
2537    
2538     +/*
2539     + * tlb_flush_{pte|pmd|pud|p4d}_range() adjust the tlb->start and tlb->end,
2540     + * and set corresponding cleared_*.
2541     + */
2542     +static inline void tlb_flush_pte_range(struct mmu_gather *tlb,
2543     + unsigned long address, unsigned long size)
2544     +{
2545     + __tlb_adjust_range(tlb, address, size);
2546     + tlb->cleared_ptes = 1;
2547     +}
2548     +
2549     +static inline void tlb_flush_pmd_range(struct mmu_gather *tlb,
2550     + unsigned long address, unsigned long size)
2551     +{
2552     + __tlb_adjust_range(tlb, address, size);
2553     + tlb->cleared_pmds = 1;
2554     +}
2555     +
2556     +static inline void tlb_flush_pud_range(struct mmu_gather *tlb,
2557     + unsigned long address, unsigned long size)
2558     +{
2559     + __tlb_adjust_range(tlb, address, size);
2560     + tlb->cleared_puds = 1;
2561     +}
2562     +
2563     +static inline void tlb_flush_p4d_range(struct mmu_gather *tlb,
2564     + unsigned long address, unsigned long size)
2565     +{
2566     + __tlb_adjust_range(tlb, address, size);
2567     + tlb->cleared_p4ds = 1;
2568     +}
2569     +
2570     #ifndef __tlb_remove_tlb_entry
2571     #define __tlb_remove_tlb_entry(tlb, ptep, address) do { } while (0)
2572     #endif
2573     @@ -508,19 +540,17 @@ static inline void tlb_end_vma(struct mmu_gather *tlb, struct vm_area_struct *vm
2574     */
2575     #define tlb_remove_tlb_entry(tlb, ptep, address) \
2576     do { \
2577     - __tlb_adjust_range(tlb, address, PAGE_SIZE); \
2578     - tlb->cleared_ptes = 1; \
2579     + tlb_flush_pte_range(tlb, address, PAGE_SIZE); \
2580     __tlb_remove_tlb_entry(tlb, ptep, address); \
2581     } while (0)
2582    
2583     #define tlb_remove_huge_tlb_entry(h, tlb, ptep, address) \
2584     do { \
2585     unsigned long _sz = huge_page_size(h); \
2586     - __tlb_adjust_range(tlb, address, _sz); \
2587     if (_sz == PMD_SIZE) \
2588     - tlb->cleared_pmds = 1; \
2589     + tlb_flush_pmd_range(tlb, address, _sz); \
2590     else if (_sz == PUD_SIZE) \
2591     - tlb->cleared_puds = 1; \
2592     + tlb_flush_pud_range(tlb, address, _sz); \
2593     __tlb_remove_tlb_entry(tlb, ptep, address); \
2594     } while (0)
2595    
2596     @@ -534,8 +564,7 @@ static inline void tlb_end_vma(struct mmu_gather *tlb, struct vm_area_struct *vm
2597    
2598     #define tlb_remove_pmd_tlb_entry(tlb, pmdp, address) \
2599     do { \
2600     - __tlb_adjust_range(tlb, address, HPAGE_PMD_SIZE); \
2601     - tlb->cleared_pmds = 1; \
2602     + tlb_flush_pmd_range(tlb, address, HPAGE_PMD_SIZE); \
2603     __tlb_remove_pmd_tlb_entry(tlb, pmdp, address); \
2604     } while (0)
2605    
2606     @@ -549,8 +578,7 @@ static inline void tlb_end_vma(struct mmu_gather *tlb, struct vm_area_struct *vm
2607    
2608     #define tlb_remove_pud_tlb_entry(tlb, pudp, address) \
2609     do { \
2610     - __tlb_adjust_range(tlb, address, HPAGE_PUD_SIZE); \
2611     - tlb->cleared_puds = 1; \
2612     + tlb_flush_pud_range(tlb, address, HPAGE_PUD_SIZE); \
2613     __tlb_remove_pud_tlb_entry(tlb, pudp, address); \
2614     } while (0)
2615    
2616     @@ -575,9 +603,8 @@ static inline void tlb_end_vma(struct mmu_gather *tlb, struct vm_area_struct *vm
2617     #ifndef pte_free_tlb
2618     #define pte_free_tlb(tlb, ptep, address) \
2619     do { \
2620     - __tlb_adjust_range(tlb, address, PAGE_SIZE); \
2621     + tlb_flush_pmd_range(tlb, address, PAGE_SIZE); \
2622     tlb->freed_tables = 1; \
2623     - tlb->cleared_pmds = 1; \
2624     __pte_free_tlb(tlb, ptep, address); \
2625     } while (0)
2626     #endif
2627     @@ -585,9 +612,8 @@ static inline void tlb_end_vma(struct mmu_gather *tlb, struct vm_area_struct *vm
2628     #ifndef pmd_free_tlb
2629     #define pmd_free_tlb(tlb, pmdp, address) \
2630     do { \
2631     - __tlb_adjust_range(tlb, address, PAGE_SIZE); \
2632     + tlb_flush_pud_range(tlb, address, PAGE_SIZE); \
2633     tlb->freed_tables = 1; \
2634     - tlb->cleared_puds = 1; \
2635     __pmd_free_tlb(tlb, pmdp, address); \
2636     } while (0)
2637     #endif
2638     @@ -596,9 +622,8 @@ static inline void tlb_end_vma(struct mmu_gather *tlb, struct vm_area_struct *vm
2639     #ifndef pud_free_tlb
2640     #define pud_free_tlb(tlb, pudp, address) \
2641     do { \
2642     - __tlb_adjust_range(tlb, address, PAGE_SIZE); \
2643     + tlb_flush_p4d_range(tlb, address, PAGE_SIZE); \
2644     tlb->freed_tables = 1; \
2645     - tlb->cleared_p4ds = 1; \
2646     __pud_free_tlb(tlb, pudp, address); \
2647     } while (0)
2648     #endif
2649     diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h
2650     index b465f8f3e554f..04e87f4b9417c 100644
2651     --- a/include/linux/virtio_net.h
2652     +++ b/include/linux/virtio_net.h
2653     @@ -120,10 +120,15 @@ retry:
2654    
2655     if (hdr->gso_type != VIRTIO_NET_HDR_GSO_NONE) {
2656     u16 gso_size = __virtio16_to_cpu(little_endian, hdr->gso_size);
2657     + unsigned int nh_off = p_off;
2658     struct skb_shared_info *shinfo = skb_shinfo(skb);
2659    
2660     + /* UFO may not include transport header in gso_size. */
2661     + if (gso_type & SKB_GSO_UDP)
2662     + nh_off -= thlen;
2663     +
2664     /* Too small packets are not really GSO ones. */
2665     - if (skb->len - p_off > gso_size) {
2666     + if (skb->len - nh_off > gso_size) {
2667     shinfo->gso_size = gso_size;
2668     shinfo->gso_type = gso_type;
2669    
2670     diff --git a/include/rdma/rdma_netlink.h b/include/rdma/rdma_netlink.h
2671     index ab22759de7ea0..7b3ef7a3d8d04 100644
2672     --- a/include/rdma/rdma_netlink.h
2673     +++ b/include/rdma/rdma_netlink.h
2674     @@ -30,7 +30,7 @@ enum rdma_nl_flags {
2675     * constant as well and the compiler checks they are the same.
2676     */
2677     #define MODULE_ALIAS_RDMA_NETLINK(_index, _val) \
2678     - static inline void __chk_##_index(void) \
2679     + static inline void __maybe_unused __chk_##_index(void) \
2680     { \
2681     BUILD_BUG_ON(_index != _val); \
2682     } \
2683     diff --git a/include/sound/hdaudio_ext.h b/include/sound/hdaudio_ext.h
2684     index ef88b20c7b0a5..23dc8deac344d 100644
2685     --- a/include/sound/hdaudio_ext.h
2686     +++ b/include/sound/hdaudio_ext.h
2687     @@ -88,6 +88,8 @@ struct hdac_ext_stream *snd_hdac_ext_stream_assign(struct hdac_bus *bus,
2688     struct snd_pcm_substream *substream,
2689     int type);
2690     void snd_hdac_ext_stream_release(struct hdac_ext_stream *azx_dev, int type);
2691     +void snd_hdac_ext_stream_decouple_locked(struct hdac_bus *bus,
2692     + struct hdac_ext_stream *azx_dev, bool decouple);
2693     void snd_hdac_ext_stream_decouple(struct hdac_bus *bus,
2694     struct hdac_ext_stream *azx_dev, bool decouple);
2695     void snd_hdac_ext_stop_streams(struct hdac_bus *bus);
2696     diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
2697     index 7c9716fe731e2..59d7ebb8bbaf4 100644
2698     --- a/include/target/target_core_base.h
2699     +++ b/include/target/target_core_base.h
2700     @@ -781,8 +781,9 @@ struct se_device {
2701     atomic_long_t read_bytes;
2702     atomic_long_t write_bytes;
2703     /* Active commands on this virtual SE device */
2704     - atomic_t simple_cmds;
2705     - atomic_t dev_ordered_sync;
2706     + atomic_t non_ordered;
2707     + bool ordered_sync_in_progress;
2708     + atomic_t delayed_cmd_count;
2709     atomic_t dev_qf_count;
2710     u32 export_count;
2711     spinlock_t delayed_cmd_lock;
2712     @@ -804,6 +805,7 @@ struct se_device {
2713     struct list_head dev_sep_list;
2714     struct list_head dev_tmr_list;
2715     struct work_struct qf_work_queue;
2716     + struct work_struct delayed_cmd_work;
2717     struct list_head delayed_cmd_list;
2718     struct list_head state_list;
2719     struct list_head qf_cmd_list;
2720     diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h
2721     index 1796ff99c3e9c..a7613efc271ab 100644
2722     --- a/include/trace/events/f2fs.h
2723     +++ b/include/trace/events/f2fs.h
2724     @@ -793,20 +793,20 @@ TRACE_EVENT(f2fs_lookup_start,
2725     TP_STRUCT__entry(
2726     __field(dev_t, dev)
2727     __field(ino_t, ino)
2728     - __field(const char *, name)
2729     + __string(name, dentry->d_name.name)
2730     __field(unsigned int, flags)
2731     ),
2732    
2733     TP_fast_assign(
2734     __entry->dev = dir->i_sb->s_dev;
2735     __entry->ino = dir->i_ino;
2736     - __entry->name = dentry->d_name.name;
2737     + __assign_str(name, dentry->d_name.name);
2738     __entry->flags = flags;
2739     ),
2740    
2741     TP_printk("dev = (%d,%d), pino = %lu, name:%s, flags:%u",
2742     show_dev_ino(__entry),
2743     - __entry->name,
2744     + __get_str(name),
2745     __entry->flags)
2746     );
2747    
2748     @@ -820,7 +820,7 @@ TRACE_EVENT(f2fs_lookup_end,
2749     TP_STRUCT__entry(
2750     __field(dev_t, dev)
2751     __field(ino_t, ino)
2752     - __field(const char *, name)
2753     + __string(name, dentry->d_name.name)
2754     __field(nid_t, cino)
2755     __field(int, err)
2756     ),
2757     @@ -828,14 +828,14 @@ TRACE_EVENT(f2fs_lookup_end,
2758     TP_fast_assign(
2759     __entry->dev = dir->i_sb->s_dev;
2760     __entry->ino = dir->i_ino;
2761     - __entry->name = dentry->d_name.name;
2762     + __assign_str(name, dentry->d_name.name);
2763     __entry->cino = ino;
2764     __entry->err = err;
2765     ),
2766    
2767     TP_printk("dev = (%d,%d), pino = %lu, name:%s, ino:%u, err:%d",
2768     show_dev_ino(__entry),
2769     - __entry->name,
2770     + __get_str(name),
2771     __entry->cino,
2772     __entry->err)
2773     );
2774     diff --git a/ipc/util.c b/ipc/util.c
2775     index 1821b6386d3b4..09c3bd9f8e768 100644
2776     --- a/ipc/util.c
2777     +++ b/ipc/util.c
2778     @@ -446,8 +446,8 @@ static int ipcget_public(struct ipc_namespace *ns, struct ipc_ids *ids,
2779     static void ipc_kht_remove(struct ipc_ids *ids, struct kern_ipc_perm *ipcp)
2780     {
2781     if (ipcp->key != IPC_PRIVATE)
2782     - rhashtable_remove_fast(&ids->key_ht, &ipcp->khtnode,
2783     - ipc_kht_params);
2784     + WARN_ON_ONCE(rhashtable_remove_fast(&ids->key_ht, &ipcp->khtnode,
2785     + ipc_kht_params));
2786     }
2787    
2788     /**
2789     @@ -462,7 +462,7 @@ void ipc_rmid(struct ipc_ids *ids, struct kern_ipc_perm *ipcp)
2790     {
2791     int idx = ipcid_to_idx(ipcp->id);
2792    
2793     - idr_remove(&ids->ipcs_idr, idx);
2794     + WARN_ON_ONCE(idr_remove(&ids->ipcs_idr, idx) != ipcp);
2795     ipc_kht_remove(ids, ipcp);
2796     ids->in_use--;
2797     ipcp->deleted = true;
2798     diff --git a/kernel/events/core.c b/kernel/events/core.c
2799     index 1993a741d2dc5..6ffe3d3e7b06d 100644
2800     --- a/kernel/events/core.c
2801     +++ b/kernel/events/core.c
2802     @@ -6536,7 +6536,6 @@ void perf_output_sample(struct perf_output_handle *handle,
2803     static u64 perf_virt_to_phys(u64 virt)
2804     {
2805     u64 phys_addr = 0;
2806     - struct page *p = NULL;
2807    
2808     if (!virt)
2809     return 0;
2810     @@ -6555,14 +6554,15 @@ static u64 perf_virt_to_phys(u64 virt)
2811     * If failed, leave phys_addr as 0.
2812     */
2813     if (current->mm != NULL) {
2814     + struct page *p;
2815     +
2816     pagefault_disable();
2817     - if (__get_user_pages_fast(virt, 1, 0, &p) == 1)
2818     + if (__get_user_pages_fast(virt, 1, 0, &p) == 1) {
2819     phys_addr = page_to_phys(p) + virt % PAGE_SIZE;
2820     + put_page(p);
2821     + }
2822     pagefault_enable();
2823     }
2824     -
2825     - if (p)
2826     - put_page(p);
2827     }
2828    
2829     return phys_addr;
2830     diff --git a/kernel/sched/core.c b/kernel/sched/core.c
2831     index 5dc43d37e6a2b..f8ca0738d729e 100644
2832     --- a/kernel/sched/core.c
2833     +++ b/kernel/sched/core.c
2834     @@ -2482,6 +2482,9 @@ out:
2835    
2836     bool cpus_share_cache(int this_cpu, int that_cpu)
2837     {
2838     + if (this_cpu == that_cpu)
2839     + return true;
2840     +
2841     return per_cpu(sd_llc_id, this_cpu) == per_cpu(sd_llc_id, that_cpu);
2842     }
2843     #endif /* CONFIG_SMP */
2844     diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
2845     index f63766366e238..8b33a3c872750 100644
2846     --- a/kernel/trace/trace_events_hist.c
2847     +++ b/kernel/trace/trace_events_hist.c
2848     @@ -149,6 +149,8 @@ struct hist_field {
2849     */
2850     unsigned int var_ref_idx;
2851     bool read_once;
2852     +
2853     + unsigned int var_str_idx;
2854     };
2855    
2856     static u64 hist_field_none(struct hist_field *field,
2857     @@ -351,6 +353,7 @@ struct hist_trigger_data {
2858     unsigned int n_keys;
2859     unsigned int n_fields;
2860     unsigned int n_vars;
2861     + unsigned int n_var_str;
2862     unsigned int key_size;
2863     struct tracing_map_sort_key sort_keys[TRACING_MAP_SORT_KEYS_MAX];
2864     unsigned int n_sort_keys;
2865     @@ -2305,7 +2308,12 @@ static int hist_trigger_elt_data_alloc(struct tracing_map_elt *elt)
2866     }
2867     }
2868    
2869     - n_str = hist_data->n_field_var_str + hist_data->n_save_var_str;
2870     + n_str = hist_data->n_field_var_str + hist_data->n_save_var_str +
2871     + hist_data->n_var_str;
2872     + if (n_str > SYNTH_FIELDS_MAX) {
2873     + hist_elt_data_free(elt_data);
2874     + return -EINVAL;
2875     + }
2876    
2877     size = STR_VAR_LEN_MAX;
2878    
2879     @@ -2582,9 +2590,10 @@ static struct hist_field *create_hist_field(struct hist_trigger_data *hist_data,
2880     if (!hist_field->type)
2881     goto free;
2882    
2883     - if (field->filter_type == FILTER_STATIC_STRING)
2884     + if (field->filter_type == FILTER_STATIC_STRING) {
2885     hist_field->fn = hist_field_string;
2886     - else if (field->filter_type == FILTER_DYN_STRING)
2887     + hist_field->size = field->size;
2888     + } else if (field->filter_type == FILTER_DYN_STRING)
2889     hist_field->fn = hist_field_dynstring;
2890     else
2891     hist_field->fn = hist_field_pstring;
2892     @@ -3522,7 +3531,7 @@ static inline void __update_field_vars(struct tracing_map_elt *elt,
2893     char *str = elt_data->field_var_str[j++];
2894     char *val_str = (char *)(uintptr_t)var_val;
2895    
2896     - strscpy(str, val_str, STR_VAR_LEN_MAX);
2897     + strscpy(str, val_str, val->size);
2898     var_val = (u64)(uintptr_t)str;
2899     }
2900     tracing_map_set_var(elt, var_idx, var_val);
2901     @@ -4599,6 +4608,7 @@ static int create_var_field(struct hist_trigger_data *hist_data,
2902     {
2903     struct trace_array *tr = hist_data->event_file->tr;
2904     unsigned long flags = 0;
2905     + int ret;
2906    
2907     if (WARN_ON(val_idx >= TRACING_MAP_VALS_MAX + TRACING_MAP_VARS_MAX))
2908     return -EINVAL;
2909     @@ -4613,7 +4623,12 @@ static int create_var_field(struct hist_trigger_data *hist_data,
2910     if (WARN_ON(hist_data->n_vars > TRACING_MAP_VARS_MAX))
2911     return -EINVAL;
2912    
2913     - return __create_val_field(hist_data, val_idx, file, var_name, expr_str, flags);
2914     + ret = __create_val_field(hist_data, val_idx, file, var_name, expr_str, flags);
2915     +
2916     + if (hist_data->fields[val_idx]->flags & HIST_FIELD_FL_STRING)
2917     + hist_data->fields[val_idx]->var_str_idx = hist_data->n_var_str++;
2918     +
2919     + return ret;
2920     }
2921    
2922     static int create_val_fields(struct hist_trigger_data *hist_data,
2923     @@ -5333,6 +5348,22 @@ static void hist_trigger_elt_update(struct hist_trigger_data *hist_data,
2924     hist_val = hist_field->fn(hist_field, elt, rbe, rec);
2925     if (hist_field->flags & HIST_FIELD_FL_VAR) {
2926     var_idx = hist_field->var.idx;
2927     +
2928     + if (hist_field->flags & HIST_FIELD_FL_STRING) {
2929     + unsigned int str_start, var_str_idx, idx;
2930     + char *str, *val_str;
2931     +
2932     + str_start = hist_data->n_field_var_str +
2933     + hist_data->n_save_var_str;
2934     + var_str_idx = hist_field->var_str_idx;
2935     + idx = str_start + var_str_idx;
2936     +
2937     + str = elt_data->field_var_str[idx];
2938     + val_str = (char *)(uintptr_t)hist_val;
2939     + strscpy(str, val_str, hist_field->size);
2940     +
2941     + hist_val = (u64)(uintptr_t)str;
2942     + }
2943     tracing_map_set_var(elt, var_idx, hist_val);
2944     continue;
2945     }
2946     diff --git a/mm/hugetlb.c b/mm/hugetlb.c
2947     index 95a32749af4da..20da6ede77041 100644
2948     --- a/mm/hugetlb.c
2949     +++ b/mm/hugetlb.c
2950     @@ -3589,6 +3589,7 @@ void __unmap_hugepage_range(struct mmu_gather *tlb, struct vm_area_struct *vma,
2951     struct hstate *h = hstate_vma(vma);
2952     unsigned long sz = huge_page_size(h);
2953     struct mmu_notifier_range range;
2954     + bool force_flush = false;
2955    
2956     WARN_ON(!is_vm_hugetlb_page(vma));
2957     BUG_ON(start & ~huge_page_mask(h));
2958     @@ -3617,10 +3618,8 @@ void __unmap_hugepage_range(struct mmu_gather *tlb, struct vm_area_struct *vma,
2959     ptl = huge_pte_lock(h, mm, ptep);
2960     if (huge_pmd_unshare(mm, &address, ptep)) {
2961     spin_unlock(ptl);
2962     - /*
2963     - * We just unmapped a page of PMDs by clearing a PUD.
2964     - * The caller's TLB flush range should cover this area.
2965     - */
2966     + tlb_flush_pmd_range(tlb, address & PUD_MASK, PUD_SIZE);
2967     + force_flush = true;
2968     continue;
2969     }
2970    
2971     @@ -3677,6 +3676,22 @@ void __unmap_hugepage_range(struct mmu_gather *tlb, struct vm_area_struct *vma,
2972     }
2973     mmu_notifier_invalidate_range_end(&range);
2974     tlb_end_vma(tlb, vma);
2975     +
2976     + /*
2977     + * If we unshared PMDs, the TLB flush was not recorded in mmu_gather. We
2978     + * could defer the flush until now, since by holding i_mmap_rwsem we
2979     + * guaranteed that the last refernece would not be dropped. But we must
2980     + * do the flushing before we return, as otherwise i_mmap_rwsem will be
2981     + * dropped and the last reference to the shared PMDs page might be
2982     + * dropped as well.
2983     + *
2984     + * In theory we could defer the freeing of the PMD pages as well, but
2985     + * huge_pmd_unshare() relies on the exact page_count for the PMD page to
2986     + * detect sharing, so we cannot defer the release of the page either.
2987     + * Instead, do flush now.
2988     + */
2989     + if (force_flush)
2990     + tlb_flush_mmu_tlbonly(tlb);
2991     }
2992    
2993     void __unmap_hugepage_range_final(struct mmu_gather *tlb,
2994     diff --git a/mm/slab.h b/mm/slab.h
2995     index b2b01694dc43f..61feda3d7e008 100644
2996     --- a/mm/slab.h
2997     +++ b/mm/slab.h
2998     @@ -211,7 +211,7 @@ static inline slab_flags_t kmem_cache_flags(unsigned int object_size,
2999     #define SLAB_CACHE_FLAGS (SLAB_NOLEAKTRACE | SLAB_RECLAIM_ACCOUNT | \
3000     SLAB_TEMPORARY | SLAB_ACCOUNT)
3001     #else
3002     -#define SLAB_CACHE_FLAGS (0)
3003     +#define SLAB_CACHE_FLAGS (SLAB_NOLEAKTRACE)
3004     #endif
3005    
3006     /* Common flags available with current configuration */
3007     diff --git a/net/batman-adv/fragmentation.c b/net/batman-adv/fragmentation.c
3008     index 385fccdcf69d0..0da90e73c79bf 100644
3009     --- a/net/batman-adv/fragmentation.c
3010     +++ b/net/batman-adv/fragmentation.c
3011     @@ -391,6 +391,7 @@ out:
3012    
3013     /**
3014     * batadv_frag_create() - create a fragment from skb
3015     + * @net_dev: outgoing device for fragment
3016     * @skb: skb to create fragment from
3017     * @frag_head: header to use in new fragment
3018     * @fragment_size: size of new fragment
3019     @@ -401,22 +402,25 @@ out:
3020     *
3021     * Return: the new fragment, NULL on error.
3022     */
3023     -static struct sk_buff *batadv_frag_create(struct sk_buff *skb,
3024     +static struct sk_buff *batadv_frag_create(struct net_device *net_dev,
3025     + struct sk_buff *skb,
3026     struct batadv_frag_packet *frag_head,
3027     unsigned int fragment_size)
3028     {
3029     + unsigned int ll_reserved = LL_RESERVED_SPACE(net_dev);
3030     + unsigned int tailroom = net_dev->needed_tailroom;
3031     struct sk_buff *skb_fragment;
3032     unsigned int header_size = sizeof(*frag_head);
3033     unsigned int mtu = fragment_size + header_size;
3034    
3035     - skb_fragment = netdev_alloc_skb(NULL, mtu + ETH_HLEN);
3036     + skb_fragment = dev_alloc_skb(ll_reserved + mtu + tailroom);
3037     if (!skb_fragment)
3038     goto err;
3039    
3040     skb_fragment->priority = skb->priority;
3041    
3042     /* Eat the last mtu-bytes of the skb */
3043     - skb_reserve(skb_fragment, header_size + ETH_HLEN);
3044     + skb_reserve(skb_fragment, ll_reserved + header_size);
3045     skb_split(skb, skb_fragment, skb->len - fragment_size);
3046    
3047     /* Add the header */
3048     @@ -439,11 +443,12 @@ int batadv_frag_send_packet(struct sk_buff *skb,
3049     struct batadv_orig_node *orig_node,
3050     struct batadv_neigh_node *neigh_node)
3051     {
3052     + struct net_device *net_dev = neigh_node->if_incoming->net_dev;
3053     struct batadv_priv *bat_priv;
3054     struct batadv_hard_iface *primary_if = NULL;
3055     struct batadv_frag_packet frag_header;
3056     struct sk_buff *skb_fragment;
3057     - unsigned int mtu = neigh_node->if_incoming->net_dev->mtu;
3058     + unsigned int mtu = net_dev->mtu;
3059     unsigned int header_size = sizeof(frag_header);
3060     unsigned int max_fragment_size, num_fragments;
3061     int ret;
3062     @@ -503,7 +508,7 @@ int batadv_frag_send_packet(struct sk_buff *skb,
3063     goto put_primary_if;
3064     }
3065    
3066     - skb_fragment = batadv_frag_create(skb, &frag_header,
3067     + skb_fragment = batadv_frag_create(net_dev, skb, &frag_header,
3068     max_fragment_size);
3069     if (!skb_fragment) {
3070     ret = -ENOMEM;
3071     @@ -522,13 +527,14 @@ int batadv_frag_send_packet(struct sk_buff *skb,
3072     frag_header.no++;
3073     }
3074    
3075     - /* Make room for the fragment header. */
3076     - if (batadv_skb_head_push(skb, header_size) < 0 ||
3077     - pskb_expand_head(skb, header_size + ETH_HLEN, 0, GFP_ATOMIC) < 0) {
3078     - ret = -ENOMEM;
3079     + /* make sure that there is at least enough head for the fragmentation
3080     + * and ethernet headers
3081     + */
3082     + ret = skb_cow_head(skb, ETH_HLEN + header_size);
3083     + if (ret < 0)
3084     goto put_primary_if;
3085     - }
3086    
3087     + skb_push(skb, header_size);
3088     memcpy(skb->data, &frag_header, header_size);
3089    
3090     /* Send the last fragment */
3091     diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
3092     index afb52282d5bd0..18e644f3cb309 100644
3093     --- a/net/batman-adv/hard-interface.c
3094     +++ b/net/batman-adv/hard-interface.c
3095     @@ -554,6 +554,9 @@ static void batadv_hardif_recalc_extra_skbroom(struct net_device *soft_iface)
3096     needed_headroom = lower_headroom + (lower_header_len - ETH_HLEN);
3097     needed_headroom += batadv_max_header_len();
3098    
3099     + /* fragmentation headers don't strip the unicast/... header */
3100     + needed_headroom += sizeof(struct batadv_frag_packet);
3101     +
3102     soft_iface->needed_headroom = needed_headroom;
3103     soft_iface->needed_tailroom = lower_tailroom;
3104     }
3105     diff --git a/net/nfc/core.c b/net/nfc/core.c
3106     index c5f9c3ee82f8e..e752692d36802 100644
3107     --- a/net/nfc/core.c
3108     +++ b/net/nfc/core.c
3109     @@ -94,13 +94,13 @@ int nfc_dev_up(struct nfc_dev *dev)
3110    
3111     device_lock(&dev->dev);
3112    
3113     - if (dev->rfkill && rfkill_blocked(dev->rfkill)) {
3114     - rc = -ERFKILL;
3115     + if (!device_is_registered(&dev->dev)) {
3116     + rc = -ENODEV;
3117     goto error;
3118     }
3119    
3120     - if (!device_is_registered(&dev->dev)) {
3121     - rc = -ENODEV;
3122     + if (dev->rfkill && rfkill_blocked(dev->rfkill)) {
3123     + rc = -ERFKILL;
3124     goto error;
3125     }
3126    
3127     @@ -1118,11 +1118,7 @@ int nfc_register_device(struct nfc_dev *dev)
3128     if (rc)
3129     pr_err("Could not register llcp device\n");
3130    
3131     - rc = nfc_genl_device_added(dev);
3132     - if (rc)
3133     - pr_debug("The userspace won't be notified that the device %s was added\n",
3134     - dev_name(&dev->dev));
3135     -
3136     + device_lock(&dev->dev);
3137     dev->rfkill = rfkill_alloc(dev_name(&dev->dev), &dev->dev,
3138     RFKILL_TYPE_NFC, &nfc_rfkill_ops, dev);
3139     if (dev->rfkill) {
3140     @@ -1131,6 +1127,12 @@ int nfc_register_device(struct nfc_dev *dev)
3141     dev->rfkill = NULL;
3142     }
3143     }
3144     + device_unlock(&dev->dev);
3145     +
3146     + rc = nfc_genl_device_added(dev);
3147     + if (rc)
3148     + pr_debug("The userspace won't be notified that the device %s was added\n",
3149     + dev_name(&dev->dev));
3150    
3151     return 0;
3152     }
3153     @@ -1147,10 +1149,17 @@ void nfc_unregister_device(struct nfc_dev *dev)
3154    
3155     pr_debug("dev_name=%s\n", dev_name(&dev->dev));
3156    
3157     + rc = nfc_genl_device_removed(dev);
3158     + if (rc)
3159     + pr_debug("The userspace won't be notified that the device %s "
3160     + "was removed\n", dev_name(&dev->dev));
3161     +
3162     + device_lock(&dev->dev);
3163     if (dev->rfkill) {
3164     rfkill_unregister(dev->rfkill);
3165     rfkill_destroy(dev->rfkill);
3166     }
3167     + device_unlock(&dev->dev);
3168    
3169     if (dev->ops->check_presence) {
3170     device_lock(&dev->dev);
3171     @@ -1160,11 +1169,6 @@ void nfc_unregister_device(struct nfc_dev *dev)
3172     cancel_work_sync(&dev->check_pres_work);
3173     }
3174    
3175     - rc = nfc_genl_device_removed(dev);
3176     - if (rc)
3177     - pr_debug("The userspace won't be notified that the device %s "
3178     - "was removed\n", dev_name(&dev->dev));
3179     -
3180     nfc_llcp_unregister_device(dev);
3181    
3182     mutex_lock(&nfc_devlist_mutex);
3183     diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c
3184     index 6a34a0a786eaa..1d0aa9e6044bf 100644
3185     --- a/net/nfc/nci/core.c
3186     +++ b/net/nfc/nci/core.c
3187     @@ -144,12 +144,15 @@ inline int nci_request(struct nci_dev *ndev,
3188     {
3189     int rc;
3190    
3191     - if (!test_bit(NCI_UP, &ndev->flags))
3192     - return -ENETDOWN;
3193     -
3194     /* Serialize all requests */
3195     mutex_lock(&ndev->req_lock);
3196     - rc = __nci_request(ndev, req, opt, timeout);
3197     + /* check the state after obtaing the lock against any races
3198     + * from nci_close_device when the device gets removed.
3199     + */
3200     + if (test_bit(NCI_UP, &ndev->flags))
3201     + rc = __nci_request(ndev, req, opt, timeout);
3202     + else
3203     + rc = -ENETDOWN;
3204     mutex_unlock(&ndev->req_lock);
3205    
3206     return rc;
3207     diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c
3208     index e3ff884a48c56..b87d2a1ee0b16 100644
3209     --- a/net/sched/act_mirred.c
3210     +++ b/net/sched/act_mirred.c
3211     @@ -19,6 +19,7 @@
3212     #include <linux/if_arp.h>
3213     #include <net/net_namespace.h>
3214     #include <net/netlink.h>
3215     +#include <net/dst.h>
3216     #include <net/pkt_sched.h>
3217     #include <net/pkt_cls.h>
3218     #include <linux/tc_act/tc_mirred.h>
3219     @@ -218,6 +219,7 @@ static int tcf_mirred_act(struct sk_buff *skb, const struct tc_action *a,
3220     bool want_ingress;
3221     bool is_redirect;
3222     bool expects_nh;
3223     + bool at_ingress;
3224     int m_eaction;
3225     int mac_len;
3226     bool at_nh;
3227     @@ -253,7 +255,8 @@ static int tcf_mirred_act(struct sk_buff *skb, const struct tc_action *a,
3228     * ingress - that covers the TC S/W datapath.
3229     */
3230     is_redirect = tcf_mirred_is_act_redirect(m_eaction);
3231     - use_reinsert = skb_at_tc_ingress(skb) && is_redirect &&
3232     + at_ingress = skb_at_tc_ingress(skb);
3233     + use_reinsert = at_ingress && is_redirect &&
3234     tcf_mirred_can_reinsert(retval);
3235     if (!use_reinsert) {
3236     skb2 = skb_clone(skb, GFP_ATOMIC);
3237     @@ -261,10 +264,12 @@ static int tcf_mirred_act(struct sk_buff *skb, const struct tc_action *a,
3238     goto out;
3239     }
3240    
3241     + want_ingress = tcf_mirred_act_wants_ingress(m_eaction);
3242     +
3243     /* All mirred/redirected skbs should clear previous ct info */
3244     nf_reset_ct(skb2);
3245     -
3246     - want_ingress = tcf_mirred_act_wants_ingress(m_eaction);
3247     + if (want_ingress && !at_ingress) /* drop dst for egress -> ingress */
3248     + skb_dst_drop(skb2);
3249    
3250     expects_nh = want_ingress || !m_mac_header_xmit;
3251     at_nh = skb->data == skb_network_header(skb);
3252     diff --git a/net/wireless/util.c b/net/wireless/util.c
3253     index aaefaf3422a1a..95533732f9d6f 100644
3254     --- a/net/wireless/util.c
3255     +++ b/net/wireless/util.c
3256     @@ -991,6 +991,7 @@ int cfg80211_change_iface(struct cfg80211_registered_device *rdev,
3257    
3258     switch (otype) {
3259     case NL80211_IFTYPE_AP:
3260     + case NL80211_IFTYPE_P2P_GO:
3261     cfg80211_stop_ap(rdev, dev, true);
3262     break;
3263     case NL80211_IFTYPE_ADHOC:
3264     diff --git a/sound/core/Makefile b/sound/core/Makefile
3265     index ee4a4a6b99ba7..d123587c0fd8f 100644
3266     --- a/sound/core/Makefile
3267     +++ b/sound/core/Makefile
3268     @@ -9,7 +9,9 @@ ifneq ($(CONFIG_SND_PROC_FS),)
3269     snd-y += info.o
3270     snd-$(CONFIG_SND_OSSEMUL) += info_oss.o
3271     endif
3272     +ifneq ($(CONFIG_M68K),y)
3273     snd-$(CONFIG_ISA_DMA_API) += isadma.o
3274     +endif
3275     snd-$(CONFIG_SND_OSSEMUL) += sound_oss.o
3276     snd-$(CONFIG_SND_VMASTER) += vmaster.o
3277     snd-$(CONFIG_SND_JACK) += ctljack.o jack.o
3278     diff --git a/sound/hda/ext/hdac_ext_stream.c b/sound/hda/ext/hdac_ext_stream.c
3279     index 6b1b4b834baef..04f4070fbf366 100644
3280     --- a/sound/hda/ext/hdac_ext_stream.c
3281     +++ b/sound/hda/ext/hdac_ext_stream.c
3282     @@ -106,20 +106,14 @@ void snd_hdac_stream_free_all(struct hdac_bus *bus)
3283     }
3284     EXPORT_SYMBOL_GPL(snd_hdac_stream_free_all);
3285    
3286     -/**
3287     - * snd_hdac_ext_stream_decouple - decouple the hdac stream
3288     - * @bus: HD-audio core bus
3289     - * @stream: HD-audio ext core stream object to initialize
3290     - * @decouple: flag to decouple
3291     - */
3292     -void snd_hdac_ext_stream_decouple(struct hdac_bus *bus,
3293     - struct hdac_ext_stream *stream, bool decouple)
3294     +void snd_hdac_ext_stream_decouple_locked(struct hdac_bus *bus,
3295     + struct hdac_ext_stream *stream,
3296     + bool decouple)
3297     {
3298     struct hdac_stream *hstream = &stream->hstream;
3299     u32 val;
3300     int mask = AZX_PPCTL_PROCEN(hstream->index);
3301    
3302     - spin_lock_irq(&bus->reg_lock);
3303     val = readw(bus->ppcap + AZX_REG_PP_PPCTL) & mask;
3304    
3305     if (decouple && !val)
3306     @@ -128,6 +122,20 @@ void snd_hdac_ext_stream_decouple(struct hdac_bus *bus,
3307     snd_hdac_updatel(bus->ppcap, AZX_REG_PP_PPCTL, mask, 0);
3308    
3309     stream->decoupled = decouple;
3310     +}
3311     +EXPORT_SYMBOL_GPL(snd_hdac_ext_stream_decouple_locked);
3312     +
3313     +/**
3314     + * snd_hdac_ext_stream_decouple - decouple the hdac stream
3315     + * @bus: HD-audio core bus
3316     + * @stream: HD-audio ext core stream object to initialize
3317     + * @decouple: flag to decouple
3318     + */
3319     +void snd_hdac_ext_stream_decouple(struct hdac_bus *bus,
3320     + struct hdac_ext_stream *stream, bool decouple)
3321     +{
3322     + spin_lock_irq(&bus->reg_lock);
3323     + snd_hdac_ext_stream_decouple_locked(bus, stream, decouple);
3324     spin_unlock_irq(&bus->reg_lock);
3325     }
3326     EXPORT_SYMBOL_GPL(snd_hdac_ext_stream_decouple);
3327     @@ -252,6 +260,7 @@ hdac_ext_link_stream_assign(struct hdac_bus *bus,
3328     return NULL;
3329     }
3330    
3331     + spin_lock_irq(&bus->reg_lock);
3332     list_for_each_entry(stream, &bus->stream_list, list) {
3333     struct hdac_ext_stream *hstream = container_of(stream,
3334     struct hdac_ext_stream,
3335     @@ -266,17 +275,16 @@ hdac_ext_link_stream_assign(struct hdac_bus *bus,
3336     }
3337    
3338     if (!hstream->link_locked) {
3339     - snd_hdac_ext_stream_decouple(bus, hstream, true);
3340     + snd_hdac_ext_stream_decouple_locked(bus, hstream, true);
3341     res = hstream;
3342     break;
3343     }
3344     }
3345     if (res) {
3346     - spin_lock_irq(&bus->reg_lock);
3347     res->link_locked = 1;
3348     res->link_substream = substream;
3349     - spin_unlock_irq(&bus->reg_lock);
3350     }
3351     + spin_unlock_irq(&bus->reg_lock);
3352     return res;
3353     }
3354    
3355     @@ -292,6 +300,7 @@ hdac_ext_host_stream_assign(struct hdac_bus *bus,
3356     return NULL;
3357     }
3358    
3359     + spin_lock_irq(&bus->reg_lock);
3360     list_for_each_entry(stream, &bus->stream_list, list) {
3361     struct hdac_ext_stream *hstream = container_of(stream,
3362     struct hdac_ext_stream,
3363     @@ -301,18 +310,17 @@ hdac_ext_host_stream_assign(struct hdac_bus *bus,
3364    
3365     if (!stream->opened) {
3366     if (!hstream->decoupled)
3367     - snd_hdac_ext_stream_decouple(bus, hstream, true);
3368     + snd_hdac_ext_stream_decouple_locked(bus, hstream, true);
3369     res = hstream;
3370     break;
3371     }
3372     }
3373     if (res) {
3374     - spin_lock_irq(&bus->reg_lock);
3375     res->hstream.opened = 1;
3376     res->hstream.running = 0;
3377     res->hstream.substream = substream;
3378     - spin_unlock_irq(&bus->reg_lock);
3379     }
3380     + spin_unlock_irq(&bus->reg_lock);
3381    
3382     return res;
3383     }
3384     @@ -378,15 +386,17 @@ void snd_hdac_ext_stream_release(struct hdac_ext_stream *stream, int type)
3385     break;
3386    
3387     case HDAC_EXT_STREAM_TYPE_HOST:
3388     + spin_lock_irq(&bus->reg_lock);
3389     if (stream->decoupled && !stream->link_locked)
3390     - snd_hdac_ext_stream_decouple(bus, stream, false);
3391     + snd_hdac_ext_stream_decouple_locked(bus, stream, false);
3392     + spin_unlock_irq(&bus->reg_lock);
3393     snd_hdac_stream_release(&stream->hstream);
3394     break;
3395    
3396     case HDAC_EXT_STREAM_TYPE_LINK:
3397     - if (stream->decoupled && !stream->hstream.opened)
3398     - snd_hdac_ext_stream_decouple(bus, stream, false);
3399     spin_lock_irq(&bus->reg_lock);
3400     + if (stream->decoupled && !stream->hstream.opened)
3401     + snd_hdac_ext_stream_decouple_locked(bus, stream, false);
3402     stream->link_locked = 0;
3403     stream->link_substream = NULL;
3404     spin_unlock_irq(&bus->reg_lock);
3405     diff --git a/sound/hda/hdac_stream.c b/sound/hda/hdac_stream.c
3406     index 682ed39f79b01..b299b8b7f871a 100644
3407     --- a/sound/hda/hdac_stream.c
3408     +++ b/sound/hda/hdac_stream.c
3409     @@ -289,6 +289,7 @@ struct hdac_stream *snd_hdac_stream_assign(struct hdac_bus *bus,
3410     int key = (substream->pcm->device << 16) | (substream->number << 2) |
3411     (substream->stream + 1);
3412    
3413     + spin_lock_irq(&bus->reg_lock);
3414     list_for_each_entry(azx_dev, &bus->stream_list, list) {
3415     if (azx_dev->direction != substream->stream)
3416     continue;
3417     @@ -302,13 +303,12 @@ struct hdac_stream *snd_hdac_stream_assign(struct hdac_bus *bus,
3418     res = azx_dev;
3419     }
3420     if (res) {
3421     - spin_lock_irq(&bus->reg_lock);
3422     res->opened = 1;
3423     res->running = 0;
3424     res->assigned_key = key;
3425     res->substream = substream;
3426     - spin_unlock_irq(&bus->reg_lock);
3427     }
3428     + spin_unlock_irq(&bus->reg_lock);
3429     return res;
3430     }
3431     EXPORT_SYMBOL_GPL(snd_hdac_stream_assign);
3432     diff --git a/sound/isa/Kconfig b/sound/isa/Kconfig
3433     index b690ed937cbe8..df2e45c8814e9 100644
3434     --- a/sound/isa/Kconfig
3435     +++ b/sound/isa/Kconfig
3436     @@ -22,7 +22,7 @@ config SND_SB16_DSP
3437     menuconfig SND_ISA
3438     bool "ISA sound devices"
3439     depends on ISA || COMPILE_TEST
3440     - depends on ISA_DMA_API
3441     + depends on ISA_DMA_API && !M68K
3442     default y
3443     help
3444     Support for sound devices connected via the ISA bus.
3445     diff --git a/sound/isa/gus/gus_dma.c b/sound/isa/gus/gus_dma.c
3446     index a1c770d826dda..6d664dd8dde0b 100644
3447     --- a/sound/isa/gus/gus_dma.c
3448     +++ b/sound/isa/gus/gus_dma.c
3449     @@ -126,6 +126,8 @@ static void snd_gf1_dma_interrupt(struct snd_gus_card * gus)
3450     }
3451     block = snd_gf1_dma_next_block(gus);
3452     spin_unlock(&gus->dma_lock);
3453     + if (!block)
3454     + return;
3455     snd_gf1_dma_program(gus, block->addr, block->buf_addr, block->count, (unsigned short) block->cmd);
3456     kfree(block);
3457     #if 0
3458     diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig
3459     index 7630f808d087c..6edde2f145025 100644
3460     --- a/sound/pci/Kconfig
3461     +++ b/sound/pci/Kconfig
3462     @@ -279,6 +279,7 @@ config SND_CS46XX_NEW_DSP
3463     config SND_CS5530
3464     tristate "CS5530 Audio"
3465     depends on ISA_DMA_API && (X86_32 || COMPILE_TEST)
3466     + depends on !M68K
3467     select SND_SB16_DSP
3468     help
3469     Say Y here to include support for audio on Cyrix/NatSemi CS5530 chips.
3470     diff --git a/sound/soc/codecs/nau8824.c b/sound/soc/codecs/nau8824.c
3471     index 15bd8335f6678..c8ccfa2fff848 100644
3472     --- a/sound/soc/codecs/nau8824.c
3473     +++ b/sound/soc/codecs/nau8824.c
3474     @@ -8,6 +8,7 @@
3475    
3476     #include <linux/module.h>
3477     #include <linux/delay.h>
3478     +#include <linux/dmi.h>
3479     #include <linux/init.h>
3480     #include <linux/i2c.h>
3481     #include <linux/regmap.h>
3482     @@ -27,6 +28,12 @@
3483    
3484     #include "nau8824.h"
3485    
3486     +#define NAU8824_JD_ACTIVE_HIGH BIT(0)
3487     +
3488     +static int nau8824_quirk;
3489     +static int quirk_override = -1;
3490     +module_param_named(quirk, quirk_override, uint, 0444);
3491     +MODULE_PARM_DESC(quirk, "Board-specific quirk override");
3492    
3493     static int nau8824_config_sysclk(struct nau8824 *nau8824,
3494     int clk_id, unsigned int freq);
3495     @@ -1875,6 +1882,34 @@ static int nau8824_read_device_properties(struct device *dev,
3496     return 0;
3497     }
3498    
3499     +/* Please keep this list alphabetically sorted */
3500     +static const struct dmi_system_id nau8824_quirk_table[] = {
3501     + {
3502     + /* Cyberbook T116 rugged tablet */
3503     + .matches = {
3504     + DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Default string"),
3505     + DMI_EXACT_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"),
3506     + DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "20170531"),
3507     + },
3508     + .driver_data = (void *)(NAU8824_JD_ACTIVE_HIGH),
3509     + },
3510     + {}
3511     +};
3512     +
3513     +static void nau8824_check_quirks(void)
3514     +{
3515     + const struct dmi_system_id *dmi_id;
3516     +
3517     + if (quirk_override != -1) {
3518     + nau8824_quirk = quirk_override;
3519     + return;
3520     + }
3521     +
3522     + dmi_id = dmi_first_match(nau8824_quirk_table);
3523     + if (dmi_id)
3524     + nau8824_quirk = (unsigned long)dmi_id->driver_data;
3525     +}
3526     +
3527     static int nau8824_i2c_probe(struct i2c_client *i2c,
3528     const struct i2c_device_id *id)
3529     {
3530     @@ -1899,6 +1934,11 @@ static int nau8824_i2c_probe(struct i2c_client *i2c,
3531     nau8824->irq = i2c->irq;
3532     sema_init(&nau8824->jd_sem, 1);
3533    
3534     + nau8824_check_quirks();
3535     +
3536     + if (nau8824_quirk & NAU8824_JD_ACTIVE_HIGH)
3537     + nau8824->jkdet_polarity = 0;
3538     +
3539     nau8824_print_device_properties(nau8824);
3540    
3541     ret = regmap_read(nau8824->regmap, NAU8824_REG_I2C_DEVICE_ID, &value);
3542     diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
3543     index 66f6b698a5436..5876be5dd9bae 100644
3544     --- a/sound/soc/soc-dapm.c
3545     +++ b/sound/soc/soc-dapm.c
3546     @@ -2542,8 +2542,13 @@ static struct snd_soc_dapm_widget *dapm_find_widget(
3547     return NULL;
3548     }
3549    
3550     -static int snd_soc_dapm_set_pin(struct snd_soc_dapm_context *dapm,
3551     - const char *pin, int status)
3552     +/*
3553     + * set the DAPM pin status:
3554     + * returns 1 when the value has been updated, 0 when unchanged, or a negative
3555     + * error code; called from kcontrol put callback
3556     + */
3557     +static int __snd_soc_dapm_set_pin(struct snd_soc_dapm_context *dapm,
3558     + const char *pin, int status)
3559     {
3560     struct snd_soc_dapm_widget *w = dapm_find_widget(dapm, pin, true);
3561     int ret = 0;
3562     @@ -2569,6 +2574,18 @@ static int snd_soc_dapm_set_pin(struct snd_soc_dapm_context *dapm,
3563     return ret;
3564     }
3565    
3566     +/*
3567     + * similar as __snd_soc_dapm_set_pin(), but returns 0 when successful;
3568     + * called from several API functions below
3569     + */
3570     +static int snd_soc_dapm_set_pin(struct snd_soc_dapm_context *dapm,
3571     + const char *pin, int status)
3572     +{
3573     + int ret = __snd_soc_dapm_set_pin(dapm, pin, status);
3574     +
3575     + return ret < 0 ? ret : 0;
3576     +}
3577     +
3578     /**
3579     * snd_soc_dapm_sync_unlocked - scan and power dapm paths
3580     * @dapm: DAPM context
3581     @@ -3584,10 +3601,10 @@ int snd_soc_dapm_put_pin_switch(struct snd_kcontrol *kcontrol,
3582     const char *pin = (const char *)kcontrol->private_value;
3583     int ret;
3584    
3585     - if (ucontrol->value.integer.value[0])
3586     - ret = snd_soc_dapm_enable_pin(&card->dapm, pin);
3587     - else
3588     - ret = snd_soc_dapm_disable_pin(&card->dapm, pin);
3589     + mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
3590     + ret = __snd_soc_dapm_set_pin(&card->dapm, pin,
3591     + !!ucontrol->value.integer.value[0]);
3592     + mutex_unlock(&card->dapm_mutex);
3593    
3594     snd_soc_dapm_sync(&card->dapm);
3595     return ret;
3596     diff --git a/sound/soc/sof/intel/hda-dai.c b/sound/soc/sof/intel/hda-dai.c
3597     index 3f645200d3a5c..b3cdd10c83ae1 100644
3598     --- a/sound/soc/sof/intel/hda-dai.c
3599     +++ b/sound/soc/sof/intel/hda-dai.c
3600     @@ -67,6 +67,7 @@ static struct hdac_ext_stream *
3601     return NULL;
3602     }
3603    
3604     + spin_lock_irq(&bus->reg_lock);
3605     list_for_each_entry(stream, &bus->stream_list, list) {
3606     struct hdac_ext_stream *hstream =
3607     stream_to_hdac_ext_stream(stream);
3608     @@ -106,12 +107,12 @@ static struct hdac_ext_stream *
3609     * is updated in snd_hdac_ext_stream_decouple().
3610     */
3611     if (!res->decoupled)
3612     - snd_hdac_ext_stream_decouple(bus, res, true);
3613     - spin_lock_irq(&bus->reg_lock);
3614     + snd_hdac_ext_stream_decouple_locked(bus, res, true);
3615     +
3616     res->link_locked = 1;
3617     res->link_substream = substream;
3618     - spin_unlock_irq(&bus->reg_lock);
3619     }
3620     + spin_unlock_irq(&bus->reg_lock);
3621    
3622     return res;
3623     }
3624     diff --git a/tools/perf/bench/futex-lock-pi.c b/tools/perf/bench/futex-lock-pi.c
3625     index 30d97121dc4fb..c54013806ba4a 100644
3626     --- a/tools/perf/bench/futex-lock-pi.c
3627     +++ b/tools/perf/bench/futex-lock-pi.c
3628     @@ -224,6 +224,7 @@ int bench_futex_lock_pi(int argc, const char **argv)
3629     print_summary();
3630    
3631     free(worker);
3632     + perf_cpu_map__put(cpu);
3633     return ret;
3634     err:
3635     usage_with_options(bench_futex_lock_pi_usage, options);
3636     diff --git a/tools/perf/bench/futex-requeue.c b/tools/perf/bench/futex-requeue.c
3637     index a00a6891447ab..11b7dbd374864 100644
3638     --- a/tools/perf/bench/futex-requeue.c
3639     +++ b/tools/perf/bench/futex-requeue.c
3640     @@ -215,6 +215,7 @@ int bench_futex_requeue(int argc, const char **argv)
3641     print_summary();
3642    
3643     free(worker);
3644     + perf_cpu_map__put(cpu);
3645     return ret;
3646     err:
3647     usage_with_options(bench_futex_requeue_usage, options);
3648     diff --git a/tools/perf/bench/futex-wake-parallel.c b/tools/perf/bench/futex-wake-parallel.c
3649     index a053cf2b70397..c3033d0905db1 100644
3650     --- a/tools/perf/bench/futex-wake-parallel.c
3651     +++ b/tools/perf/bench/futex-wake-parallel.c
3652     @@ -319,6 +319,7 @@ int bench_futex_wake_parallel(int argc, const char **argv)
3653     print_summary();
3654    
3655     free(blocked_worker);
3656     + perf_cpu_map__put(cpu);
3657     return ret;
3658     }
3659     #endif /* HAVE_PTHREAD_BARRIER */
3660     diff --git a/tools/perf/bench/futex-wake.c b/tools/perf/bench/futex-wake.c
3661     index 58906e9499bb0..ad44a78392dc4 100644
3662     --- a/tools/perf/bench/futex-wake.c
3663     +++ b/tools/perf/bench/futex-wake.c
3664     @@ -209,5 +209,6 @@ int bench_futex_wake(int argc, const char **argv)
3665     print_summary();
3666    
3667     free(worker);
3668     + perf_cpu_map__put(cpu);
3669     return ret;
3670     }
3671     diff --git a/tools/perf/tests/shell/record+zstd_comp_decomp.sh b/tools/perf/tests/shell/record+zstd_comp_decomp.sh
3672     index 045723b3d9928..c62af807198de 100755
3673     --- a/tools/perf/tests/shell/record+zstd_comp_decomp.sh
3674     +++ b/tools/perf/tests/shell/record+zstd_comp_decomp.sh
3675     @@ -12,7 +12,7 @@ skip_if_no_z_record() {
3676    
3677     collect_z_record() {
3678     echo "Collecting compressed record file:"
3679     - [[ "$(uname -m)" != s390x ]] && gflag='-g'
3680     + [ "$(uname -m)" != s390x ] && gflag='-g'
3681     $perf_tool record -o $trace_file $gflag -z -F 5000 -- \
3682     dd count=500 if=/dev/urandom of=/dev/null
3683     }
3684     diff --git a/tools/perf/util/bpf-event.c b/tools/perf/util/bpf-event.c
3685     index c766813d56be0..782c0c8a9a836 100644
3686     --- a/tools/perf/util/bpf-event.c
3687     +++ b/tools/perf/util/bpf-event.c
3688     @@ -108,7 +108,11 @@ static int perf_env__fetch_btf(struct perf_env *env,
3689     node->data_size = data_size;
3690     memcpy(node->data, data, data_size);
3691    
3692     - perf_env__insert_btf(env, node);
3693     + if (!perf_env__insert_btf(env, node)) {
3694     + /* Insertion failed because of a duplicate. */
3695     + free(node);
3696     + return -1;
3697     + }
3698     return 0;
3699     }
3700    
3701     diff --git a/tools/perf/util/env.c b/tools/perf/util/env.c
3702     index 0fafcf264d235..ef64e197bc8df 100644
3703     --- a/tools/perf/util/env.c
3704     +++ b/tools/perf/util/env.c
3705     @@ -69,12 +69,13 @@ out:
3706     return node;
3707     }
3708    
3709     -void perf_env__insert_btf(struct perf_env *env, struct btf_node *btf_node)
3710     +bool perf_env__insert_btf(struct perf_env *env, struct btf_node *btf_node)
3711     {
3712     struct rb_node *parent = NULL;
3713     __u32 btf_id = btf_node->id;
3714     struct btf_node *node;
3715     struct rb_node **p;
3716     + bool ret = true;
3717    
3718     down_write(&env->bpf_progs.lock);
3719     p = &env->bpf_progs.btfs.rb_node;
3720     @@ -88,6 +89,7 @@ void perf_env__insert_btf(struct perf_env *env, struct btf_node *btf_node)
3721     p = &(*p)->rb_right;
3722     } else {
3723     pr_debug("duplicated btf %u\n", btf_id);
3724     + ret = false;
3725     goto out;
3726     }
3727     }
3728     @@ -97,6 +99,7 @@ void perf_env__insert_btf(struct perf_env *env, struct btf_node *btf_node)
3729     env->bpf_progs.btfs_cnt++;
3730     out:
3731     up_write(&env->bpf_progs.lock);
3732     + return ret;
3733     }
3734    
3735     struct btf_node *perf_env__find_btf(struct perf_env *env, __u32 btf_id)
3736     diff --git a/tools/perf/util/env.h b/tools/perf/util/env.h
3737     index db40906e29373..37028215d4a53 100644
3738     --- a/tools/perf/util/env.h
3739     +++ b/tools/perf/util/env.h
3740     @@ -117,6 +117,6 @@ void perf_env__insert_bpf_prog_info(struct perf_env *env,
3741     struct bpf_prog_info_node *info_node);
3742     struct bpf_prog_info_node *perf_env__find_bpf_prog_info(struct perf_env *env,
3743     __u32 prog_id);
3744     -void perf_env__insert_btf(struct perf_env *env, struct btf_node *btf_node);
3745     +bool perf_env__insert_btf(struct perf_env *env, struct btf_node *btf_node);
3746     struct btf_node *perf_env__find_btf(struct perf_env *env, __u32 btf_id);
3747     #endif /* __PERF_ENV_H */