Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:5.4 commit in: /
Date: Thu, 06 Feb 2020 11:07:20
Message-Id: 1580987211.32bd5f68e22d35c9e6ba5f37eebfbcc26657c289.mpagano@gentoo
1 commit: 32bd5f68e22d35c9e6ba5f37eebfbcc26657c289
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Thu Feb 6 11:06:51 2020 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Thu Feb 6 11:06:51 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=32bd5f68
7
8 Linux patch 5.4.18
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1017_linux-5.4.18.patch | 3992 +++++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 3996 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index 7269f88..a0fadf6 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -111,6 +111,10 @@ Patch: 1016_linux-5.4.17.patch
21 From: http://www.kernel.org
22 Desc: Linux 5.4.17
23
24 +Patch: 1017_linux-5.4.18.patch
25 +From: http://www.kernel.org
26 +Desc: Linux 5.4.18
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/1017_linux-5.4.18.patch b/1017_linux-5.4.18.patch
33 new file mode 100644
34 index 0000000..aa79549
35 --- /dev/null
36 +++ b/1017_linux-5.4.18.patch
37 @@ -0,0 +1,3992 @@
38 +diff --git a/Documentation/ABI/testing/sysfs-class-devfreq b/Documentation/ABI/testing/sysfs-class-devfreq
39 +index 01196e19afca..75897e2fde43 100644
40 +--- a/Documentation/ABI/testing/sysfs-class-devfreq
41 ++++ b/Documentation/ABI/testing/sysfs-class-devfreq
42 +@@ -7,6 +7,13 @@ Description:
43 + The name of devfreq object denoted as ... is same as the
44 + name of device using devfreq.
45 +
46 ++What: /sys/class/devfreq/.../name
47 ++Date: November 2019
48 ++Contact: Chanwoo Choi <cw00.choi@×××××××.com>
49 ++Description:
50 ++ The /sys/class/devfreq/.../name shows the name of device
51 ++ of the corresponding devfreq object.
52 ++
53 + What: /sys/class/devfreq/.../governor
54 + Date: September 2011
55 + Contact: MyungJoo Ham <myungjoo.ham@×××××××.com>
56 +diff --git a/Makefile b/Makefile
57 +index a363a539a092..b6c151fd5227 100644
58 +--- a/Makefile
59 ++++ b/Makefile
60 +@@ -1,7 +1,7 @@
61 + # SPDX-License-Identifier: GPL-2.0
62 + VERSION = 5
63 + PATCHLEVEL = 4
64 +-SUBLEVEL = 17
65 ++SUBLEVEL = 18
66 + EXTRAVERSION =
67 + NAME = Kleptomaniac Octopus
68 +
69 +diff --git a/arch/arm/boot/dts/am335x-boneblack-common.dtsi b/arch/arm/boot/dts/am335x-boneblack-common.dtsi
70 +index 7ad079861efd..91f93bc89716 100644
71 +--- a/arch/arm/boot/dts/am335x-boneblack-common.dtsi
72 ++++ b/arch/arm/boot/dts/am335x-boneblack-common.dtsi
73 +@@ -131,6 +131,11 @@
74 + };
75 +
76 + / {
77 ++ memory@80000000 {
78 ++ device_type = "memory";
79 ++ reg = <0x80000000 0x20000000>; /* 512 MB */
80 ++ };
81 ++
82 + clk_mcasp0_fixed: clk_mcasp0_fixed {
83 + #clock-cells = <0>;
84 + compatible = "fixed-clock";
85 +diff --git a/arch/arm/boot/dts/am43x-epos-evm.dts b/arch/arm/boot/dts/am43x-epos-evm.dts
86 +index 078cb473fa7d..a6fbc088daa8 100644
87 +--- a/arch/arm/boot/dts/am43x-epos-evm.dts
88 ++++ b/arch/arm/boot/dts/am43x-epos-evm.dts
89 +@@ -848,6 +848,7 @@
90 + pinctrl-names = "default", "sleep";
91 + pinctrl-0 = <&spi0_pins_default>;
92 + pinctrl-1 = <&spi0_pins_sleep>;
93 ++ ti,pindir-d0-out-d1-in = <1>;
94 + };
95 +
96 + &spi1 {
97 +@@ -855,6 +856,7 @@
98 + pinctrl-names = "default", "sleep";
99 + pinctrl-0 = <&spi1_pins_default>;
100 + pinctrl-1 = <&spi1_pins_sleep>;
101 ++ ti,pindir-d0-out-d1-in = <1>;
102 + };
103 +
104 + &usb2_phy1 {
105 +diff --git a/arch/arm/boot/dts/am571x-idk.dts b/arch/arm/boot/dts/am571x-idk.dts
106 +index 9d6a872c2b23..10105a497c1a 100644
107 +--- a/arch/arm/boot/dts/am571x-idk.dts
108 ++++ b/arch/arm/boot/dts/am571x-idk.dts
109 +@@ -170,10 +170,6 @@
110 + gpios = <&gpio5 18 GPIO_ACTIVE_HIGH>;
111 + };
112 +
113 +-&pcie1_ep {
114 +- gpios = <&gpio3 23 GPIO_ACTIVE_HIGH>;
115 +-};
116 +-
117 + &mmc1 {
118 + pinctrl-names = "default", "hs";
119 + pinctrl-0 = <&mmc1_pins_default_no_clk_pu>;
120 +diff --git a/arch/arm/boot/dts/am572x-idk-common.dtsi b/arch/arm/boot/dts/am572x-idk-common.dtsi
121 +index a064f13b3880..ddf123620e96 100644
122 +--- a/arch/arm/boot/dts/am572x-idk-common.dtsi
123 ++++ b/arch/arm/boot/dts/am572x-idk-common.dtsi
124 +@@ -147,10 +147,6 @@
125 + gpios = <&gpio3 23 GPIO_ACTIVE_HIGH>;
126 + };
127 +
128 +-&pcie1_ep {
129 +- gpios = <&gpio3 23 GPIO_ACTIVE_HIGH>;
130 +-};
131 +-
132 + &mailbox5 {
133 + status = "okay";
134 + mbox_ipu1_ipc3x: mbox_ipu1_ipc3x {
135 +diff --git a/arch/arm/boot/dts/am57xx-beagle-x15-common.dtsi b/arch/arm/boot/dts/am57xx-beagle-x15-common.dtsi
136 +index bc76f1705c0f..a813a0cf3ff3 100644
137 +--- a/arch/arm/boot/dts/am57xx-beagle-x15-common.dtsi
138 ++++ b/arch/arm/boot/dts/am57xx-beagle-x15-common.dtsi
139 +@@ -29,6 +29,27 @@
140 + reg = <0x0 0x80000000 0x0 0x80000000>;
141 + };
142 +
143 ++ main_12v0: fixedregulator-main_12v0 {
144 ++ /* main supply */
145 ++ compatible = "regulator-fixed";
146 ++ regulator-name = "main_12v0";
147 ++ regulator-min-microvolt = <12000000>;
148 ++ regulator-max-microvolt = <12000000>;
149 ++ regulator-always-on;
150 ++ regulator-boot-on;
151 ++ };
152 ++
153 ++ evm_5v0: fixedregulator-evm_5v0 {
154 ++ /* Output of TPS54531D */
155 ++ compatible = "regulator-fixed";
156 ++ regulator-name = "evm_5v0";
157 ++ regulator-min-microvolt = <5000000>;
158 ++ regulator-max-microvolt = <5000000>;
159 ++ vin-supply = <&main_12v0>;
160 ++ regulator-always-on;
161 ++ regulator-boot-on;
162 ++ };
163 ++
164 + vdd_3v3: fixedregulator-vdd_3v3 {
165 + compatible = "regulator-fixed";
166 + regulator-name = "vdd_3v3";
167 +@@ -547,10 +568,6 @@
168 + gpios = <&gpio2 8 GPIO_ACTIVE_LOW>;
169 + };
170 +
171 +-&pcie1_ep {
172 +- gpios = <&gpio2 8 GPIO_ACTIVE_LOW>;
173 +-};
174 +-
175 + &mcasp3 {
176 + #sound-dai-cells = <0>;
177 + assigned-clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP3_CLKCTRL 24>;
178 +diff --git a/arch/arm/boot/dts/sun8i-a83t-cubietruck-plus.dts b/arch/arm/boot/dts/sun8i-a83t-cubietruck-plus.dts
179 +index fb928503ad45..d9be511f054f 100644
180 +--- a/arch/arm/boot/dts/sun8i-a83t-cubietruck-plus.dts
181 ++++ b/arch/arm/boot/dts/sun8i-a83t-cubietruck-plus.dts
182 +@@ -101,7 +101,7 @@
183 + initial-mode = <1>; /* initialize in HUB mode */
184 + disabled-ports = <1>;
185 + intn-gpios = <&pio 7 5 GPIO_ACTIVE_HIGH>; /* PH5 */
186 +- reset-gpios = <&pio 4 16 GPIO_ACTIVE_HIGH>; /* PE16 */
187 ++ reset-gpios = <&pio 4 16 GPIO_ACTIVE_LOW>; /* PE16 */
188 + connect-gpios = <&pio 4 17 GPIO_ACTIVE_HIGH>; /* PE17 */
189 + refclk-frequency = <19200000>;
190 + };
191 +diff --git a/arch/arm/kernel/hyp-stub.S b/arch/arm/kernel/hyp-stub.S
192 +index ae5020302de4..6607fa817bba 100644
193 +--- a/arch/arm/kernel/hyp-stub.S
194 ++++ b/arch/arm/kernel/hyp-stub.S
195 +@@ -146,10 +146,9 @@ ARM_BE8(orr r7, r7, #(1 << 25)) @ HSCTLR.EE
196 + #if !defined(ZIMAGE) && defined(CONFIG_ARM_ARCH_TIMER)
197 + @ make CNTP_* and CNTPCT accessible from PL1
198 + mrc p15, 0, r7, c0, c1, 1 @ ID_PFR1
199 +- lsr r7, #16
200 +- and r7, #0xf
201 +- cmp r7, #1
202 +- bne 1f
203 ++ ubfx r7, r7, #16, #4
204 ++ teq r7, #0
205 ++ beq 1f
206 + mrc p15, 4, r7, c14, c1, 0 @ CNTHCTL
207 + orr r7, r7, #3 @ PL1PCEN | PL1PCTEN
208 + mcr p15, 4, r7, c14, c1, 0 @ CNTHCTL
209 +diff --git a/arch/arm64/boot/Makefile b/arch/arm64/boot/Makefile
210 +index 1f012c506434..cd3414898d10 100644
211 +--- a/arch/arm64/boot/Makefile
212 ++++ b/arch/arm64/boot/Makefile
213 +@@ -16,7 +16,7 @@
214 +
215 + OBJCOPYFLAGS_Image :=-O binary -R .note -R .note.gnu.build-id -R .comment -S
216 +
217 +-targets := Image Image.gz
218 ++targets := Image Image.bz2 Image.gz Image.lz4 Image.lzma Image.lzo
219 +
220 + $(obj)/Image: vmlinux FORCE
221 + $(call if_changed,objcopy)
222 +diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-sei610.dts b/arch/arm64/boot/dts/amlogic/meson-sm1-sei610.dts
223 +index 3435aaa4e8db..5d6a8dafe8dc 100644
224 +--- a/arch/arm64/boot/dts/amlogic/meson-sm1-sei610.dts
225 ++++ b/arch/arm64/boot/dts/amlogic/meson-sm1-sei610.dts
226 +@@ -361,6 +361,8 @@
227 +
228 + bluetooth {
229 + compatible = "brcm,bcm43438-bt";
230 ++ interrupt-parent = <&gpio_intc>;
231 ++ interrupts = <95 IRQ_TYPE_LEVEL_HIGH>;
232 + shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>;
233 + max-speed = <2000000>;
234 + clocks = <&wifi32k>;
235 +diff --git a/arch/parisc/kernel/drivers.c b/arch/parisc/kernel/drivers.c
236 +index a6c9f49c6612..a5f3e50fe976 100644
237 +--- a/arch/parisc/kernel/drivers.c
238 ++++ b/arch/parisc/kernel/drivers.c
239 +@@ -889,8 +889,8 @@ static void print_parisc_device(struct parisc_device *dev)
240 + static int count;
241 +
242 + print_pa_hwpath(dev, hw_path);
243 +- pr_info("%d. %s at 0x%px [%s] { %d, 0x%x, 0x%.3x, 0x%.5x }",
244 +- ++count, dev->name, (void*) dev->hpa.start, hw_path, dev->id.hw_type,
245 ++ pr_info("%d. %s at %pap [%s] { %d, 0x%x, 0x%.3x, 0x%.5x }",
246 ++ ++count, dev->name, &(dev->hpa.start), hw_path, dev->id.hw_type,
247 + dev->id.hversion_rev, dev->id.hversion, dev->id.sversion);
248 +
249 + if (dev->num_addrs) {
250 +diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0-best-effort.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0-best-effort.dtsi
251 +index e1a961f05dcd..baa0c503e741 100644
252 +--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0-best-effort.dtsi
253 ++++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0-best-effort.dtsi
254 +@@ -63,6 +63,7 @@ fman@400000 {
255 + #size-cells = <0>;
256 + compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
257 + reg = <0xe1000 0x1000>;
258 ++ fsl,erratum-a011043; /* must ignore read errors */
259 +
260 + pcsphy0: ethernet-phy@0 {
261 + reg = <0x0>;
262 +diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0.dtsi
263 +index c288f3c6c637..93095600e808 100644
264 +--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0.dtsi
265 ++++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0.dtsi
266 +@@ -60,6 +60,7 @@ fman@400000 {
267 + #size-cells = <0>;
268 + compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
269 + reg = <0xf1000 0x1000>;
270 ++ fsl,erratum-a011043; /* must ignore read errors */
271 +
272 + pcsphy6: ethernet-phy@0 {
273 + reg = <0x0>;
274 +diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1-best-effort.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1-best-effort.dtsi
275 +index 94f3e7175012..ff4bd38f0645 100644
276 +--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1-best-effort.dtsi
277 ++++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1-best-effort.dtsi
278 +@@ -63,6 +63,7 @@ fman@400000 {
279 + #size-cells = <0>;
280 + compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
281 + reg = <0xe3000 0x1000>;
282 ++ fsl,erratum-a011043; /* must ignore read errors */
283 +
284 + pcsphy1: ethernet-phy@0 {
285 + reg = <0x0>;
286 +diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1.dtsi
287 +index 94a76982d214..1fa38ed6f59e 100644
288 +--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1.dtsi
289 ++++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1.dtsi
290 +@@ -60,6 +60,7 @@ fman@400000 {
291 + #size-cells = <0>;
292 + compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
293 + reg = <0xf3000 0x1000>;
294 ++ fsl,erratum-a011043; /* must ignore read errors */
295 +
296 + pcsphy7: ethernet-phy@0 {
297 + reg = <0x0>;
298 +diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-0.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-0.dtsi
299 +index b5ff5f71c6b8..a8cc9780c0c4 100644
300 +--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-0.dtsi
301 ++++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-0.dtsi
302 +@@ -59,6 +59,7 @@ fman@400000 {
303 + #size-cells = <0>;
304 + compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
305 + reg = <0xe1000 0x1000>;
306 ++ fsl,erratum-a011043; /* must ignore read errors */
307 +
308 + pcsphy0: ethernet-phy@0 {
309 + reg = <0x0>;
310 +diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-1.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-1.dtsi
311 +index ee44182c6348..8b8bd70c9382 100644
312 +--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-1.dtsi
313 ++++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-1.dtsi
314 +@@ -59,6 +59,7 @@ fman@400000 {
315 + #size-cells = <0>;
316 + compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
317 + reg = <0xe3000 0x1000>;
318 ++ fsl,erratum-a011043; /* must ignore read errors */
319 +
320 + pcsphy1: ethernet-phy@0 {
321 + reg = <0x0>;
322 +diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-2.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-2.dtsi
323 +index f05f0d775039..619c880b54d8 100644
324 +--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-2.dtsi
325 ++++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-2.dtsi
326 +@@ -59,6 +59,7 @@ fman@400000 {
327 + #size-cells = <0>;
328 + compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
329 + reg = <0xe5000 0x1000>;
330 ++ fsl,erratum-a011043; /* must ignore read errors */
331 +
332 + pcsphy2: ethernet-phy@0 {
333 + reg = <0x0>;
334 +diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-3.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-3.dtsi
335 +index a9114ec51075..d7ebb73a400d 100644
336 +--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-3.dtsi
337 ++++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-3.dtsi
338 +@@ -59,6 +59,7 @@ fman@400000 {
339 + #size-cells = <0>;
340 + compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
341 + reg = <0xe7000 0x1000>;
342 ++ fsl,erratum-a011043; /* must ignore read errors */
343 +
344 + pcsphy3: ethernet-phy@0 {
345 + reg = <0x0>;
346 +diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-4.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-4.dtsi
347 +index 44dd00ac7367..b151d696a069 100644
348 +--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-4.dtsi
349 ++++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-4.dtsi
350 +@@ -59,6 +59,7 @@ fman@400000 {
351 + #size-cells = <0>;
352 + compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
353 + reg = <0xe9000 0x1000>;
354 ++ fsl,erratum-a011043; /* must ignore read errors */
355 +
356 + pcsphy4: ethernet-phy@0 {
357 + reg = <0x0>;
358 +diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-5.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-5.dtsi
359 +index 5b1b84b58602..adc0ae0013a3 100644
360 +--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-5.dtsi
361 ++++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-5.dtsi
362 +@@ -59,6 +59,7 @@ fman@400000 {
363 + #size-cells = <0>;
364 + compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
365 + reg = <0xeb000 0x1000>;
366 ++ fsl,erratum-a011043; /* must ignore read errors */
367 +
368 + pcsphy5: ethernet-phy@0 {
369 + reg = <0x0>;
370 +diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-0.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-0.dtsi
371 +index 0e1daaef9e74..435047e0e250 100644
372 +--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-0.dtsi
373 ++++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-0.dtsi
374 +@@ -60,6 +60,7 @@ fman@500000 {
375 + #size-cells = <0>;
376 + compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
377 + reg = <0xf1000 0x1000>;
378 ++ fsl,erratum-a011043; /* must ignore read errors */
379 +
380 + pcsphy14: ethernet-phy@0 {
381 + reg = <0x0>;
382 +diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-1.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-1.dtsi
383 +index 68c5ef779266..c098657cca0a 100644
384 +--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-1.dtsi
385 ++++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-1.dtsi
386 +@@ -60,6 +60,7 @@ fman@500000 {
387 + #size-cells = <0>;
388 + compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
389 + reg = <0xf3000 0x1000>;
390 ++ fsl,erratum-a011043; /* must ignore read errors */
391 +
392 + pcsphy15: ethernet-phy@0 {
393 + reg = <0x0>;
394 +diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-0.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-0.dtsi
395 +index 605363cc1117..9d06824815f3 100644
396 +--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-0.dtsi
397 ++++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-0.dtsi
398 +@@ -59,6 +59,7 @@ fman@500000 {
399 + #size-cells = <0>;
400 + compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
401 + reg = <0xe1000 0x1000>;
402 ++ fsl,erratum-a011043; /* must ignore read errors */
403 +
404 + pcsphy8: ethernet-phy@0 {
405 + reg = <0x0>;
406 +diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-1.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-1.dtsi
407 +index 1955dfa13634..70e947730c4b 100644
408 +--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-1.dtsi
409 ++++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-1.dtsi
410 +@@ -59,6 +59,7 @@ fman@500000 {
411 + #size-cells = <0>;
412 + compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
413 + reg = <0xe3000 0x1000>;
414 ++ fsl,erratum-a011043; /* must ignore read errors */
415 +
416 + pcsphy9: ethernet-phy@0 {
417 + reg = <0x0>;
418 +diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-2.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-2.dtsi
419 +index 2c1476454ee0..ad96e6529595 100644
420 +--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-2.dtsi
421 ++++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-2.dtsi
422 +@@ -59,6 +59,7 @@ fman@500000 {
423 + #size-cells = <0>;
424 + compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
425 + reg = <0xe5000 0x1000>;
426 ++ fsl,erratum-a011043; /* must ignore read errors */
427 +
428 + pcsphy10: ethernet-phy@0 {
429 + reg = <0x0>;
430 +diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-3.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-3.dtsi
431 +index b8b541ff5fb0..034bc4b71f7a 100644
432 +--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-3.dtsi
433 ++++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-3.dtsi
434 +@@ -59,6 +59,7 @@ fman@500000 {
435 + #size-cells = <0>;
436 + compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
437 + reg = <0xe7000 0x1000>;
438 ++ fsl,erratum-a011043; /* must ignore read errors */
439 +
440 + pcsphy11: ethernet-phy@0 {
441 + reg = <0x0>;
442 +diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-4.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-4.dtsi
443 +index 4b2cfddd1b15..93ca23d82b39 100644
444 +--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-4.dtsi
445 ++++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-4.dtsi
446 +@@ -59,6 +59,7 @@ fman@500000 {
447 + #size-cells = <0>;
448 + compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
449 + reg = <0xe9000 0x1000>;
450 ++ fsl,erratum-a011043; /* must ignore read errors */
451 +
452 + pcsphy12: ethernet-phy@0 {
453 + reg = <0x0>;
454 +diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-5.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-5.dtsi
455 +index 0a52ddf7cc17..23b3117a2fd2 100644
456 +--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-5.dtsi
457 ++++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-5.dtsi
458 +@@ -59,6 +59,7 @@ fman@500000 {
459 + #size-cells = <0>;
460 + compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
461 + reg = <0xeb000 0x1000>;
462 ++ fsl,erratum-a011043; /* must ignore read errors */
463 +
464 + pcsphy13: ethernet-phy@0 {
465 + reg = <0x0>;
466 +diff --git a/arch/riscv/kernel/vdso/Makefile b/arch/riscv/kernel/vdso/Makefile
467 +index 49a5852fd07d..33b16f4212f7 100644
468 +--- a/arch/riscv/kernel/vdso/Makefile
469 ++++ b/arch/riscv/kernel/vdso/Makefile
470 +@@ -58,7 +58,8 @@ quiet_cmd_vdsold = VDSOLD $@
471 + cmd_vdsold = $(CC) $(KBUILD_CFLAGS) $(call cc-option, -no-pie) -nostdlib -nostartfiles $(SYSCFLAGS_$(@F)) \
472 + -Wl,-T,$(filter-out FORCE,$^) -o $@.tmp && \
473 + $(CROSS_COMPILE)objcopy \
474 +- $(patsubst %, -G __vdso_%, $(vdso-syms)) $@.tmp $@
475 ++ $(patsubst %, -G __vdso_%, $(vdso-syms)) $@.tmp $@ && \
476 ++ rm $@.tmp
477 +
478 + # install commands for the unstripped file
479 + quiet_cmd_vdso_install = INSTALL $@
480 +diff --git a/arch/x86/events/intel/uncore_snb.c b/arch/x86/events/intel/uncore_snb.c
481 +index dbaa1b088a30..c37cb12d0ef6 100644
482 +--- a/arch/x86/events/intel/uncore_snb.c
483 ++++ b/arch/x86/events/intel/uncore_snb.c
484 +@@ -15,6 +15,7 @@
485 + #define PCI_DEVICE_ID_INTEL_SKL_HQ_IMC 0x1910
486 + #define PCI_DEVICE_ID_INTEL_SKL_SD_IMC 0x190f
487 + #define PCI_DEVICE_ID_INTEL_SKL_SQ_IMC 0x191f
488 ++#define PCI_DEVICE_ID_INTEL_SKL_E3_IMC 0x1918
489 + #define PCI_DEVICE_ID_INTEL_KBL_Y_IMC 0x590c
490 + #define PCI_DEVICE_ID_INTEL_KBL_U_IMC 0x5904
491 + #define PCI_DEVICE_ID_INTEL_KBL_UQ_IMC 0x5914
492 +@@ -657,6 +658,10 @@ static const struct pci_device_id skl_uncore_pci_ids[] = {
493 + PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SKL_SQ_IMC),
494 + .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
495 + },
496 ++ { /* IMC */
497 ++ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SKL_E3_IMC),
498 ++ .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
499 ++ },
500 + { /* IMC */
501 + PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_KBL_Y_IMC),
502 + .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
503 +@@ -826,6 +831,7 @@ static const struct imc_uncore_pci_dev desktop_imc_pci_ids[] = {
504 + IMC_DEV(SKL_HQ_IMC, &skl_uncore_pci_driver), /* 6th Gen Core H Quad Core */
505 + IMC_DEV(SKL_SD_IMC, &skl_uncore_pci_driver), /* 6th Gen Core S Dual Core */
506 + IMC_DEV(SKL_SQ_IMC, &skl_uncore_pci_driver), /* 6th Gen Core S Quad Core */
507 ++ IMC_DEV(SKL_E3_IMC, &skl_uncore_pci_driver), /* Xeon E3 V5 Gen Core processor */
508 + IMC_DEV(KBL_Y_IMC, &skl_uncore_pci_driver), /* 7th Gen Core Y */
509 + IMC_DEV(KBL_U_IMC, &skl_uncore_pci_driver), /* 7th Gen Core U */
510 + IMC_DEV(KBL_UQ_IMC, &skl_uncore_pci_driver), /* 7th Gen Core U Quad Core */
511 +diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c
512 +index 011644802ce7..ad20220af303 100644
513 +--- a/arch/x86/events/intel/uncore_snbep.c
514 ++++ b/arch/x86/events/intel/uncore_snbep.c
515 +@@ -369,11 +369,6 @@
516 + #define SNR_M2M_PCI_PMON_BOX_CTL 0x438
517 + #define SNR_M2M_PCI_PMON_UMASK_EXT 0xff
518 +
519 +-/* SNR PCIE3 */
520 +-#define SNR_PCIE3_PCI_PMON_CTL0 0x508
521 +-#define SNR_PCIE3_PCI_PMON_CTR0 0x4e8
522 +-#define SNR_PCIE3_PCI_PMON_BOX_CTL 0x4e4
523 +-
524 + /* SNR IMC */
525 + #define SNR_IMC_MMIO_PMON_FIXED_CTL 0x54
526 + #define SNR_IMC_MMIO_PMON_FIXED_CTR 0x38
527 +@@ -4328,27 +4323,12 @@ static struct intel_uncore_type snr_uncore_m2m = {
528 + .format_group = &snr_m2m_uncore_format_group,
529 + };
530 +
531 +-static struct intel_uncore_type snr_uncore_pcie3 = {
532 +- .name = "pcie3",
533 +- .num_counters = 4,
534 +- .num_boxes = 1,
535 +- .perf_ctr_bits = 48,
536 +- .perf_ctr = SNR_PCIE3_PCI_PMON_CTR0,
537 +- .event_ctl = SNR_PCIE3_PCI_PMON_CTL0,
538 +- .event_mask = SNBEP_PMON_RAW_EVENT_MASK,
539 +- .box_ctl = SNR_PCIE3_PCI_PMON_BOX_CTL,
540 +- .ops = &ivbep_uncore_pci_ops,
541 +- .format_group = &ivbep_uncore_format_group,
542 +-};
543 +-
544 + enum {
545 + SNR_PCI_UNCORE_M2M,
546 +- SNR_PCI_UNCORE_PCIE3,
547 + };
548 +
549 + static struct intel_uncore_type *snr_pci_uncores[] = {
550 + [SNR_PCI_UNCORE_M2M] = &snr_uncore_m2m,
551 +- [SNR_PCI_UNCORE_PCIE3] = &snr_uncore_pcie3,
552 + NULL,
553 + };
554 +
555 +@@ -4357,10 +4337,6 @@ static const struct pci_device_id snr_uncore_pci_ids[] = {
556 + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x344a),
557 + .driver_data = UNCORE_PCI_DEV_FULL_DATA(12, 0, SNR_PCI_UNCORE_M2M, 0),
558 + },
559 +- { /* PCIe3 */
560 +- PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x334a),
561 +- .driver_data = UNCORE_PCI_DEV_FULL_DATA(4, 0, SNR_PCI_UNCORE_PCIE3, 0),
562 +- },
563 + { /* end: all zeroes */ }
564 + };
565 +
566 +diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
567 +index dac7209a0708..954fd048ad9b 100644
568 +--- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
569 ++++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
570 +@@ -1970,7 +1970,7 @@ static int rdt_get_tree(struct fs_context *fc)
571 +
572 + if (rdt_mon_capable) {
573 + ret = mongroup_create_dir(rdtgroup_default.kn,
574 +- NULL, "mon_groups",
575 ++ &rdtgroup_default, "mon_groups",
576 + &kn_mongrp);
577 + if (ret < 0)
578 + goto out_info;
579 +@@ -2205,7 +2205,11 @@ static void free_all_child_rdtgrp(struct rdtgroup *rdtgrp)
580 + list_for_each_entry_safe(sentry, stmp, head, mon.crdtgrp_list) {
581 + free_rmid(sentry->mon.rmid);
582 + list_del(&sentry->mon.crdtgrp_list);
583 +- kfree(sentry);
584 ++
585 ++ if (atomic_read(&sentry->waitcount) != 0)
586 ++ sentry->flags = RDT_DELETED;
587 ++ else
588 ++ kfree(sentry);
589 + }
590 + }
591 +
592 +@@ -2243,7 +2247,11 @@ static void rmdir_all_sub(void)
593 +
594 + kernfs_remove(rdtgrp->kn);
595 + list_del(&rdtgrp->rdtgroup_list);
596 +- kfree(rdtgrp);
597 ++
598 ++ if (atomic_read(&rdtgrp->waitcount) != 0)
599 ++ rdtgrp->flags = RDT_DELETED;
600 ++ else
601 ++ kfree(rdtgrp);
602 + }
603 + /* Notify online CPUs to update per cpu storage and PQR_ASSOC MSR */
604 + update_closid_rmid(cpu_online_mask, &rdtgroup_default);
605 +@@ -2446,7 +2454,7 @@ static int mkdir_mondata_all(struct kernfs_node *parent_kn,
606 + /*
607 + * Create the mon_data directory first.
608 + */
609 +- ret = mongroup_create_dir(parent_kn, NULL, "mon_data", &kn);
610 ++ ret = mongroup_create_dir(parent_kn, prgrp, "mon_data", &kn);
611 + if (ret)
612 + return ret;
613 +
614 +@@ -2645,7 +2653,7 @@ static int mkdir_rdt_prepare(struct kernfs_node *parent_kn,
615 + uint files = 0;
616 + int ret;
617 +
618 +- prdtgrp = rdtgroup_kn_lock_live(prgrp_kn);
619 ++ prdtgrp = rdtgroup_kn_lock_live(parent_kn);
620 + if (!prdtgrp) {
621 + ret = -ENODEV;
622 + goto out_unlock;
623 +@@ -2718,7 +2726,7 @@ static int mkdir_rdt_prepare(struct kernfs_node *parent_kn,
624 + kernfs_activate(kn);
625 +
626 + /*
627 +- * The caller unlocks the prgrp_kn upon success.
628 ++ * The caller unlocks the parent_kn upon success.
629 + */
630 + return 0;
631 +
632 +@@ -2729,7 +2737,7 @@ out_destroy:
633 + out_free_rgrp:
634 + kfree(rdtgrp);
635 + out_unlock:
636 +- rdtgroup_kn_unlock(prgrp_kn);
637 ++ rdtgroup_kn_unlock(parent_kn);
638 + return ret;
639 + }
640 +
641 +@@ -2767,7 +2775,7 @@ static int rdtgroup_mkdir_mon(struct kernfs_node *parent_kn,
642 + */
643 + list_add_tail(&rdtgrp->mon.crdtgrp_list, &prgrp->mon.crdtgrp_list);
644 +
645 +- rdtgroup_kn_unlock(prgrp_kn);
646 ++ rdtgroup_kn_unlock(parent_kn);
647 + return ret;
648 + }
649 +
650 +@@ -2810,7 +2818,7 @@ static int rdtgroup_mkdir_ctrl_mon(struct kernfs_node *parent_kn,
651 + * Create an empty mon_groups directory to hold the subset
652 + * of tasks and cpus to monitor.
653 + */
654 +- ret = mongroup_create_dir(kn, NULL, "mon_groups", NULL);
655 ++ ret = mongroup_create_dir(kn, rdtgrp, "mon_groups", NULL);
656 + if (ret) {
657 + rdt_last_cmd_puts("kernfs subdir error\n");
658 + goto out_del_list;
659 +@@ -2826,7 +2834,7 @@ out_id_free:
660 + out_common_fail:
661 + mkdir_rdt_prepare_clean(rdtgrp);
662 + out_unlock:
663 +- rdtgroup_kn_unlock(prgrp_kn);
664 ++ rdtgroup_kn_unlock(parent_kn);
665 + return ret;
666 + }
667 +
668 +@@ -2952,13 +2960,13 @@ static int rdtgroup_rmdir_ctrl(struct kernfs_node *kn, struct rdtgroup *rdtgrp,
669 + closid_free(rdtgrp->closid);
670 + free_rmid(rdtgrp->mon.rmid);
671 +
672 ++ rdtgroup_ctrl_remove(kn, rdtgrp);
673 ++
674 + /*
675 + * Free all the child monitor group rmids.
676 + */
677 + free_all_child_rdtgrp(rdtgrp);
678 +
679 +- rdtgroup_ctrl_remove(kn, rdtgrp);
680 +-
681 + return 0;
682 + }
683 +
684 +diff --git a/drivers/char/ttyprintk.c b/drivers/char/ttyprintk.c
685 +index 4f24e46ebe7c..56db949a7b70 100644
686 +--- a/drivers/char/ttyprintk.c
687 ++++ b/drivers/char/ttyprintk.c
688 +@@ -15,10 +15,11 @@
689 + #include <linux/serial.h>
690 + #include <linux/tty.h>
691 + #include <linux/module.h>
692 ++#include <linux/spinlock.h>
693 +
694 + struct ttyprintk_port {
695 + struct tty_port port;
696 +- struct mutex port_write_mutex;
697 ++ spinlock_t spinlock;
698 + };
699 +
700 + static struct ttyprintk_port tpk_port;
701 +@@ -99,11 +100,12 @@ static int tpk_open(struct tty_struct *tty, struct file *filp)
702 + static void tpk_close(struct tty_struct *tty, struct file *filp)
703 + {
704 + struct ttyprintk_port *tpkp = tty->driver_data;
705 ++ unsigned long flags;
706 +
707 +- mutex_lock(&tpkp->port_write_mutex);
708 ++ spin_lock_irqsave(&tpkp->spinlock, flags);
709 + /* flush tpk_printk buffer */
710 + tpk_printk(NULL, 0);
711 +- mutex_unlock(&tpkp->port_write_mutex);
712 ++ spin_unlock_irqrestore(&tpkp->spinlock, flags);
713 +
714 + tty_port_close(&tpkp->port, tty, filp);
715 + }
716 +@@ -115,13 +117,14 @@ static int tpk_write(struct tty_struct *tty,
717 + const unsigned char *buf, int count)
718 + {
719 + struct ttyprintk_port *tpkp = tty->driver_data;
720 ++ unsigned long flags;
721 + int ret;
722 +
723 +
724 + /* exclusive use of tpk_printk within this tty */
725 +- mutex_lock(&tpkp->port_write_mutex);
726 ++ spin_lock_irqsave(&tpkp->spinlock, flags);
727 + ret = tpk_printk(buf, count);
728 +- mutex_unlock(&tpkp->port_write_mutex);
729 ++ spin_unlock_irqrestore(&tpkp->spinlock, flags);
730 +
731 + return ret;
732 + }
733 +@@ -171,7 +174,7 @@ static int __init ttyprintk_init(void)
734 + {
735 + int ret = -ENOMEM;
736 +
737 +- mutex_init(&tpk_port.port_write_mutex);
738 ++ spin_lock_init(&tpk_port.spinlock);
739 +
740 + ttyprintk_driver = tty_alloc_driver(1,
741 + TTY_DRIVER_RESET_TERMIOS |
742 +diff --git a/drivers/clk/mmp/clk-of-mmp2.c b/drivers/clk/mmp/clk-of-mmp2.c
743 +index a60a1be937ad..b4a95cbbda98 100644
744 +--- a/drivers/clk/mmp/clk-of-mmp2.c
745 ++++ b/drivers/clk/mmp/clk-of-mmp2.c
746 +@@ -134,7 +134,7 @@ static DEFINE_SPINLOCK(ssp3_lock);
747 + static const char *ssp_parent_names[] = {"vctcxo_4", "vctcxo_2", "vctcxo", "pll1_16"};
748 +
749 + static DEFINE_SPINLOCK(timer_lock);
750 +-static const char *timer_parent_names[] = {"clk32", "vctcxo_2", "vctcxo_4", "vctcxo"};
751 ++static const char *timer_parent_names[] = {"clk32", "vctcxo_4", "vctcxo_2", "vctcxo"};
752 +
753 + static DEFINE_SPINLOCK(reset_lock);
754 +
755 +diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-h6-r.c b/drivers/clk/sunxi-ng/ccu-sun50i-h6-r.c
756 +index 45a1ed3fe674..ab194143e06c 100644
757 +--- a/drivers/clk/sunxi-ng/ccu-sun50i-h6-r.c
758 ++++ b/drivers/clk/sunxi-ng/ccu-sun50i-h6-r.c
759 +@@ -23,9 +23,9 @@
760 + */
761 +
762 + static const char * const ar100_r_apb2_parents[] = { "osc24M", "osc32k",
763 +- "pll-periph0", "iosc" };
764 ++ "iosc", "pll-periph0" };
765 + static const struct ccu_mux_var_prediv ar100_r_apb2_predivs[] = {
766 +- { .index = 2, .shift = 0, .width = 5 },
767 ++ { .index = 3, .shift = 0, .width = 5 },
768 + };
769 +
770 + static struct ccu_div ar100_clk = {
771 +diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-r.c b/drivers/clk/sunxi-ng/ccu-sun8i-r.c
772 +index 4646fdc61053..4c8c491b87c2 100644
773 +--- a/drivers/clk/sunxi-ng/ccu-sun8i-r.c
774 ++++ b/drivers/clk/sunxi-ng/ccu-sun8i-r.c
775 +@@ -51,19 +51,7 @@ static struct ccu_div ar100_clk = {
776 +
777 + static CLK_FIXED_FACTOR_HW(ahb0_clk, "ahb0", &ar100_clk.common.hw, 1, 1, 0);
778 +
779 +-static struct ccu_div apb0_clk = {
780 +- .div = _SUNXI_CCU_DIV_FLAGS(0, 2, CLK_DIVIDER_POWER_OF_TWO),
781 +-
782 +- .common = {
783 +- .reg = 0x0c,
784 +- .hw.init = CLK_HW_INIT_HW("apb0",
785 +- &ahb0_clk.hw,
786 +- &ccu_div_ops,
787 +- 0),
788 +- },
789 +-};
790 +-
791 +-static SUNXI_CCU_M(a83t_apb0_clk, "apb0", "ahb0", 0x0c, 0, 2, 0);
792 ++static SUNXI_CCU_M(apb0_clk, "apb0", "ahb0", 0x0c, 0, 2, 0);
793 +
794 + /*
795 + * Define the parent as an array that can be reused to save space
796 +@@ -127,7 +115,7 @@ static struct ccu_mp a83t_ir_clk = {
797 +
798 + static struct ccu_common *sun8i_a83t_r_ccu_clks[] = {
799 + &ar100_clk.common,
800 +- &a83t_apb0_clk.common,
801 ++ &apb0_clk.common,
802 + &apb0_pio_clk.common,
803 + &apb0_ir_clk.common,
804 + &apb0_timer_clk.common,
805 +@@ -167,7 +155,7 @@ static struct clk_hw_onecell_data sun8i_a83t_r_hw_clks = {
806 + .hws = {
807 + [CLK_AR100] = &ar100_clk.common.hw,
808 + [CLK_AHB0] = &ahb0_clk.hw,
809 +- [CLK_APB0] = &a83t_apb0_clk.common.hw,
810 ++ [CLK_APB0] = &apb0_clk.common.hw,
811 + [CLK_APB0_PIO] = &apb0_pio_clk.common.hw,
812 + [CLK_APB0_IR] = &apb0_ir_clk.common.hw,
813 + [CLK_APB0_TIMER] = &apb0_timer_clk.common.hw,
814 +@@ -282,9 +270,6 @@ static void __init sunxi_r_ccu_init(struct device_node *node,
815 +
816 + static void __init sun8i_a83t_r_ccu_setup(struct device_node *node)
817 + {
818 +- /* Fix apb0 bus gate parents here */
819 +- apb0_gate_parent[0] = &a83t_apb0_clk.common.hw;
820 +-
821 + sunxi_r_ccu_init(node, &sun8i_a83t_r_ccu_desc);
822 + }
823 + CLK_OF_DECLARE(sun8i_a83t_r_ccu, "allwinner,sun8i-a83t-r-ccu",
824 +diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c b/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c
825 +index 5c779eec454b..0e36ca3bf3d5 100644
826 +--- a/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c
827 ++++ b/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c
828 +@@ -618,7 +618,7 @@ static struct clk_hw_onecell_data sun8i_v3s_hw_clks = {
829 + [CLK_MBUS] = &mbus_clk.common.hw,
830 + [CLK_MIPI_CSI] = &mipi_csi_clk.common.hw,
831 + },
832 +- .num = CLK_NUMBER,
833 ++ .num = CLK_PLL_DDR1 + 1,
834 + };
835 +
836 + static struct clk_hw_onecell_data sun8i_v3_hw_clks = {
837 +@@ -700,7 +700,7 @@ static struct clk_hw_onecell_data sun8i_v3_hw_clks = {
838 + [CLK_MBUS] = &mbus_clk.common.hw,
839 + [CLK_MIPI_CSI] = &mipi_csi_clk.common.hw,
840 + },
841 +- .num = CLK_NUMBER,
842 ++ .num = CLK_I2S0 + 1,
843 + };
844 +
845 + static struct ccu_reset_map sun8i_v3s_ccu_resets[] = {
846 +diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-v3s.h b/drivers/clk/sunxi-ng/ccu-sun8i-v3s.h
847 +index b0160d305a67..108eeeedcbf7 100644
848 +--- a/drivers/clk/sunxi-ng/ccu-sun8i-v3s.h
849 ++++ b/drivers/clk/sunxi-ng/ccu-sun8i-v3s.h
850 +@@ -51,6 +51,4 @@
851 +
852 + #define CLK_PLL_DDR1 74
853 +
854 +-#define CLK_NUMBER (CLK_I2S0 + 1)
855 +-
856 + #endif /* _CCU_SUN8I_H3_H_ */
857 +diff --git a/drivers/cpuidle/governors/teo.c b/drivers/cpuidle/governors/teo.c
858 +index 703047434ee1..c71773c88890 100644
859 +--- a/drivers/cpuidle/governors/teo.c
860 ++++ b/drivers/cpuidle/governors/teo.c
861 +@@ -234,7 +234,7 @@ static int teo_select(struct cpuidle_driver *drv, struct cpuidle_device *dev,
862 + struct teo_cpu *cpu_data = per_cpu_ptr(&teo_cpus, dev->cpu);
863 + int latency_req = cpuidle_governor_latency_req(dev->cpu);
864 + unsigned int duration_us, hits, misses, early_hits;
865 +- int max_early_idx, constraint_idx, idx, i;
866 ++ int max_early_idx, prev_max_early_idx, constraint_idx, idx, i;
867 + ktime_t delta_tick;
868 +
869 + if (dev->last_state_idx >= 0) {
870 +@@ -251,6 +251,7 @@ static int teo_select(struct cpuidle_driver *drv, struct cpuidle_device *dev,
871 + misses = 0;
872 + early_hits = 0;
873 + max_early_idx = -1;
874 ++ prev_max_early_idx = -1;
875 + constraint_idx = drv->state_count;
876 + idx = -1;
877 +
878 +@@ -303,6 +304,7 @@ static int teo_select(struct cpuidle_driver *drv, struct cpuidle_device *dev,
879 + */
880 + if (!(tick_nohz_tick_stopped() &&
881 + drv->states[idx].target_residency < TICK_USEC)) {
882 ++ prev_max_early_idx = max_early_idx;
883 + early_hits = cpu_data->states[i].early_hits;
884 + max_early_idx = idx;
885 + }
886 +@@ -329,6 +331,7 @@ static int teo_select(struct cpuidle_driver *drv, struct cpuidle_device *dev,
887 + if (early_hits < cpu_data->states[i].early_hits &&
888 + !(tick_nohz_tick_stopped() &&
889 + drv->states[i].target_residency < TICK_USEC)) {
890 ++ prev_max_early_idx = max_early_idx;
891 + early_hits = cpu_data->states[i].early_hits;
892 + max_early_idx = i;
893 + }
894 +@@ -342,9 +345,19 @@ static int teo_select(struct cpuidle_driver *drv, struct cpuidle_device *dev,
895 + * "early hits" metric, but if that cannot be determined, just use the
896 + * state selected so far.
897 + */
898 +- if (hits <= misses && max_early_idx >= 0) {
899 +- idx = max_early_idx;
900 +- duration_us = drv->states[idx].target_residency;
901 ++ if (hits <= misses) {
902 ++ /*
903 ++ * The current candidate state is not suitable, so take the one
904 ++ * whose "early hits" metric is the maximum for the range of
905 ++ * shallower states.
906 ++ */
907 ++ if (idx == max_early_idx)
908 ++ max_early_idx = prev_max_early_idx;
909 ++
910 ++ if (max_early_idx >= 0) {
911 ++ idx = max_early_idx;
912 ++ duration_us = drv->states[idx].target_residency;
913 ++ }
914 + }
915 +
916 + /*
917 +diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
918 +index c64d20fdc187..174795ecbd3b 100644
919 +--- a/drivers/devfreq/devfreq.c
920 ++++ b/drivers/devfreq/devfreq.c
921 +@@ -1112,6 +1112,14 @@ err_out:
922 + }
923 + EXPORT_SYMBOL(devfreq_remove_governor);
924 +
925 ++static ssize_t name_show(struct device *dev,
926 ++ struct device_attribute *attr, char *buf)
927 ++{
928 ++ struct devfreq *devfreq = to_devfreq(dev);
929 ++ return sprintf(buf, "%s\n", dev_name(devfreq->dev.parent));
930 ++}
931 ++static DEVICE_ATTR_RO(name);
932 ++
933 + static ssize_t governor_show(struct device *dev,
934 + struct device_attribute *attr, char *buf)
935 + {
936 +@@ -1440,6 +1448,7 @@ static ssize_t trans_stat_show(struct device *dev,
937 + static DEVICE_ATTR_RO(trans_stat);
938 +
939 + static struct attribute *devfreq_attrs[] = {
940 ++ &dev_attr_name.attr,
941 + &dev_attr_governor.attr,
942 + &dev_attr_available_governors.attr,
943 + &dev_attr_cur_freq.attr,
944 +diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
945 +index f918fca9ada3..cb6e3a5f509c 100644
946 +--- a/drivers/input/evdev.c
947 ++++ b/drivers/input/evdev.c
948 +@@ -484,10 +484,7 @@ static int evdev_open(struct inode *inode, struct file *file)
949 + struct evdev_client *client;
950 + int error;
951 +
952 +- client = kzalloc(struct_size(client, buffer, bufsize),
953 +- GFP_KERNEL | __GFP_NOWARN);
954 +- if (!client)
955 +- client = vzalloc(struct_size(client, buffer, bufsize));
956 ++ client = kvzalloc(struct_size(client, buffer, bufsize), GFP_KERNEL);
957 + if (!client)
958 + return -ENOMEM;
959 +
960 +diff --git a/drivers/input/misc/max77650-onkey.c b/drivers/input/misc/max77650-onkey.c
961 +index 4d875f2ac13d..ee55f22dbca5 100644
962 +--- a/drivers/input/misc/max77650-onkey.c
963 ++++ b/drivers/input/misc/max77650-onkey.c
964 +@@ -108,9 +108,16 @@ static int max77650_onkey_probe(struct platform_device *pdev)
965 + return input_register_device(onkey->input);
966 + }
967 +
968 ++static const struct of_device_id max77650_onkey_of_match[] = {
969 ++ { .compatible = "maxim,max77650-onkey" },
970 ++ { }
971 ++};
972 ++MODULE_DEVICE_TABLE(of, max77650_onkey_of_match);
973 ++
974 + static struct platform_driver max77650_onkey_driver = {
975 + .driver = {
976 + .name = "max77650-onkey",
977 ++ .of_match_table = max77650_onkey_of_match,
978 + },
979 + .probe = max77650_onkey_probe,
980 + };
981 +diff --git a/drivers/leds/leds-max77650.c b/drivers/leds/leds-max77650.c
982 +index 4c2d0b3c6dad..a0d4b725c917 100644
983 +--- a/drivers/leds/leds-max77650.c
984 ++++ b/drivers/leds/leds-max77650.c
985 +@@ -135,9 +135,16 @@ err_node_put:
986 + return rv;
987 + }
988 +
989 ++static const struct of_device_id max77650_led_of_match[] = {
990 ++ { .compatible = "maxim,max77650-led" },
991 ++ { }
992 ++};
993 ++MODULE_DEVICE_TABLE(of, max77650_led_of_match);
994 ++
995 + static struct platform_driver max77650_led_driver = {
996 + .driver = {
997 + .name = "max77650-led",
998 ++ .of_match_table = max77650_led_of_match,
999 + },
1000 + .probe = max77650_led_probe,
1001 + };
1002 +diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
1003 +index 1696bfd23ad1..69201bdf7f4c 100644
1004 +--- a/drivers/md/dm-thin.c
1005 ++++ b/drivers/md/dm-thin.c
1006 +@@ -3420,10 +3420,6 @@ static int pool_ctr(struct dm_target *ti, unsigned argc, char **argv)
1007 + if (r)
1008 + goto out_flags_changed;
1009 +
1010 +- dm_pool_register_pre_commit_callback(pt->pool->pmd,
1011 +- metadata_pre_commit_callback,
1012 +- pt);
1013 +-
1014 + pt->callbacks.congested_fn = pool_is_congested;
1015 + dm_table_add_target_callbacks(ti->table, &pt->callbacks);
1016 +
1017 +@@ -3587,6 +3583,9 @@ static int pool_preresume(struct dm_target *ti)
1018 + if (r)
1019 + return r;
1020 +
1021 ++ dm_pool_register_pre_commit_callback(pool->pmd,
1022 ++ metadata_pre_commit_callback, pt);
1023 ++
1024 + r = maybe_resize_data_dev(ti, &need_commit1);
1025 + if (r)
1026 + return r;
1027 +diff --git a/drivers/media/usb/dvb-usb/af9005.c b/drivers/media/usb/dvb-usb/af9005.c
1028 +index ac93e88d7038..89b4b5d84cdf 100644
1029 +--- a/drivers/media/usb/dvb-usb/af9005.c
1030 ++++ b/drivers/media/usb/dvb-usb/af9005.c
1031 +@@ -554,7 +554,7 @@ static int af9005_boot_packet(struct usb_device *udev, int type, u8 *reply,
1032 + u8 *buf, int size)
1033 + {
1034 + u16 checksum;
1035 +- int act_len, i, ret;
1036 ++ int act_len = 0, i, ret;
1037 +
1038 + memset(buf, 0, size);
1039 + buf[0] = (u8) (FW_BULKOUT_SIZE & 0xff);
1040 +diff --git a/drivers/media/usb/dvb-usb/digitv.c b/drivers/media/usb/dvb-usb/digitv.c
1041 +index dd5bb230cec1..99a39339d45d 100644
1042 +--- a/drivers/media/usb/dvb-usb/digitv.c
1043 ++++ b/drivers/media/usb/dvb-usb/digitv.c
1044 +@@ -230,18 +230,22 @@ static struct rc_map_table rc_map_digitv_table[] = {
1045 +
1046 + static int digitv_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
1047 + {
1048 +- int i;
1049 ++ int ret, i;
1050 + u8 key[5];
1051 + u8 b[4] = { 0 };
1052 +
1053 + *event = 0;
1054 + *state = REMOTE_NO_KEY_PRESSED;
1055 +
1056 +- digitv_ctrl_msg(d,USB_READ_REMOTE,0,NULL,0,&key[1],4);
1057 ++ ret = digitv_ctrl_msg(d, USB_READ_REMOTE, 0, NULL, 0, &key[1], 4);
1058 ++ if (ret)
1059 ++ return ret;
1060 +
1061 + /* Tell the device we've read the remote. Not sure how necessary
1062 + this is, but the Nebula SDK does it. */
1063 +- digitv_ctrl_msg(d,USB_WRITE_REMOTE,0,b,4,NULL,0);
1064 ++ ret = digitv_ctrl_msg(d, USB_WRITE_REMOTE, 0, b, 4, NULL, 0);
1065 ++ if (ret)
1066 ++ return ret;
1067 +
1068 + /* if something is inside the buffer, simulate key press */
1069 + if (key[1] != 0)
1070 +diff --git a/drivers/media/usb/dvb-usb/dvb-usb-urb.c b/drivers/media/usb/dvb-usb/dvb-usb-urb.c
1071 +index c1b4e94a37f8..2aabf90d8697 100644
1072 +--- a/drivers/media/usb/dvb-usb/dvb-usb-urb.c
1073 ++++ b/drivers/media/usb/dvb-usb/dvb-usb-urb.c
1074 +@@ -12,7 +12,7 @@
1075 + int dvb_usb_generic_rw(struct dvb_usb_device *d, u8 *wbuf, u16 wlen, u8 *rbuf,
1076 + u16 rlen, int delay_ms)
1077 + {
1078 +- int actlen,ret = -ENOMEM;
1079 ++ int actlen = 0, ret = -ENOMEM;
1080 +
1081 + if (!d || wbuf == NULL || wlen == 0)
1082 + return -EINVAL;
1083 +diff --git a/drivers/media/usb/dvb-usb/vp7045.c b/drivers/media/usb/dvb-usb/vp7045.c
1084 +index 80c1cf05384b..2baf57216d19 100644
1085 +--- a/drivers/media/usb/dvb-usb/vp7045.c
1086 ++++ b/drivers/media/usb/dvb-usb/vp7045.c
1087 +@@ -96,10 +96,14 @@ static int vp7045_power_ctrl(struct dvb_usb_device *d, int onoff)
1088 +
1089 + static int vp7045_rc_query(struct dvb_usb_device *d)
1090 + {
1091 ++ int ret;
1092 + u8 key;
1093 +- vp7045_usb_op(d,RC_VAL_READ,NULL,0,&key,1,20);
1094 +
1095 +- deb_rc("remote query key: %x %d\n",key,key);
1096 ++ ret = vp7045_usb_op(d, RC_VAL_READ, NULL, 0, &key, 1, 20);
1097 ++ if (ret)
1098 ++ return ret;
1099 ++
1100 ++ deb_rc("remote query key: %x\n", key);
1101 +
1102 + if (key != 0x44) {
1103 + /*
1104 +@@ -115,15 +119,18 @@ static int vp7045_rc_query(struct dvb_usb_device *d)
1105 +
1106 + static int vp7045_read_eeprom(struct dvb_usb_device *d,u8 *buf, int len, int offset)
1107 + {
1108 +- int i = 0;
1109 +- u8 v,br[2];
1110 ++ int i, ret;
1111 ++ u8 v, br[2];
1112 + for (i=0; i < len; i++) {
1113 + v = offset + i;
1114 +- vp7045_usb_op(d,GET_EE_VALUE,&v,1,br,2,5);
1115 ++ ret = vp7045_usb_op(d, GET_EE_VALUE, &v, 1, br, 2, 5);
1116 ++ if (ret)
1117 ++ return ret;
1118 ++
1119 + buf[i] = br[1];
1120 + }
1121 +- deb_info("VP7045 EEPROM read (offs: %d, len: %d) : ",offset, i);
1122 +- debug_dump(buf,i,deb_info);
1123 ++ deb_info("VP7045 EEPROM read (offs: %d, len: %d) : ", offset, i);
1124 ++ debug_dump(buf, i, deb_info);
1125 + return 0;
1126 + }
1127 +
1128 +diff --git a/drivers/media/usb/gspca/gspca.c b/drivers/media/usb/gspca/gspca.c
1129 +index 4add2b12d330..c1b307bbe540 100644
1130 +--- a/drivers/media/usb/gspca/gspca.c
1131 ++++ b/drivers/media/usb/gspca/gspca.c
1132 +@@ -1461,7 +1461,7 @@ int gspca_dev_probe2(struct usb_interface *intf,
1133 + pr_err("couldn't kzalloc gspca struct\n");
1134 + return -ENOMEM;
1135 + }
1136 +- gspca_dev->usb_buf = kmalloc(USB_BUF_SZ, GFP_KERNEL);
1137 ++ gspca_dev->usb_buf = kzalloc(USB_BUF_SZ, GFP_KERNEL);
1138 + if (!gspca_dev->usb_buf) {
1139 + pr_err("out of memory\n");
1140 + ret = -ENOMEM;
1141 +diff --git a/drivers/misc/lkdtm/bugs.c b/drivers/misc/lkdtm/bugs.c
1142 +index 7284a22b1a09..4d5a512769e9 100644
1143 +--- a/drivers/misc/lkdtm/bugs.c
1144 ++++ b/drivers/misc/lkdtm/bugs.c
1145 +@@ -274,7 +274,7 @@ void lkdtm_STACK_GUARD_PAGE_TRAILING(void)
1146 +
1147 + void lkdtm_UNSET_SMEP(void)
1148 + {
1149 +-#ifdef CONFIG_X86_64
1150 ++#if IS_ENABLED(CONFIG_X86_64) && !IS_ENABLED(CONFIG_UML)
1151 + #define MOV_CR4_DEPTH 64
1152 + void (*direct_write_cr4)(unsigned long val);
1153 + unsigned char *insn;
1154 +diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
1155 +index fb8ade9a05a9..2ce96cc1bad4 100644
1156 +--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
1157 ++++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
1158 +@@ -70,8 +70,7 @@ static void *seq_tab_start(struct seq_file *seq, loff_t *pos)
1159 + static void *seq_tab_next(struct seq_file *seq, void *v, loff_t *pos)
1160 + {
1161 + v = seq_tab_get_idx(seq->private, *pos + 1);
1162 +- if (v)
1163 +- ++*pos;
1164 ++ ++(*pos);
1165 + return v;
1166 + }
1167 +
1168 +diff --git a/drivers/net/ethernet/chelsio/cxgb4/l2t.c b/drivers/net/ethernet/chelsio/cxgb4/l2t.c
1169 +index 1a407d3c1d67..e6fe2870137b 100644
1170 +--- a/drivers/net/ethernet/chelsio/cxgb4/l2t.c
1171 ++++ b/drivers/net/ethernet/chelsio/cxgb4/l2t.c
1172 +@@ -682,8 +682,7 @@ static void *l2t_seq_start(struct seq_file *seq, loff_t *pos)
1173 + static void *l2t_seq_next(struct seq_file *seq, void *v, loff_t *pos)
1174 + {
1175 + v = l2t_get_idx(seq, *pos);
1176 +- if (v)
1177 +- ++*pos;
1178 ++ ++(*pos);
1179 + return v;
1180 + }
1181 +
1182 +diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.c b/drivers/net/ethernet/freescale/fman/fman_memac.c
1183 +index 41c6fa200e74..e1901874c19f 100644
1184 +--- a/drivers/net/ethernet/freescale/fman/fman_memac.c
1185 ++++ b/drivers/net/ethernet/freescale/fman/fman_memac.c
1186 +@@ -110,7 +110,7 @@ do { \
1187 + /* Interface Mode Register (IF_MODE) */
1188 +
1189 + #define IF_MODE_MASK 0x00000003 /* 30-31 Mask on i/f mode bits */
1190 +-#define IF_MODE_XGMII 0x00000000 /* 30-31 XGMII (10G) interface */
1191 ++#define IF_MODE_10G 0x00000000 /* 30-31 10G interface */
1192 + #define IF_MODE_GMII 0x00000002 /* 30-31 GMII (1G) interface */
1193 + #define IF_MODE_RGMII 0x00000004
1194 + #define IF_MODE_RGMII_AUTO 0x00008000
1195 +@@ -440,7 +440,7 @@ static int init(struct memac_regs __iomem *regs, struct memac_cfg *cfg,
1196 + tmp = 0;
1197 + switch (phy_if) {
1198 + case PHY_INTERFACE_MODE_XGMII:
1199 +- tmp |= IF_MODE_XGMII;
1200 ++ tmp |= IF_MODE_10G;
1201 + break;
1202 + default:
1203 + tmp |= IF_MODE_GMII;
1204 +diff --git a/drivers/net/ethernet/freescale/xgmac_mdio.c b/drivers/net/ethernet/freescale/xgmac_mdio.c
1205 +index e03b30c60dcf..c82c85ef5fb3 100644
1206 +--- a/drivers/net/ethernet/freescale/xgmac_mdio.c
1207 ++++ b/drivers/net/ethernet/freescale/xgmac_mdio.c
1208 +@@ -49,6 +49,7 @@ struct tgec_mdio_controller {
1209 + struct mdio_fsl_priv {
1210 + struct tgec_mdio_controller __iomem *mdio_base;
1211 + bool is_little_endian;
1212 ++ bool has_a011043;
1213 + };
1214 +
1215 + static u32 xgmac_read32(void __iomem *regs,
1216 +@@ -226,7 +227,8 @@ static int xgmac_mdio_read(struct mii_bus *bus, int phy_id, int regnum)
1217 + return ret;
1218 +
1219 + /* Return all Fs if nothing was there */
1220 +- if (xgmac_read32(&regs->mdio_stat, endian) & MDIO_STAT_RD_ER) {
1221 ++ if ((xgmac_read32(&regs->mdio_stat, endian) & MDIO_STAT_RD_ER) &&
1222 ++ !priv->has_a011043) {
1223 + dev_err(&bus->dev,
1224 + "Error while reading PHY%d reg at %d.%hhu\n",
1225 + phy_id, dev_addr, regnum);
1226 +@@ -274,6 +276,9 @@ static int xgmac_mdio_probe(struct platform_device *pdev)
1227 + priv->is_little_endian = of_property_read_bool(pdev->dev.of_node,
1228 + "little-endian");
1229 +
1230 ++ priv->has_a011043 = of_property_read_bool(pdev->dev.of_node,
1231 ++ "fsl,erratum-a011043");
1232 ++
1233 + ret = of_mdiobus_register(bus, np);
1234 + if (ret) {
1235 + dev_err(&pdev->dev, "cannot register MDIO bus\n");
1236 +diff --git a/drivers/net/ethernet/intel/e1000e/e1000.h b/drivers/net/ethernet/intel/e1000e/e1000.h
1237 +index 6c51b1bad8c4..37a2314d3e6b 100644
1238 +--- a/drivers/net/ethernet/intel/e1000e/e1000.h
1239 ++++ b/drivers/net/ethernet/intel/e1000e/e1000.h
1240 +@@ -185,13 +185,12 @@ struct e1000_phy_regs {
1241 +
1242 + /* board specific private data structure */
1243 + struct e1000_adapter {
1244 ++ struct timer_list watchdog_timer;
1245 + struct timer_list phy_info_timer;
1246 + struct timer_list blink_timer;
1247 +
1248 + struct work_struct reset_task;
1249 +- struct delayed_work watchdog_task;
1250 +-
1251 +- struct workqueue_struct *e1000_workqueue;
1252 ++ struct work_struct watchdog_task;
1253 +
1254 + const struct e1000_info *ei;
1255 +
1256 +diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
1257 +index d7d56e42a6aa..c27ed7363768 100644
1258 +--- a/drivers/net/ethernet/intel/e1000e/netdev.c
1259 ++++ b/drivers/net/ethernet/intel/e1000e/netdev.c
1260 +@@ -1780,8 +1780,7 @@ static irqreturn_t e1000_intr_msi(int __always_unused irq, void *data)
1261 + }
1262 + /* guard against interrupt when we're going down */
1263 + if (!test_bit(__E1000_DOWN, &adapter->state))
1264 +- mod_delayed_work(adapter->e1000_workqueue,
1265 +- &adapter->watchdog_task, HZ);
1266 ++ mod_timer(&adapter->watchdog_timer, jiffies + 1);
1267 + }
1268 +
1269 + /* Reset on uncorrectable ECC error */
1270 +@@ -1861,8 +1860,7 @@ static irqreturn_t e1000_intr(int __always_unused irq, void *data)
1271 + }
1272 + /* guard against interrupt when we're going down */
1273 + if (!test_bit(__E1000_DOWN, &adapter->state))
1274 +- mod_delayed_work(adapter->e1000_workqueue,
1275 +- &adapter->watchdog_task, HZ);
1276 ++ mod_timer(&adapter->watchdog_timer, jiffies + 1);
1277 + }
1278 +
1279 + /* Reset on uncorrectable ECC error */
1280 +@@ -1907,8 +1905,7 @@ static irqreturn_t e1000_msix_other(int __always_unused irq, void *data)
1281 + hw->mac.get_link_status = true;
1282 + /* guard against interrupt when we're going down */
1283 + if (!test_bit(__E1000_DOWN, &adapter->state))
1284 +- mod_delayed_work(adapter->e1000_workqueue,
1285 +- &adapter->watchdog_task, HZ);
1286 ++ mod_timer(&adapter->watchdog_timer, jiffies + 1);
1287 + }
1288 +
1289 + if (!test_bit(__E1000_DOWN, &adapter->state))
1290 +@@ -4281,6 +4278,7 @@ void e1000e_down(struct e1000_adapter *adapter, bool reset)
1291 +
1292 + napi_synchronize(&adapter->napi);
1293 +
1294 ++ del_timer_sync(&adapter->watchdog_timer);
1295 + del_timer_sync(&adapter->phy_info_timer);
1296 +
1297 + spin_lock(&adapter->stats64_lock);
1298 +@@ -5152,11 +5150,25 @@ static void e1000e_check_82574_phy_workaround(struct e1000_adapter *adapter)
1299 + }
1300 + }
1301 +
1302 ++/**
1303 ++ * e1000_watchdog - Timer Call-back
1304 ++ * @data: pointer to adapter cast into an unsigned long
1305 ++ **/
1306 ++static void e1000_watchdog(struct timer_list *t)
1307 ++{
1308 ++ struct e1000_adapter *adapter = from_timer(adapter, t, watchdog_timer);
1309 ++
1310 ++ /* Do the rest outside of interrupt context */
1311 ++ schedule_work(&adapter->watchdog_task);
1312 ++
1313 ++ /* TODO: make this use queue_delayed_work() */
1314 ++}
1315 ++
1316 + static void e1000_watchdog_task(struct work_struct *work)
1317 + {
1318 + struct e1000_adapter *adapter = container_of(work,
1319 + struct e1000_adapter,
1320 +- watchdog_task.work);
1321 ++ watchdog_task);
1322 + struct net_device *netdev = adapter->netdev;
1323 + struct e1000_mac_info *mac = &adapter->hw.mac;
1324 + struct e1000_phy_info *phy = &adapter->hw.phy;
1325 +@@ -5404,9 +5416,8 @@ link_up:
1326 +
1327 + /* Reset the timer */
1328 + if (!test_bit(__E1000_DOWN, &adapter->state))
1329 +- queue_delayed_work(adapter->e1000_workqueue,
1330 +- &adapter->watchdog_task,
1331 +- round_jiffies(2 * HZ));
1332 ++ mod_timer(&adapter->watchdog_timer,
1333 ++ round_jiffies(jiffies + 2 * HZ));
1334 + }
1335 +
1336 + #define E1000_TX_FLAGS_CSUM 0x00000001
1337 +@@ -7259,21 +7270,11 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1338 + goto err_eeprom;
1339 + }
1340 +
1341 +- adapter->e1000_workqueue = alloc_workqueue("%s", WQ_MEM_RECLAIM, 0,
1342 +- e1000e_driver_name);
1343 +-
1344 +- if (!adapter->e1000_workqueue) {
1345 +- err = -ENOMEM;
1346 +- goto err_workqueue;
1347 +- }
1348 +-
1349 +- INIT_DELAYED_WORK(&adapter->watchdog_task, e1000_watchdog_task);
1350 +- queue_delayed_work(adapter->e1000_workqueue, &adapter->watchdog_task,
1351 +- 0);
1352 +-
1353 ++ timer_setup(&adapter->watchdog_timer, e1000_watchdog, 0);
1354 + timer_setup(&adapter->phy_info_timer, e1000_update_phy_info, 0);
1355 +
1356 + INIT_WORK(&adapter->reset_task, e1000_reset_task);
1357 ++ INIT_WORK(&adapter->watchdog_task, e1000_watchdog_task);
1358 + INIT_WORK(&adapter->downshift_task, e1000e_downshift_workaround);
1359 + INIT_WORK(&adapter->update_phy_task, e1000e_update_phy_task);
1360 + INIT_WORK(&adapter->print_hang_task, e1000_print_hw_hang);
1361 +@@ -7367,9 +7368,6 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1362 + return 0;
1363 +
1364 + err_register:
1365 +- flush_workqueue(adapter->e1000_workqueue);
1366 +- destroy_workqueue(adapter->e1000_workqueue);
1367 +-err_workqueue:
1368 + if (!(adapter->flags & FLAG_HAS_AMT))
1369 + e1000e_release_hw_control(adapter);
1370 + err_eeprom:
1371 +@@ -7407,26 +7405,22 @@ static void e1000_remove(struct pci_dev *pdev)
1372 + {
1373 + struct net_device *netdev = pci_get_drvdata(pdev);
1374 + struct e1000_adapter *adapter = netdev_priv(netdev);
1375 +- bool down = test_bit(__E1000_DOWN, &adapter->state);
1376 +
1377 + e1000e_ptp_remove(adapter);
1378 +
1379 + /* The timers may be rescheduled, so explicitly disable them
1380 + * from being rescheduled.
1381 + */
1382 +- if (!down)
1383 +- set_bit(__E1000_DOWN, &adapter->state);
1384 ++ set_bit(__E1000_DOWN, &adapter->state);
1385 ++ del_timer_sync(&adapter->watchdog_timer);
1386 + del_timer_sync(&adapter->phy_info_timer);
1387 +
1388 + cancel_work_sync(&adapter->reset_task);
1389 ++ cancel_work_sync(&adapter->watchdog_task);
1390 + cancel_work_sync(&adapter->downshift_task);
1391 + cancel_work_sync(&adapter->update_phy_task);
1392 + cancel_work_sync(&adapter->print_hang_task);
1393 +
1394 +- cancel_delayed_work(&adapter->watchdog_task);
1395 +- flush_workqueue(adapter->e1000_workqueue);
1396 +- destroy_workqueue(adapter->e1000_workqueue);
1397 +-
1398 + if (adapter->flags & FLAG_HAS_HW_TIMESTAMP) {
1399 + cancel_work_sync(&adapter->tx_hwtstamp_work);
1400 + if (adapter->tx_hwtstamp_skb) {
1401 +@@ -7435,9 +7429,6 @@ static void e1000_remove(struct pci_dev *pdev)
1402 + }
1403 + }
1404 +
1405 +- /* Don't lie to e1000_close() down the road. */
1406 +- if (!down)
1407 +- clear_bit(__E1000_DOWN, &adapter->state);
1408 + unregister_netdev(netdev);
1409 +
1410 + if (pci_dev_run_wake(pdev))
1411 +diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
1412 +index 3d2440838822..3515ace0f020 100644
1413 +--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
1414 ++++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
1415 +@@ -2322,6 +2322,22 @@ static int i40e_ctrl_vf_rx_rings(struct i40e_vsi *vsi, unsigned long q_map,
1416 + return ret;
1417 + }
1418 +
1419 ++/**
1420 ++ * i40e_vc_validate_vqs_bitmaps - validate Rx/Tx queue bitmaps from VIRTHCHNL
1421 ++ * @vqs: virtchnl_queue_select structure containing bitmaps to validate
1422 ++ *
1423 ++ * Returns true if validation was successful, else false.
1424 ++ */
1425 ++static bool i40e_vc_validate_vqs_bitmaps(struct virtchnl_queue_select *vqs)
1426 ++{
1427 ++ if ((!vqs->rx_queues && !vqs->tx_queues) ||
1428 ++ vqs->rx_queues >= BIT(I40E_MAX_VF_QUEUES) ||
1429 ++ vqs->tx_queues >= BIT(I40E_MAX_VF_QUEUES))
1430 ++ return false;
1431 ++
1432 ++ return true;
1433 ++}
1434 ++
1435 + /**
1436 + * i40e_vc_enable_queues_msg
1437 + * @vf: pointer to the VF info
1438 +@@ -2347,7 +2363,7 @@ static int i40e_vc_enable_queues_msg(struct i40e_vf *vf, u8 *msg)
1439 + goto error_param;
1440 + }
1441 +
1442 +- if ((0 == vqs->rx_queues) && (0 == vqs->tx_queues)) {
1443 ++ if (i40e_vc_validate_vqs_bitmaps(vqs)) {
1444 + aq_ret = I40E_ERR_PARAM;
1445 + goto error_param;
1446 + }
1447 +@@ -2409,9 +2425,7 @@ static int i40e_vc_disable_queues_msg(struct i40e_vf *vf, u8 *msg)
1448 + goto error_param;
1449 + }
1450 +
1451 +- if ((vqs->rx_queues == 0 && vqs->tx_queues == 0) ||
1452 +- vqs->rx_queues > I40E_MAX_VF_QUEUES ||
1453 +- vqs->tx_queues > I40E_MAX_VF_QUEUES) {
1454 ++ if (i40e_vc_validate_vqs_bitmaps(vqs)) {
1455 + aq_ret = I40E_ERR_PARAM;
1456 + goto error_param;
1457 + }
1458 +diff --git a/drivers/net/ethernet/intel/iavf/iavf.h b/drivers/net/ethernet/intel/iavf/iavf.h
1459 +index 29de3ae96ef2..bd1b1ed323f4 100644
1460 +--- a/drivers/net/ethernet/intel/iavf/iavf.h
1461 ++++ b/drivers/net/ethernet/intel/iavf/iavf.h
1462 +@@ -415,4 +415,6 @@ void iavf_enable_channels(struct iavf_adapter *adapter);
1463 + void iavf_disable_channels(struct iavf_adapter *adapter);
1464 + void iavf_add_cloud_filter(struct iavf_adapter *adapter);
1465 + void iavf_del_cloud_filter(struct iavf_adapter *adapter);
1466 ++struct iavf_mac_filter *iavf_add_filter(struct iavf_adapter *adapter,
1467 ++ const u8 *macaddr);
1468 + #endif /* _IAVF_H_ */
1469 +diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c
1470 +index 821987da5698..8e16be960e96 100644
1471 +--- a/drivers/net/ethernet/intel/iavf/iavf_main.c
1472 ++++ b/drivers/net/ethernet/intel/iavf/iavf_main.c
1473 +@@ -743,9 +743,8 @@ iavf_mac_filter *iavf_find_filter(struct iavf_adapter *adapter,
1474 + *
1475 + * Returns ptr to the filter object or NULL when no memory available.
1476 + **/
1477 +-static struct
1478 +-iavf_mac_filter *iavf_add_filter(struct iavf_adapter *adapter,
1479 +- const u8 *macaddr)
1480 ++struct iavf_mac_filter *iavf_add_filter(struct iavf_adapter *adapter,
1481 ++ const u8 *macaddr)
1482 + {
1483 + struct iavf_mac_filter *f;
1484 +
1485 +@@ -2065,9 +2064,9 @@ static void iavf_reset_task(struct work_struct *work)
1486 + struct virtchnl_vf_resource *vfres = adapter->vf_res;
1487 + struct net_device *netdev = adapter->netdev;
1488 + struct iavf_hw *hw = &adapter->hw;
1489 ++ struct iavf_mac_filter *f, *ftmp;
1490 + struct iavf_vlan_filter *vlf;
1491 + struct iavf_cloud_filter *cf;
1492 +- struct iavf_mac_filter *f;
1493 + u32 reg_val;
1494 + int i = 0, err;
1495 + bool running;
1496 +@@ -2181,6 +2180,16 @@ continue_reset:
1497 +
1498 + spin_lock_bh(&adapter->mac_vlan_list_lock);
1499 +
1500 ++ /* Delete filter for the current MAC address, it could have
1501 ++ * been changed by the PF via administratively set MAC.
1502 ++ * Will be re-added via VIRTCHNL_OP_GET_VF_RESOURCES.
1503 ++ */
1504 ++ list_for_each_entry_safe(f, ftmp, &adapter->mac_filter_list, list) {
1505 ++ if (ether_addr_equal(f->macaddr, adapter->hw.mac.addr)) {
1506 ++ list_del(&f->list);
1507 ++ kfree(f);
1508 ++ }
1509 ++ }
1510 + /* re-add all MAC filters */
1511 + list_for_each_entry(f, &adapter->mac_filter_list, list) {
1512 + f->add = true;
1513 +diff --git a/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c b/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c
1514 +index c46770eba320..1ab9cb339acb 100644
1515 +--- a/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c
1516 ++++ b/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c
1517 +@@ -1359,6 +1359,9 @@ void iavf_virtchnl_completion(struct iavf_adapter *adapter,
1518 + ether_addr_copy(netdev->perm_addr,
1519 + adapter->hw.mac.addr);
1520 + }
1521 ++ spin_lock_bh(&adapter->mac_vlan_list_lock);
1522 ++ iavf_add_filter(adapter, adapter->hw.mac.addr);
1523 ++ spin_unlock_bh(&adapter->mac_vlan_list_lock);
1524 + iavf_process_config(adapter);
1525 + }
1526 + break;
1527 +diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.c b/drivers/net/ethernet/intel/igb/e1000_82575.c
1528 +index 8a6ef3514129..438b42ce2cd9 100644
1529 +--- a/drivers/net/ethernet/intel/igb/e1000_82575.c
1530 ++++ b/drivers/net/ethernet/intel/igb/e1000_82575.c
1531 +@@ -530,7 +530,7 @@ static s32 igb_set_sfp_media_type_82575(struct e1000_hw *hw)
1532 + dev_spec->module_plugged = true;
1533 + if (eth_flags->e1000_base_lx || eth_flags->e1000_base_sx) {
1534 + hw->phy.media_type = e1000_media_type_internal_serdes;
1535 +- } else if (eth_flags->e100_base_fx) {
1536 ++ } else if (eth_flags->e100_base_fx || eth_flags->e100_base_lx) {
1537 + dev_spec->sgmii_active = true;
1538 + hw->phy.media_type = e1000_media_type_internal_serdes;
1539 + } else if (eth_flags->e1000_base_t) {
1540 +@@ -657,14 +657,10 @@ static s32 igb_get_invariants_82575(struct e1000_hw *hw)
1541 + break;
1542 + }
1543 +
1544 +- /* do not change link mode for 100BaseFX */
1545 +- if (dev_spec->eth_flags.e100_base_fx)
1546 +- break;
1547 +-
1548 + /* change current link mode setting */
1549 + ctrl_ext &= ~E1000_CTRL_EXT_LINK_MODE_MASK;
1550 +
1551 +- if (hw->phy.media_type == e1000_media_type_copper)
1552 ++ if (dev_spec->sgmii_active)
1553 + ctrl_ext |= E1000_CTRL_EXT_LINK_MODE_SGMII;
1554 + else
1555 + ctrl_ext |= E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES;
1556 +diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c
1557 +index 3182b059bf55..8959418776f6 100644
1558 +--- a/drivers/net/ethernet/intel/igb/igb_ethtool.c
1559 ++++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c
1560 +@@ -181,7 +181,7 @@ static int igb_get_link_ksettings(struct net_device *netdev,
1561 + advertising &= ~ADVERTISED_1000baseKX_Full;
1562 + }
1563 + }
1564 +- if (eth_flags->e100_base_fx) {
1565 ++ if (eth_flags->e100_base_fx || eth_flags->e100_base_lx) {
1566 + supported |= SUPPORTED_100baseT_Full;
1567 + advertising |= ADVERTISED_100baseT_Full;
1568 + }
1569 +diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
1570 +index c6404abf2dd1..a26f9fb95ac0 100644
1571 +--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
1572 ++++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
1573 +@@ -5239,7 +5239,7 @@ static void ixgbe_fdir_filter_restore(struct ixgbe_adapter *adapter)
1574 + struct ixgbe_hw *hw = &adapter->hw;
1575 + struct hlist_node *node2;
1576 + struct ixgbe_fdir_filter *filter;
1577 +- u64 action;
1578 ++ u8 queue;
1579 +
1580 + spin_lock(&adapter->fdir_perfect_lock);
1581 +
1582 +@@ -5248,17 +5248,34 @@ static void ixgbe_fdir_filter_restore(struct ixgbe_adapter *adapter)
1583 +
1584 + hlist_for_each_entry_safe(filter, node2,
1585 + &adapter->fdir_filter_list, fdir_node) {
1586 +- action = filter->action;
1587 +- if (action != IXGBE_FDIR_DROP_QUEUE && action != 0)
1588 +- action =
1589 +- (action >> ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF) - 1;
1590 ++ if (filter->action == IXGBE_FDIR_DROP_QUEUE) {
1591 ++ queue = IXGBE_FDIR_DROP_QUEUE;
1592 ++ } else {
1593 ++ u32 ring = ethtool_get_flow_spec_ring(filter->action);
1594 ++ u8 vf = ethtool_get_flow_spec_ring_vf(filter->action);
1595 ++
1596 ++ if (!vf && (ring >= adapter->num_rx_queues)) {
1597 ++ e_err(drv, "FDIR restore failed without VF, ring: %u\n",
1598 ++ ring);
1599 ++ continue;
1600 ++ } else if (vf &&
1601 ++ ((vf > adapter->num_vfs) ||
1602 ++ ring >= adapter->num_rx_queues_per_pool)) {
1603 ++ e_err(drv, "FDIR restore failed with VF, vf: %hhu, ring: %u\n",
1604 ++ vf, ring);
1605 ++ continue;
1606 ++ }
1607 ++
1608 ++ /* Map the ring onto the absolute queue index */
1609 ++ if (!vf)
1610 ++ queue = adapter->rx_ring[ring]->reg_idx;
1611 ++ else
1612 ++ queue = ((vf - 1) *
1613 ++ adapter->num_rx_queues_per_pool) + ring;
1614 ++ }
1615 +
1616 + ixgbe_fdir_write_perfect_filter_82599(hw,
1617 +- &filter->filter,
1618 +- filter->sw_idx,
1619 +- (action == IXGBE_FDIR_DROP_QUEUE) ?
1620 +- IXGBE_FDIR_DROP_QUEUE :
1621 +- adapter->rx_ring[action]->reg_idx);
1622 ++ &filter->filter, filter->sw_idx, queue);
1623 + }
1624 +
1625 + spin_unlock(&adapter->fdir_perfect_lock);
1626 +diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
1627 +index 076f2da36f27..64ec0e7c64b4 100644
1628 +--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
1629 ++++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
1630 +@@ -2081,11 +2081,6 @@ static int ixgbevf_write_uc_addr_list(struct net_device *netdev)
1631 + struct ixgbe_hw *hw = &adapter->hw;
1632 + int count = 0;
1633 +
1634 +- if ((netdev_uc_count(netdev)) > 10) {
1635 +- pr_err("Too many unicast filters - No Space\n");
1636 +- return -ENOSPC;
1637 +- }
1638 +-
1639 + if (!netdev_uc_empty(netdev)) {
1640 + struct netdev_hw_addr *ha;
1641 +
1642 +diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c
1643 +index a496390b8632..07f9067affc6 100644
1644 +--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c
1645 ++++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c
1646 +@@ -2043,6 +2043,7 @@ static void qlcnic_83xx_exec_template_cmd(struct qlcnic_adapter *p_dev,
1647 + break;
1648 + }
1649 + entry += p_hdr->size;
1650 ++ cond_resched();
1651 + }
1652 + p_dev->ahw->reset.seq_index = index;
1653 + }
1654 +diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c
1655 +index afa10a163da1..f34ae8c75bc5 100644
1656 +--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c
1657 ++++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c
1658 +@@ -703,6 +703,7 @@ static u32 qlcnic_read_memory_test_agent(struct qlcnic_adapter *adapter,
1659 + addr += 16;
1660 + reg_read -= 16;
1661 + ret += 16;
1662 ++ cond_resched();
1663 + }
1664 + out:
1665 + mutex_unlock(&adapter->ahw->mem_lock);
1666 +@@ -1383,6 +1384,7 @@ int qlcnic_dump_fw(struct qlcnic_adapter *adapter)
1667 + buf_offset += entry->hdr.cap_size;
1668 + entry_offset += entry->hdr.offset;
1669 + buffer = fw_dump->data + buf_offset;
1670 ++ cond_resched();
1671 + }
1672 +
1673 + fw_dump->clr = 1;
1674 +diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
1675 +index 4196c0e32740..9485c8d1de8a 100644
1676 +--- a/drivers/net/usb/qmi_wwan.c
1677 ++++ b/drivers/net/usb/qmi_wwan.c
1678 +@@ -1062,6 +1062,7 @@ static const struct usb_device_id products[] = {
1679 + {QMI_QUIRK_QUECTEL_DYNCFG(0x2c7c, 0x0125)}, /* Quectel EC25, EC20 R2.0 Mini PCIe */
1680 + {QMI_QUIRK_QUECTEL_DYNCFG(0x2c7c, 0x0306)}, /* Quectel EP06/EG06/EM06 */
1681 + {QMI_QUIRK_QUECTEL_DYNCFG(0x2c7c, 0x0512)}, /* Quectel EG12/EM12 */
1682 ++ {QMI_QUIRK_QUECTEL_DYNCFG(0x2c7c, 0x0800)}, /* Quectel RM500Q-GL */
1683 +
1684 + /* 3. Combined interface devices matching on interface number */
1685 + {QMI_FIXED_INTF(0x0408, 0xea42, 4)}, /* Yota / Megafon M100-1 */
1686 +diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
1687 +index 9e4b7a400284..6912624eed4a 100644
1688 +--- a/drivers/net/usb/r8152.c
1689 ++++ b/drivers/net/usb/r8152.c
1690 +@@ -29,7 +29,7 @@
1691 + #define NETNEXT_VERSION "10"
1692 +
1693 + /* Information for net */
1694 +-#define NET_VERSION "10"
1695 ++#define NET_VERSION "11"
1696 +
1697 + #define DRIVER_VERSION "v1." NETNEXT_VERSION "." NET_VERSION
1698 + #define DRIVER_AUTHOR "Realtek linux nic maintainers <nic_swsd@×××××××.com>"
1699 +@@ -63,6 +63,7 @@
1700 + #define PLA_LED_FEATURE 0xdd92
1701 + #define PLA_PHYAR 0xde00
1702 + #define PLA_BOOT_CTRL 0xe004
1703 ++#define PLA_LWAKE_CTRL_REG 0xe007
1704 + #define PLA_GPHY_INTR_IMR 0xe022
1705 + #define PLA_EEE_CR 0xe040
1706 + #define PLA_EEEP_CR 0xe080
1707 +@@ -90,6 +91,7 @@
1708 + #define PLA_TALLYCNT 0xe890
1709 + #define PLA_SFF_STS_7 0xe8de
1710 + #define PLA_PHYSTATUS 0xe908
1711 ++#define PLA_CONFIG6 0xe90a /* CONFIG6 */
1712 + #define PLA_BP_BA 0xfc26
1713 + #define PLA_BP_0 0xfc28
1714 + #define PLA_BP_1 0xfc2a
1715 +@@ -102,6 +104,7 @@
1716 + #define PLA_BP_EN 0xfc38
1717 +
1718 + #define USB_USB2PHY 0xb41e
1719 ++#define USB_SSPHYLINK1 0xb426
1720 + #define USB_SSPHYLINK2 0xb428
1721 + #define USB_U2P3_CTRL 0xb460
1722 + #define USB_CSR_DUMMY1 0xb464
1723 +@@ -286,6 +289,9 @@
1724 + #define LINK_ON_WAKE_EN 0x0010
1725 + #define LINK_OFF_WAKE_EN 0x0008
1726 +
1727 ++/* PLA_CONFIG6 */
1728 ++#define LANWAKE_CLR_EN BIT(0)
1729 ++
1730 + /* PLA_CONFIG5 */
1731 + #define BWF_EN 0x0040
1732 + #define MWF_EN 0x0020
1733 +@@ -298,6 +304,7 @@
1734 + /* PLA_PHY_PWR */
1735 + #define TX_10M_IDLE_EN 0x0080
1736 + #define PFM_PWM_SWITCH 0x0040
1737 ++#define TEST_IO_OFF BIT(4)
1738 +
1739 + /* PLA_MAC_PWR_CTRL */
1740 + #define D3_CLK_GATED_EN 0x00004000
1741 +@@ -310,6 +317,7 @@
1742 + #define MAC_CLK_SPDWN_EN BIT(15)
1743 +
1744 + /* PLA_MAC_PWR_CTRL3 */
1745 ++#define PLA_MCU_SPDWN_EN BIT(14)
1746 + #define PKT_AVAIL_SPDWN_EN 0x0100
1747 + #define SUSPEND_SPDWN_EN 0x0004
1748 + #define U1U2_SPDWN_EN 0x0002
1749 +@@ -340,6 +348,9 @@
1750 + /* PLA_BOOT_CTRL */
1751 + #define AUTOLOAD_DONE 0x0002
1752 +
1753 ++/* PLA_LWAKE_CTRL_REG */
1754 ++#define LANWAKE_PIN BIT(7)
1755 ++
1756 + /* PLA_SUSPEND_FLAG */
1757 + #define LINK_CHG_EVENT BIT(0)
1758 +
1759 +@@ -353,6 +364,9 @@
1760 + #define USB2PHY_SUSPEND 0x0001
1761 + #define USB2PHY_L1 0x0002
1762 +
1763 ++/* USB_SSPHYLINK1 */
1764 ++#define DELAY_PHY_PWR_CHG BIT(1)
1765 ++
1766 + /* USB_SSPHYLINK2 */
1767 + #define pwd_dn_scale_mask 0x3ffe
1768 + #define pwd_dn_scale(x) ((x) << 1)
1769 +@@ -3175,7 +3189,6 @@ static void rtl8153b_runtime_enable(struct r8152 *tp, bool enable)
1770 + r8153b_ups_en(tp, false);
1771 + r8153_queue_wake(tp, false);
1772 + rtl_runtime_suspend_enable(tp, false);
1773 +- r8153_u2p3en(tp, true);
1774 + r8153b_u1u2en(tp, true);
1775 + }
1776 + }
1777 +@@ -3703,7 +3716,6 @@ static void r8153b_hw_phy_cfg(struct r8152 *tp)
1778 +
1779 + r8153_aldps_en(tp, true);
1780 + r8152b_enable_fc(tp);
1781 +- r8153_u2p3en(tp, true);
1782 +
1783 + set_bit(PHY_RESET, &tp->flags);
1784 + }
1785 +@@ -4004,6 +4016,8 @@ static void rtl8152_down(struct r8152 *tp)
1786 +
1787 + static void rtl8153_up(struct r8152 *tp)
1788 + {
1789 ++ u32 ocp_data;
1790 ++
1791 + if (test_bit(RTL8152_UNPLUG, &tp->flags))
1792 + return;
1793 +
1794 +@@ -4011,6 +4025,19 @@ static void rtl8153_up(struct r8152 *tp)
1795 + r8153_u2p3en(tp, false);
1796 + r8153_aldps_en(tp, false);
1797 + r8153_first_init(tp);
1798 ++
1799 ++ ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_CONFIG6);
1800 ++ ocp_data |= LANWAKE_CLR_EN;
1801 ++ ocp_write_byte(tp, MCU_TYPE_PLA, PLA_CONFIG6, ocp_data);
1802 ++
1803 ++ ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_LWAKE_CTRL_REG);
1804 ++ ocp_data &= ~LANWAKE_PIN;
1805 ++ ocp_write_byte(tp, MCU_TYPE_PLA, PLA_LWAKE_CTRL_REG, ocp_data);
1806 ++
1807 ++ ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_SSPHYLINK1);
1808 ++ ocp_data &= ~DELAY_PHY_PWR_CHG;
1809 ++ ocp_write_word(tp, MCU_TYPE_USB, USB_SSPHYLINK1, ocp_data);
1810 ++
1811 + r8153_aldps_en(tp, true);
1812 +
1813 + switch (tp->version) {
1814 +@@ -4029,11 +4056,17 @@ static void rtl8153_up(struct r8152 *tp)
1815 +
1816 + static void rtl8153_down(struct r8152 *tp)
1817 + {
1818 ++ u32 ocp_data;
1819 ++
1820 + if (test_bit(RTL8152_UNPLUG, &tp->flags)) {
1821 + rtl_drop_queued_tx(tp);
1822 + return;
1823 + }
1824 +
1825 ++ ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_CONFIG6);
1826 ++ ocp_data &= ~LANWAKE_CLR_EN;
1827 ++ ocp_write_byte(tp, MCU_TYPE_PLA, PLA_CONFIG6, ocp_data);
1828 ++
1829 + r8153_u1u2en(tp, false);
1830 + r8153_u2p3en(tp, false);
1831 + r8153_power_cut_en(tp, false);
1832 +@@ -4044,6 +4077,8 @@ static void rtl8153_down(struct r8152 *tp)
1833 +
1834 + static void rtl8153b_up(struct r8152 *tp)
1835 + {
1836 ++ u32 ocp_data;
1837 ++
1838 + if (test_bit(RTL8152_UNPLUG, &tp->flags))
1839 + return;
1840 +
1841 +@@ -4054,18 +4089,27 @@ static void rtl8153b_up(struct r8152 *tp)
1842 + r8153_first_init(tp);
1843 + ocp_write_dword(tp, MCU_TYPE_USB, USB_RX_BUF_TH, RX_THR_B);
1844 +
1845 ++ ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL3);
1846 ++ ocp_data &= ~PLA_MCU_SPDWN_EN;
1847 ++ ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL3, ocp_data);
1848 ++
1849 + r8153_aldps_en(tp, true);
1850 +- r8153_u2p3en(tp, true);
1851 + r8153b_u1u2en(tp, true);
1852 + }
1853 +
1854 + static void rtl8153b_down(struct r8152 *tp)
1855 + {
1856 ++ u32 ocp_data;
1857 ++
1858 + if (test_bit(RTL8152_UNPLUG, &tp->flags)) {
1859 + rtl_drop_queued_tx(tp);
1860 + return;
1861 + }
1862 +
1863 ++ ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL3);
1864 ++ ocp_data |= PLA_MCU_SPDWN_EN;
1865 ++ ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL3, ocp_data);
1866 ++
1867 + r8153b_u1u2en(tp, false);
1868 + r8153_u2p3en(tp, false);
1869 + r8153b_power_cut_en(tp, false);
1870 +@@ -4454,6 +4498,14 @@ static void r8153_init(struct r8152 *tp)
1871 + r8153_mac_clk_spd(tp, false);
1872 + usb_enable_lpm(tp->udev);
1873 +
1874 ++ ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_CONFIG6);
1875 ++ ocp_data |= LANWAKE_CLR_EN;
1876 ++ ocp_write_byte(tp, MCU_TYPE_PLA, PLA_CONFIG6, ocp_data);
1877 ++
1878 ++ ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_LWAKE_CTRL_REG);
1879 ++ ocp_data &= ~LANWAKE_PIN;
1880 ++ ocp_write_byte(tp, MCU_TYPE_PLA, PLA_LWAKE_CTRL_REG, ocp_data);
1881 ++
1882 + /* rx aggregation */
1883 + ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_USB_CTRL);
1884 + ocp_data &= ~(RX_AGG_DISABLE | RX_ZERO_EN);
1885 +@@ -4526,6 +4578,19 @@ static void r8153b_init(struct r8152 *tp)
1886 + ocp_data |= MAC_CLK_SPDWN_EN;
1887 + ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL2, ocp_data);
1888 +
1889 ++ ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL3);
1890 ++ ocp_data &= ~PLA_MCU_SPDWN_EN;
1891 ++ ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL3, ocp_data);
1892 ++
1893 ++ if (tp->version == RTL_VER_09) {
1894 ++ /* Disable Test IO for 32QFN */
1895 ++ if (ocp_read_byte(tp, MCU_TYPE_PLA, 0xdc00) & BIT(5)) {
1896 ++ ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_PHY_PWR);
1897 ++ ocp_data |= TEST_IO_OFF;
1898 ++ ocp_write_word(tp, MCU_TYPE_PLA, PLA_PHY_PWR, ocp_data);
1899 ++ }
1900 ++ }
1901 ++
1902 + set_bit(GREEN_ETHERNET, &tp->flags);
1903 +
1904 + /* rx aggregation */
1905 +@@ -5690,6 +5755,11 @@ static int rtl8152_probe(struct usb_interface *intf,
1906 +
1907 + intf->needs_remote_wakeup = 1;
1908 +
1909 ++ if (!rtl_can_wakeup(tp))
1910 ++ __rtl_set_wol(tp, 0);
1911 ++ else
1912 ++ tp->saved_wolopts = __rtl_get_wol(tp);
1913 ++
1914 + tp->rtl_ops.init(tp);
1915 + queue_delayed_work(system_long_wq, &tp->hw_phy_work, 0);
1916 + set_ethernet_addr(tp);
1917 +@@ -5703,10 +5773,6 @@ static int rtl8152_probe(struct usb_interface *intf,
1918 + goto out1;
1919 + }
1920 +
1921 +- if (!rtl_can_wakeup(tp))
1922 +- __rtl_set_wol(tp, 0);
1923 +-
1924 +- tp->saved_wolopts = __rtl_get_wol(tp);
1925 + if (tp->saved_wolopts)
1926 + device_set_wakeup_enable(&udev->dev, true);
1927 + else
1928 +diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/tx.c b/drivers/net/wireless/intel/iwlwifi/dvm/tx.c
1929 +index 3029e3f6de63..621cd7206b7c 100644
1930 +--- a/drivers/net/wireless/intel/iwlwifi/dvm/tx.c
1931 ++++ b/drivers/net/wireless/intel/iwlwifi/dvm/tx.c
1932 +@@ -267,7 +267,7 @@ int iwlagn_tx_skb(struct iwl_priv *priv,
1933 + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1934 + struct iwl_station_priv *sta_priv = NULL;
1935 + struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
1936 +- struct iwl_device_cmd *dev_cmd;
1937 ++ struct iwl_device_tx_cmd *dev_cmd;
1938 + struct iwl_tx_cmd *tx_cmd;
1939 + __le16 fc;
1940 + u8 hdr_len;
1941 +@@ -348,7 +348,6 @@ int iwlagn_tx_skb(struct iwl_priv *priv,
1942 + if (unlikely(!dev_cmd))
1943 + goto drop_unlock_priv;
1944 +
1945 +- memset(dev_cmd, 0, sizeof(*dev_cmd));
1946 + dev_cmd->hdr.cmd = REPLY_TX;
1947 + tx_cmd = (struct iwl_tx_cmd *) dev_cmd->payload;
1948 +
1949 +diff --git a/drivers/net/wireless/intel/iwlwifi/fw/dbg.c b/drivers/net/wireless/intel/iwlwifi/fw/dbg.c
1950 +index 87421807e040..386ca67ec7b4 100644
1951 +--- a/drivers/net/wireless/intel/iwlwifi/fw/dbg.c
1952 ++++ b/drivers/net/wireless/intel/iwlwifi/fw/dbg.c
1953 +@@ -2490,12 +2490,7 @@ int iwl_fw_dbg_stop_restart_recording(struct iwl_fw_runtime *fwrt,
1954 + {
1955 + int ret = 0;
1956 +
1957 +- /* if the FW crashed or not debug monitor cfg was given, there is
1958 +- * no point in changing the recording state
1959 +- */
1960 +- if (test_bit(STATUS_FW_ERROR, &fwrt->trans->status) ||
1961 +- (!fwrt->trans->dbg.dest_tlv &&
1962 +- fwrt->trans->dbg.ini_dest == IWL_FW_INI_LOCATION_INVALID))
1963 ++ if (test_bit(STATUS_FW_ERROR, &fwrt->trans->status))
1964 + return 0;
1965 +
1966 + if (fw_has_capa(&fwrt->fw->ucode_capa,
1967 +diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
1968 +index c8972f6e38ba..5d546dac7814 100644
1969 +--- a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
1970 ++++ b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
1971 +@@ -225,6 +225,34 @@ enum iwl_nvm_channel_flags {
1972 + NVM_CHANNEL_DC_HIGH = BIT(12),
1973 + };
1974 +
1975 ++/**
1976 ++ * enum iwl_reg_capa_flags - global flags applied for the whole regulatory
1977 ++ * domain.
1978 ++ * @REG_CAPA_BF_CCD_LOW_BAND: Beam-forming or Cyclic Delay Diversity in the
1979 ++ * 2.4Ghz band is allowed.
1980 ++ * @REG_CAPA_BF_CCD_HIGH_BAND: Beam-forming or Cyclic Delay Diversity in the
1981 ++ * 5Ghz band is allowed.
1982 ++ * @REG_CAPA_160MHZ_ALLOWED: 11ac channel with a width of 160Mhz is allowed
1983 ++ * for this regulatory domain (valid only in 5Ghz).
1984 ++ * @REG_CAPA_80MHZ_ALLOWED: 11ac channel with a width of 80Mhz is allowed
1985 ++ * for this regulatory domain (valid only in 5Ghz).
1986 ++ * @REG_CAPA_MCS_8_ALLOWED: 11ac with MCS 8 is allowed.
1987 ++ * @REG_CAPA_MCS_9_ALLOWED: 11ac with MCS 9 is allowed.
1988 ++ * @REG_CAPA_40MHZ_FORBIDDEN: 11n channel with a width of 40Mhz is forbidden
1989 ++ * for this regulatory domain (valid only in 5Ghz).
1990 ++ * @REG_CAPA_DC_HIGH_ENABLED: DC HIGH allowed.
1991 ++ */
1992 ++enum iwl_reg_capa_flags {
1993 ++ REG_CAPA_BF_CCD_LOW_BAND = BIT(0),
1994 ++ REG_CAPA_BF_CCD_HIGH_BAND = BIT(1),
1995 ++ REG_CAPA_160MHZ_ALLOWED = BIT(2),
1996 ++ REG_CAPA_80MHZ_ALLOWED = BIT(3),
1997 ++ REG_CAPA_MCS_8_ALLOWED = BIT(4),
1998 ++ REG_CAPA_MCS_9_ALLOWED = BIT(5),
1999 ++ REG_CAPA_40MHZ_FORBIDDEN = BIT(7),
2000 ++ REG_CAPA_DC_HIGH_ENABLED = BIT(9),
2001 ++};
2002 ++
2003 + static inline void iwl_nvm_print_channel_flags(struct device *dev, u32 level,
2004 + int chan, u32 flags)
2005 + {
2006 +@@ -1031,6 +1059,7 @@ IWL_EXPORT_SYMBOL(iwl_parse_nvm_data);
2007 +
2008 + static u32 iwl_nvm_get_regdom_bw_flags(const u16 *nvm_chan,
2009 + int ch_idx, u16 nvm_flags,
2010 ++ u16 cap_flags,
2011 + const struct iwl_cfg *cfg)
2012 + {
2013 + u32 flags = NL80211_RRF_NO_HT40;
2014 +@@ -1069,13 +1098,27 @@ static u32 iwl_nvm_get_regdom_bw_flags(const u16 *nvm_chan,
2015 + (flags & NL80211_RRF_NO_IR))
2016 + flags |= NL80211_RRF_GO_CONCURRENT;
2017 +
2018 ++ /*
2019 ++ * cap_flags is per regulatory domain so apply it for every channel
2020 ++ */
2021 ++ if (ch_idx >= NUM_2GHZ_CHANNELS) {
2022 ++ if (cap_flags & REG_CAPA_40MHZ_FORBIDDEN)
2023 ++ flags |= NL80211_RRF_NO_HT40;
2024 ++
2025 ++ if (!(cap_flags & REG_CAPA_80MHZ_ALLOWED))
2026 ++ flags |= NL80211_RRF_NO_80MHZ;
2027 ++
2028 ++ if (!(cap_flags & REG_CAPA_160MHZ_ALLOWED))
2029 ++ flags |= NL80211_RRF_NO_160MHZ;
2030 ++ }
2031 ++
2032 + return flags;
2033 + }
2034 +
2035 + struct ieee80211_regdomain *
2036 + iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg,
2037 + int num_of_ch, __le32 *channels, u16 fw_mcc,
2038 +- u16 geo_info)
2039 ++ u16 geo_info, u16 cap)
2040 + {
2041 + int ch_idx;
2042 + u16 ch_flags;
2043 +@@ -1133,7 +1176,8 @@ iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg,
2044 + }
2045 +
2046 + reg_rule_flags = iwl_nvm_get_regdom_bw_flags(nvm_chan, ch_idx,
2047 +- ch_flags, cfg);
2048 ++ ch_flags, cap,
2049 ++ cfg);
2050 +
2051 + /* we can't continue the same rule */
2052 + if (ch_idx == 0 || prev_reg_rule_flags != reg_rule_flags ||
2053 +diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.h b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.h
2054 +index b7e1ddf8f177..4eeedb41e9ac 100644
2055 +--- a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.h
2056 ++++ b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.h
2057 +@@ -7,7 +7,7 @@
2058 + *
2059 + * Copyright(c) 2008 - 2015 Intel Corporation. All rights reserved.
2060 + * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
2061 +- * Copyright(c) 2018 Intel Corporation
2062 ++ * Copyright(c) 2018 - 2019 Intel Corporation
2063 + *
2064 + * This program is free software; you can redistribute it and/or modify
2065 + * it under the terms of version 2 of the GNU General Public License as
2066 +@@ -29,7 +29,7 @@
2067 + *
2068 + * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved.
2069 + * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
2070 +- * Copyright(c) 2018 Intel Corporation
2071 ++ * Copyright(c) 2018 - 2019 Intel Corporation
2072 + * All rights reserved.
2073 + *
2074 + * Redistribution and use in source and binary forms, with or without
2075 +@@ -103,7 +103,7 @@ iwl_parse_nvm_data(struct iwl_trans *trans, const struct iwl_cfg *cfg,
2076 + struct ieee80211_regdomain *
2077 + iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg,
2078 + int num_of_ch, __le32 *channels, u16 fw_mcc,
2079 +- u16 geo_info);
2080 ++ u16 geo_info, u16 cap);
2081 +
2082 + /**
2083 + * struct iwl_nvm_section - describes an NVM section in memory.
2084 +diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-trans.c b/drivers/net/wireless/intel/iwlwifi/iwl-trans.c
2085 +index 28bdc9a9617e..f91197e4ae40 100644
2086 +--- a/drivers/net/wireless/intel/iwlwifi/iwl-trans.c
2087 ++++ b/drivers/net/wireless/intel/iwlwifi/iwl-trans.c
2088 +@@ -66,7 +66,9 @@
2089 +
2090 + struct iwl_trans *iwl_trans_alloc(unsigned int priv_size,
2091 + struct device *dev,
2092 +- const struct iwl_trans_ops *ops)
2093 ++ const struct iwl_trans_ops *ops,
2094 ++ unsigned int cmd_pool_size,
2095 ++ unsigned int cmd_pool_align)
2096 + {
2097 + struct iwl_trans *trans;
2098 + #ifdef CONFIG_LOCKDEP
2099 +@@ -90,10 +92,8 @@ struct iwl_trans *iwl_trans_alloc(unsigned int priv_size,
2100 + "iwl_cmd_pool:%s", dev_name(trans->dev));
2101 + trans->dev_cmd_pool =
2102 + kmem_cache_create(trans->dev_cmd_pool_name,
2103 +- sizeof(struct iwl_device_cmd),
2104 +- sizeof(void *),
2105 +- SLAB_HWCACHE_ALIGN,
2106 +- NULL);
2107 ++ cmd_pool_size, cmd_pool_align,
2108 ++ SLAB_HWCACHE_ALIGN, NULL);
2109 + if (!trans->dev_cmd_pool)
2110 + return NULL;
2111 +
2112 +diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-trans.h b/drivers/net/wireless/intel/iwlwifi/iwl-trans.h
2113 +index a31408188ed0..1e85d59b9161 100644
2114 +--- a/drivers/net/wireless/intel/iwlwifi/iwl-trans.h
2115 ++++ b/drivers/net/wireless/intel/iwlwifi/iwl-trans.h
2116 +@@ -193,6 +193,18 @@ struct iwl_device_cmd {
2117 + };
2118 + } __packed;
2119 +
2120 ++/**
2121 ++ * struct iwl_device_tx_cmd - buffer for TX command
2122 ++ * @hdr: the header
2123 ++ * @payload: the payload placeholder
2124 ++ *
2125 ++ * The actual structure is sized dynamically according to need.
2126 ++ */
2127 ++struct iwl_device_tx_cmd {
2128 ++ struct iwl_cmd_header hdr;
2129 ++ u8 payload[];
2130 ++} __packed;
2131 ++
2132 + #define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl_device_cmd))
2133 +
2134 + /*
2135 +@@ -544,7 +556,7 @@ struct iwl_trans_ops {
2136 + int (*send_cmd)(struct iwl_trans *trans, struct iwl_host_cmd *cmd);
2137 +
2138 + int (*tx)(struct iwl_trans *trans, struct sk_buff *skb,
2139 +- struct iwl_device_cmd *dev_cmd, int queue);
2140 ++ struct iwl_device_tx_cmd *dev_cmd, int queue);
2141 + void (*reclaim)(struct iwl_trans *trans, int queue, int ssn,
2142 + struct sk_buff_head *skbs);
2143 +
2144 +@@ -921,22 +933,22 @@ iwl_trans_dump_data(struct iwl_trans *trans, u32 dump_mask)
2145 + return trans->ops->dump_data(trans, dump_mask);
2146 + }
2147 +
2148 +-static inline struct iwl_device_cmd *
2149 ++static inline struct iwl_device_tx_cmd *
2150 + iwl_trans_alloc_tx_cmd(struct iwl_trans *trans)
2151 + {
2152 +- return kmem_cache_alloc(trans->dev_cmd_pool, GFP_ATOMIC);
2153 ++ return kmem_cache_zalloc(trans->dev_cmd_pool, GFP_ATOMIC);
2154 + }
2155 +
2156 + int iwl_trans_send_cmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd);
2157 +
2158 + static inline void iwl_trans_free_tx_cmd(struct iwl_trans *trans,
2159 +- struct iwl_device_cmd *dev_cmd)
2160 ++ struct iwl_device_tx_cmd *dev_cmd)
2161 + {
2162 + kmem_cache_free(trans->dev_cmd_pool, dev_cmd);
2163 + }
2164 +
2165 + static inline int iwl_trans_tx(struct iwl_trans *trans, struct sk_buff *skb,
2166 +- struct iwl_device_cmd *dev_cmd, int queue)
2167 ++ struct iwl_device_tx_cmd *dev_cmd, int queue)
2168 + {
2169 + if (unlikely(test_bit(STATUS_FW_ERROR, &trans->status)))
2170 + return -EIO;
2171 +@@ -1239,7 +1251,9 @@ static inline bool iwl_trans_dbg_ini_valid(struct iwl_trans *trans)
2172 + *****************************************************/
2173 + struct iwl_trans *iwl_trans_alloc(unsigned int priv_size,
2174 + struct device *dev,
2175 +- const struct iwl_trans_ops *ops);
2176 ++ const struct iwl_trans_ops *ops,
2177 ++ unsigned int cmd_pool_size,
2178 ++ unsigned int cmd_pool_align);
2179 + void iwl_trans_free(struct iwl_trans *trans);
2180 +
2181 + /*****************************************************
2182 +diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
2183 +index 49aeab7c27a2..18ccc2692437 100644
2184 +--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
2185 ++++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
2186 +@@ -256,7 +256,8 @@ struct ieee80211_regdomain *iwl_mvm_get_regdomain(struct wiphy *wiphy,
2187 + __le32_to_cpu(resp->n_channels),
2188 + resp->channels,
2189 + __le16_to_cpu(resp->mcc),
2190 +- __le16_to_cpu(resp->geo_info));
2191 ++ __le16_to_cpu(resp->geo_info),
2192 ++ __le16_to_cpu(resp->cap));
2193 + /* Store the return source id */
2194 + src_id = resp->source_id;
2195 + kfree(resp);
2196 +diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
2197 +index d9d82f6b5e87..2b92980a49e6 100644
2198 +--- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
2199 ++++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
2200 +@@ -487,13 +487,13 @@ static void iwl_mvm_set_tx_cmd_crypto(struct iwl_mvm *mvm,
2201 + /*
2202 + * Allocates and sets the Tx cmd the driver data pointers in the skb
2203 + */
2204 +-static struct iwl_device_cmd *
2205 ++static struct iwl_device_tx_cmd *
2206 + iwl_mvm_set_tx_params(struct iwl_mvm *mvm, struct sk_buff *skb,
2207 + struct ieee80211_tx_info *info, int hdrlen,
2208 + struct ieee80211_sta *sta, u8 sta_id)
2209 + {
2210 + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
2211 +- struct iwl_device_cmd *dev_cmd;
2212 ++ struct iwl_device_tx_cmd *dev_cmd;
2213 + struct iwl_tx_cmd *tx_cmd;
2214 +
2215 + dev_cmd = iwl_trans_alloc_tx_cmd(mvm->trans);
2216 +@@ -501,11 +501,6 @@ iwl_mvm_set_tx_params(struct iwl_mvm *mvm, struct sk_buff *skb,
2217 + if (unlikely(!dev_cmd))
2218 + return NULL;
2219 +
2220 +- /* Make sure we zero enough of dev_cmd */
2221 +- BUILD_BUG_ON(sizeof(struct iwl_tx_cmd_gen2) > sizeof(*tx_cmd));
2222 +- BUILD_BUG_ON(sizeof(struct iwl_tx_cmd_gen3) > sizeof(*tx_cmd));
2223 +-
2224 +- memset(dev_cmd, 0, sizeof(dev_cmd->hdr) + sizeof(*tx_cmd));
2225 + dev_cmd->hdr.cmd = TX_CMD;
2226 +
2227 + if (iwl_mvm_has_new_tx_api(mvm)) {
2228 +@@ -594,7 +589,7 @@ out:
2229 + }
2230 +
2231 + static void iwl_mvm_skb_prepare_status(struct sk_buff *skb,
2232 +- struct iwl_device_cmd *cmd)
2233 ++ struct iwl_device_tx_cmd *cmd)
2234 + {
2235 + struct ieee80211_tx_info *skb_info = IEEE80211_SKB_CB(skb);
2236 +
2237 +@@ -713,7 +708,7 @@ int iwl_mvm_tx_skb_non_sta(struct iwl_mvm *mvm, struct sk_buff *skb)
2238 + {
2239 + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
2240 + struct ieee80211_tx_info info;
2241 +- struct iwl_device_cmd *dev_cmd;
2242 ++ struct iwl_device_tx_cmd *dev_cmd;
2243 + u8 sta_id;
2244 + int hdrlen = ieee80211_hdrlen(hdr->frame_control);
2245 + __le16 fc = hdr->frame_control;
2246 +@@ -1075,7 +1070,7 @@ static int iwl_mvm_tx_mpdu(struct iwl_mvm *mvm, struct sk_buff *skb,
2247 + {
2248 + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
2249 + struct iwl_mvm_sta *mvmsta;
2250 +- struct iwl_device_cmd *dev_cmd;
2251 ++ struct iwl_device_tx_cmd *dev_cmd;
2252 + __le16 fc;
2253 + u16 seq_number = 0;
2254 + u8 tid = IWL_MAX_TID_COUNT;
2255 +diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/internal.h b/drivers/net/wireless/intel/iwlwifi/pcie/internal.h
2256 +index 1047d48beaa5..9b5b96e34456 100644
2257 +--- a/drivers/net/wireless/intel/iwlwifi/pcie/internal.h
2258 ++++ b/drivers/net/wireless/intel/iwlwifi/pcie/internal.h
2259 +@@ -305,7 +305,7 @@ struct iwl_cmd_meta {
2260 + #define IWL_FIRST_TB_SIZE_ALIGN ALIGN(IWL_FIRST_TB_SIZE, 64)
2261 +
2262 + struct iwl_pcie_txq_entry {
2263 +- struct iwl_device_cmd *cmd;
2264 ++ void *cmd;
2265 + struct sk_buff *skb;
2266 + /* buffer to free after command completes */
2267 + const void *free_buf;
2268 +@@ -690,7 +690,7 @@ void iwl_trans_pcie_txq_set_shared_mode(struct iwl_trans *trans, u32 txq_id,
2269 + void iwl_trans_pcie_log_scd_error(struct iwl_trans *trans,
2270 + struct iwl_txq *txq);
2271 + int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb,
2272 +- struct iwl_device_cmd *dev_cmd, int txq_id);
2273 ++ struct iwl_device_tx_cmd *dev_cmd, int txq_id);
2274 + void iwl_pcie_txq_check_wrptrs(struct iwl_trans *trans);
2275 + int iwl_trans_pcie_send_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd);
2276 + void iwl_pcie_cmdq_reclaim(struct iwl_trans *trans, int txq_id, int idx);
2277 +@@ -1111,7 +1111,7 @@ int iwl_trans_pcie_dyn_txq_alloc(struct iwl_trans *trans,
2278 + unsigned int timeout);
2279 + void iwl_trans_pcie_dyn_txq_free(struct iwl_trans *trans, int queue);
2280 + int iwl_trans_pcie_gen2_tx(struct iwl_trans *trans, struct sk_buff *skb,
2281 +- struct iwl_device_cmd *dev_cmd, int txq_id);
2282 ++ struct iwl_device_tx_cmd *dev_cmd, int txq_id);
2283 + int iwl_trans_pcie_gen2_send_hcmd(struct iwl_trans *trans,
2284 + struct iwl_host_cmd *cmd);
2285 + void iwl_trans_pcie_gen2_stop_device(struct iwl_trans *trans);
2286 +diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
2287 +index d3db38c3095b..c76d26708e65 100644
2288 +--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
2289 ++++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
2290 +@@ -79,6 +79,7 @@
2291 + #include "iwl-agn-hw.h"
2292 + #include "fw/error-dump.h"
2293 + #include "fw/dbg.h"
2294 ++#include "fw/api/tx.h"
2295 + #include "internal.h"
2296 + #include "iwl-fh.h"
2297 +
2298 +@@ -3462,19 +3463,34 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev,
2299 + {
2300 + struct iwl_trans_pcie *trans_pcie;
2301 + struct iwl_trans *trans;
2302 +- int ret, addr_size;
2303 ++ int ret, addr_size, txcmd_size, txcmd_align;
2304 ++ const struct iwl_trans_ops *ops = &trans_ops_pcie_gen2;
2305 ++
2306 ++ if (!cfg_trans->gen2) {
2307 ++ ops = &trans_ops_pcie;
2308 ++ txcmd_size = sizeof(struct iwl_tx_cmd);
2309 ++ txcmd_align = sizeof(void *);
2310 ++ } else if (cfg_trans->device_family < IWL_DEVICE_FAMILY_AX210) {
2311 ++ txcmd_size = sizeof(struct iwl_tx_cmd_gen2);
2312 ++ txcmd_align = 64;
2313 ++ } else {
2314 ++ txcmd_size = sizeof(struct iwl_tx_cmd_gen3);
2315 ++ txcmd_align = 128;
2316 ++ }
2317 ++
2318 ++ txcmd_size += sizeof(struct iwl_cmd_header);
2319 ++ txcmd_size += 36; /* biggest possible 802.11 header */
2320 ++
2321 ++ /* Ensure device TX cmd cannot reach/cross a page boundary in gen2 */
2322 ++ if (WARN_ON(cfg_trans->gen2 && txcmd_size >= txcmd_align))
2323 ++ return ERR_PTR(-EINVAL);
2324 +
2325 + ret = pcim_enable_device(pdev);
2326 + if (ret)
2327 + return ERR_PTR(ret);
2328 +
2329 +- if (cfg_trans->gen2)
2330 +- trans = iwl_trans_alloc(sizeof(struct iwl_trans_pcie),
2331 +- &pdev->dev, &trans_ops_pcie_gen2);
2332 +- else
2333 +- trans = iwl_trans_alloc(sizeof(struct iwl_trans_pcie),
2334 +- &pdev->dev, &trans_ops_pcie);
2335 +-
2336 ++ trans = iwl_trans_alloc(sizeof(struct iwl_trans_pcie), &pdev->dev, ops,
2337 ++ txcmd_size, txcmd_align);
2338 + if (!trans)
2339 + return ERR_PTR(-ENOMEM);
2340 +
2341 +diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c b/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c
2342 +index 97cb3a8d505c..ff4c34d7b74f 100644
2343 +--- a/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c
2344 ++++ b/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c
2345 +@@ -243,7 +243,8 @@ static int iwl_pcie_gen2_set_tb(struct iwl_trans *trans,
2346 + static int iwl_pcie_gen2_build_amsdu(struct iwl_trans *trans,
2347 + struct sk_buff *skb,
2348 + struct iwl_tfh_tfd *tfd, int start_len,
2349 +- u8 hdr_len, struct iwl_device_cmd *dev_cmd)
2350 ++ u8 hdr_len,
2351 ++ struct iwl_device_tx_cmd *dev_cmd)
2352 + {
2353 + #ifdef CONFIG_INET
2354 + struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
2355 +@@ -371,7 +372,7 @@ out_err:
2356 + static struct
2357 + iwl_tfh_tfd *iwl_pcie_gen2_build_tx_amsdu(struct iwl_trans *trans,
2358 + struct iwl_txq *txq,
2359 +- struct iwl_device_cmd *dev_cmd,
2360 ++ struct iwl_device_tx_cmd *dev_cmd,
2361 + struct sk_buff *skb,
2362 + struct iwl_cmd_meta *out_meta,
2363 + int hdr_len,
2364 +@@ -403,6 +404,10 @@ iwl_tfh_tfd *iwl_pcie_gen2_build_tx_amsdu(struct iwl_trans *trans,
2365 + tb_phys = dma_map_single(trans->dev, tb1_addr, len, DMA_TO_DEVICE);
2366 + if (unlikely(dma_mapping_error(trans->dev, tb_phys)))
2367 + goto out_err;
2368 ++ /*
2369 ++ * No need for _with_wa(), we ensure (via alignment) that the data
2370 ++ * here can never cross or end at a page boundary.
2371 ++ */
2372 + iwl_pcie_gen2_set_tb(trans, tfd, tb_phys, len);
2373 +
2374 + if (iwl_pcie_gen2_build_amsdu(trans, skb, tfd,
2375 +@@ -456,7 +461,7 @@ static int iwl_pcie_gen2_tx_add_frags(struct iwl_trans *trans,
2376 + static struct
2377 + iwl_tfh_tfd *iwl_pcie_gen2_build_tx(struct iwl_trans *trans,
2378 + struct iwl_txq *txq,
2379 +- struct iwl_device_cmd *dev_cmd,
2380 ++ struct iwl_device_tx_cmd *dev_cmd,
2381 + struct sk_buff *skb,
2382 + struct iwl_cmd_meta *out_meta,
2383 + int hdr_len,
2384 +@@ -496,6 +501,10 @@ iwl_tfh_tfd *iwl_pcie_gen2_build_tx(struct iwl_trans *trans,
2385 + tb_phys = dma_map_single(trans->dev, tb1_addr, tb1_len, DMA_TO_DEVICE);
2386 + if (unlikely(dma_mapping_error(trans->dev, tb_phys)))
2387 + goto out_err;
2388 ++ /*
2389 ++ * No need for _with_wa(), we ensure (via alignment) that the data
2390 ++ * here can never cross or end at a page boundary.
2391 ++ */
2392 + iwl_pcie_gen2_set_tb(trans, tfd, tb_phys, tb1_len);
2393 + trace_iwlwifi_dev_tx(trans->dev, skb, tfd, sizeof(*tfd), &dev_cmd->hdr,
2394 + IWL_FIRST_TB_SIZE + tb1_len, hdr_len);
2395 +@@ -540,7 +549,7 @@ out_err:
2396 + static
2397 + struct iwl_tfh_tfd *iwl_pcie_gen2_build_tfd(struct iwl_trans *trans,
2398 + struct iwl_txq *txq,
2399 +- struct iwl_device_cmd *dev_cmd,
2400 ++ struct iwl_device_tx_cmd *dev_cmd,
2401 + struct sk_buff *skb,
2402 + struct iwl_cmd_meta *out_meta)
2403 + {
2404 +@@ -580,7 +589,7 @@ struct iwl_tfh_tfd *iwl_pcie_gen2_build_tfd(struct iwl_trans *trans,
2405 + }
2406 +
2407 + int iwl_trans_pcie_gen2_tx(struct iwl_trans *trans, struct sk_buff *skb,
2408 +- struct iwl_device_cmd *dev_cmd, int txq_id)
2409 ++ struct iwl_device_tx_cmd *dev_cmd, int txq_id)
2410 + {
2411 + struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
2412 + struct iwl_cmd_meta *out_meta;
2413 +@@ -605,7 +614,7 @@ int iwl_trans_pcie_gen2_tx(struct iwl_trans *trans, struct sk_buff *skb,
2414 +
2415 + /* don't put the packet on the ring, if there is no room */
2416 + if (unlikely(iwl_queue_space(trans, txq) < 3)) {
2417 +- struct iwl_device_cmd **dev_cmd_ptr;
2418 ++ struct iwl_device_tx_cmd **dev_cmd_ptr;
2419 +
2420 + dev_cmd_ptr = (void *)((u8 *)skb->cb +
2421 + trans_pcie->dev_cmd_offs);
2422 +diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/tx.c b/drivers/net/wireless/intel/iwlwifi/pcie/tx.c
2423 +index 4806a04cec8c..d3b58334e13e 100644
2424 +--- a/drivers/net/wireless/intel/iwlwifi/pcie/tx.c
2425 ++++ b/drivers/net/wireless/intel/iwlwifi/pcie/tx.c
2426 +@@ -213,8 +213,8 @@ static void iwl_pcie_txq_update_byte_cnt_tbl(struct iwl_trans *trans,
2427 + u8 sec_ctl = 0;
2428 + u16 len = byte_cnt + IWL_TX_CRC_SIZE + IWL_TX_DELIMITER_SIZE;
2429 + __le16 bc_ent;
2430 +- struct iwl_tx_cmd *tx_cmd =
2431 +- (void *)txq->entries[txq->write_ptr].cmd->payload;
2432 ++ struct iwl_device_tx_cmd *dev_cmd = txq->entries[txq->write_ptr].cmd;
2433 ++ struct iwl_tx_cmd *tx_cmd = (void *)dev_cmd->payload;
2434 + u8 sta_id = tx_cmd->sta_id;
2435 +
2436 + scd_bc_tbl = trans_pcie->scd_bc_tbls.addr;
2437 +@@ -257,8 +257,8 @@ static void iwl_pcie_txq_inval_byte_cnt_tbl(struct iwl_trans *trans,
2438 + int read_ptr = txq->read_ptr;
2439 + u8 sta_id = 0;
2440 + __le16 bc_ent;
2441 +- struct iwl_tx_cmd *tx_cmd =
2442 +- (void *)txq->entries[read_ptr].cmd->payload;
2443 ++ struct iwl_device_tx_cmd *dev_cmd = txq->entries[read_ptr].cmd;
2444 ++ struct iwl_tx_cmd *tx_cmd = (void *)dev_cmd->payload;
2445 +
2446 + WARN_ON(read_ptr >= TFD_QUEUE_SIZE_MAX);
2447 +
2448 +@@ -1196,7 +1196,7 @@ void iwl_trans_pcie_reclaim(struct iwl_trans *trans, int txq_id, int ssn,
2449 +
2450 + while (!skb_queue_empty(&overflow_skbs)) {
2451 + struct sk_buff *skb = __skb_dequeue(&overflow_skbs);
2452 +- struct iwl_device_cmd *dev_cmd_ptr;
2453 ++ struct iwl_device_tx_cmd *dev_cmd_ptr;
2454 +
2455 + dev_cmd_ptr = *(void **)((u8 *)skb->cb +
2456 + trans_pcie->dev_cmd_offs);
2457 +@@ -2099,7 +2099,8 @@ static void iwl_compute_pseudo_hdr_csum(void *iph, struct tcphdr *tcph,
2458 + static int iwl_fill_data_tbs_amsdu(struct iwl_trans *trans, struct sk_buff *skb,
2459 + struct iwl_txq *txq, u8 hdr_len,
2460 + struct iwl_cmd_meta *out_meta,
2461 +- struct iwl_device_cmd *dev_cmd, u16 tb1_len)
2462 ++ struct iwl_device_tx_cmd *dev_cmd,
2463 ++ u16 tb1_len)
2464 + {
2465 + struct iwl_tx_cmd *tx_cmd = (void *)dev_cmd->payload;
2466 + struct iwl_trans_pcie *trans_pcie = txq->trans_pcie;
2467 +@@ -2281,7 +2282,8 @@ static int iwl_fill_data_tbs_amsdu(struct iwl_trans *trans, struct sk_buff *skb,
2468 + static int iwl_fill_data_tbs_amsdu(struct iwl_trans *trans, struct sk_buff *skb,
2469 + struct iwl_txq *txq, u8 hdr_len,
2470 + struct iwl_cmd_meta *out_meta,
2471 +- struct iwl_device_cmd *dev_cmd, u16 tb1_len)
2472 ++ struct iwl_device_tx_cmd *dev_cmd,
2473 ++ u16 tb1_len)
2474 + {
2475 + /* No A-MSDU without CONFIG_INET */
2476 + WARN_ON(1);
2477 +@@ -2291,7 +2293,7 @@ static int iwl_fill_data_tbs_amsdu(struct iwl_trans *trans, struct sk_buff *skb,
2478 + #endif /* CONFIG_INET */
2479 +
2480 + int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb,
2481 +- struct iwl_device_cmd *dev_cmd, int txq_id)
2482 ++ struct iwl_device_tx_cmd *dev_cmd, int txq_id)
2483 + {
2484 + struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
2485 + struct ieee80211_hdr *hdr;
2486 +@@ -2348,7 +2350,7 @@ int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb,
2487 +
2488 + /* don't put the packet on the ring, if there is no room */
2489 + if (unlikely(iwl_queue_space(trans, txq) < 3)) {
2490 +- struct iwl_device_cmd **dev_cmd_ptr;
2491 ++ struct iwl_device_tx_cmd **dev_cmd_ptr;
2492 +
2493 + dev_cmd_ptr = (void *)((u8 *)skb->cb +
2494 + trans_pcie->dev_cmd_offs);
2495 +diff --git a/drivers/net/wireless/rsi/rsi_91x_usb.c b/drivers/net/wireless/rsi/rsi_91x_usb.c
2496 +index d6cdabef264d..4b9e406b8461 100644
2497 +--- a/drivers/net/wireless/rsi/rsi_91x_usb.c
2498 ++++ b/drivers/net/wireless/rsi/rsi_91x_usb.c
2499 +@@ -805,7 +805,7 @@ static int rsi_probe(struct usb_interface *pfunction,
2500 + adapter->device_model = RSI_DEV_9116;
2501 + } else {
2502 + rsi_dbg(ERR_ZONE, "%s: Unsupported RSI device id 0x%x\n",
2503 +- __func__, id ? id->idProduct : 0x0);
2504 ++ __func__, id->idProduct);
2505 + goto err1;
2506 + }
2507 +
2508 +diff --git a/drivers/platform/x86/gpd-pocket-fan.c b/drivers/platform/x86/gpd-pocket-fan.c
2509 +index 73eb1572b966..b471b86c28fe 100644
2510 +--- a/drivers/platform/x86/gpd-pocket-fan.c
2511 ++++ b/drivers/platform/x86/gpd-pocket-fan.c
2512 +@@ -127,7 +127,7 @@ static int gpd_pocket_fan_probe(struct platform_device *pdev)
2513 + int i;
2514 +
2515 + for (i = 0; i < ARRAY_SIZE(temp_limits); i++) {
2516 +- if (temp_limits[i] < 40000 || temp_limits[i] > 70000) {
2517 ++ if (temp_limits[i] < 20000 || temp_limits[i] > 90000) {
2518 + dev_err(&pdev->dev, "Invalid temp-limit %d (must be between 40000 and 70000)\n",
2519 + temp_limits[i]);
2520 + temp_limits[0] = TEMP_LIMIT0_DEFAULT;
2521 +diff --git a/drivers/platform/x86/intel_pmc_core_pltdrv.c b/drivers/platform/x86/intel_pmc_core_pltdrv.c
2522 +index 6fe829f30997..e1266f5c6359 100644
2523 +--- a/drivers/platform/x86/intel_pmc_core_pltdrv.c
2524 ++++ b/drivers/platform/x86/intel_pmc_core_pltdrv.c
2525 +@@ -44,6 +44,8 @@ static const struct x86_cpu_id intel_pmc_core_platform_ids[] = {
2526 + INTEL_CPU_FAM6(KABYLAKE, pmc_core_device),
2527 + INTEL_CPU_FAM6(CANNONLAKE_L, pmc_core_device),
2528 + INTEL_CPU_FAM6(ICELAKE_L, pmc_core_device),
2529 ++ INTEL_CPU_FAM6(COMETLAKE, pmc_core_device),
2530 ++ INTEL_CPU_FAM6(COMETLAKE_L, pmc_core_device),
2531 + {}
2532 + };
2533 + MODULE_DEVICE_TABLE(x86cpu, intel_pmc_core_platform_ids);
2534 +diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c
2535 +index a1915061932e..5256e3ce84e5 100644
2536 +--- a/drivers/s390/crypto/ap_bus.c
2537 ++++ b/drivers/s390/crypto/ap_bus.c
2538 +@@ -793,8 +793,6 @@ static int ap_device_probe(struct device *dev)
2539 + drvres = ap_drv->flags & AP_DRIVER_FLAG_DEFAULT;
2540 + if (!!devres != !!drvres)
2541 + return -ENODEV;
2542 +- /* (re-)init queue's state machine */
2543 +- ap_queue_reinit_state(to_ap_queue(dev));
2544 + }
2545 +
2546 + /* Add queue/card to list of active queues/cards */
2547 +diff --git a/drivers/s390/crypto/ap_bus.h b/drivers/s390/crypto/ap_bus.h
2548 +index 433b7b64368d..bb35ba4a8d24 100644
2549 +--- a/drivers/s390/crypto/ap_bus.h
2550 ++++ b/drivers/s390/crypto/ap_bus.h
2551 +@@ -261,7 +261,7 @@ void ap_queue_prepare_remove(struct ap_queue *aq);
2552 + void ap_queue_remove(struct ap_queue *aq);
2553 + void ap_queue_suspend(struct ap_device *ap_dev);
2554 + void ap_queue_resume(struct ap_device *ap_dev);
2555 +-void ap_queue_reinit_state(struct ap_queue *aq);
2556 ++void ap_queue_init_state(struct ap_queue *aq);
2557 +
2558 + struct ap_card *ap_card_create(int id, int queue_depth, int raw_device_type,
2559 + int comp_device_type, unsigned int functions);
2560 +diff --git a/drivers/s390/crypto/ap_queue.c b/drivers/s390/crypto/ap_queue.c
2561 +index dad2be333d82..37c3bdc3642d 100644
2562 +--- a/drivers/s390/crypto/ap_queue.c
2563 ++++ b/drivers/s390/crypto/ap_queue.c
2564 +@@ -638,7 +638,7 @@ struct ap_queue *ap_queue_create(ap_qid_t qid, int device_type)
2565 + aq->ap_dev.device.type = &ap_queue_type;
2566 + aq->ap_dev.device_type = device_type;
2567 + aq->qid = qid;
2568 +- aq->state = AP_STATE_RESET_START;
2569 ++ aq->state = AP_STATE_UNBOUND;
2570 + aq->interrupt = AP_INTR_DISABLED;
2571 + spin_lock_init(&aq->lock);
2572 + INIT_LIST_HEAD(&aq->list);
2573 +@@ -771,10 +771,11 @@ void ap_queue_remove(struct ap_queue *aq)
2574 + spin_unlock_bh(&aq->lock);
2575 + }
2576 +
2577 +-void ap_queue_reinit_state(struct ap_queue *aq)
2578 ++void ap_queue_init_state(struct ap_queue *aq)
2579 + {
2580 + spin_lock_bh(&aq->lock);
2581 + aq->state = AP_STATE_RESET_START;
2582 + ap_wait(ap_sm_event(aq, AP_EVENT_POLL));
2583 + spin_unlock_bh(&aq->lock);
2584 + }
2585 ++EXPORT_SYMBOL(ap_queue_init_state);
2586 +diff --git a/drivers/s390/crypto/zcrypt_cex2a.c b/drivers/s390/crypto/zcrypt_cex2a.c
2587 +index c50f3e86cc74..7cbb384ec535 100644
2588 +--- a/drivers/s390/crypto/zcrypt_cex2a.c
2589 ++++ b/drivers/s390/crypto/zcrypt_cex2a.c
2590 +@@ -175,6 +175,7 @@ static int zcrypt_cex2a_queue_probe(struct ap_device *ap_dev)
2591 + zq->queue = aq;
2592 + zq->online = 1;
2593 + atomic_set(&zq->load, 0);
2594 ++ ap_queue_init_state(aq);
2595 + ap_queue_init_reply(aq, &zq->reply);
2596 + aq->request_timeout = CEX2A_CLEANUP_TIME,
2597 + aq->private = zq;
2598 +diff --git a/drivers/s390/crypto/zcrypt_cex2c.c b/drivers/s390/crypto/zcrypt_cex2c.c
2599 +index 35c7c6672713..c78c0d119806 100644
2600 +--- a/drivers/s390/crypto/zcrypt_cex2c.c
2601 ++++ b/drivers/s390/crypto/zcrypt_cex2c.c
2602 +@@ -220,6 +220,7 @@ static int zcrypt_cex2c_queue_probe(struct ap_device *ap_dev)
2603 + zq->queue = aq;
2604 + zq->online = 1;
2605 + atomic_set(&zq->load, 0);
2606 ++ ap_rapq(aq->qid);
2607 + rc = zcrypt_cex2c_rng_supported(aq);
2608 + if (rc < 0) {
2609 + zcrypt_queue_free(zq);
2610 +@@ -231,6 +232,7 @@ static int zcrypt_cex2c_queue_probe(struct ap_device *ap_dev)
2611 + else
2612 + zq->ops = zcrypt_msgtype(MSGTYPE06_NAME,
2613 + MSGTYPE06_VARIANT_NORNG);
2614 ++ ap_queue_init_state(aq);
2615 + ap_queue_init_reply(aq, &zq->reply);
2616 + aq->request_timeout = CEX2C_CLEANUP_TIME;
2617 + aq->private = zq;
2618 +diff --git a/drivers/s390/crypto/zcrypt_cex4.c b/drivers/s390/crypto/zcrypt_cex4.c
2619 +index 442e3d6162f7..6fabc906114c 100644
2620 +--- a/drivers/s390/crypto/zcrypt_cex4.c
2621 ++++ b/drivers/s390/crypto/zcrypt_cex4.c
2622 +@@ -381,6 +381,7 @@ static int zcrypt_cex4_queue_probe(struct ap_device *ap_dev)
2623 + zq->queue = aq;
2624 + zq->online = 1;
2625 + atomic_set(&zq->load, 0);
2626 ++ ap_queue_init_state(aq);
2627 + ap_queue_init_reply(aq, &zq->reply);
2628 + aq->request_timeout = CEX4_CLEANUP_TIME,
2629 + aq->private = zq;
2630 +diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c
2631 +index 80608b53897b..e3f5c91d5e4f 100644
2632 +--- a/drivers/scsi/fnic/fnic_scsi.c
2633 ++++ b/drivers/scsi/fnic/fnic_scsi.c
2634 +@@ -439,6 +439,9 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc, void (*done)(struct scsi_
2635 + if (unlikely(fnic_chk_state_flags_locked(fnic, FNIC_FLAGS_IO_BLOCKED)))
2636 + return SCSI_MLQUEUE_HOST_BUSY;
2637 +
2638 ++ if (unlikely(fnic_chk_state_flags_locked(fnic, FNIC_FLAGS_FWRESET)))
2639 ++ return SCSI_MLQUEUE_HOST_BUSY;
2640 ++
2641 + rport = starget_to_rport(scsi_target(sc->device));
2642 + if (!rport) {
2643 + FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host,
2644 +diff --git a/drivers/soc/ti/wkup_m3_ipc.c b/drivers/soc/ti/wkup_m3_ipc.c
2645 +index 378369d9364a..e9ece45d7a33 100644
2646 +--- a/drivers/soc/ti/wkup_m3_ipc.c
2647 ++++ b/drivers/soc/ti/wkup_m3_ipc.c
2648 +@@ -419,6 +419,8 @@ static void wkup_m3_rproc_boot_thread(struct wkup_m3_ipc *m3_ipc)
2649 + ret = rproc_boot(m3_ipc->rproc);
2650 + if (ret)
2651 + dev_err(dev, "rproc_boot failed\n");
2652 ++ else
2653 ++ m3_ipc_state = m3_ipc;
2654 +
2655 + do_exit(0);
2656 + }
2657 +@@ -505,8 +507,6 @@ static int wkup_m3_ipc_probe(struct platform_device *pdev)
2658 + goto err_put_rproc;
2659 + }
2660 +
2661 +- m3_ipc_state = m3_ipc;
2662 +-
2663 + return 0;
2664 +
2665 + err_put_rproc:
2666 +diff --git a/drivers/tee/optee/Kconfig b/drivers/tee/optee/Kconfig
2667 +index d1ad512e1708..3ca71e3812ed 100644
2668 +--- a/drivers/tee/optee/Kconfig
2669 ++++ b/drivers/tee/optee/Kconfig
2670 +@@ -3,6 +3,7 @@
2671 + config OPTEE
2672 + tristate "OP-TEE"
2673 + depends on HAVE_ARM_SMCCC
2674 ++ depends on MMU
2675 + help
2676 + This implements the OP-TEE Trusted Execution Environment (TEE)
2677 + driver.
2678 +diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
2679 +index 1b151af25772..abcd93a3ca1d 100644
2680 +--- a/fs/btrfs/super.c
2681 ++++ b/fs/btrfs/super.c
2682 +@@ -2102,7 +2102,15 @@ static int btrfs_statfs(struct dentry *dentry, struct kstatfs *buf)
2683 + */
2684 + thresh = SZ_4M;
2685 +
2686 +- if (!mixed && total_free_meta - thresh < block_rsv->size)
2687 ++ /*
2688 ++ * We only want to claim there's no available space if we can no longer
2689 ++ * allocate chunks for our metadata profile and our global reserve will
2690 ++ * not fit in the free metadata space. If we aren't ->full then we
2691 ++ * still can allocate chunks and thus are fine using the currently
2692 ++ * calculated f_bavail.
2693 ++ */
2694 ++ if (!mixed && block_rsv->space_info->full &&
2695 ++ total_free_meta - thresh < block_rsv->size)
2696 + buf->f_bavail = 0;
2697 +
2698 + buf->f_type = BTRFS_SUPER_MAGIC;
2699 +diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
2700 +index e1d8cec6ba2e..e1cac715d19e 100644
2701 +--- a/fs/cifs/smb2pdu.c
2702 ++++ b/fs/cifs/smb2pdu.c
2703 +@@ -312,7 +312,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon)
2704 + if (server->tcpStatus != CifsNeedReconnect)
2705 + break;
2706 +
2707 +- if (--retries)
2708 ++ if (retries && --retries)
2709 + continue;
2710 +
2711 + /*
2712 +diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c
2713 +index e2437b775456..e7b9d39955d4 100644
2714 +--- a/fs/gfs2/lops.c
2715 ++++ b/fs/gfs2/lops.c
2716 +@@ -264,7 +264,7 @@ static struct bio *gfs2_log_alloc_bio(struct gfs2_sbd *sdp, u64 blkno,
2717 + struct super_block *sb = sdp->sd_vfs;
2718 + struct bio *bio = bio_alloc(GFP_NOIO, BIO_MAX_PAGES);
2719 +
2720 +- bio->bi_iter.bi_sector = blkno * (sb->s_blocksize >> 9);
2721 ++ bio->bi_iter.bi_sector = blkno << (sb->s_blocksize_bits - 9);
2722 + bio_set_dev(bio, sb->s_bdev);
2723 + bio->bi_end_io = end_io;
2724 + bio->bi_private = sdp;
2725 +@@ -471,6 +471,20 @@ static void gfs2_jhead_process_page(struct gfs2_jdesc *jd, unsigned long index,
2726 + put_page(page); /* Once more for find_or_create_page */
2727 + }
2728 +
2729 ++static struct bio *gfs2_chain_bio(struct bio *prev, unsigned int nr_iovecs)
2730 ++{
2731 ++ struct bio *new;
2732 ++
2733 ++ new = bio_alloc(GFP_NOIO, nr_iovecs);
2734 ++ bio_copy_dev(new, prev);
2735 ++ new->bi_iter.bi_sector = bio_end_sector(prev);
2736 ++ new->bi_opf = prev->bi_opf;
2737 ++ new->bi_write_hint = prev->bi_write_hint;
2738 ++ bio_chain(new, prev);
2739 ++ submit_bio(prev);
2740 ++ return new;
2741 ++}
2742 ++
2743 + /**
2744 + * gfs2_find_jhead - find the head of a log
2745 + * @jd: The journal descriptor
2746 +@@ -487,15 +501,15 @@ int gfs2_find_jhead(struct gfs2_jdesc *jd, struct gfs2_log_header_host *head,
2747 + struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode);
2748 + struct address_space *mapping = jd->jd_inode->i_mapping;
2749 + unsigned int block = 0, blocks_submitted = 0, blocks_read = 0;
2750 +- unsigned int bsize = sdp->sd_sb.sb_bsize;
2751 ++ unsigned int bsize = sdp->sd_sb.sb_bsize, off;
2752 + unsigned int bsize_shift = sdp->sd_sb.sb_bsize_shift;
2753 + unsigned int shift = PAGE_SHIFT - bsize_shift;
2754 +- unsigned int readhead_blocks = BIO_MAX_PAGES << shift;
2755 ++ unsigned int readahead_blocks = BIO_MAX_PAGES << shift;
2756 + struct gfs2_journal_extent *je;
2757 + int sz, ret = 0;
2758 + struct bio *bio = NULL;
2759 + struct page *page = NULL;
2760 +- bool done = false;
2761 ++ bool bio_chained = false, done = false;
2762 + errseq_t since;
2763 +
2764 + memset(head, 0, sizeof(*head));
2765 +@@ -504,9 +518,9 @@ int gfs2_find_jhead(struct gfs2_jdesc *jd, struct gfs2_log_header_host *head,
2766 +
2767 + since = filemap_sample_wb_err(mapping);
2768 + list_for_each_entry(je, &jd->extent_list, list) {
2769 +- for (; block < je->lblock + je->blocks; block++) {
2770 +- u64 dblock;
2771 ++ u64 dblock = je->dblock;
2772 +
2773 ++ for (; block < je->lblock + je->blocks; block++, dblock++) {
2774 + if (!page) {
2775 + page = find_or_create_page(mapping,
2776 + block >> shift, GFP_NOFS);
2777 +@@ -515,35 +529,41 @@ int gfs2_find_jhead(struct gfs2_jdesc *jd, struct gfs2_log_header_host *head,
2778 + done = true;
2779 + goto out;
2780 + }
2781 ++ off = 0;
2782 + }
2783 +
2784 +- if (bio) {
2785 +- unsigned int off;
2786 +-
2787 +- off = (block << bsize_shift) & ~PAGE_MASK;
2788 ++ if (!bio || (bio_chained && !off)) {
2789 ++ /* start new bio */
2790 ++ } else {
2791 + sz = bio_add_page(bio, page, bsize, off);
2792 +- if (sz == bsize) { /* block added */
2793 +- if (off + bsize == PAGE_SIZE) {
2794 +- page = NULL;
2795 +- goto page_added;
2796 +- }
2797 +- continue;
2798 ++ if (sz == bsize)
2799 ++ goto block_added;
2800 ++ if (off) {
2801 ++ unsigned int blocks =
2802 ++ (PAGE_SIZE - off) >> bsize_shift;
2803 ++
2804 ++ bio = gfs2_chain_bio(bio, blocks);
2805 ++ bio_chained = true;
2806 ++ goto add_block_to_new_bio;
2807 + }
2808 ++ }
2809 ++
2810 ++ if (bio) {
2811 + blocks_submitted = block + 1;
2812 + submit_bio(bio);
2813 +- bio = NULL;
2814 + }
2815 +
2816 +- dblock = je->dblock + (block - je->lblock);
2817 + bio = gfs2_log_alloc_bio(sdp, dblock, gfs2_end_log_read);
2818 + bio->bi_opf = REQ_OP_READ;
2819 +- sz = bio_add_page(bio, page, bsize, 0);
2820 +- gfs2_assert_warn(sdp, sz == bsize);
2821 +- if (bsize == PAGE_SIZE)
2822 ++ bio_chained = false;
2823 ++add_block_to_new_bio:
2824 ++ sz = bio_add_page(bio, page, bsize, off);
2825 ++ BUG_ON(sz != bsize);
2826 ++block_added:
2827 ++ off += bsize;
2828 ++ if (off == PAGE_SIZE)
2829 + page = NULL;
2830 +-
2831 +-page_added:
2832 +- if (blocks_submitted < blocks_read + readhead_blocks) {
2833 ++ if (blocks_submitted < blocks_read + readahead_blocks) {
2834 + /* Keep at least one bio in flight */
2835 + continue;
2836 + }
2837 +diff --git a/fs/namei.c b/fs/namei.c
2838 +index e81521c87f98..bd1c0ca4151c 100644
2839 +--- a/fs/namei.c
2840 ++++ b/fs/namei.c
2841 +@@ -3249,8 +3249,8 @@ static int do_last(struct nameidata *nd,
2842 + struct file *file, const struct open_flags *op)
2843 + {
2844 + struct dentry *dir = nd->path.dentry;
2845 +- kuid_t dir_uid = dir->d_inode->i_uid;
2846 +- umode_t dir_mode = dir->d_inode->i_mode;
2847 ++ kuid_t dir_uid = nd->inode->i_uid;
2848 ++ umode_t dir_mode = nd->inode->i_mode;
2849 + int open_flag = op->open_flag;
2850 + bool will_truncate = (open_flag & O_TRUNC) != 0;
2851 + bool got_write = false;
2852 +diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
2853 +index 3244037b1286..d127af64283e 100644
2854 +--- a/fs/reiserfs/super.c
2855 ++++ b/fs/reiserfs/super.c
2856 +@@ -629,6 +629,7 @@ static void reiserfs_put_super(struct super_block *s)
2857 + reiserfs_write_unlock(s);
2858 + mutex_destroy(&REISERFS_SB(s)->lock);
2859 + destroy_workqueue(REISERFS_SB(s)->commit_wq);
2860 ++ kfree(REISERFS_SB(s)->s_jdev);
2861 + kfree(s->s_fs_info);
2862 + s->s_fs_info = NULL;
2863 + }
2864 +@@ -2240,6 +2241,7 @@ error_unlocked:
2865 + kfree(qf_names[j]);
2866 + }
2867 + #endif
2868 ++ kfree(sbi->s_jdev);
2869 + kfree(sbi);
2870 +
2871 + s->s_fs_info = NULL;
2872 +diff --git a/include/linux/sched.h b/include/linux/sched.h
2873 +index 775503573ed7..b968d736833b 100644
2874 +--- a/include/linux/sched.h
2875 ++++ b/include/linux/sched.h
2876 +@@ -1915,11 +1915,11 @@ static inline void rseq_migrate(struct task_struct *t)
2877 +
2878 + /*
2879 + * If parent process has a registered restartable sequences area, the
2880 +- * child inherits. Only applies when forking a process, not a thread.
2881 ++ * child inherits. Unregister rseq for a clone with CLONE_VM set.
2882 + */
2883 + static inline void rseq_fork(struct task_struct *t, unsigned long clone_flags)
2884 + {
2885 +- if (clone_flags & CLONE_THREAD) {
2886 ++ if (clone_flags & CLONE_VM) {
2887 + t->rseq = NULL;
2888 + t->rseq_sig = 0;
2889 + t->rseq_event_mask = 0;
2890 +diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
2891 +index 4ab2c49423dc..68782ba8b6e8 100644
2892 +--- a/include/net/cfg80211.h
2893 ++++ b/include/net/cfg80211.h
2894 +@@ -3537,6 +3537,9 @@ struct cfg80211_update_owe_info {
2895 + *
2896 + * @start_radar_detection: Start radar detection in the driver.
2897 + *
2898 ++ * @end_cac: End running CAC, probably because a related CAC
2899 ++ * was finished on another phy.
2900 ++ *
2901 + * @update_ft_ies: Provide updated Fast BSS Transition information to the
2902 + * driver. If the SME is in the driver/firmware, this information can be
2903 + * used in building Authentication and Reassociation Request frames.
2904 +@@ -3863,6 +3866,8 @@ struct cfg80211_ops {
2905 + struct net_device *dev,
2906 + struct cfg80211_chan_def *chandef,
2907 + u32 cac_time_ms);
2908 ++ void (*end_cac)(struct wiphy *wiphy,
2909 ++ struct net_device *dev);
2910 + int (*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev,
2911 + struct cfg80211_update_ft_ies_params *ftie);
2912 + int (*crit_proto_start)(struct wiphy *wiphy,
2913 +diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
2914 +index ef4242e5d4bc..595c52d59f31 100644
2915 +--- a/kernel/cgroup/cgroup.c
2916 ++++ b/kernel/cgroup/cgroup.c
2917 +@@ -3111,8 +3111,6 @@ static int cgroup_apply_control_enable(struct cgroup *cgrp)
2918 + for_each_subsys(ss, ssid) {
2919 + struct cgroup_subsys_state *css = cgroup_css(dsct, ss);
2920 +
2921 +- WARN_ON_ONCE(css && percpu_ref_is_dying(&css->refcnt));
2922 +-
2923 + if (!(cgroup_ss_mask(dsct) & (1 << ss->id)))
2924 + continue;
2925 +
2926 +@@ -3122,6 +3120,8 @@ static int cgroup_apply_control_enable(struct cgroup *cgrp)
2927 + return PTR_ERR(css);
2928 + }
2929 +
2930 ++ WARN_ON_ONCE(percpu_ref_is_dying(&css->refcnt));
2931 ++
2932 + if (css_visible(css)) {
2933 + ret = css_populate_dir(css);
2934 + if (ret)
2935 +@@ -3157,11 +3157,11 @@ static void cgroup_apply_control_disable(struct cgroup *cgrp)
2936 + for_each_subsys(ss, ssid) {
2937 + struct cgroup_subsys_state *css = cgroup_css(dsct, ss);
2938 +
2939 +- WARN_ON_ONCE(css && percpu_ref_is_dying(&css->refcnt));
2940 +-
2941 + if (!css)
2942 + continue;
2943 +
2944 ++ WARN_ON_ONCE(percpu_ref_is_dying(&css->refcnt));
2945 ++
2946 + if (css->parent &&
2947 + !(cgroup_ss_mask(dsct) & (1 << ss->id))) {
2948 + kill_css(css);
2949 +@@ -3448,7 +3448,8 @@ static ssize_t cgroup_type_write(struct kernfs_open_file *of, char *buf,
2950 + if (strcmp(strstrip(buf), "threaded"))
2951 + return -EINVAL;
2952 +
2953 +- cgrp = cgroup_kn_lock_live(of->kn, false);
2954 ++ /* drain dying csses before we re-apply (threaded) subtree control */
2955 ++ cgrp = cgroup_kn_lock_live(of->kn, true);
2956 + if (!cgrp)
2957 + return -ENOENT;
2958 +
2959 +diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
2960 +index 3e5f9c7d939c..3f54dc2f6e1c 100644
2961 +--- a/kernel/trace/trace_kprobe.c
2962 ++++ b/kernel/trace/trace_kprobe.c
2963 +@@ -290,7 +290,7 @@ static struct trace_kprobe *alloc_trace_kprobe(const char *group,
2964 + INIT_HLIST_NODE(&tk->rp.kp.hlist);
2965 + INIT_LIST_HEAD(&tk->rp.kp.list);
2966 +
2967 +- ret = trace_probe_init(&tk->tp, event, group, 0);
2968 ++ ret = trace_probe_init(&tk->tp, event, group, false);
2969 + if (ret < 0)
2970 + goto error;
2971 +
2972 +diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
2973 +index bba18cf44a30..9ae87be422f2 100644
2974 +--- a/kernel/trace/trace_probe.c
2975 ++++ b/kernel/trace/trace_probe.c
2976 +@@ -984,16 +984,19 @@ void trace_probe_cleanup(struct trace_probe *tp)
2977 + }
2978 +
2979 + int trace_probe_init(struct trace_probe *tp, const char *event,
2980 +- const char *group, size_t event_data_size)
2981 ++ const char *group, bool alloc_filter)
2982 + {
2983 + struct trace_event_call *call;
2984 ++ size_t size = sizeof(struct trace_probe_event);
2985 + int ret = 0;
2986 +
2987 + if (!event || !group)
2988 + return -EINVAL;
2989 +
2990 +- tp->event = kzalloc(sizeof(struct trace_probe_event) + event_data_size,
2991 +- GFP_KERNEL);
2992 ++ if (alloc_filter)
2993 ++ size += sizeof(struct trace_uprobe_filter);
2994 ++
2995 ++ tp->event = kzalloc(size, GFP_KERNEL);
2996 + if (!tp->event)
2997 + return -ENOMEM;
2998 +
2999 +diff --git a/kernel/trace/trace_probe.h b/kernel/trace/trace_probe.h
3000 +index 03e4e180058d..a0ff9e200ef6 100644
3001 +--- a/kernel/trace/trace_probe.h
3002 ++++ b/kernel/trace/trace_probe.h
3003 +@@ -223,6 +223,12 @@ struct probe_arg {
3004 + const struct fetch_type *type; /* Type of this argument */
3005 + };
3006 +
3007 ++struct trace_uprobe_filter {
3008 ++ rwlock_t rwlock;
3009 ++ int nr_systemwide;
3010 ++ struct list_head perf_events;
3011 ++};
3012 ++
3013 + /* Event call and class holder */
3014 + struct trace_probe_event {
3015 + unsigned int flags; /* For TP_FLAG_* */
3016 +@@ -230,7 +236,7 @@ struct trace_probe_event {
3017 + struct trace_event_call call;
3018 + struct list_head files;
3019 + struct list_head probes;
3020 +- char data[0];
3021 ++ struct trace_uprobe_filter filter[0];
3022 + };
3023 +
3024 + struct trace_probe {
3025 +@@ -323,7 +329,7 @@ static inline bool trace_probe_has_single_file(struct trace_probe *tp)
3026 + }
3027 +
3028 + int trace_probe_init(struct trace_probe *tp, const char *event,
3029 +- const char *group, size_t event_data_size);
3030 ++ const char *group, bool alloc_filter);
3031 + void trace_probe_cleanup(struct trace_probe *tp);
3032 + int trace_probe_append(struct trace_probe *tp, struct trace_probe *to);
3033 + void trace_probe_unlink(struct trace_probe *tp);
3034 +diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
3035 +index f66e202fec13..2619bc5ed520 100644
3036 +--- a/kernel/trace/trace_uprobe.c
3037 ++++ b/kernel/trace/trace_uprobe.c
3038 +@@ -34,12 +34,6 @@ struct uprobe_trace_entry_head {
3039 + #define DATAOF_TRACE_ENTRY(entry, is_return) \
3040 + ((void*)(entry) + SIZEOF_TRACE_ENTRY(is_return))
3041 +
3042 +-struct trace_uprobe_filter {
3043 +- rwlock_t rwlock;
3044 +- int nr_systemwide;
3045 +- struct list_head perf_events;
3046 +-};
3047 +-
3048 + static int trace_uprobe_create(int argc, const char **argv);
3049 + static int trace_uprobe_show(struct seq_file *m, struct dyn_event *ev);
3050 + static int trace_uprobe_release(struct dyn_event *ev);
3051 +@@ -263,14 +257,6 @@ process_fetch_insn(struct fetch_insn *code, struct pt_regs *regs, void *dest,
3052 + }
3053 + NOKPROBE_SYMBOL(process_fetch_insn)
3054 +
3055 +-static struct trace_uprobe_filter *
3056 +-trace_uprobe_get_filter(struct trace_uprobe *tu)
3057 +-{
3058 +- struct trace_probe_event *event = tu->tp.event;
3059 +-
3060 +- return (struct trace_uprobe_filter *)&event->data[0];
3061 +-}
3062 +-
3063 + static inline void init_trace_uprobe_filter(struct trace_uprobe_filter *filter)
3064 + {
3065 + rwlock_init(&filter->rwlock);
3066 +@@ -358,8 +344,7 @@ alloc_trace_uprobe(const char *group, const char *event, int nargs, bool is_ret)
3067 + if (!tu)
3068 + return ERR_PTR(-ENOMEM);
3069 +
3070 +- ret = trace_probe_init(&tu->tp, event, group,
3071 +- sizeof(struct trace_uprobe_filter));
3072 ++ ret = trace_probe_init(&tu->tp, event, group, true);
3073 + if (ret < 0)
3074 + goto error;
3075 +
3076 +@@ -367,7 +352,7 @@ alloc_trace_uprobe(const char *group, const char *event, int nargs, bool is_ret)
3077 + tu->consumer.handler = uprobe_dispatcher;
3078 + if (is_ret)
3079 + tu->consumer.ret_handler = uretprobe_dispatcher;
3080 +- init_trace_uprobe_filter(trace_uprobe_get_filter(tu));
3081 ++ init_trace_uprobe_filter(tu->tp.event->filter);
3082 + return tu;
3083 +
3084 + error:
3085 +@@ -1076,7 +1061,7 @@ static void __probe_event_disable(struct trace_probe *tp)
3086 + struct trace_uprobe *tu;
3087 +
3088 + tu = container_of(tp, struct trace_uprobe, tp);
3089 +- WARN_ON(!uprobe_filter_is_empty(trace_uprobe_get_filter(tu)));
3090 ++ WARN_ON(!uprobe_filter_is_empty(tu->tp.event->filter));
3091 +
3092 + list_for_each_entry(pos, trace_probe_probe_list(tp), list) {
3093 + tu = container_of(pos, struct trace_uprobe, tp);
3094 +@@ -1117,7 +1102,7 @@ static int probe_event_enable(struct trace_event_call *call,
3095 + }
3096 +
3097 + tu = container_of(tp, struct trace_uprobe, tp);
3098 +- WARN_ON(!uprobe_filter_is_empty(trace_uprobe_get_filter(tu)));
3099 ++ WARN_ON(!uprobe_filter_is_empty(tu->tp.event->filter));
3100 +
3101 + if (enabled)
3102 + return 0;
3103 +@@ -1281,7 +1266,7 @@ static int uprobe_perf_close(struct trace_event_call *call,
3104 + return -ENODEV;
3105 +
3106 + tu = container_of(tp, struct trace_uprobe, tp);
3107 +- if (trace_uprobe_filter_remove(trace_uprobe_get_filter(tu), event))
3108 ++ if (trace_uprobe_filter_remove(tu->tp.event->filter, event))
3109 + return 0;
3110 +
3111 + list_for_each_entry(pos, trace_probe_probe_list(tp), list) {
3112 +@@ -1306,7 +1291,7 @@ static int uprobe_perf_open(struct trace_event_call *call,
3113 + return -ENODEV;
3114 +
3115 + tu = container_of(tp, struct trace_uprobe, tp);
3116 +- if (trace_uprobe_filter_add(trace_uprobe_get_filter(tu), event))
3117 ++ if (trace_uprobe_filter_add(tu->tp.event->filter, event))
3118 + return 0;
3119 +
3120 + list_for_each_entry(pos, trace_probe_probe_list(tp), list) {
3121 +@@ -1328,7 +1313,7 @@ static bool uprobe_perf_filter(struct uprobe_consumer *uc,
3122 + int ret;
3123 +
3124 + tu = container_of(uc, struct trace_uprobe, consumer);
3125 +- filter = trace_uprobe_get_filter(tu);
3126 ++ filter = tu->tp.event->filter;
3127 +
3128 + read_lock(&filter->rwlock);
3129 + ret = __uprobe_perf_filter(filter, mm);
3130 +diff --git a/lib/test_xarray.c b/lib/test_xarray.c
3131 +index 03c3f42966ce..55c14e8c8859 100644
3132 +--- a/lib/test_xarray.c
3133 ++++ b/lib/test_xarray.c
3134 +@@ -1160,6 +1160,27 @@ static noinline void check_move_tiny(struct xarray *xa)
3135 + XA_BUG_ON(xa, !xa_empty(xa));
3136 + }
3137 +
3138 ++static noinline void check_move_max(struct xarray *xa)
3139 ++{
3140 ++ XA_STATE(xas, xa, 0);
3141 ++
3142 ++ xa_store_index(xa, ULONG_MAX, GFP_KERNEL);
3143 ++ rcu_read_lock();
3144 ++ XA_BUG_ON(xa, xas_find(&xas, ULONG_MAX) != xa_mk_index(ULONG_MAX));
3145 ++ XA_BUG_ON(xa, xas_find(&xas, ULONG_MAX) != NULL);
3146 ++ rcu_read_unlock();
3147 ++
3148 ++ xas_set(&xas, 0);
3149 ++ rcu_read_lock();
3150 ++ XA_BUG_ON(xa, xas_find(&xas, ULONG_MAX) != xa_mk_index(ULONG_MAX));
3151 ++ xas_pause(&xas);
3152 ++ XA_BUG_ON(xa, xas_find(&xas, ULONG_MAX) != NULL);
3153 ++ rcu_read_unlock();
3154 ++
3155 ++ xa_erase_index(xa, ULONG_MAX);
3156 ++ XA_BUG_ON(xa, !xa_empty(xa));
3157 ++}
3158 ++
3159 + static noinline void check_move_small(struct xarray *xa, unsigned long idx)
3160 + {
3161 + XA_STATE(xas, xa, 0);
3162 +@@ -1268,6 +1289,7 @@ static noinline void check_move(struct xarray *xa)
3163 + xa_destroy(xa);
3164 +
3165 + check_move_tiny(xa);
3166 ++ check_move_max(xa);
3167 +
3168 + for (i = 0; i < 16; i++)
3169 + check_move_small(xa, 1UL << i);
3170 +diff --git a/lib/xarray.c b/lib/xarray.c
3171 +index 47e17d46e5f8..1d9fab7db8da 100644
3172 +--- a/lib/xarray.c
3173 ++++ b/lib/xarray.c
3174 +@@ -968,6 +968,7 @@ void xas_pause(struct xa_state *xas)
3175 + if (xas_invalid(xas))
3176 + return;
3177 +
3178 ++ xas->xa_node = XAS_RESTART;
3179 + if (node) {
3180 + unsigned int offset = xas->xa_offset;
3181 + while (++offset < XA_CHUNK_SIZE) {
3182 +@@ -975,10 +976,11 @@ void xas_pause(struct xa_state *xas)
3183 + break;
3184 + }
3185 + xas->xa_index += (offset - xas->xa_offset) << node->shift;
3186 ++ if (xas->xa_index == 0)
3187 ++ xas->xa_node = XAS_BOUNDS;
3188 + } else {
3189 + xas->xa_index++;
3190 + }
3191 +- xas->xa_node = XAS_RESTART;
3192 + }
3193 + EXPORT_SYMBOL_GPL(xas_pause);
3194 +
3195 +@@ -1080,7 +1082,7 @@ void *xas_find(struct xa_state *xas, unsigned long max)
3196 + {
3197 + void *entry;
3198 +
3199 +- if (xas_error(xas))
3200 ++ if (xas_error(xas) || xas->xa_node == XAS_BOUNDS)
3201 + return NULL;
3202 + if (xas->xa_index > max)
3203 + return set_bounds(xas);
3204 +@@ -1088,7 +1090,7 @@ void *xas_find(struct xa_state *xas, unsigned long max)
3205 + if (!xas->xa_node) {
3206 + xas->xa_index = 1;
3207 + return set_bounds(xas);
3208 +- } else if (xas_top(xas->xa_node)) {
3209 ++ } else if (xas->xa_node == XAS_RESTART) {
3210 + entry = xas_load(xas);
3211 + if (entry || xas_not_node(xas->xa_node))
3212 + return entry;
3213 +diff --git a/mm/mempolicy.c b/mm/mempolicy.c
3214 +index e08c94170ae4..fbb3258af275 100644
3215 +--- a/mm/mempolicy.c
3216 ++++ b/mm/mempolicy.c
3217 +@@ -2802,6 +2802,9 @@ int mpol_parse_str(char *str, struct mempolicy **mpol)
3218 + char *flags = strchr(str, '=');
3219 + int err = 1, mode;
3220 +
3221 ++ if (flags)
3222 ++ *flags++ = '\0'; /* terminate mode string */
3223 ++
3224 + if (nodelist) {
3225 + /* NUL-terminate mode or flags string */
3226 + *nodelist++ = '\0';
3227 +@@ -2812,9 +2815,6 @@ int mpol_parse_str(char *str, struct mempolicy **mpol)
3228 + } else
3229 + nodes_clear(nodes);
3230 +
3231 +- if (flags)
3232 +- *flags++ = '\0'; /* terminate mode string */
3233 +-
3234 + mode = match_string(policy_modes, MPOL_MAX, str);
3235 + if (mode < 0)
3236 + goto out;
3237 +diff --git a/mm/migrate.c b/mm/migrate.c
3238 +index 45d3303e0022..6956627ebf8b 100644
3239 +--- a/mm/migrate.c
3240 ++++ b/mm/migrate.c
3241 +@@ -1680,7 +1680,7 @@ out_flush:
3242 + err1 = do_move_pages_to_node(mm, &pagelist, current_node);
3243 + if (!err1)
3244 + err1 = store_status(status, start, current_node, i - start);
3245 +- if (!err)
3246 ++ if (err >= 0)
3247 + err = err1;
3248 + out:
3249 + return err;
3250 +diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
3251 +index d32077b28433..8159b344deef 100644
3252 +--- a/net/bluetooth/hci_sock.c
3253 ++++ b/net/bluetooth/hci_sock.c
3254 +@@ -831,6 +831,8 @@ static int hci_sock_release(struct socket *sock)
3255 + if (!sk)
3256 + return 0;
3257 +
3258 ++ lock_sock(sk);
3259 ++
3260 + switch (hci_pi(sk)->channel) {
3261 + case HCI_CHANNEL_MONITOR:
3262 + atomic_dec(&monitor_promisc);
3263 +@@ -878,6 +880,7 @@ static int hci_sock_release(struct socket *sock)
3264 + skb_queue_purge(&sk->sk_receive_queue);
3265 + skb_queue_purge(&sk->sk_write_queue);
3266 +
3267 ++ release_sock(sk);
3268 + sock_put(sk);
3269 + return 0;
3270 + }
3271 +diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
3272 +index 1292f3f0f93f..96b2566c298d 100644
3273 +--- a/net/core/flow_dissector.c
3274 ++++ b/net/core/flow_dissector.c
3275 +@@ -758,10 +758,10 @@ static void __skb_flow_bpf_to_target(const struct bpf_flow_keys *flow_keys,
3276 + struct flow_dissector *flow_dissector,
3277 + void *target_container)
3278 + {
3279 ++ struct flow_dissector_key_ports *key_ports = NULL;
3280 + struct flow_dissector_key_control *key_control;
3281 + struct flow_dissector_key_basic *key_basic;
3282 + struct flow_dissector_key_addrs *key_addrs;
3283 +- struct flow_dissector_key_ports *key_ports;
3284 + struct flow_dissector_key_tags *key_tags;
3285 +
3286 + key_control = skb_flow_dissector_target(flow_dissector,
3287 +@@ -800,10 +800,17 @@ static void __skb_flow_bpf_to_target(const struct bpf_flow_keys *flow_keys,
3288 + key_control->addr_type = FLOW_DISSECTOR_KEY_IPV6_ADDRS;
3289 + }
3290 +
3291 +- if (dissector_uses_key(flow_dissector, FLOW_DISSECTOR_KEY_PORTS)) {
3292 ++ if (dissector_uses_key(flow_dissector, FLOW_DISSECTOR_KEY_PORTS))
3293 + key_ports = skb_flow_dissector_target(flow_dissector,
3294 + FLOW_DISSECTOR_KEY_PORTS,
3295 + target_container);
3296 ++ else if (dissector_uses_key(flow_dissector,
3297 ++ FLOW_DISSECTOR_KEY_PORTS_RANGE))
3298 ++ key_ports = skb_flow_dissector_target(flow_dissector,
3299 ++ FLOW_DISSECTOR_KEY_PORTS_RANGE,
3300 ++ target_container);
3301 ++
3302 ++ if (key_ports) {
3303 + key_ports->src = flow_keys->sport;
3304 + key_ports->dst = flow_keys->dport;
3305 + }
3306 +diff --git a/net/core/utils.c b/net/core/utils.c
3307 +index 6b6e51db9f3b..1f31a39236d5 100644
3308 +--- a/net/core/utils.c
3309 ++++ b/net/core/utils.c
3310 +@@ -438,6 +438,23 @@ void inet_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb,
3311 + }
3312 + EXPORT_SYMBOL(inet_proto_csum_replace4);
3313 +
3314 ++/**
3315 ++ * inet_proto_csum_replace16 - update layer 4 header checksum field
3316 ++ * @sum: Layer 4 header checksum field
3317 ++ * @skb: sk_buff for the packet
3318 ++ * @from: old IPv6 address
3319 ++ * @to: new IPv6 address
3320 ++ * @pseudohdr: True if layer 4 header checksum includes pseudoheader
3321 ++ *
3322 ++ * Update layer 4 header as per the update in IPv6 src/dst address.
3323 ++ *
3324 ++ * There is no need to update skb->csum in this function, because update in two
3325 ++ * fields a.) IPv6 src/dst address and b.) L4 header checksum cancels each other
3326 ++ * for skb->csum calculation. Whereas inet_proto_csum_replace4 function needs to
3327 ++ * update skb->csum, because update in 3 fields a.) IPv4 src/dst address,
3328 ++ * b.) IPv4 Header checksum and c.) L4 header checksum results in same diff as
3329 ++ * L4 Header checksum for skb->csum calculation.
3330 ++ */
3331 + void inet_proto_csum_replace16(__sum16 *sum, struct sk_buff *skb,
3332 + const __be32 *from, const __be32 *to,
3333 + bool pseudohdr)
3334 +@@ -449,9 +466,6 @@ void inet_proto_csum_replace16(__sum16 *sum, struct sk_buff *skb,
3335 + if (skb->ip_summed != CHECKSUM_PARTIAL) {
3336 + *sum = csum_fold(csum_partial(diff, sizeof(diff),
3337 + ~csum_unfold(*sum)));
3338 +- if (skb->ip_summed == CHECKSUM_COMPLETE && pseudohdr)
3339 +- skb->csum = ~csum_partial(diff, sizeof(diff),
3340 +- ~skb->csum);
3341 + } else if (pseudohdr)
3342 + *sum = ~csum_fold(csum_partial(diff, sizeof(diff),
3343 + csum_unfold(*sum)));
3344 +diff --git a/net/ipv4/ip_vti.c b/net/ipv4/ip_vti.c
3345 +index fb9f6d60c27c..79eef5db336a 100644
3346 +--- a/net/ipv4/ip_vti.c
3347 ++++ b/net/ipv4/ip_vti.c
3348 +@@ -187,8 +187,17 @@ static netdev_tx_t vti_xmit(struct sk_buff *skb, struct net_device *dev,
3349 + int mtu;
3350 +
3351 + if (!dst) {
3352 +- dev->stats.tx_carrier_errors++;
3353 +- goto tx_error_icmp;
3354 ++ struct rtable *rt;
3355 ++
3356 ++ fl->u.ip4.flowi4_oif = dev->ifindex;
3357 ++ fl->u.ip4.flowi4_flags |= FLOWI_FLAG_ANYSRC;
3358 ++ rt = __ip_route_output_key(dev_net(dev), &fl->u.ip4);
3359 ++ if (IS_ERR(rt)) {
3360 ++ dev->stats.tx_carrier_errors++;
3361 ++ goto tx_error_icmp;
3362 ++ }
3363 ++ dst = &rt->dst;
3364 ++ skb_dst_set(skb, dst);
3365 + }
3366 +
3367 + dst_hold(dst);
3368 +diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c
3369 +index 6f08b760c2a7..524006aa0d78 100644
3370 +--- a/net/ipv6/ip6_vti.c
3371 ++++ b/net/ipv6/ip6_vti.c
3372 +@@ -449,8 +449,17 @@ vti6_xmit(struct sk_buff *skb, struct net_device *dev, struct flowi *fl)
3373 + int err = -1;
3374 + int mtu;
3375 +
3376 +- if (!dst)
3377 +- goto tx_err_link_failure;
3378 ++ if (!dst) {
3379 ++ fl->u.ip6.flowi6_oif = dev->ifindex;
3380 ++ fl->u.ip6.flowi6_flags |= FLOWI_FLAG_ANYSRC;
3381 ++ dst = ip6_route_output(dev_net(dev), NULL, &fl->u.ip6);
3382 ++ if (dst->error) {
3383 ++ dst_release(dst);
3384 ++ dst = NULL;
3385 ++ goto tx_err_link_failure;
3386 ++ }
3387 ++ skb_dst_set(skb, dst);
3388 ++ }
3389 +
3390 + dst_hold(dst);
3391 + dst = xfrm_lookup(t->net, dst, fl, NULL, 0);
3392 +diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
3393 +index 70739e746c13..0daaf7e37a21 100644
3394 +--- a/net/mac80211/cfg.c
3395 ++++ b/net/mac80211/cfg.c
3396 +@@ -2954,6 +2954,28 @@ static int ieee80211_start_radar_detection(struct wiphy *wiphy,
3397 + return err;
3398 + }
3399 +
3400 ++static void ieee80211_end_cac(struct wiphy *wiphy,
3401 ++ struct net_device *dev)
3402 ++{
3403 ++ struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
3404 ++ struct ieee80211_local *local = sdata->local;
3405 ++
3406 ++ mutex_lock(&local->mtx);
3407 ++ list_for_each_entry(sdata, &local->interfaces, list) {
3408 ++ /* it might be waiting for the local->mtx, but then
3409 ++ * by the time it gets it, sdata->wdev.cac_started
3410 ++ * will no longer be true
3411 ++ */
3412 ++ cancel_delayed_work(&sdata->dfs_cac_timer_work);
3413 ++
3414 ++ if (sdata->wdev.cac_started) {
3415 ++ ieee80211_vif_release_channel(sdata);
3416 ++ sdata->wdev.cac_started = false;
3417 ++ }
3418 ++ }
3419 ++ mutex_unlock(&local->mtx);
3420 ++}
3421 ++
3422 + static struct cfg80211_beacon_data *
3423 + cfg80211_beacon_dup(struct cfg80211_beacon_data *beacon)
3424 + {
3425 +@@ -4023,6 +4045,7 @@ const struct cfg80211_ops mac80211_config_ops = {
3426 + #endif
3427 + .get_channel = ieee80211_cfg_get_channel,
3428 + .start_radar_detection = ieee80211_start_radar_detection,
3429 ++ .end_cac = ieee80211_end_cac,
3430 + .channel_switch = ieee80211_channel_switch,
3431 + .set_qos_map = ieee80211_set_qos_map,
3432 + .set_ap_chanwidth = ieee80211_set_ap_chanwidth,
3433 +diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
3434 +index 68af62306385..d69983370381 100644
3435 +--- a/net/mac80211/mesh_hwmp.c
3436 ++++ b/net/mac80211/mesh_hwmp.c
3437 +@@ -328,6 +328,9 @@ u32 airtime_link_metric_get(struct ieee80211_local *local,
3438 + unsigned long fail_avg =
3439 + ewma_mesh_fail_avg_read(&sta->mesh->fail_avg);
3440 +
3441 ++ if (sta->mesh->plink_state != NL80211_PLINK_ESTAB)
3442 ++ return MAX_METRIC;
3443 ++
3444 + /* Try to get rate based on HW/SW RC algorithm.
3445 + * Rate is returned in units of Kbps, correct this
3446 + * to comply with airtime calculation units
3447 +diff --git a/net/mac80211/tkip.c b/net/mac80211/tkip.c
3448 +index 727dc9f3f3b3..e7f57bb18f6e 100644
3449 +--- a/net/mac80211/tkip.c
3450 ++++ b/net/mac80211/tkip.c
3451 +@@ -263,9 +263,21 @@ int ieee80211_tkip_decrypt_data(struct arc4_ctx *ctx,
3452 + if ((keyid >> 6) != key->conf.keyidx)
3453 + return TKIP_DECRYPT_INVALID_KEYIDX;
3454 +
3455 +- if (rx_ctx->ctx.state != TKIP_STATE_NOT_INIT &&
3456 +- (iv32 < rx_ctx->iv32 ||
3457 +- (iv32 == rx_ctx->iv32 && iv16 <= rx_ctx->iv16)))
3458 ++ /* Reject replays if the received TSC is smaller than or equal to the
3459 ++ * last received value in a valid message, but with an exception for
3460 ++ * the case where a new key has been set and no valid frame using that
3461 ++ * key has yet received and the local RSC was initialized to 0. This
3462 ++ * exception allows the very first frame sent by the transmitter to be
3463 ++ * accepted even if that transmitter were to use TSC 0 (IEEE 802.11
3464 ++ * described TSC to be initialized to 1 whenever a new key is taken into
3465 ++ * use).
3466 ++ */
3467 ++ if (iv32 < rx_ctx->iv32 ||
3468 ++ (iv32 == rx_ctx->iv32 &&
3469 ++ (iv16 < rx_ctx->iv16 ||
3470 ++ (iv16 == rx_ctx->iv16 &&
3471 ++ (rx_ctx->iv32 || rx_ctx->iv16 ||
3472 ++ rx_ctx->ctx.state != TKIP_STATE_NOT_INIT)))))
3473 + return TKIP_DECRYPT_REPLAY;
3474 +
3475 + if (only_iv) {
3476 +diff --git a/net/netfilter/nf_conntrack_proto_sctp.c b/net/netfilter/nf_conntrack_proto_sctp.c
3477 +index 0399ae8f1188..4f897b14b606 100644
3478 +--- a/net/netfilter/nf_conntrack_proto_sctp.c
3479 ++++ b/net/netfilter/nf_conntrack_proto_sctp.c
3480 +@@ -114,7 +114,7 @@ static const u8 sctp_conntracks[2][11][SCTP_CONNTRACK_MAX] = {
3481 + {
3482 + /* ORIGINAL */
3483 + /* sNO, sCL, sCW, sCE, sES, sSS, sSR, sSA, sHS, sHA */
3484 +-/* init */ {sCW, sCW, sCW, sCE, sES, sSS, sSR, sSA, sCW, sHA},
3485 ++/* init */ {sCL, sCL, sCW, sCE, sES, sSS, sSR, sSA, sCW, sHA},
3486 + /* init_ack */ {sCL, sCL, sCW, sCE, sES, sSS, sSR, sSA, sCL, sHA},
3487 + /* abort */ {sCL, sCL, sCL, sCL, sCL, sCL, sCL, sCL, sCL, sCL},
3488 + /* shutdown */ {sCL, sCL, sCW, sCE, sSS, sSS, sSR, sSA, sCL, sSS},
3489 +@@ -130,7 +130,7 @@ static const u8 sctp_conntracks[2][11][SCTP_CONNTRACK_MAX] = {
3490 + /* REPLY */
3491 + /* sNO, sCL, sCW, sCE, sES, sSS, sSR, sSA, sHS, sHA */
3492 + /* init */ {sIV, sCL, sCW, sCE, sES, sSS, sSR, sSA, sIV, sHA},/* INIT in sCL Big TODO */
3493 +-/* init_ack */ {sIV, sCL, sCW, sCE, sES, sSS, sSR, sSA, sIV, sHA},
3494 ++/* init_ack */ {sIV, sCW, sCW, sCE, sES, sSS, sSR, sSA, sIV, sHA},
3495 + /* abort */ {sIV, sCL, sCL, sCL, sCL, sCL, sCL, sCL, sIV, sCL},
3496 + /* shutdown */ {sIV, sCL, sCW, sCE, sSR, sSS, sSR, sSA, sIV, sSR},
3497 + /* shutdown_ack */ {sIV, sCL, sCW, sCE, sES, sSA, sSA, sSA, sIV, sHA},
3498 +@@ -316,7 +316,7 @@ sctp_new(struct nf_conn *ct, const struct sk_buff *skb,
3499 + ct->proto.sctp.vtag[IP_CT_DIR_REPLY] = sh->vtag;
3500 + }
3501 +
3502 +- ct->proto.sctp.state = new_state;
3503 ++ ct->proto.sctp.state = SCTP_CONNTRACK_NONE;
3504 + }
3505 +
3506 + return true;
3507 +diff --git a/net/netfilter/nf_tables_offload.c b/net/netfilter/nf_tables_offload.c
3508 +index 96a64e7594a5..914cd0618d5a 100644
3509 +--- a/net/netfilter/nf_tables_offload.c
3510 ++++ b/net/netfilter/nf_tables_offload.c
3511 +@@ -437,7 +437,7 @@ static void nft_indr_block_cb(struct net_device *dev,
3512 +
3513 + mutex_lock(&net->nft.commit_mutex);
3514 + chain = __nft_offload_get_chain(dev);
3515 +- if (chain) {
3516 ++ if (chain && chain->flags & NFT_CHAIN_HW_OFFLOAD) {
3517 + struct nft_base_chain *basechain;
3518 +
3519 + basechain = nft_base_chain(chain);
3520 +diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h
3521 +index 3dd9515c836b..e0d34f796d0b 100644
3522 +--- a/net/wireless/rdev-ops.h
3523 ++++ b/net/wireless/rdev-ops.h
3524 +@@ -1171,6 +1171,16 @@ rdev_start_radar_detection(struct cfg80211_registered_device *rdev,
3525 + return ret;
3526 + }
3527 +
3528 ++static inline void
3529 ++rdev_end_cac(struct cfg80211_registered_device *rdev,
3530 ++ struct net_device *dev)
3531 ++{
3532 ++ trace_rdev_end_cac(&rdev->wiphy, dev);
3533 ++ if (rdev->ops->end_cac)
3534 ++ rdev->ops->end_cac(&rdev->wiphy, dev);
3535 ++ trace_rdev_return_void(&rdev->wiphy);
3536 ++}
3537 ++
3538 + static inline int
3539 + rdev_set_mcast_rate(struct cfg80211_registered_device *rdev,
3540 + struct net_device *dev,
3541 +diff --git a/net/wireless/reg.c b/net/wireless/reg.c
3542 +index 446c76d44e65..fff9a74891fc 100644
3543 +--- a/net/wireless/reg.c
3544 ++++ b/net/wireless/reg.c
3545 +@@ -2261,14 +2261,15 @@ static void update_all_wiphy_regulatory(enum nl80211_reg_initiator initiator)
3546 +
3547 + static void handle_channel_custom(struct wiphy *wiphy,
3548 + struct ieee80211_channel *chan,
3549 +- const struct ieee80211_regdomain *regd)
3550 ++ const struct ieee80211_regdomain *regd,
3551 ++ u32 min_bw)
3552 + {
3553 + u32 bw_flags = 0;
3554 + const struct ieee80211_reg_rule *reg_rule = NULL;
3555 + const struct ieee80211_power_rule *power_rule = NULL;
3556 + u32 bw;
3557 +
3558 +- for (bw = MHZ_TO_KHZ(20); bw >= MHZ_TO_KHZ(5); bw = bw / 2) {
3559 ++ for (bw = MHZ_TO_KHZ(20); bw >= min_bw; bw = bw / 2) {
3560 + reg_rule = freq_reg_info_regd(MHZ_TO_KHZ(chan->center_freq),
3561 + regd, bw);
3562 + if (!IS_ERR(reg_rule))
3563 +@@ -2324,8 +2325,14 @@ static void handle_band_custom(struct wiphy *wiphy,
3564 + if (!sband)
3565 + return;
3566 +
3567 ++ /*
3568 ++ * We currently assume that you always want at least 20 MHz,
3569 ++ * otherwise channel 12 might get enabled if this rule is
3570 ++ * compatible to US, which permits 2402 - 2472 MHz.
3571 ++ */
3572 + for (i = 0; i < sband->n_channels; i++)
3573 +- handle_channel_custom(wiphy, &sband->channels[i], regd);
3574 ++ handle_channel_custom(wiphy, &sband->channels[i], regd,
3575 ++ MHZ_TO_KHZ(20));
3576 + }
3577 +
3578 + /* Used by drivers prior to wiphy registration */
3579 +@@ -3885,6 +3892,25 @@ bool regulatory_pre_cac_allowed(struct wiphy *wiphy)
3580 + }
3581 + EXPORT_SYMBOL(regulatory_pre_cac_allowed);
3582 +
3583 ++static void cfg80211_check_and_end_cac(struct cfg80211_registered_device *rdev)
3584 ++{
3585 ++ struct wireless_dev *wdev;
3586 ++ /* If we finished CAC or received radar, we should end any
3587 ++ * CAC running on the same channels.
3588 ++ * the check !cfg80211_chandef_dfs_usable contain 2 options:
3589 ++ * either all channels are available - those the CAC_FINISHED
3590 ++ * event has effected another wdev state, or there is a channel
3591 ++ * in unavailable state in wdev chandef - those the RADAR_DETECTED
3592 ++ * event has effected another wdev state.
3593 ++ * In both cases we should end the CAC on the wdev.
3594 ++ */
3595 ++ list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) {
3596 ++ if (wdev->cac_started &&
3597 ++ !cfg80211_chandef_dfs_usable(&rdev->wiphy, &wdev->chandef))
3598 ++ rdev_end_cac(rdev, wdev->netdev);
3599 ++ }
3600 ++}
3601 ++
3602 + void regulatory_propagate_dfs_state(struct wiphy *wiphy,
3603 + struct cfg80211_chan_def *chandef,
3604 + enum nl80211_dfs_state dfs_state,
3605 +@@ -3911,8 +3937,10 @@ void regulatory_propagate_dfs_state(struct wiphy *wiphy,
3606 + cfg80211_set_dfs_state(&rdev->wiphy, chandef, dfs_state);
3607 +
3608 + if (event == NL80211_RADAR_DETECTED ||
3609 +- event == NL80211_RADAR_CAC_FINISHED)
3610 ++ event == NL80211_RADAR_CAC_FINISHED) {
3611 + cfg80211_sched_dfs_chan_update(rdev);
3612 ++ cfg80211_check_and_end_cac(rdev);
3613 ++ }
3614 +
3615 + nl80211_radar_notify(rdev, chandef, event, NULL, GFP_KERNEL);
3616 + }
3617 +diff --git a/net/wireless/trace.h b/net/wireless/trace.h
3618 +index d98ad2b3143b..8677d7ab7d69 100644
3619 +--- a/net/wireless/trace.h
3620 ++++ b/net/wireless/trace.h
3621 +@@ -646,6 +646,11 @@ DEFINE_EVENT(wiphy_netdev_evt, rdev_flush_pmksa,
3622 + TP_ARGS(wiphy, netdev)
3623 + );
3624 +
3625 ++DEFINE_EVENT(wiphy_netdev_evt, rdev_end_cac,
3626 ++ TP_PROTO(struct wiphy *wiphy, struct net_device *netdev),
3627 ++ TP_ARGS(wiphy, netdev)
3628 ++);
3629 ++
3630 + DECLARE_EVENT_CLASS(station_add_change,
3631 + TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, u8 *mac,
3632 + struct station_parameters *params),
3633 +diff --git a/net/wireless/wext-core.c b/net/wireless/wext-core.c
3634 +index 5e677dac2a0c..69102fda9ebd 100644
3635 +--- a/net/wireless/wext-core.c
3636 ++++ b/net/wireless/wext-core.c
3637 +@@ -657,7 +657,8 @@ struct iw_statistics *get_wireless_stats(struct net_device *dev)
3638 + return NULL;
3639 + }
3640 +
3641 +-static int iw_handler_get_iwstats(struct net_device * dev,
3642 ++/* noinline to avoid a bogus warning with -O3 */
3643 ++static noinline int iw_handler_get_iwstats(struct net_device * dev,
3644 + struct iw_request_info * info,
3645 + union iwreq_data * wrqu,
3646 + char * extra)
3647 +diff --git a/net/xfrm/xfrm_interface.c b/net/xfrm/xfrm_interface.c
3648 +index 0f5131bc3342..4d5627e274fe 100644
3649 +--- a/net/xfrm/xfrm_interface.c
3650 ++++ b/net/xfrm/xfrm_interface.c
3651 +@@ -268,9 +268,6 @@ xfrmi_xmit2(struct sk_buff *skb, struct net_device *dev, struct flowi *fl)
3652 + int err = -1;
3653 + int mtu;
3654 +
3655 +- if (!dst)
3656 +- goto tx_err_link_failure;
3657 +-
3658 + dst_hold(dst);
3659 + dst = xfrm_lookup_with_ifid(xi->net, dst, fl, NULL, 0, xi->p.if_id);
3660 + if (IS_ERR(dst)) {
3661 +@@ -297,7 +294,7 @@ xfrmi_xmit2(struct sk_buff *skb, struct net_device *dev, struct flowi *fl)
3662 +
3663 + mtu = dst_mtu(dst);
3664 + if (!skb->ignore_df && skb->len > mtu) {
3665 +- skb_dst_update_pmtu(skb, mtu);
3666 ++ skb_dst_update_pmtu_no_confirm(skb, mtu);
3667 +
3668 + if (skb->protocol == htons(ETH_P_IPV6)) {
3669 + if (mtu < IPV6_MIN_MTU)
3670 +@@ -343,6 +340,7 @@ static netdev_tx_t xfrmi_xmit(struct sk_buff *skb, struct net_device *dev)
3671 + {
3672 + struct xfrm_if *xi = netdev_priv(dev);
3673 + struct net_device_stats *stats = &xi->dev->stats;
3674 ++ struct dst_entry *dst = skb_dst(skb);
3675 + struct flowi fl;
3676 + int ret;
3677 +
3678 +@@ -352,10 +350,33 @@ static netdev_tx_t xfrmi_xmit(struct sk_buff *skb, struct net_device *dev)
3679 + case htons(ETH_P_IPV6):
3680 + xfrm_decode_session(skb, &fl, AF_INET6);
3681 + memset(IP6CB(skb), 0, sizeof(*IP6CB(skb)));
3682 ++ if (!dst) {
3683 ++ fl.u.ip6.flowi6_oif = dev->ifindex;
3684 ++ fl.u.ip6.flowi6_flags |= FLOWI_FLAG_ANYSRC;
3685 ++ dst = ip6_route_output(dev_net(dev), NULL, &fl.u.ip6);
3686 ++ if (dst->error) {
3687 ++ dst_release(dst);
3688 ++ stats->tx_carrier_errors++;
3689 ++ goto tx_err;
3690 ++ }
3691 ++ skb_dst_set(skb, dst);
3692 ++ }
3693 + break;
3694 + case htons(ETH_P_IP):
3695 + xfrm_decode_session(skb, &fl, AF_INET);
3696 + memset(IPCB(skb), 0, sizeof(*IPCB(skb)));
3697 ++ if (!dst) {
3698 ++ struct rtable *rt;
3699 ++
3700 ++ fl.u.ip4.flowi4_oif = dev->ifindex;
3701 ++ fl.u.ip4.flowi4_flags |= FLOWI_FLAG_ANYSRC;
3702 ++ rt = __ip_route_output_key(dev_net(dev), &fl.u.ip4);
3703 ++ if (IS_ERR(rt)) {
3704 ++ stats->tx_carrier_errors++;
3705 ++ goto tx_err;
3706 ++ }
3707 ++ skb_dst_set(skb, &rt->dst);
3708 ++ }
3709 + break;
3710 + default:
3711 + goto tx_err;
3712 +@@ -563,12 +584,9 @@ static void xfrmi_dev_setup(struct net_device *dev)
3713 + {
3714 + dev->netdev_ops = &xfrmi_netdev_ops;
3715 + dev->type = ARPHRD_NONE;
3716 +- dev->hard_header_len = ETH_HLEN;
3717 +- dev->min_header_len = ETH_HLEN;
3718 + dev->mtu = ETH_DATA_LEN;
3719 + dev->min_mtu = ETH_MIN_MTU;
3720 +- dev->max_mtu = ETH_DATA_LEN;
3721 +- dev->addr_len = ETH_ALEN;
3722 ++ dev->max_mtu = IP_MAX_MTU;
3723 + dev->flags = IFF_NOARP;
3724 + dev->needs_free_netdev = true;
3725 + dev->priv_destructor = xfrmi_dev_free;
3726 +diff --git a/security/tomoyo/common.c b/security/tomoyo/common.c
3727 +index c36bafbcd77e..1b467381986f 100644
3728 +--- a/security/tomoyo/common.c
3729 ++++ b/security/tomoyo/common.c
3730 +@@ -2322,9 +2322,9 @@ static const char * const tomoyo_memory_headers[TOMOYO_MAX_MEMORY_STAT] = {
3731 + [TOMOYO_MEMORY_QUERY] = "query message:",
3732 + };
3733 +
3734 +-/* Timestamp counter for last updated. */
3735 +-static unsigned int tomoyo_stat_updated[TOMOYO_MAX_POLICY_STAT];
3736 + /* Counter for number of updates. */
3737 ++static atomic_t tomoyo_stat_updated[TOMOYO_MAX_POLICY_STAT];
3738 ++/* Timestamp counter for last updated. */
3739 + static time64_t tomoyo_stat_modified[TOMOYO_MAX_POLICY_STAT];
3740 +
3741 + /**
3742 +@@ -2336,10 +2336,7 @@ static time64_t tomoyo_stat_modified[TOMOYO_MAX_POLICY_STAT];
3743 + */
3744 + void tomoyo_update_stat(const u8 index)
3745 + {
3746 +- /*
3747 +- * I don't use atomic operations because race condition is not fatal.
3748 +- */
3749 +- tomoyo_stat_updated[index]++;
3750 ++ atomic_inc(&tomoyo_stat_updated[index]);
3751 + tomoyo_stat_modified[index] = ktime_get_real_seconds();
3752 + }
3753 +
3754 +@@ -2360,7 +2357,7 @@ static void tomoyo_read_stat(struct tomoyo_io_buffer *head)
3755 + for (i = 0; i < TOMOYO_MAX_POLICY_STAT; i++) {
3756 + tomoyo_io_printf(head, "Policy %-30s %10u",
3757 + tomoyo_policy_headers[i],
3758 +- tomoyo_stat_updated[i]);
3759 ++ atomic_read(&tomoyo_stat_updated[i]));
3760 + if (tomoyo_stat_modified[i]) {
3761 + struct tomoyo_time stamp;
3762 +
3763 +diff --git a/sound/soc/codecs/hdac_hda.c b/sound/soc/codecs/hdac_hda.c
3764 +index 4570f662fb48..d78f4d856aaf 100644
3765 +--- a/sound/soc/codecs/hdac_hda.c
3766 ++++ b/sound/soc/codecs/hdac_hda.c
3767 +@@ -498,7 +498,9 @@ static int hdac_hda_dev_remove(struct hdac_device *hdev)
3768 + struct hdac_hda_priv *hda_pvt;
3769 +
3770 + hda_pvt = dev_get_drvdata(&hdev->dev);
3771 +- cancel_delayed_work_sync(&hda_pvt->codec.jackpoll_work);
3772 ++ if (hda_pvt && hda_pvt->codec.registered)
3773 ++ cancel_delayed_work_sync(&hda_pvt->codec.jackpoll_work);
3774 ++
3775 + return 0;
3776 + }
3777 +
3778 +diff --git a/sound/soc/codecs/rt5640.c b/sound/soc/codecs/rt5640.c
3779 +index adbae1f36a8a..747ca248bf10 100644
3780 +--- a/sound/soc/codecs/rt5640.c
3781 ++++ b/sound/soc/codecs/rt5640.c
3782 +@@ -2432,6 +2432,13 @@ static void rt5640_disable_jack_detect(struct snd_soc_component *component)
3783 + {
3784 + struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component);
3785 +
3786 ++ /*
3787 ++ * soc_remove_component() force-disables jack and thus rt5640->jack
3788 ++ * could be NULL at the time of driver's module unloading.
3789 ++ */
3790 ++ if (!rt5640->jack)
3791 ++ return;
3792 ++
3793 + disable_irq(rt5640->irq);
3794 + rt5640_cancel_work(rt5640);
3795 +
3796 +diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
3797 +index 7ccbca47240d..fef01e1dd15c 100644
3798 +--- a/sound/soc/soc-topology.c
3799 ++++ b/sound/soc/soc-topology.c
3800 +@@ -1891,6 +1891,10 @@ static int soc_tplg_fe_link_create(struct soc_tplg *tplg,
3801 + link->num_codecs = 1;
3802 + link->num_platforms = 1;
3803 +
3804 ++ link->dobj.index = tplg->index;
3805 ++ link->dobj.ops = tplg->ops;
3806 ++ link->dobj.type = SND_SOC_DOBJ_DAI_LINK;
3807 ++
3808 + if (strlen(pcm->pcm_name)) {
3809 + link->name = kstrdup(pcm->pcm_name, GFP_KERNEL);
3810 + link->stream_name = kstrdup(pcm->pcm_name, GFP_KERNEL);
3811 +@@ -1927,9 +1931,6 @@ static int soc_tplg_fe_link_create(struct soc_tplg *tplg,
3812 + goto err;
3813 + }
3814 +
3815 +- link->dobj.index = tplg->index;
3816 +- link->dobj.ops = tplg->ops;
3817 +- link->dobj.type = SND_SOC_DOBJ_DAI_LINK;
3818 + list_add(&link->dobj.list, &tplg->comp->dobj_list);
3819 +
3820 + return 0;
3821 +diff --git a/sound/soc/sof/intel/hda-codec.c b/sound/soc/sof/intel/hda-codec.c
3822 +index 3ca6795a89ba..9e8233c10d86 100644
3823 +--- a/sound/soc/sof/intel/hda-codec.c
3824 ++++ b/sound/soc/sof/intel/hda-codec.c
3825 +@@ -24,19 +24,18 @@
3826 + #define IDISP_VID_INTEL 0x80860000
3827 +
3828 + /* load the legacy HDA codec driver */
3829 +-#ifdef MODULE
3830 +-static void hda_codec_load_module(struct hda_codec *codec)
3831 ++static int hda_codec_load_module(struct hda_codec *codec)
3832 + {
3833 ++#ifdef MODULE
3834 + char alias[MODULE_NAME_LEN];
3835 + const char *module = alias;
3836 +
3837 + snd_hdac_codec_modalias(&codec->core, alias, sizeof(alias));
3838 + dev_dbg(&codec->core.dev, "loading codec module: %s\n", module);
3839 + request_module(module);
3840 +-}
3841 +-#else
3842 +-static void hda_codec_load_module(struct hda_codec *codec) {}
3843 + #endif
3844 ++ return device_attach(hda_codec_dev(codec));
3845 ++}
3846 +
3847 + /* enable controller wake up event for all codecs with jack connectors */
3848 + void hda_codec_jack_wake_enable(struct snd_sof_dev *sdev)
3849 +@@ -116,10 +115,16 @@ static int hda_codec_probe(struct snd_sof_dev *sdev, int address)
3850 + /* use legacy bus only for HDA codecs, idisp uses ext bus */
3851 + if ((resp & 0xFFFF0000) != IDISP_VID_INTEL) {
3852 + hdev->type = HDA_DEV_LEGACY;
3853 +- hda_codec_load_module(&hda_priv->codec);
3854 ++ ret = hda_codec_load_module(&hda_priv->codec);
3855 ++ /*
3856 ++ * handle ret==0 (no driver bound) as an error, but pass
3857 ++ * other return codes without modification
3858 ++ */
3859 ++ if (ret == 0)
3860 ++ ret = -ENOENT;
3861 + }
3862 +
3863 +- return 0;
3864 ++ return ret;
3865 + #else
3866 + hdev = devm_kzalloc(sdev->dev, sizeof(*hdev), GFP_KERNEL);
3867 + if (!hdev)
3868 +diff --git a/sound/soc/sti/uniperif_player.c b/sound/soc/sti/uniperif_player.c
3869 +index 48ea915b24ba..2ed92c990b97 100644
3870 +--- a/sound/soc/sti/uniperif_player.c
3871 ++++ b/sound/soc/sti/uniperif_player.c
3872 +@@ -226,7 +226,6 @@ static void uni_player_set_channel_status(struct uniperif *player,
3873 + * sampling frequency. If no sample rate is already specified, then
3874 + * set one.
3875 + */
3876 +- mutex_lock(&player->ctrl_lock);
3877 + if (runtime) {
3878 + switch (runtime->rate) {
3879 + case 22050:
3880 +@@ -303,7 +302,6 @@ static void uni_player_set_channel_status(struct uniperif *player,
3881 + player->stream_settings.iec958.status[3 + (n * 4)] << 24;
3882 + SET_UNIPERIF_CHANNEL_STA_REGN(player, n, status);
3883 + }
3884 +- mutex_unlock(&player->ctrl_lock);
3885 +
3886 + /* Update the channel status */
3887 + if (player->ver < SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0)
3888 +@@ -365,8 +363,10 @@ static int uni_player_prepare_iec958(struct uniperif *player,
3889 +
3890 + SET_UNIPERIF_CTRL_ZERO_STUFF_HW(player);
3891 +
3892 ++ mutex_lock(&player->ctrl_lock);
3893 + /* Update the channel status */
3894 + uni_player_set_channel_status(player, runtime);
3895 ++ mutex_unlock(&player->ctrl_lock);
3896 +
3897 + /* Clear the user validity user bits */
3898 + SET_UNIPERIF_USER_VALIDITY_VALIDITY_LR(player, 0);
3899 +@@ -598,7 +598,6 @@ static int uni_player_ctl_iec958_put(struct snd_kcontrol *kcontrol,
3900 + iec958->status[1] = ucontrol->value.iec958.status[1];
3901 + iec958->status[2] = ucontrol->value.iec958.status[2];
3902 + iec958->status[3] = ucontrol->value.iec958.status[3];
3903 +- mutex_unlock(&player->ctrl_lock);
3904 +
3905 + spin_lock_irqsave(&player->irq_lock, flags);
3906 + if (player->substream && player->substream->runtime)
3907 +@@ -608,6 +607,8 @@ static int uni_player_ctl_iec958_put(struct snd_kcontrol *kcontrol,
3908 + uni_player_set_channel_status(player, NULL);
3909 +
3910 + spin_unlock_irqrestore(&player->irq_lock, flags);
3911 ++ mutex_unlock(&player->ctrl_lock);
3912 ++
3913 + return 0;
3914 + }
3915 +
3916 +diff --git a/tools/include/linux/string.h b/tools/include/linux/string.h
3917 +index 980cb9266718..5e9e781905ed 100644
3918 +--- a/tools/include/linux/string.h
3919 ++++ b/tools/include/linux/string.h
3920 +@@ -17,7 +17,15 @@ int strtobool(const char *s, bool *res);
3921 + * However uClibc headers also define __GLIBC__ hence the hack below
3922 + */
3923 + #if defined(__GLIBC__) && !defined(__UCLIBC__)
3924 ++// pragma diagnostic was introduced in gcc 4.6
3925 ++#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
3926 ++#pragma GCC diagnostic push
3927 ++#pragma GCC diagnostic ignored "-Wredundant-decls"
3928 ++#endif
3929 + extern size_t strlcpy(char *dest, const char *src, size_t size);
3930 ++#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
3931 ++#pragma GCC diagnostic pop
3932 ++#endif
3933 + #endif
3934 +
3935 + char *str_error_r(int errnum, char *buf, size_t buflen);
3936 +diff --git a/tools/lib/string.c b/tools/lib/string.c
3937 +index f2ae1b87c719..f645343815de 100644
3938 +--- a/tools/lib/string.c
3939 ++++ b/tools/lib/string.c
3940 +@@ -96,6 +96,10 @@ int strtobool(const char *s, bool *res)
3941 + * If libc has strlcpy() then that version will override this
3942 + * implementation:
3943 + */
3944 ++#ifdef __clang__
3945 ++#pragma clang diagnostic push
3946 ++#pragma clang diagnostic ignored "-Wignored-attributes"
3947 ++#endif
3948 + size_t __weak strlcpy(char *dest, const char *src, size_t size)
3949 + {
3950 + size_t ret = strlen(src);
3951 +@@ -107,6 +111,9 @@ size_t __weak strlcpy(char *dest, const char *src, size_t size)
3952 + }
3953 + return ret;
3954 + }
3955 ++#ifdef __clang__
3956 ++#pragma clang diagnostic pop
3957 ++#endif
3958 +
3959 + /**
3960 + * skip_spaces - Removes leading whitespace from @str.
3961 +diff --git a/tools/lib/traceevent/parse-filter.c b/tools/lib/traceevent/parse-filter.c
3962 +index f3cbf86e51ac..20eed719542e 100644
3963 +--- a/tools/lib/traceevent/parse-filter.c
3964 ++++ b/tools/lib/traceevent/parse-filter.c
3965 +@@ -1228,8 +1228,10 @@ filter_event(struct tep_event_filter *filter, struct tep_event *event,
3966 + }
3967 +
3968 + filter_type = add_filter_type(filter, event->id);
3969 +- if (filter_type == NULL)
3970 ++ if (filter_type == NULL) {
3971 ++ free_arg(arg);
3972 + return TEP_ERRNO__MEM_ALLOC_FAILED;
3973 ++ }
3974 +
3975 + if (filter_type->filter)
3976 + free_arg(filter_type->filter);
3977 +diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c
3978 +index e69f44941aad..f2e9d2b1b913 100644
3979 +--- a/tools/perf/builtin-c2c.c
3980 ++++ b/tools/perf/builtin-c2c.c
3981 +@@ -595,8 +595,8 @@ tot_hitm_cmp(struct perf_hpp_fmt *fmt __maybe_unused,
3982 + {
3983 + struct c2c_hist_entry *c2c_left;
3984 + struct c2c_hist_entry *c2c_right;
3985 +- unsigned int tot_hitm_left;
3986 +- unsigned int tot_hitm_right;
3987 ++ uint64_t tot_hitm_left;
3988 ++ uint64_t tot_hitm_right;
3989 +
3990 + c2c_left = container_of(left, struct c2c_hist_entry, he);
3991 + c2c_right = container_of(right, struct c2c_hist_entry, he);
3992 +@@ -629,7 +629,8 @@ __f ## _cmp(struct perf_hpp_fmt *fmt __maybe_unused, \
3993 + \
3994 + c2c_left = container_of(left, struct c2c_hist_entry, he); \
3995 + c2c_right = container_of(right, struct c2c_hist_entry, he); \
3996 +- return c2c_left->stats.__f - c2c_right->stats.__f; \
3997 ++ return (uint64_t) c2c_left->stats.__f - \
3998 ++ (uint64_t) c2c_right->stats.__f; \
3999 + }
4000 +
4001 + #define STAT_FN(__f) \
4002 +@@ -682,7 +683,8 @@ ld_llcmiss_cmp(struct perf_hpp_fmt *fmt __maybe_unused,
4003 + c2c_left = container_of(left, struct c2c_hist_entry, he);
4004 + c2c_right = container_of(right, struct c2c_hist_entry, he);
4005 +
4006 +- return llc_miss(&c2c_left->stats) - llc_miss(&c2c_right->stats);
4007 ++ return (uint64_t) llc_miss(&c2c_left->stats) -
4008 ++ (uint64_t) llc_miss(&c2c_right->stats);
4009 + }
4010 +
4011 + static uint64_t total_records(struct c2c_stats *stats)
4012 +diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
4013 +index ea3f0745d7ad..6407dff405d9 100644
4014 +--- a/tools/perf/builtin-report.c
4015 ++++ b/tools/perf/builtin-report.c
4016 +@@ -399,10 +399,10 @@ static int report__setup_sample_type(struct report *rep)
4017 + PERF_SAMPLE_BRANCH_ANY))
4018 + rep->nonany_branch_mode = true;
4019 +
4020 +-#ifndef HAVE_LIBUNWIND_SUPPORT
4021 ++#if !defined(HAVE_LIBUNWIND_SUPPORT) && !defined(HAVE_DWARF_SUPPORT)
4022 + if (dwarf_callchain_users) {
4023 +- ui__warning("Please install libunwind development packages "
4024 +- "during the perf build.\n");
4025 ++ ui__warning("Please install libunwind or libdw "
4026 ++ "development packages during the perf build.\n");
4027 + }
4028 + #endif
4029 +