Magellan Linux

Contents of /trunk/kernel-alx/patches-5.4/0113-5.4.14-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3494 - (show annotations) (download)
Mon May 11 14:36:16 2020 UTC (3 years, 11 months ago) by niro
File size: 271111 byte(s)
-linux-5.4.14
1 diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
2 index 4845e29411e4..e08cd4c4d568 100644
3 --- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml
4 +++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
5 @@ -347,6 +347,7 @@ allOf:
6 - st,spear600-gmac
7
8 then:
9 + properties:
10 snps,tso:
11 $ref: /schemas/types.yaml#definitions/flag
12 description:
13 diff --git a/Makefile b/Makefile
14 index d4cf4700ae3f..2b2080d08bb2 100644
15 --- a/Makefile
16 +++ b/Makefile
17 @@ -1,7 +1,7 @@
18 # SPDX-License-Identifier: GPL-2.0
19 VERSION = 5
20 PATCHLEVEL = 4
21 -SUBLEVEL = 13
22 +SUBLEVEL = 14
23 EXTRAVERSION =
24 NAME = Kleptomaniac Octopus
25
26 diff --git a/arch/arm/boot/dts/am571x-idk.dts b/arch/arm/boot/dts/am571x-idk.dts
27 index 0aaacea1d887..9d6a872c2b23 100644
28 --- a/arch/arm/boot/dts/am571x-idk.dts
29 +++ b/arch/arm/boot/dts/am571x-idk.dts
30 @@ -167,7 +167,7 @@
31
32 &pcie1_rc {
33 status = "okay";
34 - gpios = <&gpio3 23 GPIO_ACTIVE_HIGH>;
35 + gpios = <&gpio5 18 GPIO_ACTIVE_HIGH>;
36 };
37
38 &pcie1_ep {
39 diff --git a/arch/arm/boot/dts/dra7-l4.dtsi b/arch/arm/boot/dts/dra7-l4.dtsi
40 index 5cac2dd58241..c3954e34835b 100644
41 --- a/arch/arm/boot/dts/dra7-l4.dtsi
42 +++ b/arch/arm/boot/dts/dra7-l4.dtsi
43 @@ -3059,7 +3059,7 @@
44
45 davinci_mdio: mdio@1000 {
46 compatible = "ti,cpsw-mdio","ti,davinci_mdio";
47 - clocks = <&gmac_clkctrl DRA7_GMAC_GMAC_CLKCTRL 0>;
48 + clocks = <&gmac_main_clk>;
49 clock-names = "fck";
50 #address-cells = <1>;
51 #size-cells = <0>;
52 diff --git a/arch/arm/boot/dts/imx6dl-icore-mipi.dts b/arch/arm/boot/dts/imx6dl-icore-mipi.dts
53 index e43bccb78ab2..d8f3821a0ffd 100644
54 --- a/arch/arm/boot/dts/imx6dl-icore-mipi.dts
55 +++ b/arch/arm/boot/dts/imx6dl-icore-mipi.dts
56 @@ -8,7 +8,7 @@
57 /dts-v1/;
58
59 #include "imx6dl.dtsi"
60 -#include "imx6qdl-icore.dtsi"
61 +#include "imx6qdl-icore-1.5.dtsi"
62
63 / {
64 model = "Engicam i.CoreM6 DualLite/Solo MIPI Starter Kit";
65 diff --git a/arch/arm/boot/dts/imx6q-dhcom-pdk2.dts b/arch/arm/boot/dts/imx6q-dhcom-pdk2.dts
66 index 9c61e3be2d9a..1c46df6827f5 100644
67 --- a/arch/arm/boot/dts/imx6q-dhcom-pdk2.dts
68 +++ b/arch/arm/boot/dts/imx6q-dhcom-pdk2.dts
69 @@ -55,7 +55,7 @@
70 #sound-dai-cells = <0>;
71 clocks = <&clk_ext_audio_codec>;
72 VDDA-supply = <&reg_3p3v>;
73 - VDDIO-supply = <&reg_3p3v>;
74 + VDDIO-supply = <&sw2_reg>;
75 };
76 };
77
78 diff --git a/arch/arm/boot/dts/imx6q-dhcom-som.dtsi b/arch/arm/boot/dts/imx6q-dhcom-som.dtsi
79 index 387801dde02e..08a2e17e0539 100644
80 --- a/arch/arm/boot/dts/imx6q-dhcom-som.dtsi
81 +++ b/arch/arm/boot/dts/imx6q-dhcom-som.dtsi
82 @@ -206,7 +206,7 @@
83 };
84
85 rtc@56 {
86 - compatible = "rv3029c2";
87 + compatible = "microcrystal,rv3029";
88 pinctrl-names = "default";
89 pinctrl-0 = <&pinctrl_rtc_hw300>;
90 reg = <0x56>;
91 diff --git a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
92 index 71ca76a5e4a5..fe59dde41b64 100644
93 --- a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
94 +++ b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
95 @@ -749,10 +749,6 @@
96 vin-supply = <&vgen5_reg>;
97 };
98
99 -&reg_vdd3p0 {
100 - vin-supply = <&sw2_reg>;
101 -};
102 -
103 &reg_vdd2p5 {
104 vin-supply = <&vgen5_reg>;
105 };
106 diff --git a/arch/arm/boot/dts/imx6sl-evk.dts b/arch/arm/boot/dts/imx6sl-evk.dts
107 index 4829aa682aeb..bc86cfaaa9c2 100644
108 --- a/arch/arm/boot/dts/imx6sl-evk.dts
109 +++ b/arch/arm/boot/dts/imx6sl-evk.dts
110 @@ -584,10 +584,6 @@
111 vin-supply = <&sw2_reg>;
112 };
113
114 -&reg_vdd3p0 {
115 - vin-supply = <&sw2_reg>;
116 -};
117 -
118 &reg_vdd2p5 {
119 vin-supply = <&sw2_reg>;
120 };
121 diff --git a/arch/arm/boot/dts/imx6sll-evk.dts b/arch/arm/boot/dts/imx6sll-evk.dts
122 index 3e1d32fdf4b8..5ace9e6acf85 100644
123 --- a/arch/arm/boot/dts/imx6sll-evk.dts
124 +++ b/arch/arm/boot/dts/imx6sll-evk.dts
125 @@ -265,10 +265,6 @@
126 status = "okay";
127 };
128
129 -&reg_3p0 {
130 - vin-supply = <&sw2_reg>;
131 -};
132 -
133 &snvs_poweroff {
134 status = "okay";
135 };
136 diff --git a/arch/arm/boot/dts/imx6sx-sdb-reva.dts b/arch/arm/boot/dts/imx6sx-sdb-reva.dts
137 index f1830ed387a5..91a7548fdb8d 100644
138 --- a/arch/arm/boot/dts/imx6sx-sdb-reva.dts
139 +++ b/arch/arm/boot/dts/imx6sx-sdb-reva.dts
140 @@ -159,10 +159,6 @@
141 vin-supply = <&vgen6_reg>;
142 };
143
144 -&reg_vdd3p0 {
145 - vin-supply = <&sw2_reg>;
146 -};
147 -
148 &reg_vdd2p5 {
149 vin-supply = <&vgen6_reg>;
150 };
151 diff --git a/arch/arm/boot/dts/imx6sx-sdb.dts b/arch/arm/boot/dts/imx6sx-sdb.dts
152 index a8ee7087af5a..5a63ca615722 100644
153 --- a/arch/arm/boot/dts/imx6sx-sdb.dts
154 +++ b/arch/arm/boot/dts/imx6sx-sdb.dts
155 @@ -141,10 +141,6 @@
156 vin-supply = <&vgen6_reg>;
157 };
158
159 -&reg_vdd3p0 {
160 - vin-supply = <&sw2_reg>;
161 -};
162 -
163 &reg_vdd2p5 {
164 vin-supply = <&vgen6_reg>;
165 };
166 diff --git a/arch/arm/boot/dts/imx6ul-kontron-n6310-s.dts b/arch/arm/boot/dts/imx6ul-kontron-n6310-s.dts
167 index 0205fd56d975..4e99e6c79a68 100644
168 --- a/arch/arm/boot/dts/imx6ul-kontron-n6310-s.dts
169 +++ b/arch/arm/boot/dts/imx6ul-kontron-n6310-s.dts
170 @@ -157,10 +157,6 @@
171 status = "okay";
172 };
173
174 -&snvs_poweroff {
175 - status = "okay";
176 -};
177 -
178 &uart1 {
179 pinctrl-names = "default";
180 pinctrl-0 = <&pinctrl_uart1>;
181 diff --git a/arch/arm/boot/dts/imx7s-colibri.dtsi b/arch/arm/boot/dts/imx7s-colibri.dtsi
182 index 1fb1ec5d3d70..6d16e32aed89 100644
183 --- a/arch/arm/boot/dts/imx7s-colibri.dtsi
184 +++ b/arch/arm/boot/dts/imx7s-colibri.dtsi
185 @@ -49,3 +49,7 @@
186 reg = <0x80000000 0x10000000>;
187 };
188 };
189 +
190 +&gpmi {
191 + status = "okay";
192 +};
193 diff --git a/arch/arm/boot/dts/imx7ulp.dtsi b/arch/arm/boot/dts/imx7ulp.dtsi
194 index 6859a3a83750..3dac6898cdc5 100644
195 --- a/arch/arm/boot/dts/imx7ulp.dtsi
196 +++ b/arch/arm/boot/dts/imx7ulp.dtsi
197 @@ -37,10 +37,10 @@
198 #address-cells = <1>;
199 #size-cells = <0>;
200
201 - cpu0: cpu@0 {
202 + cpu0: cpu@f00 {
203 compatible = "arm,cortex-a7";
204 device_type = "cpu";
205 - reg = <0>;
206 + reg = <0xf00>;
207 };
208 };
209
210 diff --git a/arch/arm/boot/dts/meson8.dtsi b/arch/arm/boot/dts/meson8.dtsi
211 index 5a7e3e5caebe..3c534cd50ee3 100644
212 --- a/arch/arm/boot/dts/meson8.dtsi
213 +++ b/arch/arm/boot/dts/meson8.dtsi
214 @@ -253,7 +253,7 @@
215 &aobus {
216 pmu: pmu@e0 {
217 compatible = "amlogic,meson8-pmu", "syscon";
218 - reg = <0xe0 0x8>;
219 + reg = <0xe0 0x18>;
220 };
221
222 pinctrl_aobus: pinctrl@84 {
223 diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
224 index 7cc95bc1598b..e5506ab669fc 100644
225 --- a/arch/arm/boot/dts/omap4.dtsi
226 +++ b/arch/arm/boot/dts/omap4.dtsi
227 @@ -330,8 +330,8 @@
228
229 target-module@56000000 {
230 compatible = "ti,sysc-omap4", "ti,sysc";
231 - reg = <0x5601fc00 0x4>,
232 - <0x5601fc10 0x4>;
233 + reg = <0x5600fe00 0x4>,
234 + <0x5600fe10 0x4>;
235 reg-names = "rev", "sysc";
236 ti,sysc-midle = <SYSC_IDLE_FORCE>,
237 <SYSC_IDLE_NO>,
238 diff --git a/arch/arm/mach-davinci/Kconfig b/arch/arm/mach-davinci/Kconfig
239 index dd427bd2768c..02b180ad7245 100644
240 --- a/arch/arm/mach-davinci/Kconfig
241 +++ b/arch/arm/mach-davinci/Kconfig
242 @@ -9,6 +9,7 @@ menuconfig ARCH_DAVINCI
243 select PM_GENERIC_DOMAINS if PM
244 select PM_GENERIC_DOMAINS_OF if PM && OF
245 select REGMAP_MMIO
246 + select RESET_CONTROLLER
247 select HAVE_IDE
248 select PINCTRL_SINGLE
249
250 diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c
251 index 1b7cf81ff035..33688e1d9acf 100644
252 --- a/arch/arm/mach-omap2/pdata-quirks.c
253 +++ b/arch/arm/mach-omap2/pdata-quirks.c
254 @@ -368,10 +368,14 @@ static void __init dra7x_evm_mmc_quirk(void)
255
256 static struct clockdomain *ti_sysc_find_one_clockdomain(struct clk *clk)
257 {
258 + struct clk_hw *hw = __clk_get_hw(clk);
259 struct clockdomain *clkdm = NULL;
260 struct clk_hw_omap *hwclk;
261
262 - hwclk = to_clk_hw_omap(__clk_get_hw(clk));
263 + hwclk = to_clk_hw_omap(hw);
264 + if (!omap2_clk_is_hw_omap(hw))
265 + return NULL;
266 +
267 if (hwclk && hwclk->clkdm_name)
268 clkdm = clkdm_lookup(hwclk->clkdm_name);
269
270 diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-olinuxino-emmc.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-olinuxino-emmc.dts
271 index 96ab0227e82d..121e6cc4849b 100644
272 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-olinuxino-emmc.dts
273 +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-olinuxino-emmc.dts
274 @@ -15,7 +15,7 @@
275 pinctrl-names = "default";
276 pinctrl-0 = <&mmc2_pins>;
277 vmmc-supply = <&reg_dcdc1>;
278 - vqmmc-supply = <&reg_dcdc1>;
279 + vqmmc-supply = <&reg_eldo1>;
280 bus-width = <8>;
281 non-removable;
282 cap-mmc-hw-reset;
283 diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-olinuxino.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-olinuxino.dts
284 index 01a9a52edae4..393c1948a495 100644
285 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-olinuxino.dts
286 +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-olinuxino.dts
287 @@ -140,7 +140,7 @@
288 &mmc1 {
289 pinctrl-names = "default";
290 pinctrl-0 = <&mmc1_pins>;
291 - vmmc-supply = <&reg_aldo2>;
292 + vmmc-supply = <&reg_dcdc1>;
293 vqmmc-supply = <&reg_dldo4>;
294 mmc-pwrseq = <&wifi_pwrseq>;
295 bus-width = <4>;
296 diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
297 index 70f4cce6be43..ba41c1b85887 100644
298 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
299 +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
300 @@ -142,6 +142,15 @@
301 clock-output-names = "ext-osc32k";
302 };
303
304 + pmu {
305 + compatible = "arm,cortex-a53-pmu";
306 + interrupts = <GIC_SPI 116 IRQ_TYPE_LEVEL_HIGH>,
307 + <GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>,
308 + <GIC_SPI 118 IRQ_TYPE_LEVEL_HIGH>,
309 + <GIC_SPI 119 IRQ_TYPE_LEVEL_HIGH>;
310 + interrupt-affinity = <&cpu0>, <&cpu1>, <&cpu2>, <&cpu3>;
311 + };
312 +
313 psci {
314 compatible = "arm,psci-0.2";
315 method = "smc";
316 diff --git a/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi b/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi
317 index 144a2c19ac02..d1fc9c2055f4 100644
318 --- a/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi
319 +++ b/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi
320 @@ -61,10 +61,10 @@
321
322 pmu {
323 compatible = "arm,armv8-pmuv3";
324 - interrupts = <0 120 8>,
325 - <0 121 8>,
326 - <0 122 8>,
327 - <0 123 8>;
328 + interrupts = <0 170 4>,
329 + <0 171 4>,
330 + <0 172 4>,
331 + <0 173 4>;
332 interrupt-affinity = <&cpu0>,
333 <&cpu1>,
334 <&cpu2>,
335 diff --git a/arch/arm64/boot/dts/amlogic/meson-axg.dtsi b/arch/arm64/boot/dts/amlogic/meson-axg.dtsi
336 index 82919b106010..bb4a2acb9970 100644
337 --- a/arch/arm64/boot/dts/amlogic/meson-axg.dtsi
338 +++ b/arch/arm64/boot/dts/amlogic/meson-axg.dtsi
339 @@ -1162,7 +1162,7 @@
340
341 toddr_a: audio-controller@100 {
342 compatible = "amlogic,axg-toddr";
343 - reg = <0x0 0x100 0x0 0x1c>;
344 + reg = <0x0 0x100 0x0 0x2c>;
345 #sound-dai-cells = <0>;
346 sound-name-prefix = "TODDR_A";
347 interrupts = <GIC_SPI 84 IRQ_TYPE_EDGE_RISING>;
348 @@ -1173,7 +1173,7 @@
349
350 toddr_b: audio-controller@140 {
351 compatible = "amlogic,axg-toddr";
352 - reg = <0x0 0x140 0x0 0x1c>;
353 + reg = <0x0 0x140 0x0 0x2c>;
354 #sound-dai-cells = <0>;
355 sound-name-prefix = "TODDR_B";
356 interrupts = <GIC_SPI 85 IRQ_TYPE_EDGE_RISING>;
357 @@ -1184,7 +1184,7 @@
358
359 toddr_c: audio-controller@180 {
360 compatible = "amlogic,axg-toddr";
361 - reg = <0x0 0x180 0x0 0x1c>;
362 + reg = <0x0 0x180 0x0 0x2c>;
363 #sound-dai-cells = <0>;
364 sound-name-prefix = "TODDR_C";
365 interrupts = <GIC_SPI 86 IRQ_TYPE_EDGE_RISING>;
366 @@ -1195,7 +1195,7 @@
367
368 frddr_a: audio-controller@1c0 {
369 compatible = "amlogic,axg-frddr";
370 - reg = <0x0 0x1c0 0x0 0x1c>;
371 + reg = <0x0 0x1c0 0x0 0x2c>;
372 #sound-dai-cells = <0>;
373 sound-name-prefix = "FRDDR_A";
374 interrupts = <GIC_SPI 88 IRQ_TYPE_EDGE_RISING>;
375 @@ -1206,7 +1206,7 @@
376
377 frddr_b: audio-controller@200 {
378 compatible = "amlogic,axg-frddr";
379 - reg = <0x0 0x200 0x0 0x1c>;
380 + reg = <0x0 0x200 0x0 0x2c>;
381 #sound-dai-cells = <0>;
382 sound-name-prefix = "FRDDR_B";
383 interrupts = <GIC_SPI 89 IRQ_TYPE_EDGE_RISING>;
384 @@ -1217,7 +1217,7 @@
385
386 frddr_c: audio-controller@240 {
387 compatible = "amlogic,axg-frddr";
388 - reg = <0x0 0x240 0x0 0x1c>;
389 + reg = <0x0 0x240 0x0 0x2c>;
390 #sound-dai-cells = <0>;
391 sound-name-prefix = "FRDDR_C";
392 interrupts = <GIC_SPI 90 IRQ_TYPE_EDGE_RISING>;
393 diff --git a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
394 index 3f39e020f74e..0ee8a369c547 100644
395 --- a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
396 +++ b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
397 @@ -1509,7 +1509,7 @@
398 toddr_a: audio-controller@100 {
399 compatible = "amlogic,g12a-toddr",
400 "amlogic,axg-toddr";
401 - reg = <0x0 0x100 0x0 0x1c>;
402 + reg = <0x0 0x100 0x0 0x2c>;
403 #sound-dai-cells = <0>;
404 sound-name-prefix = "TODDR_A";
405 interrupts = <GIC_SPI 148 IRQ_TYPE_EDGE_RISING>;
406 @@ -1521,7 +1521,7 @@
407 toddr_b: audio-controller@140 {
408 compatible = "amlogic,g12a-toddr",
409 "amlogic,axg-toddr";
410 - reg = <0x0 0x140 0x0 0x1c>;
411 + reg = <0x0 0x140 0x0 0x2c>;
412 #sound-dai-cells = <0>;
413 sound-name-prefix = "TODDR_B";
414 interrupts = <GIC_SPI 149 IRQ_TYPE_EDGE_RISING>;
415 @@ -1533,7 +1533,7 @@
416 toddr_c: audio-controller@180 {
417 compatible = "amlogic,g12a-toddr",
418 "amlogic,axg-toddr";
419 - reg = <0x0 0x180 0x0 0x1c>;
420 + reg = <0x0 0x180 0x0 0x2c>;
421 #sound-dai-cells = <0>;
422 sound-name-prefix = "TODDR_C";
423 interrupts = <GIC_SPI 150 IRQ_TYPE_EDGE_RISING>;
424 @@ -1545,7 +1545,7 @@
425 frddr_a: audio-controller@1c0 {
426 compatible = "amlogic,g12a-frddr",
427 "amlogic,axg-frddr";
428 - reg = <0x0 0x1c0 0x0 0x1c>;
429 + reg = <0x0 0x1c0 0x0 0x2c>;
430 #sound-dai-cells = <0>;
431 sound-name-prefix = "FRDDR_A";
432 interrupts = <GIC_SPI 152 IRQ_TYPE_EDGE_RISING>;
433 @@ -1557,7 +1557,7 @@
434 frddr_b: audio-controller@200 {
435 compatible = "amlogic,g12a-frddr",
436 "amlogic,axg-frddr";
437 - reg = <0x0 0x200 0x0 0x1c>;
438 + reg = <0x0 0x200 0x0 0x2c>;
439 #sound-dai-cells = <0>;
440 sound-name-prefix = "FRDDR_B";
441 interrupts = <GIC_SPI 153 IRQ_TYPE_EDGE_RISING>;
442 @@ -1569,7 +1569,7 @@
443 frddr_c: audio-controller@240 {
444 compatible = "amlogic,g12a-frddr",
445 "amlogic,axg-frddr";
446 - reg = <0x0 0x240 0x0 0x1c>;
447 + reg = <0x0 0x240 0x0 0x2c>;
448 #sound-dai-cells = <0>;
449 sound-name-prefix = "FRDDR_C";
450 interrupts = <GIC_SPI 154 IRQ_TYPE_EDGE_RISING>;
451 diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts
452 index 8d6f316a5c7b..440bc23c7342 100644
453 --- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts
454 +++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts
455 @@ -33,11 +33,9 @@
456
457 gpio-keys-polled {
458 compatible = "gpio-keys-polled";
459 - #address-cells = <1>;
460 - #size-cells = <0>;
461 poll-interval = <100>;
462
463 - button@0 {
464 + power-button {
465 label = "power";
466 linux,code = <KEY_POWER>;
467 gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_LOW>;
468 diff --git a/arch/arm64/boot/dts/arm/juno-base.dtsi b/arch/arm64/boot/dts/arm/juno-base.dtsi
469 index 26a039a028b8..8c11660bbe40 100644
470 --- a/arch/arm64/boot/dts/arm/juno-base.dtsi
471 +++ b/arch/arm64/boot/dts/arm/juno-base.dtsi
472 @@ -6,7 +6,6 @@
473 /*
474 * Devices shared by all Juno boards
475 */
476 - dma-ranges = <0 0 0 0 0x100 0>;
477
478 memtimer: timer@2a810000 {
479 compatible = "arm,armv7-timer-mem";
480 diff --git a/arch/arm64/boot/dts/arm/juno-clocks.dtsi b/arch/arm64/boot/dts/arm/juno-clocks.dtsi
481 index e5e265dfa902..2870b5eeb198 100644
482 --- a/arch/arm64/boot/dts/arm/juno-clocks.dtsi
483 +++ b/arch/arm64/boot/dts/arm/juno-clocks.dtsi
484 @@ -8,10 +8,10 @@
485 */
486 / {
487 /* SoC fixed clocks */
488 - soc_uartclk: refclk7273800hz {
489 + soc_uartclk: refclk7372800hz {
490 compatible = "fixed-clock";
491 #clock-cells = <0>;
492 - clock-frequency = <7273800>;
493 + clock-frequency = <7372800>;
494 clock-output-names = "juno:uartclk";
495 };
496
497 diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi
498 index bb960fe2bb64..9589b15693d6 100644
499 --- a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi
500 +++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi
501 @@ -158,7 +158,7 @@
502 dcfg: syscon@1e00000 {
503 compatible = "fsl,ls1028a-dcfg", "syscon";
504 reg = <0x0 0x1e00000 0x0 0x10000>;
505 - big-endian;
506 + little-endian;
507 };
508
509 rst: syscon@1e60000 {
510 diff --git a/arch/arm64/boot/dts/freescale/imx8mm-evk.dts b/arch/arm64/boot/dts/freescale/imx8mm-evk.dts
511 index f7a15f3904c2..13137451b438 100644
512 --- a/arch/arm64/boot/dts/freescale/imx8mm-evk.dts
513 +++ b/arch/arm64/boot/dts/freescale/imx8mm-evk.dts
514 @@ -62,6 +62,8 @@
515
516 cpudai: simple-audio-card,cpu {
517 sound-dai = <&sai3>;
518 + dai-tdm-slot-num = <2>;
519 + dai-tdm-slot-width = <32>;
520 };
521
522 simple-audio-card,codec {
523 diff --git a/arch/arm64/boot/dts/freescale/imx8mm.dtsi b/arch/arm64/boot/dts/freescale/imx8mm.dtsi
524 index 23c8fad7932b..fde1849d36ca 100644
525 --- a/arch/arm64/boot/dts/freescale/imx8mm.dtsi
526 +++ b/arch/arm64/boot/dts/freescale/imx8mm.dtsi
527 @@ -479,14 +479,18 @@
528 <&clk IMX8MM_CLK_AUDIO_AHB>,
529 <&clk IMX8MM_CLK_IPG_AUDIO_ROOT>,
530 <&clk IMX8MM_SYS_PLL3>,
531 - <&clk IMX8MM_VIDEO_PLL1>;
532 + <&clk IMX8MM_VIDEO_PLL1>,
533 + <&clk IMX8MM_AUDIO_PLL1>,
534 + <&clk IMX8MM_AUDIO_PLL2>;
535 assigned-clock-parents = <&clk IMX8MM_SYS_PLL3_OUT>,
536 <&clk IMX8MM_SYS_PLL1_800M>;
537 assigned-clock-rates = <0>,
538 <400000000>,
539 <400000000>,
540 <750000000>,
541 - <594000000>;
542 + <594000000>,
543 + <393216000>,
544 + <361267200>;
545 };
546
547 src: reset-controller@30390000 {
548 @@ -741,7 +745,7 @@
549 reg = <0x30bd0000 0x10000>;
550 interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
551 clocks = <&clk IMX8MM_CLK_SDMA1_ROOT>,
552 - <&clk IMX8MM_CLK_SDMA1_ROOT>;
553 + <&clk IMX8MM_CLK_AHB>;
554 clock-names = "ipg", "ahb";
555 #dma-cells = <3>;
556 fsl,sdma-ram-script-name = "imx/sdma/sdma-imx7d.bin";
557 diff --git a/arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts b/arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts
558 index 683a11035643..98cfe67b7db7 100644
559 --- a/arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts
560 +++ b/arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts
561 @@ -421,7 +421,7 @@
562 pinctrl-names = "default";
563 pinctrl-0 = <&pinctrl_imu>;
564 interrupt-parent = <&gpio3>;
565 - interrupts = <19 IRQ_TYPE_LEVEL_LOW>;
566 + interrupts = <19 IRQ_TYPE_LEVEL_HIGH>;
567 vdd-supply = <&reg_3v3_p>;
568 vddio-supply = <&reg_3v3_p>;
569 };
570 diff --git a/arch/arm64/boot/dts/intel/socfpga_agilex.dtsi b/arch/arm64/boot/dts/intel/socfpga_agilex.dtsi
571 index 36abc25320a8..d2cb28da3fff 100644
572 --- a/arch/arm64/boot/dts/intel/socfpga_agilex.dtsi
573 +++ b/arch/arm64/boot/dts/intel/socfpga_agilex.dtsi
574 @@ -47,10 +47,10 @@
575
576 pmu {
577 compatible = "arm,armv8-pmuv3";
578 - interrupts = <0 120 8>,
579 - <0 121 8>,
580 - <0 122 8>,
581 - <0 123 8>;
582 + interrupts = <0 170 4>,
583 + <0 171 4>,
584 + <0 172 4>,
585 + <0 173 4>;
586 interrupt-affinity = <&cpu0>,
587 <&cpu1>,
588 <&cpu2>,
589 diff --git a/arch/arm64/boot/dts/marvell/armada-ap806-dual.dtsi b/arch/arm64/boot/dts/marvell/armada-ap806-dual.dtsi
590 index 9024a2d9db07..62ae016ee6aa 100644
591 --- a/arch/arm64/boot/dts/marvell/armada-ap806-dual.dtsi
592 +++ b/arch/arm64/boot/dts/marvell/armada-ap806-dual.dtsi
593 @@ -21,6 +21,7 @@
594 reg = <0x000>;
595 enable-method = "psci";
596 #cooling-cells = <2>;
597 + clocks = <&cpu_clk 0>;
598 };
599 cpu1: cpu@1 {
600 device_type = "cpu";
601 @@ -28,6 +29,7 @@
602 reg = <0x001>;
603 enable-method = "psci";
604 #cooling-cells = <2>;
605 + clocks = <&cpu_clk 0>;
606 };
607 };
608 };
609 diff --git a/arch/arm64/boot/dts/marvell/armada-cp110.dtsi b/arch/arm64/boot/dts/marvell/armada-cp110.dtsi
610 index d81944902650..8259fc8f86f2 100644
611 --- a/arch/arm64/boot/dts/marvell/armada-cp110.dtsi
612 +++ b/arch/arm64/boot/dts/marvell/armada-cp110.dtsi
613 @@ -438,10 +438,10 @@
614
615 CP110_LABEL(nand_controller): nand@720000 {
616 /*
617 - * Due to the limitation of the pins available
618 - * this controller is only usable on the CPM
619 - * for A7K and on the CPS for A8K.
620 - */
621 + * Due to the limitation of the pins available
622 + * this controller is only usable on the CPM
623 + * for A7K and on the CPS for A8K.
624 + */
625 compatible = "marvell,armada-8k-nand-controller",
626 "marvell,armada370-nand-controller";
627 reg = <0x720000 0x54>;
628 diff --git a/arch/arm64/boot/dts/qcom/msm8998-mtp.dtsi b/arch/arm64/boot/dts/qcom/msm8998-mtp.dtsi
629 index 108667ce4f31..8d15572d18e6 100644
630 --- a/arch/arm64/boot/dts/qcom/msm8998-mtp.dtsi
631 +++ b/arch/arm64/boot/dts/qcom/msm8998-mtp.dtsi
632 @@ -27,6 +27,66 @@
633 status = "okay";
634 };
635
636 +&etf {
637 + status = "okay";
638 +};
639 +
640 +&etm1 {
641 + status = "okay";
642 +};
643 +
644 +&etm2 {
645 + status = "okay";
646 +};
647 +
648 +&etm3 {
649 + status = "okay";
650 +};
651 +
652 +&etm4 {
653 + status = "okay";
654 +};
655 +
656 +&etm5 {
657 + status = "okay";
658 +};
659 +
660 +&etm6 {
661 + status = "okay";
662 +};
663 +
664 +&etm7 {
665 + status = "okay";
666 +};
667 +
668 +&etm8 {
669 + status = "okay";
670 +};
671 +
672 +&etr {
673 + status = "okay";
674 +};
675 +
676 +&funnel1 {
677 + status = "okay";
678 +};
679 +
680 +&funnel2 {
681 + status = "okay";
682 +};
683 +
684 +&funnel3 {
685 + status = "okay";
686 +};
687 +
688 +&funnel4 {
689 + status = "okay";
690 +};
691 +
692 +&funnel5 {
693 + status = "okay";
694 +};
695 +
696 &pm8005_lsid1 {
697 pm8005-regulators {
698 compatible = "qcom,pm8005-regulators";
699 @@ -51,6 +111,10 @@
700 vdda-phy-dpdm-supply = <&vreg_l24a_3p075>;
701 };
702
703 +&replicator1 {
704 + status = "okay";
705 +};
706 +
707 &rpm_requests {
708 pm8998-regulators {
709 compatible = "qcom,rpm-pm8998-regulators";
710 @@ -249,6 +313,10 @@
711 pinctrl-1 = <&sdc2_clk_off &sdc2_cmd_off &sdc2_data_off &sdc2_cd_off>;
712 };
713
714 +&stm {
715 + status = "okay";
716 +};
717 +
718 &ufshc {
719 vcc-supply = <&vreg_l20a_2p95>;
720 vccq-supply = <&vreg_l26a_1p2>;
721 diff --git a/arch/arm64/boot/dts/qcom/msm8998.dtsi b/arch/arm64/boot/dts/qcom/msm8998.dtsi
722 index c6f81431983e..ffb64fc239ee 100644
723 --- a/arch/arm64/boot/dts/qcom/msm8998.dtsi
724 +++ b/arch/arm64/boot/dts/qcom/msm8998.dtsi
725 @@ -998,11 +998,12 @@
726 #interrupt-cells = <0x2>;
727 };
728
729 - stm@6002000 {
730 + stm: stm@6002000 {
731 compatible = "arm,coresight-stm", "arm,primecell";
732 reg = <0x06002000 0x1000>,
733 <0x16280000 0x180000>;
734 reg-names = "stm-base", "stm-data-base";
735 + status = "disabled";
736
737 clocks = <&rpmcc RPM_SMD_QDSS_CLK>, <&rpmcc RPM_SMD_QDSS_A_CLK>;
738 clock-names = "apb_pclk", "atclk";
739 @@ -1016,9 +1017,10 @@
740 };
741 };
742
743 - funnel@6041000 {
744 + funnel1: funnel@6041000 {
745 compatible = "arm,coresight-dynamic-funnel", "arm,primecell";
746 reg = <0x06041000 0x1000>;
747 + status = "disabled";
748
749 clocks = <&rpmcc RPM_SMD_QDSS_CLK>, <&rpmcc RPM_SMD_QDSS_A_CLK>;
750 clock-names = "apb_pclk", "atclk";
751 @@ -1045,9 +1047,10 @@
752 };
753 };
754
755 - funnel@6042000 {
756 + funnel2: funnel@6042000 {
757 compatible = "arm,coresight-dynamic-funnel", "arm,primecell";
758 reg = <0x06042000 0x1000>;
759 + status = "disabled";
760
761 clocks = <&rpmcc RPM_SMD_QDSS_CLK>, <&rpmcc RPM_SMD_QDSS_A_CLK>;
762 clock-names = "apb_pclk", "atclk";
763 @@ -1075,9 +1078,10 @@
764 };
765 };
766
767 - funnel@6045000 {
768 + funnel3: funnel@6045000 {
769 compatible = "arm,coresight-dynamic-funnel", "arm,primecell";
770 reg = <0x06045000 0x1000>;
771 + status = "disabled";
772
773 clocks = <&rpmcc RPM_SMD_QDSS_CLK>, <&rpmcc RPM_SMD_QDSS_A_CLK>;
774 clock-names = "apb_pclk", "atclk";
775 @@ -1113,9 +1117,10 @@
776 };
777 };
778
779 - replicator@6046000 {
780 + replicator1: replicator@6046000 {
781 compatible = "arm,coresight-dynamic-replicator", "arm,primecell";
782 reg = <0x06046000 0x1000>;
783 + status = "disabled";
784
785 clocks = <&rpmcc RPM_SMD_QDSS_CLK>, <&rpmcc RPM_SMD_QDSS_A_CLK>;
786 clock-names = "apb_pclk", "atclk";
787 @@ -1137,9 +1142,10 @@
788 };
789 };
790
791 - etf@6047000 {
792 + etf: etf@6047000 {
793 compatible = "arm,coresight-tmc", "arm,primecell";
794 reg = <0x06047000 0x1000>;
795 + status = "disabled";
796
797 clocks = <&rpmcc RPM_SMD_QDSS_CLK>, <&rpmcc RPM_SMD_QDSS_A_CLK>;
798 clock-names = "apb_pclk", "atclk";
799 @@ -1163,9 +1169,10 @@
800 };
801 };
802
803 - etr@6048000 {
804 + etr: etr@6048000 {
805 compatible = "arm,coresight-tmc", "arm,primecell";
806 reg = <0x06048000 0x1000>;
807 + status = "disabled";
808
809 clocks = <&rpmcc RPM_SMD_QDSS_CLK>, <&rpmcc RPM_SMD_QDSS_A_CLK>;
810 clock-names = "apb_pclk", "atclk";
811 @@ -1181,9 +1188,10 @@
812 };
813 };
814
815 - etm@7840000 {
816 + etm1: etm@7840000 {
817 compatible = "arm,coresight-etm4x", "arm,primecell";
818 reg = <0x07840000 0x1000>;
819 + status = "disabled";
820
821 clocks = <&rpmcc RPM_SMD_QDSS_CLK>, <&rpmcc RPM_SMD_QDSS_A_CLK>;
822 clock-names = "apb_pclk", "atclk";
823 @@ -1200,9 +1208,10 @@
824 };
825 };
826
827 - etm@7940000 {
828 + etm2: etm@7940000 {
829 compatible = "arm,coresight-etm4x", "arm,primecell";
830 reg = <0x07940000 0x1000>;
831 + status = "disabled";
832
833 clocks = <&rpmcc RPM_SMD_QDSS_CLK>, <&rpmcc RPM_SMD_QDSS_A_CLK>;
834 clock-names = "apb_pclk", "atclk";
835 @@ -1219,9 +1228,10 @@
836 };
837 };
838
839 - etm@7a40000 {
840 + etm3: etm@7a40000 {
841 compatible = "arm,coresight-etm4x", "arm,primecell";
842 reg = <0x07a40000 0x1000>;
843 + status = "disabled";
844
845 clocks = <&rpmcc RPM_SMD_QDSS_CLK>, <&rpmcc RPM_SMD_QDSS_A_CLK>;
846 clock-names = "apb_pclk", "atclk";
847 @@ -1238,9 +1248,10 @@
848 };
849 };
850
851 - etm@7b40000 {
852 + etm4: etm@7b40000 {
853 compatible = "arm,coresight-etm4x", "arm,primecell";
854 reg = <0x07b40000 0x1000>;
855 + status = "disabled";
856
857 clocks = <&rpmcc RPM_SMD_QDSS_CLK>, <&rpmcc RPM_SMD_QDSS_A_CLK>;
858 clock-names = "apb_pclk", "atclk";
859 @@ -1257,9 +1268,10 @@
860 };
861 };
862
863 - funnel@7b60000 { /* APSS Funnel */
864 + funnel4: funnel@7b60000 { /* APSS Funnel */
865 compatible = "arm,coresight-etm4x", "arm,primecell";
866 reg = <0x07b60000 0x1000>;
867 + status = "disabled";
868
869 clocks = <&rpmcc RPM_SMD_QDSS_CLK>, <&rpmcc RPM_SMD_QDSS_A_CLK>;
870 clock-names = "apb_pclk", "atclk";
871 @@ -1343,9 +1355,10 @@
872 };
873 };
874
875 - funnel@7b70000 {
876 + funnel5: funnel@7b70000 {
877 compatible = "arm,coresight-dynamic-funnel", "arm,primecell";
878 reg = <0x07b70000 0x1000>;
879 + status = "disabled";
880
881 clocks = <&rpmcc RPM_SMD_QDSS_CLK>, <&rpmcc RPM_SMD_QDSS_A_CLK>;
882 clock-names = "apb_pclk", "atclk";
883 @@ -1369,9 +1382,10 @@
884 };
885 };
886
887 - etm@7c40000 {
888 + etm5: etm@7c40000 {
889 compatible = "arm,coresight-etm4x", "arm,primecell";
890 reg = <0x07c40000 0x1000>;
891 + status = "disabled";
892
893 clocks = <&rpmcc RPM_SMD_QDSS_CLK>, <&rpmcc RPM_SMD_QDSS_A_CLK>;
894 clock-names = "apb_pclk", "atclk";
895 @@ -1385,9 +1399,10 @@
896 };
897 };
898
899 - etm@7d40000 {
900 + etm6: etm@7d40000 {
901 compatible = "arm,coresight-etm4x", "arm,primecell";
902 reg = <0x07d40000 0x1000>;
903 + status = "disabled";
904
905 clocks = <&rpmcc RPM_SMD_QDSS_CLK>, <&rpmcc RPM_SMD_QDSS_A_CLK>;
906 clock-names = "apb_pclk", "atclk";
907 @@ -1401,9 +1416,10 @@
908 };
909 };
910
911 - etm@7e40000 {
912 + etm7: etm@7e40000 {
913 compatible = "arm,coresight-etm4x", "arm,primecell";
914 reg = <0x07e40000 0x1000>;
915 + status = "disabled";
916
917 clocks = <&rpmcc RPM_SMD_QDSS_CLK>, <&rpmcc RPM_SMD_QDSS_A_CLK>;
918 clock-names = "apb_pclk", "atclk";
919 @@ -1417,9 +1433,10 @@
920 };
921 };
922
923 - etm@7f40000 {
924 + etm8: etm@7f40000 {
925 compatible = "arm,coresight-etm4x", "arm,primecell";
926 reg = <0x07f40000 0x1000>;
927 + status = "disabled";
928
929 clocks = <&rpmcc RPM_SMD_QDSS_CLK>, <&rpmcc RPM_SMD_QDSS_A_CLK>;
930 clock-names = "apb_pclk", "atclk";
931 diff --git a/arch/arm64/boot/dts/qcom/sdm845-cheza.dtsi b/arch/arm64/boot/dts/qcom/sdm845-cheza.dtsi
932 index 34881c0113cb..99a28d64ee62 100644
933 --- a/arch/arm64/boot/dts/qcom/sdm845-cheza.dtsi
934 +++ b/arch/arm64/boot/dts/qcom/sdm845-cheza.dtsi
935 @@ -165,6 +165,8 @@
936 /delete-node/ &venus_mem;
937 /delete-node/ &cdsp_mem;
938 /delete-node/ &cdsp_pas;
939 +/delete-node/ &zap_shader;
940 +/delete-node/ &gpu_mem;
941
942 /* Increase the size from 120 MB to 128 MB */
943 &mpss_region {
944 diff --git a/arch/arm64/boot/dts/qcom/sdm845.dtsi b/arch/arm64/boot/dts/qcom/sdm845.dtsi
945 index f406a4340b05..2287354fef86 100644
946 --- a/arch/arm64/boot/dts/qcom/sdm845.dtsi
947 +++ b/arch/arm64/boot/dts/qcom/sdm845.dtsi
948 @@ -2824,7 +2824,7 @@
949
950 qcom,gmu = <&gmu>;
951
952 - zap-shader {
953 + zap_shader: zap-shader {
954 memory-region = <&gpu_mem>;
955 };
956
957 diff --git a/arch/arm64/boot/dts/renesas/hihope-common.dtsi b/arch/arm64/boot/dts/renesas/hihope-common.dtsi
958 index 3e376d29a730..69585d6e3653 100644
959 --- a/arch/arm64/boot/dts/renesas/hihope-common.dtsi
960 +++ b/arch/arm64/boot/dts/renesas/hihope-common.dtsi
961 @@ -86,7 +86,7 @@
962
963 label = "rcar-sound";
964
965 - dais = <&rsnd_port0>;
966 + dais = <&rsnd_port>;
967 };
968
969 vbus0_usb2: regulator-vbus0-usb2 {
970 @@ -191,7 +191,7 @@
971 port@2 {
972 reg = <2>;
973 dw_hdmi0_snd_in: endpoint {
974 - remote-endpoint = <&rsnd_endpoint0>;
975 + remote-endpoint = <&rsnd_endpoint>;
976 };
977 };
978 };
979 @@ -327,17 +327,15 @@
980 /* Single DAI */
981 #sound-dai-cells = <0>;
982
983 - ports {
984 - rsnd_port0: port@0 {
985 - rsnd_endpoint0: endpoint {
986 - remote-endpoint = <&dw_hdmi0_snd_in>;
987 + rsnd_port: port {
988 + rsnd_endpoint: endpoint {
989 + remote-endpoint = <&dw_hdmi0_snd_in>;
990
991 - dai-format = "i2s";
992 - bitclock-master = <&rsnd_endpoint0>;
993 - frame-master = <&rsnd_endpoint0>;
994 + dai-format = "i2s";
995 + bitclock-master = <&rsnd_endpoint>;
996 + frame-master = <&rsnd_endpoint>;
997
998 - playback = <&ssi2>;
999 - };
1000 + playback = <&ssi2>;
1001 };
1002 };
1003 };
1004 diff --git a/arch/arm64/boot/dts/renesas/r8a774a1.dtsi b/arch/arm64/boot/dts/renesas/r8a774a1.dtsi
1005 index 06c7c849c8ab..c2a7ec3fc209 100644
1006 --- a/arch/arm64/boot/dts/renesas/r8a774a1.dtsi
1007 +++ b/arch/arm64/boot/dts/renesas/r8a774a1.dtsi
1008 @@ -1726,17 +1726,6 @@
1009 "ssi.1", "ssi.0";
1010 status = "disabled";
1011
1012 - ports {
1013 - #address-cells = <1>;
1014 - #size-cells = <0>;
1015 - port@0 {
1016 - reg = <0>;
1017 - };
1018 - port@1 {
1019 - reg = <1>;
1020 - };
1021 - };
1022 -
1023 rcar_sound,ctu {
1024 ctu00: ctu-0 { };
1025 ctu01: ctu-1 { };
1026 diff --git a/arch/arm64/boot/dts/renesas/r8a77970.dtsi b/arch/arm64/boot/dts/renesas/r8a77970.dtsi
1027 index 0cd3b376635d..4952981bb6ba 100644
1028 --- a/arch/arm64/boot/dts/renesas/r8a77970.dtsi
1029 +++ b/arch/arm64/boot/dts/renesas/r8a77970.dtsi
1030 @@ -652,7 +652,7 @@
1031 };
1032
1033 pwm3: pwm@e6e33000 {
1034 - compatible = "renesas,pwm-r8a7790", "renesas,pwm-rcar";
1035 + compatible = "renesas,pwm-r8a77970", "renesas,pwm-rcar";
1036 reg = <0 0xe6e33000 0 8>;
1037 #pwm-cells = <2>;
1038 clocks = <&cpg CPG_MOD 523>;
1039 diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
1040 index 3ff291bc63b7..b95e6fa34cc8 100644
1041 --- a/arch/s390/kernel/setup.c
1042 +++ b/arch/s390/kernel/setup.c
1043 @@ -1059,7 +1059,7 @@ static void __init log_component_list(void)
1044
1045 if (!early_ipl_comp_list_addr)
1046 return;
1047 - if (ipl_block.hdr.flags & IPL_PL_FLAG_IPLSR)
1048 + if (ipl_block.hdr.flags & IPL_PL_FLAG_SIPL)
1049 pr_info("Linux is running with Secure-IPL enabled\n");
1050 else
1051 pr_info("Linux is running with Secure-IPL disabled\n");
1052 diff --git a/arch/um/drivers/Kconfig b/arch/um/drivers/Kconfig
1053 index fea5a0d522dc..388096fb45a2 100644
1054 --- a/arch/um/drivers/Kconfig
1055 +++ b/arch/um/drivers/Kconfig
1056 @@ -337,7 +337,7 @@ config UML_NET_SLIRP
1057 endmenu
1058
1059 config VIRTIO_UML
1060 - tristate "UML driver for virtio devices"
1061 + bool "UML driver for virtio devices"
1062 select VIRTIO
1063 help
1064 This driver provides support for virtio based paravirtual device
1065 diff --git a/arch/um/drivers/virtio_uml.c b/arch/um/drivers/virtio_uml.c
1066 index c5643a59a8c7..179b41ad63ba 100644
1067 --- a/arch/um/drivers/virtio_uml.c
1068 +++ b/arch/um/drivers/virtio_uml.c
1069 @@ -4,12 +4,12 @@
1070 *
1071 * Copyright(c) 2019 Intel Corporation
1072 *
1073 - * This module allows virtio devices to be used over a vhost-user socket.
1074 + * This driver allows virtio devices to be used over a vhost-user socket.
1075 *
1076 * Guest devices can be instantiated by kernel module or command line
1077 * parameters. One device will be created for each parameter. Syntax:
1078 *
1079 - * [virtio_uml.]device=<socket>:<virtio_id>[:<platform_id>]
1080 + * virtio_uml.device=<socket>:<virtio_id>[:<platform_id>]
1081 * where:
1082 * <socket> := vhost-user socket path to connect
1083 * <virtio_id> := virtio device id (as in virtio_ids.h)
1084 diff --git a/arch/um/os-Linux/main.c b/arch/um/os-Linux/main.c
1085 index 8014dfac644d..c8a42ecbd7a2 100644
1086 --- a/arch/um/os-Linux/main.c
1087 +++ b/arch/um/os-Linux/main.c
1088 @@ -170,7 +170,7 @@ int __init main(int argc, char **argv, char **envp)
1089 * that they won't be delivered after the exec, when
1090 * they are definitely not expected.
1091 */
1092 - unblock_signals_trace();
1093 + unblock_signals();
1094
1095 os_info("\n");
1096 /* Reboot */
1097 diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S
1098 index d98cd483377e..e9a7f7cadb12 100644
1099 --- a/arch/x86/boot/compressed/head_64.S
1100 +++ b/arch/x86/boot/compressed/head_64.S
1101 @@ -244,6 +244,11 @@ ENTRY(efi32_stub_entry)
1102 leal efi32_config(%ebp), %eax
1103 movl %eax, efi_config(%ebp)
1104
1105 + /* Disable paging */
1106 + movl %cr0, %eax
1107 + btrl $X86_CR0_PG_BIT, %eax
1108 + movl %eax, %cr0
1109 +
1110 jmp startup_32
1111 ENDPROC(efi32_stub_entry)
1112 #endif
1113 diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c
1114 index b10a5ec79e48..011644802ce7 100644
1115 --- a/arch/x86/events/intel/uncore_snbep.c
1116 +++ b/arch/x86/events/intel/uncore_snbep.c
1117 @@ -4536,6 +4536,7 @@ static struct uncore_event_desc snr_uncore_imc_freerunning_events[] = {
1118 INTEL_UNCORE_EVENT_DESC(write, "event=0xff,umask=0x21"),
1119 INTEL_UNCORE_EVENT_DESC(write.scale, "3.814697266e-6"),
1120 INTEL_UNCORE_EVENT_DESC(write.unit, "MiB"),
1121 + { /* end: all zeroes */ },
1122 };
1123
1124 static struct intel_uncore_ops snr_uncore_imc_freerunning_ops = {
1125 diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
1126 index 90f75e515876..62c30279be77 100644
1127 --- a/arch/x86/kernel/cpu/amd.c
1128 +++ b/arch/x86/kernel/cpu/amd.c
1129 @@ -615,9 +615,9 @@ static void early_detect_mem_encrypt(struct cpuinfo_x86 *c)
1130 return;
1131
1132 clear_all:
1133 - clear_cpu_cap(c, X86_FEATURE_SME);
1134 + setup_clear_cpu_cap(X86_FEATURE_SME);
1135 clear_sev:
1136 - clear_cpu_cap(c, X86_FEATURE_SEV);
1137 + setup_clear_cpu_cap(X86_FEATURE_SEV);
1138 }
1139 }
1140
1141 diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c
1142 index 03eb90d00af0..89049b343c7a 100644
1143 --- a/arch/x86/kernel/cpu/resctrl/core.c
1144 +++ b/arch/x86/kernel/cpu/resctrl/core.c
1145 @@ -618,7 +618,7 @@ static void domain_remove_cpu(int cpu, struct rdt_resource *r)
1146 if (static_branch_unlikely(&rdt_mon_enable_key))
1147 rmdir_mondata_subdir_allrdtgrp(r, d->id);
1148 list_del(&d->list);
1149 - if (is_mbm_enabled())
1150 + if (r->mon_capable && is_mbm_enabled())
1151 cancel_delayed_work(&d->mbm_over);
1152 if (is_llc_occupancy_enabled() && has_busy_rmid(r, d)) {
1153 /*
1154 diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
1155 index 2e3b06d6bbc6..dac7209a0708 100644
1156 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
1157 +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
1158 @@ -1741,9 +1741,6 @@ static int set_cache_qos_cfg(int level, bool enable)
1159 struct rdt_domain *d;
1160 int cpu;
1161
1162 - if (!zalloc_cpumask_var(&cpu_mask, GFP_KERNEL))
1163 - return -ENOMEM;
1164 -
1165 if (level == RDT_RESOURCE_L3)
1166 update = l3_qos_cfg_update;
1167 else if (level == RDT_RESOURCE_L2)
1168 @@ -1751,6 +1748,9 @@ static int set_cache_qos_cfg(int level, bool enable)
1169 else
1170 return -EINVAL;
1171
1172 + if (!zalloc_cpumask_var(&cpu_mask, GFP_KERNEL))
1173 + return -ENOMEM;
1174 +
1175 r_l = &rdt_resources_all[level];
1176 list_for_each_entry(d, &r_l->domains, list) {
1177 /* Pick one CPU from each domain instance to update MSR */
1178 diff --git a/block/blk-settings.c b/block/blk-settings.c
1179 index 5f6dcc7a47bd..c8eda2e7b91e 100644
1180 --- a/block/blk-settings.c
1181 +++ b/block/blk-settings.c
1182 @@ -328,7 +328,7 @@ EXPORT_SYMBOL(blk_queue_max_segment_size);
1183 * storage device can address. The default of 512 covers most
1184 * hardware.
1185 **/
1186 -void blk_queue_logical_block_size(struct request_queue *q, unsigned short size)
1187 +void blk_queue_logical_block_size(struct request_queue *q, unsigned int size)
1188 {
1189 q->limits.logical_block_size = size;
1190
1191 diff --git a/block/bsg-lib.c b/block/bsg-lib.c
1192 index 347dda16c2f4..6cbb7926534c 100644
1193 --- a/block/bsg-lib.c
1194 +++ b/block/bsg-lib.c
1195 @@ -266,7 +266,7 @@ static blk_status_t bsg_queue_rq(struct blk_mq_hw_ctx *hctx,
1196 struct request *req = bd->rq;
1197 struct bsg_set *bset =
1198 container_of(q->tag_set, struct bsg_set, tag_set);
1199 - int sts = BLK_STS_IOERR;
1200 + blk_status_t sts = BLK_STS_IOERR;
1201 int ret;
1202
1203 blk_mq_start_request(req);
1204 diff --git a/drivers/base/firmware_loader/builtin/Makefile b/drivers/base/firmware_loader/builtin/Makefile
1205 index 4a66888e7253..5fa7ce3745a0 100644
1206 --- a/drivers/base/firmware_loader/builtin/Makefile
1207 +++ b/drivers/base/firmware_loader/builtin/Makefile
1208 @@ -17,7 +17,7 @@ PROGBITS = $(if $(CONFIG_ARM),%,@)progbits
1209 filechk_fwbin = \
1210 echo "/* Generated by $(src)/Makefile */" ;\
1211 echo " .section .rodata" ;\
1212 - echo " .p2align $(ASM_ALIGN)" ;\
1213 + echo " .p2align 4" ;\
1214 echo "_fw_$(FWSTR)_bin:" ;\
1215 echo " .incbin \"$(fwdir)/$(FWNAME)\"" ;\
1216 echo "_fw_end:" ;\
1217 diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
1218 index a74d03913822..c02be06c5299 100644
1219 --- a/drivers/block/xen-blkfront.c
1220 +++ b/drivers/block/xen-blkfront.c
1221 @@ -1113,8 +1113,8 @@ static int xlvbd_alloc_gendisk(blkif_sector_t capacity,
1222 if (!VDEV_IS_EXTENDED(info->vdevice)) {
1223 err = xen_translate_vdev(info->vdevice, &minor, &offset);
1224 if (err)
1225 - return err;
1226 - nr_parts = PARTS_PER_DISK;
1227 + return err;
1228 + nr_parts = PARTS_PER_DISK;
1229 } else {
1230 minor = BLKIF_MINOR_EXT(info->vdevice);
1231 nr_parts = PARTS_PER_EXT_DISK;
1232 diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c
1233 index 34bd9bf4e68a..abbf281ee337 100644
1234 --- a/drivers/bus/ti-sysc.c
1235 +++ b/drivers/bus/ti-sysc.c
1236 @@ -343,6 +343,12 @@ static int sysc_get_clocks(struct sysc *ddata)
1237 return -EINVAL;
1238 }
1239
1240 + /* Always add a slot for main clocks fck and ick even if unused */
1241 + if (!nr_fck)
1242 + ddata->nr_clocks++;
1243 + if (!nr_ick)
1244 + ddata->nr_clocks++;
1245 +
1246 ddata->clocks = devm_kcalloc(ddata->dev,
1247 ddata->nr_clocks, sizeof(*ddata->clocks),
1248 GFP_KERNEL);
1249 @@ -421,7 +427,7 @@ static int sysc_enable_opt_clocks(struct sysc *ddata)
1250 struct clk *clock;
1251 int i, error;
1252
1253 - if (!ddata->clocks)
1254 + if (!ddata->clocks || ddata->nr_clocks < SYSC_OPTFCK0 + 1)
1255 return 0;
1256
1257 for (i = SYSC_OPTFCK0; i < SYSC_MAX_CLOCKS; i++) {
1258 @@ -455,7 +461,7 @@ static void sysc_disable_opt_clocks(struct sysc *ddata)
1259 struct clk *clock;
1260 int i;
1261
1262 - if (!ddata->clocks)
1263 + if (!ddata->clocks || ddata->nr_clocks < SYSC_OPTFCK0 + 1)
1264 return;
1265
1266 for (i = SYSC_OPTFCK0; i < SYSC_MAX_CLOCKS; i++) {
1267 diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
1268 index 4fc294c2f9e8..67f592fa083a 100644
1269 --- a/drivers/clk/clk.c
1270 +++ b/drivers/clk/clk.c
1271 @@ -3408,11 +3408,17 @@ static int __clk_core_init(struct clk_core *core)
1272 if (core->flags & CLK_IS_CRITICAL) {
1273 unsigned long flags;
1274
1275 - clk_core_prepare(core);
1276 + ret = clk_core_prepare(core);
1277 + if (ret)
1278 + goto out;
1279
1280 flags = clk_enable_lock();
1281 - clk_core_enable(core);
1282 + ret = clk_core_enable(core);
1283 clk_enable_unlock(flags);
1284 + if (ret) {
1285 + clk_core_unprepare(core);
1286 + goto out;
1287 + }
1288 }
1289
1290 clk_core_reparent_orphans_nolock();
1291 diff --git a/drivers/clk/imx/clk-imx7ulp.c b/drivers/clk/imx/clk-imx7ulp.c
1292 index a0f650150367..04a3ae979281 100644
1293 --- a/drivers/clk/imx/clk-imx7ulp.c
1294 +++ b/drivers/clk/imx/clk-imx7ulp.c
1295 @@ -24,8 +24,8 @@ static const char * const spll_pfd_sels[] = { "spll_pfd0", "spll_pfd1", "spll_pf
1296 static const char * const spll_sels[] = { "spll", "spll_pfd_sel", };
1297 static const char * const apll_pfd_sels[] = { "apll_pfd0", "apll_pfd1", "apll_pfd2", "apll_pfd3", };
1298 static const char * const apll_sels[] = { "apll", "apll_pfd_sel", };
1299 -static const char * const scs_sels[] = { "dummy", "sosc", "sirc", "firc", "dummy", "apll_sel", "spll_sel", "upll", };
1300 -static const char * const ddr_sels[] = { "apll_pfd_sel", "upll", };
1301 +static const char * const scs_sels[] = { "dummy", "sosc", "sirc", "firc", "dummy", "apll_sel", "spll_sel", "dummy", };
1302 +static const char * const ddr_sels[] = { "apll_pfd_sel", "dummy", "dummy", "dummy", };
1303 static const char * const nic_sels[] = { "firc", "ddr_clk", };
1304 static const char * const periph_plat_sels[] = { "dummy", "nic1_bus_clk", "nic1_clk", "ddr_clk", "apll_pfd2", "apll_pfd1", "apll_pfd0", "upll", };
1305 static const char * const periph_bus_sels[] = { "dummy", "sosc_bus_clk", "mpll", "firc_bus_clk", "rosc", "nic1_bus_clk", "nic1_clk", "spll_bus_clk", };
1306 @@ -119,7 +119,7 @@ static void __init imx7ulp_clk_scg1_init(struct device_node *np)
1307 clks[IMX7ULP_CLK_SYS_SEL] = imx_clk_hw_mux2("scs_sel", base + 0x14, 24, 4, scs_sels, ARRAY_SIZE(scs_sels));
1308 clks[IMX7ULP_CLK_HSRUN_SYS_SEL] = imx_clk_hw_mux2("hsrun_scs_sel", base + 0x1c, 24, 4, scs_sels, ARRAY_SIZE(scs_sels));
1309 clks[IMX7ULP_CLK_NIC_SEL] = imx_clk_hw_mux2("nic_sel", base + 0x40, 28, 1, nic_sels, ARRAY_SIZE(nic_sels));
1310 - clks[IMX7ULP_CLK_DDR_SEL] = imx_clk_hw_mux_flags("ddr_sel", base + 0x30, 24, 1, ddr_sels, ARRAY_SIZE(ddr_sels), CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE);
1311 + clks[IMX7ULP_CLK_DDR_SEL] = imx_clk_hw_mux_flags("ddr_sel", base + 0x30, 24, 2, ddr_sels, ARRAY_SIZE(ddr_sels), CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE);
1312
1313 clks[IMX7ULP_CLK_CORE_DIV] = imx_clk_hw_divider_flags("divcore", "scs_sel", base + 0x14, 16, 4, CLK_SET_RATE_PARENT);
1314 clks[IMX7ULP_CLK_HSRUN_CORE_DIV] = imx_clk_hw_divider_flags("hsrun_divcore", "hsrun_scs_sel", base + 0x1c, 16, 4, CLK_SET_RATE_PARENT);
1315 diff --git a/drivers/clk/qcom/gcc-sdm845.c b/drivers/clk/qcom/gcc-sdm845.c
1316 index 95be125c3bdd..56d22dd225c9 100644
1317 --- a/drivers/clk/qcom/gcc-sdm845.c
1318 +++ b/drivers/clk/qcom/gcc-sdm845.c
1319 @@ -3255,6 +3255,7 @@ static struct gdsc hlos1_vote_aggre_noc_mmu_audio_tbu_gdsc = {
1320 .name = "hlos1_vote_aggre_noc_mmu_audio_tbu_gdsc",
1321 },
1322 .pwrsts = PWRSTS_OFF_ON,
1323 + .flags = VOTABLE,
1324 };
1325
1326 static struct gdsc hlos1_vote_aggre_noc_mmu_pcie_tbu_gdsc = {
1327 @@ -3263,6 +3264,7 @@ static struct gdsc hlos1_vote_aggre_noc_mmu_pcie_tbu_gdsc = {
1328 .name = "hlos1_vote_aggre_noc_mmu_pcie_tbu_gdsc",
1329 },
1330 .pwrsts = PWRSTS_OFF_ON,
1331 + .flags = VOTABLE,
1332 };
1333
1334 static struct gdsc hlos1_vote_aggre_noc_mmu_tbu1_gdsc = {
1335 @@ -3271,6 +3273,7 @@ static struct gdsc hlos1_vote_aggre_noc_mmu_tbu1_gdsc = {
1336 .name = "hlos1_vote_aggre_noc_mmu_tbu1_gdsc",
1337 },
1338 .pwrsts = PWRSTS_OFF_ON,
1339 + .flags = VOTABLE,
1340 };
1341
1342 static struct gdsc hlos1_vote_aggre_noc_mmu_tbu2_gdsc = {
1343 @@ -3279,6 +3282,7 @@ static struct gdsc hlos1_vote_aggre_noc_mmu_tbu2_gdsc = {
1344 .name = "hlos1_vote_aggre_noc_mmu_tbu2_gdsc",
1345 },
1346 .pwrsts = PWRSTS_OFF_ON,
1347 + .flags = VOTABLE,
1348 };
1349
1350 static struct gdsc hlos1_vote_mmnoc_mmu_tbu_hf0_gdsc = {
1351 @@ -3287,6 +3291,7 @@ static struct gdsc hlos1_vote_mmnoc_mmu_tbu_hf0_gdsc = {
1352 .name = "hlos1_vote_mmnoc_mmu_tbu_hf0_gdsc",
1353 },
1354 .pwrsts = PWRSTS_OFF_ON,
1355 + .flags = VOTABLE,
1356 };
1357
1358 static struct gdsc hlos1_vote_mmnoc_mmu_tbu_hf1_gdsc = {
1359 @@ -3295,6 +3300,7 @@ static struct gdsc hlos1_vote_mmnoc_mmu_tbu_hf1_gdsc = {
1360 .name = "hlos1_vote_mmnoc_mmu_tbu_hf1_gdsc",
1361 },
1362 .pwrsts = PWRSTS_OFF_ON,
1363 + .flags = VOTABLE,
1364 };
1365
1366 static struct gdsc hlos1_vote_mmnoc_mmu_tbu_sf_gdsc = {
1367 @@ -3303,6 +3309,7 @@ static struct gdsc hlos1_vote_mmnoc_mmu_tbu_sf_gdsc = {
1368 .name = "hlos1_vote_mmnoc_mmu_tbu_sf_gdsc",
1369 },
1370 .pwrsts = PWRSTS_OFF_ON,
1371 + .flags = VOTABLE,
1372 };
1373
1374 static struct clk_regmap *gcc_sdm845_clocks[] = {
1375 diff --git a/drivers/clk/samsung/clk-exynos5420.c b/drivers/clk/samsung/clk-exynos5420.c
1376 index 3b7601647d7b..27fd274e92f8 100644
1377 --- a/drivers/clk/samsung/clk-exynos5420.c
1378 +++ b/drivers/clk/samsung/clk-exynos5420.c
1379 @@ -12,6 +12,7 @@
1380 #include <linux/clk-provider.h>
1381 #include <linux/of.h>
1382 #include <linux/of_address.h>
1383 +#include <linux/clk.h>
1384
1385 #include "clk.h"
1386 #include "clk-cpu.h"
1387 @@ -1630,6 +1631,13 @@ static void __init exynos5x_clk_init(struct device_node *np,
1388 exynos5x_subcmus);
1389 }
1390
1391 + /*
1392 + * Keep top part of G3D clock path enabled permanently to ensure
1393 + * that the internal busses get their clock regardless of the
1394 + * main G3D clock enablement status.
1395 + */
1396 + clk_prepare_enable(__clk_lookup("mout_sw_aclk_g3d"));
1397 +
1398 samsung_clk_of_add_provider(np, ctx);
1399 }
1400
1401 diff --git a/drivers/clk/sprd/common.c b/drivers/clk/sprd/common.c
1402 index 9d56eac43832..7ad5ba26dfba 100644
1403 --- a/drivers/clk/sprd/common.c
1404 +++ b/drivers/clk/sprd/common.c
1405 @@ -46,7 +46,7 @@ int sprd_clk_regmap_init(struct platform_device *pdev,
1406
1407 if (of_find_property(node, "sprd,syscon", NULL)) {
1408 regmap = syscon_regmap_lookup_by_phandle(node, "sprd,syscon");
1409 - if (IS_ERR_OR_NULL(regmap)) {
1410 + if (IS_ERR(regmap)) {
1411 pr_err("%s: failed to get syscon regmap\n", __func__);
1412 return PTR_ERR(regmap);
1413 }
1414 diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-r40.c b/drivers/clk/sunxi-ng/ccu-sun8i-r40.c
1415 index 897490800102..23bfe1d12f21 100644
1416 --- a/drivers/clk/sunxi-ng/ccu-sun8i-r40.c
1417 +++ b/drivers/clk/sunxi-ng/ccu-sun8i-r40.c
1418 @@ -761,7 +761,8 @@ static struct ccu_mp outa_clk = {
1419 .reg = 0x1f0,
1420 .features = CCU_FEATURE_FIXED_PREDIV,
1421 .hw.init = CLK_HW_INIT_PARENTS("outa", out_parents,
1422 - &ccu_mp_ops, 0),
1423 + &ccu_mp_ops,
1424 + CLK_SET_RATE_PARENT),
1425 }
1426 };
1427
1428 @@ -779,7 +780,8 @@ static struct ccu_mp outb_clk = {
1429 .reg = 0x1f4,
1430 .features = CCU_FEATURE_FIXED_PREDIV,
1431 .hw.init = CLK_HW_INIT_PARENTS("outb", out_parents,
1432 - &ccu_mp_ops, 0),
1433 + &ccu_mp_ops,
1434 + CLK_SET_RATE_PARENT),
1435 }
1436 };
1437
1438 diff --git a/drivers/cpuidle/governors/teo.c b/drivers/cpuidle/governors/teo.c
1439 index b9b9156618e6..703047434ee1 100644
1440 --- a/drivers/cpuidle/governors/teo.c
1441 +++ b/drivers/cpuidle/governors/teo.c
1442 @@ -194,7 +194,7 @@ static void teo_update(struct cpuidle_driver *drv, struct cpuidle_device *dev)
1443 * pattern detection.
1444 */
1445 cpu_data->intervals[cpu_data->interval_idx++] = measured_us;
1446 - if (cpu_data->interval_idx > INTERVALS)
1447 + if (cpu_data->interval_idx >= INTERVALS)
1448 cpu_data->interval_idx = 0;
1449 }
1450
1451 diff --git a/drivers/firmware/efi/earlycon.c b/drivers/firmware/efi/earlycon.c
1452 index d4077db6dc97..5d4f84781aa0 100644
1453 --- a/drivers/firmware/efi/earlycon.c
1454 +++ b/drivers/firmware/efi/earlycon.c
1455 @@ -17,7 +17,7 @@ static const struct console *earlycon_console __initdata;
1456 static const struct font_desc *font;
1457 static u32 efi_x, efi_y;
1458 static u64 fb_base;
1459 -static pgprot_t fb_prot;
1460 +static bool fb_wb;
1461 static void *efi_fb;
1462
1463 /*
1464 @@ -33,10 +33,8 @@ static int __init efi_earlycon_remap_fb(void)
1465 if (!earlycon_console || !(earlycon_console->flags & CON_ENABLED))
1466 return 0;
1467
1468 - if (pgprot_val(fb_prot) == pgprot_val(PAGE_KERNEL))
1469 - efi_fb = memremap(fb_base, screen_info.lfb_size, MEMREMAP_WB);
1470 - else
1471 - efi_fb = memremap(fb_base, screen_info.lfb_size, MEMREMAP_WC);
1472 + efi_fb = memremap(fb_base, screen_info.lfb_size,
1473 + fb_wb ? MEMREMAP_WB : MEMREMAP_WC);
1474
1475 return efi_fb ? 0 : -ENOMEM;
1476 }
1477 @@ -53,9 +51,12 @@ late_initcall(efi_earlycon_unmap_fb);
1478
1479 static __ref void *efi_earlycon_map(unsigned long start, unsigned long len)
1480 {
1481 + pgprot_t fb_prot;
1482 +
1483 if (efi_fb)
1484 return efi_fb + start;
1485
1486 + fb_prot = fb_wb ? PAGE_KERNEL : pgprot_writecombine(PAGE_KERNEL);
1487 return early_memremap_prot(fb_base + start, len, pgprot_val(fb_prot));
1488 }
1489
1490 @@ -215,10 +216,7 @@ static int __init efi_earlycon_setup(struct earlycon_device *device,
1491 if (screen_info.capabilities & VIDEO_CAPABILITY_64BIT_BASE)
1492 fb_base |= (u64)screen_info.ext_lfb_base << 32;
1493
1494 - if (opt && !strcmp(opt, "ram"))
1495 - fb_prot = PAGE_KERNEL;
1496 - else
1497 - fb_prot = pgprot_writecombine(PAGE_KERNEL);
1498 + fb_wb = opt && !strcmp(opt, "ram");
1499
1500 si = &screen_info;
1501 xres = si->lfb_width;
1502 diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
1503 index 38e096e6925f..ceb908f7dbe5 100644
1504 --- a/drivers/gpio/Kconfig
1505 +++ b/drivers/gpio/Kconfig
1506 @@ -546,7 +546,6 @@ config GPIO_THUNDERX
1507 tristate "Cavium ThunderX/OCTEON-TX GPIO"
1508 depends on ARCH_THUNDER || (64BIT && COMPILE_TEST)
1509 depends on PCI_MSI
1510 - select GPIOLIB_IRQCHIP
1511 select IRQ_DOMAIN_HIERARCHY
1512 select IRQ_FASTEOI_HIERARCHY_HANDLERS
1513 help
1514 diff --git a/drivers/gpio/gpio-thunderx.c b/drivers/gpio/gpio-thunderx.c
1515 index ddad5c7ea617..715371b5102a 100644
1516 --- a/drivers/gpio/gpio-thunderx.c
1517 +++ b/drivers/gpio/gpio-thunderx.c
1518 @@ -53,6 +53,7 @@ struct thunderx_line {
1519 struct thunderx_gpio {
1520 struct gpio_chip chip;
1521 u8 __iomem *register_base;
1522 + struct irq_domain *irqd;
1523 struct msix_entry *msix_entries; /* per line MSI-X */
1524 struct thunderx_line *line_entries; /* per line irq info */
1525 raw_spinlock_t lock;
1526 @@ -282,60 +283,54 @@ static void thunderx_gpio_set_multiple(struct gpio_chip *chip,
1527 }
1528 }
1529
1530 -static void thunderx_gpio_irq_ack(struct irq_data *d)
1531 +static void thunderx_gpio_irq_ack(struct irq_data *data)
1532 {
1533 - struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
1534 - struct thunderx_gpio *txgpio = gpiochip_get_data(gc);
1535 + struct thunderx_line *txline = irq_data_get_irq_chip_data(data);
1536
1537 writeq(GPIO_INTR_INTR,
1538 - txgpio->register_base + intr_reg(irqd_to_hwirq(d)));
1539 + txline->txgpio->register_base + intr_reg(txline->line));
1540 }
1541
1542 -static void thunderx_gpio_irq_mask(struct irq_data *d)
1543 +static void thunderx_gpio_irq_mask(struct irq_data *data)
1544 {
1545 - struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
1546 - struct thunderx_gpio *txgpio = gpiochip_get_data(gc);
1547 + struct thunderx_line *txline = irq_data_get_irq_chip_data(data);
1548
1549 writeq(GPIO_INTR_ENA_W1C,
1550 - txgpio->register_base + intr_reg(irqd_to_hwirq(d)));
1551 + txline->txgpio->register_base + intr_reg(txline->line));
1552 }
1553
1554 -static void thunderx_gpio_irq_mask_ack(struct irq_data *d)
1555 +static void thunderx_gpio_irq_mask_ack(struct irq_data *data)
1556 {
1557 - struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
1558 - struct thunderx_gpio *txgpio = gpiochip_get_data(gc);
1559 + struct thunderx_line *txline = irq_data_get_irq_chip_data(data);
1560
1561 writeq(GPIO_INTR_ENA_W1C | GPIO_INTR_INTR,
1562 - txgpio->register_base + intr_reg(irqd_to_hwirq(d)));
1563 + txline->txgpio->register_base + intr_reg(txline->line));
1564 }
1565
1566 -static void thunderx_gpio_irq_unmask(struct irq_data *d)
1567 +static void thunderx_gpio_irq_unmask(struct irq_data *data)
1568 {
1569 - struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
1570 - struct thunderx_gpio *txgpio = gpiochip_get_data(gc);
1571 + struct thunderx_line *txline = irq_data_get_irq_chip_data(data);
1572
1573 writeq(GPIO_INTR_ENA_W1S,
1574 - txgpio->register_base + intr_reg(irqd_to_hwirq(d)));
1575 + txline->txgpio->register_base + intr_reg(txline->line));
1576 }
1577
1578 -static int thunderx_gpio_irq_set_type(struct irq_data *d,
1579 +static int thunderx_gpio_irq_set_type(struct irq_data *data,
1580 unsigned int flow_type)
1581 {
1582 - struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
1583 - struct thunderx_gpio *txgpio = gpiochip_get_data(gc);
1584 - struct thunderx_line *txline =
1585 - &txgpio->line_entries[irqd_to_hwirq(d)];
1586 + struct thunderx_line *txline = irq_data_get_irq_chip_data(data);
1587 + struct thunderx_gpio *txgpio = txline->txgpio;
1588 u64 bit_cfg;
1589
1590 - irqd_set_trigger_type(d, flow_type);
1591 + irqd_set_trigger_type(data, flow_type);
1592
1593 bit_cfg = txline->fil_bits | GPIO_BIT_CFG_INT_EN;
1594
1595 if (flow_type & IRQ_TYPE_EDGE_BOTH) {
1596 - irq_set_handler_locked(d, handle_fasteoi_ack_irq);
1597 + irq_set_handler_locked(data, handle_fasteoi_ack_irq);
1598 bit_cfg |= GPIO_BIT_CFG_INT_TYPE;
1599 } else {
1600 - irq_set_handler_locked(d, handle_fasteoi_mask_irq);
1601 + irq_set_handler_locked(data, handle_fasteoi_mask_irq);
1602 }
1603
1604 raw_spin_lock(&txgpio->lock);
1605 @@ -364,6 +359,33 @@ static void thunderx_gpio_irq_disable(struct irq_data *data)
1606 irq_chip_disable_parent(data);
1607 }
1608
1609 +static int thunderx_gpio_irq_request_resources(struct irq_data *data)
1610 +{
1611 + struct thunderx_line *txline = irq_data_get_irq_chip_data(data);
1612 + struct thunderx_gpio *txgpio = txline->txgpio;
1613 + int r;
1614 +
1615 + r = gpiochip_lock_as_irq(&txgpio->chip, txline->line);
1616 + if (r)
1617 + return r;
1618 +
1619 + r = irq_chip_request_resources_parent(data);
1620 + if (r)
1621 + gpiochip_unlock_as_irq(&txgpio->chip, txline->line);
1622 +
1623 + return r;
1624 +}
1625 +
1626 +static void thunderx_gpio_irq_release_resources(struct irq_data *data)
1627 +{
1628 + struct thunderx_line *txline = irq_data_get_irq_chip_data(data);
1629 + struct thunderx_gpio *txgpio = txline->txgpio;
1630 +
1631 + irq_chip_release_resources_parent(data);
1632 +
1633 + gpiochip_unlock_as_irq(&txgpio->chip, txline->line);
1634 +}
1635 +
1636 /*
1637 * Interrupts are chained from underlying MSI-X vectors. We have
1638 * these irq_chip functions to be able to handle level triggering
1639 @@ -380,24 +402,50 @@ static struct irq_chip thunderx_gpio_irq_chip = {
1640 .irq_unmask = thunderx_gpio_irq_unmask,
1641 .irq_eoi = irq_chip_eoi_parent,
1642 .irq_set_affinity = irq_chip_set_affinity_parent,
1643 + .irq_request_resources = thunderx_gpio_irq_request_resources,
1644 + .irq_release_resources = thunderx_gpio_irq_release_resources,
1645 .irq_set_type = thunderx_gpio_irq_set_type,
1646
1647 .flags = IRQCHIP_SET_TYPE_MASKED
1648 };
1649
1650 -static int thunderx_gpio_child_to_parent_hwirq(struct gpio_chip *gc,
1651 - unsigned int child,
1652 - unsigned int child_type,
1653 - unsigned int *parent,
1654 - unsigned int *parent_type)
1655 +static int thunderx_gpio_irq_translate(struct irq_domain *d,
1656 + struct irq_fwspec *fwspec,
1657 + irq_hw_number_t *hwirq,
1658 + unsigned int *type)
1659 {
1660 - struct thunderx_gpio *txgpio = gpiochip_get_data(gc);
1661 -
1662 - *parent = txgpio->base_msi + (2 * child);
1663 - *parent_type = IRQ_TYPE_LEVEL_HIGH;
1664 + struct thunderx_gpio *txgpio = d->host_data;
1665 +
1666 + if (WARN_ON(fwspec->param_count < 2))
1667 + return -EINVAL;
1668 + if (fwspec->param[0] >= txgpio->chip.ngpio)
1669 + return -EINVAL;
1670 + *hwirq = fwspec->param[0];
1671 + *type = fwspec->param[1] & IRQ_TYPE_SENSE_MASK;
1672 return 0;
1673 }
1674
1675 +static int thunderx_gpio_irq_alloc(struct irq_domain *d, unsigned int virq,
1676 + unsigned int nr_irqs, void *arg)
1677 +{
1678 + struct thunderx_line *txline = arg;
1679 +
1680 + return irq_domain_set_hwirq_and_chip(d, virq, txline->line,
1681 + &thunderx_gpio_irq_chip, txline);
1682 +}
1683 +
1684 +static const struct irq_domain_ops thunderx_gpio_irqd_ops = {
1685 + .alloc = thunderx_gpio_irq_alloc,
1686 + .translate = thunderx_gpio_irq_translate
1687 +};
1688 +
1689 +static int thunderx_gpio_to_irq(struct gpio_chip *chip, unsigned int offset)
1690 +{
1691 + struct thunderx_gpio *txgpio = gpiochip_get_data(chip);
1692 +
1693 + return irq_find_mapping(txgpio->irqd, offset);
1694 +}
1695 +
1696 static int thunderx_gpio_probe(struct pci_dev *pdev,
1697 const struct pci_device_id *id)
1698 {
1699 @@ -405,7 +453,6 @@ static int thunderx_gpio_probe(struct pci_dev *pdev,
1700 struct device *dev = &pdev->dev;
1701 struct thunderx_gpio *txgpio;
1702 struct gpio_chip *chip;
1703 - struct gpio_irq_chip *girq;
1704 int ngpio, i;
1705 int err = 0;
1706
1707 @@ -450,8 +497,8 @@ static int thunderx_gpio_probe(struct pci_dev *pdev,
1708 }
1709
1710 txgpio->msix_entries = devm_kcalloc(dev,
1711 - ngpio, sizeof(struct msix_entry),
1712 - GFP_KERNEL);
1713 + ngpio, sizeof(struct msix_entry),
1714 + GFP_KERNEL);
1715 if (!txgpio->msix_entries) {
1716 err = -ENOMEM;
1717 goto out;
1718 @@ -492,6 +539,27 @@ static int thunderx_gpio_probe(struct pci_dev *pdev,
1719 if (err < 0)
1720 goto out;
1721
1722 + /*
1723 + * Push GPIO specific irqdomain on hierarchy created as a side
1724 + * effect of the pci_enable_msix()
1725 + */
1726 + txgpio->irqd = irq_domain_create_hierarchy(irq_get_irq_data(txgpio->msix_entries[0].vector)->domain,
1727 + 0, 0, of_node_to_fwnode(dev->of_node),
1728 + &thunderx_gpio_irqd_ops, txgpio);
1729 + if (!txgpio->irqd) {
1730 + err = -ENOMEM;
1731 + goto out;
1732 + }
1733 +
1734 + /* Push on irq_data and the domain for each line. */
1735 + for (i = 0; i < ngpio; i++) {
1736 + err = irq_domain_push_irq(txgpio->irqd,
1737 + txgpio->msix_entries[i].vector,
1738 + &txgpio->line_entries[i]);
1739 + if (err < 0)
1740 + dev_err(dev, "irq_domain_push_irq: %d\n", err);
1741 + }
1742 +
1743 chip->label = KBUILD_MODNAME;
1744 chip->parent = dev;
1745 chip->owner = THIS_MODULE;
1746 @@ -506,28 +574,11 @@ static int thunderx_gpio_probe(struct pci_dev *pdev,
1747 chip->set = thunderx_gpio_set;
1748 chip->set_multiple = thunderx_gpio_set_multiple;
1749 chip->set_config = thunderx_gpio_set_config;
1750 - girq = &chip->irq;
1751 - girq->chip = &thunderx_gpio_irq_chip;
1752 - girq->fwnode = of_node_to_fwnode(dev->of_node);
1753 - girq->parent_domain =
1754 - irq_get_irq_data(txgpio->msix_entries[0].vector)->domain;
1755 - girq->child_to_parent_hwirq = thunderx_gpio_child_to_parent_hwirq;
1756 - girq->handler = handle_bad_irq;
1757 - girq->default_type = IRQ_TYPE_NONE;
1758 -
1759 + chip->to_irq = thunderx_gpio_to_irq;
1760 err = devm_gpiochip_add_data(dev, chip, txgpio);
1761 if (err)
1762 goto out;
1763
1764 - /* Push on irq_data and the domain for each line. */
1765 - for (i = 0; i < ngpio; i++) {
1766 - err = irq_domain_push_irq(chip->irq.domain,
1767 - txgpio->msix_entries[i].vector,
1768 - chip);
1769 - if (err < 0)
1770 - dev_err(dev, "irq_domain_push_irq: %d\n", err);
1771 - }
1772 -
1773 dev_info(dev, "ThunderX GPIO: %d lines with base %d.\n",
1774 ngpio, chip->base);
1775 return 0;
1776 @@ -542,10 +593,10 @@ static void thunderx_gpio_remove(struct pci_dev *pdev)
1777 struct thunderx_gpio *txgpio = pci_get_drvdata(pdev);
1778
1779 for (i = 0; i < txgpio->chip.ngpio; i++)
1780 - irq_domain_pop_irq(txgpio->chip.irq.domain,
1781 + irq_domain_pop_irq(txgpio->irqd,
1782 txgpio->msix_entries[i].vector);
1783
1784 - irq_domain_remove(txgpio->chip.irq.domain);
1785 + irq_domain_remove(txgpio->irqd);
1786
1787 pci_set_drvdata(pdev, NULL);
1788 }
1789 diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
1790 index ab4a0d8545dc..0125ea7c4103 100644
1791 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
1792 +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
1793 @@ -2923,7 +2923,9 @@ static void gfx_v9_0_init_pg(struct amdgpu_device *adev)
1794 * And it's needed by gfxoff feature.
1795 */
1796 if (adev->gfx.rlc.is_rlc_v2_1) {
1797 - if (adev->asic_type == CHIP_VEGA12)
1798 + if (adev->asic_type == CHIP_VEGA12 ||
1799 + (adev->asic_type == CHIP_RAVEN &&
1800 + adev->rev_id >= 8))
1801 gfx_v9_1_init_rlc_save_restore_list(adev);
1802 gfx_v9_0_enable_save_restore_machine(adev);
1803 }
1804 diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
1805 index 793aa8e8ec9a..c0f1c62c59b4 100644
1806 --- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c
1807 +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
1808 @@ -809,8 +809,8 @@ bool dc_link_detect(struct dc_link *link, enum dc_detect_reason reason)
1809 }
1810
1811 case SIGNAL_TYPE_EDP: {
1812 - read_edp_current_link_settings_on_detect(link);
1813 detect_edp_sink_caps(link);
1814 + read_edp_current_link_settings_on_detect(link);
1815 sink_caps.transaction_type =
1816 DDC_TRANSACTION_TYPE_I2C_OVER_AUX;
1817 sink_caps.signal = SIGNAL_TYPE_EDP;
1818 diff --git a/drivers/gpu/drm/i915/selftests/i915_random.h b/drivers/gpu/drm/i915/selftests/i915_random.h
1819 index 8e1ff9c105b6..22335cee2203 100644
1820 --- a/drivers/gpu/drm/i915/selftests/i915_random.h
1821 +++ b/drivers/gpu/drm/i915/selftests/i915_random.h
1822 @@ -25,6 +25,7 @@
1823 #ifndef __I915_SELFTESTS_RANDOM_H__
1824 #define __I915_SELFTESTS_RANDOM_H__
1825
1826 +#include <linux/math64.h>
1827 #include <linux/random.h>
1828
1829 #include "../i915_selftest.h"
1830 diff --git a/drivers/hwmon/pmbus/ibm-cffps.c b/drivers/hwmon/pmbus/ibm-cffps.c
1831 index d44745e498e7..929c909ac27a 100644
1832 --- a/drivers/hwmon/pmbus/ibm-cffps.c
1833 +++ b/drivers/hwmon/pmbus/ibm-cffps.c
1834 @@ -39,9 +39,13 @@
1835 #define CFFPS_MFR_VAUX_FAULT BIT(6)
1836 #define CFFPS_MFR_CURRENT_SHARE_WARNING BIT(7)
1837
1838 +/*
1839 + * LED off state actually relinquishes LED control to PSU firmware, so it can
1840 + * turn on the LED for faults.
1841 + */
1842 +#define CFFPS_LED_OFF 0
1843 #define CFFPS_LED_BLINK BIT(0)
1844 #define CFFPS_LED_ON BIT(1)
1845 -#define CFFPS_LED_OFF BIT(2)
1846 #define CFFPS_BLINK_RATE_MS 250
1847
1848 enum {
1849 @@ -292,28 +296,38 @@ static int ibm_cffps_read_word_data(struct i2c_client *client, int page,
1850 return rc;
1851 }
1852
1853 -static void ibm_cffps_led_brightness_set(struct led_classdev *led_cdev,
1854 - enum led_brightness brightness)
1855 +static int ibm_cffps_led_brightness_set(struct led_classdev *led_cdev,
1856 + enum led_brightness brightness)
1857 {
1858 int rc;
1859 + u8 next_led_state;
1860 struct ibm_cffps *psu = container_of(led_cdev, struct ibm_cffps, led);
1861
1862 if (brightness == LED_OFF) {
1863 - psu->led_state = CFFPS_LED_OFF;
1864 + next_led_state = CFFPS_LED_OFF;
1865 } else {
1866 brightness = LED_FULL;
1867 +
1868 if (psu->led_state != CFFPS_LED_BLINK)
1869 - psu->led_state = CFFPS_LED_ON;
1870 + next_led_state = CFFPS_LED_ON;
1871 + else
1872 + next_led_state = CFFPS_LED_BLINK;
1873 }
1874
1875 + dev_dbg(&psu->client->dev, "LED brightness set: %d. Command: %d.\n",
1876 + brightness, next_led_state);
1877 +
1878 pmbus_set_page(psu->client, 0);
1879
1880 rc = i2c_smbus_write_byte_data(psu->client, CFFPS_SYS_CONFIG_CMD,
1881 - psu->led_state);
1882 + next_led_state);
1883 if (rc < 0)
1884 - return;
1885 + return rc;
1886
1887 + psu->led_state = next_led_state;
1888 led_cdev->brightness = brightness;
1889 +
1890 + return 0;
1891 }
1892
1893 static int ibm_cffps_led_blink_set(struct led_classdev *led_cdev,
1894 @@ -323,10 +337,7 @@ static int ibm_cffps_led_blink_set(struct led_classdev *led_cdev,
1895 int rc;
1896 struct ibm_cffps *psu = container_of(led_cdev, struct ibm_cffps, led);
1897
1898 - psu->led_state = CFFPS_LED_BLINK;
1899 -
1900 - if (led_cdev->brightness == LED_OFF)
1901 - return 0;
1902 + dev_dbg(&psu->client->dev, "LED blink set.\n");
1903
1904 pmbus_set_page(psu->client, 0);
1905
1906 @@ -335,6 +346,8 @@ static int ibm_cffps_led_blink_set(struct led_classdev *led_cdev,
1907 if (rc < 0)
1908 return rc;
1909
1910 + psu->led_state = CFFPS_LED_BLINK;
1911 + led_cdev->brightness = LED_FULL;
1912 *delay_on = CFFPS_BLINK_RATE_MS;
1913 *delay_off = CFFPS_BLINK_RATE_MS;
1914
1915 @@ -351,7 +364,7 @@ static void ibm_cffps_create_led_class(struct ibm_cffps *psu)
1916 client->addr);
1917 psu->led.name = psu->led_name;
1918 psu->led.max_brightness = LED_FULL;
1919 - psu->led.brightness_set = ibm_cffps_led_brightness_set;
1920 + psu->led.brightness_set_blocking = ibm_cffps_led_brightness_set;
1921 psu->led.blink_set = ibm_cffps_led_blink_set;
1922
1923 rc = devm_led_classdev_register(dev, &psu->led);
1924 diff --git a/drivers/i2c/busses/i2c-iop3xx.c b/drivers/i2c/busses/i2c-iop3xx.c
1925 index 38556381f4ca..2f8b8050a223 100644
1926 --- a/drivers/i2c/busses/i2c-iop3xx.c
1927 +++ b/drivers/i2c/busses/i2c-iop3xx.c
1928 @@ -433,13 +433,17 @@ iop3xx_i2c_probe(struct platform_device *pdev)
1929 adapter_data->gpio_scl = devm_gpiod_get_optional(&pdev->dev,
1930 "scl",
1931 GPIOD_ASIS);
1932 - if (IS_ERR(adapter_data->gpio_scl))
1933 - return PTR_ERR(adapter_data->gpio_scl);
1934 + if (IS_ERR(adapter_data->gpio_scl)) {
1935 + ret = PTR_ERR(adapter_data->gpio_scl);
1936 + goto free_both;
1937 + }
1938 adapter_data->gpio_sda = devm_gpiod_get_optional(&pdev->dev,
1939 "sda",
1940 GPIOD_ASIS);
1941 - if (IS_ERR(adapter_data->gpio_sda))
1942 - return PTR_ERR(adapter_data->gpio_sda);
1943 + if (IS_ERR(adapter_data->gpio_sda)) {
1944 + ret = PTR_ERR(adapter_data->gpio_sda);
1945 + goto free_both;
1946 + }
1947
1948 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1949 if (!res) {
1950 diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
1951 index c1683f9338b4..dbc43cfec19d 100644
1952 --- a/drivers/i2c/busses/i2c-tegra.c
1953 +++ b/drivers/i2c/busses/i2c-tegra.c
1954 @@ -1608,14 +1608,18 @@ static int tegra_i2c_probe(struct platform_device *pdev)
1955 }
1956
1957 pm_runtime_enable(&pdev->dev);
1958 - if (!pm_runtime_enabled(&pdev->dev))
1959 + if (!pm_runtime_enabled(&pdev->dev)) {
1960 ret = tegra_i2c_runtime_resume(&pdev->dev);
1961 - else
1962 + if (ret < 0) {
1963 + dev_err(&pdev->dev, "runtime resume failed\n");
1964 + goto unprepare_div_clk;
1965 + }
1966 + } else {
1967 ret = pm_runtime_get_sync(i2c_dev->dev);
1968 -
1969 - if (ret < 0) {
1970 - dev_err(&pdev->dev, "runtime resume failed\n");
1971 - goto unprepare_div_clk;
1972 + if (ret < 0) {
1973 + dev_err(&pdev->dev, "runtime resume failed\n");
1974 + goto disable_rpm;
1975 + }
1976 }
1977
1978 if (i2c_dev->is_multimaster_mode) {
1979 @@ -1623,7 +1627,7 @@ static int tegra_i2c_probe(struct platform_device *pdev)
1980 if (ret < 0) {
1981 dev_err(i2c_dev->dev, "div_clk enable failed %d\n",
1982 ret);
1983 - goto disable_rpm;
1984 + goto put_rpm;
1985 }
1986 }
1987
1988 @@ -1671,11 +1675,16 @@ disable_div_clk:
1989 if (i2c_dev->is_multimaster_mode)
1990 clk_disable(i2c_dev->div_clk);
1991
1992 -disable_rpm:
1993 - pm_runtime_disable(&pdev->dev);
1994 - if (!pm_runtime_status_suspended(&pdev->dev))
1995 +put_rpm:
1996 + if (pm_runtime_enabled(&pdev->dev))
1997 + pm_runtime_put_sync(&pdev->dev);
1998 + else
1999 tegra_i2c_runtime_suspend(&pdev->dev);
2000
2001 +disable_rpm:
2002 + if (pm_runtime_enabled(&pdev->dev))
2003 + pm_runtime_disable(&pdev->dev);
2004 +
2005 unprepare_div_clk:
2006 clk_unprepare(i2c_dev->div_clk);
2007
2008 @@ -1710,9 +1719,14 @@ static int tegra_i2c_remove(struct platform_device *pdev)
2009 static int __maybe_unused tegra_i2c_suspend(struct device *dev)
2010 {
2011 struct tegra_i2c_dev *i2c_dev = dev_get_drvdata(dev);
2012 + int err;
2013
2014 i2c_mark_adapter_suspended(&i2c_dev->adapter);
2015
2016 + err = pm_runtime_force_suspend(dev);
2017 + if (err < 0)
2018 + return err;
2019 +
2020 return 0;
2021 }
2022
2023 @@ -1733,6 +1747,10 @@ static int __maybe_unused tegra_i2c_resume(struct device *dev)
2024 if (err)
2025 return err;
2026
2027 + err = pm_runtime_force_resume(dev);
2028 + if (err < 0)
2029 + return err;
2030 +
2031 i2c_mark_adapter_resumed(&i2c_dev->adapter);
2032
2033 return 0;
2034 diff --git a/drivers/iio/adc/ad7124.c b/drivers/iio/adc/ad7124.c
2035 index 3f03abf100b5..306bf15023a7 100644
2036 --- a/drivers/iio/adc/ad7124.c
2037 +++ b/drivers/iio/adc/ad7124.c
2038 @@ -494,13 +494,11 @@ static int ad7124_of_parse_channel_config(struct iio_dev *indio_dev,
2039 st->channel_config[channel].buf_negative =
2040 of_property_read_bool(child, "adi,buffered-negative");
2041
2042 - *chan = ad7124_channel_template;
2043 - chan->address = channel;
2044 - chan->scan_index = channel;
2045 - chan->channel = ain[0];
2046 - chan->channel2 = ain[1];
2047 -
2048 - chan++;
2049 + chan[channel] = ad7124_channel_template;
2050 + chan[channel].address = channel;
2051 + chan[channel].scan_index = channel;
2052 + chan[channel].channel = ain[0];
2053 + chan[channel].channel2 = ain[1];
2054 }
2055
2056 return 0;
2057 diff --git a/drivers/iio/chemical/Kconfig b/drivers/iio/chemical/Kconfig
2058 index fa4586037bb8..0b91de4df8f4 100644
2059 --- a/drivers/iio/chemical/Kconfig
2060 +++ b/drivers/iio/chemical/Kconfig
2061 @@ -65,6 +65,7 @@ config IAQCORE
2062 config PMS7003
2063 tristate "Plantower PMS7003 particulate matter sensor"
2064 depends on SERIAL_DEV_BUS
2065 + select IIO_BUFFER
2066 select IIO_TRIGGERED_BUFFER
2067 help
2068 Say Y here to build support for the Plantower PMS7003 particulate
2069 diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
2070 index 3e0528793d95..057a4b010010 100644
2071 --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
2072 +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
2073 @@ -911,7 +911,8 @@ static int st_lsm6dsx_check_whoami(struct st_lsm6dsx_hw *hw, int id,
2074
2075 for (i = 0; i < ARRAY_SIZE(st_lsm6dsx_sensor_settings); i++) {
2076 for (j = 0; j < ST_LSM6DSX_MAX_ID; j++) {
2077 - if (id == st_lsm6dsx_sensor_settings[i].id[j].hw_id)
2078 + if (st_lsm6dsx_sensor_settings[i].id[j].name &&
2079 + id == st_lsm6dsx_sensor_settings[i].id[j].hw_id)
2080 break;
2081 }
2082 if (j < ST_LSM6DSX_MAX_ID)
2083 diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
2084 index c193d64e5217..112225c0e486 100644
2085 --- a/drivers/iio/industrialio-buffer.c
2086 +++ b/drivers/iio/industrialio-buffer.c
2087 @@ -566,7 +566,7 @@ static int iio_compute_scan_bytes(struct iio_dev *indio_dev,
2088 const unsigned long *mask, bool timestamp)
2089 {
2090 unsigned bytes = 0;
2091 - int length, i;
2092 + int length, i, largest = 0;
2093
2094 /* How much space will the demuxed element take? */
2095 for_each_set_bit(i, mask,
2096 @@ -574,13 +574,17 @@ static int iio_compute_scan_bytes(struct iio_dev *indio_dev,
2097 length = iio_storage_bytes_for_si(indio_dev, i);
2098 bytes = ALIGN(bytes, length);
2099 bytes += length;
2100 + largest = max(largest, length);
2101 }
2102
2103 if (timestamp) {
2104 length = iio_storage_bytes_for_timestamp(indio_dev);
2105 bytes = ALIGN(bytes, length);
2106 bytes += length;
2107 + largest = max(largest, length);
2108 }
2109 +
2110 + bytes = ALIGN(bytes, largest);
2111 return bytes;
2112 }
2113
2114 diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c
2115 index 16dacea9eadf..b0e241aaefb4 100644
2116 --- a/drivers/iio/light/vcnl4000.c
2117 +++ b/drivers/iio/light/vcnl4000.c
2118 @@ -163,7 +163,6 @@ static int vcnl4200_init(struct vcnl4000_data *data)
2119 if (ret < 0)
2120 return ret;
2121
2122 - data->al_scale = 24000;
2123 data->vcnl4200_al.reg = VCNL4200_AL_DATA;
2124 data->vcnl4200_ps.reg = VCNL4200_PS_DATA;
2125 switch (id) {
2126 @@ -172,11 +171,13 @@ static int vcnl4200_init(struct vcnl4000_data *data)
2127 /* show 54ms in total. */
2128 data->vcnl4200_al.sampling_rate = ktime_set(0, 54000 * 1000);
2129 data->vcnl4200_ps.sampling_rate = ktime_set(0, 4200 * 1000);
2130 + data->al_scale = 24000;
2131 break;
2132 case VCNL4040_PROD_ID:
2133 /* Integration time is 80ms, add 10ms. */
2134 data->vcnl4200_al.sampling_rate = ktime_set(0, 100000 * 1000);
2135 data->vcnl4200_ps.sampling_rate = ktime_set(0, 100000 * 1000);
2136 + data->al_scale = 120000;
2137 break;
2138 }
2139 data->vcnl4200_al.last_measurement = ktime_set(0, 0);
2140 diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
2141 index ccbb8973a324..97f9c001d8ff 100644
2142 --- a/drivers/irqchip/Kconfig
2143 +++ b/drivers/irqchip/Kconfig
2144 @@ -483,8 +483,6 @@ config TI_SCI_INTA_IRQCHIP
2145 If you wish to use interrupt aggregator irq resources managed by the
2146 TI System Controller, say Y here. Otherwise, say N.
2147
2148 -endmenu
2149 -
2150 config SIFIVE_PLIC
2151 bool "SiFive Platform-Level Interrupt Controller"
2152 depends on RISCV
2153 @@ -496,3 +494,5 @@ config SIFIVE_PLIC
2154 interrupt sources are subordinate to the PLIC.
2155
2156 If you don't know what to do here, say Y.
2157 +
2158 +endmenu
2159 diff --git a/drivers/md/dm-snap-persistent.c b/drivers/md/dm-snap-persistent.c
2160 index 3c50c4e4da8f..963d3774c93e 100644
2161 --- a/drivers/md/dm-snap-persistent.c
2162 +++ b/drivers/md/dm-snap-persistent.c
2163 @@ -17,7 +17,7 @@
2164 #include <linux/dm-bufio.h>
2165
2166 #define DM_MSG_PREFIX "persistent snapshot"
2167 -#define DM_CHUNK_SIZE_DEFAULT_SECTORS 32 /* 16KB */
2168 +#define DM_CHUNK_SIZE_DEFAULT_SECTORS 32U /* 16KB */
2169
2170 #define DM_PREFETCH_CHUNKS 12
2171
2172 diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
2173 index b7c20979bd19..322386ff5d22 100644
2174 --- a/drivers/md/raid0.c
2175 +++ b/drivers/md/raid0.c
2176 @@ -87,7 +87,7 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf)
2177 char b[BDEVNAME_SIZE];
2178 char b2[BDEVNAME_SIZE];
2179 struct r0conf *conf = kzalloc(sizeof(*conf), GFP_KERNEL);
2180 - unsigned short blksize = 512;
2181 + unsigned blksize = 512;
2182
2183 *private_conf = ERR_PTR(-ENOMEM);
2184 if (!conf)
2185 diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c
2186 index f9ac22413000..1074b882c57c 100644
2187 --- a/drivers/message/fusion/mptctl.c
2188 +++ b/drivers/message/fusion/mptctl.c
2189 @@ -100,19 +100,19 @@ struct buflist {
2190 * Function prototypes. Called from OS entry point mptctl_ioctl.
2191 * arg contents specific to function.
2192 */
2193 -static int mptctl_fw_download(unsigned long arg);
2194 -static int mptctl_getiocinfo(unsigned long arg, unsigned int cmd);
2195 -static int mptctl_gettargetinfo(unsigned long arg);
2196 -static int mptctl_readtest(unsigned long arg);
2197 -static int mptctl_mpt_command(unsigned long arg);
2198 -static int mptctl_eventquery(unsigned long arg);
2199 -static int mptctl_eventenable(unsigned long arg);
2200 -static int mptctl_eventreport(unsigned long arg);
2201 -static int mptctl_replace_fw(unsigned long arg);
2202 -
2203 -static int mptctl_do_reset(unsigned long arg);
2204 -static int mptctl_hp_hostinfo(unsigned long arg, unsigned int cmd);
2205 -static int mptctl_hp_targetinfo(unsigned long arg);
2206 +static int mptctl_fw_download(MPT_ADAPTER *iocp, unsigned long arg);
2207 +static int mptctl_getiocinfo(MPT_ADAPTER *iocp, unsigned long arg, unsigned int cmd);
2208 +static int mptctl_gettargetinfo(MPT_ADAPTER *iocp, unsigned long arg);
2209 +static int mptctl_readtest(MPT_ADAPTER *iocp, unsigned long arg);
2210 +static int mptctl_mpt_command(MPT_ADAPTER *iocp, unsigned long arg);
2211 +static int mptctl_eventquery(MPT_ADAPTER *iocp, unsigned long arg);
2212 +static int mptctl_eventenable(MPT_ADAPTER *iocp, unsigned long arg);
2213 +static int mptctl_eventreport(MPT_ADAPTER *iocp, unsigned long arg);
2214 +static int mptctl_replace_fw(MPT_ADAPTER *iocp, unsigned long arg);
2215 +
2216 +static int mptctl_do_reset(MPT_ADAPTER *iocp, unsigned long arg);
2217 +static int mptctl_hp_hostinfo(MPT_ADAPTER *iocp, unsigned long arg, unsigned int cmd);
2218 +static int mptctl_hp_targetinfo(MPT_ADAPTER *iocp, unsigned long arg);
2219
2220 static int mptctl_probe(struct pci_dev *, const struct pci_device_id *);
2221 static void mptctl_remove(struct pci_dev *);
2222 @@ -123,8 +123,8 @@ static long compat_mpctl_ioctl(struct file *f, unsigned cmd, unsigned long arg);
2223 /*
2224 * Private function calls.
2225 */
2226 -static int mptctl_do_mpt_command(struct mpt_ioctl_command karg, void __user *mfPtr);
2227 -static int mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen);
2228 +static int mptctl_do_mpt_command(MPT_ADAPTER *iocp, struct mpt_ioctl_command karg, void __user *mfPtr);
2229 +static int mptctl_do_fw_download(MPT_ADAPTER *iocp, char __user *ufwbuf, size_t fwlen);
2230 static MptSge_t *kbuf_alloc_2_sgl(int bytes, u32 dir, int sge_offset, int *frags,
2231 struct buflist **blp, dma_addr_t *sglbuf_dma, MPT_ADAPTER *ioc);
2232 static void kfree_sgl(MptSge_t *sgl, dma_addr_t sgl_dma,
2233 @@ -656,19 +656,19 @@ __mptctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
2234 * by TM and FW reloads.
2235 */
2236 if ((cmd & ~IOCSIZE_MASK) == (MPTIOCINFO & ~IOCSIZE_MASK)) {
2237 - return mptctl_getiocinfo(arg, _IOC_SIZE(cmd));
2238 + return mptctl_getiocinfo(iocp, arg, _IOC_SIZE(cmd));
2239 } else if (cmd == MPTTARGETINFO) {
2240 - return mptctl_gettargetinfo(arg);
2241 + return mptctl_gettargetinfo(iocp, arg);
2242 } else if (cmd == MPTTEST) {
2243 - return mptctl_readtest(arg);
2244 + return mptctl_readtest(iocp, arg);
2245 } else if (cmd == MPTEVENTQUERY) {
2246 - return mptctl_eventquery(arg);
2247 + return mptctl_eventquery(iocp, arg);
2248 } else if (cmd == MPTEVENTENABLE) {
2249 - return mptctl_eventenable(arg);
2250 + return mptctl_eventenable(iocp, arg);
2251 } else if (cmd == MPTEVENTREPORT) {
2252 - return mptctl_eventreport(arg);
2253 + return mptctl_eventreport(iocp, arg);
2254 } else if (cmd == MPTFWREPLACE) {
2255 - return mptctl_replace_fw(arg);
2256 + return mptctl_replace_fw(iocp, arg);
2257 }
2258
2259 /* All of these commands require an interrupt or
2260 @@ -678,15 +678,15 @@ __mptctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
2261 return ret;
2262
2263 if (cmd == MPTFWDOWNLOAD)
2264 - ret = mptctl_fw_download(arg);
2265 + ret = mptctl_fw_download(iocp, arg);
2266 else if (cmd == MPTCOMMAND)
2267 - ret = mptctl_mpt_command(arg);
2268 + ret = mptctl_mpt_command(iocp, arg);
2269 else if (cmd == MPTHARDRESET)
2270 - ret = mptctl_do_reset(arg);
2271 + ret = mptctl_do_reset(iocp, arg);
2272 else if ((cmd & ~IOCSIZE_MASK) == (HP_GETHOSTINFO & ~IOCSIZE_MASK))
2273 - ret = mptctl_hp_hostinfo(arg, _IOC_SIZE(cmd));
2274 + ret = mptctl_hp_hostinfo(iocp, arg, _IOC_SIZE(cmd));
2275 else if (cmd == HP_GETTARGETINFO)
2276 - ret = mptctl_hp_targetinfo(arg);
2277 + ret = mptctl_hp_targetinfo(iocp, arg);
2278 else
2279 ret = -EINVAL;
2280
2281 @@ -705,11 +705,10 @@ mptctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
2282 return ret;
2283 }
2284
2285 -static int mptctl_do_reset(unsigned long arg)
2286 +static int mptctl_do_reset(MPT_ADAPTER *iocp, unsigned long arg)
2287 {
2288 struct mpt_ioctl_diag_reset __user *urinfo = (void __user *) arg;
2289 struct mpt_ioctl_diag_reset krinfo;
2290 - MPT_ADAPTER *iocp;
2291
2292 if (copy_from_user(&krinfo, urinfo, sizeof(struct mpt_ioctl_diag_reset))) {
2293 printk(KERN_ERR MYNAM "%s@%d::mptctl_do_reset - "
2294 @@ -718,12 +717,6 @@ static int mptctl_do_reset(unsigned long arg)
2295 return -EFAULT;
2296 }
2297
2298 - if (mpt_verify_adapter(krinfo.hdr.iocnum, &iocp) < 0) {
2299 - printk(KERN_DEBUG MYNAM "%s@%d::mptctl_do_reset - ioc%d not found!\n",
2300 - __FILE__, __LINE__, krinfo.hdr.iocnum);
2301 - return -ENODEV; /* (-6) No such device or address */
2302 - }
2303 -
2304 dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT "mptctl_do_reset called.\n",
2305 iocp->name));
2306
2307 @@ -754,7 +747,7 @@ static int mptctl_do_reset(unsigned long arg)
2308 * -ENOMSG if FW upload returned bad status
2309 */
2310 static int
2311 -mptctl_fw_download(unsigned long arg)
2312 +mptctl_fw_download(MPT_ADAPTER *iocp, unsigned long arg)
2313 {
2314 struct mpt_fw_xfer __user *ufwdl = (void __user *) arg;
2315 struct mpt_fw_xfer kfwdl;
2316 @@ -766,7 +759,7 @@ mptctl_fw_download(unsigned long arg)
2317 return -EFAULT;
2318 }
2319
2320 - return mptctl_do_fw_download(kfwdl.iocnum, kfwdl.bufp, kfwdl.fwlen);
2321 + return mptctl_do_fw_download(iocp, kfwdl.bufp, kfwdl.fwlen);
2322 }
2323
2324 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
2325 @@ -784,11 +777,10 @@ mptctl_fw_download(unsigned long arg)
2326 * -ENOMSG if FW upload returned bad status
2327 */
2328 static int
2329 -mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen)
2330 +mptctl_do_fw_download(MPT_ADAPTER *iocp, char __user *ufwbuf, size_t fwlen)
2331 {
2332 FWDownload_t *dlmsg;
2333 MPT_FRAME_HDR *mf;
2334 - MPT_ADAPTER *iocp;
2335 FWDownloadTCSGE_t *ptsge;
2336 MptSge_t *sgl, *sgIn;
2337 char *sgOut;
2338 @@ -808,17 +800,10 @@ mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen)
2339 pFWDownloadReply_t ReplyMsg = NULL;
2340 unsigned long timeleft;
2341
2342 - if (mpt_verify_adapter(ioc, &iocp) < 0) {
2343 - printk(KERN_DEBUG MYNAM "ioctl_fwdl - ioc%d not found!\n",
2344 - ioc);
2345 - return -ENODEV; /* (-6) No such device or address */
2346 - } else {
2347 -
2348 - /* Valid device. Get a message frame and construct the FW download message.
2349 - */
2350 - if ((mf = mpt_get_msg_frame(mptctl_id, iocp)) == NULL)
2351 - return -EAGAIN;
2352 - }
2353 + /* Valid device. Get a message frame and construct the FW download message.
2354 + */
2355 + if ((mf = mpt_get_msg_frame(mptctl_id, iocp)) == NULL)
2356 + return -EAGAIN;
2357
2358 dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT
2359 "mptctl_do_fwdl called. mptctl_id = %xh.\n", iocp->name, mptctl_id));
2360 @@ -826,8 +811,6 @@ mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen)
2361 iocp->name, ufwbuf));
2362 dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT "DbG: kfwdl.fwlen = %d\n",
2363 iocp->name, (int)fwlen));
2364 - dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT "DbG: kfwdl.ioc = %04xh\n",
2365 - iocp->name, ioc));
2366
2367 dlmsg = (FWDownload_t*) mf;
2368 ptsge = (FWDownloadTCSGE_t *) &dlmsg->SGL;
2369 @@ -1238,13 +1221,11 @@ kfree_sgl(MptSge_t *sgl, dma_addr_t sgl_dma, struct buflist *buflist, MPT_ADAPTE
2370 * -ENODEV if no such device/adapter
2371 */
2372 static int
2373 -mptctl_getiocinfo (unsigned long arg, unsigned int data_size)
2374 +mptctl_getiocinfo (MPT_ADAPTER *ioc, unsigned long arg, unsigned int data_size)
2375 {
2376 struct mpt_ioctl_iocinfo __user *uarg = (void __user *) arg;
2377 struct mpt_ioctl_iocinfo *karg;
2378 - MPT_ADAPTER *ioc;
2379 struct pci_dev *pdev;
2380 - int iocnum;
2381 unsigned int port;
2382 int cim_rev;
2383 struct scsi_device *sdev;
2384 @@ -1272,14 +1253,6 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size)
2385 return PTR_ERR(karg);
2386 }
2387
2388 - if (((iocnum = mpt_verify_adapter(karg->hdr.iocnum, &ioc)) < 0) ||
2389 - (ioc == NULL)) {
2390 - printk(KERN_DEBUG MYNAM "%s::mptctl_getiocinfo() @%d - ioc%d not found!\n",
2391 - __FILE__, __LINE__, iocnum);
2392 - kfree(karg);
2393 - return -ENODEV;
2394 - }
2395 -
2396 /* Verify the data transfer size is correct. */
2397 if (karg->hdr.maxDataSize != data_size) {
2398 printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_getiocinfo - "
2399 @@ -1385,15 +1358,13 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size)
2400 * -ENODEV if no such device/adapter
2401 */
2402 static int
2403 -mptctl_gettargetinfo (unsigned long arg)
2404 +mptctl_gettargetinfo (MPT_ADAPTER *ioc, unsigned long arg)
2405 {
2406 struct mpt_ioctl_targetinfo __user *uarg = (void __user *) arg;
2407 struct mpt_ioctl_targetinfo karg;
2408 - MPT_ADAPTER *ioc;
2409 VirtDevice *vdevice;
2410 char *pmem;
2411 int *pdata;
2412 - int iocnum;
2413 int numDevices = 0;
2414 int lun;
2415 int maxWordsLeft;
2416 @@ -1408,13 +1379,6 @@ mptctl_gettargetinfo (unsigned long arg)
2417 return -EFAULT;
2418 }
2419
2420 - if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
2421 - (ioc == NULL)) {
2422 - printk(KERN_DEBUG MYNAM "%s::mptctl_gettargetinfo() @%d - ioc%d not found!\n",
2423 - __FILE__, __LINE__, iocnum);
2424 - return -ENODEV;
2425 - }
2426 -
2427 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_gettargetinfo called.\n",
2428 ioc->name));
2429 /* Get the port number and set the maximum number of bytes
2430 @@ -1510,12 +1474,10 @@ mptctl_gettargetinfo (unsigned long arg)
2431 * -ENODEV if no such device/adapter
2432 */
2433 static int
2434 -mptctl_readtest (unsigned long arg)
2435 +mptctl_readtest (MPT_ADAPTER *ioc, unsigned long arg)
2436 {
2437 struct mpt_ioctl_test __user *uarg = (void __user *) arg;
2438 struct mpt_ioctl_test karg;
2439 - MPT_ADAPTER *ioc;
2440 - int iocnum;
2441
2442 if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_test))) {
2443 printk(KERN_ERR MYNAM "%s@%d::mptctl_readtest - "
2444 @@ -1524,13 +1486,6 @@ mptctl_readtest (unsigned long arg)
2445 return -EFAULT;
2446 }
2447
2448 - if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
2449 - (ioc == NULL)) {
2450 - printk(KERN_DEBUG MYNAM "%s::mptctl_readtest() @%d - ioc%d not found!\n",
2451 - __FILE__, __LINE__, iocnum);
2452 - return -ENODEV;
2453 - }
2454 -
2455 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_readtest called.\n",
2456 ioc->name));
2457 /* Fill in the data and return the structure to the calling
2458 @@ -1571,12 +1526,10 @@ mptctl_readtest (unsigned long arg)
2459 * -ENODEV if no such device/adapter
2460 */
2461 static int
2462 -mptctl_eventquery (unsigned long arg)
2463 +mptctl_eventquery (MPT_ADAPTER *ioc, unsigned long arg)
2464 {
2465 struct mpt_ioctl_eventquery __user *uarg = (void __user *) arg;
2466 struct mpt_ioctl_eventquery karg;
2467 - MPT_ADAPTER *ioc;
2468 - int iocnum;
2469
2470 if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_eventquery))) {
2471 printk(KERN_ERR MYNAM "%s@%d::mptctl_eventquery - "
2472 @@ -1585,13 +1538,6 @@ mptctl_eventquery (unsigned long arg)
2473 return -EFAULT;
2474 }
2475
2476 - if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
2477 - (ioc == NULL)) {
2478 - printk(KERN_DEBUG MYNAM "%s::mptctl_eventquery() @%d - ioc%d not found!\n",
2479 - __FILE__, __LINE__, iocnum);
2480 - return -ENODEV;
2481 - }
2482 -
2483 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_eventquery called.\n",
2484 ioc->name));
2485 karg.eventEntries = MPTCTL_EVENT_LOG_SIZE;
2486 @@ -1610,12 +1556,10 @@ mptctl_eventquery (unsigned long arg)
2487
2488 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
2489 static int
2490 -mptctl_eventenable (unsigned long arg)
2491 +mptctl_eventenable (MPT_ADAPTER *ioc, unsigned long arg)
2492 {
2493 struct mpt_ioctl_eventenable __user *uarg = (void __user *) arg;
2494 struct mpt_ioctl_eventenable karg;
2495 - MPT_ADAPTER *ioc;
2496 - int iocnum;
2497
2498 if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_eventenable))) {
2499 printk(KERN_ERR MYNAM "%s@%d::mptctl_eventenable - "
2500 @@ -1624,13 +1568,6 @@ mptctl_eventenable (unsigned long arg)
2501 return -EFAULT;
2502 }
2503
2504 - if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
2505 - (ioc == NULL)) {
2506 - printk(KERN_DEBUG MYNAM "%s::mptctl_eventenable() @%d - ioc%d not found!\n",
2507 - __FILE__, __LINE__, iocnum);
2508 - return -ENODEV;
2509 - }
2510 -
2511 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_eventenable called.\n",
2512 ioc->name));
2513 if (ioc->events == NULL) {
2514 @@ -1658,12 +1595,10 @@ mptctl_eventenable (unsigned long arg)
2515
2516 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
2517 static int
2518 -mptctl_eventreport (unsigned long arg)
2519 +mptctl_eventreport (MPT_ADAPTER *ioc, unsigned long arg)
2520 {
2521 struct mpt_ioctl_eventreport __user *uarg = (void __user *) arg;
2522 struct mpt_ioctl_eventreport karg;
2523 - MPT_ADAPTER *ioc;
2524 - int iocnum;
2525 int numBytes, maxEvents, max;
2526
2527 if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_eventreport))) {
2528 @@ -1673,12 +1608,6 @@ mptctl_eventreport (unsigned long arg)
2529 return -EFAULT;
2530 }
2531
2532 - if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
2533 - (ioc == NULL)) {
2534 - printk(KERN_DEBUG MYNAM "%s::mptctl_eventreport() @%d - ioc%d not found!\n",
2535 - __FILE__, __LINE__, iocnum);
2536 - return -ENODEV;
2537 - }
2538 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_eventreport called.\n",
2539 ioc->name));
2540
2541 @@ -1712,12 +1641,10 @@ mptctl_eventreport (unsigned long arg)
2542
2543 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
2544 static int
2545 -mptctl_replace_fw (unsigned long arg)
2546 +mptctl_replace_fw (MPT_ADAPTER *ioc, unsigned long arg)
2547 {
2548 struct mpt_ioctl_replace_fw __user *uarg = (void __user *) arg;
2549 struct mpt_ioctl_replace_fw karg;
2550 - MPT_ADAPTER *ioc;
2551 - int iocnum;
2552 int newFwSize;
2553
2554 if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_replace_fw))) {
2555 @@ -1727,13 +1654,6 @@ mptctl_replace_fw (unsigned long arg)
2556 return -EFAULT;
2557 }
2558
2559 - if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
2560 - (ioc == NULL)) {
2561 - printk(KERN_DEBUG MYNAM "%s::mptctl_replace_fw() @%d - ioc%d not found!\n",
2562 - __FILE__, __LINE__, iocnum);
2563 - return -ENODEV;
2564 - }
2565 -
2566 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_replace_fw called.\n",
2567 ioc->name));
2568 /* If caching FW, Free the old FW image
2569 @@ -1780,12 +1700,10 @@ mptctl_replace_fw (unsigned long arg)
2570 * -ENOMEM if memory allocation error
2571 */
2572 static int
2573 -mptctl_mpt_command (unsigned long arg)
2574 +mptctl_mpt_command (MPT_ADAPTER *ioc, unsigned long arg)
2575 {
2576 struct mpt_ioctl_command __user *uarg = (void __user *) arg;
2577 struct mpt_ioctl_command karg;
2578 - MPT_ADAPTER *ioc;
2579 - int iocnum;
2580 int rc;
2581
2582
2583 @@ -1796,14 +1714,7 @@ mptctl_mpt_command (unsigned long arg)
2584 return -EFAULT;
2585 }
2586
2587 - if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
2588 - (ioc == NULL)) {
2589 - printk(KERN_DEBUG MYNAM "%s::mptctl_mpt_command() @%d - ioc%d not found!\n",
2590 - __FILE__, __LINE__, iocnum);
2591 - return -ENODEV;
2592 - }
2593 -
2594 - rc = mptctl_do_mpt_command (karg, &uarg->MF);
2595 + rc = mptctl_do_mpt_command (ioc, karg, &uarg->MF);
2596
2597 return rc;
2598 }
2599 @@ -1821,9 +1732,8 @@ mptctl_mpt_command (unsigned long arg)
2600 * -EPERM if SCSI I/O and target is untagged
2601 */
2602 static int
2603 -mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
2604 +mptctl_do_mpt_command (MPT_ADAPTER *ioc, struct mpt_ioctl_command karg, void __user *mfPtr)
2605 {
2606 - MPT_ADAPTER *ioc;
2607 MPT_FRAME_HDR *mf = NULL;
2608 MPIHeader_t *hdr;
2609 char *psge;
2610 @@ -1832,7 +1742,7 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
2611 dma_addr_t dma_addr_in;
2612 dma_addr_t dma_addr_out;
2613 int sgSize = 0; /* Num SG elements */
2614 - int iocnum, flagsLength;
2615 + int flagsLength;
2616 int sz, rc = 0;
2617 int msgContext;
2618 u16 req_idx;
2619 @@ -1847,13 +1757,6 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
2620 bufIn.kptr = bufOut.kptr = NULL;
2621 bufIn.len = bufOut.len = 0;
2622
2623 - if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
2624 - (ioc == NULL)) {
2625 - printk(KERN_DEBUG MYNAM "%s::mptctl_do_mpt_command() @%d - ioc%d not found!\n",
2626 - __FILE__, __LINE__, iocnum);
2627 - return -ENODEV;
2628 - }
2629 -
2630 spin_lock_irqsave(&ioc->taskmgmt_lock, flags);
2631 if (ioc->ioc_reset_in_progress) {
2632 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags);
2633 @@ -2418,17 +2321,15 @@ done_free_mem:
2634 * -ENOMEM if memory allocation error
2635 */
2636 static int
2637 -mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size)
2638 +mptctl_hp_hostinfo(MPT_ADAPTER *ioc, unsigned long arg, unsigned int data_size)
2639 {
2640 hp_host_info_t __user *uarg = (void __user *) arg;
2641 - MPT_ADAPTER *ioc;
2642 struct pci_dev *pdev;
2643 char *pbuf=NULL;
2644 dma_addr_t buf_dma;
2645 hp_host_info_t karg;
2646 CONFIGPARMS cfg;
2647 ConfigPageHeader_t hdr;
2648 - int iocnum;
2649 int rc, cim_rev;
2650 ToolboxIstwiReadWriteRequest_t *IstwiRWRequest;
2651 MPT_FRAME_HDR *mf = NULL;
2652 @@ -2452,12 +2353,6 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size)
2653 return -EFAULT;
2654 }
2655
2656 - if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
2657 - (ioc == NULL)) {
2658 - printk(KERN_DEBUG MYNAM "%s::mptctl_hp_hostinfo() @%d - ioc%d not found!\n",
2659 - __FILE__, __LINE__, iocnum);
2660 - return -ENODEV;
2661 - }
2662 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT ": mptctl_hp_hostinfo called.\n",
2663 ioc->name));
2664
2665 @@ -2659,15 +2554,13 @@ retry_wait:
2666 * -ENOMEM if memory allocation error
2667 */
2668 static int
2669 -mptctl_hp_targetinfo(unsigned long arg)
2670 +mptctl_hp_targetinfo(MPT_ADAPTER *ioc, unsigned long arg)
2671 {
2672 hp_target_info_t __user *uarg = (void __user *) arg;
2673 SCSIDevicePage0_t *pg0_alloc;
2674 SCSIDevicePage3_t *pg3_alloc;
2675 - MPT_ADAPTER *ioc;
2676 MPT_SCSI_HOST *hd = NULL;
2677 hp_target_info_t karg;
2678 - int iocnum;
2679 int data_sz;
2680 dma_addr_t page_dma;
2681 CONFIGPARMS cfg;
2682 @@ -2681,12 +2574,6 @@ mptctl_hp_targetinfo(unsigned long arg)
2683 return -EFAULT;
2684 }
2685
2686 - if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
2687 - (ioc == NULL)) {
2688 - printk(KERN_DEBUG MYNAM "%s::mptctl_hp_targetinfo() @%d - ioc%d not found!\n",
2689 - __FILE__, __LINE__, iocnum);
2690 - return -ENODEV;
2691 - }
2692 if (karg.hdr.id >= MPT_MAX_FC_DEVICES)
2693 return -EINVAL;
2694 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_hp_targetinfo called.\n",
2695 @@ -2854,7 +2741,7 @@ compat_mptfwxfer_ioctl(struct file *filp, unsigned int cmd,
2696 kfw.fwlen = kfw32.fwlen;
2697 kfw.bufp = compat_ptr(kfw32.bufp);
2698
2699 - ret = mptctl_do_fw_download(kfw.iocnum, kfw.bufp, kfw.fwlen);
2700 + ret = mptctl_do_fw_download(iocp, kfw.bufp, kfw.fwlen);
2701
2702 mutex_unlock(&iocp->ioctl_cmds.mutex);
2703
2704 @@ -2908,7 +2795,7 @@ compat_mpt_command(struct file *filp, unsigned int cmd,
2705
2706 /* Pass new structure to do_mpt_command
2707 */
2708 - ret = mptctl_do_mpt_command (karg, &uarg->MF);
2709 + ret = mptctl_do_mpt_command (iocp, karg, &uarg->MF);
2710
2711 mutex_unlock(&iocp->ioctl_cmds.mutex);
2712
2713 diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c
2714 index cf8c8be40a9c..a4f2d8cdca12 100644
2715 --- a/drivers/mtd/chips/cfi_cmdset_0002.c
2716 +++ b/drivers/mtd/chips/cfi_cmdset_0002.c
2717 @@ -123,19 +123,23 @@ static int cfi_use_status_reg(struct cfi_private *cfi)
2718 (extp->SoftwareFeatures & poll_mask) == CFI_POLL_STATUS_REG;
2719 }
2720
2721 -static void cfi_check_err_status(struct map_info *map, struct flchip *chip,
2722 - unsigned long adr)
2723 +static int cfi_check_err_status(struct map_info *map, struct flchip *chip,
2724 + unsigned long adr)
2725 {
2726 struct cfi_private *cfi = map->fldrv_priv;
2727 map_word status;
2728
2729 if (!cfi_use_status_reg(cfi))
2730 - return;
2731 + return 0;
2732
2733 cfi_send_gen_cmd(0x70, cfi->addr_unlock1, chip->start, map, cfi,
2734 cfi->device_type, NULL);
2735 status = map_read(map, adr);
2736
2737 + /* The error bits are invalid while the chip's busy */
2738 + if (!map_word_bitsset(map, status, CMD(CFI_SR_DRB)))
2739 + return 0;
2740 +
2741 if (map_word_bitsset(map, status, CMD(0x3a))) {
2742 unsigned long chipstatus = MERGESTATUS(status);
2743
2744 @@ -151,7 +155,12 @@ static void cfi_check_err_status(struct map_info *map, struct flchip *chip,
2745 if (chipstatus & CFI_SR_SLSB)
2746 pr_err("%s sector write protected, status %lx\n",
2747 map->name, chipstatus);
2748 +
2749 + /* Erase/Program status bits are set on the operation failure */
2750 + if (chipstatus & (CFI_SR_ESB | CFI_SR_PSB))
2751 + return 1;
2752 }
2753 + return 0;
2754 }
2755
2756 /* #define DEBUG_CFI_FEATURES */
2757 @@ -848,20 +857,16 @@ static int __xipram chip_good(struct map_info *map, struct flchip *chip,
2758
2759 if (cfi_use_status_reg(cfi)) {
2760 map_word ready = CMD(CFI_SR_DRB);
2761 - map_word err = CMD(CFI_SR_PSB | CFI_SR_ESB);
2762 +
2763 /*
2764 * For chips that support status register, check device
2765 - * ready bit and Erase/Program status bit to know if
2766 - * operation succeeded.
2767 + * ready bit
2768 */
2769 cfi_send_gen_cmd(0x70, cfi->addr_unlock1, chip->start, map, cfi,
2770 cfi->device_type, NULL);
2771 curd = map_read(map, addr);
2772
2773 - if (map_word_andequal(map, curd, ready, ready))
2774 - return !map_word_bitsset(map, curd, err);
2775 -
2776 - return 0;
2777 + return map_word_andequal(map, curd, ready, ready);
2778 }
2779
2780 oldd = map_read(map, addr);
2781 @@ -1699,8 +1704,11 @@ static int __xipram do_write_oneword_once(struct map_info *map,
2782 break;
2783 }
2784
2785 - if (chip_good(map, chip, adr, datum))
2786 + if (chip_good(map, chip, adr, datum)) {
2787 + if (cfi_check_err_status(map, chip, adr))
2788 + ret = -EIO;
2789 break;
2790 + }
2791
2792 /* Latency issues. Drop the lock, wait a while and retry */
2793 UDELAY(map, chip, adr, 1);
2794 @@ -1773,7 +1781,6 @@ static int __xipram do_write_oneword_retry(struct map_info *map,
2795 ret = do_write_oneword_once(map, chip, adr, datum, mode, cfi);
2796 if (ret) {
2797 /* reset on all failures. */
2798 - cfi_check_err_status(map, chip, adr);
2799 map_write(map, CMD(0xF0), chip->start);
2800 /* FIXME - should have reset delay before continuing */
2801
2802 @@ -1970,12 +1977,17 @@ static int __xipram do_write_buffer_wait(struct map_info *map,
2803 */
2804 if (time_after(jiffies, timeo) &&
2805 !chip_good(map, chip, adr, datum)) {
2806 + pr_err("MTD %s(): software timeout, address:0x%.8lx.\n",
2807 + __func__, adr);
2808 ret = -EIO;
2809 break;
2810 }
2811
2812 - if (chip_good(map, chip, adr, datum))
2813 + if (chip_good(map, chip, adr, datum)) {
2814 + if (cfi_check_err_status(map, chip, adr))
2815 + ret = -EIO;
2816 break;
2817 + }
2818
2819 /* Latency issues. Drop the lock, wait a while and retry */
2820 UDELAY(map, chip, adr, 1);
2821 @@ -2071,12 +2083,8 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip,
2822 chip->word_write_time);
2823
2824 ret = do_write_buffer_wait(map, chip, adr, datum);
2825 - if (ret) {
2826 - cfi_check_err_status(map, chip, adr);
2827 + if (ret)
2828 do_write_buffer_reset(map, chip, cfi);
2829 - pr_err("MTD %s(): software timeout, address:0x%.8lx.\n",
2830 - __func__, adr);
2831 - }
2832
2833 xip_enable(map, chip, adr);
2834
2835 @@ -2271,9 +2279,9 @@ retry:
2836 udelay(1);
2837 }
2838
2839 - if (!chip_good(map, chip, adr, datum)) {
2840 + if (!chip_good(map, chip, adr, datum) ||
2841 + cfi_check_err_status(map, chip, adr)) {
2842 /* reset on all failures. */
2843 - cfi_check_err_status(map, chip, adr);
2844 map_write(map, CMD(0xF0), chip->start);
2845 /* FIXME - should have reset delay before continuing */
2846
2847 @@ -2467,8 +2475,11 @@ static int __xipram do_erase_chip(struct map_info *map, struct flchip *chip)
2848 chip->erase_suspended = 0;
2849 }
2850
2851 - if (chip_good(map, chip, adr, map_word_ff(map)))
2852 + if (chip_good(map, chip, adr, map_word_ff(map))) {
2853 + if (cfi_check_err_status(map, chip, adr))
2854 + ret = -EIO;
2855 break;
2856 + }
2857
2858 if (time_after(jiffies, timeo)) {
2859 printk(KERN_WARNING "MTD %s(): software timeout\n",
2860 @@ -2483,7 +2494,6 @@ static int __xipram do_erase_chip(struct map_info *map, struct flchip *chip)
2861 /* Did we succeed? */
2862 if (ret) {
2863 /* reset on all failures. */
2864 - cfi_check_err_status(map, chip, adr);
2865 map_write(map, CMD(0xF0), chip->start);
2866 /* FIXME - should have reset delay before continuing */
2867
2868 @@ -2564,8 +2574,11 @@ static int __xipram do_erase_oneblock(struct map_info *map, struct flchip *chip,
2869 chip->erase_suspended = 0;
2870 }
2871
2872 - if (chip_good(map, chip, adr, map_word_ff(map)))
2873 + if (chip_good(map, chip, adr, map_word_ff(map))) {
2874 + if (cfi_check_err_status(map, chip, adr))
2875 + ret = -EIO;
2876 break;
2877 + }
2878
2879 if (time_after(jiffies, timeo)) {
2880 printk(KERN_WARNING "MTD %s(): software timeout\n",
2881 @@ -2580,7 +2593,6 @@ static int __xipram do_erase_oneblock(struct map_info *map, struct flchip *chip,
2882 /* Did we succeed? */
2883 if (ret) {
2884 /* reset on all failures. */
2885 - cfi_check_err_status(map, chip, adr);
2886 map_write(map, CMD(0xF0), chip->start);
2887 /* FIXME - should have reset delay before continuing */
2888
2889 diff --git a/drivers/mtd/devices/mchp23k256.c b/drivers/mtd/devices/mchp23k256.c
2890 index b20d02b4f830..77c872fd3d83 100644
2891 --- a/drivers/mtd/devices/mchp23k256.c
2892 +++ b/drivers/mtd/devices/mchp23k256.c
2893 @@ -64,15 +64,17 @@ static int mchp23k256_write(struct mtd_info *mtd, loff_t to, size_t len,
2894 struct spi_transfer transfer[2] = {};
2895 struct spi_message message;
2896 unsigned char command[MAX_CMD_SIZE];
2897 - int ret;
2898 + int ret, cmd_len;
2899
2900 spi_message_init(&message);
2901
2902 + cmd_len = mchp23k256_cmdsz(flash);
2903 +
2904 command[0] = MCHP23K256_CMD_WRITE;
2905 mchp23k256_addr2cmd(flash, to, command);
2906
2907 transfer[0].tx_buf = command;
2908 - transfer[0].len = mchp23k256_cmdsz(flash);
2909 + transfer[0].len = cmd_len;
2910 spi_message_add_tail(&transfer[0], &message);
2911
2912 transfer[1].tx_buf = buf;
2913 @@ -88,8 +90,8 @@ static int mchp23k256_write(struct mtd_info *mtd, loff_t to, size_t len,
2914 if (ret)
2915 return ret;
2916
2917 - if (retlen && message.actual_length > sizeof(command))
2918 - *retlen += message.actual_length - sizeof(command);
2919 + if (retlen && message.actual_length > cmd_len)
2920 + *retlen += message.actual_length - cmd_len;
2921
2922 return 0;
2923 }
2924 @@ -101,16 +103,18 @@ static int mchp23k256_read(struct mtd_info *mtd, loff_t from, size_t len,
2925 struct spi_transfer transfer[2] = {};
2926 struct spi_message message;
2927 unsigned char command[MAX_CMD_SIZE];
2928 - int ret;
2929 + int ret, cmd_len;
2930
2931 spi_message_init(&message);
2932
2933 + cmd_len = mchp23k256_cmdsz(flash);
2934 +
2935 memset(&transfer, 0, sizeof(transfer));
2936 command[0] = MCHP23K256_CMD_READ;
2937 mchp23k256_addr2cmd(flash, from, command);
2938
2939 transfer[0].tx_buf = command;
2940 - transfer[0].len = mchp23k256_cmdsz(flash);
2941 + transfer[0].len = cmd_len;
2942 spi_message_add_tail(&transfer[0], &message);
2943
2944 transfer[1].rx_buf = buf;
2945 @@ -126,8 +130,8 @@ static int mchp23k256_read(struct mtd_info *mtd, loff_t from, size_t len,
2946 if (ret)
2947 return ret;
2948
2949 - if (retlen && message.actual_length > sizeof(command))
2950 - *retlen += message.actual_length - sizeof(command);
2951 + if (retlen && message.actual_length > cmd_len)
2952 + *retlen += message.actual_length - cmd_len;
2953
2954 return 0;
2955 }
2956 diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
2957 index 334fe3130285..b9d5d55a5edb 100644
2958 --- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
2959 +++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
2960 @@ -148,6 +148,10 @@ static int gpmi_init(struct gpmi_nand_data *this)
2961 struct resources *r = &this->resources;
2962 int ret;
2963
2964 + ret = pm_runtime_get_sync(this->dev);
2965 + if (ret < 0)
2966 + return ret;
2967 +
2968 ret = gpmi_reset_block(r->gpmi_regs, false);
2969 if (ret)
2970 goto err_out;
2971 @@ -179,8 +183,9 @@ static int gpmi_init(struct gpmi_nand_data *this)
2972 */
2973 writel(BM_GPMI_CTRL1_DECOUPLE_CS, r->gpmi_regs + HW_GPMI_CTRL1_SET);
2974
2975 - return 0;
2976 err_out:
2977 + pm_runtime_mark_last_busy(this->dev);
2978 + pm_runtime_put_autosuspend(this->dev);
2979 return ret;
2980 }
2981
2982 @@ -2722,6 +2727,10 @@ static int gpmi_pm_resume(struct device *dev)
2983 return ret;
2984 }
2985
2986 + /* Set flag to get timing setup restored for next exec_op */
2987 + if (this->hw.clk_rate)
2988 + this->hw.must_apply_timings = true;
2989 +
2990 /* re-init the BCH registers */
2991 ret = bch_set_geometry(this);
2992 if (ret) {
2993 diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
2994 index 1548e0f7f5f4..309c808351ac 100644
2995 --- a/drivers/mtd/spi-nor/spi-nor.c
2996 +++ b/drivers/mtd/spi-nor/spi-nor.c
2997 @@ -4544,9 +4544,7 @@ static void spi_nor_info_init_params(struct spi_nor *nor)
2998
2999 static void spansion_post_sfdp_fixups(struct spi_nor *nor)
3000 {
3001 - struct mtd_info *mtd = &nor->mtd;
3002 -
3003 - if (mtd->size <= SZ_16M)
3004 + if (nor->params.size <= SZ_16M)
3005 return;
3006
3007 nor->flags |= SNOR_F_4B_OPCODES;
3008 diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
3009 index 69fc13046ac7..47b21096b577 100644
3010 --- a/drivers/net/dsa/bcm_sf2.c
3011 +++ b/drivers/net/dsa/bcm_sf2.c
3012 @@ -68,7 +68,7 @@ static void bcm_sf2_imp_setup(struct dsa_switch *ds, int port)
3013
3014 /* Force link status for IMP port */
3015 reg = core_readl(priv, offset);
3016 - reg |= (MII_SW_OR | LINK_STS);
3017 + reg |= (MII_SW_OR | LINK_STS | GMII_SPEED_UP_2G);
3018 core_writel(priv, reg, offset);
3019
3020 /* Enable Broadcast, Multicast, Unicast forwarding to IMP port */
3021 diff --git a/drivers/net/dsa/sja1105/sja1105_main.c b/drivers/net/dsa/sja1105/sja1105_main.c
3022 index 7763221286d4..3b51e87a3714 100644
3023 --- a/drivers/net/dsa/sja1105/sja1105_main.c
3024 +++ b/drivers/net/dsa/sja1105/sja1105_main.c
3025 @@ -619,7 +619,7 @@ static int sja1105_parse_ports_node(struct sja1105_private *priv,
3026 struct device *dev = &priv->spidev->dev;
3027 struct device_node *child;
3028
3029 - for_each_child_of_node(ports_node, child) {
3030 + for_each_available_child_of_node(ports_node, child) {
3031 struct device_node *phy_node;
3032 int phy_mode;
3033 u32 index;
3034 diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
3035 index a977a459bd20..b4c664957266 100644
3036 --- a/drivers/net/ethernet/broadcom/bcmsysport.c
3037 +++ b/drivers/net/ethernet/broadcom/bcmsysport.c
3038 @@ -2323,7 +2323,7 @@ static int bcm_sysport_map_queues(struct notifier_block *nb,
3039 ring->switch_queue = qp;
3040 ring->switch_port = port;
3041 ring->inspect = true;
3042 - priv->ring_map[q + port * num_tx_queues] = ring;
3043 + priv->ring_map[qp + port * num_tx_queues] = ring;
3044 qp++;
3045 }
3046
3047 @@ -2338,7 +2338,7 @@ static int bcm_sysport_unmap_queues(struct notifier_block *nb,
3048 struct net_device *slave_dev;
3049 unsigned int num_tx_queues;
3050 struct net_device *dev;
3051 - unsigned int q, port;
3052 + unsigned int q, qp, port;
3053
3054 priv = container_of(nb, struct bcm_sysport_priv, dsa_notifier);
3055 if (priv->netdev != info->master)
3056 @@ -2364,7 +2364,8 @@ static int bcm_sysport_unmap_queues(struct notifier_block *nb,
3057 continue;
3058
3059 ring->inspect = false;
3060 - priv->ring_map[q + port * num_tx_queues] = NULL;
3061 + qp = ring->switch_queue;
3062 + priv->ring_map[qp + port * num_tx_queues] = NULL;
3063 }
3064
3065 return 0;
3066 diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
3067 index 5c75b061243f..cf292f7c3d3c 100644
3068 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
3069 +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
3070 @@ -10991,11 +10991,23 @@ static bool bnxt_fltr_match(struct bnxt_ntuple_filter *f1,
3071 struct flow_keys *keys1 = &f1->fkeys;
3072 struct flow_keys *keys2 = &f2->fkeys;
3073
3074 - if (keys1->addrs.v4addrs.src == keys2->addrs.v4addrs.src &&
3075 - keys1->addrs.v4addrs.dst == keys2->addrs.v4addrs.dst &&
3076 - keys1->ports.ports == keys2->ports.ports &&
3077 - keys1->basic.ip_proto == keys2->basic.ip_proto &&
3078 - keys1->basic.n_proto == keys2->basic.n_proto &&
3079 + if (keys1->basic.n_proto != keys2->basic.n_proto ||
3080 + keys1->basic.ip_proto != keys2->basic.ip_proto)
3081 + return false;
3082 +
3083 + if (keys1->basic.n_proto == htons(ETH_P_IP)) {
3084 + if (keys1->addrs.v4addrs.src != keys2->addrs.v4addrs.src ||
3085 + keys1->addrs.v4addrs.dst != keys2->addrs.v4addrs.dst)
3086 + return false;
3087 + } else {
3088 + if (memcmp(&keys1->addrs.v6addrs.src, &keys2->addrs.v6addrs.src,
3089 + sizeof(keys1->addrs.v6addrs.src)) ||
3090 + memcmp(&keys1->addrs.v6addrs.dst, &keys2->addrs.v6addrs.dst,
3091 + sizeof(keys1->addrs.v6addrs.dst)))
3092 + return false;
3093 + }
3094 +
3095 + if (keys1->ports.ports == keys2->ports.ports &&
3096 keys1->control.flags == keys2->control.flags &&
3097 ether_addr_equal(f1->src_mac_addr, f2->src_mac_addr) &&
3098 ether_addr_equal(f1->dst_mac_addr, f2->dst_mac_addr))
3099 @@ -11287,7 +11299,7 @@ int bnxt_get_port_parent_id(struct net_device *dev,
3100 return -EOPNOTSUPP;
3101
3102 /* The PF and it's VF-reps only support the switchdev framework */
3103 - if (!BNXT_PF(bp))
3104 + if (!BNXT_PF(bp) || !(bp->flags & BNXT_FLAG_DSN_VALID))
3105 return -EOPNOTSUPP;
3106
3107 ppid->id_len = sizeof(bp->switch_id);
3108 @@ -11679,6 +11691,7 @@ static int bnxt_pcie_dsn_get(struct bnxt *bp, u8 dsn[])
3109 put_unaligned_le32(dw, &dsn[0]);
3110 pci_read_config_dword(pdev, pos + 4, &dw);
3111 put_unaligned_le32(dw, &dsn[4]);
3112 + bp->flags |= BNXT_FLAG_DSN_VALID;
3113 return 0;
3114 }
3115
3116 @@ -11790,9 +11803,7 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
3117
3118 if (BNXT_PF(bp)) {
3119 /* Read the adapter's DSN to use as the eswitch switch_id */
3120 - rc = bnxt_pcie_dsn_get(bp, bp->switch_id);
3121 - if (rc)
3122 - goto init_err_pci_clean;
3123 + bnxt_pcie_dsn_get(bp, bp->switch_id);
3124 }
3125
3126 /* MTU range: 60 - FW defined max */
3127 diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
3128 index dc26e3ace43f..2e6ad53fdc75 100644
3129 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h
3130 +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
3131 @@ -1510,6 +1510,7 @@ struct bnxt {
3132 #define BNXT_FLAG_NO_AGG_RINGS 0x20000
3133 #define BNXT_FLAG_RX_PAGE_MODE 0x40000
3134 #define BNXT_FLAG_MULTI_HOST 0x100000
3135 + #define BNXT_FLAG_DSN_VALID 0x200000
3136 #define BNXT_FLAG_DOUBLE_DB 0x400000
3137 #define BNXT_FLAG_CHIP_NITRO_A0 0x1000000
3138 #define BNXT_FLAG_DIM 0x2000000
3139 @@ -1904,9 +1905,6 @@ static inline bool bnxt_cfa_hwrm_message(u16 req_type)
3140 case HWRM_CFA_ENCAP_RECORD_FREE:
3141 case HWRM_CFA_DECAP_FILTER_ALLOC:
3142 case HWRM_CFA_DECAP_FILTER_FREE:
3143 - case HWRM_CFA_NTUPLE_FILTER_ALLOC:
3144 - case HWRM_CFA_NTUPLE_FILTER_FREE:
3145 - case HWRM_CFA_NTUPLE_FILTER_CFG:
3146 case HWRM_CFA_EM_FLOW_ALLOC:
3147 case HWRM_CFA_EM_FLOW_FREE:
3148 case HWRM_CFA_EM_FLOW_CFG:
3149 diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c
3150 index f9bf7d7250ab..b010b34cdaf8 100644
3151 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c
3152 +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c
3153 @@ -398,6 +398,9 @@ static int bnxt_vf_reps_create(struct bnxt *bp)
3154 struct net_device *dev;
3155 int rc, i;
3156
3157 + if (!(bp->flags & BNXT_FLAG_DSN_VALID))
3158 + return -ENODEV;
3159 +
3160 bp->vf_reps = kcalloc(num_vfs, sizeof(vf_rep), GFP_KERNEL);
3161 if (!bp->vf_reps)
3162 return -ENOMEM;
3163 diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
3164 index 14ab20491fd0..eb69e5c81a4d 100644
3165 --- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c
3166 +++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
3167 @@ -565,7 +565,6 @@ static int hns_nic_poll_rx_skb(struct hns_nic_ring_data *ring_data,
3168 skb = *out_skb = napi_alloc_skb(&ring_data->napi,
3169 HNS_RX_HEAD_SIZE);
3170 if (unlikely(!skb)) {
3171 - netdev_err(ndev, "alloc rx skb fail\n");
3172 ring->stats.sw_err_cnt++;
3173 return -ENOMEM;
3174 }
3175 @@ -1056,7 +1055,6 @@ static int hns_nic_common_poll(struct napi_struct *napi, int budget)
3176 container_of(napi, struct hns_nic_ring_data, napi);
3177 struct hnae_ring *ring = ring_data->ring;
3178
3179 -try_again:
3180 clean_complete += ring_data->poll_one(
3181 ring_data, budget - clean_complete,
3182 ring_data->ex_process);
3183 @@ -1066,7 +1064,7 @@ try_again:
3184 napi_complete(napi);
3185 ring->q->handle->dev->ops->toggle_ring_irq(ring, 0);
3186 } else {
3187 - goto try_again;
3188 + return budget;
3189 }
3190 }
3191
3192 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
3193 index 84d8816c8681..0c8d2269bc46 100644
3194 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
3195 +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
3196 @@ -54,6 +54,8 @@ MODULE_PARM_DESC(debug, " Network interface message level setting");
3197 #define HNS3_INNER_VLAN_TAG 1
3198 #define HNS3_OUTER_VLAN_TAG 2
3199
3200 +#define HNS3_MIN_TX_LEN 33U
3201 +
3202 /* hns3_pci_tbl - PCI Device ID Table
3203 *
3204 * Last entry must be all 0s
3205 @@ -1329,6 +1331,10 @@ netdev_tx_t hns3_nic_net_xmit(struct sk_buff *skb, struct net_device *netdev)
3206 int ret;
3207 int i;
3208
3209 + /* Hardware can only handle short frames above 32 bytes */
3210 + if (skb_put_padto(skb, HNS3_MIN_TX_LEN))
3211 + return NETDEV_TX_OK;
3212 +
3213 /* Prefetch the data used later */
3214 prefetch(skb->data);
3215
3216 diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
3217 index 4960c9c3e773..a8dd0228b678 100644
3218 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c
3219 +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
3220 @@ -7168,6 +7168,7 @@ static int i40e_setup_macvlans(struct i40e_vsi *vsi, u16 macvlan_cnt, u16 qcnt,
3221 ch->num_queue_pairs = qcnt;
3222 if (!i40e_setup_channel(pf, vsi, ch)) {
3223 ret = -EINVAL;
3224 + kfree(ch);
3225 goto err_free;
3226 }
3227 ch->parent_vsi = vsi;
3228 diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
3229 index 3ec18fb0d479..a806c6190bb1 100644
3230 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
3231 +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
3232 @@ -812,23 +812,17 @@ static netdev_tx_t mlxsw_sp_port_xmit(struct sk_buff *skb,
3233 u64 len;
3234 int err;
3235
3236 + if (skb_cow_head(skb, MLXSW_TXHDR_LEN)) {
3237 + this_cpu_inc(mlxsw_sp_port->pcpu_stats->tx_dropped);
3238 + dev_kfree_skb_any(skb);
3239 + return NETDEV_TX_OK;
3240 + }
3241 +
3242 memset(skb->cb, 0, sizeof(struct mlxsw_skb_cb));
3243
3244 if (mlxsw_core_skb_transmit_busy(mlxsw_sp->core, &tx_info))
3245 return NETDEV_TX_BUSY;
3246
3247 - if (unlikely(skb_headroom(skb) < MLXSW_TXHDR_LEN)) {
3248 - struct sk_buff *skb_orig = skb;
3249 -
3250 - skb = skb_realloc_headroom(skb, MLXSW_TXHDR_LEN);
3251 - if (!skb) {
3252 - this_cpu_inc(mlxsw_sp_port->pcpu_stats->tx_dropped);
3253 - dev_kfree_skb_any(skb_orig);
3254 - return NETDEV_TX_OK;
3255 - }
3256 - dev_consume_skb_any(skb_orig);
3257 - }
3258 -
3259 if (eth_skb_pad(skb)) {
3260 this_cpu_inc(mlxsw_sp_port->pcpu_stats->tx_dropped);
3261 return NETDEV_TX_OK;
3262 @@ -1167,6 +1161,9 @@ static void update_stats_cache(struct work_struct *work)
3263 periodic_hw_stats.update_dw.work);
3264
3265 if (!netif_carrier_ok(mlxsw_sp_port->dev))
3266 + /* Note: mlxsw_sp_port_down_wipe_counters() clears the cache as
3267 + * necessary when port goes down.
3268 + */
3269 goto out;
3270
3271 mlxsw_sp_port_get_hw_stats(mlxsw_sp_port->dev,
3272 @@ -4176,6 +4173,15 @@ static int mlxsw_sp_port_unsplit(struct mlxsw_core *mlxsw_core, u8 local_port,
3273 return 0;
3274 }
3275
3276 +static void
3277 +mlxsw_sp_port_down_wipe_counters(struct mlxsw_sp_port *mlxsw_sp_port)
3278 +{
3279 + int i;
3280 +
3281 + for (i = 0; i < TC_MAX_QUEUE; i++)
3282 + mlxsw_sp_port->periodic_hw_stats.xstats.backlog[i] = 0;
3283 +}
3284 +
3285 static void mlxsw_sp_pude_event_func(const struct mlxsw_reg_info *reg,
3286 char *pude_pl, void *priv)
3287 {
3288 @@ -4197,6 +4203,7 @@ static void mlxsw_sp_pude_event_func(const struct mlxsw_reg_info *reg,
3289 } else {
3290 netdev_info(mlxsw_sp_port->dev, "link down\n");
3291 netif_carrier_off(mlxsw_sp_port->dev);
3292 + mlxsw_sp_port_down_wipe_counters(mlxsw_sp_port);
3293 }
3294 }
3295
3296 diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c
3297 index 720514b5c006..dc63583c4948 100644
3298 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c
3299 +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c
3300 @@ -195,6 +195,20 @@ mlxsw_sp_qdisc_get_xstats(struct mlxsw_sp_port *mlxsw_sp_port,
3301 return -EOPNOTSUPP;
3302 }
3303
3304 +static u64
3305 +mlxsw_sp_xstats_backlog(struct mlxsw_sp_port_xstats *xstats, int tclass_num)
3306 +{
3307 + return xstats->backlog[tclass_num] +
3308 + xstats->backlog[tclass_num + 8];
3309 +}
3310 +
3311 +static u64
3312 +mlxsw_sp_xstats_tail_drop(struct mlxsw_sp_port_xstats *xstats, int tclass_num)
3313 +{
3314 + return xstats->tail_drop[tclass_num] +
3315 + xstats->tail_drop[tclass_num + 8];
3316 +}
3317 +
3318 static void
3319 mlxsw_sp_qdisc_bstats_per_priority_get(struct mlxsw_sp_port_xstats *xstats,
3320 u8 prio_bitmap, u64 *tx_packets,
3321 @@ -269,7 +283,7 @@ mlxsw_sp_setup_tc_qdisc_red_clean_stats(struct mlxsw_sp_port *mlxsw_sp_port,
3322 &stats_base->tx_bytes);
3323 red_base->prob_mark = xstats->ecn;
3324 red_base->prob_drop = xstats->wred_drop[tclass_num];
3325 - red_base->pdrop = xstats->tail_drop[tclass_num];
3326 + red_base->pdrop = mlxsw_sp_xstats_tail_drop(xstats, tclass_num);
3327
3328 stats_base->overlimits = red_base->prob_drop + red_base->prob_mark;
3329 stats_base->drops = red_base->prob_drop + red_base->pdrop;
3330 @@ -369,7 +383,8 @@ mlxsw_sp_qdisc_get_red_xstats(struct mlxsw_sp_port *mlxsw_sp_port,
3331
3332 early_drops = xstats->wred_drop[tclass_num] - xstats_base->prob_drop;
3333 marks = xstats->ecn - xstats_base->prob_mark;
3334 - pdrops = xstats->tail_drop[tclass_num] - xstats_base->pdrop;
3335 + pdrops = mlxsw_sp_xstats_tail_drop(xstats, tclass_num) -
3336 + xstats_base->pdrop;
3337
3338 res->pdrop += pdrops;
3339 res->prob_drop += early_drops;
3340 @@ -402,9 +417,10 @@ mlxsw_sp_qdisc_get_red_stats(struct mlxsw_sp_port *mlxsw_sp_port,
3341
3342 overlimits = xstats->wred_drop[tclass_num] + xstats->ecn -
3343 stats_base->overlimits;
3344 - drops = xstats->wred_drop[tclass_num] + xstats->tail_drop[tclass_num] -
3345 + drops = xstats->wred_drop[tclass_num] +
3346 + mlxsw_sp_xstats_tail_drop(xstats, tclass_num) -
3347 stats_base->drops;
3348 - backlog = xstats->backlog[tclass_num];
3349 + backlog = mlxsw_sp_xstats_backlog(xstats, tclass_num);
3350
3351 _bstats_update(stats_ptr->bstats, tx_bytes, tx_packets);
3352 stats_ptr->qstats->overlimits += overlimits;
3353 @@ -575,9 +591,9 @@ mlxsw_sp_qdisc_get_prio_stats(struct mlxsw_sp_port *mlxsw_sp_port,
3354 tx_packets = stats->tx_packets - stats_base->tx_packets;
3355
3356 for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) {
3357 - drops += xstats->tail_drop[i];
3358 + drops += mlxsw_sp_xstats_tail_drop(xstats, i);
3359 drops += xstats->wred_drop[i];
3360 - backlog += xstats->backlog[i];
3361 + backlog += mlxsw_sp_xstats_backlog(xstats, i);
3362 }
3363 drops = drops - stats_base->drops;
3364
3365 @@ -613,7 +629,7 @@ mlxsw_sp_setup_tc_qdisc_prio_clean_stats(struct mlxsw_sp_port *mlxsw_sp_port,
3366
3367 stats_base->drops = 0;
3368 for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) {
3369 - stats_base->drops += xstats->tail_drop[i];
3370 + stats_base->drops += mlxsw_sp_xstats_tail_drop(xstats, i);
3371 stats_base->drops += xstats->wred_drop[i];
3372 }
3373
3374 diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
3375 index 7ba35a0bdb29..8aa1b1bda96d 100644
3376 --- a/drivers/net/ethernet/renesas/sh_eth.c
3377 +++ b/drivers/net/ethernet/renesas/sh_eth.c
3378 @@ -2204,24 +2204,28 @@ static size_t __sh_eth_get_regs(struct net_device *ndev, u32 *buf)
3379 if (cd->tsu) {
3380 add_tsu_reg(ARSTR);
3381 add_tsu_reg(TSU_CTRST);
3382 - add_tsu_reg(TSU_FWEN0);
3383 - add_tsu_reg(TSU_FWEN1);
3384 - add_tsu_reg(TSU_FCM);
3385 - add_tsu_reg(TSU_BSYSL0);
3386 - add_tsu_reg(TSU_BSYSL1);
3387 - add_tsu_reg(TSU_PRISL0);
3388 - add_tsu_reg(TSU_PRISL1);
3389 - add_tsu_reg(TSU_FWSL0);
3390 - add_tsu_reg(TSU_FWSL1);
3391 + if (cd->dual_port) {
3392 + add_tsu_reg(TSU_FWEN0);
3393 + add_tsu_reg(TSU_FWEN1);
3394 + add_tsu_reg(TSU_FCM);
3395 + add_tsu_reg(TSU_BSYSL0);
3396 + add_tsu_reg(TSU_BSYSL1);
3397 + add_tsu_reg(TSU_PRISL0);
3398 + add_tsu_reg(TSU_PRISL1);
3399 + add_tsu_reg(TSU_FWSL0);
3400 + add_tsu_reg(TSU_FWSL1);
3401 + }
3402 add_tsu_reg(TSU_FWSLC);
3403 - add_tsu_reg(TSU_QTAGM0);
3404 - add_tsu_reg(TSU_QTAGM1);
3405 - add_tsu_reg(TSU_FWSR);
3406 - add_tsu_reg(TSU_FWINMK);
3407 - add_tsu_reg(TSU_ADQT0);
3408 - add_tsu_reg(TSU_ADQT1);
3409 - add_tsu_reg(TSU_VTAG0);
3410 - add_tsu_reg(TSU_VTAG1);
3411 + if (cd->dual_port) {
3412 + add_tsu_reg(TSU_QTAGM0);
3413 + add_tsu_reg(TSU_QTAGM1);
3414 + add_tsu_reg(TSU_FWSR);
3415 + add_tsu_reg(TSU_FWINMK);
3416 + add_tsu_reg(TSU_ADQT0);
3417 + add_tsu_reg(TSU_ADQT1);
3418 + add_tsu_reg(TSU_VTAG0);
3419 + add_tsu_reg(TSU_VTAG1);
3420 + }
3421 add_tsu_reg(TSU_ADSBSY);
3422 add_tsu_reg(TSU_TEN);
3423 add_tsu_reg(TSU_POST1);
3424 diff --git a/drivers/net/ethernet/socionext/sni_ave.c b/drivers/net/ethernet/socionext/sni_ave.c
3425 index 6e984d5a729f..38d39c4b5ac8 100644
3426 --- a/drivers/net/ethernet/socionext/sni_ave.c
3427 +++ b/drivers/net/ethernet/socionext/sni_ave.c
3428 @@ -424,16 +424,22 @@ static void ave_ethtool_get_wol(struct net_device *ndev,
3429 phy_ethtool_get_wol(ndev->phydev, wol);
3430 }
3431
3432 -static int ave_ethtool_set_wol(struct net_device *ndev,
3433 - struct ethtool_wolinfo *wol)
3434 +static int __ave_ethtool_set_wol(struct net_device *ndev,
3435 + struct ethtool_wolinfo *wol)
3436 {
3437 - int ret;
3438 -
3439 if (!ndev->phydev ||
3440 (wol->wolopts & (WAKE_ARP | WAKE_MAGICSECURE)))
3441 return -EOPNOTSUPP;
3442
3443 - ret = phy_ethtool_set_wol(ndev->phydev, wol);
3444 + return phy_ethtool_set_wol(ndev->phydev, wol);
3445 +}
3446 +
3447 +static int ave_ethtool_set_wol(struct net_device *ndev,
3448 + struct ethtool_wolinfo *wol)
3449 +{
3450 + int ret;
3451 +
3452 + ret = __ave_ethtool_set_wol(ndev, wol);
3453 if (!ret)
3454 device_set_wakeup_enable(&ndev->dev, !!wol->wolopts);
3455
3456 @@ -1216,7 +1222,7 @@ static int ave_init(struct net_device *ndev)
3457
3458 /* set wol initial state disabled */
3459 wol.wolopts = 0;
3460 - ave_ethtool_set_wol(ndev, &wol);
3461 + __ave_ethtool_set_wol(ndev, &wol);
3462
3463 if (!phy_interface_is_rgmii(phydev))
3464 phy_set_max_speed(phydev, SPEED_100);
3465 @@ -1768,7 +1774,7 @@ static int ave_resume(struct device *dev)
3466
3467 ave_ethtool_get_wol(ndev, &wol);
3468 wol.wolopts = priv->wolopts;
3469 - ave_ethtool_set_wol(ndev, &wol);
3470 + __ave_ethtool_set_wol(ndev, &wol);
3471
3472 if (ndev->phydev) {
3473 ret = phy_resume(ndev->phydev);
3474 diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
3475 index 912bbb6515b2..bc82cdf36cc3 100644
3476 --- a/drivers/net/ethernet/stmicro/stmmac/common.h
3477 +++ b/drivers/net/ethernet/stmicro/stmmac/common.h
3478 @@ -364,9 +364,8 @@ struct dma_features {
3479 unsigned int arpoffsel;
3480 };
3481
3482 -/* GMAC TX FIFO is 8K, Rx FIFO is 16K */
3483 -#define BUF_SIZE_16KiB 16384
3484 -/* RX Buffer size must be < 8191 and multiple of 4/8/16 bytes */
3485 +/* RX Buffer size must be multiple of 4/8/16 bytes */
3486 +#define BUF_SIZE_16KiB 16368
3487 #define BUF_SIZE_8KiB 8188
3488 #define BUF_SIZE_4KiB 4096
3489 #define BUF_SIZE_2KiB 2048
3490 diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
3491 index 903c5d8a226e..1b3520d0e59e 100644
3492 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
3493 +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
3494 @@ -1108,7 +1108,9 @@ static int stmmac_set_bfsize(int mtu, int bufsize)
3495 {
3496 int ret = bufsize;
3497
3498 - if (mtu >= BUF_SIZE_4KiB)
3499 + if (mtu >= BUF_SIZE_8KiB)
3500 + ret = BUF_SIZE_16KiB;
3501 + else if (mtu >= BUF_SIZE_4KiB)
3502 ret = BUF_SIZE_8KiB;
3503 else if (mtu >= BUF_SIZE_2KiB)
3504 ret = BUF_SIZE_4KiB;
3505 diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
3506 index a0513deab1a0..ba03a2d77434 100644
3507 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
3508 +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
3509 @@ -80,7 +80,7 @@ static struct sk_buff *stmmac_test_get_udp_skb(struct stmmac_priv *priv,
3510 if (attr->max_size && (attr->max_size > size))
3511 size = attr->max_size;
3512
3513 - skb = netdev_alloc_skb_ip_align(priv->dev, size);
3514 + skb = netdev_alloc_skb(priv->dev, size);
3515 if (!skb)
3516 return NULL;
3517
3518 @@ -244,6 +244,8 @@ static int stmmac_test_loopback_validate(struct sk_buff *skb,
3519 struct net_device *orig_ndev)
3520 {
3521 struct stmmac_test_priv *tpriv = pt->af_packet_priv;
3522 + unsigned char *src = tpriv->packet->src;
3523 + unsigned char *dst = tpriv->packet->dst;
3524 struct stmmachdr *shdr;
3525 struct ethhdr *ehdr;
3526 struct udphdr *uhdr;
3527 @@ -260,15 +262,15 @@ static int stmmac_test_loopback_validate(struct sk_buff *skb,
3528 goto out;
3529
3530 ehdr = (struct ethhdr *)skb_mac_header(skb);
3531 - if (tpriv->packet->dst) {
3532 - if (!ether_addr_equal(ehdr->h_dest, tpriv->packet->dst))
3533 + if (dst) {
3534 + if (!ether_addr_equal_unaligned(ehdr->h_dest, dst))
3535 goto out;
3536 }
3537 if (tpriv->packet->sarc) {
3538 - if (!ether_addr_equal(ehdr->h_source, ehdr->h_dest))
3539 + if (!ether_addr_equal_unaligned(ehdr->h_source, ehdr->h_dest))
3540 goto out;
3541 - } else if (tpriv->packet->src) {
3542 - if (!ether_addr_equal(ehdr->h_source, tpriv->packet->src))
3543 + } else if (src) {
3544 + if (!ether_addr_equal_unaligned(ehdr->h_source, src))
3545 goto out;
3546 }
3547
3548 @@ -714,7 +716,7 @@ static int stmmac_test_flowctrl_validate(struct sk_buff *skb,
3549 struct ethhdr *ehdr;
3550
3551 ehdr = (struct ethhdr *)skb_mac_header(skb);
3552 - if (!ether_addr_equal(ehdr->h_source, orig_ndev->dev_addr))
3553 + if (!ether_addr_equal_unaligned(ehdr->h_source, orig_ndev->dev_addr))
3554 goto out;
3555 if (ehdr->h_proto != htons(ETH_P_PAUSE))
3556 goto out;
3557 @@ -851,12 +853,16 @@ static int stmmac_test_vlan_validate(struct sk_buff *skb,
3558 if (tpriv->vlan_id) {
3559 if (skb->vlan_proto != htons(proto))
3560 goto out;
3561 - if (skb->vlan_tci != tpriv->vlan_id)
3562 + if (skb->vlan_tci != tpriv->vlan_id) {
3563 + /* Means filter did not work. */
3564 + tpriv->ok = false;
3565 + complete(&tpriv->comp);
3566 goto out;
3567 + }
3568 }
3569
3570 ehdr = (struct ethhdr *)skb_mac_header(skb);
3571 - if (!ether_addr_equal(ehdr->h_dest, tpriv->packet->dst))
3572 + if (!ether_addr_equal_unaligned(ehdr->h_dest, tpriv->packet->dst))
3573 goto out;
3574
3575 ihdr = ip_hdr(skb);
3576 @@ -1291,16 +1297,19 @@ static int __stmmac_test_l3filt(struct stmmac_priv *priv, u32 dst, u32 src,
3577 struct stmmac_packet_attrs attr = { };
3578 struct flow_dissector *dissector;
3579 struct flow_cls_offload *cls;
3580 + int ret, old_enable = 0;
3581 struct flow_rule *rule;
3582 - int ret;
3583
3584 if (!tc_can_offload(priv->dev))
3585 return -EOPNOTSUPP;
3586 if (!priv->dma_cap.l3l4fnum)
3587 return -EOPNOTSUPP;
3588 - if (priv->rss.enable)
3589 + if (priv->rss.enable) {
3590 + old_enable = priv->rss.enable;
3591 + priv->rss.enable = false;
3592 stmmac_rss_configure(priv, priv->hw, NULL,
3593 priv->plat->rx_queues_to_use);
3594 + }
3595
3596 dissector = kzalloc(sizeof(*dissector), GFP_KERNEL);
3597 if (!dissector) {
3598 @@ -1367,7 +1376,8 @@ cleanup_cls:
3599 cleanup_dissector:
3600 kfree(dissector);
3601 cleanup_rss:
3602 - if (priv->rss.enable) {
3603 + if (old_enable) {
3604 + priv->rss.enable = old_enable;
3605 stmmac_rss_configure(priv, priv->hw, &priv->rss,
3606 priv->plat->rx_queues_to_use);
3607 }
3608 @@ -1412,16 +1422,19 @@ static int __stmmac_test_l4filt(struct stmmac_priv *priv, u32 dst, u32 src,
3609 struct stmmac_packet_attrs attr = { };
3610 struct flow_dissector *dissector;
3611 struct flow_cls_offload *cls;
3612 + int ret, old_enable = 0;
3613 struct flow_rule *rule;
3614 - int ret;
3615
3616 if (!tc_can_offload(priv->dev))
3617 return -EOPNOTSUPP;
3618 if (!priv->dma_cap.l3l4fnum)
3619 return -EOPNOTSUPP;
3620 - if (priv->rss.enable)
3621 + if (priv->rss.enable) {
3622 + old_enable = priv->rss.enable;
3623 + priv->rss.enable = false;
3624 stmmac_rss_configure(priv, priv->hw, NULL,
3625 priv->plat->rx_queues_to_use);
3626 + }
3627
3628 dissector = kzalloc(sizeof(*dissector), GFP_KERNEL);
3629 if (!dissector) {
3630 @@ -1493,7 +1506,8 @@ cleanup_cls:
3631 cleanup_dissector:
3632 kfree(dissector);
3633 cleanup_rss:
3634 - if (priv->rss.enable) {
3635 + if (old_enable) {
3636 + priv->rss.enable = old_enable;
3637 stmmac_rss_configure(priv, priv->hw, &priv->rss,
3638 priv->plat->rx_queues_to_use);
3639 }
3640 @@ -1546,7 +1560,7 @@ static int stmmac_test_arp_validate(struct sk_buff *skb,
3641 struct arphdr *ahdr;
3642
3643 ehdr = (struct ethhdr *)skb_mac_header(skb);
3644 - if (!ether_addr_equal(ehdr->h_dest, tpriv->packet->src))
3645 + if (!ether_addr_equal_unaligned(ehdr->h_dest, tpriv->packet->src))
3646 goto out;
3647
3648 ahdr = arp_hdr(skb);
3649 diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
3650 index f9a9a9d82233..1d135b02ea02 100644
3651 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
3652 +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
3653 @@ -579,6 +579,10 @@ static int tc_setup_cls(struct stmmac_priv *priv,
3654 {
3655 int ret = 0;
3656
3657 + /* When RSS is enabled, the filtering will be bypassed */
3658 + if (priv->rss.enable)
3659 + return -EBUSY;
3660 +
3661 switch (cls->command) {
3662 case FLOW_CLS_REPLACE:
3663 ret = tc_add_flow(priv, cls);
3664 diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c
3665 index f81e58267a6e..b9e44bb22289 100644
3666 --- a/drivers/net/hyperv/rndis_filter.c
3667 +++ b/drivers/net/hyperv/rndis_filter.c
3668 @@ -1436,8 +1436,6 @@ void rndis_filter_device_remove(struct hv_device *dev,
3669 /* Halt and release the rndis device */
3670 rndis_filter_halt_device(net_dev, rndis_dev);
3671
3672 - net_dev->extension = NULL;
3673 -
3674 netvsc_device_remove(dev);
3675 }
3676
3677 diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
3678 index 747c0542a53c..c5bf61565726 100644
3679 --- a/drivers/net/macvlan.c
3680 +++ b/drivers/net/macvlan.c
3681 @@ -259,7 +259,7 @@ static void macvlan_broadcast(struct sk_buff *skb,
3682 struct net_device *src,
3683 enum macvlan_mode mode)
3684 {
3685 - const struct ethhdr *eth = skb_eth_hdr(skb);
3686 + const struct ethhdr *eth = eth_hdr(skb);
3687 const struct macvlan_dev *vlan;
3688 struct sk_buff *nskb;
3689 unsigned int i;
3690 @@ -513,10 +513,11 @@ static int macvlan_queue_xmit(struct sk_buff *skb, struct net_device *dev)
3691 const struct macvlan_dev *dest;
3692
3693 if (vlan->mode == MACVLAN_MODE_BRIDGE) {
3694 - const struct ethhdr *eth = (void *)skb->data;
3695 + const struct ethhdr *eth = skb_eth_hdr(skb);
3696
3697 /* send to other bridge ports directly */
3698 if (is_multicast_ether_addr(eth->h_dest)) {
3699 + skb_reset_mac_header(skb);
3700 macvlan_broadcast(skb, port, dev, MACVLAN_MODE_BRIDGE);
3701 goto xmit_world;
3702 }
3703 diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c
3704 index cf4455bbf888..52e80434e45e 100644
3705 --- a/drivers/net/phy/dp83867.c
3706 +++ b/drivers/net/phy/dp83867.c
3707 @@ -80,6 +80,7 @@
3708 #define DP83867_PHYCR_FIFO_DEPTH_MAX 0x03
3709 #define DP83867_PHYCR_FIFO_DEPTH_MASK GENMASK(15, 14)
3710 #define DP83867_PHYCR_RESERVED_MASK BIT(11)
3711 +#define DP83867_PHYCR_FORCE_LINK_GOOD BIT(10)
3712
3713 /* RGMIIDCTL bits */
3714 #define DP83867_RGMII_TX_CLK_DELAY_MAX 0xf
3715 @@ -454,7 +455,12 @@ static int dp83867_phy_reset(struct phy_device *phydev)
3716
3717 usleep_range(10, 20);
3718
3719 - return 0;
3720 + /* After reset FORCE_LINK_GOOD bit is set. Although the
3721 + * default value should be unset. Disable FORCE_LINK_GOOD
3722 + * for the phy to work properly.
3723 + */
3724 + return phy_modify(phydev, MII_DP83867_PHYCTRL,
3725 + DP83867_PHYCR_FORCE_LINK_GOOD, 0);
3726 }
3727
3728 static struct phy_driver dp83867_driver[] = {
3729 diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
3730 index 3e5f2f7a155e..c232f1612083 100644
3731 --- a/drivers/net/usb/lan78xx.c
3732 +++ b/drivers/net/usb/lan78xx.c
3733 @@ -3750,6 +3750,7 @@ static int lan78xx_probe(struct usb_interface *intf,
3734
3735 /* MTU range: 68 - 9000 */
3736 netdev->max_mtu = MAX_SINGLE_PACKET_SIZE;
3737 + netif_set_gso_max_size(netdev, MAX_SINGLE_PACKET_SIZE - MAX_HEADER);
3738
3739 dev->ep_blkin = (intf->cur_altsetting)->endpoint + 0;
3740 dev->ep_blkout = (intf->cur_altsetting)->endpoint + 1;
3741 diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
3742 index b2507c59ba8b..9e4b7a400284 100644
3743 --- a/drivers/net/usb/r8152.c
3744 +++ b/drivers/net/usb/r8152.c
3745 @@ -5587,6 +5587,9 @@ static int rtl8152_probe(struct usb_interface *intf,
3746 return -ENODEV;
3747 }
3748
3749 + if (intf->cur_altsetting->desc.bNumEndpoints < 3)
3750 + return -ENODEV;
3751 +
3752 usb_reset_device(udev);
3753 netdev = alloc_etherdev(sizeof(struct r8152));
3754 if (!netdev) {
3755 diff --git a/drivers/net/wan/fsl_ucc_hdlc.c b/drivers/net/wan/fsl_ucc_hdlc.c
3756 index ca0f3be2b6bf..aef7de225783 100644
3757 --- a/drivers/net/wan/fsl_ucc_hdlc.c
3758 +++ b/drivers/net/wan/fsl_ucc_hdlc.c
3759 @@ -73,7 +73,7 @@ static struct ucc_tdm_info utdm_primary_info = {
3760 },
3761 };
3762
3763 -static struct ucc_tdm_info utdm_info[MAX_HDLC_NUM];
3764 +static struct ucc_tdm_info utdm_info[UCC_MAX_NUM];
3765
3766 static int uhdlc_init(struct ucc_hdlc_private *priv)
3767 {
3768 diff --git a/drivers/net/wireless/realtek/rtw88/phy.c b/drivers/net/wireless/realtek/rtw88/phy.c
3769 index d3d3f40de75e..47d199d2e7dc 100644
3770 --- a/drivers/net/wireless/realtek/rtw88/phy.c
3771 +++ b/drivers/net/wireless/realtek/rtw88/phy.c
3772 @@ -118,7 +118,7 @@ static void rtw_phy_cck_pd_init(struct rtw_dev *rtwdev)
3773
3774 for (i = 0; i <= RTW_CHANNEL_WIDTH_40; i++) {
3775 for (j = 0; j < RTW_RF_PATH_MAX; j++)
3776 - dm_info->cck_pd_lv[i][j] = 0;
3777 + dm_info->cck_pd_lv[i][j] = CCK_PD_LV0;
3778 }
3779
3780 dm_info->cck_fa_avg = CCK_FA_AVG_RESET;
3781 @@ -461,7 +461,6 @@ static void rtw_phy_dpk_track(struct rtw_dev *rtwdev)
3782 chip->ops->dpk_track(rtwdev);
3783 }
3784
3785 -#define CCK_PD_LV_MAX 5
3786 #define CCK_PD_FA_LV1_MIN 1000
3787 #define CCK_PD_FA_LV0_MAX 500
3788
3789 @@ -471,10 +470,10 @@ static u8 rtw_phy_cck_pd_lv_unlink(struct rtw_dev *rtwdev)
3790 u32 cck_fa_avg = dm_info->cck_fa_avg;
3791
3792 if (cck_fa_avg > CCK_PD_FA_LV1_MIN)
3793 - return 1;
3794 + return CCK_PD_LV1;
3795
3796 if (cck_fa_avg < CCK_PD_FA_LV0_MAX)
3797 - return 0;
3798 + return CCK_PD_LV0;
3799
3800 return CCK_PD_LV_MAX;
3801 }
3802 @@ -494,15 +493,15 @@ static u8 rtw_phy_cck_pd_lv_link(struct rtw_dev *rtwdev)
3803 u32 cck_fa_avg = dm_info->cck_fa_avg;
3804
3805 if (igi > CCK_PD_IGI_LV4_VAL && rssi > CCK_PD_RSSI_LV4_VAL)
3806 - return 4;
3807 + return CCK_PD_LV4;
3808 if (igi > CCK_PD_IGI_LV3_VAL && rssi > CCK_PD_RSSI_LV3_VAL)
3809 - return 3;
3810 + return CCK_PD_LV3;
3811 if (igi > CCK_PD_IGI_LV2_VAL || rssi > CCK_PD_RSSI_LV2_VAL)
3812 - return 2;
3813 + return CCK_PD_LV2;
3814 if (cck_fa_avg > CCK_PD_FA_LV1_MIN)
3815 - return 1;
3816 + return CCK_PD_LV1;
3817 if (cck_fa_avg < CCK_PD_FA_LV0_MAX)
3818 - return 0;
3819 + return CCK_PD_LV0;
3820
3821 return CCK_PD_LV_MAX;
3822 }
3823 diff --git a/drivers/net/wireless/realtek/rtw88/phy.h b/drivers/net/wireless/realtek/rtw88/phy.h
3824 index e79b084628e7..33a5eb9637c0 100644
3825 --- a/drivers/net/wireless/realtek/rtw88/phy.h
3826 +++ b/drivers/net/wireless/realtek/rtw88/phy.h
3827 @@ -125,6 +125,15 @@ rtw_get_tx_power_params(struct rtw_dev *rtwdev, u8 path,
3828 u8 rate, u8 bw, u8 ch, u8 regd,
3829 struct rtw_power_params *pwr_param);
3830
3831 +enum rtw_phy_cck_pd_lv {
3832 + CCK_PD_LV0,
3833 + CCK_PD_LV1,
3834 + CCK_PD_LV2,
3835 + CCK_PD_LV3,
3836 + CCK_PD_LV4,
3837 + CCK_PD_LV_MAX,
3838 +};
3839 +
3840 #define MASKBYTE0 0xff
3841 #define MASKBYTE1 0xff00
3842 #define MASKBYTE2 0xff0000
3843 diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822c.c b/drivers/net/wireless/realtek/rtw88/rtw8822c.c
3844 index c2f6cd76a658..de0505a6a365 100644
3845 --- a/drivers/net/wireless/realtek/rtw88/rtw8822c.c
3846 +++ b/drivers/net/wireless/realtek/rtw88/rtw8822c.c
3847 @@ -3168,8 +3168,8 @@ rtw8822c_phy_cck_pd_set_reg(struct rtw_dev *rtwdev,
3848 static void rtw8822c_phy_cck_pd_set(struct rtw_dev *rtwdev, u8 new_lvl)
3849 {
3850 struct rtw_dm_info *dm_info = &rtwdev->dm_info;
3851 - s8 pd_lvl[4] = {2, 4, 6, 8};
3852 - s8 cs_lvl[4] = {2, 2, 2, 4};
3853 + s8 pd_lvl[CCK_PD_LV_MAX] = {0, 2, 4, 6, 8};
3854 + s8 cs_lvl[CCK_PD_LV_MAX] = {0, 2, 2, 2, 4};
3855 u8 cur_lvl;
3856 u8 nrx, bw;
3857
3858 diff --git a/drivers/net/wireless/st/cw1200/fwio.c b/drivers/net/wireless/st/cw1200/fwio.c
3859 index 6574e78e05ea..2a03dc533b6a 100644
3860 --- a/drivers/net/wireless/st/cw1200/fwio.c
3861 +++ b/drivers/net/wireless/st/cw1200/fwio.c
3862 @@ -320,12 +320,12 @@ int cw1200_load_firmware(struct cw1200_common *priv)
3863 goto out;
3864 }
3865
3866 - priv->hw_type = cw1200_get_hw_type(val32, &major_revision);
3867 - if (priv->hw_type < 0) {
3868 + ret = cw1200_get_hw_type(val32, &major_revision);
3869 + if (ret < 0) {
3870 pr_err("Can't deduce hardware type.\n");
3871 - ret = -ENOTSUPP;
3872 goto out;
3873 }
3874 + priv->hw_type = ret;
3875
3876 /* Set DPLL Reg value, and read back to confirm writes work */
3877 ret = cw1200_reg_write_32(priv, ST90TDS_TSET_GEN_R_W_REG_ID,
3878 diff --git a/drivers/nfc/pn533/usb.c b/drivers/nfc/pn533/usb.c
3879 index e897e4d768ef..d7a355d05368 100644
3880 --- a/drivers/nfc/pn533/usb.c
3881 +++ b/drivers/nfc/pn533/usb.c
3882 @@ -391,7 +391,7 @@ static int pn533_acr122_poweron_rdr(struct pn533_usb_phy *phy)
3883 cmd, sizeof(cmd), false);
3884
3885 rc = usb_bulk_msg(phy->udev, phy->out_urb->pipe, buffer, sizeof(cmd),
3886 - &transferred, 0);
3887 + &transferred, 5000);
3888 kfree(buffer);
3889 if (rc || (transferred != sizeof(cmd))) {
3890 nfc_err(&phy->udev->dev,
3891 diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c
3892 index 61fafe0374ce..b84f16bbd6f2 100644
3893 --- a/drivers/ptp/ptp_clock.c
3894 +++ b/drivers/ptp/ptp_clock.c
3895 @@ -170,6 +170,7 @@ static void ptp_clock_release(struct device *dev)
3896 {
3897 struct ptp_clock *ptp = container_of(dev, struct ptp_clock, dev);
3898
3899 + ptp_cleanup_pin_groups(ptp);
3900 mutex_destroy(&ptp->tsevq_mux);
3901 mutex_destroy(&ptp->pincfg_mux);
3902 ida_simple_remove(&ptp_clocks_map, ptp->index);
3903 @@ -302,9 +303,8 @@ int ptp_clock_unregister(struct ptp_clock *ptp)
3904 if (ptp->pps_source)
3905 pps_unregister_source(ptp->pps_source);
3906
3907 - ptp_cleanup_pin_groups(ptp);
3908 -
3909 posix_clock_unregister(&ptp->clock);
3910 +
3911 return 0;
3912 }
3913 EXPORT_SYMBOL(ptp_clock_unregister);
3914 diff --git a/drivers/reset/core.c b/drivers/reset/core.c
3915 index f343bd814d32..76c0dc7f165d 100644
3916 --- a/drivers/reset/core.c
3917 +++ b/drivers/reset/core.c
3918 @@ -861,8 +861,7 @@ static int of_reset_control_get_count(struct device_node *node)
3919 * @acquired: only one reset control may be acquired for a given controller
3920 * and ID
3921 *
3922 - * Returns pointer to allocated reset_control_array on success or
3923 - * error on failure
3924 + * Returns pointer to allocated reset_control on success or error on failure
3925 */
3926 struct reset_control *
3927 of_reset_control_array_get(struct device_node *np, bool shared, bool optional,
3928 @@ -915,8 +914,7 @@ EXPORT_SYMBOL_GPL(of_reset_control_array_get);
3929 * that just have to be asserted or deasserted, without any
3930 * requirements on the order.
3931 *
3932 - * Returns pointer to allocated reset_control_array on success or
3933 - * error on failure
3934 + * Returns pointer to allocated reset_control on success or error on failure
3935 */
3936 struct reset_control *
3937 devm_reset_control_array_get(struct device *dev, bool shared, bool optional)
3938 diff --git a/drivers/s390/crypto/zcrypt_ccamisc.c b/drivers/s390/crypto/zcrypt_ccamisc.c
3939 index c1db64a2db21..110fe9d0cb91 100644
3940 --- a/drivers/s390/crypto/zcrypt_ccamisc.c
3941 +++ b/drivers/s390/crypto/zcrypt_ccamisc.c
3942 @@ -1037,8 +1037,8 @@ static int _ip_cprb_helper(u16 cardnr, u16 domain,
3943 prepparm = (struct iprepparm *) prepcblk->rpl_parmb;
3944
3945 /* do some plausibility checks on the key block */
3946 - if (prepparm->kb.len < 120 + 5 * sizeof(uint16_t) ||
3947 - prepparm->kb.len > 136 + 5 * sizeof(uint16_t)) {
3948 + if (prepparm->kb.len < 120 + 3 * sizeof(uint16_t) ||
3949 + prepparm->kb.len > 136 + 3 * sizeof(uint16_t)) {
3950 DEBUG_ERR("%s reply with invalid or unknown key block\n",
3951 __func__);
3952 rc = -EIO;
3953 diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c
3954 index c5fa5f3b00e9..0b28d44d3573 100644
3955 --- a/drivers/scsi/bnx2i/bnx2i_iscsi.c
3956 +++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c
3957 @@ -915,12 +915,12 @@ void bnx2i_free_hba(struct bnx2i_hba *hba)
3958 INIT_LIST_HEAD(&hba->ep_ofld_list);
3959 INIT_LIST_HEAD(&hba->ep_active_list);
3960 INIT_LIST_HEAD(&hba->ep_destroy_list);
3961 - pci_dev_put(hba->pcidev);
3962
3963 if (hba->regview) {
3964 pci_iounmap(hba->pcidev, hba->regview);
3965 hba->regview = NULL;
3966 }
3967 + pci_dev_put(hba->pcidev);
3968 bnx2i_free_mp_bdt(hba);
3969 bnx2i_release_free_cid_que(hba);
3970 iscsi_host_free(shost);
3971 diff --git a/drivers/scsi/esas2r/esas2r_flash.c b/drivers/scsi/esas2r/esas2r_flash.c
3972 index 7bd376d95ed5..b02ac389e6c6 100644
3973 --- a/drivers/scsi/esas2r/esas2r_flash.c
3974 +++ b/drivers/scsi/esas2r/esas2r_flash.c
3975 @@ -1197,6 +1197,7 @@ bool esas2r_nvram_read_direct(struct esas2r_adapter *a)
3976 if (!esas2r_read_flash_block(a, a->nvram, FLS_OFFSET_NVR,
3977 sizeof(struct esas2r_sas_nvram))) {
3978 esas2r_hdebug("NVRAM read failed, using defaults");
3979 + up(&a->nvram_semaphore);
3980 return false;
3981 }
3982
3983 diff --git a/drivers/scsi/fnic/vnic_dev.c b/drivers/scsi/fnic/vnic_dev.c
3984 index 78af9cc2009b..522636e94628 100644
3985 --- a/drivers/scsi/fnic/vnic_dev.c
3986 +++ b/drivers/scsi/fnic/vnic_dev.c
3987 @@ -688,26 +688,26 @@ int vnic_dev_soft_reset_done(struct vnic_dev *vdev, int *done)
3988
3989 int vnic_dev_hang_notify(struct vnic_dev *vdev)
3990 {
3991 - u64 a0, a1;
3992 + u64 a0 = 0, a1 = 0;
3993 int wait = 1000;
3994 return vnic_dev_cmd(vdev, CMD_HANG_NOTIFY, &a0, &a1, wait);
3995 }
3996
3997 int vnic_dev_mac_addr(struct vnic_dev *vdev, u8 *mac_addr)
3998 {
3999 - u64 a0, a1;
4000 + u64 a[2] = {};
4001 int wait = 1000;
4002 int err, i;
4003
4004 for (i = 0; i < ETH_ALEN; i++)
4005 mac_addr[i] = 0;
4006
4007 - err = vnic_dev_cmd(vdev, CMD_MAC_ADDR, &a0, &a1, wait);
4008 + err = vnic_dev_cmd(vdev, CMD_MAC_ADDR, &a[0], &a[1], wait);
4009 if (err)
4010 return err;
4011
4012 for (i = 0; i < ETH_ALEN; i++)
4013 - mac_addr[i] = ((u8 *)&a0)[i];
4014 + mac_addr[i] = ((u8 *)&a)[i];
4015
4016 return 0;
4017 }
4018 @@ -732,30 +732,30 @@ void vnic_dev_packet_filter(struct vnic_dev *vdev, int directed, int multicast,
4019
4020 void vnic_dev_add_addr(struct vnic_dev *vdev, u8 *addr)
4021 {
4022 - u64 a0 = 0, a1 = 0;
4023 + u64 a[2] = {};
4024 int wait = 1000;
4025 int err;
4026 int i;
4027
4028 for (i = 0; i < ETH_ALEN; i++)
4029 - ((u8 *)&a0)[i] = addr[i];
4030 + ((u8 *)&a)[i] = addr[i];
4031
4032 - err = vnic_dev_cmd(vdev, CMD_ADDR_ADD, &a0, &a1, wait);
4033 + err = vnic_dev_cmd(vdev, CMD_ADDR_ADD, &a[0], &a[1], wait);
4034 if (err)
4035 pr_err("Can't add addr [%pM], %d\n", addr, err);
4036 }
4037
4038 void vnic_dev_del_addr(struct vnic_dev *vdev, u8 *addr)
4039 {
4040 - u64 a0 = 0, a1 = 0;
4041 + u64 a[2] = {};
4042 int wait = 1000;
4043 int err;
4044 int i;
4045
4046 for (i = 0; i < ETH_ALEN; i++)
4047 - ((u8 *)&a0)[i] = addr[i];
4048 + ((u8 *)&a)[i] = addr[i];
4049
4050 - err = vnic_dev_cmd(vdev, CMD_ADDR_DEL, &a0, &a1, wait);
4051 + err = vnic_dev_cmd(vdev, CMD_ADDR_DEL, &a[0], &a[1], wait);
4052 if (err)
4053 pr_err("Can't del addr [%pM], %d\n", addr, err);
4054 }
4055 diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c
4056 index 633effb09c9c..849335d76cf6 100644
4057 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c
4058 +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c
4059 @@ -3719,9 +3719,6 @@ static int hisi_sas_debugfs_alloc(struct hisi_hba *hisi_hba)
4060 int p, c, d;
4061 size_t sz;
4062
4063 - hisi_hba->debugfs_dump_dentry =
4064 - debugfs_create_dir("dump", hisi_hba->debugfs_dir);
4065 -
4066 sz = hw->debugfs_reg_array[DEBUGFS_GLOBAL]->count * 4;
4067 hisi_hba->debugfs_regs[DEBUGFS_GLOBAL] =
4068 devm_kmalloc(dev, sz, GFP_KERNEL);
4069 diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
4070 index ef32ee12f606..723f51c822af 100644
4071 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
4072 +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
4073 @@ -3022,11 +3022,6 @@ static int debugfs_set_bist_v3_hw(struct hisi_hba *hisi_hba, bool enable)
4074 hisi_sas_phy_write32(hisi_hba, phy_id,
4075 SAS_PHY_BIST_CTRL, reg_val);
4076
4077 - mdelay(100);
4078 - reg_val |= (CFG_RX_BIST_EN_MSK | CFG_TX_BIST_EN_MSK);
4079 - hisi_sas_phy_write32(hisi_hba, phy_id,
4080 - SAS_PHY_BIST_CTRL, reg_val);
4081 -
4082 /* set the bist init value */
4083 hisi_sas_phy_write32(hisi_hba, phy_id,
4084 SAS_PHY_BIST_CODE,
4085 @@ -3035,6 +3030,11 @@ static int debugfs_set_bist_v3_hw(struct hisi_hba *hisi_hba, bool enable)
4086 SAS_PHY_BIST_CODE1,
4087 SAS_PHY_BIST_CODE1_INIT);
4088
4089 + mdelay(100);
4090 + reg_val |= (CFG_RX_BIST_EN_MSK | CFG_TX_BIST_EN_MSK);
4091 + hisi_sas_phy_write32(hisi_hba, phy_id,
4092 + SAS_PHY_BIST_CTRL, reg_val);
4093 +
4094 /* clear error bit */
4095 mdelay(100);
4096 hisi_sas_phy_read32(hisi_hba, phy_id, SAS_BIST_ERR_CNT);
4097 @@ -3423,6 +3423,7 @@ static int hisi_sas_v3_resume(struct pci_dev *pdev)
4098 if (rc) {
4099 scsi_remove_host(shost);
4100 pci_disable_device(pdev);
4101 + return rc;
4102 }
4103 hisi_hba->hw->phys_init(hisi_hba);
4104 sas_resume_ha(sha);
4105 diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
4106 index aa82d538a18a..40706cb842fd 100644
4107 --- a/drivers/scsi/lpfc/lpfc_scsi.c
4108 +++ b/drivers/scsi/lpfc/lpfc_scsi.c
4109 @@ -719,7 +719,7 @@ lpfc_get_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp,
4110 iocb->ulpLe = 1;
4111 iocb->ulpClass = CLASS3;
4112
4113 - if (lpfc_ndlp_check_qdepth(phba, ndlp)) {
4114 + if (lpfc_ndlp_check_qdepth(phba, ndlp) && lpfc_cmd) {
4115 atomic_inc(&ndlp->cmd_pending);
4116 lpfc_cmd->flags |= LPFC_SBUF_BUMP_QDEPTH;
4117 }
4118 diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
4119 index 8860f41af3ff..e2cec1f6e659 100644
4120 --- a/drivers/scsi/lpfc/lpfc_sli.c
4121 +++ b/drivers/scsi/lpfc/lpfc_sli.c
4122 @@ -20108,6 +20108,13 @@ void lpfc_release_io_buf(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_ncmd,
4123 lpfc_ncmd->cur_iocbq.wqe_cmpl = NULL;
4124 lpfc_ncmd->cur_iocbq.iocb_cmpl = NULL;
4125
4126 + if (phba->cfg_xpsgl && !phba->nvmet_support &&
4127 + !list_empty(&lpfc_ncmd->dma_sgl_xtra_list))
4128 + lpfc_put_sgl_per_hdwq(phba, lpfc_ncmd);
4129 +
4130 + if (!list_empty(&lpfc_ncmd->dma_cmd_rsp_list))
4131 + lpfc_put_cmd_rsp_buf_per_hdwq(phba, lpfc_ncmd);
4132 +
4133 if (phba->cfg_xri_rebalancing) {
4134 if (lpfc_ncmd->expedite) {
4135 /* Return to expedite pool */
4136 @@ -20172,13 +20179,6 @@ void lpfc_release_io_buf(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_ncmd,
4137 spin_unlock_irqrestore(&qp->io_buf_list_put_lock,
4138 iflag);
4139 }
4140 -
4141 - if (phba->cfg_xpsgl && !phba->nvmet_support &&
4142 - !list_empty(&lpfc_ncmd->dma_sgl_xtra_list))
4143 - lpfc_put_sgl_per_hdwq(phba, lpfc_ncmd);
4144 -
4145 - if (!list_empty(&lpfc_ncmd->dma_cmd_rsp_list))
4146 - lpfc_put_cmd_rsp_buf_per_hdwq(phba, lpfc_ncmd);
4147 }
4148
4149 /**
4150 @@ -20414,8 +20414,9 @@ lpfc_get_sgl_per_hdwq(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_buf)
4151 struct sli4_hybrid_sgl *allocated_sgl = NULL;
4152 struct lpfc_sli4_hdw_queue *hdwq = lpfc_buf->hdwq;
4153 struct list_head *buf_list = &hdwq->sgl_list;
4154 + unsigned long iflags;
4155
4156 - spin_lock_irq(&hdwq->hdwq_lock);
4157 + spin_lock_irqsave(&hdwq->hdwq_lock, iflags);
4158
4159 if (likely(!list_empty(buf_list))) {
4160 /* break off 1 chunk from the sgl_list */
4161 @@ -20427,9 +20428,9 @@ lpfc_get_sgl_per_hdwq(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_buf)
4162 }
4163 } else {
4164 /* allocate more */
4165 - spin_unlock_irq(&hdwq->hdwq_lock);
4166 + spin_unlock_irqrestore(&hdwq->hdwq_lock, iflags);
4167 tmp = kmalloc_node(sizeof(*tmp), GFP_ATOMIC,
4168 - cpu_to_node(smp_processor_id()));
4169 + cpu_to_node(hdwq->io_wq->chann));
4170 if (!tmp) {
4171 lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
4172 "8353 error kmalloc memory for HDWQ "
4173 @@ -20449,7 +20450,7 @@ lpfc_get_sgl_per_hdwq(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_buf)
4174 return NULL;
4175 }
4176
4177 - spin_lock_irq(&hdwq->hdwq_lock);
4178 + spin_lock_irqsave(&hdwq->hdwq_lock, iflags);
4179 list_add_tail(&tmp->list_node, &lpfc_buf->dma_sgl_xtra_list);
4180 }
4181
4182 @@ -20457,7 +20458,7 @@ lpfc_get_sgl_per_hdwq(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_buf)
4183 struct sli4_hybrid_sgl,
4184 list_node);
4185
4186 - spin_unlock_irq(&hdwq->hdwq_lock);
4187 + spin_unlock_irqrestore(&hdwq->hdwq_lock, iflags);
4188
4189 return allocated_sgl;
4190 }
4191 @@ -20481,8 +20482,9 @@ lpfc_put_sgl_per_hdwq(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_buf)
4192 struct sli4_hybrid_sgl *tmp = NULL;
4193 struct lpfc_sli4_hdw_queue *hdwq = lpfc_buf->hdwq;
4194 struct list_head *buf_list = &hdwq->sgl_list;
4195 + unsigned long iflags;
4196
4197 - spin_lock_irq(&hdwq->hdwq_lock);
4198 + spin_lock_irqsave(&hdwq->hdwq_lock, iflags);
4199
4200 if (likely(!list_empty(&lpfc_buf->dma_sgl_xtra_list))) {
4201 list_for_each_entry_safe(list_entry, tmp,
4202 @@ -20495,7 +20497,7 @@ lpfc_put_sgl_per_hdwq(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_buf)
4203 rc = -EINVAL;
4204 }
4205
4206 - spin_unlock_irq(&hdwq->hdwq_lock);
4207 + spin_unlock_irqrestore(&hdwq->hdwq_lock, iflags);
4208 return rc;
4209 }
4210
4211 @@ -20516,8 +20518,9 @@ lpfc_free_sgl_per_hdwq(struct lpfc_hba *phba,
4212 struct list_head *buf_list = &hdwq->sgl_list;
4213 struct sli4_hybrid_sgl *list_entry = NULL;
4214 struct sli4_hybrid_sgl *tmp = NULL;
4215 + unsigned long iflags;
4216
4217 - spin_lock_irq(&hdwq->hdwq_lock);
4218 + spin_lock_irqsave(&hdwq->hdwq_lock, iflags);
4219
4220 /* Free sgl pool */
4221 list_for_each_entry_safe(list_entry, tmp,
4222 @@ -20529,7 +20532,7 @@ lpfc_free_sgl_per_hdwq(struct lpfc_hba *phba,
4223 kfree(list_entry);
4224 }
4225
4226 - spin_unlock_irq(&hdwq->hdwq_lock);
4227 + spin_unlock_irqrestore(&hdwq->hdwq_lock, iflags);
4228 }
4229
4230 /**
4231 @@ -20553,8 +20556,9 @@ lpfc_get_cmd_rsp_buf_per_hdwq(struct lpfc_hba *phba,
4232 struct fcp_cmd_rsp_buf *allocated_buf = NULL;
4233 struct lpfc_sli4_hdw_queue *hdwq = lpfc_buf->hdwq;
4234 struct list_head *buf_list = &hdwq->cmd_rsp_buf_list;
4235 + unsigned long iflags;
4236
4237 - spin_lock_irq(&hdwq->hdwq_lock);
4238 + spin_lock_irqsave(&hdwq->hdwq_lock, iflags);
4239
4240 if (likely(!list_empty(buf_list))) {
4241 /* break off 1 chunk from the list */
4242 @@ -20567,9 +20571,9 @@ lpfc_get_cmd_rsp_buf_per_hdwq(struct lpfc_hba *phba,
4243 }
4244 } else {
4245 /* allocate more */
4246 - spin_unlock_irq(&hdwq->hdwq_lock);
4247 + spin_unlock_irqrestore(&hdwq->hdwq_lock, iflags);
4248 tmp = kmalloc_node(sizeof(*tmp), GFP_ATOMIC,
4249 - cpu_to_node(smp_processor_id()));
4250 + cpu_to_node(hdwq->io_wq->chann));
4251 if (!tmp) {
4252 lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
4253 "8355 error kmalloc memory for HDWQ "
4254 @@ -20594,7 +20598,7 @@ lpfc_get_cmd_rsp_buf_per_hdwq(struct lpfc_hba *phba,
4255 tmp->fcp_rsp = (struct fcp_rsp *)((uint8_t *)tmp->fcp_cmnd +
4256 sizeof(struct fcp_cmnd));
4257
4258 - spin_lock_irq(&hdwq->hdwq_lock);
4259 + spin_lock_irqsave(&hdwq->hdwq_lock, iflags);
4260 list_add_tail(&tmp->list_node, &lpfc_buf->dma_cmd_rsp_list);
4261 }
4262
4263 @@ -20602,7 +20606,7 @@ lpfc_get_cmd_rsp_buf_per_hdwq(struct lpfc_hba *phba,
4264 struct fcp_cmd_rsp_buf,
4265 list_node);
4266
4267 - spin_unlock_irq(&hdwq->hdwq_lock);
4268 + spin_unlock_irqrestore(&hdwq->hdwq_lock, iflags);
4269
4270 return allocated_buf;
4271 }
4272 @@ -20627,8 +20631,9 @@ lpfc_put_cmd_rsp_buf_per_hdwq(struct lpfc_hba *phba,
4273 struct fcp_cmd_rsp_buf *tmp = NULL;
4274 struct lpfc_sli4_hdw_queue *hdwq = lpfc_buf->hdwq;
4275 struct list_head *buf_list = &hdwq->cmd_rsp_buf_list;
4276 + unsigned long iflags;
4277
4278 - spin_lock_irq(&hdwq->hdwq_lock);
4279 + spin_lock_irqsave(&hdwq->hdwq_lock, iflags);
4280
4281 if (likely(!list_empty(&lpfc_buf->dma_cmd_rsp_list))) {
4282 list_for_each_entry_safe(list_entry, tmp,
4283 @@ -20641,7 +20646,7 @@ lpfc_put_cmd_rsp_buf_per_hdwq(struct lpfc_hba *phba,
4284 rc = -EINVAL;
4285 }
4286
4287 - spin_unlock_irq(&hdwq->hdwq_lock);
4288 + spin_unlock_irqrestore(&hdwq->hdwq_lock, iflags);
4289 return rc;
4290 }
4291
4292 @@ -20662,8 +20667,9 @@ lpfc_free_cmd_rsp_buf_per_hdwq(struct lpfc_hba *phba,
4293 struct list_head *buf_list = &hdwq->cmd_rsp_buf_list;
4294 struct fcp_cmd_rsp_buf *list_entry = NULL;
4295 struct fcp_cmd_rsp_buf *tmp = NULL;
4296 + unsigned long iflags;
4297
4298 - spin_lock_irq(&hdwq->hdwq_lock);
4299 + spin_lock_irqsave(&hdwq->hdwq_lock, iflags);
4300
4301 /* Free cmd_rsp buf pool */
4302 list_for_each_entry_safe(list_entry, tmp,
4303 @@ -20676,5 +20682,5 @@ lpfc_free_cmd_rsp_buf_per_hdwq(struct lpfc_hba *phba,
4304 kfree(list_entry);
4305 }
4306
4307 - spin_unlock_irq(&hdwq->hdwq_lock);
4308 + spin_unlock_irqrestore(&hdwq->hdwq_lock, iflags);
4309 }
4310 diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
4311 index 80f276d67c14..9ffaa920fc8f 100644
4312 --- a/drivers/scsi/qla2xxx/qla_init.c
4313 +++ b/drivers/scsi/qla2xxx/qla_init.c
4314 @@ -5891,8 +5891,7 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *vha)
4315 if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags))
4316 break;
4317
4318 - if ((fcport->flags & FCF_FABRIC_DEVICE) == 0 ||
4319 - (fcport->flags & FCF_LOGIN_NEEDED) == 0)
4320 + if ((fcport->flags & FCF_FABRIC_DEVICE) == 0)
4321 continue;
4322
4323 if (fcport->scan_state == QLA_FCPORT_SCAN) {
4324 @@ -5915,7 +5914,8 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *vha)
4325 }
4326 }
4327
4328 - if (fcport->scan_state == QLA_FCPORT_FOUND)
4329 + if (fcport->scan_state == QLA_FCPORT_FOUND &&
4330 + (fcport->flags & FCF_LOGIN_NEEDED) != 0)
4331 qla24xx_fcport_handle_login(vha, fcport);
4332 }
4333 return (rval);
4334 diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
4335 index b3766b1879e3..7c5f2736ebee 100644
4336 --- a/drivers/scsi/qla2xxx/qla_isr.c
4337 +++ b/drivers/scsi/qla2xxx/qla_isr.c
4338 @@ -3625,7 +3625,7 @@ qla2x00_request_irqs(struct qla_hw_data *ha, struct rsp_que *rsp)
4339 skip_msix:
4340
4341 ql_log(ql_log_info, vha, 0x0037,
4342 - "Falling back-to MSI mode -%d.\n", ret);
4343 + "Falling back-to MSI mode -- ret=%d.\n", ret);
4344
4345 if (!IS_QLA24XX(ha) && !IS_QLA2532(ha) && !IS_QLA8432(ha) &&
4346 !IS_QLA8001(ha) && !IS_P3P_TYPE(ha) && !IS_QLAFX00(ha) &&
4347 @@ -3633,13 +3633,13 @@ skip_msix:
4348 goto skip_msi;
4349
4350 ret = pci_alloc_irq_vectors(ha->pdev, 1, 1, PCI_IRQ_MSI);
4351 - if (!ret) {
4352 + if (ret > 0) {
4353 ql_dbg(ql_dbg_init, vha, 0x0038,
4354 "MSI: Enabled.\n");
4355 ha->flags.msi_enabled = 1;
4356 } else
4357 ql_log(ql_log_warn, vha, 0x0039,
4358 - "Falling back-to INTa mode -- %d.\n", ret);
4359 + "Falling back-to INTa mode -- ret=%d.\n", ret);
4360 skip_msi:
4361
4362 /* Skip INTx on ISP82xx. */
4363 diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c
4364 index dac9a7013208..02636b4785c5 100644
4365 --- a/drivers/scsi/qla4xxx/ql4_mbx.c
4366 +++ b/drivers/scsi/qla4xxx/ql4_mbx.c
4367 @@ -640,9 +640,6 @@ int qla4xxx_initialize_fw_cb(struct scsi_qla_host * ha)
4368
4369 if (qla4xxx_get_ifcb(ha, &mbox_cmd[0], &mbox_sts[0], init_fw_cb_dma) !=
4370 QLA_SUCCESS) {
4371 - dma_free_coherent(&ha->pdev->dev,
4372 - sizeof(struct addr_ctrl_blk),
4373 - init_fw_cb, init_fw_cb_dma);
4374 goto exit_init_fw_cb;
4375 }
4376
4377 diff --git a/drivers/scsi/scsi_trace.c b/drivers/scsi/scsi_trace.c
4378 index 07a2425ffa2c..ac35c301c792 100644
4379 --- a/drivers/scsi/scsi_trace.c
4380 +++ b/drivers/scsi/scsi_trace.c
4381 @@ -9,7 +9,7 @@
4382 #include <trace/events/scsi.h>
4383
4384 #define SERVICE_ACTION16(cdb) (cdb[1] & 0x1f)
4385 -#define SERVICE_ACTION32(cdb) ((cdb[8] << 8) | cdb[9])
4386 +#define SERVICE_ACTION32(cdb) (get_unaligned_be16(&cdb[8]))
4387
4388 static const char *
4389 scsi_trace_misc(struct trace_seq *, unsigned char *, int);
4390 @@ -39,17 +39,12 @@ static const char *
4391 scsi_trace_rw10(struct trace_seq *p, unsigned char *cdb, int len)
4392 {
4393 const char *ret = trace_seq_buffer_ptr(p);
4394 - sector_t lba = 0, txlen = 0;
4395 + u32 lba, txlen;
4396
4397 - lba |= (cdb[2] << 24);
4398 - lba |= (cdb[3] << 16);
4399 - lba |= (cdb[4] << 8);
4400 - lba |= cdb[5];
4401 - txlen |= (cdb[7] << 8);
4402 - txlen |= cdb[8];
4403 + lba = get_unaligned_be32(&cdb[2]);
4404 + txlen = get_unaligned_be16(&cdb[7]);
4405
4406 - trace_seq_printf(p, "lba=%llu txlen=%llu protect=%u",
4407 - (unsigned long long)lba, (unsigned long long)txlen,
4408 + trace_seq_printf(p, "lba=%u txlen=%u protect=%u", lba, txlen,
4409 cdb[1] >> 5);
4410
4411 if (cdb[0] == WRITE_SAME)
4412 @@ -64,19 +59,12 @@ static const char *
4413 scsi_trace_rw12(struct trace_seq *p, unsigned char *cdb, int len)
4414 {
4415 const char *ret = trace_seq_buffer_ptr(p);
4416 - sector_t lba = 0, txlen = 0;
4417 -
4418 - lba |= (cdb[2] << 24);
4419 - lba |= (cdb[3] << 16);
4420 - lba |= (cdb[4] << 8);
4421 - lba |= cdb[5];
4422 - txlen |= (cdb[6] << 24);
4423 - txlen |= (cdb[7] << 16);
4424 - txlen |= (cdb[8] << 8);
4425 - txlen |= cdb[9];
4426 -
4427 - trace_seq_printf(p, "lba=%llu txlen=%llu protect=%u",
4428 - (unsigned long long)lba, (unsigned long long)txlen,
4429 + u32 lba, txlen;
4430 +
4431 + lba = get_unaligned_be32(&cdb[2]);
4432 + txlen = get_unaligned_be32(&cdb[6]);
4433 +
4434 + trace_seq_printf(p, "lba=%u txlen=%u protect=%u", lba, txlen,
4435 cdb[1] >> 5);
4436 trace_seq_putc(p, 0);
4437
4438 @@ -87,23 +75,13 @@ static const char *
4439 scsi_trace_rw16(struct trace_seq *p, unsigned char *cdb, int len)
4440 {
4441 const char *ret = trace_seq_buffer_ptr(p);
4442 - sector_t lba = 0, txlen = 0;
4443 -
4444 - lba |= ((u64)cdb[2] << 56);
4445 - lba |= ((u64)cdb[3] << 48);
4446 - lba |= ((u64)cdb[4] << 40);
4447 - lba |= ((u64)cdb[5] << 32);
4448 - lba |= (cdb[6] << 24);
4449 - lba |= (cdb[7] << 16);
4450 - lba |= (cdb[8] << 8);
4451 - lba |= cdb[9];
4452 - txlen |= (cdb[10] << 24);
4453 - txlen |= (cdb[11] << 16);
4454 - txlen |= (cdb[12] << 8);
4455 - txlen |= cdb[13];
4456 -
4457 - trace_seq_printf(p, "lba=%llu txlen=%llu protect=%u",
4458 - (unsigned long long)lba, (unsigned long long)txlen,
4459 + u64 lba;
4460 + u32 txlen;
4461 +
4462 + lba = get_unaligned_be64(&cdb[2]);
4463 + txlen = get_unaligned_be32(&cdb[10]);
4464 +
4465 + trace_seq_printf(p, "lba=%llu txlen=%u protect=%u", lba, txlen,
4466 cdb[1] >> 5);
4467
4468 if (cdb[0] == WRITE_SAME_16)
4469 @@ -118,8 +96,8 @@ static const char *
4470 scsi_trace_rw32(struct trace_seq *p, unsigned char *cdb, int len)
4471 {
4472 const char *ret = trace_seq_buffer_ptr(p), *cmd;
4473 - sector_t lba = 0, txlen = 0;
4474 - u32 ei_lbrt = 0;
4475 + u64 lba;
4476 + u32 ei_lbrt, txlen;
4477
4478 switch (SERVICE_ACTION32(cdb)) {
4479 case READ_32:
4480 @@ -139,26 +117,12 @@ scsi_trace_rw32(struct trace_seq *p, unsigned char *cdb, int len)
4481 goto out;
4482 }
4483
4484 - lba |= ((u64)cdb[12] << 56);
4485 - lba |= ((u64)cdb[13] << 48);
4486 - lba |= ((u64)cdb[14] << 40);
4487 - lba |= ((u64)cdb[15] << 32);
4488 - lba |= (cdb[16] << 24);
4489 - lba |= (cdb[17] << 16);
4490 - lba |= (cdb[18] << 8);
4491 - lba |= cdb[19];
4492 - ei_lbrt |= (cdb[20] << 24);
4493 - ei_lbrt |= (cdb[21] << 16);
4494 - ei_lbrt |= (cdb[22] << 8);
4495 - ei_lbrt |= cdb[23];
4496 - txlen |= (cdb[28] << 24);
4497 - txlen |= (cdb[29] << 16);
4498 - txlen |= (cdb[30] << 8);
4499 - txlen |= cdb[31];
4500 -
4501 - trace_seq_printf(p, "%s_32 lba=%llu txlen=%llu protect=%u ei_lbrt=%u",
4502 - cmd, (unsigned long long)lba,
4503 - (unsigned long long)txlen, cdb[10] >> 5, ei_lbrt);
4504 + lba = get_unaligned_be64(&cdb[12]);
4505 + ei_lbrt = get_unaligned_be32(&cdb[20]);
4506 + txlen = get_unaligned_be32(&cdb[28]);
4507 +
4508 + trace_seq_printf(p, "%s_32 lba=%llu txlen=%u protect=%u ei_lbrt=%u",
4509 + cmd, lba, txlen, cdb[10] >> 5, ei_lbrt);
4510
4511 if (SERVICE_ACTION32(cdb) == WRITE_SAME_32)
4512 trace_seq_printf(p, " unmap=%u", cdb[10] >> 3 & 1);
4513 @@ -173,7 +137,7 @@ static const char *
4514 scsi_trace_unmap(struct trace_seq *p, unsigned char *cdb, int len)
4515 {
4516 const char *ret = trace_seq_buffer_ptr(p);
4517 - unsigned int regions = cdb[7] << 8 | cdb[8];
4518 + unsigned int regions = get_unaligned_be16(&cdb[7]);
4519
4520 trace_seq_printf(p, "regions=%u", (regions - 8) / 16);
4521 trace_seq_putc(p, 0);
4522 @@ -185,8 +149,8 @@ static const char *
4523 scsi_trace_service_action_in(struct trace_seq *p, unsigned char *cdb, int len)
4524 {
4525 const char *ret = trace_seq_buffer_ptr(p), *cmd;
4526 - sector_t lba = 0;
4527 - u32 alloc_len = 0;
4528 + u64 lba;
4529 + u32 alloc_len;
4530
4531 switch (SERVICE_ACTION16(cdb)) {
4532 case SAI_READ_CAPACITY_16:
4533 @@ -200,21 +164,10 @@ scsi_trace_service_action_in(struct trace_seq *p, unsigned char *cdb, int len)
4534 goto out;
4535 }
4536
4537 - lba |= ((u64)cdb[2] << 56);
4538 - lba |= ((u64)cdb[3] << 48);
4539 - lba |= ((u64)cdb[4] << 40);
4540 - lba |= ((u64)cdb[5] << 32);
4541 - lba |= (cdb[6] << 24);
4542 - lba |= (cdb[7] << 16);
4543 - lba |= (cdb[8] << 8);
4544 - lba |= cdb[9];
4545 - alloc_len |= (cdb[10] << 24);
4546 - alloc_len |= (cdb[11] << 16);
4547 - alloc_len |= (cdb[12] << 8);
4548 - alloc_len |= cdb[13];
4549 -
4550 - trace_seq_printf(p, "%s lba=%llu alloc_len=%u", cmd,
4551 - (unsigned long long)lba, alloc_len);
4552 + lba = get_unaligned_be64(&cdb[2]);
4553 + alloc_len = get_unaligned_be32(&cdb[10]);
4554 +
4555 + trace_seq_printf(p, "%s lba=%llu alloc_len=%u", cmd, lba, alloc_len);
4556
4557 out:
4558 trace_seq_putc(p, 0);
4559 diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c
4560 index ef138c57e2a6..182fd25c7c43 100644
4561 --- a/drivers/scsi/scsi_transport_sas.c
4562 +++ b/drivers/scsi/scsi_transport_sas.c
4563 @@ -1391,9 +1391,6 @@ static void sas_expander_release(struct device *dev)
4564 struct sas_rphy *rphy = dev_to_rphy(dev);
4565 struct sas_expander_device *edev = rphy_to_expander_device(rphy);
4566
4567 - if (rphy->q)
4568 - blk_cleanup_queue(rphy->q);
4569 -
4570 put_device(dev->parent);
4571 kfree(edev);
4572 }
4573 @@ -1403,9 +1400,6 @@ static void sas_end_device_release(struct device *dev)
4574 struct sas_rphy *rphy = dev_to_rphy(dev);
4575 struct sas_end_device *edev = rphy_to_end_device(rphy);
4576
4577 - if (rphy->q)
4578 - blk_cleanup_queue(rphy->q);
4579 -
4580 put_device(dev->parent);
4581 kfree(edev);
4582 }
4583 @@ -1634,8 +1628,7 @@ sas_rphy_remove(struct sas_rphy *rphy)
4584 }
4585
4586 sas_rphy_unlink(rphy);
4587 - if (rphy->q)
4588 - bsg_unregister_queue(rphy->q);
4589 + bsg_remove_queue(rphy->q);
4590 transport_remove_device(dev);
4591 device_del(dev);
4592 }
4593 diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
4594 index 542d2bac2922..5087ed6afbdc 100644
4595 --- a/drivers/scsi/storvsc_drv.c
4596 +++ b/drivers/scsi/storvsc_drv.c
4597 @@ -1835,9 +1835,11 @@ static int storvsc_probe(struct hv_device *device,
4598 */
4599 host->sg_tablesize = (stor_device->max_transfer_bytes >> PAGE_SHIFT);
4600 /*
4601 + * For non-IDE disks, the host supports multiple channels.
4602 * Set the number of HW queues we are supporting.
4603 */
4604 - host->nr_hw_queues = num_present_cpus();
4605 + if (!dev_is_ide)
4606 + host->nr_hw_queues = num_present_cpus();
4607
4608 /*
4609 * Set the error handler work queue.
4610 diff --git a/drivers/soc/amlogic/meson-ee-pwrc.c b/drivers/soc/amlogic/meson-ee-pwrc.c
4611 index 5823f5b67d16..3f0261d53ad9 100644
4612 --- a/drivers/soc/amlogic/meson-ee-pwrc.c
4613 +++ b/drivers/soc/amlogic/meson-ee-pwrc.c
4614 @@ -323,6 +323,8 @@ static int meson_ee_pwrc_init_domain(struct platform_device *pdev,
4615 struct meson_ee_pwrc *pwrc,
4616 struct meson_ee_pwrc_domain *dom)
4617 {
4618 + int ret;
4619 +
4620 dom->pwrc = pwrc;
4621 dom->num_rstc = dom->desc.reset_names_count;
4622 dom->num_clks = dom->desc.clk_names_count;
4623 @@ -368,15 +370,21 @@ static int meson_ee_pwrc_init_domain(struct platform_device *pdev,
4624 * prepare/enable counters won't be in sync.
4625 */
4626 if (dom->num_clks && dom->desc.get_power && !dom->desc.get_power(dom)) {
4627 - int ret = clk_bulk_prepare_enable(dom->num_clks, dom->clks);
4628 + ret = clk_bulk_prepare_enable(dom->num_clks, dom->clks);
4629 if (ret)
4630 return ret;
4631
4632 - pm_genpd_init(&dom->base, &pm_domain_always_on_gov, false);
4633 - } else
4634 - pm_genpd_init(&dom->base, NULL,
4635 - (dom->desc.get_power ?
4636 - dom->desc.get_power(dom) : true));
4637 + ret = pm_genpd_init(&dom->base, &pm_domain_always_on_gov,
4638 + false);
4639 + if (ret)
4640 + return ret;
4641 + } else {
4642 + ret = pm_genpd_init(&dom->base, NULL,
4643 + (dom->desc.get_power ?
4644 + dom->desc.get_power(dom) : true));
4645 + if (ret)
4646 + return ret;
4647 + }
4648
4649 return 0;
4650 }
4651 @@ -441,9 +449,7 @@ static int meson_ee_pwrc_probe(struct platform_device *pdev)
4652 pwrc->xlate.domains[i] = &dom->base;
4653 }
4654
4655 - of_genpd_add_provider_onecell(pdev->dev.of_node, &pwrc->xlate);
4656 -
4657 - return 0;
4658 + return of_genpd_add_provider_onecell(pdev->dev.of_node, &pwrc->xlate);
4659 }
4660
4661 static void meson_ee_pwrc_shutdown(struct platform_device *pdev)
4662 diff --git a/drivers/staging/comedi/drivers/ni_routes.c b/drivers/staging/comedi/drivers/ni_routes.c
4663 index eb61494dc2bd..88beb0d6c42b 100644
4664 --- a/drivers/staging/comedi/drivers/ni_routes.c
4665 +++ b/drivers/staging/comedi/drivers/ni_routes.c
4666 @@ -74,9 +74,6 @@ static int ni_find_device_routes(const char *device_family,
4667 }
4668 }
4669
4670 - if (!rv)
4671 - return -ENODATA;
4672 -
4673 /* Second, find the set of routes valid for this device. */
4674 for (i = 0; ni_device_routes_list[i]; ++i) {
4675 if (memcmp(ni_device_routes_list[i]->device, board_name,
4676 @@ -86,12 +83,12 @@ static int ni_find_device_routes(const char *device_family,
4677 }
4678 }
4679
4680 - if (!dr)
4681 - return -ENODATA;
4682 -
4683 tables->route_values = rv;
4684 tables->valid_routes = dr;
4685
4686 + if (!rv || !dr)
4687 + return -ENODATA;
4688 +
4689 return 0;
4690 }
4691
4692 @@ -489,6 +486,9 @@ int ni_find_route_source(const u8 src_sel_reg_value, int dest,
4693 {
4694 int src;
4695
4696 + if (!tables->route_values)
4697 + return -EINVAL;
4698 +
4699 dest = B(dest); /* subtract NI names offset */
4700 /* ensure we are not going to under/over run the route value table */
4701 if (dest < 0 || dest >= NI_NUM_NAMES)
4702 diff --git a/drivers/target/target_core_fabric_lib.c b/drivers/target/target_core_fabric_lib.c
4703 index 3c79411c4cd0..6b4b354c88aa 100644
4704 --- a/drivers/target/target_core_fabric_lib.c
4705 +++ b/drivers/target/target_core_fabric_lib.c
4706 @@ -118,7 +118,7 @@ static int srp_get_pr_transport_id(
4707 memset(buf + 8, 0, leading_zero_bytes);
4708 rc = hex2bin(buf + 8 + leading_zero_bytes, p, count);
4709 if (rc < 0) {
4710 - pr_debug("hex2bin failed for %s: %d\n", __func__, rc);
4711 + pr_debug("hex2bin failed for %s: %d\n", p, rc);
4712 return rc;
4713 }
4714
4715 diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
4716 index 8b23162e4239..4ac74b354801 100644
4717 --- a/drivers/usb/core/hub.c
4718 +++ b/drivers/usb/core/hub.c
4719 @@ -1191,6 +1191,7 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
4720 * PORT_OVER_CURRENT is not. So check for any of them.
4721 */
4722 if (udev || (portstatus & USB_PORT_STAT_CONNECTION) ||
4723 + (portchange & USB_PORT_STAT_C_CONNECTION) ||
4724 (portstatus & USB_PORT_STAT_OVERCURRENT) ||
4725 (portchange & USB_PORT_STAT_C_OVERCURRENT))
4726 set_bit(port1, hub->change_bits);
4727 diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c
4728 index 3bb1fff02bed..955ab97b9b22 100644
4729 --- a/drivers/usb/serial/ch341.c
4730 +++ b/drivers/usb/serial/ch341.c
4731 @@ -589,9 +589,13 @@ static int ch341_tiocmget(struct tty_struct *tty)
4732 static int ch341_reset_resume(struct usb_serial *serial)
4733 {
4734 struct usb_serial_port *port = serial->port[0];
4735 - struct ch341_private *priv = usb_get_serial_port_data(port);
4736 + struct ch341_private *priv;
4737 int ret;
4738
4739 + priv = usb_get_serial_port_data(port);
4740 + if (!priv)
4741 + return 0;
4742 +
4743 /* reconfigure ch341 serial port after bus-reset */
4744 ch341_configure(serial->dev, priv);
4745
4746 diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
4747 index 9690a5f4b9d6..5737add6a2a4 100644
4748 --- a/drivers/usb/serial/io_edgeport.c
4749 +++ b/drivers/usb/serial/io_edgeport.c
4750 @@ -716,7 +716,7 @@ static void edge_interrupt_callback(struct urb *urb)
4751 if (txCredits) {
4752 port = edge_serial->serial->port[portNumber];
4753 edge_port = usb_get_serial_port_data(port);
4754 - if (edge_port->open) {
4755 + if (edge_port && edge_port->open) {
4756 spin_lock_irqsave(&edge_port->ep_lock,
4757 flags);
4758 edge_port->txCredits += txCredits;
4759 @@ -1725,7 +1725,8 @@ static void edge_break(struct tty_struct *tty, int break_state)
4760 static void process_rcvd_data(struct edgeport_serial *edge_serial,
4761 unsigned char *buffer, __u16 bufferLength)
4762 {
4763 - struct device *dev = &edge_serial->serial->dev->dev;
4764 + struct usb_serial *serial = edge_serial->serial;
4765 + struct device *dev = &serial->dev->dev;
4766 struct usb_serial_port *port;
4767 struct edgeport_port *edge_port;
4768 __u16 lastBufferLength;
4769 @@ -1821,11 +1822,10 @@ static void process_rcvd_data(struct edgeport_serial *edge_serial,
4770
4771 /* spit this data back into the tty driver if this
4772 port is open */
4773 - if (rxLen) {
4774 - port = edge_serial->serial->port[
4775 - edge_serial->rxPort];
4776 + if (rxLen && edge_serial->rxPort < serial->num_ports) {
4777 + port = serial->port[edge_serial->rxPort];
4778 edge_port = usb_get_serial_port_data(port);
4779 - if (edge_port->open) {
4780 + if (edge_port && edge_port->open) {
4781 dev_dbg(dev, "%s - Sending %d bytes to TTY for port %d\n",
4782 __func__, rxLen,
4783 edge_serial->rxPort);
4784 @@ -1833,8 +1833,8 @@ static void process_rcvd_data(struct edgeport_serial *edge_serial,
4785 rxLen);
4786 edge_port->port->icount.rx += rxLen;
4787 }
4788 - buffer += rxLen;
4789 }
4790 + buffer += rxLen;
4791 break;
4792
4793 case EXPECT_HDR3: /* Expect 3rd byte of status header */
4794 @@ -1869,6 +1869,8 @@ static void process_rcvd_status(struct edgeport_serial *edge_serial,
4795 __u8 code = edge_serial->rxStatusCode;
4796
4797 /* switch the port pointer to the one being currently talked about */
4798 + if (edge_serial->rxPort >= edge_serial->serial->num_ports)
4799 + return;
4800 port = edge_serial->serial->port[edge_serial->rxPort];
4801 edge_port = usb_get_serial_port_data(port);
4802 if (edge_port == NULL) {
4803 diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
4804 index e66a59ef43a1..aa3dbce22cfb 100644
4805 --- a/drivers/usb/serial/keyspan.c
4806 +++ b/drivers/usb/serial/keyspan.c
4807 @@ -1058,6 +1058,8 @@ static void usa49_glocont_callback(struct urb *urb)
4808 for (i = 0; i < serial->num_ports; ++i) {
4809 port = serial->port[i];
4810 p_priv = usb_get_serial_port_data(port);
4811 + if (!p_priv)
4812 + continue;
4813
4814 if (p_priv->resend_cont) {
4815 dev_dbg(&port->dev, "%s - sending setup\n", __func__);
4816 @@ -1459,6 +1461,8 @@ static void usa67_glocont_callback(struct urb *urb)
4817 for (i = 0; i < serial->num_ports; ++i) {
4818 port = serial->port[i];
4819 p_priv = usb_get_serial_port_data(port);
4820 + if (!p_priv)
4821 + continue;
4822
4823 if (p_priv->resend_cont) {
4824 dev_dbg(&port->dev, "%s - sending setup\n", __func__);
4825 diff --git a/drivers/usb/serial/opticon.c b/drivers/usb/serial/opticon.c
4826 index cb7aac9cd9e7..ed2b4e6dca38 100644
4827 --- a/drivers/usb/serial/opticon.c
4828 +++ b/drivers/usb/serial/opticon.c
4829 @@ -113,7 +113,7 @@ static int send_control_msg(struct usb_serial_port *port, u8 requesttype,
4830 retval = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
4831 requesttype,
4832 USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_INTERFACE,
4833 - 0, 0, buffer, 1, 0);
4834 + 0, 0, buffer, 1, USB_CTRL_SET_TIMEOUT);
4835 kfree(buffer);
4836
4837 if (retval < 0)
4838 diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
4839 index 2d919d0e6e45..084cc2fff3ae 100644
4840 --- a/drivers/usb/serial/option.c
4841 +++ b/drivers/usb/serial/option.c
4842 @@ -248,6 +248,7 @@ static void option_instat_callback(struct urb *urb);
4843 #define QUECTEL_PRODUCT_BG96 0x0296
4844 #define QUECTEL_PRODUCT_EP06 0x0306
4845 #define QUECTEL_PRODUCT_EM12 0x0512
4846 +#define QUECTEL_PRODUCT_RM500Q 0x0800
4847
4848 #define CMOTECH_VENDOR_ID 0x16d8
4849 #define CMOTECH_PRODUCT_6001 0x6001
4850 @@ -1104,6 +1105,11 @@ static const struct usb_device_id option_ids[] = {
4851 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM12, 0xff, 0xff, 0xff),
4852 .driver_info = RSVD(1) | RSVD(2) | RSVD(3) | RSVD(4) | NUMEP2 },
4853 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM12, 0xff, 0, 0) },
4854 + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500Q, 0xff, 0xff, 0x30) },
4855 + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500Q, 0xff, 0, 0) },
4856 + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500Q, 0xff, 0xff, 0x10),
4857 + .driver_info = ZLP },
4858 +
4859 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) },
4860 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) },
4861 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6003),
4862 diff --git a/drivers/usb/serial/quatech2.c b/drivers/usb/serial/quatech2.c
4863 index a62981ca7a73..f93b81a297d6 100644
4864 --- a/drivers/usb/serial/quatech2.c
4865 +++ b/drivers/usb/serial/quatech2.c
4866 @@ -841,7 +841,10 @@ static void qt2_update_msr(struct usb_serial_port *port, unsigned char *ch)
4867 u8 newMSR = (u8) *ch;
4868 unsigned long flags;
4869
4870 + /* May be called from qt2_process_read_urb() for an unbound port. */
4871 port_priv = usb_get_serial_port_data(port);
4872 + if (!port_priv)
4873 + return;
4874
4875 spin_lock_irqsave(&port_priv->lock, flags);
4876 port_priv->shadowMSR = newMSR;
4877 @@ -869,7 +872,10 @@ static void qt2_update_lsr(struct usb_serial_port *port, unsigned char *ch)
4878 unsigned long flags;
4879 u8 newLSR = (u8) *ch;
4880
4881 + /* May be called from qt2_process_read_urb() for an unbound port. */
4882 port_priv = usb_get_serial_port_data(port);
4883 + if (!port_priv)
4884 + return;
4885
4886 if (newLSR & UART_LSR_BI)
4887 newLSR &= (u8) (UART_LSR_OE | UART_LSR_BI);
4888 diff --git a/drivers/usb/serial/usb-serial-simple.c b/drivers/usb/serial/usb-serial-simple.c
4889 index edbbb13d6de6..bd23a7cb1be2 100644
4890 --- a/drivers/usb/serial/usb-serial-simple.c
4891 +++ b/drivers/usb/serial/usb-serial-simple.c
4892 @@ -86,6 +86,8 @@ DEVICE(moto_modem, MOTO_IDS);
4893 #define MOTOROLA_TETRA_IDS() \
4894 { USB_DEVICE(0x0cad, 0x9011) }, /* Motorola Solutions TETRA PEI */ \
4895 { USB_DEVICE(0x0cad, 0x9012) }, /* MTP6550 */ \
4896 + { USB_DEVICE(0x0cad, 0x9013) }, /* MTP3xxx */ \
4897 + { USB_DEVICE(0x0cad, 0x9015) }, /* MTP85xx */ \
4898 { USB_DEVICE(0x0cad, 0x9016) } /* TPG2200 */
4899 DEVICE(motorola_tetra, MOTOROLA_TETRA_IDS);
4900
4901 diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
4902 index 8f066bb55d7d..dc7a65b9ec98 100644
4903 --- a/drivers/usb/serial/usb-serial.c
4904 +++ b/drivers/usb/serial/usb-serial.c
4905 @@ -1317,6 +1317,9 @@ static int usb_serial_register(struct usb_serial_driver *driver)
4906 return -EINVAL;
4907 }
4908
4909 + /* Prevent individual ports from being unbound. */
4910 + driver->driver.suppress_bind_attrs = true;
4911 +
4912 usb_serial_operations_init(driver);
4913
4914 /* Add this device to our list of devices */
4915 diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
4916 index 0b2758961b1c..6f0568fb5899 100644
4917 --- a/fs/btrfs/inode.c
4918 +++ b/fs/btrfs/inode.c
4919 @@ -4215,18 +4215,30 @@ out:
4920 }
4921
4922 static int btrfs_unlink_subvol(struct btrfs_trans_handle *trans,
4923 - struct inode *dir, u64 objectid,
4924 - const char *name, int name_len)
4925 + struct inode *dir, struct dentry *dentry)
4926 {
4927 struct btrfs_root *root = BTRFS_I(dir)->root;
4928 + struct btrfs_inode *inode = BTRFS_I(d_inode(dentry));
4929 struct btrfs_path *path;
4930 struct extent_buffer *leaf;
4931 struct btrfs_dir_item *di;
4932 struct btrfs_key key;
4933 + const char *name = dentry->d_name.name;
4934 + int name_len = dentry->d_name.len;
4935 u64 index;
4936 int ret;
4937 + u64 objectid;
4938 u64 dir_ino = btrfs_ino(BTRFS_I(dir));
4939
4940 + if (btrfs_ino(inode) == BTRFS_FIRST_FREE_OBJECTID) {
4941 + objectid = inode->root->root_key.objectid;
4942 + } else if (btrfs_ino(inode) == BTRFS_EMPTY_SUBVOL_DIR_OBJECTID) {
4943 + objectid = inode->location.objectid;
4944 + } else {
4945 + WARN_ON(1);
4946 + return -EINVAL;
4947 + }
4948 +
4949 path = btrfs_alloc_path();
4950 if (!path)
4951 return -ENOMEM;
4952 @@ -4248,13 +4260,16 @@ static int btrfs_unlink_subvol(struct btrfs_trans_handle *trans,
4953 }
4954 btrfs_release_path(path);
4955
4956 - ret = btrfs_del_root_ref(trans, objectid, root->root_key.objectid,
4957 - dir_ino, &index, name, name_len);
4958 - if (ret < 0) {
4959 - if (ret != -ENOENT) {
4960 - btrfs_abort_transaction(trans, ret);
4961 - goto out;
4962 - }
4963 + /*
4964 + * This is a placeholder inode for a subvolume we didn't have a
4965 + * reference to at the time of the snapshot creation. In the meantime
4966 + * we could have renamed the real subvol link into our snapshot, so
4967 + * depending on btrfs_del_root_ref to return -ENOENT here is incorret.
4968 + * Instead simply lookup the dir_index_item for this entry so we can
4969 + * remove it. Otherwise we know we have a ref to the root and we can
4970 + * call btrfs_del_root_ref, and it _shouldn't_ fail.
4971 + */
4972 + if (btrfs_ino(inode) == BTRFS_EMPTY_SUBVOL_DIR_OBJECTID) {
4973 di = btrfs_search_dir_index_item(root, path, dir_ino,
4974 name, name_len);
4975 if (IS_ERR_OR_NULL(di)) {
4976 @@ -4269,8 +4284,16 @@ static int btrfs_unlink_subvol(struct btrfs_trans_handle *trans,
4977 leaf = path->nodes[0];
4978 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]);
4979 index = key.offset;
4980 + btrfs_release_path(path);
4981 + } else {
4982 + ret = btrfs_del_root_ref(trans, objectid,
4983 + root->root_key.objectid, dir_ino,
4984 + &index, name, name_len);
4985 + if (ret) {
4986 + btrfs_abort_transaction(trans, ret);
4987 + goto out;
4988 + }
4989 }
4990 - btrfs_release_path(path);
4991
4992 ret = btrfs_delete_delayed_dir_index(trans, BTRFS_I(dir), index);
4993 if (ret) {
4994 @@ -4464,8 +4487,7 @@ int btrfs_delete_subvolume(struct inode *dir, struct dentry *dentry)
4995
4996 btrfs_record_snapshot_destroy(trans, BTRFS_I(dir));
4997
4998 - ret = btrfs_unlink_subvol(trans, dir, dest->root_key.objectid,
4999 - dentry->d_name.name, dentry->d_name.len);
5000 + ret = btrfs_unlink_subvol(trans, dir, dentry);
5001 if (ret) {
5002 err = ret;
5003 btrfs_abort_transaction(trans, ret);
5004 @@ -4560,10 +4582,7 @@ static int btrfs_rmdir(struct inode *dir, struct dentry *dentry)
5005 return PTR_ERR(trans);
5006
5007 if (unlikely(btrfs_ino(BTRFS_I(inode)) == BTRFS_EMPTY_SUBVOL_DIR_OBJECTID)) {
5008 - err = btrfs_unlink_subvol(trans, dir,
5009 - BTRFS_I(inode)->location.objectid,
5010 - dentry->d_name.name,
5011 - dentry->d_name.len);
5012 + err = btrfs_unlink_subvol(trans, dir, dentry);
5013 goto out;
5014 }
5015
5016 @@ -9519,7 +9538,6 @@ static int btrfs_rename_exchange(struct inode *old_dir,
5017 u64 new_ino = btrfs_ino(BTRFS_I(new_inode));
5018 u64 old_idx = 0;
5019 u64 new_idx = 0;
5020 - u64 root_objectid;
5021 int ret;
5022 bool root_log_pinned = false;
5023 bool dest_log_pinned = false;
5024 @@ -9625,10 +9643,7 @@ static int btrfs_rename_exchange(struct inode *old_dir,
5025
5026 /* src is a subvolume */
5027 if (old_ino == BTRFS_FIRST_FREE_OBJECTID) {
5028 - root_objectid = BTRFS_I(old_inode)->root->root_key.objectid;
5029 - ret = btrfs_unlink_subvol(trans, old_dir, root_objectid,
5030 - old_dentry->d_name.name,
5031 - old_dentry->d_name.len);
5032 + ret = btrfs_unlink_subvol(trans, old_dir, old_dentry);
5033 } else { /* src is an inode */
5034 ret = __btrfs_unlink_inode(trans, root, BTRFS_I(old_dir),
5035 BTRFS_I(old_dentry->d_inode),
5036 @@ -9644,10 +9659,7 @@ static int btrfs_rename_exchange(struct inode *old_dir,
5037
5038 /* dest is a subvolume */
5039 if (new_ino == BTRFS_FIRST_FREE_OBJECTID) {
5040 - root_objectid = BTRFS_I(new_inode)->root->root_key.objectid;
5041 - ret = btrfs_unlink_subvol(trans, new_dir, root_objectid,
5042 - new_dentry->d_name.name,
5043 - new_dentry->d_name.len);
5044 + ret = btrfs_unlink_subvol(trans, new_dir, new_dentry);
5045 } else { /* dest is an inode */
5046 ret = __btrfs_unlink_inode(trans, dest, BTRFS_I(new_dir),
5047 BTRFS_I(new_dentry->d_inode),
5048 @@ -9845,7 +9857,6 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
5049 struct inode *new_inode = d_inode(new_dentry);
5050 struct inode *old_inode = d_inode(old_dentry);
5051 u64 index = 0;
5052 - u64 root_objectid;
5053 int ret;
5054 u64 old_ino = btrfs_ino(BTRFS_I(old_inode));
5055 bool log_pinned = false;
5056 @@ -9953,10 +9964,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
5057 BTRFS_I(old_inode), 1);
5058
5059 if (unlikely(old_ino == BTRFS_FIRST_FREE_OBJECTID)) {
5060 - root_objectid = BTRFS_I(old_inode)->root->root_key.objectid;
5061 - ret = btrfs_unlink_subvol(trans, old_dir, root_objectid,
5062 - old_dentry->d_name.name,
5063 - old_dentry->d_name.len);
5064 + ret = btrfs_unlink_subvol(trans, old_dir, old_dentry);
5065 } else {
5066 ret = __btrfs_unlink_inode(trans, root, BTRFS_I(old_dir),
5067 BTRFS_I(d_inode(old_dentry)),
5068 @@ -9975,10 +9983,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
5069 new_inode->i_ctime = current_time(new_inode);
5070 if (unlikely(btrfs_ino(BTRFS_I(new_inode)) ==
5071 BTRFS_EMPTY_SUBVOL_DIR_OBJECTID)) {
5072 - root_objectid = BTRFS_I(new_inode)->location.objectid;
5073 - ret = btrfs_unlink_subvol(trans, new_dir, root_objectid,
5074 - new_dentry->d_name.name,
5075 - new_dentry->d_name.len);
5076 + ret = btrfs_unlink_subvol(trans, new_dir, new_dentry);
5077 BUG_ON(new_inode->i_nlink == 0);
5078 } else {
5079 ret = btrfs_unlink_inode(trans, dest, BTRFS_I(new_dir),
5080 diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
5081 index 5720e450a46f..8e86b2d700c4 100644
5082 --- a/fs/btrfs/ioctl.c
5083 +++ b/fs/btrfs/ioctl.c
5084 @@ -4254,7 +4254,19 @@ static long btrfs_ioctl_scrub(struct file *file, void __user *arg)
5085 &sa->progress, sa->flags & BTRFS_SCRUB_READONLY,
5086 0);
5087
5088 - if (ret == 0 && copy_to_user(arg, sa, sizeof(*sa)))
5089 + /*
5090 + * Copy scrub args to user space even if btrfs_scrub_dev() returned an
5091 + * error. This is important as it allows user space to know how much
5092 + * progress scrub has done. For example, if scrub is canceled we get
5093 + * -ECANCELED from btrfs_scrub_dev() and return that error back to user
5094 + * space. Later user space can inspect the progress from the structure
5095 + * btrfs_ioctl_scrub_args and resume scrub from where it left off
5096 + * previously (btrfs-progs does this).
5097 + * If we fail to copy the btrfs_ioctl_scrub_args structure to user space
5098 + * then return -EFAULT to signal the structure was not copied or it may
5099 + * be corrupt and unreliable due to a partial copy.
5100 + */
5101 + if (copy_to_user(arg, sa, sizeof(*sa)))
5102 ret = -EFAULT;
5103
5104 if (!(sa->flags & BTRFS_SCRUB_READONLY))
5105 diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
5106 index aeb5f2f3cdd7..50517221638a 100644
5107 --- a/fs/btrfs/qgroup.c
5108 +++ b/fs/btrfs/qgroup.c
5109 @@ -2423,8 +2423,12 @@ int btrfs_qgroup_account_extent(struct btrfs_trans_handle *trans, u64 bytenr,
5110 u64 nr_old_roots = 0;
5111 int ret = 0;
5112
5113 + /*
5114 + * If quotas get disabled meanwhile, the resouces need to be freed and
5115 + * we can't just exit here.
5116 + */
5117 if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags))
5118 - return 0;
5119 + goto out_free;
5120
5121 if (new_roots) {
5122 if (!maybe_fs_roots(new_roots))
5123 diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
5124 index fd0f4c1696c8..bc1d7f144ace 100644
5125 --- a/fs/btrfs/relocation.c
5126 +++ b/fs/btrfs/relocation.c
5127 @@ -517,6 +517,34 @@ static int update_backref_cache(struct btrfs_trans_handle *trans,
5128 return 1;
5129 }
5130
5131 +static bool reloc_root_is_dead(struct btrfs_root *root)
5132 +{
5133 + /*
5134 + * Pair with set_bit/clear_bit in clean_dirty_subvols and
5135 + * btrfs_update_reloc_root. We need to see the updated bit before
5136 + * trying to access reloc_root
5137 + */
5138 + smp_rmb();
5139 + if (test_bit(BTRFS_ROOT_DEAD_RELOC_TREE, &root->state))
5140 + return true;
5141 + return false;
5142 +}
5143 +
5144 +/*
5145 + * Check if this subvolume tree has valid reloc tree.
5146 + *
5147 + * Reloc tree after swap is considered dead, thus not considered as valid.
5148 + * This is enough for most callers, as they don't distinguish dead reloc root
5149 + * from no reloc root. But should_ignore_root() below is a special case.
5150 + */
5151 +static bool have_reloc_root(struct btrfs_root *root)
5152 +{
5153 + if (reloc_root_is_dead(root))
5154 + return false;
5155 + if (!root->reloc_root)
5156 + return false;
5157 + return true;
5158 +}
5159
5160 static int should_ignore_root(struct btrfs_root *root)
5161 {
5162 @@ -525,6 +553,10 @@ static int should_ignore_root(struct btrfs_root *root)
5163 if (!test_bit(BTRFS_ROOT_REF_COWS, &root->state))
5164 return 0;
5165
5166 + /* This root has been merged with its reloc tree, we can ignore it */
5167 + if (reloc_root_is_dead(root))
5168 + return 1;
5169 +
5170 reloc_root = root->reloc_root;
5171 if (!reloc_root)
5172 return 0;
5173 @@ -1439,7 +1471,7 @@ int btrfs_init_reloc_root(struct btrfs_trans_handle *trans,
5174 * The subvolume has reloc tree but the swap is finished, no need to
5175 * create/update the dead reloc tree
5176 */
5177 - if (test_bit(BTRFS_ROOT_DEAD_RELOC_TREE, &root->state))
5178 + if (reloc_root_is_dead(root))
5179 return 0;
5180
5181 if (root->reloc_root) {
5182 @@ -1478,8 +1510,7 @@ int btrfs_update_reloc_root(struct btrfs_trans_handle *trans,
5183 struct btrfs_root_item *root_item;
5184 int ret;
5185
5186 - if (test_bit(BTRFS_ROOT_DEAD_RELOC_TREE, &root->state) ||
5187 - !root->reloc_root)
5188 + if (!have_reloc_root(root))
5189 goto out;
5190
5191 reloc_root = root->reloc_root;
5192 @@ -1489,6 +1520,11 @@ int btrfs_update_reloc_root(struct btrfs_trans_handle *trans,
5193 if (fs_info->reloc_ctl->merge_reloc_tree &&
5194 btrfs_root_refs(root_item) == 0) {
5195 set_bit(BTRFS_ROOT_DEAD_RELOC_TREE, &root->state);
5196 + /*
5197 + * Mark the tree as dead before we change reloc_root so
5198 + * have_reloc_root will not touch it from now on.
5199 + */
5200 + smp_wmb();
5201 __del_reloc_root(reloc_root);
5202 }
5203
5204 @@ -2202,6 +2238,11 @@ static int clean_dirty_subvols(struct reloc_control *rc)
5205 if (ret2 < 0 && !ret)
5206 ret = ret2;
5207 }
5208 + /*
5209 + * Need barrier to ensure clear_bit() only happens after
5210 + * root->reloc_root = NULL. Pairs with have_reloc_root.
5211 + */
5212 + smp_wmb();
5213 clear_bit(BTRFS_ROOT_DEAD_RELOC_TREE, &root->state);
5214 btrfs_put_fs_root(root);
5215 } else {
5216 @@ -4721,7 +4762,7 @@ void btrfs_reloc_pre_snapshot(struct btrfs_pending_snapshot *pending,
5217 struct btrfs_root *root = pending->root;
5218 struct reloc_control *rc = root->fs_info->reloc_ctl;
5219
5220 - if (!root->reloc_root || !rc)
5221 + if (!rc || !have_reloc_root(root))
5222 return;
5223
5224 if (!rc->merge_reloc_tree)
5225 @@ -4755,7 +4796,7 @@ int btrfs_reloc_post_snapshot(struct btrfs_trans_handle *trans,
5226 struct reloc_control *rc = root->fs_info->reloc_ctl;
5227 int ret;
5228
5229 - if (!root->reloc_root || !rc)
5230 + if (!rc || !have_reloc_root(root))
5231 return 0;
5232
5233 rc = root->fs_info->reloc_ctl;
5234 diff --git a/fs/btrfs/root-tree.c b/fs/btrfs/root-tree.c
5235 index 3b17b647d002..612411c74550 100644
5236 --- a/fs/btrfs/root-tree.c
5237 +++ b/fs/btrfs/root-tree.c
5238 @@ -376,11 +376,13 @@ again:
5239 leaf = path->nodes[0];
5240 ref = btrfs_item_ptr(leaf, path->slots[0],
5241 struct btrfs_root_ref);
5242 -
5243 - WARN_ON(btrfs_root_ref_dirid(leaf, ref) != dirid);
5244 - WARN_ON(btrfs_root_ref_name_len(leaf, ref) != name_len);
5245 ptr = (unsigned long)(ref + 1);
5246 - WARN_ON(memcmp_extent_buffer(leaf, name, ptr, name_len));
5247 + if ((btrfs_root_ref_dirid(leaf, ref) != dirid) ||
5248 + (btrfs_root_ref_name_len(leaf, ref) != name_len) ||
5249 + memcmp_extent_buffer(leaf, name, ptr, name_len)) {
5250 + err = -ENOENT;
5251 + goto out;
5252 + }
5253 *sequence = btrfs_root_ref_sequence(leaf, ref);
5254
5255 ret = btrfs_del_item(trans, tree_root, path);
5256 diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
5257 index d8d7b1ee83ca..97f1ba7c18b2 100644
5258 --- a/fs/btrfs/volumes.c
5259 +++ b/fs/btrfs/volumes.c
5260 @@ -4066,7 +4066,11 @@ int btrfs_balance(struct btrfs_fs_info *fs_info,
5261 }
5262 }
5263
5264 - num_devices = btrfs_num_devices(fs_info);
5265 + /*
5266 + * rw_devices will not change at the moment, device add/delete/replace
5267 + * are excluded by EXCL_OP
5268 + */
5269 + num_devices = fs_info->fs_devices->rw_devices;
5270
5271 /*
5272 * SINGLE profile on-disk has no profile bit, but in-memory we have a
5273 diff --git a/fs/fuse/file.c b/fs/fuse/file.c
5274 index a63d779eac10..ce715380143c 100644
5275 --- a/fs/fuse/file.c
5276 +++ b/fs/fuse/file.c
5277 @@ -882,6 +882,7 @@ static void fuse_send_readpages(struct fuse_io_args *ia, struct file *file)
5278 struct fuse_args_pages *ap = &ia->ap;
5279 loff_t pos = page_offset(ap->pages[0]);
5280 size_t count = ap->num_pages << PAGE_SHIFT;
5281 + ssize_t res;
5282 int err;
5283
5284 ap->args.out_pages = true;
5285 @@ -896,7 +897,8 @@ static void fuse_send_readpages(struct fuse_io_args *ia, struct file *file)
5286 if (!err)
5287 return;
5288 } else {
5289 - err = fuse_simple_request(fc, &ap->args);
5290 + res = fuse_simple_request(fc, &ap->args);
5291 + err = res < 0 ? res : 0;
5292 }
5293 fuse_readpages_end(fc, &ap->args, err);
5294 }
5295 diff --git a/fs/io_uring.c b/fs/io_uring.c
5296 index 709671faaed6..b1c9ad1fb9e1 100644
5297 --- a/fs/io_uring.c
5298 +++ b/fs/io_uring.c
5299 @@ -3716,6 +3716,12 @@ SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit,
5300 wake_up(&ctx->sqo_wait);
5301 submitted = to_submit;
5302 } else if (to_submit) {
5303 + if (current->mm != ctx->sqo_mm ||
5304 + current_cred() != ctx->creds) {
5305 + ret = -EPERM;
5306 + goto out;
5307 + }
5308 +
5309 to_submit = min(to_submit, ctx->sq_entries);
5310
5311 mutex_lock(&ctx->uring_lock);
5312 diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
5313 index 62b40df36c98..28b241cd6987 100644
5314 --- a/fs/reiserfs/xattr.c
5315 +++ b/fs/reiserfs/xattr.c
5316 @@ -319,8 +319,12 @@ static int reiserfs_for_each_xattr(struct inode *inode,
5317 out_dir:
5318 dput(dir);
5319 out:
5320 - /* -ENODATA isn't an error */
5321 - if (err == -ENODATA)
5322 + /*
5323 + * -ENODATA: this object doesn't have any xattrs
5324 + * -EOPNOTSUPP: this file system doesn't have xattrs enabled on disk.
5325 + * Neither are errors
5326 + */
5327 + if (err == -ENODATA || err == -EOPNOTSUPP)
5328 err = 0;
5329 return err;
5330 }
5331 diff --git a/include/dt-bindings/reset/amlogic,meson8b-reset.h b/include/dt-bindings/reset/amlogic,meson8b-reset.h
5332 index c614438bcbdb..fbc524a900da 100644
5333 --- a/include/dt-bindings/reset/amlogic,meson8b-reset.h
5334 +++ b/include/dt-bindings/reset/amlogic,meson8b-reset.h
5335 @@ -46,9 +46,9 @@
5336 #define RESET_VD_RMEM 64
5337 #define RESET_AUDIN 65
5338 #define RESET_DBLK 66
5339 -#define RESET_PIC_DC 66
5340 -#define RESET_PSC 66
5341 -#define RESET_NAND 66
5342 +#define RESET_PIC_DC 67
5343 +#define RESET_PSC 68
5344 +#define RESET_NAND 69
5345 #define RESET_GE2D 70
5346 #define RESET_PARSER_REG 71
5347 #define RESET_PARSER_FETCH 72
5348 diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
5349 index f3ea78b0c91c..51ccb4b8770a 100644
5350 --- a/include/linux/blkdev.h
5351 +++ b/include/linux/blkdev.h
5352 @@ -328,6 +328,7 @@ struct queue_limits {
5353 unsigned int max_sectors;
5354 unsigned int max_segment_size;
5355 unsigned int physical_block_size;
5356 + unsigned int logical_block_size;
5357 unsigned int alignment_offset;
5358 unsigned int io_min;
5359 unsigned int io_opt;
5360 @@ -338,7 +339,6 @@ struct queue_limits {
5361 unsigned int discard_granularity;
5362 unsigned int discard_alignment;
5363
5364 - unsigned short logical_block_size;
5365 unsigned short max_segments;
5366 unsigned short max_integrity_segments;
5367 unsigned short max_discard_segments;
5368 @@ -1080,7 +1080,7 @@ extern void blk_queue_max_write_same_sectors(struct request_queue *q,
5369 unsigned int max_write_same_sectors);
5370 extern void blk_queue_max_write_zeroes_sectors(struct request_queue *q,
5371 unsigned int max_write_same_sectors);
5372 -extern void blk_queue_logical_block_size(struct request_queue *, unsigned short);
5373 +extern void blk_queue_logical_block_size(struct request_queue *, unsigned int);
5374 extern void blk_queue_physical_block_size(struct request_queue *, unsigned int);
5375 extern void blk_queue_alignment_offset(struct request_queue *q,
5376 unsigned int alignment);
5377 @@ -1294,7 +1294,7 @@ static inline unsigned int queue_max_segment_size(const struct request_queue *q)
5378 return q->limits.max_segment_size;
5379 }
5380
5381 -static inline unsigned short queue_logical_block_size(const struct request_queue *q)
5382 +static inline unsigned queue_logical_block_size(const struct request_queue *q)
5383 {
5384 int retval = 512;
5385
5386 @@ -1304,7 +1304,7 @@ static inline unsigned short queue_logical_block_size(const struct request_queue
5387 return retval;
5388 }
5389
5390 -static inline unsigned short bdev_logical_block_size(struct block_device *bdev)
5391 +static inline unsigned int bdev_logical_block_size(struct block_device *bdev)
5392 {
5393 return queue_logical_block_size(bdev_get_queue(bdev));
5394 }
5395 diff --git a/include/linux/mm.h b/include/linux/mm.h
5396 index a2adf95b3f9c..b249d2e033aa 100644
5397 --- a/include/linux/mm.h
5398 +++ b/include/linux/mm.h
5399 @@ -2666,13 +2666,25 @@ static inline bool want_init_on_free(void)
5400 !page_poisoning_enabled();
5401 }
5402
5403 -#ifdef CONFIG_DEBUG_PAGEALLOC_ENABLE_DEFAULT
5404 -DECLARE_STATIC_KEY_TRUE(_debug_pagealloc_enabled);
5405 +#ifdef CONFIG_DEBUG_PAGEALLOC
5406 +extern void init_debug_pagealloc(void);
5407 #else
5408 -DECLARE_STATIC_KEY_FALSE(_debug_pagealloc_enabled);
5409 +static inline void init_debug_pagealloc(void) {}
5410 #endif
5411 +extern bool _debug_pagealloc_enabled_early;
5412 +DECLARE_STATIC_KEY_FALSE(_debug_pagealloc_enabled);
5413
5414 static inline bool debug_pagealloc_enabled(void)
5415 +{
5416 + return IS_ENABLED(CONFIG_DEBUG_PAGEALLOC) &&
5417 + _debug_pagealloc_enabled_early;
5418 +}
5419 +
5420 +/*
5421 + * For use in fast paths after init_debug_pagealloc() has run, or when a
5422 + * false negative result is not harmful when called too early.
5423 + */
5424 +static inline bool debug_pagealloc_enabled_static(void)
5425 {
5426 if (!IS_ENABLED(CONFIG_DEBUG_PAGEALLOC))
5427 return false;
5428 diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
5429 index bda20282746b..8b5f758942a2 100644
5430 --- a/include/linux/mmzone.h
5431 +++ b/include/linux/mmzone.h
5432 @@ -215,9 +215,8 @@ enum node_stat_item {
5433 NR_INACTIVE_FILE, /* " " " " " */
5434 NR_ACTIVE_FILE, /* " " " " " */
5435 NR_UNEVICTABLE, /* " " " " " */
5436 - NR_SLAB_RECLAIMABLE, /* Please do not reorder this item */
5437 - NR_SLAB_UNRECLAIMABLE, /* and this one without looking at
5438 - * memcg_flush_percpu_vmstats() first. */
5439 + NR_SLAB_RECLAIMABLE,
5440 + NR_SLAB_UNRECLAIMABLE,
5441 NR_ISOLATED_ANON, /* Temporary isolated pages from anon lru */
5442 NR_ISOLATED_FILE, /* Temporary isolated pages from file lru */
5443 WORKINGSET_NODES,
5444 diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
5445 index 76d952aeb0fc..13f09706033a 100644
5446 --- a/include/linux/netdevice.h
5447 +++ b/include/linux/netdevice.h
5448 @@ -1761,7 +1761,7 @@ enum netdev_priv_flags {
5449 * for hardware timestamping
5450 * @sfp_bus: attached &struct sfp_bus structure.
5451 * @qdisc_tx_busylock_key: lockdep class annotating Qdisc->busylock
5452 - spinlock
5453 + * spinlock
5454 * @qdisc_running_key: lockdep class annotating Qdisc->running seqcount
5455 * @qdisc_xmit_lock_key: lockdep class annotating
5456 * netdev_queue->_xmit_lock spinlock
5457 diff --git a/include/linux/regulator/ab8500.h b/include/linux/regulator/ab8500.h
5458 index 505e94a6e3e8..3ab1ddf151a2 100644
5459 --- a/include/linux/regulator/ab8500.h
5460 +++ b/include/linux/regulator/ab8500.h
5461 @@ -42,8 +42,6 @@ enum ab8505_regulator_id {
5462 AB8505_LDO_ANAMIC2,
5463 AB8505_LDO_AUX8,
5464 AB8505_LDO_ANA,
5465 - AB8505_SYSCLKREQ_2,
5466 - AB8505_SYSCLKREQ_4,
5467 AB8505_NUM_REGULATORS,
5468 };
5469
5470 diff --git a/include/linux/skmsg.h b/include/linux/skmsg.h
5471 index da4caff7efa4..7eb6a8754f19 100644
5472 --- a/include/linux/skmsg.h
5473 +++ b/include/linux/skmsg.h
5474 @@ -354,17 +354,22 @@ static inline void sk_psock_update_proto(struct sock *sk,
5475 static inline void sk_psock_restore_proto(struct sock *sk,
5476 struct sk_psock *psock)
5477 {
5478 - sk->sk_write_space = psock->saved_write_space;
5479 + sk->sk_prot->unhash = psock->saved_unhash;
5480
5481 if (psock->sk_proto) {
5482 struct inet_connection_sock *icsk = inet_csk(sk);
5483 bool has_ulp = !!icsk->icsk_ulp_data;
5484
5485 - if (has_ulp)
5486 - tcp_update_ulp(sk, psock->sk_proto);
5487 - else
5488 + if (has_ulp) {
5489 + tcp_update_ulp(sk, psock->sk_proto,
5490 + psock->saved_write_space);
5491 + } else {
5492 sk->sk_prot = psock->sk_proto;
5493 + sk->sk_write_space = psock->saved_write_space;
5494 + }
5495 psock->sk_proto = NULL;
5496 + } else {
5497 + sk->sk_write_space = psock->saved_write_space;
5498 }
5499 }
5500
5501 diff --git a/include/linux/tnum.h b/include/linux/tnum.h
5502 index c17af77f3fae..ea627d1ab7e3 100644
5503 --- a/include/linux/tnum.h
5504 +++ b/include/linux/tnum.h
5505 @@ -30,7 +30,7 @@ struct tnum tnum_lshift(struct tnum a, u8 shift);
5506 /* Shift (rsh) a tnum right (by a fixed shift) */
5507 struct tnum tnum_rshift(struct tnum a, u8 shift);
5508 /* Shift (arsh) a tnum right (by a fixed min_shift) */
5509 -struct tnum tnum_arshift(struct tnum a, u8 min_shift);
5510 +struct tnum tnum_arshift(struct tnum a, u8 min_shift, u8 insn_bitness);
5511 /* Add two tnums, return @a + @b */
5512 struct tnum tnum_add(struct tnum a, struct tnum b);
5513 /* Subtract two tnums, return @a - @b */
5514 diff --git a/include/net/tcp.h b/include/net/tcp.h
5515 index b2367cfe0bda..830c89db1245 100644
5516 --- a/include/net/tcp.h
5517 +++ b/include/net/tcp.h
5518 @@ -2132,7 +2132,8 @@ struct tcp_ulp_ops {
5519 /* initialize ulp */
5520 int (*init)(struct sock *sk);
5521 /* update ulp */
5522 - void (*update)(struct sock *sk, struct proto *p);
5523 + void (*update)(struct sock *sk, struct proto *p,
5524 + void (*write_space)(struct sock *sk));
5525 /* cleanup ulp */
5526 void (*release)(struct sock *sk);
5527 /* diagnostic */
5528 @@ -2147,7 +2148,8 @@ void tcp_unregister_ulp(struct tcp_ulp_ops *type);
5529 int tcp_set_ulp(struct sock *sk, const char *name);
5530 void tcp_get_available_ulp(char *buf, size_t len);
5531 void tcp_cleanup_ulp(struct sock *sk);
5532 -void tcp_update_ulp(struct sock *sk, struct proto *p);
5533 +void tcp_update_ulp(struct sock *sk, struct proto *p,
5534 + void (*write_space)(struct sock *sk));
5535
5536 #define MODULE_ALIAS_TCP_ULP(name) \
5537 __MODULE_INFO(alias, alias_userspace, name); \
5538 diff --git a/include/trace/events/huge_memory.h b/include/trace/events/huge_memory.h
5539 index dd4db334bd63..d82a0f4e824d 100644
5540 --- a/include/trace/events/huge_memory.h
5541 +++ b/include/trace/events/huge_memory.h
5542 @@ -31,7 +31,8 @@
5543 EM( SCAN_ALLOC_HUGE_PAGE_FAIL, "alloc_huge_page_failed") \
5544 EM( SCAN_CGROUP_CHARGE_FAIL, "ccgroup_charge_failed") \
5545 EM( SCAN_EXCEED_SWAP_PTE, "exceed_swap_pte") \
5546 - EMe(SCAN_TRUNCATED, "truncated") \
5547 + EM( SCAN_TRUNCATED, "truncated") \
5548 + EMe(SCAN_PAGE_HAS_PRIVATE, "page_has_private") \
5549
5550 #undef EM
5551 #undef EMe
5552 diff --git a/init/main.c b/init/main.c
5553 index 91f6ebb30ef0..c0206c507eba 100644
5554 --- a/init/main.c
5555 +++ b/init/main.c
5556 @@ -553,6 +553,7 @@ static void __init mm_init(void)
5557 * bigger than MAX_ORDER unless SPARSEMEM.
5558 */
5559 page_ext_init_flatmem();
5560 + init_debug_pagealloc();
5561 report_meminit();
5562 mem_init();
5563 kmem_cache_init();
5564 diff --git a/kernel/bpf/tnum.c b/kernel/bpf/tnum.c
5565 index ca52b9642943..d4f335a9a899 100644
5566 --- a/kernel/bpf/tnum.c
5567 +++ b/kernel/bpf/tnum.c
5568 @@ -44,14 +44,19 @@ struct tnum tnum_rshift(struct tnum a, u8 shift)
5569 return TNUM(a.value >> shift, a.mask >> shift);
5570 }
5571
5572 -struct tnum tnum_arshift(struct tnum a, u8 min_shift)
5573 +struct tnum tnum_arshift(struct tnum a, u8 min_shift, u8 insn_bitness)
5574 {
5575 /* if a.value is negative, arithmetic shifting by minimum shift
5576 * will have larger negative offset compared to more shifting.
5577 * If a.value is nonnegative, arithmetic shifting by minimum shift
5578 * will have larger positive offset compare to more shifting.
5579 */
5580 - return TNUM((s64)a.value >> min_shift, (s64)a.mask >> min_shift);
5581 + if (insn_bitness == 32)
5582 + return TNUM((u32)(((s32)a.value) >> min_shift),
5583 + (u32)(((s32)a.mask) >> min_shift));
5584 + else
5585 + return TNUM((s64)a.value >> min_shift,
5586 + (s64)a.mask >> min_shift);
5587 }
5588
5589 struct tnum tnum_add(struct tnum a, struct tnum b)
5590 diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
5591 index 9c74c98f6501..b2817d0929b3 100644
5592 --- a/kernel/bpf/verifier.c
5593 +++ b/kernel/bpf/verifier.c
5594 @@ -4824,9 +4824,16 @@ static int adjust_scalar_min_max_vals(struct bpf_verifier_env *env,
5595 /* Upon reaching here, src_known is true and
5596 * umax_val is equal to umin_val.
5597 */
5598 - dst_reg->smin_value >>= umin_val;
5599 - dst_reg->smax_value >>= umin_val;
5600 - dst_reg->var_off = tnum_arshift(dst_reg->var_off, umin_val);
5601 + if (insn_bitness == 32) {
5602 + dst_reg->smin_value = (u32)(((s32)dst_reg->smin_value) >> umin_val);
5603 + dst_reg->smax_value = (u32)(((s32)dst_reg->smax_value) >> umin_val);
5604 + } else {
5605 + dst_reg->smin_value >>= umin_val;
5606 + dst_reg->smax_value >>= umin_val;
5607 + }
5608 +
5609 + dst_reg->var_off = tnum_arshift(dst_reg->var_off, umin_val,
5610 + insn_bitness);
5611
5612 /* blow away the dst_reg umin_value/umax_value and rely on
5613 * dst_reg var_off to refine the result.
5614 diff --git a/kernel/cpu.c b/kernel/cpu.c
5615 index e2cad3ee2ead..116825437cd6 100644
5616 --- a/kernel/cpu.c
5617 +++ b/kernel/cpu.c
5618 @@ -1909,6 +1909,78 @@ void __cpuhp_remove_state(enum cpuhp_state state, bool invoke)
5619 }
5620 EXPORT_SYMBOL(__cpuhp_remove_state);
5621
5622 +#ifdef CONFIG_HOTPLUG_SMT
5623 +static void cpuhp_offline_cpu_device(unsigned int cpu)
5624 +{
5625 + struct device *dev = get_cpu_device(cpu);
5626 +
5627 + dev->offline = true;
5628 + /* Tell user space about the state change */
5629 + kobject_uevent(&dev->kobj, KOBJ_OFFLINE);
5630 +}
5631 +
5632 +static void cpuhp_online_cpu_device(unsigned int cpu)
5633 +{
5634 + struct device *dev = get_cpu_device(cpu);
5635 +
5636 + dev->offline = false;
5637 + /* Tell user space about the state change */
5638 + kobject_uevent(&dev->kobj, KOBJ_ONLINE);
5639 +}
5640 +
5641 +int cpuhp_smt_disable(enum cpuhp_smt_control ctrlval)
5642 +{
5643 + int cpu, ret = 0;
5644 +
5645 + cpu_maps_update_begin();
5646 + for_each_online_cpu(cpu) {
5647 + if (topology_is_primary_thread(cpu))
5648 + continue;
5649 + ret = cpu_down_maps_locked(cpu, CPUHP_OFFLINE);
5650 + if (ret)
5651 + break;
5652 + /*
5653 + * As this needs to hold the cpu maps lock it's impossible
5654 + * to call device_offline() because that ends up calling
5655 + * cpu_down() which takes cpu maps lock. cpu maps lock
5656 + * needs to be held as this might race against in kernel
5657 + * abusers of the hotplug machinery (thermal management).
5658 + *
5659 + * So nothing would update device:offline state. That would
5660 + * leave the sysfs entry stale and prevent onlining after
5661 + * smt control has been changed to 'off' again. This is
5662 + * called under the sysfs hotplug lock, so it is properly
5663 + * serialized against the regular offline usage.
5664 + */
5665 + cpuhp_offline_cpu_device(cpu);
5666 + }
5667 + if (!ret)
5668 + cpu_smt_control = ctrlval;
5669 + cpu_maps_update_done();
5670 + return ret;
5671 +}
5672 +
5673 +int cpuhp_smt_enable(void)
5674 +{
5675 + int cpu, ret = 0;
5676 +
5677 + cpu_maps_update_begin();
5678 + cpu_smt_control = CPU_SMT_ENABLED;
5679 + for_each_present_cpu(cpu) {
5680 + /* Skip online CPUs and CPUs on offline nodes */
5681 + if (cpu_online(cpu) || !node_online(cpu_to_node(cpu)))
5682 + continue;
5683 + ret = _cpu_up(cpu, 0, CPUHP_ONLINE);
5684 + if (ret)
5685 + break;
5686 + /* See comment in cpuhp_smt_disable() */
5687 + cpuhp_online_cpu_device(cpu);
5688 + }
5689 + cpu_maps_update_done();
5690 + return ret;
5691 +}
5692 +#endif
5693 +
5694 #if defined(CONFIG_SYSFS) && defined(CONFIG_HOTPLUG_CPU)
5695 static ssize_t show_cpuhp_state(struct device *dev,
5696 struct device_attribute *attr, char *buf)
5697 @@ -2063,77 +2135,6 @@ static const struct attribute_group cpuhp_cpu_root_attr_group = {
5698
5699 #ifdef CONFIG_HOTPLUG_SMT
5700
5701 -static void cpuhp_offline_cpu_device(unsigned int cpu)
5702 -{
5703 - struct device *dev = get_cpu_device(cpu);
5704 -
5705 - dev->offline = true;
5706 - /* Tell user space about the state change */
5707 - kobject_uevent(&dev->kobj, KOBJ_OFFLINE);
5708 -}
5709 -
5710 -static void cpuhp_online_cpu_device(unsigned int cpu)
5711 -{
5712 - struct device *dev = get_cpu_device(cpu);
5713 -
5714 - dev->offline = false;
5715 - /* Tell user space about the state change */
5716 - kobject_uevent(&dev->kobj, KOBJ_ONLINE);
5717 -}
5718 -
5719 -int cpuhp_smt_disable(enum cpuhp_smt_control ctrlval)
5720 -{
5721 - int cpu, ret = 0;
5722 -
5723 - cpu_maps_update_begin();
5724 - for_each_online_cpu(cpu) {
5725 - if (topology_is_primary_thread(cpu))
5726 - continue;
5727 - ret = cpu_down_maps_locked(cpu, CPUHP_OFFLINE);
5728 - if (ret)
5729 - break;
5730 - /*
5731 - * As this needs to hold the cpu maps lock it's impossible
5732 - * to call device_offline() because that ends up calling
5733 - * cpu_down() which takes cpu maps lock. cpu maps lock
5734 - * needs to be held as this might race against in kernel
5735 - * abusers of the hotplug machinery (thermal management).
5736 - *
5737 - * So nothing would update device:offline state. That would
5738 - * leave the sysfs entry stale and prevent onlining after
5739 - * smt control has been changed to 'off' again. This is
5740 - * called under the sysfs hotplug lock, so it is properly
5741 - * serialized against the regular offline usage.
5742 - */
5743 - cpuhp_offline_cpu_device(cpu);
5744 - }
5745 - if (!ret)
5746 - cpu_smt_control = ctrlval;
5747 - cpu_maps_update_done();
5748 - return ret;
5749 -}
5750 -
5751 -int cpuhp_smt_enable(void)
5752 -{
5753 - int cpu, ret = 0;
5754 -
5755 - cpu_maps_update_begin();
5756 - cpu_smt_control = CPU_SMT_ENABLED;
5757 - for_each_present_cpu(cpu) {
5758 - /* Skip online CPUs and CPUs on offline nodes */
5759 - if (cpu_online(cpu) || !node_online(cpu_to_node(cpu)))
5760 - continue;
5761 - ret = _cpu_up(cpu, 0, CPUHP_ONLINE);
5762 - if (ret)
5763 - break;
5764 - /* See comment in cpuhp_smt_disable() */
5765 - cpuhp_online_cpu_device(cpu);
5766 - }
5767 - cpu_maps_update_done();
5768 - return ret;
5769 -}
5770 -
5771 -
5772 static ssize_t
5773 __store_smt_control(struct device *dev, struct device_attribute *attr,
5774 const char *buf, size_t count)
5775 diff --git a/kernel/events/core.c b/kernel/events/core.c
5776 index 8f66a4833ded..6c829e22bad3 100644
5777 --- a/kernel/events/core.c
5778 +++ b/kernel/events/core.c
5779 @@ -11182,8 +11182,10 @@ SYSCALL_DEFINE5(perf_event_open,
5780 }
5781 }
5782
5783 - if (event->attr.aux_output && !perf_get_aux_event(event, group_leader))
5784 + if (event->attr.aux_output && !perf_get_aux_event(event, group_leader)) {
5785 + err = -EINVAL;
5786 goto err_locked;
5787 + }
5788
5789 /*
5790 * Must be under the same ctx::mutex as perf_install_in_context(),
5791 diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
5792 index 233459c03b5a..35d3b6925b1e 100644
5793 --- a/kernel/locking/lockdep.c
5794 +++ b/kernel/locking/lockdep.c
5795 @@ -482,7 +482,7 @@ static struct lock_trace *save_trace(void)
5796 struct lock_trace *trace, *t2;
5797 struct hlist_head *hash_head;
5798 u32 hash;
5799 - unsigned int max_entries;
5800 + int max_entries;
5801
5802 BUILD_BUG_ON_NOT_POWER_OF_2(STACK_TRACE_HASH_SIZE);
5803 BUILD_BUG_ON(LOCK_TRACE_SIZE_IN_LONGS >= MAX_STACK_TRACE_ENTRIES);
5804 @@ -490,10 +490,8 @@ static struct lock_trace *save_trace(void)
5805 trace = (struct lock_trace *)(stack_trace + nr_stack_trace_entries);
5806 max_entries = MAX_STACK_TRACE_ENTRIES - nr_stack_trace_entries -
5807 LOCK_TRACE_SIZE_IN_LONGS;
5808 - trace->nr_entries = stack_trace_save(trace->entries, max_entries, 3);
5809
5810 - if (nr_stack_trace_entries >= MAX_STACK_TRACE_ENTRIES -
5811 - LOCK_TRACE_SIZE_IN_LONGS - 1) {
5812 + if (max_entries <= 0) {
5813 if (!debug_locks_off_graph_unlock())
5814 return NULL;
5815
5816 @@ -502,6 +500,7 @@ static struct lock_trace *save_trace(void)
5817
5818 return NULL;
5819 }
5820 + trace->nr_entries = stack_trace_save(trace->entries, max_entries, 3);
5821
5822 hash = jhash(trace->entries, trace->nr_entries *
5823 sizeof(trace->entries[0]), 0);
5824 diff --git a/kernel/locking/rwsem.c b/kernel/locking/rwsem.c
5825 index eef04551eae7..baafa1dd9fcc 100644
5826 --- a/kernel/locking/rwsem.c
5827 +++ b/kernel/locking/rwsem.c
5828 @@ -1226,8 +1226,8 @@ wait:
5829 * In this case, we attempt to acquire the lock again
5830 * without sleeping.
5831 */
5832 - if ((wstate == WRITER_HANDOFF) &&
5833 - (rwsem_spin_on_owner(sem, 0) == OWNER_NULL))
5834 + if (wstate == WRITER_HANDOFF &&
5835 + rwsem_spin_on_owner(sem, RWSEM_NONSPINNABLE) == OWNER_NULL)
5836 goto trylock_again;
5837
5838 /* Block until there are no active lockers. */
5839 diff --git a/kernel/ptrace.c b/kernel/ptrace.c
5840 index cb9ddcc08119..43d6179508d6 100644
5841 --- a/kernel/ptrace.c
5842 +++ b/kernel/ptrace.c
5843 @@ -264,12 +264,17 @@ static int ptrace_check_attach(struct task_struct *child, bool ignore_state)
5844 return ret;
5845 }
5846
5847 -static int ptrace_has_cap(struct user_namespace *ns, unsigned int mode)
5848 +static bool ptrace_has_cap(const struct cred *cred, struct user_namespace *ns,
5849 + unsigned int mode)
5850 {
5851 + int ret;
5852 +
5853 if (mode & PTRACE_MODE_NOAUDIT)
5854 - return has_ns_capability_noaudit(current, ns, CAP_SYS_PTRACE);
5855 + ret = security_capable(cred, ns, CAP_SYS_PTRACE, CAP_OPT_NOAUDIT);
5856 else
5857 - return has_ns_capability(current, ns, CAP_SYS_PTRACE);
5858 + ret = security_capable(cred, ns, CAP_SYS_PTRACE, CAP_OPT_NONE);
5859 +
5860 + return ret == 0;
5861 }
5862
5863 /* Returns 0 on success, -errno on denial. */
5864 @@ -321,7 +326,7 @@ static int __ptrace_may_access(struct task_struct *task, unsigned int mode)
5865 gid_eq(caller_gid, tcred->sgid) &&
5866 gid_eq(caller_gid, tcred->gid))
5867 goto ok;
5868 - if (ptrace_has_cap(tcred->user_ns, mode))
5869 + if (ptrace_has_cap(cred, tcred->user_ns, mode))
5870 goto ok;
5871 rcu_read_unlock();
5872 return -EPERM;
5873 @@ -340,7 +345,7 @@ ok:
5874 mm = task->mm;
5875 if (mm &&
5876 ((get_dumpable(mm) != SUID_DUMP_USER) &&
5877 - !ptrace_has_cap(mm->user_ns, mode)))
5878 + !ptrace_has_cap(cred, mm->user_ns, mode)))
5879 return -EPERM;
5880
5881 return security_ptrace_access_check(task, mode);
5882 diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
5883 index 955851748dc3..5c9fcc72460d 100644
5884 --- a/kernel/time/tick-sched.c
5885 +++ b/kernel/time/tick-sched.c
5886 @@ -58,8 +58,9 @@ static void tick_do_update_jiffies64(ktime_t now)
5887
5888 /*
5889 * Do a quick check without holding jiffies_lock:
5890 + * The READ_ONCE() pairs with two updates done later in this function.
5891 */
5892 - delta = ktime_sub(now, last_jiffies_update);
5893 + delta = ktime_sub(now, READ_ONCE(last_jiffies_update));
5894 if (delta < tick_period)
5895 return;
5896
5897 @@ -70,8 +71,9 @@ static void tick_do_update_jiffies64(ktime_t now)
5898 if (delta >= tick_period) {
5899
5900 delta = ktime_sub(delta, tick_period);
5901 - last_jiffies_update = ktime_add(last_jiffies_update,
5902 - tick_period);
5903 + /* Pairs with the lockless read in this function. */
5904 + WRITE_ONCE(last_jiffies_update,
5905 + ktime_add(last_jiffies_update, tick_period));
5906
5907 /* Slow path for long timeouts */
5908 if (unlikely(delta >= tick_period)) {
5909 @@ -79,8 +81,10 @@ static void tick_do_update_jiffies64(ktime_t now)
5910
5911 ticks = ktime_divns(delta, incr);
5912
5913 - last_jiffies_update = ktime_add_ns(last_jiffies_update,
5914 - incr * ticks);
5915 + /* Pairs with the lockless read in this function. */
5916 + WRITE_ONCE(last_jiffies_update,
5917 + ktime_add_ns(last_jiffies_update,
5918 + incr * ticks));
5919 }
5920 do_timer(++ticks);
5921
5922 diff --git a/mm/huge_memory.c b/mm/huge_memory.c
5923 index 13cc93785006..1de7f53621a0 100644
5924 --- a/mm/huge_memory.c
5925 +++ b/mm/huge_memory.c
5926 @@ -527,13 +527,13 @@ void prep_transhuge_page(struct page *page)
5927 set_compound_page_dtor(page, TRANSHUGE_PAGE_DTOR);
5928 }
5929
5930 -static unsigned long __thp_get_unmapped_area(struct file *filp, unsigned long len,
5931 +static unsigned long __thp_get_unmapped_area(struct file *filp,
5932 + unsigned long addr, unsigned long len,
5933 loff_t off, unsigned long flags, unsigned long size)
5934 {
5935 - unsigned long addr;
5936 loff_t off_end = off + len;
5937 loff_t off_align = round_up(off, size);
5938 - unsigned long len_pad;
5939 + unsigned long len_pad, ret;
5940
5941 if (off_end <= off_align || (off_end - off_align) < size)
5942 return 0;
5943 @@ -542,30 +542,40 @@ static unsigned long __thp_get_unmapped_area(struct file *filp, unsigned long le
5944 if (len_pad < len || (off + len_pad) < off)
5945 return 0;
5946
5947 - addr = current->mm->get_unmapped_area(filp, 0, len_pad,
5948 + ret = current->mm->get_unmapped_area(filp, addr, len_pad,
5949 off >> PAGE_SHIFT, flags);
5950 - if (IS_ERR_VALUE(addr))
5951 +
5952 + /*
5953 + * The failure might be due to length padding. The caller will retry
5954 + * without the padding.
5955 + */
5956 + if (IS_ERR_VALUE(ret))
5957 return 0;
5958
5959 - addr += (off - addr) & (size - 1);
5960 - return addr;
5961 + /*
5962 + * Do not try to align to THP boundary if allocation at the address
5963 + * hint succeeds.
5964 + */
5965 + if (ret == addr)
5966 + return addr;
5967 +
5968 + ret += (off - ret) & (size - 1);
5969 + return ret;
5970 }
5971
5972 unsigned long thp_get_unmapped_area(struct file *filp, unsigned long addr,
5973 unsigned long len, unsigned long pgoff, unsigned long flags)
5974 {
5975 + unsigned long ret;
5976 loff_t off = (loff_t)pgoff << PAGE_SHIFT;
5977
5978 - if (addr)
5979 - goto out;
5980 if (!IS_DAX(filp->f_mapping->host) || !IS_ENABLED(CONFIG_FS_DAX_PMD))
5981 goto out;
5982
5983 - addr = __thp_get_unmapped_area(filp, len, off, flags, PMD_SIZE);
5984 - if (addr)
5985 - return addr;
5986 -
5987 - out:
5988 + ret = __thp_get_unmapped_area(filp, addr, len, off, flags, PMD_SIZE);
5989 + if (ret)
5990 + return ret;
5991 +out:
5992 return current->mm->get_unmapped_area(filp, addr, len, pgoff, flags);
5993 }
5994 EXPORT_SYMBOL_GPL(thp_get_unmapped_area);
5995 diff --git a/mm/memcontrol.c b/mm/memcontrol.c
5996 index 46ad252e6d6a..ef4e9eb572a4 100644
5997 --- a/mm/memcontrol.c
5998 +++ b/mm/memcontrol.c
5999 @@ -3404,49 +3404,34 @@ static u64 mem_cgroup_read_u64(struct cgroup_subsys_state *css,
6000 }
6001 }
6002
6003 -static void memcg_flush_percpu_vmstats(struct mem_cgroup *memcg, bool slab_only)
6004 +static void memcg_flush_percpu_vmstats(struct mem_cgroup *memcg)
6005 {
6006 - unsigned long stat[MEMCG_NR_STAT];
6007 + unsigned long stat[MEMCG_NR_STAT] = {0};
6008 struct mem_cgroup *mi;
6009 int node, cpu, i;
6010 - int min_idx, max_idx;
6011 -
6012 - if (slab_only) {
6013 - min_idx = NR_SLAB_RECLAIMABLE;
6014 - max_idx = NR_SLAB_UNRECLAIMABLE;
6015 - } else {
6016 - min_idx = 0;
6017 - max_idx = MEMCG_NR_STAT;
6018 - }
6019 -
6020 - for (i = min_idx; i < max_idx; i++)
6021 - stat[i] = 0;
6022
6023 for_each_online_cpu(cpu)
6024 - for (i = min_idx; i < max_idx; i++)
6025 + for (i = 0; i < MEMCG_NR_STAT; i++)
6026 stat[i] += per_cpu(memcg->vmstats_percpu->stat[i], cpu);
6027
6028 for (mi = memcg; mi; mi = parent_mem_cgroup(mi))
6029 - for (i = min_idx; i < max_idx; i++)
6030 + for (i = 0; i < MEMCG_NR_STAT; i++)
6031 atomic_long_add(stat[i], &mi->vmstats[i]);
6032
6033 - if (!slab_only)
6034 - max_idx = NR_VM_NODE_STAT_ITEMS;
6035 -
6036 for_each_node(node) {
6037 struct mem_cgroup_per_node *pn = memcg->nodeinfo[node];
6038 struct mem_cgroup_per_node *pi;
6039
6040 - for (i = min_idx; i < max_idx; i++)
6041 + for (i = 0; i < NR_VM_NODE_STAT_ITEMS; i++)
6042 stat[i] = 0;
6043
6044 for_each_online_cpu(cpu)
6045 - for (i = min_idx; i < max_idx; i++)
6046 + for (i = 0; i < NR_VM_NODE_STAT_ITEMS; i++)
6047 stat[i] += per_cpu(
6048 pn->lruvec_stat_cpu->count[i], cpu);
6049
6050 for (pi = pn; pi; pi = parent_nodeinfo(pi, node))
6051 - for (i = min_idx; i < max_idx; i++)
6052 + for (i = 0; i < NR_VM_NODE_STAT_ITEMS; i++)
6053 atomic_long_add(stat[i], &pi->lruvec_stat[i]);
6054 }
6055 }
6056 @@ -3520,13 +3505,9 @@ static void memcg_offline_kmem(struct mem_cgroup *memcg)
6057 parent = root_mem_cgroup;
6058
6059 /*
6060 - * Deactivate and reparent kmem_caches. Then flush percpu
6061 - * slab statistics to have precise values at the parent and
6062 - * all ancestor levels. It's required to keep slab stats
6063 - * accurate after the reparenting of kmem_caches.
6064 + * Deactivate and reparent kmem_caches.
6065 */
6066 memcg_deactivate_kmem_caches(memcg, parent);
6067 - memcg_flush_percpu_vmstats(memcg, true);
6068
6069 kmemcg_id = memcg->kmemcg_id;
6070 BUG_ON(kmemcg_id < 0);
6071 @@ -5037,7 +5018,7 @@ static void mem_cgroup_free(struct mem_cgroup *memcg)
6072 * Flush percpu vmstats and vmevents to guarantee the value correctness
6073 * on parent's and all ancestor levels.
6074 */
6075 - memcg_flush_percpu_vmstats(memcg, false);
6076 + memcg_flush_percpu_vmstats(memcg);
6077 memcg_flush_percpu_vmevents(memcg);
6078 __mem_cgroup_free(memcg);
6079 }
6080 diff --git a/mm/page-writeback.c b/mm/page-writeback.c
6081 index 50055d2e4ea8..2d658b208319 100644
6082 --- a/mm/page-writeback.c
6083 +++ b/mm/page-writeback.c
6084 @@ -201,11 +201,11 @@ static void wb_min_max_ratio(struct bdi_writeback *wb,
6085 if (this_bw < tot_bw) {
6086 if (min) {
6087 min *= this_bw;
6088 - do_div(min, tot_bw);
6089 + min = div64_ul(min, tot_bw);
6090 }
6091 if (max < 100) {
6092 max *= this_bw;
6093 - do_div(max, tot_bw);
6094 + max = div64_ul(max, tot_bw);
6095 }
6096 }
6097
6098 diff --git a/mm/page_alloc.c b/mm/page_alloc.c
6099 index f391c0c4ed1d..45e39131a716 100644
6100 --- a/mm/page_alloc.c
6101 +++ b/mm/page_alloc.c
6102 @@ -694,34 +694,27 @@ void prep_compound_page(struct page *page, unsigned int order)
6103 #ifdef CONFIG_DEBUG_PAGEALLOC
6104 unsigned int _debug_guardpage_minorder;
6105
6106 -#ifdef CONFIG_DEBUG_PAGEALLOC_ENABLE_DEFAULT
6107 -DEFINE_STATIC_KEY_TRUE(_debug_pagealloc_enabled);
6108 -#else
6109 +bool _debug_pagealloc_enabled_early __read_mostly
6110 + = IS_ENABLED(CONFIG_DEBUG_PAGEALLOC_ENABLE_DEFAULT);
6111 +EXPORT_SYMBOL(_debug_pagealloc_enabled_early);
6112 DEFINE_STATIC_KEY_FALSE(_debug_pagealloc_enabled);
6113 -#endif
6114 EXPORT_SYMBOL(_debug_pagealloc_enabled);
6115
6116 DEFINE_STATIC_KEY_FALSE(_debug_guardpage_enabled);
6117
6118 static int __init early_debug_pagealloc(char *buf)
6119 {
6120 - bool enable = false;
6121 -
6122 - if (kstrtobool(buf, &enable))
6123 - return -EINVAL;
6124 -
6125 - if (enable)
6126 - static_branch_enable(&_debug_pagealloc_enabled);
6127 -
6128 - return 0;
6129 + return kstrtobool(buf, &_debug_pagealloc_enabled_early);
6130 }
6131 early_param("debug_pagealloc", early_debug_pagealloc);
6132
6133 -static void init_debug_guardpage(void)
6134 +void init_debug_pagealloc(void)
6135 {
6136 if (!debug_pagealloc_enabled())
6137 return;
6138
6139 + static_branch_enable(&_debug_pagealloc_enabled);
6140 +
6141 if (!debug_guardpage_minorder())
6142 return;
6143
6144 @@ -1186,7 +1179,7 @@ static __always_inline bool free_pages_prepare(struct page *page,
6145 */
6146 arch_free_page(page, order);
6147
6148 - if (debug_pagealloc_enabled())
6149 + if (debug_pagealloc_enabled_static())
6150 kernel_map_pages(page, 1 << order, 0);
6151
6152 kasan_free_nondeferred_pages(page, order);
6153 @@ -1207,7 +1200,7 @@ static bool free_pcp_prepare(struct page *page)
6154
6155 static bool bulkfree_pcp_prepare(struct page *page)
6156 {
6157 - if (debug_pagealloc_enabled())
6158 + if (debug_pagealloc_enabled_static())
6159 return free_pages_check(page);
6160 else
6161 return false;
6162 @@ -1221,7 +1214,7 @@ static bool bulkfree_pcp_prepare(struct page *page)
6163 */
6164 static bool free_pcp_prepare(struct page *page)
6165 {
6166 - if (debug_pagealloc_enabled())
6167 + if (debug_pagealloc_enabled_static())
6168 return free_pages_prepare(page, 0, true);
6169 else
6170 return free_pages_prepare(page, 0, false);
6171 @@ -1973,10 +1966,6 @@ void __init page_alloc_init_late(void)
6172
6173 for_each_populated_zone(zone)
6174 set_zone_contiguous(zone);
6175 -
6176 -#ifdef CONFIG_DEBUG_PAGEALLOC
6177 - init_debug_guardpage();
6178 -#endif
6179 }
6180
6181 #ifdef CONFIG_CMA
6182 @@ -2106,7 +2095,7 @@ static inline bool free_pages_prezeroed(void)
6183 */
6184 static inline bool check_pcp_refill(struct page *page)
6185 {
6186 - if (debug_pagealloc_enabled())
6187 + if (debug_pagealloc_enabled_static())
6188 return check_new_page(page);
6189 else
6190 return false;
6191 @@ -2128,7 +2117,7 @@ static inline bool check_pcp_refill(struct page *page)
6192 }
6193 static inline bool check_new_pcp(struct page *page)
6194 {
6195 - if (debug_pagealloc_enabled())
6196 + if (debug_pagealloc_enabled_static())
6197 return check_new_page(page);
6198 else
6199 return false;
6200 @@ -2155,7 +2144,7 @@ inline void post_alloc_hook(struct page *page, unsigned int order,
6201 set_page_refcounted(page);
6202
6203 arch_alloc_page(page, order);
6204 - if (debug_pagealloc_enabled())
6205 + if (debug_pagealloc_enabled_static())
6206 kernel_map_pages(page, 1 << order, 1);
6207 kasan_alloc_pages(page, order);
6208 kernel_poison_pages(page, 1 << order, 1);
6209 diff --git a/mm/shmem.c b/mm/shmem.c
6210 index 6074714fdbd4..312e31196720 100644
6211 --- a/mm/shmem.c
6212 +++ b/mm/shmem.c
6213 @@ -2106,9 +2106,10 @@ unsigned long shmem_get_unmapped_area(struct file *file,
6214 /*
6215 * Our priority is to support MAP_SHARED mapped hugely;
6216 * and support MAP_PRIVATE mapped hugely too, until it is COWed.
6217 - * But if caller specified an address hint, respect that as before.
6218 + * But if caller specified an address hint and we allocated area there
6219 + * successfully, respect that as before.
6220 */
6221 - if (uaddr)
6222 + if (uaddr == addr)
6223 return addr;
6224
6225 if (shmem_huge != SHMEM_HUGE_FORCE) {
6226 @@ -2142,7 +2143,7 @@ unsigned long shmem_get_unmapped_area(struct file *file,
6227 if (inflated_len < len)
6228 return addr;
6229
6230 - inflated_addr = get_area(NULL, 0, inflated_len, 0, flags);
6231 + inflated_addr = get_area(NULL, uaddr, inflated_len, 0, flags);
6232 if (IS_ERR_VALUE(inflated_addr))
6233 return addr;
6234 if (inflated_addr & ~PAGE_MASK)
6235 diff --git a/mm/slab.c b/mm/slab.c
6236 index 66e5d8032bae..d1d7624cec4a 100644
6237 --- a/mm/slab.c
6238 +++ b/mm/slab.c
6239 @@ -1415,7 +1415,7 @@ static void kmem_rcu_free(struct rcu_head *head)
6240 #if DEBUG
6241 static bool is_debug_pagealloc_cache(struct kmem_cache *cachep)
6242 {
6243 - if (debug_pagealloc_enabled() && OFF_SLAB(cachep) &&
6244 + if (debug_pagealloc_enabled_static() && OFF_SLAB(cachep) &&
6245 (cachep->size % PAGE_SIZE) == 0)
6246 return true;
6247
6248 @@ -2007,7 +2007,7 @@ int __kmem_cache_create(struct kmem_cache *cachep, slab_flags_t flags)
6249 * to check size >= 256. It guarantees that all necessary small
6250 * sized slab is initialized in current slab initialization sequence.
6251 */
6252 - if (debug_pagealloc_enabled() && (flags & SLAB_POISON) &&
6253 + if (debug_pagealloc_enabled_static() && (flags & SLAB_POISON) &&
6254 size >= 256 && cachep->object_size > cache_line_size()) {
6255 if (size < PAGE_SIZE || size % PAGE_SIZE == 0) {
6256 size_t tmp_size = ALIGN(size, PAGE_SIZE);
6257 diff --git a/mm/slab_common.c b/mm/slab_common.c
6258 index 78402b362df9..ade6c257d4b4 100644
6259 --- a/mm/slab_common.c
6260 +++ b/mm/slab_common.c
6261 @@ -903,7 +903,8 @@ static void flush_memcg_workqueue(struct kmem_cache *s)
6262 * deactivates the memcg kmem_caches through workqueue. Make sure all
6263 * previous workitems on workqueue are processed.
6264 */
6265 - flush_workqueue(memcg_kmem_cache_wq);
6266 + if (likely(memcg_kmem_cache_wq))
6267 + flush_workqueue(memcg_kmem_cache_wq);
6268
6269 /*
6270 * If we're racing with children kmem_cache deactivation, it might
6271 diff --git a/mm/slub.c b/mm/slub.c
6272 index e72e802fc569..20d72cb20515 100644
6273 --- a/mm/slub.c
6274 +++ b/mm/slub.c
6275 @@ -290,7 +290,7 @@ static inline void *get_freepointer_safe(struct kmem_cache *s, void *object)
6276 unsigned long freepointer_addr;
6277 void *p;
6278
6279 - if (!debug_pagealloc_enabled())
6280 + if (!debug_pagealloc_enabled_static())
6281 return get_freepointer(s, object);
6282
6283 freepointer_addr = (unsigned long)object + s->offset;
6284 diff --git a/mm/sparse.c b/mm/sparse.c
6285 index c2c01b6330af..1100fdb9649c 100644
6286 --- a/mm/sparse.c
6287 +++ b/mm/sparse.c
6288 @@ -775,7 +775,14 @@ static void section_deactivate(unsigned long pfn, unsigned long nr_pages,
6289 if (bitmap_empty(subsection_map, SUBSECTIONS_PER_SECTION)) {
6290 unsigned long section_nr = pfn_to_section_nr(pfn);
6291
6292 - if (!section_is_early) {
6293 + /*
6294 + * When removing an early section, the usage map is kept (as the
6295 + * usage maps of other sections fall into the same page). It
6296 + * will be re-used when re-adding the section - which is then no
6297 + * longer an early section. If the usage map is PageReserved, it
6298 + * was allocated during boot.
6299 + */
6300 + if (!PageReserved(virt_to_page(ms->usage))) {
6301 kfree(ms->usage);
6302 ms->usage = NULL;
6303 }
6304 diff --git a/mm/vmalloc.c b/mm/vmalloc.c
6305 index a3c70e275f4e..61bdbaf20cde 100644
6306 --- a/mm/vmalloc.c
6307 +++ b/mm/vmalloc.c
6308 @@ -1349,7 +1349,7 @@ static void free_unmap_vmap_area(struct vmap_area *va)
6309 {
6310 flush_cache_vunmap(va->va_start, va->va_end);
6311 unmap_vmap_area(va);
6312 - if (debug_pagealloc_enabled())
6313 + if (debug_pagealloc_enabled_static())
6314 flush_tlb_kernel_range(va->va_start, va->va_end);
6315
6316 free_vmap_area_noflush(va);
6317 @@ -1647,7 +1647,7 @@ static void vb_free(const void *addr, unsigned long size)
6318
6319 vunmap_page_range((unsigned long)addr, (unsigned long)addr + size);
6320
6321 - if (debug_pagealloc_enabled())
6322 + if (debug_pagealloc_enabled_static())
6323 flush_tlb_kernel_range((unsigned long)addr,
6324 (unsigned long)addr + size);
6325
6326 diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c
6327 index b0af3a11d406..ec7bf5a4a9fc 100644
6328 --- a/net/batman-adv/distributed-arp-table.c
6329 +++ b/net/batman-adv/distributed-arp-table.c
6330 @@ -285,6 +285,7 @@ static u32 batadv_hash_dat(const void *data, u32 size)
6331 u32 hash = 0;
6332 const struct batadv_dat_entry *dat = data;
6333 const unsigned char *key;
6334 + __be16 vid;
6335 u32 i;
6336
6337 key = (const unsigned char *)&dat->ip;
6338 @@ -294,7 +295,8 @@ static u32 batadv_hash_dat(const void *data, u32 size)
6339 hash ^= (hash >> 6);
6340 }
6341
6342 - key = (const unsigned char *)&dat->vid;
6343 + vid = htons(dat->vid);
6344 + key = (__force const unsigned char *)&vid;
6345 for (i = 0; i < sizeof(dat->vid); i++) {
6346 hash += key[i];
6347 hash += (hash << 10);
6348 diff --git a/net/core/dev.c b/net/core/dev.c
6349 index 3e11c6bb4dd6..3098c90d60e2 100644
6350 --- a/net/core/dev.c
6351 +++ b/net/core/dev.c
6352 @@ -8953,22 +8953,10 @@ static void netdev_unregister_lockdep_key(struct net_device *dev)
6353
6354 void netdev_update_lockdep_key(struct net_device *dev)
6355 {
6356 - struct netdev_queue *queue;
6357 - int i;
6358 -
6359 - lockdep_unregister_key(&dev->qdisc_xmit_lock_key);
6360 lockdep_unregister_key(&dev->addr_list_lock_key);
6361 -
6362 - lockdep_register_key(&dev->qdisc_xmit_lock_key);
6363 lockdep_register_key(&dev->addr_list_lock_key);
6364
6365 lockdep_set_class(&dev->addr_list_lock, &dev->addr_list_lock_key);
6366 - for (i = 0; i < dev->num_tx_queues; i++) {
6367 - queue = netdev_get_tx_queue(dev, i);
6368 -
6369 - lockdep_set_class(&queue->_xmit_lock,
6370 - &dev->qdisc_xmit_lock_key);
6371 - }
6372 }
6373 EXPORT_SYMBOL(netdev_update_lockdep_key);
6374
6375 diff --git a/net/core/devlink.c b/net/core/devlink.c
6376 index 93905dc7c179..ae614965c8c2 100644
6377 --- a/net/core/devlink.c
6378 +++ b/net/core/devlink.c
6379 @@ -6280,7 +6280,7 @@ static bool devlink_port_type_should_warn(struct devlink_port *devlink_port)
6380 devlink_port->attrs.flavour != DEVLINK_PORT_FLAVOUR_DSA;
6381 }
6382
6383 -#define DEVLINK_PORT_TYPE_WARN_TIMEOUT (HZ * 30)
6384 +#define DEVLINK_PORT_TYPE_WARN_TIMEOUT (HZ * 3600)
6385
6386 static void devlink_port_type_warn_schedule(struct devlink_port *devlink_port)
6387 {
6388 diff --git a/net/core/filter.c b/net/core/filter.c
6389 index 2f76461c120d..1a78d64096bb 100644
6390 --- a/net/core/filter.c
6391 +++ b/net/core/filter.c
6392 @@ -2231,10 +2231,10 @@ BPF_CALL_4(bpf_msg_pull_data, struct sk_msg *, msg, u32, start,
6393 /* First find the starting scatterlist element */
6394 i = msg->sg.start;
6395 do {
6396 + offset += len;
6397 len = sk_msg_elem(msg, i)->length;
6398 if (start < offset + len)
6399 break;
6400 - offset += len;
6401 sk_msg_iter_var_next(i);
6402 } while (i != msg->sg.end);
6403
6404 @@ -2346,7 +2346,7 @@ BPF_CALL_4(bpf_msg_push_data, struct sk_msg *, msg, u32, start,
6405 u32, len, u64, flags)
6406 {
6407 struct scatterlist sge, nsge, nnsge, rsge = {0}, *psge;
6408 - u32 new, i = 0, l, space, copy = 0, offset = 0;
6409 + u32 new, i = 0, l = 0, space, copy = 0, offset = 0;
6410 u8 *raw, *to, *from;
6411 struct page *page;
6412
6413 @@ -2356,11 +2356,11 @@ BPF_CALL_4(bpf_msg_push_data, struct sk_msg *, msg, u32, start,
6414 /* First find the starting scatterlist element */
6415 i = msg->sg.start;
6416 do {
6417 + offset += l;
6418 l = sk_msg_elem(msg, i)->length;
6419
6420 if (start < offset + l)
6421 break;
6422 - offset += l;
6423 sk_msg_iter_var_next(i);
6424 } while (i != msg->sg.end);
6425
6426 @@ -2415,6 +2415,7 @@ BPF_CALL_4(bpf_msg_push_data, struct sk_msg *, msg, u32, start,
6427
6428 sk_msg_iter_var_next(i);
6429 sg_unmark_end(psge);
6430 + sg_unmark_end(&rsge);
6431 sk_msg_iter_next(msg, end);
6432 }
6433
6434 @@ -2506,7 +2507,7 @@ static void sk_msg_shift_right(struct sk_msg *msg, int i)
6435 BPF_CALL_4(bpf_msg_pop_data, struct sk_msg *, msg, u32, start,
6436 u32, len, u64, flags)
6437 {
6438 - u32 i = 0, l, space, offset = 0;
6439 + u32 i = 0, l = 0, space, offset = 0;
6440 u64 last = start + len;
6441 int pop;
6442
6443 @@ -2516,11 +2517,11 @@ BPF_CALL_4(bpf_msg_pop_data, struct sk_msg *, msg, u32, start,
6444 /* First find the starting scatterlist element */
6445 i = msg->sg.start;
6446 do {
6447 + offset += l;
6448 l = sk_msg_elem(msg, i)->length;
6449
6450 if (start < offset + l)
6451 break;
6452 - offset += l;
6453 sk_msg_iter_var_next(i);
6454 } while (i != msg->sg.end);
6455
6456 @@ -5305,8 +5306,7 @@ __bpf_sk_lookup(struct sk_buff *skb, struct bpf_sock_tuple *tuple, u32 len,
6457 if (sk) {
6458 sk = sk_to_full_sk(sk);
6459 if (!sk_fullsock(sk)) {
6460 - if (!sock_flag(sk, SOCK_RCU_FREE))
6461 - sock_gen_put(sk);
6462 + sock_gen_put(sk);
6463 return NULL;
6464 }
6465 }
6466 @@ -5343,8 +5343,7 @@ bpf_sk_lookup(struct sk_buff *skb, struct bpf_sock_tuple *tuple, u32 len,
6467 if (sk) {
6468 sk = sk_to_full_sk(sk);
6469 if (!sk_fullsock(sk)) {
6470 - if (!sock_flag(sk, SOCK_RCU_FREE))
6471 - sock_gen_put(sk);
6472 + sock_gen_put(sk);
6473 return NULL;
6474 }
6475 }
6476 @@ -5411,7 +5410,8 @@ static const struct bpf_func_proto bpf_sk_lookup_udp_proto = {
6477
6478 BPF_CALL_1(bpf_sk_release, struct sock *, sk)
6479 {
6480 - if (!sock_flag(sk, SOCK_RCU_FREE))
6481 + /* Only full sockets have sk->sk_flags. */
6482 + if (!sk_fullsock(sk) || !sock_flag(sk, SOCK_RCU_FREE))
6483 sock_gen_put(sk);
6484 return 0;
6485 }
6486 diff --git a/net/core/skmsg.c b/net/core/skmsg.c
6487 index ded2d5227678..3866d7e20c07 100644
6488 --- a/net/core/skmsg.c
6489 +++ b/net/core/skmsg.c
6490 @@ -594,6 +594,8 @@ EXPORT_SYMBOL_GPL(sk_psock_destroy);
6491
6492 void sk_psock_drop(struct sock *sk, struct sk_psock *psock)
6493 {
6494 + sock_owned_by_me(sk);
6495 +
6496 sk_psock_cork_free(psock);
6497 sk_psock_zap_ingress(psock);
6498
6499 diff --git a/net/core/sock_map.c b/net/core/sock_map.c
6500 index eb114ee419b6..8998e356f423 100644
6501 --- a/net/core/sock_map.c
6502 +++ b/net/core/sock_map.c
6503 @@ -241,8 +241,11 @@ static void sock_map_free(struct bpf_map *map)
6504 struct sock *sk;
6505
6506 sk = xchg(psk, NULL);
6507 - if (sk)
6508 + if (sk) {
6509 + lock_sock(sk);
6510 sock_map_unref(sk, psk);
6511 + release_sock(sk);
6512 + }
6513 }
6514 raw_spin_unlock_bh(&stab->lock);
6515 rcu_read_unlock();
6516 @@ -862,7 +865,9 @@ static void sock_hash_free(struct bpf_map *map)
6517 raw_spin_lock_bh(&bucket->lock);
6518 hlist_for_each_entry_safe(elem, node, &bucket->head, node) {
6519 hlist_del_rcu(&elem->node);
6520 + lock_sock(elem->sk);
6521 sock_map_unref(elem->sk, elem);
6522 + release_sock(elem->sk);
6523 }
6524 raw_spin_unlock_bh(&bucket->lock);
6525 }
6526 diff --git a/net/dsa/tag_gswip.c b/net/dsa/tag_gswip.c
6527 index b678160bbd66..408d4af390a0 100644
6528 --- a/net/dsa/tag_gswip.c
6529 +++ b/net/dsa/tag_gswip.c
6530 @@ -104,7 +104,7 @@ static struct sk_buff *gswip_tag_rcv(struct sk_buff *skb,
6531 }
6532
6533 static const struct dsa_device_ops gswip_netdev_ops = {
6534 - .name = "gwsip",
6535 + .name = "gswip",
6536 .proto = DSA_TAG_PROTO_GSWIP,
6537 .xmit = gswip_tag_xmit,
6538 .rcv = gswip_tag_rcv,
6539 diff --git a/net/dsa/tag_qca.c b/net/dsa/tag_qca.c
6540 index c95885215525..c8a128c9e5e0 100644
6541 --- a/net/dsa/tag_qca.c
6542 +++ b/net/dsa/tag_qca.c
6543 @@ -33,9 +33,6 @@ static struct sk_buff *qca_tag_xmit(struct sk_buff *skb, struct net_device *dev)
6544 struct dsa_port *dp = dsa_slave_to_port(dev);
6545 u16 *phdr, hdr;
6546
6547 - dev->stats.tx_packets++;
6548 - dev->stats.tx_bytes += skb->len;
6549 -
6550 if (skb_cow_head(skb, 0) < 0)
6551 return NULL;
6552
6553 diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c
6554 index 069f72edb264..f1f78a742b36 100644
6555 --- a/net/ipv4/netfilter/arp_tables.c
6556 +++ b/net/ipv4/netfilter/arp_tables.c
6557 @@ -496,12 +496,13 @@ static inline int check_entry_size_and_hooks(struct arpt_entry *e,
6558 return 0;
6559 }
6560
6561 -static inline void cleanup_entry(struct arpt_entry *e)
6562 +static void cleanup_entry(struct arpt_entry *e, struct net *net)
6563 {
6564 struct xt_tgdtor_param par;
6565 struct xt_entry_target *t;
6566
6567 t = arpt_get_target(e);
6568 + par.net = net;
6569 par.target = t->u.kernel.target;
6570 par.targinfo = t->data;
6571 par.family = NFPROTO_ARP;
6572 @@ -584,7 +585,7 @@ static int translate_table(struct net *net,
6573 xt_entry_foreach(iter, entry0, newinfo->size) {
6574 if (i-- == 0)
6575 break;
6576 - cleanup_entry(iter);
6577 + cleanup_entry(iter, net);
6578 }
6579 return ret;
6580 }
6581 @@ -927,7 +928,7 @@ static int __do_replace(struct net *net, const char *name,
6582 /* Decrease module usage counts and free resource */
6583 loc_cpu_old_entry = oldinfo->entries;
6584 xt_entry_foreach(iter, loc_cpu_old_entry, oldinfo->size)
6585 - cleanup_entry(iter);
6586 + cleanup_entry(iter, net);
6587
6588 xt_free_table_info(oldinfo);
6589 if (copy_to_user(counters_ptr, counters,
6590 @@ -990,7 +991,7 @@ static int do_replace(struct net *net, const void __user *user,
6591
6592 free_newinfo_untrans:
6593 xt_entry_foreach(iter, loc_cpu_entry, newinfo->size)
6594 - cleanup_entry(iter);
6595 + cleanup_entry(iter, net);
6596 free_newinfo:
6597 xt_free_table_info(newinfo);
6598 return ret;
6599 @@ -1287,7 +1288,7 @@ static int compat_do_replace(struct net *net, void __user *user,
6600
6601 free_newinfo_untrans:
6602 xt_entry_foreach(iter, loc_cpu_entry, newinfo->size)
6603 - cleanup_entry(iter);
6604 + cleanup_entry(iter, net);
6605 free_newinfo:
6606 xt_free_table_info(newinfo);
6607 return ret;
6608 @@ -1514,7 +1515,7 @@ static int do_arpt_get_ctl(struct sock *sk, int cmd, void __user *user, int *len
6609 return ret;
6610 }
6611
6612 -static void __arpt_unregister_table(struct xt_table *table)
6613 +static void __arpt_unregister_table(struct net *net, struct xt_table *table)
6614 {
6615 struct xt_table_info *private;
6616 void *loc_cpu_entry;
6617 @@ -1526,7 +1527,7 @@ static void __arpt_unregister_table(struct xt_table *table)
6618 /* Decrease module usage counts and free resources */
6619 loc_cpu_entry = private->entries;
6620 xt_entry_foreach(iter, loc_cpu_entry, private->size)
6621 - cleanup_entry(iter);
6622 + cleanup_entry(iter, net);
6623 if (private->number > private->initial_entries)
6624 module_put(table_owner);
6625 xt_free_table_info(private);
6626 @@ -1566,7 +1567,7 @@ int arpt_register_table(struct net *net,
6627
6628 ret = nf_register_net_hooks(net, ops, hweight32(table->valid_hooks));
6629 if (ret != 0) {
6630 - __arpt_unregister_table(new_table);
6631 + __arpt_unregister_table(net, new_table);
6632 *res = NULL;
6633 }
6634
6635 @@ -1581,7 +1582,7 @@ void arpt_unregister_table(struct net *net, struct xt_table *table,
6636 const struct nf_hook_ops *ops)
6637 {
6638 nf_unregister_net_hooks(net, ops, hweight32(table->valid_hooks));
6639 - __arpt_unregister_table(table);
6640 + __arpt_unregister_table(net, table);
6641 }
6642
6643 /* The built-in targets: standard (NULL) and error. */
6644 diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
6645 index e537a4b6531b..84115577d3dc 100644
6646 --- a/net/ipv4/tcp.c
6647 +++ b/net/ipv4/tcp.c
6648 @@ -1087,8 +1087,7 @@ do_error:
6649 goto out;
6650 out_err:
6651 /* make sure we wake any epoll edge trigger waiter */
6652 - if (unlikely(skb_queue_len(&sk->sk_write_queue) == 0 &&
6653 - err == -EAGAIN)) {
6654 + if (unlikely(tcp_rtx_and_write_queues_empty(sk) && err == -EAGAIN)) {
6655 sk->sk_write_space(sk);
6656 tcp_chrono_stop(sk, TCP_CHRONO_SNDBUF_LIMITED);
6657 }
6658 @@ -1419,8 +1418,7 @@ out_err:
6659 sock_zerocopy_put_abort(uarg, true);
6660 err = sk_stream_error(sk, flags, err);
6661 /* make sure we wake any epoll edge trigger waiter */
6662 - if (unlikely(skb_queue_len(&sk->sk_write_queue) == 0 &&
6663 - err == -EAGAIN)) {
6664 + if (unlikely(tcp_rtx_and_write_queues_empty(sk) && err == -EAGAIN)) {
6665 sk->sk_write_space(sk);
6666 tcp_chrono_stop(sk, TCP_CHRONO_SNDBUF_LIMITED);
6667 }
6668 diff --git a/net/ipv4/tcp_bpf.c b/net/ipv4/tcp_bpf.c
6669 index e38705165ac9..8a01428f80c1 100644
6670 --- a/net/ipv4/tcp_bpf.c
6671 +++ b/net/ipv4/tcp_bpf.c
6672 @@ -121,14 +121,14 @@ int tcp_bpf_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
6673 struct sk_psock *psock;
6674 int copied, ret;
6675
6676 - if (unlikely(flags & MSG_ERRQUEUE))
6677 - return inet_recv_error(sk, msg, len, addr_len);
6678 - if (!skb_queue_empty(&sk->sk_receive_queue))
6679 - return tcp_recvmsg(sk, msg, len, nonblock, flags, addr_len);
6680 -
6681 psock = sk_psock_get(sk);
6682 if (unlikely(!psock))
6683 return tcp_recvmsg(sk, msg, len, nonblock, flags, addr_len);
6684 + if (unlikely(flags & MSG_ERRQUEUE))
6685 + return inet_recv_error(sk, msg, len, addr_len);
6686 + if (!skb_queue_empty(&sk->sk_receive_queue) &&
6687 + sk_psock_queue_empty(psock))
6688 + return tcp_recvmsg(sk, msg, len, nonblock, flags, addr_len);
6689 lock_sock(sk);
6690 msg_bytes_ready:
6691 copied = __tcp_bpf_recvmsg(sk, psock, msg, len, flags);
6692 @@ -139,7 +139,7 @@ msg_bytes_ready:
6693 timeo = sock_rcvtimeo(sk, nonblock);
6694 data = tcp_bpf_wait_data(sk, psock, flags, timeo, &err);
6695 if (data) {
6696 - if (skb_queue_empty(&sk->sk_receive_queue))
6697 + if (!sk_psock_queue_empty(psock))
6698 goto msg_bytes_ready;
6699 release_sock(sk);
6700 sk_psock_put(sk, psock);
6701 @@ -315,10 +315,7 @@ more_data:
6702 */
6703 delta = msg->sg.size;
6704 psock->eval = sk_psock_msg_verdict(sk, psock, msg);
6705 - if (msg->sg.size < delta)
6706 - delta -= msg->sg.size;
6707 - else
6708 - delta = 0;
6709 + delta -= msg->sg.size;
6710 }
6711
6712 if (msg->cork_bytes &&
6713 diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
6714 index 67e44e6717b0..59b78ce2ce2e 100644
6715 --- a/net/ipv4/tcp_input.c
6716 +++ b/net/ipv4/tcp_input.c
6717 @@ -915,9 +915,10 @@ static void tcp_check_sack_reordering(struct sock *sk, const u32 low_seq,
6718 /* This must be called before lost_out is incremented */
6719 static void tcp_verify_retransmit_hint(struct tcp_sock *tp, struct sk_buff *skb)
6720 {
6721 - if (!tp->retransmit_skb_hint ||
6722 - before(TCP_SKB_CB(skb)->seq,
6723 - TCP_SKB_CB(tp->retransmit_skb_hint)->seq))
6724 + if ((!tp->retransmit_skb_hint && tp->retrans_out >= tp->lost_out) ||
6725 + (tp->retransmit_skb_hint &&
6726 + before(TCP_SKB_CB(skb)->seq,
6727 + TCP_SKB_CB(tp->retransmit_skb_hint)->seq)))
6728 tp->retransmit_skb_hint = skb;
6729 }
6730
6731 diff --git a/net/ipv4/tcp_ulp.c b/net/ipv4/tcp_ulp.c
6732 index 4849edb62d52..9168645b760e 100644
6733 --- a/net/ipv4/tcp_ulp.c
6734 +++ b/net/ipv4/tcp_ulp.c
6735 @@ -96,17 +96,19 @@ void tcp_get_available_ulp(char *buf, size_t maxlen)
6736 rcu_read_unlock();
6737 }
6738
6739 -void tcp_update_ulp(struct sock *sk, struct proto *proto)
6740 +void tcp_update_ulp(struct sock *sk, struct proto *proto,
6741 + void (*write_space)(struct sock *sk))
6742 {
6743 struct inet_connection_sock *icsk = inet_csk(sk);
6744
6745 if (!icsk->icsk_ulp_ops) {
6746 + sk->sk_write_space = write_space;
6747 sk->sk_prot = proto;
6748 return;
6749 }
6750
6751 if (icsk->icsk_ulp_ops->update)
6752 - icsk->icsk_ulp_ops->update(sk, proto);
6753 + icsk->icsk_ulp_ops->update(sk, proto, write_space);
6754 }
6755
6756 void tcp_cleanup_ulp(struct sock *sk)
6757 diff --git a/net/netfilter/ipset/ip_set_bitmap_gen.h b/net/netfilter/ipset/ip_set_bitmap_gen.h
6758 index 063df74b4647..e1f271a1b2c1 100644
6759 --- a/net/netfilter/ipset/ip_set_bitmap_gen.h
6760 +++ b/net/netfilter/ipset/ip_set_bitmap_gen.h
6761 @@ -60,9 +60,9 @@ mtype_destroy(struct ip_set *set)
6762 if (SET_WITH_TIMEOUT(set))
6763 del_timer_sync(&map->gc);
6764
6765 - ip_set_free(map->members);
6766 if (set->dsize && set->extensions & IPSET_EXT_DESTROY)
6767 mtype_ext_cleanup(set);
6768 + ip_set_free(map->members);
6769 ip_set_free(map);
6770
6771 set->data = NULL;
6772 diff --git a/net/netfilter/nf_nat_proto.c b/net/netfilter/nf_nat_proto.c
6773 index 0a59c14b5177..64eedc17037a 100644
6774 --- a/net/netfilter/nf_nat_proto.c
6775 +++ b/net/netfilter/nf_nat_proto.c
6776 @@ -233,6 +233,19 @@ icmp_manip_pkt(struct sk_buff *skb,
6777 return false;
6778
6779 hdr = (struct icmphdr *)(skb->data + hdroff);
6780 + switch (hdr->type) {
6781 + case ICMP_ECHO:
6782 + case ICMP_ECHOREPLY:
6783 + case ICMP_TIMESTAMP:
6784 + case ICMP_TIMESTAMPREPLY:
6785 + case ICMP_INFO_REQUEST:
6786 + case ICMP_INFO_REPLY:
6787 + case ICMP_ADDRESS:
6788 + case ICMP_ADDRESSREPLY:
6789 + break;
6790 + default:
6791 + return true;
6792 + }
6793 inet_proto_csum_replace2(&hdr->checksum, skb,
6794 hdr->un.echo.id, tuple->src.u.icmp.id, false);
6795 hdr->un.echo.id = tuple->src.u.icmp.id;
6796 diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
6797 index 67ca47c7ce54..9fefd0150091 100644
6798 --- a/net/netfilter/nf_tables_api.c
6799 +++ b/net/netfilter/nf_tables_api.c
6800 @@ -22,6 +22,8 @@
6801 #include <net/net_namespace.h>
6802 #include <net/sock.h>
6803
6804 +#define NFT_MODULE_AUTOLOAD_LIMIT (MODULE_NAME_LEN - sizeof("nft-expr-255-"))
6805 +
6806 static LIST_HEAD(nf_tables_expressions);
6807 static LIST_HEAD(nf_tables_objects);
6808 static LIST_HEAD(nf_tables_flowtables);
6809 @@ -500,33 +502,34 @@ __nf_tables_chain_type_lookup(const struct nlattr *nla, u8 family)
6810 }
6811
6812 /*
6813 - * Loading a module requires dropping mutex that guards the
6814 - * transaction.
6815 - * We first need to abort any pending transactions as once
6816 - * mutex is unlocked a different client could start a new
6817 - * transaction. It must not see any 'future generation'
6818 - * changes * as these changes will never happen.
6819 + * Loading a module requires dropping mutex that guards the transaction.
6820 + * A different client might race to start a new transaction meanwhile. Zap the
6821 + * list of pending transaction and then restore it once the mutex is grabbed
6822 + * again. Users of this function return EAGAIN which implicitly triggers the
6823 + * transaction abort path to clean up the list of pending transactions.
6824 */
6825 #ifdef CONFIG_MODULES
6826 -static int __nf_tables_abort(struct net *net);
6827 -
6828 static void nft_request_module(struct net *net, const char *fmt, ...)
6829 {
6830 char module_name[MODULE_NAME_LEN];
6831 + LIST_HEAD(commit_list);
6832 va_list args;
6833 int ret;
6834
6835 - __nf_tables_abort(net);
6836 + list_splice_init(&net->nft.commit_list, &commit_list);
6837
6838 va_start(args, fmt);
6839 ret = vsnprintf(module_name, MODULE_NAME_LEN, fmt, args);
6840 va_end(args);
6841 - if (WARN(ret >= MODULE_NAME_LEN, "truncated: '%s' (len %d)", module_name, ret))
6842 + if (ret >= MODULE_NAME_LEN)
6843 return;
6844
6845 mutex_unlock(&net->nft.commit_mutex);
6846 request_module("%s", module_name);
6847 mutex_lock(&net->nft.commit_mutex);
6848 +
6849 + WARN_ON_ONCE(!list_empty(&net->nft.commit_list));
6850 + list_splice(&commit_list, &net->nft.commit_list);
6851 }
6852 #endif
6853
6854 @@ -978,12 +981,18 @@ static int nft_flush_table(struct nft_ctx *ctx)
6855 }
6856
6857 list_for_each_entry_safe(flowtable, nft, &ctx->table->flowtables, list) {
6858 + if (!nft_is_active_next(ctx->net, flowtable))
6859 + continue;
6860 +
6861 err = nft_delflowtable(ctx, flowtable);
6862 if (err < 0)
6863 goto out;
6864 }
6865
6866 list_for_each_entry_safe(obj, ne, &ctx->table->objects, list) {
6867 + if (!nft_is_active_next(ctx->net, obj))
6868 + continue;
6869 +
6870 err = nft_delobj(ctx, obj);
6871 if (err < 0)
6872 goto out;
6873 @@ -1174,7 +1183,8 @@ static const struct nla_policy nft_chain_policy[NFTA_CHAIN_MAX + 1] = {
6874 .len = NFT_CHAIN_MAXNAMELEN - 1 },
6875 [NFTA_CHAIN_HOOK] = { .type = NLA_NESTED },
6876 [NFTA_CHAIN_POLICY] = { .type = NLA_U32 },
6877 - [NFTA_CHAIN_TYPE] = { .type = NLA_STRING },
6878 + [NFTA_CHAIN_TYPE] = { .type = NLA_STRING,
6879 + .len = NFT_MODULE_AUTOLOAD_LIMIT },
6880 [NFTA_CHAIN_COUNTERS] = { .type = NLA_NESTED },
6881 [NFTA_CHAIN_FLAGS] = { .type = NLA_U32 },
6882 };
6883 @@ -2088,7 +2098,8 @@ static const struct nft_expr_type *nft_expr_type_get(struct net *net,
6884 }
6885
6886 static const struct nla_policy nft_expr_policy[NFTA_EXPR_MAX + 1] = {
6887 - [NFTA_EXPR_NAME] = { .type = NLA_STRING },
6888 + [NFTA_EXPR_NAME] = { .type = NLA_STRING,
6889 + .len = NFT_MODULE_AUTOLOAD_LIMIT },
6890 [NFTA_EXPR_DATA] = { .type = NLA_NESTED },
6891 };
6892
6893 @@ -3931,7 +3942,8 @@ static const struct nla_policy nft_set_elem_policy[NFTA_SET_ELEM_MAX + 1] = {
6894 [NFTA_SET_ELEM_USERDATA] = { .type = NLA_BINARY,
6895 .len = NFT_USERDATA_MAXLEN },
6896 [NFTA_SET_ELEM_EXPR] = { .type = NLA_NESTED },
6897 - [NFTA_SET_ELEM_OBJREF] = { .type = NLA_STRING },
6898 + [NFTA_SET_ELEM_OBJREF] = { .type = NLA_STRING,
6899 + .len = NFT_OBJ_MAXNAMELEN - 1 },
6900 };
6901
6902 static const struct nla_policy nft_set_elem_list_policy[NFTA_SET_ELEM_LIST_MAX + 1] = {
6903 diff --git a/net/netfilter/nft_tunnel.c b/net/netfilter/nft_tunnel.c
6904 index 3d4c2ae605a8..5284fcf16be7 100644
6905 --- a/net/netfilter/nft_tunnel.c
6906 +++ b/net/netfilter/nft_tunnel.c
6907 @@ -76,7 +76,7 @@ static int nft_tunnel_get_init(const struct nft_ctx *ctx,
6908 struct nft_tunnel *priv = nft_expr_priv(expr);
6909 u32 len;
6910
6911 - if (!tb[NFTA_TUNNEL_KEY] &&
6912 + if (!tb[NFTA_TUNNEL_KEY] ||
6913 !tb[NFTA_TUNNEL_DREG])
6914 return -EINVAL;
6915
6916 @@ -266,6 +266,9 @@ static int nft_tunnel_obj_erspan_init(const struct nlattr *attr,
6917 if (err < 0)
6918 return err;
6919
6920 + if (!tb[NFTA_TUNNEL_KEY_ERSPAN_VERSION])
6921 + return -EINVAL;
6922 +
6923 version = ntohl(nla_get_be32(tb[NFTA_TUNNEL_KEY_ERSPAN_VERSION]));
6924 switch (version) {
6925 case ERSPAN_VERSION:
6926 diff --git a/net/sched/act_ctinfo.c b/net/sched/act_ctinfo.c
6927 index 0dbcfd1dca7b..f45995a6237a 100644
6928 --- a/net/sched/act_ctinfo.c
6929 +++ b/net/sched/act_ctinfo.c
6930 @@ -360,6 +360,16 @@ static int tcf_ctinfo_search(struct net *net, struct tc_action **a, u32 index)
6931 return tcf_idr_search(tn, a, index);
6932 }
6933
6934 +static void tcf_ctinfo_cleanup(struct tc_action *a)
6935 +{
6936 + struct tcf_ctinfo *ci = to_ctinfo(a);
6937 + struct tcf_ctinfo_params *cp;
6938 +
6939 + cp = rcu_dereference_protected(ci->params, 1);
6940 + if (cp)
6941 + kfree_rcu(cp, rcu);
6942 +}
6943 +
6944 static struct tc_action_ops act_ctinfo_ops = {
6945 .kind = "ctinfo",
6946 .id = TCA_ID_CTINFO,
6947 @@ -367,6 +377,7 @@ static struct tc_action_ops act_ctinfo_ops = {
6948 .act = tcf_ctinfo_act,
6949 .dump = tcf_ctinfo_dump,
6950 .init = tcf_ctinfo_init,
6951 + .cleanup= tcf_ctinfo_cleanup,
6952 .walk = tcf_ctinfo_walker,
6953 .lookup = tcf_ctinfo_search,
6954 .size = sizeof(struct tcf_ctinfo),
6955 diff --git a/net/sched/act_ife.c b/net/sched/act_ife.c
6956 index 3a31e241c647..a0cfb4793c93 100644
6957 --- a/net/sched/act_ife.c
6958 +++ b/net/sched/act_ife.c
6959 @@ -536,6 +536,9 @@ static int tcf_ife_init(struct net *net, struct nlattr *nla,
6960 }
6961
6962 ife = to_ife(*a);
6963 + if (ret == ACT_P_CREATED)
6964 + INIT_LIST_HEAD(&ife->metalist);
6965 +
6966 err = tcf_action_check_ctrlact(parm->action, tp, &goto_ch, extack);
6967 if (err < 0)
6968 goto release_idr;
6969 @@ -565,10 +568,6 @@ static int tcf_ife_init(struct net *net, struct nlattr *nla,
6970 p->eth_type = ife_type;
6971 }
6972
6973 -
6974 - if (ret == ACT_P_CREATED)
6975 - INIT_LIST_HEAD(&ife->metalist);
6976 -
6977 if (tb[TCA_IFE_METALST]) {
6978 err = nla_parse_nested_deprecated(tb2, IFE_META_MAX,
6979 tb[TCA_IFE_METALST], NULL,
6980 diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c
6981 index 6ef1abdd525f..885ecf6ea65a 100644
6982 --- a/net/tipc/bcast.c
6983 +++ b/net/tipc/bcast.c
6984 @@ -305,17 +305,17 @@ static int tipc_rcast_xmit(struct net *net, struct sk_buff_head *pkts,
6985 * @skb: socket buffer to copy
6986 * @method: send method to be used
6987 * @dests: destination nodes for message.
6988 - * @cong_link_cnt: returns number of encountered congested destination links
6989 * Returns 0 if success, otherwise errno
6990 */
6991 static int tipc_mcast_send_sync(struct net *net, struct sk_buff *skb,
6992 struct tipc_mc_method *method,
6993 - struct tipc_nlist *dests,
6994 - u16 *cong_link_cnt)
6995 + struct tipc_nlist *dests)
6996 {
6997 struct tipc_msg *hdr, *_hdr;
6998 struct sk_buff_head tmpq;
6999 struct sk_buff *_skb;
7000 + u16 cong_link_cnt;
7001 + int rc = 0;
7002
7003 /* Is a cluster supporting with new capabilities ? */
7004 if (!(tipc_net(net)->capabilities & TIPC_MCAST_RBCTL))
7005 @@ -343,18 +343,19 @@ static int tipc_mcast_send_sync(struct net *net, struct sk_buff *skb,
7006 _hdr = buf_msg(_skb);
7007 msg_set_size(_hdr, MCAST_H_SIZE);
7008 msg_set_is_rcast(_hdr, !msg_is_rcast(hdr));
7009 + msg_set_errcode(_hdr, TIPC_ERR_NO_PORT);
7010
7011 __skb_queue_head_init(&tmpq);
7012 __skb_queue_tail(&tmpq, _skb);
7013 if (method->rcast)
7014 - tipc_bcast_xmit(net, &tmpq, cong_link_cnt);
7015 + rc = tipc_bcast_xmit(net, &tmpq, &cong_link_cnt);
7016 else
7017 - tipc_rcast_xmit(net, &tmpq, dests, cong_link_cnt);
7018 + rc = tipc_rcast_xmit(net, &tmpq, dests, &cong_link_cnt);
7019
7020 /* This queue should normally be empty by now */
7021 __skb_queue_purge(&tmpq);
7022
7023 - return 0;
7024 + return rc;
7025 }
7026
7027 /* tipc_mcast_xmit - deliver message to indicated destination nodes
7028 @@ -396,9 +397,14 @@ int tipc_mcast_xmit(struct net *net, struct sk_buff_head *pkts,
7029 msg_set_is_rcast(hdr, method->rcast);
7030
7031 /* Switch method ? */
7032 - if (rcast != method->rcast)
7033 - tipc_mcast_send_sync(net, skb, method,
7034 - dests, cong_link_cnt);
7035 + if (rcast != method->rcast) {
7036 + rc = tipc_mcast_send_sync(net, skb, method, dests);
7037 + if (unlikely(rc)) {
7038 + pr_err("Unable to send SYN: method %d, rc %d\n",
7039 + rcast, rc);
7040 + goto exit;
7041 + }
7042 + }
7043
7044 if (method->rcast)
7045 rc = tipc_rcast_xmit(net, pkts, dests, cong_link_cnt);
7046 diff --git a/net/tipc/socket.c b/net/tipc/socket.c
7047 index 4b92b196cfa6..79d06c21ebe3 100644
7048 --- a/net/tipc/socket.c
7049 +++ b/net/tipc/socket.c
7050 @@ -1306,8 +1306,8 @@ static int __tipc_sendmsg(struct socket *sock, struct msghdr *m, size_t dlen)
7051 struct tipc_msg *hdr = &tsk->phdr;
7052 struct tipc_name_seq *seq;
7053 struct sk_buff_head pkts;
7054 - u32 dport, dnode = 0;
7055 - u32 type, inst;
7056 + u32 dport = 0, dnode = 0;
7057 + u32 type = 0, inst = 0;
7058 int mtu, rc;
7059
7060 if (unlikely(dlen > TIPC_MAX_USER_MSG_SIZE))
7061 @@ -1360,23 +1360,11 @@ static int __tipc_sendmsg(struct socket *sock, struct msghdr *m, size_t dlen)
7062 type = dest->addr.name.name.type;
7063 inst = dest->addr.name.name.instance;
7064 dnode = dest->addr.name.domain;
7065 - msg_set_type(hdr, TIPC_NAMED_MSG);
7066 - msg_set_hdr_sz(hdr, NAMED_H_SIZE);
7067 - msg_set_nametype(hdr, type);
7068 - msg_set_nameinst(hdr, inst);
7069 - msg_set_lookup_scope(hdr, tipc_node2scope(dnode));
7070 dport = tipc_nametbl_translate(net, type, inst, &dnode);
7071 - msg_set_destnode(hdr, dnode);
7072 - msg_set_destport(hdr, dport);
7073 if (unlikely(!dport && !dnode))
7074 return -EHOSTUNREACH;
7075 } else if (dest->addrtype == TIPC_ADDR_ID) {
7076 dnode = dest->addr.id.node;
7077 - msg_set_type(hdr, TIPC_DIRECT_MSG);
7078 - msg_set_lookup_scope(hdr, 0);
7079 - msg_set_destnode(hdr, dnode);
7080 - msg_set_destport(hdr, dest->addr.id.ref);
7081 - msg_set_hdr_sz(hdr, BASIC_H_SIZE);
7082 } else {
7083 return -EINVAL;
7084 }
7085 @@ -1387,6 +1375,22 @@ static int __tipc_sendmsg(struct socket *sock, struct msghdr *m, size_t dlen)
7086 if (unlikely(rc))
7087 return rc;
7088
7089 + if (dest->addrtype == TIPC_ADDR_NAME) {
7090 + msg_set_type(hdr, TIPC_NAMED_MSG);
7091 + msg_set_hdr_sz(hdr, NAMED_H_SIZE);
7092 + msg_set_nametype(hdr, type);
7093 + msg_set_nameinst(hdr, inst);
7094 + msg_set_lookup_scope(hdr, tipc_node2scope(dnode));
7095 + msg_set_destnode(hdr, dnode);
7096 + msg_set_destport(hdr, dport);
7097 + } else { /* TIPC_ADDR_ID */
7098 + msg_set_type(hdr, TIPC_DIRECT_MSG);
7099 + msg_set_lookup_scope(hdr, 0);
7100 + msg_set_destnode(hdr, dnode);
7101 + msg_set_destport(hdr, dest->addr.id.ref);
7102 + msg_set_hdr_sz(hdr, BASIC_H_SIZE);
7103 + }
7104 +
7105 __skb_queue_head_init(&pkts);
7106 mtu = tipc_node_get_mtu(net, dnode, tsk->portid);
7107 rc = tipc_msg_build(hdr, m, 0, dlen, mtu, &pkts);
7108 diff --git a/net/tls/tls_main.c b/net/tls/tls_main.c
7109 index 82d0beed8f07..7aba4ee77aba 100644
7110 --- a/net/tls/tls_main.c
7111 +++ b/net/tls/tls_main.c
7112 @@ -798,15 +798,19 @@ out:
7113 return rc;
7114 }
7115
7116 -static void tls_update(struct sock *sk, struct proto *p)
7117 +static void tls_update(struct sock *sk, struct proto *p,
7118 + void (*write_space)(struct sock *sk))
7119 {
7120 struct tls_context *ctx;
7121
7122 ctx = tls_get_ctx(sk);
7123 - if (likely(ctx))
7124 + if (likely(ctx)) {
7125 + ctx->sk_write_space = write_space;
7126 ctx->sk_proto = p;
7127 - else
7128 + } else {
7129 sk->sk_prot = p;
7130 + sk->sk_write_space = write_space;
7131 + }
7132 }
7133
7134 static int tls_get_info(const struct sock *sk, struct sk_buff *skb)
7135 diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
7136 index c70cf30c5492..a80920f261ca 100644
7137 --- a/net/tls/tls_sw.c
7138 +++ b/net/tls/tls_sw.c
7139 @@ -677,12 +677,32 @@ static int tls_push_record(struct sock *sk, int flags,
7140
7141 split_point = msg_pl->apply_bytes;
7142 split = split_point && split_point < msg_pl->sg.size;
7143 + if (unlikely((!split &&
7144 + msg_pl->sg.size +
7145 + prot->overhead_size > msg_en->sg.size) ||
7146 + (split &&
7147 + split_point +
7148 + prot->overhead_size > msg_en->sg.size))) {
7149 + split = true;
7150 + split_point = msg_en->sg.size;
7151 + }
7152 if (split) {
7153 rc = tls_split_open_record(sk, rec, &tmp, msg_pl, msg_en,
7154 split_point, prot->overhead_size,
7155 &orig_end);
7156 if (rc < 0)
7157 return rc;
7158 + /* This can happen if above tls_split_open_record allocates
7159 + * a single large encryption buffer instead of two smaller
7160 + * ones. In this case adjust pointers and continue without
7161 + * split.
7162 + */
7163 + if (!msg_pl->sg.size) {
7164 + tls_merge_open_record(sk, rec, tmp, orig_end);
7165 + msg_pl = &rec->msg_plaintext;
7166 + msg_en = &rec->msg_encrypted;
7167 + split = false;
7168 + }
7169 sk_msg_trim(sk, msg_en, msg_pl->sg.size +
7170 prot->overhead_size);
7171 }
7172 @@ -704,6 +724,12 @@ static int tls_push_record(struct sock *sk, int flags,
7173 sg_mark_end(sk_msg_elem(msg_pl, i));
7174 }
7175
7176 + if (msg_pl->sg.end < msg_pl->sg.start) {
7177 + sg_chain(&msg_pl->sg.data[msg_pl->sg.start],
7178 + MAX_SKB_FRAGS - msg_pl->sg.start + 1,
7179 + msg_pl->sg.data);
7180 + }
7181 +
7182 i = msg_pl->sg.start;
7183 sg_chain(rec->sg_aead_in, 2, &msg_pl->sg.data[i]);
7184
7185 @@ -778,10 +804,7 @@ more_data:
7186 if (psock->eval == __SK_NONE) {
7187 delta = msg->sg.size;
7188 psock->eval = sk_psock_msg_verdict(sk, psock, msg);
7189 - if (delta < msg->sg.size)
7190 - delta -= msg->sg.size;
7191 - else
7192 - delta = 0;
7193 + delta -= msg->sg.size;
7194 }
7195 if (msg->cork_bytes && msg->cork_bytes > msg->sg.size &&
7196 !enospc && !full_record) {
7197 diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
7198 index 7b72286922f7..c74646b7a751 100644
7199 --- a/net/wireless/nl80211.c
7200 +++ b/net/wireless/nl80211.c
7201 @@ -10834,6 +10834,7 @@ static int cfg80211_cqm_rssi_update(struct cfg80211_registered_device *rdev,
7202 if (err)
7203 return err;
7204
7205 + cfg80211_sinfo_release_content(&sinfo);
7206 if (sinfo.filled & BIT_ULL(NL80211_STA_INFO_BEACON_SIGNAL_AVG))
7207 wdev->cqm_config->last_rssi_event_value =
7208 (s8) sinfo.rx_beacon_signal_avg;
7209 @@ -13787,6 +13788,8 @@ static int nl80211_probe_mesh_link(struct sk_buff *skb, struct genl_info *info)
7210 if (err)
7211 return err;
7212
7213 + cfg80211_sinfo_release_content(&sinfo);
7214 +
7215 return rdev_probe_mesh_link(rdev, dev, dest, buf, len);
7216 }
7217
7218 diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h
7219 index e853a4fe6f97..3dd9515c836b 100644
7220 --- a/net/wireless/rdev-ops.h
7221 +++ b/net/wireless/rdev-ops.h
7222 @@ -538,6 +538,10 @@ static inline int
7223 rdev_set_wiphy_params(struct cfg80211_registered_device *rdev, u32 changed)
7224 {
7225 int ret;
7226 +
7227 + if (!rdev->ops->set_wiphy_params)
7228 + return -EOPNOTSUPP;
7229 +
7230 trace_rdev_set_wiphy_params(&rdev->wiphy, changed);
7231 ret = rdev->ops->set_wiphy_params(&rdev->wiphy, changed);
7232 trace_rdev_return_int(&rdev->wiphy, ret);
7233 diff --git a/net/wireless/sme.c b/net/wireless/sme.c
7234 index 7a6c38ddc65a..d32a2ec4d96a 100644
7235 --- a/net/wireless/sme.c
7236 +++ b/net/wireless/sme.c
7237 @@ -1307,14 +1307,14 @@ void cfg80211_autodisconnect_wk(struct work_struct *work)
7238 if (wdev->conn_owner_nlportid) {
7239 switch (wdev->iftype) {
7240 case NL80211_IFTYPE_ADHOC:
7241 - cfg80211_leave_ibss(rdev, wdev->netdev, false);
7242 + __cfg80211_leave_ibss(rdev, wdev->netdev, false);
7243 break;
7244 case NL80211_IFTYPE_AP:
7245 case NL80211_IFTYPE_P2P_GO:
7246 - cfg80211_stop_ap(rdev, wdev->netdev, false);
7247 + __cfg80211_stop_ap(rdev, wdev->netdev, false);
7248 break;
7249 case NL80211_IFTYPE_MESH_POINT:
7250 - cfg80211_leave_mesh(rdev, wdev->netdev);
7251 + __cfg80211_leave_mesh(rdev, wdev->netdev);
7252 break;
7253 case NL80211_IFTYPE_STATION:
7254 case NL80211_IFTYPE_P2P_CLIENT:
7255 diff --git a/net/wireless/util.c b/net/wireless/util.c
7256 index 5b4ed5bbc542..8481e9ac33da 100644
7257 --- a/net/wireless/util.c
7258 +++ b/net/wireless/util.c
7259 @@ -564,7 +564,7 @@ __frame_add_frag(struct sk_buff *skb, struct page *page,
7260 struct skb_shared_info *sh = skb_shinfo(skb);
7261 int page_offset;
7262
7263 - page_ref_inc(page);
7264 + get_page(page);
7265 page_offset = ptr - page_address(page);
7266 skb_add_rx_frag(skb, sh->nr_frags, page, page_offset, len, size);
7267 }
7268 diff --git a/sound/core/seq/seq_timer.c b/sound/core/seq/seq_timer.c
7269 index 161f3170bd7e..3bc6095df44d 100644
7270 --- a/sound/core/seq/seq_timer.c
7271 +++ b/sound/core/seq/seq_timer.c
7272 @@ -465,15 +465,19 @@ void snd_seq_info_timer_read(struct snd_info_entry *entry,
7273 q = queueptr(idx);
7274 if (q == NULL)
7275 continue;
7276 - if ((tmr = q->timer) == NULL ||
7277 - (ti = tmr->timeri) == NULL) {
7278 - queuefree(q);
7279 - continue;
7280 - }
7281 + mutex_lock(&q->timer_mutex);
7282 + tmr = q->timer;
7283 + if (!tmr)
7284 + goto unlock;
7285 + ti = tmr->timeri;
7286 + if (!ti)
7287 + goto unlock;
7288 snd_iprintf(buffer, "Timer for queue %i : %s\n", q->queue, ti->timer->name);
7289 resolution = snd_timer_resolution(ti) * tmr->ticks;
7290 snd_iprintf(buffer, " Period time : %lu.%09lu\n", resolution / 1000000000, resolution % 1000000000);
7291 snd_iprintf(buffer, " Skew : %u / %u\n", tmr->skew, tmr->skew_base);
7292 +unlock:
7293 + mutex_unlock(&q->timer_mutex);
7294 queuefree(q);
7295 }
7296 }
7297 diff --git a/sound/firewire/dice/dice-extension.c b/sound/firewire/dice/dice-extension.c
7298 index a63fcbc875ad..02f4a8318e38 100644
7299 --- a/sound/firewire/dice/dice-extension.c
7300 +++ b/sound/firewire/dice/dice-extension.c
7301 @@ -159,8 +159,11 @@ int snd_dice_detect_extension_formats(struct snd_dice *dice)
7302 int j;
7303
7304 for (j = i + 1; j < 9; ++j) {
7305 - if (pointers[i * 2] == pointers[j * 2])
7306 + if (pointers[i * 2] == pointers[j * 2]) {
7307 + // Fallback to limited functionality.
7308 + err = -ENXIO;
7309 goto end;
7310 + }
7311 }
7312 }
7313
7314 diff --git a/sound/firewire/tascam/amdtp-tascam.c b/sound/firewire/tascam/amdtp-tascam.c
7315 index e80bb84c43f6..f823a2ab3544 100644
7316 --- a/sound/firewire/tascam/amdtp-tascam.c
7317 +++ b/sound/firewire/tascam/amdtp-tascam.c
7318 @@ -157,14 +157,15 @@ static void read_status_messages(struct amdtp_stream *s,
7319 if ((before ^ after) & mask) {
7320 struct snd_firewire_tascam_change *entry =
7321 &tscm->queue[tscm->push_pos];
7322 + unsigned long flag;
7323
7324 - spin_lock_irq(&tscm->lock);
7325 + spin_lock_irqsave(&tscm->lock, flag);
7326 entry->index = index;
7327 entry->before = before;
7328 entry->after = after;
7329 if (++tscm->push_pos >= SND_TSCM_QUEUE_COUNT)
7330 tscm->push_pos = 0;
7331 - spin_unlock_irq(&tscm->lock);
7332 + spin_unlock_irqrestore(&tscm->lock, flag);
7333
7334 wake_up(&tscm->hwdep_wait);
7335 }
7336 diff --git a/sound/soc/codecs/msm8916-wcd-analog.c b/sound/soc/codecs/msm8916-wcd-analog.c
7337 index e3d311fb510e..84289ebeae87 100644
7338 --- a/sound/soc/codecs/msm8916-wcd-analog.c
7339 +++ b/sound/soc/codecs/msm8916-wcd-analog.c
7340 @@ -391,9 +391,6 @@ static int pm8916_wcd_analog_enable_micbias_int(struct snd_soc_component
7341
7342 switch (event) {
7343 case SND_SOC_DAPM_PRE_PMU:
7344 - snd_soc_component_update_bits(component, CDC_A_MICB_1_INT_RBIAS,
7345 - MICB_1_INT_TX2_INT_RBIAS_EN_MASK,
7346 - MICB_1_INT_TX2_INT_RBIAS_EN_ENABLE);
7347 snd_soc_component_update_bits(component, reg, MICB_1_EN_PULL_DOWN_EN_MASK, 0);
7348 snd_soc_component_update_bits(component, CDC_A_MICB_1_EN,
7349 MICB_1_EN_OPA_STG2_TAIL_CURR_MASK,
7350 @@ -443,6 +440,14 @@ static int pm8916_wcd_analog_enable_micbias_int1(struct
7351 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
7352 struct pm8916_wcd_analog_priv *wcd = snd_soc_component_get_drvdata(component);
7353
7354 + switch (event) {
7355 + case SND_SOC_DAPM_PRE_PMU:
7356 + snd_soc_component_update_bits(component, CDC_A_MICB_1_INT_RBIAS,
7357 + MICB_1_INT_TX1_INT_RBIAS_EN_MASK,
7358 + MICB_1_INT_TX1_INT_RBIAS_EN_ENABLE);
7359 + break;
7360 + }
7361 +
7362 return pm8916_wcd_analog_enable_micbias_int(component, event, w->reg,
7363 wcd->micbias1_cap_mode);
7364 }
7365 @@ -553,6 +558,11 @@ static int pm8916_wcd_analog_enable_micbias_int2(struct
7366 struct pm8916_wcd_analog_priv *wcd = snd_soc_component_get_drvdata(component);
7367
7368 switch (event) {
7369 + case SND_SOC_DAPM_PRE_PMU:
7370 + snd_soc_component_update_bits(component, CDC_A_MICB_1_INT_RBIAS,
7371 + MICB_1_INT_TX2_INT_RBIAS_EN_MASK,
7372 + MICB_1_INT_TX2_INT_RBIAS_EN_ENABLE);
7373 + break;
7374 case SND_SOC_DAPM_POST_PMU:
7375 pm8916_mbhc_configure_bias(wcd, true);
7376 break;
7377 @@ -888,10 +898,10 @@ static const struct snd_soc_dapm_widget pm8916_wcd_analog_dapm_widgets[] = {
7378
7379 SND_SOC_DAPM_SUPPLY("MIC BIAS External1", CDC_A_MICB_1_EN, 7, 0,
7380 pm8916_wcd_analog_enable_micbias_ext1,
7381 - SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
7382 + SND_SOC_DAPM_POST_PMU),
7383 SND_SOC_DAPM_SUPPLY("MIC BIAS External2", CDC_A_MICB_2_EN, 7, 0,
7384 pm8916_wcd_analog_enable_micbias_ext2,
7385 - SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
7386 + SND_SOC_DAPM_POST_PMU),
7387
7388 SND_SOC_DAPM_ADC_E("ADC1", NULL, CDC_A_TX_1_EN, 7, 0,
7389 pm8916_wcd_analog_enable_adc,
7390 diff --git a/sound/soc/codecs/msm8916-wcd-digital.c b/sound/soc/codecs/msm8916-wcd-digital.c
7391 index 58b2468fb2a7..09fccacadd6b 100644
7392 --- a/sound/soc/codecs/msm8916-wcd-digital.c
7393 +++ b/sound/soc/codecs/msm8916-wcd-digital.c
7394 @@ -586,6 +586,12 @@ static int msm8916_wcd_digital_enable_interpolator(
7395 snd_soc_component_write(component, rx_gain_reg[w->shift],
7396 snd_soc_component_read32(component, rx_gain_reg[w->shift]));
7397 break;
7398 + case SND_SOC_DAPM_POST_PMD:
7399 + snd_soc_component_update_bits(component, LPASS_CDC_CLK_RX_RESET_CTL,
7400 + 1 << w->shift, 1 << w->shift);
7401 + snd_soc_component_update_bits(component, LPASS_CDC_CLK_RX_RESET_CTL,
7402 + 1 << w->shift, 0x0);
7403 + break;
7404 }
7405 return 0;
7406 }
7407 diff --git a/sound/soc/intel/boards/bytcht_es8316.c b/sound/soc/intel/boards/bytcht_es8316.c
7408 index 46612331f5ea..54e97455d7f6 100644
7409 --- a/sound/soc/intel/boards/bytcht_es8316.c
7410 +++ b/sound/soc/intel/boards/bytcht_es8316.c
7411 @@ -442,7 +442,8 @@ static const struct dmi_system_id byt_cht_es8316_quirk_table[] = {
7412 DMI_MATCH(DMI_SYS_VENDOR, "IRBIS"),
7413 DMI_MATCH(DMI_PRODUCT_NAME, "NB41"),
7414 },
7415 - .driver_data = (void *)(BYT_CHT_ES8316_INTMIC_IN2_MAP
7416 + .driver_data = (void *)(BYT_CHT_ES8316_SSP0
7417 + | BYT_CHT_ES8316_INTMIC_IN2_MAP
7418 | BYT_CHT_ES8316_JD_INVERTED),
7419 },
7420 { /* Teclast X98 Plus II */
7421 diff --git a/sound/soc/stm/stm32_adfsdm.c b/sound/soc/stm/stm32_adfsdm.c
7422 index 3c9a9deec9af..4ecea4913f42 100644
7423 --- a/sound/soc/stm/stm32_adfsdm.c
7424 +++ b/sound/soc/stm/stm32_adfsdm.c
7425 @@ -153,13 +153,13 @@ static const struct snd_soc_component_driver stm32_adfsdm_dai_component = {
7426 .name = "stm32_dfsdm_audio",
7427 };
7428
7429 -static void memcpy_32to16(void *dest, const void *src, size_t n)
7430 +static void stm32_memcpy_32to16(void *dest, const void *src, size_t n)
7431 {
7432 unsigned int i = 0;
7433 u16 *d = (u16 *)dest, *s = (u16 *)src;
7434
7435 s++;
7436 - for (i = n; i > 0; i--) {
7437 + for (i = n >> 1; i > 0; i--) {
7438 *d++ = *s++;
7439 s++;
7440 }
7441 @@ -186,8 +186,8 @@ static int stm32_afsdm_pcm_cb(const void *data, size_t size, void *private)
7442
7443 if ((priv->pos + src_size) > buff_size) {
7444 if (format == SNDRV_PCM_FORMAT_S16_LE)
7445 - memcpy_32to16(&pcm_buff[priv->pos], src_buff,
7446 - buff_size - priv->pos);
7447 + stm32_memcpy_32to16(&pcm_buff[priv->pos], src_buff,
7448 + buff_size - priv->pos);
7449 else
7450 memcpy(&pcm_buff[priv->pos], src_buff,
7451 buff_size - priv->pos);
7452 @@ -196,8 +196,8 @@ static int stm32_afsdm_pcm_cb(const void *data, size_t size, void *private)
7453 }
7454
7455 if (format == SNDRV_PCM_FORMAT_S16_LE)
7456 - memcpy_32to16(&pcm_buff[priv->pos],
7457 - &src_buff[src_size - cur_size], cur_size);
7458 + stm32_memcpy_32to16(&pcm_buff[priv->pos],
7459 + &src_buff[src_size - cur_size], cur_size);
7460 else
7461 memcpy(&pcm_buff[priv->pos], &src_buff[src_size - cur_size],
7462 cur_size);
7463 diff --git a/sound/soc/stm/stm32_sai_sub.c b/sound/soc/stm/stm32_sai_sub.c
7464 index 48e629ac2d88..30bcd5d3a32a 100644
7465 --- a/sound/soc/stm/stm32_sai_sub.c
7466 +++ b/sound/soc/stm/stm32_sai_sub.c
7467 @@ -184,6 +184,56 @@ static bool stm32_sai_sub_writeable_reg(struct device *dev, unsigned int reg)
7468 }
7469 }
7470
7471 +static int stm32_sai_sub_reg_up(struct stm32_sai_sub_data *sai,
7472 + unsigned int reg, unsigned int mask,
7473 + unsigned int val)
7474 +{
7475 + int ret;
7476 +
7477 + ret = clk_enable(sai->pdata->pclk);
7478 + if (ret < 0)
7479 + return ret;
7480 +
7481 + ret = regmap_update_bits(sai->regmap, reg, mask, val);
7482 +
7483 + clk_disable(sai->pdata->pclk);
7484 +
7485 + return ret;
7486 +}
7487 +
7488 +static int stm32_sai_sub_reg_wr(struct stm32_sai_sub_data *sai,
7489 + unsigned int reg, unsigned int mask,
7490 + unsigned int val)
7491 +{
7492 + int ret;
7493 +
7494 + ret = clk_enable(sai->pdata->pclk);
7495 + if (ret < 0)
7496 + return ret;
7497 +
7498 + ret = regmap_write_bits(sai->regmap, reg, mask, val);
7499 +
7500 + clk_disable(sai->pdata->pclk);
7501 +
7502 + return ret;
7503 +}
7504 +
7505 +static int stm32_sai_sub_reg_rd(struct stm32_sai_sub_data *sai,
7506 + unsigned int reg, unsigned int *val)
7507 +{
7508 + int ret;
7509 +
7510 + ret = clk_enable(sai->pdata->pclk);
7511 + if (ret < 0)
7512 + return ret;
7513 +
7514 + ret = regmap_read(sai->regmap, reg, val);
7515 +
7516 + clk_disable(sai->pdata->pclk);
7517 +
7518 + return ret;
7519 +}
7520 +
7521 static const struct regmap_config stm32_sai_sub_regmap_config_f4 = {
7522 .reg_bits = 32,
7523 .reg_stride = 4,
7524 @@ -295,7 +345,7 @@ static int stm32_sai_set_clk_div(struct stm32_sai_sub_data *sai,
7525
7526 mask = SAI_XCR1_MCKDIV_MASK(SAI_XCR1_MCKDIV_WIDTH(version));
7527 cr1 = SAI_XCR1_MCKDIV_SET(div);
7528 - ret = regmap_update_bits(sai->regmap, STM_SAI_CR1_REGX, mask, cr1);
7529 + ret = stm32_sai_sub_reg_up(sai, STM_SAI_CR1_REGX, mask, cr1);
7530 if (ret < 0)
7531 dev_err(&sai->pdev->dev, "Failed to update CR1 register\n");
7532
7533 @@ -372,8 +422,8 @@ static int stm32_sai_mclk_enable(struct clk_hw *hw)
7534
7535 dev_dbg(&sai->pdev->dev, "Enable master clock\n");
7536
7537 - return regmap_update_bits(sai->regmap, STM_SAI_CR1_REGX,
7538 - SAI_XCR1_MCKEN, SAI_XCR1_MCKEN);
7539 + return stm32_sai_sub_reg_up(sai, STM_SAI_CR1_REGX,
7540 + SAI_XCR1_MCKEN, SAI_XCR1_MCKEN);
7541 }
7542
7543 static void stm32_sai_mclk_disable(struct clk_hw *hw)
7544 @@ -383,7 +433,7 @@ static void stm32_sai_mclk_disable(struct clk_hw *hw)
7545
7546 dev_dbg(&sai->pdev->dev, "Disable master clock\n");
7547
7548 - regmap_update_bits(sai->regmap, STM_SAI_CR1_REGX, SAI_XCR1_MCKEN, 0);
7549 + stm32_sai_sub_reg_up(sai, STM_SAI_CR1_REGX, SAI_XCR1_MCKEN, 0);
7550 }
7551
7552 static const struct clk_ops mclk_ops = {
7553 @@ -446,15 +496,15 @@ static irqreturn_t stm32_sai_isr(int irq, void *devid)
7554 unsigned int sr, imr, flags;
7555 snd_pcm_state_t status = SNDRV_PCM_STATE_RUNNING;
7556
7557 - regmap_read(sai->regmap, STM_SAI_IMR_REGX, &imr);
7558 - regmap_read(sai->regmap, STM_SAI_SR_REGX, &sr);
7559 + stm32_sai_sub_reg_rd(sai, STM_SAI_IMR_REGX, &imr);
7560 + stm32_sai_sub_reg_rd(sai, STM_SAI_SR_REGX, &sr);
7561
7562 flags = sr & imr;
7563 if (!flags)
7564 return IRQ_NONE;
7565
7566 - regmap_write_bits(sai->regmap, STM_SAI_CLRFR_REGX, SAI_XCLRFR_MASK,
7567 - SAI_XCLRFR_MASK);
7568 + stm32_sai_sub_reg_wr(sai, STM_SAI_CLRFR_REGX, SAI_XCLRFR_MASK,
7569 + SAI_XCLRFR_MASK);
7570
7571 if (!sai->substream) {
7572 dev_err(&pdev->dev, "Device stopped. Spurious IRQ 0x%x\n", sr);
7573 @@ -503,8 +553,8 @@ static int stm32_sai_set_sysclk(struct snd_soc_dai *cpu_dai,
7574 int ret;
7575
7576 if (dir == SND_SOC_CLOCK_OUT && sai->sai_mclk) {
7577 - ret = regmap_update_bits(sai->regmap, STM_SAI_CR1_REGX,
7578 - SAI_XCR1_NODIV,
7579 + ret = stm32_sai_sub_reg_up(sai, STM_SAI_CR1_REGX,
7580 + SAI_XCR1_NODIV,
7581 freq ? 0 : SAI_XCR1_NODIV);
7582 if (ret < 0)
7583 return ret;
7584 @@ -583,7 +633,7 @@ static int stm32_sai_set_dai_tdm_slot(struct snd_soc_dai *cpu_dai, u32 tx_mask,
7585
7586 slotr_mask |= SAI_XSLOTR_SLOTEN_MASK;
7587
7588 - regmap_update_bits(sai->regmap, STM_SAI_SLOTR_REGX, slotr_mask, slotr);
7589 + stm32_sai_sub_reg_up(sai, STM_SAI_SLOTR_REGX, slotr_mask, slotr);
7590
7591 sai->slot_width = slot_width;
7592 sai->slots = slots;
7593 @@ -665,7 +715,7 @@ static int stm32_sai_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt)
7594 cr1_mask |= SAI_XCR1_CKSTR;
7595 frcr_mask |= SAI_XFRCR_FSPOL;
7596
7597 - regmap_update_bits(sai->regmap, STM_SAI_FRCR_REGX, frcr_mask, frcr);
7598 + stm32_sai_sub_reg_up(sai, STM_SAI_FRCR_REGX, frcr_mask, frcr);
7599
7600 /* DAI clock master masks */
7601 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
7602 @@ -693,7 +743,7 @@ static int stm32_sai_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt)
7603 cr1_mask |= SAI_XCR1_SLAVE;
7604
7605 conf_update:
7606 - ret = regmap_update_bits(sai->regmap, STM_SAI_CR1_REGX, cr1_mask, cr1);
7607 + ret = stm32_sai_sub_reg_up(sai, STM_SAI_CR1_REGX, cr1_mask, cr1);
7608 if (ret < 0) {
7609 dev_err(cpu_dai->dev, "Failed to update CR1 register\n");
7610 return ret;
7611 @@ -730,12 +780,12 @@ static int stm32_sai_startup(struct snd_pcm_substream *substream,
7612 }
7613
7614 /* Enable ITs */
7615 - regmap_write_bits(sai->regmap, STM_SAI_CLRFR_REGX,
7616 - SAI_XCLRFR_MASK, SAI_XCLRFR_MASK);
7617 + stm32_sai_sub_reg_wr(sai, STM_SAI_CLRFR_REGX,
7618 + SAI_XCLRFR_MASK, SAI_XCLRFR_MASK);
7619
7620 imr = SAI_XIMR_OVRUDRIE;
7621 if (STM_SAI_IS_CAPTURE(sai)) {
7622 - regmap_read(sai->regmap, STM_SAI_CR2_REGX, &cr2);
7623 + stm32_sai_sub_reg_rd(sai, STM_SAI_CR2_REGX, &cr2);
7624 if (cr2 & SAI_XCR2_MUTECNT_MASK)
7625 imr |= SAI_XIMR_MUTEDETIE;
7626 }
7627 @@ -745,8 +795,8 @@ static int stm32_sai_startup(struct snd_pcm_substream *substream,
7628 else
7629 imr |= SAI_XIMR_AFSDETIE | SAI_XIMR_LFSDETIE;
7630
7631 - regmap_update_bits(sai->regmap, STM_SAI_IMR_REGX,
7632 - SAI_XIMR_MASK, imr);
7633 + stm32_sai_sub_reg_up(sai, STM_SAI_IMR_REGX,
7634 + SAI_XIMR_MASK, imr);
7635
7636 return 0;
7637 }
7638 @@ -763,10 +813,10 @@ static int stm32_sai_set_config(struct snd_soc_dai *cpu_dai,
7639 * SAI fifo threshold is set to half fifo, to keep enough space
7640 * for DMA incoming bursts.
7641 */
7642 - regmap_write_bits(sai->regmap, STM_SAI_CR2_REGX,
7643 - SAI_XCR2_FFLUSH | SAI_XCR2_FTH_MASK,
7644 - SAI_XCR2_FFLUSH |
7645 - SAI_XCR2_FTH_SET(STM_SAI_FIFO_TH_HALF));
7646 + stm32_sai_sub_reg_wr(sai, STM_SAI_CR2_REGX,
7647 + SAI_XCR2_FFLUSH | SAI_XCR2_FTH_MASK,
7648 + SAI_XCR2_FFLUSH |
7649 + SAI_XCR2_FTH_SET(STM_SAI_FIFO_TH_HALF));
7650
7651 /* DS bits in CR1 not set for SPDIF (size forced to 24 bits).*/
7652 if (STM_SAI_PROTOCOL_IS_SPDIF(sai)) {
7653 @@ -795,7 +845,7 @@ static int stm32_sai_set_config(struct snd_soc_dai *cpu_dai,
7654 if ((sai->slots == 2) && (params_channels(params) == 1))
7655 cr1 |= SAI_XCR1_MONO;
7656
7657 - ret = regmap_update_bits(sai->regmap, STM_SAI_CR1_REGX, cr1_mask, cr1);
7658 + ret = stm32_sai_sub_reg_up(sai, STM_SAI_CR1_REGX, cr1_mask, cr1);
7659 if (ret < 0) {
7660 dev_err(cpu_dai->dev, "Failed to update CR1 register\n");
7661 return ret;
7662 @@ -809,7 +859,7 @@ static int stm32_sai_set_slots(struct snd_soc_dai *cpu_dai)
7663 struct stm32_sai_sub_data *sai = snd_soc_dai_get_drvdata(cpu_dai);
7664 int slotr, slot_sz;
7665
7666 - regmap_read(sai->regmap, STM_SAI_SLOTR_REGX, &slotr);
7667 + stm32_sai_sub_reg_rd(sai, STM_SAI_SLOTR_REGX, &slotr);
7668
7669 /*
7670 * If SLOTSZ is set to auto in SLOTR, align slot width on data size
7671 @@ -831,16 +881,16 @@ static int stm32_sai_set_slots(struct snd_soc_dai *cpu_dai)
7672 sai->slots = 2;
7673
7674 /* The number of slots in the audio frame is equal to NBSLOT[3:0] + 1*/
7675 - regmap_update_bits(sai->regmap, STM_SAI_SLOTR_REGX,
7676 - SAI_XSLOTR_NBSLOT_MASK,
7677 - SAI_XSLOTR_NBSLOT_SET((sai->slots - 1)));
7678 + stm32_sai_sub_reg_up(sai, STM_SAI_SLOTR_REGX,
7679 + SAI_XSLOTR_NBSLOT_MASK,
7680 + SAI_XSLOTR_NBSLOT_SET((sai->slots - 1)));
7681
7682 /* Set default slots mask if not already set from DT */
7683 if (!(slotr & SAI_XSLOTR_SLOTEN_MASK)) {
7684 sai->slot_mask = (1 << sai->slots) - 1;
7685 - regmap_update_bits(sai->regmap,
7686 - STM_SAI_SLOTR_REGX, SAI_XSLOTR_SLOTEN_MASK,
7687 - SAI_XSLOTR_SLOTEN_SET(sai->slot_mask));
7688 + stm32_sai_sub_reg_up(sai,
7689 + STM_SAI_SLOTR_REGX, SAI_XSLOTR_SLOTEN_MASK,
7690 + SAI_XSLOTR_SLOTEN_SET(sai->slot_mask));
7691 }
7692
7693 dev_dbg(cpu_dai->dev, "Slots %d, slot width %d\n",
7694 @@ -870,14 +920,14 @@ static void stm32_sai_set_frame(struct snd_soc_dai *cpu_dai)
7695 dev_dbg(cpu_dai->dev, "Frame length %d, frame active %d\n",
7696 sai->fs_length, fs_active);
7697
7698 - regmap_update_bits(sai->regmap, STM_SAI_FRCR_REGX, frcr_mask, frcr);
7699 + stm32_sai_sub_reg_up(sai, STM_SAI_FRCR_REGX, frcr_mask, frcr);
7700
7701 if ((sai->fmt & SND_SOC_DAIFMT_FORMAT_MASK) == SND_SOC_DAIFMT_LSB) {
7702 offset = sai->slot_width - sai->data_size;
7703
7704 - regmap_update_bits(sai->regmap, STM_SAI_SLOTR_REGX,
7705 - SAI_XSLOTR_FBOFF_MASK,
7706 - SAI_XSLOTR_FBOFF_SET(offset));
7707 + stm32_sai_sub_reg_up(sai, STM_SAI_SLOTR_REGX,
7708 + SAI_XSLOTR_FBOFF_MASK,
7709 + SAI_XSLOTR_FBOFF_SET(offset));
7710 }
7711 }
7712
7713 @@ -994,9 +1044,9 @@ static int stm32_sai_configure_clock(struct snd_soc_dai *cpu_dai,
7714 return -EINVAL;
7715 }
7716
7717 - regmap_update_bits(sai->regmap,
7718 - STM_SAI_CR1_REGX,
7719 - SAI_XCR1_OSR, cr1);
7720 + stm32_sai_sub_reg_up(sai,
7721 + STM_SAI_CR1_REGX,
7722 + SAI_XCR1_OSR, cr1);
7723
7724 div = stm32_sai_get_clk_div(sai, sai_clk_rate,
7725 sai->mclk_rate);
7726 @@ -1058,12 +1108,12 @@ static int stm32_sai_trigger(struct snd_pcm_substream *substream, int cmd,
7727 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
7728 dev_dbg(cpu_dai->dev, "Enable DMA and SAI\n");
7729
7730 - regmap_update_bits(sai->regmap, STM_SAI_CR1_REGX,
7731 - SAI_XCR1_DMAEN, SAI_XCR1_DMAEN);
7732 + stm32_sai_sub_reg_up(sai, STM_SAI_CR1_REGX,
7733 + SAI_XCR1_DMAEN, SAI_XCR1_DMAEN);
7734
7735 /* Enable SAI */
7736 - ret = regmap_update_bits(sai->regmap, STM_SAI_CR1_REGX,
7737 - SAI_XCR1_SAIEN, SAI_XCR1_SAIEN);
7738 + ret = stm32_sai_sub_reg_up(sai, STM_SAI_CR1_REGX,
7739 + SAI_XCR1_SAIEN, SAI_XCR1_SAIEN);
7740 if (ret < 0)
7741 dev_err(cpu_dai->dev, "Failed to update CR1 register\n");
7742 break;
7743 @@ -1072,16 +1122,16 @@ static int stm32_sai_trigger(struct snd_pcm_substream *substream, int cmd,
7744 case SNDRV_PCM_TRIGGER_STOP:
7745 dev_dbg(cpu_dai->dev, "Disable DMA and SAI\n");
7746
7747 - regmap_update_bits(sai->regmap, STM_SAI_IMR_REGX,
7748 - SAI_XIMR_MASK, 0);
7749 + stm32_sai_sub_reg_up(sai, STM_SAI_IMR_REGX,
7750 + SAI_XIMR_MASK, 0);
7751
7752 - regmap_update_bits(sai->regmap, STM_SAI_CR1_REGX,
7753 - SAI_XCR1_SAIEN,
7754 - (unsigned int)~SAI_XCR1_SAIEN);
7755 + stm32_sai_sub_reg_up(sai, STM_SAI_CR1_REGX,
7756 + SAI_XCR1_SAIEN,
7757 + (unsigned int)~SAI_XCR1_SAIEN);
7758
7759 - ret = regmap_update_bits(sai->regmap, STM_SAI_CR1_REGX,
7760 - SAI_XCR1_DMAEN,
7761 - (unsigned int)~SAI_XCR1_DMAEN);
7762 + ret = stm32_sai_sub_reg_up(sai, STM_SAI_CR1_REGX,
7763 + SAI_XCR1_DMAEN,
7764 + (unsigned int)~SAI_XCR1_DMAEN);
7765 if (ret < 0)
7766 dev_err(cpu_dai->dev, "Failed to update CR1 register\n");
7767
7768 @@ -1101,7 +1151,7 @@ static void stm32_sai_shutdown(struct snd_pcm_substream *substream,
7769 struct stm32_sai_sub_data *sai = snd_soc_dai_get_drvdata(cpu_dai);
7770 unsigned long flags;
7771
7772 - regmap_update_bits(sai->regmap, STM_SAI_IMR_REGX, SAI_XIMR_MASK, 0);
7773 + stm32_sai_sub_reg_up(sai, STM_SAI_IMR_REGX, SAI_XIMR_MASK, 0);
7774
7775 clk_disable_unprepare(sai->sai_ck);
7776
7777 @@ -1169,7 +1219,7 @@ static int stm32_sai_dai_probe(struct snd_soc_dai *cpu_dai)
7778 cr1_mask |= SAI_XCR1_SYNCEN_MASK;
7779 cr1 |= SAI_XCR1_SYNCEN_SET(sai->sync);
7780
7781 - return regmap_update_bits(sai->regmap, STM_SAI_CR1_REGX, cr1_mask, cr1);
7782 + return stm32_sai_sub_reg_up(sai, STM_SAI_CR1_REGX, cr1_mask, cr1);
7783 }
7784
7785 static const struct snd_soc_dai_ops stm32_sai_pcm_dai_ops = {
7786 @@ -1322,8 +1372,13 @@ static int stm32_sai_sub_parse_of(struct platform_device *pdev,
7787 if (STM_SAI_HAS_PDM(sai) && STM_SAI_IS_SUB_A(sai))
7788 sai->regmap_config = &stm32_sai_sub_regmap_config_h7;
7789
7790 - sai->regmap = devm_regmap_init_mmio_clk(&pdev->dev, "sai_ck",
7791 - base, sai->regmap_config);
7792 + /*
7793 + * Do not manage peripheral clock through regmap framework as this
7794 + * can lead to circular locking issue with sai master clock provider.
7795 + * Manage peripheral clock directly in driver instead.
7796 + */
7797 + sai->regmap = devm_regmap_init_mmio(&pdev->dev, base,
7798 + sai->regmap_config);
7799 if (IS_ERR(sai->regmap)) {
7800 dev_err(&pdev->dev, "Failed to initialize MMIO\n");
7801 return PTR_ERR(sai->regmap);
7802 @@ -1420,6 +1475,10 @@ static int stm32_sai_sub_parse_of(struct platform_device *pdev,
7803 return PTR_ERR(sai->sai_ck);
7804 }
7805
7806 + ret = clk_prepare(sai->pdata->pclk);
7807 + if (ret < 0)
7808 + return ret;
7809 +
7810 if (STM_SAI_IS_F4(sai->pdata))
7811 return 0;
7812
7813 @@ -1501,22 +1560,48 @@ static int stm32_sai_sub_probe(struct platform_device *pdev)
7814 return 0;
7815 }
7816
7817 +static int stm32_sai_sub_remove(struct platform_device *pdev)
7818 +{
7819 + struct stm32_sai_sub_data *sai = dev_get_drvdata(&pdev->dev);
7820 +
7821 + clk_unprepare(sai->pdata->pclk);
7822 +
7823 + return 0;
7824 +}
7825 +
7826 #ifdef CONFIG_PM_SLEEP
7827 static int stm32_sai_sub_suspend(struct device *dev)
7828 {
7829 struct stm32_sai_sub_data *sai = dev_get_drvdata(dev);
7830 + int ret;
7831 +
7832 + ret = clk_enable(sai->pdata->pclk);
7833 + if (ret < 0)
7834 + return ret;
7835
7836 regcache_cache_only(sai->regmap, true);
7837 regcache_mark_dirty(sai->regmap);
7838 +
7839 + clk_disable(sai->pdata->pclk);
7840 +
7841 return 0;
7842 }
7843
7844 static int stm32_sai_sub_resume(struct device *dev)
7845 {
7846 struct stm32_sai_sub_data *sai = dev_get_drvdata(dev);
7847 + int ret;
7848 +
7849 + ret = clk_enable(sai->pdata->pclk);
7850 + if (ret < 0)
7851 + return ret;
7852
7853 regcache_cache_only(sai->regmap, false);
7854 - return regcache_sync(sai->regmap);
7855 + ret = regcache_sync(sai->regmap);
7856 +
7857 + clk_disable(sai->pdata->pclk);
7858 +
7859 + return ret;
7860 }
7861 #endif /* CONFIG_PM_SLEEP */
7862
7863 @@ -1531,6 +1616,7 @@ static struct platform_driver stm32_sai_sub_driver = {
7864 .pm = &stm32_sai_sub_pm_ops,
7865 },
7866 .probe = stm32_sai_sub_probe,
7867 + .remove = stm32_sai_sub_remove,
7868 };
7869
7870 module_platform_driver(stm32_sai_sub_driver);
7871 diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
7872 index a04c727dcd19..fa24bd491cf6 100644
7873 --- a/sound/usb/pcm.c
7874 +++ b/sound/usb/pcm.c
7875 @@ -370,7 +370,7 @@ static int set_sync_ep_implicit_fb_quirk(struct snd_usb_substream *subs,
7876 add_sync_ep_from_ifnum:
7877 iface = usb_ifnum_to_if(dev, ifnum);
7878
7879 - if (!iface || iface->num_altsetting == 0)
7880 + if (!iface || iface->num_altsetting < 2)
7881 return -EINVAL;
7882
7883 alts = &iface->altsetting[1];
7884 diff --git a/tools/bpf/bpftool/btf_dumper.c b/tools/bpf/bpftool/btf_dumper.c
7885 index d66131f69689..397e5716ab6d 100644
7886 --- a/tools/bpf/bpftool/btf_dumper.c
7887 +++ b/tools/bpf/bpftool/btf_dumper.c
7888 @@ -26,7 +26,7 @@ static void btf_dumper_ptr(const void *data, json_writer_t *jw,
7889 bool is_plain_text)
7890 {
7891 if (is_plain_text)
7892 - jsonw_printf(jw, "%p", data);
7893 + jsonw_printf(jw, "%p", *(void **)data);
7894 else
7895 jsonw_printf(jw, "%lu", *(unsigned long *)data);
7896 }
7897 diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
7898 index 7accaf8ef689..ea3f0745d7ad 100644
7899 --- a/tools/perf/builtin-report.c
7900 +++ b/tools/perf/builtin-report.c
7901 @@ -1031,6 +1031,7 @@ int cmd_report(int argc, const char **argv)
7902 struct stat st;
7903 bool has_br_stack = false;
7904 int branch_mode = -1;
7905 + int last_key = 0;
7906 bool branch_call_mode = false;
7907 #define CALLCHAIN_DEFAULT_OPT "graph,0.5,caller,function,percent"
7908 static const char report_callchain_help[] = "Display call graph (stack chain/backtrace):\n\n"
7909 @@ -1396,7 +1397,8 @@ repeat:
7910 sort_order = sort_tmp;
7911 }
7912
7913 - if (setup_sorting(session->evlist) < 0) {
7914 + if ((last_key != K_SWITCH_INPUT_DATA) &&
7915 + (setup_sorting(session->evlist) < 0)) {
7916 if (sort_order)
7917 parse_options_usage(report_usage, options, "s", 1);
7918 if (field_order)
7919 @@ -1475,6 +1477,7 @@ repeat:
7920 ret = __cmd_report(&report);
7921 if (ret == K_SWITCH_INPUT_DATA) {
7922 perf_session__delete(session);
7923 + last_key = K_SWITCH_INPUT_DATA;
7924 goto repeat;
7925 } else
7926 ret = 0;
7927 diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
7928 index 3983d6ccd14d..da016f398aa8 100644
7929 --- a/tools/perf/builtin-script.c
7930 +++ b/tools/perf/builtin-script.c
7931 @@ -3605,11 +3605,6 @@ int cmd_script(int argc, const char **argv)
7932 }
7933 }
7934
7935 - if (script.time_str && reltime) {
7936 - fprintf(stderr, "Don't combine --reltime with --time\n");
7937 - return -1;
7938 - }
7939 -
7940 if (itrace_synth_opts.callchain &&
7941 itrace_synth_opts.callchain_sz > scripting_max_stack)
7942 scripting_max_stack = itrace_synth_opts.callchain_sz;
7943 @@ -3869,10 +3864,11 @@ int cmd_script(int argc, const char **argv)
7944 goto out_delete;
7945
7946 if (script.time_str) {
7947 - err = perf_time__parse_for_ranges(script.time_str, session,
7948 + err = perf_time__parse_for_ranges_reltime(script.time_str, session,
7949 &script.ptime_range,
7950 &script.range_size,
7951 - &script.range_num);
7952 + &script.range_num,
7953 + reltime);
7954 if (err < 0)
7955 goto out_delete;
7956
7957 diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
7958 index 6a186b668303..479273130794 100644
7959 --- a/tools/perf/util/hist.h
7960 +++ b/tools/perf/util/hist.h
7961 @@ -339,10 +339,10 @@ static inline void perf_hpp__prepend_sort_field(struct perf_hpp_fmt *format)
7962 list_for_each_entry_safe(format, tmp, &(_list)->sorts, sort_list)
7963
7964 #define hists__for_each_format(hists, format) \
7965 - perf_hpp_list__for_each_format((hists)->hpp_list, fmt)
7966 + perf_hpp_list__for_each_format((hists)->hpp_list, format)
7967
7968 #define hists__for_each_sort_list(hists, format) \
7969 - perf_hpp_list__for_each_sort_list((hists)->hpp_list, fmt)
7970 + perf_hpp_list__for_each_sort_list((hists)->hpp_list, format)
7971
7972 extern struct perf_hpp_fmt perf_hpp__format[];
7973
7974 diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
7975 index 08cccd86447c..9ecea45da4ca 100644
7976 --- a/tools/perf/util/probe-finder.c
7977 +++ b/tools/perf/util/probe-finder.c
7978 @@ -604,38 +604,26 @@ static int convert_to_trace_point(Dwarf_Die *sp_die, Dwfl_Module *mod,
7979 const char *function,
7980 struct probe_trace_point *tp)
7981 {
7982 - Dwarf_Addr eaddr, highaddr;
7983 + Dwarf_Addr eaddr;
7984 GElf_Sym sym;
7985 const char *symbol;
7986
7987 /* Verify the address is correct */
7988 - if (dwarf_entrypc(sp_die, &eaddr) != 0) {
7989 - pr_warning("Failed to get entry address of %s\n",
7990 - dwarf_diename(sp_die));
7991 - return -ENOENT;
7992 - }
7993 - if (dwarf_highpc(sp_die, &highaddr) != 0) {
7994 - pr_warning("Failed to get end address of %s\n",
7995 - dwarf_diename(sp_die));
7996 - return -ENOENT;
7997 - }
7998 - if (paddr > highaddr) {
7999 - pr_warning("Offset specified is greater than size of %s\n",
8000 + if (!dwarf_haspc(sp_die, paddr)) {
8001 + pr_warning("Specified offset is out of %s\n",
8002 dwarf_diename(sp_die));
8003 return -EINVAL;
8004 }
8005
8006 - symbol = dwarf_diename(sp_die);
8007 + /* Try to get actual symbol name from symtab */
8008 + symbol = dwfl_module_addrsym(mod, paddr, &sym, NULL);
8009 if (!symbol) {
8010 - /* Try to get the symbol name from symtab */
8011 - symbol = dwfl_module_addrsym(mod, paddr, &sym, NULL);
8012 - if (!symbol) {
8013 - pr_warning("Failed to find symbol at 0x%lx\n",
8014 - (unsigned long)paddr);
8015 - return -ENOENT;
8016 - }
8017 - eaddr = sym.st_value;
8018 + pr_warning("Failed to find symbol at 0x%lx\n",
8019 + (unsigned long)paddr);
8020 + return -ENOENT;
8021 }
8022 + eaddr = sym.st_value;
8023 +
8024 tp->offset = (unsigned long)(paddr - eaddr);
8025 tp->address = (unsigned long)paddr;
8026 tp->symbol = strdup(symbol);
8027 diff --git a/tools/perf/util/time-utils.c b/tools/perf/util/time-utils.c
8028 index 9796a2e43f67..302443921681 100644
8029 --- a/tools/perf/util/time-utils.c
8030 +++ b/tools/perf/util/time-utils.c
8031 @@ -458,10 +458,11 @@ bool perf_time__ranges_skip_sample(struct perf_time_interval *ptime_buf,
8032 return true;
8033 }
8034
8035 -int perf_time__parse_for_ranges(const char *time_str,
8036 +int perf_time__parse_for_ranges_reltime(const char *time_str,
8037 struct perf_session *session,
8038 struct perf_time_interval **ranges,
8039 - int *range_size, int *range_num)
8040 + int *range_size, int *range_num,
8041 + bool reltime)
8042 {
8043 bool has_percent = strchr(time_str, '%');
8044 struct perf_time_interval *ptime_range;
8045 @@ -471,7 +472,7 @@ int perf_time__parse_for_ranges(const char *time_str,
8046 if (!ptime_range)
8047 return -ENOMEM;
8048
8049 - if (has_percent) {
8050 + if (has_percent || reltime) {
8051 if (session->evlist->first_sample_time == 0 &&
8052 session->evlist->last_sample_time == 0) {
8053 pr_err("HINT: no first/last sample time found in perf data.\n"
8054 @@ -479,7 +480,9 @@ int perf_time__parse_for_ranges(const char *time_str,
8055 "(if '--buildid-all' is enabled, please set '--timestamp-boundary').\n");
8056 goto error;
8057 }
8058 + }
8059
8060 + if (has_percent) {
8061 num = perf_time__percent_parse_str(
8062 ptime_range, size,
8063 time_str,
8064 @@ -492,6 +495,15 @@ int perf_time__parse_for_ranges(const char *time_str,
8065 if (num < 0)
8066 goto error_invalid;
8067
8068 + if (reltime) {
8069 + int i;
8070 +
8071 + for (i = 0; i < num; i++) {
8072 + ptime_range[i].start += session->evlist->first_sample_time;
8073 + ptime_range[i].end += session->evlist->first_sample_time;
8074 + }
8075 + }
8076 +
8077 *range_size = size;
8078 *range_num = num;
8079 *ranges = ptime_range;
8080 @@ -504,6 +516,15 @@ error:
8081 return ret;
8082 }
8083
8084 +int perf_time__parse_for_ranges(const char *time_str,
8085 + struct perf_session *session,
8086 + struct perf_time_interval **ranges,
8087 + int *range_size, int *range_num)
8088 +{
8089 + return perf_time__parse_for_ranges_reltime(time_str, session, ranges,
8090 + range_size, range_num, false);
8091 +}
8092 +
8093 int timestamp__scnprintf_usec(u64 timestamp, char *buf, size_t sz)
8094 {
8095 u64 sec = timestamp / NSEC_PER_SEC;
8096 diff --git a/tools/perf/util/time-utils.h b/tools/perf/util/time-utils.h
8097 index 4f42988eb2f7..1142b0bddd5e 100644
8098 --- a/tools/perf/util/time-utils.h
8099 +++ b/tools/perf/util/time-utils.h
8100 @@ -26,6 +26,11 @@ bool perf_time__ranges_skip_sample(struct perf_time_interval *ptime_buf,
8101
8102 struct perf_session;
8103
8104 +int perf_time__parse_for_ranges_reltime(const char *str, struct perf_session *session,
8105 + struct perf_time_interval **ranges,
8106 + int *range_size, int *range_num,
8107 + bool reltime);
8108 +
8109 int perf_time__parse_for_ranges(const char *str, struct perf_session *session,
8110 struct perf_time_interval **ranges,
8111 int *range_size, int *range_num);
8112 diff --git a/tools/testing/selftests/drivers/net/mlxsw/qos_mc_aware.sh b/tools/testing/selftests/drivers/net/mlxsw/qos_mc_aware.sh
8113 index 47315fe48d5a..24dd8ed48580 100755
8114 --- a/tools/testing/selftests/drivers/net/mlxsw/qos_mc_aware.sh
8115 +++ b/tools/testing/selftests/drivers/net/mlxsw/qos_mc_aware.sh
8116 @@ -232,7 +232,7 @@ test_mc_aware()
8117 stop_traffic
8118 local ucth1=${uc_rate[1]}
8119
8120 - start_traffic $h1 own bc bc
8121 + start_traffic $h1 192.0.2.65 bc bc
8122
8123 local d0=$(date +%s)
8124 local t0=$(ethtool_stats_get $h3 rx_octets_prio_0)
8125 @@ -254,7 +254,11 @@ test_mc_aware()
8126 ret = 100 * ($ucth1 - $ucth2) / $ucth1
8127 if (ret > 0) { ret } else { 0 }
8128 ")
8129 - check_err $(bc <<< "$deg > 25")
8130 +
8131 + # Minimum shaper of 200Mbps on MC TCs should cause about 20% of
8132 + # degradation on 1Gbps link.
8133 + check_err $(bc <<< "$deg < 15") "Minimum shaper not in effect"
8134 + check_err $(bc <<< "$deg > 25") "MC traffic degrades UC performance too much"
8135
8136 local interval=$((d1 - d0))
8137 local mc_ir=$(rate $u0 $u1 $interval)