Gentoo Archives: gentoo-commits

From: Alice Ferrazzi <alicef@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:5.10 commit in: /
Date: Wed, 03 Feb 2021 23:43:21
Message-Id: 1612395778.813dc8c752e33af6a79f31239aa610cca6157169.alicef@gentoo
1 commit: 813dc8c752e33af6a79f31239aa610cca6157169
2 Author: Alice Ferrazzi <alicef <AT> gentoo <DOT> org>
3 AuthorDate: Wed Feb 3 23:42:45 2021 +0000
4 Commit: Alice Ferrazzi <alicef <AT> gentoo <DOT> org>
5 CommitDate: Wed Feb 3 23:42:58 2021 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=813dc8c7
7
8 Linux patch 5.10.13
9
10 Signed-off-by: Alice Ferrazzi <alicef <AT> gentoo.org>
11
12 0000_README | 4 +
13 1012_linux-5.10.13.patch | 5253 ++++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 5257 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index 8c99e2c..0a7ffef 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -91,6 +91,10 @@ Patch: 1011_linux-5.10.12.patch
21 From: http://www.kernel.org
22 Desc: Linux 5.10.12
23
24 +Patch: 1012_linux-5.10.13.patch
25 +From: http://www.kernel.org
26 +Desc: Linux 5.10.13
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/1012_linux-5.10.13.patch b/1012_linux-5.10.13.patch
33 new file mode 100644
34 index 0000000..59a71aa
35 --- /dev/null
36 +++ b/1012_linux-5.10.13.patch
37 @@ -0,0 +1,5253 @@
38 +diff --git a/Documentation/asm-annotations.rst b/Documentation/asm-annotations.rst
39 +index 32ea57483378d..76424e0431f4b 100644
40 +--- a/Documentation/asm-annotations.rst
41 ++++ b/Documentation/asm-annotations.rst
42 +@@ -100,6 +100,11 @@ Instruction Macros
43 + ~~~~~~~~~~~~~~~~~~
44 + This section covers ``SYM_FUNC_*`` and ``SYM_CODE_*`` enumerated above.
45 +
46 ++``objtool`` requires that all code must be contained in an ELF symbol. Symbol
47 ++names that have a ``.L`` prefix do not emit symbol table entries. ``.L``
48 ++prefixed symbols can be used within a code region, but should be avoided for
49 ++denoting a range of code via ``SYM_*_START/END`` annotations.
50 ++
51 + * ``SYM_FUNC_START`` and ``SYM_FUNC_START_LOCAL`` are supposed to be **the
52 + most frequent markings**. They are used for functions with standard calling
53 + conventions -- global and local. Like in C, they both align the functions to
54 +diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst
55 +index e00a66d723728..4ba0df574eb25 100644
56 +--- a/Documentation/virt/kvm/api.rst
57 ++++ b/Documentation/virt/kvm/api.rst
58 +@@ -1264,6 +1264,9 @@ field userspace_addr, which must point at user addressable memory for
59 + the entire memory slot size. Any object may back this memory, including
60 + anonymous memory, ordinary files, and hugetlbfs.
61 +
62 ++On architectures that support a form of address tagging, userspace_addr must
63 ++be an untagged address.
64 ++
65 + It is recommended that the lower 21 bits of guest_phys_addr and userspace_addr
66 + be identical. This allows large pages in the guest to be backed by large
67 + pages in the host.
68 +@@ -1316,7 +1319,7 @@ documentation when it pops into existence).
69 +
70 + :Capability: KVM_CAP_ENABLE_CAP_VM
71 + :Architectures: all
72 +-:Type: vcpu ioctl
73 ++:Type: vm ioctl
74 + :Parameters: struct kvm_enable_cap (in)
75 + :Returns: 0 on success; -1 on error
76 +
77 +diff --git a/Makefile b/Makefile
78 +index a6b2e64bcf6c7..a2d5e953ea40a 100644
79 +--- a/Makefile
80 ++++ b/Makefile
81 +@@ -1,7 +1,7 @@
82 + # SPDX-License-Identifier: GPL-2.0
83 + VERSION = 5
84 + PATCHLEVEL = 10
85 +-SUBLEVEL = 12
86 ++SUBLEVEL = 13
87 + EXTRAVERSION =
88 + NAME = Kleptomaniac Octopus
89 +
90 +diff --git a/arch/arm/boot/compressed/atags_to_fdt.c b/arch/arm/boot/compressed/atags_to_fdt.c
91 +index 8452753efebe5..31927d2fe2972 100644
92 +--- a/arch/arm/boot/compressed/atags_to_fdt.c
93 ++++ b/arch/arm/boot/compressed/atags_to_fdt.c
94 +@@ -15,7 +15,8 @@ static int node_offset(void *fdt, const char *node_path)
95 + {
96 + int offset = fdt_path_offset(fdt, node_path);
97 + if (offset == -FDT_ERR_NOTFOUND)
98 +- offset = fdt_add_subnode(fdt, 0, node_path);
99 ++ /* Add the node to root if not found, dropping the leading '/' */
100 ++ offset = fdt_add_subnode(fdt, 0, node_path + 1);
101 + return offset;
102 + }
103 +
104 +diff --git a/arch/arm/boot/dts/imx6q-tbs2910.dts b/arch/arm/boot/dts/imx6q-tbs2910.dts
105 +index 861e05d53157e..343364d3e4f7d 100644
106 +--- a/arch/arm/boot/dts/imx6q-tbs2910.dts
107 ++++ b/arch/arm/boot/dts/imx6q-tbs2910.dts
108 +@@ -16,6 +16,13 @@
109 + stdout-path = &uart1;
110 + };
111 +
112 ++ aliases {
113 ++ mmc0 = &usdhc2;
114 ++ mmc1 = &usdhc3;
115 ++ mmc2 = &usdhc4;
116 ++ /delete-property/ mmc3;
117 ++ };
118 ++
119 + memory@10000000 {
120 + device_type = "memory";
121 + reg = <0x10000000 0x80000000>;
122 +diff --git a/arch/arm/boot/dts/imx6qdl-gw52xx.dtsi b/arch/arm/boot/dts/imx6qdl-gw52xx.dtsi
123 +index 736074f1c3ef9..959d8ac2e393b 100644
124 +--- a/arch/arm/boot/dts/imx6qdl-gw52xx.dtsi
125 ++++ b/arch/arm/boot/dts/imx6qdl-gw52xx.dtsi
126 +@@ -418,7 +418,7 @@
127 +
128 + /* VDD_AUD_1P8: Audio codec */
129 + reg_aud_1p8v: ldo3 {
130 +- regulator-name = "vdd1p8";
131 ++ regulator-name = "vdd1p8a";
132 + regulator-min-microvolt = <1800000>;
133 + regulator-max-microvolt = <1800000>;
134 + regulator-boot-on;
135 +diff --git a/arch/arm/boot/dts/imx6qdl-kontron-samx6i.dtsi b/arch/arm/boot/dts/imx6qdl-kontron-samx6i.dtsi
136 +index 24f793ca28867..92f9977d14822 100644
137 +--- a/arch/arm/boot/dts/imx6qdl-kontron-samx6i.dtsi
138 ++++ b/arch/arm/boot/dts/imx6qdl-kontron-samx6i.dtsi
139 +@@ -137,7 +137,7 @@
140 +
141 + lcd_backlight: lcd-backlight {
142 + compatible = "pwm-backlight";
143 +- pwms = <&pwm4 0 5000000>;
144 ++ pwms = <&pwm4 0 5000000 0>;
145 + pwm-names = "LCD_BKLT_PWM";
146 +
147 + brightness-levels = <0 10 20 30 40 50 60 70 80 90 100>;
148 +@@ -167,7 +167,7 @@
149 + i2c-gpio,delay-us = <2>; /* ~100 kHz */
150 + #address-cells = <1>;
151 + #size-cells = <0>;
152 +- status = "disabld";
153 ++ status = "disabled";
154 + };
155 +
156 + i2c_cam: i2c-gpio-cam {
157 +@@ -179,7 +179,7 @@
158 + i2c-gpio,delay-us = <2>; /* ~100 kHz */
159 + #address-cells = <1>;
160 + #size-cells = <0>;
161 +- status = "disabld";
162 ++ status = "disabled";
163 + };
164 + };
165 +
166 +diff --git a/arch/arm/boot/dts/imx6qdl-sr-som.dtsi b/arch/arm/boot/dts/imx6qdl-sr-som.dtsi
167 +index b06577808ff4e..7e4e5fd0143a1 100644
168 +--- a/arch/arm/boot/dts/imx6qdl-sr-som.dtsi
169 ++++ b/arch/arm/boot/dts/imx6qdl-sr-som.dtsi
170 +@@ -53,7 +53,6 @@
171 + &fec {
172 + pinctrl-names = "default";
173 + pinctrl-0 = <&pinctrl_microsom_enet_ar8035>;
174 +- phy-handle = <&phy>;
175 + phy-mode = "rgmii-id";
176 + phy-reset-duration = <2>;
177 + phy-reset-gpios = <&gpio4 15 GPIO_ACTIVE_LOW>;
178 +@@ -63,10 +62,19 @@
179 + #address-cells = <1>;
180 + #size-cells = <0>;
181 +
182 +- phy: ethernet-phy@0 {
183 ++ /*
184 ++ * The PHY can appear at either address 0 or 4 due to the
185 ++ * configuration (LED) pin not being pulled sufficiently.
186 ++ */
187 ++ ethernet-phy@0 {
188 + reg = <0>;
189 + qca,clk-out-frequency = <125000000>;
190 + };
191 ++
192 ++ ethernet-phy@4 {
193 ++ reg = <4>;
194 ++ qca,clk-out-frequency = <125000000>;
195 ++ };
196 + };
197 + };
198 +
199 +diff --git a/arch/arm/boot/dts/ste-db8500.dtsi b/arch/arm/boot/dts/ste-db8500.dtsi
200 +index d309fad32229d..344d29853bf76 100644
201 +--- a/arch/arm/boot/dts/ste-db8500.dtsi
202 ++++ b/arch/arm/boot/dts/ste-db8500.dtsi
203 +@@ -12,4 +12,42 @@
204 + 200000 0>;
205 + };
206 + };
207 ++
208 ++ reserved-memory {
209 ++ #address-cells = <1>;
210 ++ #size-cells = <1>;
211 ++ ranges;
212 ++
213 ++ /* Modem trace memory */
214 ++ ram@06000000 {
215 ++ reg = <0x06000000 0x00f00000>;
216 ++ no-map;
217 ++ };
218 ++
219 ++ /* Modem shared memory */
220 ++ ram@06f00000 {
221 ++ reg = <0x06f00000 0x00100000>;
222 ++ no-map;
223 ++ };
224 ++
225 ++ /* Modem private memory */
226 ++ ram@07000000 {
227 ++ reg = <0x07000000 0x01000000>;
228 ++ no-map;
229 ++ };
230 ++
231 ++ /*
232 ++ * Initial Secure Software ISSW memory
233 ++ *
234 ++ * This is probably only used if the kernel tries
235 ++ * to actually call into trustzone to run secure
236 ++ * applications, which the mainline kernel probably
237 ++ * will not do on this old chipset. But you can never
238 ++ * be too careful, so reserve this memory anyway.
239 ++ */
240 ++ ram@17f00000 {
241 ++ reg = <0x17f00000 0x00100000>;
242 ++ no-map;
243 ++ };
244 ++ };
245 + };
246 +diff --git a/arch/arm/boot/dts/ste-db8520.dtsi b/arch/arm/boot/dts/ste-db8520.dtsi
247 +index 48bd8728ae27f..287804e9e1836 100644
248 +--- a/arch/arm/boot/dts/ste-db8520.dtsi
249 ++++ b/arch/arm/boot/dts/ste-db8520.dtsi
250 +@@ -12,4 +12,42 @@
251 + 200000 0>;
252 + };
253 + };
254 ++
255 ++ reserved-memory {
256 ++ #address-cells = <1>;
257 ++ #size-cells = <1>;
258 ++ ranges;
259 ++
260 ++ /* Modem trace memory */
261 ++ ram@06000000 {
262 ++ reg = <0x06000000 0x00f00000>;
263 ++ no-map;
264 ++ };
265 ++
266 ++ /* Modem shared memory */
267 ++ ram@06f00000 {
268 ++ reg = <0x06f00000 0x00100000>;
269 ++ no-map;
270 ++ };
271 ++
272 ++ /* Modem private memory */
273 ++ ram@07000000 {
274 ++ reg = <0x07000000 0x01000000>;
275 ++ no-map;
276 ++ };
277 ++
278 ++ /*
279 ++ * Initial Secure Software ISSW memory
280 ++ *
281 ++ * This is probably only used if the kernel tries
282 ++ * to actually call into trustzone to run secure
283 ++ * applications, which the mainline kernel probably
284 ++ * will not do on this old chipset. But you can never
285 ++ * be too careful, so reserve this memory anyway.
286 ++ */
287 ++ ram@17f00000 {
288 ++ reg = <0x17f00000 0x00100000>;
289 ++ no-map;
290 ++ };
291 ++ };
292 + };
293 +diff --git a/arch/arm/boot/dts/ste-db9500.dtsi b/arch/arm/boot/dts/ste-db9500.dtsi
294 +new file mode 100644
295 +index 0000000000000..0afff703191c6
296 +--- /dev/null
297 ++++ b/arch/arm/boot/dts/ste-db9500.dtsi
298 +@@ -0,0 +1,35 @@
299 ++// SPDX-License-Identifier: GPL-2.0-or-later
300 ++
301 ++#include "ste-dbx5x0.dtsi"
302 ++
303 ++/ {
304 ++ cpus {
305 ++ cpu@300 {
306 ++ /* cpufreq controls */
307 ++ operating-points = <1152000 0
308 ++ 800000 0
309 ++ 400000 0
310 ++ 200000 0>;
311 ++ };
312 ++ };
313 ++
314 ++ reserved-memory {
315 ++ #address-cells = <1>;
316 ++ #size-cells = <1>;
317 ++ ranges;
318 ++
319 ++ /*
320 ++ * Initial Secure Software ISSW memory
321 ++ *
322 ++ * This is probably only used if the kernel tries
323 ++ * to actually call into trustzone to run secure
324 ++ * applications, which the mainline kernel probably
325 ++ * will not do on this old chipset. But you can never
326 ++ * be too careful, so reserve this memory anyway.
327 ++ */
328 ++ ram@17f00000 {
329 ++ reg = <0x17f00000 0x00100000>;
330 ++ no-map;
331 ++ };
332 ++ };
333 ++};
334 +diff --git a/arch/arm/boot/dts/ste-snowball.dts b/arch/arm/boot/dts/ste-snowball.dts
335 +index be90e73c923ec..27d8a07718a00 100644
336 +--- a/arch/arm/boot/dts/ste-snowball.dts
337 ++++ b/arch/arm/boot/dts/ste-snowball.dts
338 +@@ -4,7 +4,7 @@
339 + */
340 +
341 + /dts-v1/;
342 +-#include "ste-db8500.dtsi"
343 ++#include "ste-db9500.dtsi"
344 + #include "ste-href-ab8500.dtsi"
345 + #include "ste-href-family-pinctrl.dtsi"
346 +
347 +diff --git a/arch/arm/mach-imx/suspend-imx6.S b/arch/arm/mach-imx/suspend-imx6.S
348 +index 1eabf2d2834be..e06f946b75b96 100644
349 +--- a/arch/arm/mach-imx/suspend-imx6.S
350 ++++ b/arch/arm/mach-imx/suspend-imx6.S
351 +@@ -67,6 +67,7 @@
352 + #define MX6Q_CCM_CCR 0x0
353 +
354 + .align 3
355 ++ .arm
356 +
357 + .macro sync_l2_cache
358 +
359 +diff --git a/arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi b/arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi
360 +index aef8f2b00778d..5401a646c8406 100644
361 +--- a/arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi
362 ++++ b/arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi
363 +@@ -4,11 +4,16 @@
364 + */
365 + usb {
366 + compatible = "simple-bus";
367 +- dma-ranges;
368 + #address-cells = <2>;
369 + #size-cells = <2>;
370 + ranges = <0x0 0x0 0x0 0x68500000 0x0 0x00400000>;
371 +
372 ++ /*
373 ++ * Internally, USB bus to the interconnect can only address up
374 ++ * to 40-bit
375 ++ */
376 ++ dma-ranges = <0 0 0 0 0x100 0x0>;
377 ++
378 + usbphy0: usb-phy@0 {
379 + compatible = "brcm,sr-usb-combo-phy";
380 + reg = <0x0 0x00000000 0x0 0x100>;
381 +diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi
382 +index 33aa0efa2293a..62f4dcb96e70d 100644
383 +--- a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi
384 ++++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi
385 +@@ -93,7 +93,7 @@
386 + reboot {
387 + compatible ="syscon-reboot";
388 + regmap = <&rst>;
389 +- offset = <0xb0>;
390 ++ offset = <0>;
391 + mask = <0x02>;
392 + };
393 +
394 +diff --git a/arch/arm64/boot/dts/freescale/imx8mp.dtsi b/arch/arm64/boot/dts/freescale/imx8mp.dtsi
395 +index 6038f66aefc10..03ef0e5f909e4 100644
396 +--- a/arch/arm64/boot/dts/freescale/imx8mp.dtsi
397 ++++ b/arch/arm64/boot/dts/freescale/imx8mp.dtsi
398 +@@ -259,7 +259,7 @@
399 + #gpio-cells = <2>;
400 + interrupt-controller;
401 + #interrupt-cells = <2>;
402 +- gpio-ranges = <&iomuxc 0 56 26>, <&iomuxc 0 144 4>;
403 ++ gpio-ranges = <&iomuxc 0 56 26>, <&iomuxc 26 144 4>;
404 + };
405 +
406 + gpio4: gpio@30230000 {
407 +diff --git a/arch/arm64/kvm/pmu-emul.c b/arch/arm64/kvm/pmu-emul.c
408 +index 2ed5ef8f274b1..2dd164bb1c5a9 100644
409 +--- a/arch/arm64/kvm/pmu-emul.c
410 ++++ b/arch/arm64/kvm/pmu-emul.c
411 +@@ -788,7 +788,7 @@ u64 kvm_pmu_get_pmceid(struct kvm_vcpu *vcpu, bool pmceid1)
412 + {
413 + unsigned long *bmap = vcpu->kvm->arch.pmu_filter;
414 + u64 val, mask = 0;
415 +- int base, i;
416 ++ int base, i, nr_events;
417 +
418 + if (!pmceid1) {
419 + val = read_sysreg(pmceid0_el0);
420 +@@ -801,13 +801,17 @@ u64 kvm_pmu_get_pmceid(struct kvm_vcpu *vcpu, bool pmceid1)
421 + if (!bmap)
422 + return val;
423 +
424 ++ nr_events = kvm_pmu_event_mask(vcpu->kvm) + 1;
425 ++
426 + for (i = 0; i < 32; i += 8) {
427 + u64 byte;
428 +
429 + byte = bitmap_get_value8(bmap, base + i);
430 + mask |= byte << i;
431 +- byte = bitmap_get_value8(bmap, 0x4000 + base + i);
432 +- mask |= byte << (32 + i);
433 ++ if (nr_events >= (0x4000 + base + 32)) {
434 ++ byte = bitmap_get_value8(bmap, 0x4000 + base + i);
435 ++ mask |= byte << (32 + i);
436 ++ }
437 + }
438 +
439 + return val & mask;
440 +diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
441 +index b234e8154cbd4..04dc17d52ac2d 100644
442 +--- a/arch/parisc/Kconfig
443 ++++ b/arch/parisc/Kconfig
444 +@@ -202,9 +202,8 @@ config PREFETCH
445 + depends on PA8X00 || PA7200
446 +
447 + config MLONGCALLS
448 +- bool "Enable the -mlong-calls compiler option for big kernels"
449 +- default y if !MODULES || UBSAN || FTRACE
450 +- default n
451 ++ def_bool y if !MODULES || UBSAN || FTRACE
452 ++ bool "Enable the -mlong-calls compiler option for big kernels" if MODULES && !UBSAN && !FTRACE
453 + depends on PA8X00
454 + help
455 + If you configure the kernel to include many drivers built-in instead
456 +diff --git a/arch/parisc/kernel/entry.S b/arch/parisc/kernel/entry.S
457 +index f6f28e41bb5e0..5d8123eb38ec5 100644
458 +--- a/arch/parisc/kernel/entry.S
459 ++++ b/arch/parisc/kernel/entry.S
460 +@@ -997,10 +997,17 @@ intr_do_preempt:
461 + bb,<,n %r20, 31 - PSW_SM_I, intr_restore
462 + nop
463 +
464 ++ /* ssm PSW_SM_I done later in intr_restore */
465 ++#ifdef CONFIG_MLONGCALLS
466 ++ ldil L%intr_restore, %r2
467 ++ load32 preempt_schedule_irq, %r1
468 ++ bv %r0(%r1)
469 ++ ldo R%intr_restore(%r2), %r2
470 ++#else
471 ++ ldil L%intr_restore, %r1
472 + BL preempt_schedule_irq, %r2
473 +- nop
474 +-
475 +- b,n intr_restore /* ssm PSW_SM_I done by intr_restore */
476 ++ ldo R%intr_restore(%r1), %r2
477 ++#endif
478 + #endif /* CONFIG_PREEMPTION */
479 +
480 + /*
481 +diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
482 +index 6b1eca53e36cc..cc7a6271b6b4e 100644
483 +--- a/arch/powerpc/kernel/irq.c
484 ++++ b/arch/powerpc/kernel/irq.c
485 +@@ -180,13 +180,18 @@ void notrace restore_interrupts(void)
486 +
487 + void replay_soft_interrupts(void)
488 + {
489 ++ struct pt_regs regs;
490 ++
491 + /*
492 +- * We use local_paca rather than get_paca() to avoid all
493 +- * the debug_smp_processor_id() business in this low level
494 +- * function
495 ++ * Be careful here, calling these interrupt handlers can cause
496 ++ * softirqs to be raised, which they may run when calling irq_exit,
497 ++ * which will cause local_irq_enable() to be run, which can then
498 ++ * recurse into this function. Don't keep any state across
499 ++ * interrupt handler calls which may change underneath us.
500 ++ *
501 ++ * We use local_paca rather than get_paca() to avoid all the
502 ++ * debug_smp_processor_id() business in this low level function.
503 + */
504 +- unsigned char happened = local_paca->irq_happened;
505 +- struct pt_regs regs;
506 +
507 + ppc_save_regs(&regs);
508 + regs.softe = IRQS_ENABLED;
509 +@@ -209,7 +214,7 @@ again:
510 + * This is a higher priority interrupt than the others, so
511 + * replay it first.
512 + */
513 +- if (IS_ENABLED(CONFIG_PPC_BOOK3S) && (happened & PACA_IRQ_HMI)) {
514 ++ if (IS_ENABLED(CONFIG_PPC_BOOK3S) && (local_paca->irq_happened & PACA_IRQ_HMI)) {
515 + local_paca->irq_happened &= ~PACA_IRQ_HMI;
516 + regs.trap = 0xe60;
517 + handle_hmi_exception(&regs);
518 +@@ -217,7 +222,7 @@ again:
519 + hard_irq_disable();
520 + }
521 +
522 +- if (happened & PACA_IRQ_DEC) {
523 ++ if (local_paca->irq_happened & PACA_IRQ_DEC) {
524 + local_paca->irq_happened &= ~PACA_IRQ_DEC;
525 + regs.trap = 0x900;
526 + timer_interrupt(&regs);
527 +@@ -225,7 +230,7 @@ again:
528 + hard_irq_disable();
529 + }
530 +
531 +- if (happened & PACA_IRQ_EE) {
532 ++ if (local_paca->irq_happened & PACA_IRQ_EE) {
533 + local_paca->irq_happened &= ~PACA_IRQ_EE;
534 + regs.trap = 0x500;
535 + do_IRQ(&regs);
536 +@@ -233,7 +238,7 @@ again:
537 + hard_irq_disable();
538 + }
539 +
540 +- if (IS_ENABLED(CONFIG_PPC_DOORBELL) && (happened & PACA_IRQ_DBELL)) {
541 ++ if (IS_ENABLED(CONFIG_PPC_DOORBELL) && (local_paca->irq_happened & PACA_IRQ_DBELL)) {
542 + local_paca->irq_happened &= ~PACA_IRQ_DBELL;
543 + if (IS_ENABLED(CONFIG_PPC_BOOK3E))
544 + regs.trap = 0x280;
545 +@@ -245,7 +250,7 @@ again:
546 + }
547 +
548 + /* Book3E does not support soft-masking PMI interrupts */
549 +- if (IS_ENABLED(CONFIG_PPC_BOOK3S) && (happened & PACA_IRQ_PMI)) {
550 ++ if (IS_ENABLED(CONFIG_PPC_BOOK3S) && (local_paca->irq_happened & PACA_IRQ_PMI)) {
551 + local_paca->irq_happened &= ~PACA_IRQ_PMI;
552 + regs.trap = 0xf00;
553 + performance_monitor_exception(&regs);
554 +@@ -253,8 +258,7 @@ again:
555 + hard_irq_disable();
556 + }
557 +
558 +- happened = local_paca->irq_happened;
559 +- if (happened & ~PACA_IRQ_HARD_DIS) {
560 ++ if (local_paca->irq_happened & ~PACA_IRQ_HARD_DIS) {
561 + /*
562 + * We are responding to the next interrupt, so interrupt-off
563 + * latencies should be reset here.
564 +diff --git a/arch/s390/boot/uv.c b/arch/s390/boot/uv.c
565 +index a15c033f53ca4..87641dd65ccf9 100644
566 +--- a/arch/s390/boot/uv.c
567 ++++ b/arch/s390/boot/uv.c
568 +@@ -35,7 +35,7 @@ void uv_query_info(void)
569 + uv_info.guest_cpu_stor_len = uvcb.cpu_stor_len;
570 + uv_info.max_sec_stor_addr = ALIGN(uvcb.max_guest_stor_addr, PAGE_SIZE);
571 + uv_info.max_num_sec_conf = uvcb.max_num_sec_conf;
572 +- uv_info.max_guest_cpus = uvcb.max_guest_cpus;
573 ++ uv_info.max_guest_cpu_id = uvcb.max_guest_cpu_id;
574 + }
575 +
576 + #ifdef CONFIG_PROTECTED_VIRTUALIZATION_GUEST
577 +diff --git a/arch/s390/include/asm/uv.h b/arch/s390/include/asm/uv.h
578 +index 0325fc0469b7b..7b98d4caee779 100644
579 +--- a/arch/s390/include/asm/uv.h
580 ++++ b/arch/s390/include/asm/uv.h
581 +@@ -96,7 +96,7 @@ struct uv_cb_qui {
582 + u32 max_num_sec_conf;
583 + u64 max_guest_stor_addr;
584 + u8 reserved88[158 - 136];
585 +- u16 max_guest_cpus;
586 ++ u16 max_guest_cpu_id;
587 + u8 reserveda0[200 - 160];
588 + } __packed __aligned(8);
589 +
590 +@@ -273,7 +273,7 @@ struct uv_info {
591 + unsigned long guest_cpu_stor_len;
592 + unsigned long max_sec_stor_addr;
593 + unsigned int max_num_sec_conf;
594 +- unsigned short max_guest_cpus;
595 ++ unsigned short max_guest_cpu_id;
596 + };
597 +
598 + extern struct uv_info uv_info;
599 +diff --git a/arch/s390/kernel/uv.c b/arch/s390/kernel/uv.c
600 +index 883bfed9f5c2c..b2d2ad1530676 100644
601 +--- a/arch/s390/kernel/uv.c
602 ++++ b/arch/s390/kernel/uv.c
603 +@@ -368,7 +368,7 @@ static ssize_t uv_query_max_guest_cpus(struct kobject *kobj,
604 + struct kobj_attribute *attr, char *page)
605 + {
606 + return scnprintf(page, PAGE_SIZE, "%d\n",
607 +- uv_info.max_guest_cpus);
608 ++ uv_info.max_guest_cpu_id + 1);
609 + }
610 +
611 + static struct kobj_attribute uv_query_max_guest_cpus_attr =
612 +diff --git a/arch/x86/entry/thunk_64.S b/arch/x86/entry/thunk_64.S
613 +index ccd32877a3c41..c9a9fbf1655f3 100644
614 +--- a/arch/x86/entry/thunk_64.S
615 ++++ b/arch/x86/entry/thunk_64.S
616 +@@ -31,7 +31,7 @@ SYM_FUNC_START_NOALIGN(\name)
617 + .endif
618 +
619 + call \func
620 +- jmp .L_restore
621 ++ jmp __thunk_restore
622 + SYM_FUNC_END(\name)
623 + _ASM_NOKPROBE(\name)
624 + .endm
625 +@@ -44,7 +44,7 @@ SYM_FUNC_END(\name)
626 + #endif
627 +
628 + #ifdef CONFIG_PREEMPTION
629 +-SYM_CODE_START_LOCAL_NOALIGN(.L_restore)
630 ++SYM_CODE_START_LOCAL_NOALIGN(__thunk_restore)
631 + popq %r11
632 + popq %r10
633 + popq %r9
634 +@@ -56,6 +56,6 @@ SYM_CODE_START_LOCAL_NOALIGN(.L_restore)
635 + popq %rdi
636 + popq %rbp
637 + ret
638 +- _ASM_NOKPROBE(.L_restore)
639 +-SYM_CODE_END(.L_restore)
640 ++ _ASM_NOKPROBE(__thunk_restore)
641 ++SYM_CODE_END(__thunk_restore)
642 + #endif
643 +diff --git a/arch/x86/include/asm/idtentry.h b/arch/x86/include/asm/idtentry.h
644 +index b2442eb0ac2f8..eb01c2618a9df 100644
645 +--- a/arch/x86/include/asm/idtentry.h
646 ++++ b/arch/x86/include/asm/idtentry.h
647 +@@ -616,6 +616,7 @@ DECLARE_IDTENTRY_VC(X86_TRAP_VC, exc_vmm_communication);
648 +
649 + #ifdef CONFIG_XEN_PV
650 + DECLARE_IDTENTRY_XENCB(X86_TRAP_OTHER, exc_xen_hypervisor_callback);
651 ++DECLARE_IDTENTRY_RAW(X86_TRAP_OTHER, exc_xen_unknown_trap);
652 + #endif
653 +
654 + /* Device interrupts common/spurious */
655 +diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c
656 +index 9e4c226dbf7d9..65e40acde71aa 100644
657 +--- a/arch/x86/kvm/svm/nested.c
658 ++++ b/arch/x86/kvm/svm/nested.c
659 +@@ -199,6 +199,10 @@ static bool nested_svm_vmrun_msrpm(struct vcpu_svm *svm)
660 + static bool svm_get_nested_state_pages(struct kvm_vcpu *vcpu)
661 + {
662 + struct vcpu_svm *svm = to_svm(vcpu);
663 ++
664 ++ if (WARN_ON(!is_guest_mode(vcpu)))
665 ++ return true;
666 ++
667 + if (!nested_svm_vmrun_msrpm(svm)) {
668 + vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
669 + vcpu->run->internal.suberror =
670 +@@ -595,6 +599,8 @@ int nested_svm_vmexit(struct vcpu_svm *svm)
671 + svm->nested.vmcb12_gpa = 0;
672 + WARN_ON_ONCE(svm->nested.nested_run_pending);
673 +
674 ++ kvm_clear_request(KVM_REQ_GET_NESTED_STATE_PAGES, &svm->vcpu);
675 ++
676 + /* in case we halted in L2 */
677 + svm->vcpu.arch.mp_state = KVM_MP_STATE_RUNNABLE;
678 +
679 +diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
680 +index 89af692deb7ef..f3eca45267781 100644
681 +--- a/arch/x86/kvm/vmx/nested.c
682 ++++ b/arch/x86/kvm/vmx/nested.c
683 +@@ -3123,13 +3123,9 @@ static int nested_vmx_check_vmentry_hw(struct kvm_vcpu *vcpu)
684 + return 0;
685 + }
686 +
687 +-static bool nested_get_vmcs12_pages(struct kvm_vcpu *vcpu)
688 ++static bool nested_get_evmcs_page(struct kvm_vcpu *vcpu)
689 + {
690 +- struct vmcs12 *vmcs12 = get_vmcs12(vcpu);
691 + struct vcpu_vmx *vmx = to_vmx(vcpu);
692 +- struct kvm_host_map *map;
693 +- struct page *page;
694 +- u64 hpa;
695 +
696 + /*
697 + * hv_evmcs may end up being not mapped after migration (when
698 +@@ -3152,6 +3148,17 @@ static bool nested_get_vmcs12_pages(struct kvm_vcpu *vcpu)
699 + }
700 + }
701 +
702 ++ return true;
703 ++}
704 ++
705 ++static bool nested_get_vmcs12_pages(struct kvm_vcpu *vcpu)
706 ++{
707 ++ struct vmcs12 *vmcs12 = get_vmcs12(vcpu);
708 ++ struct vcpu_vmx *vmx = to_vmx(vcpu);
709 ++ struct kvm_host_map *map;
710 ++ struct page *page;
711 ++ u64 hpa;
712 ++
713 + if (nested_cpu_has2(vmcs12, SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES)) {
714 + /*
715 + * Translate L1 physical address to host physical
716 +@@ -3220,6 +3227,18 @@ static bool nested_get_vmcs12_pages(struct kvm_vcpu *vcpu)
717 + exec_controls_setbit(vmx, CPU_BASED_USE_MSR_BITMAPS);
718 + else
719 + exec_controls_clearbit(vmx, CPU_BASED_USE_MSR_BITMAPS);
720 ++
721 ++ return true;
722 ++}
723 ++
724 ++static bool vmx_get_nested_state_pages(struct kvm_vcpu *vcpu)
725 ++{
726 ++ if (!nested_get_evmcs_page(vcpu))
727 ++ return false;
728 ++
729 ++ if (is_guest_mode(vcpu) && !nested_get_vmcs12_pages(vcpu))
730 ++ return false;
731 ++
732 + return true;
733 + }
734 +
735 +@@ -4416,6 +4435,8 @@ void nested_vmx_vmexit(struct kvm_vcpu *vcpu, u32 vm_exit_reason,
736 + /* trying to cancel vmlaunch/vmresume is a bug */
737 + WARN_ON_ONCE(vmx->nested.nested_run_pending);
738 +
739 ++ kvm_clear_request(KVM_REQ_GET_NESTED_STATE_PAGES, vcpu);
740 ++
741 + /* Service the TLB flush request for L2 before switching to L1. */
742 + if (kvm_check_request(KVM_REQ_TLB_FLUSH_CURRENT, vcpu))
743 + kvm_vcpu_flush_tlb_current(vcpu);
744 +@@ -6049,11 +6070,14 @@ static int vmx_get_nested_state(struct kvm_vcpu *vcpu,
745 + if (is_guest_mode(vcpu)) {
746 + sync_vmcs02_to_vmcs12(vcpu, vmcs12);
747 + sync_vmcs02_to_vmcs12_rare(vcpu, vmcs12);
748 +- } else if (!vmx->nested.need_vmcs12_to_shadow_sync) {
749 +- if (vmx->nested.hv_evmcs)
750 +- copy_enlightened_to_vmcs12(vmx);
751 +- else if (enable_shadow_vmcs)
752 +- copy_shadow_to_vmcs12(vmx);
753 ++ } else {
754 ++ copy_vmcs02_to_vmcs12_rare(vcpu, get_vmcs12(vcpu));
755 ++ if (!vmx->nested.need_vmcs12_to_shadow_sync) {
756 ++ if (vmx->nested.hv_evmcs)
757 ++ copy_enlightened_to_vmcs12(vmx);
758 ++ else if (enable_shadow_vmcs)
759 ++ copy_shadow_to_vmcs12(vmx);
760 ++ }
761 + }
762 +
763 + BUILD_BUG_ON(sizeof(user_vmx_nested_state->vmcs12) < VMCS12_SIZE);
764 +@@ -6573,7 +6597,7 @@ struct kvm_x86_nested_ops vmx_nested_ops = {
765 + .hv_timer_pending = nested_vmx_preemption_timer_pending,
766 + .get_state = vmx_get_nested_state,
767 + .set_state = vmx_set_nested_state,
768 +- .get_nested_state_pages = nested_get_vmcs12_pages,
769 ++ .get_nested_state_pages = vmx_get_nested_state_pages,
770 + .write_log_dirty = nested_vmx_write_pml_buffer,
771 + .enable_evmcs = nested_enable_evmcs,
772 + .get_evmcs_version = nested_get_evmcs_version,
773 +diff --git a/arch/x86/kvm/vmx/pmu_intel.c b/arch/x86/kvm/vmx/pmu_intel.c
774 +index a886a47daebda..cdf5f34518f43 100644
775 +--- a/arch/x86/kvm/vmx/pmu_intel.c
776 ++++ b/arch/x86/kvm/vmx/pmu_intel.c
777 +@@ -29,7 +29,7 @@ static struct kvm_event_hw_type_mapping intel_arch_events[] = {
778 + [4] = { 0x2e, 0x41, PERF_COUNT_HW_CACHE_MISSES },
779 + [5] = { 0xc4, 0x00, PERF_COUNT_HW_BRANCH_INSTRUCTIONS },
780 + [6] = { 0xc5, 0x00, PERF_COUNT_HW_BRANCH_MISSES },
781 +- [7] = { 0x00, 0x30, PERF_COUNT_HW_REF_CPU_CYCLES },
782 ++ [7] = { 0x00, 0x03, PERF_COUNT_HW_REF_CPU_CYCLES },
783 + };
784 +
785 + /* mapping between fixed pmc index and intel_arch_events array */
786 +@@ -345,7 +345,9 @@ static void intel_pmu_refresh(struct kvm_vcpu *vcpu)
787 +
788 + pmu->nr_arch_gp_counters = min_t(int, eax.split.num_counters,
789 + x86_pmu.num_counters_gp);
790 ++ eax.split.bit_width = min_t(int, eax.split.bit_width, x86_pmu.bit_width_gp);
791 + pmu->counter_bitmask[KVM_PMC_GP] = ((u64)1 << eax.split.bit_width) - 1;
792 ++ eax.split.mask_length = min_t(int, eax.split.mask_length, x86_pmu.events_mask_len);
793 + pmu->available_event_types = ~entry->ebx &
794 + ((1ull << eax.split.mask_length) - 1);
795 +
796 +@@ -355,6 +357,8 @@ static void intel_pmu_refresh(struct kvm_vcpu *vcpu)
797 + pmu->nr_arch_fixed_counters =
798 + min_t(int, edx.split.num_counters_fixed,
799 + x86_pmu.num_counters_fixed);
800 ++ edx.split.bit_width_fixed = min_t(int,
801 ++ edx.split.bit_width_fixed, x86_pmu.bit_width_fixed);
802 + pmu->counter_bitmask[KVM_PMC_FIXED] =
803 + ((u64)1 << edx.split.bit_width_fixed) - 1;
804 + }
805 +diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
806 +index e545a8a613b19..0a302685e4d62 100644
807 +--- a/arch/x86/kvm/x86.c
808 ++++ b/arch/x86/kvm/x86.c
809 +@@ -105,6 +105,7 @@ static u64 __read_mostly cr4_reserved_bits = CR4_RESERVED_BITS;
810 +
811 + static void update_cr8_intercept(struct kvm_vcpu *vcpu);
812 + static void process_nmi(struct kvm_vcpu *vcpu);
813 ++static void process_smi(struct kvm_vcpu *vcpu);
814 + static void enter_smm(struct kvm_vcpu *vcpu);
815 + static void __kvm_set_rflags(struct kvm_vcpu *vcpu, unsigned long rflags);
816 + static void store_regs(struct kvm_vcpu *vcpu);
817 +@@ -4199,6 +4200,9 @@ static void kvm_vcpu_ioctl_x86_get_vcpu_events(struct kvm_vcpu *vcpu,
818 + {
819 + process_nmi(vcpu);
820 +
821 ++ if (kvm_check_request(KVM_REQ_SMI, vcpu))
822 ++ process_smi(vcpu);
823 ++
824 + /*
825 + * In guest mode, payload delivery should be deferred,
826 + * so that the L1 hypervisor can intercept #PF before
827 +diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c
828 +index 4409306364dc3..9a5a50cdaab59 100644
829 +--- a/arch/x86/xen/enlighten_pv.c
830 ++++ b/arch/x86/xen/enlighten_pv.c
831 +@@ -583,6 +583,13 @@ DEFINE_IDTENTRY_RAW(xenpv_exc_debug)
832 + exc_debug(regs);
833 + }
834 +
835 ++DEFINE_IDTENTRY_RAW(exc_xen_unknown_trap)
836 ++{
837 ++ /* This should never happen and there is no way to handle it. */
838 ++ pr_err("Unknown trap in Xen PV mode.");
839 ++ BUG();
840 ++}
841 ++
842 + struct trap_array_entry {
843 + void (*orig)(void);
844 + void (*xen)(void);
845 +@@ -631,6 +638,7 @@ static bool __ref get_trap_addr(void **addr, unsigned int ist)
846 + {
847 + unsigned int nr;
848 + bool ist_okay = false;
849 ++ bool found = false;
850 +
851 + /*
852 + * Replace trap handler addresses by Xen specific ones.
853 +@@ -645,6 +653,7 @@ static bool __ref get_trap_addr(void **addr, unsigned int ist)
854 + if (*addr == entry->orig) {
855 + *addr = entry->xen;
856 + ist_okay = entry->ist_okay;
857 ++ found = true;
858 + break;
859 + }
860 + }
861 +@@ -655,9 +664,13 @@ static bool __ref get_trap_addr(void **addr, unsigned int ist)
862 + nr = (*addr - (void *)early_idt_handler_array[0]) /
863 + EARLY_IDT_HANDLER_SIZE;
864 + *addr = (void *)xen_early_idt_handler_array[nr];
865 ++ found = true;
866 + }
867 +
868 +- if (WARN_ON(ist != 0 && !ist_okay))
869 ++ if (!found)
870 ++ *addr = (void *)xen_asm_exc_xen_unknown_trap;
871 ++
872 ++ if (WARN_ON(found && ist != 0 && !ist_okay))
873 + return false;
874 +
875 + return true;
876 +diff --git a/arch/x86/xen/xen-asm.S b/arch/x86/xen/xen-asm.S
877 +index 1cb0e84b91610..53cf8aa35032d 100644
878 +--- a/arch/x86/xen/xen-asm.S
879 ++++ b/arch/x86/xen/xen-asm.S
880 +@@ -178,6 +178,7 @@ xen_pv_trap asm_exc_simd_coprocessor_error
881 + #ifdef CONFIG_IA32_EMULATION
882 + xen_pv_trap entry_INT80_compat
883 + #endif
884 ++xen_pv_trap asm_exc_xen_unknown_trap
885 + xen_pv_trap asm_exc_xen_hypervisor_callback
886 +
887 + __INIT
888 +diff --git a/block/blk-mq.h b/block/blk-mq.h
889 +index a52703c98b773..d2359f7cfd5f2 100644
890 +--- a/block/blk-mq.h
891 ++++ b/block/blk-mq.h
892 +@@ -303,7 +303,7 @@ static inline bool hctx_may_queue(struct blk_mq_hw_ctx *hctx,
893 + struct request_queue *q = hctx->queue;
894 + struct blk_mq_tag_set *set = q->tag_set;
895 +
896 +- if (!test_bit(BLK_MQ_S_TAG_ACTIVE, &q->queue_flags))
897 ++ if (!test_bit(QUEUE_FLAG_HCTX_ACTIVE, &q->queue_flags))
898 + return true;
899 + users = atomic_read(&set->active_queues_shared_sbitmap);
900 + } else {
901 +diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c
902 +index 770d84071a328..94f34109695c9 100644
903 +--- a/drivers/acpi/arm64/iort.c
904 ++++ b/drivers/acpi/arm64/iort.c
905 +@@ -1107,6 +1107,11 @@ static int nc_dma_get_range(struct device *dev, u64 *size)
906 +
907 + ncomp = (struct acpi_iort_named_component *)node->node_data;
908 +
909 ++ if (!ncomp->memory_address_limit) {
910 ++ pr_warn(FW_BUG "Named component missing memory address limit\n");
911 ++ return -EINVAL;
912 ++ }
913 ++
914 + *size = ncomp->memory_address_limit >= 64 ? U64_MAX :
915 + 1ULL<<ncomp->memory_address_limit;
916 +
917 +@@ -1126,6 +1131,11 @@ static int rc_dma_get_range(struct device *dev, u64 *size)
918 +
919 + rc = (struct acpi_iort_root_complex *)node->node_data;
920 +
921 ++ if (!rc->memory_address_limit) {
922 ++ pr_warn(FW_BUG "Root complex missing memory address limit\n");
923 ++ return -EINVAL;
924 ++ }
925 ++
926 + *size = rc->memory_address_limit >= 64 ? U64_MAX :
927 + 1ULL<<rc->memory_address_limit;
928 +
929 +@@ -1173,8 +1183,8 @@ void iort_dma_setup(struct device *dev, u64 *dma_addr, u64 *dma_size)
930 + end = dmaaddr + size - 1;
931 + mask = DMA_BIT_MASK(ilog2(end) + 1);
932 + dev->bus_dma_limit = end;
933 +- dev->coherent_dma_mask = mask;
934 +- *dev->dma_mask = mask;
935 ++ dev->coherent_dma_mask = min(dev->coherent_dma_mask, mask);
936 ++ *dev->dma_mask = min(*dev->dma_mask, mask);
937 + }
938 +
939 + *dma_addr = dmaaddr;
940 +diff --git a/drivers/acpi/device_sysfs.c b/drivers/acpi/device_sysfs.c
941 +index 96869f1538b93..bfca116482b8b 100644
942 +--- a/drivers/acpi/device_sysfs.c
943 ++++ b/drivers/acpi/device_sysfs.c
944 +@@ -251,20 +251,12 @@ int __acpi_device_uevent_modalias(struct acpi_device *adev,
945 + if (add_uevent_var(env, "MODALIAS="))
946 + return -ENOMEM;
947 +
948 +- len = create_pnp_modalias(adev, &env->buf[env->buflen - 1],
949 +- sizeof(env->buf) - env->buflen);
950 +- if (len < 0)
951 +- return len;
952 +-
953 +- env->buflen += len;
954 +- if (!adev->data.of_compatible)
955 +- return 0;
956 +-
957 +- if (len > 0 && add_uevent_var(env, "MODALIAS="))
958 +- return -ENOMEM;
959 +-
960 +- len = create_of_modalias(adev, &env->buf[env->buflen - 1],
961 +- sizeof(env->buf) - env->buflen);
962 ++ if (adev->data.of_compatible)
963 ++ len = create_of_modalias(adev, &env->buf[env->buflen - 1],
964 ++ sizeof(env->buf) - env->buflen);
965 ++ else
966 ++ len = create_pnp_modalias(adev, &env->buf[env->buflen - 1],
967 ++ sizeof(env->buf) - env->buflen);
968 + if (len < 0)
969 + return len;
970 +
971 +diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
972 +index 12c0ece746f04..859b1de31ddc0 100644
973 +--- a/drivers/acpi/thermal.c
974 ++++ b/drivers/acpi/thermal.c
975 +@@ -174,6 +174,8 @@ struct acpi_thermal {
976 + struct thermal_zone_device *thermal_zone;
977 + int kelvin_offset; /* in millidegrees */
978 + struct work_struct thermal_check_work;
979 ++ struct mutex thermal_check_lock;
980 ++ refcount_t thermal_check_count;
981 + };
982 +
983 + /* --------------------------------------------------------------------------
984 +@@ -495,14 +497,6 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz)
985 + return 0;
986 + }
987 +
988 +-static void acpi_thermal_check(void *data)
989 +-{
990 +- struct acpi_thermal *tz = data;
991 +-
992 +- thermal_zone_device_update(tz->thermal_zone,
993 +- THERMAL_EVENT_UNSPECIFIED);
994 +-}
995 +-
996 + /* sys I/F for generic thermal sysfs support */
997 +
998 + static int thermal_get_temp(struct thermal_zone_device *thermal, int *temp)
999 +@@ -900,6 +894,12 @@ static void acpi_thermal_unregister_thermal_zone(struct acpi_thermal *tz)
1000 + Driver Interface
1001 + -------------------------------------------------------------------------- */
1002 +
1003 ++static void acpi_queue_thermal_check(struct acpi_thermal *tz)
1004 ++{
1005 ++ if (!work_pending(&tz->thermal_check_work))
1006 ++ queue_work(acpi_thermal_pm_queue, &tz->thermal_check_work);
1007 ++}
1008 ++
1009 + static void acpi_thermal_notify(struct acpi_device *device, u32 event)
1010 + {
1011 + struct acpi_thermal *tz = acpi_driver_data(device);
1012 +@@ -910,17 +910,17 @@ static void acpi_thermal_notify(struct acpi_device *device, u32 event)
1013 +
1014 + switch (event) {
1015 + case ACPI_THERMAL_NOTIFY_TEMPERATURE:
1016 +- acpi_thermal_check(tz);
1017 ++ acpi_queue_thermal_check(tz);
1018 + break;
1019 + case ACPI_THERMAL_NOTIFY_THRESHOLDS:
1020 + acpi_thermal_trips_update(tz, ACPI_TRIPS_REFRESH_THRESHOLDS);
1021 +- acpi_thermal_check(tz);
1022 ++ acpi_queue_thermal_check(tz);
1023 + acpi_bus_generate_netlink_event(device->pnp.device_class,
1024 + dev_name(&device->dev), event, 0);
1025 + break;
1026 + case ACPI_THERMAL_NOTIFY_DEVICES:
1027 + acpi_thermal_trips_update(tz, ACPI_TRIPS_REFRESH_DEVICES);
1028 +- acpi_thermal_check(tz);
1029 ++ acpi_queue_thermal_check(tz);
1030 + acpi_bus_generate_netlink_event(device->pnp.device_class,
1031 + dev_name(&device->dev), event, 0);
1032 + break;
1033 +@@ -1020,7 +1020,25 @@ static void acpi_thermal_check_fn(struct work_struct *work)
1034 + {
1035 + struct acpi_thermal *tz = container_of(work, struct acpi_thermal,
1036 + thermal_check_work);
1037 +- acpi_thermal_check(tz);
1038 ++
1039 ++ /*
1040 ++ * In general, it is not sufficient to check the pending bit, because
1041 ++ * subsequent instances of this function may be queued after one of them
1042 ++ * has started running (e.g. if _TMP sleeps). Avoid bailing out if just
1043 ++ * one of them is running, though, because it may have done the actual
1044 ++ * check some time ago, so allow at least one of them to block on the
1045 ++ * mutex while another one is running the update.
1046 ++ */
1047 ++ if (!refcount_dec_not_one(&tz->thermal_check_count))
1048 ++ return;
1049 ++
1050 ++ mutex_lock(&tz->thermal_check_lock);
1051 ++
1052 ++ thermal_zone_device_update(tz->thermal_zone, THERMAL_EVENT_UNSPECIFIED);
1053 ++
1054 ++ refcount_inc(&tz->thermal_check_count);
1055 ++
1056 ++ mutex_unlock(&tz->thermal_check_lock);
1057 + }
1058 +
1059 + static int acpi_thermal_add(struct acpi_device *device)
1060 +@@ -1052,6 +1070,8 @@ static int acpi_thermal_add(struct acpi_device *device)
1061 + if (result)
1062 + goto free_memory;
1063 +
1064 ++ refcount_set(&tz->thermal_check_count, 3);
1065 ++ mutex_init(&tz->thermal_check_lock);
1066 + INIT_WORK(&tz->thermal_check_work, acpi_thermal_check_fn);
1067 +
1068 + pr_info(PREFIX "%s [%s] (%ld C)\n", acpi_device_name(device),
1069 +@@ -1117,7 +1137,7 @@ static int acpi_thermal_resume(struct device *dev)
1070 + tz->state.active |= tz->trips.active[i].flags.enabled;
1071 + }
1072 +
1073 +- queue_work(acpi_thermal_pm_queue, &tz->thermal_check_work);
1074 ++ acpi_queue_thermal_check(tz);
1075 +
1076 + return AE_OK;
1077 + }
1078 +diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
1079 +index aaae9220f3a00..bd5c04fabdab6 100644
1080 +--- a/drivers/block/nbd.c
1081 ++++ b/drivers/block/nbd.c
1082 +@@ -1029,6 +1029,12 @@ static int nbd_add_socket(struct nbd_device *nbd, unsigned long arg,
1083 + if (!sock)
1084 + return err;
1085 +
1086 ++ /*
1087 ++ * We need to make sure we don't get any errant requests while we're
1088 ++ * reallocating the ->socks array.
1089 ++ */
1090 ++ blk_mq_freeze_queue(nbd->disk->queue);
1091 ++
1092 + if (!netlink && !nbd->task_setup &&
1093 + !test_bit(NBD_RT_BOUND, &config->runtime_flags))
1094 + nbd->task_setup = current;
1095 +@@ -1067,10 +1073,12 @@ static int nbd_add_socket(struct nbd_device *nbd, unsigned long arg,
1096 + nsock->cookie = 0;
1097 + socks[config->num_connections++] = nsock;
1098 + atomic_inc(&config->live_connections);
1099 ++ blk_mq_unfreeze_queue(nbd->disk->queue);
1100 +
1101 + return 0;
1102 +
1103 + put_socket:
1104 ++ blk_mq_unfreeze_queue(nbd->disk->queue);
1105 + sockfd_put(sock);
1106 + return err;
1107 + }
1108 +diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
1109 +index 48629d3433b4c..10078a7435644 100644
1110 +--- a/drivers/block/xen-blkfront.c
1111 ++++ b/drivers/block/xen-blkfront.c
1112 +@@ -945,7 +945,8 @@ static void blkif_set_queue_limits(struct blkfront_info *info)
1113 + if (info->feature_discard) {
1114 + blk_queue_flag_set(QUEUE_FLAG_DISCARD, rq);
1115 + blk_queue_max_discard_sectors(rq, get_capacity(gd));
1116 +- rq->limits.discard_granularity = info->discard_granularity;
1117 ++ rq->limits.discard_granularity = info->discard_granularity ?:
1118 ++ info->physical_sector_size;
1119 + rq->limits.discard_alignment = info->discard_alignment;
1120 + if (info->feature_secdiscard)
1121 + blk_queue_flag_set(QUEUE_FLAG_SECERASE, rq);
1122 +@@ -2179,19 +2180,12 @@ static void blkfront_closing(struct blkfront_info *info)
1123 +
1124 + static void blkfront_setup_discard(struct blkfront_info *info)
1125 + {
1126 +- int err;
1127 +- unsigned int discard_granularity;
1128 +- unsigned int discard_alignment;
1129 +-
1130 + info->feature_discard = 1;
1131 +- err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
1132 +- "discard-granularity", "%u", &discard_granularity,
1133 +- "discard-alignment", "%u", &discard_alignment,
1134 +- NULL);
1135 +- if (!err) {
1136 +- info->discard_granularity = discard_granularity;
1137 +- info->discard_alignment = discard_alignment;
1138 +- }
1139 ++ info->discard_granularity = xenbus_read_unsigned(info->xbdev->otherend,
1140 ++ "discard-granularity",
1141 ++ 0);
1142 ++ info->discard_alignment = xenbus_read_unsigned(info->xbdev->otherend,
1143 ++ "discard-alignment", 0);
1144 + info->feature_secdiscard =
1145 + !!xenbus_read_unsigned(info->xbdev->otherend, "discard-secure",
1146 + 0);
1147 +diff --git a/drivers/clk/imx/Kconfig b/drivers/clk/imx/Kconfig
1148 +index 3061896503f30..47d9ec3abd2f7 100644
1149 +--- a/drivers/clk/imx/Kconfig
1150 ++++ b/drivers/clk/imx/Kconfig
1151 +@@ -6,8 +6,6 @@ config MXC_CLK
1152 +
1153 + config MXC_CLK_SCU
1154 + tristate
1155 +- depends on ARCH_MXC
1156 +- depends on IMX_SCU && HAVE_ARM_SMCCC
1157 +
1158 + config CLK_IMX1
1159 + def_bool SOC_IMX1
1160 +diff --git a/drivers/clk/mmp/clk-audio.c b/drivers/clk/mmp/clk-audio.c
1161 +index eea69d498bd27..7aa7f4a9564fd 100644
1162 +--- a/drivers/clk/mmp/clk-audio.c
1163 ++++ b/drivers/clk/mmp/clk-audio.c
1164 +@@ -392,7 +392,8 @@ static int mmp2_audio_clk_remove(struct platform_device *pdev)
1165 + return 0;
1166 + }
1167 +
1168 +-static int __maybe_unused mmp2_audio_clk_suspend(struct device *dev)
1169 ++#ifdef CONFIG_PM
1170 ++static int mmp2_audio_clk_suspend(struct device *dev)
1171 + {
1172 + struct mmp2_audio_clk *priv = dev_get_drvdata(dev);
1173 +
1174 +@@ -404,7 +405,7 @@ static int __maybe_unused mmp2_audio_clk_suspend(struct device *dev)
1175 + return 0;
1176 + }
1177 +
1178 +-static int __maybe_unused mmp2_audio_clk_resume(struct device *dev)
1179 ++static int mmp2_audio_clk_resume(struct device *dev)
1180 + {
1181 + struct mmp2_audio_clk *priv = dev_get_drvdata(dev);
1182 +
1183 +@@ -415,6 +416,7 @@ static int __maybe_unused mmp2_audio_clk_resume(struct device *dev)
1184 +
1185 + return 0;
1186 + }
1187 ++#endif
1188 +
1189 + static const struct dev_pm_ops mmp2_audio_clk_pm_ops = {
1190 + SET_RUNTIME_PM_OPS(mmp2_audio_clk_suspend, mmp2_audio_clk_resume, NULL)
1191 +diff --git a/drivers/clk/qcom/gcc-sm8250.c b/drivers/clk/qcom/gcc-sm8250.c
1192 +index 6cb6617b8d88c..ab594a0f0c408 100644
1193 +--- a/drivers/clk/qcom/gcc-sm8250.c
1194 ++++ b/drivers/clk/qcom/gcc-sm8250.c
1195 +@@ -722,7 +722,7 @@ static struct clk_rcg2 gcc_sdcc2_apps_clk_src = {
1196 + .name = "gcc_sdcc2_apps_clk_src",
1197 + .parent_data = gcc_parent_data_4,
1198 + .num_parents = 5,
1199 +- .ops = &clk_rcg2_ops,
1200 ++ .ops = &clk_rcg2_floor_ops,
1201 + },
1202 + };
1203 +
1204 +@@ -745,7 +745,7 @@ static struct clk_rcg2 gcc_sdcc4_apps_clk_src = {
1205 + .name = "gcc_sdcc4_apps_clk_src",
1206 + .parent_data = gcc_parent_data_0,
1207 + .num_parents = 3,
1208 +- .ops = &clk_rcg2_ops,
1209 ++ .ops = &clk_rcg2_floor_ops,
1210 + },
1211 + };
1212 +
1213 +diff --git a/drivers/crypto/marvell/cesa/cesa.h b/drivers/crypto/marvell/cesa/cesa.h
1214 +index fabfaaccca872..fa56b45620c79 100644
1215 +--- a/drivers/crypto/marvell/cesa/cesa.h
1216 ++++ b/drivers/crypto/marvell/cesa/cesa.h
1217 +@@ -300,11 +300,11 @@ struct mv_cesa_tdma_desc {
1218 + __le32 byte_cnt;
1219 + union {
1220 + __le32 src;
1221 +- dma_addr_t src_dma;
1222 ++ u32 src_dma;
1223 + };
1224 + union {
1225 + __le32 dst;
1226 +- dma_addr_t dst_dma;
1227 ++ u32 dst_dma;
1228 + };
1229 + __le32 next_dma;
1230 +
1231 +diff --git a/drivers/firmware/efi/apple-properties.c b/drivers/firmware/efi/apple-properties.c
1232 +index 34f53d898acb0..e1926483ae2fd 100644
1233 +--- a/drivers/firmware/efi/apple-properties.c
1234 ++++ b/drivers/firmware/efi/apple-properties.c
1235 +@@ -3,8 +3,9 @@
1236 + * apple-properties.c - EFI device properties on Macs
1237 + * Copyright (C) 2016 Lukas Wunner <lukas@××××××.de>
1238 + *
1239 +- * Note, all properties are considered as u8 arrays.
1240 +- * To get a value of any of them the caller must use device_property_read_u8_array().
1241 ++ * Properties are stored either as:
1242 ++ * u8 arrays which can be retrieved with device_property_read_u8_array() or
1243 ++ * booleans which can be queried with device_property_present().
1244 + */
1245 +
1246 + #define pr_fmt(fmt) "apple-properties: " fmt
1247 +@@ -88,8 +89,12 @@ static void __init unmarshal_key_value_pairs(struct dev_header *dev_header,
1248 +
1249 + entry_data = ptr + key_len + sizeof(val_len);
1250 + entry_len = val_len - sizeof(val_len);
1251 +- entry[i] = PROPERTY_ENTRY_U8_ARRAY_LEN(key, entry_data,
1252 +- entry_len);
1253 ++ if (entry_len)
1254 ++ entry[i] = PROPERTY_ENTRY_U8_ARRAY_LEN(key, entry_data,
1255 ++ entry_len);
1256 ++ else
1257 ++ entry[i] = PROPERTY_ENTRY_BOOL(key);
1258 ++
1259 + if (dump_properties) {
1260 + dev_info(dev, "property: %s\n", key);
1261 + print_hex_dump(KERN_INFO, pr_fmt(), DUMP_PREFIX_OFFSET,
1262 +diff --git a/drivers/firmware/imx/Kconfig b/drivers/firmware/imx/Kconfig
1263 +index 1d2e5b85d7ca8..c027d99f2a599 100644
1264 +--- a/drivers/firmware/imx/Kconfig
1265 ++++ b/drivers/firmware/imx/Kconfig
1266 +@@ -13,6 +13,7 @@ config IMX_DSP
1267 + config IMX_SCU
1268 + bool "IMX SCU Protocol driver"
1269 + depends on IMX_MBOX
1270 ++ select SOC_BUS
1271 + help
1272 + The System Controller Firmware (SCFW) is a low-level system function
1273 + which runs on a dedicated Cortex-M core to provide power, clock, and
1274 +diff --git a/drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h b/drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h
1275 +index 44fd0cd069de6..95d0f18ed0c56 100644
1276 +--- a/drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h
1277 ++++ b/drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h
1278 +@@ -575,6 +575,7 @@ struct pptable_funcs {
1279 + int (*conv_power_profile_to_pplib_workload)(int power_profile);
1280 + uint32_t (*get_fan_control_mode)(struct smu_context *smu);
1281 + int (*set_fan_control_mode)(struct smu_context *smu, uint32_t mode);
1282 ++ int (*set_fan_speed_percent)(struct smu_context *smu, uint32_t speed);
1283 + int (*set_fan_speed_rpm)(struct smu_context *smu, uint32_t speed);
1284 + int (*set_xgmi_pstate)(struct smu_context *smu, uint32_t pstate);
1285 + int (*gfx_off_control)(struct smu_context *smu, bool enable);
1286 +diff --git a/drivers/gpu/drm/amd/pm/inc/smu_v11_0.h b/drivers/gpu/drm/amd/pm/inc/smu_v11_0.h
1287 +index 2d1c3babaa3a0..0046f1c26fc2d 100644
1288 +--- a/drivers/gpu/drm/amd/pm/inc/smu_v11_0.h
1289 ++++ b/drivers/gpu/drm/amd/pm/inc/smu_v11_0.h
1290 +@@ -200,6 +200,9 @@ int
1291 + smu_v11_0_set_fan_control_mode(struct smu_context *smu,
1292 + uint32_t mode);
1293 +
1294 ++int
1295 ++smu_v11_0_set_fan_speed_percent(struct smu_context *smu, uint32_t speed);
1296 ++
1297 + int smu_v11_0_set_fan_speed_rpm(struct smu_context *smu,
1298 + uint32_t speed);
1299 +
1300 +diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
1301 +index b1e5ec01527b8..5cc45b1cff7e7 100644
1302 +--- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
1303 ++++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
1304 +@@ -2255,19 +2255,14 @@ int smu_get_fan_speed_percent(struct smu_context *smu, uint32_t *speed)
1305 + int smu_set_fan_speed_percent(struct smu_context *smu, uint32_t speed)
1306 + {
1307 + int ret = 0;
1308 +- uint32_t rpm;
1309 +
1310 + if (!smu->pm_enabled || !smu->adev->pm.dpm_enabled)
1311 + return -EOPNOTSUPP;
1312 +
1313 + mutex_lock(&smu->mutex);
1314 +
1315 +- if (smu->ppt_funcs->set_fan_speed_rpm) {
1316 +- if (speed > 100)
1317 +- speed = 100;
1318 +- rpm = speed * smu->fan_max_rpm / 100;
1319 +- ret = smu->ppt_funcs->set_fan_speed_rpm(smu, rpm);
1320 +- }
1321 ++ if (smu->ppt_funcs->set_fan_speed_percent)
1322 ++ ret = smu->ppt_funcs->set_fan_speed_percent(smu, speed);
1323 +
1324 + mutex_unlock(&smu->mutex);
1325 +
1326 +diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c
1327 +index fc376281e629a..1c526cb239e03 100644
1328 +--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c
1329 ++++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c
1330 +@@ -2366,6 +2366,7 @@ static const struct pptable_funcs arcturus_ppt_funcs = {
1331 + .display_clock_voltage_request = smu_v11_0_display_clock_voltage_request,
1332 + .get_fan_control_mode = smu_v11_0_get_fan_control_mode,
1333 + .set_fan_control_mode = smu_v11_0_set_fan_control_mode,
1334 ++ .set_fan_speed_percent = smu_v11_0_set_fan_speed_percent,
1335 + .set_fan_speed_rpm = smu_v11_0_set_fan_speed_rpm,
1336 + .set_xgmi_pstate = smu_v11_0_set_xgmi_pstate,
1337 + .gfx_off_control = smu_v11_0_gfx_off_control,
1338 +diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
1339 +index ef1a62e86a0ee..f2c8719b8395e 100644
1340 +--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
1341 ++++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
1342 +@@ -2710,6 +2710,7 @@ static const struct pptable_funcs navi10_ppt_funcs = {
1343 + .display_clock_voltage_request = smu_v11_0_display_clock_voltage_request,
1344 + .get_fan_control_mode = smu_v11_0_get_fan_control_mode,
1345 + .set_fan_control_mode = smu_v11_0_set_fan_control_mode,
1346 ++ .set_fan_speed_percent = smu_v11_0_set_fan_speed_percent,
1347 + .set_fan_speed_rpm = smu_v11_0_set_fan_speed_rpm,
1348 + .set_xgmi_pstate = smu_v11_0_set_xgmi_pstate,
1349 + .gfx_off_control = smu_v11_0_gfx_off_control,
1350 +diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c
1351 +index cf7c4f0e0a0b5..31da8fae6fa9d 100644
1352 +--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c
1353 ++++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c
1354 +@@ -2776,6 +2776,7 @@ static const struct pptable_funcs sienna_cichlid_ppt_funcs = {
1355 + .display_clock_voltage_request = smu_v11_0_display_clock_voltage_request,
1356 + .get_fan_control_mode = smu_v11_0_get_fan_control_mode,
1357 + .set_fan_control_mode = smu_v11_0_set_fan_control_mode,
1358 ++ .set_fan_speed_percent = smu_v11_0_set_fan_speed_percent,
1359 + .set_fan_speed_rpm = smu_v11_0_set_fan_speed_rpm,
1360 + .set_xgmi_pstate = smu_v11_0_set_xgmi_pstate,
1361 + .gfx_off_control = smu_v11_0_gfx_off_control,
1362 +diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
1363 +index 6db96fa1df092..e646f5931d795 100644
1364 +--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
1365 ++++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
1366 +@@ -1122,6 +1122,35 @@ smu_v11_0_set_fan_static_mode(struct smu_context *smu, uint32_t mode)
1367 + return 0;
1368 + }
1369 +
1370 ++int
1371 ++smu_v11_0_set_fan_speed_percent(struct smu_context *smu, uint32_t speed)
1372 ++{
1373 ++ struct amdgpu_device *adev = smu->adev;
1374 ++ uint32_t duty100, duty;
1375 ++ uint64_t tmp64;
1376 ++
1377 ++ if (speed > 100)
1378 ++ speed = 100;
1379 ++
1380 ++ if (smu_v11_0_auto_fan_control(smu, 0))
1381 ++ return -EINVAL;
1382 ++
1383 ++ duty100 = REG_GET_FIELD(RREG32_SOC15(THM, 0, mmCG_FDO_CTRL1),
1384 ++ CG_FDO_CTRL1, FMAX_DUTY100);
1385 ++ if (!duty100)
1386 ++ return -EINVAL;
1387 ++
1388 ++ tmp64 = (uint64_t)speed * duty100;
1389 ++ do_div(tmp64, 100);
1390 ++ duty = (uint32_t)tmp64;
1391 ++
1392 ++ WREG32_SOC15(THM, 0, mmCG_FDO_CTRL0,
1393 ++ REG_SET_FIELD(RREG32_SOC15(THM, 0, mmCG_FDO_CTRL0),
1394 ++ CG_FDO_CTRL0, FDO_STATIC_DUTY, duty));
1395 ++
1396 ++ return smu_v11_0_set_fan_static_mode(smu, FDO_PWM_MODE_STATIC);
1397 ++}
1398 ++
1399 + int
1400 + smu_v11_0_set_fan_control_mode(struct smu_context *smu,
1401 + uint32_t mode)
1402 +@@ -1130,7 +1159,7 @@ smu_v11_0_set_fan_control_mode(struct smu_context *smu,
1403 +
1404 + switch (mode) {
1405 + case AMD_FAN_CTRL_NONE:
1406 +- ret = smu_v11_0_set_fan_speed_rpm(smu, smu->fan_max_rpm);
1407 ++ ret = smu_v11_0_set_fan_speed_percent(smu, 100);
1408 + break;
1409 + case AMD_FAN_CTRL_MANUAL:
1410 + ret = smu_v11_0_auto_fan_control(smu, 0);
1411 +diff --git a/drivers/gpu/drm/i915/gt/gen7_renderclear.c b/drivers/gpu/drm/i915/gt/gen7_renderclear.c
1412 +index 94465374ca2fe..e961ad6a31294 100644
1413 +--- a/drivers/gpu/drm/i915/gt/gen7_renderclear.c
1414 ++++ b/drivers/gpu/drm/i915/gt/gen7_renderclear.c
1415 +@@ -390,6 +390,16 @@ static void emit_batch(struct i915_vma * const vma,
1416 + &cb_kernel_ivb,
1417 + desc_count);
1418 +
1419 ++ /* Reset inherited context registers */
1420 ++ gen7_emit_pipeline_invalidate(&cmds);
1421 ++ batch_add(&cmds, MI_LOAD_REGISTER_IMM(2));
1422 ++ batch_add(&cmds, i915_mmio_reg_offset(CACHE_MODE_0_GEN7));
1423 ++ batch_add(&cmds, 0xffff0000);
1424 ++ batch_add(&cmds, i915_mmio_reg_offset(CACHE_MODE_1));
1425 ++ batch_add(&cmds, 0xffff0000 | PIXEL_SUBSPAN_COLLECT_OPT_DISABLE);
1426 ++ gen7_emit_pipeline_flush(&cmds);
1427 ++
1428 ++ /* Switch to the media pipeline and our base address */
1429 + gen7_emit_pipeline_invalidate(&cmds);
1430 + batch_add(&cmds, PIPELINE_SELECT | PIPELINE_SELECT_MEDIA);
1431 + batch_add(&cmds, MI_NOOP);
1432 +@@ -399,9 +409,11 @@ static void emit_batch(struct i915_vma * const vma,
1433 + gen7_emit_state_base_address(&cmds, descriptors);
1434 + gen7_emit_pipeline_invalidate(&cmds);
1435 +
1436 ++ /* Set the clear-residual kernel state */
1437 + gen7_emit_vfe_state(&cmds, bv, urb_size - 1, 0, 0);
1438 + gen7_emit_interface_descriptor_load(&cmds, descriptors, desc_count);
1439 +
1440 ++ /* Execute the kernel on all HW threads */
1441 + for (i = 0; i < num_primitives(bv); i++)
1442 + gen7_emit_media_object(&cmds, i);
1443 +
1444 +diff --git a/drivers/gpu/drm/i915/gt/intel_ggtt.c b/drivers/gpu/drm/i915/gt/intel_ggtt.c
1445 +index 81c05f551b9c8..060f826b1d52e 100644
1446 +--- a/drivers/gpu/drm/i915/gt/intel_ggtt.c
1447 ++++ b/drivers/gpu/drm/i915/gt/intel_ggtt.c
1448 +@@ -526,16 +526,39 @@ static int init_ggtt(struct i915_ggtt *ggtt)
1449 +
1450 + mutex_init(&ggtt->error_mutex);
1451 + if (ggtt->mappable_end) {
1452 +- /* Reserve a mappable slot for our lockless error capture */
1453 +- ret = drm_mm_insert_node_in_range(&ggtt->vm.mm,
1454 +- &ggtt->error_capture,
1455 +- PAGE_SIZE, 0,
1456 +- I915_COLOR_UNEVICTABLE,
1457 +- 0, ggtt->mappable_end,
1458 +- DRM_MM_INSERT_LOW);
1459 +- if (ret)
1460 +- return ret;
1461 ++ /*
1462 ++ * Reserve a mappable slot for our lockless error capture.
1463 ++ *
1464 ++ * We strongly prefer taking address 0x0 in order to protect
1465 ++ * other critical buffers against accidental overwrites,
1466 ++ * as writing to address 0 is a very common mistake.
1467 ++ *
1468 ++ * Since 0 may already be in use by the system (e.g. the BIOS
1469 ++ * framebuffer), we let the reservation fail quietly and hope
1470 ++ * 0 remains reserved always.
1471 ++ *
1472 ++ * If we fail to reserve 0, and then fail to find any space
1473 ++ * for an error-capture, remain silent. We can afford not
1474 ++ * to reserve an error_capture node as we have fallback
1475 ++ * paths, and we trust that 0 will remain reserved. However,
1476 ++ * the only likely reason for failure to insert is a driver
1477 ++ * bug, which we expect to cause other failures...
1478 ++ */
1479 ++ ggtt->error_capture.size = I915_GTT_PAGE_SIZE;
1480 ++ ggtt->error_capture.color = I915_COLOR_UNEVICTABLE;
1481 ++ if (drm_mm_reserve_node(&ggtt->vm.mm, &ggtt->error_capture))
1482 ++ drm_mm_insert_node_in_range(&ggtt->vm.mm,
1483 ++ &ggtt->error_capture,
1484 ++ ggtt->error_capture.size, 0,
1485 ++ ggtt->error_capture.color,
1486 ++ 0, ggtt->mappable_end,
1487 ++ DRM_MM_INSERT_LOW);
1488 + }
1489 ++ if (drm_mm_node_allocated(&ggtt->error_capture))
1490 ++ drm_dbg(&ggtt->vm.i915->drm,
1491 ++ "Reserved GGTT:[%llx, %llx] for use by error capture\n",
1492 ++ ggtt->error_capture.start,
1493 ++ ggtt->error_capture.start + ggtt->error_capture.size);
1494 +
1495 + /*
1496 + * The upper portion of the GuC address space has a sizeable hole
1497 +@@ -548,9 +571,9 @@ static int init_ggtt(struct i915_ggtt *ggtt)
1498 +
1499 + /* Clear any non-preallocated blocks */
1500 + drm_mm_for_each_hole(entry, &ggtt->vm.mm, hole_start, hole_end) {
1501 +- drm_dbg_kms(&ggtt->vm.i915->drm,
1502 +- "clearing unused GTT space: [%lx, %lx]\n",
1503 +- hole_start, hole_end);
1504 ++ drm_dbg(&ggtt->vm.i915->drm,
1505 ++ "clearing unused GTT space: [%lx, %lx]\n",
1506 ++ hole_start, hole_end);
1507 + ggtt->vm.clear_range(&ggtt->vm, hole_start,
1508 + hole_end - hole_start);
1509 + }
1510 +diff --git a/drivers/gpu/drm/i915/i915_active.c b/drivers/gpu/drm/i915/i915_active.c
1511 +index 10a865f3dc09a..9ed19b8bca600 100644
1512 +--- a/drivers/gpu/drm/i915/i915_active.c
1513 ++++ b/drivers/gpu/drm/i915/i915_active.c
1514 +@@ -631,24 +631,26 @@ static int flush_lazy_signals(struct i915_active *ref)
1515 +
1516 + int __i915_active_wait(struct i915_active *ref, int state)
1517 + {
1518 +- int err;
1519 +-
1520 + might_sleep();
1521 +
1522 +- if (!i915_active_acquire_if_busy(ref))
1523 +- return 0;
1524 +-
1525 + /* Any fence added after the wait begins will not be auto-signaled */
1526 +- err = flush_lazy_signals(ref);
1527 +- i915_active_release(ref);
1528 +- if (err)
1529 +- return err;
1530 ++ if (i915_active_acquire_if_busy(ref)) {
1531 ++ int err;
1532 +
1533 +- if (!i915_active_is_idle(ref) &&
1534 +- ___wait_var_event(ref, i915_active_is_idle(ref),
1535 +- state, 0, 0, schedule()))
1536 +- return -EINTR;
1537 ++ err = flush_lazy_signals(ref);
1538 ++ i915_active_release(ref);
1539 ++ if (err)
1540 ++ return err;
1541 +
1542 ++ if (___wait_var_event(ref, i915_active_is_idle(ref),
1543 ++ state, 0, 0, schedule()))
1544 ++ return -EINTR;
1545 ++ }
1546 ++
1547 ++ /*
1548 ++ * After the wait is complete, the caller may free the active.
1549 ++ * We have to flush any concurrent retirement before returning.
1550 ++ */
1551 + flush_work(&ref->work);
1552 + return 0;
1553 + }
1554 +diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
1555 +index 83f4af097b858..fa830e77bb648 100644
1556 +--- a/drivers/gpu/drm/i915/i915_drv.h
1557 ++++ b/drivers/gpu/drm/i915/i915_drv.h
1558 +@@ -1347,7 +1347,7 @@ intel_subplatform(const struct intel_runtime_info *info, enum intel_platform p)
1559 + {
1560 + const unsigned int pi = __platform_mask_index(info, p);
1561 +
1562 +- return info->platform_mask[pi] & INTEL_SUBPLATFORM_BITS;
1563 ++ return info->platform_mask[pi] & ((1 << INTEL_SUBPLATFORM_BITS) - 1);
1564 + }
1565 +
1566 + static __always_inline bool
1567 +diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c
1568 +index 69c0fa20eba17..3c9ac6649ead3 100644
1569 +--- a/drivers/gpu/drm/i915/i915_pmu.c
1570 ++++ b/drivers/gpu/drm/i915/i915_pmu.c
1571 +@@ -184,13 +184,24 @@ static u64 get_rc6(struct intel_gt *gt)
1572 + return val;
1573 + }
1574 +
1575 +-static void park_rc6(struct drm_i915_private *i915)
1576 ++static void init_rc6(struct i915_pmu *pmu)
1577 + {
1578 +- struct i915_pmu *pmu = &i915->pmu;
1579 ++ struct drm_i915_private *i915 = container_of(pmu, typeof(*i915), pmu);
1580 ++ intel_wakeref_t wakeref;
1581 +
1582 +- if (pmu->enable & config_enabled_mask(I915_PMU_RC6_RESIDENCY))
1583 ++ with_intel_runtime_pm(i915->gt.uncore->rpm, wakeref) {
1584 + pmu->sample[__I915_SAMPLE_RC6].cur = __get_rc6(&i915->gt);
1585 ++ pmu->sample[__I915_SAMPLE_RC6_LAST_REPORTED].cur =
1586 ++ pmu->sample[__I915_SAMPLE_RC6].cur;
1587 ++ pmu->sleep_last = ktime_get();
1588 ++ }
1589 ++}
1590 +
1591 ++static void park_rc6(struct drm_i915_private *i915)
1592 ++{
1593 ++ struct i915_pmu *pmu = &i915->pmu;
1594 ++
1595 ++ pmu->sample[__I915_SAMPLE_RC6].cur = __get_rc6(&i915->gt);
1596 + pmu->sleep_last = ktime_get();
1597 + }
1598 +
1599 +@@ -201,6 +212,7 @@ static u64 get_rc6(struct intel_gt *gt)
1600 + return __get_rc6(gt);
1601 + }
1602 +
1603 ++static void init_rc6(struct i915_pmu *pmu) { }
1604 + static void park_rc6(struct drm_i915_private *i915) {}
1605 +
1606 + #endif
1607 +@@ -613,10 +625,8 @@ static void i915_pmu_enable(struct perf_event *event)
1608 + container_of(event->pmu, typeof(*i915), pmu.base);
1609 + unsigned int bit = event_enabled_bit(event);
1610 + struct i915_pmu *pmu = &i915->pmu;
1611 +- intel_wakeref_t wakeref;
1612 + unsigned long flags;
1613 +
1614 +- wakeref = intel_runtime_pm_get(&i915->runtime_pm);
1615 + spin_lock_irqsave(&pmu->lock, flags);
1616 +
1617 + /*
1618 +@@ -627,13 +637,6 @@ static void i915_pmu_enable(struct perf_event *event)
1619 + GEM_BUG_ON(bit >= ARRAY_SIZE(pmu->enable_count));
1620 + GEM_BUG_ON(pmu->enable_count[bit] == ~0);
1621 +
1622 +- if (pmu->enable_count[bit] == 0 &&
1623 +- config_enabled_mask(I915_PMU_RC6_RESIDENCY) & BIT_ULL(bit)) {
1624 +- pmu->sample[__I915_SAMPLE_RC6_LAST_REPORTED].cur = 0;
1625 +- pmu->sample[__I915_SAMPLE_RC6].cur = __get_rc6(&i915->gt);
1626 +- pmu->sleep_last = ktime_get();
1627 +- }
1628 +-
1629 + pmu->enable |= BIT_ULL(bit);
1630 + pmu->enable_count[bit]++;
1631 +
1632 +@@ -674,8 +677,6 @@ static void i915_pmu_enable(struct perf_event *event)
1633 + * an existing non-zero value.
1634 + */
1635 + local64_set(&event->hw.prev_count, __i915_pmu_event_read(event));
1636 +-
1637 +- intel_runtime_pm_put(&i915->runtime_pm, wakeref);
1638 + }
1639 +
1640 + static void i915_pmu_disable(struct perf_event *event)
1641 +@@ -1101,6 +1102,7 @@ void i915_pmu_register(struct drm_i915_private *i915)
1642 + hrtimer_init(&pmu->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
1643 + pmu->timer.function = i915_sample;
1644 + pmu->cpuhp.slot = CPUHP_INVALID;
1645 ++ init_rc6(pmu);
1646 +
1647 + if (!is_igp(i915)) {
1648 + pmu->name = kasprintf(GFP_KERNEL,
1649 +diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
1650 +index c53a222e3dece..713770fb2b92d 100644
1651 +--- a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
1652 ++++ b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
1653 +@@ -1880,7 +1880,7 @@ static int igt_cs_tlb(void *arg)
1654 + vma = i915_vma_instance(out, vm, NULL);
1655 + if (IS_ERR(vma)) {
1656 + err = PTR_ERR(vma);
1657 +- goto out_put_batch;
1658 ++ goto out_put_out;
1659 + }
1660 +
1661 + err = i915_vma_pin(vma, 0, 0,
1662 +diff --git a/drivers/gpu/drm/nouveau/dispnv50/base507c.c b/drivers/gpu/drm/nouveau/dispnv50/base507c.c
1663 +index 302d4e6fc52f1..788db043a3429 100644
1664 +--- a/drivers/gpu/drm/nouveau/dispnv50/base507c.c
1665 ++++ b/drivers/gpu/drm/nouveau/dispnv50/base507c.c
1666 +@@ -88,7 +88,11 @@ base507c_image_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
1667 + NVVAL(NV507C, SET_CONVERSION, OFS, 0x64));
1668 + } else {
1669 + PUSH_MTHD(push, NV507C, SET_PROCESSING,
1670 +- NVDEF(NV507C, SET_PROCESSING, USE_GAIN_OFS, DISABLE));
1671 ++ NVDEF(NV507C, SET_PROCESSING, USE_GAIN_OFS, DISABLE),
1672 ++
1673 ++ SET_CONVERSION,
1674 ++ NVVAL(NV507C, SET_CONVERSION, GAIN, 0) |
1675 ++ NVVAL(NV507C, SET_CONVERSION, OFS, 0));
1676 + }
1677 +
1678 + PUSH_MTHD(push, NV507C, SURFACE_SET_OFFSET(0, 0), asyw->image.offset[0] >> 8);
1679 +diff --git a/drivers/gpu/drm/nouveau/dispnv50/base827c.c b/drivers/gpu/drm/nouveau/dispnv50/base827c.c
1680 +index 18d34096f1258..093d4ba6910ec 100644
1681 +--- a/drivers/gpu/drm/nouveau/dispnv50/base827c.c
1682 ++++ b/drivers/gpu/drm/nouveau/dispnv50/base827c.c
1683 +@@ -49,7 +49,11 @@ base827c_image_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
1684 + NVVAL(NV827C, SET_CONVERSION, OFS, 0x64));
1685 + } else {
1686 + PUSH_MTHD(push, NV827C, SET_PROCESSING,
1687 +- NVDEF(NV827C, SET_PROCESSING, USE_GAIN_OFS, DISABLE));
1688 ++ NVDEF(NV827C, SET_PROCESSING, USE_GAIN_OFS, DISABLE),
1689 ++
1690 ++ SET_CONVERSION,
1691 ++ NVVAL(NV827C, SET_CONVERSION, GAIN, 0) |
1692 ++ NVVAL(NV827C, SET_CONVERSION, OFS, 0));
1693 + }
1694 +
1695 + PUSH_MTHD(push, NV827C, SURFACE_SET_OFFSET(0, 0), asyw->image.offset[0] >> 8,
1696 +diff --git a/drivers/gpu/drm/nouveau/dispnv50/head917d.c b/drivers/gpu/drm/nouveau/dispnv50/head917d.c
1697 +index a5d8274036609..ea9f8667305ec 100644
1698 +--- a/drivers/gpu/drm/nouveau/dispnv50/head917d.c
1699 ++++ b/drivers/gpu/drm/nouveau/dispnv50/head917d.c
1700 +@@ -22,6 +22,7 @@
1701 + #include "head.h"
1702 + #include "core.h"
1703 +
1704 ++#include "nvif/push.h"
1705 + #include <nvif/push507c.h>
1706 +
1707 + #include <nvhw/class/cl917d.h>
1708 +@@ -73,6 +74,31 @@ head917d_base(struct nv50_head *head, struct nv50_head_atom *asyh)
1709 + return 0;
1710 + }
1711 +
1712 ++static int
1713 ++head917d_curs_set(struct nv50_head *head, struct nv50_head_atom *asyh)
1714 ++{
1715 ++ struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push;
1716 ++ const int i = head->base.index;
1717 ++ int ret;
1718 ++
1719 ++ ret = PUSH_WAIT(push, 5);
1720 ++ if (ret)
1721 ++ return ret;
1722 ++
1723 ++ PUSH_MTHD(push, NV917D, HEAD_SET_CONTROL_CURSOR(i),
1724 ++ NVDEF(NV917D, HEAD_SET_CONTROL_CURSOR, ENABLE, ENABLE) |
1725 ++ NVVAL(NV917D, HEAD_SET_CONTROL_CURSOR, FORMAT, asyh->curs.format) |
1726 ++ NVVAL(NV917D, HEAD_SET_CONTROL_CURSOR, SIZE, asyh->curs.layout) |
1727 ++ NVVAL(NV917D, HEAD_SET_CONTROL_CURSOR, HOT_SPOT_X, 0) |
1728 ++ NVVAL(NV917D, HEAD_SET_CONTROL_CURSOR, HOT_SPOT_Y, 0) |
1729 ++ NVDEF(NV917D, HEAD_SET_CONTROL_CURSOR, COMPOSITION, ALPHA_BLEND),
1730 ++
1731 ++ HEAD_SET_OFFSET_CURSOR(i), asyh->curs.offset >> 8);
1732 ++
1733 ++ PUSH_MTHD(push, NV917D, HEAD_SET_CONTEXT_DMA_CURSOR(i), asyh->curs.handle);
1734 ++ return 0;
1735 ++}
1736 ++
1737 + int
1738 + head917d_curs_layout(struct nv50_head *head, struct nv50_wndw_atom *asyw,
1739 + struct nv50_head_atom *asyh)
1740 +@@ -101,7 +127,7 @@ head917d = {
1741 + .core_clr = head907d_core_clr,
1742 + .curs_layout = head917d_curs_layout,
1743 + .curs_format = head507d_curs_format,
1744 +- .curs_set = head907d_curs_set,
1745 ++ .curs_set = head917d_curs_set,
1746 + .curs_clr = head907d_curs_clr,
1747 + .base = head917d_base,
1748 + .ovly = head907d_ovly,
1749 +diff --git a/drivers/gpu/drm/nouveau/dispnv50/wndw.c b/drivers/gpu/drm/nouveau/dispnv50/wndw.c
1750 +index 0356474ad6f6a..f07916ffe42cb 100644
1751 +--- a/drivers/gpu/drm/nouveau/dispnv50/wndw.c
1752 ++++ b/drivers/gpu/drm/nouveau/dispnv50/wndw.c
1753 +@@ -702,6 +702,11 @@ nv50_wndw_init(struct nv50_wndw *wndw)
1754 + nvif_notify_get(&wndw->notify);
1755 + }
1756 +
1757 ++static const u64 nv50_cursor_format_modifiers[] = {
1758 ++ DRM_FORMAT_MOD_LINEAR,
1759 ++ DRM_FORMAT_MOD_INVALID,
1760 ++};
1761 ++
1762 + int
1763 + nv50_wndw_new_(const struct nv50_wndw_func *func, struct drm_device *dev,
1764 + enum drm_plane_type type, const char *name, int index,
1765 +@@ -713,6 +718,7 @@ nv50_wndw_new_(const struct nv50_wndw_func *func, struct drm_device *dev,
1766 + struct nvif_mmu *mmu = &drm->client.mmu;
1767 + struct nv50_disp *disp = nv50_disp(dev);
1768 + struct nv50_wndw *wndw;
1769 ++ const u64 *format_modifiers;
1770 + int nformat;
1771 + int ret;
1772 +
1773 +@@ -728,10 +734,13 @@ nv50_wndw_new_(const struct nv50_wndw_func *func, struct drm_device *dev,
1774 +
1775 + for (nformat = 0; format[nformat]; nformat++);
1776 +
1777 +- ret = drm_universal_plane_init(dev, &wndw->plane, heads, &nv50_wndw,
1778 +- format, nformat,
1779 +- nouveau_display(dev)->format_modifiers,
1780 +- type, "%s-%d", name, index);
1781 ++ if (type == DRM_PLANE_TYPE_CURSOR)
1782 ++ format_modifiers = nv50_cursor_format_modifiers;
1783 ++ else
1784 ++ format_modifiers = nouveau_display(dev)->format_modifiers;
1785 ++
1786 ++ ret = drm_universal_plane_init(dev, &wndw->plane, heads, &nv50_wndw, format, nformat,
1787 ++ format_modifiers, type, "%s-%d", name, index);
1788 + if (ret) {
1789 + kfree(*pwndw);
1790 + *pwndw = NULL;
1791 +diff --git a/drivers/gpu/drm/nouveau/include/nvhw/class/cl917d.h b/drivers/gpu/drm/nouveau/include/nvhw/class/cl917d.h
1792 +index 2a2612d6e1e0e..fb223723a38ad 100644
1793 +--- a/drivers/gpu/drm/nouveau/include/nvhw/class/cl917d.h
1794 ++++ b/drivers/gpu/drm/nouveau/include/nvhw/class/cl917d.h
1795 +@@ -66,6 +66,10 @@
1796 + #define NV917D_HEAD_SET_CONTROL_CURSOR_COMPOSITION_ALPHA_BLEND (0x00000000)
1797 + #define NV917D_HEAD_SET_CONTROL_CURSOR_COMPOSITION_PREMULT_ALPHA_BLEND (0x00000001)
1798 + #define NV917D_HEAD_SET_CONTROL_CURSOR_COMPOSITION_XOR (0x00000002)
1799 ++#define NV917D_HEAD_SET_OFFSET_CURSOR(a) (0x00000484 + (a)*0x00000300)
1800 ++#define NV917D_HEAD_SET_OFFSET_CURSOR_ORIGIN 31:0
1801 ++#define NV917D_HEAD_SET_CONTEXT_DMA_CURSOR(a) (0x0000048C + (a)*0x00000300)
1802 ++#define NV917D_HEAD_SET_CONTEXT_DMA_CURSOR_HANDLE 31:0
1803 + #define NV917D_HEAD_SET_DITHER_CONTROL(a) (0x000004A0 + (a)*0x00000300)
1804 + #define NV917D_HEAD_SET_DITHER_CONTROL_ENABLE 0:0
1805 + #define NV917D_HEAD_SET_DITHER_CONTROL_ENABLE_DISABLE (0x00000000)
1806 +diff --git a/drivers/gpu/drm/nouveau/nouveau_svm.c b/drivers/gpu/drm/nouveau/nouveau_svm.c
1807 +index 4f69e4c3dafde..1c3f890377d2c 100644
1808 +--- a/drivers/gpu/drm/nouveau/nouveau_svm.c
1809 ++++ b/drivers/gpu/drm/nouveau/nouveau_svm.c
1810 +@@ -315,6 +315,10 @@ nouveau_svmm_init(struct drm_device *dev, void *data,
1811 + struct drm_nouveau_svm_init *args = data;
1812 + int ret;
1813 +
1814 ++ /* We need to fail if svm is disabled */
1815 ++ if (!cli->drm->svm)
1816 ++ return -ENOSYS;
1817 ++
1818 + /* Allocate tracking for SVM-enabled VMM. */
1819 + if (!(svmm = kzalloc(sizeof(*svmm), GFP_KERNEL)))
1820 + return -ENOMEM;
1821 +diff --git a/drivers/gpu/drm/vc4/vc4_hvs.c b/drivers/gpu/drm/vc4/vc4_hvs.c
1822 +index b72b2bd05a815..ad691571d759f 100644
1823 +--- a/drivers/gpu/drm/vc4/vc4_hvs.c
1824 ++++ b/drivers/gpu/drm/vc4/vc4_hvs.c
1825 +@@ -618,11 +618,11 @@ static int vc4_hvs_bind(struct device *dev, struct device *master, void *data)
1826 + * for now we just allocate globally.
1827 + */
1828 + if (!hvs->hvs5)
1829 +- /* 96kB */
1830 +- drm_mm_init(&hvs->lbm_mm, 0, 96 * 1024);
1831 ++ /* 48k words of 2x12-bit pixels */
1832 ++ drm_mm_init(&hvs->lbm_mm, 0, 48 * 1024);
1833 + else
1834 +- /* 70k words */
1835 +- drm_mm_init(&hvs->lbm_mm, 0, 70 * 2 * 1024);
1836 ++ /* 60k words of 4x12-bit pixels */
1837 ++ drm_mm_init(&hvs->lbm_mm, 0, 60 * 1024);
1838 +
1839 + /* Upload filter kernels. We only have the one for now, so we
1840 + * keep it around for the lifetime of the driver.
1841 +diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c
1842 +index 6b39cc2ca18d0..5612cab552270 100644
1843 +--- a/drivers/gpu/drm/vc4/vc4_plane.c
1844 ++++ b/drivers/gpu/drm/vc4/vc4_plane.c
1845 +@@ -437,6 +437,7 @@ static void vc4_write_ppf(struct vc4_plane_state *vc4_state, u32 src, u32 dst)
1846 + static u32 vc4_lbm_size(struct drm_plane_state *state)
1847 + {
1848 + struct vc4_plane_state *vc4_state = to_vc4_plane_state(state);
1849 ++ struct vc4_dev *vc4 = to_vc4_dev(state->plane->dev);
1850 + u32 pix_per_line;
1851 + u32 lbm;
1852 +
1853 +@@ -472,7 +473,11 @@ static u32 vc4_lbm_size(struct drm_plane_state *state)
1854 + lbm = pix_per_line * 16;
1855 + }
1856 +
1857 +- lbm = roundup(lbm, 32);
1858 ++ /* Align it to 64 or 128 (hvs5) bytes */
1859 ++ lbm = roundup(lbm, vc4->hvs->hvs5 ? 128 : 64);
1860 ++
1861 ++ /* Each "word" of the LBM memory contains 2 or 4 (hvs5) pixels */
1862 ++ lbm /= vc4->hvs->hvs5 ? 4 : 2;
1863 +
1864 + return lbm;
1865 + }
1866 +@@ -912,9 +917,9 @@ static int vc4_plane_mode_set(struct drm_plane *plane,
1867 + if (!vc4_state->is_unity) {
1868 + vc4_dlist_write(vc4_state,
1869 + VC4_SET_FIELD(vc4_state->crtc_w,
1870 +- SCALER_POS1_SCL_WIDTH) |
1871 ++ SCALER5_POS1_SCL_WIDTH) |
1872 + VC4_SET_FIELD(vc4_state->crtc_h,
1873 +- SCALER_POS1_SCL_HEIGHT));
1874 ++ SCALER5_POS1_SCL_HEIGHT));
1875 + }
1876 +
1877 + /* Position Word 2: Source Image Size */
1878 +diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c
1879 +index f20379e4e2ec2..5df4bb52bb10f 100644
1880 +--- a/drivers/infiniband/hw/cxgb4/qp.c
1881 ++++ b/drivers/infiniband/hw/cxgb4/qp.c
1882 +@@ -2471,7 +2471,7 @@ int c4iw_ib_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
1883 + init_attr->cap.max_send_wr = qhp->attr.sq_num_entries;
1884 + init_attr->cap.max_recv_wr = qhp->attr.rq_num_entries;
1885 + init_attr->cap.max_send_sge = qhp->attr.sq_max_sges;
1886 +- init_attr->cap.max_recv_sge = qhp->attr.sq_max_sges;
1887 ++ init_attr->cap.max_recv_sge = qhp->attr.rq_max_sges;
1888 + init_attr->cap.max_inline_data = T4_MAX_SEND_INLINE;
1889 + init_attr->sq_sig_type = qhp->sq_sig_all ? IB_SIGNAL_ALL_WR : 0;
1890 + return 0;
1891 +diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
1892 +index fb092ff79d840..e317d7d6d5c0d 100644
1893 +--- a/drivers/infiniband/hw/mlx5/main.c
1894 ++++ b/drivers/infiniband/hw/mlx5/main.c
1895 +@@ -3305,8 +3305,7 @@ static int mlx5_add_netdev_notifier(struct mlx5_ib_dev *dev, u8 port_num)
1896 + int err;
1897 +
1898 + dev->port[port_num].roce.nb.notifier_call = mlx5_netdev_event;
1899 +- err = register_netdevice_notifier_net(mlx5_core_net(dev->mdev),
1900 +- &dev->port[port_num].roce.nb);
1901 ++ err = register_netdevice_notifier(&dev->port[port_num].roce.nb);
1902 + if (err) {
1903 + dev->port[port_num].roce.nb.notifier_call = NULL;
1904 + return err;
1905 +@@ -3318,8 +3317,7 @@ static int mlx5_add_netdev_notifier(struct mlx5_ib_dev *dev, u8 port_num)
1906 + static void mlx5_remove_netdev_notifier(struct mlx5_ib_dev *dev, u8 port_num)
1907 + {
1908 + if (dev->port[port_num].roce.nb.notifier_call) {
1909 +- unregister_netdevice_notifier_net(mlx5_core_net(dev->mdev),
1910 +- &dev->port[port_num].roce.nb);
1911 ++ unregister_netdevice_notifier(&dev->port[port_num].roce.nb);
1912 + dev->port[port_num].roce.nb.notifier_call = NULL;
1913 + }
1914 + }
1915 +diff --git a/drivers/iommu/amd/amd_iommu.h b/drivers/iommu/amd/amd_iommu.h
1916 +index 6b8cbdf717140..b4adab6985632 100644
1917 +--- a/drivers/iommu/amd/amd_iommu.h
1918 ++++ b/drivers/iommu/amd/amd_iommu.h
1919 +@@ -84,12 +84,9 @@ static inline bool is_rd890_iommu(struct pci_dev *pdev)
1920 + (pdev->device == PCI_DEVICE_ID_RD890_IOMMU);
1921 + }
1922 +
1923 +-static inline bool iommu_feature(struct amd_iommu *iommu, u64 f)
1924 ++static inline bool iommu_feature(struct amd_iommu *iommu, u64 mask)
1925 + {
1926 +- if (!(iommu->cap & (1 << IOMMU_CAP_EFR)))
1927 +- return false;
1928 +-
1929 +- return !!(iommu->features & f);
1930 ++ return !!(iommu->features & mask);
1931 + }
1932 +
1933 + static inline u64 iommu_virt_to_phys(void *vaddr)
1934 +diff --git a/drivers/iommu/amd/amd_iommu_types.h b/drivers/iommu/amd/amd_iommu_types.h
1935 +index 494b42a31b7ae..33446c9d3bac8 100644
1936 +--- a/drivers/iommu/amd/amd_iommu_types.h
1937 ++++ b/drivers/iommu/amd/amd_iommu_types.h
1938 +@@ -379,6 +379,10 @@
1939 + #define IOMMU_CAP_NPCACHE 26
1940 + #define IOMMU_CAP_EFR 27
1941 +
1942 ++/* IOMMU IVINFO */
1943 ++#define IOMMU_IVINFO_OFFSET 36
1944 ++#define IOMMU_IVINFO_EFRSUP BIT(0)
1945 ++
1946 + /* IOMMU Feature Reporting Field (for IVHD type 10h */
1947 + #define IOMMU_FEAT_GASUP_SHIFT 6
1948 +
1949 +diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c
1950 +index 23a790f8f5506..c842545368fdd 100644
1951 +--- a/drivers/iommu/amd/init.c
1952 ++++ b/drivers/iommu/amd/init.c
1953 +@@ -257,6 +257,8 @@ static void init_device_table_dma(void);
1954 +
1955 + static bool amd_iommu_pre_enabled = true;
1956 +
1957 ++static u32 amd_iommu_ivinfo __initdata;
1958 ++
1959 + bool translation_pre_enabled(struct amd_iommu *iommu)
1960 + {
1961 + return (iommu->flags & AMD_IOMMU_FLAG_TRANS_PRE_ENABLED);
1962 +@@ -296,6 +298,18 @@ int amd_iommu_get_num_iommus(void)
1963 + return amd_iommus_present;
1964 + }
1965 +
1966 ++/*
1967 ++ * For IVHD type 0x11/0x40, EFR is also available via IVHD.
1968 ++ * Default to IVHD EFR since it is available sooner
1969 ++ * (i.e. before PCI init).
1970 ++ */
1971 ++static void __init early_iommu_features_init(struct amd_iommu *iommu,
1972 ++ struct ivhd_header *h)
1973 ++{
1974 ++ if (amd_iommu_ivinfo & IOMMU_IVINFO_EFRSUP)
1975 ++ iommu->features = h->efr_reg;
1976 ++}
1977 ++
1978 + /* Access to l1 and l2 indexed register spaces */
1979 +
1980 + static u32 iommu_read_l1(struct amd_iommu *iommu, u16 l1, u8 address)
1981 +@@ -1584,6 +1598,9 @@ static int __init init_iommu_one(struct amd_iommu *iommu, struct ivhd_header *h)
1982 + if ((h->efr_reg & BIT(IOMMU_EFR_XTSUP_SHIFT)) &&
1983 + (h->efr_reg & BIT(IOMMU_EFR_MSICAPMMIOSUP_SHIFT)))
1984 + amd_iommu_xt_mode = IRQ_REMAP_X2APIC_MODE;
1985 ++
1986 ++ early_iommu_features_init(iommu, h);
1987 ++
1988 + break;
1989 + default:
1990 + return -EINVAL;
1991 +@@ -1775,6 +1792,35 @@ static const struct attribute_group *amd_iommu_groups[] = {
1992 + NULL,
1993 + };
1994 +
1995 ++/*
1996 ++ * Note: IVHD 0x11 and 0x40 also contains exact copy
1997 ++ * of the IOMMU Extended Feature Register [MMIO Offset 0030h].
1998 ++ * Default to EFR in IVHD since it is available sooner (i.e. before PCI init).
1999 ++ */
2000 ++static void __init late_iommu_features_init(struct amd_iommu *iommu)
2001 ++{
2002 ++ u64 features;
2003 ++
2004 ++ if (!(iommu->cap & (1 << IOMMU_CAP_EFR)))
2005 ++ return;
2006 ++
2007 ++ /* read extended feature bits */
2008 ++ features = readq(iommu->mmio_base + MMIO_EXT_FEATURES);
2009 ++
2010 ++ if (!iommu->features) {
2011 ++ iommu->features = features;
2012 ++ return;
2013 ++ }
2014 ++
2015 ++ /*
2016 ++ * Sanity check and warn if EFR values from
2017 ++ * IVHD and MMIO conflict.
2018 ++ */
2019 ++ if (features != iommu->features)
2020 ++ pr_warn(FW_WARN "EFR mismatch. Use IVHD EFR (%#llx : %#llx\n).",
2021 ++ features, iommu->features);
2022 ++}
2023 ++
2024 + static int __init iommu_init_pci(struct amd_iommu *iommu)
2025 + {
2026 + int cap_ptr = iommu->cap_ptr;
2027 +@@ -1794,8 +1840,7 @@ static int __init iommu_init_pci(struct amd_iommu *iommu)
2028 + if (!(iommu->cap & (1 << IOMMU_CAP_IOTLB)))
2029 + amd_iommu_iotlb_sup = false;
2030 +
2031 +- /* read extended feature bits */
2032 +- iommu->features = readq(iommu->mmio_base + MMIO_EXT_FEATURES);
2033 ++ late_iommu_features_init(iommu);
2034 +
2035 + if (iommu_feature(iommu, FEATURE_GT)) {
2036 + int glxval;
2037 +@@ -2525,6 +2570,11 @@ static void __init free_dma_resources(void)
2038 + free_unity_maps();
2039 + }
2040 +
2041 ++static void __init ivinfo_init(void *ivrs)
2042 ++{
2043 ++ amd_iommu_ivinfo = *((u32 *)(ivrs + IOMMU_IVINFO_OFFSET));
2044 ++}
2045 ++
2046 + /*
2047 + * This is the hardware init function for AMD IOMMU in the system.
2048 + * This function is called either from amd_iommu_init or from the interrupt
2049 +@@ -2579,6 +2629,8 @@ static int __init early_amd_iommu_init(void)
2050 + if (ret)
2051 + goto out;
2052 +
2053 ++ ivinfo_init(ivrs_base);
2054 ++
2055 + amd_iommu_target_ivhd_type = get_highest_supported_ivhd_type(ivrs_base);
2056 + DUMP_printk("Using IVHD type %#x\n", amd_iommu_target_ivhd_type);
2057 +
2058 +diff --git a/drivers/iommu/intel/dmar.c b/drivers/iommu/intel/dmar.c
2059 +index 004feaed3c72c..02e7c10a4224b 100644
2060 +--- a/drivers/iommu/intel/dmar.c
2061 ++++ b/drivers/iommu/intel/dmar.c
2062 +@@ -1496,7 +1496,7 @@ void qi_flush_dev_iotlb_pasid(struct intel_iommu *iommu, u16 sid, u16 pfsid,
2063 + * Max Invs Pending (MIP) is set to 0 for now until we have DIT in
2064 + * ECAP.
2065 + */
2066 +- if (addr & GENMASK_ULL(size_order + VTD_PAGE_SHIFT, 0))
2067 ++ if (!IS_ALIGNED(addr, VTD_PAGE_SIZE << size_order))
2068 + pr_warn_ratelimited("Invalidate non-aligned address %llx, order %d\n",
2069 + addr, size_order);
2070 +
2071 +diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c
2072 +index 91da90cfb11d9..4e7b78a84149b 100644
2073 +--- a/drivers/leds/led-triggers.c
2074 ++++ b/drivers/leds/led-triggers.c
2075 +@@ -378,14 +378,15 @@ void led_trigger_event(struct led_trigger *trig,
2076 + enum led_brightness brightness)
2077 + {
2078 + struct led_classdev *led_cdev;
2079 ++ unsigned long flags;
2080 +
2081 + if (!trig)
2082 + return;
2083 +
2084 +- read_lock(&trig->leddev_list_lock);
2085 ++ read_lock_irqsave(&trig->leddev_list_lock, flags);
2086 + list_for_each_entry(led_cdev, &trig->led_cdevs, trig_list)
2087 + led_set_brightness(led_cdev, brightness);
2088 +- read_unlock(&trig->leddev_list_lock);
2089 ++ read_unlock_irqrestore(&trig->leddev_list_lock, flags);
2090 + }
2091 + EXPORT_SYMBOL_GPL(led_trigger_event);
2092 +
2093 +@@ -396,11 +397,12 @@ static void led_trigger_blink_setup(struct led_trigger *trig,
2094 + int invert)
2095 + {
2096 + struct led_classdev *led_cdev;
2097 ++ unsigned long flags;
2098 +
2099 + if (!trig)
2100 + return;
2101 +
2102 +- read_lock(&trig->leddev_list_lock);
2103 ++ read_lock_irqsave(&trig->leddev_list_lock, flags);
2104 + list_for_each_entry(led_cdev, &trig->led_cdevs, trig_list) {
2105 + if (oneshot)
2106 + led_blink_set_oneshot(led_cdev, delay_on, delay_off,
2107 +@@ -408,7 +410,7 @@ static void led_trigger_blink_setup(struct led_trigger *trig,
2108 + else
2109 + led_blink_set(led_cdev, delay_on, delay_off);
2110 + }
2111 +- read_unlock(&trig->leddev_list_lock);
2112 ++ read_unlock_irqrestore(&trig->leddev_list_lock, flags);
2113 + }
2114 +
2115 + void led_trigger_blink(struct led_trigger *trig,
2116 +diff --git a/drivers/md/bcache/features.h b/drivers/md/bcache/features.h
2117 +index 84fc2c0f01015..d1c8fd3977fc6 100644
2118 +--- a/drivers/md/bcache/features.h
2119 ++++ b/drivers/md/bcache/features.h
2120 +@@ -33,6 +33,8 @@
2121 + #define BCH_FEATURE_COMPAT_FUNCS(name, flagname) \
2122 + static inline int bch_has_feature_##name(struct cache_sb *sb) \
2123 + { \
2124 ++ if (sb->version < BCACHE_SB_VERSION_CDEV_WITH_FEATURES) \
2125 ++ return 0; \
2126 + return (((sb)->feature_compat & \
2127 + BCH##_FEATURE_COMPAT_##flagname) != 0); \
2128 + } \
2129 +@@ -50,6 +52,8 @@ static inline void bch_clear_feature_##name(struct cache_sb *sb) \
2130 + #define BCH_FEATURE_RO_COMPAT_FUNCS(name, flagname) \
2131 + static inline int bch_has_feature_##name(struct cache_sb *sb) \
2132 + { \
2133 ++ if (sb->version < BCACHE_SB_VERSION_CDEV_WITH_FEATURES) \
2134 ++ return 0; \
2135 + return (((sb)->feature_ro_compat & \
2136 + BCH##_FEATURE_RO_COMPAT_##flagname) != 0); \
2137 + } \
2138 +@@ -67,6 +71,8 @@ static inline void bch_clear_feature_##name(struct cache_sb *sb) \
2139 + #define BCH_FEATURE_INCOMPAT_FUNCS(name, flagname) \
2140 + static inline int bch_has_feature_##name(struct cache_sb *sb) \
2141 + { \
2142 ++ if (sb->version < BCACHE_SB_VERSION_CDEV_WITH_FEATURES) \
2143 ++ return 0; \
2144 + return (((sb)->feature_incompat & \
2145 + BCH##_FEATURE_INCOMPAT_##flagname) != 0); \
2146 + } \
2147 +diff --git a/drivers/media/cec/platform/Makefile b/drivers/media/cec/platform/Makefile
2148 +index 3a947159b25ac..ea6f8ee8161c9 100644
2149 +--- a/drivers/media/cec/platform/Makefile
2150 ++++ b/drivers/media/cec/platform/Makefile
2151 +@@ -10,5 +10,6 @@ obj-$(CONFIG_CEC_MESON_AO) += meson/
2152 + obj-$(CONFIG_CEC_SAMSUNG_S5P) += s5p/
2153 + obj-$(CONFIG_CEC_SECO) += seco/
2154 + obj-$(CONFIG_CEC_STI) += sti/
2155 ++obj-$(CONFIG_CEC_STM32) += stm32/
2156 + obj-$(CONFIG_CEC_TEGRA) += tegra/
2157 +
2158 +diff --git a/drivers/media/rc/ir-mce_kbd-decoder.c b/drivers/media/rc/ir-mce_kbd-decoder.c
2159 +index be8f2756a444e..1524dc0fc566e 100644
2160 +--- a/drivers/media/rc/ir-mce_kbd-decoder.c
2161 ++++ b/drivers/media/rc/ir-mce_kbd-decoder.c
2162 +@@ -320,7 +320,7 @@ again:
2163 + data->body);
2164 + spin_lock(&data->keylock);
2165 + if (scancode) {
2166 +- delay = nsecs_to_jiffies(dev->timeout) +
2167 ++ delay = usecs_to_jiffies(dev->timeout) +
2168 + msecs_to_jiffies(100);
2169 + mod_timer(&data->rx_timeout, jiffies + delay);
2170 + } else {
2171 +diff --git a/drivers/media/rc/ite-cir.c b/drivers/media/rc/ite-cir.c
2172 +index a905113fef6ea..0c6229592e132 100644
2173 +--- a/drivers/media/rc/ite-cir.c
2174 ++++ b/drivers/media/rc/ite-cir.c
2175 +@@ -1551,7 +1551,7 @@ static int ite_probe(struct pnp_dev *pdev, const struct pnp_device_id
2176 + rdev->s_rx_carrier_range = ite_set_rx_carrier_range;
2177 + /* FIFO threshold is 17 bytes, so 17 * 8 samples minimum */
2178 + rdev->min_timeout = 17 * 8 * ITE_BAUDRATE_DIVISOR *
2179 +- itdev->params.sample_period;
2180 ++ itdev->params.sample_period / 1000;
2181 + rdev->timeout = IR_DEFAULT_TIMEOUT;
2182 + rdev->max_timeout = 10 * IR_DEFAULT_TIMEOUT;
2183 + rdev->rx_resolution = ITE_BAUDRATE_DIVISOR *
2184 +diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
2185 +index 1d811e5ffb557..1fd62c1dac768 100644
2186 +--- a/drivers/media/rc/rc-main.c
2187 ++++ b/drivers/media/rc/rc-main.c
2188 +@@ -737,7 +737,7 @@ static unsigned int repeat_period(int protocol)
2189 + void rc_repeat(struct rc_dev *dev)
2190 + {
2191 + unsigned long flags;
2192 +- unsigned int timeout = nsecs_to_jiffies(dev->timeout) +
2193 ++ unsigned int timeout = usecs_to_jiffies(dev->timeout) +
2194 + msecs_to_jiffies(repeat_period(dev->last_protocol));
2195 + struct lirc_scancode sc = {
2196 + .scancode = dev->last_scancode, .rc_proto = dev->last_protocol,
2197 +@@ -855,7 +855,7 @@ void rc_keydown(struct rc_dev *dev, enum rc_proto protocol, u64 scancode,
2198 + ir_do_keydown(dev, protocol, scancode, keycode, toggle);
2199 +
2200 + if (dev->keypressed) {
2201 +- dev->keyup_jiffies = jiffies + nsecs_to_jiffies(dev->timeout) +
2202 ++ dev->keyup_jiffies = jiffies + usecs_to_jiffies(dev->timeout) +
2203 + msecs_to_jiffies(repeat_period(protocol));
2204 + mod_timer(&dev->timer_keyup, dev->keyup_jiffies);
2205 + }
2206 +@@ -1928,6 +1928,8 @@ int rc_register_device(struct rc_dev *dev)
2207 + goto out_raw;
2208 + }
2209 +
2210 ++ dev->registered = true;
2211 ++
2212 + rc = device_add(&dev->dev);
2213 + if (rc)
2214 + goto out_rx_free;
2215 +@@ -1937,8 +1939,6 @@ int rc_register_device(struct rc_dev *dev)
2216 + dev->device_name ?: "Unspecified device", path ?: "N/A");
2217 + kfree(path);
2218 +
2219 +- dev->registered = true;
2220 +-
2221 + /*
2222 + * once the the input device is registered in rc_setup_rx_device,
2223 + * userspace can open the input device and rc_open() will be called
2224 +diff --git a/drivers/media/rc/serial_ir.c b/drivers/media/rc/serial_ir.c
2225 +index 8cc28c92d05d6..96ae0294ac102 100644
2226 +--- a/drivers/media/rc/serial_ir.c
2227 ++++ b/drivers/media/rc/serial_ir.c
2228 +@@ -385,7 +385,7 @@ static irqreturn_t serial_ir_irq_handler(int i, void *blah)
2229 + } while (!(sinp(UART_IIR) & UART_IIR_NO_INT)); /* still pending ? */
2230 +
2231 + mod_timer(&serial_ir.timeout_timer,
2232 +- jiffies + nsecs_to_jiffies(serial_ir.rcdev->timeout));
2233 ++ jiffies + usecs_to_jiffies(serial_ir.rcdev->timeout));
2234 +
2235 + ir_raw_event_handle(serial_ir.rcdev);
2236 +
2237 +diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
2238 +index 09879aea9f7cc..24cd3c1027ecc 100644
2239 +--- a/drivers/net/can/dev.c
2240 ++++ b/drivers/net/can/dev.c
2241 +@@ -1163,7 +1163,7 @@ static int can_fill_info(struct sk_buff *skb, const struct net_device *dev)
2242 + {
2243 + struct can_priv *priv = netdev_priv(dev);
2244 + struct can_ctrlmode cm = {.flags = priv->ctrlmode};
2245 +- struct can_berr_counter bec;
2246 ++ struct can_berr_counter bec = { };
2247 + enum can_state state = priv->state;
2248 +
2249 + if (priv->do_get_state)
2250 +diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
2251 +index 61968e9174dab..2872c4dc77f07 100644
2252 +--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
2253 ++++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
2254 +@@ -4046,20 +4046,16 @@ int i40e_ndo_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac)
2255 + goto error_param;
2256 +
2257 + vf = &pf->vf[vf_id];
2258 +- vsi = pf->vsi[vf->lan_vsi_idx];
2259 +
2260 + /* When the VF is resetting wait until it is done.
2261 + * It can take up to 200 milliseconds,
2262 + * but wait for up to 300 milliseconds to be safe.
2263 +- * If the VF is indeed in reset, the vsi pointer has
2264 +- * to show on the newly loaded vsi under pf->vsi[id].
2265 ++ * Acquire the VSI pointer only after the VF has been
2266 ++ * properly initialized.
2267 + */
2268 + for (i = 0; i < 15; i++) {
2269 +- if (test_bit(I40E_VF_STATE_INIT, &vf->vf_states)) {
2270 +- if (i > 0)
2271 +- vsi = pf->vsi[vf->lan_vsi_idx];
2272 ++ if (test_bit(I40E_VF_STATE_INIT, &vf->vf_states))
2273 + break;
2274 +- }
2275 + msleep(20);
2276 + }
2277 + if (!test_bit(I40E_VF_STATE_INIT, &vf->vf_states)) {
2278 +@@ -4068,6 +4064,7 @@ int i40e_ndo_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac)
2279 + ret = -EAGAIN;
2280 + goto error_param;
2281 + }
2282 ++ vsi = pf->vsi[vf->lan_vsi_idx];
2283 +
2284 + if (is_multicast_ether_addr(mac)) {
2285 + dev_err(&pf->pdev->dev,
2286 +diff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/intel/ice/ice.h
2287 +index a0723831c4e48..54cf382fddaf9 100644
2288 +--- a/drivers/net/ethernet/intel/ice/ice.h
2289 ++++ b/drivers/net/ethernet/intel/ice/ice.h
2290 +@@ -68,7 +68,9 @@
2291 + #define ICE_INT_NAME_STR_LEN (IFNAMSIZ + 16)
2292 + #define ICE_AQ_LEN 64
2293 + #define ICE_MBXSQ_LEN 64
2294 +-#define ICE_MIN_MSIX 2
2295 ++#define ICE_MIN_LAN_TXRX_MSIX 1
2296 ++#define ICE_MIN_LAN_OICR_MSIX 1
2297 ++#define ICE_MIN_MSIX (ICE_MIN_LAN_TXRX_MSIX + ICE_MIN_LAN_OICR_MSIX)
2298 + #define ICE_FDIR_MSIX 1
2299 + #define ICE_NO_VSI 0xffff
2300 + #define ICE_VSI_MAP_CONTIG 0
2301 +diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c
2302 +index 9e8e9531cd871..69c113a4de7e6 100644
2303 +--- a/drivers/net/ethernet/intel/ice/ice_ethtool.c
2304 ++++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c
2305 +@@ -3258,8 +3258,8 @@ ice_set_rxfh(struct net_device *netdev, const u32 *indir, const u8 *key,
2306 + */
2307 + static int ice_get_max_txq(struct ice_pf *pf)
2308 + {
2309 +- return min_t(int, num_online_cpus(),
2310 +- pf->hw.func_caps.common_cap.num_txq);
2311 ++ return min3(pf->num_lan_msix, (u16)num_online_cpus(),
2312 ++ (u16)pf->hw.func_caps.common_cap.num_txq);
2313 + }
2314 +
2315 + /**
2316 +@@ -3268,8 +3268,8 @@ static int ice_get_max_txq(struct ice_pf *pf)
2317 + */
2318 + static int ice_get_max_rxq(struct ice_pf *pf)
2319 + {
2320 +- return min_t(int, num_online_cpus(),
2321 +- pf->hw.func_caps.common_cap.num_rxq);
2322 ++ return min3(pf->num_lan_msix, (u16)num_online_cpus(),
2323 ++ (u16)pf->hw.func_caps.common_cap.num_rxq);
2324 + }
2325 +
2326 + /**
2327 +diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool_fdir.c b/drivers/net/ethernet/intel/ice/ice_ethtool_fdir.c
2328 +index 2d27f66ac8534..192729546bbfc 100644
2329 +--- a/drivers/net/ethernet/intel/ice/ice_ethtool_fdir.c
2330 ++++ b/drivers/net/ethernet/intel/ice/ice_ethtool_fdir.c
2331 +@@ -1576,7 +1576,13 @@ ice_set_fdir_input_set(struct ice_vsi *vsi, struct ethtool_rx_flow_spec *fsp,
2332 + sizeof(struct in6_addr));
2333 + input->ip.v6.l4_header = fsp->h_u.usr_ip6_spec.l4_4_bytes;
2334 + input->ip.v6.tc = fsp->h_u.usr_ip6_spec.tclass;
2335 +- input->ip.v6.proto = fsp->h_u.usr_ip6_spec.l4_proto;
2336 ++
2337 ++ /* if no protocol requested, use IPPROTO_NONE */
2338 ++ if (!fsp->m_u.usr_ip6_spec.l4_proto)
2339 ++ input->ip.v6.proto = IPPROTO_NONE;
2340 ++ else
2341 ++ input->ip.v6.proto = fsp->h_u.usr_ip6_spec.l4_proto;
2342 ++
2343 + memcpy(input->mask.v6.dst_ip, fsp->m_u.usr_ip6_spec.ip6dst,
2344 + sizeof(struct in6_addr));
2345 + memcpy(input->mask.v6.src_ip, fsp->m_u.usr_ip6_spec.ip6src,
2346 +diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c
2347 +index 3df67486d42d9..ad9c22a1b97a0 100644
2348 +--- a/drivers/net/ethernet/intel/ice/ice_lib.c
2349 ++++ b/drivers/net/ethernet/intel/ice/ice_lib.c
2350 +@@ -161,8 +161,9 @@ static void ice_vsi_set_num_qs(struct ice_vsi *vsi, u16 vf_id)
2351 +
2352 + switch (vsi->type) {
2353 + case ICE_VSI_PF:
2354 +- vsi->alloc_txq = min_t(int, ice_get_avail_txq_count(pf),
2355 +- num_online_cpus());
2356 ++ vsi->alloc_txq = min3(pf->num_lan_msix,
2357 ++ ice_get_avail_txq_count(pf),
2358 ++ (u16)num_online_cpus());
2359 + if (vsi->req_txq) {
2360 + vsi->alloc_txq = vsi->req_txq;
2361 + vsi->num_txq = vsi->req_txq;
2362 +@@ -174,8 +175,9 @@ static void ice_vsi_set_num_qs(struct ice_vsi *vsi, u16 vf_id)
2363 + if (!test_bit(ICE_FLAG_RSS_ENA, pf->flags)) {
2364 + vsi->alloc_rxq = 1;
2365 + } else {
2366 +- vsi->alloc_rxq = min_t(int, ice_get_avail_rxq_count(pf),
2367 +- num_online_cpus());
2368 ++ vsi->alloc_rxq = min3(pf->num_lan_msix,
2369 ++ ice_get_avail_rxq_count(pf),
2370 ++ (u16)num_online_cpus());
2371 + if (vsi->req_rxq) {
2372 + vsi->alloc_rxq = vsi->req_rxq;
2373 + vsi->num_rxq = vsi->req_rxq;
2374 +@@ -184,7 +186,9 @@ static void ice_vsi_set_num_qs(struct ice_vsi *vsi, u16 vf_id)
2375 +
2376 + pf->num_lan_rx = vsi->alloc_rxq;
2377 +
2378 +- vsi->num_q_vectors = max_t(int, vsi->alloc_rxq, vsi->alloc_txq);
2379 ++ vsi->num_q_vectors = min_t(int, pf->num_lan_msix,
2380 ++ max_t(int, vsi->alloc_rxq,
2381 ++ vsi->alloc_txq));
2382 + break;
2383 + case ICE_VSI_VF:
2384 + vf = &pf->vf[vsi->vf_id];
2385 +diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
2386 +index 2dea4d0e9415c..bacb368063e34 100644
2387 +--- a/drivers/net/ethernet/intel/ice/ice_main.c
2388 ++++ b/drivers/net/ethernet/intel/ice/ice_main.c
2389 +@@ -3433,18 +3433,14 @@ static int ice_ena_msix_range(struct ice_pf *pf)
2390 + if (v_actual < v_budget) {
2391 + dev_warn(dev, "not enough OS MSI-X vectors. requested = %d, obtained = %d\n",
2392 + v_budget, v_actual);
2393 +-/* 2 vectors each for LAN and RDMA (traffic + OICR), one for flow director */
2394 +-#define ICE_MIN_LAN_VECS 2
2395 +-#define ICE_MIN_RDMA_VECS 2
2396 +-#define ICE_MIN_VECS (ICE_MIN_LAN_VECS + ICE_MIN_RDMA_VECS + 1)
2397 +
2398 +- if (v_actual < ICE_MIN_LAN_VECS) {
2399 ++ if (v_actual < ICE_MIN_MSIX) {
2400 + /* error if we can't get minimum vectors */
2401 + pci_disable_msix(pf->pdev);
2402 + err = -ERANGE;
2403 + goto msix_err;
2404 + } else {
2405 +- pf->num_lan_msix = ICE_MIN_LAN_VECS;
2406 ++ pf->num_lan_msix = ICE_MIN_LAN_TXRX_MSIX;
2407 + }
2408 + }
2409 +
2410 +@@ -4887,9 +4883,15 @@ static int ice_set_mac_address(struct net_device *netdev, void *pi)
2411 + goto err_update_filters;
2412 + }
2413 +
2414 +- /* Add filter for new MAC. If filter exists, just return success */
2415 ++ /* Add filter for new MAC. If filter exists, return success */
2416 + status = ice_fltr_add_mac(vsi, mac, ICE_FWD_TO_VSI);
2417 + if (status == ICE_ERR_ALREADY_EXISTS) {
2418 ++ /* Although this MAC filter is already present in hardware it's
2419 ++ * possible in some cases (e.g. bonding) that dev_addr was
2420 ++ * modified outside of the driver and needs to be restored back
2421 ++ * to this value.
2422 ++ */
2423 ++ memcpy(netdev->dev_addr, mac, netdev->addr_len);
2424 + netdev_dbg(netdev, "filter for MAC %pM already exists\n", mac);
2425 + return 0;
2426 + }
2427 +diff --git a/drivers/net/ethernet/intel/ice/ice_txrx.c b/drivers/net/ethernet/intel/ice/ice_txrx.c
2428 +index 23eca2f0a03b1..af5b7f33db9af 100644
2429 +--- a/drivers/net/ethernet/intel/ice/ice_txrx.c
2430 ++++ b/drivers/net/ethernet/intel/ice/ice_txrx.c
2431 +@@ -1923,12 +1923,15 @@ int ice_tx_csum(struct ice_tx_buf *first, struct ice_tx_offload_params *off)
2432 + ICE_TX_CTX_EIPT_IPV4_NO_CSUM;
2433 + l4_proto = ip.v4->protocol;
2434 + } else if (first->tx_flags & ICE_TX_FLAGS_IPV6) {
2435 ++ int ret;
2436 ++
2437 + tunnel |= ICE_TX_CTX_EIPT_IPV6;
2438 + exthdr = ip.hdr + sizeof(*ip.v6);
2439 + l4_proto = ip.v6->nexthdr;
2440 +- if (l4.hdr != exthdr)
2441 +- ipv6_skip_exthdr(skb, exthdr - skb->data,
2442 +- &l4_proto, &frag_off);
2443 ++ ret = ipv6_skip_exthdr(skb, exthdr - skb->data,
2444 ++ &l4_proto, &frag_off);
2445 ++ if (ret < 0)
2446 ++ return -1;
2447 + }
2448 +
2449 + /* define outer transport */
2450 +diff --git a/drivers/net/ethernet/intel/igc/igc_ethtool.c b/drivers/net/ethernet/intel/igc/igc_ethtool.c
2451 +index 61d331ce38cdd..831f2f09de5fb 100644
2452 +--- a/drivers/net/ethernet/intel/igc/igc_ethtool.c
2453 ++++ b/drivers/net/ethernet/intel/igc/igc_ethtool.c
2454 +@@ -1675,12 +1675,18 @@ static int igc_ethtool_get_link_ksettings(struct net_device *netdev,
2455 + cmd->base.phy_address = hw->phy.addr;
2456 +
2457 + /* advertising link modes */
2458 +- ethtool_link_ksettings_add_link_mode(cmd, advertising, 10baseT_Half);
2459 +- ethtool_link_ksettings_add_link_mode(cmd, advertising, 10baseT_Full);
2460 +- ethtool_link_ksettings_add_link_mode(cmd, advertising, 100baseT_Half);
2461 +- ethtool_link_ksettings_add_link_mode(cmd, advertising, 100baseT_Full);
2462 +- ethtool_link_ksettings_add_link_mode(cmd, advertising, 1000baseT_Full);
2463 +- ethtool_link_ksettings_add_link_mode(cmd, advertising, 2500baseT_Full);
2464 ++ if (hw->phy.autoneg_advertised & ADVERTISE_10_HALF)
2465 ++ ethtool_link_ksettings_add_link_mode(cmd, advertising, 10baseT_Half);
2466 ++ if (hw->phy.autoneg_advertised & ADVERTISE_10_FULL)
2467 ++ ethtool_link_ksettings_add_link_mode(cmd, advertising, 10baseT_Full);
2468 ++ if (hw->phy.autoneg_advertised & ADVERTISE_100_HALF)
2469 ++ ethtool_link_ksettings_add_link_mode(cmd, advertising, 100baseT_Half);
2470 ++ if (hw->phy.autoneg_advertised & ADVERTISE_100_FULL)
2471 ++ ethtool_link_ksettings_add_link_mode(cmd, advertising, 100baseT_Full);
2472 ++ if (hw->phy.autoneg_advertised & ADVERTISE_1000_FULL)
2473 ++ ethtool_link_ksettings_add_link_mode(cmd, advertising, 1000baseT_Full);
2474 ++ if (hw->phy.autoneg_advertised & ADVERTISE_2500_FULL)
2475 ++ ethtool_link_ksettings_add_link_mode(cmd, advertising, 2500baseT_Full);
2476 +
2477 + /* set autoneg settings */
2478 + if (hw->mac.autoneg == 1) {
2479 +@@ -1792,6 +1798,12 @@ igc_ethtool_set_link_ksettings(struct net_device *netdev,
2480 +
2481 + ethtool_convert_link_mode_to_legacy_u32(&advertising,
2482 + cmd->link_modes.advertising);
2483 ++ /* Converting to legacy u32 drops ETHTOOL_LINK_MODE_2500baseT_Full_BIT.
2484 ++ * We have to check this and convert it to ADVERTISE_2500_FULL
2485 ++ * (aka ETHTOOL_LINK_MODE_2500baseX_Full_BIT) explicitly.
2486 ++ */
2487 ++ if (ethtool_link_ksettings_test_link_mode(cmd, advertising, 2500baseT_Full))
2488 ++ advertising |= ADVERTISE_2500_FULL;
2489 +
2490 + if (cmd->base.autoneg == AUTONEG_ENABLE) {
2491 + hw->mac.autoneg = 1;
2492 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/health.c b/drivers/net/ethernet/mellanox/mlx5/core/en/health.c
2493 +index 69a05da0e3e3d..e03e78a35df00 100644
2494 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en/health.c
2495 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en/health.c
2496 +@@ -275,7 +275,7 @@ int mlx5e_health_rsc_fmsg_dump(struct mlx5e_priv *priv, struct mlx5_rsc_key *key
2497 +
2498 + err = devlink_fmsg_binary_pair_nest_start(fmsg, "data");
2499 + if (err)
2500 +- return err;
2501 ++ goto free_page;
2502 +
2503 + cmd = mlx5_rsc_dump_cmd_create(mdev, key);
2504 + if (IS_ERR(cmd)) {
2505 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
2506 +index 072363e73f1ce..6bc6b48a56dc7 100644
2507 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
2508 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
2509 +@@ -167,6 +167,12 @@ static const struct rhashtable_params tuples_nat_ht_params = {
2510 + .min_size = 16 * 1024,
2511 + };
2512 +
2513 ++static bool
2514 ++mlx5_tc_ct_entry_has_nat(struct mlx5_ct_entry *entry)
2515 ++{
2516 ++ return !!(entry->tuple_nat_node.next);
2517 ++}
2518 ++
2519 + static int
2520 + mlx5_tc_ct_rule_to_tuple(struct mlx5_ct_tuple *tuple, struct flow_rule *rule)
2521 + {
2522 +@@ -911,13 +917,13 @@ mlx5_tc_ct_block_flow_offload_add(struct mlx5_ct_ft *ft,
2523 + err_insert:
2524 + mlx5_tc_ct_entry_del_rules(ct_priv, entry);
2525 + err_rules:
2526 +- rhashtable_remove_fast(&ct_priv->ct_tuples_nat_ht,
2527 +- &entry->tuple_nat_node, tuples_nat_ht_params);
2528 ++ if (mlx5_tc_ct_entry_has_nat(entry))
2529 ++ rhashtable_remove_fast(&ct_priv->ct_tuples_nat_ht,
2530 ++ &entry->tuple_nat_node, tuples_nat_ht_params);
2531 + err_tuple_nat:
2532 +- if (entry->tuple_node.next)
2533 +- rhashtable_remove_fast(&ct_priv->ct_tuples_ht,
2534 +- &entry->tuple_node,
2535 +- tuples_ht_params);
2536 ++ rhashtable_remove_fast(&ct_priv->ct_tuples_ht,
2537 ++ &entry->tuple_node,
2538 ++ tuples_ht_params);
2539 + err_tuple:
2540 + err_set:
2541 + kfree(entry);
2542 +@@ -932,7 +938,7 @@ mlx5_tc_ct_del_ft_entry(struct mlx5_tc_ct_priv *ct_priv,
2543 + {
2544 + mlx5_tc_ct_entry_del_rules(ct_priv, entry);
2545 + mutex_lock(&ct_priv->shared_counter_lock);
2546 +- if (entry->tuple_node.next)
2547 ++ if (mlx5_tc_ct_entry_has_nat(entry))
2548 + rhashtable_remove_fast(&ct_priv->ct_tuples_nat_ht,
2549 + &entry->tuple_nat_node,
2550 + tuples_nat_ht_params);
2551 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_stats.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_stats.c
2552 +index 6c5c54bcd9be0..5cb936541b9e9 100644
2553 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_stats.c
2554 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_stats.c
2555 +@@ -76,7 +76,7 @@ static const struct counter_desc mlx5e_ipsec_sw_stats_desc[] = {
2556 +
2557 + static MLX5E_DECLARE_STATS_GRP_OP_NUM_STATS(ipsec_sw)
2558 + {
2559 +- return NUM_IPSEC_SW_COUNTERS;
2560 ++ return priv->ipsec ? NUM_IPSEC_SW_COUNTERS : 0;
2561 + }
2562 +
2563 + static inline MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS(ipsec_sw) {}
2564 +@@ -105,7 +105,7 @@ static MLX5E_DECLARE_STATS_GRP_OP_FILL_STATS(ipsec_sw)
2565 +
2566 + static MLX5E_DECLARE_STATS_GRP_OP_NUM_STATS(ipsec_hw)
2567 + {
2568 +- return (mlx5_fpga_ipsec_device_caps(priv->mdev)) ? NUM_IPSEC_HW_COUNTERS : 0;
2569 ++ return (priv->ipsec && mlx5_fpga_ipsec_device_caps(priv->mdev)) ? NUM_IPSEC_HW_COUNTERS : 0;
2570 + }
2571 +
2572 + static MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS(ipsec_hw)
2573 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c b/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
2574 +index d20243d6a0326..f23c67575073a 100644
2575 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
2576 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
2577 +@@ -1151,6 +1151,7 @@ static int mlx5e_set_trust_state(struct mlx5e_priv *priv, u8 trust_state)
2578 + {
2579 + struct mlx5e_channels new_channels = {};
2580 + bool reset_channels = true;
2581 ++ bool opened;
2582 + int err = 0;
2583 +
2584 + mutex_lock(&priv->state_lock);
2585 +@@ -1159,22 +1160,24 @@ static int mlx5e_set_trust_state(struct mlx5e_priv *priv, u8 trust_state)
2586 + mlx5e_params_calc_trust_tx_min_inline_mode(priv->mdev, &new_channels.params,
2587 + trust_state);
2588 +
2589 +- if (!test_bit(MLX5E_STATE_OPENED, &priv->state)) {
2590 +- priv->channels.params = new_channels.params;
2591 ++ opened = test_bit(MLX5E_STATE_OPENED, &priv->state);
2592 ++ if (!opened)
2593 + reset_channels = false;
2594 +- }
2595 +
2596 + /* Skip if tx_min_inline is the same */
2597 + if (new_channels.params.tx_min_inline_mode ==
2598 + priv->channels.params.tx_min_inline_mode)
2599 + reset_channels = false;
2600 +
2601 +- if (reset_channels)
2602 ++ if (reset_channels) {
2603 + err = mlx5e_safe_switch_channels(priv, &new_channels,
2604 + mlx5e_update_trust_state_hw,
2605 + &trust_state);
2606 +- else
2607 ++ } else {
2608 + err = mlx5e_update_trust_state_hw(priv, &trust_state);
2609 ++ if (!err && !opened)
2610 ++ priv->channels.params = new_channels.params;
2611 ++ }
2612 +
2613 + mutex_unlock(&priv->state_lock);
2614 +
2615 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
2616 +index f01395a9fd8df..e596f050c4316 100644
2617 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
2618 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
2619 +@@ -444,12 +444,18 @@ int mlx5e_ethtool_set_channels(struct mlx5e_priv *priv,
2620 + goto out;
2621 + }
2622 +
2623 +- new_channels.params = priv->channels.params;
2624 ++ new_channels.params = *cur_params;
2625 + new_channels.params.num_channels = count;
2626 +
2627 + if (!test_bit(MLX5E_STATE_OPENED, &priv->state)) {
2628 ++ struct mlx5e_params old_params;
2629 ++
2630 ++ old_params = *cur_params;
2631 + *cur_params = new_channels.params;
2632 + err = mlx5e_num_channels_changed(priv);
2633 ++ if (err)
2634 ++ *cur_params = old_params;
2635 ++
2636 + goto out;
2637 + }
2638 +
2639 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
2640 +index ebce97921e03c..c9b5d7f29911e 100644
2641 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
2642 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
2643 +@@ -3580,7 +3580,14 @@ static int mlx5e_setup_tc_mqprio(struct mlx5e_priv *priv,
2644 + new_channels.params.num_tc = tc ? tc : 1;
2645 +
2646 + if (!test_bit(MLX5E_STATE_OPENED, &priv->state)) {
2647 ++ struct mlx5e_params old_params;
2648 ++
2649 ++ old_params = priv->channels.params;
2650 + priv->channels.params = new_channels.params;
2651 ++ err = mlx5e_num_channels_changed(priv);
2652 ++ if (err)
2653 ++ priv->channels.params = old_params;
2654 ++
2655 + goto out;
2656 + }
2657 +
2658 +@@ -3723,7 +3730,7 @@ static int set_feature_lro(struct net_device *netdev, bool enable)
2659 + struct mlx5e_priv *priv = netdev_priv(netdev);
2660 + struct mlx5_core_dev *mdev = priv->mdev;
2661 + struct mlx5e_channels new_channels = {};
2662 +- struct mlx5e_params *old_params;
2663 ++ struct mlx5e_params *cur_params;
2664 + int err = 0;
2665 + bool reset;
2666 +
2667 +@@ -3736,8 +3743,8 @@ static int set_feature_lro(struct net_device *netdev, bool enable)
2668 + goto out;
2669 + }
2670 +
2671 +- old_params = &priv->channels.params;
2672 +- if (enable && !MLX5E_GET_PFLAG(old_params, MLX5E_PFLAG_RX_STRIDING_RQ)) {
2673 ++ cur_params = &priv->channels.params;
2674 ++ if (enable && !MLX5E_GET_PFLAG(cur_params, MLX5E_PFLAG_RX_STRIDING_RQ)) {
2675 + netdev_warn(netdev, "can't set LRO with legacy RQ\n");
2676 + err = -EINVAL;
2677 + goto out;
2678 +@@ -3745,18 +3752,23 @@ static int set_feature_lro(struct net_device *netdev, bool enable)
2679 +
2680 + reset = test_bit(MLX5E_STATE_OPENED, &priv->state);
2681 +
2682 +- new_channels.params = *old_params;
2683 ++ new_channels.params = *cur_params;
2684 + new_channels.params.lro_en = enable;
2685 +
2686 +- if (old_params->rq_wq_type != MLX5_WQ_TYPE_CYCLIC) {
2687 +- if (mlx5e_rx_mpwqe_is_linear_skb(mdev, old_params, NULL) ==
2688 ++ if (cur_params->rq_wq_type != MLX5_WQ_TYPE_CYCLIC) {
2689 ++ if (mlx5e_rx_mpwqe_is_linear_skb(mdev, cur_params, NULL) ==
2690 + mlx5e_rx_mpwqe_is_linear_skb(mdev, &new_channels.params, NULL))
2691 + reset = false;
2692 + }
2693 +
2694 + if (!reset) {
2695 +- *old_params = new_channels.params;
2696 ++ struct mlx5e_params old_params;
2697 ++
2698 ++ old_params = *cur_params;
2699 ++ *cur_params = new_channels.params;
2700 + err = mlx5e_modify_tirs_lro(priv);
2701 ++ if (err)
2702 ++ *cur_params = old_params;
2703 + goto out;
2704 + }
2705 +
2706 +@@ -4030,9 +4042,16 @@ int mlx5e_change_mtu(struct net_device *netdev, int new_mtu,
2707 + }
2708 +
2709 + if (!reset) {
2710 ++ unsigned int old_mtu = params->sw_mtu;
2711 ++
2712 + params->sw_mtu = new_mtu;
2713 +- if (preactivate)
2714 +- preactivate(priv, NULL);
2715 ++ if (preactivate) {
2716 ++ err = preactivate(priv, NULL);
2717 ++ if (err) {
2718 ++ params->sw_mtu = old_mtu;
2719 ++ goto out;
2720 ++ }
2721 ++ }
2722 + netdev->mtu = params->sw_mtu;
2723 + goto out;
2724 + }
2725 +@@ -4990,7 +5009,7 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev)
2726 + FT_CAP(modify_root) &&
2727 + FT_CAP(identified_miss_table_mode) &&
2728 + FT_CAP(flow_table_modify)) {
2729 +-#ifdef CONFIG_MLX5_ESWITCH
2730 ++#if IS_ENABLED(CONFIG_MLX5_CLS_ACT)
2731 + netdev->hw_features |= NETIF_F_HW_TC;
2732 + #endif
2733 + #ifdef CONFIG_MLX5_EN_ARFS
2734 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
2735 +index 67247c33b9fd6..304435e561170 100644
2736 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
2737 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
2738 +@@ -738,7 +738,9 @@ static void mlx5e_build_rep_netdev(struct net_device *netdev)
2739 +
2740 + netdev->features |= NETIF_F_NETNS_LOCAL;
2741 +
2742 ++#if IS_ENABLED(CONFIG_MLX5_CLS_ACT)
2743 + netdev->hw_features |= NETIF_F_HW_TC;
2744 ++#endif
2745 + netdev->hw_features |= NETIF_F_SG;
2746 + netdev->hw_features |= NETIF_F_IP_CSUM;
2747 + netdev->hw_features |= NETIF_F_IPV6_CSUM;
2748 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
2749 +index ce710f22b1fff..4b8a442f09cd6 100644
2750 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
2751 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
2752 +@@ -67,6 +67,7 @@
2753 + #include "lib/geneve.h"
2754 + #include "lib/fs_chains.h"
2755 + #include "diag/en_tc_tracepoint.h"
2756 ++#include <asm/div64.h>
2757 +
2758 + #define nic_chains(priv) ((priv)->fs.tc.chains)
2759 + #define MLX5_MH_ACT_SZ MLX5_UN_SZ_BYTES(set_add_copy_action_in_auto)
2760 +@@ -1164,6 +1165,9 @@ mlx5e_tc_offload_fdb_rules(struct mlx5_eswitch *esw,
2761 + struct mlx5e_tc_mod_hdr_acts *mod_hdr_acts;
2762 + struct mlx5_flow_handle *rule;
2763 +
2764 ++ if (attr->flags & MLX5_ESW_ATTR_FLAG_SLOW_PATH)
2765 ++ return mlx5_eswitch_add_offloaded_rule(esw, spec, attr);
2766 ++
2767 + if (flow_flag_test(flow, CT)) {
2768 + mod_hdr_acts = &attr->parse_attr->mod_hdr_acts;
2769 +
2770 +@@ -1194,6 +1198,9 @@ mlx5e_tc_unoffload_fdb_rules(struct mlx5_eswitch *esw,
2771 + {
2772 + flow_flag_clear(flow, OFFLOADED);
2773 +
2774 ++ if (attr->flags & MLX5_ESW_ATTR_FLAG_SLOW_PATH)
2775 ++ goto offload_rule_0;
2776 ++
2777 + if (flow_flag_test(flow, CT)) {
2778 + mlx5_tc_ct_delete_flow(get_ct_priv(flow->priv), flow, attr);
2779 + return;
2780 +@@ -1202,6 +1209,7 @@ mlx5e_tc_unoffload_fdb_rules(struct mlx5_eswitch *esw,
2781 + if (attr->esw_attr->split_count)
2782 + mlx5_eswitch_del_fwd_rule(esw, flow->rule[1], attr);
2783 +
2784 ++offload_rule_0:
2785 + mlx5_eswitch_del_offloaded_rule(esw, flow->rule[0], attr);
2786 + }
2787 +
2788 +@@ -2271,8 +2279,8 @@ static int __parse_cls_flower(struct mlx5e_priv *priv,
2789 + BIT(FLOW_DISSECTOR_KEY_ENC_OPTS) |
2790 + BIT(FLOW_DISSECTOR_KEY_MPLS))) {
2791 + NL_SET_ERR_MSG_MOD(extack, "Unsupported key");
2792 +- netdev_warn(priv->netdev, "Unsupported key used: 0x%x\n",
2793 +- dissector->used_keys);
2794 ++ netdev_dbg(priv->netdev, "Unsupported key used: 0x%x\n",
2795 ++ dissector->used_keys);
2796 + return -EOPNOTSUPP;
2797 + }
2798 +
2799 +@@ -5009,13 +5017,13 @@ errout:
2800 + return err;
2801 + }
2802 +
2803 +-static int apply_police_params(struct mlx5e_priv *priv, u32 rate,
2804 ++static int apply_police_params(struct mlx5e_priv *priv, u64 rate,
2805 + struct netlink_ext_ack *extack)
2806 + {
2807 + struct mlx5e_rep_priv *rpriv = priv->ppriv;
2808 + struct mlx5_eswitch *esw;
2809 ++ u32 rate_mbps = 0;
2810 + u16 vport_num;
2811 +- u32 rate_mbps;
2812 + int err;
2813 +
2814 + vport_num = rpriv->rep->vport;
2815 +@@ -5032,7 +5040,11 @@ static int apply_police_params(struct mlx5e_priv *priv, u32 rate,
2816 + * Moreover, if rate is non zero we choose to configure to a minimum of
2817 + * 1 mbit/sec.
2818 + */
2819 +- rate_mbps = rate ? max_t(u32, (rate * 8 + 500000) / 1000000, 1) : 0;
2820 ++ if (rate) {
2821 ++ rate = (rate * BITS_PER_BYTE) + 500000;
2822 ++ rate_mbps = max_t(u32, do_div(rate, 1000000), 1);
2823 ++ }
2824 ++
2825 + err = mlx5_esw_modify_vport_rate(esw, vport_num, rate_mbps);
2826 + if (err)
2827 + NL_SET_ERR_MSG_MOD(extack, "failed applying action to hardware");
2828 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
2829 +index 9fdd99272e310..634c2bfd25be1 100644
2830 +--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
2831 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
2832 +@@ -1141,6 +1141,7 @@ static struct mlx5_flow_table *__mlx5_create_flow_table(struct mlx5_flow_namespa
2833 + destroy_ft:
2834 + root->cmds->destroy_flow_table(root, ft);
2835 + free_ft:
2836 ++ rhltable_destroy(&ft->fgs_hash);
2837 + kfree(ft);
2838 + unlock_root:
2839 + mutex_unlock(&root->chain_lock);
2840 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/mlx5.h b/drivers/net/ethernet/mellanox/mlx5/core/lib/mlx5.h
2841 +index 3a9fa629503f0..d046db7bb047d 100644
2842 +--- a/drivers/net/ethernet/mellanox/mlx5/core/lib/mlx5.h
2843 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/mlx5.h
2844 +@@ -90,4 +90,9 @@ int mlx5_create_encryption_key(struct mlx5_core_dev *mdev,
2845 + u32 key_type, u32 *p_key_id);
2846 + void mlx5_destroy_encryption_key(struct mlx5_core_dev *mdev, u32 key_id);
2847 +
2848 ++static inline struct net *mlx5_core_net(struct mlx5_core_dev *dev)
2849 ++{
2850 ++ return devlink_net(priv_to_devlink(dev));
2851 ++}
2852 ++
2853 + #endif
2854 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
2855 +index 4d7f8a357df76..a3e0c71831928 100644
2856 +--- a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
2857 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
2858 +@@ -58,7 +58,7 @@ struct fw_page {
2859 + struct rb_node rb_node;
2860 + u64 addr;
2861 + struct page *page;
2862 +- u16 func_id;
2863 ++ u32 function;
2864 + unsigned long bitmask;
2865 + struct list_head list;
2866 + unsigned free_count;
2867 +@@ -74,12 +74,17 @@ enum {
2868 + MLX5_NUM_4K_IN_PAGE = PAGE_SIZE / MLX5_ADAPTER_PAGE_SIZE,
2869 + };
2870 +
2871 +-static struct rb_root *page_root_per_func_id(struct mlx5_core_dev *dev, u16 func_id)
2872 ++static u32 get_function(u16 func_id, bool ec_function)
2873 ++{
2874 ++ return func_id & (ec_function << 16);
2875 ++}
2876 ++
2877 ++static struct rb_root *page_root_per_function(struct mlx5_core_dev *dev, u32 function)
2878 + {
2879 + struct rb_root *root;
2880 + int err;
2881 +
2882 +- root = xa_load(&dev->priv.page_root_xa, func_id);
2883 ++ root = xa_load(&dev->priv.page_root_xa, function);
2884 + if (root)
2885 + return root;
2886 +
2887 +@@ -87,7 +92,7 @@ static struct rb_root *page_root_per_func_id(struct mlx5_core_dev *dev, u16 func
2888 + if (!root)
2889 + return ERR_PTR(-ENOMEM);
2890 +
2891 +- err = xa_insert(&dev->priv.page_root_xa, func_id, root, GFP_KERNEL);
2892 ++ err = xa_insert(&dev->priv.page_root_xa, function, root, GFP_KERNEL);
2893 + if (err) {
2894 + kfree(root);
2895 + return ERR_PTR(err);
2896 +@@ -98,7 +103,7 @@ static struct rb_root *page_root_per_func_id(struct mlx5_core_dev *dev, u16 func
2897 + return root;
2898 + }
2899 +
2900 +-static int insert_page(struct mlx5_core_dev *dev, u64 addr, struct page *page, u16 func_id)
2901 ++static int insert_page(struct mlx5_core_dev *dev, u64 addr, struct page *page, u32 function)
2902 + {
2903 + struct rb_node *parent = NULL;
2904 + struct rb_root *root;
2905 +@@ -107,7 +112,7 @@ static int insert_page(struct mlx5_core_dev *dev, u64 addr, struct page *page, u
2906 + struct fw_page *tfp;
2907 + int i;
2908 +
2909 +- root = page_root_per_func_id(dev, func_id);
2910 ++ root = page_root_per_function(dev, function);
2911 + if (IS_ERR(root))
2912 + return PTR_ERR(root);
2913 +
2914 +@@ -130,7 +135,7 @@ static int insert_page(struct mlx5_core_dev *dev, u64 addr, struct page *page, u
2915 +
2916 + nfp->addr = addr;
2917 + nfp->page = page;
2918 +- nfp->func_id = func_id;
2919 ++ nfp->function = function;
2920 + nfp->free_count = MLX5_NUM_4K_IN_PAGE;
2921 + for (i = 0; i < MLX5_NUM_4K_IN_PAGE; i++)
2922 + set_bit(i, &nfp->bitmask);
2923 +@@ -143,14 +148,14 @@ static int insert_page(struct mlx5_core_dev *dev, u64 addr, struct page *page, u
2924 + }
2925 +
2926 + static struct fw_page *find_fw_page(struct mlx5_core_dev *dev, u64 addr,
2927 +- u32 func_id)
2928 ++ u32 function)
2929 + {
2930 + struct fw_page *result = NULL;
2931 + struct rb_root *root;
2932 + struct rb_node *tmp;
2933 + struct fw_page *tfp;
2934 +
2935 +- root = xa_load(&dev->priv.page_root_xa, func_id);
2936 ++ root = xa_load(&dev->priv.page_root_xa, function);
2937 + if (WARN_ON_ONCE(!root))
2938 + return NULL;
2939 +
2940 +@@ -194,14 +199,14 @@ static int mlx5_cmd_query_pages(struct mlx5_core_dev *dev, u16 *func_id,
2941 + return err;
2942 + }
2943 +
2944 +-static int alloc_4k(struct mlx5_core_dev *dev, u64 *addr, u16 func_id)
2945 ++static int alloc_4k(struct mlx5_core_dev *dev, u64 *addr, u32 function)
2946 + {
2947 + struct fw_page *fp = NULL;
2948 + struct fw_page *iter;
2949 + unsigned n;
2950 +
2951 + list_for_each_entry(iter, &dev->priv.free_list, list) {
2952 +- if (iter->func_id != func_id)
2953 ++ if (iter->function != function)
2954 + continue;
2955 + fp = iter;
2956 + }
2957 +@@ -231,7 +236,7 @@ static void free_fwp(struct mlx5_core_dev *dev, struct fw_page *fwp,
2958 + {
2959 + struct rb_root *root;
2960 +
2961 +- root = xa_load(&dev->priv.page_root_xa, fwp->func_id);
2962 ++ root = xa_load(&dev->priv.page_root_xa, fwp->function);
2963 + if (WARN_ON_ONCE(!root))
2964 + return;
2965 +
2966 +@@ -244,12 +249,12 @@ static void free_fwp(struct mlx5_core_dev *dev, struct fw_page *fwp,
2967 + kfree(fwp);
2968 + }
2969 +
2970 +-static void free_4k(struct mlx5_core_dev *dev, u64 addr, u32 func_id)
2971 ++static void free_4k(struct mlx5_core_dev *dev, u64 addr, u32 function)
2972 + {
2973 + struct fw_page *fwp;
2974 + int n;
2975 +
2976 +- fwp = find_fw_page(dev, addr & MLX5_U64_4K_PAGE_MASK, func_id);
2977 ++ fwp = find_fw_page(dev, addr & MLX5_U64_4K_PAGE_MASK, function);
2978 + if (!fwp) {
2979 + mlx5_core_warn_rl(dev, "page not found\n");
2980 + return;
2981 +@@ -263,7 +268,7 @@ static void free_4k(struct mlx5_core_dev *dev, u64 addr, u32 func_id)
2982 + list_add(&fwp->list, &dev->priv.free_list);
2983 + }
2984 +
2985 +-static int alloc_system_page(struct mlx5_core_dev *dev, u16 func_id)
2986 ++static int alloc_system_page(struct mlx5_core_dev *dev, u32 function)
2987 + {
2988 + struct device *device = mlx5_core_dma_dev(dev);
2989 + int nid = dev_to_node(device);
2990 +@@ -291,7 +296,7 @@ map:
2991 + goto map;
2992 + }
2993 +
2994 +- err = insert_page(dev, addr, page, func_id);
2995 ++ err = insert_page(dev, addr, page, function);
2996 + if (err) {
2997 + mlx5_core_err(dev, "failed to track allocated page\n");
2998 + dma_unmap_page(device, addr, PAGE_SIZE, DMA_BIDIRECTIONAL);
2999 +@@ -328,6 +333,7 @@ static void page_notify_fail(struct mlx5_core_dev *dev, u16 func_id,
3000 + static int give_pages(struct mlx5_core_dev *dev, u16 func_id, int npages,
3001 + int notify_fail, bool ec_function)
3002 + {
3003 ++ u32 function = get_function(func_id, ec_function);
3004 + u32 out[MLX5_ST_SZ_DW(manage_pages_out)] = {0};
3005 + int inlen = MLX5_ST_SZ_BYTES(manage_pages_in);
3006 + u64 addr;
3007 +@@ -345,10 +351,10 @@ static int give_pages(struct mlx5_core_dev *dev, u16 func_id, int npages,
3008 +
3009 + for (i = 0; i < npages; i++) {
3010 + retry:
3011 +- err = alloc_4k(dev, &addr, func_id);
3012 ++ err = alloc_4k(dev, &addr, function);
3013 + if (err) {
3014 + if (err == -ENOMEM)
3015 +- err = alloc_system_page(dev, func_id);
3016 ++ err = alloc_system_page(dev, function);
3017 + if (err)
3018 + goto out_4k;
3019 +
3020 +@@ -384,7 +390,7 @@ retry:
3021 +
3022 + out_4k:
3023 + for (i--; i >= 0; i--)
3024 +- free_4k(dev, MLX5_GET64(manage_pages_in, in, pas[i]), func_id);
3025 ++ free_4k(dev, MLX5_GET64(manage_pages_in, in, pas[i]), function);
3026 + out_free:
3027 + kvfree(in);
3028 + if (notify_fail)
3029 +@@ -392,14 +398,15 @@ out_free:
3030 + return err;
3031 + }
3032 +
3033 +-static void release_all_pages(struct mlx5_core_dev *dev, u32 func_id,
3034 ++static void release_all_pages(struct mlx5_core_dev *dev, u16 func_id,
3035 + bool ec_function)
3036 + {
3037 ++ u32 function = get_function(func_id, ec_function);
3038 + struct rb_root *root;
3039 + struct rb_node *p;
3040 + int npages = 0;
3041 +
3042 +- root = xa_load(&dev->priv.page_root_xa, func_id);
3043 ++ root = xa_load(&dev->priv.page_root_xa, function);
3044 + if (WARN_ON_ONCE(!root))
3045 + return;
3046 +
3047 +@@ -446,6 +453,7 @@ static int reclaim_pages_cmd(struct mlx5_core_dev *dev,
3048 + struct rb_root *root;
3049 + struct fw_page *fwp;
3050 + struct rb_node *p;
3051 ++ bool ec_function;
3052 + u32 func_id;
3053 + u32 npages;
3054 + u32 i = 0;
3055 +@@ -456,8 +464,9 @@ static int reclaim_pages_cmd(struct mlx5_core_dev *dev,
3056 + /* No hard feelings, we want our pages back! */
3057 + npages = MLX5_GET(manage_pages_in, in, input_num_entries);
3058 + func_id = MLX5_GET(manage_pages_in, in, function_id);
3059 ++ ec_function = MLX5_GET(manage_pages_in, in, embedded_cpu_function);
3060 +
3061 +- root = xa_load(&dev->priv.page_root_xa, func_id);
3062 ++ root = xa_load(&dev->priv.page_root_xa, get_function(func_id, ec_function));
3063 + if (WARN_ON_ONCE(!root))
3064 + return -EEXIST;
3065 +
3066 +@@ -473,9 +482,10 @@ static int reclaim_pages_cmd(struct mlx5_core_dev *dev,
3067 + return 0;
3068 + }
3069 +
3070 +-static int reclaim_pages(struct mlx5_core_dev *dev, u32 func_id, int npages,
3071 ++static int reclaim_pages(struct mlx5_core_dev *dev, u16 func_id, int npages,
3072 + int *nclaimed, bool ec_function)
3073 + {
3074 ++ u32 function = get_function(func_id, ec_function);
3075 + int outlen = MLX5_ST_SZ_BYTES(manage_pages_out);
3076 + u32 in[MLX5_ST_SZ_DW(manage_pages_in)] = {};
3077 + int num_claimed;
3078 +@@ -514,7 +524,7 @@ static int reclaim_pages(struct mlx5_core_dev *dev, u32 func_id, int npages,
3079 + }
3080 +
3081 + for (i = 0; i < num_claimed; i++)
3082 +- free_4k(dev, MLX5_GET64(manage_pages_out, out, pas[i]), func_id);
3083 ++ free_4k(dev, MLX5_GET64(manage_pages_out, out, pas[i]), function);
3084 +
3085 + if (nclaimed)
3086 + *nclaimed = num_claimed;
3087 +diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
3088 +index 07f1f39339271..615f3776b4bee 100644
3089 +--- a/drivers/net/team/team.c
3090 ++++ b/drivers/net/team/team.c
3091 +@@ -991,7 +991,8 @@ static void __team_compute_features(struct team *team)
3092 + unsigned int dst_release_flag = IFF_XMIT_DST_RELEASE |
3093 + IFF_XMIT_DST_RELEASE_PERM;
3094 +
3095 +- list_for_each_entry(port, &team->port_list, list) {
3096 ++ rcu_read_lock();
3097 ++ list_for_each_entry_rcu(port, &team->port_list, list) {
3098 + vlan_features = netdev_increment_features(vlan_features,
3099 + port->dev->vlan_features,
3100 + TEAM_VLAN_FEATURES);
3101 +@@ -1005,6 +1006,7 @@ static void __team_compute_features(struct team *team)
3102 + if (port->dev->hard_header_len > max_hard_header_len)
3103 + max_hard_header_len = port->dev->hard_header_len;
3104 + }
3105 ++ rcu_read_unlock();
3106 +
3107 + team->dev->vlan_features = vlan_features;
3108 + team->dev->hw_enc_features = enc_features | NETIF_F_GSO_ENCAP_ALL |
3109 +@@ -1020,9 +1022,7 @@ static void __team_compute_features(struct team *team)
3110 +
3111 + static void team_compute_features(struct team *team)
3112 + {
3113 +- mutex_lock(&team->lock);
3114 + __team_compute_features(team);
3115 +- mutex_unlock(&team->lock);
3116 + netdev_change_features(team->dev);
3117 + }
3118 +
3119 +diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
3120 +index 21120b4e5637d..ce73df4c137ea 100644
3121 +--- a/drivers/net/usb/qmi_wwan.c
3122 ++++ b/drivers/net/usb/qmi_wwan.c
3123 +@@ -1325,6 +1325,7 @@ static const struct usb_device_id products[] = {
3124 + {QMI_FIXED_INTF(0x0b3c, 0xc00a, 6)}, /* Olivetti Olicard 160 */
3125 + {QMI_FIXED_INTF(0x0b3c, 0xc00b, 4)}, /* Olivetti Olicard 500 */
3126 + {QMI_FIXED_INTF(0x1e2d, 0x0060, 4)}, /* Cinterion PLxx */
3127 ++ {QMI_QUIRK_SET_DTR(0x1e2d, 0x006f, 8)}, /* Cinterion PLS83/PLS63 */
3128 + {QMI_FIXED_INTF(0x1e2d, 0x0053, 4)}, /* Cinterion PHxx,PXxx */
3129 + {QMI_FIXED_INTF(0x1e2d, 0x0063, 10)}, /* Cinterion ALASxx (1 RmNet) */
3130 + {QMI_FIXED_INTF(0x1e2d, 0x0082, 4)}, /* Cinterion PHxx,PXxx (2 RmNet) */
3131 +diff --git a/drivers/net/wireless/intel/iwlwifi/fw/pnvm.c b/drivers/net/wireless/intel/iwlwifi/fw/pnvm.c
3132 +index 6d8f7bff12432..895a907acdf0f 100644
3133 +--- a/drivers/net/wireless/intel/iwlwifi/fw/pnvm.c
3134 ++++ b/drivers/net/wireless/intel/iwlwifi/fw/pnvm.c
3135 +@@ -224,40 +224,46 @@ static int iwl_pnvm_parse(struct iwl_trans *trans, const u8 *data,
3136 + int iwl_pnvm_load(struct iwl_trans *trans,
3137 + struct iwl_notif_wait_data *notif_wait)
3138 + {
3139 +- const struct firmware *pnvm;
3140 + struct iwl_notification_wait pnvm_wait;
3141 + static const u16 ntf_cmds[] = { WIDE_ID(REGULATORY_AND_NVM_GROUP,
3142 + PNVM_INIT_COMPLETE_NTFY) };
3143 +- char pnvm_name[64];
3144 +- int ret;
3145 +
3146 + /* if the SKU_ID is empty, there's nothing to do */
3147 + if (!trans->sku_id[0] && !trans->sku_id[1] && !trans->sku_id[2])
3148 + return 0;
3149 +
3150 +- /* if we already have it, nothing to do either */
3151 +- if (trans->pnvm_loaded)
3152 +- return 0;
3153 ++ /* load from disk only if we haven't done it (or tried) before */
3154 ++ if (!trans->pnvm_loaded) {
3155 ++ const struct firmware *pnvm;
3156 ++ char pnvm_name[64];
3157 ++ int ret;
3158 ++
3159 ++ /*
3160 ++ * The prefix unfortunately includes a hyphen at the end, so
3161 ++ * don't add the dot here...
3162 ++ */
3163 ++ snprintf(pnvm_name, sizeof(pnvm_name), "%spnvm",
3164 ++ trans->cfg->fw_name_pre);
3165 ++
3166 ++ /* ...but replace the hyphen with the dot here. */
3167 ++ if (strlen(trans->cfg->fw_name_pre) < sizeof(pnvm_name))
3168 ++ pnvm_name[strlen(trans->cfg->fw_name_pre) - 1] = '.';
3169 ++
3170 ++ ret = firmware_request_nowarn(&pnvm, pnvm_name, trans->dev);
3171 ++ if (ret) {
3172 ++ IWL_DEBUG_FW(trans, "PNVM file %s not found %d\n",
3173 ++ pnvm_name, ret);
3174 ++ /*
3175 ++ * Pretend we've loaded it - at least we've tried and
3176 ++ * couldn't load it at all, so there's no point in
3177 ++ * trying again over and over.
3178 ++ */
3179 ++ trans->pnvm_loaded = true;
3180 ++ } else {
3181 ++ iwl_pnvm_parse(trans, pnvm->data, pnvm->size);
3182 +
3183 +- /*
3184 +- * The prefix unfortunately includes a hyphen at the end, so
3185 +- * don't add the dot here...
3186 +- */
3187 +- snprintf(pnvm_name, sizeof(pnvm_name), "%spnvm",
3188 +- trans->cfg->fw_name_pre);
3189 +-
3190 +- /* ...but replace the hyphen with the dot here. */
3191 +- if (strlen(trans->cfg->fw_name_pre) < sizeof(pnvm_name))
3192 +- pnvm_name[strlen(trans->cfg->fw_name_pre) - 1] = '.';
3193 +-
3194 +- ret = firmware_request_nowarn(&pnvm, pnvm_name, trans->dev);
3195 +- if (ret) {
3196 +- IWL_DEBUG_FW(trans, "PNVM file %s not found %d\n",
3197 +- pnvm_name, ret);
3198 +- } else {
3199 +- iwl_pnvm_parse(trans, pnvm->data, pnvm->size);
3200 +-
3201 +- release_firmware(pnvm);
3202 ++ release_firmware(pnvm);
3203 ++ }
3204 + }
3205 +
3206 + iwl_init_notification_wait(notif_wait, &pnvm_wait,
3207 +diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-config.h b/drivers/net/wireless/intel/iwlwifi/iwl-config.h
3208 +index 580b07a43856d..e82e3fc963be2 100644
3209 +--- a/drivers/net/wireless/intel/iwlwifi/iwl-config.h
3210 ++++ b/drivers/net/wireless/intel/iwlwifi/iwl-config.h
3211 +@@ -498,7 +498,7 @@ struct iwl_cfg {
3212 + #define IWL_CFG_CORES_BT_GNSS 0x5
3213 +
3214 + #define IWL_SUBDEVICE_RF_ID(subdevice) ((u16)((subdevice) & 0x00F0) >> 4)
3215 +-#define IWL_SUBDEVICE_NO_160(subdevice) ((u16)((subdevice) & 0x0100) >> 9)
3216 ++#define IWL_SUBDEVICE_NO_160(subdevice) ((u16)((subdevice) & 0x0200) >> 9)
3217 + #define IWL_SUBDEVICE_CORES(subdevice) ((u16)((subdevice) & 0x1C00) >> 10)
3218 +
3219 + struct iwl_dev_info {
3220 +diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-prph.h b/drivers/net/wireless/intel/iwlwifi/iwl-prph.h
3221 +index fa3f15778fc7b..579578534f9d9 100644
3222 +--- a/drivers/net/wireless/intel/iwlwifi/iwl-prph.h
3223 ++++ b/drivers/net/wireless/intel/iwlwifi/iwl-prph.h
3224 +@@ -355,6 +355,12 @@
3225 + #define RADIO_RSP_ADDR_POS (6)
3226 + #define RADIO_RSP_RD_CMD (3)
3227 +
3228 ++/* LTR control (Qu only) */
3229 ++#define HPM_MAC_LTR_CSR 0xa0348c
3230 ++#define HPM_MAC_LRT_ENABLE_ALL 0xf
3231 ++/* also uses CSR_LTR_* for values */
3232 ++#define HPM_UMAC_LTR 0xa03480
3233 ++
3234 + /* FW monitor */
3235 + #define MON_BUFF_SAMPLE_CTL (0xa03c00)
3236 + #define MON_BUFF_BASE_ADDR (0xa03c1c)
3237 +diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
3238 +index fe1c538cd7182..7626117c01fa3 100644
3239 +--- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
3240 ++++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
3241 +@@ -833,6 +833,7 @@ iwl_mvm_tx_tso_segment(struct sk_buff *skb, unsigned int num_subframes,
3242 +
3243 + next = skb_gso_segment(skb, netdev_flags);
3244 + skb_shinfo(skb)->gso_size = mss;
3245 ++ skb_shinfo(skb)->gso_type = ipv4 ? SKB_GSO_TCPV4 : SKB_GSO_TCPV6;
3246 + if (WARN_ON_ONCE(IS_ERR(next)))
3247 + return -EINVAL;
3248 + else if (next)
3249 +@@ -855,6 +856,8 @@ iwl_mvm_tx_tso_segment(struct sk_buff *skb, unsigned int num_subframes,
3250 +
3251 + if (tcp_payload_len > mss) {
3252 + skb_shinfo(tmp)->gso_size = mss;
3253 ++ skb_shinfo(tmp)->gso_type = ipv4 ? SKB_GSO_TCPV4 :
3254 ++ SKB_GSO_TCPV6;
3255 + } else {
3256 + if (qos) {
3257 + u8 *qc;
3258 +diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c b/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c
3259 +index 5512e3c630c31..d719e433a59bf 100644
3260 +--- a/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c
3261 ++++ b/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c
3262 +@@ -122,6 +122,15 @@ int iwl_pcie_ctxt_info_gen3_init(struct iwl_trans *trans,
3263 + const struct fw_img *fw)
3264 + {
3265 + struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
3266 ++ u32 ltr_val = CSR_LTR_LONG_VAL_AD_NO_SNOOP_REQ |
3267 ++ u32_encode_bits(CSR_LTR_LONG_VAL_AD_SCALE_USEC,
3268 ++ CSR_LTR_LONG_VAL_AD_NO_SNOOP_SCALE) |
3269 ++ u32_encode_bits(250,
3270 ++ CSR_LTR_LONG_VAL_AD_NO_SNOOP_VAL) |
3271 ++ CSR_LTR_LONG_VAL_AD_SNOOP_REQ |
3272 ++ u32_encode_bits(CSR_LTR_LONG_VAL_AD_SCALE_USEC,
3273 ++ CSR_LTR_LONG_VAL_AD_SNOOP_SCALE) |
3274 ++ u32_encode_bits(250, CSR_LTR_LONG_VAL_AD_SNOOP_VAL);
3275 + struct iwl_context_info_gen3 *ctxt_info_gen3;
3276 + struct iwl_prph_scratch *prph_scratch;
3277 + struct iwl_prph_scratch_ctrl_cfg *prph_sc_ctrl;
3278 +@@ -253,23 +262,19 @@ int iwl_pcie_ctxt_info_gen3_init(struct iwl_trans *trans,
3279 + iwl_set_bit(trans, CSR_CTXT_INFO_BOOT_CTRL,
3280 + CSR_AUTO_FUNC_BOOT_ENA);
3281 +
3282 +- if (trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_AX210) {
3283 +- /*
3284 +- * The firmware initializes this again later (to a smaller
3285 +- * value), but for the boot process initialize the LTR to
3286 +- * ~250 usec.
3287 +- */
3288 +- u32 val = CSR_LTR_LONG_VAL_AD_NO_SNOOP_REQ |
3289 +- u32_encode_bits(CSR_LTR_LONG_VAL_AD_SCALE_USEC,
3290 +- CSR_LTR_LONG_VAL_AD_NO_SNOOP_SCALE) |
3291 +- u32_encode_bits(250,
3292 +- CSR_LTR_LONG_VAL_AD_NO_SNOOP_VAL) |
3293 +- CSR_LTR_LONG_VAL_AD_SNOOP_REQ |
3294 +- u32_encode_bits(CSR_LTR_LONG_VAL_AD_SCALE_USEC,
3295 +- CSR_LTR_LONG_VAL_AD_SNOOP_SCALE) |
3296 +- u32_encode_bits(250, CSR_LTR_LONG_VAL_AD_SNOOP_VAL);
3297 +-
3298 +- iwl_write32(trans, CSR_LTR_LONG_VAL_AD, val);
3299 ++ /*
3300 ++ * To workaround hardware latency issues during the boot process,
3301 ++ * initialize the LTR to ~250 usec (see ltr_val above).
3302 ++ * The firmware initializes this again later (to a smaller value).
3303 ++ */
3304 ++ if ((trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_AX210 ||
3305 ++ trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_22000) &&
3306 ++ !trans->trans_cfg->integrated) {
3307 ++ iwl_write32(trans, CSR_LTR_LONG_VAL_AD, ltr_val);
3308 ++ } else if (trans->trans_cfg->integrated &&
3309 ++ trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_22000) {
3310 ++ iwl_write_prph(trans, HPM_MAC_LTR_CSR, HPM_MAC_LRT_ENABLE_ALL);
3311 ++ iwl_write_prph(trans, HPM_UMAC_LTR, ltr_val);
3312 + }
3313 +
3314 + if (trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_AX210)
3315 +@@ -341,6 +346,9 @@ int iwl_trans_pcie_ctx_info_gen3_set_pnvm(struct iwl_trans *trans,
3316 + return ret;
3317 + }
3318 +
3319 ++ if (WARN_ON(prph_sc_ctrl->pnvm_cfg.pnvm_size))
3320 ++ return -EBUSY;
3321 ++
3322 + prph_sc_ctrl->pnvm_cfg.pnvm_base_addr =
3323 + cpu_to_le64(trans_pcie->pnvm_dram.physical);
3324 + prph_sc_ctrl->pnvm_cfg.pnvm_size =
3325 +diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
3326 +index 2fffbbc8462fc..1a222469b5b4e 100644
3327 +--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
3328 ++++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
3329 +@@ -2161,7 +2161,8 @@ static int iwl_trans_pcie_read_mem(struct iwl_trans *trans, u32 addr,
3330 +
3331 + while (offs < dwords) {
3332 + /* limit the time we spin here under lock to 1/2s */
3333 +- ktime_t timeout = ktime_add_us(ktime_get(), 500 * USEC_PER_MSEC);
3334 ++ unsigned long end = jiffies + HZ / 2;
3335 ++ bool resched = false;
3336 +
3337 + if (iwl_trans_grab_nic_access(trans, &flags)) {
3338 + iwl_write32(trans, HBUS_TARG_MEM_RADDR,
3339 +@@ -2172,14 +2173,15 @@ static int iwl_trans_pcie_read_mem(struct iwl_trans *trans, u32 addr,
3340 + HBUS_TARG_MEM_RDAT);
3341 + offs++;
3342 +
3343 +- /* calling ktime_get is expensive so
3344 +- * do it once in 128 reads
3345 +- */
3346 +- if (offs % 128 == 0 && ktime_after(ktime_get(),
3347 +- timeout))
3348 ++ if (time_after(jiffies, end)) {
3349 ++ resched = true;
3350 + break;
3351 ++ }
3352 + }
3353 + iwl_trans_release_nic_access(trans, &flags);
3354 ++
3355 ++ if (resched)
3356 ++ cond_resched();
3357 + } else {
3358 + return -EBUSY;
3359 + }
3360 +diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c b/drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c
3361 +index 69e38f477b1e4..595519c582558 100644
3362 +--- a/drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c
3363 ++++ b/drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c
3364 +@@ -85,7 +85,7 @@ static int mt7663s_rx_run_queue(struct mt76_dev *dev, enum mt76_rxq_id qid,
3365 + {
3366 + struct mt76_queue *q = &dev->q_rx[qid];
3367 + struct mt76_sdio *sdio = &dev->sdio;
3368 +- int len = 0, err, i, order;
3369 ++ int len = 0, err, i;
3370 + struct page *page;
3371 + u8 *buf;
3372 +
3373 +@@ -98,8 +98,7 @@ static int mt7663s_rx_run_queue(struct mt76_dev *dev, enum mt76_rxq_id qid,
3374 + if (len > sdio->func->cur_blksize)
3375 + len = roundup(len, sdio->func->cur_blksize);
3376 +
3377 +- order = get_order(len);
3378 +- page = __dev_alloc_pages(GFP_KERNEL, order);
3379 ++ page = __dev_alloc_pages(GFP_KERNEL, get_order(len));
3380 + if (!page)
3381 + return -ENOMEM;
3382 +
3383 +@@ -111,7 +110,7 @@ static int mt7663s_rx_run_queue(struct mt76_dev *dev, enum mt76_rxq_id qid,
3384 +
3385 + if (err < 0) {
3386 + dev_err(dev->dev, "sdio read data failed:%d\n", err);
3387 +- __free_pages(page, order);
3388 ++ put_page(page);
3389 + return err;
3390 + }
3391 +
3392 +@@ -128,7 +127,7 @@ static int mt7663s_rx_run_queue(struct mt76_dev *dev, enum mt76_rxq_id qid,
3393 + if (q->queued + i + 1 == q->ndesc)
3394 + break;
3395 + }
3396 +- __free_pages(page, order);
3397 ++ put_page(page);
3398 +
3399 + spin_lock_bh(&q->lock);
3400 + q->head = (q->head + i) % q->ndesc;
3401 +diff --git a/drivers/net/wireless/mediatek/mt7601u/dma.c b/drivers/net/wireless/mediatek/mt7601u/dma.c
3402 +index 09f931d4598c2..11071519fce81 100644
3403 +--- a/drivers/net/wireless/mediatek/mt7601u/dma.c
3404 ++++ b/drivers/net/wireless/mediatek/mt7601u/dma.c
3405 +@@ -152,8 +152,7 @@ mt7601u_rx_process_entry(struct mt7601u_dev *dev, struct mt7601u_dma_buf_rx *e)
3406 +
3407 + if (new_p) {
3408 + /* we have one extra ref from the allocator */
3409 +- __free_pages(e->p, MT_RX_ORDER);
3410 +-
3411 ++ put_page(e->p);
3412 + e->p = new_p;
3413 + }
3414 + }
3415 +@@ -310,7 +309,6 @@ static int mt7601u_dma_submit_tx(struct mt7601u_dev *dev,
3416 + }
3417 +
3418 + e = &q->e[q->end];
3419 +- e->skb = skb;
3420 + usb_fill_bulk_urb(e->urb, usb_dev, snd_pipe, skb->data, skb->len,
3421 + mt7601u_complete_tx, q);
3422 + ret = usb_submit_urb(e->urb, GFP_ATOMIC);
3423 +@@ -328,6 +326,7 @@ static int mt7601u_dma_submit_tx(struct mt7601u_dev *dev,
3424 +
3425 + q->end = (q->end + 1) % q->entries;
3426 + q->used++;
3427 ++ e->skb = skb;
3428 +
3429 + if (q->used >= q->entries)
3430 + ieee80211_stop_queue(dev->hw, skb_get_queue_mapping(skb));
3431 +diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
3432 +index 74896be40c176..292e535a385d4 100644
3433 +--- a/drivers/nvme/host/multipath.c
3434 ++++ b/drivers/nvme/host/multipath.c
3435 +@@ -221,7 +221,7 @@ static struct nvme_ns *nvme_round_robin_path(struct nvme_ns_head *head,
3436 + }
3437 +
3438 + for (ns = nvme_next_ns(head, old);
3439 +- ns != old;
3440 ++ ns && ns != old;
3441 + ns = nvme_next_ns(head, ns)) {
3442 + if (nvme_path_is_disabled(ns))
3443 + continue;
3444 +diff --git a/drivers/of/device.c b/drivers/of/device.c
3445 +index aedfaaafd3e7e..1122daa8e2736 100644
3446 +--- a/drivers/of/device.c
3447 ++++ b/drivers/of/device.c
3448 +@@ -162,9 +162,11 @@ int of_dma_configure_id(struct device *dev, struct device_node *np,
3449 + mask = DMA_BIT_MASK(ilog2(end) + 1);
3450 + dev->coherent_dma_mask &= mask;
3451 + *dev->dma_mask &= mask;
3452 +- /* ...but only set bus limit if we found valid dma-ranges earlier */
3453 +- if (!ret)
3454 ++ /* ...but only set bus limit and range map if we found valid dma-ranges earlier */
3455 ++ if (!ret) {
3456 + dev->bus_dma_limit = end;
3457 ++ dev->dma_range_map = map;
3458 ++ }
3459 +
3460 + coherent = of_dma_is_coherent(np);
3461 + dev_dbg(dev, "device is%sdma coherent\n",
3462 +@@ -172,6 +174,9 @@ int of_dma_configure_id(struct device *dev, struct device_node *np,
3463 +
3464 + iommu = of_iommu_configure(dev, np, id);
3465 + if (PTR_ERR(iommu) == -EPROBE_DEFER) {
3466 ++ /* Don't touch range map if it wasn't set from a valid dma-ranges */
3467 ++ if (!ret)
3468 ++ dev->dma_range_map = NULL;
3469 + kfree(map);
3470 + return -EPROBE_DEFER;
3471 + }
3472 +@@ -181,7 +186,6 @@ int of_dma_configure_id(struct device *dev, struct device_node *np,
3473 +
3474 + arch_setup_dma_ops(dev, dma_start, size, iommu, coherent);
3475 +
3476 +- dev->dma_range_map = map;
3477 + return 0;
3478 + }
3479 + EXPORT_SYMBOL_GPL(of_dma_configure_id);
3480 +diff --git a/drivers/s390/crypto/vfio_ap_drv.c b/drivers/s390/crypto/vfio_ap_drv.c
3481 +index be2520cc010be..7dc72cb718b0e 100644
3482 +--- a/drivers/s390/crypto/vfio_ap_drv.c
3483 ++++ b/drivers/s390/crypto/vfio_ap_drv.c
3484 +@@ -71,15 +71,11 @@ static int vfio_ap_queue_dev_probe(struct ap_device *apdev)
3485 + static void vfio_ap_queue_dev_remove(struct ap_device *apdev)
3486 + {
3487 + struct vfio_ap_queue *q;
3488 +- int apid, apqi;
3489 +
3490 + mutex_lock(&matrix_dev->lock);
3491 + q = dev_get_drvdata(&apdev->device);
3492 ++ vfio_ap_mdev_reset_queue(q, 1);
3493 + dev_set_drvdata(&apdev->device, NULL);
3494 +- apid = AP_QID_CARD(q->apqn);
3495 +- apqi = AP_QID_QUEUE(q->apqn);
3496 +- vfio_ap_mdev_reset_queue(apid, apqi, 1);
3497 +- vfio_ap_irq_disable(q);
3498 + kfree(q);
3499 + mutex_unlock(&matrix_dev->lock);
3500 + }
3501 +diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c
3502 +index e0bde85187451..7ceb6c433b3ba 100644
3503 +--- a/drivers/s390/crypto/vfio_ap_ops.c
3504 ++++ b/drivers/s390/crypto/vfio_ap_ops.c
3505 +@@ -25,6 +25,7 @@
3506 + #define VFIO_AP_MDEV_NAME_HWVIRT "VFIO AP Passthrough Device"
3507 +
3508 + static int vfio_ap_mdev_reset_queues(struct mdev_device *mdev);
3509 ++static struct vfio_ap_queue *vfio_ap_find_queue(int apqn);
3510 +
3511 + static int match_apqn(struct device *dev, const void *data)
3512 + {
3513 +@@ -49,20 +50,15 @@ static struct vfio_ap_queue *vfio_ap_get_queue(
3514 + int apqn)
3515 + {
3516 + struct vfio_ap_queue *q;
3517 +- struct device *dev;
3518 +
3519 + if (!test_bit_inv(AP_QID_CARD(apqn), matrix_mdev->matrix.apm))
3520 + return NULL;
3521 + if (!test_bit_inv(AP_QID_QUEUE(apqn), matrix_mdev->matrix.aqm))
3522 + return NULL;
3523 +
3524 +- dev = driver_find_device(&matrix_dev->vfio_ap_drv->driver, NULL,
3525 +- &apqn, match_apqn);
3526 +- if (!dev)
3527 +- return NULL;
3528 +- q = dev_get_drvdata(dev);
3529 +- q->matrix_mdev = matrix_mdev;
3530 +- put_device(dev);
3531 ++ q = vfio_ap_find_queue(apqn);
3532 ++ if (q)
3533 ++ q->matrix_mdev = matrix_mdev;
3534 +
3535 + return q;
3536 + }
3537 +@@ -119,13 +115,18 @@ static void vfio_ap_wait_for_irqclear(int apqn)
3538 + */
3539 + static void vfio_ap_free_aqic_resources(struct vfio_ap_queue *q)
3540 + {
3541 +- if (q->saved_isc != VFIO_AP_ISC_INVALID && q->matrix_mdev)
3542 ++ if (!q)
3543 ++ return;
3544 ++ if (q->saved_isc != VFIO_AP_ISC_INVALID &&
3545 ++ !WARN_ON(!(q->matrix_mdev && q->matrix_mdev->kvm))) {
3546 + kvm_s390_gisc_unregister(q->matrix_mdev->kvm, q->saved_isc);
3547 +- if (q->saved_pfn && q->matrix_mdev)
3548 ++ q->saved_isc = VFIO_AP_ISC_INVALID;
3549 ++ }
3550 ++ if (q->saved_pfn && !WARN_ON(!q->matrix_mdev)) {
3551 + vfio_unpin_pages(mdev_dev(q->matrix_mdev->mdev),
3552 + &q->saved_pfn, 1);
3553 +- q->saved_pfn = 0;
3554 +- q->saved_isc = VFIO_AP_ISC_INVALID;
3555 ++ q->saved_pfn = 0;
3556 ++ }
3557 + }
3558 +
3559 + /**
3560 +@@ -144,7 +145,7 @@ static void vfio_ap_free_aqic_resources(struct vfio_ap_queue *q)
3561 + * Returns if ap_aqic function failed with invalid, deconfigured or
3562 + * checkstopped AP.
3563 + */
3564 +-struct ap_queue_status vfio_ap_irq_disable(struct vfio_ap_queue *q)
3565 ++static struct ap_queue_status vfio_ap_irq_disable(struct vfio_ap_queue *q)
3566 + {
3567 + struct ap_qirq_ctrl aqic_gisa = {};
3568 + struct ap_queue_status status;
3569 +@@ -1114,48 +1115,70 @@ static int vfio_ap_mdev_group_notifier(struct notifier_block *nb,
3570 + return NOTIFY_OK;
3571 + }
3572 +
3573 +-static void vfio_ap_irq_disable_apqn(int apqn)
3574 ++static struct vfio_ap_queue *vfio_ap_find_queue(int apqn)
3575 + {
3576 + struct device *dev;
3577 +- struct vfio_ap_queue *q;
3578 ++ struct vfio_ap_queue *q = NULL;
3579 +
3580 + dev = driver_find_device(&matrix_dev->vfio_ap_drv->driver, NULL,
3581 + &apqn, match_apqn);
3582 + if (dev) {
3583 + q = dev_get_drvdata(dev);
3584 +- vfio_ap_irq_disable(q);
3585 + put_device(dev);
3586 + }
3587 ++
3588 ++ return q;
3589 + }
3590 +
3591 +-int vfio_ap_mdev_reset_queue(unsigned int apid, unsigned int apqi,
3592 ++int vfio_ap_mdev_reset_queue(struct vfio_ap_queue *q,
3593 + unsigned int retry)
3594 + {
3595 + struct ap_queue_status status;
3596 ++ int ret;
3597 + int retry2 = 2;
3598 +- int apqn = AP_MKQID(apid, apqi);
3599 +
3600 +- do {
3601 +- status = ap_zapq(apqn);
3602 +- switch (status.response_code) {
3603 +- case AP_RESPONSE_NORMAL:
3604 +- while (!status.queue_empty && retry2--) {
3605 +- msleep(20);
3606 +- status = ap_tapq(apqn, NULL);
3607 +- }
3608 +- WARN_ON_ONCE(retry2 <= 0);
3609 +- return 0;
3610 +- case AP_RESPONSE_RESET_IN_PROGRESS:
3611 +- case AP_RESPONSE_BUSY:
3612 ++ if (!q)
3613 ++ return 0;
3614 ++
3615 ++retry_zapq:
3616 ++ status = ap_zapq(q->apqn);
3617 ++ switch (status.response_code) {
3618 ++ case AP_RESPONSE_NORMAL:
3619 ++ ret = 0;
3620 ++ break;
3621 ++ case AP_RESPONSE_RESET_IN_PROGRESS:
3622 ++ if (retry--) {
3623 + msleep(20);
3624 +- break;
3625 +- default:
3626 +- /* things are really broken, give up */
3627 +- return -EIO;
3628 ++ goto retry_zapq;
3629 + }
3630 +- } while (retry--);
3631 ++ ret = -EBUSY;
3632 ++ break;
3633 ++ case AP_RESPONSE_Q_NOT_AVAIL:
3634 ++ case AP_RESPONSE_DECONFIGURED:
3635 ++ case AP_RESPONSE_CHECKSTOPPED:
3636 ++ WARN_ON_ONCE(status.irq_enabled);
3637 ++ ret = -EBUSY;
3638 ++ goto free_resources;
3639 ++ default:
3640 ++ /* things are really broken, give up */
3641 ++ WARN(true, "PQAP/ZAPQ completed with invalid rc (%x)\n",
3642 ++ status.response_code);
3643 ++ return -EIO;
3644 ++ }
3645 ++
3646 ++ /* wait for the reset to take effect */
3647 ++ while (retry2--) {
3648 ++ if (status.queue_empty && !status.irq_enabled)
3649 ++ break;
3650 ++ msleep(20);
3651 ++ status = ap_tapq(q->apqn, NULL);
3652 ++ }
3653 ++ WARN_ON_ONCE(retry2 <= 0);
3654 +
3655 +- return -EBUSY;
3656 ++free_resources:
3657 ++ vfio_ap_free_aqic_resources(q);
3658 ++
3659 ++ return ret;
3660 + }
3661 +
3662 + static int vfio_ap_mdev_reset_queues(struct mdev_device *mdev)
3663 +@@ -1163,13 +1186,15 @@ static int vfio_ap_mdev_reset_queues(struct mdev_device *mdev)
3664 + int ret;
3665 + int rc = 0;
3666 + unsigned long apid, apqi;
3667 ++ struct vfio_ap_queue *q;
3668 + struct ap_matrix_mdev *matrix_mdev = mdev_get_drvdata(mdev);
3669 +
3670 + for_each_set_bit_inv(apid, matrix_mdev->matrix.apm,
3671 + matrix_mdev->matrix.apm_max + 1) {
3672 + for_each_set_bit_inv(apqi, matrix_mdev->matrix.aqm,
3673 + matrix_mdev->matrix.aqm_max + 1) {
3674 +- ret = vfio_ap_mdev_reset_queue(apid, apqi, 1);
3675 ++ q = vfio_ap_find_queue(AP_MKQID(apid, apqi));
3676 ++ ret = vfio_ap_mdev_reset_queue(q, 1);
3677 + /*
3678 + * Regardless whether a queue turns out to be busy, or
3679 + * is not operational, we need to continue resetting
3680 +@@ -1177,7 +1202,6 @@ static int vfio_ap_mdev_reset_queues(struct mdev_device *mdev)
3681 + */
3682 + if (ret)
3683 + rc = ret;
3684 +- vfio_ap_irq_disable_apqn(AP_MKQID(apid, apqi));
3685 + }
3686 + }
3687 +
3688 +diff --git a/drivers/s390/crypto/vfio_ap_private.h b/drivers/s390/crypto/vfio_ap_private.h
3689 +index f46dde56b4644..28e9d99897682 100644
3690 +--- a/drivers/s390/crypto/vfio_ap_private.h
3691 ++++ b/drivers/s390/crypto/vfio_ap_private.h
3692 +@@ -88,11 +88,6 @@ struct ap_matrix_mdev {
3693 + struct mdev_device *mdev;
3694 + };
3695 +
3696 +-extern int vfio_ap_mdev_register(void);
3697 +-extern void vfio_ap_mdev_unregister(void);
3698 +-int vfio_ap_mdev_reset_queue(unsigned int apid, unsigned int apqi,
3699 +- unsigned int retry);
3700 +-
3701 + struct vfio_ap_queue {
3702 + struct ap_matrix_mdev *matrix_mdev;
3703 + unsigned long saved_pfn;
3704 +@@ -100,5 +95,10 @@ struct vfio_ap_queue {
3705 + #define VFIO_AP_ISC_INVALID 0xff
3706 + unsigned char saved_isc;
3707 + };
3708 +-struct ap_queue_status vfio_ap_irq_disable(struct vfio_ap_queue *q);
3709 ++
3710 ++int vfio_ap_mdev_register(void);
3711 ++void vfio_ap_mdev_unregister(void);
3712 ++int vfio_ap_mdev_reset_queue(struct vfio_ap_queue *q,
3713 ++ unsigned int retry);
3714 ++
3715 + #endif /* _VFIO_AP_PRIVATE_H_ */
3716 +diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
3717 +index f9c8ae9d669ef..d389f56fff54a 100644
3718 +--- a/drivers/scsi/qla2xxx/qla_os.c
3719 ++++ b/drivers/scsi/qla2xxx/qla_os.c
3720 +@@ -42,7 +42,7 @@ MODULE_PARM_DESC(ql2xfulldump_on_mpifail,
3721 + int ql2xenforce_iocb_limit = 1;
3722 + module_param(ql2xenforce_iocb_limit, int, S_IRUGO | S_IWUSR);
3723 + MODULE_PARM_DESC(ql2xenforce_iocb_limit,
3724 +- "Enforce IOCB throttling, to avoid FW congestion. (default: 0)");
3725 ++ "Enforce IOCB throttling, to avoid FW congestion. (default: 1)");
3726 +
3727 + /*
3728 + * CT6 CTX allocation cache
3729 +diff --git a/drivers/soc/atmel/soc.c b/drivers/soc/atmel/soc.c
3730 +index 55a1f57a4d8cb..5d06ee70a36b9 100644
3731 +--- a/drivers/soc/atmel/soc.c
3732 ++++ b/drivers/soc/atmel/soc.c
3733 +@@ -265,8 +265,21 @@ struct soc_device * __init at91_soc_init(const struct at91_soc *socs)
3734 + return soc_dev;
3735 + }
3736 +
3737 ++static const struct of_device_id at91_soc_allowed_list[] __initconst = {
3738 ++ { .compatible = "atmel,at91rm9200", },
3739 ++ { .compatible = "atmel,at91sam9", },
3740 ++ { .compatible = "atmel,sama5", },
3741 ++ { .compatible = "atmel,samv7", },
3742 ++ { }
3743 ++};
3744 ++
3745 + static int __init atmel_soc_device_init(void)
3746 + {
3747 ++ struct device_node *np = of_find_node_by_path("/");
3748 ++
3749 ++ if (!of_match_node(at91_soc_allowed_list, np))
3750 ++ return 0;
3751 ++
3752 + at91_soc_init(socs);
3753 +
3754 + return 0;
3755 +diff --git a/drivers/soc/imx/Kconfig b/drivers/soc/imx/Kconfig
3756 +index a9370f4aacca9..05812f8ae7340 100644
3757 +--- a/drivers/soc/imx/Kconfig
3758 ++++ b/drivers/soc/imx/Kconfig
3759 +@@ -13,7 +13,7 @@ config SOC_IMX8M
3760 + depends on ARCH_MXC || COMPILE_TEST
3761 + default ARCH_MXC && ARM64
3762 + select SOC_BUS
3763 +- select ARM_GIC_V3 if ARCH_MXC
3764 ++ select ARM_GIC_V3 if ARCH_MXC && ARCH_MULTI_V7
3765 + help
3766 + If you say yes here you get support for the NXP i.MX8M family
3767 + support, it will provide the SoC info like SoC family,
3768 +diff --git a/drivers/spi/spi-altera.c b/drivers/spi/spi-altera.c
3769 +index cbc4c28c1541c..62ea0c9e321b4 100644
3770 +--- a/drivers/spi/spi-altera.c
3771 ++++ b/drivers/spi/spi-altera.c
3772 +@@ -254,7 +254,8 @@ static int altera_spi_probe(struct platform_device *pdev)
3773 + dev_err(&pdev->dev,
3774 + "Invalid number of chipselect: %hu\n",
3775 + pdata->num_chipselect);
3776 +- return -EINVAL;
3777 ++ err = -EINVAL;
3778 ++ goto exit;
3779 + }
3780 +
3781 + master->num_chipselect = pdata->num_chipselect;
3782 +diff --git a/drivers/staging/media/hantro/hantro_v4l2.c b/drivers/staging/media/hantro/hantro_v4l2.c
3783 +index b668a82d40ad4..f5fbdbc4ffdb1 100644
3784 +--- a/drivers/staging/media/hantro/hantro_v4l2.c
3785 ++++ b/drivers/staging/media/hantro/hantro_v4l2.c
3786 +@@ -367,7 +367,7 @@ hantro_reset_raw_fmt(struct hantro_ctx *ctx)
3787 +
3788 + hantro_reset_fmt(raw_fmt, raw_vpu_fmt);
3789 + raw_fmt->width = encoded_fmt->width;
3790 +- raw_fmt->width = encoded_fmt->width;
3791 ++ raw_fmt->height = encoded_fmt->height;
3792 + if (ctx->is_encoder)
3793 + hantro_set_fmt_out(ctx, raw_fmt);
3794 + else
3795 +diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
3796 +index 781c84a9b1b79..de7442d4834dc 100644
3797 +--- a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
3798 ++++ b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
3799 +@@ -203,7 +203,7 @@ static void _cedrus_write_ref_list(struct cedrus_ctx *ctx,
3800 + position = cedrus_buf->codec.h264.position;
3801 +
3802 + sram_array[i] |= position << 1;
3803 +- if (ref_list[i].fields & V4L2_H264_BOTTOM_FIELD_REF)
3804 ++ if (ref_list[i].fields == V4L2_H264_BOTTOM_FIELD_REF)
3805 + sram_array[i] |= BIT(0);
3806 + }
3807 +
3808 +diff --git a/drivers/tee/optee/call.c b/drivers/tee/optee/call.c
3809 +index c981757ba0d40..780d7c4fd7565 100644
3810 +--- a/drivers/tee/optee/call.c
3811 ++++ b/drivers/tee/optee/call.c
3812 +@@ -7,6 +7,7 @@
3813 + #include <linux/err.h>
3814 + #include <linux/errno.h>
3815 + #include <linux/mm.h>
3816 ++#include <linux/sched.h>
3817 + #include <linux/slab.h>
3818 + #include <linux/tee_drv.h>
3819 + #include <linux/types.h>
3820 +@@ -148,7 +149,8 @@ u32 optee_do_call_with_arg(struct tee_context *ctx, phys_addr_t parg)
3821 + */
3822 + optee_cq_wait_for_completion(&optee->call_queue, &w);
3823 + } else if (OPTEE_SMC_RETURN_IS_RPC(res.a0)) {
3824 +- might_sleep();
3825 ++ if (need_resched())
3826 ++ cond_resched();
3827 + param.a0 = res.a0;
3828 + param.a1 = res.a1;
3829 + param.a2 = res.a2;
3830 +diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
3831 +index 2f8223b2ffa45..ff87cb51747d8 100644
3832 +--- a/drivers/tty/tty_io.c
3833 ++++ b/drivers/tty/tty_io.c
3834 +@@ -1027,9 +1027,8 @@ void tty_write_message(struct tty_struct *tty, char *msg)
3835 + * write method will not be invoked in parallel for each device.
3836 + */
3837 +
3838 +-static ssize_t tty_write(struct kiocb *iocb, struct iov_iter *from)
3839 ++static ssize_t file_tty_write(struct file *file, struct kiocb *iocb, struct iov_iter *from)
3840 + {
3841 +- struct file *file = iocb->ki_filp;
3842 + struct tty_struct *tty = file_tty(file);
3843 + struct tty_ldisc *ld;
3844 + ssize_t ret;
3845 +@@ -1052,6 +1051,11 @@ static ssize_t tty_write(struct kiocb *iocb, struct iov_iter *from)
3846 + return ret;
3847 + }
3848 +
3849 ++static ssize_t tty_write(struct kiocb *iocb, struct iov_iter *from)
3850 ++{
3851 ++ return file_tty_write(iocb->ki_filp, iocb, from);
3852 ++}
3853 ++
3854 + ssize_t redirected_tty_write(struct kiocb *iocb, struct iov_iter *iter)
3855 + {
3856 + struct file *p = NULL;
3857 +@@ -1061,9 +1065,13 @@ ssize_t redirected_tty_write(struct kiocb *iocb, struct iov_iter *iter)
3858 + p = get_file(redirect);
3859 + spin_unlock(&redirect_lock);
3860 +
3861 ++ /*
3862 ++ * We know the redirected tty is just another tty, we can can
3863 ++ * call file_tty_write() directly with that file pointer.
3864 ++ */
3865 + if (p) {
3866 + ssize_t res;
3867 +- res = vfs_iocb_iter_write(p, iocb, iter);
3868 ++ res = file_tty_write(p, iocb, iter);
3869 + fput(p);
3870 + return res;
3871 + }
3872 +@@ -2306,6 +2314,12 @@ static int tioccons(struct file *file)
3873 + fput(f);
3874 + return 0;
3875 + }
3876 ++ if (file->f_op->write_iter != tty_write)
3877 ++ return -ENOTTY;
3878 ++ if (!(file->f_mode & FMODE_WRITE))
3879 ++ return -EBADF;
3880 ++ if (!(file->f_mode & FMODE_CAN_WRITE))
3881 ++ return -EINVAL;
3882 + spin_lock(&redirect_lock);
3883 + if (redirect) {
3884 + spin_unlock(&redirect_lock);
3885 +diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c
3886 +index c8f0282bb6497..18ffd0551b542 100644
3887 +--- a/drivers/xen/xenbus/xenbus_probe.c
3888 ++++ b/drivers/xen/xenbus/xenbus_probe.c
3889 +@@ -714,6 +714,23 @@ static bool xs_hvm_defer_init_for_callback(void)
3890 + #endif
3891 + }
3892 +
3893 ++static int xenbus_probe_thread(void *unused)
3894 ++{
3895 ++ DEFINE_WAIT(w);
3896 ++
3897 ++ /*
3898 ++ * We actually just want to wait for *any* trigger of xb_waitq,
3899 ++ * and run xenbus_probe() the moment it occurs.
3900 ++ */
3901 ++ prepare_to_wait(&xb_waitq, &w, TASK_INTERRUPTIBLE);
3902 ++ schedule();
3903 ++ finish_wait(&xb_waitq, &w);
3904 ++
3905 ++ DPRINTK("probing");
3906 ++ xenbus_probe();
3907 ++ return 0;
3908 ++}
3909 ++
3910 + static int __init xenbus_probe_initcall(void)
3911 + {
3912 + /*
3913 +@@ -725,6 +742,20 @@ static int __init xenbus_probe_initcall(void)
3914 + !xs_hvm_defer_init_for_callback()))
3915 + xenbus_probe();
3916 +
3917 ++ /*
3918 ++ * For XS_LOCAL, spawn a thread which will wait for xenstored
3919 ++ * or a xenstore-stubdom to be started, then probe. It will be
3920 ++ * triggered when communication starts happening, by waiting
3921 ++ * on xb_waitq.
3922 ++ */
3923 ++ if (xen_store_domain_type == XS_LOCAL) {
3924 ++ struct task_struct *probe_task;
3925 ++
3926 ++ probe_task = kthread_run(xenbus_probe_thread, NULL,
3927 ++ "xenbus_probe");
3928 ++ if (IS_ERR(probe_task))
3929 ++ return PTR_ERR(probe_task);
3930 ++ }
3931 + return 0;
3932 + }
3933 + device_initcall(xenbus_probe_initcall);
3934 +diff --git a/fs/block_dev.c b/fs/block_dev.c
3935 +index 9e84b1928b940..2ea189c1b4ffe 100644
3936 +--- a/fs/block_dev.c
3937 ++++ b/fs/block_dev.c
3938 +@@ -134,7 +134,15 @@ EXPORT_SYMBOL(truncate_bdev_range);
3939 +
3940 + static void set_init_blocksize(struct block_device *bdev)
3941 + {
3942 +- bdev->bd_inode->i_blkbits = blksize_bits(bdev_logical_block_size(bdev));
3943 ++ unsigned int bsize = bdev_logical_block_size(bdev);
3944 ++ loff_t size = i_size_read(bdev->bd_inode);
3945 ++
3946 ++ while (bsize < PAGE_SIZE) {
3947 ++ if (size & bsize)
3948 ++ break;
3949 ++ bsize <<= 1;
3950 ++ }
3951 ++ bdev->bd_inode->i_blkbits = blksize_bits(bsize);
3952 + }
3953 +
3954 + int set_blocksize(struct block_device *bdev, int size)
3955 +diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
3956 +index cef2f080fdcd5..a2111eab614f2 100644
3957 +--- a/fs/btrfs/block-group.c
3958 ++++ b/fs/btrfs/block-group.c
3959 +@@ -639,7 +639,15 @@ static noinline void caching_thread(struct btrfs_work *work)
3960 + mutex_lock(&caching_ctl->mutex);
3961 + down_read(&fs_info->commit_root_sem);
3962 +
3963 +- if (btrfs_fs_compat_ro(fs_info, FREE_SPACE_TREE))
3964 ++ /*
3965 ++ * If we are in the transaction that populated the free space tree we
3966 ++ * can't actually cache from the free space tree as our commit root and
3967 ++ * real root are the same, so we could change the contents of the blocks
3968 ++ * while caching. Instead do the slow caching in this case, and after
3969 ++ * the transaction has committed we will be safe.
3970 ++ */
3971 ++ if (btrfs_fs_compat_ro(fs_info, FREE_SPACE_TREE) &&
3972 ++ !(test_bit(BTRFS_FS_FREE_SPACE_TREE_UNTRUSTED, &fs_info->flags)))
3973 + ret = load_free_space_tree(caching_ctl);
3974 + else
3975 + ret = load_extent_tree_free(caching_ctl);
3976 +diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
3977 +index e01545538e07f..30ea9780725ff 100644
3978 +--- a/fs/btrfs/ctree.h
3979 ++++ b/fs/btrfs/ctree.h
3980 +@@ -146,6 +146,9 @@ enum {
3981 + BTRFS_FS_STATE_DEV_REPLACING,
3982 + /* The btrfs_fs_info created for self-tests */
3983 + BTRFS_FS_STATE_DUMMY_FS_INFO,
3984 ++
3985 ++ /* Indicate that we can't trust the free space tree for caching yet */
3986 ++ BTRFS_FS_FREE_SPACE_TREE_UNTRUSTED,
3987 + };
3988 +
3989 + #define BTRFS_BACKREF_REV_MAX 256
3990 +diff --git a/fs/btrfs/free-space-tree.c b/fs/btrfs/free-space-tree.c
3991 +index 6b9faf3b0e967..6cf2f7bb30c27 100644
3992 +--- a/fs/btrfs/free-space-tree.c
3993 ++++ b/fs/btrfs/free-space-tree.c
3994 +@@ -1152,6 +1152,7 @@ int btrfs_create_free_space_tree(struct btrfs_fs_info *fs_info)
3995 + return PTR_ERR(trans);
3996 +
3997 + set_bit(BTRFS_FS_CREATING_FREE_SPACE_TREE, &fs_info->flags);
3998 ++ set_bit(BTRFS_FS_FREE_SPACE_TREE_UNTRUSTED, &fs_info->flags);
3999 + free_space_root = btrfs_create_tree(trans,
4000 + BTRFS_FREE_SPACE_TREE_OBJECTID);
4001 + if (IS_ERR(free_space_root)) {
4002 +@@ -1173,11 +1174,18 @@ int btrfs_create_free_space_tree(struct btrfs_fs_info *fs_info)
4003 + btrfs_set_fs_compat_ro(fs_info, FREE_SPACE_TREE);
4004 + btrfs_set_fs_compat_ro(fs_info, FREE_SPACE_TREE_VALID);
4005 + clear_bit(BTRFS_FS_CREATING_FREE_SPACE_TREE, &fs_info->flags);
4006 ++ ret = btrfs_commit_transaction(trans);
4007 +
4008 +- return btrfs_commit_transaction(trans);
4009 ++ /*
4010 ++ * Now that we've committed the transaction any reading of our commit
4011 ++ * root will be safe, so we can cache from the free space tree now.
4012 ++ */
4013 ++ clear_bit(BTRFS_FS_FREE_SPACE_TREE_UNTRUSTED, &fs_info->flags);
4014 ++ return ret;
4015 +
4016 + abort:
4017 + clear_bit(BTRFS_FS_CREATING_FREE_SPACE_TREE, &fs_info->flags);
4018 ++ clear_bit(BTRFS_FS_FREE_SPACE_TREE_UNTRUSTED, &fs_info->flags);
4019 + btrfs_abort_transaction(trans, ret);
4020 + btrfs_end_transaction(trans);
4021 + return ret;
4022 +diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
4023 +index 6311308b32beb..f9ae3850526c6 100644
4024 +--- a/fs/btrfs/volumes.c
4025 ++++ b/fs/btrfs/volumes.c
4026 +@@ -431,7 +431,7 @@ static struct btrfs_device *__alloc_device(struct btrfs_fs_info *fs_info)
4027 +
4028 + atomic_set(&dev->reada_in_flight, 0);
4029 + atomic_set(&dev->dev_stats_ccnt, 0);
4030 +- btrfs_device_data_ordered_init(dev, fs_info);
4031 ++ btrfs_device_data_ordered_init(dev);
4032 + INIT_RADIX_TREE(&dev->reada_zones, GFP_NOFS & ~__GFP_DIRECT_RECLAIM);
4033 + INIT_RADIX_TREE(&dev->reada_extents, GFP_NOFS & ~__GFP_DIRECT_RECLAIM);
4034 + extent_io_tree_init(fs_info, &dev->alloc_state,
4035 +diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
4036 +index 232f02bd214fc..f2177263748e8 100644
4037 +--- a/fs/btrfs/volumes.h
4038 ++++ b/fs/btrfs/volumes.h
4039 +@@ -39,10 +39,10 @@ struct btrfs_io_geometry {
4040 + #if BITS_PER_LONG==32 && defined(CONFIG_SMP)
4041 + #include <linux/seqlock.h>
4042 + #define __BTRFS_NEED_DEVICE_DATA_ORDERED
4043 +-#define btrfs_device_data_ordered_init(device, info) \
4044 +- seqcount_mutex_init(&device->data_seqcount, &info->chunk_mutex)
4045 ++#define btrfs_device_data_ordered_init(device) \
4046 ++ seqcount_init(&device->data_seqcount)
4047 + #else
4048 +-#define btrfs_device_data_ordered_init(device, info) do { } while (0)
4049 ++#define btrfs_device_data_ordered_init(device) do { } while (0)
4050 + #endif
4051 +
4052 + #define BTRFS_DEV_STATE_WRITEABLE (0)
4053 +@@ -72,8 +72,7 @@ struct btrfs_device {
4054 + blk_status_t last_flush_error;
4055 +
4056 + #ifdef __BTRFS_NEED_DEVICE_DATA_ORDERED
4057 +- /* A seqcount_t with associated chunk_mutex (for lockdep) */
4058 +- seqcount_mutex_t data_seqcount;
4059 ++ seqcount_t data_seqcount;
4060 + #endif
4061 +
4062 + /* the internal btrfs device id */
4063 +@@ -164,9 +163,11 @@ btrfs_device_get_##name(const struct btrfs_device *dev) \
4064 + static inline void \
4065 + btrfs_device_set_##name(struct btrfs_device *dev, u64 size) \
4066 + { \
4067 ++ preempt_disable(); \
4068 + write_seqcount_begin(&dev->data_seqcount); \
4069 + dev->name = size; \
4070 + write_seqcount_end(&dev->data_seqcount); \
4071 ++ preempt_enable(); \
4072 + }
4073 + #elif BITS_PER_LONG==32 && defined(CONFIG_PREEMPTION)
4074 + #define BTRFS_DEVICE_GETSET_FUNCS(name) \
4075 +diff --git a/fs/io_uring.c b/fs/io_uring.c
4076 +index fd12d9327ee5b..907ecaffc3386 100644
4077 +--- a/fs/io_uring.c
4078 ++++ b/fs/io_uring.c
4079 +@@ -972,6 +972,7 @@ static int io_setup_async_rw(struct io_kiocb *req, const struct iovec *iovec,
4080 + const struct iovec *fast_iov,
4081 + struct iov_iter *iter, bool force);
4082 + static void io_req_drop_files(struct io_kiocb *req);
4083 ++static void io_req_task_queue(struct io_kiocb *req);
4084 +
4085 + static struct kmem_cache *req_cachep;
4086 +
4087 +@@ -1502,18 +1503,11 @@ static void __io_queue_deferred(struct io_ring_ctx *ctx)
4088 + do {
4089 + struct io_defer_entry *de = list_first_entry(&ctx->defer_list,
4090 + struct io_defer_entry, list);
4091 +- struct io_kiocb *link;
4092 +
4093 + if (req_need_defer(de->req, de->seq))
4094 + break;
4095 + list_del_init(&de->list);
4096 +- /* punt-init is done before queueing for defer */
4097 +- link = __io_queue_async_work(de->req);
4098 +- if (link) {
4099 +- __io_queue_linked_timeout(link);
4100 +- /* drop submission reference */
4101 +- io_put_req_deferred(link, 1);
4102 +- }
4103 ++ io_req_task_queue(de->req);
4104 + kfree(de);
4105 + } while (!list_empty(&ctx->defer_list));
4106 + }
4107 +diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
4108 +index 471bfa273dade..cbadcf6ca4da2 100644
4109 +--- a/fs/nfs/pnfs.c
4110 ++++ b/fs/nfs/pnfs.c
4111 +@@ -324,6 +324,21 @@ pnfs_grab_inode_layout_hdr(struct pnfs_layout_hdr *lo)
4112 + return NULL;
4113 + }
4114 +
4115 ++/*
4116 ++ * Compare 2 layout stateid sequence ids, to see which is newer,
4117 ++ * taking into account wraparound issues.
4118 ++ */
4119 ++static bool pnfs_seqid_is_newer(u32 s1, u32 s2)
4120 ++{
4121 ++ return (s32)(s1 - s2) > 0;
4122 ++}
4123 ++
4124 ++static void pnfs_barrier_update(struct pnfs_layout_hdr *lo, u32 newseq)
4125 ++{
4126 ++ if (pnfs_seqid_is_newer(newseq, lo->plh_barrier))
4127 ++ lo->plh_barrier = newseq;
4128 ++}
4129 ++
4130 + static void
4131 + pnfs_set_plh_return_info(struct pnfs_layout_hdr *lo, enum pnfs_iomode iomode,
4132 + u32 seq)
4133 +@@ -335,6 +350,7 @@ pnfs_set_plh_return_info(struct pnfs_layout_hdr *lo, enum pnfs_iomode iomode,
4134 + if (seq != 0) {
4135 + WARN_ON_ONCE(lo->plh_return_seq != 0 && lo->plh_return_seq != seq);
4136 + lo->plh_return_seq = seq;
4137 ++ pnfs_barrier_update(lo, seq);
4138 + }
4139 + }
4140 +
4141 +@@ -639,15 +655,6 @@ static int mark_lseg_invalid(struct pnfs_layout_segment *lseg,
4142 + return rv;
4143 + }
4144 +
4145 +-/*
4146 +- * Compare 2 layout stateid sequence ids, to see which is newer,
4147 +- * taking into account wraparound issues.
4148 +- */
4149 +-static bool pnfs_seqid_is_newer(u32 s1, u32 s2)
4150 +-{
4151 +- return (s32)(s1 - s2) > 0;
4152 +-}
4153 +-
4154 + static bool
4155 + pnfs_should_free_range(const struct pnfs_layout_range *lseg_range,
4156 + const struct pnfs_layout_range *recall_range)
4157 +@@ -984,8 +991,7 @@ pnfs_set_layout_stateid(struct pnfs_layout_hdr *lo, const nfs4_stateid *new,
4158 + new_barrier = be32_to_cpu(new->seqid);
4159 + else if (new_barrier == 0)
4160 + return;
4161 +- if (pnfs_seqid_is_newer(new_barrier, lo->plh_barrier))
4162 +- lo->plh_barrier = new_barrier;
4163 ++ pnfs_barrier_update(lo, new_barrier);
4164 + }
4165 +
4166 + static bool
4167 +@@ -1183,20 +1189,17 @@ pnfs_prepare_layoutreturn(struct pnfs_layout_hdr *lo,
4168 + return false;
4169 + set_bit(NFS_LAYOUT_RETURN, &lo->plh_flags);
4170 + pnfs_get_layout_hdr(lo);
4171 ++ nfs4_stateid_copy(stateid, &lo->plh_stateid);
4172 ++ *cred = get_cred(lo->plh_lc_cred);
4173 + if (test_bit(NFS_LAYOUT_RETURN_REQUESTED, &lo->plh_flags)) {
4174 +- nfs4_stateid_copy(stateid, &lo->plh_stateid);
4175 +- *cred = get_cred(lo->plh_lc_cred);
4176 + if (lo->plh_return_seq != 0)
4177 + stateid->seqid = cpu_to_be32(lo->plh_return_seq);
4178 + if (iomode != NULL)
4179 + *iomode = lo->plh_return_iomode;
4180 + pnfs_clear_layoutreturn_info(lo);
4181 +- return true;
4182 +- }
4183 +- nfs4_stateid_copy(stateid, &lo->plh_stateid);
4184 +- *cred = get_cred(lo->plh_lc_cred);
4185 +- if (iomode != NULL)
4186 ++ } else if (iomode != NULL)
4187 + *iomode = IOMODE_ANY;
4188 ++ pnfs_barrier_update(lo, be32_to_cpu(stateid->seqid));
4189 + return true;
4190 + }
4191 +
4192 +@@ -2418,6 +2421,7 @@ out_forget:
4193 + spin_unlock(&ino->i_lock);
4194 + lseg->pls_layout = lo;
4195 + NFS_SERVER(ino)->pnfs_curr_ld->free_lseg(lseg);
4196 ++ pnfs_free_lseg_list(&free_me);
4197 + return ERR_PTR(-EAGAIN);
4198 + }
4199 +
4200 +diff --git a/include/dt-bindings/sound/apq8016-lpass.h b/include/dt-bindings/sound/apq8016-lpass.h
4201 +index 3c3e16c0aadbf..dc605c4bc2249 100644
4202 +--- a/include/dt-bindings/sound/apq8016-lpass.h
4203 ++++ b/include/dt-bindings/sound/apq8016-lpass.h
4204 +@@ -2,9 +2,8 @@
4205 + #ifndef __DT_APQ8016_LPASS_H
4206 + #define __DT_APQ8016_LPASS_H
4207 +
4208 +-#define MI2S_PRIMARY 0
4209 +-#define MI2S_SECONDARY 1
4210 +-#define MI2S_TERTIARY 2
4211 +-#define MI2S_QUATERNARY 3
4212 ++#include <dt-bindings/sound/qcom,lpass.h>
4213 ++
4214 ++/* NOTE: Use qcom,lpass.h to define any AIF ID's for LPASS */
4215 +
4216 + #endif /* __DT_APQ8016_LPASS_H */
4217 +diff --git a/include/dt-bindings/sound/qcom,lpass.h b/include/dt-bindings/sound/qcom,lpass.h
4218 +new file mode 100644
4219 +index 0000000000000..7b0b80b38699e
4220 +--- /dev/null
4221 ++++ b/include/dt-bindings/sound/qcom,lpass.h
4222 +@@ -0,0 +1,15 @@
4223 ++/* SPDX-License-Identifier: GPL-2.0 */
4224 ++#ifndef __DT_QCOM_LPASS_H
4225 ++#define __DT_QCOM_LPASS_H
4226 ++
4227 ++#define MI2S_PRIMARY 0
4228 ++#define MI2S_SECONDARY 1
4229 ++#define MI2S_TERTIARY 2
4230 ++#define MI2S_QUATERNARY 3
4231 ++#define MI2S_QUINARY 4
4232 ++
4233 ++#define LPASS_DP_RX 5
4234 ++
4235 ++#define LPASS_MCLK0 0
4236 ++
4237 ++#endif /* __DT_QCOM_LPASS_H */
4238 +diff --git a/include/dt-bindings/sound/sc7180-lpass.h b/include/dt-bindings/sound/sc7180-lpass.h
4239 +index 56ecaafd2dc68..5c1ee8b36b197 100644
4240 +--- a/include/dt-bindings/sound/sc7180-lpass.h
4241 ++++ b/include/dt-bindings/sound/sc7180-lpass.h
4242 +@@ -2,10 +2,8 @@
4243 + #ifndef __DT_SC7180_LPASS_H
4244 + #define __DT_SC7180_LPASS_H
4245 +
4246 +-#define MI2S_PRIMARY 0
4247 +-#define MI2S_SECONDARY 1
4248 +-#define LPASS_DP_RX 2
4249 ++#include <dt-bindings/sound/qcom,lpass.h>
4250 +
4251 +-#define LPASS_MCLK0 0
4252 ++/* NOTE: Use qcom,lpass.h to define any AIF ID's for LPASS */
4253 +
4254 + #endif /* __DT_APQ8016_LPASS_H */
4255 +diff --git a/include/linux/linkage.h b/include/linux/linkage.h
4256 +index 5bcfbd972e970..dbf8506decca0 100644
4257 +--- a/include/linux/linkage.h
4258 ++++ b/include/linux/linkage.h
4259 +@@ -178,6 +178,11 @@
4260 + * Objtool generates debug info for both FUNC & CODE, but needs special
4261 + * annotations for each CODE's start (to describe the actual stack frame).
4262 + *
4263 ++ * Objtool requires that all code must be contained in an ELF symbol. Symbol
4264 ++ * names that have a .L prefix do not emit symbol table entries. .L
4265 ++ * prefixed symbols can be used within a code region, but should be avoided for
4266 ++ * denoting a range of code via ``SYM_*_START/END`` annotations.
4267 ++ *
4268 + * ALIAS -- does not generate debug info -- the aliased function will
4269 + */
4270 +
4271 +diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
4272 +index 0f23e1ed5e710..add85094f9a58 100644
4273 +--- a/include/linux/mlx5/driver.h
4274 ++++ b/include/linux/mlx5/driver.h
4275 +@@ -1213,22 +1213,4 @@ static inline bool mlx5_is_roce_enabled(struct mlx5_core_dev *dev)
4276 + return val.vbool;
4277 + }
4278 +
4279 +-/**
4280 +- * mlx5_core_net - Provide net namespace of the mlx5_core_dev
4281 +- * @dev: mlx5 core device
4282 +- *
4283 +- * mlx5_core_net() returns the net namespace of mlx5 core device.
4284 +- * This can be called only in below described limited context.
4285 +- * (a) When a devlink instance for mlx5_core is registered and
4286 +- * when devlink reload operation is disabled.
4287 +- * or
4288 +- * (b) during devlink reload reload_down() and reload_up callbacks
4289 +- * where it is ensured that devlink instance's net namespace is
4290 +- * stable.
4291 +- */
4292 +-static inline struct net *mlx5_core_net(struct mlx5_core_dev *dev)
4293 +-{
4294 +- return devlink_net(priv_to_devlink(dev));
4295 +-}
4296 +-
4297 + #endif /* MLX5_DRIVER_H */
4298 +diff --git a/include/net/tcp.h b/include/net/tcp.h
4299 +index d4ef5bf941689..fe9747ee70a6f 100644
4300 +--- a/include/net/tcp.h
4301 ++++ b/include/net/tcp.h
4302 +@@ -625,6 +625,7 @@ static inline void tcp_clear_xmit_timers(struct sock *sk)
4303 +
4304 + unsigned int tcp_sync_mss(struct sock *sk, u32 pmtu);
4305 + unsigned int tcp_current_mss(struct sock *sk);
4306 ++u32 tcp_clamp_probe0_to_user_timeout(const struct sock *sk, u32 when);
4307 +
4308 + /* Bound MSS / TSO packet size with the half of the window */
4309 + static inline int tcp_bound_to_half_wnd(struct tcp_sock *tp, int pktsize)
4310 +@@ -2065,7 +2066,7 @@ void tcp_mark_skb_lost(struct sock *sk, struct sk_buff *skb);
4311 + void tcp_newreno_mark_lost(struct sock *sk, bool snd_una_advanced);
4312 + extern s32 tcp_rack_skb_timeout(struct tcp_sock *tp, struct sk_buff *skb,
4313 + u32 reo_wnd);
4314 +-extern void tcp_rack_mark_lost(struct sock *sk);
4315 ++extern bool tcp_rack_mark_lost(struct sock *sk);
4316 + extern void tcp_rack_advance(struct tcp_sock *tp, u8 sacked, u32 end_seq,
4317 + u64 xmit_time);
4318 + extern void tcp_rack_reo_timeout(struct sock *sk);
4319 +diff --git a/include/uapi/linux/rpl.h b/include/uapi/linux/rpl.h
4320 +index 1dccb55cf8c64..708adddf9f138 100644
4321 +--- a/include/uapi/linux/rpl.h
4322 ++++ b/include/uapi/linux/rpl.h
4323 +@@ -28,10 +28,10 @@ struct ipv6_rpl_sr_hdr {
4324 + pad:4,
4325 + reserved1:16;
4326 + #elif defined(__BIG_ENDIAN_BITFIELD)
4327 +- __u32 reserved:20,
4328 ++ __u32 cmpri:4,
4329 ++ cmpre:4,
4330 + pad:4,
4331 +- cmpri:4,
4332 +- cmpre:4;
4333 ++ reserved:20;
4334 + #else
4335 + #error "Please fix <asm/byteorder.h>"
4336 + #endif
4337 +diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
4338 +index 8798a8183974e..c589c7a9562ca 100644
4339 +--- a/kernel/kexec_core.c
4340 ++++ b/kernel/kexec_core.c
4341 +@@ -1135,7 +1135,6 @@ int kernel_kexec(void)
4342 +
4343 + #ifdef CONFIG_KEXEC_JUMP
4344 + if (kexec_image->preserve_context) {
4345 +- lock_system_sleep();
4346 + pm_prepare_console();
4347 + error = freeze_processes();
4348 + if (error) {
4349 +@@ -1198,7 +1197,6 @@ int kernel_kexec(void)
4350 + thaw_processes();
4351 + Restore_console:
4352 + pm_restore_console();
4353 +- unlock_system_sleep();
4354 + }
4355 + #endif
4356 +
4357 +diff --git a/kernel/power/swap.c b/kernel/power/swap.c
4358 +index c73f2e295167d..72e33054a2e1b 100644
4359 +--- a/kernel/power/swap.c
4360 ++++ b/kernel/power/swap.c
4361 +@@ -497,10 +497,10 @@ static int swap_writer_finish(struct swap_map_handle *handle,
4362 + unsigned int flags, int error)
4363 + {
4364 + if (!error) {
4365 +- flush_swap_writer(handle);
4366 + pr_info("S");
4367 + error = mark_swapfiles(handle, flags);
4368 + pr_cont("|\n");
4369 ++ flush_swap_writer(handle);
4370 + }
4371 +
4372 + if (error)
4373 +diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
4374 +index 6bf066f924c15..fac5c1469ceee 100644
4375 +--- a/net/ipv4/tcp_input.c
4376 ++++ b/net/ipv4/tcp_input.c
4377 +@@ -2845,7 +2845,8 @@ static void tcp_identify_packet_loss(struct sock *sk, int *ack_flag)
4378 + } else if (tcp_is_rack(sk)) {
4379 + u32 prior_retrans = tp->retrans_out;
4380 +
4381 +- tcp_rack_mark_lost(sk);
4382 ++ if (tcp_rack_mark_lost(sk))
4383 ++ *ack_flag &= ~FLAG_SET_XMIT_TIMER;
4384 + if (prior_retrans > tp->retrans_out)
4385 + *ack_flag |= FLAG_LOST_RETRANS;
4386 + }
4387 +@@ -3378,8 +3379,8 @@ static void tcp_ack_probe(struct sock *sk)
4388 + } else {
4389 + unsigned long when = tcp_probe0_when(sk, TCP_RTO_MAX);
4390 +
4391 +- tcp_reset_xmit_timer(sk, ICSK_TIME_PROBE0,
4392 +- when, TCP_RTO_MAX);
4393 ++ when = tcp_clamp_probe0_to_user_timeout(sk, when);
4394 ++ tcp_reset_xmit_timer(sk, ICSK_TIME_PROBE0, when, TCP_RTO_MAX);
4395 + }
4396 + }
4397 +
4398 +@@ -3802,9 +3803,6 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)
4399 +
4400 + if (tp->tlp_high_seq)
4401 + tcp_process_tlp_ack(sk, ack, flag);
4402 +- /* If needed, reset TLP/RTO timer; RACK may later override this. */
4403 +- if (flag & FLAG_SET_XMIT_TIMER)
4404 +- tcp_set_xmit_timer(sk);
4405 +
4406 + if (tcp_ack_is_dubious(sk, flag)) {
4407 + if (!(flag & (FLAG_SND_UNA_ADVANCED | FLAG_NOT_DUP))) {
4408 +@@ -3817,6 +3815,10 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)
4409 + &rexmit);
4410 + }
4411 +
4412 ++ /* If needed, reset TLP/RTO timer when RACK doesn't set. */
4413 ++ if (flag & FLAG_SET_XMIT_TIMER)
4414 ++ tcp_set_xmit_timer(sk);
4415 ++
4416 + if ((flag & FLAG_FORWARD_PROGRESS) || !(flag & FLAG_NOT_DUP))
4417 + sk_dst_confirm(sk);
4418 +
4419 +diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
4420 +index e58e2589d7f98..f99494637ff47 100644
4421 +--- a/net/ipv4/tcp_output.c
4422 ++++ b/net/ipv4/tcp_output.c
4423 +@@ -4095,6 +4095,8 @@ void tcp_send_probe0(struct sock *sk)
4424 + */
4425 + timeout = TCP_RESOURCE_PROBE_INTERVAL;
4426 + }
4427 ++
4428 ++ timeout = tcp_clamp_probe0_to_user_timeout(sk, timeout);
4429 + tcp_reset_xmit_timer(sk, ICSK_TIME_PROBE0, timeout, TCP_RTO_MAX);
4430 + }
4431 +
4432 +diff --git a/net/ipv4/tcp_recovery.c b/net/ipv4/tcp_recovery.c
4433 +index f65a3ddd0d58a..31fc178f42c02 100644
4434 +--- a/net/ipv4/tcp_recovery.c
4435 ++++ b/net/ipv4/tcp_recovery.c
4436 +@@ -96,13 +96,13 @@ static void tcp_rack_detect_loss(struct sock *sk, u32 *reo_timeout)
4437 + }
4438 + }
4439 +
4440 +-void tcp_rack_mark_lost(struct sock *sk)
4441 ++bool tcp_rack_mark_lost(struct sock *sk)
4442 + {
4443 + struct tcp_sock *tp = tcp_sk(sk);
4444 + u32 timeout;
4445 +
4446 + if (!tp->rack.advanced)
4447 +- return;
4448 ++ return false;
4449 +
4450 + /* Reset the advanced flag to avoid unnecessary queue scanning */
4451 + tp->rack.advanced = 0;
4452 +@@ -112,6 +112,7 @@ void tcp_rack_mark_lost(struct sock *sk)
4453 + inet_csk_reset_xmit_timer(sk, ICSK_TIME_REO_TIMEOUT,
4454 + timeout, inet_csk(sk)->icsk_rto);
4455 + }
4456 ++ return !!timeout;
4457 + }
4458 +
4459 + /* Record the most recently (re)sent time among the (s)acked packets
4460 +diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
4461 +index faa92948441ba..4ef08079ccfa9 100644
4462 +--- a/net/ipv4/tcp_timer.c
4463 ++++ b/net/ipv4/tcp_timer.c
4464 +@@ -40,6 +40,24 @@ static u32 tcp_clamp_rto_to_user_timeout(const struct sock *sk)
4465 + return min_t(u32, icsk->icsk_rto, msecs_to_jiffies(remaining));
4466 + }
4467 +
4468 ++u32 tcp_clamp_probe0_to_user_timeout(const struct sock *sk, u32 when)
4469 ++{
4470 ++ struct inet_connection_sock *icsk = inet_csk(sk);
4471 ++ u32 remaining;
4472 ++ s32 elapsed;
4473 ++
4474 ++ if (!icsk->icsk_user_timeout || !icsk->icsk_probes_tstamp)
4475 ++ return when;
4476 ++
4477 ++ elapsed = tcp_jiffies32 - icsk->icsk_probes_tstamp;
4478 ++ if (unlikely(elapsed < 0))
4479 ++ elapsed = 0;
4480 ++ remaining = msecs_to_jiffies(icsk->icsk_user_timeout) - elapsed;
4481 ++ remaining = max_t(u32, remaining, TCP_TIMEOUT_MIN);
4482 ++
4483 ++ return min_t(u32, remaining, when);
4484 ++}
4485 ++
4486 + /**
4487 + * tcp_write_err() - close socket and save error info
4488 + * @sk: The socket the error has appeared on.
4489 +diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
4490 +index 2a21226fb518a..d6913784be2bd 100644
4491 +--- a/net/mac80211/ieee80211_i.h
4492 ++++ b/net/mac80211/ieee80211_i.h
4493 +@@ -1082,6 +1082,7 @@ enum queue_stop_reason {
4494 + IEEE80211_QUEUE_STOP_REASON_FLUSH,
4495 + IEEE80211_QUEUE_STOP_REASON_TDLS_TEARDOWN,
4496 + IEEE80211_QUEUE_STOP_REASON_RESERVE_TID,
4497 ++ IEEE80211_QUEUE_STOP_REASON_IFTYPE_CHANGE,
4498 +
4499 + IEEE80211_QUEUE_STOP_REASONS,
4500 + };
4501 +diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
4502 +index 44154cc596cd4..f3c3557a9e4c4 100644
4503 +--- a/net/mac80211/iface.c
4504 ++++ b/net/mac80211/iface.c
4505 +@@ -1654,6 +1654,10 @@ static int ieee80211_runtime_change_iftype(struct ieee80211_sub_if_data *sdata,
4506 + if (ret)
4507 + return ret;
4508 +
4509 ++ ieee80211_stop_vif_queues(local, sdata,
4510 ++ IEEE80211_QUEUE_STOP_REASON_IFTYPE_CHANGE);
4511 ++ synchronize_net();
4512 ++
4513 + ieee80211_do_stop(sdata, false);
4514 +
4515 + ieee80211_teardown_sdata(sdata);
4516 +@@ -1676,6 +1680,8 @@ static int ieee80211_runtime_change_iftype(struct ieee80211_sub_if_data *sdata,
4517 + err = ieee80211_do_open(&sdata->wdev, false);
4518 + WARN(err, "type change: do_open returned %d", err);
4519 +
4520 ++ ieee80211_wake_vif_queues(local, sdata,
4521 ++ IEEE80211_QUEUE_STOP_REASON_IFTYPE_CHANGE);
4522 + return ret;
4523 + }
4524 +
4525 +diff --git a/net/netfilter/nft_dynset.c b/net/netfilter/nft_dynset.c
4526 +index 4990f7cbfafdf..5c84a968dae29 100644
4527 +--- a/net/netfilter/nft_dynset.c
4528 ++++ b/net/netfilter/nft_dynset.c
4529 +@@ -204,8 +204,10 @@ static int nft_dynset_init(const struct nft_ctx *ctx,
4530 + nft_set_ext_add_length(&priv->tmpl, NFT_SET_EXT_EXPR,
4531 + priv->expr->ops->size);
4532 + if (set->flags & NFT_SET_TIMEOUT) {
4533 +- if (timeout || set->timeout)
4534 ++ if (timeout || set->timeout) {
4535 ++ nft_set_ext_add(&priv->tmpl, NFT_SET_EXT_TIMEOUT);
4536 + nft_set_ext_add(&priv->tmpl, NFT_SET_EXT_EXPIRATION);
4537 ++ }
4538 + }
4539 +
4540 + priv->timeout = timeout;
4541 +diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c
4542 +index 8709f3d4e7c4b..bec7847f8eaac 100644
4543 +--- a/net/nfc/netlink.c
4544 ++++ b/net/nfc/netlink.c
4545 +@@ -852,6 +852,7 @@ static int nfc_genl_stop_poll(struct sk_buff *skb, struct genl_info *info)
4546 +
4547 + if (!dev->polling) {
4548 + device_unlock(&dev->dev);
4549 ++ nfc_put_device(dev);
4550 + return -EINVAL;
4551 + }
4552 +
4553 +diff --git a/net/nfc/rawsock.c b/net/nfc/rawsock.c
4554 +index 955c195ae14bc..9c7eb8455ba8e 100644
4555 +--- a/net/nfc/rawsock.c
4556 ++++ b/net/nfc/rawsock.c
4557 +@@ -105,7 +105,7 @@ static int rawsock_connect(struct socket *sock, struct sockaddr *_addr,
4558 + if (addr->target_idx > dev->target_next_idx - 1 ||
4559 + addr->target_idx < dev->target_next_idx - dev->n_targets) {
4560 + rc = -EINVAL;
4561 +- goto error;
4562 ++ goto put_dev;
4563 + }
4564 +
4565 + rc = nfc_activate_target(dev, addr->target_idx, addr->nfc_protocol);
4566 +diff --git a/net/rxrpc/call_accept.c b/net/rxrpc/call_accept.c
4567 +index 8df1964db3332..a0b033954ceac 100644
4568 +--- a/net/rxrpc/call_accept.c
4569 ++++ b/net/rxrpc/call_accept.c
4570 +@@ -197,6 +197,7 @@ void rxrpc_discard_prealloc(struct rxrpc_sock *rx)
4571 + tail = b->peer_backlog_tail;
4572 + while (CIRC_CNT(head, tail, size) > 0) {
4573 + struct rxrpc_peer *peer = b->peer_backlog[tail];
4574 ++ rxrpc_put_local(peer->local);
4575 + kfree(peer);
4576 + tail = (tail + 1) & (size - 1);
4577 + }
4578 +diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
4579 +index d10916ab45267..f64e681493a59 100644
4580 +--- a/net/vmw_vsock/af_vsock.c
4581 ++++ b/net/vmw_vsock/af_vsock.c
4582 +@@ -997,9 +997,12 @@ static __poll_t vsock_poll(struct file *file, struct socket *sock,
4583 + mask |= EPOLLOUT | EPOLLWRNORM | EPOLLWRBAND;
4584 +
4585 + } else if (sock->type == SOCK_STREAM) {
4586 +- const struct vsock_transport *transport = vsk->transport;
4587 ++ const struct vsock_transport *transport;
4588 ++
4589 + lock_sock(sk);
4590 +
4591 ++ transport = vsk->transport;
4592 ++
4593 + /* Listening sockets that have connections in their accept
4594 + * queue can be read.
4595 + */
4596 +@@ -1082,10 +1085,11 @@ static int vsock_dgram_sendmsg(struct socket *sock, struct msghdr *msg,
4597 + err = 0;
4598 + sk = sock->sk;
4599 + vsk = vsock_sk(sk);
4600 +- transport = vsk->transport;
4601 +
4602 + lock_sock(sk);
4603 +
4604 ++ transport = vsk->transport;
4605 ++
4606 + err = vsock_auto_bind(vsk);
4607 + if (err)
4608 + goto out;
4609 +@@ -1544,10 +1548,11 @@ static int vsock_stream_setsockopt(struct socket *sock,
4610 + err = 0;
4611 + sk = sock->sk;
4612 + vsk = vsock_sk(sk);
4613 +- transport = vsk->transport;
4614 +
4615 + lock_sock(sk);
4616 +
4617 ++ transport = vsk->transport;
4618 ++
4619 + switch (optname) {
4620 + case SO_VM_SOCKETS_BUFFER_SIZE:
4621 + COPY_IN(val);
4622 +@@ -1680,7 +1685,6 @@ static int vsock_stream_sendmsg(struct socket *sock, struct msghdr *msg,
4623 +
4624 + sk = sock->sk;
4625 + vsk = vsock_sk(sk);
4626 +- transport = vsk->transport;
4627 + total_written = 0;
4628 + err = 0;
4629 +
4630 +@@ -1689,6 +1693,8 @@ static int vsock_stream_sendmsg(struct socket *sock, struct msghdr *msg,
4631 +
4632 + lock_sock(sk);
4633 +
4634 ++ transport = vsk->transport;
4635 ++
4636 + /* Callers should not provide a destination with stream sockets. */
4637 + if (msg->msg_namelen) {
4638 + err = sk->sk_state == TCP_ESTABLISHED ? -EISCONN : -EOPNOTSUPP;
4639 +@@ -1823,11 +1829,12 @@ vsock_stream_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
4640 +
4641 + sk = sock->sk;
4642 + vsk = vsock_sk(sk);
4643 +- transport = vsk->transport;
4644 + err = 0;
4645 +
4646 + lock_sock(sk);
4647 +
4648 ++ transport = vsk->transport;
4649 ++
4650 + if (!transport || sk->sk_state != TCP_ESTABLISHED) {
4651 + /* Recvmsg is supposed to return 0 if a peer performs an
4652 + * orderly shutdown. Differentiate between that case and when a
4653 +diff --git a/net/wireless/wext-core.c b/net/wireless/wext-core.c
4654 +index 69102fda9ebd4..76a80a41615be 100644
4655 +--- a/net/wireless/wext-core.c
4656 ++++ b/net/wireless/wext-core.c
4657 +@@ -896,8 +896,9 @@ out:
4658 + int call_commit_handler(struct net_device *dev)
4659 + {
4660 + #ifdef CONFIG_WIRELESS_EXT
4661 +- if ((netif_running(dev)) &&
4662 +- (dev->wireless_handlers->standard[0] != NULL))
4663 ++ if (netif_running(dev) &&
4664 ++ dev->wireless_handlers &&
4665 ++ dev->wireless_handlers->standard[0])
4666 + /* Call the commit handler on the driver */
4667 + return dev->wireless_handlers->standard[0](dev, NULL,
4668 + NULL, NULL);
4669 +diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c
4670 +index 37456d022cfa3..61e6220ddd5ae 100644
4671 +--- a/net/xfrm/xfrm_input.c
4672 ++++ b/net/xfrm/xfrm_input.c
4673 +@@ -660,7 +660,7 @@ resume:
4674 + /* only the first xfrm gets the encap type */
4675 + encap_type = 0;
4676 +
4677 +- if (async && x->repl->recheck(x, skb, seq)) {
4678 ++ if (x->repl->recheck(x, skb, seq)) {
4679 + XFRM_INC_STATS(net, LINUX_MIB_XFRMINSTATESEQERROR);
4680 + goto drop_unlock;
4681 + }
4682 +diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
4683 +index d622c2548d229..b74f28cabe24f 100644
4684 +--- a/net/xfrm/xfrm_policy.c
4685 ++++ b/net/xfrm/xfrm_policy.c
4686 +@@ -793,15 +793,22 @@ static int xfrm_policy_addr_delta(const xfrm_address_t *a,
4687 + const xfrm_address_t *b,
4688 + u8 prefixlen, u16 family)
4689 + {
4690 ++ u32 ma, mb, mask;
4691 + unsigned int pdw, pbi;
4692 + int delta = 0;
4693 +
4694 + switch (family) {
4695 + case AF_INET:
4696 +- if (sizeof(long) == 4 && prefixlen == 0)
4697 +- return ntohl(a->a4) - ntohl(b->a4);
4698 +- return (ntohl(a->a4) & ((~0UL << (32 - prefixlen)))) -
4699 +- (ntohl(b->a4) & ((~0UL << (32 - prefixlen))));
4700 ++ if (prefixlen == 0)
4701 ++ return 0;
4702 ++ mask = ~0U << (32 - prefixlen);
4703 ++ ma = ntohl(a->a4) & mask;
4704 ++ mb = ntohl(b->a4) & mask;
4705 ++ if (ma < mb)
4706 ++ delta = -1;
4707 ++ else if (ma > mb)
4708 ++ delta = 1;
4709 ++ break;
4710 + case AF_INET6:
4711 + pdw = prefixlen >> 5;
4712 + pbi = prefixlen & 0x1f;
4713 +@@ -812,10 +819,13 @@ static int xfrm_policy_addr_delta(const xfrm_address_t *a,
4714 + return delta;
4715 + }
4716 + if (pbi) {
4717 +- u32 mask = ~0u << (32 - pbi);
4718 +-
4719 +- delta = (ntohl(a->a6[pdw]) & mask) -
4720 +- (ntohl(b->a6[pdw]) & mask);
4721 ++ mask = ~0U << (32 - pbi);
4722 ++ ma = ntohl(a->a6[pdw]) & mask;
4723 ++ mb = ntohl(b->a6[pdw]) & mask;
4724 ++ if (ma < mb)
4725 ++ delta = -1;
4726 ++ else if (ma > mb)
4727 ++ delta = 1;
4728 + }
4729 + break;
4730 + default:
4731 +@@ -3078,8 +3088,8 @@ struct dst_entry *xfrm_lookup_with_ifid(struct net *net,
4732 + xflo.flags = flags;
4733 +
4734 + /* To accelerate a bit... */
4735 +- if ((dst_orig->flags & DST_NOXFRM) ||
4736 +- !net->xfrm.policy_count[XFRM_POLICY_OUT])
4737 ++ if (!if_id && ((dst_orig->flags & DST_NOXFRM) ||
4738 ++ !net->xfrm.policy_count[XFRM_POLICY_OUT]))
4739 + goto nopol;
4740 +
4741 + xdst = xfrm_bundle_lookup(net, fl, family, dir, &xflo, if_id);
4742 +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
4743 +index ed5b6b894dc19..290645516313c 100644
4744 +--- a/sound/pci/hda/patch_realtek.c
4745 ++++ b/sound/pci/hda/patch_realtek.c
4746 +@@ -8006,6 +8006,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
4747 + SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
4748 + SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
4749 + SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE),
4750 ++ SND_PCI_QUIRK(0x1043, 0x1982, "ASUS B1400CEPE", ALC256_FIXUP_ASUS_HPE),
4751 + SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
4752 + SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
4753 + SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
4754 +diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c
4755 +index 834367dd54e1b..a5c1a2c4eae4e 100644
4756 +--- a/sound/pci/hda/patch_via.c
4757 ++++ b/sound/pci/hda/patch_via.c
4758 +@@ -1043,7 +1043,7 @@ static const struct hda_fixup via_fixups[] = {
4759 + static const struct snd_pci_quirk vt2002p_fixups[] = {
4760 + SND_PCI_QUIRK(0x1043, 0x1487, "Asus G75", VIA_FIXUP_ASUS_G75),
4761 + SND_PCI_QUIRK(0x1043, 0x8532, "Asus X202E", VIA_FIXUP_INTMIC_BOOST),
4762 +- SND_PCI_QUIRK(0x1558, 0x3501, "Clevo W35xSS_370SS", VIA_FIXUP_POWER_SAVE),
4763 ++ SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", VIA_FIXUP_POWER_SAVE),
4764 + {}
4765 + };
4766 +
4767 +diff --git a/sound/soc/amd/renoir/rn-pci-acp3x.c b/sound/soc/amd/renoir/rn-pci-acp3x.c
4768 +index 6f153856657ae..917536def5f2a 100644
4769 +--- a/sound/soc/amd/renoir/rn-pci-acp3x.c
4770 ++++ b/sound/soc/amd/renoir/rn-pci-acp3x.c
4771 +@@ -165,10 +165,24 @@ static int rn_acp_deinit(void __iomem *acp_base)
4772 +
4773 + static const struct dmi_system_id rn_acp_quirk_table[] = {
4774 + {
4775 +- /* Lenovo IdeaPad Flex 5 14ARE05, IdeaPad 5 15ARE05 */
4776 ++ /* Lenovo IdeaPad S340-14API */
4777 + .matches = {
4778 + DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
4779 +- DMI_EXACT_MATCH(DMI_BOARD_NAME, "LNVNB161216"),
4780 ++ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "81NB"),
4781 ++ }
4782 ++ },
4783 ++ {
4784 ++ /* Lenovo IdeaPad Flex 5 14ARE05 */
4785 ++ .matches = {
4786 ++ DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
4787 ++ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "81X2"),
4788 ++ }
4789 ++ },
4790 ++ {
4791 ++ /* Lenovo IdeaPad 5 15ARE05 */
4792 ++ .matches = {
4793 ++ DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
4794 ++ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "81YQ"),
4795 + }
4796 + },
4797 + {
4798 +diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c
4799 +index 40bee10b0c65a..d699e61eca3d0 100644
4800 +--- a/sound/soc/intel/skylake/skl-topology.c
4801 ++++ b/sound/soc/intel/skylake/skl-topology.c
4802 +@@ -3619,15 +3619,16 @@ static void skl_tplg_complete(struct snd_soc_component *component)
4803 +
4804 + list_for_each_entry(dobj, &component->dobj_list, list) {
4805 + struct snd_kcontrol *kcontrol = dobj->control.kcontrol;
4806 +- struct soc_enum *se =
4807 +- (struct soc_enum *)kcontrol->private_value;
4808 +- char **texts = dobj->control.dtexts;
4809 ++ struct soc_enum *se;
4810 ++ char **texts;
4811 + char chan_text[4];
4812 +
4813 +- if (dobj->type != SND_SOC_DOBJ_ENUM ||
4814 +- dobj->control.kcontrol->put !=
4815 +- skl_tplg_multi_config_set_dmic)
4816 ++ if (dobj->type != SND_SOC_DOBJ_ENUM || !kcontrol ||
4817 ++ kcontrol->put != skl_tplg_multi_config_set_dmic)
4818 + continue;
4819 ++
4820 ++ se = (struct soc_enum *)kcontrol->private_value;
4821 ++ texts = dobj->control.dtexts;
4822 + sprintf(chan_text, "c%d", mach->mach_params.dmic_num);
4823 +
4824 + for (i = 0; i < se->items; i++) {
4825 +diff --git a/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c b/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c
4826 +index 26e7d9a7198f8..20d31b69a5c00 100644
4827 +--- a/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c
4828 ++++ b/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c
4829 +@@ -532,6 +532,7 @@ static struct snd_soc_dai_link mt8183_da7219_dai_links[] = {
4830 + .dpcm_playback = 1,
4831 + .ignore_suspend = 1,
4832 + .be_hw_params_fixup = mt8183_i2s_hw_params_fixup,
4833 ++ .ignore = 1,
4834 + .init = mt8183_da7219_max98357_hdmi_init,
4835 + SND_SOC_DAILINK_REG(tdm),
4836 + },
4837 +@@ -754,8 +755,10 @@ static int mt8183_da7219_max98357_dev_probe(struct platform_device *pdev)
4838 + }
4839 + }
4840 +
4841 +- if (hdmi_codec && strcmp(dai_link->name, "TDM") == 0)
4842 ++ if (hdmi_codec && strcmp(dai_link->name, "TDM") == 0) {
4843 + dai_link->codecs->of_node = hdmi_codec;
4844 ++ dai_link->ignore = 0;
4845 ++ }
4846 +
4847 + if (!dai_link->platforms->name)
4848 + dai_link->platforms->of_node = platform_node;
4849 +diff --git a/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c b/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c
4850 +index 327dfad41e310..79ba2f2d84522 100644
4851 +--- a/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c
4852 ++++ b/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c
4853 +@@ -515,6 +515,7 @@ static struct snd_soc_dai_link mt8183_mt6358_ts3a227_dai_links[] = {
4854 + .ignore_suspend = 1,
4855 + .be_hw_params_fixup = mt8183_i2s_hw_params_fixup,
4856 + .ops = &mt8183_mt6358_tdm_ops,
4857 ++ .ignore = 1,
4858 + .init = mt8183_mt6358_ts3a227_max98357_hdmi_init,
4859 + SND_SOC_DAILINK_REG(tdm),
4860 + },
4861 +@@ -661,8 +662,10 @@ mt8183_mt6358_ts3a227_max98357_dev_probe(struct platform_device *pdev)
4862 + SND_SOC_DAIFMT_CBM_CFM;
4863 + }
4864 +
4865 +- if (hdmi_codec && strcmp(dai_link->name, "TDM") == 0)
4866 ++ if (hdmi_codec && strcmp(dai_link->name, "TDM") == 0) {
4867 + dai_link->codecs->of_node = hdmi_codec;
4868 ++ dai_link->ignore = 0;
4869 ++ }
4870 +
4871 + if (!dai_link->platforms->name)
4872 + dai_link->platforms->of_node = platform_node;
4873 +diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c
4874 +index 426235a217ec6..46bb24afeacf0 100644
4875 +--- a/sound/soc/qcom/lpass-cpu.c
4876 ++++ b/sound/soc/qcom/lpass-cpu.c
4877 +@@ -270,18 +270,6 @@ static int lpass_cpu_daiops_trigger(struct snd_pcm_substream *substream,
4878 + struct lpaif_i2sctl *i2sctl = drvdata->i2sctl;
4879 + unsigned int id = dai->driver->id;
4880 + int ret = -EINVAL;
4881 +- unsigned int val = 0;
4882 +-
4883 +- ret = regmap_read(drvdata->lpaif_map,
4884 +- LPAIF_I2SCTL_REG(drvdata->variant, dai->driver->id), &val);
4885 +- if (ret) {
4886 +- dev_err(dai->dev, "error reading from i2sctl reg: %d\n", ret);
4887 +- return ret;
4888 +- }
4889 +- if (val == LPAIF_I2SCTL_RESET_STATE) {
4890 +- dev_err(dai->dev, "error in i2sctl register state\n");
4891 +- return -ENOTRECOVERABLE;
4892 +- }
4893 +
4894 + switch (cmd) {
4895 + case SNDRV_PCM_TRIGGER_START:
4896 +@@ -356,8 +344,30 @@ int asoc_qcom_lpass_cpu_dai_probe(struct snd_soc_dai *dai)
4897 + }
4898 + EXPORT_SYMBOL_GPL(asoc_qcom_lpass_cpu_dai_probe);
4899 +
4900 ++static int asoc_qcom_of_xlate_dai_name(struct snd_soc_component *component,
4901 ++ struct of_phandle_args *args,
4902 ++ const char **dai_name)
4903 ++{
4904 ++ struct lpass_data *drvdata = snd_soc_component_get_drvdata(component);
4905 ++ struct lpass_variant *variant = drvdata->variant;
4906 ++ int id = args->args[0];
4907 ++ int ret = -EINVAL;
4908 ++ int i;
4909 ++
4910 ++ for (i = 0; i < variant->num_dai; i++) {
4911 ++ if (variant->dai_driver[i].id == id) {
4912 ++ *dai_name = variant->dai_driver[i].name;
4913 ++ ret = 0;
4914 ++ break;
4915 ++ }
4916 ++ }
4917 ++
4918 ++ return ret;
4919 ++}
4920 ++
4921 + static const struct snd_soc_component_driver lpass_cpu_comp_driver = {
4922 + .name = "lpass-cpu",
4923 ++ .of_xlate_dai_name = asoc_qcom_of_xlate_dai_name,
4924 + };
4925 +
4926 + static bool lpass_cpu_regmap_writeable(struct device *dev, unsigned int reg)
4927 +@@ -454,20 +464,16 @@ static bool lpass_cpu_regmap_volatile(struct device *dev, unsigned int reg)
4928 + struct lpass_variant *v = drvdata->variant;
4929 + int i;
4930 +
4931 +- for (i = 0; i < v->i2s_ports; ++i)
4932 +- if (reg == LPAIF_I2SCTL_REG(v, i))
4933 +- return true;
4934 + for (i = 0; i < v->irq_ports; ++i)
4935 + if (reg == LPAIF_IRQSTAT_REG(v, i))
4936 + return true;
4937 +
4938 + for (i = 0; i < v->rdma_channels; ++i)
4939 +- if (reg == LPAIF_RDMACURR_REG(v, i) || reg == LPAIF_RDMACTL_REG(v, i))
4940 ++ if (reg == LPAIF_RDMACURR_REG(v, i))
4941 + return true;
4942 +
4943 + for (i = 0; i < v->wrdma_channels; ++i)
4944 +- if (reg == LPAIF_WRDMACURR_REG(v, i + v->wrdma_channel_start) ||
4945 +- reg == LPAIF_WRDMACTL_REG(v, i + v->wrdma_channel_start))
4946 ++ if (reg == LPAIF_WRDMACURR_REG(v, i + v->wrdma_channel_start))
4947 + return true;
4948 +
4949 + return false;
4950 +diff --git a/sound/soc/qcom/lpass-ipq806x.c b/sound/soc/qcom/lpass-ipq806x.c
4951 +index 832a9161484e7..3a45e6a26f04b 100644
4952 +--- a/sound/soc/qcom/lpass-ipq806x.c
4953 ++++ b/sound/soc/qcom/lpass-ipq806x.c
4954 +@@ -131,7 +131,7 @@ static struct lpass_variant ipq806x_data = {
4955 + .micmode = REG_FIELD_ID(0x0010, 4, 7, 5, 0x4),
4956 + .micmono = REG_FIELD_ID(0x0010, 3, 3, 5, 0x4),
4957 + .wssrc = REG_FIELD_ID(0x0010, 2, 2, 5, 0x4),
4958 +- .bitwidth = REG_FIELD_ID(0x0010, 0, 0, 5, 0x4),
4959 ++ .bitwidth = REG_FIELD_ID(0x0010, 0, 1, 5, 0x4),
4960 +
4961 + .rdma_dyncclk = REG_FIELD_ID(0x6000, 12, 12, 4, 0x1000),
4962 + .rdma_bursten = REG_FIELD_ID(0x6000, 11, 11, 4, 0x1000),
4963 +diff --git a/sound/soc/qcom/lpass-lpaif-reg.h b/sound/soc/qcom/lpass-lpaif-reg.h
4964 +index 405542832e994..baf72f124ea9b 100644
4965 +--- a/sound/soc/qcom/lpass-lpaif-reg.h
4966 ++++ b/sound/soc/qcom/lpass-lpaif-reg.h
4967 +@@ -133,7 +133,7 @@
4968 + #define LPAIF_WRDMAPERCNT_REG(v, chan) LPAIF_WRDMA_REG_ADDR(v, 0x14, (chan))
4969 +
4970 + #define LPAIF_INTFDMA_REG(v, chan, reg, dai_id) \
4971 +- ((v->dai_driver[dai_id].id == LPASS_DP_RX) ? \
4972 ++ ((dai_id == LPASS_DP_RX) ? \
4973 + LPAIF_HDMI_RDMA##reg##_REG(v, chan) : \
4974 + LPAIF_RDMA##reg##_REG(v, chan))
4975 +
4976 +diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c
4977 +index 80b09dede5f9c..71122e9eb2305 100644
4978 +--- a/sound/soc/qcom/lpass-platform.c
4979 ++++ b/sound/soc/qcom/lpass-platform.c
4980 +@@ -257,6 +257,9 @@ static int lpass_platform_pcmops_hw_params(struct snd_soc_component *component,
4981 + break;
4982 + case MI2S_PRIMARY:
4983 + case MI2S_SECONDARY:
4984 ++ case MI2S_TERTIARY:
4985 ++ case MI2S_QUATERNARY:
4986 ++ case MI2S_QUINARY:
4987 + ret = regmap_fields_write(dmactl->intf, id,
4988 + LPAIF_DMACTL_AUDINTF(dma_port));
4989 + if (ret) {
4990 +@@ -452,7 +455,6 @@ static int lpass_platform_pcmops_trigger(struct snd_soc_component *component,
4991 + unsigned int reg_irqclr = 0, val_irqclr = 0;
4992 + unsigned int reg_irqen = 0, val_irqen = 0, val_mask = 0;
4993 + unsigned int dai_id = cpu_dai->driver->id;
4994 +- unsigned int dma_ctrl_reg = 0;
4995 +
4996 + ch = pcm_data->dma_ch;
4997 + if (dir == SNDRV_PCM_STREAM_PLAYBACK) {
4998 +@@ -469,17 +471,7 @@ static int lpass_platform_pcmops_trigger(struct snd_soc_component *component,
4999 + id = pcm_data->dma_ch - v->wrdma_channel_start;
5000 + map = drvdata->lpaif_map;
5001 + }
5002 +- ret = regmap_read(map, LPAIF_DMACTL_REG(v, ch, dir, dai_id), &dma_ctrl_reg);
5003 +- if (ret) {
5004 +- dev_err(soc_runtime->dev, "error reading from rdmactl reg: %d\n", ret);
5005 +- return ret;
5006 +- }
5007 +
5008 +- if (dma_ctrl_reg == LPAIF_DMACTL_RESET_STATE ||
5009 +- dma_ctrl_reg == LPAIF_DMACTL_RESET_STATE + 1) {
5010 +- dev_err(soc_runtime->dev, "error in rdmactl register state\n");
5011 +- return -ENOTRECOVERABLE;
5012 +- }
5013 + switch (cmd) {
5014 + case SNDRV_PCM_TRIGGER_START:
5015 + case SNDRV_PCM_TRIGGER_RESUME:
5016 +@@ -500,7 +492,6 @@ static int lpass_platform_pcmops_trigger(struct snd_soc_component *component,
5017 + "error writing to rdmactl reg: %d\n", ret);
5018 + return ret;
5019 + }
5020 +- map = drvdata->hdmiif_map;
5021 + reg_irqclr = LPASS_HDMITX_APP_IRQCLEAR_REG(v);
5022 + val_irqclr = (LPAIF_IRQ_ALL(ch) |
5023 + LPAIF_IRQ_HDMI_REQ_ON_PRELOAD(ch) |
5024 +@@ -519,7 +510,9 @@ static int lpass_platform_pcmops_trigger(struct snd_soc_component *component,
5025 + break;
5026 + case MI2S_PRIMARY:
5027 + case MI2S_SECONDARY:
5028 +- map = drvdata->lpaif_map;
5029 ++ case MI2S_TERTIARY:
5030 ++ case MI2S_QUATERNARY:
5031 ++ case MI2S_QUINARY:
5032 + reg_irqclr = LPAIF_IRQCLEAR_REG(v, LPAIF_IRQ_PORT_HOST);
5033 + val_irqclr = LPAIF_IRQ_ALL(ch);
5034 +
5035 +@@ -563,7 +556,6 @@ static int lpass_platform_pcmops_trigger(struct snd_soc_component *component,
5036 + "error writing to rdmactl reg: %d\n", ret);
5037 + return ret;
5038 + }
5039 +- map = drvdata->hdmiif_map;
5040 + reg_irqen = LPASS_HDMITX_APP_IRQEN_REG(v);
5041 + val_mask = (LPAIF_IRQ_ALL(ch) |
5042 + LPAIF_IRQ_HDMI_REQ_ON_PRELOAD(ch) |
5043 +@@ -573,7 +565,9 @@ static int lpass_platform_pcmops_trigger(struct snd_soc_component *component,
5044 + break;
5045 + case MI2S_PRIMARY:
5046 + case MI2S_SECONDARY:
5047 +- map = drvdata->lpaif_map;
5048 ++ case MI2S_TERTIARY:
5049 ++ case MI2S_QUATERNARY:
5050 ++ case MI2S_QUINARY:
5051 + reg_irqen = LPAIF_IRQEN_REG(v, LPAIF_IRQ_PORT_HOST);
5052 + val_mask = LPAIF_IRQ_ALL(ch);
5053 + val_irqen = 0;
5054 +@@ -670,6 +664,9 @@ static irqreturn_t lpass_dma_interrupt_handler(
5055 + break;
5056 + case MI2S_PRIMARY:
5057 + case MI2S_SECONDARY:
5058 ++ case MI2S_TERTIARY:
5059 ++ case MI2S_QUATERNARY:
5060 ++ case MI2S_QUINARY:
5061 + map = drvdata->lpaif_map;
5062 + reg = LPAIF_IRQCLEAR_REG(v, LPAIF_IRQ_PORT_HOST);
5063 + val = 0;
5064 +diff --git a/sound/soc/qcom/lpass-sc7180.c b/sound/soc/qcom/lpass-sc7180.c
5065 +index bc998d5016000..c647e627897a2 100644
5066 +--- a/sound/soc/qcom/lpass-sc7180.c
5067 ++++ b/sound/soc/qcom/lpass-sc7180.c
5068 +@@ -20,7 +20,7 @@
5069 + #include "lpass.h"
5070 +
5071 + static struct snd_soc_dai_driver sc7180_lpass_cpu_dai_driver[] = {
5072 +- [MI2S_PRIMARY] = {
5073 ++ {
5074 + .id = MI2S_PRIMARY,
5075 + .name = "Primary MI2S",
5076 + .playback = {
5077 +@@ -43,9 +43,7 @@ static struct snd_soc_dai_driver sc7180_lpass_cpu_dai_driver[] = {
5078 + },
5079 + .probe = &asoc_qcom_lpass_cpu_dai_probe,
5080 + .ops = &asoc_qcom_lpass_cpu_dai_ops,
5081 +- },
5082 +-
5083 +- [MI2S_SECONDARY] = {
5084 ++ }, {
5085 + .id = MI2S_SECONDARY,
5086 + .name = "Secondary MI2S",
5087 + .playback = {
5088 +@@ -59,8 +57,7 @@ static struct snd_soc_dai_driver sc7180_lpass_cpu_dai_driver[] = {
5089 + },
5090 + .probe = &asoc_qcom_lpass_cpu_dai_probe,
5091 + .ops = &asoc_qcom_lpass_cpu_dai_ops,
5092 +- },
5093 +- [LPASS_DP_RX] = {
5094 ++ }, {
5095 + .id = LPASS_DP_RX,
5096 + .name = "Hdmi",
5097 + .playback = {
5098 +diff --git a/sound/soc/qcom/lpass.h b/sound/soc/qcom/lpass.h
5099 +index bccd1a05d771e..868c1c8dbd455 100644
5100 +--- a/sound/soc/qcom/lpass.h
5101 ++++ b/sound/soc/qcom/lpass.h
5102 +@@ -12,7 +12,7 @@
5103 + #include <linux/compiler.h>
5104 + #include <linux/platform_device.h>
5105 + #include <linux/regmap.h>
5106 +-#include <dt-bindings/sound/sc7180-lpass.h>
5107 ++#include <dt-bindings/sound/qcom,lpass.h>
5108 + #include "lpass-hdmi.h"
5109 +
5110 + #define LPASS_AHBIX_CLOCK_FREQUENCY 131072000
5111 +diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
5112 +index c5ef432a023ba..1030e11017b27 100644
5113 +--- a/sound/soc/soc-topology.c
5114 ++++ b/sound/soc/soc-topology.c
5115 +@@ -506,7 +506,7 @@ static void remove_dai(struct snd_soc_component *comp,
5116 + {
5117 + struct snd_soc_dai_driver *dai_drv =
5118 + container_of(dobj, struct snd_soc_dai_driver, dobj);
5119 +- struct snd_soc_dai *dai;
5120 ++ struct snd_soc_dai *dai, *_dai;
5121 +
5122 + if (pass != SOC_TPLG_PASS_PCM_DAI)
5123 + return;
5124 +@@ -514,9 +514,9 @@ static void remove_dai(struct snd_soc_component *comp,
5125 + if (dobj->ops && dobj->ops->dai_unload)
5126 + dobj->ops->dai_unload(comp, dobj);
5127 +
5128 +- for_each_component_dais(comp, dai)
5129 ++ for_each_component_dais_safe(comp, dai, _dai)
5130 + if (dai->driver == dai_drv)
5131 +- dai->driver = NULL;
5132 ++ snd_soc_unregister_dai(dai);
5133 +
5134 + kfree(dai_drv->playback.stream_name);
5135 + kfree(dai_drv->capture.stream_name);
5136 +@@ -987,7 +987,7 @@ static int soc_tplg_denum_create_values(struct soc_enum *se,
5137 + return -EINVAL;
5138 +
5139 + se->dobj.control.dvalues = kzalloc(le32_to_cpu(ec->items) *
5140 +- sizeof(u32),
5141 ++ sizeof(*se->dobj.control.dvalues),
5142 + GFP_KERNEL);
5143 + if (!se->dobj.control.dvalues)
5144 + return -ENOMEM;
5145 +@@ -1876,7 +1876,7 @@ static int soc_tplg_dai_create(struct soc_tplg *tplg,
5146 + list_add(&dai_drv->dobj.list, &tplg->comp->dobj_list);
5147 +
5148 + /* register the DAI to the component */
5149 +- dai = devm_snd_soc_register_dai(tplg->comp->dev, tplg->comp, dai_drv, false);
5150 ++ dai = snd_soc_register_dai(tplg->comp, dai_drv, false);
5151 + if (!dai)
5152 + return -ENOMEM;
5153 +
5154 +@@ -1884,6 +1884,7 @@ static int soc_tplg_dai_create(struct soc_tplg *tplg,
5155 + ret = snd_soc_dapm_new_dai_widgets(dapm, dai);
5156 + if (ret != 0) {
5157 + dev_err(dai->dev, "Failed to create DAI widgets %d\n", ret);
5158 ++ snd_soc_unregister_dai(dai);
5159 + return ret;
5160 + }
5161 +
5162 +diff --git a/sound/soc/sof/intel/Kconfig b/sound/soc/sof/intel/Kconfig
5163 +index 5bfc2f8b13b90..de7ff2d097ab9 100644
5164 +--- a/sound/soc/sof/intel/Kconfig
5165 ++++ b/sound/soc/sof/intel/Kconfig
5166 +@@ -337,7 +337,7 @@ config SND_SOC_SOF_HDA
5167 +
5168 + config SND_SOC_SOF_INTEL_SOUNDWIRE_LINK
5169 + bool "SOF support for SoundWire"
5170 +- depends on SOUNDWIRE && ACPI
5171 ++ depends on ACPI
5172 + help
5173 + This adds support for SoundWire with Sound Open Firmware
5174 + for Intel(R) platforms.
5175 +@@ -353,6 +353,7 @@ config SND_SOC_SOF_INTEL_SOUNDWIRE_LINK_BASELINE
5176 +
5177 + config SND_SOC_SOF_INTEL_SOUNDWIRE
5178 + tristate
5179 ++ select SOUNDWIRE
5180 + select SOUNDWIRE_INTEL
5181 + help
5182 + This option is not user-selectable but automagically handled by
5183 +diff --git a/tools/testing/selftests/net/forwarding/router_mpath_nh.sh b/tools/testing/selftests/net/forwarding/router_mpath_nh.sh
5184 +index cf3d26c233e8e..7fcc42bc076fa 100755
5185 +--- a/tools/testing/selftests/net/forwarding/router_mpath_nh.sh
5186 ++++ b/tools/testing/selftests/net/forwarding/router_mpath_nh.sh
5187 +@@ -197,7 +197,7 @@ multipath4_test()
5188 + t0_rp12=$(link_stats_tx_packets_get $rp12)
5189 + t0_rp13=$(link_stats_tx_packets_get $rp13)
5190 +
5191 +- ip vrf exec vrf-h1 $MZ -q -p 64 -A 192.0.2.2 -B 198.51.100.2 \
5192 ++ ip vrf exec vrf-h1 $MZ $h1 -q -p 64 -A 192.0.2.2 -B 198.51.100.2 \
5193 + -d 1msec -t udp "sp=1024,dp=0-32768"
5194 +
5195 + t1_rp12=$(link_stats_tx_packets_get $rp12)
5196 +diff --git a/tools/testing/selftests/net/forwarding/router_multipath.sh b/tools/testing/selftests/net/forwarding/router_multipath.sh
5197 +index 79a2099279621..464821c587a5e 100755
5198 +--- a/tools/testing/selftests/net/forwarding/router_multipath.sh
5199 ++++ b/tools/testing/selftests/net/forwarding/router_multipath.sh
5200 +@@ -178,7 +178,7 @@ multipath4_test()
5201 + t0_rp12=$(link_stats_tx_packets_get $rp12)
5202 + t0_rp13=$(link_stats_tx_packets_get $rp13)
5203 +
5204 +- ip vrf exec vrf-h1 $MZ -q -p 64 -A 192.0.2.2 -B 198.51.100.2 \
5205 ++ ip vrf exec vrf-h1 $MZ $h1 -q -p 64 -A 192.0.2.2 -B 198.51.100.2 \
5206 + -d 1msec -t udp "sp=1024,dp=0-32768"
5207 +
5208 + t1_rp12=$(link_stats_tx_packets_get $rp12)
5209 +diff --git a/tools/testing/selftests/net/xfrm_policy.sh b/tools/testing/selftests/net/xfrm_policy.sh
5210 +index 7a1bf94c5bd38..bdf450eaf60cf 100755
5211 +--- a/tools/testing/selftests/net/xfrm_policy.sh
5212 ++++ b/tools/testing/selftests/net/xfrm_policy.sh
5213 +@@ -202,7 +202,7 @@ check_xfrm() {
5214 + # 1: iptables -m policy rule count != 0
5215 + rval=$1
5216 + ip=$2
5217 +- lret=0
5218 ++ local lret=0
5219 +
5220 + ip netns exec ns1 ping -q -c 1 10.0.2.$ip > /dev/null
5221 +
5222 +@@ -287,6 +287,47 @@ check_hthresh_repeat()
5223 + return 0
5224 + }
5225 +
5226 ++# insert non-overlapping policies in a random order and check that
5227 ++# all of them can be fetched using the traffic selectors.
5228 ++check_random_order()
5229 ++{
5230 ++ local ns=$1
5231 ++ local log=$2
5232 ++
5233 ++ for i in $(seq 100); do
5234 ++ ip -net $ns xfrm policy flush
5235 ++ for j in $(seq 0 16 255 | sort -R); do
5236 ++ ip -net $ns xfrm policy add dst $j.0.0.0/24 dir out priority 10 action allow
5237 ++ done
5238 ++ for j in $(seq 0 16 255); do
5239 ++ if ! ip -net $ns xfrm policy get dst $j.0.0.0/24 dir out > /dev/null; then
5240 ++ echo "FAIL: $log" 1>&2
5241 ++ return 1
5242 ++ fi
5243 ++ done
5244 ++ done
5245 ++
5246 ++ for i in $(seq 100); do
5247 ++ ip -net $ns xfrm policy flush
5248 ++ for j in $(seq 0 16 255 | sort -R); do
5249 ++ local addr=$(printf "e000:0000:%02x00::/56" $j)
5250 ++ ip -net $ns xfrm policy add dst $addr dir out priority 10 action allow
5251 ++ done
5252 ++ for j in $(seq 0 16 255); do
5253 ++ local addr=$(printf "e000:0000:%02x00::/56" $j)
5254 ++ if ! ip -net $ns xfrm policy get dst $addr dir out > /dev/null; then
5255 ++ echo "FAIL: $log" 1>&2
5256 ++ return 1
5257 ++ fi
5258 ++ done
5259 ++ done
5260 ++
5261 ++ ip -net $ns xfrm policy flush
5262 ++
5263 ++ echo "PASS: $log"
5264 ++ return 0
5265 ++}
5266 ++
5267 + #check for needed privileges
5268 + if [ "$(id -u)" -ne 0 ];then
5269 + echo "SKIP: Need root privileges"
5270 +@@ -438,6 +479,8 @@ check_exceptions "exceptions and block policies after htresh change to normal"
5271 +
5272 + check_hthresh_repeat "policies with repeated htresh change"
5273 +
5274 ++check_random_order ns3 "policies inserted in random order"
5275 ++
5276 + for i in 1 2 3 4;do ip netns del ns$i;done
5277 +
5278 + exit $ret
5279 +diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
5280 +index 3083fb53861df..cf9cc0ed7e995 100644
5281 +--- a/virt/kvm/kvm_main.c
5282 ++++ b/virt/kvm/kvm_main.c
5283 +@@ -1289,6 +1289,7 @@ int __kvm_set_memory_region(struct kvm *kvm,
5284 + return -EINVAL;
5285 + /* We can read the guest memory with __xxx_user() later on. */
5286 + if ((mem->userspace_addr & (PAGE_SIZE - 1)) ||
5287 ++ (mem->userspace_addr != untagged_addr(mem->userspace_addr)) ||
5288 + !access_ok((void __user *)(unsigned long)mem->userspace_addr,
5289 + mem->memory_size))
5290 + return -EINVAL;