Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:5.4 commit in: /
Date: Thu, 12 Mar 2020 14:05:01
Message-Id: 1584021878.7e97a93a72d89274cefb1764cc26d44310a4f0e5.mpagano@gentoo
1 commit: 7e97a93a72d89274cefb1764cc26d44310a4f0e5
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Thu Mar 12 14:04:38 2020 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Thu Mar 12 14:04:38 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=7e97a93a
7
8 Linux patch 5.4.25
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1024_linux-5.4.25.patch | 6231 +++++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 6235 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index c24327d..d81740b 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -139,6 +139,10 @@ Patch: 1023_linux-5.4.24.patch
21 From: http://www.kernel.org
22 Desc: Linux 5.4.24
23
24 +Patch: 1024_linux-5.4.25.patch
25 +From: http://www.kernel.org
26 +Desc: Linux 5.4.25
27 +
28 Patch: 1500_XATTR_USER_PREFIX.patch
29 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
30 Desc: Support for namespace user.pax.* on tmpfs.
31
32 diff --git a/1024_linux-5.4.25.patch b/1024_linux-5.4.25.patch
33 new file mode 100644
34 index 0000000..58f0901
35 --- /dev/null
36 +++ b/1024_linux-5.4.25.patch
37 @@ -0,0 +1,6231 @@
38 +diff --git a/Makefile b/Makefile
39 +index c32c78cf2fe5..85e41313f078 100644
40 +--- a/Makefile
41 ++++ b/Makefile
42 +@@ -1,7 +1,7 @@
43 + # SPDX-License-Identifier: GPL-2.0
44 + VERSION = 5
45 + PATCHLEVEL = 4
46 +-SUBLEVEL = 24
47 ++SUBLEVEL = 25
48 + EXTRAVERSION =
49 + NAME = Kleptomaniac Octopus
50 +
51 +diff --git a/arch/arm/boot/dts/am437x-idk-evm.dts b/arch/arm/boot/dts/am437x-idk-evm.dts
52 +index f3ced6df0c9b..9f66f96d09c9 100644
53 +--- a/arch/arm/boot/dts/am437x-idk-evm.dts
54 ++++ b/arch/arm/boot/dts/am437x-idk-evm.dts
55 +@@ -526,11 +526,11 @@
56 + * Supply voltage supervisor on board will not allow opp50 so
57 + * disable it and set opp100 as suspend OPP.
58 + */
59 +- opp50@300000000 {
60 ++ opp50-300000000 {
61 + status = "disabled";
62 + };
63 +
64 +- opp100@600000000 {
65 ++ opp100-600000000 {
66 + opp-suspend;
67 + };
68 + };
69 +diff --git a/arch/arm/boot/dts/dra76x.dtsi b/arch/arm/boot/dts/dra76x.dtsi
70 +index cdcba3f561c4..9f6fbe4c1fee 100644
71 +--- a/arch/arm/boot/dts/dra76x.dtsi
72 ++++ b/arch/arm/boot/dts/dra76x.dtsi
73 +@@ -86,3 +86,8 @@
74 + &usb4_tm {
75 + status = "disabled";
76 + };
77 ++
78 ++&mmc3 {
79 ++ /* dra76x is not affected by i887 */
80 ++ max-frequency = <96000000>;
81 ++};
82 +diff --git a/arch/arm/boot/dts/dra7xx-clocks.dtsi b/arch/arm/boot/dts/dra7xx-clocks.dtsi
83 +index 93e1eb83bed9..d7d98d2069df 100644
84 +--- a/arch/arm/boot/dts/dra7xx-clocks.dtsi
85 ++++ b/arch/arm/boot/dts/dra7xx-clocks.dtsi
86 +@@ -796,16 +796,6 @@
87 + clock-div = <1>;
88 + };
89 +
90 +- ipu1_gfclk_mux: ipu1_gfclk_mux@520 {
91 +- #clock-cells = <0>;
92 +- compatible = "ti,mux-clock";
93 +- clocks = <&dpll_abe_m2x2_ck>, <&dpll_core_h22x2_ck>;
94 +- ti,bit-shift = <24>;
95 +- reg = <0x0520>;
96 +- assigned-clocks = <&ipu1_gfclk_mux>;
97 +- assigned-clock-parents = <&dpll_core_h22x2_ck>;
98 +- };
99 +-
100 + dummy_ck: dummy_ck {
101 + #clock-cells = <0>;
102 + compatible = "fixed-clock";
103 +@@ -1564,6 +1554,8 @@
104 + compatible = "ti,clkctrl";
105 + reg = <0x20 0x4>;
106 + #clock-cells = <2>;
107 ++ assigned-clocks = <&ipu1_clkctrl DRA7_IPU1_MMU_IPU1_CLKCTRL 24>;
108 ++ assigned-clock-parents = <&dpll_core_h22x2_ck>;
109 + };
110 +
111 + ipu_clkctrl: ipu-clkctrl@50 {
112 +diff --git a/arch/arm/boot/dts/imx6qdl-phytec-phycore-som.dtsi b/arch/arm/boot/dts/imx6qdl-phytec-phycore-som.dtsi
113 +index 6486df3e2942..881cea0b61ba 100644
114 +--- a/arch/arm/boot/dts/imx6qdl-phytec-phycore-som.dtsi
115 ++++ b/arch/arm/boot/dts/imx6qdl-phytec-phycore-som.dtsi
116 +@@ -183,7 +183,6 @@
117 + pinctrl-0 = <&pinctrl_usdhc4>;
118 + bus-width = <8>;
119 + non-removable;
120 +- vmmc-supply = <&vdd_emmc_1p8>;
121 + status = "disabled";
122 + };
123 +
124 +diff --git a/arch/arm/boot/dts/imx7-colibri.dtsi b/arch/arm/boot/dts/imx7-colibri.dtsi
125 +index 917eb0b58b13..eed78f12e79e 100644
126 +--- a/arch/arm/boot/dts/imx7-colibri.dtsi
127 ++++ b/arch/arm/boot/dts/imx7-colibri.dtsi
128 +@@ -337,7 +337,6 @@
129 + assigned-clock-rates = <400000000>;
130 + bus-width = <8>;
131 + fsl,tuning-step = <2>;
132 +- max-frequency = <100000000>;
133 + vmmc-supply = <&reg_module_3v3>;
134 + vqmmc-supply = <&reg_DCDC3>;
135 + non-removable;
136 +diff --git a/arch/arm/boot/dts/ls1021a.dtsi b/arch/arm/boot/dts/ls1021a.dtsi
137 +index 2f6977ada447..63d9f4a066e3 100644
138 +--- a/arch/arm/boot/dts/ls1021a.dtsi
139 ++++ b/arch/arm/boot/dts/ls1021a.dtsi
140 +@@ -728,7 +728,7 @@
141 + };
142 +
143 + mdio0: mdio@2d24000 {
144 +- compatible = "fsl,etsec2-mdio";
145 ++ compatible = "gianfar";
146 + device_type = "mdio";
147 + #address-cells = <1>;
148 + #size-cells = <0>;
149 +@@ -737,7 +737,7 @@
150 + };
151 +
152 + mdio1: mdio@2d64000 {
153 +- compatible = "fsl,etsec2-mdio";
154 ++ compatible = "gianfar";
155 + device_type = "mdio";
156 + #address-cells = <1>;
157 + #size-cells = <0>;
158 +diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
159 +index 35ff620537e6..03506ce46149 100644
160 +--- a/arch/arm/mach-imx/Makefile
161 ++++ b/arch/arm/mach-imx/Makefile
162 +@@ -91,6 +91,8 @@ AFLAGS_suspend-imx6.o :=-Wa,-march=armv7-a
163 + obj-$(CONFIG_SOC_IMX6) += suspend-imx6.o
164 + obj-$(CONFIG_SOC_IMX53) += suspend-imx53.o
165 + endif
166 ++AFLAGS_resume-imx6.o :=-Wa,-march=armv7-a
167 ++obj-$(CONFIG_SOC_IMX6) += resume-imx6.o
168 + obj-$(CONFIG_SOC_IMX6) += pm-imx6.o
169 +
170 + obj-$(CONFIG_SOC_IMX1) += mach-imx1.o
171 +diff --git a/arch/arm/mach-imx/common.h b/arch/arm/mach-imx/common.h
172 +index 912aeceb4ff8..5aa5796cff0e 100644
173 +--- a/arch/arm/mach-imx/common.h
174 ++++ b/arch/arm/mach-imx/common.h
175 +@@ -109,17 +109,17 @@ void imx_cpu_die(unsigned int cpu);
176 + int imx_cpu_kill(unsigned int cpu);
177 +
178 + #ifdef CONFIG_SUSPEND
179 +-void v7_cpu_resume(void);
180 + void imx53_suspend(void __iomem *ocram_vbase);
181 + extern const u32 imx53_suspend_sz;
182 + void imx6_suspend(void __iomem *ocram_vbase);
183 + #else
184 +-static inline void v7_cpu_resume(void) {}
185 + static inline void imx53_suspend(void __iomem *ocram_vbase) {}
186 + static const u32 imx53_suspend_sz;
187 + static inline void imx6_suspend(void __iomem *ocram_vbase) {}
188 + #endif
189 +
190 ++void v7_cpu_resume(void);
191 ++
192 + void imx6_pm_ccm_init(const char *ccm_compat);
193 + void imx6q_pm_init(void);
194 + void imx6dl_pm_init(void);
195 +diff --git a/arch/arm/mach-imx/resume-imx6.S b/arch/arm/mach-imx/resume-imx6.S
196 +new file mode 100644
197 +index 000000000000..5bd1ba7ef15b
198 +--- /dev/null
199 ++++ b/arch/arm/mach-imx/resume-imx6.S
200 +@@ -0,0 +1,24 @@
201 ++/* SPDX-License-Identifier: GPL-2.0-or-later */
202 ++/*
203 ++ * Copyright 2014 Freescale Semiconductor, Inc.
204 ++ */
205 ++
206 ++#include <linux/linkage.h>
207 ++#include <asm/assembler.h>
208 ++#include <asm/asm-offsets.h>
209 ++#include <asm/hardware/cache-l2x0.h>
210 ++#include "hardware.h"
211 ++
212 ++/*
213 ++ * The following code must assume it is running from physical address
214 ++ * where absolute virtual addresses to the data section have to be
215 ++ * turned into relative ones.
216 ++ */
217 ++
218 ++ENTRY(v7_cpu_resume)
219 ++ bl v7_invalidate_l1
220 ++#ifdef CONFIG_CACHE_L2X0
221 ++ bl l2c310_early_resume
222 ++#endif
223 ++ b cpu_resume
224 ++ENDPROC(v7_cpu_resume)
225 +diff --git a/arch/arm/mach-imx/suspend-imx6.S b/arch/arm/mach-imx/suspend-imx6.S
226 +index 062391ff13da..1eabf2d2834b 100644
227 +--- a/arch/arm/mach-imx/suspend-imx6.S
228 ++++ b/arch/arm/mach-imx/suspend-imx6.S
229 +@@ -327,17 +327,3 @@ resume:
230 +
231 + ret lr
232 + ENDPROC(imx6_suspend)
233 +-
234 +-/*
235 +- * The following code must assume it is running from physical address
236 +- * where absolute virtual addresses to the data section have to be
237 +- * turned into relative ones.
238 +- */
239 +-
240 +-ENTRY(v7_cpu_resume)
241 +- bl v7_invalidate_l1
242 +-#ifdef CONFIG_CACHE_L2X0
243 +- bl l2c310_early_resume
244 +-#endif
245 +- b cpu_resume
246 +-ENDPROC(v7_cpu_resume)
247 +diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts
248 +index 4d67eb715b91..3f43716d5c45 100644
249 +--- a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts
250 ++++ b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts
251 +@@ -327,7 +327,7 @@
252 + #size-cells = <0>;
253 +
254 + bus-width = <4>;
255 +- max-frequency = <50000000>;
256 ++ max-frequency = <60000000>;
257 +
258 + non-removable;
259 + disable-wp;
260 +diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-sei610.dts b/arch/arm64/boot/dts/amlogic/meson-sm1-sei610.dts
261 +index 5d6a8dafe8dc..29ac78ddc057 100644
262 +--- a/arch/arm64/boot/dts/amlogic/meson-sm1-sei610.dts
263 ++++ b/arch/arm64/boot/dts/amlogic/meson-sm1-sei610.dts
264 +@@ -363,6 +363,7 @@
265 + compatible = "brcm,bcm43438-bt";
266 + interrupt-parent = <&gpio_intc>;
267 + interrupts = <95 IRQ_TYPE_LEVEL_HIGH>;
268 ++ interrupt-names = "host-wakeup";
269 + shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>;
270 + max-speed = <2000000>;
271 + clocks = <&wifi32k>;
272 +diff --git a/arch/arm64/boot/dts/freescale/imx8qxp-mek.dts b/arch/arm64/boot/dts/freescale/imx8qxp-mek.dts
273 +index 19468058e6ae..8148196902dd 100644
274 +--- a/arch/arm64/boot/dts/freescale/imx8qxp-mek.dts
275 ++++ b/arch/arm64/boot/dts/freescale/imx8qxp-mek.dts
276 +@@ -52,11 +52,6 @@
277 + compatible = "ethernet-phy-ieee802.3-c22";
278 + reg = <0>;
279 + };
280 +-
281 +- ethphy1: ethernet-phy@1 {
282 +- compatible = "ethernet-phy-ieee802.3-c22";
283 +- reg = <1>;
284 +- };
285 + };
286 + };
287 +
288 +diff --git a/arch/arm64/boot/dts/intel/socfpga_agilex.dtsi b/arch/arm64/boot/dts/intel/socfpga_agilex.dtsi
289 +index d2cb28da3fff..d911d38877e5 100644
290 +--- a/arch/arm64/boot/dts/intel/socfpga_agilex.dtsi
291 ++++ b/arch/arm64/boot/dts/intel/socfpga_agilex.dtsi
292 +@@ -82,7 +82,7 @@
293 + ranges = <0 0 0 0xffffffff>;
294 +
295 + gmac0: ethernet@ff800000 {
296 +- compatible = "altr,socfpga-stmmac", "snps,dwmac-3.74a", "snps,dwmac";
297 ++ compatible = "altr,socfpga-stmmac-a10-s10", "snps,dwmac-3.74a", "snps,dwmac";
298 + reg = <0xff800000 0x2000>;
299 + interrupts = <0 90 4>;
300 + interrupt-names = "macirq";
301 +@@ -97,7 +97,7 @@
302 + };
303 +
304 + gmac1: ethernet@ff802000 {
305 +- compatible = "altr,socfpga-stmmac", "snps,dwmac-3.74a", "snps,dwmac";
306 ++ compatible = "altr,socfpga-stmmac-a10-s10", "snps,dwmac-3.74a", "snps,dwmac";
307 + reg = <0xff802000 0x2000>;
308 + interrupts = <0 91 4>;
309 + interrupt-names = "macirq";
310 +@@ -112,7 +112,7 @@
311 + };
312 +
313 + gmac2: ethernet@ff804000 {
314 +- compatible = "altr,socfpga-stmmac", "snps,dwmac-3.74a", "snps,dwmac";
315 ++ compatible = "altr,socfpga-stmmac-a10-s10", "snps,dwmac-3.74a", "snps,dwmac";
316 + reg = <0xff804000 0x2000>;
317 + interrupts = <0 92 4>;
318 + interrupt-names = "macirq";
319 +diff --git a/arch/csky/Kconfig b/arch/csky/Kconfig
320 +index 3973847b5f42..48b2e1b59119 100644
321 +--- a/arch/csky/Kconfig
322 ++++ b/arch/csky/Kconfig
323 +@@ -36,6 +36,7 @@ config CSKY
324 + select GX6605S_TIMER if CPU_CK610
325 + select HAVE_ARCH_TRACEHOOK
326 + select HAVE_ARCH_AUDITSYSCALL
327 ++ select HAVE_COPY_THREAD_TLS
328 + select HAVE_DYNAMIC_FTRACE
329 + select HAVE_FUNCTION_TRACER
330 + select HAVE_FUNCTION_GRAPH_TRACER
331 +@@ -74,7 +75,7 @@ config CPU_HAS_TLBI
332 + config CPU_HAS_LDSTEX
333 + bool
334 + help
335 +- For SMP, CPU needs "ldex&stex" instrcutions to atomic operations.
336 ++ For SMP, CPU needs "ldex&stex" instructions for atomic operations.
337 +
338 + config CPU_NEED_TLBSYNC
339 + bool
340 +diff --git a/arch/csky/abiv1/inc/abi/entry.h b/arch/csky/abiv1/inc/abi/entry.h
341 +index 7ab78bd0f3b1..f35a9f3315ee 100644
342 +--- a/arch/csky/abiv1/inc/abi/entry.h
343 ++++ b/arch/csky/abiv1/inc/abi/entry.h
344 +@@ -16,14 +16,16 @@
345 + #define LSAVE_A4 40
346 + #define LSAVE_A5 44
347 +
348 ++#define usp ss1
349 ++
350 + .macro USPTOKSP
351 +- mtcr sp, ss1
352 ++ mtcr sp, usp
353 + mfcr sp, ss0
354 + .endm
355 +
356 + .macro KSPTOUSP
357 + mtcr sp, ss0
358 +- mfcr sp, ss1
359 ++ mfcr sp, usp
360 + .endm
361 +
362 + .macro SAVE_ALL epc_inc
363 +@@ -45,7 +47,13 @@
364 + add lr, r13
365 + stw lr, (sp, 8)
366 +
367 ++ mov lr, sp
368 ++ addi lr, 32
369 ++ addi lr, 32
370 ++ addi lr, 16
371 ++ bt 2f
372 + mfcr lr, ss1
373 ++2:
374 + stw lr, (sp, 16)
375 +
376 + stw a0, (sp, 20)
377 +@@ -79,9 +87,10 @@
378 + ldw a0, (sp, 12)
379 + mtcr a0, epsr
380 + btsti a0, 31
381 ++ bt 1f
382 + ldw a0, (sp, 16)
383 + mtcr a0, ss1
384 +-
385 ++1:
386 + ldw a0, (sp, 24)
387 + ldw a1, (sp, 28)
388 + ldw a2, (sp, 32)
389 +@@ -102,9 +111,9 @@
390 + addi sp, 32
391 + addi sp, 8
392 +
393 +- bt 1f
394 ++ bt 2f
395 + KSPTOUSP
396 +-1:
397 ++2:
398 + rte
399 + .endm
400 +
401 +diff --git a/arch/csky/abiv2/inc/abi/entry.h b/arch/csky/abiv2/inc/abi/entry.h
402 +index 9897a16b45e5..94a7a58765df 100644
403 +--- a/arch/csky/abiv2/inc/abi/entry.h
404 ++++ b/arch/csky/abiv2/inc/abi/entry.h
405 +@@ -31,7 +31,13 @@
406 +
407 + mfcr lr, epsr
408 + stw lr, (sp, 12)
409 ++ btsti lr, 31
410 ++ bf 1f
411 ++ addi lr, sp, 152
412 ++ br 2f
413 ++1:
414 + mfcr lr, usp
415 ++2:
416 + stw lr, (sp, 16)
417 +
418 + stw a0, (sp, 20)
419 +@@ -64,8 +70,10 @@
420 + mtcr a0, epc
421 + ldw a0, (sp, 12)
422 + mtcr a0, epsr
423 ++ btsti a0, 31
424 + ldw a0, (sp, 16)
425 + mtcr a0, usp
426 ++ mtcr a0, ss0
427 +
428 + #ifdef CONFIG_CPU_HAS_HILO
429 + ldw a0, (sp, 140)
430 +@@ -86,6 +94,9 @@
431 + addi sp, 40
432 + ldm r16-r30, (sp)
433 + addi sp, 72
434 ++ bf 1f
435 ++ mfcr sp, ss0
436 ++1:
437 + rte
438 + .endm
439 +
440 +diff --git a/arch/csky/include/uapi/asm/unistd.h b/arch/csky/include/uapi/asm/unistd.h
441 +index 211c983c7282..ba4018929733 100644
442 +--- a/arch/csky/include/uapi/asm/unistd.h
443 ++++ b/arch/csky/include/uapi/asm/unistd.h
444 +@@ -1,7 +1,10 @@
445 + /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
446 + // Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
447 +
448 ++#define __ARCH_WANT_STAT64
449 ++#define __ARCH_WANT_NEW_STAT
450 + #define __ARCH_WANT_SYS_CLONE
451 ++#define __ARCH_WANT_SYS_CLONE3
452 + #define __ARCH_WANT_SET_GET_RLIMIT
453 + #define __ARCH_WANT_TIME32_SYSCALLS
454 + #include <asm-generic/unistd.h>
455 +diff --git a/arch/csky/kernel/atomic.S b/arch/csky/kernel/atomic.S
456 +index 5b84f11485ae..3821ef9b7567 100644
457 +--- a/arch/csky/kernel/atomic.S
458 ++++ b/arch/csky/kernel/atomic.S
459 +@@ -17,10 +17,12 @@ ENTRY(csky_cmpxchg)
460 + mfcr a3, epc
461 + addi a3, TRAP0_SIZE
462 +
463 +- subi sp, 8
464 ++ subi sp, 16
465 + stw a3, (sp, 0)
466 + mfcr a3, epsr
467 + stw a3, (sp, 4)
468 ++ mfcr a3, usp
469 ++ stw a3, (sp, 8)
470 +
471 + psrset ee
472 + #ifdef CONFIG_CPU_HAS_LDSTEX
473 +@@ -47,7 +49,9 @@ ENTRY(csky_cmpxchg)
474 + mtcr a3, epc
475 + ldw a3, (sp, 4)
476 + mtcr a3, epsr
477 +- addi sp, 8
478 ++ ldw a3, (sp, 8)
479 ++ mtcr a3, usp
480 ++ addi sp, 16
481 + KSPTOUSP
482 + rte
483 + END(csky_cmpxchg)
484 +diff --git a/arch/csky/kernel/process.c b/arch/csky/kernel/process.c
485 +index f320d9248a22..397962e11bd1 100644
486 +--- a/arch/csky/kernel/process.c
487 ++++ b/arch/csky/kernel/process.c
488 +@@ -34,10 +34,11 @@ unsigned long thread_saved_pc(struct task_struct *tsk)
489 + return sw->r15;
490 + }
491 +
492 +-int copy_thread(unsigned long clone_flags,
493 ++int copy_thread_tls(unsigned long clone_flags,
494 + unsigned long usp,
495 + unsigned long kthread_arg,
496 +- struct task_struct *p)
497 ++ struct task_struct *p,
498 ++ unsigned long tls)
499 + {
500 + struct switch_stack *childstack;
501 + struct pt_regs *childregs = task_pt_regs(p);
502 +@@ -64,7 +65,7 @@ int copy_thread(unsigned long clone_flags,
503 + childregs->usp = usp;
504 + if (clone_flags & CLONE_SETTLS)
505 + task_thread_info(p)->tp_value = childregs->tls
506 +- = childregs->regs[0];
507 ++ = tls;
508 +
509 + childregs->a0 = 0;
510 + childstack->r15 = (unsigned long) ret_from_fork;
511 +diff --git a/arch/csky/kernel/smp.c b/arch/csky/kernel/smp.c
512 +index b753d382e4ce..0bb0954d5570 100644
513 +--- a/arch/csky/kernel/smp.c
514 ++++ b/arch/csky/kernel/smp.c
515 +@@ -120,7 +120,7 @@ void __init setup_smp_ipi(void)
516 + int rc;
517 +
518 + if (ipi_irq == 0)
519 +- panic("%s IRQ mapping failed\n", __func__);
520 ++ return;
521 +
522 + rc = request_percpu_irq(ipi_irq, handle_ipi, "IPI Interrupt",
523 + &ipi_dummy_dev);
524 +diff --git a/arch/csky/mm/Makefile b/arch/csky/mm/Makefile
525 +index c94ef6481098..efb7ebab342b 100644
526 +--- a/arch/csky/mm/Makefile
527 ++++ b/arch/csky/mm/Makefile
528 +@@ -1,8 +1,10 @@
529 + # SPDX-License-Identifier: GPL-2.0-only
530 + ifeq ($(CONFIG_CPU_HAS_CACHEV2),y)
531 + obj-y += cachev2.o
532 ++CFLAGS_REMOVE_cachev2.o = $(CC_FLAGS_FTRACE)
533 + else
534 + obj-y += cachev1.o
535 ++CFLAGS_REMOVE_cachev1.o = $(CC_FLAGS_FTRACE)
536 + endif
537 +
538 + obj-y += dma-mapping.o
539 +diff --git a/arch/csky/mm/init.c b/arch/csky/mm/init.c
540 +index d4c2292ea46b..00e96278b377 100644
541 +--- a/arch/csky/mm/init.c
542 ++++ b/arch/csky/mm/init.c
543 +@@ -31,6 +31,7 @@
544 +
545 + pgd_t swapper_pg_dir[PTRS_PER_PGD] __page_aligned_bss;
546 + pte_t invalid_pte_table[PTRS_PER_PTE] __page_aligned_bss;
547 ++EXPORT_SYMBOL(invalid_pte_table);
548 + unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]
549 + __page_aligned_bss;
550 + EXPORT_SYMBOL(empty_zero_page);
551 +diff --git a/arch/powerpc/include/asm/cache.h b/arch/powerpc/include/asm/cache.h
552 +index 45e3137ccd71..72b81015cebe 100644
553 +--- a/arch/powerpc/include/asm/cache.h
554 ++++ b/arch/powerpc/include/asm/cache.h
555 +@@ -55,42 +55,48 @@ struct ppc64_caches {
556 +
557 + extern struct ppc64_caches ppc64_caches;
558 +
559 +-static inline u32 l1_cache_shift(void)
560 ++static inline u32 l1_dcache_shift(void)
561 + {
562 + return ppc64_caches.l1d.log_block_size;
563 + }
564 +
565 +-static inline u32 l1_cache_bytes(void)
566 ++static inline u32 l1_dcache_bytes(void)
567 + {
568 + return ppc64_caches.l1d.block_size;
569 + }
570 ++
571 ++static inline u32 l1_icache_shift(void)
572 ++{
573 ++ return ppc64_caches.l1i.log_block_size;
574 ++}
575 ++
576 ++static inline u32 l1_icache_bytes(void)
577 ++{
578 ++ return ppc64_caches.l1i.block_size;
579 ++}
580 + #else
581 +-static inline u32 l1_cache_shift(void)
582 ++static inline u32 l1_dcache_shift(void)
583 + {
584 + return L1_CACHE_SHIFT;
585 + }
586 +
587 +-static inline u32 l1_cache_bytes(void)
588 ++static inline u32 l1_dcache_bytes(void)
589 + {
590 + return L1_CACHE_BYTES;
591 + }
592 ++
593 ++static inline u32 l1_icache_shift(void)
594 ++{
595 ++ return L1_CACHE_SHIFT;
596 ++}
597 ++
598 ++static inline u32 l1_icache_bytes(void)
599 ++{
600 ++ return L1_CACHE_BYTES;
601 ++}
602 ++
603 + #endif
604 +-#endif /* ! __ASSEMBLY__ */
605 +-
606 +-#if defined(__ASSEMBLY__)
607 +-/*
608 +- * For a snooping icache, we still need a dummy icbi to purge all the
609 +- * prefetched instructions from the ifetch buffers. We also need a sync
610 +- * before the icbi to order the the actual stores to memory that might
611 +- * have modified instructions with the icbi.
612 +- */
613 +-#define PURGE_PREFETCHED_INS \
614 +- sync; \
615 +- icbi 0,r3; \
616 +- sync; \
617 +- isync
618 +
619 +-#else
620 + #define __read_mostly __attribute__((__section__(".data..read_mostly")))
621 +
622 + #ifdef CONFIG_PPC_BOOK3S_32
623 +@@ -124,6 +130,17 @@ static inline void dcbst(void *addr)
624 + {
625 + __asm__ __volatile__ ("dcbst 0, %0" : : "r"(addr) : "memory");
626 + }
627 ++
628 ++static inline void icbi(void *addr)
629 ++{
630 ++ asm volatile ("icbi 0, %0" : : "r"(addr) : "memory");
631 ++}
632 ++
633 ++static inline void iccci(void *addr)
634 ++{
635 ++ asm volatile ("iccci 0, %0" : : "r"(addr) : "memory");
636 ++}
637 ++
638 + #endif /* !__ASSEMBLY__ */
639 + #endif /* __KERNEL__ */
640 + #endif /* _ASM_POWERPC_CACHE_H */
641 +diff --git a/arch/powerpc/include/asm/cacheflush.h b/arch/powerpc/include/asm/cacheflush.h
642 +index eef388f2659f..4a1c9f0200e1 100644
643 +--- a/arch/powerpc/include/asm/cacheflush.h
644 ++++ b/arch/powerpc/include/asm/cacheflush.h
645 +@@ -42,29 +42,25 @@ extern void flush_dcache_page(struct page *page);
646 + #define flush_dcache_mmap_lock(mapping) do { } while (0)
647 + #define flush_dcache_mmap_unlock(mapping) do { } while (0)
648 +
649 +-extern void flush_icache_range(unsigned long, unsigned long);
650 ++void flush_icache_range(unsigned long start, unsigned long stop);
651 + extern void flush_icache_user_range(struct vm_area_struct *vma,
652 + struct page *page, unsigned long addr,
653 + int len);
654 +-extern void __flush_dcache_icache(void *page_va);
655 + extern void flush_dcache_icache_page(struct page *page);
656 +-#if defined(CONFIG_PPC32) && !defined(CONFIG_BOOKE)
657 +-extern void __flush_dcache_icache_phys(unsigned long physaddr);
658 +-#else
659 +-static inline void __flush_dcache_icache_phys(unsigned long physaddr)
660 +-{
661 +- BUG();
662 +-}
663 +-#endif
664 +-
665 +-/*
666 +- * Write any modified data cache blocks out to memory and invalidate them.
667 +- * Does not invalidate the corresponding instruction cache blocks.
668 ++void __flush_dcache_icache(void *page);
669 ++
670 ++/**
671 ++ * flush_dcache_range(): Write any modified data cache blocks out to memory and
672 ++ * invalidate them. Does not invalidate the corresponding instruction cache
673 ++ * blocks.
674 ++ *
675 ++ * @start: the start address
676 ++ * @stop: the stop address (exclusive)
677 + */
678 + static inline void flush_dcache_range(unsigned long start, unsigned long stop)
679 + {
680 +- unsigned long shift = l1_cache_shift();
681 +- unsigned long bytes = l1_cache_bytes();
682 ++ unsigned long shift = l1_dcache_shift();
683 ++ unsigned long bytes = l1_dcache_bytes();
684 + void *addr = (void *)(start & ~(bytes - 1));
685 + unsigned long size = stop - (unsigned long)addr + (bytes - 1);
686 + unsigned long i;
687 +@@ -89,8 +85,8 @@ static inline void flush_dcache_range(unsigned long start, unsigned long stop)
688 + */
689 + static inline void clean_dcache_range(unsigned long start, unsigned long stop)
690 + {
691 +- unsigned long shift = l1_cache_shift();
692 +- unsigned long bytes = l1_cache_bytes();
693 ++ unsigned long shift = l1_dcache_shift();
694 ++ unsigned long bytes = l1_dcache_bytes();
695 + void *addr = (void *)(start & ~(bytes - 1));
696 + unsigned long size = stop - (unsigned long)addr + (bytes - 1);
697 + unsigned long i;
698 +@@ -108,8 +104,8 @@ static inline void clean_dcache_range(unsigned long start, unsigned long stop)
699 + static inline void invalidate_dcache_range(unsigned long start,
700 + unsigned long stop)
701 + {
702 +- unsigned long shift = l1_cache_shift();
703 +- unsigned long bytes = l1_cache_bytes();
704 ++ unsigned long shift = l1_dcache_shift();
705 ++ unsigned long bytes = l1_dcache_bytes();
706 + void *addr = (void *)(start & ~(bytes - 1));
707 + unsigned long size = stop - (unsigned long)addr + (bytes - 1);
708 + unsigned long i;
709 +diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
710 +index e745abc5457a..245be4fafe13 100644
711 +--- a/arch/powerpc/kernel/cputable.c
712 ++++ b/arch/powerpc/kernel/cputable.c
713 +@@ -2193,11 +2193,13 @@ static struct cpu_spec * __init setup_cpu_spec(unsigned long offset,
714 + * oprofile_cpu_type already has a value, then we are
715 + * possibly overriding a real PVR with a logical one,
716 + * and, in that case, keep the current value for
717 +- * oprofile_cpu_type.
718 ++ * oprofile_cpu_type. Futhermore, let's ensure that the
719 ++ * fix for the PMAO bug is enabled on compatibility mode.
720 + */
721 + if (old.oprofile_cpu_type != NULL) {
722 + t->oprofile_cpu_type = old.oprofile_cpu_type;
723 + t->oprofile_type = old.oprofile_type;
724 ++ t->cpu_features |= old.cpu_features & CPU_FTR_PMAO_BUG;
725 + }
726 + }
727 +
728 +diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S
729 +index 82df4b09e79f..f4e4a1926a7a 100644
730 +--- a/arch/powerpc/kernel/misc_32.S
731 ++++ b/arch/powerpc/kernel/misc_32.S
732 +@@ -316,126 +316,6 @@ _GLOBAL(flush_instruction_cache)
733 + EXPORT_SYMBOL(flush_instruction_cache)
734 + #endif /* CONFIG_PPC_8xx */
735 +
736 +-/*
737 +- * Write any modified data cache blocks out to memory
738 +- * and invalidate the corresponding instruction cache blocks.
739 +- * This is a no-op on the 601.
740 +- *
741 +- * flush_icache_range(unsigned long start, unsigned long stop)
742 +- */
743 +-_GLOBAL(flush_icache_range)
744 +-#if defined(CONFIG_PPC_BOOK3S_601) || defined(CONFIG_E200)
745 +- PURGE_PREFETCHED_INS
746 +- blr /* for 601 and e200, do nothing */
747 +-#else
748 +- rlwinm r3,r3,0,0,31 - L1_CACHE_SHIFT
749 +- subf r4,r3,r4
750 +- addi r4,r4,L1_CACHE_BYTES - 1
751 +- srwi. r4,r4,L1_CACHE_SHIFT
752 +- beqlr
753 +- mtctr r4
754 +- mr r6,r3
755 +-1: dcbst 0,r3
756 +- addi r3,r3,L1_CACHE_BYTES
757 +- bdnz 1b
758 +- sync /* wait for dcbst's to get to ram */
759 +-#ifndef CONFIG_44x
760 +- mtctr r4
761 +-2: icbi 0,r6
762 +- addi r6,r6,L1_CACHE_BYTES
763 +- bdnz 2b
764 +-#else
765 +- /* Flash invalidate on 44x because we are passed kmapped addresses and
766 +- this doesn't work for userspace pages due to the virtually tagged
767 +- icache. Sigh. */
768 +- iccci 0, r0
769 +-#endif
770 +- sync /* additional sync needed on g4 */
771 +- isync
772 +- blr
773 +-#endif
774 +-_ASM_NOKPROBE_SYMBOL(flush_icache_range)
775 +-EXPORT_SYMBOL(flush_icache_range)
776 +-
777 +-/*
778 +- * Flush a particular page from the data cache to RAM.
779 +- * Note: this is necessary because the instruction cache does *not*
780 +- * snoop from the data cache.
781 +- * This is a no-op on the 601 and e200 which have a unified cache.
782 +- *
783 +- * void __flush_dcache_icache(void *page)
784 +- */
785 +-_GLOBAL(__flush_dcache_icache)
786 +-#if defined(CONFIG_PPC_BOOK3S_601) || defined(CONFIG_E200)
787 +- PURGE_PREFETCHED_INS
788 +- blr
789 +-#else
790 +- rlwinm r3,r3,0,0,31-PAGE_SHIFT /* Get page base address */
791 +- li r4,PAGE_SIZE/L1_CACHE_BYTES /* Number of lines in a page */
792 +- mtctr r4
793 +- mr r6,r3
794 +-0: dcbst 0,r3 /* Write line to ram */
795 +- addi r3,r3,L1_CACHE_BYTES
796 +- bdnz 0b
797 +- sync
798 +-#ifdef CONFIG_44x
799 +- /* We don't flush the icache on 44x. Those have a virtual icache
800 +- * and we don't have access to the virtual address here (it's
801 +- * not the page vaddr but where it's mapped in user space). The
802 +- * flushing of the icache on these is handled elsewhere, when
803 +- * a change in the address space occurs, before returning to
804 +- * user space
805 +- */
806 +-BEGIN_MMU_FTR_SECTION
807 +- blr
808 +-END_MMU_FTR_SECTION_IFSET(MMU_FTR_TYPE_44x)
809 +-#endif /* CONFIG_44x */
810 +- mtctr r4
811 +-1: icbi 0,r6
812 +- addi r6,r6,L1_CACHE_BYTES
813 +- bdnz 1b
814 +- sync
815 +- isync
816 +- blr
817 +-#endif
818 +-
819 +-#ifndef CONFIG_BOOKE
820 +-/*
821 +- * Flush a particular page from the data cache to RAM, identified
822 +- * by its physical address. We turn off the MMU so we can just use
823 +- * the physical address (this may be a highmem page without a kernel
824 +- * mapping).
825 +- *
826 +- * void __flush_dcache_icache_phys(unsigned long physaddr)
827 +- */
828 +-_GLOBAL(__flush_dcache_icache_phys)
829 +-#if defined(CONFIG_PPC_BOOK3S_601) || defined(CONFIG_E200)
830 +- PURGE_PREFETCHED_INS
831 +- blr /* for 601 and e200, do nothing */
832 +-#else
833 +- mfmsr r10
834 +- rlwinm r0,r10,0,28,26 /* clear DR */
835 +- mtmsr r0
836 +- isync
837 +- rlwinm r3,r3,0,0,31-PAGE_SHIFT /* Get page base address */
838 +- li r4,PAGE_SIZE/L1_CACHE_BYTES /* Number of lines in a page */
839 +- mtctr r4
840 +- mr r6,r3
841 +-0: dcbst 0,r3 /* Write line to ram */
842 +- addi r3,r3,L1_CACHE_BYTES
843 +- bdnz 0b
844 +- sync
845 +- mtctr r4
846 +-1: icbi 0,r6
847 +- addi r6,r6,L1_CACHE_BYTES
848 +- bdnz 1b
849 +- sync
850 +- mtmsr r10 /* restore DR */
851 +- isync
852 +- blr
853 +-#endif
854 +-#endif /* CONFIG_BOOKE */
855 +-
856 + /*
857 + * Copy a whole page. We use the dcbz instruction on the destination
858 + * to reduce memory traffic (it eliminates the unnecessary reads of
859 +diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S
860 +index 9bc0aa9aeb65..ff20c253f273 100644
861 +--- a/arch/powerpc/kernel/misc_64.S
862 ++++ b/arch/powerpc/kernel/misc_64.S
863 +@@ -49,108 +49,6 @@ _GLOBAL(call_do_irq)
864 + mtlr r0
865 + blr
866 +
867 +- .section ".toc","aw"
868 +-PPC64_CACHES:
869 +- .tc ppc64_caches[TC],ppc64_caches
870 +- .section ".text"
871 +-
872 +-/*
873 +- * Write any modified data cache blocks out to memory
874 +- * and invalidate the corresponding instruction cache blocks.
875 +- *
876 +- * flush_icache_range(unsigned long start, unsigned long stop)
877 +- *
878 +- * flush all bytes from start through stop-1 inclusive
879 +- */
880 +-
881 +-_GLOBAL_TOC(flush_icache_range)
882 +-BEGIN_FTR_SECTION
883 +- PURGE_PREFETCHED_INS
884 +- blr
885 +-END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE)
886 +-/*
887 +- * Flush the data cache to memory
888 +- *
889 +- * Different systems have different cache line sizes
890 +- * and in some cases i-cache and d-cache line sizes differ from
891 +- * each other.
892 +- */
893 +- ld r10,PPC64_CACHES@toc(r2)
894 +- lwz r7,DCACHEL1BLOCKSIZE(r10)/* Get cache block size */
895 +- addi r5,r7,-1
896 +- andc r6,r3,r5 /* round low to line bdy */
897 +- subf r8,r6,r4 /* compute length */
898 +- add r8,r8,r5 /* ensure we get enough */
899 +- lwz r9,DCACHEL1LOGBLOCKSIZE(r10) /* Get log-2 of cache block size */
900 +- srd. r8,r8,r9 /* compute line count */
901 +- beqlr /* nothing to do? */
902 +- mtctr r8
903 +-1: dcbst 0,r6
904 +- add r6,r6,r7
905 +- bdnz 1b
906 +- sync
907 +-
908 +-/* Now invalidate the instruction cache */
909 +-
910 +- lwz r7,ICACHEL1BLOCKSIZE(r10) /* Get Icache block size */
911 +- addi r5,r7,-1
912 +- andc r6,r3,r5 /* round low to line bdy */
913 +- subf r8,r6,r4 /* compute length */
914 +- add r8,r8,r5
915 +- lwz r9,ICACHEL1LOGBLOCKSIZE(r10) /* Get log-2 of Icache block size */
916 +- srd. r8,r8,r9 /* compute line count */
917 +- beqlr /* nothing to do? */
918 +- mtctr r8
919 +-2: icbi 0,r6
920 +- add r6,r6,r7
921 +- bdnz 2b
922 +- isync
923 +- blr
924 +-_ASM_NOKPROBE_SYMBOL(flush_icache_range)
925 +-EXPORT_SYMBOL(flush_icache_range)
926 +-
927 +-/*
928 +- * Flush a particular page from the data cache to RAM.
929 +- * Note: this is necessary because the instruction cache does *not*
930 +- * snoop from the data cache.
931 +- *
932 +- * void __flush_dcache_icache(void *page)
933 +- */
934 +-_GLOBAL(__flush_dcache_icache)
935 +-/*
936 +- * Flush the data cache to memory
937 +- *
938 +- * Different systems have different cache line sizes
939 +- */
940 +-
941 +-BEGIN_FTR_SECTION
942 +- PURGE_PREFETCHED_INS
943 +- blr
944 +-END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE)
945 +-
946 +-/* Flush the dcache */
947 +- ld r7,PPC64_CACHES@toc(r2)
948 +- clrrdi r3,r3,PAGE_SHIFT /* Page align */
949 +- lwz r4,DCACHEL1BLOCKSPERPAGE(r7) /* Get # dcache blocks per page */
950 +- lwz r5,DCACHEL1BLOCKSIZE(r7) /* Get dcache block size */
951 +- mr r6,r3
952 +- mtctr r4
953 +-0: dcbst 0,r6
954 +- add r6,r6,r5
955 +- bdnz 0b
956 +- sync
957 +-
958 +-/* Now invalidate the icache */
959 +-
960 +- lwz r4,ICACHEL1BLOCKSPERPAGE(r7) /* Get # icache blocks per page */
961 +- lwz r5,ICACHEL1BLOCKSIZE(r7) /* Get icache block size */
962 +- mtctr r4
963 +-1: icbi 0,r3
964 +- add r3,r3,r5
965 +- bdnz 1b
966 +- isync
967 +- blr
968 +-
969 + _GLOBAL(__bswapdi2)
970 + EXPORT_SYMBOL(__bswapdi2)
971 + srdi r8,r3,32
972 +diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
973 +index 9f5b32163bda..96ca90ce0264 100644
974 +--- a/arch/powerpc/mm/mem.c
975 ++++ b/arch/powerpc/mm/mem.c
976 +@@ -348,6 +348,122 @@ void free_initmem(void)
977 + free_initmem_default(POISON_FREE_INITMEM);
978 + }
979 +
980 ++/**
981 ++ * flush_coherent_icache() - if a CPU has a coherent icache, flush it
982 ++ * @addr: The base address to use (can be any valid address, the whole cache will be flushed)
983 ++ * Return true if the cache was flushed, false otherwise
984 ++ */
985 ++static inline bool flush_coherent_icache(unsigned long addr)
986 ++{
987 ++ /*
988 ++ * For a snooping icache, we still need a dummy icbi to purge all the
989 ++ * prefetched instructions from the ifetch buffers. We also need a sync
990 ++ * before the icbi to order the the actual stores to memory that might
991 ++ * have modified instructions with the icbi.
992 ++ */
993 ++ if (cpu_has_feature(CPU_FTR_COHERENT_ICACHE)) {
994 ++ mb(); /* sync */
995 ++ allow_read_from_user((const void __user *)addr, L1_CACHE_BYTES);
996 ++ icbi((void *)addr);
997 ++ prevent_read_from_user((const void __user *)addr, L1_CACHE_BYTES);
998 ++ mb(); /* sync */
999 ++ isync();
1000 ++ return true;
1001 ++ }
1002 ++
1003 ++ return false;
1004 ++}
1005 ++
1006 ++/**
1007 ++ * invalidate_icache_range() - Flush the icache by issuing icbi across an address range
1008 ++ * @start: the start address
1009 ++ * @stop: the stop address (exclusive)
1010 ++ */
1011 ++static void invalidate_icache_range(unsigned long start, unsigned long stop)
1012 ++{
1013 ++ unsigned long shift = l1_icache_shift();
1014 ++ unsigned long bytes = l1_icache_bytes();
1015 ++ char *addr = (char *)(start & ~(bytes - 1));
1016 ++ unsigned long size = stop - (unsigned long)addr + (bytes - 1);
1017 ++ unsigned long i;
1018 ++
1019 ++ for (i = 0; i < size >> shift; i++, addr += bytes)
1020 ++ icbi(addr);
1021 ++
1022 ++ mb(); /* sync */
1023 ++ isync();
1024 ++}
1025 ++
1026 ++/**
1027 ++ * flush_icache_range: Write any modified data cache blocks out to memory
1028 ++ * and invalidate the corresponding blocks in the instruction cache
1029 ++ *
1030 ++ * Generic code will call this after writing memory, before executing from it.
1031 ++ *
1032 ++ * @start: the start address
1033 ++ * @stop: the stop address (exclusive)
1034 ++ */
1035 ++void flush_icache_range(unsigned long start, unsigned long stop)
1036 ++{
1037 ++ if (flush_coherent_icache(start))
1038 ++ return;
1039 ++
1040 ++ clean_dcache_range(start, stop);
1041 ++
1042 ++ if (IS_ENABLED(CONFIG_44x)) {
1043 ++ /*
1044 ++ * Flash invalidate on 44x because we are passed kmapped
1045 ++ * addresses and this doesn't work for userspace pages due to
1046 ++ * the virtually tagged icache.
1047 ++ */
1048 ++ iccci((void *)start);
1049 ++ mb(); /* sync */
1050 ++ isync();
1051 ++ } else
1052 ++ invalidate_icache_range(start, stop);
1053 ++}
1054 ++EXPORT_SYMBOL(flush_icache_range);
1055 ++
1056 ++#if !defined(CONFIG_PPC_8xx) && !defined(CONFIG_PPC64)
1057 ++/**
1058 ++ * flush_dcache_icache_phys() - Flush a page by it's physical address
1059 ++ * @physaddr: the physical address of the page
1060 ++ */
1061 ++static void flush_dcache_icache_phys(unsigned long physaddr)
1062 ++{
1063 ++ unsigned long bytes = l1_dcache_bytes();
1064 ++ unsigned long nb = PAGE_SIZE / bytes;
1065 ++ unsigned long addr = physaddr & PAGE_MASK;
1066 ++ unsigned long msr, msr0;
1067 ++ unsigned long loop1 = addr, loop2 = addr;
1068 ++
1069 ++ msr0 = mfmsr();
1070 ++ msr = msr0 & ~MSR_DR;
1071 ++ /*
1072 ++ * This must remain as ASM to prevent potential memory accesses
1073 ++ * while the data MMU is disabled
1074 ++ */
1075 ++ asm volatile(
1076 ++ " mtctr %2;\n"
1077 ++ " mtmsr %3;\n"
1078 ++ " isync;\n"
1079 ++ "0: dcbst 0, %0;\n"
1080 ++ " addi %0, %0, %4;\n"
1081 ++ " bdnz 0b;\n"
1082 ++ " sync;\n"
1083 ++ " mtctr %2;\n"
1084 ++ "1: icbi 0, %1;\n"
1085 ++ " addi %1, %1, %4;\n"
1086 ++ " bdnz 1b;\n"
1087 ++ " sync;\n"
1088 ++ " mtmsr %5;\n"
1089 ++ " isync;\n"
1090 ++ : "+&r" (loop1), "+&r" (loop2)
1091 ++ : "r" (nb), "r" (msr), "i" (bytes), "r" (msr0)
1092 ++ : "ctr", "memory");
1093 ++}
1094 ++#endif // !defined(CONFIG_PPC_8xx) && !defined(CONFIG_PPC64)
1095 ++
1096 + /*
1097 + * This is called when a page has been modified by the kernel.
1098 + * It just marks the page as not i-cache clean. We do the i-cache
1099 +@@ -380,12 +496,46 @@ void flush_dcache_icache_page(struct page *page)
1100 + __flush_dcache_icache(start);
1101 + kunmap_atomic(start);
1102 + } else {
1103 +- __flush_dcache_icache_phys(page_to_pfn(page) << PAGE_SHIFT);
1104 ++ unsigned long addr = page_to_pfn(page) << PAGE_SHIFT;
1105 ++
1106 ++ if (flush_coherent_icache(addr))
1107 ++ return;
1108 ++ flush_dcache_icache_phys(addr);
1109 + }
1110 + #endif
1111 + }
1112 + EXPORT_SYMBOL(flush_dcache_icache_page);
1113 +
1114 ++/**
1115 ++ * __flush_dcache_icache(): Flush a particular page from the data cache to RAM.
1116 ++ * Note: this is necessary because the instruction cache does *not*
1117 ++ * snoop from the data cache.
1118 ++ *
1119 ++ * @page: the address of the page to flush
1120 ++ */
1121 ++void __flush_dcache_icache(void *p)
1122 ++{
1123 ++ unsigned long addr = (unsigned long)p;
1124 ++
1125 ++ if (flush_coherent_icache(addr))
1126 ++ return;
1127 ++
1128 ++ clean_dcache_range(addr, addr + PAGE_SIZE);
1129 ++
1130 ++ /*
1131 ++ * We don't flush the icache on 44x. Those have a virtual icache and we
1132 ++ * don't have access to the virtual address here (it's not the page
1133 ++ * vaddr but where it's mapped in user space). The flushing of the
1134 ++ * icache on these is handled elsewhere, when a change in the address
1135 ++ * space occurs, before returning to user space.
1136 ++ */
1137 ++
1138 ++ if (cpu_has_feature(MMU_FTR_TYPE_44x))
1139 ++ return;
1140 ++
1141 ++ invalidate_icache_range(addr, addr + PAGE_SIZE);
1142 ++}
1143 ++
1144 + void clear_user_page(void *page, unsigned long vaddr, struct page *pg)
1145 + {
1146 + clear_page(page);
1147 +diff --git a/arch/s390/Makefile b/arch/s390/Makefile
1148 +index 9ce1baeac2b2..2faaf456956a 100644
1149 +--- a/arch/s390/Makefile
1150 ++++ b/arch/s390/Makefile
1151 +@@ -146,7 +146,7 @@ all: bzImage
1152 + #KBUILD_IMAGE is necessary for packaging targets like rpm-pkg, deb-pkg...
1153 + KBUILD_IMAGE := $(boot)/bzImage
1154 +
1155 +-install: vmlinux
1156 ++install:
1157 + $(Q)$(MAKE) $(build)=$(boot) $@
1158 +
1159 + bzImage: vmlinux
1160 +diff --git a/arch/s390/boot/Makefile b/arch/s390/boot/Makefile
1161 +index e2c47d3a1c89..0ff9261c915e 100644
1162 +--- a/arch/s390/boot/Makefile
1163 ++++ b/arch/s390/boot/Makefile
1164 +@@ -70,7 +70,7 @@ $(obj)/compressed/vmlinux: $(obj)/startup.a FORCE
1165 + $(obj)/startup.a: $(OBJECTS) FORCE
1166 + $(call if_changed,ar)
1167 +
1168 +-install: $(CONFIGURE) $(obj)/bzImage
1169 ++install:
1170 + sh -x $(srctree)/$(obj)/install.sh $(KERNELRELEASE) $(obj)/bzImage \
1171 + System.map "$(INSTALL_PATH)"
1172 +
1173 +diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
1174 +index a9e46b83c536..34a655ad7123 100644
1175 +--- a/arch/s390/include/asm/pgtable.h
1176 ++++ b/arch/s390/include/asm/pgtable.h
1177 +@@ -756,6 +756,12 @@ static inline int pmd_write(pmd_t pmd)
1178 + return (pmd_val(pmd) & _SEGMENT_ENTRY_WRITE) != 0;
1179 + }
1180 +
1181 ++#define pud_write pud_write
1182 ++static inline int pud_write(pud_t pud)
1183 ++{
1184 ++ return (pud_val(pud) & _REGION3_ENTRY_WRITE) != 0;
1185 ++}
1186 ++
1187 + static inline int pmd_dirty(pmd_t pmd)
1188 + {
1189 + int dirty = 1;
1190 +diff --git a/arch/s390/include/asm/qdio.h b/arch/s390/include/asm/qdio.h
1191 +index e3f238e8c611..4f35b1055f30 100644
1192 +--- a/arch/s390/include/asm/qdio.h
1193 ++++ b/arch/s390/include/asm/qdio.h
1194 +@@ -227,7 +227,7 @@ struct qdio_buffer {
1195 + * @sbal: absolute SBAL address
1196 + */
1197 + struct sl_element {
1198 +- unsigned long sbal;
1199 ++ u64 sbal;
1200 + } __attribute__ ((packed));
1201 +
1202 + /**
1203 +diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
1204 +index 5b24fcc9c361..6105b1b6e49b 100644
1205 +--- a/arch/s390/pci/pci.c
1206 ++++ b/arch/s390/pci/pci.c
1207 +@@ -423,7 +423,7 @@ static void zpci_map_resources(struct pci_dev *pdev)
1208 +
1209 + if (zpci_use_mio(zdev))
1210 + pdev->resource[i].start =
1211 +- (resource_size_t __force) zdev->bars[i].mio_wb;
1212 ++ (resource_size_t __force) zdev->bars[i].mio_wt;
1213 + else
1214 + pdev->resource[i].start = (resource_size_t __force)
1215 + pci_iomap_range_fh(pdev, i, 0, 0);
1216 +@@ -530,7 +530,7 @@ static int zpci_setup_bus_resources(struct zpci_dev *zdev,
1217 + flags |= IORESOURCE_MEM_64;
1218 +
1219 + if (zpci_use_mio(zdev))
1220 +- addr = (unsigned long) zdev->bars[i].mio_wb;
1221 ++ addr = (unsigned long) zdev->bars[i].mio_wt;
1222 + else
1223 + addr = ZPCI_ADDR(entry);
1224 + size = 1UL << zdev->bars[i].size;
1225 +diff --git a/arch/x86/boot/compressed/kaslr_64.c b/arch/x86/boot/compressed/kaslr_64.c
1226 +index 748456c365f4..9557c5a15b91 100644
1227 +--- a/arch/x86/boot/compressed/kaslr_64.c
1228 ++++ b/arch/x86/boot/compressed/kaslr_64.c
1229 +@@ -29,9 +29,6 @@
1230 + #define __PAGE_OFFSET __PAGE_OFFSET_BASE
1231 + #include "../../mm/ident_map.c"
1232 +
1233 +-/* Used by pgtable.h asm code to force instruction serialization. */
1234 +-unsigned long __force_order;
1235 +-
1236 + /* Used to track our page table allocation area. */
1237 + struct alloc_pgt_data {
1238 + unsigned char *pgt_buf;
1239 +diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
1240 +index fffe21945374..704caec136cf 100644
1241 +--- a/arch/x86/kernel/cpu/common.c
1242 ++++ b/arch/x86/kernel/cpu/common.c
1243 +@@ -464,7 +464,7 @@ static __always_inline void setup_pku(struct cpuinfo_x86 *c)
1244 + * cpuid bit to be set. We need to ensure that we
1245 + * update that bit in this CPU's "cpu_info".
1246 + */
1247 +- get_cpu_cap(c);
1248 ++ set_cpu_cap(c, X86_FEATURE_OSPKE);
1249 + }
1250 +
1251 + #ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS
1252 +diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
1253 +index 52a1e5192fa8..fe0e647411da 100644
1254 +--- a/arch/x86/platform/efi/efi_64.c
1255 ++++ b/arch/x86/platform/efi/efi_64.c
1256 +@@ -316,7 +316,7 @@ void efi_sync_low_kernel_mappings(void)
1257 + static inline phys_addr_t
1258 + virt_to_phys_or_null_size(void *va, unsigned long size)
1259 + {
1260 +- bool bad_size;
1261 ++ phys_addr_t pa;
1262 +
1263 + if (!va)
1264 + return 0;
1265 +@@ -324,16 +324,13 @@ virt_to_phys_or_null_size(void *va, unsigned long size)
1266 + if (virt_addr_valid(va))
1267 + return virt_to_phys(va);
1268 +
1269 +- /*
1270 +- * A fully aligned variable on the stack is guaranteed not to
1271 +- * cross a page bounary. Try to catch strings on the stack by
1272 +- * checking that 'size' is a power of two.
1273 +- */
1274 +- bad_size = size > PAGE_SIZE || !is_power_of_2(size);
1275 ++ pa = slow_virt_to_phys(va);
1276 +
1277 +- WARN_ON(!IS_ALIGNED((unsigned long)va, size) || bad_size);
1278 ++ /* check if the object crosses a page boundary */
1279 ++ if (WARN_ON((pa ^ (pa + size - 1)) & PAGE_MASK))
1280 ++ return 0;
1281 +
1282 +- return slow_virt_to_phys(va);
1283 ++ return pa;
1284 + }
1285 +
1286 + #define virt_to_phys_or_null(addr) \
1287 +@@ -791,6 +788,8 @@ static efi_status_t
1288 + efi_thunk_get_variable(efi_char16_t *name, efi_guid_t *vendor,
1289 + u32 *attr, unsigned long *data_size, void *data)
1290 + {
1291 ++ u8 buf[24] __aligned(8);
1292 ++ efi_guid_t *vnd = PTR_ALIGN((efi_guid_t *)buf, sizeof(*vnd));
1293 + efi_status_t status;
1294 + u32 phys_name, phys_vendor, phys_attr;
1295 + u32 phys_data_size, phys_data;
1296 +@@ -798,14 +797,19 @@ efi_thunk_get_variable(efi_char16_t *name, efi_guid_t *vendor,
1297 +
1298 + spin_lock_irqsave(&efi_runtime_lock, flags);
1299 +
1300 ++ *vnd = *vendor;
1301 ++
1302 + phys_data_size = virt_to_phys_or_null(data_size);
1303 +- phys_vendor = virt_to_phys_or_null(vendor);
1304 ++ phys_vendor = virt_to_phys_or_null(vnd);
1305 + phys_name = virt_to_phys_or_null_size(name, efi_name_size(name));
1306 + phys_attr = virt_to_phys_or_null(attr);
1307 + phys_data = virt_to_phys_or_null_size(data, *data_size);
1308 +
1309 +- status = efi_thunk(get_variable, phys_name, phys_vendor,
1310 +- phys_attr, phys_data_size, phys_data);
1311 ++ if (!phys_name || (data && !phys_data))
1312 ++ status = EFI_INVALID_PARAMETER;
1313 ++ else
1314 ++ status = efi_thunk(get_variable, phys_name, phys_vendor,
1315 ++ phys_attr, phys_data_size, phys_data);
1316 +
1317 + spin_unlock_irqrestore(&efi_runtime_lock, flags);
1318 +
1319 +@@ -816,19 +820,25 @@ static efi_status_t
1320 + efi_thunk_set_variable(efi_char16_t *name, efi_guid_t *vendor,
1321 + u32 attr, unsigned long data_size, void *data)
1322 + {
1323 ++ u8 buf[24] __aligned(8);
1324 ++ efi_guid_t *vnd = PTR_ALIGN((efi_guid_t *)buf, sizeof(*vnd));
1325 + u32 phys_name, phys_vendor, phys_data;
1326 + efi_status_t status;
1327 + unsigned long flags;
1328 +
1329 + spin_lock_irqsave(&efi_runtime_lock, flags);
1330 +
1331 ++ *vnd = *vendor;
1332 ++
1333 + phys_name = virt_to_phys_or_null_size(name, efi_name_size(name));
1334 +- phys_vendor = virt_to_phys_or_null(vendor);
1335 ++ phys_vendor = virt_to_phys_or_null(vnd);
1336 + phys_data = virt_to_phys_or_null_size(data, data_size);
1337 +
1338 +- /* If data_size is > sizeof(u32) we've got problems */
1339 +- status = efi_thunk(set_variable, phys_name, phys_vendor,
1340 +- attr, data_size, phys_data);
1341 ++ if (!phys_name || !phys_data)
1342 ++ status = EFI_INVALID_PARAMETER;
1343 ++ else
1344 ++ status = efi_thunk(set_variable, phys_name, phys_vendor,
1345 ++ attr, data_size, phys_data);
1346 +
1347 + spin_unlock_irqrestore(&efi_runtime_lock, flags);
1348 +
1349 +@@ -840,6 +850,8 @@ efi_thunk_set_variable_nonblocking(efi_char16_t *name, efi_guid_t *vendor,
1350 + u32 attr, unsigned long data_size,
1351 + void *data)
1352 + {
1353 ++ u8 buf[24] __aligned(8);
1354 ++ efi_guid_t *vnd = PTR_ALIGN((efi_guid_t *)buf, sizeof(*vnd));
1355 + u32 phys_name, phys_vendor, phys_data;
1356 + efi_status_t status;
1357 + unsigned long flags;
1358 +@@ -847,13 +859,17 @@ efi_thunk_set_variable_nonblocking(efi_char16_t *name, efi_guid_t *vendor,
1359 + if (!spin_trylock_irqsave(&efi_runtime_lock, flags))
1360 + return EFI_NOT_READY;
1361 +
1362 ++ *vnd = *vendor;
1363 ++
1364 + phys_name = virt_to_phys_or_null_size(name, efi_name_size(name));
1365 +- phys_vendor = virt_to_phys_or_null(vendor);
1366 ++ phys_vendor = virt_to_phys_or_null(vnd);
1367 + phys_data = virt_to_phys_or_null_size(data, data_size);
1368 +
1369 +- /* If data_size is > sizeof(u32) we've got problems */
1370 +- status = efi_thunk(set_variable, phys_name, phys_vendor,
1371 +- attr, data_size, phys_data);
1372 ++ if (!phys_name || !phys_data)
1373 ++ status = EFI_INVALID_PARAMETER;
1374 ++ else
1375 ++ status = efi_thunk(set_variable, phys_name, phys_vendor,
1376 ++ attr, data_size, phys_data);
1377 +
1378 + spin_unlock_irqrestore(&efi_runtime_lock, flags);
1379 +
1380 +@@ -865,21 +881,29 @@ efi_thunk_get_next_variable(unsigned long *name_size,
1381 + efi_char16_t *name,
1382 + efi_guid_t *vendor)
1383 + {
1384 ++ u8 buf[24] __aligned(8);
1385 ++ efi_guid_t *vnd = PTR_ALIGN((efi_guid_t *)buf, sizeof(*vnd));
1386 + efi_status_t status;
1387 + u32 phys_name_size, phys_name, phys_vendor;
1388 + unsigned long flags;
1389 +
1390 + spin_lock_irqsave(&efi_runtime_lock, flags);
1391 +
1392 ++ *vnd = *vendor;
1393 ++
1394 + phys_name_size = virt_to_phys_or_null(name_size);
1395 +- phys_vendor = virt_to_phys_or_null(vendor);
1396 ++ phys_vendor = virt_to_phys_or_null(vnd);
1397 + phys_name = virt_to_phys_or_null_size(name, *name_size);
1398 +
1399 +- status = efi_thunk(get_next_variable, phys_name_size,
1400 +- phys_name, phys_vendor);
1401 ++ if (!phys_name)
1402 ++ status = EFI_INVALID_PARAMETER;
1403 ++ else
1404 ++ status = efi_thunk(get_next_variable, phys_name_size,
1405 ++ phys_name, phys_vendor);
1406 +
1407 + spin_unlock_irqrestore(&efi_runtime_lock, flags);
1408 +
1409 ++ *vendor = *vnd;
1410 + return status;
1411 + }
1412 +
1413 +diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c
1414 +index 6ea215cdeada..6d4d8a5700b7 100644
1415 +--- a/arch/x86/xen/enlighten_pv.c
1416 ++++ b/arch/x86/xen/enlighten_pv.c
1417 +@@ -905,14 +905,15 @@ static u64 xen_read_msr_safe(unsigned int msr, int *err)
1418 + static int xen_write_msr_safe(unsigned int msr, unsigned low, unsigned high)
1419 + {
1420 + int ret;
1421 ++#ifdef CONFIG_X86_64
1422 ++ unsigned int which;
1423 ++ u64 base;
1424 ++#endif
1425 +
1426 + ret = 0;
1427 +
1428 + switch (msr) {
1429 + #ifdef CONFIG_X86_64
1430 +- unsigned which;
1431 +- u64 base;
1432 +-
1433 + case MSR_FS_BASE: which = SEGBASE_FS; goto set;
1434 + case MSR_KERNEL_GS_BASE: which = SEGBASE_GS_USER; goto set;
1435 + case MSR_GS_BASE: which = SEGBASE_GS_KERNEL; goto set;
1436 +diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c
1437 +index 86a607cf19a1..d0e36d652264 100644
1438 +--- a/block/bfq-cgroup.c
1439 ++++ b/block/bfq-cgroup.c
1440 +@@ -332,7 +332,7 @@ static void bfqg_put(struct bfq_group *bfqg)
1441 + kfree(bfqg);
1442 + }
1443 +
1444 +-static void bfqg_and_blkg_get(struct bfq_group *bfqg)
1445 ++void bfqg_and_blkg_get(struct bfq_group *bfqg)
1446 + {
1447 + /* see comments in bfq_bic_update_cgroup for why refcounting bfqg */
1448 + bfqg_get(bfqg);
1449 +@@ -634,6 +634,12 @@ void bfq_bfqq_move(struct bfq_data *bfqd, struct bfq_queue *bfqq,
1450 + bfq_bfqq_expire(bfqd, bfqd->in_service_queue,
1451 + false, BFQQE_PREEMPTED);
1452 +
1453 ++ /*
1454 ++ * get extra reference to prevent bfqq from being freed in
1455 ++ * next possible deactivate
1456 ++ */
1457 ++ bfqq->ref++;
1458 ++
1459 + if (bfq_bfqq_busy(bfqq))
1460 + bfq_deactivate_bfqq(bfqd, bfqq, false, false);
1461 + else if (entity->on_st)
1462 +@@ -653,6 +659,8 @@ void bfq_bfqq_move(struct bfq_data *bfqd, struct bfq_queue *bfqq,
1463 +
1464 + if (!bfqd->in_service_queue && !bfqd->rq_in_driver)
1465 + bfq_schedule_dispatch(bfqd);
1466 ++ /* release extra ref taken above */
1467 ++ bfq_put_queue(bfqq);
1468 + }
1469 +
1470 + /**
1471 +@@ -1380,6 +1388,10 @@ struct bfq_group *bfqq_group(struct bfq_queue *bfqq)
1472 + return bfqq->bfqd->root_group;
1473 + }
1474 +
1475 ++void bfqg_and_blkg_get(struct bfq_group *bfqg) {}
1476 ++
1477 ++void bfqg_and_blkg_put(struct bfq_group *bfqg) {}
1478 ++
1479 + struct bfq_group *bfq_create_group_hierarchy(struct bfq_data *bfqd, int node)
1480 + {
1481 + struct bfq_group *bfqg;
1482 +diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
1483 +index 5498d05b873d..48189ff88916 100644
1484 +--- a/block/bfq-iosched.c
1485 ++++ b/block/bfq-iosched.c
1486 +@@ -614,6 +614,10 @@ bfq_pos_tree_add_move(struct bfq_data *bfqd, struct bfq_queue *bfqq)
1487 + bfqq->pos_root = NULL;
1488 + }
1489 +
1490 ++ /* oom_bfqq does not participate in queue merging */
1491 ++ if (bfqq == &bfqd->oom_bfqq)
1492 ++ return;
1493 ++
1494 + /*
1495 + * bfqq cannot be merged any longer (see comments in
1496 + * bfq_setup_cooperator): no point in adding bfqq into the
1497 +@@ -4822,9 +4826,7 @@ void bfq_put_queue(struct bfq_queue *bfqq)
1498 + {
1499 + struct bfq_queue *item;
1500 + struct hlist_node *n;
1501 +-#ifdef CONFIG_BFQ_GROUP_IOSCHED
1502 + struct bfq_group *bfqg = bfqq_group(bfqq);
1503 +-#endif
1504 +
1505 + if (bfqq->bfqd)
1506 + bfq_log_bfqq(bfqq->bfqd, bfqq, "put_queue: %p %d",
1507 +@@ -4897,9 +4899,7 @@ void bfq_put_queue(struct bfq_queue *bfqq)
1508 + bfqq->bfqd->last_completed_rq_bfqq = NULL;
1509 +
1510 + kmem_cache_free(bfq_pool, bfqq);
1511 +-#ifdef CONFIG_BFQ_GROUP_IOSCHED
1512 + bfqg_and_blkg_put(bfqg);
1513 +-#endif
1514 + }
1515 +
1516 + static void bfq_put_cooperator(struct bfq_queue *bfqq)
1517 +@@ -6383,10 +6383,10 @@ static void bfq_exit_queue(struct elevator_queue *e)
1518 +
1519 + hrtimer_cancel(&bfqd->idle_slice_timer);
1520 +
1521 +-#ifdef CONFIG_BFQ_GROUP_IOSCHED
1522 + /* release oom-queue reference to root group */
1523 + bfqg_and_blkg_put(bfqd->root_group);
1524 +
1525 ++#ifdef CONFIG_BFQ_GROUP_IOSCHED
1526 + blkcg_deactivate_policy(bfqd->queue, &blkcg_policy_bfq);
1527 + #else
1528 + spin_lock_irq(&bfqd->lock);
1529 +diff --git a/block/bfq-iosched.h b/block/bfq-iosched.h
1530 +index 5d1a519640f6..1553a4e8f7ad 100644
1531 +--- a/block/bfq-iosched.h
1532 ++++ b/block/bfq-iosched.h
1533 +@@ -916,6 +916,7 @@ struct bfq_group {
1534 +
1535 + #else
1536 + struct bfq_group {
1537 ++ struct bfq_entity entity;
1538 + struct bfq_sched_data sched_data;
1539 +
1540 + struct bfq_queue *async_bfqq[2][IOPRIO_BE_NR];
1541 +@@ -978,6 +979,7 @@ struct bfq_group *bfq_find_set_group(struct bfq_data *bfqd,
1542 + struct blkcg_gq *bfqg_to_blkg(struct bfq_group *bfqg);
1543 + struct bfq_group *bfqq_group(struct bfq_queue *bfqq);
1544 + struct bfq_group *bfq_create_group_hierarchy(struct bfq_data *bfqd, int node);
1545 ++void bfqg_and_blkg_get(struct bfq_group *bfqg);
1546 + void bfqg_and_blkg_put(struct bfq_group *bfqg);
1547 +
1548 + #ifdef CONFIG_BFQ_GROUP_IOSCHED
1549 +diff --git a/block/bfq-wf2q.c b/block/bfq-wf2q.c
1550 +index 05f0bf4a1144..44079147e396 100644
1551 +--- a/block/bfq-wf2q.c
1552 ++++ b/block/bfq-wf2q.c
1553 +@@ -536,7 +536,9 @@ static void bfq_get_entity(struct bfq_entity *entity)
1554 + bfqq->ref++;
1555 + bfq_log_bfqq(bfqq->bfqd, bfqq, "get_entity: %p %d",
1556 + bfqq, bfqq->ref);
1557 +- }
1558 ++ } else
1559 ++ bfqg_and_blkg_get(container_of(entity, struct bfq_group,
1560 ++ entity));
1561 + }
1562 +
1563 + /**
1564 +@@ -650,8 +652,14 @@ static void bfq_forget_entity(struct bfq_service_tree *st,
1565 +
1566 + entity->on_st = false;
1567 + st->wsum -= entity->weight;
1568 +- if (bfqq && !is_in_service)
1569 ++ if (is_in_service)
1570 ++ return;
1571 ++
1572 ++ if (bfqq)
1573 + bfq_put_queue(bfqq);
1574 ++ else
1575 ++ bfqg_and_blkg_put(container_of(entity, struct bfq_group,
1576 ++ entity));
1577 + }
1578 +
1579 + /**
1580 +diff --git a/drivers/android/binder.c b/drivers/android/binder.c
1581 +index 254f87b627fe..34a6de65aa7e 100644
1582 +--- a/drivers/android/binder.c
1583 ++++ b/drivers/android/binder.c
1584 +@@ -5230,6 +5230,7 @@ static int binder_open(struct inode *nodp, struct file *filp)
1585 + binder_dev = container_of(filp->private_data,
1586 + struct binder_device, miscdev);
1587 + }
1588 ++ refcount_inc(&binder_dev->ref);
1589 + proc->context = &binder_dev->context;
1590 + binder_alloc_init(&proc->alloc);
1591 +
1592 +@@ -5407,6 +5408,7 @@ static int binder_node_release(struct binder_node *node, int refs)
1593 + static void binder_deferred_release(struct binder_proc *proc)
1594 + {
1595 + struct binder_context *context = proc->context;
1596 ++ struct binder_device *device;
1597 + struct rb_node *n;
1598 + int threads, nodes, incoming_refs, outgoing_refs, active_transactions;
1599 +
1600 +@@ -5423,6 +5425,12 @@ static void binder_deferred_release(struct binder_proc *proc)
1601 + context->binder_context_mgr_node = NULL;
1602 + }
1603 + mutex_unlock(&context->context_mgr_node_lock);
1604 ++ device = container_of(proc->context, struct binder_device, context);
1605 ++ if (refcount_dec_and_test(&device->ref)) {
1606 ++ kfree(context->name);
1607 ++ kfree(device);
1608 ++ }
1609 ++ proc->context = NULL;
1610 + binder_inner_proc_lock(proc);
1611 + /*
1612 + * Make sure proc stays alive after we
1613 +@@ -6079,6 +6087,7 @@ static int __init init_binder_device(const char *name)
1614 + binder_device->miscdev.minor = MISC_DYNAMIC_MINOR;
1615 + binder_device->miscdev.name = name;
1616 +
1617 ++ refcount_set(&binder_device->ref, 1);
1618 + binder_device->context.binder_context_mgr_uid = INVALID_UID;
1619 + binder_device->context.name = name;
1620 + mutex_init(&binder_device->context.context_mgr_node_lock);
1621 +diff --git a/drivers/android/binder_internal.h b/drivers/android/binder_internal.h
1622 +index ae991097d14d..283d3cb9c16e 100644
1623 +--- a/drivers/android/binder_internal.h
1624 ++++ b/drivers/android/binder_internal.h
1625 +@@ -8,6 +8,7 @@
1626 + #include <linux/list.h>
1627 + #include <linux/miscdevice.h>
1628 + #include <linux/mutex.h>
1629 ++#include <linux/refcount.h>
1630 + #include <linux/stddef.h>
1631 + #include <linux/types.h>
1632 + #include <linux/uidgid.h>
1633 +@@ -33,6 +34,7 @@ struct binder_device {
1634 + struct miscdevice miscdev;
1635 + struct binder_context context;
1636 + struct inode *binderfs_inode;
1637 ++ refcount_t ref;
1638 + };
1639 +
1640 + /**
1641 +diff --git a/drivers/android/binderfs.c b/drivers/android/binderfs.c
1642 +index e2580e5316a2..110e41f920c2 100644
1643 +--- a/drivers/android/binderfs.c
1644 ++++ b/drivers/android/binderfs.c
1645 +@@ -154,6 +154,7 @@ static int binderfs_binder_device_create(struct inode *ref_inode,
1646 + if (!name)
1647 + goto err;
1648 +
1649 ++ refcount_set(&device->ref, 1);
1650 + device->binderfs_inode = inode;
1651 + device->context.binder_context_mgr_uid = INVALID_UID;
1652 + device->context.name = name;
1653 +@@ -257,8 +258,10 @@ static void binderfs_evict_inode(struct inode *inode)
1654 + ida_free(&binderfs_minors, device->miscdev.minor);
1655 + mutex_unlock(&binderfs_minors_mutex);
1656 +
1657 +- kfree(device->context.name);
1658 +- kfree(device);
1659 ++ if (refcount_dec_and_test(&device->ref)) {
1660 ++ kfree(device->context.name);
1661 ++ kfree(device);
1662 ++ }
1663 + }
1664 +
1665 + /**
1666 +diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c
1667 +index a0cecb12b6f9..f0bc0841cbc4 100644
1668 +--- a/drivers/bus/ti-sysc.c
1669 ++++ b/drivers/bus/ti-sysc.c
1670 +@@ -1406,7 +1406,7 @@ static void sysc_init_revision_quirks(struct sysc *ddata)
1671 + }
1672 +
1673 + /* 1-wire needs module's internal clocks enabled for reset */
1674 +-static void sysc_clk_enable_quirk_hdq1w(struct sysc *ddata)
1675 ++static void sysc_pre_reset_quirk_hdq1w(struct sysc *ddata)
1676 + {
1677 + int offset = 0x0c; /* HDQ_CTRL_STATUS */
1678 + u16 val;
1679 +@@ -1494,7 +1494,7 @@ static void sysc_init_module_quirks(struct sysc *ddata)
1680 + return;
1681 +
1682 + if (ddata->cfg.quirks & SYSC_MODULE_QUIRK_HDQ1W) {
1683 +- ddata->clk_enable_quirk = sysc_clk_enable_quirk_hdq1w;
1684 ++ ddata->clk_disable_quirk = sysc_pre_reset_quirk_hdq1w;
1685 +
1686 + return;
1687 + }
1688 +diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
1689 +index 433d91d710e4..0fb0358f0073 100644
1690 +--- a/drivers/dma-buf/dma-buf.c
1691 ++++ b/drivers/dma-buf/dma-buf.c
1692 +@@ -108,6 +108,7 @@ static int dma_buf_release(struct inode *inode, struct file *file)
1693 + dma_resv_fini(dmabuf->resv);
1694 +
1695 + module_put(dmabuf->owner);
1696 ++ kfree(dmabuf->name);
1697 + kfree(dmabuf);
1698 + return 0;
1699 + }
1700 +diff --git a/drivers/dma/coh901318.c b/drivers/dma/coh901318.c
1701 +index e51d836afcc7..1092d4ce723e 100644
1702 +--- a/drivers/dma/coh901318.c
1703 ++++ b/drivers/dma/coh901318.c
1704 +@@ -1947,8 +1947,6 @@ static void dma_tc_handle(struct coh901318_chan *cohc)
1705 + return;
1706 + }
1707 +
1708 +- spin_lock(&cohc->lock);
1709 +-
1710 + /*
1711 + * When we reach this point, at least one queue item
1712 + * should have been moved over from cohc->queue to
1713 +@@ -1969,8 +1967,6 @@ static void dma_tc_handle(struct coh901318_chan *cohc)
1714 + if (coh901318_queue_start(cohc) == NULL)
1715 + cohc->busy = 0;
1716 +
1717 +- spin_unlock(&cohc->lock);
1718 +-
1719 + /*
1720 + * This tasklet will remove items from cohc->active
1721 + * and thus terminates them.
1722 +diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
1723 +index c27e206a764c..67736c801f3c 100644
1724 +--- a/drivers/dma/imx-sdma.c
1725 ++++ b/drivers/dma/imx-sdma.c
1726 +@@ -1328,13 +1328,14 @@ static void sdma_free_chan_resources(struct dma_chan *chan)
1727 +
1728 + sdma_channel_synchronize(chan);
1729 +
1730 +- if (sdmac->event_id0)
1731 ++ if (sdmac->event_id0 >= 0)
1732 + sdma_event_disable(sdmac, sdmac->event_id0);
1733 + if (sdmac->event_id1)
1734 + sdma_event_disable(sdmac, sdmac->event_id1);
1735 +
1736 + sdmac->event_id0 = 0;
1737 + sdmac->event_id1 = 0;
1738 ++ sdmac->context_loaded = false;
1739 +
1740 + sdma_set_channel_priority(sdmac, 0);
1741 +
1742 +@@ -1628,7 +1629,7 @@ static int sdma_config(struct dma_chan *chan,
1743 + memcpy(&sdmac->slave_config, dmaengine_cfg, sizeof(*dmaengine_cfg));
1744 +
1745 + /* Set ENBLn earlier to make sure dma request triggered after that */
1746 +- if (sdmac->event_id0) {
1747 ++ if (sdmac->event_id0 >= 0) {
1748 + if (sdmac->event_id0 >= sdmac->sdma->drvdata->num_events)
1749 + return -EINVAL;
1750 + sdma_event_enable(sdmac, sdmac->event_id0);
1751 +diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c
1752 +index 3a45079d11ec..4a750e29bfb5 100644
1753 +--- a/drivers/dma/tegra20-apb-dma.c
1754 ++++ b/drivers/dma/tegra20-apb-dma.c
1755 +@@ -281,7 +281,7 @@ static struct tegra_dma_desc *tegra_dma_desc_get(
1756 +
1757 + /* Do not allocate if desc are waiting for ack */
1758 + list_for_each_entry(dma_desc, &tdc->free_dma_desc, node) {
1759 +- if (async_tx_test_ack(&dma_desc->txd)) {
1760 ++ if (async_tx_test_ack(&dma_desc->txd) && !dma_desc->cb_count) {
1761 + list_del(&dma_desc->node);
1762 + spin_unlock_irqrestore(&tdc->lock, flags);
1763 + dma_desc->txd.flags = 0;
1764 +@@ -756,10 +756,6 @@ static int tegra_dma_terminate_all(struct dma_chan *dc)
1765 + bool was_busy;
1766 +
1767 + spin_lock_irqsave(&tdc->lock, flags);
1768 +- if (list_empty(&tdc->pending_sg_req)) {
1769 +- spin_unlock_irqrestore(&tdc->lock, flags);
1770 +- return 0;
1771 +- }
1772 +
1773 + if (!tdc->busy)
1774 + goto skip_dma_stop;
1775 +diff --git a/drivers/edac/synopsys_edac.c b/drivers/edac/synopsys_edac.c
1776 +index 2d263382d797..880ffd833718 100644
1777 +--- a/drivers/edac/synopsys_edac.c
1778 ++++ b/drivers/edac/synopsys_edac.c
1779 +@@ -479,20 +479,14 @@ static void handle_error(struct mem_ctl_info *mci, struct synps_ecc_status *p)
1780 + pinf = &p->ceinfo;
1781 + if (!priv->p_data->quirks) {
1782 + snprintf(priv->message, SYNPS_EDAC_MSG_SIZE,
1783 +- "DDR ECC error type:%s Row %d Bank %d Col %d ",
1784 +- "CE", pinf->row, pinf->bank, pinf->col);
1785 +- snprintf(priv->message, SYNPS_EDAC_MSG_SIZE,
1786 +- "Bit Position: %d Data: 0x%08x\n",
1787 ++ "DDR ECC error type:%s Row %d Bank %d Col %d Bit Position: %d Data: 0x%08x",
1788 ++ "CE", pinf->row, pinf->bank, pinf->col,
1789 + pinf->bitpos, pinf->data);
1790 + } else {
1791 + snprintf(priv->message, SYNPS_EDAC_MSG_SIZE,
1792 +- "DDR ECC error type:%s Row %d Bank %d Col %d ",
1793 +- "CE", pinf->row, pinf->bank, pinf->col);
1794 +- snprintf(priv->message, SYNPS_EDAC_MSG_SIZE,
1795 +- "BankGroup Number %d Block Number %d ",
1796 +- pinf->bankgrpnr, pinf->blknr);
1797 +- snprintf(priv->message, SYNPS_EDAC_MSG_SIZE,
1798 +- "Bit Position: %d Data: 0x%08x\n",
1799 ++ "DDR ECC error type:%s Row %d Bank %d Col %d BankGroup Number %d Block Number %d Bit Position: %d Data: 0x%08x",
1800 ++ "CE", pinf->row, pinf->bank, pinf->col,
1801 ++ pinf->bankgrpnr, pinf->blknr,
1802 + pinf->bitpos, pinf->data);
1803 + }
1804 +
1805 +@@ -509,10 +503,8 @@ static void handle_error(struct mem_ctl_info *mci, struct synps_ecc_status *p)
1806 + "UE", pinf->row, pinf->bank, pinf->col);
1807 + } else {
1808 + snprintf(priv->message, SYNPS_EDAC_MSG_SIZE,
1809 +- "DDR ECC error type :%s Row %d Bank %d Col %d ",
1810 +- "UE", pinf->row, pinf->bank, pinf->col);
1811 +- snprintf(priv->message, SYNPS_EDAC_MSG_SIZE,
1812 +- "BankGroup Number %d Block Number %d",
1813 ++ "DDR ECC error type :%s Row %d Bank %d Col %d BankGroup Number %d Block Number %d",
1814 ++ "UE", pinf->row, pinf->bank, pinf->col,
1815 + pinf->bankgrpnr, pinf->blknr);
1816 + }
1817 +
1818 +diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
1819 +index 34d41f67b54d..ad8a4bc074fb 100644
1820 +--- a/drivers/firmware/efi/efi.c
1821 ++++ b/drivers/firmware/efi/efi.c
1822 +@@ -544,7 +544,7 @@ int __init efi_config_parse_tables(void *config_tables, int count, int sz,
1823 +
1824 + seed = early_memremap(efi.rng_seed, sizeof(*seed));
1825 + if (seed != NULL) {
1826 +- size = seed->size;
1827 ++ size = READ_ONCE(seed->size);
1828 + early_memunmap(seed, sizeof(*seed));
1829 + } else {
1830 + pr_err("Could not map UEFI random seed!\n");
1831 +@@ -554,7 +554,7 @@ int __init efi_config_parse_tables(void *config_tables, int count, int sz,
1832 + sizeof(*seed) + size);
1833 + if (seed != NULL) {
1834 + pr_notice("seeding entropy pool\n");
1835 +- add_bootloader_randomness(seed->bits, seed->size);
1836 ++ add_bootloader_randomness(seed->bits, size);
1837 + early_memunmap(seed, sizeof(*seed) + size);
1838 + } else {
1839 + pr_err("Could not map UEFI random seed!\n");
1840 +diff --git a/drivers/firmware/imx/imx-scu.c b/drivers/firmware/imx/imx-scu.c
1841 +index 04a24a863d6e..35a5f8f8eea5 100644
1842 +--- a/drivers/firmware/imx/imx-scu.c
1843 ++++ b/drivers/firmware/imx/imx-scu.c
1844 +@@ -29,6 +29,7 @@ struct imx_sc_chan {
1845 + struct mbox_client cl;
1846 + struct mbox_chan *ch;
1847 + int idx;
1848 ++ struct completion tx_done;
1849 + };
1850 +
1851 + struct imx_sc_ipc {
1852 +@@ -100,6 +101,14 @@ int imx_scu_get_handle(struct imx_sc_ipc **ipc)
1853 + }
1854 + EXPORT_SYMBOL(imx_scu_get_handle);
1855 +
1856 ++/* Callback called when the word of a message is ack-ed, eg read by SCU */
1857 ++static void imx_scu_tx_done(struct mbox_client *cl, void *mssg, int r)
1858 ++{
1859 ++ struct imx_sc_chan *sc_chan = container_of(cl, struct imx_sc_chan, cl);
1860 ++
1861 ++ complete(&sc_chan->tx_done);
1862 ++}
1863 ++
1864 + static void imx_scu_rx_callback(struct mbox_client *c, void *msg)
1865 + {
1866 + struct imx_sc_chan *sc_chan = container_of(c, struct imx_sc_chan, cl);
1867 +@@ -143,6 +152,19 @@ static int imx_scu_ipc_write(struct imx_sc_ipc *sc_ipc, void *msg)
1868 +
1869 + for (i = 0; i < hdr->size; i++) {
1870 + sc_chan = &sc_ipc->chans[i % 4];
1871 ++
1872 ++ /*
1873 ++ * SCU requires that all messages words are written
1874 ++ * sequentially but linux MU driver implements multiple
1875 ++ * independent channels for each register so ordering between
1876 ++ * different channels must be ensured by SCU API interface.
1877 ++ *
1878 ++ * Wait for tx_done before every send to ensure that no
1879 ++ * queueing happens at the mailbox channel level.
1880 ++ */
1881 ++ wait_for_completion(&sc_chan->tx_done);
1882 ++ reinit_completion(&sc_chan->tx_done);
1883 ++
1884 + ret = mbox_send_message(sc_chan->ch, &data[i]);
1885 + if (ret < 0)
1886 + return ret;
1887 +@@ -225,6 +247,11 @@ static int imx_scu_probe(struct platform_device *pdev)
1888 + cl->knows_txdone = true;
1889 + cl->rx_callback = imx_scu_rx_callback;
1890 +
1891 ++ /* Initial tx_done completion as "done" */
1892 ++ cl->tx_done = imx_scu_tx_done;
1893 ++ init_completion(&sc_chan->tx_done);
1894 ++ complete(&sc_chan->tx_done);
1895 ++
1896 + sc_chan->sc_ipc = sc_ipc;
1897 + sc_chan->idx = i % 4;
1898 + sc_chan->ch = mbox_request_channel_byname(cl, chan_name);
1899 +diff --git a/drivers/firmware/imx/misc.c b/drivers/firmware/imx/misc.c
1900 +index 4b56a587dacd..d073cb3ce699 100644
1901 +--- a/drivers/firmware/imx/misc.c
1902 ++++ b/drivers/firmware/imx/misc.c
1903 +@@ -16,7 +16,7 @@ struct imx_sc_msg_req_misc_set_ctrl {
1904 + u32 ctrl;
1905 + u32 val;
1906 + u16 resource;
1907 +-} __packed;
1908 ++} __packed __aligned(4);
1909 +
1910 + struct imx_sc_msg_req_cpu_start {
1911 + struct imx_sc_rpc_msg hdr;
1912 +@@ -24,18 +24,18 @@ struct imx_sc_msg_req_cpu_start {
1913 + u32 address_lo;
1914 + u16 resource;
1915 + u8 enable;
1916 +-} __packed;
1917 ++} __packed __aligned(4);
1918 +
1919 + struct imx_sc_msg_req_misc_get_ctrl {
1920 + struct imx_sc_rpc_msg hdr;
1921 + u32 ctrl;
1922 + u16 resource;
1923 +-} __packed;
1924 ++} __packed __aligned(4);
1925 +
1926 + struct imx_sc_msg_resp_misc_get_ctrl {
1927 + struct imx_sc_rpc_msg hdr;
1928 + u32 val;
1929 +-} __packed;
1930 ++} __packed __aligned(4);
1931 +
1932 + /*
1933 + * This function sets a miscellaneous control value.
1934 +diff --git a/drivers/firmware/imx/scu-pd.c b/drivers/firmware/imx/scu-pd.c
1935 +index b556612207e5..af3ae0087de4 100644
1936 +--- a/drivers/firmware/imx/scu-pd.c
1937 ++++ b/drivers/firmware/imx/scu-pd.c
1938 +@@ -61,7 +61,7 @@ struct imx_sc_msg_req_set_resource_power_mode {
1939 + struct imx_sc_rpc_msg hdr;
1940 + u16 resource;
1941 + u8 mode;
1942 +-} __packed;
1943 ++} __packed __aligned(4);
1944 +
1945 + #define IMX_SCU_PD_NAME_SIZE 20
1946 + struct imx_sc_pm_domain {
1947 +diff --git a/drivers/gpu/drm/drm_client_modeset.c b/drivers/gpu/drm/drm_client_modeset.c
1948 +index 12e748b202d6..18cb88b9105e 100644
1949 +--- a/drivers/gpu/drm/drm_client_modeset.c
1950 ++++ b/drivers/gpu/drm/drm_client_modeset.c
1951 +@@ -952,7 +952,8 @@ bool drm_client_rotation(struct drm_mode_set *modeset, unsigned int *rotation)
1952 + * depending on the hardware this may require the framebuffer
1953 + * to be in a specific tiling format.
1954 + */
1955 +- if ((*rotation & DRM_MODE_ROTATE_MASK) != DRM_MODE_ROTATE_180 ||
1956 ++ if (((*rotation & DRM_MODE_ROTATE_MASK) != DRM_MODE_ROTATE_0 &&
1957 ++ (*rotation & DRM_MODE_ROTATE_MASK) != DRM_MODE_ROTATE_180) ||
1958 + !plane->rotation_property)
1959 + return false;
1960 +
1961 +diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
1962 +index 88232698d7a0..3fd35e6b9d53 100644
1963 +--- a/drivers/gpu/drm/drm_modes.c
1964 ++++ b/drivers/gpu/drm/drm_modes.c
1965 +@@ -1672,6 +1672,13 @@ static int drm_mode_parse_cmdline_options(char *str, size_t len,
1966 + }
1967 + }
1968 +
1969 ++ if (!(rotation & DRM_MODE_ROTATE_MASK))
1970 ++ rotation |= DRM_MODE_ROTATE_0;
1971 ++
1972 ++ /* Make sure there is exactly one rotation defined */
1973 ++ if (!is_power_of_2(rotation & DRM_MODE_ROTATE_MASK))
1974 ++ return -EINVAL;
1975 ++
1976 + mode->rotation_reflection = rotation;
1977 +
1978 + return 0;
1979 +diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_ade_reg.h b/drivers/gpu/drm/hisilicon/kirin/kirin_ade_reg.h
1980 +index 0da860200410..e2ac09894a6d 100644
1981 +--- a/drivers/gpu/drm/hisilicon/kirin/kirin_ade_reg.h
1982 ++++ b/drivers/gpu/drm/hisilicon/kirin/kirin_ade_reg.h
1983 +@@ -83,7 +83,6 @@
1984 + #define VSIZE_OFST 20
1985 + #define LDI_INT_EN 0x741C
1986 + #define FRAME_END_INT_EN_OFST 1
1987 +-#define UNDERFLOW_INT_EN_OFST 2
1988 + #define LDI_CTRL 0x7420
1989 + #define BPP_OFST 3
1990 + #define DATA_GATE_EN BIT(2)
1991 +diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
1992 +index 73cd28a6ea07..86000127d4ee 100644
1993 +--- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
1994 ++++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
1995 +@@ -46,7 +46,6 @@ struct ade_hw_ctx {
1996 + struct clk *media_noc_clk;
1997 + struct clk *ade_pix_clk;
1998 + struct reset_control *reset;
1999 +- struct work_struct display_reset_wq;
2000 + bool power_on;
2001 + int irq;
2002 +
2003 +@@ -136,7 +135,6 @@ static void ade_init(struct ade_hw_ctx *ctx)
2004 + */
2005 + ade_update_bits(base + ADE_CTRL, FRM_END_START_OFST,
2006 + FRM_END_START_MASK, REG_EFFECTIVE_IN_ADEEN_FRMEND);
2007 +- ade_update_bits(base + LDI_INT_EN, UNDERFLOW_INT_EN_OFST, MASK(1), 1);
2008 + }
2009 +
2010 + static bool ade_crtc_mode_fixup(struct drm_crtc *crtc,
2011 +@@ -304,17 +302,6 @@ static void ade_crtc_disable_vblank(struct drm_crtc *crtc)
2012 + MASK(1), 0);
2013 + }
2014 +
2015 +-static void drm_underflow_wq(struct work_struct *work)
2016 +-{
2017 +- struct ade_hw_ctx *ctx = container_of(work, struct ade_hw_ctx,
2018 +- display_reset_wq);
2019 +- struct drm_device *drm_dev = ctx->crtc->dev;
2020 +- struct drm_atomic_state *state;
2021 +-
2022 +- state = drm_atomic_helper_suspend(drm_dev);
2023 +- drm_atomic_helper_resume(drm_dev, state);
2024 +-}
2025 +-
2026 + static irqreturn_t ade_irq_handler(int irq, void *data)
2027 + {
2028 + struct ade_hw_ctx *ctx = data;
2029 +@@ -331,12 +318,6 @@ static irqreturn_t ade_irq_handler(int irq, void *data)
2030 + MASK(1), 1);
2031 + drm_crtc_handle_vblank(crtc);
2032 + }
2033 +- if (status & BIT(UNDERFLOW_INT_EN_OFST)) {
2034 +- ade_update_bits(base + LDI_INT_CLR, UNDERFLOW_INT_EN_OFST,
2035 +- MASK(1), 1);
2036 +- DRM_ERROR("LDI underflow!");
2037 +- schedule_work(&ctx->display_reset_wq);
2038 +- }
2039 +
2040 + return IRQ_HANDLED;
2041 + }
2042 +@@ -919,7 +900,6 @@ static void *ade_hw_ctx_alloc(struct platform_device *pdev,
2043 + if (ret)
2044 + return ERR_PTR(-EIO);
2045 +
2046 +- INIT_WORK(&ctx->display_reset_wq, drm_underflow_wq);
2047 + ctx->crtc = crtc;
2048 +
2049 + return ctx;
2050 +diff --git a/drivers/gpu/drm/i915/display/intel_display_power.c b/drivers/gpu/drm/i915/display/intel_display_power.c
2051 +index c002f234ff31..2422af6a99a0 100644
2052 +--- a/drivers/gpu/drm/i915/display/intel_display_power.c
2053 ++++ b/drivers/gpu/drm/i915/display/intel_display_power.c
2054 +@@ -4205,13 +4205,19 @@ static void icl_dbuf_disable(struct drm_i915_private *dev_priv)
2055 +
2056 + static void icl_mbus_init(struct drm_i915_private *dev_priv)
2057 + {
2058 +- u32 val;
2059 ++ u32 mask, val;
2060 +
2061 +- val = MBUS_ABOX_BT_CREDIT_POOL1(16) |
2062 +- MBUS_ABOX_BT_CREDIT_POOL2(16) |
2063 +- MBUS_ABOX_B_CREDIT(1) |
2064 +- MBUS_ABOX_BW_CREDIT(1);
2065 ++ mask = MBUS_ABOX_BT_CREDIT_POOL1_MASK |
2066 ++ MBUS_ABOX_BT_CREDIT_POOL2_MASK |
2067 ++ MBUS_ABOX_B_CREDIT_MASK |
2068 ++ MBUS_ABOX_BW_CREDIT_MASK;
2069 +
2070 ++ val = I915_READ(MBUS_ABOX_CTL);
2071 ++ val &= ~mask;
2072 ++ val |= MBUS_ABOX_BT_CREDIT_POOL1(16) |
2073 ++ MBUS_ABOX_BT_CREDIT_POOL2(16) |
2074 ++ MBUS_ABOX_B_CREDIT(1) |
2075 ++ MBUS_ABOX_BW_CREDIT(1);
2076 + I915_WRITE(MBUS_ABOX_CTL, val);
2077 + }
2078 +
2079 +diff --git a/drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c b/drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c
2080 +index 1d27babff0ce..dc9d3a5ec4a6 100644
2081 +--- a/drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c
2082 ++++ b/drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c
2083 +@@ -375,7 +375,7 @@ static bool assert_mmap_offset(struct drm_i915_private *i915,
2084 +
2085 + obj = i915_gem_object_create_internal(i915, size);
2086 + if (IS_ERR(obj))
2087 +- return PTR_ERR(obj);
2088 ++ return false;
2089 +
2090 + err = create_mmap_offset(obj);
2091 + i915_gem_object_put(obj);
2092 +diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
2093 +index eb0b4b7dc7cc..03c6d6157e4d 100644
2094 +--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
2095 ++++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
2096 +@@ -1112,8 +1112,8 @@ static void mdp5_crtc_wait_for_pp_done(struct drm_crtc *crtc)
2097 + ret = wait_for_completion_timeout(&mdp5_crtc->pp_completion,
2098 + msecs_to_jiffies(50));
2099 + if (ret == 0)
2100 +- dev_warn(dev->dev, "pp done time out, lm=%d\n",
2101 +- mdp5_cstate->pipeline.mixer->lm);
2102 ++ dev_warn_ratelimited(dev->dev, "pp done time out, lm=%d\n",
2103 ++ mdp5_cstate->pipeline.mixer->lm);
2104 + }
2105 +
2106 + static void mdp5_crtc_wait_for_flush_done(struct drm_crtc *crtc)
2107 +diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c
2108 +index 271aa7bbca92..73127948f54d 100644
2109 +--- a/drivers/gpu/drm/msm/dsi/dsi_manager.c
2110 ++++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c
2111 +@@ -336,7 +336,7 @@ static int dsi_mgr_connector_get_modes(struct drm_connector *connector)
2112 + return num;
2113 + }
2114 +
2115 +-static int dsi_mgr_connector_mode_valid(struct drm_connector *connector,
2116 ++static enum drm_mode_status dsi_mgr_connector_mode_valid(struct drm_connector *connector,
2117 + struct drm_display_mode *mode)
2118 + {
2119 + int id = dsi_mgr_connector_get_id(connector);
2120 +@@ -479,6 +479,7 @@ static void dsi_mgr_bridge_post_disable(struct drm_bridge *bridge)
2121 + struct msm_dsi *msm_dsi1 = dsi_mgr_get_dsi(DSI_1);
2122 + struct mipi_dsi_host *host = msm_dsi->host;
2123 + struct drm_panel *panel = msm_dsi->panel;
2124 ++ struct msm_dsi_pll *src_pll;
2125 + bool is_dual_dsi = IS_DUAL_DSI();
2126 + int ret;
2127 +
2128 +@@ -519,6 +520,10 @@ static void dsi_mgr_bridge_post_disable(struct drm_bridge *bridge)
2129 + id, ret);
2130 + }
2131 +
2132 ++ /* Save PLL status if it is a clock source */
2133 ++ src_pll = msm_dsi_phy_get_pll(msm_dsi->phy);
2134 ++ msm_dsi_pll_save_state(src_pll);
2135 ++
2136 + ret = msm_dsi_host_power_off(host);
2137 + if (ret)
2138 + pr_err("%s: host %d power off failed,%d\n", __func__, id, ret);
2139 +diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
2140 +index 3522863a4984..21519229fe73 100644
2141 +--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
2142 ++++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
2143 +@@ -724,10 +724,6 @@ void msm_dsi_phy_disable(struct msm_dsi_phy *phy)
2144 + if (!phy || !phy->cfg->ops.disable)
2145 + return;
2146 +
2147 +- /* Save PLL status if it is a clock source */
2148 +- if (phy->usecase != MSM_DSI_PHY_SLAVE)
2149 +- msm_dsi_pll_save_state(phy->pll);
2150 +-
2151 + phy->cfg->ops.disable(phy);
2152 +
2153 + dsi_phy_regulator_disable(phy);
2154 +diff --git a/drivers/gpu/drm/msm/dsi/pll/dsi_pll_10nm.c b/drivers/gpu/drm/msm/dsi/pll/dsi_pll_10nm.c
2155 +index 8f6100db90ed..aa9385d5bfff 100644
2156 +--- a/drivers/gpu/drm/msm/dsi/pll/dsi_pll_10nm.c
2157 ++++ b/drivers/gpu/drm/msm/dsi/pll/dsi_pll_10nm.c
2158 +@@ -411,6 +411,12 @@ static int dsi_pll_10nm_vco_prepare(struct clk_hw *hw)
2159 + if (pll_10nm->slave)
2160 + dsi_pll_enable_pll_bias(pll_10nm->slave);
2161 +
2162 ++ rc = dsi_pll_10nm_vco_set_rate(hw,pll_10nm->vco_current_rate, 0);
2163 ++ if (rc) {
2164 ++ pr_err("vco_set_rate failed, rc=%d\n", rc);
2165 ++ return rc;
2166 ++ }
2167 ++
2168 + /* Start PLL */
2169 + pll_write(pll_10nm->phy_cmn_mmio + REG_DSI_10nm_PHY_CMN_PLL_CNTRL,
2170 + 0x01);
2171 +diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.c b/drivers/gpu/drm/panfrost/panfrost_mmu.c
2172 +index 3107b0738e40..5d75f8cf6477 100644
2173 +--- a/drivers/gpu/drm/panfrost/panfrost_mmu.c
2174 ++++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c
2175 +@@ -601,33 +601,27 @@ static irqreturn_t panfrost_mmu_irq_handler_thread(int irq, void *data)
2176 + source_id = (fault_status >> 16);
2177 +
2178 + /* Page fault only */
2179 +- if ((status & mask) == BIT(i)) {
2180 +- WARN_ON(exception_type < 0xC1 || exception_type > 0xC4);
2181 +-
2182 ++ ret = -1;
2183 ++ if ((status & mask) == BIT(i) && (exception_type & 0xF8) == 0xC0)
2184 + ret = panfrost_mmu_map_fault_addr(pfdev, i, addr);
2185 +- if (!ret) {
2186 +- mmu_write(pfdev, MMU_INT_CLEAR, BIT(i));
2187 +- status &= ~mask;
2188 +- continue;
2189 +- }
2190 +- }
2191 +
2192 +- /* terminal fault, print info about the fault */
2193 +- dev_err(pfdev->dev,
2194 +- "Unhandled Page fault in AS%d at VA 0x%016llX\n"
2195 +- "Reason: %s\n"
2196 +- "raw fault status: 0x%X\n"
2197 +- "decoded fault status: %s\n"
2198 +- "exception type 0x%X: %s\n"
2199 +- "access type 0x%X: %s\n"
2200 +- "source id 0x%X\n",
2201 +- i, addr,
2202 +- "TODO",
2203 +- fault_status,
2204 +- (fault_status & (1 << 10) ? "DECODER FAULT" : "SLAVE FAULT"),
2205 +- exception_type, panfrost_exception_name(pfdev, exception_type),
2206 +- access_type, access_type_name(pfdev, fault_status),
2207 +- source_id);
2208 ++ if (ret)
2209 ++ /* terminal fault, print info about the fault */
2210 ++ dev_err(pfdev->dev,
2211 ++ "Unhandled Page fault in AS%d at VA 0x%016llX\n"
2212 ++ "Reason: %s\n"
2213 ++ "raw fault status: 0x%X\n"
2214 ++ "decoded fault status: %s\n"
2215 ++ "exception type 0x%X: %s\n"
2216 ++ "access type 0x%X: %s\n"
2217 ++ "source id 0x%X\n",
2218 ++ i, addr,
2219 ++ "TODO",
2220 ++ fault_status,
2221 ++ (fault_status & (1 << 10) ? "DECODER FAULT" : "SLAVE FAULT"),
2222 ++ exception_type, panfrost_exception_name(pfdev, exception_type),
2223 ++ access_type, access_type_name(pfdev, fault_status),
2224 ++ source_id);
2225 +
2226 + mmu_write(pfdev, MMU_INT_CLEAR, mask);
2227 +
2228 +diff --git a/drivers/gpu/drm/selftests/drm_cmdline_selftests.h b/drivers/gpu/drm/selftests/drm_cmdline_selftests.h
2229 +index 6d61a0eb5d64..84e6bc050bf2 100644
2230 +--- a/drivers/gpu/drm/selftests/drm_cmdline_selftests.h
2231 ++++ b/drivers/gpu/drm/selftests/drm_cmdline_selftests.h
2232 +@@ -53,6 +53,7 @@ cmdline_test(drm_cmdline_test_rotate_0)
2233 + cmdline_test(drm_cmdline_test_rotate_90)
2234 + cmdline_test(drm_cmdline_test_rotate_180)
2235 + cmdline_test(drm_cmdline_test_rotate_270)
2236 ++cmdline_test(drm_cmdline_test_rotate_multiple)
2237 + cmdline_test(drm_cmdline_test_rotate_invalid_val)
2238 + cmdline_test(drm_cmdline_test_rotate_truncated)
2239 + cmdline_test(drm_cmdline_test_hmirror)
2240 +diff --git a/drivers/gpu/drm/selftests/test-drm_cmdline_parser.c b/drivers/gpu/drm/selftests/test-drm_cmdline_parser.c
2241 +index 013de9d27c35..035f86c5d648 100644
2242 +--- a/drivers/gpu/drm/selftests/test-drm_cmdline_parser.c
2243 ++++ b/drivers/gpu/drm/selftests/test-drm_cmdline_parser.c
2244 +@@ -856,6 +856,17 @@ static int drm_cmdline_test_rotate_270(void *ignored)
2245 + return 0;
2246 + }
2247 +
2248 ++static int drm_cmdline_test_rotate_multiple(void *ignored)
2249 ++{
2250 ++ struct drm_cmdline_mode mode = { };
2251 ++
2252 ++ FAIL_ON(drm_mode_parse_command_line_for_connector("720x480,rotate=0,rotate=90",
2253 ++ &no_connector,
2254 ++ &mode));
2255 ++
2256 ++ return 0;
2257 ++}
2258 ++
2259 + static int drm_cmdline_test_rotate_invalid_val(void *ignored)
2260 + {
2261 + struct drm_cmdline_mode mode = { };
2262 +@@ -888,7 +899,7 @@ static int drm_cmdline_test_hmirror(void *ignored)
2263 + FAIL_ON(!mode.specified);
2264 + FAIL_ON(mode.xres != 720);
2265 + FAIL_ON(mode.yres != 480);
2266 +- FAIL_ON(mode.rotation_reflection != DRM_MODE_REFLECT_X);
2267 ++ FAIL_ON(mode.rotation_reflection != (DRM_MODE_ROTATE_0 | DRM_MODE_REFLECT_X));
2268 +
2269 + FAIL_ON(mode.refresh_specified);
2270 +
2271 +@@ -913,7 +924,7 @@ static int drm_cmdline_test_vmirror(void *ignored)
2272 + FAIL_ON(!mode.specified);
2273 + FAIL_ON(mode.xres != 720);
2274 + FAIL_ON(mode.yres != 480);
2275 +- FAIL_ON(mode.rotation_reflection != DRM_MODE_REFLECT_Y);
2276 ++ FAIL_ON(mode.rotation_reflection != (DRM_MODE_ROTATE_0 | DRM_MODE_REFLECT_Y));
2277 +
2278 + FAIL_ON(mode.refresh_specified);
2279 +
2280 +diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c b/drivers/gpu/drm/sun4i/sun8i_mixer.c
2281 +index 8b803eb903b8..18b4881f4481 100644
2282 +--- a/drivers/gpu/drm/sun4i/sun8i_mixer.c
2283 ++++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c
2284 +@@ -106,48 +106,128 @@ static const struct de2_fmt_info de2_formats[] = {
2285 + .rgb = true,
2286 + .csc = SUN8I_CSC_MODE_OFF,
2287 + },
2288 ++ {
2289 ++ /* for DE2 VI layer which ignores alpha */
2290 ++ .drm_fmt = DRM_FORMAT_XRGB4444,
2291 ++ .de2_fmt = SUN8I_MIXER_FBFMT_ARGB4444,
2292 ++ .rgb = true,
2293 ++ .csc = SUN8I_CSC_MODE_OFF,
2294 ++ },
2295 + {
2296 + .drm_fmt = DRM_FORMAT_ABGR4444,
2297 + .de2_fmt = SUN8I_MIXER_FBFMT_ABGR4444,
2298 + .rgb = true,
2299 + .csc = SUN8I_CSC_MODE_OFF,
2300 + },
2301 ++ {
2302 ++ /* for DE2 VI layer which ignores alpha */
2303 ++ .drm_fmt = DRM_FORMAT_XBGR4444,
2304 ++ .de2_fmt = SUN8I_MIXER_FBFMT_ABGR4444,
2305 ++ .rgb = true,
2306 ++ .csc = SUN8I_CSC_MODE_OFF,
2307 ++ },
2308 + {
2309 + .drm_fmt = DRM_FORMAT_RGBA4444,
2310 + .de2_fmt = SUN8I_MIXER_FBFMT_RGBA4444,
2311 + .rgb = true,
2312 + .csc = SUN8I_CSC_MODE_OFF,
2313 + },
2314 ++ {
2315 ++ /* for DE2 VI layer which ignores alpha */
2316 ++ .drm_fmt = DRM_FORMAT_RGBX4444,
2317 ++ .de2_fmt = SUN8I_MIXER_FBFMT_RGBA4444,
2318 ++ .rgb = true,
2319 ++ .csc = SUN8I_CSC_MODE_OFF,
2320 ++ },
2321 + {
2322 + .drm_fmt = DRM_FORMAT_BGRA4444,
2323 + .de2_fmt = SUN8I_MIXER_FBFMT_BGRA4444,
2324 + .rgb = true,
2325 + .csc = SUN8I_CSC_MODE_OFF,
2326 + },
2327 ++ {
2328 ++ /* for DE2 VI layer which ignores alpha */
2329 ++ .drm_fmt = DRM_FORMAT_BGRX4444,
2330 ++ .de2_fmt = SUN8I_MIXER_FBFMT_BGRA4444,
2331 ++ .rgb = true,
2332 ++ .csc = SUN8I_CSC_MODE_OFF,
2333 ++ },
2334 + {
2335 + .drm_fmt = DRM_FORMAT_ARGB1555,
2336 + .de2_fmt = SUN8I_MIXER_FBFMT_ARGB1555,
2337 + .rgb = true,
2338 + .csc = SUN8I_CSC_MODE_OFF,
2339 + },
2340 ++ {
2341 ++ /* for DE2 VI layer which ignores alpha */
2342 ++ .drm_fmt = DRM_FORMAT_XRGB1555,
2343 ++ .de2_fmt = SUN8I_MIXER_FBFMT_ARGB1555,
2344 ++ .rgb = true,
2345 ++ .csc = SUN8I_CSC_MODE_OFF,
2346 ++ },
2347 + {
2348 + .drm_fmt = DRM_FORMAT_ABGR1555,
2349 + .de2_fmt = SUN8I_MIXER_FBFMT_ABGR1555,
2350 + .rgb = true,
2351 + .csc = SUN8I_CSC_MODE_OFF,
2352 + },
2353 ++ {
2354 ++ /* for DE2 VI layer which ignores alpha */
2355 ++ .drm_fmt = DRM_FORMAT_XBGR1555,
2356 ++ .de2_fmt = SUN8I_MIXER_FBFMT_ABGR1555,
2357 ++ .rgb = true,
2358 ++ .csc = SUN8I_CSC_MODE_OFF,
2359 ++ },
2360 + {
2361 + .drm_fmt = DRM_FORMAT_RGBA5551,
2362 + .de2_fmt = SUN8I_MIXER_FBFMT_RGBA5551,
2363 + .rgb = true,
2364 + .csc = SUN8I_CSC_MODE_OFF,
2365 + },
2366 ++ {
2367 ++ /* for DE2 VI layer which ignores alpha */
2368 ++ .drm_fmt = DRM_FORMAT_RGBX5551,
2369 ++ .de2_fmt = SUN8I_MIXER_FBFMT_RGBA5551,
2370 ++ .rgb = true,
2371 ++ .csc = SUN8I_CSC_MODE_OFF,
2372 ++ },
2373 + {
2374 + .drm_fmt = DRM_FORMAT_BGRA5551,
2375 + .de2_fmt = SUN8I_MIXER_FBFMT_BGRA5551,
2376 + .rgb = true,
2377 + .csc = SUN8I_CSC_MODE_OFF,
2378 + },
2379 ++ {
2380 ++ /* for DE2 VI layer which ignores alpha */
2381 ++ .drm_fmt = DRM_FORMAT_BGRX5551,
2382 ++ .de2_fmt = SUN8I_MIXER_FBFMT_BGRA5551,
2383 ++ .rgb = true,
2384 ++ .csc = SUN8I_CSC_MODE_OFF,
2385 ++ },
2386 ++ {
2387 ++ .drm_fmt = DRM_FORMAT_ARGB2101010,
2388 ++ .de2_fmt = SUN8I_MIXER_FBFMT_ARGB2101010,
2389 ++ .rgb = true,
2390 ++ .csc = SUN8I_CSC_MODE_OFF,
2391 ++ },
2392 ++ {
2393 ++ .drm_fmt = DRM_FORMAT_ABGR2101010,
2394 ++ .de2_fmt = SUN8I_MIXER_FBFMT_ABGR2101010,
2395 ++ .rgb = true,
2396 ++ .csc = SUN8I_CSC_MODE_OFF,
2397 ++ },
2398 ++ {
2399 ++ .drm_fmt = DRM_FORMAT_RGBA1010102,
2400 ++ .de2_fmt = SUN8I_MIXER_FBFMT_RGBA1010102,
2401 ++ .rgb = true,
2402 ++ .csc = SUN8I_CSC_MODE_OFF,
2403 ++ },
2404 ++ {
2405 ++ .drm_fmt = DRM_FORMAT_BGRA1010102,
2406 ++ .de2_fmt = SUN8I_MIXER_FBFMT_BGRA1010102,
2407 ++ .rgb = true,
2408 ++ .csc = SUN8I_CSC_MODE_OFF,
2409 ++ },
2410 + {
2411 + .drm_fmt = DRM_FORMAT_UYVY,
2412 + .de2_fmt = SUN8I_MIXER_FBFMT_UYVY,
2413 +@@ -196,12 +276,6 @@ static const struct de2_fmt_info de2_formats[] = {
2414 + .rgb = false,
2415 + .csc = SUN8I_CSC_MODE_YUV2RGB,
2416 + },
2417 +- {
2418 +- .drm_fmt = DRM_FORMAT_YUV444,
2419 +- .de2_fmt = SUN8I_MIXER_FBFMT_RGB888,
2420 +- .rgb = true,
2421 +- .csc = SUN8I_CSC_MODE_YUV2RGB,
2422 +- },
2423 + {
2424 + .drm_fmt = DRM_FORMAT_YUV422,
2425 + .de2_fmt = SUN8I_MIXER_FBFMT_YUV422,
2426 +@@ -220,12 +294,6 @@ static const struct de2_fmt_info de2_formats[] = {
2427 + .rgb = false,
2428 + .csc = SUN8I_CSC_MODE_YUV2RGB,
2429 + },
2430 +- {
2431 +- .drm_fmt = DRM_FORMAT_YVU444,
2432 +- .de2_fmt = SUN8I_MIXER_FBFMT_RGB888,
2433 +- .rgb = true,
2434 +- .csc = SUN8I_CSC_MODE_YVU2RGB,
2435 +- },
2436 + {
2437 + .drm_fmt = DRM_FORMAT_YVU422,
2438 + .de2_fmt = SUN8I_MIXER_FBFMT_YUV422,
2439 +@@ -244,6 +312,18 @@ static const struct de2_fmt_info de2_formats[] = {
2440 + .rgb = false,
2441 + .csc = SUN8I_CSC_MODE_YVU2RGB,
2442 + },
2443 ++ {
2444 ++ .drm_fmt = DRM_FORMAT_P010,
2445 ++ .de2_fmt = SUN8I_MIXER_FBFMT_P010_YUV,
2446 ++ .rgb = false,
2447 ++ .csc = SUN8I_CSC_MODE_YUV2RGB,
2448 ++ },
2449 ++ {
2450 ++ .drm_fmt = DRM_FORMAT_P210,
2451 ++ .de2_fmt = SUN8I_MIXER_FBFMT_P210_YUV,
2452 ++ .rgb = false,
2453 ++ .csc = SUN8I_CSC_MODE_YUV2RGB,
2454 ++ },
2455 + };
2456 +
2457 + const struct de2_fmt_info *sun8i_mixer_format_info(u32 format)
2458 +diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.h b/drivers/gpu/drm/sun4i/sun8i_mixer.h
2459 +index c6cc94057faf..345b28b0a80a 100644
2460 +--- a/drivers/gpu/drm/sun4i/sun8i_mixer.h
2461 ++++ b/drivers/gpu/drm/sun4i/sun8i_mixer.h
2462 +@@ -93,6 +93,10 @@
2463 + #define SUN8I_MIXER_FBFMT_ABGR1555 17
2464 + #define SUN8I_MIXER_FBFMT_RGBA5551 18
2465 + #define SUN8I_MIXER_FBFMT_BGRA5551 19
2466 ++#define SUN8I_MIXER_FBFMT_ARGB2101010 20
2467 ++#define SUN8I_MIXER_FBFMT_ABGR2101010 21
2468 ++#define SUN8I_MIXER_FBFMT_RGBA1010102 22
2469 ++#define SUN8I_MIXER_FBFMT_BGRA1010102 23
2470 +
2471 + #define SUN8I_MIXER_FBFMT_YUYV 0
2472 + #define SUN8I_MIXER_FBFMT_UYVY 1
2473 +@@ -109,6 +113,13 @@
2474 + /* format 12 is semi-planar YUV411 UVUV */
2475 + /* format 13 is semi-planar YUV411 VUVU */
2476 + #define SUN8I_MIXER_FBFMT_YUV411 14
2477 ++/* format 15 doesn't exist */
2478 ++/* format 16 is P010 YVU */
2479 ++#define SUN8I_MIXER_FBFMT_P010_YUV 17
2480 ++/* format 18 is P210 YVU */
2481 ++#define SUN8I_MIXER_FBFMT_P210_YUV 19
2482 ++/* format 20 is packed YVU444 10-bit */
2483 ++/* format 21 is packed YUV444 10-bit */
2484 +
2485 + /*
2486 + * Sub-engines listed bellow are unused for now. The EN registers are here only
2487 +diff --git a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
2488 +index 42d445d23773..b8398ca18b0f 100644
2489 +--- a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
2490 ++++ b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
2491 +@@ -398,24 +398,66 @@ static const struct drm_plane_funcs sun8i_vi_layer_funcs = {
2492 + };
2493 +
2494 + /*
2495 +- * While all RGB formats are supported, VI planes don't support
2496 +- * alpha blending, so there is no point having formats with alpha
2497 +- * channel if their opaque analog exist.
2498 ++ * While DE2 VI layer supports same RGB formats as UI layer, alpha
2499 ++ * channel is ignored. This structure lists all unique variants
2500 ++ * where alpha channel is replaced with "don't care" (X) channel.
2501 + */
2502 + static const u32 sun8i_vi_layer_formats[] = {
2503 ++ DRM_FORMAT_BGR565,
2504 ++ DRM_FORMAT_BGR888,
2505 ++ DRM_FORMAT_BGRX4444,
2506 ++ DRM_FORMAT_BGRX5551,
2507 ++ DRM_FORMAT_BGRX8888,
2508 ++ DRM_FORMAT_RGB565,
2509 ++ DRM_FORMAT_RGB888,
2510 ++ DRM_FORMAT_RGBX4444,
2511 ++ DRM_FORMAT_RGBX5551,
2512 ++ DRM_FORMAT_RGBX8888,
2513 ++ DRM_FORMAT_XBGR1555,
2514 ++ DRM_FORMAT_XBGR4444,
2515 ++ DRM_FORMAT_XBGR8888,
2516 ++ DRM_FORMAT_XRGB1555,
2517 ++ DRM_FORMAT_XRGB4444,
2518 ++ DRM_FORMAT_XRGB8888,
2519 ++
2520 ++ DRM_FORMAT_NV16,
2521 ++ DRM_FORMAT_NV12,
2522 ++ DRM_FORMAT_NV21,
2523 ++ DRM_FORMAT_NV61,
2524 ++ DRM_FORMAT_UYVY,
2525 ++ DRM_FORMAT_VYUY,
2526 ++ DRM_FORMAT_YUYV,
2527 ++ DRM_FORMAT_YVYU,
2528 ++ DRM_FORMAT_YUV411,
2529 ++ DRM_FORMAT_YUV420,
2530 ++ DRM_FORMAT_YUV422,
2531 ++ DRM_FORMAT_YVU411,
2532 ++ DRM_FORMAT_YVU420,
2533 ++ DRM_FORMAT_YVU422,
2534 ++};
2535 ++
2536 ++static const u32 sun8i_vi_layer_de3_formats[] = {
2537 + DRM_FORMAT_ABGR1555,
2538 ++ DRM_FORMAT_ABGR2101010,
2539 + DRM_FORMAT_ABGR4444,
2540 ++ DRM_FORMAT_ABGR8888,
2541 + DRM_FORMAT_ARGB1555,
2542 ++ DRM_FORMAT_ARGB2101010,
2543 + DRM_FORMAT_ARGB4444,
2544 ++ DRM_FORMAT_ARGB8888,
2545 + DRM_FORMAT_BGR565,
2546 + DRM_FORMAT_BGR888,
2547 ++ DRM_FORMAT_BGRA1010102,
2548 + DRM_FORMAT_BGRA5551,
2549 + DRM_FORMAT_BGRA4444,
2550 ++ DRM_FORMAT_BGRA8888,
2551 + DRM_FORMAT_BGRX8888,
2552 + DRM_FORMAT_RGB565,
2553 + DRM_FORMAT_RGB888,
2554 ++ DRM_FORMAT_RGBA1010102,
2555 + DRM_FORMAT_RGBA4444,
2556 + DRM_FORMAT_RGBA5551,
2557 ++ DRM_FORMAT_RGBA8888,
2558 + DRM_FORMAT_RGBX8888,
2559 + DRM_FORMAT_XBGR8888,
2560 + DRM_FORMAT_XRGB8888,
2561 +@@ -424,6 +466,8 @@ static const u32 sun8i_vi_layer_formats[] = {
2562 + DRM_FORMAT_NV12,
2563 + DRM_FORMAT_NV21,
2564 + DRM_FORMAT_NV61,
2565 ++ DRM_FORMAT_P010,
2566 ++ DRM_FORMAT_P210,
2567 + DRM_FORMAT_UYVY,
2568 + DRM_FORMAT_VYUY,
2569 + DRM_FORMAT_YUYV,
2570 +@@ -431,11 +475,9 @@ static const u32 sun8i_vi_layer_formats[] = {
2571 + DRM_FORMAT_YUV411,
2572 + DRM_FORMAT_YUV420,
2573 + DRM_FORMAT_YUV422,
2574 +- DRM_FORMAT_YUV444,
2575 + DRM_FORMAT_YVU411,
2576 + DRM_FORMAT_YVU420,
2577 + DRM_FORMAT_YVU422,
2578 +- DRM_FORMAT_YVU444,
2579 + };
2580 +
2581 + struct sun8i_vi_layer *sun8i_vi_layer_init_one(struct drm_device *drm,
2582 +@@ -443,19 +485,27 @@ struct sun8i_vi_layer *sun8i_vi_layer_init_one(struct drm_device *drm,
2583 + int index)
2584 + {
2585 + u32 supported_encodings, supported_ranges;
2586 ++ unsigned int plane_cnt, format_count;
2587 + struct sun8i_vi_layer *layer;
2588 +- unsigned int plane_cnt;
2589 ++ const u32 *formats;
2590 + int ret;
2591 +
2592 + layer = devm_kzalloc(drm->dev, sizeof(*layer), GFP_KERNEL);
2593 + if (!layer)
2594 + return ERR_PTR(-ENOMEM);
2595 +
2596 ++ if (mixer->cfg->is_de3) {
2597 ++ formats = sun8i_vi_layer_de3_formats;
2598 ++ format_count = ARRAY_SIZE(sun8i_vi_layer_de3_formats);
2599 ++ } else {
2600 ++ formats = sun8i_vi_layer_formats;
2601 ++ format_count = ARRAY_SIZE(sun8i_vi_layer_formats);
2602 ++ }
2603 ++
2604 + /* possible crtcs are set later */
2605 + ret = drm_universal_plane_init(drm, &layer->plane, 0,
2606 + &sun8i_vi_layer_funcs,
2607 +- sun8i_vi_layer_formats,
2608 +- ARRAY_SIZE(sun8i_vi_layer_formats),
2609 ++ formats, format_count,
2610 + NULL, DRM_PLANE_TYPE_OVERLAY, NULL);
2611 + if (ret) {
2612 + dev_err(drm->dev, "Couldn't initialize layer\n");
2613 +diff --git a/drivers/gpu/drm/virtio/virtgpu_object.c b/drivers/gpu/drm/virtio/virtgpu_object.c
2614 +index 09b526518f5a..8de93ccacaac 100644
2615 +--- a/drivers/gpu/drm/virtio/virtgpu_object.c
2616 ++++ b/drivers/gpu/drm/virtio/virtgpu_object.c
2617 +@@ -23,38 +23,44 @@
2618 + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2619 + */
2620 +
2621 ++#include <linux/moduleparam.h>
2622 ++
2623 + #include <drm/ttm/ttm_execbuf_util.h>
2624 +
2625 + #include "virtgpu_drv.h"
2626 +
2627 ++static int virtio_gpu_virglrenderer_workaround = 1;
2628 ++module_param_named(virglhack, virtio_gpu_virglrenderer_workaround, int, 0400);
2629 ++
2630 + static int virtio_gpu_resource_id_get(struct virtio_gpu_device *vgdev,
2631 + uint32_t *resid)
2632 + {
2633 +-#if 0
2634 +- int handle = ida_alloc(&vgdev->resource_ida, GFP_KERNEL);
2635 +-
2636 +- if (handle < 0)
2637 +- return handle;
2638 +-#else
2639 +- static int handle;
2640 +-
2641 +- /*
2642 +- * FIXME: dirty hack to avoid re-using IDs, virglrenderer
2643 +- * can't deal with that. Needs fixing in virglrenderer, also
2644 +- * should figure a better way to handle that in the guest.
2645 +- */
2646 +- handle++;
2647 +-#endif
2648 +-
2649 +- *resid = handle + 1;
2650 ++ if (virtio_gpu_virglrenderer_workaround) {
2651 ++ /*
2652 ++ * Hack to avoid re-using resource IDs.
2653 ++ *
2654 ++ * virglrenderer versions up to (and including) 0.7.0
2655 ++ * can't deal with that. virglrenderer commit
2656 ++ * "f91a9dd35715 Fix unlinking resources from hash
2657 ++ * table." (Feb 2019) fixes the bug.
2658 ++ */
2659 ++ static atomic_t seqno = ATOMIC_INIT(0);
2660 ++ int handle = atomic_inc_return(&seqno);
2661 ++ *resid = handle + 1;
2662 ++ } else {
2663 ++ int handle = ida_alloc(&vgdev->resource_ida, GFP_KERNEL);
2664 ++ if (handle < 0)
2665 ++ return handle;
2666 ++ *resid = handle + 1;
2667 ++ }
2668 + return 0;
2669 + }
2670 +
2671 + static void virtio_gpu_resource_id_put(struct virtio_gpu_device *vgdev, uint32_t id)
2672 + {
2673 +-#if 0
2674 +- ida_free(&vgdev->resource_ida, id - 1);
2675 +-#endif
2676 ++ if (!virtio_gpu_virglrenderer_workaround) {
2677 ++ ida_free(&vgdev->resource_ida, id - 1);
2678 ++ }
2679 + }
2680 +
2681 + static void virtio_gpu_ttm_bo_destroy(struct ttm_buffer_object *tbo)
2682 +diff --git a/drivers/hwmon/adt7462.c b/drivers/hwmon/adt7462.c
2683 +index 9632e2e3c4bb..319a0519ebdb 100644
2684 +--- a/drivers/hwmon/adt7462.c
2685 ++++ b/drivers/hwmon/adt7462.c
2686 +@@ -413,7 +413,7 @@ static int ADT7462_REG_VOLT(struct adt7462_data *data, int which)
2687 + return 0x95;
2688 + break;
2689 + }
2690 +- return -ENODEV;
2691 ++ return 0;
2692 + }
2693 +
2694 + /* Provide labels for sysfs */
2695 +diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
2696 +index 5920c0085d35..319e4b4ae639 100644
2697 +--- a/drivers/infiniband/core/cm.c
2698 ++++ b/drivers/infiniband/core/cm.c
2699 +@@ -1228,6 +1228,7 @@ struct ib_cm_id *ib_cm_insert_listen(struct ib_device *device,
2700 + /* Sharing an ib_cm_id with different handlers is not
2701 + * supported */
2702 + spin_unlock_irqrestore(&cm.lock, flags);
2703 ++ ib_destroy_cm_id(cm_id);
2704 + return ERR_PTR(-EINVAL);
2705 + }
2706 + atomic_inc(&cm_id_priv->refcount);
2707 +diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
2708 +index 9008937f8ed8..6c12da176981 100644
2709 +--- a/drivers/infiniband/core/cma.c
2710 ++++ b/drivers/infiniband/core/cma.c
2711 +@@ -3155,19 +3155,26 @@ int rdma_resolve_addr(struct rdma_cm_id *id, struct sockaddr *src_addr,
2712 + int ret;
2713 +
2714 + id_priv = container_of(id, struct rdma_id_private, id);
2715 ++ memcpy(cma_dst_addr(id_priv), dst_addr, rdma_addr_size(dst_addr));
2716 + if (id_priv->state == RDMA_CM_IDLE) {
2717 + ret = cma_bind_addr(id, src_addr, dst_addr);
2718 +- if (ret)
2719 ++ if (ret) {
2720 ++ memset(cma_dst_addr(id_priv), 0,
2721 ++ rdma_addr_size(dst_addr));
2722 + return ret;
2723 ++ }
2724 + }
2725 +
2726 +- if (cma_family(id_priv) != dst_addr->sa_family)
2727 ++ if (cma_family(id_priv) != dst_addr->sa_family) {
2728 ++ memset(cma_dst_addr(id_priv), 0, rdma_addr_size(dst_addr));
2729 + return -EINVAL;
2730 ++ }
2731 +
2732 +- if (!cma_comp_exch(id_priv, RDMA_CM_ADDR_BOUND, RDMA_CM_ADDR_QUERY))
2733 ++ if (!cma_comp_exch(id_priv, RDMA_CM_ADDR_BOUND, RDMA_CM_ADDR_QUERY)) {
2734 ++ memset(cma_dst_addr(id_priv), 0, rdma_addr_size(dst_addr));
2735 + return -EINVAL;
2736 ++ }
2737 +
2738 +- memcpy(cma_dst_addr(id_priv), dst_addr, rdma_addr_size(dst_addr));
2739 + if (cma_any_addr(dst_addr)) {
2740 + ret = cma_resolve_loopback(id_priv);
2741 + } else {
2742 +diff --git a/drivers/infiniband/core/core_priv.h b/drivers/infiniband/core/core_priv.h
2743 +index 9b30773f2da0..86a17a87f181 100644
2744 +--- a/drivers/infiniband/core/core_priv.h
2745 ++++ b/drivers/infiniband/core/core_priv.h
2746 +@@ -338,6 +338,21 @@ static inline struct ib_qp *_ib_create_qp(struct ib_device *dev,
2747 + qp->pd = pd;
2748 + qp->uobject = uobj;
2749 + qp->real_qp = qp;
2750 ++
2751 ++ qp->qp_type = attr->qp_type;
2752 ++ qp->qp_context = attr->qp_context;
2753 ++ qp->rwq_ind_tbl = attr->rwq_ind_tbl;
2754 ++ qp->send_cq = attr->send_cq;
2755 ++ qp->recv_cq = attr->recv_cq;
2756 ++ qp->srq = attr->srq;
2757 ++ qp->rwq_ind_tbl = attr->rwq_ind_tbl;
2758 ++ qp->event_handler = attr->event_handler;
2759 ++
2760 ++ atomic_set(&qp->usecnt, 0);
2761 ++ spin_lock_init(&qp->mr_lock);
2762 ++ INIT_LIST_HEAD(&qp->rdma_mrs);
2763 ++ INIT_LIST_HEAD(&qp->sig_mrs);
2764 ++
2765 + /*
2766 + * We don't track XRC QPs for now, because they don't have PD
2767 + * and more importantly they are created internaly by driver,
2768 +diff --git a/drivers/infiniband/core/iwcm.c b/drivers/infiniband/core/iwcm.c
2769 +index ade71823370f..da8adadf4755 100644
2770 +--- a/drivers/infiniband/core/iwcm.c
2771 ++++ b/drivers/infiniband/core/iwcm.c
2772 +@@ -159,8 +159,10 @@ static void dealloc_work_entries(struct iwcm_id_private *cm_id_priv)
2773 + {
2774 + struct list_head *e, *tmp;
2775 +
2776 +- list_for_each_safe(e, tmp, &cm_id_priv->work_free_list)
2777 ++ list_for_each_safe(e, tmp, &cm_id_priv->work_free_list) {
2778 ++ list_del(e);
2779 + kfree(list_entry(e, struct iwcm_work, free_list));
2780 ++ }
2781 + }
2782 +
2783 + static int alloc_work_entries(struct iwcm_id_private *cm_id_priv, int count)
2784 +diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c
2785 +index c03af08b80e7..ad4301ecfa59 100644
2786 +--- a/drivers/infiniband/core/nldev.c
2787 ++++ b/drivers/infiniband/core/nldev.c
2788 +@@ -1711,6 +1711,8 @@ static int nldev_stat_set_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
2789 + if (ret)
2790 + goto err_msg;
2791 + } else {
2792 ++ if (!tb[RDMA_NLDEV_ATTR_RES_LQPN])
2793 ++ goto err_msg;
2794 + qpn = nla_get_u32(tb[RDMA_NLDEV_ATTR_RES_LQPN]);
2795 + if (tb[RDMA_NLDEV_ATTR_STAT_COUNTER_ID]) {
2796 + cntn = nla_get_u32(tb[RDMA_NLDEV_ATTR_STAT_COUNTER_ID]);
2797 +diff --git a/drivers/infiniband/core/rw.c b/drivers/infiniband/core/rw.c
2798 +index 5337393d4dfe..bb10cbfa0070 100644
2799 +--- a/drivers/infiniband/core/rw.c
2800 ++++ b/drivers/infiniband/core/rw.c
2801 +@@ -268,6 +268,23 @@ static int rdma_rw_init_single_wr(struct rdma_rw_ctx *ctx, struct ib_qp *qp,
2802 + return 1;
2803 + }
2804 +
2805 ++static void rdma_rw_unmap_sg(struct ib_device *dev, struct scatterlist *sg,
2806 ++ u32 sg_cnt, enum dma_data_direction dir)
2807 ++{
2808 ++ if (is_pci_p2pdma_page(sg_page(sg)))
2809 ++ pci_p2pdma_unmap_sg(dev->dma_device, sg, sg_cnt, dir);
2810 ++ else
2811 ++ ib_dma_unmap_sg(dev, sg, sg_cnt, dir);
2812 ++}
2813 ++
2814 ++static int rdma_rw_map_sg(struct ib_device *dev, struct scatterlist *sg,
2815 ++ u32 sg_cnt, enum dma_data_direction dir)
2816 ++{
2817 ++ if (is_pci_p2pdma_page(sg_page(sg)))
2818 ++ return pci_p2pdma_map_sg(dev->dma_device, sg, sg_cnt, dir);
2819 ++ return ib_dma_map_sg(dev, sg, sg_cnt, dir);
2820 ++}
2821 ++
2822 + /**
2823 + * rdma_rw_ctx_init - initialize a RDMA READ/WRITE context
2824 + * @ctx: context to initialize
2825 +@@ -290,11 +307,7 @@ int rdma_rw_ctx_init(struct rdma_rw_ctx *ctx, struct ib_qp *qp, u8 port_num,
2826 + struct ib_device *dev = qp->pd->device;
2827 + int ret;
2828 +
2829 +- if (is_pci_p2pdma_page(sg_page(sg)))
2830 +- ret = pci_p2pdma_map_sg(dev->dma_device, sg, sg_cnt, dir);
2831 +- else
2832 +- ret = ib_dma_map_sg(dev, sg, sg_cnt, dir);
2833 +-
2834 ++ ret = rdma_rw_map_sg(dev, sg, sg_cnt, dir);
2835 + if (!ret)
2836 + return -ENOMEM;
2837 + sg_cnt = ret;
2838 +@@ -333,7 +346,7 @@ int rdma_rw_ctx_init(struct rdma_rw_ctx *ctx, struct ib_qp *qp, u8 port_num,
2839 + return ret;
2840 +
2841 + out_unmap_sg:
2842 +- ib_dma_unmap_sg(dev, sg, sg_cnt, dir);
2843 ++ rdma_rw_unmap_sg(dev, sg, sg_cnt, dir);
2844 + return ret;
2845 + }
2846 + EXPORT_SYMBOL(rdma_rw_ctx_init);
2847 +@@ -583,11 +596,7 @@ void rdma_rw_ctx_destroy(struct rdma_rw_ctx *ctx, struct ib_qp *qp, u8 port_num,
2848 + break;
2849 + }
2850 +
2851 +- if (is_pci_p2pdma_page(sg_page(sg)))
2852 +- pci_p2pdma_unmap_sg(qp->pd->device->dma_device, sg,
2853 +- sg_cnt, dir);
2854 +- else
2855 +- ib_dma_unmap_sg(qp->pd->device, sg, sg_cnt, dir);
2856 ++ rdma_rw_unmap_sg(qp->pd->device, sg, sg_cnt, dir);
2857 + }
2858 + EXPORT_SYMBOL(rdma_rw_ctx_destroy);
2859 +
2860 +diff --git a/drivers/infiniband/core/security.c b/drivers/infiniband/core/security.c
2861 +index 2b4d80393bd0..2d5608315dc8 100644
2862 +--- a/drivers/infiniband/core/security.c
2863 ++++ b/drivers/infiniband/core/security.c
2864 +@@ -340,15 +340,19 @@ static struct ib_ports_pkeys *get_new_pps(const struct ib_qp *qp,
2865 + return NULL;
2866 +
2867 + if (qp_attr_mask & IB_QP_PORT)
2868 +- new_pps->main.port_num =
2869 +- (qp_pps) ? qp_pps->main.port_num : qp_attr->port_num;
2870 ++ new_pps->main.port_num = qp_attr->port_num;
2871 ++ else if (qp_pps)
2872 ++ new_pps->main.port_num = qp_pps->main.port_num;
2873 ++
2874 + if (qp_attr_mask & IB_QP_PKEY_INDEX)
2875 +- new_pps->main.pkey_index = (qp_pps) ? qp_pps->main.pkey_index :
2876 +- qp_attr->pkey_index;
2877 ++ new_pps->main.pkey_index = qp_attr->pkey_index;
2878 ++ else if (qp_pps)
2879 ++ new_pps->main.pkey_index = qp_pps->main.pkey_index;
2880 ++
2881 + if ((qp_attr_mask & IB_QP_PKEY_INDEX) && (qp_attr_mask & IB_QP_PORT))
2882 + new_pps->main.state = IB_PORT_PKEY_VALID;
2883 +
2884 +- if (!(qp_attr_mask & (IB_QP_PKEY_INDEX || IB_QP_PORT)) && qp_pps) {
2885 ++ if (!(qp_attr_mask & (IB_QP_PKEY_INDEX | IB_QP_PORT)) && qp_pps) {
2886 + new_pps->main.port_num = qp_pps->main.port_num;
2887 + new_pps->main.pkey_index = qp_pps->main.pkey_index;
2888 + if (qp_pps->main.state != IB_PORT_PKEY_NOT_VALID)
2889 +diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
2890 +index 300353c1e5f1..e2ddcb0dc4ee 100644
2891 +--- a/drivers/infiniband/core/uverbs_cmd.c
2892 ++++ b/drivers/infiniband/core/uverbs_cmd.c
2893 +@@ -1431,17 +1431,7 @@ static int create_qp(struct uverbs_attr_bundle *attrs,
2894 + if (ret)
2895 + goto err_cb;
2896 +
2897 +- qp->pd = pd;
2898 +- qp->send_cq = attr.send_cq;
2899 +- qp->recv_cq = attr.recv_cq;
2900 +- qp->srq = attr.srq;
2901 +- qp->rwq_ind_tbl = ind_tbl;
2902 +- qp->event_handler = attr.event_handler;
2903 +- qp->qp_context = attr.qp_context;
2904 +- qp->qp_type = attr.qp_type;
2905 +- atomic_set(&qp->usecnt, 0);
2906 + atomic_inc(&pd->usecnt);
2907 +- qp->port = 0;
2908 + if (attr.send_cq)
2909 + atomic_inc(&attr.send_cq->usecnt);
2910 + if (attr.recv_cq)
2911 +diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
2912 +index 35c2841a569e..6c4093d0a91d 100644
2913 +--- a/drivers/infiniband/core/verbs.c
2914 ++++ b/drivers/infiniband/core/verbs.c
2915 +@@ -1180,16 +1180,6 @@ struct ib_qp *ib_create_qp_user(struct ib_pd *pd,
2916 + if (ret)
2917 + goto err;
2918 +
2919 +- qp->qp_type = qp_init_attr->qp_type;
2920 +- qp->rwq_ind_tbl = qp_init_attr->rwq_ind_tbl;
2921 +-
2922 +- atomic_set(&qp->usecnt, 0);
2923 +- qp->mrs_used = 0;
2924 +- spin_lock_init(&qp->mr_lock);
2925 +- INIT_LIST_HEAD(&qp->rdma_mrs);
2926 +- INIT_LIST_HEAD(&qp->sig_mrs);
2927 +- qp->port = 0;
2928 +-
2929 + if (qp_init_attr->qp_type == IB_QPT_XRC_TGT) {
2930 + struct ib_qp *xrc_qp =
2931 + create_xrc_qp_user(qp, qp_init_attr, udata);
2932 +diff --git a/drivers/infiniband/hw/hfi1/verbs.c b/drivers/infiniband/hw/hfi1/verbs.c
2933 +index 089e201d7550..2f6323ad9c59 100644
2934 +--- a/drivers/infiniband/hw/hfi1/verbs.c
2935 ++++ b/drivers/infiniband/hw/hfi1/verbs.c
2936 +@@ -515,10 +515,11 @@ static inline void hfi1_handle_packet(struct hfi1_packet *packet,
2937 + opa_get_lid(packet->dlid, 9B));
2938 + if (!mcast)
2939 + goto drop;
2940 ++ rcu_read_lock();
2941 + list_for_each_entry_rcu(p, &mcast->qp_list, list) {
2942 + packet->qp = p->qp;
2943 + if (hfi1_do_pkey_check(packet))
2944 +- goto drop;
2945 ++ goto unlock_drop;
2946 + spin_lock_irqsave(&packet->qp->r_lock, flags);
2947 + packet_handler = qp_ok(packet);
2948 + if (likely(packet_handler))
2949 +@@ -527,6 +528,7 @@ static inline void hfi1_handle_packet(struct hfi1_packet *packet,
2950 + ibp->rvp.n_pkt_drops++;
2951 + spin_unlock_irqrestore(&packet->qp->r_lock, flags);
2952 + }
2953 ++ rcu_read_unlock();
2954 + /*
2955 + * Notify rvt_multicast_detach() if it is waiting for us
2956 + * to finish.
2957 +diff --git a/drivers/infiniband/hw/qib/qib_verbs.c b/drivers/infiniband/hw/qib/qib_verbs.c
2958 +index 33778d451b82..5ef93f8f17a1 100644
2959 +--- a/drivers/infiniband/hw/qib/qib_verbs.c
2960 ++++ b/drivers/infiniband/hw/qib/qib_verbs.c
2961 +@@ -329,8 +329,10 @@ void qib_ib_rcv(struct qib_ctxtdata *rcd, void *rhdr, void *data, u32 tlen)
2962 + if (mcast == NULL)
2963 + goto drop;
2964 + this_cpu_inc(ibp->pmastats->n_multicast_rcv);
2965 ++ rcu_read_lock();
2966 + list_for_each_entry_rcu(p, &mcast->qp_list, list)
2967 + qib_qp_rcv(rcd, hdr, 1, data, tlen, p->qp);
2968 ++ rcu_read_unlock();
2969 + /*
2970 + * Notify rvt_multicast_detach() if it is waiting for us
2971 + * to finish.
2972 +diff --git a/drivers/infiniband/sw/siw/siw_main.c b/drivers/infiniband/sw/siw/siw_main.c
2973 +index fb01407a310f..130b1e31b978 100644
2974 +--- a/drivers/infiniband/sw/siw/siw_main.c
2975 ++++ b/drivers/infiniband/sw/siw/siw_main.c
2976 +@@ -379,6 +379,9 @@ static struct siw_device *siw_device_create(struct net_device *netdev)
2977 + base_dev->dev.dma_ops = &dma_virt_ops;
2978 + base_dev->num_comp_vectors = num_possible_cpus();
2979 +
2980 ++ xa_init_flags(&sdev->qp_xa, XA_FLAGS_ALLOC1);
2981 ++ xa_init_flags(&sdev->mem_xa, XA_FLAGS_ALLOC1);
2982 ++
2983 + ib_set_device_ops(base_dev, &siw_device_ops);
2984 + rv = ib_device_set_netdev(base_dev, netdev, 1);
2985 + if (rv)
2986 +@@ -406,9 +409,6 @@ static struct siw_device *siw_device_create(struct net_device *netdev)
2987 + sdev->attrs.max_srq_wr = SIW_MAX_SRQ_WR;
2988 + sdev->attrs.max_srq_sge = SIW_MAX_SGE;
2989 +
2990 +- xa_init_flags(&sdev->qp_xa, XA_FLAGS_ALLOC1);
2991 +- xa_init_flags(&sdev->mem_xa, XA_FLAGS_ALLOC1);
2992 +-
2993 + INIT_LIST_HEAD(&sdev->cep_list);
2994 + INIT_LIST_HEAD(&sdev->qp_list);
2995 +
2996 +diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
2997 +index d7cbca8bf2cd..b5ae9f7c0510 100644
2998 +--- a/drivers/iommu/amd_iommu_init.c
2999 ++++ b/drivers/iommu/amd_iommu_init.c
3000 +@@ -2533,6 +2533,7 @@ static int __init early_amd_iommu_init(void)
3001 + struct acpi_table_header *ivrs_base;
3002 + acpi_status status;
3003 + int i, remap_cache_sz, ret = 0;
3004 ++ u32 pci_id;
3005 +
3006 + if (!amd_iommu_detected)
3007 + return -ENODEV;
3008 +@@ -2620,6 +2621,16 @@ static int __init early_amd_iommu_init(void)
3009 + if (ret)
3010 + goto out;
3011 +
3012 ++ /* Disable IOMMU if there's Stoney Ridge graphics */
3013 ++ for (i = 0; i < 32; i++) {
3014 ++ pci_id = read_pci_config(0, i, 0, 0);
3015 ++ if ((pci_id & 0xffff) == 0x1002 && (pci_id >> 16) == 0x98e4) {
3016 ++ pr_info("Disable IOMMU on Stoney Ridge\n");
3017 ++ amd_iommu_disabled = true;
3018 ++ break;
3019 ++ }
3020 ++ }
3021 ++
3022 + /* Disable any previously enabled IOMMUs */
3023 + if (!is_kdump_kernel() || amd_iommu_disabled)
3024 + disable_iommus();
3025 +@@ -2728,7 +2739,7 @@ static int __init state_next(void)
3026 + ret = early_amd_iommu_init();
3027 + init_state = ret ? IOMMU_INIT_ERROR : IOMMU_ACPI_FINISHED;
3028 + if (init_state == IOMMU_ACPI_FINISHED && amd_iommu_disabled) {
3029 +- pr_info("AMD IOMMU disabled on kernel command-line\n");
3030 ++ pr_info("AMD IOMMU disabled\n");
3031 + init_state = IOMMU_CMDLINE_DISABLED;
3032 + ret = -EINVAL;
3033 + }
3034 +diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c
3035 +index 8346e6d1816c..f595e9867cbe 100644
3036 +--- a/drivers/md/dm-cache-target.c
3037 ++++ b/drivers/md/dm-cache-target.c
3038 +@@ -2867,8 +2867,8 @@ static void cache_postsuspend(struct dm_target *ti)
3039 + prevent_background_work(cache);
3040 + BUG_ON(atomic_read(&cache->nr_io_migrations));
3041 +
3042 +- cancel_delayed_work(&cache->waker);
3043 +- flush_workqueue(cache->wq);
3044 ++ cancel_delayed_work_sync(&cache->waker);
3045 ++ drain_workqueue(cache->wq);
3046 + WARN_ON(cache->tracker.in_flight);
3047 +
3048 + /*
3049 +diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c
3050 +index dab4446fe7d8..57ac603f3741 100644
3051 +--- a/drivers/md/dm-integrity.c
3052 ++++ b/drivers/md/dm-integrity.c
3053 +@@ -199,17 +199,19 @@ struct dm_integrity_c {
3054 + __u8 log2_blocks_per_bitmap_bit;
3055 +
3056 + unsigned char mode;
3057 +- int suspending;
3058 +
3059 + int failed;
3060 +
3061 + struct crypto_shash *internal_hash;
3062 +
3063 ++ struct dm_target *ti;
3064 ++
3065 + /* these variables are locked with endio_wait.lock */
3066 + struct rb_root in_progress;
3067 + struct list_head wait_list;
3068 + wait_queue_head_t endio_wait;
3069 + struct workqueue_struct *wait_wq;
3070 ++ struct workqueue_struct *offload_wq;
3071 +
3072 + unsigned char commit_seq;
3073 + commit_id_t commit_ids[N_COMMIT_IDS];
3074 +@@ -1434,7 +1436,7 @@ static void dec_in_flight(struct dm_integrity_io *dio)
3075 + dio->range.logical_sector += dio->range.n_sectors;
3076 + bio_advance(bio, dio->range.n_sectors << SECTOR_SHIFT);
3077 + INIT_WORK(&dio->work, integrity_bio_wait);
3078 +- queue_work(ic->wait_wq, &dio->work);
3079 ++ queue_work(ic->offload_wq, &dio->work);
3080 + return;
3081 + }
3082 + do_endio_flush(ic, dio);
3083 +@@ -1860,7 +1862,7 @@ static void dm_integrity_map_continue(struct dm_integrity_io *dio, bool from_map
3084 +
3085 + if (need_sync_io && from_map) {
3086 + INIT_WORK(&dio->work, integrity_bio_wait);
3087 +- queue_work(ic->metadata_wq, &dio->work);
3088 ++ queue_work(ic->offload_wq, &dio->work);
3089 + return;
3090 + }
3091 +
3092 +@@ -2310,7 +2312,7 @@ static void integrity_writer(struct work_struct *w)
3093 + unsigned prev_free_sectors;
3094 +
3095 + /* the following test is not needed, but it tests the replay code */
3096 +- if (READ_ONCE(ic->suspending) && !ic->meta_dev)
3097 ++ if (unlikely(dm_suspended(ic->ti)) && !ic->meta_dev)
3098 + return;
3099 +
3100 + spin_lock_irq(&ic->endio_wait.lock);
3101 +@@ -2371,7 +2373,7 @@ static void integrity_recalc(struct work_struct *w)
3102 +
3103 + next_chunk:
3104 +
3105 +- if (unlikely(READ_ONCE(ic->suspending)))
3106 ++ if (unlikely(dm_suspended(ic->ti)))
3107 + goto unlock_ret;
3108 +
3109 + range.logical_sector = le64_to_cpu(ic->sb->recalc_sector);
3110 +@@ -2496,7 +2498,7 @@ static void bitmap_block_work(struct work_struct *w)
3111 + dio->range.n_sectors, BITMAP_OP_TEST_ALL_SET)) {
3112 + remove_range(ic, &dio->range);
3113 + INIT_WORK(&dio->work, integrity_bio_wait);
3114 +- queue_work(ic->wait_wq, &dio->work);
3115 ++ queue_work(ic->offload_wq, &dio->work);
3116 + } else {
3117 + block_bitmap_op(ic, ic->journal, dio->range.logical_sector,
3118 + dio->range.n_sectors, BITMAP_OP_SET);
3119 +@@ -2519,7 +2521,7 @@ static void bitmap_block_work(struct work_struct *w)
3120 +
3121 + remove_range(ic, &dio->range);
3122 + INIT_WORK(&dio->work, integrity_bio_wait);
3123 +- queue_work(ic->wait_wq, &dio->work);
3124 ++ queue_work(ic->offload_wq, &dio->work);
3125 + }
3126 +
3127 + queue_delayed_work(ic->commit_wq, &ic->bitmap_flush_work, ic->bitmap_flush_interval);
3128 +@@ -2799,8 +2801,6 @@ static void dm_integrity_postsuspend(struct dm_target *ti)
3129 +
3130 + del_timer_sync(&ic->autocommit_timer);
3131 +
3132 +- WRITE_ONCE(ic->suspending, 1);
3133 +-
3134 + if (ic->recalc_wq)
3135 + drain_workqueue(ic->recalc_wq);
3136 +
3137 +@@ -2829,8 +2829,6 @@ static void dm_integrity_postsuspend(struct dm_target *ti)
3138 + #endif
3139 + }
3140 +
3141 +- WRITE_ONCE(ic->suspending, 0);
3142 +-
3143 + BUG_ON(!RB_EMPTY_ROOT(&ic->in_progress));
3144 +
3145 + ic->journal_uptodate = true;
3146 +@@ -2883,17 +2881,24 @@ static void dm_integrity_resume(struct dm_target *ti)
3147 + } else {
3148 + replay_journal(ic);
3149 + if (ic->mode == 'B') {
3150 +- int mode;
3151 + ic->sb->flags |= cpu_to_le32(SB_FLAG_DIRTY_BITMAP);
3152 + ic->sb->log2_blocks_per_bitmap_bit = ic->log2_blocks_per_bitmap_bit;
3153 + r = sync_rw_sb(ic, REQ_OP_WRITE, REQ_FUA);
3154 + if (unlikely(r))
3155 + dm_integrity_io_error(ic, "writing superblock", r);
3156 +
3157 +- mode = ic->recalculate_flag ? BITMAP_OP_SET : BITMAP_OP_CLEAR;
3158 +- block_bitmap_op(ic, ic->journal, 0, ic->provided_data_sectors, mode);
3159 +- block_bitmap_op(ic, ic->recalc_bitmap, 0, ic->provided_data_sectors, mode);
3160 +- block_bitmap_op(ic, ic->may_write_bitmap, 0, ic->provided_data_sectors, mode);
3161 ++ block_bitmap_op(ic, ic->journal, 0, ic->provided_data_sectors, BITMAP_OP_CLEAR);
3162 ++ block_bitmap_op(ic, ic->recalc_bitmap, 0, ic->provided_data_sectors, BITMAP_OP_CLEAR);
3163 ++ block_bitmap_op(ic, ic->may_write_bitmap, 0, ic->provided_data_sectors, BITMAP_OP_CLEAR);
3164 ++ if (ic->sb->flags & cpu_to_le32(SB_FLAG_RECALCULATING) &&
3165 ++ le64_to_cpu(ic->sb->recalc_sector) < ic->provided_data_sectors) {
3166 ++ block_bitmap_op(ic, ic->journal, le64_to_cpu(ic->sb->recalc_sector),
3167 ++ ic->provided_data_sectors - le64_to_cpu(ic->sb->recalc_sector), BITMAP_OP_SET);
3168 ++ block_bitmap_op(ic, ic->recalc_bitmap, le64_to_cpu(ic->sb->recalc_sector),
3169 ++ ic->provided_data_sectors - le64_to_cpu(ic->sb->recalc_sector), BITMAP_OP_SET);
3170 ++ block_bitmap_op(ic, ic->may_write_bitmap, le64_to_cpu(ic->sb->recalc_sector),
3171 ++ ic->provided_data_sectors - le64_to_cpu(ic->sb->recalc_sector), BITMAP_OP_SET);
3172 ++ }
3173 + rw_journal_sectors(ic, REQ_OP_WRITE, REQ_FUA | REQ_SYNC, 0,
3174 + ic->n_bitmap_blocks * (BITMAP_BLOCK_SIZE >> SECTOR_SHIFT), NULL);
3175 + }
3176 +@@ -2961,7 +2966,7 @@ static void dm_integrity_status(struct dm_target *ti, status_type_t type,
3177 + DMEMIT(" meta_device:%s", ic->meta_dev->name);
3178 + if (ic->sectors_per_block != 1)
3179 + DMEMIT(" block_size:%u", ic->sectors_per_block << SECTOR_SHIFT);
3180 +- if (ic->recalculate_flag)
3181 ++ if (ic->sb->flags & cpu_to_le32(SB_FLAG_RECALCULATING))
3182 + DMEMIT(" recalculate");
3183 + DMEMIT(" journal_sectors:%u", ic->initial_sectors - SB_SECTORS);
3184 + DMEMIT(" interleave_sectors:%u", 1U << ic->sb->log2_interleave_sectors);
3185 +@@ -3607,6 +3612,7 @@ static int dm_integrity_ctr(struct dm_target *ti, unsigned argc, char **argv)
3186 + }
3187 + ti->private = ic;
3188 + ti->per_io_data_size = sizeof(struct dm_integrity_io);
3189 ++ ic->ti = ti;
3190 +
3191 + ic->in_progress = RB_ROOT;
3192 + INIT_LIST_HEAD(&ic->wait_list);
3193 +@@ -3818,6 +3824,14 @@ static int dm_integrity_ctr(struct dm_target *ti, unsigned argc, char **argv)
3194 + goto bad;
3195 + }
3196 +
3197 ++ ic->offload_wq = alloc_workqueue("dm-integrity-offload", WQ_MEM_RECLAIM,
3198 ++ METADATA_WORKQUEUE_MAX_ACTIVE);
3199 ++ if (!ic->offload_wq) {
3200 ++ ti->error = "Cannot allocate workqueue";
3201 ++ r = -ENOMEM;
3202 ++ goto bad;
3203 ++ }
3204 ++
3205 + ic->commit_wq = alloc_workqueue("dm-integrity-commit", WQ_MEM_RECLAIM, 1);
3206 + if (!ic->commit_wq) {
3207 + ti->error = "Cannot allocate workqueue";
3208 +@@ -4122,6 +4136,8 @@ static void dm_integrity_dtr(struct dm_target *ti)
3209 + destroy_workqueue(ic->metadata_wq);
3210 + if (ic->wait_wq)
3211 + destroy_workqueue(ic->wait_wq);
3212 ++ if (ic->offload_wq)
3213 ++ destroy_workqueue(ic->offload_wq);
3214 + if (ic->commit_wq)
3215 + destroy_workqueue(ic->commit_wq);
3216 + if (ic->writer_wq)
3217 +diff --git a/drivers/md/dm-thin-metadata.c b/drivers/md/dm-thin-metadata.c
3218 +index 8bb723f1a569..4cd8868f8004 100644
3219 +--- a/drivers/md/dm-thin-metadata.c
3220 ++++ b/drivers/md/dm-thin-metadata.c
3221 +@@ -960,9 +960,9 @@ int dm_pool_metadata_close(struct dm_pool_metadata *pmd)
3222 + DMWARN("%s: __commit_transaction() failed, error = %d",
3223 + __func__, r);
3224 + }
3225 ++ pmd_write_unlock(pmd);
3226 + if (!pmd->fail_io)
3227 + __destroy_persistent_data_objects(pmd);
3228 +- pmd_write_unlock(pmd);
3229 +
3230 + kfree(pmd);
3231 + return 0;
3232 +diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c
3233 +index 07c1b0334f57..184dabce1bad 100644
3234 +--- a/drivers/md/dm-writecache.c
3235 ++++ b/drivers/md/dm-writecache.c
3236 +@@ -625,6 +625,12 @@ static void writecache_add_to_freelist(struct dm_writecache *wc, struct wc_entry
3237 + wc->freelist_size++;
3238 + }
3239 +
3240 ++static inline void writecache_verify_watermark(struct dm_writecache *wc)
3241 ++{
3242 ++ if (unlikely(wc->freelist_size + wc->writeback_size <= wc->freelist_high_watermark))
3243 ++ queue_work(wc->writeback_wq, &wc->writeback_work);
3244 ++}
3245 ++
3246 + static struct wc_entry *writecache_pop_from_freelist(struct dm_writecache *wc)
3247 + {
3248 + struct wc_entry *e;
3249 +@@ -646,8 +652,8 @@ static struct wc_entry *writecache_pop_from_freelist(struct dm_writecache *wc)
3250 + list_del(&e->lru);
3251 + }
3252 + wc->freelist_size--;
3253 +- if (unlikely(wc->freelist_size + wc->writeback_size <= wc->freelist_high_watermark))
3254 +- queue_work(wc->writeback_wq, &wc->writeback_work);
3255 ++
3256 ++ writecache_verify_watermark(wc);
3257 +
3258 + return e;
3259 + }
3260 +@@ -838,7 +844,7 @@ static void writecache_suspend(struct dm_target *ti)
3261 + }
3262 + wc_unlock(wc);
3263 +
3264 +- flush_workqueue(wc->writeback_wq);
3265 ++ drain_workqueue(wc->writeback_wq);
3266 +
3267 + wc_lock(wc);
3268 + if (flush_on_suspend)
3269 +@@ -961,6 +967,8 @@ erase_this:
3270 + writecache_commit_flushed(wc, false);
3271 + }
3272 +
3273 ++ writecache_verify_watermark(wc);
3274 ++
3275 + wc_unlock(wc);
3276 + }
3277 +
3278 +diff --git a/drivers/md/dm-zoned-target.c b/drivers/md/dm-zoned-target.c
3279 +index 4574e0dedbd6..03267609b515 100644
3280 +--- a/drivers/md/dm-zoned-target.c
3281 ++++ b/drivers/md/dm-zoned-target.c
3282 +@@ -533,8 +533,9 @@ static int dmz_queue_chunk_work(struct dmz_target *dmz, struct bio *bio)
3283 +
3284 + /* Get the BIO chunk work. If one is not active yet, create one */
3285 + cw = radix_tree_lookup(&dmz->chunk_rxtree, chunk);
3286 +- if (!cw) {
3287 +-
3288 ++ if (cw) {
3289 ++ dmz_get_chunk_work(cw);
3290 ++ } else {
3291 + /* Create a new chunk work */
3292 + cw = kmalloc(sizeof(struct dm_chunk_work), GFP_NOIO);
3293 + if (unlikely(!cw)) {
3294 +@@ -543,7 +544,7 @@ static int dmz_queue_chunk_work(struct dmz_target *dmz, struct bio *bio)
3295 + }
3296 +
3297 + INIT_WORK(&cw->work, dmz_chunk_work);
3298 +- refcount_set(&cw->refcount, 0);
3299 ++ refcount_set(&cw->refcount, 1);
3300 + cw->target = dmz;
3301 + cw->chunk = chunk;
3302 + bio_list_init(&cw->bio_list);
3303 +@@ -556,7 +557,6 @@ static int dmz_queue_chunk_work(struct dmz_target *dmz, struct bio *bio)
3304 + }
3305 +
3306 + bio_list_add(&cw->bio_list, bio);
3307 +- dmz_get_chunk_work(cw);
3308 +
3309 + dmz_reclaim_bio_acc(dmz->reclaim);
3310 + if (queue_work(dmz->chunk_wq, &cw->work))
3311 +diff --git a/drivers/md/dm.c b/drivers/md/dm.c
3312 +index 6d3cc235f842..cf71a2277d60 100644
3313 +--- a/drivers/md/dm.c
3314 ++++ b/drivers/md/dm.c
3315 +@@ -1809,7 +1809,8 @@ static int dm_any_congested(void *congested_data, int bdi_bits)
3316 + * With request-based DM we only need to check the
3317 + * top-level queue for congestion.
3318 + */
3319 +- r = md->queue->backing_dev_info->wb.state & bdi_bits;
3320 ++ struct backing_dev_info *bdi = md->queue->backing_dev_info;
3321 ++ r = bdi->wb.congested->state & bdi_bits;
3322 + } else {
3323 + map = dm_get_live_table_fast(md);
3324 + if (map)
3325 +@@ -1875,15 +1876,6 @@ static const struct dax_operations dm_dax_ops;
3326 +
3327 + static void dm_wq_work(struct work_struct *work);
3328 +
3329 +-static void dm_init_normal_md_queue(struct mapped_device *md)
3330 +-{
3331 +- /*
3332 +- * Initialize aspects of queue that aren't relevant for blk-mq
3333 +- */
3334 +- md->queue->backing_dev_info->congested_data = md;
3335 +- md->queue->backing_dev_info->congested_fn = dm_any_congested;
3336 +-}
3337 +-
3338 + static void cleanup_mapped_device(struct mapped_device *md)
3339 + {
3340 + if (md->wq)
3341 +@@ -2270,6 +2262,12 @@ struct queue_limits *dm_get_queue_limits(struct mapped_device *md)
3342 + }
3343 + EXPORT_SYMBOL_GPL(dm_get_queue_limits);
3344 +
3345 ++static void dm_init_congested_fn(struct mapped_device *md)
3346 ++{
3347 ++ md->queue->backing_dev_info->congested_data = md;
3348 ++ md->queue->backing_dev_info->congested_fn = dm_any_congested;
3349 ++}
3350 ++
3351 + /*
3352 + * Setup the DM device's queue based on md's type
3353 + */
3354 +@@ -2286,11 +2284,12 @@ int dm_setup_md_queue(struct mapped_device *md, struct dm_table *t)
3355 + DMERR("Cannot initialize queue for request-based dm-mq mapped device");
3356 + return r;
3357 + }
3358 ++ dm_init_congested_fn(md);
3359 + break;
3360 + case DM_TYPE_BIO_BASED:
3361 + case DM_TYPE_DAX_BIO_BASED:
3362 + case DM_TYPE_NVME_BIO_BASED:
3363 +- dm_init_normal_md_queue(md);
3364 ++ dm_init_congested_fn(md);
3365 + break;
3366 + case DM_TYPE_NONE:
3367 + WARN_ON_ONCE(true);
3368 +@@ -2389,6 +2388,7 @@ static void __dm_destroy(struct mapped_device *md, bool wait)
3369 + map = dm_get_live_table(md, &srcu_idx);
3370 + if (!dm_suspended_md(md)) {
3371 + dm_table_presuspend_targets(map);
3372 ++ set_bit(DMF_SUSPENDED, &md->flags);
3373 + dm_table_postsuspend_targets(map);
3374 + }
3375 + /* dm_put_live_table must be before msleep, otherwise deadlock is possible */
3376 +diff --git a/drivers/media/mc/mc-entity.c b/drivers/media/mc/mc-entity.c
3377 +index 7c429ce98bae..668770e9f609 100644
3378 +--- a/drivers/media/mc/mc-entity.c
3379 ++++ b/drivers/media/mc/mc-entity.c
3380 +@@ -639,9 +639,9 @@ int media_get_pad_index(struct media_entity *entity, bool is_sink,
3381 + return -EINVAL;
3382 +
3383 + for (i = 0; i < entity->num_pads; i++) {
3384 +- if (entity->pads[i].flags == MEDIA_PAD_FL_SINK)
3385 ++ if (entity->pads[i].flags & MEDIA_PAD_FL_SINK)
3386 + pad_is_sink = true;
3387 +- else if (entity->pads[i].flags == MEDIA_PAD_FL_SOURCE)
3388 ++ else if (entity->pads[i].flags & MEDIA_PAD_FL_SOURCE)
3389 + pad_is_sink = false;
3390 + else
3391 + continue; /* This is an error! */
3392 +diff --git a/drivers/media/platform/vicodec/codec-v4l2-fwht.c b/drivers/media/platform/vicodec/codec-v4l2-fwht.c
3393 +index 3c93d9232c3c..b6e39fbd8ad5 100644
3394 +--- a/drivers/media/platform/vicodec/codec-v4l2-fwht.c
3395 ++++ b/drivers/media/platform/vicodec/codec-v4l2-fwht.c
3396 +@@ -27,17 +27,17 @@ static const struct v4l2_fwht_pixfmt_info v4l2_fwht_pixfmts[] = {
3397 + { V4L2_PIX_FMT_BGR24, 3, 3, 1, 3, 3, 1, 1, 3, 1, FWHT_FL_PIXENC_RGB},
3398 + { V4L2_PIX_FMT_RGB24, 3, 3, 1, 3, 3, 1, 1, 3, 1, FWHT_FL_PIXENC_RGB},
3399 + { V4L2_PIX_FMT_HSV24, 3, 3, 1, 3, 3, 1, 1, 3, 1, FWHT_FL_PIXENC_HSV},
3400 +- { V4L2_PIX_FMT_BGR32, 4, 4, 1, 4, 4, 1, 1, 3, 1, FWHT_FL_PIXENC_RGB},
3401 +- { V4L2_PIX_FMT_XBGR32, 4, 4, 1, 4, 4, 1, 1, 3, 1, FWHT_FL_PIXENC_RGB},
3402 ++ { V4L2_PIX_FMT_BGR32, 4, 4, 1, 4, 4, 1, 1, 4, 1, FWHT_FL_PIXENC_RGB},
3403 ++ { V4L2_PIX_FMT_XBGR32, 4, 4, 1, 4, 4, 1, 1, 4, 1, FWHT_FL_PIXENC_RGB},
3404 + { V4L2_PIX_FMT_ABGR32, 4, 4, 1, 4, 4, 1, 1, 4, 1, FWHT_FL_PIXENC_RGB},
3405 +- { V4L2_PIX_FMT_RGB32, 4, 4, 1, 4, 4, 1, 1, 3, 1, FWHT_FL_PIXENC_RGB},
3406 +- { V4L2_PIX_FMT_XRGB32, 4, 4, 1, 4, 4, 1, 1, 3, 1, FWHT_FL_PIXENC_RGB},
3407 ++ { V4L2_PIX_FMT_RGB32, 4, 4, 1, 4, 4, 1, 1, 4, 1, FWHT_FL_PIXENC_RGB},
3408 ++ { V4L2_PIX_FMT_XRGB32, 4, 4, 1, 4, 4, 1, 1, 4, 1, FWHT_FL_PIXENC_RGB},
3409 + { V4L2_PIX_FMT_ARGB32, 4, 4, 1, 4, 4, 1, 1, 4, 1, FWHT_FL_PIXENC_RGB},
3410 +- { V4L2_PIX_FMT_BGRX32, 4, 4, 1, 4, 4, 1, 1, 3, 1, FWHT_FL_PIXENC_RGB},
3411 ++ { V4L2_PIX_FMT_BGRX32, 4, 4, 1, 4, 4, 1, 1, 4, 1, FWHT_FL_PIXENC_RGB},
3412 + { V4L2_PIX_FMT_BGRA32, 4, 4, 1, 4, 4, 1, 1, 4, 1, FWHT_FL_PIXENC_RGB},
3413 +- { V4L2_PIX_FMT_RGBX32, 4, 4, 1, 4, 4, 1, 1, 3, 1, FWHT_FL_PIXENC_RGB},
3414 ++ { V4L2_PIX_FMT_RGBX32, 4, 4, 1, 4, 4, 1, 1, 4, 1, FWHT_FL_PIXENC_RGB},
3415 + { V4L2_PIX_FMT_RGBA32, 4, 4, 1, 4, 4, 1, 1, 4, 1, FWHT_FL_PIXENC_RGB},
3416 +- { V4L2_PIX_FMT_HSV32, 4, 4, 1, 4, 4, 1, 1, 3, 1, FWHT_FL_PIXENC_HSV},
3417 ++ { V4L2_PIX_FMT_HSV32, 4, 4, 1, 4, 4, 1, 1, 4, 1, FWHT_FL_PIXENC_HSV},
3418 + { V4L2_PIX_FMT_GREY, 1, 1, 1, 1, 0, 1, 1, 1, 1, FWHT_FL_PIXENC_RGB},
3419 + };
3420 +
3421 +@@ -175,22 +175,14 @@ static int prepare_raw_frame(struct fwht_raw_frame *rf,
3422 + case V4L2_PIX_FMT_RGB32:
3423 + case V4L2_PIX_FMT_XRGB32:
3424 + case V4L2_PIX_FMT_HSV32:
3425 +- rf->cr = rf->luma + 1;
3426 +- rf->cb = rf->cr + 2;
3427 +- rf->luma += 2;
3428 +- break;
3429 +- case V4L2_PIX_FMT_BGR32:
3430 +- case V4L2_PIX_FMT_XBGR32:
3431 +- rf->cb = rf->luma;
3432 +- rf->cr = rf->cb + 2;
3433 +- rf->luma++;
3434 +- break;
3435 + case V4L2_PIX_FMT_ARGB32:
3436 + rf->alpha = rf->luma;
3437 + rf->cr = rf->luma + 1;
3438 + rf->cb = rf->cr + 2;
3439 + rf->luma += 2;
3440 + break;
3441 ++ case V4L2_PIX_FMT_BGR32:
3442 ++ case V4L2_PIX_FMT_XBGR32:
3443 + case V4L2_PIX_FMT_ABGR32:
3444 + rf->cb = rf->luma;
3445 + rf->cr = rf->cb + 2;
3446 +@@ -198,10 +190,6 @@ static int prepare_raw_frame(struct fwht_raw_frame *rf,
3447 + rf->alpha = rf->cr + 1;
3448 + break;
3449 + case V4L2_PIX_FMT_BGRX32:
3450 +- rf->cb = rf->luma + 1;
3451 +- rf->cr = rf->cb + 2;
3452 +- rf->luma += 2;
3453 +- break;
3454 + case V4L2_PIX_FMT_BGRA32:
3455 + rf->alpha = rf->luma;
3456 + rf->cb = rf->luma + 1;
3457 +@@ -209,10 +197,6 @@ static int prepare_raw_frame(struct fwht_raw_frame *rf,
3458 + rf->luma += 2;
3459 + break;
3460 + case V4L2_PIX_FMT_RGBX32:
3461 +- rf->cr = rf->luma;
3462 +- rf->cb = rf->cr + 2;
3463 +- rf->luma++;
3464 +- break;
3465 + case V4L2_PIX_FMT_RGBA32:
3466 + rf->alpha = rf->luma + 3;
3467 + rf->cr = rf->luma;
3468 +diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2-core/v4l2-mem2mem.c
3469 +index 19937dd3c6f6..3d6a6306cec7 100644
3470 +--- a/drivers/media/v4l2-core/v4l2-mem2mem.c
3471 ++++ b/drivers/media/v4l2-core/v4l2-mem2mem.c
3472 +@@ -809,12 +809,12 @@ int v4l2_m2m_register_media_controller(struct v4l2_m2m_dev *m2m_dev,
3473 + goto err_rel_entity1;
3474 +
3475 + /* Connect the three entities */
3476 +- ret = media_create_pad_link(m2m_dev->source, 0, &m2m_dev->proc, 1,
3477 ++ ret = media_create_pad_link(m2m_dev->source, 0, &m2m_dev->proc, 0,
3478 + MEDIA_LNK_FL_IMMUTABLE | MEDIA_LNK_FL_ENABLED);
3479 + if (ret)
3480 + goto err_rel_entity2;
3481 +
3482 +- ret = media_create_pad_link(&m2m_dev->proc, 0, &m2m_dev->sink, 0,
3483 ++ ret = media_create_pad_link(&m2m_dev->proc, 1, &m2m_dev->sink, 0,
3484 + MEDIA_LNK_FL_IMMUTABLE | MEDIA_LNK_FL_ENABLED);
3485 + if (ret)
3486 + goto err_rm_links0;
3487 +diff --git a/drivers/misc/habanalabs/device.c b/drivers/misc/habanalabs/device.c
3488 +index 459fee70a597..a7a4fed4d899 100644
3489 +--- a/drivers/misc/habanalabs/device.c
3490 ++++ b/drivers/misc/habanalabs/device.c
3491 +@@ -600,7 +600,9 @@ int hl_device_set_debug_mode(struct hl_device *hdev, bool enable)
3492 + goto out;
3493 + }
3494 +
3495 +- hdev->asic_funcs->halt_coresight(hdev);
3496 ++ if (!hdev->hard_reset_pending)
3497 ++ hdev->asic_funcs->halt_coresight(hdev);
3498 ++
3499 + hdev->in_debug = 0;
3500 +
3501 + goto out;
3502 +@@ -1185,6 +1187,7 @@ int hl_device_init(struct hl_device *hdev, struct class *hclass)
3503 + if (hdev->asic_funcs->get_hw_state(hdev) == HL_DEVICE_HW_STATE_DIRTY) {
3504 + dev_info(hdev->dev,
3505 + "H/W state is dirty, must reset before initializing\n");
3506 ++ hdev->asic_funcs->halt_engines(hdev, true);
3507 + hdev->asic_funcs->hw_fini(hdev, true);
3508 + }
3509 +
3510 +diff --git a/drivers/misc/habanalabs/goya/goya.c b/drivers/misc/habanalabs/goya/goya.c
3511 +index fe3574a83b7c..13b39fd97429 100644
3512 +--- a/drivers/misc/habanalabs/goya/goya.c
3513 ++++ b/drivers/misc/habanalabs/goya/goya.c
3514 +@@ -869,6 +869,11 @@ void goya_init_dma_qmans(struct hl_device *hdev)
3515 + */
3516 + static void goya_disable_external_queues(struct hl_device *hdev)
3517 + {
3518 ++ struct goya_device *goya = hdev->asic_specific;
3519 ++
3520 ++ if (!(goya->hw_cap_initialized & HW_CAP_DMA))
3521 ++ return;
3522 ++
3523 + WREG32(mmDMA_QM_0_GLBL_CFG0, 0);
3524 + WREG32(mmDMA_QM_1_GLBL_CFG0, 0);
3525 + WREG32(mmDMA_QM_2_GLBL_CFG0, 0);
3526 +@@ -930,6 +935,11 @@ static int goya_stop_external_queues(struct hl_device *hdev)
3527 + {
3528 + int rc, retval = 0;
3529 +
3530 ++ struct goya_device *goya = hdev->asic_specific;
3531 ++
3532 ++ if (!(goya->hw_cap_initialized & HW_CAP_DMA))
3533 ++ return retval;
3534 ++
3535 + rc = goya_stop_queue(hdev,
3536 + mmDMA_QM_0_GLBL_CFG1,
3537 + mmDMA_QM_0_CP_STS,
3538 +@@ -1719,9 +1729,18 @@ void goya_init_tpc_qmans(struct hl_device *hdev)
3539 + */
3540 + static void goya_disable_internal_queues(struct hl_device *hdev)
3541 + {
3542 ++ struct goya_device *goya = hdev->asic_specific;
3543 ++
3544 ++ if (!(goya->hw_cap_initialized & HW_CAP_MME))
3545 ++ goto disable_tpc;
3546 ++
3547 + WREG32(mmMME_QM_GLBL_CFG0, 0);
3548 + WREG32(mmMME_CMDQ_GLBL_CFG0, 0);
3549 +
3550 ++disable_tpc:
3551 ++ if (!(goya->hw_cap_initialized & HW_CAP_TPC))
3552 ++ return;
3553 ++
3554 + WREG32(mmTPC0_QM_GLBL_CFG0, 0);
3555 + WREG32(mmTPC0_CMDQ_GLBL_CFG0, 0);
3556 +
3557 +@@ -1757,8 +1776,12 @@ static void goya_disable_internal_queues(struct hl_device *hdev)
3558 + */
3559 + static int goya_stop_internal_queues(struct hl_device *hdev)
3560 + {
3561 ++ struct goya_device *goya = hdev->asic_specific;
3562 + int rc, retval = 0;
3563 +
3564 ++ if (!(goya->hw_cap_initialized & HW_CAP_MME))
3565 ++ goto stop_tpc;
3566 ++
3567 + /*
3568 + * Each queue (QMAN) is a separate H/W logic. That means that each
3569 + * QMAN can be stopped independently and failure to stop one does NOT
3570 +@@ -1785,6 +1808,10 @@ static int goya_stop_internal_queues(struct hl_device *hdev)
3571 + retval = -EIO;
3572 + }
3573 +
3574 ++stop_tpc:
3575 ++ if (!(goya->hw_cap_initialized & HW_CAP_TPC))
3576 ++ return retval;
3577 ++
3578 + rc = goya_stop_queue(hdev,
3579 + mmTPC0_QM_GLBL_CFG1,
3580 + mmTPC0_QM_CP_STS,
3581 +@@ -1950,6 +1977,11 @@ static int goya_stop_internal_queues(struct hl_device *hdev)
3582 +
3583 + static void goya_dma_stall(struct hl_device *hdev)
3584 + {
3585 ++ struct goya_device *goya = hdev->asic_specific;
3586 ++
3587 ++ if (!(goya->hw_cap_initialized & HW_CAP_DMA))
3588 ++ return;
3589 ++
3590 + WREG32(mmDMA_QM_0_GLBL_CFG1, 1 << DMA_QM_0_GLBL_CFG1_DMA_STOP_SHIFT);
3591 + WREG32(mmDMA_QM_1_GLBL_CFG1, 1 << DMA_QM_1_GLBL_CFG1_DMA_STOP_SHIFT);
3592 + WREG32(mmDMA_QM_2_GLBL_CFG1, 1 << DMA_QM_2_GLBL_CFG1_DMA_STOP_SHIFT);
3593 +@@ -1959,6 +1991,11 @@ static void goya_dma_stall(struct hl_device *hdev)
3594 +
3595 + static void goya_tpc_stall(struct hl_device *hdev)
3596 + {
3597 ++ struct goya_device *goya = hdev->asic_specific;
3598 ++
3599 ++ if (!(goya->hw_cap_initialized & HW_CAP_TPC))
3600 ++ return;
3601 ++
3602 + WREG32(mmTPC0_CFG_TPC_STALL, 1 << TPC0_CFG_TPC_STALL_V_SHIFT);
3603 + WREG32(mmTPC1_CFG_TPC_STALL, 1 << TPC1_CFG_TPC_STALL_V_SHIFT);
3604 + WREG32(mmTPC2_CFG_TPC_STALL, 1 << TPC2_CFG_TPC_STALL_V_SHIFT);
3605 +@@ -1971,6 +2008,11 @@ static void goya_tpc_stall(struct hl_device *hdev)
3606 +
3607 + static void goya_mme_stall(struct hl_device *hdev)
3608 + {
3609 ++ struct goya_device *goya = hdev->asic_specific;
3610 ++
3611 ++ if (!(goya->hw_cap_initialized & HW_CAP_MME))
3612 ++ return;
3613 ++
3614 + WREG32(mmMME_STALL, 0xFFFFFFFF);
3615 + }
3616 +
3617 +@@ -4624,8 +4666,6 @@ static int goya_memset_device_memory(struct hl_device *hdev, u64 addr, u64 size,
3618 +
3619 + rc = goya_send_job_on_qman0(hdev, job);
3620 +
3621 +- hl_cb_put(job->patched_cb);
3622 +-
3623 + hl_debugfs_remove_job(hdev, job);
3624 + kfree(job);
3625 + cb->cs_cnt--;
3626 +diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
3627 +index fecd5e674e04..46dc913da852 100644
3628 +--- a/drivers/net/dsa/bcm_sf2.c
3629 ++++ b/drivers/net/dsa/bcm_sf2.c
3630 +@@ -69,8 +69,7 @@ static void bcm_sf2_imp_setup(struct dsa_switch *ds, int port)
3631 + /* Force link status for IMP port */
3632 + reg = core_readl(priv, offset);
3633 + reg |= (MII_SW_OR | LINK_STS);
3634 +- if (priv->type == BCM7278_DEVICE_ID)
3635 +- reg |= GMII_SPEED_UP_2G;
3636 ++ reg &= ~GMII_SPEED_UP_2G;
3637 + core_writel(priv, reg, offset);
3638 +
3639 + /* Enable Broadcast, Multicast, Unicast forwarding to IMP port */
3640 +diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
3641 +index 52646855495e..873f9865f0d1 100644
3642 +--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
3643 ++++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
3644 +@@ -22,6 +22,7 @@
3645 + #define HW_ATL_MIF_ADDR 0x0208U
3646 + #define HW_ATL_MIF_VAL 0x020CU
3647 +
3648 ++#define HW_ATL_MPI_RPC_ADDR 0x0334U
3649 + #define HW_ATL_RPC_CONTROL_ADR 0x0338U
3650 + #define HW_ATL_RPC_STATE_ADR 0x033CU
3651 +
3652 +@@ -48,15 +49,14 @@
3653 + #define FORCE_FLASHLESS 0
3654 +
3655 + static int hw_atl_utils_ver_match(u32 ver_expected, u32 ver_actual);
3656 +-
3657 + static int hw_atl_utils_mpi_set_state(struct aq_hw_s *self,
3658 + enum hal_atl_utils_fw_state_e state);
3659 +-
3660 + static u32 hw_atl_utils_get_mpi_mbox_tid(struct aq_hw_s *self);
3661 + static u32 hw_atl_utils_mpi_get_state(struct aq_hw_s *self);
3662 + static u32 hw_atl_utils_mif_cmd_get(struct aq_hw_s *self);
3663 + static u32 hw_atl_utils_mif_addr_get(struct aq_hw_s *self);
3664 + static u32 hw_atl_utils_rpc_state_get(struct aq_hw_s *self);
3665 ++static u32 aq_fw1x_rpc_get(struct aq_hw_s *self);
3666 +
3667 + int hw_atl_utils_initfw(struct aq_hw_s *self, const struct aq_fw_ops **fw_ops)
3668 + {
3669 +@@ -413,6 +413,10 @@ static int hw_atl_utils_init_ucp(struct aq_hw_s *self,
3670 + self, self->mbox_addr,
3671 + self->mbox_addr != 0U,
3672 + 1000U, 10000U);
3673 ++ err = readx_poll_timeout_atomic(aq_fw1x_rpc_get, self,
3674 ++ self->rpc_addr,
3675 ++ self->rpc_addr != 0U,
3676 ++ 1000U, 100000U);
3677 +
3678 + return err;
3679 + }
3680 +@@ -469,6 +473,12 @@ int hw_atl_utils_fw_rpc_wait(struct aq_hw_s *self,
3681 + self, fw.val,
3682 + sw.tid == fw.tid,
3683 + 1000U, 100000U);
3684 ++ if (err < 0)
3685 ++ goto err_exit;
3686 ++
3687 ++ err = aq_hw_err_from_flags(self);
3688 ++ if (err < 0)
3689 ++ goto err_exit;
3690 +
3691 + if (fw.len == 0xFFFFU) {
3692 + err = hw_atl_utils_fw_rpc_call(self, sw.len);
3693 +@@ -950,6 +960,11 @@ static u32 hw_atl_utils_rpc_state_get(struct aq_hw_s *self)
3694 + return aq_hw_read_reg(self, HW_ATL_RPC_STATE_ADR);
3695 + }
3696 +
3697 ++static u32 aq_fw1x_rpc_get(struct aq_hw_s *self)
3698 ++{
3699 ++ return aq_hw_read_reg(self, HW_ATL_MPI_RPC_ADDR);
3700 ++}
3701 ++
3702 + const struct aq_fw_ops aq_fw_1x_ops = {
3703 + .init = hw_atl_utils_mpi_create,
3704 + .deinit = hw_atl_fw1x_deinit,
3705 +diff --git a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
3706 +index 6cc100e7d5c0..76ff42ec3ae5 100644
3707 +--- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
3708 ++++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
3709 +@@ -410,10 +410,19 @@ void bgx_lmac_rx_tx_enable(int node, int bgx_idx, int lmacid, bool enable)
3710 + lmac = &bgx->lmac[lmacid];
3711 +
3712 + cfg = bgx_reg_read(bgx, lmacid, BGX_CMRX_CFG);
3713 +- if (enable)
3714 ++ if (enable) {
3715 + cfg |= CMR_PKT_RX_EN | CMR_PKT_TX_EN;
3716 +- else
3717 ++
3718 ++ /* enable TX FIFO Underflow interrupt */
3719 ++ bgx_reg_modify(bgx, lmacid, BGX_GMP_GMI_TXX_INT_ENA_W1S,
3720 ++ GMI_TXX_INT_UNDFLW);
3721 ++ } else {
3722 + cfg &= ~(CMR_PKT_RX_EN | CMR_PKT_TX_EN);
3723 ++
3724 ++ /* Disable TX FIFO Underflow interrupt */
3725 ++ bgx_reg_modify(bgx, lmacid, BGX_GMP_GMI_TXX_INT_ENA_W1C,
3726 ++ GMI_TXX_INT_UNDFLW);
3727 ++ }
3728 + bgx_reg_write(bgx, lmacid, BGX_CMRX_CFG, cfg);
3729 +
3730 + if (bgx->is_rgx)
3731 +@@ -1535,6 +1544,48 @@ static int bgx_init_phy(struct bgx *bgx)
3732 + return bgx_init_of_phy(bgx);
3733 + }
3734 +
3735 ++static irqreturn_t bgx_intr_handler(int irq, void *data)
3736 ++{
3737 ++ struct bgx *bgx = (struct bgx *)data;
3738 ++ u64 status, val;
3739 ++ int lmac;
3740 ++
3741 ++ for (lmac = 0; lmac < bgx->lmac_count; lmac++) {
3742 ++ status = bgx_reg_read(bgx, lmac, BGX_GMP_GMI_TXX_INT);
3743 ++ if (status & GMI_TXX_INT_UNDFLW) {
3744 ++ pci_err(bgx->pdev, "BGX%d lmac%d UNDFLW\n",
3745 ++ bgx->bgx_id, lmac);
3746 ++ val = bgx_reg_read(bgx, lmac, BGX_CMRX_CFG);
3747 ++ val &= ~CMR_EN;
3748 ++ bgx_reg_write(bgx, lmac, BGX_CMRX_CFG, val);
3749 ++ val |= CMR_EN;
3750 ++ bgx_reg_write(bgx, lmac, BGX_CMRX_CFG, val);
3751 ++ }
3752 ++ /* clear interrupts */
3753 ++ bgx_reg_write(bgx, lmac, BGX_GMP_GMI_TXX_INT, status);
3754 ++ }
3755 ++
3756 ++ return IRQ_HANDLED;
3757 ++}
3758 ++
3759 ++static void bgx_register_intr(struct pci_dev *pdev)
3760 ++{
3761 ++ struct bgx *bgx = pci_get_drvdata(pdev);
3762 ++ int ret;
3763 ++
3764 ++ ret = pci_alloc_irq_vectors(pdev, BGX_LMAC_VEC_OFFSET,
3765 ++ BGX_LMAC_VEC_OFFSET, PCI_IRQ_ALL_TYPES);
3766 ++ if (ret < 0) {
3767 ++ pci_err(pdev, "Req for #%d msix vectors failed\n",
3768 ++ BGX_LMAC_VEC_OFFSET);
3769 ++ return;
3770 ++ }
3771 ++ ret = pci_request_irq(pdev, GMPX_GMI_TX_INT, bgx_intr_handler, NULL,
3772 ++ bgx, "BGX%d", bgx->bgx_id);
3773 ++ if (ret)
3774 ++ pci_free_irq(pdev, GMPX_GMI_TX_INT, bgx);
3775 ++}
3776 ++
3777 + static int bgx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
3778 + {
3779 + int err;
3780 +@@ -1550,7 +1601,7 @@ static int bgx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
3781 +
3782 + pci_set_drvdata(pdev, bgx);
3783 +
3784 +- err = pci_enable_device(pdev);
3785 ++ err = pcim_enable_device(pdev);
3786 + if (err) {
3787 + dev_err(dev, "Failed to enable PCI device\n");
3788 + pci_set_drvdata(pdev, NULL);
3789 +@@ -1604,6 +1655,8 @@ static int bgx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
3790 +
3791 + bgx_init_hw(bgx);
3792 +
3793 ++ bgx_register_intr(pdev);
3794 ++
3795 + /* Enable all LMACs */
3796 + for (lmac = 0; lmac < bgx->lmac_count; lmac++) {
3797 + err = bgx_lmac_enable(bgx, lmac);
3798 +@@ -1620,6 +1673,7 @@ static int bgx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
3799 +
3800 + err_enable:
3801 + bgx_vnic[bgx->bgx_id] = NULL;
3802 ++ pci_free_irq(pdev, GMPX_GMI_TX_INT, bgx);
3803 + err_release_regions:
3804 + pci_release_regions(pdev);
3805 + err_disable_device:
3806 +@@ -1637,6 +1691,8 @@ static void bgx_remove(struct pci_dev *pdev)
3807 + for (lmac = 0; lmac < bgx->lmac_count; lmac++)
3808 + bgx_lmac_disable(bgx, lmac);
3809 +
3810 ++ pci_free_irq(pdev, GMPX_GMI_TX_INT, bgx);
3811 ++
3812 + bgx_vnic[bgx->bgx_id] = NULL;
3813 + pci_release_regions(pdev);
3814 + pci_disable_device(pdev);
3815 +diff --git a/drivers/net/ethernet/cavium/thunder/thunder_bgx.h b/drivers/net/ethernet/cavium/thunder/thunder_bgx.h
3816 +index 25888706bdcd..cdea49392185 100644
3817 +--- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.h
3818 ++++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.h
3819 +@@ -180,6 +180,15 @@
3820 + #define BGX_GMP_GMI_TXX_BURST 0x38228
3821 + #define BGX_GMP_GMI_TXX_MIN_PKT 0x38240
3822 + #define BGX_GMP_GMI_TXX_SGMII_CTL 0x38300
3823 ++#define BGX_GMP_GMI_TXX_INT 0x38500
3824 ++#define BGX_GMP_GMI_TXX_INT_W1S 0x38508
3825 ++#define BGX_GMP_GMI_TXX_INT_ENA_W1C 0x38510
3826 ++#define BGX_GMP_GMI_TXX_INT_ENA_W1S 0x38518
3827 ++#define GMI_TXX_INT_PTP_LOST BIT_ULL(4)
3828 ++#define GMI_TXX_INT_LATE_COL BIT_ULL(3)
3829 ++#define GMI_TXX_INT_XSDEF BIT_ULL(2)
3830 ++#define GMI_TXX_INT_XSCOL BIT_ULL(1)
3831 ++#define GMI_TXX_INT_UNDFLW BIT_ULL(0)
3832 +
3833 + #define BGX_MSIX_VEC_0_29_ADDR 0x400000 /* +(0..29) << 4 */
3834 + #define BGX_MSIX_VEC_0_29_CTL 0x400008
3835 +diff --git a/drivers/net/ethernet/davicom/dm9000.c b/drivers/net/ethernet/davicom/dm9000.c
3836 +index cce90b5925d9..70060c51854f 100644
3837 +--- a/drivers/net/ethernet/davicom/dm9000.c
3838 ++++ b/drivers/net/ethernet/davicom/dm9000.c
3839 +@@ -1405,6 +1405,8 @@ static struct dm9000_plat_data *dm9000_parse_dt(struct device *dev)
3840 + mac_addr = of_get_mac_address(np);
3841 + if (!IS_ERR(mac_addr))
3842 + ether_addr_copy(pdata->dev_addr, mac_addr);
3843 ++ else if (PTR_ERR(mac_addr) == -EPROBE_DEFER)
3844 ++ return ERR_CAST(mac_addr);
3845 +
3846 + return pdata;
3847 + }
3848 +diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c
3849 +index 1fe9f6050635..62673e27af0e 100644
3850 +--- a/drivers/net/ethernet/intel/ice/ice_ethtool.c
3851 ++++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c
3852 +@@ -2916,13 +2916,6 @@ ice_set_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *pause)
3853 + else
3854 + return -EINVAL;
3855 +
3856 +- /* Tell the OS link is going down, the link will go back up when fw
3857 +- * says it is ready asynchronously
3858 +- */
3859 +- ice_print_link_msg(vsi, false);
3860 +- netif_carrier_off(netdev);
3861 +- netif_tx_stop_all_queues(netdev);
3862 +-
3863 + /* Set the FC mode and only restart AN if link is up */
3864 + status = ice_set_fc(pi, &aq_failures, link_up);
3865 +
3866 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c
3867 +index 2739ed2a2911..841abe75652c 100644
3868 +--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c
3869 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c
3870 +@@ -2257,7 +2257,9 @@ static int dr_ste_build_src_gvmi_qpn_tag(struct mlx5dr_match_param *value,
3871 + struct mlx5dr_cmd_vport_cap *vport_cap;
3872 + struct mlx5dr_domain *dmn = sb->dmn;
3873 + struct mlx5dr_cmd_caps *caps;
3874 ++ u8 *bit_mask = sb->bit_mask;
3875 + u8 *tag = hw_ste->tag;
3876 ++ bool source_gvmi_set;
3877 +
3878 + DR_STE_SET_TAG(src_gvmi_qp, tag, source_qp, misc, source_sqn);
3879 +
3880 +@@ -2278,7 +2280,8 @@ static int dr_ste_build_src_gvmi_qpn_tag(struct mlx5dr_match_param *value,
3881 + if (!vport_cap)
3882 + return -EINVAL;
3883 +
3884 +- if (vport_cap->vport_gvmi)
3885 ++ source_gvmi_set = MLX5_GET(ste_src_gvmi_qp, bit_mask, source_gvmi);
3886 ++ if (vport_cap->vport_gvmi && source_gvmi_set)
3887 + MLX5_SET(ste_src_gvmi_qp, tag, source_gvmi, vport_cap->vport_gvmi);
3888 +
3889 + misc->source_eswitch_owner_vhca_id = 0;
3890 +diff --git a/drivers/net/ethernet/micrel/ks8851_mll.c b/drivers/net/ethernet/micrel/ks8851_mll.c
3891 +index a41a90c589db..1c9e70c8cc30 100644
3892 +--- a/drivers/net/ethernet/micrel/ks8851_mll.c
3893 ++++ b/drivers/net/ethernet/micrel/ks8851_mll.c
3894 +@@ -156,24 +156,6 @@ static int msg_enable;
3895 + * chip is busy transferring packet data (RX/TX FIFO accesses).
3896 + */
3897 +
3898 +-/**
3899 +- * ks_rdreg8 - read 8 bit register from device
3900 +- * @ks : The chip information
3901 +- * @offset: The register address
3902 +- *
3903 +- * Read a 8bit register from the chip, returning the result
3904 +- */
3905 +-static u8 ks_rdreg8(struct ks_net *ks, int offset)
3906 +-{
3907 +- u16 data;
3908 +- u8 shift_bit = offset & 0x03;
3909 +- u8 shift_data = (offset & 1) << 3;
3910 +- ks->cmd_reg_cache = (u16) offset | (u16)(BE0 << shift_bit);
3911 +- iowrite16(ks->cmd_reg_cache, ks->hw_addr_cmd);
3912 +- data = ioread16(ks->hw_addr);
3913 +- return (u8)(data >> shift_data);
3914 +-}
3915 +-
3916 + /**
3917 + * ks_rdreg16 - read 16 bit register from device
3918 + * @ks : The chip information
3919 +@@ -184,27 +166,11 @@ static u8 ks_rdreg8(struct ks_net *ks, int offset)
3920 +
3921 + static u16 ks_rdreg16(struct ks_net *ks, int offset)
3922 + {
3923 +- ks->cmd_reg_cache = (u16)offset | ((BE1 | BE0) << (offset & 0x02));
3924 ++ ks->cmd_reg_cache = (u16)offset | ((BE3 | BE2) >> (offset & 0x02));
3925 + iowrite16(ks->cmd_reg_cache, ks->hw_addr_cmd);
3926 + return ioread16(ks->hw_addr);
3927 + }
3928 +
3929 +-/**
3930 +- * ks_wrreg8 - write 8bit register value to chip
3931 +- * @ks: The chip information
3932 +- * @offset: The register address
3933 +- * @value: The value to write
3934 +- *
3935 +- */
3936 +-static void ks_wrreg8(struct ks_net *ks, int offset, u8 value)
3937 +-{
3938 +- u8 shift_bit = (offset & 0x03);
3939 +- u16 value_write = (u16)(value << ((offset & 1) << 3));
3940 +- ks->cmd_reg_cache = (u16)offset | (BE0 << shift_bit);
3941 +- iowrite16(ks->cmd_reg_cache, ks->hw_addr_cmd);
3942 +- iowrite16(value_write, ks->hw_addr);
3943 +-}
3944 +-
3945 + /**
3946 + * ks_wrreg16 - write 16bit register value to chip
3947 + * @ks: The chip information
3948 +@@ -215,7 +181,7 @@ static void ks_wrreg8(struct ks_net *ks, int offset, u8 value)
3949 +
3950 + static void ks_wrreg16(struct ks_net *ks, int offset, u16 value)
3951 + {
3952 +- ks->cmd_reg_cache = (u16)offset | ((BE1 | BE0) << (offset & 0x02));
3953 ++ ks->cmd_reg_cache = (u16)offset | ((BE3 | BE2) >> (offset & 0x02));
3954 + iowrite16(ks->cmd_reg_cache, ks->hw_addr_cmd);
3955 + iowrite16(value, ks->hw_addr);
3956 + }
3957 +@@ -231,7 +197,7 @@ static inline void ks_inblk(struct ks_net *ks, u16 *wptr, u32 len)
3958 + {
3959 + len >>= 1;
3960 + while (len--)
3961 +- *wptr++ = (u16)ioread16(ks->hw_addr);
3962 ++ *wptr++ = be16_to_cpu(ioread16(ks->hw_addr));
3963 + }
3964 +
3965 + /**
3966 +@@ -245,7 +211,7 @@ static inline void ks_outblk(struct ks_net *ks, u16 *wptr, u32 len)
3967 + {
3968 + len >>= 1;
3969 + while (len--)
3970 +- iowrite16(*wptr++, ks->hw_addr);
3971 ++ iowrite16(cpu_to_be16(*wptr++), ks->hw_addr);
3972 + }
3973 +
3974 + static void ks_disable_int(struct ks_net *ks)
3975 +@@ -324,8 +290,7 @@ static void ks_read_config(struct ks_net *ks)
3976 + u16 reg_data = 0;
3977 +
3978 + /* Regardless of bus width, 8 bit read should always work.*/
3979 +- reg_data = ks_rdreg8(ks, KS_CCR) & 0x00FF;
3980 +- reg_data |= ks_rdreg8(ks, KS_CCR+1) << 8;
3981 ++ reg_data = ks_rdreg16(ks, KS_CCR);
3982 +
3983 + /* addr/data bus are multiplexed */
3984 + ks->sharedbus = (reg_data & CCR_SHARED) == CCR_SHARED;
3985 +@@ -429,7 +394,7 @@ static inline void ks_read_qmu(struct ks_net *ks, u16 *buf, u32 len)
3986 +
3987 + /* 1. set sudo DMA mode */
3988 + ks_wrreg16(ks, KS_RXFDPR, RXFDPR_RXFPAI);
3989 +- ks_wrreg8(ks, KS_RXQCR, (ks->rc_rxqcr | RXQCR_SDA) & 0xff);
3990 ++ ks_wrreg16(ks, KS_RXQCR, ks->rc_rxqcr | RXQCR_SDA);
3991 +
3992 + /* 2. read prepend data */
3993 + /**
3994 +@@ -446,7 +411,7 @@ static inline void ks_read_qmu(struct ks_net *ks, u16 *buf, u32 len)
3995 + ks_inblk(ks, buf, ALIGN(len, 4));
3996 +
3997 + /* 4. reset sudo DMA Mode */
3998 +- ks_wrreg8(ks, KS_RXQCR, ks->rc_rxqcr);
3999 ++ ks_wrreg16(ks, KS_RXQCR, ks->rc_rxqcr);
4000 + }
4001 +
4002 + /**
4003 +@@ -679,13 +644,13 @@ static void ks_write_qmu(struct ks_net *ks, u8 *pdata, u16 len)
4004 + ks->txh.txw[1] = cpu_to_le16(len);
4005 +
4006 + /* 1. set sudo-DMA mode */
4007 +- ks_wrreg8(ks, KS_RXQCR, (ks->rc_rxqcr | RXQCR_SDA) & 0xff);
4008 ++ ks_wrreg16(ks, KS_RXQCR, ks->rc_rxqcr | RXQCR_SDA);
4009 + /* 2. write status/lenth info */
4010 + ks_outblk(ks, ks->txh.txw, 4);
4011 + /* 3. write pkt data */
4012 + ks_outblk(ks, (u16 *)pdata, ALIGN(len, 4));
4013 + /* 4. reset sudo-DMA mode */
4014 +- ks_wrreg8(ks, KS_RXQCR, ks->rc_rxqcr);
4015 ++ ks_wrreg16(ks, KS_RXQCR, ks->rc_rxqcr);
4016 + /* 5. Enqueue Tx(move the pkt from TX buffer into TXQ) */
4017 + ks_wrreg16(ks, KS_TXQCR, TXQCR_METFE);
4018 + /* 6. wait until TXQCR_METFE is auto-cleared */
4019 +diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
4020 +index 582176d869c3..89a6ae2b17e3 100644
4021 +--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
4022 ++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
4023 +@@ -4208,6 +4208,8 @@ static void stmmac_init_fs(struct net_device *dev)
4024 + {
4025 + struct stmmac_priv *priv = netdev_priv(dev);
4026 +
4027 ++ rtnl_lock();
4028 ++
4029 + /* Create per netdev entries */
4030 + priv->dbgfs_dir = debugfs_create_dir(dev->name, stmmac_fs_dir);
4031 +
4032 +@@ -4219,14 +4221,13 @@ static void stmmac_init_fs(struct net_device *dev)
4033 + debugfs_create_file("dma_cap", 0444, priv->dbgfs_dir, dev,
4034 + &stmmac_dma_cap_fops);
4035 +
4036 +- register_netdevice_notifier(&stmmac_notifier);
4037 ++ rtnl_unlock();
4038 + }
4039 +
4040 + static void stmmac_exit_fs(struct net_device *dev)
4041 + {
4042 + struct stmmac_priv *priv = netdev_priv(dev);
4043 +
4044 +- unregister_netdevice_notifier(&stmmac_notifier);
4045 + debugfs_remove_recursive(priv->dbgfs_dir);
4046 + }
4047 + #endif /* CONFIG_DEBUG_FS */
4048 +@@ -4728,14 +4729,14 @@ int stmmac_dvr_remove(struct device *dev)
4049 +
4050 + netdev_info(priv->dev, "%s: removing driver", __func__);
4051 +
4052 +-#ifdef CONFIG_DEBUG_FS
4053 +- stmmac_exit_fs(ndev);
4054 +-#endif
4055 + stmmac_stop_all_dma(priv);
4056 +
4057 + stmmac_mac_set(priv, priv->ioaddr, false);
4058 + netif_carrier_off(ndev);
4059 + unregister_netdev(ndev);
4060 ++#ifdef CONFIG_DEBUG_FS
4061 ++ stmmac_exit_fs(ndev);
4062 ++#endif
4063 + phylink_destroy(priv->phylink);
4064 + if (priv->plat->stmmac_rst)
4065 + reset_control_assert(priv->plat->stmmac_rst);
4066 +@@ -4955,6 +4956,7 @@ static int __init stmmac_init(void)
4067 + /* Create debugfs main directory if it doesn't exist yet */
4068 + if (!stmmac_fs_dir)
4069 + stmmac_fs_dir = debugfs_create_dir(STMMAC_RESOURCE_NAME, NULL);
4070 ++ register_netdevice_notifier(&stmmac_notifier);
4071 + #endif
4072 +
4073 + return 0;
4074 +@@ -4963,6 +4965,7 @@ static int __init stmmac_init(void)
4075 + static void __exit stmmac_exit(void)
4076 + {
4077 + #ifdef CONFIG_DEBUG_FS
4078 ++ unregister_netdevice_notifier(&stmmac_notifier);
4079 + debugfs_remove_recursive(stmmac_fs_dir);
4080 + #endif
4081 + }
4082 +diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
4083 +index 7dacfd102a99..b8fe42f4b3c5 100644
4084 +--- a/drivers/nvme/host/core.c
4085 ++++ b/drivers/nvme/host/core.c
4086 +@@ -1161,8 +1161,8 @@ static int nvme_identify_ns(struct nvme_ctrl *ctrl,
4087 + static int nvme_features(struct nvme_ctrl *dev, u8 op, unsigned int fid,
4088 + unsigned int dword11, void *buffer, size_t buflen, u32 *result)
4089 + {
4090 ++ union nvme_result res = { 0 };
4091 + struct nvme_command c;
4092 +- union nvme_result res;
4093 + int ret;
4094 +
4095 + memset(&c, 0, sizeof(c));
4096 +diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
4097 +index 570c75c92e29..cd64ddb129e5 100644
4098 +--- a/drivers/nvme/host/pci.c
4099 ++++ b/drivers/nvme/host/pci.c
4100 +@@ -2753,6 +2753,18 @@ static unsigned long check_vendor_combination_bug(struct pci_dev *pdev)
4101 + (dmi_match(DMI_BOARD_NAME, "PRIME B350M-A") ||
4102 + dmi_match(DMI_BOARD_NAME, "PRIME Z370-A")))
4103 + return NVME_QUIRK_NO_APST;
4104 ++ } else if ((pdev->vendor == 0x144d && (pdev->device == 0xa801 ||
4105 ++ pdev->device == 0xa808 || pdev->device == 0xa809)) ||
4106 ++ (pdev->vendor == 0x1e0f && pdev->device == 0x0001)) {
4107 ++ /*
4108 ++ * Forcing to use host managed nvme power settings for
4109 ++ * lowest idle power with quick resume latency on
4110 ++ * Samsung and Toshiba SSDs based on suspend behavior
4111 ++ * on Coffee Lake board for LENOVO C640
4112 ++ */
4113 ++ if ((dmi_match(DMI_BOARD_VENDOR, "LENOVO")) &&
4114 ++ dmi_match(DMI_BOARD_NAME, "LNVNB161216"))
4115 ++ return NVME_QUIRK_SIMPLE_SUSPEND;
4116 + }
4117 +
4118 + return 0;
4119 +@@ -3114,7 +3126,8 @@ static const struct pci_device_id nvme_id_table[] = {
4120 + .driver_data = NVME_QUIRK_NO_DEEPEST_PS |
4121 + NVME_QUIRK_IGNORE_DEV_SUBNQN, },
4122 + { PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_EXPRESS, 0xffffff) },
4123 +- { PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2001) },
4124 ++ { PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2001),
4125 ++ .driver_data = NVME_QUIRK_SINGLE_VECTOR },
4126 + { PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2003) },
4127 + { PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2005),
4128 + .driver_data = NVME_QUIRK_SINGLE_VECTOR |
4129 +diff --git a/drivers/phy/motorola/phy-mapphone-mdm6600.c b/drivers/phy/motorola/phy-mapphone-mdm6600.c
4130 +index f20524f0c21d..94a34cf75eb3 100644
4131 +--- a/drivers/phy/motorola/phy-mapphone-mdm6600.c
4132 ++++ b/drivers/phy/motorola/phy-mapphone-mdm6600.c
4133 +@@ -20,6 +20,7 @@
4134 +
4135 + #define PHY_MDM6600_PHY_DELAY_MS 4000 /* PHY enable 2.2s to 3.5s */
4136 + #define PHY_MDM6600_ENABLED_DELAY_MS 8000 /* 8s more total for MDM6600 */
4137 ++#define PHY_MDM6600_WAKE_KICK_MS 600 /* time on after GPIO toggle */
4138 + #define MDM6600_MODEM_IDLE_DELAY_MS 1000 /* modem after USB suspend */
4139 + #define MDM6600_MODEM_WAKE_DELAY_MS 200 /* modem response after idle */
4140 +
4141 +@@ -243,10 +244,24 @@ static irqreturn_t phy_mdm6600_wakeirq_thread(int irq, void *data)
4142 + {
4143 + struct phy_mdm6600 *ddata = data;
4144 + struct gpio_desc *mode_gpio1;
4145 ++ int error, wakeup;
4146 +
4147 + mode_gpio1 = ddata->mode_gpios->desc[PHY_MDM6600_MODE1];
4148 +- dev_dbg(ddata->dev, "OOB wake on mode_gpio1: %i\n",
4149 +- gpiod_get_value(mode_gpio1));
4150 ++ wakeup = gpiod_get_value(mode_gpio1);
4151 ++ if (!wakeup)
4152 ++ return IRQ_NONE;
4153 ++
4154 ++ dev_dbg(ddata->dev, "OOB wake on mode_gpio1: %i\n", wakeup);
4155 ++ error = pm_runtime_get_sync(ddata->dev);
4156 ++ if (error < 0) {
4157 ++ pm_runtime_put_noidle(ddata->dev);
4158 ++
4159 ++ return IRQ_NONE;
4160 ++ }
4161 ++
4162 ++ /* Just wake-up and kick the autosuspend timer */
4163 ++ pm_runtime_mark_last_busy(ddata->dev);
4164 ++ pm_runtime_put_autosuspend(ddata->dev);
4165 +
4166 + return IRQ_HANDLED;
4167 + }
4168 +@@ -496,8 +511,14 @@ static void phy_mdm6600_modem_wake(struct work_struct *work)
4169 +
4170 + ddata = container_of(work, struct phy_mdm6600, modem_wake_work.work);
4171 + phy_mdm6600_wake_modem(ddata);
4172 ++
4173 ++ /*
4174 ++ * The modem does not always stay awake 1.2 seconds after toggling
4175 ++ * the wake GPIO, and sometimes it idles after about some 600 ms
4176 ++ * making writes time out.
4177 ++ */
4178 + schedule_delayed_work(&ddata->modem_wake_work,
4179 +- msecs_to_jiffies(MDM6600_MODEM_IDLE_DELAY_MS));
4180 ++ msecs_to_jiffies(PHY_MDM6600_WAKE_KICK_MS));
4181 + }
4182 +
4183 + static int __maybe_unused phy_mdm6600_runtime_suspend(struct device *dev)
4184 +diff --git a/drivers/regulator/stm32-vrefbuf.c b/drivers/regulator/stm32-vrefbuf.c
4185 +index 8919a5130bec..25f24df9aa82 100644
4186 +--- a/drivers/regulator/stm32-vrefbuf.c
4187 ++++ b/drivers/regulator/stm32-vrefbuf.c
4188 +@@ -88,7 +88,7 @@ static int stm32_vrefbuf_disable(struct regulator_dev *rdev)
4189 + }
4190 +
4191 + val = readl_relaxed(priv->base + STM32_VREFBUF_CSR);
4192 +- val = (val & ~STM32_ENVR) | STM32_HIZ;
4193 ++ val &= ~STM32_ENVR;
4194 + writel_relaxed(val, priv->base + STM32_VREFBUF_CSR);
4195 +
4196 + pm_runtime_mark_last_busy(priv->dev);
4197 +@@ -175,6 +175,7 @@ static const struct regulator_desc stm32_vrefbuf_regu = {
4198 + .volt_table = stm32_vrefbuf_voltages,
4199 + .n_voltages = ARRAY_SIZE(stm32_vrefbuf_voltages),
4200 + .ops = &stm32_vrefbuf_volt_ops,
4201 ++ .off_on_delay = 1000,
4202 + .type = REGULATOR_VOLTAGE,
4203 + .owner = THIS_MODULE,
4204 + };
4205 +diff --git a/drivers/s390/cio/blacklist.c b/drivers/s390/cio/blacklist.c
4206 +index 2a3f874a21d5..9cebff8e8d74 100644
4207 +--- a/drivers/s390/cio/blacklist.c
4208 ++++ b/drivers/s390/cio/blacklist.c
4209 +@@ -303,8 +303,10 @@ static void *
4210 + cio_ignore_proc_seq_next(struct seq_file *s, void *it, loff_t *offset)
4211 + {
4212 + struct ccwdev_iter *iter;
4213 ++ loff_t p = *offset;
4214 +
4215 +- if (*offset >= (__MAX_SUBCHANNEL + 1) * (__MAX_SSID + 1))
4216 ++ (*offset)++;
4217 ++ if (p >= (__MAX_SUBCHANNEL + 1) * (__MAX_SSID + 1))
4218 + return NULL;
4219 + iter = it;
4220 + if (iter->devno == __MAX_SUBCHANNEL) {
4221 +@@ -314,7 +316,6 @@ cio_ignore_proc_seq_next(struct seq_file *s, void *it, loff_t *offset)
4222 + return NULL;
4223 + } else
4224 + iter->devno++;
4225 +- (*offset)++;
4226 + return iter;
4227 + }
4228 +
4229 +diff --git a/drivers/s390/cio/qdio_setup.c b/drivers/s390/cio/qdio_setup.c
4230 +index cd164886132f..ee0b3c586211 100644
4231 +--- a/drivers/s390/cio/qdio_setup.c
4232 ++++ b/drivers/s390/cio/qdio_setup.c
4233 +@@ -8,6 +8,7 @@
4234 + #include <linux/kernel.h>
4235 + #include <linux/slab.h>
4236 + #include <linux/export.h>
4237 ++#include <linux/io.h>
4238 + #include <asm/qdio.h>
4239 +
4240 + #include "cio.h"
4241 +@@ -207,7 +208,7 @@ static void setup_storage_lists(struct qdio_q *q, struct qdio_irq *irq_ptr,
4242 +
4243 + /* fill in sl */
4244 + for (j = 0; j < QDIO_MAX_BUFFERS_PER_Q; j++)
4245 +- q->sl->element[j].sbal = (unsigned long)q->sbal[j];
4246 ++ q->sl->element[j].sbal = virt_to_phys(q->sbal[j]);
4247 + }
4248 +
4249 + static void setup_queues(struct qdio_irq *irq_ptr,
4250 +diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
4251 +index 23852888eb2c..b727d1e34523 100644
4252 +--- a/drivers/s390/net/qeth_core_main.c
4253 ++++ b/drivers/s390/net/qeth_core_main.c
4254 +@@ -4716,10 +4716,10 @@ static void qeth_qdio_establish_cq(struct qeth_card *card,
4255 + if (card->options.cq == QETH_CQ_ENABLED) {
4256 + int offset = QDIO_MAX_BUFFERS_PER_Q *
4257 + (card->qdio.no_in_queues - 1);
4258 +- for (i = 0; i < QDIO_MAX_BUFFERS_PER_Q; ++i) {
4259 +- in_sbal_ptrs[offset + i] = (struct qdio_buffer *)
4260 +- virt_to_phys(card->qdio.c_q->bufs[i].buffer);
4261 +- }
4262 ++
4263 ++ for (i = 0; i < QDIO_MAX_BUFFERS_PER_Q; i++)
4264 ++ in_sbal_ptrs[offset + i] =
4265 ++ card->qdio.c_q->bufs[i].buffer;
4266 +
4267 + queue_start_poll[card->qdio.no_in_queues - 1] = NULL;
4268 + }
4269 +@@ -4753,10 +4753,9 @@ static int qeth_qdio_establish(struct qeth_card *card)
4270 + rc = -ENOMEM;
4271 + goto out_free_qib_param;
4272 + }
4273 +- for (i = 0; i < QDIO_MAX_BUFFERS_PER_Q; ++i) {
4274 +- in_sbal_ptrs[i] = (struct qdio_buffer *)
4275 +- virt_to_phys(card->qdio.in_q->bufs[i].buffer);
4276 +- }
4277 ++
4278 ++ for (i = 0; i < QDIO_MAX_BUFFERS_PER_Q; i++)
4279 ++ in_sbal_ptrs[i] = card->qdio.in_q->bufs[i].buffer;
4280 +
4281 + queue_start_poll = kcalloc(card->qdio.no_in_queues, sizeof(void *),
4282 + GFP_KERNEL);
4283 +@@ -4777,11 +4776,11 @@ static int qeth_qdio_establish(struct qeth_card *card)
4284 + rc = -ENOMEM;
4285 + goto out_free_queue_start_poll;
4286 + }
4287 ++
4288 + for (i = 0, k = 0; i < card->qdio.no_out_queues; ++i)
4289 +- for (j = 0; j < QDIO_MAX_BUFFERS_PER_Q; ++j, ++k) {
4290 +- out_sbal_ptrs[k] = (struct qdio_buffer *)virt_to_phys(
4291 +- card->qdio.out_qs[i]->bufs[j]->buffer);
4292 +- }
4293 ++ for (j = 0; j < QDIO_MAX_BUFFERS_PER_Q; j++, k++)
4294 ++ out_sbal_ptrs[k] =
4295 ++ card->qdio.out_qs[i]->bufs[j]->buffer;
4296 +
4297 + memset(&init_data, 0, sizeof(struct qdio_initialize));
4298 + init_data.cdev = CARD_DDEV(card);
4299 +diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
4300 +index 46bc062d873e..d86838801805 100644
4301 +--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
4302 ++++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
4303 +@@ -594,7 +594,8 @@ retry_alloc:
4304 +
4305 + fusion->io_request_frames =
4306 + dma_pool_alloc(fusion->io_request_frames_pool,
4307 +- GFP_KERNEL, &fusion->io_request_frames_phys);
4308 ++ GFP_KERNEL | __GFP_NOWARN,
4309 ++ &fusion->io_request_frames_phys);
4310 + if (!fusion->io_request_frames) {
4311 + if (instance->max_fw_cmds >= (MEGASAS_REDUCE_QD_COUNT * 2)) {
4312 + instance->max_fw_cmds -= MEGASAS_REDUCE_QD_COUNT;
4313 +@@ -632,7 +633,7 @@ retry_alloc:
4314 +
4315 + fusion->io_request_frames =
4316 + dma_pool_alloc(fusion->io_request_frames_pool,
4317 +- GFP_KERNEL,
4318 ++ GFP_KERNEL | __GFP_NOWARN,
4319 + &fusion->io_request_frames_phys);
4320 +
4321 + if (!fusion->io_request_frames) {
4322 +diff --git a/drivers/soc/imx/soc-imx-scu.c b/drivers/soc/imx/soc-imx-scu.c
4323 +index c68882eb80f7..f638e7790470 100644
4324 +--- a/drivers/soc/imx/soc-imx-scu.c
4325 ++++ b/drivers/soc/imx/soc-imx-scu.c
4326 +@@ -25,7 +25,7 @@ struct imx_sc_msg_misc_get_soc_id {
4327 + u32 id;
4328 + } resp;
4329 + } data;
4330 +-} __packed;
4331 ++} __packed __aligned(4);
4332 +
4333 + struct imx_sc_msg_misc_get_soc_uid {
4334 + struct imx_sc_rpc_msg hdr;
4335 +diff --git a/drivers/spi/atmel-quadspi.c b/drivers/spi/atmel-quadspi.c
4336 +index fd8007ebb145..13def7f78b9e 100644
4337 +--- a/drivers/spi/atmel-quadspi.c
4338 ++++ b/drivers/spi/atmel-quadspi.c
4339 +@@ -149,6 +149,7 @@ struct atmel_qspi {
4340 + struct clk *qspick;
4341 + struct platform_device *pdev;
4342 + const struct atmel_qspi_caps *caps;
4343 ++ resource_size_t mmap_size;
4344 + u32 pending;
4345 + u32 mr;
4346 + u32 scr;
4347 +@@ -329,6 +330,14 @@ static int atmel_qspi_exec_op(struct spi_mem *mem, const struct spi_mem_op *op)
4348 + u32 sr, offset;
4349 + int err;
4350 +
4351 ++ /*
4352 ++ * Check if the address exceeds the MMIO window size. An improvement
4353 ++ * would be to add support for regular SPI mode and fall back to it
4354 ++ * when the flash memories overrun the controller's memory space.
4355 ++ */
4356 ++ if (op->addr.val + op->data.nbytes > aq->mmap_size)
4357 ++ return -ENOTSUPP;
4358 ++
4359 + err = atmel_qspi_set_cfg(aq, op, &offset);
4360 + if (err)
4361 + return err;
4362 +@@ -480,6 +489,8 @@ static int atmel_qspi_probe(struct platform_device *pdev)
4363 + goto exit;
4364 + }
4365 +
4366 ++ aq->mmap_size = resource_size(res);
4367 ++
4368 + /* Get the peripheral clock */
4369 + aq->pclk = devm_clk_get(&pdev->dev, "pclk");
4370 + if (IS_ERR(aq->pclk))
4371 +diff --git a/drivers/spi/spi-bcm63xx-hsspi.c b/drivers/spi/spi-bcm63xx-hsspi.c
4372 +index c6836a931dbf..36f7eb8ab2df 100644
4373 +--- a/drivers/spi/spi-bcm63xx-hsspi.c
4374 ++++ b/drivers/spi/spi-bcm63xx-hsspi.c
4375 +@@ -367,7 +367,6 @@ static int bcm63xx_hsspi_probe(struct platform_device *pdev)
4376 + goto out_disable_clk;
4377 +
4378 + rate = clk_get_rate(pll_clk);
4379 +- clk_disable_unprepare(pll_clk);
4380 + if (!rate) {
4381 + ret = -EINVAL;
4382 + goto out_disable_pll_clk;
4383 +diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c
4384 +index 3ea9d8a3e6e8..ab2c3848f5bf 100644
4385 +--- a/drivers/spi/spidev.c
4386 ++++ b/drivers/spi/spidev.c
4387 +@@ -394,6 +394,7 @@ spidev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
4388 + else
4389 + retval = get_user(tmp, (u32 __user *)arg);
4390 + if (retval == 0) {
4391 ++ struct spi_controller *ctlr = spi->controller;
4392 + u32 save = spi->mode;
4393 +
4394 + if (tmp & ~SPI_MODE_MASK) {
4395 +@@ -401,6 +402,10 @@ spidev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
4396 + break;
4397 + }
4398 +
4399 ++ if (ctlr->use_gpio_descriptors && ctlr->cs_gpiods &&
4400 ++ ctlr->cs_gpiods[spi->chip_select])
4401 ++ tmp |= SPI_CS_HIGH;
4402 ++
4403 + tmp |= spi->mode & ~SPI_MODE_MASK;
4404 + spi->mode = (u16)tmp;
4405 + retval = spi_setup(spi);
4406 +diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c
4407 +index 6d9d41170832..32e5966ba5c5 100644
4408 +--- a/drivers/staging/media/hantro/hantro_drv.c
4409 ++++ b/drivers/staging/media/hantro/hantro_drv.c
4410 +@@ -553,13 +553,13 @@ static int hantro_attach_func(struct hantro_dev *vpu,
4411 + goto err_rel_entity1;
4412 +
4413 + /* Connect the three entities */
4414 +- ret = media_create_pad_link(&func->vdev.entity, 0, &func->proc, 1,
4415 ++ ret = media_create_pad_link(&func->vdev.entity, 0, &func->proc, 0,
4416 + MEDIA_LNK_FL_IMMUTABLE |
4417 + MEDIA_LNK_FL_ENABLED);
4418 + if (ret)
4419 + goto err_rel_entity2;
4420 +
4421 +- ret = media_create_pad_link(&func->proc, 0, &func->sink, 0,
4422 ++ ret = media_create_pad_link(&func->proc, 1, &func->sink, 0,
4423 + MEDIA_LNK_FL_IMMUTABLE |
4424 + MEDIA_LNK_FL_ENABLED);
4425 + if (ret)
4426 +diff --git a/drivers/staging/speakup/selection.c b/drivers/staging/speakup/selection.c
4427 +index a8b4d0c5ab7e..032f3264fba1 100644
4428 +--- a/drivers/staging/speakup/selection.c
4429 ++++ b/drivers/staging/speakup/selection.c
4430 +@@ -51,9 +51,7 @@ static void __speakup_set_selection(struct work_struct *work)
4431 + goto unref;
4432 + }
4433 +
4434 +- console_lock();
4435 + set_selection_kernel(&sel, tty);
4436 +- console_unlock();
4437 +
4438 + unref:
4439 + tty_kref_put(tty);
4440 +diff --git a/drivers/tty/serial/8250/8250_exar.c b/drivers/tty/serial/8250/8250_exar.c
4441 +index 597eb9d16f21..e1268646ee56 100644
4442 +--- a/drivers/tty/serial/8250/8250_exar.c
4443 ++++ b/drivers/tty/serial/8250/8250_exar.c
4444 +@@ -25,6 +25,14 @@
4445 +
4446 + #include "8250.h"
4447 +
4448 ++#define PCI_DEVICE_ID_ACCES_COM_2S 0x1052
4449 ++#define PCI_DEVICE_ID_ACCES_COM_4S 0x105d
4450 ++#define PCI_DEVICE_ID_ACCES_COM_8S 0x106c
4451 ++#define PCI_DEVICE_ID_ACCES_COM232_8 0x10a8
4452 ++#define PCI_DEVICE_ID_ACCES_COM_2SM 0x10d2
4453 ++#define PCI_DEVICE_ID_ACCES_COM_4SM 0x10db
4454 ++#define PCI_DEVICE_ID_ACCES_COM_8SM 0x10ea
4455 ++
4456 + #define PCI_DEVICE_ID_COMMTECH_4224PCI335 0x0002
4457 + #define PCI_DEVICE_ID_COMMTECH_4222PCI335 0x0004
4458 + #define PCI_DEVICE_ID_COMMTECH_2324PCI335 0x000a
4459 +@@ -658,6 +666,22 @@ static int __maybe_unused exar_resume(struct device *dev)
4460 +
4461 + static SIMPLE_DEV_PM_OPS(exar_pci_pm, exar_suspend, exar_resume);
4462 +
4463 ++static const struct exar8250_board acces_com_2x = {
4464 ++ .num_ports = 2,
4465 ++ .setup = pci_xr17c154_setup,
4466 ++};
4467 ++
4468 ++static const struct exar8250_board acces_com_4x = {
4469 ++ .num_ports = 4,
4470 ++ .setup = pci_xr17c154_setup,
4471 ++};
4472 ++
4473 ++static const struct exar8250_board acces_com_8x = {
4474 ++ .num_ports = 8,
4475 ++ .setup = pci_xr17c154_setup,
4476 ++};
4477 ++
4478 ++
4479 + static const struct exar8250_board pbn_fastcom335_2 = {
4480 + .num_ports = 2,
4481 + .setup = pci_fastcom335_setup,
4482 +@@ -726,6 +750,15 @@ static const struct exar8250_board pbn_exar_XR17V8358 = {
4483 + }
4484 +
4485 + static const struct pci_device_id exar_pci_tbl[] = {
4486 ++ EXAR_DEVICE(ACCESSIO, ACCES_COM_2S, acces_com_2x),
4487 ++ EXAR_DEVICE(ACCESSIO, ACCES_COM_4S, acces_com_4x),
4488 ++ EXAR_DEVICE(ACCESSIO, ACCES_COM_8S, acces_com_8x),
4489 ++ EXAR_DEVICE(ACCESSIO, ACCES_COM232_8, acces_com_8x),
4490 ++ EXAR_DEVICE(ACCESSIO, ACCES_COM_2SM, acces_com_2x),
4491 ++ EXAR_DEVICE(ACCESSIO, ACCES_COM_4SM, acces_com_4x),
4492 ++ EXAR_DEVICE(ACCESSIO, ACCES_COM_8SM, acces_com_8x),
4493 ++
4494 ++
4495 + CONNECT_DEVICE(XR17C152, UART_2_232, pbn_connect),
4496 + CONNECT_DEVICE(XR17C154, UART_4_232, pbn_connect),
4497 + CONNECT_DEVICE(XR17C158, UART_8_232, pbn_connect),
4498 +diff --git a/drivers/tty/serial/ar933x_uart.c b/drivers/tty/serial/ar933x_uart.c
4499 +index 3bdd56a1021b..ea12f10610b6 100644
4500 +--- a/drivers/tty/serial/ar933x_uart.c
4501 ++++ b/drivers/tty/serial/ar933x_uart.c
4502 +@@ -286,6 +286,10 @@ static void ar933x_uart_set_termios(struct uart_port *port,
4503 + ar933x_uart_rmw_set(up, AR933X_UART_CS_REG,
4504 + AR933X_UART_CS_HOST_INT_EN);
4505 +
4506 ++ /* enable RX and TX ready overide */
4507 ++ ar933x_uart_rmw_set(up, AR933X_UART_CS_REG,
4508 ++ AR933X_UART_CS_TX_READY_ORIDE | AR933X_UART_CS_RX_READY_ORIDE);
4509 ++
4510 + /* reenable the UART */
4511 + ar933x_uart_rmw(up, AR933X_UART_CS_REG,
4512 + AR933X_UART_CS_IF_MODE_M << AR933X_UART_CS_IF_MODE_S,
4513 +@@ -418,6 +422,10 @@ static int ar933x_uart_startup(struct uart_port *port)
4514 + ar933x_uart_rmw_set(up, AR933X_UART_CS_REG,
4515 + AR933X_UART_CS_HOST_INT_EN);
4516 +
4517 ++ /* enable RX and TX ready overide */
4518 ++ ar933x_uart_rmw_set(up, AR933X_UART_CS_REG,
4519 ++ AR933X_UART_CS_TX_READY_ORIDE | AR933X_UART_CS_RX_READY_ORIDE);
4520 ++
4521 + /* Enable RX interrupts */
4522 + up->ier = AR933X_UART_INT_RX_VALID;
4523 + ar933x_uart_write(up, AR933X_UART_INT_EN_REG, up->ier);
4524 +diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
4525 +index 3f64b08f50ef..d2fc050a3445 100644
4526 +--- a/drivers/tty/serial/fsl_lpuart.c
4527 ++++ b/drivers/tty/serial/fsl_lpuart.c
4528 +@@ -268,6 +268,7 @@ struct lpuart_port {
4529 + int rx_dma_rng_buf_len;
4530 + unsigned int dma_tx_nents;
4531 + wait_queue_head_t dma_wait;
4532 ++ bool id_allocated;
4533 + };
4534 +
4535 + struct lpuart_soc_data {
4536 +@@ -2382,19 +2383,6 @@ static int lpuart_probe(struct platform_device *pdev)
4537 + if (!sport)
4538 + return -ENOMEM;
4539 +
4540 +- ret = of_alias_get_id(np, "serial");
4541 +- if (ret < 0) {
4542 +- ret = ida_simple_get(&fsl_lpuart_ida, 0, UART_NR, GFP_KERNEL);
4543 +- if (ret < 0) {
4544 +- dev_err(&pdev->dev, "port line is full, add device failed\n");
4545 +- return ret;
4546 +- }
4547 +- }
4548 +- if (ret >= ARRAY_SIZE(lpuart_ports)) {
4549 +- dev_err(&pdev->dev, "serial%d out of range\n", ret);
4550 +- return -EINVAL;
4551 +- }
4552 +- sport->port.line = ret;
4553 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
4554 + sport->port.membase = devm_ioremap_resource(&pdev->dev, res);
4555 + if (IS_ERR(sport->port.membase))
4556 +@@ -2435,9 +2423,25 @@ static int lpuart_probe(struct platform_device *pdev)
4557 + }
4558 + }
4559 +
4560 ++ ret = of_alias_get_id(np, "serial");
4561 ++ if (ret < 0) {
4562 ++ ret = ida_simple_get(&fsl_lpuart_ida, 0, UART_NR, GFP_KERNEL);
4563 ++ if (ret < 0) {
4564 ++ dev_err(&pdev->dev, "port line is full, add device failed\n");
4565 ++ return ret;
4566 ++ }
4567 ++ sport->id_allocated = true;
4568 ++ }
4569 ++ if (ret >= ARRAY_SIZE(lpuart_ports)) {
4570 ++ dev_err(&pdev->dev, "serial%d out of range\n", ret);
4571 ++ ret = -EINVAL;
4572 ++ goto failed_out_of_range;
4573 ++ }
4574 ++ sport->port.line = ret;
4575 ++
4576 + ret = lpuart_enable_clks(sport);
4577 + if (ret)
4578 +- return ret;
4579 ++ goto failed_clock_enable;
4580 + sport->port.uartclk = lpuart_get_baud_clk_rate(sport);
4581 +
4582 + lpuart_ports[sport->port.line] = sport;
4583 +@@ -2487,6 +2491,10 @@ static int lpuart_probe(struct platform_device *pdev)
4584 + failed_attach_port:
4585 + failed_irq_request:
4586 + lpuart_disable_clks(sport);
4587 ++failed_clock_enable:
4588 ++failed_out_of_range:
4589 ++ if (sport->id_allocated)
4590 ++ ida_simple_remove(&fsl_lpuart_ida, sport->port.line);
4591 + return ret;
4592 + }
4593 +
4594 +@@ -2496,7 +2504,8 @@ static int lpuart_remove(struct platform_device *pdev)
4595 +
4596 + uart_remove_one_port(&lpuart_reg, &sport->port);
4597 +
4598 +- ida_simple_remove(&fsl_lpuart_ida, sport->port.line);
4599 ++ if (sport->id_allocated)
4600 ++ ida_simple_remove(&fsl_lpuart_ida, sport->port.line);
4601 +
4602 + lpuart_disable_clks(sport);
4603 +
4604 +diff --git a/drivers/tty/serial/mvebu-uart.c b/drivers/tty/serial/mvebu-uart.c
4605 +index c12a12556339..4e9a590712cb 100644
4606 +--- a/drivers/tty/serial/mvebu-uart.c
4607 ++++ b/drivers/tty/serial/mvebu-uart.c
4608 +@@ -851,7 +851,7 @@ static int mvebu_uart_probe(struct platform_device *pdev)
4609 +
4610 + port->membase = devm_ioremap_resource(&pdev->dev, reg);
4611 + if (IS_ERR(port->membase))
4612 +- return -PTR_ERR(port->membase);
4613 ++ return PTR_ERR(port->membase);
4614 +
4615 + mvuart = devm_kzalloc(&pdev->dev, sizeof(struct mvebu_uart),
4616 + GFP_KERNEL);
4617 +diff --git a/drivers/tty/vt/selection.c b/drivers/tty/vt/selection.c
4618 +index 44d974d4159f..d7d2e4b844bc 100644
4619 +--- a/drivers/tty/vt/selection.c
4620 ++++ b/drivers/tty/vt/selection.c
4621 +@@ -16,6 +16,7 @@
4622 + #include <linux/tty.h>
4623 + #include <linux/sched.h>
4624 + #include <linux/mm.h>
4625 ++#include <linux/mutex.h>
4626 + #include <linux/slab.h>
4627 + #include <linux/types.h>
4628 +
4629 +@@ -45,6 +46,7 @@ static volatile int sel_start = -1; /* cleared by clear_selection */
4630 + static int sel_end;
4631 + static int sel_buffer_lth;
4632 + static char *sel_buffer;
4633 ++static DEFINE_MUTEX(sel_lock);
4634 +
4635 + /* clear_selection, highlight and highlight_pointer can be called
4636 + from interrupt (via scrollback/front) */
4637 +@@ -179,14 +181,14 @@ int set_selection_user(const struct tiocl_selection __user *sel,
4638 + return set_selection_kernel(&v, tty);
4639 + }
4640 +
4641 +-int set_selection_kernel(struct tiocl_selection *v, struct tty_struct *tty)
4642 ++static int __set_selection_kernel(struct tiocl_selection *v, struct tty_struct *tty)
4643 + {
4644 + struct vc_data *vc = vc_cons[fg_console].d;
4645 + int new_sel_start, new_sel_end, spc;
4646 + char *bp, *obp;
4647 + int i, ps, pe, multiplier;
4648 + u32 c;
4649 +- int mode;
4650 ++ int mode, ret = 0;
4651 +
4652 + poke_blanked_console();
4653 +
4654 +@@ -334,7 +336,21 @@ int set_selection_kernel(struct tiocl_selection *v, struct tty_struct *tty)
4655 + }
4656 + }
4657 + sel_buffer_lth = bp - sel_buffer;
4658 +- return 0;
4659 ++
4660 ++ return ret;
4661 ++}
4662 ++
4663 ++int set_selection_kernel(struct tiocl_selection *v, struct tty_struct *tty)
4664 ++{
4665 ++ int ret;
4666 ++
4667 ++ mutex_lock(&sel_lock);
4668 ++ console_lock();
4669 ++ ret = __set_selection_kernel(v, tty);
4670 ++ console_unlock();
4671 ++ mutex_unlock(&sel_lock);
4672 ++
4673 ++ return ret;
4674 + }
4675 + EXPORT_SYMBOL_GPL(set_selection_kernel);
4676 +
4677 +@@ -364,6 +380,7 @@ int paste_selection(struct tty_struct *tty)
4678 + tty_buffer_lock_exclusive(&vc->port);
4679 +
4680 + add_wait_queue(&vc->paste_wait, &wait);
4681 ++ mutex_lock(&sel_lock);
4682 + while (sel_buffer && sel_buffer_lth > pasted) {
4683 + set_current_state(TASK_INTERRUPTIBLE);
4684 + if (signal_pending(current)) {
4685 +@@ -371,7 +388,9 @@ int paste_selection(struct tty_struct *tty)
4686 + break;
4687 + }
4688 + if (tty_throttled(tty)) {
4689 ++ mutex_unlock(&sel_lock);
4690 + schedule();
4691 ++ mutex_lock(&sel_lock);
4692 + continue;
4693 + }
4694 + __set_current_state(TASK_RUNNING);
4695 +@@ -380,6 +399,7 @@ int paste_selection(struct tty_struct *tty)
4696 + count);
4697 + pasted += count;
4698 + }
4699 ++ mutex_unlock(&sel_lock);
4700 + remove_wait_queue(&vc->paste_wait, &wait);
4701 + __set_current_state(TASK_RUNNING);
4702 +
4703 +diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
4704 +index 3b4ccc2a30c1..e9e27ba69d5d 100644
4705 +--- a/drivers/tty/vt/vt.c
4706 ++++ b/drivers/tty/vt/vt.c
4707 +@@ -3046,10 +3046,8 @@ int tioclinux(struct tty_struct *tty, unsigned long arg)
4708 + switch (type)
4709 + {
4710 + case TIOCL_SETSEL:
4711 +- console_lock();
4712 + ret = set_selection_user((struct tiocl_selection
4713 + __user *)(p+1), tty);
4714 +- console_unlock();
4715 + break;
4716 + case TIOCL_PASTESEL:
4717 + ret = paste_selection(tty);
4718 +diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c
4719 +index 02f6ca2cb1ba..f624cc87cbab 100644
4720 +--- a/drivers/usb/cdns3/gadget.c
4721 ++++ b/drivers/usb/cdns3/gadget.c
4722 +@@ -2107,7 +2107,7 @@ found:
4723 + /* Update ring only if removed request is on pending_req_list list */
4724 + if (req_on_hw_ring) {
4725 + link_trb->buffer = TRB_BUFFER(priv_ep->trb_pool_dma +
4726 +- (priv_req->start_trb * TRB_SIZE));
4727 ++ ((priv_req->end_trb + 1) * TRB_SIZE));
4728 + link_trb->control = (link_trb->control & TRB_CYCLE) |
4729 + TRB_TYPE(TRB_LINK) | TRB_CHAIN;
4730 +
4731 +@@ -2152,11 +2152,21 @@ int __cdns3_gadget_ep_clear_halt(struct cdns3_endpoint *priv_ep)
4732 + {
4733 + struct cdns3_device *priv_dev = priv_ep->cdns3_dev;
4734 + struct usb_request *request;
4735 ++ struct cdns3_request *priv_req;
4736 ++ struct cdns3_trb *trb = NULL;
4737 + int ret;
4738 + int val;
4739 +
4740 + trace_cdns3_halt(priv_ep, 0, 0);
4741 +
4742 ++ request = cdns3_next_request(&priv_ep->pending_req_list);
4743 ++ if (request) {
4744 ++ priv_req = to_cdns3_request(request);
4745 ++ trb = priv_req->trb;
4746 ++ if (trb)
4747 ++ trb->control = trb->control ^ TRB_CYCLE;
4748 ++ }
4749 ++
4750 + writel(EP_CMD_CSTALL | EP_CMD_EPRST, &priv_dev->regs->ep_cmd);
4751 +
4752 + /* wait for EPRST cleared */
4753 +@@ -2167,10 +2177,11 @@ int __cdns3_gadget_ep_clear_halt(struct cdns3_endpoint *priv_ep)
4754 +
4755 + priv_ep->flags &= ~(EP_STALLED | EP_STALL_PENDING);
4756 +
4757 +- request = cdns3_next_request(&priv_ep->pending_req_list);
4758 +-
4759 +- if (request)
4760 ++ if (request) {
4761 ++ if (trb)
4762 ++ trb->control = trb->control ^ TRB_CYCLE;
4763 + cdns3_rearm_transfer(priv_ep, 1);
4764 ++ }
4765 +
4766 + cdns3_start_all_request(priv_dev, priv_ep);
4767 + return ret;
4768 +diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
4769 +index f381faa10f15..243577656177 100644
4770 +--- a/drivers/usb/core/hub.c
4771 ++++ b/drivers/usb/core/hub.c
4772 +@@ -987,13 +987,17 @@ int usb_remove_device(struct usb_device *udev)
4773 + {
4774 + struct usb_hub *hub;
4775 + struct usb_interface *intf;
4776 ++ int ret;
4777 +
4778 + if (!udev->parent) /* Can't remove a root hub */
4779 + return -EINVAL;
4780 + hub = usb_hub_to_struct_hub(udev->parent);
4781 + intf = to_usb_interface(hub->intfdev);
4782 +
4783 +- usb_autopm_get_interface(intf);
4784 ++ ret = usb_autopm_get_interface(intf);
4785 ++ if (ret < 0)
4786 ++ return ret;
4787 ++
4788 + set_bit(udev->portnum, hub->removed_bits);
4789 + hub_port_logical_disconnect(hub, udev->portnum);
4790 + usb_autopm_put_interface(intf);
4791 +@@ -1865,7 +1869,7 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id)
4792 +
4793 + if (id->driver_info & HUB_QUIRK_DISABLE_AUTOSUSPEND) {
4794 + hub->quirk_disable_autosuspend = 1;
4795 +- usb_autopm_get_interface(intf);
4796 ++ usb_autopm_get_interface_no_resume(intf);
4797 + }
4798 +
4799 + if (hub_configure(hub, &desc->endpoint[0].desc) >= 0)
4800 +diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c
4801 +index bbbb35fa639f..235a7c645503 100644
4802 +--- a/drivers/usb/core/port.c
4803 ++++ b/drivers/usb/core/port.c
4804 +@@ -213,7 +213,10 @@ static int usb_port_runtime_resume(struct device *dev)
4805 + if (!port_dev->is_superspeed && peer)
4806 + pm_runtime_get_sync(&peer->dev);
4807 +
4808 +- usb_autopm_get_interface(intf);
4809 ++ retval = usb_autopm_get_interface(intf);
4810 ++ if (retval < 0)
4811 ++ return retval;
4812 ++
4813 + retval = usb_hub_set_port_power(hdev, hub, port1, true);
4814 + msleep(hub_power_on_good_delay(hub));
4815 + if (udev && !retval) {
4816 +@@ -266,7 +269,10 @@ static int usb_port_runtime_suspend(struct device *dev)
4817 + if (usb_port_block_power_off)
4818 + return -EBUSY;
4819 +
4820 +- usb_autopm_get_interface(intf);
4821 ++ retval = usb_autopm_get_interface(intf);
4822 ++ if (retval < 0)
4823 ++ return retval;
4824 ++
4825 + retval = usb_hub_set_port_power(hdev, hub, port1, false);
4826 + usb_clear_port_feature(hdev, port1, USB_PORT_FEAT_C_CONNECTION);
4827 + if (!port_dev->is_superspeed)
4828 +diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
4829 +index 2b24336a72e5..2dac3e7cdd97 100644
4830 +--- a/drivers/usb/core/quirks.c
4831 ++++ b/drivers/usb/core/quirks.c
4832 +@@ -231,6 +231,9 @@ static const struct usb_device_id usb_quirk_list[] = {
4833 + /* Logitech PTZ Pro Camera */
4834 + { USB_DEVICE(0x046d, 0x0853), .driver_info = USB_QUIRK_DELAY_INIT },
4835 +
4836 ++ /* Logitech Screen Share */
4837 ++ { USB_DEVICE(0x046d, 0x086c), .driver_info = USB_QUIRK_NO_LPM },
4838 ++
4839 + /* Logitech Quickcam Fusion */
4840 + { USB_DEVICE(0x046d, 0x08c1), .driver_info = USB_QUIRK_RESET_RESUME },
4841 +
4842 +diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
4843 +index e0cb1c2d5675..6ac02ba5e4a1 100644
4844 +--- a/drivers/usb/dwc3/gadget.c
4845 ++++ b/drivers/usb/dwc3/gadget.c
4846 +@@ -1068,7 +1068,14 @@ static void dwc3_prepare_one_trb_sg(struct dwc3_ep *dep,
4847 + unsigned int rem = length % maxp;
4848 + unsigned chain = true;
4849 +
4850 +- if (sg_is_last(s))
4851 ++ /*
4852 ++ * IOMMU driver is coalescing the list of sgs which shares a
4853 ++ * page boundary into one and giving it to USB driver. With
4854 ++ * this the number of sgs mapped is not equal to the number of
4855 ++ * sgs passed. So mark the chain bit to false if it isthe last
4856 ++ * mapped sg.
4857 ++ */
4858 ++ if (i == remaining - 1)
4859 + chain = false;
4860 +
4861 + if (rem && usb_endpoint_dir_out(dep->endpoint.desc) && !chain) {
4862 +diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
4863 +index 0d45d7a4f949..d7871636fced 100644
4864 +--- a/drivers/usb/gadget/composite.c
4865 ++++ b/drivers/usb/gadget/composite.c
4866 +@@ -438,9 +438,13 @@ static u8 encode_bMaxPower(enum usb_device_speed speed,
4867 + if (!val)
4868 + return 0;
4869 + if (speed < USB_SPEED_SUPER)
4870 +- return DIV_ROUND_UP(val, 2);
4871 ++ return min(val, 500U) / 2;
4872 + else
4873 +- return DIV_ROUND_UP(val, 8);
4874 ++ /*
4875 ++ * USB 3.x supports up to 900mA, but since 900 isn't divisible
4876 ++ * by 8 the integral division will effectively cap to 896mA.
4877 ++ */
4878 ++ return min(val, 900U) / 8;
4879 + }
4880 +
4881 + static int config_buf(struct usb_configuration *config,
4882 +@@ -852,6 +856,10 @@ static int set_config(struct usb_composite_dev *cdev,
4883 +
4884 + /* when we return, be sure our power usage is valid */
4885 + power = c->MaxPower ? c->MaxPower : CONFIG_USB_GADGET_VBUS_DRAW;
4886 ++ if (gadget->speed < USB_SPEED_SUPER)
4887 ++ power = min(power, 500U);
4888 ++ else
4889 ++ power = min(power, 900U);
4890 + done:
4891 + usb_gadget_vbus_draw(gadget, power);
4892 + if (result >= 0 && cdev->delayed_status)
4893 +@@ -2278,7 +2286,7 @@ void composite_resume(struct usb_gadget *gadget)
4894 + {
4895 + struct usb_composite_dev *cdev = get_gadget_data(gadget);
4896 + struct usb_function *f;
4897 +- u16 maxpower;
4898 ++ unsigned maxpower;
4899 +
4900 + /* REVISIT: should we have config level
4901 + * suspend/resume callbacks?
4902 +@@ -2292,10 +2300,14 @@ void composite_resume(struct usb_gadget *gadget)
4903 + f->resume(f);
4904 + }
4905 +
4906 +- maxpower = cdev->config->MaxPower;
4907 ++ maxpower = cdev->config->MaxPower ?
4908 ++ cdev->config->MaxPower : CONFIG_USB_GADGET_VBUS_DRAW;
4909 ++ if (gadget->speed < USB_SPEED_SUPER)
4910 ++ maxpower = min(maxpower, 500U);
4911 ++ else
4912 ++ maxpower = min(maxpower, 900U);
4913 +
4914 +- usb_gadget_vbus_draw(gadget, maxpower ?
4915 +- maxpower : CONFIG_USB_GADGET_VBUS_DRAW);
4916 ++ usb_gadget_vbus_draw(gadget, maxpower);
4917 + }
4918 +
4919 + cdev->suspended = 0;
4920 +diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
4921 +index ced2581cf99f..a9a711e04614 100644
4922 +--- a/drivers/usb/gadget/function/f_fs.c
4923 ++++ b/drivers/usb/gadget/function/f_fs.c
4924 +@@ -1162,18 +1162,19 @@ static int ffs_aio_cancel(struct kiocb *kiocb)
4925 + {
4926 + struct ffs_io_data *io_data = kiocb->private;
4927 + struct ffs_epfile *epfile = kiocb->ki_filp->private_data;
4928 ++ unsigned long flags;
4929 + int value;
4930 +
4931 + ENTER();
4932 +
4933 +- spin_lock_irq(&epfile->ffs->eps_lock);
4934 ++ spin_lock_irqsave(&epfile->ffs->eps_lock, flags);
4935 +
4936 + if (likely(io_data && io_data->ep && io_data->req))
4937 + value = usb_ep_dequeue(io_data->ep, io_data->req);
4938 + else
4939 + value = -EINVAL;
4940 +
4941 +- spin_unlock_irq(&epfile->ffs->eps_lock);
4942 ++ spin_unlock_irqrestore(&epfile->ffs->eps_lock, flags);
4943 +
4944 + return value;
4945 + }
4946 +diff --git a/drivers/usb/gadget/function/u_serial.c b/drivers/usb/gadget/function/u_serial.c
4947 +index bb1e2e1d0076..038c445a4e9b 100644
4948 +--- a/drivers/usb/gadget/function/u_serial.c
4949 ++++ b/drivers/usb/gadget/function/u_serial.c
4950 +@@ -560,8 +560,10 @@ static int gs_start_io(struct gs_port *port)
4951 + port->n_read = 0;
4952 + started = gs_start_rx(port);
4953 +
4954 +- /* unblock any pending writes into our circular buffer */
4955 + if (started) {
4956 ++ gs_start_tx(port);
4957 ++ /* Unblock any pending writes into our circular buffer, in case
4958 ++ * we didn't in gs_start_tx() */
4959 + tty_wakeup(port->port.tty);
4960 + } else {
4961 + gs_free_requests(ep, head, &port->read_allocated);
4962 +diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
4963 +index 1cd9b6305b06..1880f3e13f57 100644
4964 +--- a/drivers/usb/storage/unusual_devs.h
4965 ++++ b/drivers/usb/storage/unusual_devs.h
4966 +@@ -1258,6 +1258,12 @@ UNUSUAL_DEV( 0x090a, 0x1200, 0x0000, 0x9999,
4967 + USB_SC_RBC, USB_PR_BULK, NULL,
4968 + 0 ),
4969 +
4970 ++UNUSUAL_DEV(0x090c, 0x1000, 0x1100, 0x1100,
4971 ++ "Samsung",
4972 ++ "Flash Drive FIT",
4973 ++ USB_SC_DEVICE, USB_PR_DEVICE, NULL,
4974 ++ US_FL_MAX_SECTORS_64),
4975 ++
4976 + /* aeb */
4977 + UNUSUAL_DEV( 0x090c, 0x1132, 0x0000, 0xffff,
4978 + "Feiya",
4979 +diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
4980 +index c6b3bdbbdbc9..bfaa9ec4bc1f 100644
4981 +--- a/drivers/video/console/vgacon.c
4982 ++++ b/drivers/video/console/vgacon.c
4983 +@@ -1316,6 +1316,9 @@ static int vgacon_font_get(struct vc_data *c, struct console_font *font)
4984 + static int vgacon_resize(struct vc_data *c, unsigned int width,
4985 + unsigned int height, unsigned int user)
4986 + {
4987 ++ if ((width << 1) * height > vga_vram_size)
4988 ++ return -EINVAL;
4989 ++
4990 + if (width % 2 || width > screen_info.orig_video_cols ||
4991 + height > (screen_info.orig_video_lines * vga_default_font_height)/
4992 + c->vc_font.height)
4993 +diff --git a/drivers/watchdog/da9062_wdt.c b/drivers/watchdog/da9062_wdt.c
4994 +index e149e66a6ea9..e92f38fcb7a4 100644
4995 +--- a/drivers/watchdog/da9062_wdt.c
4996 ++++ b/drivers/watchdog/da9062_wdt.c
4997 +@@ -94,13 +94,6 @@ static int da9062_wdt_stop(struct watchdog_device *wdd)
4998 + struct da9062_watchdog *wdt = watchdog_get_drvdata(wdd);
4999 + int ret;
5000 +
5001 +- ret = da9062_reset_watchdog_timer(wdt);
5002 +- if (ret) {
5003 +- dev_err(wdt->hw->dev, "Failed to ping the watchdog (err = %d)\n",
5004 +- ret);
5005 +- return ret;
5006 +- }
5007 +-
5008 + ret = regmap_update_bits(wdt->hw->regmap,
5009 + DA9062AA_CONTROL_D,
5010 + DA9062AA_TWDSCALE_MASK,
5011 +diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
5012 +index 50feb01f27f3..c056d12cbb3c 100644
5013 +--- a/fs/btrfs/inode.c
5014 ++++ b/fs/btrfs/inode.c
5015 +@@ -8426,6 +8426,7 @@ static inline blk_status_t btrfs_lookup_and_bind_dio_csum(struct inode *inode,
5016 + {
5017 + struct btrfs_io_bio *io_bio = btrfs_io_bio(bio);
5018 + struct btrfs_io_bio *orig_io_bio = btrfs_io_bio(dip->orig_bio);
5019 ++ u16 csum_size;
5020 + blk_status_t ret;
5021 +
5022 + /*
5023 +@@ -8445,7 +8446,8 @@ static inline blk_status_t btrfs_lookup_and_bind_dio_csum(struct inode *inode,
5024 +
5025 + file_offset -= dip->logical_offset;
5026 + file_offset >>= inode->i_sb->s_blocksize_bits;
5027 +- io_bio->csum = (u8 *)(((u32 *)orig_io_bio->csum) + file_offset);
5028 ++ csum_size = btrfs_super_csum_size(btrfs_sb(inode->i_sb)->super_copy);
5029 ++ io_bio->csum = orig_io_bio->csum + csum_size * file_offset;
5030 +
5031 + return 0;
5032 + }
5033 +diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
5034 +index 53611d7e9d28..f9cbdfc1591b 100644
5035 +--- a/fs/cifs/cifsglob.h
5036 ++++ b/fs/cifs/cifsglob.h
5037 +@@ -1229,6 +1229,7 @@ struct cifs_fid {
5038 + __u64 volatile_fid; /* volatile file id for smb2 */
5039 + __u8 lease_key[SMB2_LEASE_KEY_SIZE]; /* lease key for smb2 */
5040 + __u8 create_guid[16];
5041 ++ __u32 access;
5042 + struct cifs_pending_open *pending_open;
5043 + unsigned int epoch;
5044 + #ifdef CONFIG_CIFS_DEBUG2
5045 +@@ -1700,6 +1701,12 @@ static inline bool is_retryable_error(int error)
5046 + return false;
5047 + }
5048 +
5049 ++
5050 ++/* cifs_get_writable_file() flags */
5051 ++#define FIND_WR_ANY 0
5052 ++#define FIND_WR_FSUID_ONLY 1
5053 ++#define FIND_WR_WITH_DELETE 2
5054 ++
5055 + #define MID_FREE 0
5056 + #define MID_REQUEST_ALLOCATED 1
5057 + #define MID_REQUEST_SUBMITTED 2
5058 +diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
5059 +index fe597d3d5208..f18da99a6b55 100644
5060 +--- a/fs/cifs/cifsproto.h
5061 ++++ b/fs/cifs/cifsproto.h
5062 +@@ -133,11 +133,12 @@ extern bool backup_cred(struct cifs_sb_info *);
5063 + extern bool is_size_safe_to_change(struct cifsInodeInfo *, __u64 eof);
5064 + extern void cifs_update_eof(struct cifsInodeInfo *cifsi, loff_t offset,
5065 + unsigned int bytes_written);
5066 +-extern struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *, bool);
5067 ++extern struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *, int);
5068 + extern int cifs_get_writable_file(struct cifsInodeInfo *cifs_inode,
5069 +- bool fsuid_only,
5070 ++ int flags,
5071 + struct cifsFileInfo **ret_file);
5072 + extern int cifs_get_writable_path(struct cifs_tcon *tcon, const char *name,
5073 ++ int flags,
5074 + struct cifsFileInfo **ret_file);
5075 + extern struct cifsFileInfo *find_readable_file(struct cifsInodeInfo *, bool);
5076 + extern int cifs_get_readable_path(struct cifs_tcon *tcon, const char *name,
5077 +diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
5078 +index 4f554f019a98..c8494fa5e19d 100644
5079 +--- a/fs/cifs/cifssmb.c
5080 ++++ b/fs/cifs/cifssmb.c
5081 +@@ -1489,6 +1489,7 @@ openRetry:
5082 + *oplock = rsp->OplockLevel;
5083 + /* cifs fid stays in le */
5084 + oparms->fid->netfid = rsp->Fid;
5085 ++ oparms->fid->access = desired_access;
5086 +
5087 + /* Let caller know file was created so we can set the mode. */
5088 + /* Do we care about the CreateAction in any other cases? */
5089 +@@ -2112,7 +2113,7 @@ cifs_writev_requeue(struct cifs_writedata *wdata)
5090 + wdata2->tailsz = tailsz;
5091 + wdata2->bytes = cur_len;
5092 +
5093 +- rc = cifs_get_writable_file(CIFS_I(inode), false,
5094 ++ rc = cifs_get_writable_file(CIFS_I(inode), FIND_WR_ANY,
5095 + &wdata2->cfile);
5096 + if (!wdata2->cfile) {
5097 + cifs_dbg(VFS, "No writable handle to retry writepages rc=%d\n",
5098 +diff --git a/fs/cifs/file.c b/fs/cifs/file.c
5099 +index 969543034b4d..0dbe47e89720 100644
5100 +--- a/fs/cifs/file.c
5101 ++++ b/fs/cifs/file.c
5102 +@@ -1916,7 +1916,7 @@ struct cifsFileInfo *find_readable_file(struct cifsInodeInfo *cifs_inode,
5103 +
5104 + /* Return -EBADF if no handle is found and general rc otherwise */
5105 + int
5106 +-cifs_get_writable_file(struct cifsInodeInfo *cifs_inode, bool fsuid_only,
5107 ++cifs_get_writable_file(struct cifsInodeInfo *cifs_inode, int flags,
5108 + struct cifsFileInfo **ret_file)
5109 + {
5110 + struct cifsFileInfo *open_file, *inv_file = NULL;
5111 +@@ -1924,7 +1924,8 @@ cifs_get_writable_file(struct cifsInodeInfo *cifs_inode, bool fsuid_only,
5112 + bool any_available = false;
5113 + int rc = -EBADF;
5114 + unsigned int refind = 0;
5115 +-
5116 ++ bool fsuid_only = flags & FIND_WR_FSUID_ONLY;
5117 ++ bool with_delete = flags & FIND_WR_WITH_DELETE;
5118 + *ret_file = NULL;
5119 +
5120 + /*
5121 +@@ -1956,6 +1957,8 @@ refind_writable:
5122 + continue;
5123 + if (fsuid_only && !uid_eq(open_file->uid, current_fsuid()))
5124 + continue;
5125 ++ if (with_delete && !(open_file->fid.access & DELETE))
5126 ++ continue;
5127 + if (OPEN_FMODE(open_file->f_flags) & FMODE_WRITE) {
5128 + if (!open_file->invalidHandle) {
5129 + /* found a good writable file */
5130 +@@ -2003,12 +2006,12 @@ refind_writable:
5131 + }
5132 +
5133 + struct cifsFileInfo *
5134 +-find_writable_file(struct cifsInodeInfo *cifs_inode, bool fsuid_only)
5135 ++find_writable_file(struct cifsInodeInfo *cifs_inode, int flags)
5136 + {
5137 + struct cifsFileInfo *cfile;
5138 + int rc;
5139 +
5140 +- rc = cifs_get_writable_file(cifs_inode, fsuid_only, &cfile);
5141 ++ rc = cifs_get_writable_file(cifs_inode, flags, &cfile);
5142 + if (rc)
5143 + cifs_dbg(FYI, "couldn't find writable handle rc=%d", rc);
5144 +
5145 +@@ -2017,6 +2020,7 @@ find_writable_file(struct cifsInodeInfo *cifs_inode, bool fsuid_only)
5146 +
5147 + int
5148 + cifs_get_writable_path(struct cifs_tcon *tcon, const char *name,
5149 ++ int flags,
5150 + struct cifsFileInfo **ret_file)
5151 + {
5152 + struct list_head *tmp;
5153 +@@ -2043,7 +2047,7 @@ cifs_get_writable_path(struct cifs_tcon *tcon, const char *name,
5154 + kfree(full_path);
5155 + cinode = CIFS_I(d_inode(cfile->dentry));
5156 + spin_unlock(&tcon->open_file_lock);
5157 +- return cifs_get_writable_file(cinode, 0, ret_file);
5158 ++ return cifs_get_writable_file(cinode, flags, ret_file);
5159 + }
5160 +
5161 + spin_unlock(&tcon->open_file_lock);
5162 +@@ -2120,7 +2124,8 @@ static int cifs_partialpagewrite(struct page *page, unsigned from, unsigned to)
5163 + if (mapping->host->i_size - offset < (loff_t)to)
5164 + to = (unsigned)(mapping->host->i_size - offset);
5165 +
5166 +- rc = cifs_get_writable_file(CIFS_I(mapping->host), false, &open_file);
5167 ++ rc = cifs_get_writable_file(CIFS_I(mapping->host), FIND_WR_ANY,
5168 ++ &open_file);
5169 + if (!rc) {
5170 + bytes_written = cifs_write(open_file, open_file->pid,
5171 + write_data, to - from, &offset);
5172 +@@ -2313,7 +2318,7 @@ retry:
5173 + if (cfile)
5174 + cifsFileInfo_put(cfile);
5175 +
5176 +- rc = cifs_get_writable_file(CIFS_I(inode), false, &cfile);
5177 ++ rc = cifs_get_writable_file(CIFS_I(inode), FIND_WR_ANY, &cfile);
5178 +
5179 + /* in case of an error store it to return later */
5180 + if (rc)
5181 +diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
5182 +index aafcd79c4772..7c5e983fe385 100644
5183 +--- a/fs/cifs/inode.c
5184 ++++ b/fs/cifs/inode.c
5185 +@@ -2011,6 +2011,7 @@ int cifs_revalidate_dentry_attr(struct dentry *dentry)
5186 + struct inode *inode = d_inode(dentry);
5187 + struct super_block *sb = dentry->d_sb;
5188 + char *full_path = NULL;
5189 ++ int count = 0;
5190 +
5191 + if (inode == NULL)
5192 + return -ENOENT;
5193 +@@ -2032,15 +2033,18 @@ int cifs_revalidate_dentry_attr(struct dentry *dentry)
5194 + full_path, inode, inode->i_count.counter,
5195 + dentry, cifs_get_time(dentry), jiffies);
5196 +
5197 ++again:
5198 + if (cifs_sb_master_tcon(CIFS_SB(sb))->unix_ext)
5199 + rc = cifs_get_inode_info_unix(&inode, full_path, sb, xid);
5200 + else
5201 + rc = cifs_get_inode_info(&inode, full_path, NULL, sb,
5202 + xid, NULL);
5203 +-
5204 ++ if (rc == -EAGAIN && count++ < 10)
5205 ++ goto again;
5206 + out:
5207 + kfree(full_path);
5208 + free_xid(xid);
5209 ++
5210 + return rc;
5211 + }
5212 +
5213 +@@ -2216,7 +2220,7 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs,
5214 + * writebehind data than the SMB timeout for the SetPathInfo
5215 + * request would allow
5216 + */
5217 +- open_file = find_writable_file(cifsInode, true);
5218 ++ open_file = find_writable_file(cifsInode, FIND_WR_FSUID_ONLY);
5219 + if (open_file) {
5220 + tcon = tlink_tcon(open_file->tlink);
5221 + server = tcon->ses->server;
5222 +@@ -2366,7 +2370,7 @@ cifs_setattr_unix(struct dentry *direntry, struct iattr *attrs)
5223 + args->ctime = NO_CHANGE_64;
5224 +
5225 + args->device = 0;
5226 +- open_file = find_writable_file(cifsInode, true);
5227 ++ open_file = find_writable_file(cifsInode, FIND_WR_FSUID_ONLY);
5228 + if (open_file) {
5229 + u16 nfid = open_file->fid.netfid;
5230 + u32 npid = open_file->pid;
5231 +@@ -2469,7 +2473,7 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs)
5232 + rc = 0;
5233 +
5234 + if (attrs->ia_valid & ATTR_MTIME) {
5235 +- rc = cifs_get_writable_file(cifsInode, false, &wfile);
5236 ++ rc = cifs_get_writable_file(cifsInode, FIND_WR_ANY, &wfile);
5237 + if (!rc) {
5238 + tcon = tlink_tcon(wfile->tlink);
5239 + rc = tcon->ses->server->ops->flush(xid, tcon, &wfile->fid);
5240 +diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c
5241 +index 514810694c0f..195766221a7a 100644
5242 +--- a/fs/cifs/smb1ops.c
5243 ++++ b/fs/cifs/smb1ops.c
5244 +@@ -767,7 +767,7 @@ smb_set_file_info(struct inode *inode, const char *full_path,
5245 + struct cifs_tcon *tcon;
5246 +
5247 + /* if the file is already open for write, just use that fileid */
5248 +- open_file = find_writable_file(cinode, true);
5249 ++ open_file = find_writable_file(cinode, FIND_WR_FSUID_ONLY);
5250 + if (open_file) {
5251 + fid.netfid = open_file->fid.netfid;
5252 + netpid = open_file->pid;
5253 +diff --git a/fs/cifs/smb2inode.c b/fs/cifs/smb2inode.c
5254 +index 4121ac1163ca..f2a6f7f28340 100644
5255 +--- a/fs/cifs/smb2inode.c
5256 ++++ b/fs/cifs/smb2inode.c
5257 +@@ -525,7 +525,7 @@ smb2_mkdir_setinfo(struct inode *inode, const char *name,
5258 + cifs_i = CIFS_I(inode);
5259 + dosattrs = cifs_i->cifsAttrs | ATTR_READONLY;
5260 + data.Attributes = cpu_to_le32(dosattrs);
5261 +- cifs_get_writable_path(tcon, name, &cfile);
5262 ++ cifs_get_writable_path(tcon, name, FIND_WR_ANY, &cfile);
5263 + tmprc = smb2_compound_op(xid, tcon, cifs_sb, name,
5264 + FILE_WRITE_ATTRIBUTES, FILE_CREATE,
5265 + CREATE_NOT_FILE, ACL_NO_MODE,
5266 +@@ -581,7 +581,7 @@ smb2_rename_path(const unsigned int xid, struct cifs_tcon *tcon,
5267 + {
5268 + struct cifsFileInfo *cfile;
5269 +
5270 +- cifs_get_writable_path(tcon, from_name, &cfile);
5271 ++ cifs_get_writable_path(tcon, from_name, FIND_WR_WITH_DELETE, &cfile);
5272 +
5273 + return smb2_set_path_attr(xid, tcon, from_name, to_name,
5274 + cifs_sb, DELETE, SMB2_OP_RENAME, cfile);
5275 +diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
5276 +index b75d208d4b2b..99420608d2ec 100644
5277 +--- a/fs/cifs/smb2ops.c
5278 ++++ b/fs/cifs/smb2ops.c
5279 +@@ -1338,6 +1338,7 @@ smb2_set_fid(struct cifsFileInfo *cfile, struct cifs_fid *fid, __u32 oplock)
5280 +
5281 + cfile->fid.persistent_fid = fid->persistent_fid;
5282 + cfile->fid.volatile_fid = fid->volatile_fid;
5283 ++ cfile->fid.access = fid->access;
5284 + #ifdef CONFIG_CIFS_DEBUG2
5285 + cfile->fid.mid = fid->mid;
5286 + #endif /* CIFS_DEBUG2 */
5287 +@@ -3162,7 +3163,7 @@ static loff_t smb3_llseek(struct file *file, struct cifs_tcon *tcon, loff_t offs
5288 + * some servers (Windows2016) will not reflect recent writes in
5289 + * QUERY_ALLOCATED_RANGES until SMB2_flush is called.
5290 + */
5291 +- wrcfile = find_writable_file(cifsi, false);
5292 ++ wrcfile = find_writable_file(cifsi, FIND_WR_ANY);
5293 + if (wrcfile) {
5294 + filemap_write_and_wait(inode->i_mapping);
5295 + smb2_flush_file(xid, tcon, &wrcfile->fid);
5296 +diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
5297 +index c6fc6582ee7b..c8f304cae3f3 100644
5298 +--- a/fs/cifs/smb2pdu.c
5299 ++++ b/fs/cifs/smb2pdu.c
5300 +@@ -2650,6 +2650,7 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,
5301 + atomic_inc(&tcon->num_remote_opens);
5302 + oparms->fid->persistent_fid = rsp->PersistentFileId;
5303 + oparms->fid->volatile_fid = rsp->VolatileFileId;
5304 ++ oparms->fid->access = oparms->desired_access;
5305 + #ifdef CONFIG_CIFS_DEBUG2
5306 + oparms->fid->mid = le64_to_cpu(rsp->sync_hdr.MessageId);
5307 + #endif /* CIFS_DEBUG2 */
5308 +diff --git a/fs/fat/inode.c b/fs/fat/inode.c
5309 +index 5f04c5c810fb..d40cbad16659 100644
5310 +--- a/fs/fat/inode.c
5311 ++++ b/fs/fat/inode.c
5312 +@@ -749,6 +749,13 @@ static struct inode *fat_alloc_inode(struct super_block *sb)
5313 + return NULL;
5314 +
5315 + init_rwsem(&ei->truncate_lock);
5316 ++ /* Zeroing to allow iput() even if partial initialized inode. */
5317 ++ ei->mmu_private = 0;
5318 ++ ei->i_start = 0;
5319 ++ ei->i_logstart = 0;
5320 ++ ei->i_attrs = 0;
5321 ++ ei->i_pos = 0;
5322 ++
5323 + return &ei->vfs_inode;
5324 + }
5325 +
5326 +@@ -1373,16 +1380,6 @@ out:
5327 + return 0;
5328 + }
5329 +
5330 +-static void fat_dummy_inode_init(struct inode *inode)
5331 +-{
5332 +- /* Initialize this dummy inode to work as no-op. */
5333 +- MSDOS_I(inode)->mmu_private = 0;
5334 +- MSDOS_I(inode)->i_start = 0;
5335 +- MSDOS_I(inode)->i_logstart = 0;
5336 +- MSDOS_I(inode)->i_attrs = 0;
5337 +- MSDOS_I(inode)->i_pos = 0;
5338 +-}
5339 +-
5340 + static int fat_read_root(struct inode *inode)
5341 + {
5342 + struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb);
5343 +@@ -1843,13 +1840,11 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, int isvfat,
5344 + fat_inode = new_inode(sb);
5345 + if (!fat_inode)
5346 + goto out_fail;
5347 +- fat_dummy_inode_init(fat_inode);
5348 + sbi->fat_inode = fat_inode;
5349 +
5350 + fsinfo_inode = new_inode(sb);
5351 + if (!fsinfo_inode)
5352 + goto out_fail;
5353 +- fat_dummy_inode_init(fsinfo_inode);
5354 + fsinfo_inode->i_ino = MSDOS_FSINFO_INO;
5355 + sbi->fsinfo_inode = fsinfo_inode;
5356 + insert_inode_hash(fsinfo_inode);
5357 +diff --git a/include/linux/mm.h b/include/linux/mm.h
5358 +index b249d2e033aa..afa77b683a04 100644
5359 +--- a/include/linux/mm.h
5360 ++++ b/include/linux/mm.h
5361 +@@ -2695,6 +2695,10 @@ static inline bool debug_pagealloc_enabled_static(void)
5362 + #if defined(CONFIG_DEBUG_PAGEALLOC) || defined(CONFIG_ARCH_HAS_SET_DIRECT_MAP)
5363 + extern void __kernel_map_pages(struct page *page, int numpages, int enable);
5364 +
5365 ++/*
5366 ++ * When called in DEBUG_PAGEALLOC context, the call should most likely be
5367 ++ * guarded by debug_pagealloc_enabled() or debug_pagealloc_enabled_static()
5368 ++ */
5369 + static inline void
5370 + kernel_map_pages(struct page *page, int numpages, int enable)
5371 + {
5372 +diff --git a/kernel/kprobes.c b/kernel/kprobes.c
5373 +index 34e28b236d68..2625c241ac00 100644
5374 +--- a/kernel/kprobes.c
5375 ++++ b/kernel/kprobes.c
5376 +@@ -612,6 +612,18 @@ void wait_for_kprobe_optimizer(void)
5377 + mutex_unlock(&kprobe_mutex);
5378 + }
5379 +
5380 ++static bool optprobe_queued_unopt(struct optimized_kprobe *op)
5381 ++{
5382 ++ struct optimized_kprobe *_op;
5383 ++
5384 ++ list_for_each_entry(_op, &unoptimizing_list, list) {
5385 ++ if (op == _op)
5386 ++ return true;
5387 ++ }
5388 ++
5389 ++ return false;
5390 ++}
5391 ++
5392 + /* Optimize kprobe if p is ready to be optimized */
5393 + static void optimize_kprobe(struct kprobe *p)
5394 + {
5395 +@@ -633,17 +645,21 @@ static void optimize_kprobe(struct kprobe *p)
5396 + return;
5397 +
5398 + /* Check if it is already optimized. */
5399 +- if (op->kp.flags & KPROBE_FLAG_OPTIMIZED)
5400 ++ if (op->kp.flags & KPROBE_FLAG_OPTIMIZED) {
5401 ++ if (optprobe_queued_unopt(op)) {
5402 ++ /* This is under unoptimizing. Just dequeue the probe */
5403 ++ list_del_init(&op->list);
5404 ++ }
5405 + return;
5406 ++ }
5407 + op->kp.flags |= KPROBE_FLAG_OPTIMIZED;
5408 +
5409 +- if (!list_empty(&op->list))
5410 +- /* This is under unoptimizing. Just dequeue the probe */
5411 +- list_del_init(&op->list);
5412 +- else {
5413 +- list_add(&op->list, &optimizing_list);
5414 +- kick_kprobe_optimizer();
5415 +- }
5416 ++ /* On unoptimizing/optimizing_list, op must have OPTIMIZED flag */
5417 ++ if (WARN_ON_ONCE(!list_empty(&op->list)))
5418 ++ return;
5419 ++
5420 ++ list_add(&op->list, &optimizing_list);
5421 ++ kick_kprobe_optimizer();
5422 + }
5423 +
5424 + /* Short cut to direct unoptimizing */
5425 +@@ -665,30 +681,33 @@ static void unoptimize_kprobe(struct kprobe *p, bool force)
5426 + return; /* This is not an optprobe nor optimized */
5427 +
5428 + op = container_of(p, struct optimized_kprobe, kp);
5429 +- if (!kprobe_optimized(p)) {
5430 +- /* Unoptimized or unoptimizing case */
5431 +- if (force && !list_empty(&op->list)) {
5432 +- /*
5433 +- * Only if this is unoptimizing kprobe and forced,
5434 +- * forcibly unoptimize it. (No need to unoptimize
5435 +- * unoptimized kprobe again :)
5436 +- */
5437 +- list_del_init(&op->list);
5438 +- force_unoptimize_kprobe(op);
5439 +- }
5440 ++ if (!kprobe_optimized(p))
5441 + return;
5442 +- }
5443 +
5444 + if (!list_empty(&op->list)) {
5445 +- /* Dequeue from the optimization queue */
5446 +- list_del_init(&op->list);
5447 ++ if (optprobe_queued_unopt(op)) {
5448 ++ /* Queued in unoptimizing queue */
5449 ++ if (force) {
5450 ++ /*
5451 ++ * Forcibly unoptimize the kprobe here, and queue it
5452 ++ * in the freeing list for release afterwards.
5453 ++ */
5454 ++ force_unoptimize_kprobe(op);
5455 ++ list_move(&op->list, &freeing_list);
5456 ++ }
5457 ++ } else {
5458 ++ /* Dequeue from the optimizing queue */
5459 ++ list_del_init(&op->list);
5460 ++ op->kp.flags &= ~KPROBE_FLAG_OPTIMIZED;
5461 ++ }
5462 + return;
5463 + }
5464 ++
5465 + /* Optimized kprobe case */
5466 +- if (force)
5467 ++ if (force) {
5468 + /* Forcibly update the code: this is a special case */
5469 + force_unoptimize_kprobe(op);
5470 +- else {
5471 ++ } else {
5472 + list_add(&op->list, &unoptimizing_list);
5473 + kick_kprobe_optimizer();
5474 + }
5475 +diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
5476 +index 4b2ad374167b..e7e483cdbea6 100644
5477 +--- a/kernel/trace/blktrace.c
5478 ++++ b/kernel/trace/blktrace.c
5479 +@@ -1888,8 +1888,11 @@ static ssize_t sysfs_blk_trace_attr_store(struct device *dev,
5480 + }
5481 +
5482 + ret = 0;
5483 +- if (bt == NULL)
5484 ++ if (bt == NULL) {
5485 + ret = blk_trace_setup_queue(q, bdev);
5486 ++ bt = rcu_dereference_protected(q->blk_trace,
5487 ++ lockdep_is_held(&q->blk_trace_mutex));
5488 ++ }
5489 +
5490 + if (ret == 0) {
5491 + if (attr == &dev_attr_act_mask)
5492 +diff --git a/mm/huge_memory.c b/mm/huge_memory.c
5493 +index 6c9689281c07..0d96831b6ded 100644
5494 +--- a/mm/huge_memory.c
5495 ++++ b/mm/huge_memory.c
5496 +@@ -3032,8 +3032,7 @@ void set_pmd_migration_entry(struct page_vma_mapped_walk *pvmw,
5497 + return;
5498 +
5499 + flush_cache_range(vma, address, address + HPAGE_PMD_SIZE);
5500 +- pmdval = *pvmw->pmd;
5501 +- pmdp_invalidate(vma, address, pvmw->pmd);
5502 ++ pmdval = pmdp_invalidate(vma, address, pvmw->pmd);
5503 + if (pmd_dirty(pmdval))
5504 + set_page_dirty(page);
5505 + entry = make_migration_entry(page, pmd_write(pmdval));
5506 +diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
5507 +index 0aa154be3a52..c054945a9a74 100644
5508 +--- a/mm/memory_hotplug.c
5509 ++++ b/mm/memory_hotplug.c
5510 +@@ -598,7 +598,13 @@ EXPORT_SYMBOL_GPL(__online_page_free);
5511 +
5512 + static void generic_online_page(struct page *page, unsigned int order)
5513 + {
5514 +- kernel_map_pages(page, 1 << order, 1);
5515 ++ /*
5516 ++ * Freeing the page with debug_pagealloc enabled will try to unmap it,
5517 ++ * so we should map it first. This is better than introducing a special
5518 ++ * case in page freeing fast path.
5519 ++ */
5520 ++ if (debug_pagealloc_enabled_static())
5521 ++ kernel_map_pages(page, 1 << order, 1);
5522 + __free_pages_core(page, order);
5523 + totalram_pages_add(1UL << order);
5524 + #ifdef CONFIG_HIGHMEM
5525 +diff --git a/mm/mprotect.c b/mm/mprotect.c
5526 +index 7967825f6d33..95dee88f782b 100644
5527 +--- a/mm/mprotect.c
5528 ++++ b/mm/mprotect.c
5529 +@@ -161,6 +161,31 @@ static unsigned long change_pte_range(struct vm_area_struct *vma, pmd_t *pmd,
5530 + return pages;
5531 + }
5532 +
5533 ++/*
5534 ++ * Used when setting automatic NUMA hinting protection where it is
5535 ++ * critical that a numa hinting PMD is not confused with a bad PMD.
5536 ++ */
5537 ++static inline int pmd_none_or_clear_bad_unless_trans_huge(pmd_t *pmd)
5538 ++{
5539 ++ pmd_t pmdval = pmd_read_atomic(pmd);
5540 ++
5541 ++ /* See pmd_none_or_trans_huge_or_clear_bad for info on barrier */
5542 ++#ifdef CONFIG_TRANSPARENT_HUGEPAGE
5543 ++ barrier();
5544 ++#endif
5545 ++
5546 ++ if (pmd_none(pmdval))
5547 ++ return 1;
5548 ++ if (pmd_trans_huge(pmdval))
5549 ++ return 0;
5550 ++ if (unlikely(pmd_bad(pmdval))) {
5551 ++ pmd_clear_bad(pmd);
5552 ++ return 1;
5553 ++ }
5554 ++
5555 ++ return 0;
5556 ++}
5557 ++
5558 + static inline unsigned long change_pmd_range(struct vm_area_struct *vma,
5559 + pud_t *pud, unsigned long addr, unsigned long end,
5560 + pgprot_t newprot, int dirty_accountable, int prot_numa)
5561 +@@ -178,8 +203,17 @@ static inline unsigned long change_pmd_range(struct vm_area_struct *vma,
5562 + unsigned long this_pages;
5563 +
5564 + next = pmd_addr_end(addr, end);
5565 +- if (!is_swap_pmd(*pmd) && !pmd_trans_huge(*pmd) && !pmd_devmap(*pmd)
5566 +- && pmd_none_or_clear_bad(pmd))
5567 ++
5568 ++ /*
5569 ++ * Automatic NUMA balancing walks the tables with mmap_sem
5570 ++ * held for read. It's possible a parallel update to occur
5571 ++ * between pmd_trans_huge() and a pmd_none_or_clear_bad()
5572 ++ * check leading to a false positive and clearing.
5573 ++ * Hence, it's necessary to atomically read the PMD value
5574 ++ * for all the checks.
5575 ++ */
5576 ++ if (!is_swap_pmd(*pmd) && !pmd_devmap(*pmd) &&
5577 ++ pmd_none_or_clear_bad_unless_trans_huge(pmd))
5578 + goto next;
5579 +
5580 + /* invoke the mmu notifier if the pmd is populated */
5581 +diff --git a/security/integrity/platform_certs/load_uefi.c b/security/integrity/platform_certs/load_uefi.c
5582 +index 81b19c52832b..020fc7a11ef0 100644
5583 +--- a/security/integrity/platform_certs/load_uefi.c
5584 ++++ b/security/integrity/platform_certs/load_uefi.c
5585 +@@ -39,16 +39,18 @@ static __init bool uefi_check_ignore_db(void)
5586 + * Get a certificate list blob from the named EFI variable.
5587 + */
5588 + static __init void *get_cert_list(efi_char16_t *name, efi_guid_t *guid,
5589 +- unsigned long *size)
5590 ++ unsigned long *size, efi_status_t *status)
5591 + {
5592 +- efi_status_t status;
5593 + unsigned long lsize = 4;
5594 + unsigned long tmpdb[4];
5595 + void *db;
5596 +
5597 +- status = efi.get_variable(name, guid, NULL, &lsize, &tmpdb);
5598 +- if (status != EFI_BUFFER_TOO_SMALL) {
5599 +- pr_err("Couldn't get size: 0x%lx\n", status);
5600 ++ *status = efi.get_variable(name, guid, NULL, &lsize, &tmpdb);
5601 ++ if (*status == EFI_NOT_FOUND)
5602 ++ return NULL;
5603 ++
5604 ++ if (*status != EFI_BUFFER_TOO_SMALL) {
5605 ++ pr_err("Couldn't get size: 0x%lx\n", *status);
5606 + return NULL;
5607 + }
5608 +
5609 +@@ -56,10 +58,10 @@ static __init void *get_cert_list(efi_char16_t *name, efi_guid_t *guid,
5610 + if (!db)
5611 + return NULL;
5612 +
5613 +- status = efi.get_variable(name, guid, NULL, &lsize, db);
5614 +- if (status != EFI_SUCCESS) {
5615 ++ *status = efi.get_variable(name, guid, NULL, &lsize, db);
5616 ++ if (*status != EFI_SUCCESS) {
5617 + kfree(db);
5618 +- pr_err("Error reading db var: 0x%lx\n", status);
5619 ++ pr_err("Error reading db var: 0x%lx\n", *status);
5620 + return NULL;
5621 + }
5622 +
5623 +@@ -144,6 +146,7 @@ static int __init load_uefi_certs(void)
5624 + efi_guid_t mok_var = EFI_SHIM_LOCK_GUID;
5625 + void *db = NULL, *dbx = NULL, *mok = NULL;
5626 + unsigned long dbsize = 0, dbxsize = 0, moksize = 0;
5627 ++ efi_status_t status;
5628 + int rc = 0;
5629 +
5630 + if (!efi.get_variable)
5631 +@@ -153,9 +156,12 @@ static int __init load_uefi_certs(void)
5632 + * an error if we can't get them.
5633 + */
5634 + if (!uefi_check_ignore_db()) {
5635 +- db = get_cert_list(L"db", &secure_var, &dbsize);
5636 ++ db = get_cert_list(L"db", &secure_var, &dbsize, &status);
5637 + if (!db) {
5638 +- pr_err("MODSIGN: Couldn't get UEFI db list\n");
5639 ++ if (status == EFI_NOT_FOUND)
5640 ++ pr_debug("MODSIGN: db variable wasn't found\n");
5641 ++ else
5642 ++ pr_err("MODSIGN: Couldn't get UEFI db list\n");
5643 + } else {
5644 + rc = parse_efi_signature_list("UEFI:db",
5645 + db, dbsize, get_handler_for_db);
5646 +@@ -166,9 +172,12 @@ static int __init load_uefi_certs(void)
5647 + }
5648 + }
5649 +
5650 +- mok = get_cert_list(L"MokListRT", &mok_var, &moksize);
5651 ++ mok = get_cert_list(L"MokListRT", &mok_var, &moksize, &status);
5652 + if (!mok) {
5653 +- pr_info("Couldn't get UEFI MokListRT\n");
5654 ++ if (status == EFI_NOT_FOUND)
5655 ++ pr_debug("MokListRT variable wasn't found\n");
5656 ++ else
5657 ++ pr_info("Couldn't get UEFI MokListRT\n");
5658 + } else {
5659 + rc = parse_efi_signature_list("UEFI:MokListRT",
5660 + mok, moksize, get_handler_for_db);
5661 +@@ -177,9 +186,12 @@ static int __init load_uefi_certs(void)
5662 + kfree(mok);
5663 + }
5664 +
5665 +- dbx = get_cert_list(L"dbx", &secure_var, &dbxsize);
5666 ++ dbx = get_cert_list(L"dbx", &secure_var, &dbxsize, &status);
5667 + if (!dbx) {
5668 +- pr_info("Couldn't get UEFI dbx list\n");
5669 ++ if (status == EFI_NOT_FOUND)
5670 ++ pr_debug("dbx variable wasn't found\n");
5671 ++ else
5672 ++ pr_info("Couldn't get UEFI dbx list\n");
5673 + } else {
5674 + rc = parse_efi_signature_list("UEFI:dbx",
5675 + dbx, dbxsize,
5676 +diff --git a/sound/hda/ext/hdac_ext_controller.c b/sound/hda/ext/hdac_ext_controller.c
5677 +index cfab60d88c92..09ff209df4a3 100644
5678 +--- a/sound/hda/ext/hdac_ext_controller.c
5679 ++++ b/sound/hda/ext/hdac_ext_controller.c
5680 +@@ -254,6 +254,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_link_power_down_all);
5681 + int snd_hdac_ext_bus_link_get(struct hdac_bus *bus,
5682 + struct hdac_ext_link *link)
5683 + {
5684 ++ unsigned long codec_mask;
5685 + int ret = 0;
5686 +
5687 + mutex_lock(&bus->lock);
5688 +@@ -280,9 +281,11 @@ int snd_hdac_ext_bus_link_get(struct hdac_bus *bus,
5689 + * HDA spec section 4.3 - Codec Discovery
5690 + */
5691 + udelay(521);
5692 +- bus->codec_mask = snd_hdac_chip_readw(bus, STATESTS);
5693 +- dev_dbg(bus->dev, "codec_mask = 0x%lx\n", bus->codec_mask);
5694 +- snd_hdac_chip_writew(bus, STATESTS, bus->codec_mask);
5695 ++ codec_mask = snd_hdac_chip_readw(bus, STATESTS);
5696 ++ dev_dbg(bus->dev, "codec_mask = 0x%lx\n", codec_mask);
5697 ++ snd_hdac_chip_writew(bus, STATESTS, codec_mask);
5698 ++ if (!bus->codec_mask)
5699 ++ bus->codec_mask = codec_mask;
5700 + }
5701 +
5702 + mutex_unlock(&bus->lock);
5703 +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
5704 +index 4f78b40831d8..b6b837a5bdaf 100644
5705 +--- a/sound/pci/hda/patch_realtek.c
5706 ++++ b/sound/pci/hda/patch_realtek.c
5707 +@@ -2447,6 +2447,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
5708 + SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
5709 + SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
5710 + SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
5711 ++ SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_CLEVO_P950),
5712 + SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
5713 + SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
5714 + SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
5715 +@@ -5920,7 +5921,8 @@ enum {
5716 + ALC289_FIXUP_DUAL_SPK,
5717 + ALC294_FIXUP_SPK2_TO_DAC1,
5718 + ALC294_FIXUP_ASUS_DUAL_SPK,
5719 +-
5720 ++ ALC285_FIXUP_THINKPAD_HEADSET_JACK,
5721 ++ ALC294_FIXUP_ASUS_HPE,
5722 + };
5723 +
5724 + static const struct hda_fixup alc269_fixups[] = {
5725 +@@ -6684,6 +6686,8 @@ static const struct hda_fixup alc269_fixups[] = {
5726 + [ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
5727 + .type = HDA_FIXUP_FUNC,
5728 + .v.func = alc285_fixup_speaker2_to_dac1,
5729 ++ .chained = true,
5730 ++ .chain_id = ALC269_FIXUP_THINKPAD_ACPI
5731 + },
5732 + [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
5733 + .type = HDA_FIXUP_PINS,
5734 +@@ -7040,7 +7044,23 @@ static const struct hda_fixup alc269_fixups[] = {
5735 + .chained = true,
5736 + .chain_id = ALC294_FIXUP_SPK2_TO_DAC1
5737 + },
5738 +-
5739 ++ [ALC285_FIXUP_THINKPAD_HEADSET_JACK] = {
5740 ++ .type = HDA_FIXUP_FUNC,
5741 ++ .v.func = alc_fixup_headset_jack,
5742 ++ .chained = true,
5743 ++ .chain_id = ALC285_FIXUP_SPEAKER2_TO_DAC1
5744 ++ },
5745 ++ [ALC294_FIXUP_ASUS_HPE] = {
5746 ++ .type = HDA_FIXUP_VERBS,
5747 ++ .v.verbs = (const struct hda_verb[]) {
5748 ++ /* Set EAPD high */
5749 ++ { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
5750 ++ { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
5751 ++ { }
5752 ++ },
5753 ++ .chained = true,
5754 ++ .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
5755 ++ },
5756 + };
5757 +
5758 + static const struct snd_pci_quirk alc269_fixup_tbl[] = {
5759 +@@ -7115,6 +7135,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
5760 + SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
5761 + SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
5762 + SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
5763 ++ SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
5764 ++ SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
5765 + SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
5766 + SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
5767 + SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
5768 +@@ -7204,6 +7226,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
5769 + SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
5770 + SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
5771 + SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
5772 ++ SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
5773 + SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
5774 + SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
5775 + SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
5776 +@@ -7274,8 +7297,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
5777 + SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
5778 + SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
5779 + SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
5780 +- SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Yoga 7th", ALC285_FIXUP_SPEAKER2_TO_DAC1),
5781 +- SND_PCI_QUIRK(0x17aa, 0x2293, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_SPEAKER2_TO_DAC1),
5782 ++ SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Yoga 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
5783 ++ SND_PCI_QUIRK(0x17aa, 0x2293, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
5784 + SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
5785 + SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
5786 + SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
5787 +diff --git a/sound/soc/codecs/pcm512x.c b/sound/soc/codecs/pcm512x.c
5788 +index 861210f6bf4f..4cbef9affffd 100644
5789 +--- a/sound/soc/codecs/pcm512x.c
5790 ++++ b/sound/soc/codecs/pcm512x.c
5791 +@@ -1564,13 +1564,15 @@ int pcm512x_probe(struct device *dev, struct regmap *regmap)
5792 + }
5793 +
5794 + pcm512x->sclk = devm_clk_get(dev, NULL);
5795 +- if (PTR_ERR(pcm512x->sclk) == -EPROBE_DEFER)
5796 +- return -EPROBE_DEFER;
5797 ++ if (PTR_ERR(pcm512x->sclk) == -EPROBE_DEFER) {
5798 ++ ret = -EPROBE_DEFER;
5799 ++ goto err;
5800 ++ }
5801 + if (!IS_ERR(pcm512x->sclk)) {
5802 + ret = clk_prepare_enable(pcm512x->sclk);
5803 + if (ret != 0) {
5804 + dev_err(dev, "Failed to enable SCLK: %d\n", ret);
5805 +- return ret;
5806 ++ goto err;
5807 + }
5808 + }
5809 +
5810 +diff --git a/sound/soc/intel/skylake/skl-debug.c b/sound/soc/intel/skylake/skl-debug.c
5811 +index 3466675f2678..a15aa2ffa681 100644
5812 +--- a/sound/soc/intel/skylake/skl-debug.c
5813 ++++ b/sound/soc/intel/skylake/skl-debug.c
5814 +@@ -34,8 +34,8 @@ static ssize_t skl_print_pins(struct skl_module_pin *m_pin, char *buf,
5815 + int i;
5816 + ssize_t ret = 0;
5817 +
5818 +- for (i = 0; i < max_pin; i++)
5819 +- ret += snprintf(buf + size, MOD_BUF - size,
5820 ++ for (i = 0; i < max_pin; i++) {
5821 ++ ret += scnprintf(buf + size, MOD_BUF - size,
5822 + "%s %d\n\tModule %d\n\tInstance %d\n\t"
5823 + "In-used %s\n\tType %s\n"
5824 + "\tState %d\n\tIndex %d\n",
5825 +@@ -45,13 +45,15 @@ static ssize_t skl_print_pins(struct skl_module_pin *m_pin, char *buf,
5826 + m_pin[i].in_use ? "Used" : "Unused",
5827 + m_pin[i].is_dynamic ? "Dynamic" : "Static",
5828 + m_pin[i].pin_state, i);
5829 ++ size += ret;
5830 ++ }
5831 + return ret;
5832 + }
5833 +
5834 + static ssize_t skl_print_fmt(struct skl_module_fmt *fmt, char *buf,
5835 + ssize_t size, bool direction)
5836 + {
5837 +- return snprintf(buf + size, MOD_BUF - size,
5838 ++ return scnprintf(buf + size, MOD_BUF - size,
5839 + "%s\n\tCh %d\n\tFreq %d\n\tBit depth %d\n\t"
5840 + "Valid bit depth %d\n\tCh config %#x\n\tInterleaving %d\n\t"
5841 + "Sample Type %d\n\tCh Map %#x\n",
5842 +@@ -75,16 +77,16 @@ static ssize_t module_read(struct file *file, char __user *user_buf,
5843 + if (!buf)
5844 + return -ENOMEM;
5845 +
5846 +- ret = snprintf(buf, MOD_BUF, "Module:\n\tUUID %pUL\n\tModule id %d\n"
5847 ++ ret = scnprintf(buf, MOD_BUF, "Module:\n\tUUID %pUL\n\tModule id %d\n"
5848 + "\tInstance id %d\n\tPvt_id %d\n", mconfig->guid,
5849 + mconfig->id.module_id, mconfig->id.instance_id,
5850 + mconfig->id.pvt_id);
5851 +
5852 +- ret += snprintf(buf + ret, MOD_BUF - ret,
5853 ++ ret += scnprintf(buf + ret, MOD_BUF - ret,
5854 + "Resources:\n\tCPC %#x\n\tIBS %#x\n\tOBS %#x\t\n",
5855 + res->cpc, res->ibs, res->obs);
5856 +
5857 +- ret += snprintf(buf + ret, MOD_BUF - ret,
5858 ++ ret += scnprintf(buf + ret, MOD_BUF - ret,
5859 + "Module data:\n\tCore %d\n\tIn queue %d\n\t"
5860 + "Out queue %d\n\tType %s\n",
5861 + mconfig->core_id, mconfig->max_in_queue,
5862 +@@ -94,38 +96,38 @@ static ssize_t module_read(struct file *file, char __user *user_buf,
5863 + ret += skl_print_fmt(mconfig->in_fmt, buf, ret, true);
5864 + ret += skl_print_fmt(mconfig->out_fmt, buf, ret, false);
5865 +
5866 +- ret += snprintf(buf + ret, MOD_BUF - ret,
5867 ++ ret += scnprintf(buf + ret, MOD_BUF - ret,
5868 + "Fixup:\n\tParams %#x\n\tConverter %#x\n",
5869 + mconfig->params_fixup, mconfig->converter);
5870 +
5871 +- ret += snprintf(buf + ret, MOD_BUF - ret,
5872 ++ ret += scnprintf(buf + ret, MOD_BUF - ret,
5873 + "Module Gateway:\n\tType %#x\n\tVbus %#x\n\tHW conn %#x\n\tSlot %#x\n",
5874 + mconfig->dev_type, mconfig->vbus_id,
5875 + mconfig->hw_conn_type, mconfig->time_slot);
5876 +
5877 +- ret += snprintf(buf + ret, MOD_BUF - ret,
5878 ++ ret += scnprintf(buf + ret, MOD_BUF - ret,
5879 + "Pipeline:\n\tID %d\n\tPriority %d\n\tConn Type %d\n\t"
5880 + "Pages %#x\n", mconfig->pipe->ppl_id,
5881 + mconfig->pipe->pipe_priority, mconfig->pipe->conn_type,
5882 + mconfig->pipe->memory_pages);
5883 +
5884 +- ret += snprintf(buf + ret, MOD_BUF - ret,
5885 ++ ret += scnprintf(buf + ret, MOD_BUF - ret,
5886 + "\tParams:\n\t\tHost DMA %d\n\t\tLink DMA %d\n",
5887 + mconfig->pipe->p_params->host_dma_id,
5888 + mconfig->pipe->p_params->link_dma_id);
5889 +
5890 +- ret += snprintf(buf + ret, MOD_BUF - ret,
5891 ++ ret += scnprintf(buf + ret, MOD_BUF - ret,
5892 + "\tPCM params:\n\t\tCh %d\n\t\tFreq %d\n\t\tFormat %d\n",
5893 + mconfig->pipe->p_params->ch,
5894 + mconfig->pipe->p_params->s_freq,
5895 + mconfig->pipe->p_params->s_fmt);
5896 +
5897 +- ret += snprintf(buf + ret, MOD_BUF - ret,
5898 ++ ret += scnprintf(buf + ret, MOD_BUF - ret,
5899 + "\tLink %#x\n\tStream %#x\n",
5900 + mconfig->pipe->p_params->linktype,
5901 + mconfig->pipe->p_params->stream);
5902 +
5903 +- ret += snprintf(buf + ret, MOD_BUF - ret,
5904 ++ ret += scnprintf(buf + ret, MOD_BUF - ret,
5905 + "\tState %d\n\tPassthru %s\n",
5906 + mconfig->pipe->state,
5907 + mconfig->pipe->passthru ? "true" : "false");
5908 +@@ -135,7 +137,7 @@ static ssize_t module_read(struct file *file, char __user *user_buf,
5909 + ret += skl_print_pins(mconfig->m_out_pin, buf,
5910 + mconfig->max_out_queue, ret, false);
5911 +
5912 +- ret += snprintf(buf + ret, MOD_BUF - ret,
5913 ++ ret += scnprintf(buf + ret, MOD_BUF - ret,
5914 + "Other:\n\tDomain %d\n\tHomogeneous Input %s\n\t"
5915 + "Homogeneous Output %s\n\tIn Queue Mask %d\n\t"
5916 + "Out Queue Mask %d\n\tDMA ID %d\n\tMem Pages %d\n\t"
5917 +@@ -191,7 +193,7 @@ static ssize_t fw_softreg_read(struct file *file, char __user *user_buf,
5918 + __ioread32_copy(d->fw_read_buff, fw_reg_addr, w0_stat_sz >> 2);
5919 +
5920 + for (offset = 0; offset < FW_REG_SIZE; offset += 16) {
5921 +- ret += snprintf(tmp + ret, FW_REG_BUF - ret, "%#.4x: ", offset);
5922 ++ ret += scnprintf(tmp + ret, FW_REG_BUF - ret, "%#.4x: ", offset);
5923 + hex_dump_to_buffer(d->fw_read_buff + offset, 16, 16, 4,
5924 + tmp + ret, FW_REG_BUF - ret, 0);
5925 + ret += strlen(tmp + ret);
5926 +diff --git a/sound/soc/intel/skylake/skl-ssp-clk.c b/sound/soc/intel/skylake/skl-ssp-clk.c
5927 +index 1c0e5226cb5b..bd43885f3805 100644
5928 +--- a/sound/soc/intel/skylake/skl-ssp-clk.c
5929 ++++ b/sound/soc/intel/skylake/skl-ssp-clk.c
5930 +@@ -384,9 +384,11 @@ static int skl_clk_dev_probe(struct platform_device *pdev)
5931 + &clks[i], clk_pdata, i);
5932 +
5933 + if (IS_ERR(data->clk[data->avail_clk_cnt])) {
5934 +- ret = PTR_ERR(data->clk[data->avail_clk_cnt++]);
5935 ++ ret = PTR_ERR(data->clk[data->avail_clk_cnt]);
5936 + goto err_unreg_skl_clk;
5937 + }
5938 ++
5939 ++ data->avail_clk_cnt++;
5940 + }
5941 +
5942 + platform_set_drvdata(pdev, data);
5943 +diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
5944 +index 935b5375ecc5..ebd785f9aa46 100644
5945 +--- a/sound/soc/soc-dapm.c
5946 ++++ b/sound/soc/soc-dapm.c
5947 +@@ -4749,7 +4749,7 @@ static void soc_dapm_shutdown_dapm(struct snd_soc_dapm_context *dapm)
5948 + continue;
5949 + if (w->power) {
5950 + dapm_seq_insert(w, &down_list, false);
5951 +- w->power = 0;
5952 ++ w->new_power = 0;
5953 + powerdown = 1;
5954 + }
5955 + }
5956 +diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
5957 +index 8712a91e0e3e..d978df95c5c6 100644
5958 +--- a/sound/soc/soc-pcm.c
5959 ++++ b/sound/soc/soc-pcm.c
5960 +@@ -3169,16 +3169,16 @@ static ssize_t dpcm_show_state(struct snd_soc_pcm_runtime *fe,
5961 + unsigned long flags;
5962 +
5963 + /* FE state */
5964 +- offset += snprintf(buf + offset, size - offset,
5965 ++ offset += scnprintf(buf + offset, size - offset,
5966 + "[%s - %s]\n", fe->dai_link->name,
5967 + stream ? "Capture" : "Playback");
5968 +
5969 +- offset += snprintf(buf + offset, size - offset, "State: %s\n",
5970 ++ offset += scnprintf(buf + offset, size - offset, "State: %s\n",
5971 + dpcm_state_string(fe->dpcm[stream].state));
5972 +
5973 + if ((fe->dpcm[stream].state >= SND_SOC_DPCM_STATE_HW_PARAMS) &&
5974 + (fe->dpcm[stream].state <= SND_SOC_DPCM_STATE_STOP))
5975 +- offset += snprintf(buf + offset, size - offset,
5976 ++ offset += scnprintf(buf + offset, size - offset,
5977 + "Hardware Params: "
5978 + "Format = %s, Channels = %d, Rate = %d\n",
5979 + snd_pcm_format_name(params_format(params)),
5980 +@@ -3186,10 +3186,10 @@ static ssize_t dpcm_show_state(struct snd_soc_pcm_runtime *fe,
5981 + params_rate(params));
5982 +
5983 + /* BEs state */
5984 +- offset += snprintf(buf + offset, size - offset, "Backends:\n");
5985 ++ offset += scnprintf(buf + offset, size - offset, "Backends:\n");
5986 +
5987 + if (list_empty(&fe->dpcm[stream].be_clients)) {
5988 +- offset += snprintf(buf + offset, size - offset,
5989 ++ offset += scnprintf(buf + offset, size - offset,
5990 + " No active DSP links\n");
5991 + goto out;
5992 + }
5993 +@@ -3199,16 +3199,16 @@ static ssize_t dpcm_show_state(struct snd_soc_pcm_runtime *fe,
5994 + struct snd_soc_pcm_runtime *be = dpcm->be;
5995 + params = &dpcm->hw_params;
5996 +
5997 +- offset += snprintf(buf + offset, size - offset,
5998 ++ offset += scnprintf(buf + offset, size - offset,
5999 + "- %s\n", be->dai_link->name);
6000 +
6001 +- offset += snprintf(buf + offset, size - offset,
6002 ++ offset += scnprintf(buf + offset, size - offset,
6003 + " State: %s\n",
6004 + dpcm_state_string(be->dpcm[stream].state));
6005 +
6006 + if ((be->dpcm[stream].state >= SND_SOC_DPCM_STATE_HW_PARAMS) &&
6007 + (be->dpcm[stream].state <= SND_SOC_DPCM_STATE_STOP))
6008 +- offset += snprintf(buf + offset, size - offset,
6009 ++ offset += scnprintf(buf + offset, size - offset,
6010 + " Hardware Params: "
6011 + "Format = %s, Channels = %d, Rate = %d\n",
6012 + snd_pcm_format_name(params_format(params)),
6013 +diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
6014 +index d00203ef8305..b19ecaf0febf 100644
6015 +--- a/sound/soc/soc-topology.c
6016 ++++ b/sound/soc/soc-topology.c
6017 +@@ -2320,8 +2320,11 @@ static int soc_tplg_link_elems_load(struct soc_tplg *tplg,
6018 + }
6019 +
6020 + ret = soc_tplg_link_config(tplg, _link);
6021 +- if (ret < 0)
6022 ++ if (ret < 0) {
6023 ++ if (!abi_match)
6024 ++ kfree(_link);
6025 + return ret;
6026 ++ }
6027 +
6028 + /* offset by version-specific struct size and
6029 + * real priv data size
6030 +@@ -2485,7 +2488,7 @@ static int soc_tplg_manifest_load(struct soc_tplg *tplg,
6031 + {
6032 + struct snd_soc_tplg_manifest *manifest, *_manifest;
6033 + bool abi_match;
6034 +- int err;
6035 ++ int ret = 0;
6036 +
6037 + if (tplg->pass != SOC_TPLG_PASS_MANIFEST)
6038 + return 0;
6039 +@@ -2498,19 +2501,19 @@ static int soc_tplg_manifest_load(struct soc_tplg *tplg,
6040 + _manifest = manifest;
6041 + } else {
6042 + abi_match = false;
6043 +- err = manifest_new_ver(tplg, manifest, &_manifest);
6044 +- if (err < 0)
6045 +- return err;
6046 ++ ret = manifest_new_ver(tplg, manifest, &_manifest);
6047 ++ if (ret < 0)
6048 ++ return ret;
6049 + }
6050 +
6051 + /* pass control to component driver for optional further init */
6052 + if (tplg->comp && tplg->ops && tplg->ops->manifest)
6053 +- return tplg->ops->manifest(tplg->comp, tplg->index, _manifest);
6054 ++ ret = tplg->ops->manifest(tplg->comp, tplg->index, _manifest);
6055 +
6056 + if (!abi_match) /* free the duplicated one */
6057 + kfree(_manifest);
6058 +
6059 +- return 0;
6060 ++ return ret;
6061 + }
6062 +
6063 + /* validate header magic, size and type */
6064 +diff --git a/sound/soc/sof/ipc.c b/sound/soc/sof/ipc.c
6065 +index 8984d965037d..e7b1a80e2a14 100644
6066 +--- a/sound/soc/sof/ipc.c
6067 ++++ b/sound/soc/sof/ipc.c
6068 +@@ -497,7 +497,7 @@ int snd_sof_ipc_stream_posn(struct snd_sof_dev *sdev,
6069 +
6070 + /* send IPC to the DSP */
6071 + err = sof_ipc_tx_message(sdev->ipc,
6072 +- stream.hdr.cmd, &stream, sizeof(stream), &posn,
6073 ++ stream.hdr.cmd, &stream, sizeof(stream), posn,
6074 + sizeof(*posn));
6075 + if (err < 0) {
6076 + dev_err(sdev->dev, "error: failed to get stream %d position\n",
6077 +diff --git a/tools/perf/arch/arm/util/cs-etm.c b/tools/perf/arch/arm/util/cs-etm.c
6078 +index ede040cf82ad..20e9a189ad92 100644
6079 +--- a/tools/perf/arch/arm/util/cs-etm.c
6080 ++++ b/tools/perf/arch/arm/util/cs-etm.c
6081 +@@ -865,9 +865,12 @@ static int cs_etm_read_finish(struct auxtrace_record *itr, int idx)
6082 + struct evsel *evsel;
6083 +
6084 + evlist__for_each_entry(ptr->evlist, evsel) {
6085 +- if (evsel->core.attr.type == ptr->cs_etm_pmu->type)
6086 ++ if (evsel->core.attr.type == ptr->cs_etm_pmu->type) {
6087 ++ if (evsel->disabled)
6088 ++ return 0;
6089 + return perf_evlist__enable_event_idx(ptr->evlist,
6090 + evsel, idx);
6091 ++ }
6092 + }
6093 +
6094 + return -EINVAL;
6095 +diff --git a/tools/perf/arch/arm64/util/arm-spe.c b/tools/perf/arch/arm64/util/arm-spe.c
6096 +index eba6541ec0f1..1d993c27242b 100644
6097 +--- a/tools/perf/arch/arm64/util/arm-spe.c
6098 ++++ b/tools/perf/arch/arm64/util/arm-spe.c
6099 +@@ -165,9 +165,12 @@ static int arm_spe_read_finish(struct auxtrace_record *itr, int idx)
6100 + struct evsel *evsel;
6101 +
6102 + evlist__for_each_entry(sper->evlist, evsel) {
6103 +- if (evsel->core.attr.type == sper->arm_spe_pmu->type)
6104 ++ if (evsel->core.attr.type == sper->arm_spe_pmu->type) {
6105 ++ if (evsel->disabled)
6106 ++ return 0;
6107 + return perf_evlist__enable_event_idx(sper->evlist,
6108 + evsel, idx);
6109 ++ }
6110 + }
6111 + return -EINVAL;
6112 + }
6113 +diff --git a/tools/perf/arch/x86/util/intel-bts.c b/tools/perf/arch/x86/util/intel-bts.c
6114 +index f7f68a50a5cd..85799b5fa01d 100644
6115 +--- a/tools/perf/arch/x86/util/intel-bts.c
6116 ++++ b/tools/perf/arch/x86/util/intel-bts.c
6117 +@@ -415,9 +415,12 @@ static int intel_bts_read_finish(struct auxtrace_record *itr, int idx)
6118 + struct evsel *evsel;
6119 +
6120 + evlist__for_each_entry(btsr->evlist, evsel) {
6121 +- if (evsel->core.attr.type == btsr->intel_bts_pmu->type)
6122 ++ if (evsel->core.attr.type == btsr->intel_bts_pmu->type) {
6123 ++ if (evsel->disabled)
6124 ++ return 0;
6125 + return perf_evlist__enable_event_idx(btsr->evlist,
6126 + evsel, idx);
6127 ++ }
6128 + }
6129 + return -EINVAL;
6130 + }
6131 +diff --git a/tools/perf/arch/x86/util/intel-pt.c b/tools/perf/arch/x86/util/intel-pt.c
6132 +index d6d26256915f..d43f9dec6998 100644
6133 +--- a/tools/perf/arch/x86/util/intel-pt.c
6134 ++++ b/tools/perf/arch/x86/util/intel-pt.c
6135 +@@ -1099,9 +1099,12 @@ static int intel_pt_read_finish(struct auxtrace_record *itr, int idx)
6136 + struct evsel *evsel;
6137 +
6138 + evlist__for_each_entry(ptr->evlist, evsel) {
6139 +- if (evsel->core.attr.type == ptr->intel_pt_pmu->type)
6140 ++ if (evsel->core.attr.type == ptr->intel_pt_pmu->type) {
6141 ++ if (evsel->disabled)
6142 ++ return 0;
6143 + return perf_evlist__enable_event_idx(ptr->evlist, evsel,
6144 + idx);
6145 ++ }
6146 + }
6147 + return -EINVAL;
6148 + }
6149 +diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
6150 +index 1c8a1963d03f..3ed0134a764d 100644
6151 +--- a/tools/testing/selftests/lib.mk
6152 ++++ b/tools/testing/selftests/lib.mk
6153 +@@ -83,17 +83,20 @@ else
6154 + $(call RUN_TESTS, $(TEST_GEN_PROGS) $(TEST_CUSTOM_PROGS) $(TEST_PROGS))
6155 + endif
6156 +
6157 ++define INSTALL_SINGLE_RULE
6158 ++ $(if $(INSTALL_LIST),@mkdir -p $(INSTALL_PATH))
6159 ++ $(if $(INSTALL_LIST),@echo rsync -a $(INSTALL_LIST) $(INSTALL_PATH)/)
6160 ++ $(if $(INSTALL_LIST),@rsync -a $(INSTALL_LIST) $(INSTALL_PATH)/)
6161 ++endef
6162 ++
6163 + define INSTALL_RULE
6164 +- @if [ "X$(TEST_PROGS)$(TEST_PROGS_EXTENDED)$(TEST_FILES)" != "X" ]; then \
6165 +- mkdir -p ${INSTALL_PATH}; \
6166 +- echo "rsync -a $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES) $(INSTALL_PATH)/"; \
6167 +- rsync -a $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES) $(INSTALL_PATH)/; \
6168 +- fi
6169 +- @if [ "X$(TEST_GEN_PROGS)$(TEST_CUSTOM_PROGS)$(TEST_GEN_PROGS_EXTENDED)$(TEST_GEN_FILES)" != "X" ]; then \
6170 +- mkdir -p ${INSTALL_PATH}; \
6171 +- echo "rsync -a $(TEST_GEN_PROGS) $(TEST_CUSTOM_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) $(INSTALL_PATH)/"; \
6172 +- rsync -a $(TEST_GEN_PROGS) $(TEST_CUSTOM_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) $(INSTALL_PATH)/; \
6173 +- fi
6174 ++ $(eval INSTALL_LIST = $(TEST_PROGS)) $(INSTALL_SINGLE_RULE)
6175 ++ $(eval INSTALL_LIST = $(TEST_PROGS_EXTENDED)) $(INSTALL_SINGLE_RULE)
6176 ++ $(eval INSTALL_LIST = $(TEST_FILES)) $(INSTALL_SINGLE_RULE)
6177 ++ $(eval INSTALL_LIST = $(TEST_GEN_PROGS)) $(INSTALL_SINGLE_RULE)
6178 ++ $(eval INSTALL_LIST = $(TEST_CUSTOM_PROGS)) $(INSTALL_SINGLE_RULE)
6179 ++ $(eval INSTALL_LIST = $(TEST_GEN_PROGS_EXTENDED)) $(INSTALL_SINGLE_RULE)
6180 ++ $(eval INSTALL_LIST = $(TEST_GEN_FILES)) $(INSTALL_SINGLE_RULE)
6181 + endef
6182 +
6183 + install: all
6184 +diff --git a/tools/testing/selftests/net/forwarding/mirror_gre.sh b/tools/testing/selftests/net/forwarding/mirror_gre.sh
6185 +index e6fd7a18c655..0266443601bc 100755
6186 +--- a/tools/testing/selftests/net/forwarding/mirror_gre.sh
6187 ++++ b/tools/testing/selftests/net/forwarding/mirror_gre.sh
6188 +@@ -63,22 +63,23 @@ test_span_gre_mac()
6189 + {
6190 + local tundev=$1; shift
6191 + local direction=$1; shift
6192 +- local prot=$1; shift
6193 + local what=$1; shift
6194 +
6195 +- local swp3mac=$(mac_get $swp3)
6196 +- local h3mac=$(mac_get $h3)
6197 ++ case "$direction" in
6198 ++ ingress) local src_mac=$(mac_get $h1); local dst_mac=$(mac_get $h2)
6199 ++ ;;
6200 ++ egress) local src_mac=$(mac_get $h2); local dst_mac=$(mac_get $h1)
6201 ++ ;;
6202 ++ esac
6203 +
6204 + RET=0
6205 +
6206 + mirror_install $swp1 $direction $tundev "matchall $tcflags"
6207 +- tc filter add dev $h3 ingress pref 77 prot $prot \
6208 +- flower ip_proto 0x2f src_mac $swp3mac dst_mac $h3mac \
6209 +- action pass
6210 ++ icmp_capture_install h3-${tundev} "src_mac $src_mac dst_mac $dst_mac"
6211 +
6212 +- mirror_test v$h1 192.0.2.1 192.0.2.2 $h3 77 10
6213 ++ mirror_test v$h1 192.0.2.1 192.0.2.2 h3-${tundev} 100 10
6214 +
6215 +- tc filter del dev $h3 ingress pref 77
6216 ++ icmp_capture_uninstall h3-${tundev}
6217 + mirror_uninstall $swp1 $direction
6218 +
6219 + log_test "$direction $what: envelope MAC ($tcflags)"
6220 +@@ -120,14 +121,14 @@ test_ip6gretap()
6221 +
6222 + test_gretap_mac()
6223 + {
6224 +- test_span_gre_mac gt4 ingress ip "mirror to gretap"
6225 +- test_span_gre_mac gt4 egress ip "mirror to gretap"
6226 ++ test_span_gre_mac gt4 ingress "mirror to gretap"
6227 ++ test_span_gre_mac gt4 egress "mirror to gretap"
6228 + }
6229 +
6230 + test_ip6gretap_mac()
6231 + {
6232 +- test_span_gre_mac gt6 ingress ipv6 "mirror to ip6gretap"
6233 +- test_span_gre_mac gt6 egress ipv6 "mirror to ip6gretap"
6234 ++ test_span_gre_mac gt6 ingress "mirror to ip6gretap"
6235 ++ test_span_gre_mac gt6 egress "mirror to ip6gretap"
6236 + }
6237 +
6238 + test_all()
6239 +diff --git a/tools/testing/selftests/net/forwarding/vxlan_bridge_1d.sh b/tools/testing/selftests/net/forwarding/vxlan_bridge_1d.sh
6240 +index bb10e33690b2..ce6bea9675c0 100755
6241 +--- a/tools/testing/selftests/net/forwarding/vxlan_bridge_1d.sh
6242 ++++ b/tools/testing/selftests/net/forwarding/vxlan_bridge_1d.sh
6243 +@@ -516,9 +516,9 @@ test_tos()
6244 + RET=0
6245 +
6246 + tc filter add dev v1 egress pref 77 prot ip \
6247 +- flower ip_tos 0x40 action pass
6248 +- vxlan_ping_test $h1 192.0.2.3 "-Q 0x40" v1 egress 77 10
6249 +- vxlan_ping_test $h1 192.0.2.3 "-Q 0x30" v1 egress 77 0
6250 ++ flower ip_tos 0x14 action pass
6251 ++ vxlan_ping_test $h1 192.0.2.3 "-Q 0x14" v1 egress 77 10
6252 ++ vxlan_ping_test $h1 192.0.2.3 "-Q 0x18" v1 egress 77 0
6253 + tc filter del dev v1 egress pref 77 prot ip
6254 +
6255 + log_test "VXLAN: envelope TOS inheritance"
6256 +diff --git a/usr/include/Makefile b/usr/include/Makefile
6257 +index 47cb91d3a51d..e2840579156a 100644
6258 +--- a/usr/include/Makefile
6259 ++++ b/usr/include/Makefile
6260 +@@ -99,7 +99,7 @@ endif
6261 + # asm-generic/*.h is used by asm/*.h, and should not be included directly
6262 + header-test- += asm-generic/%
6263 +
6264 +-extra-y := $(patsubst $(obj)/%.h,%.hdrtest, $(shell find $(obj) -name '*.h'))
6265 ++extra-y := $(patsubst $(obj)/%.h,%.hdrtest, $(shell find $(obj) -name '*.h' 2>/dev/null))
6266 +
6267 + quiet_cmd_hdrtest = HDRTEST $<
6268 + cmd_hdrtest = \