Magellan Linux

Annotation of /trunk/kernel-alx/patches-5.4/0117-5.4.18-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


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