1 |
commit: 6fac29ab3b07663ad8abad37e43b857ad95a2261 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Jan 27 14:25:03 2020 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Jan 27 14:25:03 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=6fac29ab |
7 |
|
8 |
Linux patch 4.19.99 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1098_linux-4.19.99.patch | 20747 +++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 20751 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index b2dcc20..cae3438 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -431,6 +431,10 @@ Patch: 1097_linux-4.19.98.patch |
21 |
From: https://www.kernel.org |
22 |
Desc: Linux 4.19.98 |
23 |
|
24 |
+Patch: 1098_linux-4.19.99.patch |
25 |
+From: https://www.kernel.org |
26 |
+Desc: Linux 4.19.99 |
27 |
+ |
28 |
Patch: 1500_XATTR_USER_PREFIX.patch |
29 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
30 |
Desc: Support for namespace user.pax.* on tmpfs. |
31 |
|
32 |
diff --git a/1098_linux-4.19.99.patch b/1098_linux-4.19.99.patch |
33 |
new file mode 100644 |
34 |
index 0000000..4c7a117 |
35 |
--- /dev/null |
36 |
+++ b/1098_linux-4.19.99.patch |
37 |
@@ -0,0 +1,20747 @@ |
38 |
+diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio |
39 |
+index a5b4f223641d..8127a08e366d 100644 |
40 |
+--- a/Documentation/ABI/testing/sysfs-bus-iio |
41 |
++++ b/Documentation/ABI/testing/sysfs-bus-iio |
42 |
+@@ -199,7 +199,7 @@ Description: |
43 |
+ |
44 |
+ What: /sys/bus/iio/devices/iio:deviceX/in_positionrelative_x_raw |
45 |
+ What: /sys/bus/iio/devices/iio:deviceX/in_positionrelative_y_raw |
46 |
+-KernelVersion: 4.18 |
47 |
++KernelVersion: 4.19 |
48 |
+ Contact: linux-iio@×××××××××××.org |
49 |
+ Description: |
50 |
+ Relative position in direction x or y on a pad (may be |
51 |
+diff --git a/Documentation/devicetree/bindings/bus/ti-sysc.txt b/Documentation/devicetree/bindings/bus/ti-sysc.txt |
52 |
+index 91dc2333af01..85a23f551f02 100644 |
53 |
+--- a/Documentation/devicetree/bindings/bus/ti-sysc.txt |
54 |
++++ b/Documentation/devicetree/bindings/bus/ti-sysc.txt |
55 |
+@@ -35,6 +35,7 @@ Required standard properties: |
56 |
+ "ti,sysc-omap3-sham" |
57 |
+ "ti,sysc-omap-aes" |
58 |
+ "ti,sysc-mcasp" |
59 |
++ "ti,sysc-dra7-mcasp" |
60 |
+ "ti,sysc-usb-host-fs" |
61 |
+ "ti,sysc-dra7-mcan" |
62 |
+ |
63 |
+diff --git a/Documentation/devicetree/bindings/rng/omap3_rom_rng.txt b/Documentation/devicetree/bindings/rng/omap3_rom_rng.txt |
64 |
+new file mode 100644 |
65 |
+index 000000000000..f315c9723bd2 |
66 |
+--- /dev/null |
67 |
++++ b/Documentation/devicetree/bindings/rng/omap3_rom_rng.txt |
68 |
+@@ -0,0 +1,27 @@ |
69 |
++OMAP ROM RNG driver binding |
70 |
++ |
71 |
++Secure SoCs may provide RNG via secure ROM calls like Nokia N900 does. The |
72 |
++implementation can depend on the SoC secure ROM used. |
73 |
++ |
74 |
++- compatible: |
75 |
++ Usage: required |
76 |
++ Value type: <string> |
77 |
++ Definition: must be "nokia,n900-rom-rng" |
78 |
++ |
79 |
++- clocks: |
80 |
++ Usage: required |
81 |
++ Value type: <prop-encoded-array> |
82 |
++ Definition: reference to the the RNG interface clock |
83 |
++ |
84 |
++- clock-names: |
85 |
++ Usage: required |
86 |
++ Value type: <stringlist> |
87 |
++ Definition: must be "ick" |
88 |
++ |
89 |
++Example: |
90 |
++ |
91 |
++ rom_rng: rng { |
92 |
++ compatible = "nokia,n900-rom-rng"; |
93 |
++ clocks = <&rng_ick>; |
94 |
++ clock-names = "ick"; |
95 |
++ }; |
96 |
+diff --git a/Makefile b/Makefile |
97 |
+index 48dbafb790ff..a2be0c79eeb8 100644 |
98 |
+--- a/Makefile |
99 |
++++ b/Makefile |
100 |
+@@ -1,7 +1,7 @@ |
101 |
+ # SPDX-License-Identifier: GPL-2.0 |
102 |
+ VERSION = 4 |
103 |
+ PATCHLEVEL = 19 |
104 |
+-SUBLEVEL = 98 |
105 |
++SUBLEVEL = 99 |
106 |
+ EXTRAVERSION = |
107 |
+ NAME = "People's Front" |
108 |
+ |
109 |
+@@ -964,6 +964,7 @@ ifdef CONFIG_STACK_VALIDATION |
110 |
+ endif |
111 |
+ endif |
112 |
+ |
113 |
++PHONY += prepare0 |
114 |
+ |
115 |
+ ifeq ($(KBUILD_EXTMOD),) |
116 |
+ core-y += kernel/ certs/ mm/ fs/ ipc/ security/ crypto/ block/ |
117 |
+@@ -1072,8 +1073,7 @@ scripts: scripts_basic asm-generic gcc-plugins $(autoksyms_h) |
118 |
+ # archprepare is used in arch Makefiles and when processed asm symlink, |
119 |
+ # version.h and scripts_basic is processed / created. |
120 |
+ |
121 |
+-# Listed in dependency order |
122 |
+-PHONY += prepare archprepare prepare0 prepare1 prepare2 prepare3 |
123 |
++PHONY += prepare archprepare prepare1 prepare2 prepare3 |
124 |
+ |
125 |
+ # prepare3 is used to check if we are building in a separate output directory, |
126 |
+ # and if so do: |
127 |
+diff --git a/arch/arm/boot/dts/aspeed-g5.dtsi b/arch/arm/boot/dts/aspeed-g5.dtsi |
128 |
+index d107459fc0f8..f2e1015d75ab 100644 |
129 |
+--- a/arch/arm/boot/dts/aspeed-g5.dtsi |
130 |
++++ b/arch/arm/boot/dts/aspeed-g5.dtsi |
131 |
+@@ -247,7 +247,7 @@ |
132 |
+ compatible = "aspeed,ast2500-gpio"; |
133 |
+ reg = <0x1e780000 0x1000>; |
134 |
+ interrupts = <20>; |
135 |
+- gpio-ranges = <&pinctrl 0 0 220>; |
136 |
++ gpio-ranges = <&pinctrl 0 0 232>; |
137 |
+ clocks = <&syscon ASPEED_CLK_APB>; |
138 |
+ interrupt-controller; |
139 |
+ }; |
140 |
+diff --git a/arch/arm/boot/dts/at91-nattis-2-natte-2.dts b/arch/arm/boot/dts/at91-nattis-2-natte-2.dts |
141 |
+index af9f38456d04..4308a07b792e 100644 |
142 |
+--- a/arch/arm/boot/dts/at91-nattis-2-natte-2.dts |
143 |
++++ b/arch/arm/boot/dts/at91-nattis-2-natte-2.dts |
144 |
+@@ -38,14 +38,16 @@ |
145 |
+ atmel,pins = |
146 |
+ <AT91_PIOA 21 |
147 |
+ AT91_PERIPH_GPIO |
148 |
+- AT91_PINCTRL_OUTPUT_VAL(0)>; |
149 |
++ (AT91_PINCTRL_OUTPUT | |
150 |
++ AT91_PINCTRL_OUTPUT_VAL(0))>; |
151 |
+ }; |
152 |
+ |
153 |
+ pinctrl_lcd_hipow0: lcd_hipow0 { |
154 |
+ atmel,pins = |
155 |
+ <AT91_PIOA 23 |
156 |
+ AT91_PERIPH_GPIO |
157 |
+- AT91_PINCTRL_OUTPUT_VAL(0)>; |
158 |
++ (AT91_PINCTRL_OUTPUT | |
159 |
++ AT91_PINCTRL_OUTPUT_VAL(0))>; |
160 |
+ }; |
161 |
+ }; |
162 |
+ }; |
163 |
+@@ -219,6 +221,7 @@ |
164 |
+ reg = <0>; |
165 |
+ bus-width = <4>; |
166 |
+ cd-gpios = <&pioD 5 GPIO_ACTIVE_HIGH>; |
167 |
++ cd-inverted; |
168 |
+ }; |
169 |
+ }; |
170 |
+ |
171 |
+diff --git a/arch/arm/boot/dts/bcm2835-rpi.dtsi b/arch/arm/boot/dts/bcm2835-rpi.dtsi |
172 |
+index cb2d6d78a7fb..c481eab1bd7c 100644 |
173 |
+--- a/arch/arm/boot/dts/bcm2835-rpi.dtsi |
174 |
++++ b/arch/arm/boot/dts/bcm2835-rpi.dtsi |
175 |
+@@ -32,7 +32,7 @@ |
176 |
+ |
177 |
+ mailbox@7e00b840 { |
178 |
+ compatible = "brcm,bcm2835-vchiq"; |
179 |
+- reg = <0x7e00b840 0xf>; |
180 |
++ reg = <0x7e00b840 0x3c>; |
181 |
+ interrupts = <0 2>; |
182 |
+ }; |
183 |
+ }; |
184 |
+diff --git a/arch/arm/boot/dts/iwg20d-q7-common.dtsi b/arch/arm/boot/dts/iwg20d-q7-common.dtsi |
185 |
+index 5cae74eb6cdd..a2c9a1e88c1a 100644 |
186 |
+--- a/arch/arm/boot/dts/iwg20d-q7-common.dtsi |
187 |
++++ b/arch/arm/boot/dts/iwg20d-q7-common.dtsi |
188 |
+@@ -87,7 +87,7 @@ |
189 |
+ regulator-min-microvolt = <1800000>; |
190 |
+ regulator-max-microvolt = <3300000>; |
191 |
+ |
192 |
+- gpios = <&gpio2 30 GPIO_ACTIVE_LOW>; |
193 |
++ gpios = <&gpio2 30 GPIO_ACTIVE_HIGH>; |
194 |
+ gpios-states = <1>; |
195 |
+ states = <3300000 1 |
196 |
+ 1800000 0>; |
197 |
+diff --git a/arch/arm/boot/dts/logicpd-som-lv-baseboard.dtsi b/arch/arm/boot/dts/logicpd-som-lv-baseboard.dtsi |
198 |
+index 4990ed90dcea..3e39b9a1f35d 100644 |
199 |
+--- a/arch/arm/boot/dts/logicpd-som-lv-baseboard.dtsi |
200 |
++++ b/arch/arm/boot/dts/logicpd-som-lv-baseboard.dtsi |
201 |
+@@ -153,7 +153,7 @@ |
202 |
+ pinctrl-names = "default"; |
203 |
+ pinctrl-0 = <&mmc1_pins>; |
204 |
+ wp-gpios = <&gpio4 30 GPIO_ACTIVE_HIGH>; /* gpio_126 */ |
205 |
+- cd-gpios = <&gpio4 14 IRQ_TYPE_LEVEL_LOW>; /* gpio_110 */ |
206 |
++ cd-gpios = <&gpio4 14 GPIO_ACTIVE_LOW>; /* gpio_110 */ |
207 |
+ vmmc-supply = <&vmmc1>; |
208 |
+ bus-width = <4>; |
209 |
+ cap-power-off-card; |
210 |
+diff --git a/arch/arm/boot/dts/logicpd-som-lv.dtsi b/arch/arm/boot/dts/logicpd-som-lv.dtsi |
211 |
+index 98b682a8080c..c5d54c4d3747 100644 |
212 |
+--- a/arch/arm/boot/dts/logicpd-som-lv.dtsi |
213 |
++++ b/arch/arm/boot/dts/logicpd-som-lv.dtsi |
214 |
+@@ -232,6 +232,20 @@ |
215 |
+ >; |
216 |
+ }; |
217 |
+ |
218 |
++ i2c2_pins: pinmux_i2c2_pins { |
219 |
++ pinctrl-single,pins = < |
220 |
++ OMAP3_CORE1_IOPAD(0x21be, PIN_INPUT | MUX_MODE0) /* i2c2_scl */ |
221 |
++ OMAP3_CORE1_IOPAD(0x21c0, PIN_INPUT | MUX_MODE0) /* i2c2_sda */ |
222 |
++ >; |
223 |
++ }; |
224 |
++ |
225 |
++ i2c3_pins: pinmux_i2c3_pins { |
226 |
++ pinctrl-single,pins = < |
227 |
++ OMAP3_CORE1_IOPAD(0x21c2, PIN_INPUT | MUX_MODE0) /* i2c3_scl */ |
228 |
++ OMAP3_CORE1_IOPAD(0x21c4, PIN_INPUT | MUX_MODE0) /* i2c3_sda */ |
229 |
++ >; |
230 |
++ }; |
231 |
++ |
232 |
+ tsc2004_pins: pinmux_tsc2004_pins { |
233 |
+ pinctrl-single,pins = < |
234 |
+ OMAP3_CORE1_IOPAD(0x2186, PIN_INPUT | MUX_MODE4) /* mcbsp4_dr.gpio_153 */ |
235 |
+@@ -253,18 +267,6 @@ |
236 |
+ OMAP3_WKUP_IOPAD(0x2a0c, PIN_OUTPUT | MUX_MODE4) /* sys_boot1.gpio_3 */ |
237 |
+ >; |
238 |
+ }; |
239 |
+- i2c2_pins: pinmux_i2c2_pins { |
240 |
+- pinctrl-single,pins = < |
241 |
+- OMAP3_CORE1_IOPAD(0x21be, PIN_INPUT | MUX_MODE0) /* i2c2_scl */ |
242 |
+- OMAP3_CORE1_IOPAD(0x21c0, PIN_INPUT | MUX_MODE0) /* i2c2_sda */ |
243 |
+- >; |
244 |
+- }; |
245 |
+- i2c3_pins: pinmux_i2c3_pins { |
246 |
+- pinctrl-single,pins = < |
247 |
+- OMAP3_CORE1_IOPAD(0x21c2, PIN_INPUT | MUX_MODE0) /* i2c3_scl */ |
248 |
+- OMAP3_CORE1_IOPAD(0x21c4, PIN_INPUT | MUX_MODE0) /* i2c3_sda */ |
249 |
+- >; |
250 |
+- }; |
251 |
+ }; |
252 |
+ |
253 |
+ &omap3_pmx_core2 { |
254 |
+diff --git a/arch/arm/boot/dts/lpc3250-phy3250.dts b/arch/arm/boot/dts/lpc3250-phy3250.dts |
255 |
+index 1e1c2f517a82..ffcf78631b22 100644 |
256 |
+--- a/arch/arm/boot/dts/lpc3250-phy3250.dts |
257 |
++++ b/arch/arm/boot/dts/lpc3250-phy3250.dts |
258 |
+@@ -49,8 +49,8 @@ |
259 |
+ sd_reg: regulator@2 { |
260 |
+ compatible = "regulator-fixed"; |
261 |
+ regulator-name = "sd_reg"; |
262 |
+- regulator-min-microvolt = <1800000>; |
263 |
+- regulator-max-microvolt = <1800000>; |
264 |
++ regulator-min-microvolt = <3300000>; |
265 |
++ regulator-max-microvolt = <3300000>; |
266 |
+ gpio = <&gpio 5 5 0>; |
267 |
+ enable-active-high; |
268 |
+ }; |
269 |
+diff --git a/arch/arm/boot/dts/lpc32xx.dtsi b/arch/arm/boot/dts/lpc32xx.dtsi |
270 |
+index ed0d6fb20122..9ad3df11db0d 100644 |
271 |
+--- a/arch/arm/boot/dts/lpc32xx.dtsi |
272 |
++++ b/arch/arm/boot/dts/lpc32xx.dtsi |
273 |
+@@ -139,11 +139,11 @@ |
274 |
+ }; |
275 |
+ |
276 |
+ clcd: clcd@31040000 { |
277 |
+- compatible = "arm,pl110", "arm,primecell"; |
278 |
++ compatible = "arm,pl111", "arm,primecell"; |
279 |
+ reg = <0x31040000 0x1000>; |
280 |
+ interrupts = <14 IRQ_TYPE_LEVEL_HIGH>; |
281 |
+- clocks = <&clk LPC32XX_CLK_LCD>; |
282 |
+- clock-names = "apb_pclk"; |
283 |
++ clocks = <&clk LPC32XX_CLK_LCD>, <&clk LPC32XX_CLK_LCD>; |
284 |
++ clock-names = "clcdclk", "apb_pclk"; |
285 |
+ status = "disabled"; |
286 |
+ }; |
287 |
+ |
288 |
+@@ -462,7 +462,9 @@ |
289 |
+ key: key@40050000 { |
290 |
+ compatible = "nxp,lpc3220-key"; |
291 |
+ reg = <0x40050000 0x1000>; |
292 |
+- interrupts = <54 IRQ_TYPE_LEVEL_HIGH>; |
293 |
++ clocks = <&clk LPC32XX_CLK_KEY>; |
294 |
++ interrupt-parent = <&sic1>; |
295 |
++ interrupts = <22 IRQ_TYPE_LEVEL_HIGH>; |
296 |
+ status = "disabled"; |
297 |
+ }; |
298 |
+ |
299 |
+diff --git a/arch/arm/boot/dts/ls1021a-twr.dts b/arch/arm/boot/dts/ls1021a-twr.dts |
300 |
+index f0c949d74833..ec5afad3efd8 100644 |
301 |
+--- a/arch/arm/boot/dts/ls1021a-twr.dts |
302 |
++++ b/arch/arm/boot/dts/ls1021a-twr.dts |
303 |
+@@ -143,7 +143,7 @@ |
304 |
+ }; |
305 |
+ |
306 |
+ &enet0 { |
307 |
+- tbi-handle = <&tbi1>; |
308 |
++ tbi-handle = <&tbi0>; |
309 |
+ phy-handle = <&sgmii_phy2>; |
310 |
+ phy-connection-type = "sgmii"; |
311 |
+ status = "okay"; |
312 |
+@@ -222,6 +222,13 @@ |
313 |
+ sgmii_phy2: ethernet-phy@2 { |
314 |
+ reg = <0x2>; |
315 |
+ }; |
316 |
++ tbi0: tbi-phy@1f { |
317 |
++ reg = <0x1f>; |
318 |
++ device_type = "tbi-phy"; |
319 |
++ }; |
320 |
++}; |
321 |
++ |
322 |
++&mdio1 { |
323 |
+ tbi1: tbi-phy@1f { |
324 |
+ reg = <0x1f>; |
325 |
+ device_type = "tbi-phy"; |
326 |
+diff --git a/arch/arm/boot/dts/ls1021a.dtsi b/arch/arm/boot/dts/ls1021a.dtsi |
327 |
+index f18490548c78..7e22309bccac 100644 |
328 |
+--- a/arch/arm/boot/dts/ls1021a.dtsi |
329 |
++++ b/arch/arm/boot/dts/ls1021a.dtsi |
330 |
+@@ -584,7 +584,7 @@ |
331 |
+ }; |
332 |
+ |
333 |
+ mdio0: mdio@2d24000 { |
334 |
+- compatible = "gianfar"; |
335 |
++ compatible = "fsl,etsec2-mdio"; |
336 |
+ device_type = "mdio"; |
337 |
+ #address-cells = <1>; |
338 |
+ #size-cells = <0>; |
339 |
+@@ -592,6 +592,15 @@ |
340 |
+ <0x0 0x2d10030 0x0 0x4>; |
341 |
+ }; |
342 |
+ |
343 |
++ mdio1: mdio@2d64000 { |
344 |
++ compatible = "fsl,etsec2-mdio"; |
345 |
++ device_type = "mdio"; |
346 |
++ #address-cells = <1>; |
347 |
++ #size-cells = <0>; |
348 |
++ reg = <0x0 0x2d64000 0x0 0x4000>, |
349 |
++ <0x0 0x2d50030 0x0 0x4>; |
350 |
++ }; |
351 |
++ |
352 |
+ ptp_clock@2d10e00 { |
353 |
+ compatible = "fsl,etsec-ptp"; |
354 |
+ reg = <0x0 0x2d10e00 0x0 0xb0>; |
355 |
+diff --git a/arch/arm/boot/dts/omap3-n900.dts b/arch/arm/boot/dts/omap3-n900.dts |
356 |
+index 182a53991c90..37785e7d1238 100644 |
357 |
+--- a/arch/arm/boot/dts/omap3-n900.dts |
358 |
++++ b/arch/arm/boot/dts/omap3-n900.dts |
359 |
+@@ -158,6 +158,12 @@ |
360 |
+ pwms = <&pwm9 0 26316 0>; /* 38000 Hz */ |
361 |
+ }; |
362 |
+ |
363 |
++ rom_rng: rng { |
364 |
++ compatible = "nokia,n900-rom-rng"; |
365 |
++ clocks = <&rng_ick>; |
366 |
++ clock-names = "ick"; |
367 |
++ }; |
368 |
++ |
369 |
+ /* controlled (enabled/disabled) directly by bcm2048 and wl1251 */ |
370 |
+ vctcxo: vctcxo { |
371 |
+ compatible = "fixed-clock"; |
372 |
+diff --git a/arch/arm/boot/dts/r8a7743.dtsi b/arch/arm/boot/dts/r8a7743.dtsi |
373 |
+index 24715f74ae08..5015e2273d82 100644 |
374 |
+--- a/arch/arm/boot/dts/r8a7743.dtsi |
375 |
++++ b/arch/arm/boot/dts/r8a7743.dtsi |
376 |
+@@ -565,9 +565,7 @@ |
377 |
+ /* doesn't need pinmux */ |
378 |
+ #address-cells = <1>; |
379 |
+ #size-cells = <0>; |
380 |
+- compatible = "renesas,iic-r8a7743", |
381 |
+- "renesas,rcar-gen2-iic", |
382 |
+- "renesas,rmobile-iic"; |
383 |
++ compatible = "renesas,iic-r8a7743"; |
384 |
+ reg = <0 0xe60b0000 0 0x425>; |
385 |
+ interrupts = <GIC_SPI 173 IRQ_TYPE_LEVEL_HIGH>; |
386 |
+ clocks = <&cpg CPG_MOD 926>; |
387 |
+diff --git a/arch/arm/boot/dts/stm32h743i-eval.dts b/arch/arm/boot/dts/stm32h743i-eval.dts |
388 |
+index 3f8e0c4a998d..5bf64e63cdf3 100644 |
389 |
+--- a/arch/arm/boot/dts/stm32h743i-eval.dts |
390 |
++++ b/arch/arm/boot/dts/stm32h743i-eval.dts |
391 |
+@@ -79,6 +79,7 @@ |
392 |
+ }; |
393 |
+ |
394 |
+ &adc_12 { |
395 |
++ vdda-supply = <&vdda>; |
396 |
+ vref-supply = <&vdda>; |
397 |
+ status = "okay"; |
398 |
+ adc1: adc@0 { |
399 |
+diff --git a/arch/arm/boot/dts/sun8i-a23-a33.dtsi b/arch/arm/boot/dts/sun8i-a23-a33.dtsi |
400 |
+index c16ffcc4db7d..1efad1a6bcfd 100644 |
401 |
+--- a/arch/arm/boot/dts/sun8i-a23-a33.dtsi |
402 |
++++ b/arch/arm/boot/dts/sun8i-a23-a33.dtsi |
403 |
+@@ -155,6 +155,21 @@ |
404 |
+ #dma-cells = <1>; |
405 |
+ }; |
406 |
+ |
407 |
++ nfc: nand@1c03000 { |
408 |
++ compatible = "allwinner,sun4i-a10-nand"; |
409 |
++ reg = <0x01c03000 0x1000>; |
410 |
++ interrupts = <GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>; |
411 |
++ clocks = <&ccu CLK_BUS_NAND>, <&ccu CLK_NAND>; |
412 |
++ clock-names = "ahb", "mod"; |
413 |
++ resets = <&ccu RST_BUS_NAND>; |
414 |
++ reset-names = "ahb"; |
415 |
++ pinctrl-names = "default"; |
416 |
++ pinctrl-0 = <&nand_pins &nand_pins_cs0 &nand_pins_rb0>; |
417 |
++ status = "disabled"; |
418 |
++ #address-cells = <1>; |
419 |
++ #size-cells = <0>; |
420 |
++ }; |
421 |
++ |
422 |
+ mmc0: mmc@1c0f000 { |
423 |
+ compatible = "allwinner,sun7i-a20-mmc"; |
424 |
+ reg = <0x01c0f000 0x1000>; |
425 |
+@@ -212,21 +227,6 @@ |
426 |
+ #size-cells = <0>; |
427 |
+ }; |
428 |
+ |
429 |
+- nfc: nand@1c03000 { |
430 |
+- compatible = "allwinner,sun4i-a10-nand"; |
431 |
+- reg = <0x01c03000 0x1000>; |
432 |
+- interrupts = <GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>; |
433 |
+- clocks = <&ccu CLK_BUS_NAND>, <&ccu CLK_NAND>; |
434 |
+- clock-names = "ahb", "mod"; |
435 |
+- resets = <&ccu RST_BUS_NAND>; |
436 |
+- reset-names = "ahb"; |
437 |
+- pinctrl-names = "default"; |
438 |
+- pinctrl-0 = <&nand_pins &nand_pins_cs0 &nand_pins_rb0>; |
439 |
+- status = "disabled"; |
440 |
+- #address-cells = <1>; |
441 |
+- #size-cells = <0>; |
442 |
+- }; |
443 |
+- |
444 |
+ usb_otg: usb@1c19000 { |
445 |
+ /* compatible gets set in SoC specific dtsi file */ |
446 |
+ reg = <0x01c19000 0x0400>; |
447 |
+diff --git a/arch/arm/boot/dts/sun8i-h3-beelink-x2.dts b/arch/arm/boot/dts/sun8i-h3-beelink-x2.dts |
448 |
+index 25540b7694d5..6523d81dd9c4 100644 |
449 |
+--- a/arch/arm/boot/dts/sun8i-h3-beelink-x2.dts |
450 |
++++ b/arch/arm/boot/dts/sun8i-h3-beelink-x2.dts |
451 |
+@@ -90,6 +90,8 @@ |
452 |
+ wifi_pwrseq: wifi_pwrseq { |
453 |
+ compatible = "mmc-pwrseq-simple"; |
454 |
+ reset-gpios = <&r_pio 0 7 GPIO_ACTIVE_LOW>; /* PL7 */ |
455 |
++ clocks = <&rtc 1>; |
456 |
++ clock-names = "ext_clock"; |
457 |
+ }; |
458 |
+ |
459 |
+ sound_spdif { |
460 |
+@@ -155,6 +157,8 @@ |
461 |
+ |
462 |
+ &mmc1 { |
463 |
+ vmmc-supply = <®_vcc3v3>; |
464 |
++ vqmmc-supply = <®_vcc3v3>; |
465 |
++ mmc-pwrseq = <&wifi_pwrseq>; |
466 |
+ bus-width = <4>; |
467 |
+ non-removable; |
468 |
+ status = "okay"; |
469 |
+diff --git a/arch/arm/boot/dts/sun9i-a80-optimus.dts b/arch/arm/boot/dts/sun9i-a80-optimus.dts |
470 |
+index 58a199b0e494..d1e58a6a4343 100644 |
471 |
+--- a/arch/arm/boot/dts/sun9i-a80-optimus.dts |
472 |
++++ b/arch/arm/boot/dts/sun9i-a80-optimus.dts |
473 |
+@@ -82,7 +82,7 @@ |
474 |
+ |
475 |
+ reg_usb1_vbus: usb1-vbus { |
476 |
+ compatible = "regulator-fixed"; |
477 |
+- pinctrl-names = "default"; |
478 |
++ regulator-name = "usb1-vbus"; |
479 |
+ regulator-min-microvolt = <5000000>; |
480 |
+ regulator-max-microvolt = <5000000>; |
481 |
+ enable-active-high; |
482 |
+@@ -91,7 +91,7 @@ |
483 |
+ |
484 |
+ reg_usb3_vbus: usb3-vbus { |
485 |
+ compatible = "regulator-fixed"; |
486 |
+- pinctrl-names = "default"; |
487 |
++ regulator-name = "usb3-vbus"; |
488 |
+ regulator-min-microvolt = <5000000>; |
489 |
+ regulator-max-microvolt = <5000000>; |
490 |
+ enable-active-high; |
491 |
+diff --git a/arch/arm/common/mcpm_entry.c b/arch/arm/common/mcpm_entry.c |
492 |
+index ad574d20415c..1b1b82b37ce0 100644 |
493 |
+--- a/arch/arm/common/mcpm_entry.c |
494 |
++++ b/arch/arm/common/mcpm_entry.c |
495 |
+@@ -381,7 +381,7 @@ static int __init nocache_trampoline(unsigned long _arg) |
496 |
+ unsigned int cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1); |
497 |
+ phys_reset_t phys_reset; |
498 |
+ |
499 |
+- mcpm_set_entry_vector(cpu, cluster, cpu_resume); |
500 |
++ mcpm_set_entry_vector(cpu, cluster, cpu_resume_no_hyp); |
501 |
+ setup_mm_for_reboot(); |
502 |
+ |
503 |
+ __mcpm_cpu_going_down(cpu, cluster); |
504 |
+diff --git a/arch/arm/configs/qcom_defconfig b/arch/arm/configs/qcom_defconfig |
505 |
+index 6aa7046fb91f..bd6440f23493 100644 |
506 |
+--- a/arch/arm/configs/qcom_defconfig |
507 |
++++ b/arch/arm/configs/qcom_defconfig |
508 |
+@@ -207,6 +207,7 @@ CONFIG_MSM_MMCC_8974=y |
509 |
+ CONFIG_MSM_IOMMU=y |
510 |
+ CONFIG_HWSPINLOCK=y |
511 |
+ CONFIG_HWSPINLOCK_QCOM=y |
512 |
++CONFIG_MAILBOX=y |
513 |
+ CONFIG_REMOTEPROC=y |
514 |
+ CONFIG_QCOM_ADSP_PIL=y |
515 |
+ CONFIG_QCOM_Q6V5_PIL=y |
516 |
+diff --git a/arch/arm/include/asm/suspend.h b/arch/arm/include/asm/suspend.h |
517 |
+index 452bbdcbcc83..506314265c6f 100644 |
518 |
+--- a/arch/arm/include/asm/suspend.h |
519 |
++++ b/arch/arm/include/asm/suspend.h |
520 |
+@@ -10,6 +10,7 @@ struct sleep_save_sp { |
521 |
+ }; |
522 |
+ |
523 |
+ extern void cpu_resume(void); |
524 |
++extern void cpu_resume_no_hyp(void); |
525 |
+ extern void cpu_resume_arm(void); |
526 |
+ extern int cpu_suspend(unsigned long, int (*)(unsigned long)); |
527 |
+ |
528 |
+diff --git a/arch/arm/kernel/head-nommu.S b/arch/arm/kernel/head-nommu.S |
529 |
+index 326a97aa3ea0..22efcf48604c 100644 |
530 |
+--- a/arch/arm/kernel/head-nommu.S |
531 |
++++ b/arch/arm/kernel/head-nommu.S |
532 |
+@@ -441,8 +441,8 @@ M_CLASS(str r6, [r12, #PMSAv8_RLAR_A(3)]) |
533 |
+ str r5, [r12, #PMSAv8_RBAR_A(0)] |
534 |
+ str r6, [r12, #PMSAv8_RLAR_A(0)] |
535 |
+ #else |
536 |
+- mcr p15, 0, r5, c6, c10, 1 @ PRBAR4 |
537 |
+- mcr p15, 0, r6, c6, c10, 2 @ PRLAR4 |
538 |
++ mcr p15, 0, r5, c6, c10, 0 @ PRBAR4 |
539 |
++ mcr p15, 0, r6, c6, c10, 1 @ PRLAR4 |
540 |
+ #endif |
541 |
+ #endif |
542 |
+ ret lr |
543 |
+diff --git a/arch/arm/kernel/hyp-stub.S b/arch/arm/kernel/hyp-stub.S |
544 |
+index 60146e32619a..82a942894fc0 100644 |
545 |
+--- a/arch/arm/kernel/hyp-stub.S |
546 |
++++ b/arch/arm/kernel/hyp-stub.S |
547 |
+@@ -180,8 +180,8 @@ ARM_BE8(orr r7, r7, #(1 << 25)) @ HSCTLR.EE |
548 |
+ @ Check whether GICv3 system registers are available |
549 |
+ mrc p15, 0, r7, c0, c1, 1 @ ID_PFR1 |
550 |
+ ubfx r7, r7, #28, #4 |
551 |
+- cmp r7, #1 |
552 |
+- bne 2f |
553 |
++ teq r7, #0 |
554 |
++ beq 2f |
555 |
+ |
556 |
+ @ Enable system register accesses |
557 |
+ mrc p15, 4, r7, c12, c9, 5 @ ICC_HSRE |
558 |
+diff --git a/arch/arm/kernel/sleep.S b/arch/arm/kernel/sleep.S |
559 |
+index a8257fc9cf2a..5dc8b80bb693 100644 |
560 |
+--- a/arch/arm/kernel/sleep.S |
561 |
++++ b/arch/arm/kernel/sleep.S |
562 |
+@@ -120,6 +120,14 @@ ENDPROC(cpu_resume_after_mmu) |
563 |
+ .text |
564 |
+ .align |
565 |
+ |
566 |
++#ifdef CONFIG_MCPM |
567 |
++ .arm |
568 |
++THUMB( .thumb ) |
569 |
++ENTRY(cpu_resume_no_hyp) |
570 |
++ARM_BE8(setend be) @ ensure we are in BE mode |
571 |
++ b no_hyp |
572 |
++#endif |
573 |
++ |
574 |
+ #ifdef CONFIG_MMU |
575 |
+ .arm |
576 |
+ ENTRY(cpu_resume_arm) |
577 |
+@@ -135,6 +143,7 @@ ARM_BE8(setend be) @ ensure we are in BE mode |
578 |
+ bl __hyp_stub_install_secondary |
579 |
+ #endif |
580 |
+ safe_svcmode_maskall r1 |
581 |
++no_hyp: |
582 |
+ mov r1, #0 |
583 |
+ ALT_SMP(mrc p15, 0, r0, c0, c0, 5) |
584 |
+ ALT_UP_B(1f) |
585 |
+@@ -163,6 +172,9 @@ ENDPROC(cpu_resume) |
586 |
+ |
587 |
+ #ifdef CONFIG_MMU |
588 |
+ ENDPROC(cpu_resume_arm) |
589 |
++#endif |
590 |
++#ifdef CONFIG_MCPM |
591 |
++ENDPROC(cpu_resume_no_hyp) |
592 |
+ #endif |
593 |
+ |
594 |
+ .align 2 |
595 |
+diff --git a/arch/arm/kernel/vdso.c b/arch/arm/kernel/vdso.c |
596 |
+index f4dd7f9663c1..e8cda5e02b4e 100644 |
597 |
+--- a/arch/arm/kernel/vdso.c |
598 |
++++ b/arch/arm/kernel/vdso.c |
599 |
+@@ -205,7 +205,6 @@ static int __init vdso_init(void) |
600 |
+ } |
601 |
+ |
602 |
+ text_pages = (vdso_end - vdso_start) >> PAGE_SHIFT; |
603 |
+- pr_debug("vdso: %i text pages at base %p\n", text_pages, vdso_start); |
604 |
+ |
605 |
+ /* Allocate the VDSO text pagelist */ |
606 |
+ vdso_text_pagelist = kcalloc(text_pages, sizeof(struct page *), |
607 |
+diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c |
608 |
+index ec3789ba17b8..a8269f0a87ce 100644 |
609 |
+--- a/arch/arm/mach-omap2/omap_hwmod.c |
610 |
++++ b/arch/arm/mach-omap2/omap_hwmod.c |
611 |
+@@ -2430,7 +2430,7 @@ static void _setup_iclk_autoidle(struct omap_hwmod *oh) |
612 |
+ */ |
613 |
+ static int _setup_reset(struct omap_hwmod *oh) |
614 |
+ { |
615 |
+- int r; |
616 |
++ int r = 0; |
617 |
+ |
618 |
+ if (oh->_state != _HWMOD_STATE_INITIALIZED) |
619 |
+ return -EINVAL; |
620 |
+diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c |
621 |
+index dae726228770..b57faa2310a2 100644 |
622 |
+--- a/arch/arm/mach-omap2/pdata-quirks.c |
623 |
++++ b/arch/arm/mach-omap2/pdata-quirks.c |
624 |
+@@ -263,14 +263,6 @@ static void __init am3517_evm_legacy_init(void) |
625 |
+ am35xx_emac_reset(); |
626 |
+ } |
627 |
+ |
628 |
+-static struct platform_device omap3_rom_rng_device = { |
629 |
+- .name = "omap3-rom-rng", |
630 |
+- .id = -1, |
631 |
+- .dev = { |
632 |
+- .platform_data = rx51_secure_rng_call, |
633 |
+- }, |
634 |
+-}; |
635 |
+- |
636 |
+ static void __init nokia_n900_legacy_init(void) |
637 |
+ { |
638 |
+ hsmmc2_internal_input_clk(); |
639 |
+@@ -286,9 +278,6 @@ static void __init nokia_n900_legacy_init(void) |
640 |
+ pr_warn("RX-51: Not enabling ARM errata 430973 workaround\n"); |
641 |
+ pr_warn("Thumb binaries may crash randomly without this workaround\n"); |
642 |
+ } |
643 |
+- |
644 |
+- pr_info("RX-51: Registering OMAP3 HWRNG device\n"); |
645 |
+- platform_device_register(&omap3_rom_rng_device); |
646 |
+ } |
647 |
+ } |
648 |
+ |
649 |
+@@ -466,6 +455,7 @@ static struct of_dev_auxdata omap_auxdata_lookup[] = { |
650 |
+ OF_DEV_AUXDATA("ti,davinci_mdio", 0x5c030000, "davinci_mdio.0", NULL), |
651 |
+ OF_DEV_AUXDATA("ti,am3517-emac", 0x5c000000, "davinci_emac.0", |
652 |
+ &am35xx_emac_pdata), |
653 |
++ OF_DEV_AUXDATA("nokia,n900-rom-rng", 0, NULL, rx51_secure_rng_call), |
654 |
+ /* McBSP modules with sidetone core */ |
655 |
+ #if IS_ENABLED(CONFIG_SND_OMAP_SOC_MCBSP) |
656 |
+ OF_DEV_AUXDATA("ti,omap3-mcbsp", 0x49022000, "49022000.mcbsp", &mcbsp_pdata), |
657 |
+diff --git a/arch/arm/mach-rpc/irq.c b/arch/arm/mach-rpc/irq.c |
658 |
+index b8a61cb11207..7f0f40178634 100644 |
659 |
+--- a/arch/arm/mach-rpc/irq.c |
660 |
++++ b/arch/arm/mach-rpc/irq.c |
661 |
+@@ -118,7 +118,7 @@ extern unsigned char rpc_default_fiq_start, rpc_default_fiq_end; |
662 |
+ |
663 |
+ void __init rpc_init_irq(void) |
664 |
+ { |
665 |
+- unsigned int irq, clr, set = 0; |
666 |
++ unsigned int irq, clr, set; |
667 |
+ |
668 |
+ iomd_writeb(0, IOMD_IRQMASKA); |
669 |
+ iomd_writeb(0, IOMD_IRQMASKB); |
670 |
+@@ -130,6 +130,7 @@ void __init rpc_init_irq(void) |
671 |
+ |
672 |
+ for (irq = 0; irq < NR_IRQS; irq++) { |
673 |
+ clr = IRQ_NOREQUEST; |
674 |
++ set = 0; |
675 |
+ |
676 |
+ if (irq <= 6 || (irq >= 9 && irq <= 15)) |
677 |
+ clr |= IRQ_NOPROBE; |
678 |
+diff --git a/arch/arm/mach-stm32/Kconfig b/arch/arm/mach-stm32/Kconfig |
679 |
+index 713c068b953f..adca4368d67c 100644 |
680 |
+--- a/arch/arm/mach-stm32/Kconfig |
681 |
++++ b/arch/arm/mach-stm32/Kconfig |
682 |
+@@ -1,5 +1,6 @@ |
683 |
+ menuconfig ARCH_STM32 |
684 |
+- bool "STMicroelectronics STM32 family" if ARM_SINGLE_ARMV7M || ARCH_MULTI_V7 |
685 |
++ bool "STMicroelectronics STM32 family" |
686 |
++ depends on ARM_SINGLE_ARMV7M || ARCH_MULTI_V7 |
687 |
+ select ARMV7M_SYSTICK if ARM_SINGLE_ARMV7M |
688 |
+ select HAVE_ARM_ARCH_TIMER if ARCH_MULTI_V7 |
689 |
+ select ARM_GIC if ARCH_MULTI_V7 |
690 |
+diff --git a/arch/arm/plat-pxa/ssp.c b/arch/arm/plat-pxa/ssp.c |
691 |
+index f51919974183..bf25f780c1c9 100644 |
692 |
+--- a/arch/arm/plat-pxa/ssp.c |
693 |
++++ b/arch/arm/plat-pxa/ssp.c |
694 |
+@@ -183,18 +183,12 @@ static int pxa_ssp_probe(struct platform_device *pdev) |
695 |
+ |
696 |
+ static int pxa_ssp_remove(struct platform_device *pdev) |
697 |
+ { |
698 |
+- struct resource *res; |
699 |
+ struct ssp_device *ssp; |
700 |
+ |
701 |
+ ssp = platform_get_drvdata(pdev); |
702 |
+ if (ssp == NULL) |
703 |
+ return -ENODEV; |
704 |
+ |
705 |
+- res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
706 |
+- release_mem_region(res->start, resource_size(res)); |
707 |
+- |
708 |
+- clk_put(ssp->clk); |
709 |
+- |
710 |
+ mutex_lock(&ssp_lock); |
711 |
+ list_del(&ssp->node); |
712 |
+ mutex_unlock(&ssp_lock); |
713 |
+diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi |
714 |
+index d3daf90a8715..7abc4ea30541 100644 |
715 |
+--- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi |
716 |
++++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi |
717 |
+@@ -366,7 +366,8 @@ |
718 |
+ interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>, |
719 |
+ <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>, |
720 |
+ <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>; |
721 |
+- clocks = <&ccu 58>; |
722 |
++ clocks = <&ccu 58>, <&osc24M>, <&rtc 0>; |
723 |
++ clock-names = "apb", "hosc", "losc"; |
724 |
+ gpio-controller; |
725 |
+ #gpio-cells = <3>; |
726 |
+ interrupt-controller; |
727 |
+diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6-pine-h64.dts b/arch/arm64/boot/dts/allwinner/sun50i-h6-pine-h64.dts |
728 |
+index 48daec7f78ba..6c3a47d90c79 100644 |
729 |
+--- a/arch/arm64/boot/dts/allwinner/sun50i-h6-pine-h64.dts |
730 |
++++ b/arch/arm64/boot/dts/allwinner/sun50i-h6-pine-h64.dts |
731 |
+@@ -176,6 +176,8 @@ |
732 |
+ pcf8563: rtc@51 { |
733 |
+ compatible = "nxp,pcf8563"; |
734 |
+ reg = <0x51>; |
735 |
++ interrupt-parent = <&r_intc>; |
736 |
++ interrupts = <0 IRQ_TYPE_LEVEL_LOW>; |
737 |
+ #clock-cells = <0>; |
738 |
+ }; |
739 |
+ }; |
740 |
+diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi |
741 |
+index cfa5fffcf62b..72813e7aefb8 100644 |
742 |
+--- a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi |
743 |
++++ b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi |
744 |
+@@ -101,17 +101,6 @@ |
745 |
+ #reset-cells = <1>; |
746 |
+ }; |
747 |
+ |
748 |
+- gic: interrupt-controller@3021000 { |
749 |
+- compatible = "arm,gic-400"; |
750 |
+- reg = <0x03021000 0x1000>, |
751 |
+- <0x03022000 0x2000>, |
752 |
+- <0x03024000 0x2000>, |
753 |
+- <0x03026000 0x2000>; |
754 |
+- interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>; |
755 |
+- interrupt-controller; |
756 |
+- #interrupt-cells = <3>; |
757 |
+- }; |
758 |
+- |
759 |
+ pio: pinctrl@300b000 { |
760 |
+ compatible = "allwinner,sun50i-h6-pinctrl"; |
761 |
+ reg = <0x0300b000 0x400>; |
762 |
+@@ -149,6 +138,17 @@ |
763 |
+ }; |
764 |
+ }; |
765 |
+ |
766 |
++ gic: interrupt-controller@3021000 { |
767 |
++ compatible = "arm,gic-400"; |
768 |
++ reg = <0x03021000 0x1000>, |
769 |
++ <0x03022000 0x2000>, |
770 |
++ <0x03024000 0x2000>, |
771 |
++ <0x03026000 0x2000>; |
772 |
++ interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>; |
773 |
++ interrupt-controller; |
774 |
++ #interrupt-cells = <3>; |
775 |
++ }; |
776 |
++ |
777 |
+ mmc0: mmc@4020000 { |
778 |
+ compatible = "allwinner,sun50i-h6-mmc", |
779 |
+ "allwinner,sun50i-a64-mmc"; |
780 |
+diff --git a/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi |
781 |
+index 765247bc4f24..e14e0ce7e89f 100644 |
782 |
+--- a/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi |
783 |
++++ b/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi |
784 |
+@@ -125,6 +125,7 @@ |
785 |
+ status = "okay"; |
786 |
+ pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>; |
787 |
+ pinctrl-names = "default"; |
788 |
++ hdmi-supply = <&hdmi_5v>; |
789 |
+ }; |
790 |
+ |
791 |
+ &hdmi_tx_tmds_port { |
792 |
+diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts |
793 |
+index 9d858eb193ca..062e12aa4677 100644 |
794 |
+--- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts |
795 |
++++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts |
796 |
+@@ -76,6 +76,7 @@ |
797 |
+ status = "okay"; |
798 |
+ pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>; |
799 |
+ pinctrl-names = "default"; |
800 |
++ hdmi-supply = <&hdmi_5v>; |
801 |
+ }; |
802 |
+ |
803 |
+ &hdmi_tx_tmds_port { |
804 |
+diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts |
805 |
+index b4dfb9afdef8..daad007fac1f 100644 |
806 |
+--- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts |
807 |
++++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts |
808 |
+@@ -155,6 +155,7 @@ |
809 |
+ status = "okay"; |
810 |
+ pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>; |
811 |
+ pinctrl-names = "default"; |
812 |
++ hdmi-supply = <&hdmi_5v>; |
813 |
+ }; |
814 |
+ |
815 |
+ &hdmi_tx_tmds_port { |
816 |
+@@ -255,7 +256,6 @@ |
817 |
+ cap-mmc-highspeed; |
818 |
+ mmc-ddr-3_3v; |
819 |
+ max-frequency = <50000000>; |
820 |
+- non-removable; |
821 |
+ disable-wp; |
822 |
+ |
823 |
+ mmc-pwrseq = <&emmc_pwrseq>; |
824 |
+diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dts |
825 |
+index 5896e8a5d86b..2602940c2077 100644 |
826 |
+--- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dts |
827 |
++++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dts |
828 |
+@@ -51,6 +51,7 @@ |
829 |
+ status = "okay"; |
830 |
+ pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>; |
831 |
+ pinctrl-names = "default"; |
832 |
++ hdmi-supply = <&hdmi_5v>; |
833 |
+ }; |
834 |
+ |
835 |
+ &hdmi_tx_tmds_port { |
836 |
+diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts |
837 |
+index 313f88f8759e..bdf7c6c5983c 100644 |
838 |
+--- a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts |
839 |
++++ b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts |
840 |
+@@ -18,7 +18,6 @@ |
841 |
+ |
842 |
+ aliases { |
843 |
+ serial0 = &uart_AO; |
844 |
+- serial1 = &uart_A; |
845 |
+ serial2 = &uart_AO_B; |
846 |
+ }; |
847 |
+ |
848 |
+@@ -63,11 +62,9 @@ |
849 |
+ |
850 |
+ gpio-keys-polled { |
851 |
+ compatible = "gpio-keys-polled"; |
852 |
+- #address-cells = <1>; |
853 |
+- #size-cells = <0>; |
854 |
+ poll-interval = <100>; |
855 |
+ |
856 |
+- button@0 { |
857 |
++ power-button { |
858 |
+ label = "power"; |
859 |
+ linux,code = <KEY_POWER>; |
860 |
+ gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_LOW>; |
861 |
+@@ -271,6 +268,7 @@ |
862 |
+ status = "okay"; |
863 |
+ pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>; |
864 |
+ pinctrl-names = "default"; |
865 |
++ hdmi-supply = <&hdmi_5v>; |
866 |
+ }; |
867 |
+ |
868 |
+ &hdmi_tx_tmds_port { |
869 |
+@@ -408,8 +406,17 @@ |
870 |
+ /* This one is connected to the Bluetooth module */ |
871 |
+ &uart_A { |
872 |
+ status = "okay"; |
873 |
+- pinctrl-0 = <&uart_a_pins>; |
874 |
++ pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>; |
875 |
+ pinctrl-names = "default"; |
876 |
++ uart-has-rtscts; |
877 |
++ |
878 |
++ bluetooth { |
879 |
++ compatible = "brcm,bcm43438-bt"; |
880 |
++ shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>; |
881 |
++ max-speed = <2000000>; |
882 |
++ clocks = <&wifi32k>; |
883 |
++ clock-names = "lpo"; |
884 |
++ }; |
885 |
+ }; |
886 |
+ |
887 |
+ /* This is brought out on the Linux_RX (18) and Linux_TX (19) pins: */ |
888 |
+diff --git a/arch/arm64/boot/dts/arm/juno-clocks.dtsi b/arch/arm64/boot/dts/arm/juno-clocks.dtsi |
889 |
+index e5e265dfa902..2870b5eeb198 100644 |
890 |
+--- a/arch/arm64/boot/dts/arm/juno-clocks.dtsi |
891 |
++++ b/arch/arm64/boot/dts/arm/juno-clocks.dtsi |
892 |
+@@ -8,10 +8,10 @@ |
893 |
+ */ |
894 |
+ / { |
895 |
+ /* SoC fixed clocks */ |
896 |
+- soc_uartclk: refclk7273800hz { |
897 |
++ soc_uartclk: refclk7372800hz { |
898 |
+ compatible = "fixed-clock"; |
899 |
+ #clock-cells = <0>; |
900 |
+- clock-frequency = <7273800>; |
901 |
++ clock-frequency = <7372800>; |
902 |
+ clock-output-names = "juno:uartclk"; |
903 |
+ }; |
904 |
+ |
905 |
+diff --git a/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi b/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi |
906 |
+index 78ce3979ef09..f38b815e696d 100644 |
907 |
+--- a/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi |
908 |
++++ b/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi |
909 |
+@@ -630,6 +630,8 @@ |
910 |
+ l11 { |
911 |
+ regulator-min-microvolt = <1750000>; |
912 |
+ regulator-max-microvolt = <3337000>; |
913 |
++ regulator-allow-set-load; |
914 |
++ regulator-system-load = <200000>; |
915 |
+ }; |
916 |
+ |
917 |
+ l12 { |
918 |
+diff --git a/arch/arm64/boot/dts/qcom/msm8916.dtsi b/arch/arm64/boot/dts/qcom/msm8916.dtsi |
919 |
+index 7b32b8990d62..8011e564a234 100644 |
920 |
+--- a/arch/arm64/boot/dts/qcom/msm8916.dtsi |
921 |
++++ b/arch/arm64/boot/dts/qcom/msm8916.dtsi |
922 |
+@@ -114,7 +114,7 @@ |
923 |
+ next-level-cache = <&L2_0>; |
924 |
+ enable-method = "psci"; |
925 |
+ cpu-idle-states = <&CPU_SPC>; |
926 |
+- clocks = <&apcs 0>; |
927 |
++ clocks = <&apcs>; |
928 |
+ operating-points-v2 = <&cpu_opp_table>; |
929 |
+ #cooling-cells = <2>; |
930 |
+ }; |
931 |
+@@ -126,7 +126,7 @@ |
932 |
+ next-level-cache = <&L2_0>; |
933 |
+ enable-method = "psci"; |
934 |
+ cpu-idle-states = <&CPU_SPC>; |
935 |
+- clocks = <&apcs 0>; |
936 |
++ clocks = <&apcs>; |
937 |
+ operating-points-v2 = <&cpu_opp_table>; |
938 |
+ #cooling-cells = <2>; |
939 |
+ }; |
940 |
+@@ -138,7 +138,7 @@ |
941 |
+ next-level-cache = <&L2_0>; |
942 |
+ enable-method = "psci"; |
943 |
+ cpu-idle-states = <&CPU_SPC>; |
944 |
+- clocks = <&apcs 0>; |
945 |
++ clocks = <&apcs>; |
946 |
+ operating-points-v2 = <&cpu_opp_table>; |
947 |
+ #cooling-cells = <2>; |
948 |
+ }; |
949 |
+@@ -150,7 +150,7 @@ |
950 |
+ next-level-cache = <&L2_0>; |
951 |
+ enable-method = "psci"; |
952 |
+ cpu-idle-states = <&CPU_SPC>; |
953 |
+- clocks = <&apcs 0>; |
954 |
++ clocks = <&apcs>; |
955 |
+ operating-points-v2 = <&cpu_opp_table>; |
956 |
+ #cooling-cells = <2>; |
957 |
+ }; |
958 |
+diff --git a/arch/arm64/boot/dts/renesas/r8a7795-es1.dtsi b/arch/arm64/boot/dts/renesas/r8a7795-es1.dtsi |
959 |
+index 7b2fbaec9aef..3dc61b7e1d08 100644 |
960 |
+--- a/arch/arm64/boot/dts/renesas/r8a7795-es1.dtsi |
961 |
++++ b/arch/arm64/boot/dts/renesas/r8a7795-es1.dtsi |
962 |
+@@ -28,6 +28,7 @@ |
963 |
+ compatible = "renesas,ipmmu-r8a7795"; |
964 |
+ reg = <0 0xec680000 0 0x1000>; |
965 |
+ renesas,ipmmu-main = <&ipmmu_mm 5>; |
966 |
++ power-domains = <&sysc R8A7795_PD_ALWAYS_ON>; |
967 |
+ #iommu-cells = <1>; |
968 |
+ }; |
969 |
+ |
970 |
+@@ -35,6 +36,7 @@ |
971 |
+ compatible = "renesas,ipmmu-r8a7795"; |
972 |
+ reg = <0 0xe7730000 0 0x1000>; |
973 |
+ renesas,ipmmu-main = <&ipmmu_mm 8>; |
974 |
++ power-domains = <&sysc R8A7795_PD_ALWAYS_ON>; |
975 |
+ #iommu-cells = <1>; |
976 |
+ }; |
977 |
+ |
978 |
+diff --git a/arch/arm64/boot/dts/renesas/r8a77990-ebisu.dts b/arch/arm64/boot/dts/renesas/r8a77990-ebisu.dts |
979 |
+index 2bc3a4884b00..470c2a35a5af 100644 |
980 |
+--- a/arch/arm64/boot/dts/renesas/r8a77990-ebisu.dts |
981 |
++++ b/arch/arm64/boot/dts/renesas/r8a77990-ebisu.dts |
982 |
+@@ -33,7 +33,6 @@ |
983 |
+ &avb { |
984 |
+ pinctrl-0 = <&avb_pins>; |
985 |
+ pinctrl-names = "default"; |
986 |
+- renesas,no-ether-link; |
987 |
+ phy-handle = <&phy0>; |
988 |
+ phy-mode = "rgmii-txid"; |
989 |
+ status = "okay"; |
990 |
+diff --git a/arch/arm64/boot/dts/renesas/r8a77995.dtsi b/arch/arm64/boot/dts/renesas/r8a77995.dtsi |
991 |
+index fe77bc43c447..fb3ecb2c385d 100644 |
992 |
+--- a/arch/arm64/boot/dts/renesas/r8a77995.dtsi |
993 |
++++ b/arch/arm64/boot/dts/renesas/r8a77995.dtsi |
994 |
+@@ -938,7 +938,7 @@ |
995 |
+ |
996 |
+ du: display@feb00000 { |
997 |
+ compatible = "renesas,du-r8a77995"; |
998 |
+- reg = <0 0xfeb00000 0 0x80000>; |
999 |
++ reg = <0 0xfeb00000 0 0x40000>; |
1000 |
+ interrupts = <GIC_SPI 256 IRQ_TYPE_LEVEL_HIGH>, |
1001 |
+ <GIC_SPI 268 IRQ_TYPE_LEVEL_HIGH>; |
1002 |
+ clocks = <&cpg CPG_MOD 724>, |
1003 |
+diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig |
1004 |
+index db8d364f8476..1a4f8b67bbe8 100644 |
1005 |
+--- a/arch/arm64/configs/defconfig |
1006 |
++++ b/arch/arm64/configs/defconfig |
1007 |
+@@ -365,6 +365,7 @@ CONFIG_THERMAL_EMULATION=y |
1008 |
+ CONFIG_ROCKCHIP_THERMAL=m |
1009 |
+ CONFIG_RCAR_GEN3_THERMAL=y |
1010 |
+ CONFIG_ARMADA_THERMAL=y |
1011 |
++CONFIG_BCM2835_THERMAL=m |
1012 |
+ CONFIG_BRCMSTB_THERMAL=m |
1013 |
+ CONFIG_EXYNOS_THERMAL=y |
1014 |
+ CONFIG_TEGRA_BPMP_THERMAL=m |
1015 |
+diff --git a/arch/arm64/kernel/hibernate.c b/arch/arm64/kernel/hibernate.c |
1016 |
+index 9859e1178e6b..dbeeeffdb9c9 100644 |
1017 |
+--- a/arch/arm64/kernel/hibernate.c |
1018 |
++++ b/arch/arm64/kernel/hibernate.c |
1019 |
+@@ -202,6 +202,7 @@ static int create_safe_exec_page(void *src_start, size_t length, |
1020 |
+ gfp_t mask) |
1021 |
+ { |
1022 |
+ int rc = 0; |
1023 |
++ pgd_t *trans_pgd; |
1024 |
+ pgd_t *pgdp; |
1025 |
+ pud_t *pudp; |
1026 |
+ pmd_t *pmdp; |
1027 |
+@@ -216,7 +217,13 @@ static int create_safe_exec_page(void *src_start, size_t length, |
1028 |
+ memcpy((void *)dst, src_start, length); |
1029 |
+ __flush_icache_range(dst, dst + length); |
1030 |
+ |
1031 |
+- pgdp = pgd_offset_raw(allocator(mask), dst_addr); |
1032 |
++ trans_pgd = allocator(mask); |
1033 |
++ if (!trans_pgd) { |
1034 |
++ rc = -ENOMEM; |
1035 |
++ goto out; |
1036 |
++ } |
1037 |
++ |
1038 |
++ pgdp = pgd_offset_raw(trans_pgd, dst_addr); |
1039 |
+ if (pgd_none(READ_ONCE(*pgdp))) { |
1040 |
+ pudp = allocator(mask); |
1041 |
+ if (!pudp) { |
1042 |
+diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c |
1043 |
+index ec0bb588d755..42b7082029e1 100644 |
1044 |
+--- a/arch/arm64/kernel/vdso.c |
1045 |
++++ b/arch/arm64/kernel/vdso.c |
1046 |
+@@ -146,8 +146,6 @@ static int __init vdso_init(void) |
1047 |
+ } |
1048 |
+ |
1049 |
+ vdso_pages = (vdso_end - vdso_start) >> PAGE_SHIFT; |
1050 |
+- pr_info("vdso: %ld pages (%ld code @ %p, %ld data @ %p)\n", |
1051 |
+- vdso_pages + 1, vdso_pages, vdso_start, 1L, vdso_data); |
1052 |
+ |
1053 |
+ /* Allocate the vDSO pagelist, plus a page for the data. */ |
1054 |
+ vdso_pagelist = kcalloc(vdso_pages + 1, sizeof(struct page *), |
1055 |
+diff --git a/arch/ia64/kernel/signal.c b/arch/ia64/kernel/signal.c |
1056 |
+index d1234a5ba4c5..9a960829a01d 100644 |
1057 |
+--- a/arch/ia64/kernel/signal.c |
1058 |
++++ b/arch/ia64/kernel/signal.c |
1059 |
+@@ -110,7 +110,6 @@ ia64_rt_sigreturn (struct sigscratch *scr) |
1060 |
+ { |
1061 |
+ extern char ia64_strace_leave_kernel, ia64_leave_kernel; |
1062 |
+ struct sigcontext __user *sc; |
1063 |
+- struct siginfo si; |
1064 |
+ sigset_t set; |
1065 |
+ long retval; |
1066 |
+ |
1067 |
+@@ -153,14 +152,7 @@ ia64_rt_sigreturn (struct sigscratch *scr) |
1068 |
+ return retval; |
1069 |
+ |
1070 |
+ give_sigsegv: |
1071 |
+- clear_siginfo(&si); |
1072 |
+- si.si_signo = SIGSEGV; |
1073 |
+- si.si_errno = 0; |
1074 |
+- si.si_code = SI_KERNEL; |
1075 |
+- si.si_pid = task_pid_vnr(current); |
1076 |
+- si.si_uid = from_kuid_munged(current_user_ns(), current_uid()); |
1077 |
+- si.si_addr = sc; |
1078 |
+- force_sig_info(SIGSEGV, &si, current); |
1079 |
++ force_sig(SIGSEGV, current); |
1080 |
+ return retval; |
1081 |
+ } |
1082 |
+ |
1083 |
+@@ -231,37 +223,6 @@ rbs_on_sig_stack (unsigned long bsp) |
1084 |
+ return (bsp - current->sas_ss_sp < current->sas_ss_size); |
1085 |
+ } |
1086 |
+ |
1087 |
+-static long |
1088 |
+-force_sigsegv_info (int sig, void __user *addr) |
1089 |
+-{ |
1090 |
+- unsigned long flags; |
1091 |
+- struct siginfo si; |
1092 |
+- |
1093 |
+- clear_siginfo(&si); |
1094 |
+- if (sig == SIGSEGV) { |
1095 |
+- /* |
1096 |
+- * Acquiring siglock around the sa_handler-update is almost |
1097 |
+- * certainly overkill, but this isn't a |
1098 |
+- * performance-critical path and I'd rather play it safe |
1099 |
+- * here than having to debug a nasty race if and when |
1100 |
+- * something changes in kernel/signal.c that would make it |
1101 |
+- * no longer safe to modify sa_handler without holding the |
1102 |
+- * lock. |
1103 |
+- */ |
1104 |
+- spin_lock_irqsave(¤t->sighand->siglock, flags); |
1105 |
+- current->sighand->action[sig - 1].sa.sa_handler = SIG_DFL; |
1106 |
+- spin_unlock_irqrestore(¤t->sighand->siglock, flags); |
1107 |
+- } |
1108 |
+- si.si_signo = SIGSEGV; |
1109 |
+- si.si_errno = 0; |
1110 |
+- si.si_code = SI_KERNEL; |
1111 |
+- si.si_pid = task_pid_vnr(current); |
1112 |
+- si.si_uid = from_kuid_munged(current_user_ns(), current_uid()); |
1113 |
+- si.si_addr = addr; |
1114 |
+- force_sig_info(SIGSEGV, &si, current); |
1115 |
+- return 1; |
1116 |
+-} |
1117 |
+- |
1118 |
+ static long |
1119 |
+ setup_frame(struct ksignal *ksig, sigset_t *set, struct sigscratch *scr) |
1120 |
+ { |
1121 |
+@@ -295,15 +256,18 @@ setup_frame(struct ksignal *ksig, sigset_t *set, struct sigscratch *scr) |
1122 |
+ * instead so we will die with SIGSEGV. |
1123 |
+ */ |
1124 |
+ check_sp = (new_sp - sizeof(*frame)) & -STACK_ALIGN; |
1125 |
+- if (!likely(on_sig_stack(check_sp))) |
1126 |
+- return force_sigsegv_info(ksig->sig, (void __user *) |
1127 |
+- check_sp); |
1128 |
++ if (!likely(on_sig_stack(check_sp))) { |
1129 |
++ force_sigsegv(ksig->sig, current); |
1130 |
++ return 1; |
1131 |
++ } |
1132 |
+ } |
1133 |
+ } |
1134 |
+ frame = (void __user *) ((new_sp - sizeof(*frame)) & -STACK_ALIGN); |
1135 |
+ |
1136 |
+- if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) |
1137 |
+- return force_sigsegv_info(ksig->sig, frame); |
1138 |
++ if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) { |
1139 |
++ force_sigsegv(ksig->sig, current); |
1140 |
++ return 1; |
1141 |
++ } |
1142 |
+ |
1143 |
+ err = __put_user(ksig->sig, &frame->arg0); |
1144 |
+ err |= __put_user(&frame->info, &frame->arg1); |
1145 |
+@@ -317,8 +281,10 @@ setup_frame(struct ksignal *ksig, sigset_t *set, struct sigscratch *scr) |
1146 |
+ err |= __save_altstack(&frame->sc.sc_stack, scr->pt.r12); |
1147 |
+ err |= setup_sigcontext(&frame->sc, set, scr); |
1148 |
+ |
1149 |
+- if (unlikely(err)) |
1150 |
+- return force_sigsegv_info(ksig->sig, frame); |
1151 |
++ if (unlikely(err)) { |
1152 |
++ force_sigsegv(ksig->sig, current); |
1153 |
++ return 1; |
1154 |
++ } |
1155 |
+ |
1156 |
+ scr->pt.r12 = (unsigned long) frame - 16; /* new stack pointer */ |
1157 |
+ scr->pt.ar_fpsr = FPSR_DEFAULT; /* reset fpsr for signal handler */ |
1158 |
+diff --git a/arch/m68k/amiga/cia.c b/arch/m68k/amiga/cia.c |
1159 |
+index 2081b8cd5591..b9aee983e6f4 100644 |
1160 |
+--- a/arch/m68k/amiga/cia.c |
1161 |
++++ b/arch/m68k/amiga/cia.c |
1162 |
+@@ -88,10 +88,19 @@ static irqreturn_t cia_handler(int irq, void *dev_id) |
1163 |
+ struct ciabase *base = dev_id; |
1164 |
+ int mach_irq; |
1165 |
+ unsigned char ints; |
1166 |
++ unsigned long flags; |
1167 |
+ |
1168 |
++ /* Interrupts get disabled while the timer irq flag is cleared and |
1169 |
++ * the timer interrupt serviced. |
1170 |
++ */ |
1171 |
+ mach_irq = base->cia_irq; |
1172 |
++ local_irq_save(flags); |
1173 |
+ ints = cia_set_irq(base, CIA_ICR_ALL); |
1174 |
+ amiga_custom.intreq = base->int_mask; |
1175 |
++ if (ints & 1) |
1176 |
++ generic_handle_irq(mach_irq); |
1177 |
++ local_irq_restore(flags); |
1178 |
++ mach_irq++, ints >>= 1; |
1179 |
+ for (; ints; mach_irq++, ints >>= 1) { |
1180 |
+ if (ints & 1) |
1181 |
+ generic_handle_irq(mach_irq); |
1182 |
+diff --git a/arch/m68k/atari/ataints.c b/arch/m68k/atari/ataints.c |
1183 |
+index 3d2b63bedf05..56f02ea2c248 100644 |
1184 |
+--- a/arch/m68k/atari/ataints.c |
1185 |
++++ b/arch/m68k/atari/ataints.c |
1186 |
+@@ -142,7 +142,7 @@ struct mfptimerbase { |
1187 |
+ .name = "MFP Timer D" |
1188 |
+ }; |
1189 |
+ |
1190 |
+-static irqreturn_t mfptimer_handler(int irq, void *dev_id) |
1191 |
++static irqreturn_t mfp_timer_d_handler(int irq, void *dev_id) |
1192 |
+ { |
1193 |
+ struct mfptimerbase *base = dev_id; |
1194 |
+ int mach_irq; |
1195 |
+@@ -344,7 +344,7 @@ void __init atari_init_IRQ(void) |
1196 |
+ st_mfp.tim_ct_cd = (st_mfp.tim_ct_cd & 0xf0) | 0x6; |
1197 |
+ |
1198 |
+ /* request timer D dispatch handler */ |
1199 |
+- if (request_irq(IRQ_MFP_TIMD, mfptimer_handler, IRQF_SHARED, |
1200 |
++ if (request_irq(IRQ_MFP_TIMD, mfp_timer_d_handler, IRQF_SHARED, |
1201 |
+ stmfp_base.name, &stmfp_base)) |
1202 |
+ pr_err("Couldn't register %s interrupt\n", stmfp_base.name); |
1203 |
+ |
1204 |
+diff --git a/arch/m68k/atari/time.c b/arch/m68k/atari/time.c |
1205 |
+index 9cca64286464..fafa20f75ab9 100644 |
1206 |
+--- a/arch/m68k/atari/time.c |
1207 |
++++ b/arch/m68k/atari/time.c |
1208 |
+@@ -24,6 +24,18 @@ |
1209 |
+ DEFINE_SPINLOCK(rtc_lock); |
1210 |
+ EXPORT_SYMBOL_GPL(rtc_lock); |
1211 |
+ |
1212 |
++static irqreturn_t mfp_timer_c_handler(int irq, void *dev_id) |
1213 |
++{ |
1214 |
++ irq_handler_t timer_routine = dev_id; |
1215 |
++ unsigned long flags; |
1216 |
++ |
1217 |
++ local_irq_save(flags); |
1218 |
++ timer_routine(0, NULL); |
1219 |
++ local_irq_restore(flags); |
1220 |
++ |
1221 |
++ return IRQ_HANDLED; |
1222 |
++} |
1223 |
++ |
1224 |
+ void __init |
1225 |
+ atari_sched_init(irq_handler_t timer_routine) |
1226 |
+ { |
1227 |
+@@ -32,7 +44,8 @@ atari_sched_init(irq_handler_t timer_routine) |
1228 |
+ /* start timer C, div = 1:100 */ |
1229 |
+ st_mfp.tim_ct_cd = (st_mfp.tim_ct_cd & 15) | 0x60; |
1230 |
+ /* install interrupt service routine for MFP Timer C */ |
1231 |
+- if (request_irq(IRQ_MFP_TIMC, timer_routine, 0, "timer", timer_routine)) |
1232 |
++ if (request_irq(IRQ_MFP_TIMC, mfp_timer_c_handler, 0, "timer", |
1233 |
++ timer_routine)) |
1234 |
+ pr_err("Couldn't register timer interrupt\n"); |
1235 |
+ } |
1236 |
+ |
1237 |
+diff --git a/arch/m68k/bvme6000/config.c b/arch/m68k/bvme6000/config.c |
1238 |
+index 143ee9fa3893..0e5efed4da86 100644 |
1239 |
+--- a/arch/m68k/bvme6000/config.c |
1240 |
++++ b/arch/m68k/bvme6000/config.c |
1241 |
+@@ -44,11 +44,6 @@ extern int bvme6000_hwclk (int, struct rtc_time *); |
1242 |
+ extern void bvme6000_reset (void); |
1243 |
+ void bvme6000_set_vectors (void); |
1244 |
+ |
1245 |
+-/* Save tick handler routine pointer, will point to xtime_update() in |
1246 |
+- * kernel/timer/timekeeping.c, called via bvme6000_process_int() */ |
1247 |
+- |
1248 |
+-static irq_handler_t tick_handler; |
1249 |
+- |
1250 |
+ |
1251 |
+ int __init bvme6000_parse_bootinfo(const struct bi_record *bi) |
1252 |
+ { |
1253 |
+@@ -157,12 +152,18 @@ irqreturn_t bvme6000_abort_int (int irq, void *dev_id) |
1254 |
+ |
1255 |
+ static irqreturn_t bvme6000_timer_int (int irq, void *dev_id) |
1256 |
+ { |
1257 |
++ irq_handler_t timer_routine = dev_id; |
1258 |
++ unsigned long flags; |
1259 |
+ volatile RtcPtr_t rtc = (RtcPtr_t)BVME_RTC_BASE; |
1260 |
+- unsigned char msr = rtc->msr & 0xc0; |
1261 |
++ unsigned char msr; |
1262 |
+ |
1263 |
++ local_irq_save(flags); |
1264 |
++ msr = rtc->msr & 0xc0; |
1265 |
+ rtc->msr = msr | 0x20; /* Ack the interrupt */ |
1266 |
++ timer_routine(0, NULL); |
1267 |
++ local_irq_restore(flags); |
1268 |
+ |
1269 |
+- return tick_handler(irq, dev_id); |
1270 |
++ return IRQ_HANDLED; |
1271 |
+ } |
1272 |
+ |
1273 |
+ /* |
1274 |
+@@ -181,9 +182,8 @@ void bvme6000_sched_init (irq_handler_t timer_routine) |
1275 |
+ |
1276 |
+ rtc->msr = 0; /* Ensure timer registers accessible */ |
1277 |
+ |
1278 |
+- tick_handler = timer_routine; |
1279 |
+- if (request_irq(BVME_IRQ_RTC, bvme6000_timer_int, 0, |
1280 |
+- "timer", bvme6000_timer_int)) |
1281 |
++ if (request_irq(BVME_IRQ_RTC, bvme6000_timer_int, 0, "timer", |
1282 |
++ timer_routine)) |
1283 |
+ panic ("Couldn't register timer int"); |
1284 |
+ |
1285 |
+ rtc->t1cr_omr = 0x04; /* Mode 2, ext clk */ |
1286 |
+diff --git a/arch/m68k/hp300/time.c b/arch/m68k/hp300/time.c |
1287 |
+index 289d928a46cb..d30b03ea93a2 100644 |
1288 |
+--- a/arch/m68k/hp300/time.c |
1289 |
++++ b/arch/m68k/hp300/time.c |
1290 |
+@@ -38,13 +38,19 @@ |
1291 |
+ |
1292 |
+ static irqreturn_t hp300_tick(int irq, void *dev_id) |
1293 |
+ { |
1294 |
++ irq_handler_t timer_routine = dev_id; |
1295 |
++ unsigned long flags; |
1296 |
+ unsigned long tmp; |
1297 |
+- irq_handler_t vector = dev_id; |
1298 |
++ |
1299 |
++ local_irq_save(flags); |
1300 |
+ in_8(CLOCKBASE + CLKSR); |
1301 |
+ asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE)); |
1302 |
++ timer_routine(0, NULL); |
1303 |
++ local_irq_restore(flags); |
1304 |
++ |
1305 |
+ /* Turn off the network and SCSI leds */ |
1306 |
+ blinken_leds(0, 0xe0); |
1307 |
+- return vector(irq, NULL); |
1308 |
++ return IRQ_HANDLED; |
1309 |
+ } |
1310 |
+ |
1311 |
+ u32 hp300_gettimeoffset(void) |
1312 |
+diff --git a/arch/m68k/mac/via.c b/arch/m68k/mac/via.c |
1313 |
+index acdabbeecfd2..038d5a1c4d48 100644 |
1314 |
+--- a/arch/m68k/mac/via.c |
1315 |
++++ b/arch/m68k/mac/via.c |
1316 |
+@@ -54,16 +54,6 @@ static __u8 rbv_clear; |
1317 |
+ |
1318 |
+ static int gIER,gIFR,gBufA,gBufB; |
1319 |
+ |
1320 |
+-/* |
1321 |
+- * Timer defs. |
1322 |
+- */ |
1323 |
+- |
1324 |
+-#define TICK_SIZE 10000 |
1325 |
+-#define MAC_CLOCK_TICK (783300/HZ) /* ticks per HZ */ |
1326 |
+-#define MAC_CLOCK_LOW (MAC_CLOCK_TICK&0xFF) |
1327 |
+-#define MAC_CLOCK_HIGH (MAC_CLOCK_TICK>>8) |
1328 |
+- |
1329 |
+- |
1330 |
+ /* |
1331 |
+ * On Macs with a genuine VIA chip there is no way to mask an individual slot |
1332 |
+ * interrupt. This limitation also seems to apply to VIA clone logic cores in |
1333 |
+@@ -267,22 +257,6 @@ void __init via_init(void) |
1334 |
+ } |
1335 |
+ } |
1336 |
+ |
1337 |
+-/* |
1338 |
+- * Start the 100 Hz clock |
1339 |
+- */ |
1340 |
+- |
1341 |
+-void __init via_init_clock(irq_handler_t func) |
1342 |
+-{ |
1343 |
+- via1[vACR] |= 0x40; |
1344 |
+- via1[vT1LL] = MAC_CLOCK_LOW; |
1345 |
+- via1[vT1LH] = MAC_CLOCK_HIGH; |
1346 |
+- via1[vT1CL] = MAC_CLOCK_LOW; |
1347 |
+- via1[vT1CH] = MAC_CLOCK_HIGH; |
1348 |
+- |
1349 |
+- if (request_irq(IRQ_MAC_TIMER_1, func, 0, "timer", func)) |
1350 |
+- pr_err("Couldn't register %s interrupt\n", "timer"); |
1351 |
+-} |
1352 |
+- |
1353 |
+ /* |
1354 |
+ * Debugging dump, used in various places to see what's going on. |
1355 |
+ */ |
1356 |
+@@ -310,29 +284,6 @@ void via_debug_dump(void) |
1357 |
+ } |
1358 |
+ } |
1359 |
+ |
1360 |
+-/* |
1361 |
+- * This is always executed with interrupts disabled. |
1362 |
+- * |
1363 |
+- * TBI: get time offset between scheduling timer ticks |
1364 |
+- */ |
1365 |
+- |
1366 |
+-u32 mac_gettimeoffset(void) |
1367 |
+-{ |
1368 |
+- unsigned long ticks, offset = 0; |
1369 |
+- |
1370 |
+- /* read VIA1 timer 2 current value */ |
1371 |
+- ticks = via1[vT1CL] | (via1[vT1CH] << 8); |
1372 |
+- /* The probability of underflow is less than 2% */ |
1373 |
+- if (ticks > MAC_CLOCK_TICK - MAC_CLOCK_TICK / 50) |
1374 |
+- /* Check for pending timer interrupt in VIA1 IFR */ |
1375 |
+- if (via1[vIFR] & 0x40) offset = TICK_SIZE; |
1376 |
+- |
1377 |
+- ticks = MAC_CLOCK_TICK - ticks; |
1378 |
+- ticks = ticks * 10000L / MAC_CLOCK_TICK; |
1379 |
+- |
1380 |
+- return (ticks + offset) * 1000; |
1381 |
+-} |
1382 |
+- |
1383 |
+ /* |
1384 |
+ * Flush the L2 cache on Macs that have it by flipping |
1385 |
+ * the system into 24-bit mode for an instant. |
1386 |
+@@ -436,6 +387,8 @@ void via_nubus_irq_shutdown(int irq) |
1387 |
+ * via6522.c :-), disable/pending masks added. |
1388 |
+ */ |
1389 |
+ |
1390 |
++#define VIA_TIMER_1_INT BIT(6) |
1391 |
++ |
1392 |
+ void via1_irq(struct irq_desc *desc) |
1393 |
+ { |
1394 |
+ int irq_num; |
1395 |
+@@ -445,6 +398,21 @@ void via1_irq(struct irq_desc *desc) |
1396 |
+ if (!events) |
1397 |
+ return; |
1398 |
+ |
1399 |
++ irq_num = IRQ_MAC_TIMER_1; |
1400 |
++ irq_bit = VIA_TIMER_1_INT; |
1401 |
++ if (events & irq_bit) { |
1402 |
++ unsigned long flags; |
1403 |
++ |
1404 |
++ local_irq_save(flags); |
1405 |
++ via1[vIFR] = irq_bit; |
1406 |
++ generic_handle_irq(irq_num); |
1407 |
++ local_irq_restore(flags); |
1408 |
++ |
1409 |
++ events &= ~irq_bit; |
1410 |
++ if (!events) |
1411 |
++ return; |
1412 |
++ } |
1413 |
++ |
1414 |
+ irq_num = VIA1_SOURCE_BASE; |
1415 |
+ irq_bit = 1; |
1416 |
+ do { |
1417 |
+@@ -601,3 +569,56 @@ int via2_scsi_drq_pending(void) |
1418 |
+ return via2[gIFR] & (1 << IRQ_IDX(IRQ_MAC_SCSIDRQ)); |
1419 |
+ } |
1420 |
+ EXPORT_SYMBOL(via2_scsi_drq_pending); |
1421 |
++ |
1422 |
++/* timer and clock source */ |
1423 |
++ |
1424 |
++#define VIA_CLOCK_FREQ 783360 /* VIA "phase 2" clock in Hz */ |
1425 |
++#define VIA_TIMER_INTERVAL (1000000 / HZ) /* microseconds per jiffy */ |
1426 |
++#define VIA_TIMER_CYCLES (VIA_CLOCK_FREQ / HZ) /* clock cycles per jiffy */ |
1427 |
++ |
1428 |
++#define VIA_TC (VIA_TIMER_CYCLES - 2) /* including 0 and -1 */ |
1429 |
++#define VIA_TC_LOW (VIA_TC & 0xFF) |
1430 |
++#define VIA_TC_HIGH (VIA_TC >> 8) |
1431 |
++ |
1432 |
++void __init via_init_clock(irq_handler_t timer_routine) |
1433 |
++{ |
1434 |
++ if (request_irq(IRQ_MAC_TIMER_1, timer_routine, 0, "timer", NULL)) { |
1435 |
++ pr_err("Couldn't register %s interrupt\n", "timer"); |
1436 |
++ return; |
1437 |
++ } |
1438 |
++ |
1439 |
++ via1[vT1LL] = VIA_TC_LOW; |
1440 |
++ via1[vT1LH] = VIA_TC_HIGH; |
1441 |
++ via1[vT1CL] = VIA_TC_LOW; |
1442 |
++ via1[vT1CH] = VIA_TC_HIGH; |
1443 |
++ via1[vACR] |= 0x40; |
1444 |
++} |
1445 |
++ |
1446 |
++u32 mac_gettimeoffset(void) |
1447 |
++{ |
1448 |
++ unsigned long flags; |
1449 |
++ u8 count_high; |
1450 |
++ u16 count, offset = 0; |
1451 |
++ |
1452 |
++ /* |
1453 |
++ * Timer counter wrap-around is detected with the timer interrupt flag |
1454 |
++ * but reading the counter low byte (vT1CL) would reset the flag. |
1455 |
++ * Also, accessing both counter registers is essentially a data race. |
1456 |
++ * These problems are avoided by ignoring the low byte. Clock accuracy |
1457 |
++ * is 256 times worse (error can reach 0.327 ms) but CPU overhead is |
1458 |
++ * reduced by avoiding slow VIA register accesses. |
1459 |
++ */ |
1460 |
++ |
1461 |
++ local_irq_save(flags); |
1462 |
++ count_high = via1[vT1CH]; |
1463 |
++ if (count_high == 0xFF) |
1464 |
++ count_high = 0; |
1465 |
++ if (count_high > 0 && (via1[vIFR] & VIA_TIMER_1_INT)) |
1466 |
++ offset = VIA_TIMER_CYCLES; |
1467 |
++ local_irq_restore(flags); |
1468 |
++ |
1469 |
++ count = count_high << 8; |
1470 |
++ count = VIA_TIMER_CYCLES - count + offset; |
1471 |
++ |
1472 |
++ return ((count * VIA_TIMER_INTERVAL) / VIA_TIMER_CYCLES) * 1000; |
1473 |
++} |
1474 |
+diff --git a/arch/m68k/mvme147/config.c b/arch/m68k/mvme147/config.c |
1475 |
+index adea549d240e..93c68d2b8e0e 100644 |
1476 |
+--- a/arch/m68k/mvme147/config.c |
1477 |
++++ b/arch/m68k/mvme147/config.c |
1478 |
+@@ -45,11 +45,6 @@ extern void mvme147_reset (void); |
1479 |
+ |
1480 |
+ static int bcd2int (unsigned char b); |
1481 |
+ |
1482 |
+-/* Save tick handler routine pointer, will point to xtime_update() in |
1483 |
+- * kernel/time/timekeeping.c, called via mvme147_process_int() */ |
1484 |
+- |
1485 |
+-irq_handler_t tick_handler; |
1486 |
+- |
1487 |
+ |
1488 |
+ int __init mvme147_parse_bootinfo(const struct bi_record *bi) |
1489 |
+ { |
1490 |
+@@ -104,16 +99,23 @@ void __init config_mvme147(void) |
1491 |
+ |
1492 |
+ static irqreturn_t mvme147_timer_int (int irq, void *dev_id) |
1493 |
+ { |
1494 |
++ irq_handler_t timer_routine = dev_id; |
1495 |
++ unsigned long flags; |
1496 |
++ |
1497 |
++ local_irq_save(flags); |
1498 |
+ m147_pcc->t1_int_cntrl = PCC_TIMER_INT_CLR; |
1499 |
+ m147_pcc->t1_int_cntrl = PCC_INT_ENAB|PCC_LEVEL_TIMER1; |
1500 |
+- return tick_handler(irq, dev_id); |
1501 |
++ timer_routine(0, NULL); |
1502 |
++ local_irq_restore(flags); |
1503 |
++ |
1504 |
++ return IRQ_HANDLED; |
1505 |
+ } |
1506 |
+ |
1507 |
+ |
1508 |
+ void mvme147_sched_init (irq_handler_t timer_routine) |
1509 |
+ { |
1510 |
+- tick_handler = timer_routine; |
1511 |
+- if (request_irq(PCC_IRQ_TIMER1, mvme147_timer_int, 0, "timer 1", NULL)) |
1512 |
++ if (request_irq(PCC_IRQ_TIMER1, mvme147_timer_int, 0, "timer 1", |
1513 |
++ timer_routine)) |
1514 |
+ pr_err("Couldn't register timer interrupt\n"); |
1515 |
+ |
1516 |
+ /* Init the clock with a value */ |
1517 |
+diff --git a/arch/m68k/mvme16x/config.c b/arch/m68k/mvme16x/config.c |
1518 |
+index 6ee36a5b528d..5feb3ab484d0 100644 |
1519 |
+--- a/arch/m68k/mvme16x/config.c |
1520 |
++++ b/arch/m68k/mvme16x/config.c |
1521 |
+@@ -50,11 +50,6 @@ extern void mvme16x_reset (void); |
1522 |
+ |
1523 |
+ int bcd2int (unsigned char b); |
1524 |
+ |
1525 |
+-/* Save tick handler routine pointer, will point to xtime_update() in |
1526 |
+- * kernel/time/timekeeping.c, called via mvme16x_process_int() */ |
1527 |
+- |
1528 |
+-static irq_handler_t tick_handler; |
1529 |
+- |
1530 |
+ |
1531 |
+ unsigned short mvme16x_config; |
1532 |
+ EXPORT_SYMBOL(mvme16x_config); |
1533 |
+@@ -352,8 +347,15 @@ static irqreturn_t mvme16x_abort_int (int irq, void *dev_id) |
1534 |
+ |
1535 |
+ static irqreturn_t mvme16x_timer_int (int irq, void *dev_id) |
1536 |
+ { |
1537 |
+- *(volatile unsigned char *)0xfff4201b |= 8; |
1538 |
+- return tick_handler(irq, dev_id); |
1539 |
++ irq_handler_t timer_routine = dev_id; |
1540 |
++ unsigned long flags; |
1541 |
++ |
1542 |
++ local_irq_save(flags); |
1543 |
++ *(volatile unsigned char *)0xfff4201b |= 8; |
1544 |
++ timer_routine(0, NULL); |
1545 |
++ local_irq_restore(flags); |
1546 |
++ |
1547 |
++ return IRQ_HANDLED; |
1548 |
+ } |
1549 |
+ |
1550 |
+ void mvme16x_sched_init (irq_handler_t timer_routine) |
1551 |
+@@ -361,14 +363,13 @@ void mvme16x_sched_init (irq_handler_t timer_routine) |
1552 |
+ uint16_t brdno = be16_to_cpu(mvme_bdid.brdno); |
1553 |
+ int irq; |
1554 |
+ |
1555 |
+- tick_handler = timer_routine; |
1556 |
+ /* Using PCCchip2 or MC2 chip tick timer 1 */ |
1557 |
+ *(volatile unsigned long *)0xfff42008 = 0; |
1558 |
+ *(volatile unsigned long *)0xfff42004 = 10000; /* 10ms */ |
1559 |
+ *(volatile unsigned char *)0xfff42017 |= 3; |
1560 |
+ *(volatile unsigned char *)0xfff4201b = 0x16; |
1561 |
+- if (request_irq(MVME16x_IRQ_TIMER, mvme16x_timer_int, 0, |
1562 |
+- "timer", mvme16x_timer_int)) |
1563 |
++ if (request_irq(MVME16x_IRQ_TIMER, mvme16x_timer_int, 0, "timer", |
1564 |
++ timer_routine)) |
1565 |
+ panic ("Couldn't register timer int"); |
1566 |
+ |
1567 |
+ if (brdno == 0x0162 || brdno == 0x172) |
1568 |
+diff --git a/arch/m68k/q40/q40ints.c b/arch/m68k/q40/q40ints.c |
1569 |
+index 3e7603202977..1c696906c159 100644 |
1570 |
+--- a/arch/m68k/q40/q40ints.c |
1571 |
++++ b/arch/m68k/q40/q40ints.c |
1572 |
+@@ -127,10 +127,10 @@ void q40_mksound(unsigned int hz, unsigned int ticks) |
1573 |
+ sound_ticks = ticks << 1; |
1574 |
+ } |
1575 |
+ |
1576 |
+-static irq_handler_t q40_timer_routine; |
1577 |
+- |
1578 |
+-static irqreturn_t q40_timer_int (int irq, void * dev) |
1579 |
++static irqreturn_t q40_timer_int(int irq, void *dev_id) |
1580 |
+ { |
1581 |
++ irq_handler_t timer_routine = dev_id; |
1582 |
++ |
1583 |
+ ql_ticks = ql_ticks ? 0 : 1; |
1584 |
+ if (sound_ticks) { |
1585 |
+ unsigned char sval=(sound_ticks & 1) ? 128-SVOL : 128+SVOL; |
1586 |
+@@ -139,8 +139,13 @@ static irqreturn_t q40_timer_int (int irq, void * dev) |
1587 |
+ *DAC_RIGHT=sval; |
1588 |
+ } |
1589 |
+ |
1590 |
+- if (!ql_ticks) |
1591 |
+- q40_timer_routine(irq, dev); |
1592 |
++ if (!ql_ticks) { |
1593 |
++ unsigned long flags; |
1594 |
++ |
1595 |
++ local_irq_save(flags); |
1596 |
++ timer_routine(0, NULL); |
1597 |
++ local_irq_restore(flags); |
1598 |
++ } |
1599 |
+ return IRQ_HANDLED; |
1600 |
+ } |
1601 |
+ |
1602 |
+@@ -148,11 +153,9 @@ void q40_sched_init (irq_handler_t timer_routine) |
1603 |
+ { |
1604 |
+ int timer_irq; |
1605 |
+ |
1606 |
+- q40_timer_routine = timer_routine; |
1607 |
+ timer_irq = Q40_IRQ_FRAME; |
1608 |
+ |
1609 |
+- if (request_irq(timer_irq, q40_timer_int, 0, |
1610 |
+- "timer", q40_timer_int)) |
1611 |
++ if (request_irq(timer_irq, q40_timer_int, 0, "timer", timer_routine)) |
1612 |
+ panic("Couldn't register timer int"); |
1613 |
+ |
1614 |
+ master_outb(-1, FRAME_CLEAR_REG); |
1615 |
+diff --git a/arch/m68k/sun3/sun3ints.c b/arch/m68k/sun3/sun3ints.c |
1616 |
+index 6bbca30c9188..a5824abb4a39 100644 |
1617 |
+--- a/arch/m68k/sun3/sun3ints.c |
1618 |
++++ b/arch/m68k/sun3/sun3ints.c |
1619 |
+@@ -61,8 +61,10 @@ static irqreturn_t sun3_int7(int irq, void *dev_id) |
1620 |
+ |
1621 |
+ static irqreturn_t sun3_int5(int irq, void *dev_id) |
1622 |
+ { |
1623 |
++ unsigned long flags; |
1624 |
+ unsigned int cnt; |
1625 |
+ |
1626 |
++ local_irq_save(flags); |
1627 |
+ #ifdef CONFIG_SUN3 |
1628 |
+ intersil_clear(); |
1629 |
+ #endif |
1630 |
+@@ -76,6 +78,7 @@ static irqreturn_t sun3_int5(int irq, void *dev_id) |
1631 |
+ cnt = kstat_irqs_cpu(irq, 0); |
1632 |
+ if (!(cnt % 20)) |
1633 |
+ sun3_leds(led_pattern[cnt % 160 / 20]); |
1634 |
++ local_irq_restore(flags); |
1635 |
+ return IRQ_HANDLED; |
1636 |
+ } |
1637 |
+ |
1638 |
+diff --git a/arch/m68k/sun3x/time.c b/arch/m68k/sun3x/time.c |
1639 |
+index 047e2bcee3d7..3c8a86d08508 100644 |
1640 |
+--- a/arch/m68k/sun3x/time.c |
1641 |
++++ b/arch/m68k/sun3x/time.c |
1642 |
+@@ -80,15 +80,19 @@ u32 sun3x_gettimeoffset(void) |
1643 |
+ } |
1644 |
+ |
1645 |
+ #if 0 |
1646 |
+-static void sun3x_timer_tick(int irq, void *dev_id, struct pt_regs *regs) |
1647 |
++static irqreturn_t sun3x_timer_tick(int irq, void *dev_id) |
1648 |
+ { |
1649 |
+- void (*vector)(int, void *, struct pt_regs *) = dev_id; |
1650 |
++ irq_handler_t timer_routine = dev_id; |
1651 |
++ unsigned long flags; |
1652 |
+ |
1653 |
+- /* Clear the pending interrupt - pulse the enable line low */ |
1654 |
+- disable_irq(5); |
1655 |
+- enable_irq(5); |
1656 |
++ local_irq_save(flags); |
1657 |
++ /* Clear the pending interrupt - pulse the enable line low */ |
1658 |
++ disable_irq(5); |
1659 |
++ enable_irq(5); |
1660 |
++ timer_routine(0, NULL); |
1661 |
++ local_irq_restore(flags); |
1662 |
+ |
1663 |
+- vector(irq, NULL, regs); |
1664 |
++ return IRQ_HANDLED; |
1665 |
+ } |
1666 |
+ #endif |
1667 |
+ |
1668 |
+diff --git a/arch/mips/bcm63xx/Makefile b/arch/mips/bcm63xx/Makefile |
1669 |
+index c69f297fc1df..d89651e538f6 100644 |
1670 |
+--- a/arch/mips/bcm63xx/Makefile |
1671 |
++++ b/arch/mips/bcm63xx/Makefile |
1672 |
+@@ -1,8 +1,8 @@ |
1673 |
+ # SPDX-License-Identifier: GPL-2.0 |
1674 |
+ obj-y += clk.o cpu.o cs.o gpio.o irq.o nvram.o prom.o reset.o \ |
1675 |
+- setup.o timer.o dev-dsp.o dev-enet.o dev-flash.o \ |
1676 |
+- dev-pcmcia.o dev-rng.o dev-spi.o dev-hsspi.o dev-uart.o \ |
1677 |
+- dev-wdt.o dev-usb-usbd.o |
1678 |
++ setup.o timer.o dev-enet.o dev-flash.o dev-pcmcia.o \ |
1679 |
++ dev-rng.o dev-spi.o dev-hsspi.o dev-uart.o dev-wdt.o \ |
1680 |
++ dev-usb-usbd.o |
1681 |
+ obj-$(CONFIG_EARLY_PRINTK) += early_printk.o |
1682 |
+ |
1683 |
+ obj-y += boards/ |
1684 |
+diff --git a/arch/mips/bcm63xx/boards/board_bcm963xx.c b/arch/mips/bcm63xx/boards/board_bcm963xx.c |
1685 |
+index b2097c0d2ed7..36ec3dc2c999 100644 |
1686 |
+--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c |
1687 |
++++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c |
1688 |
+@@ -23,7 +23,6 @@ |
1689 |
+ #include <bcm63xx_nvram.h> |
1690 |
+ #include <bcm63xx_dev_pci.h> |
1691 |
+ #include <bcm63xx_dev_enet.h> |
1692 |
+-#include <bcm63xx_dev_dsp.h> |
1693 |
+ #include <bcm63xx_dev_flash.h> |
1694 |
+ #include <bcm63xx_dev_hsspi.h> |
1695 |
+ #include <bcm63xx_dev_pcmcia.h> |
1696 |
+@@ -289,14 +288,6 @@ static struct board_info __initdata board_96348gw_10 = { |
1697 |
+ .has_pccard = 1, |
1698 |
+ .has_ehci0 = 1, |
1699 |
+ |
1700 |
+- .has_dsp = 1, |
1701 |
+- .dsp = { |
1702 |
+- .gpio_rst = 6, |
1703 |
+- .gpio_int = 34, |
1704 |
+- .cs = 2, |
1705 |
+- .ext_irq = 2, |
1706 |
+- }, |
1707 |
+- |
1708 |
+ .leds = { |
1709 |
+ { |
1710 |
+ .name = "adsl-fail", |
1711 |
+@@ -401,14 +392,6 @@ static struct board_info __initdata board_96348gw = { |
1712 |
+ |
1713 |
+ .has_ohci0 = 1, |
1714 |
+ |
1715 |
+- .has_dsp = 1, |
1716 |
+- .dsp = { |
1717 |
+- .gpio_rst = 6, |
1718 |
+- .gpio_int = 34, |
1719 |
+- .ext_irq = 2, |
1720 |
+- .cs = 2, |
1721 |
+- }, |
1722 |
+- |
1723 |
+ .leds = { |
1724 |
+ { |
1725 |
+ .name = "adsl-fail", |
1726 |
+@@ -898,9 +881,6 @@ int __init board_register_devices(void) |
1727 |
+ if (board.has_usbd) |
1728 |
+ bcm63xx_usbd_register(&board.usbd); |
1729 |
+ |
1730 |
+- if (board.has_dsp) |
1731 |
+- bcm63xx_dsp_register(&board.dsp); |
1732 |
+- |
1733 |
+ /* Generate MAC address for WLAN and register our SPROM, |
1734 |
+ * do this after registering enet devices |
1735 |
+ */ |
1736 |
+diff --git a/arch/mips/bcm63xx/dev-dsp.c b/arch/mips/bcm63xx/dev-dsp.c |
1737 |
+deleted file mode 100644 |
1738 |
+index 5bb5b154c9bd..000000000000 |
1739 |
+--- a/arch/mips/bcm63xx/dev-dsp.c |
1740 |
++++ /dev/null |
1741 |
+@@ -1,56 +0,0 @@ |
1742 |
+-/* |
1743 |
+- * Broadcom BCM63xx VoIP DSP registration |
1744 |
+- * |
1745 |
+- * This file is subject to the terms and conditions of the GNU General Public |
1746 |
+- * License. See the file "COPYING" in the main directory of this archive |
1747 |
+- * for more details. |
1748 |
+- * |
1749 |
+- * Copyright (C) 2009 Florian Fainelli <florian@×××××××.org> |
1750 |
+- */ |
1751 |
+- |
1752 |
+-#include <linux/init.h> |
1753 |
+-#include <linux/kernel.h> |
1754 |
+-#include <linux/platform_device.h> |
1755 |
+- |
1756 |
+-#include <bcm63xx_cpu.h> |
1757 |
+-#include <bcm63xx_dev_dsp.h> |
1758 |
+-#include <bcm63xx_regs.h> |
1759 |
+-#include <bcm63xx_io.h> |
1760 |
+- |
1761 |
+-static struct resource voip_dsp_resources[] = { |
1762 |
+- { |
1763 |
+- .start = -1, /* filled at runtime */ |
1764 |
+- .end = -1, /* filled at runtime */ |
1765 |
+- .flags = IORESOURCE_MEM, |
1766 |
+- }, |
1767 |
+- { |
1768 |
+- .start = -1, /* filled at runtime */ |
1769 |
+- .flags = IORESOURCE_IRQ, |
1770 |
+- }, |
1771 |
+-}; |
1772 |
+- |
1773 |
+-static struct platform_device bcm63xx_voip_dsp_device = { |
1774 |
+- .name = "bcm63xx-voip-dsp", |
1775 |
+- .id = -1, |
1776 |
+- .num_resources = ARRAY_SIZE(voip_dsp_resources), |
1777 |
+- .resource = voip_dsp_resources, |
1778 |
+-}; |
1779 |
+- |
1780 |
+-int __init bcm63xx_dsp_register(const struct bcm63xx_dsp_platform_data *pd) |
1781 |
+-{ |
1782 |
+- struct bcm63xx_dsp_platform_data *dpd; |
1783 |
+- u32 val; |
1784 |
+- |
1785 |
+- /* Get the memory window */ |
1786 |
+- val = bcm_mpi_readl(MPI_CSBASE_REG(pd->cs - 1)); |
1787 |
+- val &= MPI_CSBASE_BASE_MASK; |
1788 |
+- voip_dsp_resources[0].start = val; |
1789 |
+- voip_dsp_resources[0].end = val + 0xFFFFFFF; |
1790 |
+- voip_dsp_resources[1].start = pd->ext_irq; |
1791 |
+- |
1792 |
+- /* copy given platform data */ |
1793 |
+- dpd = bcm63xx_voip_dsp_device.dev.platform_data; |
1794 |
+- memcpy(dpd, pd, sizeof (*pd)); |
1795 |
+- |
1796 |
+- return platform_device_register(&bcm63xx_voip_dsp_device); |
1797 |
+-} |
1798 |
+diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h |
1799 |
+index 54c730aed327..df1eaa365279 100644 |
1800 |
+--- a/arch/mips/include/asm/io.h |
1801 |
++++ b/arch/mips/include/asm/io.h |
1802 |
+@@ -62,21 +62,11 @@ |
1803 |
+ * instruction, so the lower 16 bits must be zero. Should be true on |
1804 |
+ * on any sane architecture; generic code does not use this assumption. |
1805 |
+ */ |
1806 |
+-extern const unsigned long mips_io_port_base; |
1807 |
++extern unsigned long mips_io_port_base; |
1808 |
+ |
1809 |
+-/* |
1810 |
+- * Gcc will generate code to load the value of mips_io_port_base after each |
1811 |
+- * function call which may be fairly wasteful in some cases. So we don't |
1812 |
+- * play quite by the book. We tell gcc mips_io_port_base is a long variable |
1813 |
+- * which solves the code generation issue. Now we need to violate the |
1814 |
+- * aliasing rules a little to make initialization possible and finally we |
1815 |
+- * will need the barrier() to fight side effects of the aliasing chat. |
1816 |
+- * This trickery will eventually collapse under gcc's optimizer. Oh well. |
1817 |
+- */ |
1818 |
+ static inline void set_io_port_base(unsigned long base) |
1819 |
+ { |
1820 |
+- * (unsigned long *) &mips_io_port_base = base; |
1821 |
+- barrier(); |
1822 |
++ mips_io_port_base = base; |
1823 |
+ } |
1824 |
+ |
1825 |
+ /* |
1826 |
+diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_dsp.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_dsp.h |
1827 |
+deleted file mode 100644 |
1828 |
+index 4e4970787371..000000000000 |
1829 |
+--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_dsp.h |
1830 |
++++ /dev/null |
1831 |
+@@ -1,14 +0,0 @@ |
1832 |
+-/* SPDX-License-Identifier: GPL-2.0 */ |
1833 |
+-#ifndef __BCM63XX_DSP_H |
1834 |
+-#define __BCM63XX_DSP_H |
1835 |
+- |
1836 |
+-struct bcm63xx_dsp_platform_data { |
1837 |
+- unsigned gpio_rst; |
1838 |
+- unsigned gpio_int; |
1839 |
+- unsigned cs; |
1840 |
+- unsigned ext_irq; |
1841 |
+-}; |
1842 |
+- |
1843 |
+-int __init bcm63xx_dsp_register(const struct bcm63xx_dsp_platform_data *pd); |
1844 |
+- |
1845 |
+-#endif /* __BCM63XX_DSP_H */ |
1846 |
+diff --git a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h |
1847 |
+index 5e5b1bc4a324..830f53f28e3f 100644 |
1848 |
+--- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h |
1849 |
++++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h |
1850 |
+@@ -7,7 +7,6 @@ |
1851 |
+ #include <linux/leds.h> |
1852 |
+ #include <bcm63xx_dev_enet.h> |
1853 |
+ #include <bcm63xx_dev_usb_usbd.h> |
1854 |
+-#include <bcm63xx_dev_dsp.h> |
1855 |
+ |
1856 |
+ /* |
1857 |
+ * flash mapping |
1858 |
+@@ -31,7 +30,6 @@ struct board_info { |
1859 |
+ unsigned int has_ohci0:1; |
1860 |
+ unsigned int has_ehci0:1; |
1861 |
+ unsigned int has_usbd:1; |
1862 |
+- unsigned int has_dsp:1; |
1863 |
+ unsigned int has_uart0:1; |
1864 |
+ unsigned int has_uart1:1; |
1865 |
+ |
1866 |
+@@ -43,9 +41,6 @@ struct board_info { |
1867 |
+ /* USB config */ |
1868 |
+ struct bcm63xx_usbd_platform_data usbd; |
1869 |
+ |
1870 |
+- /* DSP config */ |
1871 |
+- struct bcm63xx_dsp_platform_data dsp; |
1872 |
+- |
1873 |
+ /* GPIO LEDs */ |
1874 |
+ struct gpio_led leds[5]; |
1875 |
+ |
1876 |
+diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c |
1877 |
+index 8aaaa42f91ed..e87c98b8a72c 100644 |
1878 |
+--- a/arch/mips/kernel/setup.c |
1879 |
++++ b/arch/mips/kernel/setup.c |
1880 |
+@@ -76,7 +76,7 @@ static char __initdata builtin_cmdline[COMMAND_LINE_SIZE] = CONFIG_CMDLINE; |
1881 |
+ * mips_io_port_base is the begin of the address space to which x86 style |
1882 |
+ * I/O ports are mapped. |
1883 |
+ */ |
1884 |
+-const unsigned long mips_io_port_base = -1; |
1885 |
++unsigned long mips_io_port_base = -1; |
1886 |
+ EXPORT_SYMBOL(mips_io_port_base); |
1887 |
+ |
1888 |
+ static struct resource code_resource = { .name = "Kernel code", }; |
1889 |
+diff --git a/arch/nios2/kernel/nios2_ksyms.c b/arch/nios2/kernel/nios2_ksyms.c |
1890 |
+index bf2f55d10a4d..4e704046a150 100644 |
1891 |
+--- a/arch/nios2/kernel/nios2_ksyms.c |
1892 |
++++ b/arch/nios2/kernel/nios2_ksyms.c |
1893 |
+@@ -9,12 +9,20 @@ |
1894 |
+ #include <linux/export.h> |
1895 |
+ #include <linux/string.h> |
1896 |
+ |
1897 |
++#include <asm/cacheflush.h> |
1898 |
++#include <asm/pgtable.h> |
1899 |
++ |
1900 |
+ /* string functions */ |
1901 |
+ |
1902 |
+ EXPORT_SYMBOL(memcpy); |
1903 |
+ EXPORT_SYMBOL(memset); |
1904 |
+ EXPORT_SYMBOL(memmove); |
1905 |
+ |
1906 |
++/* memory management */ |
1907 |
++ |
1908 |
++EXPORT_SYMBOL(empty_zero_page); |
1909 |
++EXPORT_SYMBOL(flush_icache_range); |
1910 |
++ |
1911 |
+ /* |
1912 |
+ * libgcc functions - functions that are used internally by the |
1913 |
+ * compiler... (prototypes are not correct though, but that |
1914 |
+@@ -31,3 +39,7 @@ DECLARE_EXPORT(__udivsi3); |
1915 |
+ DECLARE_EXPORT(__umoddi3); |
1916 |
+ DECLARE_EXPORT(__umodsi3); |
1917 |
+ DECLARE_EXPORT(__muldi3); |
1918 |
++DECLARE_EXPORT(__ucmpdi2); |
1919 |
++DECLARE_EXPORT(__lshrdi3); |
1920 |
++DECLARE_EXPORT(__ashldi3); |
1921 |
++DECLARE_EXPORT(__ashrdi3); |
1922 |
+diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile |
1923 |
+index e43321f46a3b..8954108df457 100644 |
1924 |
+--- a/arch/powerpc/Makefile |
1925 |
++++ b/arch/powerpc/Makefile |
1926 |
+@@ -412,7 +412,9 @@ vdso_install: |
1927 |
+ ifdef CONFIG_PPC64 |
1928 |
+ $(Q)$(MAKE) $(build)=arch/$(ARCH)/kernel/vdso64 $@ |
1929 |
+ endif |
1930 |
++ifdef CONFIG_VDSO32 |
1931 |
+ $(Q)$(MAKE) $(build)=arch/$(ARCH)/kernel/vdso32 $@ |
1932 |
++endif |
1933 |
+ |
1934 |
+ archclean: |
1935 |
+ $(Q)$(MAKE) $(clean)=$(boot) |
1936 |
+diff --git a/arch/powerpc/include/asm/archrandom.h b/arch/powerpc/include/asm/archrandom.h |
1937 |
+index 9c63b596e6ce..a09595f00cab 100644 |
1938 |
+--- a/arch/powerpc/include/asm/archrandom.h |
1939 |
++++ b/arch/powerpc/include/asm/archrandom.h |
1940 |
+@@ -28,7 +28,7 @@ static inline int arch_get_random_seed_int(unsigned int *v) |
1941 |
+ unsigned long val; |
1942 |
+ int rc; |
1943 |
+ |
1944 |
+- rc = arch_get_random_long(&val); |
1945 |
++ rc = arch_get_random_seed_long(&val); |
1946 |
+ if (rc) |
1947 |
+ *v = val; |
1948 |
+ |
1949 |
+diff --git a/arch/powerpc/include/asm/kgdb.h b/arch/powerpc/include/asm/kgdb.h |
1950 |
+index 9db24e77b9f4..a9e098a3b881 100644 |
1951 |
+--- a/arch/powerpc/include/asm/kgdb.h |
1952 |
++++ b/arch/powerpc/include/asm/kgdb.h |
1953 |
+@@ -26,9 +26,12 @@ |
1954 |
+ #define BREAK_INSTR_SIZE 4 |
1955 |
+ #define BUFMAX ((NUMREGBYTES * 2) + 512) |
1956 |
+ #define OUTBUFMAX ((NUMREGBYTES * 2) + 512) |
1957 |
++ |
1958 |
++#define BREAK_INSTR 0x7d821008 /* twge r2, r2 */ |
1959 |
++ |
1960 |
+ static inline void arch_kgdb_breakpoint(void) |
1961 |
+ { |
1962 |
+- asm(".long 0x7d821008"); /* twge r2, r2 */ |
1963 |
++ asm(stringify_in_c(.long BREAK_INSTR)); |
1964 |
+ } |
1965 |
+ #define CACHE_FLUSH_IS_SAFE 1 |
1966 |
+ #define DBG_MAX_REG_NUM 70 |
1967 |
+diff --git a/arch/powerpc/kernel/cacheinfo.c b/arch/powerpc/kernel/cacheinfo.c |
1968 |
+index a8f20e5928e1..9edb45430133 100644 |
1969 |
+--- a/arch/powerpc/kernel/cacheinfo.c |
1970 |
++++ b/arch/powerpc/kernel/cacheinfo.c |
1971 |
+@@ -865,4 +865,25 @@ void cacheinfo_cpu_offline(unsigned int cpu_id) |
1972 |
+ if (cache) |
1973 |
+ cache_cpu_clear(cache, cpu_id); |
1974 |
+ } |
1975 |
++ |
1976 |
++void cacheinfo_teardown(void) |
1977 |
++{ |
1978 |
++ unsigned int cpu; |
1979 |
++ |
1980 |
++ lockdep_assert_cpus_held(); |
1981 |
++ |
1982 |
++ for_each_online_cpu(cpu) |
1983 |
++ cacheinfo_cpu_offline(cpu); |
1984 |
++} |
1985 |
++ |
1986 |
++void cacheinfo_rebuild(void) |
1987 |
++{ |
1988 |
++ unsigned int cpu; |
1989 |
++ |
1990 |
++ lockdep_assert_cpus_held(); |
1991 |
++ |
1992 |
++ for_each_online_cpu(cpu) |
1993 |
++ cacheinfo_cpu_online(cpu); |
1994 |
++} |
1995 |
++ |
1996 |
+ #endif /* (CONFIG_PPC_PSERIES && CONFIG_SUSPEND) || CONFIG_HOTPLUG_CPU */ |
1997 |
+diff --git a/arch/powerpc/kernel/cacheinfo.h b/arch/powerpc/kernel/cacheinfo.h |
1998 |
+index 955f5e999f1b..52bd3fc6642d 100644 |
1999 |
+--- a/arch/powerpc/kernel/cacheinfo.h |
2000 |
++++ b/arch/powerpc/kernel/cacheinfo.h |
2001 |
+@@ -6,4 +6,8 @@ |
2002 |
+ extern void cacheinfo_cpu_online(unsigned int cpu_id); |
2003 |
+ extern void cacheinfo_cpu_offline(unsigned int cpu_id); |
2004 |
+ |
2005 |
++/* Allow migration/suspend to tear down and rebuild the hierarchy. */ |
2006 |
++extern void cacheinfo_teardown(void); |
2007 |
++extern void cacheinfo_rebuild(void); |
2008 |
++ |
2009 |
+ #endif /* _PPC_CACHEINFO_H */ |
2010 |
+diff --git a/arch/powerpc/kernel/dt_cpu_ftrs.c b/arch/powerpc/kernel/dt_cpu_ftrs.c |
2011 |
+index c6f41907f0d7..a4b31e17492d 100644 |
2012 |
+--- a/arch/powerpc/kernel/dt_cpu_ftrs.c |
2013 |
++++ b/arch/powerpc/kernel/dt_cpu_ftrs.c |
2014 |
+@@ -666,8 +666,10 @@ static bool __init cpufeatures_process_feature(struct dt_cpu_feature *f) |
2015 |
+ m = &dt_cpu_feature_match_table[i]; |
2016 |
+ if (!strcmp(f->name, m->name)) { |
2017 |
+ known = true; |
2018 |
+- if (m->enable(f)) |
2019 |
++ if (m->enable(f)) { |
2020 |
++ cur_cpu_spec->cpu_features |= m->cpu_ftr_bit_mask; |
2021 |
+ break; |
2022 |
++ } |
2023 |
+ |
2024 |
+ pr_info("not enabling: %s (disabled or unsupported by kernel)\n", |
2025 |
+ f->name); |
2026 |
+@@ -675,17 +677,12 @@ static bool __init cpufeatures_process_feature(struct dt_cpu_feature *f) |
2027 |
+ } |
2028 |
+ } |
2029 |
+ |
2030 |
+- if (!known && enable_unknown) { |
2031 |
+- if (!feat_try_enable_unknown(f)) { |
2032 |
+- pr_info("not enabling: %s (unknown and unsupported by kernel)\n", |
2033 |
+- f->name); |
2034 |
+- return false; |
2035 |
+- } |
2036 |
++ if (!known && (!enable_unknown || !feat_try_enable_unknown(f))) { |
2037 |
++ pr_info("not enabling: %s (unknown and unsupported by kernel)\n", |
2038 |
++ f->name); |
2039 |
++ return false; |
2040 |
+ } |
2041 |
+ |
2042 |
+- if (m->cpu_ftr_bit_mask) |
2043 |
+- cur_cpu_spec->cpu_features |= m->cpu_ftr_bit_mask; |
2044 |
+- |
2045 |
+ if (known) |
2046 |
+ pr_debug("enabling: %s\n", f->name); |
2047 |
+ else |
2048 |
+diff --git a/arch/powerpc/kernel/kgdb.c b/arch/powerpc/kernel/kgdb.c |
2049 |
+index 35e240a0a408..59c578f865aa 100644 |
2050 |
+--- a/arch/powerpc/kernel/kgdb.c |
2051 |
++++ b/arch/powerpc/kernel/kgdb.c |
2052 |
+@@ -24,6 +24,7 @@ |
2053 |
+ #include <asm/processor.h> |
2054 |
+ #include <asm/machdep.h> |
2055 |
+ #include <asm/debug.h> |
2056 |
++#include <asm/code-patching.h> |
2057 |
+ #include <linux/slab.h> |
2058 |
+ |
2059 |
+ /* |
2060 |
+@@ -144,7 +145,7 @@ static int kgdb_handle_breakpoint(struct pt_regs *regs) |
2061 |
+ if (kgdb_handle_exception(1, SIGTRAP, 0, regs) != 0) |
2062 |
+ return 0; |
2063 |
+ |
2064 |
+- if (*(u32 *) (regs->nip) == *(u32 *) (&arch_kgdb_ops.gdb_bpt_instr)) |
2065 |
++ if (*(u32 *)regs->nip == BREAK_INSTR) |
2066 |
+ regs->nip += BREAK_INSTR_SIZE; |
2067 |
+ |
2068 |
+ return 1; |
2069 |
+@@ -441,16 +442,42 @@ int kgdb_arch_handle_exception(int vector, int signo, int err_code, |
2070 |
+ return -1; |
2071 |
+ } |
2072 |
+ |
2073 |
++int kgdb_arch_set_breakpoint(struct kgdb_bkpt *bpt) |
2074 |
++{ |
2075 |
++ int err; |
2076 |
++ unsigned int instr; |
2077 |
++ unsigned int *addr = (unsigned int *)bpt->bpt_addr; |
2078 |
++ |
2079 |
++ err = probe_kernel_address(addr, instr); |
2080 |
++ if (err) |
2081 |
++ return err; |
2082 |
++ |
2083 |
++ err = patch_instruction(addr, BREAK_INSTR); |
2084 |
++ if (err) |
2085 |
++ return -EFAULT; |
2086 |
++ |
2087 |
++ *(unsigned int *)bpt->saved_instr = instr; |
2088 |
++ |
2089 |
++ return 0; |
2090 |
++} |
2091 |
++ |
2092 |
++int kgdb_arch_remove_breakpoint(struct kgdb_bkpt *bpt) |
2093 |
++{ |
2094 |
++ int err; |
2095 |
++ unsigned int instr = *(unsigned int *)bpt->saved_instr; |
2096 |
++ unsigned int *addr = (unsigned int *)bpt->bpt_addr; |
2097 |
++ |
2098 |
++ err = patch_instruction(addr, instr); |
2099 |
++ if (err) |
2100 |
++ return -EFAULT; |
2101 |
++ |
2102 |
++ return 0; |
2103 |
++} |
2104 |
++ |
2105 |
+ /* |
2106 |
+ * Global data |
2107 |
+ */ |
2108 |
+-struct kgdb_arch arch_kgdb_ops = { |
2109 |
+-#ifdef __LITTLE_ENDIAN__ |
2110 |
+- .gdb_bpt_instr = {0x08, 0x10, 0x82, 0x7d}, |
2111 |
+-#else |
2112 |
+- .gdb_bpt_instr = {0x7d, 0x82, 0x10, 0x08}, |
2113 |
+-#endif |
2114 |
+-}; |
2115 |
++struct kgdb_arch arch_kgdb_ops; |
2116 |
+ |
2117 |
+ static int kgdb_not_implemented(struct pt_regs *regs) |
2118 |
+ { |
2119 |
+diff --git a/arch/powerpc/kernel/mce_power.c b/arch/powerpc/kernel/mce_power.c |
2120 |
+index 37a110b8e7e1..ecb375040637 100644 |
2121 |
+--- a/arch/powerpc/kernel/mce_power.c |
2122 |
++++ b/arch/powerpc/kernel/mce_power.c |
2123 |
+@@ -40,7 +40,7 @@ static unsigned long addr_to_pfn(struct pt_regs *regs, unsigned long addr) |
2124 |
+ { |
2125 |
+ pte_t *ptep; |
2126 |
+ unsigned int shift; |
2127 |
+- unsigned long flags; |
2128 |
++ unsigned long pfn, flags; |
2129 |
+ struct mm_struct *mm; |
2130 |
+ |
2131 |
+ if (user_mode(regs)) |
2132 |
+@@ -50,18 +50,22 @@ static unsigned long addr_to_pfn(struct pt_regs *regs, unsigned long addr) |
2133 |
+ |
2134 |
+ local_irq_save(flags); |
2135 |
+ ptep = __find_linux_pte(mm->pgd, addr, NULL, &shift); |
2136 |
+- local_irq_restore(flags); |
2137 |
+ |
2138 |
+- if (!ptep || pte_special(*ptep)) |
2139 |
+- return ULONG_MAX; |
2140 |
++ if (!ptep || pte_special(*ptep)) { |
2141 |
++ pfn = ULONG_MAX; |
2142 |
++ goto out; |
2143 |
++ } |
2144 |
+ |
2145 |
+- if (shift > PAGE_SHIFT) { |
2146 |
++ if (shift <= PAGE_SHIFT) |
2147 |
++ pfn = pte_pfn(*ptep); |
2148 |
++ else { |
2149 |
+ unsigned long rpnmask = (1ul << shift) - PAGE_SIZE; |
2150 |
+- |
2151 |
+- return pte_pfn(__pte(pte_val(*ptep) | (addr & rpnmask))); |
2152 |
++ pfn = pte_pfn(__pte(pte_val(*ptep) | (addr & rpnmask))); |
2153 |
+ } |
2154 |
+ |
2155 |
+- return pte_pfn(*ptep); |
2156 |
++out: |
2157 |
++ local_irq_restore(flags); |
2158 |
++ return pfn; |
2159 |
+ } |
2160 |
+ |
2161 |
+ /* flush SLBs and reload */ |
2162 |
+diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c |
2163 |
+index 9b38a2e5dd35..af1e38febe49 100644 |
2164 |
+--- a/arch/powerpc/kernel/prom_init.c |
2165 |
++++ b/arch/powerpc/kernel/prom_init.c |
2166 |
+@@ -904,7 +904,7 @@ struct ibm_arch_vec __cacheline_aligned ibm_architecture_vec = { |
2167 |
+ .reserved2 = 0, |
2168 |
+ .reserved3 = 0, |
2169 |
+ .subprocessors = 1, |
2170 |
+- .byte22 = OV5_FEAT(OV5_DRMEM_V2), |
2171 |
++ .byte22 = OV5_FEAT(OV5_DRMEM_V2) | OV5_FEAT(OV5_DRC_INFO), |
2172 |
+ .intarch = 0, |
2173 |
+ .mmu = 0, |
2174 |
+ .hash_ext = 0, |
2175 |
+diff --git a/arch/powerpc/kvm/book3s_64_vio.c b/arch/powerpc/kvm/book3s_64_vio.c |
2176 |
+index 65486c3d029b..26b03af71abd 100644 |
2177 |
+--- a/arch/powerpc/kvm/book3s_64_vio.c |
2178 |
++++ b/arch/powerpc/kvm/book3s_64_vio.c |
2179 |
+@@ -133,7 +133,6 @@ extern void kvm_spapr_tce_release_iommu_group(struct kvm *kvm, |
2180 |
+ continue; |
2181 |
+ |
2182 |
+ kref_put(&stit->kref, kvm_spapr_tce_liobn_put); |
2183 |
+- return; |
2184 |
+ } |
2185 |
+ } |
2186 |
+ } |
2187 |
+diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c |
2188 |
+index 3ae3e8d141e3..dbfe32327212 100644 |
2189 |
+--- a/arch/powerpc/kvm/book3s_hv.c |
2190 |
++++ b/arch/powerpc/kvm/book3s_hv.c |
2191 |
+@@ -2993,25 +2993,26 @@ static noinline void kvmppc_run_core(struct kvmppc_vcore *vc) |
2192 |
+ } |
2193 |
+ } |
2194 |
+ |
2195 |
+- /* |
2196 |
+- * Interrupts will be enabled once we get into the guest, |
2197 |
+- * so tell lockdep that we're about to enable interrupts. |
2198 |
+- */ |
2199 |
+- trace_hardirqs_on(); |
2200 |
+- |
2201 |
+ guest_enter_irqoff(); |
2202 |
+ |
2203 |
+ srcu_idx = srcu_read_lock(&vc->kvm->srcu); |
2204 |
+ |
2205 |
+ this_cpu_disable_ftrace(); |
2206 |
+ |
2207 |
++ /* |
2208 |
++ * Interrupts will be enabled once we get into the guest, |
2209 |
++ * so tell lockdep that we're about to enable interrupts. |
2210 |
++ */ |
2211 |
++ trace_hardirqs_on(); |
2212 |
++ |
2213 |
+ trap = __kvmppc_vcore_entry(); |
2214 |
+ |
2215 |
++ trace_hardirqs_off(); |
2216 |
++ |
2217 |
+ this_cpu_enable_ftrace(); |
2218 |
+ |
2219 |
+ srcu_read_unlock(&vc->kvm->srcu, srcu_idx); |
2220 |
+ |
2221 |
+- trace_hardirqs_off(); |
2222 |
+ set_irq_happened(trap); |
2223 |
+ |
2224 |
+ spin_lock(&vc->lock); |
2225 |
+diff --git a/arch/powerpc/mm/dump_hashpagetable.c b/arch/powerpc/mm/dump_hashpagetable.c |
2226 |
+index 869294695048..b430e4e08af6 100644 |
2227 |
+--- a/arch/powerpc/mm/dump_hashpagetable.c |
2228 |
++++ b/arch/powerpc/mm/dump_hashpagetable.c |
2229 |
+@@ -342,7 +342,7 @@ static unsigned long hpte_find(struct pg_state *st, unsigned long ea, int psize) |
2230 |
+ |
2231 |
+ /* Look in secondary table */ |
2232 |
+ if (slot == -1) |
2233 |
+- slot = base_hpte_find(ea, psize, true, &v, &r); |
2234 |
++ slot = base_hpte_find(ea, psize, false, &v, &r); |
2235 |
+ |
2236 |
+ /* No entry found */ |
2237 |
+ if (slot == -1) |
2238 |
+diff --git a/arch/powerpc/mm/pgtable-radix.c b/arch/powerpc/mm/pgtable-radix.c |
2239 |
+index 69caeb5bccb2..5404a631d583 100644 |
2240 |
+--- a/arch/powerpc/mm/pgtable-radix.c |
2241 |
++++ b/arch/powerpc/mm/pgtable-radix.c |
2242 |
+@@ -717,8 +717,8 @@ static int __meminit stop_machine_change_mapping(void *data) |
2243 |
+ |
2244 |
+ spin_unlock(&init_mm.page_table_lock); |
2245 |
+ pte_clear(&init_mm, params->aligned_start, params->pte); |
2246 |
+- create_physical_mapping(params->aligned_start, params->start, -1); |
2247 |
+- create_physical_mapping(params->end, params->aligned_end, -1); |
2248 |
++ create_physical_mapping(__pa(params->aligned_start), __pa(params->start), -1); |
2249 |
++ create_physical_mapping(__pa(params->end), __pa(params->aligned_end), -1); |
2250 |
+ spin_lock(&init_mm.page_table_lock); |
2251 |
+ return 0; |
2252 |
+ } |
2253 |
+diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c |
2254 |
+index 7f86bc3eaade..62d3c72cd931 100644 |
2255 |
+--- a/arch/powerpc/platforms/pseries/hotplug-memory.c |
2256 |
++++ b/arch/powerpc/platforms/pseries/hotplug-memory.c |
2257 |
+@@ -101,11 +101,12 @@ static struct property *dlpar_clone_property(struct property *prop, |
2258 |
+ return new_prop; |
2259 |
+ } |
2260 |
+ |
2261 |
+-static u32 find_aa_index(struct device_node *dr_node, |
2262 |
+- struct property *ala_prop, const u32 *lmb_assoc) |
2263 |
++static bool find_aa_index(struct device_node *dr_node, |
2264 |
++ struct property *ala_prop, |
2265 |
++ const u32 *lmb_assoc, u32 *aa_index) |
2266 |
+ { |
2267 |
+- u32 *assoc_arrays; |
2268 |
+- u32 aa_index; |
2269 |
++ u32 *assoc_arrays, new_prop_size; |
2270 |
++ struct property *new_prop; |
2271 |
+ int aa_arrays, aa_array_entries, aa_array_sz; |
2272 |
+ int i, index; |
2273 |
+ |
2274 |
+@@ -121,46 +122,39 @@ static u32 find_aa_index(struct device_node *dr_node, |
2275 |
+ aa_array_entries = be32_to_cpu(assoc_arrays[1]); |
2276 |
+ aa_array_sz = aa_array_entries * sizeof(u32); |
2277 |
+ |
2278 |
+- aa_index = -1; |
2279 |
+ for (i = 0; i < aa_arrays; i++) { |
2280 |
+ index = (i * aa_array_entries) + 2; |
2281 |
+ |
2282 |
+ if (memcmp(&assoc_arrays[index], &lmb_assoc[1], aa_array_sz)) |
2283 |
+ continue; |
2284 |
+ |
2285 |
+- aa_index = i; |
2286 |
+- break; |
2287 |
++ *aa_index = i; |
2288 |
++ return true; |
2289 |
+ } |
2290 |
+ |
2291 |
+- if (aa_index == -1) { |
2292 |
+- struct property *new_prop; |
2293 |
+- u32 new_prop_size; |
2294 |
+- |
2295 |
+- new_prop_size = ala_prop->length + aa_array_sz; |
2296 |
+- new_prop = dlpar_clone_property(ala_prop, new_prop_size); |
2297 |
+- if (!new_prop) |
2298 |
+- return -1; |
2299 |
+- |
2300 |
+- assoc_arrays = new_prop->value; |
2301 |
++ new_prop_size = ala_prop->length + aa_array_sz; |
2302 |
++ new_prop = dlpar_clone_property(ala_prop, new_prop_size); |
2303 |
++ if (!new_prop) |
2304 |
++ return false; |
2305 |
+ |
2306 |
+- /* increment the number of entries in the lookup array */ |
2307 |
+- assoc_arrays[0] = cpu_to_be32(aa_arrays + 1); |
2308 |
++ assoc_arrays = new_prop->value; |
2309 |
+ |
2310 |
+- /* copy the new associativity into the lookup array */ |
2311 |
+- index = aa_arrays * aa_array_entries + 2; |
2312 |
+- memcpy(&assoc_arrays[index], &lmb_assoc[1], aa_array_sz); |
2313 |
++ /* increment the number of entries in the lookup array */ |
2314 |
++ assoc_arrays[0] = cpu_to_be32(aa_arrays + 1); |
2315 |
+ |
2316 |
+- of_update_property(dr_node, new_prop); |
2317 |
++ /* copy the new associativity into the lookup array */ |
2318 |
++ index = aa_arrays * aa_array_entries + 2; |
2319 |
++ memcpy(&assoc_arrays[index], &lmb_assoc[1], aa_array_sz); |
2320 |
+ |
2321 |
+- /* |
2322 |
+- * The associativity lookup array index for this lmb is |
2323 |
+- * number of entries - 1 since we added its associativity |
2324 |
+- * to the end of the lookup array. |
2325 |
+- */ |
2326 |
+- aa_index = be32_to_cpu(assoc_arrays[0]) - 1; |
2327 |
+- } |
2328 |
++ of_update_property(dr_node, new_prop); |
2329 |
+ |
2330 |
+- return aa_index; |
2331 |
++ /* |
2332 |
++ * The associativity lookup array index for this lmb is |
2333 |
++ * number of entries - 1 since we added its associativity |
2334 |
++ * to the end of the lookup array. |
2335 |
++ */ |
2336 |
++ *aa_index = be32_to_cpu(assoc_arrays[0]) - 1; |
2337 |
++ return true; |
2338 |
+ } |
2339 |
+ |
2340 |
+ static int update_lmb_associativity_index(struct drmem_lmb *lmb) |
2341 |
+@@ -169,6 +163,7 @@ static int update_lmb_associativity_index(struct drmem_lmb *lmb) |
2342 |
+ struct property *ala_prop; |
2343 |
+ const u32 *lmb_assoc; |
2344 |
+ u32 aa_index; |
2345 |
++ bool found; |
2346 |
+ |
2347 |
+ parent = of_find_node_by_path("/"); |
2348 |
+ if (!parent) |
2349 |
+@@ -200,12 +195,12 @@ static int update_lmb_associativity_index(struct drmem_lmb *lmb) |
2350 |
+ return -ENODEV; |
2351 |
+ } |
2352 |
+ |
2353 |
+- aa_index = find_aa_index(dr_node, ala_prop, lmb_assoc); |
2354 |
++ found = find_aa_index(dr_node, ala_prop, lmb_assoc, &aa_index); |
2355 |
+ |
2356 |
+ of_node_put(dr_node); |
2357 |
+ dlpar_free_cc_nodes(lmb_node); |
2358 |
+ |
2359 |
+- if (aa_index < 0) { |
2360 |
++ if (!found) { |
2361 |
+ pr_err("Could not find LMB associativity\n"); |
2362 |
+ return -1; |
2363 |
+ } |
2364 |
+diff --git a/arch/powerpc/platforms/pseries/mobility.c b/arch/powerpc/platforms/pseries/mobility.c |
2365 |
+index e4ea71383383..70744b4fbd9e 100644 |
2366 |
+--- a/arch/powerpc/platforms/pseries/mobility.c |
2367 |
++++ b/arch/powerpc/platforms/pseries/mobility.c |
2368 |
+@@ -24,6 +24,7 @@ |
2369 |
+ #include <asm/machdep.h> |
2370 |
+ #include <asm/rtas.h> |
2371 |
+ #include "pseries.h" |
2372 |
++#include "../../kernel/cacheinfo.h" |
2373 |
+ |
2374 |
+ static struct kobject *mobility_kobj; |
2375 |
+ |
2376 |
+@@ -360,11 +361,20 @@ void post_mobility_fixup(void) |
2377 |
+ */ |
2378 |
+ cpus_read_lock(); |
2379 |
+ |
2380 |
++ /* |
2381 |
++ * It's common for the destination firmware to replace cache |
2382 |
++ * nodes. Release all of the cacheinfo hierarchy's references |
2383 |
++ * before updating the device tree. |
2384 |
++ */ |
2385 |
++ cacheinfo_teardown(); |
2386 |
++ |
2387 |
+ rc = pseries_devicetree_update(MIGRATION_SCOPE); |
2388 |
+ if (rc) |
2389 |
+ printk(KERN_ERR "Post-mobility device tree update " |
2390 |
+ "failed: %d\n", rc); |
2391 |
+ |
2392 |
++ cacheinfo_rebuild(); |
2393 |
++ |
2394 |
+ cpus_read_unlock(); |
2395 |
+ |
2396 |
+ /* Possibly switch to a new RFI flush type */ |
2397 |
+diff --git a/arch/s390/kernel/kexec_elf.c b/arch/s390/kernel/kexec_elf.c |
2398 |
+index 602e7cc26d11..5cf340b778f1 100644 |
2399 |
+--- a/arch/s390/kernel/kexec_elf.c |
2400 |
++++ b/arch/s390/kernel/kexec_elf.c |
2401 |
+@@ -58,7 +58,7 @@ static int kexec_file_add_elf_kernel(struct kimage *image, |
2402 |
+ if (ret) |
2403 |
+ return ret; |
2404 |
+ |
2405 |
+- data->memsz += buf.memsz; |
2406 |
++ data->memsz = ALIGN(data->memsz, phdr->p_align) + buf.memsz; |
2407 |
+ } |
2408 |
+ |
2409 |
+ return 0; |
2410 |
+diff --git a/arch/sh/boards/mach-migor/setup.c b/arch/sh/boards/mach-migor/setup.c |
2411 |
+index 254f2c662703..6cd3cd468047 100644 |
2412 |
+--- a/arch/sh/boards/mach-migor/setup.c |
2413 |
++++ b/arch/sh/boards/mach-migor/setup.c |
2414 |
+@@ -5,6 +5,7 @@ |
2415 |
+ * Copyright (C) 2008 Magnus Damm |
2416 |
+ */ |
2417 |
+ #include <linux/clkdev.h> |
2418 |
++#include <linux/dma-mapping.h> |
2419 |
+ #include <linux/init.h> |
2420 |
+ #include <linux/platform_device.h> |
2421 |
+ #include <linux/interrupt.h> |
2422 |
+diff --git a/arch/um/drivers/chan_kern.c b/arch/um/drivers/chan_kern.c |
2423 |
+index 05588f9466c7..13ba195f9c9c 100644 |
2424 |
+--- a/arch/um/drivers/chan_kern.c |
2425 |
++++ b/arch/um/drivers/chan_kern.c |
2426 |
+@@ -171,19 +171,55 @@ int enable_chan(struct line *line) |
2427 |
+ return err; |
2428 |
+ } |
2429 |
+ |
2430 |
++/* Items are added in IRQ context, when free_irq can't be called, and |
2431 |
++ * removed in process context, when it can. |
2432 |
++ * This handles interrupt sources which disappear, and which need to |
2433 |
++ * be permanently disabled. This is discovered in IRQ context, but |
2434 |
++ * the freeing of the IRQ must be done later. |
2435 |
++ */ |
2436 |
++static DEFINE_SPINLOCK(irqs_to_free_lock); |
2437 |
++static LIST_HEAD(irqs_to_free); |
2438 |
++ |
2439 |
++void free_irqs(void) |
2440 |
++{ |
2441 |
++ struct chan *chan; |
2442 |
++ LIST_HEAD(list); |
2443 |
++ struct list_head *ele; |
2444 |
++ unsigned long flags; |
2445 |
++ |
2446 |
++ spin_lock_irqsave(&irqs_to_free_lock, flags); |
2447 |
++ list_splice_init(&irqs_to_free, &list); |
2448 |
++ spin_unlock_irqrestore(&irqs_to_free_lock, flags); |
2449 |
++ |
2450 |
++ list_for_each(ele, &list) { |
2451 |
++ chan = list_entry(ele, struct chan, free_list); |
2452 |
++ |
2453 |
++ if (chan->input && chan->enabled) |
2454 |
++ um_free_irq(chan->line->driver->read_irq, chan); |
2455 |
++ if (chan->output && chan->enabled) |
2456 |
++ um_free_irq(chan->line->driver->write_irq, chan); |
2457 |
++ chan->enabled = 0; |
2458 |
++ } |
2459 |
++} |
2460 |
++ |
2461 |
+ static void close_one_chan(struct chan *chan, int delay_free_irq) |
2462 |
+ { |
2463 |
++ unsigned long flags; |
2464 |
++ |
2465 |
+ if (!chan->opened) |
2466 |
+ return; |
2467 |
+ |
2468 |
+- /* we can safely call free now - it will be marked |
2469 |
+- * as free and freed once the IRQ stopped processing |
2470 |
+- */ |
2471 |
+- if (chan->input && chan->enabled) |
2472 |
+- um_free_irq(chan->line->driver->read_irq, chan); |
2473 |
+- if (chan->output && chan->enabled) |
2474 |
+- um_free_irq(chan->line->driver->write_irq, chan); |
2475 |
+- chan->enabled = 0; |
2476 |
++ if (delay_free_irq) { |
2477 |
++ spin_lock_irqsave(&irqs_to_free_lock, flags); |
2478 |
++ list_add(&chan->free_list, &irqs_to_free); |
2479 |
++ spin_unlock_irqrestore(&irqs_to_free_lock, flags); |
2480 |
++ } else { |
2481 |
++ if (chan->input && chan->enabled) |
2482 |
++ um_free_irq(chan->line->driver->read_irq, chan); |
2483 |
++ if (chan->output && chan->enabled) |
2484 |
++ um_free_irq(chan->line->driver->write_irq, chan); |
2485 |
++ chan->enabled = 0; |
2486 |
++ } |
2487 |
+ if (chan->ops->close != NULL) |
2488 |
+ (*chan->ops->close)(chan->fd, chan->data); |
2489 |
+ |
2490 |
+diff --git a/arch/um/include/asm/irq.h b/arch/um/include/asm/irq.h |
2491 |
+index 49ed3e35b35a..ce7a78c3bcf2 100644 |
2492 |
+--- a/arch/um/include/asm/irq.h |
2493 |
++++ b/arch/um/include/asm/irq.h |
2494 |
+@@ -23,7 +23,7 @@ |
2495 |
+ #define VECTOR_BASE_IRQ 15 |
2496 |
+ #define VECTOR_IRQ_SPACE 8 |
2497 |
+ |
2498 |
+-#define LAST_IRQ (VECTOR_IRQ_SPACE + VECTOR_BASE_IRQ) |
2499 |
++#define LAST_IRQ (VECTOR_IRQ_SPACE + VECTOR_BASE_IRQ - 1) |
2500 |
+ |
2501 |
+ #else |
2502 |
+ |
2503 |
+diff --git a/arch/um/kernel/irq.c b/arch/um/kernel/irq.c |
2504 |
+index 6b7f3827d6e4..2753718d31b9 100644 |
2505 |
+--- a/arch/um/kernel/irq.c |
2506 |
++++ b/arch/um/kernel/irq.c |
2507 |
+@@ -21,6 +21,8 @@ |
2508 |
+ #include <irq_user.h> |
2509 |
+ |
2510 |
+ |
2511 |
++extern void free_irqs(void); |
2512 |
++ |
2513 |
+ /* When epoll triggers we do not know why it did so |
2514 |
+ * we can also have different IRQs for read and write. |
2515 |
+ * This is why we keep a small irq_fd array for each fd - |
2516 |
+@@ -100,6 +102,8 @@ void sigio_handler(int sig, struct siginfo *unused_si, struct uml_pt_regs *regs) |
2517 |
+ } |
2518 |
+ } |
2519 |
+ } |
2520 |
++ |
2521 |
++ free_irqs(); |
2522 |
+ } |
2523 |
+ |
2524 |
+ static int assign_epoll_events_to_irq(struct irq_entry *irq_entry) |
2525 |
+diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug |
2526 |
+index 7d68f0c7cfb1..687cd1a213d5 100644 |
2527 |
+--- a/arch/x86/Kconfig.debug |
2528 |
++++ b/arch/x86/Kconfig.debug |
2529 |
+@@ -181,7 +181,7 @@ config HAVE_MMIOTRACE_SUPPORT |
2530 |
+ |
2531 |
+ config X86_DECODER_SELFTEST |
2532 |
+ bool "x86 instruction decoder selftest" |
2533 |
+- depends on DEBUG_KERNEL && KPROBES |
2534 |
++ depends on DEBUG_KERNEL && INSTRUCTION_DECODER |
2535 |
+ depends on !COMPILE_TEST |
2536 |
+ ---help--- |
2537 |
+ Perform x86 instruction decoder selftests at build time. |
2538 |
+diff --git a/arch/x86/events/intel/pt.c b/arch/x86/events/intel/pt.c |
2539 |
+index 8f4c98fdd03c..f03100bc5fd1 100644 |
2540 |
+--- a/arch/x86/events/intel/pt.c |
2541 |
++++ b/arch/x86/events/intel/pt.c |
2542 |
+@@ -1213,7 +1213,8 @@ static int pt_event_addr_filters_validate(struct list_head *filters) |
2543 |
+ static void pt_event_addr_filters_sync(struct perf_event *event) |
2544 |
+ { |
2545 |
+ struct perf_addr_filters_head *head = perf_event_addr_filters(event); |
2546 |
+- unsigned long msr_a, msr_b, *offs = event->addr_filters_offs; |
2547 |
++ unsigned long msr_a, msr_b; |
2548 |
++ struct perf_addr_filter_range *fr = event->addr_filter_ranges; |
2549 |
+ struct pt_filters *filters = event->hw.addr_filters; |
2550 |
+ struct perf_addr_filter *filter; |
2551 |
+ int range = 0; |
2552 |
+@@ -1222,12 +1223,12 @@ static void pt_event_addr_filters_sync(struct perf_event *event) |
2553 |
+ return; |
2554 |
+ |
2555 |
+ list_for_each_entry(filter, &head->list, entry) { |
2556 |
+- if (filter->path.dentry && !offs[range]) { |
2557 |
++ if (filter->path.dentry && !fr[range].start) { |
2558 |
+ msr_a = msr_b = 0; |
2559 |
+ } else { |
2560 |
+ /* apply the offset */ |
2561 |
+- msr_a = filter->offset + offs[range]; |
2562 |
+- msr_b = filter->size + msr_a - 1; |
2563 |
++ msr_a = fr[range].start; |
2564 |
++ msr_b = msr_a + fr[range].size - 1; |
2565 |
+ } |
2566 |
+ |
2567 |
+ filters->filter[range].msr_a = msr_a; |
2568 |
+diff --git a/arch/x86/include/asm/pgtable_32.h b/arch/x86/include/asm/pgtable_32.h |
2569 |
+index b3ec519e3982..71e1df860176 100644 |
2570 |
+--- a/arch/x86/include/asm/pgtable_32.h |
2571 |
++++ b/arch/x86/include/asm/pgtable_32.h |
2572 |
+@@ -106,6 +106,6 @@ do { \ |
2573 |
+ * with only a host target support using a 32-bit type for internal |
2574 |
+ * representation. |
2575 |
+ */ |
2576 |
+-#define LOWMEM_PAGES ((((2<<31) - __PAGE_OFFSET) >> PAGE_SHIFT)) |
2577 |
++#define LOWMEM_PAGES ((((_ULL(2)<<31) - __PAGE_OFFSET) >> PAGE_SHIFT)) |
2578 |
+ |
2579 |
+ #endif /* _ASM_X86_PGTABLE_32_H */ |
2580 |
+diff --git a/arch/x86/kernel/kgdb.c b/arch/x86/kernel/kgdb.c |
2581 |
+index 8e36f249646e..904e18bb38c5 100644 |
2582 |
+--- a/arch/x86/kernel/kgdb.c |
2583 |
++++ b/arch/x86/kernel/kgdb.c |
2584 |
+@@ -438,7 +438,7 @@ static void kgdb_disable_hw_debug(struct pt_regs *regs) |
2585 |
+ */ |
2586 |
+ void kgdb_roundup_cpus(unsigned long flags) |
2587 |
+ { |
2588 |
+- apic->send_IPI_allbutself(APIC_DM_NMI); |
2589 |
++ apic->send_IPI_allbutself(NMI_VECTOR); |
2590 |
+ } |
2591 |
+ #endif |
2592 |
+ |
2593 |
+diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c |
2594 |
+index a6836ab0fcc7..b72296bd04a2 100644 |
2595 |
+--- a/arch/x86/mm/tlb.c |
2596 |
++++ b/arch/x86/mm/tlb.c |
2597 |
+@@ -664,9 +664,6 @@ void native_flush_tlb_others(const struct cpumask *cpumask, |
2598 |
+ * that UV should be updated so that smp_call_function_many(), |
2599 |
+ * etc, are optimal on UV. |
2600 |
+ */ |
2601 |
+- unsigned int cpu; |
2602 |
+- |
2603 |
+- cpu = smp_processor_id(); |
2604 |
+ cpumask = uv_flush_tlb_others(cpumask, info); |
2605 |
+ if (cpumask) |
2606 |
+ smp_call_function_many(cpumask, flush_tlb_func_remote, |
2607 |
+diff --git a/block/blk-merge.c b/block/blk-merge.c |
2608 |
+index 2776ee6c5c3d..7efa8c3e2b72 100644 |
2609 |
+--- a/block/blk-merge.c |
2610 |
++++ b/block/blk-merge.c |
2611 |
+@@ -309,13 +309,7 @@ void blk_recalc_rq_segments(struct request *rq) |
2612 |
+ |
2613 |
+ void blk_recount_segments(struct request_queue *q, struct bio *bio) |
2614 |
+ { |
2615 |
+- unsigned short seg_cnt; |
2616 |
+- |
2617 |
+- /* estimate segment number by bi_vcnt for non-cloned bio */ |
2618 |
+- if (bio_flagged(bio, BIO_CLONED)) |
2619 |
+- seg_cnt = bio_segments(bio); |
2620 |
+- else |
2621 |
+- seg_cnt = bio->bi_vcnt; |
2622 |
++ unsigned short seg_cnt = bio_segments(bio); |
2623 |
+ |
2624 |
+ if (test_bit(QUEUE_FLAG_NO_SG_MERGE, &q->queue_flags) && |
2625 |
+ (seg_cnt < queue_max_segments(q))) |
2626 |
+diff --git a/crypto/pcrypt.c b/crypto/pcrypt.c |
2627 |
+index f8ec3d4ba4a8..a5718c0a3dc4 100644 |
2628 |
+--- a/crypto/pcrypt.c |
2629 |
++++ b/crypto/pcrypt.c |
2630 |
+@@ -394,7 +394,7 @@ static int pcrypt_sysfs_add(struct padata_instance *pinst, const char *name) |
2631 |
+ int ret; |
2632 |
+ |
2633 |
+ pinst->kobj.kset = pcrypt_kset; |
2634 |
+- ret = kobject_add(&pinst->kobj, NULL, name); |
2635 |
++ ret = kobject_add(&pinst->kobj, NULL, "%s", name); |
2636 |
+ if (!ret) |
2637 |
+ kobject_uevent(&pinst->kobj, KOBJ_ADD); |
2638 |
+ |
2639 |
+diff --git a/crypto/tgr192.c b/crypto/tgr192.c |
2640 |
+index 022d3dd76c3b..f8e1d9f9938f 100644 |
2641 |
+--- a/crypto/tgr192.c |
2642 |
++++ b/crypto/tgr192.c |
2643 |
+@@ -25,8 +25,9 @@ |
2644 |
+ #include <linux/init.h> |
2645 |
+ #include <linux/module.h> |
2646 |
+ #include <linux/mm.h> |
2647 |
+-#include <asm/byteorder.h> |
2648 |
+ #include <linux/types.h> |
2649 |
++#include <asm/byteorder.h> |
2650 |
++#include <asm/unaligned.h> |
2651 |
+ |
2652 |
+ #define TGR192_DIGEST_SIZE 24 |
2653 |
+ #define TGR160_DIGEST_SIZE 20 |
2654 |
+@@ -468,10 +469,9 @@ static void tgr192_transform(struct tgr192_ctx *tctx, const u8 * data) |
2655 |
+ u64 a, b, c, aa, bb, cc; |
2656 |
+ u64 x[8]; |
2657 |
+ int i; |
2658 |
+- const __le64 *ptr = (const __le64 *)data; |
2659 |
+ |
2660 |
+ for (i = 0; i < 8; i++) |
2661 |
+- x[i] = le64_to_cpu(ptr[i]); |
2662 |
++ x[i] = get_unaligned_le64(data + i * sizeof(__le64)); |
2663 |
+ |
2664 |
+ /* save */ |
2665 |
+ a = aa = tctx->a; |
2666 |
+diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c |
2667 |
+index 30ccd94f87d2..ded6c5c17fd7 100644 |
2668 |
+--- a/drivers/acpi/acpi_lpss.c |
2669 |
++++ b/drivers/acpi/acpi_lpss.c |
2670 |
+@@ -1056,6 +1056,13 @@ static int acpi_lpss_suspend_noirq(struct device *dev) |
2671 |
+ int ret; |
2672 |
+ |
2673 |
+ if (pdata->dev_desc->resume_from_noirq) { |
2674 |
++ /* |
2675 |
++ * The driver's ->suspend_late callback will be invoked by |
2676 |
++ * acpi_lpss_do_suspend_late(), with the assumption that the |
2677 |
++ * driver really wanted to run that code in ->suspend_noirq, but |
2678 |
++ * it could not run after acpi_dev_suspend() and the driver |
2679 |
++ * expected the latter to be called in the "late" phase. |
2680 |
++ */ |
2681 |
+ ret = acpi_lpss_do_suspend_late(dev); |
2682 |
+ if (ret) |
2683 |
+ return ret; |
2684 |
+@@ -1086,16 +1093,99 @@ static int acpi_lpss_resume_noirq(struct device *dev) |
2685 |
+ struct lpss_private_data *pdata = acpi_driver_data(ACPI_COMPANION(dev)); |
2686 |
+ int ret; |
2687 |
+ |
2688 |
+- ret = acpi_subsys_resume_noirq(dev); |
2689 |
++ /* Follow acpi_subsys_resume_noirq(). */ |
2690 |
++ if (dev_pm_may_skip_resume(dev)) |
2691 |
++ return 0; |
2692 |
++ |
2693 |
++ if (dev_pm_smart_suspend_and_suspended(dev)) |
2694 |
++ pm_runtime_set_active(dev); |
2695 |
++ |
2696 |
++ ret = pm_generic_resume_noirq(dev); |
2697 |
+ if (ret) |
2698 |
+ return ret; |
2699 |
+ |
2700 |
+- if (!dev_pm_may_skip_resume(dev) && pdata->dev_desc->resume_from_noirq) |
2701 |
+- ret = acpi_lpss_do_resume_early(dev); |
2702 |
++ if (!pdata->dev_desc->resume_from_noirq) |
2703 |
++ return 0; |
2704 |
+ |
2705 |
+- return ret; |
2706 |
++ /* |
2707 |
++ * The driver's ->resume_early callback will be invoked by |
2708 |
++ * acpi_lpss_do_resume_early(), with the assumption that the driver |
2709 |
++ * really wanted to run that code in ->resume_noirq, but it could not |
2710 |
++ * run before acpi_dev_resume() and the driver expected the latter to be |
2711 |
++ * called in the "early" phase. |
2712 |
++ */ |
2713 |
++ return acpi_lpss_do_resume_early(dev); |
2714 |
++} |
2715 |
++ |
2716 |
++static int acpi_lpss_do_restore_early(struct device *dev) |
2717 |
++{ |
2718 |
++ int ret = acpi_lpss_resume(dev); |
2719 |
++ |
2720 |
++ return ret ? ret : pm_generic_restore_early(dev); |
2721 |
+ } |
2722 |
+ |
2723 |
++static int acpi_lpss_restore_early(struct device *dev) |
2724 |
++{ |
2725 |
++ struct lpss_private_data *pdata = acpi_driver_data(ACPI_COMPANION(dev)); |
2726 |
++ |
2727 |
++ if (pdata->dev_desc->resume_from_noirq) |
2728 |
++ return 0; |
2729 |
++ |
2730 |
++ return acpi_lpss_do_restore_early(dev); |
2731 |
++} |
2732 |
++ |
2733 |
++static int acpi_lpss_restore_noirq(struct device *dev) |
2734 |
++{ |
2735 |
++ struct lpss_private_data *pdata = acpi_driver_data(ACPI_COMPANION(dev)); |
2736 |
++ int ret; |
2737 |
++ |
2738 |
++ ret = pm_generic_restore_noirq(dev); |
2739 |
++ if (ret) |
2740 |
++ return ret; |
2741 |
++ |
2742 |
++ if (!pdata->dev_desc->resume_from_noirq) |
2743 |
++ return 0; |
2744 |
++ |
2745 |
++ /* This is analogous to what happens in acpi_lpss_resume_noirq(). */ |
2746 |
++ return acpi_lpss_do_restore_early(dev); |
2747 |
++} |
2748 |
++ |
2749 |
++static int acpi_lpss_do_poweroff_late(struct device *dev) |
2750 |
++{ |
2751 |
++ int ret = pm_generic_poweroff_late(dev); |
2752 |
++ |
2753 |
++ return ret ? ret : acpi_lpss_suspend(dev, device_may_wakeup(dev)); |
2754 |
++} |
2755 |
++ |
2756 |
++static int acpi_lpss_poweroff_late(struct device *dev) |
2757 |
++{ |
2758 |
++ struct lpss_private_data *pdata = acpi_driver_data(ACPI_COMPANION(dev)); |
2759 |
++ |
2760 |
++ if (dev_pm_smart_suspend_and_suspended(dev)) |
2761 |
++ return 0; |
2762 |
++ |
2763 |
++ if (pdata->dev_desc->resume_from_noirq) |
2764 |
++ return 0; |
2765 |
++ |
2766 |
++ return acpi_lpss_do_poweroff_late(dev); |
2767 |
++} |
2768 |
++ |
2769 |
++static int acpi_lpss_poweroff_noirq(struct device *dev) |
2770 |
++{ |
2771 |
++ struct lpss_private_data *pdata = acpi_driver_data(ACPI_COMPANION(dev)); |
2772 |
++ |
2773 |
++ if (dev_pm_smart_suspend_and_suspended(dev)) |
2774 |
++ return 0; |
2775 |
++ |
2776 |
++ if (pdata->dev_desc->resume_from_noirq) { |
2777 |
++ /* This is analogous to the acpi_lpss_suspend_noirq() case. */ |
2778 |
++ int ret = acpi_lpss_do_poweroff_late(dev); |
2779 |
++ if (ret) |
2780 |
++ return ret; |
2781 |
++ } |
2782 |
++ |
2783 |
++ return pm_generic_poweroff_noirq(dev); |
2784 |
++} |
2785 |
+ #endif /* CONFIG_PM_SLEEP */ |
2786 |
+ |
2787 |
+ static int acpi_lpss_runtime_suspend(struct device *dev) |
2788 |
+@@ -1129,14 +1219,11 @@ static struct dev_pm_domain acpi_lpss_pm_domain = { |
2789 |
+ .resume_noirq = acpi_lpss_resume_noirq, |
2790 |
+ .resume_early = acpi_lpss_resume_early, |
2791 |
+ .freeze = acpi_subsys_freeze, |
2792 |
+- .freeze_late = acpi_subsys_freeze_late, |
2793 |
+- .freeze_noirq = acpi_subsys_freeze_noirq, |
2794 |
+- .thaw_noirq = acpi_subsys_thaw_noirq, |
2795 |
+- .poweroff = acpi_subsys_suspend, |
2796 |
+- .poweroff_late = acpi_lpss_suspend_late, |
2797 |
+- .poweroff_noirq = acpi_lpss_suspend_noirq, |
2798 |
+- .restore_noirq = acpi_lpss_resume_noirq, |
2799 |
+- .restore_early = acpi_lpss_resume_early, |
2800 |
++ .poweroff = acpi_subsys_poweroff, |
2801 |
++ .poweroff_late = acpi_lpss_poweroff_late, |
2802 |
++ .poweroff_noirq = acpi_lpss_poweroff_noirq, |
2803 |
++ .restore_noirq = acpi_lpss_restore_noirq, |
2804 |
++ .restore_early = acpi_lpss_restore_early, |
2805 |
+ #endif |
2806 |
+ .runtime_suspend = acpi_lpss_runtime_suspend, |
2807 |
+ .runtime_resume = acpi_lpss_runtime_resume, |
2808 |
+diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c |
2809 |
+index 870eb5c7516a..a25d77b3a16a 100644 |
2810 |
+--- a/drivers/acpi/button.c |
2811 |
++++ b/drivers/acpi/button.c |
2812 |
+@@ -467,8 +467,11 @@ static int acpi_button_resume(struct device *dev) |
2813 |
+ struct acpi_button *button = acpi_driver_data(device); |
2814 |
+ |
2815 |
+ button->suspended = false; |
2816 |
+- if (button->type == ACPI_BUTTON_TYPE_LID && button->input->users) |
2817 |
++ if (button->type == ACPI_BUTTON_TYPE_LID && button->input->users) { |
2818 |
++ button->last_state = !!acpi_lid_evaluate_state(device); |
2819 |
++ button->last_time = ktime_get(); |
2820 |
+ acpi_lid_initialize_state(device); |
2821 |
++ } |
2822 |
+ return 0; |
2823 |
+ } |
2824 |
+ #endif |
2825 |
+diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c |
2826 |
+index e0927c5fd282..54b6547d32b2 100644 |
2827 |
+--- a/drivers/acpi/device_pm.c |
2828 |
++++ b/drivers/acpi/device_pm.c |
2829 |
+@@ -1077,7 +1077,7 @@ EXPORT_SYMBOL_GPL(acpi_subsys_suspend_noirq); |
2830 |
+ * acpi_subsys_resume_noirq - Run the device driver's "noirq" resume callback. |
2831 |
+ * @dev: Device to handle. |
2832 |
+ */ |
2833 |
+-int acpi_subsys_resume_noirq(struct device *dev) |
2834 |
++static int acpi_subsys_resume_noirq(struct device *dev) |
2835 |
+ { |
2836 |
+ if (dev_pm_may_skip_resume(dev)) |
2837 |
+ return 0; |
2838 |
+@@ -1092,7 +1092,6 @@ int acpi_subsys_resume_noirq(struct device *dev) |
2839 |
+ |
2840 |
+ return pm_generic_resume_noirq(dev); |
2841 |
+ } |
2842 |
+-EXPORT_SYMBOL_GPL(acpi_subsys_resume_noirq); |
2843 |
+ |
2844 |
+ /** |
2845 |
+ * acpi_subsys_resume_early - Resume device using ACPI. |
2846 |
+@@ -1102,12 +1101,11 @@ EXPORT_SYMBOL_GPL(acpi_subsys_resume_noirq); |
2847 |
+ * generic early resume procedure for it during system transition into the |
2848 |
+ * working state. |
2849 |
+ */ |
2850 |
+-int acpi_subsys_resume_early(struct device *dev) |
2851 |
++static int acpi_subsys_resume_early(struct device *dev) |
2852 |
+ { |
2853 |
+ int ret = acpi_dev_resume(dev); |
2854 |
+ return ret ? ret : pm_generic_resume_early(dev); |
2855 |
+ } |
2856 |
+-EXPORT_SYMBOL_GPL(acpi_subsys_resume_early); |
2857 |
+ |
2858 |
+ /** |
2859 |
+ * acpi_subsys_freeze - Run the device driver's freeze callback. |
2860 |
+@@ -1116,65 +1114,81 @@ EXPORT_SYMBOL_GPL(acpi_subsys_resume_early); |
2861 |
+ int acpi_subsys_freeze(struct device *dev) |
2862 |
+ { |
2863 |
+ /* |
2864 |
+- * This used to be done in acpi_subsys_prepare() for all devices and |
2865 |
+- * some drivers may depend on it, so do it here. Ideally, however, |
2866 |
+- * runtime-suspended devices should not be touched during freeze/thaw |
2867 |
+- * transitions. |
2868 |
++ * Resume all runtime-suspended devices before creating a snapshot |
2869 |
++ * image of system memory, because the restore kernel generally cannot |
2870 |
++ * be expected to always handle them consistently and they need to be |
2871 |
++ * put into the runtime-active metastate during system resume anyway, |
2872 |
++ * so it is better to ensure that the state saved in the image will be |
2873 |
++ * always consistent with that. |
2874 |
+ */ |
2875 |
+- if (!dev_pm_test_driver_flags(dev, DPM_FLAG_SMART_SUSPEND)) |
2876 |
+- pm_runtime_resume(dev); |
2877 |
++ pm_runtime_resume(dev); |
2878 |
+ |
2879 |
+ return pm_generic_freeze(dev); |
2880 |
+ } |
2881 |
+ EXPORT_SYMBOL_GPL(acpi_subsys_freeze); |
2882 |
+ |
2883 |
+ /** |
2884 |
+- * acpi_subsys_freeze_late - Run the device driver's "late" freeze callback. |
2885 |
+- * @dev: Device to handle. |
2886 |
++ * acpi_subsys_restore_early - Restore device using ACPI. |
2887 |
++ * @dev: Device to restore. |
2888 |
+ */ |
2889 |
+-int acpi_subsys_freeze_late(struct device *dev) |
2890 |
++int acpi_subsys_restore_early(struct device *dev) |
2891 |
+ { |
2892 |
++ int ret = acpi_dev_resume(dev); |
2893 |
++ return ret ? ret : pm_generic_restore_early(dev); |
2894 |
++} |
2895 |
++EXPORT_SYMBOL_GPL(acpi_subsys_restore_early); |
2896 |
+ |
2897 |
+- if (dev_pm_smart_suspend_and_suspended(dev)) |
2898 |
+- return 0; |
2899 |
++/** |
2900 |
++ * acpi_subsys_poweroff - Run the device driver's poweroff callback. |
2901 |
++ * @dev: Device to handle. |
2902 |
++ * |
2903 |
++ * Follow PCI and resume devices from runtime suspend before running their |
2904 |
++ * system poweroff callbacks, unless the driver can cope with runtime-suspended |
2905 |
++ * devices during system suspend and there are no ACPI-specific reasons for |
2906 |
++ * resuming them. |
2907 |
++ */ |
2908 |
++int acpi_subsys_poweroff(struct device *dev) |
2909 |
++{ |
2910 |
++ if (!dev_pm_test_driver_flags(dev, DPM_FLAG_SMART_SUSPEND) || |
2911 |
++ acpi_dev_needs_resume(dev, ACPI_COMPANION(dev))) |
2912 |
++ pm_runtime_resume(dev); |
2913 |
+ |
2914 |
+- return pm_generic_freeze_late(dev); |
2915 |
++ return pm_generic_poweroff(dev); |
2916 |
+ } |
2917 |
+-EXPORT_SYMBOL_GPL(acpi_subsys_freeze_late); |
2918 |
++EXPORT_SYMBOL_GPL(acpi_subsys_poweroff); |
2919 |
+ |
2920 |
+ /** |
2921 |
+- * acpi_subsys_freeze_noirq - Run the device driver's "noirq" freeze callback. |
2922 |
++ * acpi_subsys_poweroff_late - Run the device driver's poweroff callback. |
2923 |
+ * @dev: Device to handle. |
2924 |
++ * |
2925 |
++ * Carry out the generic late poweroff procedure for @dev and use ACPI to put |
2926 |
++ * it into a low-power state during system transition into a sleep state. |
2927 |
+ */ |
2928 |
+-int acpi_subsys_freeze_noirq(struct device *dev) |
2929 |
++static int acpi_subsys_poweroff_late(struct device *dev) |
2930 |
+ { |
2931 |
++ int ret; |
2932 |
+ |
2933 |
+ if (dev_pm_smart_suspend_and_suspended(dev)) |
2934 |
+ return 0; |
2935 |
+ |
2936 |
+- return pm_generic_freeze_noirq(dev); |
2937 |
++ ret = pm_generic_poweroff_late(dev); |
2938 |
++ if (ret) |
2939 |
++ return ret; |
2940 |
++ |
2941 |
++ return acpi_dev_suspend(dev, device_may_wakeup(dev)); |
2942 |
+ } |
2943 |
+-EXPORT_SYMBOL_GPL(acpi_subsys_freeze_noirq); |
2944 |
+ |
2945 |
+ /** |
2946 |
+- * acpi_subsys_thaw_noirq - Run the device driver's "noirq" thaw callback. |
2947 |
+- * @dev: Device to handle. |
2948 |
++ * acpi_subsys_poweroff_noirq - Run the driver's "noirq" poweroff callback. |
2949 |
++ * @dev: Device to suspend. |
2950 |
+ */ |
2951 |
+-int acpi_subsys_thaw_noirq(struct device *dev) |
2952 |
++static int acpi_subsys_poweroff_noirq(struct device *dev) |
2953 |
+ { |
2954 |
+- /* |
2955 |
+- * If the device is in runtime suspend, the "thaw" code may not work |
2956 |
+- * correctly with it, so skip the driver callback and make the PM core |
2957 |
+- * skip all of the subsequent "thaw" callbacks for the device. |
2958 |
+- */ |
2959 |
+- if (dev_pm_smart_suspend_and_suspended(dev)) { |
2960 |
+- dev_pm_skip_next_resume_phases(dev); |
2961 |
++ if (dev_pm_smart_suspend_and_suspended(dev)) |
2962 |
+ return 0; |
2963 |
+- } |
2964 |
+ |
2965 |
+- return pm_generic_thaw_noirq(dev); |
2966 |
++ return pm_generic_poweroff_noirq(dev); |
2967 |
+ } |
2968 |
+-EXPORT_SYMBOL_GPL(acpi_subsys_thaw_noirq); |
2969 |
+ #endif /* CONFIG_PM_SLEEP */ |
2970 |
+ |
2971 |
+ static struct dev_pm_domain acpi_general_pm_domain = { |
2972 |
+@@ -1190,14 +1204,10 @@ static struct dev_pm_domain acpi_general_pm_domain = { |
2973 |
+ .resume_noirq = acpi_subsys_resume_noirq, |
2974 |
+ .resume_early = acpi_subsys_resume_early, |
2975 |
+ .freeze = acpi_subsys_freeze, |
2976 |
+- .freeze_late = acpi_subsys_freeze_late, |
2977 |
+- .freeze_noirq = acpi_subsys_freeze_noirq, |
2978 |
+- .thaw_noirq = acpi_subsys_thaw_noirq, |
2979 |
+- .poweroff = acpi_subsys_suspend, |
2980 |
+- .poweroff_late = acpi_subsys_suspend_late, |
2981 |
+- .poweroff_noirq = acpi_subsys_suspend_noirq, |
2982 |
+- .restore_noirq = acpi_subsys_resume_noirq, |
2983 |
+- .restore_early = acpi_subsys_resume_early, |
2984 |
++ .poweroff = acpi_subsys_poweroff, |
2985 |
++ .poweroff_late = acpi_subsys_poweroff_late, |
2986 |
++ .poweroff_noirq = acpi_subsys_poweroff_noirq, |
2987 |
++ .restore_early = acpi_subsys_restore_early, |
2988 |
+ #endif |
2989 |
+ }, |
2990 |
+ }; |
2991 |
+diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c |
2992 |
+index b5f57c69c487..2bdb250a2142 100644 |
2993 |
+--- a/drivers/ata/libahci.c |
2994 |
++++ b/drivers/ata/libahci.c |
2995 |
+@@ -191,7 +191,6 @@ struct ata_port_operations ahci_pmp_retry_srst_ops = { |
2996 |
+ EXPORT_SYMBOL_GPL(ahci_pmp_retry_srst_ops); |
2997 |
+ |
2998 |
+ static bool ahci_em_messages __read_mostly = true; |
2999 |
+-EXPORT_SYMBOL_GPL(ahci_em_messages); |
3000 |
+ module_param(ahci_em_messages, bool, 0444); |
3001 |
+ /* add other LED protocol types when they become supported */ |
3002 |
+ MODULE_PARM_DESC(ahci_em_messages, |
3003 |
+diff --git a/drivers/base/core.c b/drivers/base/core.c |
3004 |
+index 985ccced33a2..742bc60e9cca 100644 |
3005 |
+--- a/drivers/base/core.c |
3006 |
++++ b/drivers/base/core.c |
3007 |
+@@ -179,10 +179,14 @@ void device_pm_move_to_tail(struct device *dev) |
3008 |
+ * of the link. If DL_FLAG_PM_RUNTIME is not set, DL_FLAG_RPM_ACTIVE will be |
3009 |
+ * ignored. |
3010 |
+ * |
3011 |
+- * If the DL_FLAG_AUTOREMOVE_CONSUMER is set, the link will be removed |
3012 |
+- * automatically when the consumer device driver unbinds from it. |
3013 |
+- * The combination of both DL_FLAG_AUTOREMOVE_CONSUMER and DL_FLAG_STATELESS |
3014 |
+- * set is invalid and will cause NULL to be returned. |
3015 |
++ * If the DL_FLAG_AUTOREMOVE_CONSUMER flag is set, the link will be removed |
3016 |
++ * automatically when the consumer device driver unbinds from it. Analogously, |
3017 |
++ * if DL_FLAG_AUTOREMOVE_SUPPLIER is set in @flags, the link will be removed |
3018 |
++ * automatically when the supplier device driver unbinds from it. |
3019 |
++ * |
3020 |
++ * The combination of DL_FLAG_STATELESS and either DL_FLAG_AUTOREMOVE_CONSUMER |
3021 |
++ * or DL_FLAG_AUTOREMOVE_SUPPLIER set in @flags at the same time is invalid and |
3022 |
++ * will cause NULL to be returned upfront. |
3023 |
+ * |
3024 |
+ * A side effect of the link creation is re-ordering of dpm_list and the |
3025 |
+ * devices_kset list by moving the consumer device and all devices depending |
3026 |
+@@ -199,10 +203,17 @@ struct device_link *device_link_add(struct device *consumer, |
3027 |
+ struct device_link *link; |
3028 |
+ |
3029 |
+ if (!consumer || !supplier || |
3030 |
+- ((flags & DL_FLAG_STATELESS) && |
3031 |
+- (flags & DL_FLAG_AUTOREMOVE_CONSUMER))) |
3032 |
++ (flags & DL_FLAG_STATELESS && |
3033 |
++ flags & (DL_FLAG_AUTOREMOVE_CONSUMER | DL_FLAG_AUTOREMOVE_SUPPLIER))) |
3034 |
+ return NULL; |
3035 |
+ |
3036 |
++ if (flags & DL_FLAG_PM_RUNTIME && flags & DL_FLAG_RPM_ACTIVE) { |
3037 |
++ if (pm_runtime_get_sync(supplier) < 0) { |
3038 |
++ pm_runtime_put_noidle(supplier); |
3039 |
++ return NULL; |
3040 |
++ } |
3041 |
++ } |
3042 |
++ |
3043 |
+ device_links_write_lock(); |
3044 |
+ device_pm_lock(); |
3045 |
+ |
3046 |
+@@ -217,35 +228,51 @@ struct device_link *device_link_add(struct device *consumer, |
3047 |
+ goto out; |
3048 |
+ } |
3049 |
+ |
3050 |
+- list_for_each_entry(link, &supplier->links.consumers, s_node) |
3051 |
+- if (link->consumer == consumer) { |
3052 |
+- kref_get(&link->kref); |
3053 |
++ list_for_each_entry(link, &supplier->links.consumers, s_node) { |
3054 |
++ if (link->consumer != consumer) |
3055 |
++ continue; |
3056 |
++ |
3057 |
++ /* |
3058 |
++ * Don't return a stateless link if the caller wants a stateful |
3059 |
++ * one and vice versa. |
3060 |
++ */ |
3061 |
++ if (WARN_ON((flags & DL_FLAG_STATELESS) != (link->flags & DL_FLAG_STATELESS))) { |
3062 |
++ link = NULL; |
3063 |
+ goto out; |
3064 |
+ } |
3065 |
+ |
3066 |
++ if (flags & DL_FLAG_AUTOREMOVE_CONSUMER) |
3067 |
++ link->flags |= DL_FLAG_AUTOREMOVE_CONSUMER; |
3068 |
++ |
3069 |
++ if (flags & DL_FLAG_AUTOREMOVE_SUPPLIER) |
3070 |
++ link->flags |= DL_FLAG_AUTOREMOVE_SUPPLIER; |
3071 |
++ |
3072 |
++ if (flags & DL_FLAG_PM_RUNTIME) { |
3073 |
++ if (!(link->flags & DL_FLAG_PM_RUNTIME)) { |
3074 |
++ pm_runtime_new_link(consumer); |
3075 |
++ link->flags |= DL_FLAG_PM_RUNTIME; |
3076 |
++ } |
3077 |
++ if (flags & DL_FLAG_RPM_ACTIVE) |
3078 |
++ refcount_inc(&link->rpm_active); |
3079 |
++ } |
3080 |
++ |
3081 |
++ kref_get(&link->kref); |
3082 |
++ goto out; |
3083 |
++ } |
3084 |
++ |
3085 |
+ link = kzalloc(sizeof(*link), GFP_KERNEL); |
3086 |
+ if (!link) |
3087 |
+ goto out; |
3088 |
+ |
3089 |
++ refcount_set(&link->rpm_active, 1); |
3090 |
++ |
3091 |
+ if (flags & DL_FLAG_PM_RUNTIME) { |
3092 |
+- if (flags & DL_FLAG_RPM_ACTIVE) { |
3093 |
+- if (pm_runtime_get_sync(supplier) < 0) { |
3094 |
+- pm_runtime_put_noidle(supplier); |
3095 |
+- kfree(link); |
3096 |
+- link = NULL; |
3097 |
+- goto out; |
3098 |
+- } |
3099 |
+- link->rpm_active = true; |
3100 |
+- } |
3101 |
++ if (flags & DL_FLAG_RPM_ACTIVE) |
3102 |
++ refcount_inc(&link->rpm_active); |
3103 |
++ |
3104 |
+ pm_runtime_new_link(consumer); |
3105 |
+- /* |
3106 |
+- * If the link is being added by the consumer driver at probe |
3107 |
+- * time, balance the decrementation of the supplier's runtime PM |
3108 |
+- * usage counter after consumer probe in driver_probe_device(). |
3109 |
+- */ |
3110 |
+- if (consumer->links.status == DL_DEV_PROBING) |
3111 |
+- pm_runtime_get_noresume(supplier); |
3112 |
+ } |
3113 |
++ |
3114 |
+ get_device(supplier); |
3115 |
+ link->supplier = supplier; |
3116 |
+ INIT_LIST_HEAD(&link->s_node); |
3117 |
+@@ -307,12 +334,19 @@ struct device_link *device_link_add(struct device *consumer, |
3118 |
+ out: |
3119 |
+ device_pm_unlock(); |
3120 |
+ device_links_write_unlock(); |
3121 |
++ |
3122 |
++ if ((flags & DL_FLAG_PM_RUNTIME && flags & DL_FLAG_RPM_ACTIVE) && !link) |
3123 |
++ pm_runtime_put(supplier); |
3124 |
++ |
3125 |
+ return link; |
3126 |
+ } |
3127 |
+ EXPORT_SYMBOL_GPL(device_link_add); |
3128 |
+ |
3129 |
+ static void device_link_free(struct device_link *link) |
3130 |
+ { |
3131 |
++ while (refcount_dec_not_one(&link->rpm_active)) |
3132 |
++ pm_runtime_put(link->supplier); |
3133 |
++ |
3134 |
+ put_device(link->consumer); |
3135 |
+ put_device(link->supplier); |
3136 |
+ kfree(link); |
3137 |
+@@ -539,11 +573,11 @@ void device_links_no_driver(struct device *dev) |
3138 |
+ */ |
3139 |
+ void device_links_driver_cleanup(struct device *dev) |
3140 |
+ { |
3141 |
+- struct device_link *link; |
3142 |
++ struct device_link *link, *ln; |
3143 |
+ |
3144 |
+ device_links_write_lock(); |
3145 |
+ |
3146 |
+- list_for_each_entry(link, &dev->links.consumers, s_node) { |
3147 |
++ list_for_each_entry_safe(link, ln, &dev->links.consumers, s_node) { |
3148 |
+ if (link->flags & DL_FLAG_STATELESS) |
3149 |
+ continue; |
3150 |
+ |
3151 |
+diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c |
3152 |
+index beb85c31f3fa..303ce7d54a30 100644 |
3153 |
+--- a/drivers/base/power/runtime.c |
3154 |
++++ b/drivers/base/power/runtime.c |
3155 |
+@@ -268,11 +268,8 @@ static int rpm_get_suppliers(struct device *dev) |
3156 |
+ list_for_each_entry_rcu(link, &dev->links.suppliers, c_node) { |
3157 |
+ int retval; |
3158 |
+ |
3159 |
+- if (!(link->flags & DL_FLAG_PM_RUNTIME)) |
3160 |
+- continue; |
3161 |
+- |
3162 |
+- if (READ_ONCE(link->status) == DL_STATE_SUPPLIER_UNBIND || |
3163 |
+- link->rpm_active) |
3164 |
++ if (!(link->flags & DL_FLAG_PM_RUNTIME) || |
3165 |
++ READ_ONCE(link->status) == DL_STATE_SUPPLIER_UNBIND) |
3166 |
+ continue; |
3167 |
+ |
3168 |
+ retval = pm_runtime_get_sync(link->supplier); |
3169 |
+@@ -281,7 +278,7 @@ static int rpm_get_suppliers(struct device *dev) |
3170 |
+ pm_runtime_put_noidle(link->supplier); |
3171 |
+ return retval; |
3172 |
+ } |
3173 |
+- link->rpm_active = true; |
3174 |
++ refcount_inc(&link->rpm_active); |
3175 |
+ } |
3176 |
+ return 0; |
3177 |
+ } |
3178 |
+@@ -290,12 +287,13 @@ static void rpm_put_suppliers(struct device *dev) |
3179 |
+ { |
3180 |
+ struct device_link *link; |
3181 |
+ |
3182 |
+- list_for_each_entry_rcu(link, &dev->links.suppliers, c_node) |
3183 |
+- if (link->rpm_active && |
3184 |
+- READ_ONCE(link->status) != DL_STATE_SUPPLIER_UNBIND) { |
3185 |
++ list_for_each_entry_rcu(link, &dev->links.suppliers, c_node) { |
3186 |
++ if (READ_ONCE(link->status) == DL_STATE_SUPPLIER_UNBIND) |
3187 |
++ continue; |
3188 |
++ |
3189 |
++ while (refcount_dec_not_one(&link->rpm_active)) |
3190 |
+ pm_runtime_put(link->supplier); |
3191 |
+- link->rpm_active = false; |
3192 |
+- } |
3193 |
++ } |
3194 |
+ } |
3195 |
+ |
3196 |
+ /** |
3197 |
+@@ -1531,7 +1529,7 @@ void pm_runtime_remove(struct device *dev) |
3198 |
+ * |
3199 |
+ * Check links from this device to any consumers and if any of them have active |
3200 |
+ * runtime PM references to the device, drop the usage counter of the device |
3201 |
+- * (once per link). |
3202 |
++ * (as many times as needed). |
3203 |
+ * |
3204 |
+ * Links with the DL_FLAG_STATELESS flag set are ignored. |
3205 |
+ * |
3206 |
+@@ -1553,10 +1551,8 @@ void pm_runtime_clean_up_links(struct device *dev) |
3207 |
+ if (link->flags & DL_FLAG_STATELESS) |
3208 |
+ continue; |
3209 |
+ |
3210 |
+- if (link->rpm_active) { |
3211 |
++ while (refcount_dec_not_one(&link->rpm_active)) |
3212 |
+ pm_runtime_put_noidle(dev); |
3213 |
+- link->rpm_active = false; |
3214 |
+- } |
3215 |
+ } |
3216 |
+ |
3217 |
+ device_links_read_unlock(idx); |
3218 |
+@@ -1574,8 +1570,11 @@ void pm_runtime_get_suppliers(struct device *dev) |
3219 |
+ idx = device_links_read_lock(); |
3220 |
+ |
3221 |
+ list_for_each_entry_rcu(link, &dev->links.suppliers, c_node) |
3222 |
+- if (link->flags & DL_FLAG_PM_RUNTIME) |
3223 |
++ if (link->flags & DL_FLAG_PM_RUNTIME) { |
3224 |
++ link->supplier_preactivated = true; |
3225 |
++ refcount_inc(&link->rpm_active); |
3226 |
+ pm_runtime_get_sync(link->supplier); |
3227 |
++ } |
3228 |
+ |
3229 |
+ device_links_read_unlock(idx); |
3230 |
+ } |
3231 |
+@@ -1592,8 +1591,11 @@ void pm_runtime_put_suppliers(struct device *dev) |
3232 |
+ idx = device_links_read_lock(); |
3233 |
+ |
3234 |
+ list_for_each_entry_rcu(link, &dev->links.suppliers, c_node) |
3235 |
+- if (link->flags & DL_FLAG_PM_RUNTIME) |
3236 |
+- pm_runtime_put(link->supplier); |
3237 |
++ if (link->supplier_preactivated) { |
3238 |
++ link->supplier_preactivated = false; |
3239 |
++ if (refcount_dec_not_one(&link->rpm_active)) |
3240 |
++ pm_runtime_put(link->supplier); |
3241 |
++ } |
3242 |
+ |
3243 |
+ device_links_read_unlock(idx); |
3244 |
+ } |
3245 |
+@@ -1607,8 +1609,6 @@ void pm_runtime_new_link(struct device *dev) |
3246 |
+ |
3247 |
+ void pm_runtime_drop_link(struct device *dev) |
3248 |
+ { |
3249 |
+- rpm_put_suppliers(dev); |
3250 |
+- |
3251 |
+ spin_lock_irq(&dev->power.lock); |
3252 |
+ WARN_ON(dev->power.links_count == 0); |
3253 |
+ dev->power.links_count--; |
3254 |
+diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c |
3255 |
+index 7c84f64c74f7..2dfa2e048745 100644 |
3256 |
+--- a/drivers/base/power/wakeup.c |
3257 |
++++ b/drivers/base/power/wakeup.c |
3258 |
+@@ -875,7 +875,7 @@ EXPORT_SYMBOL_GPL(pm_system_wakeup); |
3259 |
+ |
3260 |
+ void pm_system_cancel_wakeup(void) |
3261 |
+ { |
3262 |
+- atomic_dec(&pm_abort_suspend); |
3263 |
++ atomic_dec_if_positive(&pm_abort_suspend); |
3264 |
+ } |
3265 |
+ |
3266 |
+ void pm_wakeup_clear(bool reset) |
3267 |
+diff --git a/drivers/bcma/driver_pci.c b/drivers/bcma/driver_pci.c |
3268 |
+index f499a469e66d..12b2cc9a3fbe 100644 |
3269 |
+--- a/drivers/bcma/driver_pci.c |
3270 |
++++ b/drivers/bcma/driver_pci.c |
3271 |
+@@ -78,7 +78,7 @@ static u16 bcma_pcie_mdio_read(struct bcma_drv_pci *pc, u16 device, u8 address) |
3272 |
+ v |= (address << BCMA_CORE_PCI_MDIODATA_REGADDR_SHF_OLD); |
3273 |
+ } |
3274 |
+ |
3275 |
+- v = BCMA_CORE_PCI_MDIODATA_START; |
3276 |
++ v |= BCMA_CORE_PCI_MDIODATA_START; |
3277 |
+ v |= BCMA_CORE_PCI_MDIODATA_READ; |
3278 |
+ v |= BCMA_CORE_PCI_MDIODATA_TA; |
3279 |
+ |
3280 |
+@@ -121,7 +121,7 @@ static void bcma_pcie_mdio_write(struct bcma_drv_pci *pc, u16 device, |
3281 |
+ v |= (address << BCMA_CORE_PCI_MDIODATA_REGADDR_SHF_OLD); |
3282 |
+ } |
3283 |
+ |
3284 |
+- v = BCMA_CORE_PCI_MDIODATA_START; |
3285 |
++ v |= BCMA_CORE_PCI_MDIODATA_START; |
3286 |
+ v |= BCMA_CORE_PCI_MDIODATA_WRITE; |
3287 |
+ v |= BCMA_CORE_PCI_MDIODATA_TA; |
3288 |
+ v |= data; |
3289 |
+diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c |
3290 |
+index a49a8d91a599..5e3885f5729b 100644 |
3291 |
+--- a/drivers/block/drbd/drbd_main.c |
3292 |
++++ b/drivers/block/drbd/drbd_main.c |
3293 |
+@@ -334,6 +334,8 @@ static int drbd_thread_setup(void *arg) |
3294 |
+ thi->name[0], |
3295 |
+ resource->name); |
3296 |
+ |
3297 |
++ allow_kernel_signal(DRBD_SIGKILL); |
3298 |
++ allow_kernel_signal(SIGXCPU); |
3299 |
+ restart: |
3300 |
+ retval = thi->function(thi); |
3301 |
+ |
3302 |
+diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c |
3303 |
+index 585378bc988c..b942f4c8cea8 100644 |
3304 |
+--- a/drivers/block/rbd.c |
3305 |
++++ b/drivers/block/rbd.c |
3306 |
+@@ -2506,6 +2506,7 @@ again: |
3307 |
+ ret = rbd_obj_issue_copyup(obj_req, obj_req->xferred); |
3308 |
+ if (ret) { |
3309 |
+ obj_req->result = ret; |
3310 |
++ obj_req->xferred = 0; |
3311 |
+ return true; |
3312 |
+ } |
3313 |
+ return false; |
3314 |
+diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c |
3315 |
+index b6f63e762021..54c8c8644df2 100644 |
3316 |
+--- a/drivers/bus/ti-sysc.c |
3317 |
++++ b/drivers/bus/ti-sysc.c |
3318 |
+@@ -888,10 +888,10 @@ static const struct sysc_revision_quirk sysc_revision_quirks[] = { |
3319 |
+ SYSC_QUIRK("smartreflex", 0, -1, 0x38, -1, 0x00000000, 0xffffffff, |
3320 |
+ SYSC_QUIRK_LEGACY_IDLE), |
3321 |
+ SYSC_QUIRK("timer", 0, 0, 0x10, 0x14, 0x00000015, 0xffffffff, |
3322 |
+- SYSC_QUIRK_LEGACY_IDLE), |
3323 |
++ 0), |
3324 |
+ /* Some timers on omap4 and later */ |
3325 |
+ SYSC_QUIRK("timer", 0, 0, 0x10, -1, 0x4fff1301, 0xffffffff, |
3326 |
+- SYSC_QUIRK_LEGACY_IDLE), |
3327 |
++ 0), |
3328 |
+ SYSC_QUIRK("uart", 0, 0x50, 0x54, 0x58, 0x00000052, 0xffffffff, |
3329 |
+ SYSC_QUIRK_LEGACY_IDLE), |
3330 |
+ /* Uarts on omap4 and later */ |
3331 |
+@@ -1400,6 +1400,9 @@ static void sysc_unprepare(struct sysc *ddata) |
3332 |
+ { |
3333 |
+ int i; |
3334 |
+ |
3335 |
++ if (!ddata->clocks) |
3336 |
++ return; |
3337 |
++ |
3338 |
+ for (i = 0; i < SYSC_MAX_CLOCKS; i++) { |
3339 |
+ if (!IS_ERR_OR_NULL(ddata->clocks[i])) |
3340 |
+ clk_unprepare(ddata->clocks[i]); |
3341 |
+@@ -1593,6 +1596,16 @@ static const struct sysc_regbits sysc_regbits_omap4_mcasp = { |
3342 |
+ static const struct sysc_capabilities sysc_omap4_mcasp = { |
3343 |
+ .type = TI_SYSC_OMAP4_MCASP, |
3344 |
+ .regbits = &sysc_regbits_omap4_mcasp, |
3345 |
++ .mod_quirks = SYSC_QUIRK_OPT_CLKS_NEEDED, |
3346 |
++}; |
3347 |
++ |
3348 |
++/* |
3349 |
++ * McASP found on dra7 and later |
3350 |
++ */ |
3351 |
++static const struct sysc_capabilities sysc_dra7_mcasp = { |
3352 |
++ .type = TI_SYSC_OMAP4_SIMPLE, |
3353 |
++ .regbits = &sysc_regbits_omap4_simple, |
3354 |
++ .mod_quirks = SYSC_QUIRK_OPT_CLKS_NEEDED, |
3355 |
+ }; |
3356 |
+ |
3357 |
+ /* |
3358 |
+@@ -1821,6 +1834,7 @@ static const struct of_device_id sysc_match[] = { |
3359 |
+ { .compatible = "ti,sysc-omap3-sham", .data = &sysc_omap3_sham, }, |
3360 |
+ { .compatible = "ti,sysc-omap-aes", .data = &sysc_omap3_aes, }, |
3361 |
+ { .compatible = "ti,sysc-mcasp", .data = &sysc_omap4_mcasp, }, |
3362 |
++ { .compatible = "ti,sysc-dra7-mcasp", .data = &sysc_dra7_mcasp, }, |
3363 |
+ { .compatible = "ti,sysc-usb-host-fs", |
3364 |
+ .data = &sysc_omap4_usb_host_fs, }, |
3365 |
+ { .compatible = "ti,sysc-dra7-mcan", .data = &sysc_dra7_mcan, }, |
3366 |
+diff --git a/drivers/char/hw_random/bcm2835-rng.c b/drivers/char/hw_random/bcm2835-rng.c |
3367 |
+index 6767d965c36c..19bde680aee1 100644 |
3368 |
+--- a/drivers/char/hw_random/bcm2835-rng.c |
3369 |
++++ b/drivers/char/hw_random/bcm2835-rng.c |
3370 |
+@@ -171,14 +171,16 @@ static int bcm2835_rng_probe(struct platform_device *pdev) |
3371 |
+ priv->rng.read = bcm2835_rng_read; |
3372 |
+ priv->rng.cleanup = bcm2835_rng_cleanup; |
3373 |
+ |
3374 |
+- rng_id = of_match_node(bcm2835_rng_of_match, np); |
3375 |
+- if (!rng_id) |
3376 |
+- return -EINVAL; |
3377 |
+- |
3378 |
+- /* Check for rng init function, execute it */ |
3379 |
+- of_data = rng_id->data; |
3380 |
+- if (of_data) |
3381 |
+- priv->mask_interrupts = of_data->mask_interrupts; |
3382 |
++ if (dev_of_node(dev)) { |
3383 |
++ rng_id = of_match_node(bcm2835_rng_of_match, np); |
3384 |
++ if (!rng_id) |
3385 |
++ return -EINVAL; |
3386 |
++ |
3387 |
++ /* Check for rng init function, execute it */ |
3388 |
++ of_data = rng_id->data; |
3389 |
++ if (of_data) |
3390 |
++ priv->mask_interrupts = of_data->mask_interrupts; |
3391 |
++ } |
3392 |
+ |
3393 |
+ /* register driver */ |
3394 |
+ err = devm_hwrng_register(dev, &priv->rng); |
3395 |
+diff --git a/drivers/char/hw_random/omap3-rom-rng.c b/drivers/char/hw_random/omap3-rom-rng.c |
3396 |
+index 648e39ce6bd9..8df3cad7c97a 100644 |
3397 |
+--- a/drivers/char/hw_random/omap3-rom-rng.c |
3398 |
++++ b/drivers/char/hw_random/omap3-rom-rng.c |
3399 |
+@@ -20,6 +20,8 @@ |
3400 |
+ #include <linux/workqueue.h> |
3401 |
+ #include <linux/clk.h> |
3402 |
+ #include <linux/err.h> |
3403 |
++#include <linux/of.h> |
3404 |
++#include <linux/of_device.h> |
3405 |
+ #include <linux/platform_device.h> |
3406 |
+ |
3407 |
+ #define RNG_RESET 0x01 |
3408 |
+@@ -86,14 +88,18 @@ static int omap3_rom_rng_read(struct hwrng *rng, void *data, size_t max, bool w) |
3409 |
+ |
3410 |
+ static struct hwrng omap3_rom_rng_ops = { |
3411 |
+ .name = "omap3-rom", |
3412 |
+- .read = omap3_rom_rng_read, |
3413 |
+ }; |
3414 |
+ |
3415 |
+ static int omap3_rom_rng_probe(struct platform_device *pdev) |
3416 |
+ { |
3417 |
+ int ret = 0; |
3418 |
+ |
3419 |
+- pr_info("initializing\n"); |
3420 |
++ omap3_rom_rng_ops.read = of_device_get_match_data(&pdev->dev); |
3421 |
++ if (!omap3_rom_rng_ops.read) { |
3422 |
++ dev_err(&pdev->dev, "missing rom code handler\n"); |
3423 |
++ |
3424 |
++ return -ENODEV; |
3425 |
++ } |
3426 |
+ |
3427 |
+ omap3_rom_rng_call = pdev->dev.platform_data; |
3428 |
+ if (!omap3_rom_rng_call) { |
3429 |
+@@ -126,9 +132,16 @@ static int omap3_rom_rng_remove(struct platform_device *pdev) |
3430 |
+ return 0; |
3431 |
+ } |
3432 |
+ |
3433 |
++static const struct of_device_id omap_rom_rng_match[] = { |
3434 |
++ { .compatible = "nokia,n900-rom-rng", .data = omap3_rom_rng_read, }, |
3435 |
++ { /* sentinel */ }, |
3436 |
++}; |
3437 |
++MODULE_DEVICE_TABLE(of, omap_rom_rng_match); |
3438 |
++ |
3439 |
+ static struct platform_driver omap3_rom_rng_driver = { |
3440 |
+ .driver = { |
3441 |
+ .name = "omap3-rom-rng", |
3442 |
++ .of_match_table = omap_rom_rng_match, |
3443 |
+ }, |
3444 |
+ .probe = omap3_rom_rng_probe, |
3445 |
+ .remove = omap3_rom_rng_remove, |
3446 |
+diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c |
3447 |
+index 91f2d9219489..980eb7c60952 100644 |
3448 |
+--- a/drivers/char/ipmi/ipmi_msghandler.c |
3449 |
++++ b/drivers/char/ipmi/ipmi_msghandler.c |
3450 |
+@@ -2965,8 +2965,11 @@ static int __ipmi_bmc_register(struct ipmi_smi *intf, |
3451 |
+ bmc->pdev.name = "ipmi_bmc"; |
3452 |
+ |
3453 |
+ rv = ida_simple_get(&ipmi_bmc_ida, 0, 0, GFP_KERNEL); |
3454 |
+- if (rv < 0) |
3455 |
++ if (rv < 0) { |
3456 |
++ kfree(bmc); |
3457 |
+ goto out; |
3458 |
++ } |
3459 |
++ |
3460 |
+ bmc->pdev.dev.driver = &ipmidriver.driver; |
3461 |
+ bmc->pdev.id = rv; |
3462 |
+ bmc->pdev.dev.release = release_bmc_device; |
3463 |
+diff --git a/drivers/char/ipmi/kcs_bmc.c b/drivers/char/ipmi/kcs_bmc.c |
3464 |
+index e6124bd548df..ed4dc3b1843e 100644 |
3465 |
+--- a/drivers/char/ipmi/kcs_bmc.c |
3466 |
++++ b/drivers/char/ipmi/kcs_bmc.c |
3467 |
+@@ -440,12 +440,13 @@ struct kcs_bmc *kcs_bmc_alloc(struct device *dev, int sizeof_priv, u32 channel) |
3468 |
+ kcs_bmc->data_in = devm_kmalloc(dev, KCS_MSG_BUFSIZ, GFP_KERNEL); |
3469 |
+ kcs_bmc->data_out = devm_kmalloc(dev, KCS_MSG_BUFSIZ, GFP_KERNEL); |
3470 |
+ kcs_bmc->kbuffer = devm_kmalloc(dev, KCS_MSG_BUFSIZ, GFP_KERNEL); |
3471 |
+- if (!kcs_bmc->data_in || !kcs_bmc->data_out || !kcs_bmc->kbuffer) |
3472 |
+- return NULL; |
3473 |
+ |
3474 |
+ kcs_bmc->miscdev.minor = MISC_DYNAMIC_MINOR; |
3475 |
+ kcs_bmc->miscdev.name = devm_kasprintf(dev, GFP_KERNEL, "%s%u", |
3476 |
+ DEVICE_NAME, channel); |
3477 |
++ if (!kcs_bmc->data_in || !kcs_bmc->data_out || !kcs_bmc->kbuffer || |
3478 |
++ !kcs_bmc->miscdev.name) |
3479 |
++ return NULL; |
3480 |
+ kcs_bmc->miscdev.fops = &kcs_bmc_fops; |
3481 |
+ |
3482 |
+ return kcs_bmc; |
3483 |
+diff --git a/drivers/clk/actions/owl-factor.c b/drivers/clk/actions/owl-factor.c |
3484 |
+index 317d4a9e112e..f15e2621fa18 100644 |
3485 |
+--- a/drivers/clk/actions/owl-factor.c |
3486 |
++++ b/drivers/clk/actions/owl-factor.c |
3487 |
+@@ -64,11 +64,10 @@ static unsigned int _get_table_val(const struct clk_factor_table *table, |
3488 |
+ return val; |
3489 |
+ } |
3490 |
+ |
3491 |
+-static int clk_val_best(struct clk_hw *hw, unsigned long rate, |
3492 |
++static int owl_clk_val_best(const struct owl_factor_hw *factor_hw, |
3493 |
++ struct clk_hw *hw, unsigned long rate, |
3494 |
+ unsigned long *best_parent_rate) |
3495 |
+ { |
3496 |
+- struct owl_factor *factor = hw_to_owl_factor(hw); |
3497 |
+- struct owl_factor_hw *factor_hw = &factor->factor_hw; |
3498 |
+ const struct clk_factor_table *clkt = factor_hw->table; |
3499 |
+ unsigned long parent_rate, try_parent_rate, best = 0, cur_rate; |
3500 |
+ unsigned long parent_rate_saved = *best_parent_rate; |
3501 |
+@@ -126,7 +125,7 @@ long owl_factor_helper_round_rate(struct owl_clk_common *common, |
3502 |
+ const struct clk_factor_table *clkt = factor_hw->table; |
3503 |
+ unsigned int val, mul = 0, div = 1; |
3504 |
+ |
3505 |
+- val = clk_val_best(&common->hw, rate, parent_rate); |
3506 |
++ val = owl_clk_val_best(factor_hw, &common->hw, rate, parent_rate); |
3507 |
+ _get_table_div_mul(clkt, val, &mul, &div); |
3508 |
+ |
3509 |
+ return *parent_rate * mul / div; |
3510 |
+diff --git a/drivers/clk/clk-highbank.c b/drivers/clk/clk-highbank.c |
3511 |
+index 727ed8e1bb72..8e4581004695 100644 |
3512 |
+--- a/drivers/clk/clk-highbank.c |
3513 |
++++ b/drivers/clk/clk-highbank.c |
3514 |
+@@ -293,6 +293,7 @@ static __init struct clk *hb_clk_init(struct device_node *node, const struct clk |
3515 |
+ /* Map system registers */ |
3516 |
+ srnp = of_find_compatible_node(NULL, NULL, "calxeda,hb-sregs"); |
3517 |
+ hb_clk->reg = of_iomap(srnp, 0); |
3518 |
++ of_node_put(srnp); |
3519 |
+ BUG_ON(!hb_clk->reg); |
3520 |
+ hb_clk->reg += reg; |
3521 |
+ |
3522 |
+diff --git a/drivers/clk/clk-qoriq.c b/drivers/clk/clk-qoriq.c |
3523 |
+index 8abc5c8cb8b8..a0713b2a12f3 100644 |
3524 |
+--- a/drivers/clk/clk-qoriq.c |
3525 |
++++ b/drivers/clk/clk-qoriq.c |
3526 |
+@@ -1389,6 +1389,7 @@ static void __init clockgen_init(struct device_node *np) |
3527 |
+ pr_err("%s: Couldn't map %pOF regs\n", __func__, |
3528 |
+ guts); |
3529 |
+ } |
3530 |
++ of_node_put(guts); |
3531 |
+ } |
3532 |
+ |
3533 |
+ } |
3534 |
+diff --git a/drivers/clk/imx/clk-imx6q.c b/drivers/clk/imx/clk-imx6q.c |
3535 |
+index c509324f6338..8ddf9b1f1677 100644 |
3536 |
+--- a/drivers/clk/imx/clk-imx6q.c |
3537 |
++++ b/drivers/clk/imx/clk-imx6q.c |
3538 |
+@@ -424,6 +424,7 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node) |
3539 |
+ np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-anatop"); |
3540 |
+ anatop_base = base = of_iomap(np, 0); |
3541 |
+ WARN_ON(!base); |
3542 |
++ of_node_put(np); |
3543 |
+ |
3544 |
+ /* Audio/video PLL post dividers do not work on i.MX6q revision 1.0 */ |
3545 |
+ if (clk_on_imx6q() && imx_get_soc_revision() == IMX_CHIP_REVISION_1_0) { |
3546 |
+diff --git a/drivers/clk/imx/clk-imx6sx.c b/drivers/clk/imx/clk-imx6sx.c |
3547 |
+index d9f2890ffe62..57ab96a47775 100644 |
3548 |
+--- a/drivers/clk/imx/clk-imx6sx.c |
3549 |
++++ b/drivers/clk/imx/clk-imx6sx.c |
3550 |
+@@ -151,6 +151,7 @@ static void __init imx6sx_clocks_init(struct device_node *ccm_node) |
3551 |
+ np = of_find_compatible_node(NULL, NULL, "fsl,imx6sx-anatop"); |
3552 |
+ base = of_iomap(np, 0); |
3553 |
+ WARN_ON(!base); |
3554 |
++ of_node_put(np); |
3555 |
+ |
3556 |
+ clks[IMX6SX_PLL1_BYPASS_SRC] = imx_clk_mux("pll1_bypass_src", base + 0x00, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); |
3557 |
+ clks[IMX6SX_PLL2_BYPASS_SRC] = imx_clk_mux("pll2_bypass_src", base + 0x30, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); |
3558 |
+diff --git a/drivers/clk/imx/clk-imx7d.c b/drivers/clk/imx/clk-imx7d.c |
3559 |
+index 881b772c4ac9..83412bc36ebf 100644 |
3560 |
+--- a/drivers/clk/imx/clk-imx7d.c |
3561 |
++++ b/drivers/clk/imx/clk-imx7d.c |
3562 |
+@@ -413,6 +413,7 @@ static void __init imx7d_clocks_init(struct device_node *ccm_node) |
3563 |
+ np = of_find_compatible_node(NULL, NULL, "fsl,imx7d-anatop"); |
3564 |
+ base = of_iomap(np, 0); |
3565 |
+ WARN_ON(!base); |
3566 |
++ of_node_put(np); |
3567 |
+ |
3568 |
+ clks[IMX7D_PLL_ARM_MAIN_SRC] = imx_clk_mux("pll_arm_main_src", base + 0x60, 14, 2, pll_bypass_src_sel, ARRAY_SIZE(pll_bypass_src_sel)); |
3569 |
+ clks[IMX7D_PLL_DRAM_MAIN_SRC] = imx_clk_mux("pll_dram_main_src", base + 0x70, 14, 2, pll_bypass_src_sel, ARRAY_SIZE(pll_bypass_src_sel)); |
3570 |
+diff --git a/drivers/clk/imx/clk-vf610.c b/drivers/clk/imx/clk-vf610.c |
3571 |
+index 6dae54325a91..a334667c450a 100644 |
3572 |
+--- a/drivers/clk/imx/clk-vf610.c |
3573 |
++++ b/drivers/clk/imx/clk-vf610.c |
3574 |
+@@ -203,6 +203,7 @@ static void __init vf610_clocks_init(struct device_node *ccm_node) |
3575 |
+ np = of_find_compatible_node(NULL, NULL, "fsl,vf610-anatop"); |
3576 |
+ anatop_base = of_iomap(np, 0); |
3577 |
+ BUG_ON(!anatop_base); |
3578 |
++ of_node_put(np); |
3579 |
+ |
3580 |
+ np = ccm_node; |
3581 |
+ ccm_base = of_iomap(np, 0); |
3582 |
+diff --git a/drivers/clk/ingenic/jz4740-cgu.c b/drivers/clk/ingenic/jz4740-cgu.c |
3583 |
+index 4479c102e899..b86edd328249 100644 |
3584 |
+--- a/drivers/clk/ingenic/jz4740-cgu.c |
3585 |
++++ b/drivers/clk/ingenic/jz4740-cgu.c |
3586 |
+@@ -165,7 +165,7 @@ static const struct ingenic_cgu_clk_info jz4740_cgu_clocks[] = { |
3587 |
+ .parents = { JZ4740_CLK_EXT, JZ4740_CLK_PLL_HALF, -1, -1 }, |
3588 |
+ .mux = { CGU_REG_CPCCR, 29, 1 }, |
3589 |
+ .div = { CGU_REG_CPCCR, 23, 1, 6, -1, -1, -1 }, |
3590 |
+- .gate = { CGU_REG_SCR, 6 }, |
3591 |
++ .gate = { CGU_REG_SCR, 6, true }, |
3592 |
+ }, |
3593 |
+ |
3594 |
+ /* Gate-only clocks */ |
3595 |
+diff --git a/drivers/clk/meson/axg.c b/drivers/clk/meson/axg.c |
3596 |
+index 02229d051d77..4e7dac24948b 100644 |
3597 |
+--- a/drivers/clk/meson/axg.c |
3598 |
++++ b/drivers/clk/meson/axg.c |
3599 |
+@@ -461,11 +461,6 @@ static struct clk_regmap axg_mpll0_div = { |
3600 |
+ .shift = 16, |
3601 |
+ .width = 9, |
3602 |
+ }, |
3603 |
+- .ssen = { |
3604 |
+- .reg_off = HHI_MPLL_CNTL, |
3605 |
+- .shift = 25, |
3606 |
+- .width = 1, |
3607 |
+- }, |
3608 |
+ .misc = { |
3609 |
+ .reg_off = HHI_PLL_TOP_MISC, |
3610 |
+ .shift = 0, |
3611 |
+@@ -560,6 +555,11 @@ static struct clk_regmap axg_mpll2_div = { |
3612 |
+ .shift = 16, |
3613 |
+ .width = 9, |
3614 |
+ }, |
3615 |
++ .ssen = { |
3616 |
++ .reg_off = HHI_MPLL_CNTL, |
3617 |
++ .shift = 25, |
3618 |
++ .width = 1, |
3619 |
++ }, |
3620 |
+ .misc = { |
3621 |
+ .reg_off = HHI_PLL_TOP_MISC, |
3622 |
+ .shift = 2, |
3623 |
+diff --git a/drivers/clk/meson/gxbb.c b/drivers/clk/meson/gxbb.c |
3624 |
+index b039909e03cf..38ffa51a5bad 100644 |
3625 |
+--- a/drivers/clk/meson/gxbb.c |
3626 |
++++ b/drivers/clk/meson/gxbb.c |
3627 |
+@@ -650,11 +650,6 @@ static struct clk_regmap gxbb_mpll0_div = { |
3628 |
+ .shift = 16, |
3629 |
+ .width = 9, |
3630 |
+ }, |
3631 |
+- .ssen = { |
3632 |
+- .reg_off = HHI_MPLL_CNTL, |
3633 |
+- .shift = 25, |
3634 |
+- .width = 1, |
3635 |
+- }, |
3636 |
+ .lock = &meson_clk_lock, |
3637 |
+ }, |
3638 |
+ .hw.init = &(struct clk_init_data){ |
3639 |
+diff --git a/drivers/clk/mvebu/armada-370.c b/drivers/clk/mvebu/armada-370.c |
3640 |
+index 2c7c1085f883..8fdfa97900cd 100644 |
3641 |
+--- a/drivers/clk/mvebu/armada-370.c |
3642 |
++++ b/drivers/clk/mvebu/armada-370.c |
3643 |
+@@ -177,8 +177,10 @@ static void __init a370_clk_init(struct device_node *np) |
3644 |
+ |
3645 |
+ mvebu_coreclk_setup(np, &a370_coreclks); |
3646 |
+ |
3647 |
+- if (cgnp) |
3648 |
++ if (cgnp) { |
3649 |
+ mvebu_clk_gating_setup(cgnp, a370_gating_desc); |
3650 |
++ of_node_put(cgnp); |
3651 |
++ } |
3652 |
+ } |
3653 |
+ CLK_OF_DECLARE(a370_clk, "marvell,armada-370-core-clock", a370_clk_init); |
3654 |
+ |
3655 |
+diff --git a/drivers/clk/mvebu/armada-xp.c b/drivers/clk/mvebu/armada-xp.c |
3656 |
+index 0ec44ae9a2a2..df529982adc9 100644 |
3657 |
+--- a/drivers/clk/mvebu/armada-xp.c |
3658 |
++++ b/drivers/clk/mvebu/armada-xp.c |
3659 |
+@@ -228,7 +228,9 @@ static void __init axp_clk_init(struct device_node *np) |
3660 |
+ |
3661 |
+ mvebu_coreclk_setup(np, &axp_coreclks); |
3662 |
+ |
3663 |
+- if (cgnp) |
3664 |
++ if (cgnp) { |
3665 |
+ mvebu_clk_gating_setup(cgnp, axp_gating_desc); |
3666 |
++ of_node_put(cgnp); |
3667 |
++ } |
3668 |
+ } |
3669 |
+ CLK_OF_DECLARE(axp_clk, "marvell,armada-xp-core-clock", axp_clk_init); |
3670 |
+diff --git a/drivers/clk/mvebu/dove.c b/drivers/clk/mvebu/dove.c |
3671 |
+index 59fad9546c84..5f258c9bb68b 100644 |
3672 |
+--- a/drivers/clk/mvebu/dove.c |
3673 |
++++ b/drivers/clk/mvebu/dove.c |
3674 |
+@@ -190,10 +190,14 @@ static void __init dove_clk_init(struct device_node *np) |
3675 |
+ |
3676 |
+ mvebu_coreclk_setup(np, &dove_coreclks); |
3677 |
+ |
3678 |
+- if (ddnp) |
3679 |
++ if (ddnp) { |
3680 |
+ dove_divider_clk_init(ddnp); |
3681 |
++ of_node_put(ddnp); |
3682 |
++ } |
3683 |
+ |
3684 |
+- if (cgnp) |
3685 |
++ if (cgnp) { |
3686 |
+ mvebu_clk_gating_setup(cgnp, dove_gating_desc); |
3687 |
++ of_node_put(cgnp); |
3688 |
++ } |
3689 |
+ } |
3690 |
+ CLK_OF_DECLARE(dove_clk, "marvell,dove-core-clock", dove_clk_init); |
3691 |
+diff --git a/drivers/clk/mvebu/kirkwood.c b/drivers/clk/mvebu/kirkwood.c |
3692 |
+index a2a8d614039d..890ebf623261 100644 |
3693 |
+--- a/drivers/clk/mvebu/kirkwood.c |
3694 |
++++ b/drivers/clk/mvebu/kirkwood.c |
3695 |
+@@ -333,6 +333,8 @@ static void __init kirkwood_clk_init(struct device_node *np) |
3696 |
+ if (cgnp) { |
3697 |
+ mvebu_clk_gating_setup(cgnp, kirkwood_gating_desc); |
3698 |
+ kirkwood_clk_muxing_setup(cgnp, kirkwood_mux_desc); |
3699 |
++ |
3700 |
++ of_node_put(cgnp); |
3701 |
+ } |
3702 |
+ } |
3703 |
+ CLK_OF_DECLARE(kirkwood_clk, "marvell,kirkwood-core-clock", |
3704 |
+diff --git a/drivers/clk/mvebu/mv98dx3236.c b/drivers/clk/mvebu/mv98dx3236.c |
3705 |
+index 6e203af73cac..c8a0d03d2cd6 100644 |
3706 |
+--- a/drivers/clk/mvebu/mv98dx3236.c |
3707 |
++++ b/drivers/clk/mvebu/mv98dx3236.c |
3708 |
+@@ -174,7 +174,9 @@ static void __init mv98dx3236_clk_init(struct device_node *np) |
3709 |
+ |
3710 |
+ mvebu_coreclk_setup(np, &mv98dx3236_core_clocks); |
3711 |
+ |
3712 |
+- if (cgnp) |
3713 |
++ if (cgnp) { |
3714 |
+ mvebu_clk_gating_setup(cgnp, mv98dx3236_gating_desc); |
3715 |
++ of_node_put(cgnp); |
3716 |
++ } |
3717 |
+ } |
3718 |
+ CLK_OF_DECLARE(mv98dx3236_clk, "marvell,mv98dx3236-core-clock", mv98dx3236_clk_init); |
3719 |
+diff --git a/drivers/clk/qcom/gcc-msm8996.c b/drivers/clk/qcom/gcc-msm8996.c |
3720 |
+index 9a3290fdd01b..bea55c461cee 100644 |
3721 |
+--- a/drivers/clk/qcom/gcc-msm8996.c |
3722 |
++++ b/drivers/clk/qcom/gcc-msm8996.c |
3723 |
+@@ -138,22 +138,6 @@ static const char * const gcc_xo_gpll0_gpll4_gpll0_early_div[] = { |
3724 |
+ "gpll0_early_div" |
3725 |
+ }; |
3726 |
+ |
3727 |
+-static const struct parent_map gcc_xo_gpll0_gpll2_gpll3_gpll0_early_div_map[] = { |
3728 |
+- { P_XO, 0 }, |
3729 |
+- { P_GPLL0, 1 }, |
3730 |
+- { P_GPLL2, 2 }, |
3731 |
+- { P_GPLL3, 3 }, |
3732 |
+- { P_GPLL0_EARLY_DIV, 6 } |
3733 |
+-}; |
3734 |
+- |
3735 |
+-static const char * const gcc_xo_gpll0_gpll2_gpll3_gpll0_early_div[] = { |
3736 |
+- "xo", |
3737 |
+- "gpll0", |
3738 |
+- "gpll2", |
3739 |
+- "gpll3", |
3740 |
+- "gpll0_early_div" |
3741 |
+-}; |
3742 |
+- |
3743 |
+ static const struct parent_map gcc_xo_gpll0_gpll1_early_div_gpll1_gpll4_gpll0_early_div_map[] = { |
3744 |
+ { P_XO, 0 }, |
3745 |
+ { P_GPLL0, 1 }, |
3746 |
+@@ -192,26 +176,6 @@ static const char * const gcc_xo_gpll0_gpll2_gpll3_gpll1_gpll2_early_gpll0_early |
3747 |
+ "gpll0_early_div" |
3748 |
+ }; |
3749 |
+ |
3750 |
+-static const struct parent_map gcc_xo_gpll0_gpll2_gpll3_gpll1_gpll4_gpll0_early_div_map[] = { |
3751 |
+- { P_XO, 0 }, |
3752 |
+- { P_GPLL0, 1 }, |
3753 |
+- { P_GPLL2, 2 }, |
3754 |
+- { P_GPLL3, 3 }, |
3755 |
+- { P_GPLL1, 4 }, |
3756 |
+- { P_GPLL4, 5 }, |
3757 |
+- { P_GPLL0_EARLY_DIV, 6 } |
3758 |
+-}; |
3759 |
+- |
3760 |
+-static const char * const gcc_xo_gpll0_gpll2_gpll3_gpll1_gpll4_gpll0_early_div[] = { |
3761 |
+- "xo", |
3762 |
+- "gpll0", |
3763 |
+- "gpll2", |
3764 |
+- "gpll3", |
3765 |
+- "gpll1", |
3766 |
+- "gpll4", |
3767 |
+- "gpll0_early_div" |
3768 |
+-}; |
3769 |
+- |
3770 |
+ static struct clk_fixed_factor xo = { |
3771 |
+ .mult = 1, |
3772 |
+ .div = 1, |
3773 |
+diff --git a/drivers/clk/qcom/gcc-msm8998.c b/drivers/clk/qcom/gcc-msm8998.c |
3774 |
+index 4e23973b6cd1..772a08101ddf 100644 |
3775 |
+--- a/drivers/clk/qcom/gcc-msm8998.c |
3776 |
++++ b/drivers/clk/qcom/gcc-msm8998.c |
3777 |
+@@ -2144,7 +2144,7 @@ static struct clk_branch gcc_pcie_0_mstr_axi_clk = { |
3778 |
+ |
3779 |
+ static struct clk_branch gcc_pcie_0_pipe_clk = { |
3780 |
+ .halt_reg = 0x6b018, |
3781 |
+- .halt_check = BRANCH_HALT, |
3782 |
++ .halt_check = BRANCH_HALT_SKIP, |
3783 |
+ .clkr = { |
3784 |
+ .enable_reg = 0x6b018, |
3785 |
+ .enable_mask = BIT(0), |
3786 |
+diff --git a/drivers/clk/samsung/clk-exynos4.c b/drivers/clk/samsung/clk-exynos4.c |
3787 |
+index 0421960eb963..442309b56920 100644 |
3788 |
+--- a/drivers/clk/samsung/clk-exynos4.c |
3789 |
++++ b/drivers/clk/samsung/clk-exynos4.c |
3790 |
+@@ -1226,6 +1226,7 @@ static unsigned long __init exynos4_get_xom(void) |
3791 |
+ xom = readl(chipid_base + 8); |
3792 |
+ |
3793 |
+ iounmap(chipid_base); |
3794 |
++ of_node_put(np); |
3795 |
+ } |
3796 |
+ |
3797 |
+ return xom; |
3798 |
+diff --git a/drivers/clk/socfpga/clk-pll-a10.c b/drivers/clk/socfpga/clk-pll-a10.c |
3799 |
+index 35fabe1a32c3..269467e8e07e 100644 |
3800 |
+--- a/drivers/clk/socfpga/clk-pll-a10.c |
3801 |
++++ b/drivers/clk/socfpga/clk-pll-a10.c |
3802 |
+@@ -95,6 +95,7 @@ static struct clk * __init __socfpga_pll_init(struct device_node *node, |
3803 |
+ |
3804 |
+ clkmgr_np = of_find_compatible_node(NULL, NULL, "altr,clk-mgr"); |
3805 |
+ clk_mgr_a10_base_addr = of_iomap(clkmgr_np, 0); |
3806 |
++ of_node_put(clkmgr_np); |
3807 |
+ BUG_ON(!clk_mgr_a10_base_addr); |
3808 |
+ pll_clk->hw.reg = clk_mgr_a10_base_addr + reg; |
3809 |
+ |
3810 |
+diff --git a/drivers/clk/socfpga/clk-pll.c b/drivers/clk/socfpga/clk-pll.c |
3811 |
+index c7f463172e4b..b4b44e9b5901 100644 |
3812 |
+--- a/drivers/clk/socfpga/clk-pll.c |
3813 |
++++ b/drivers/clk/socfpga/clk-pll.c |
3814 |
+@@ -100,6 +100,7 @@ static __init struct clk *__socfpga_pll_init(struct device_node *node, |
3815 |
+ |
3816 |
+ clkmgr_np = of_find_compatible_node(NULL, NULL, "altr,clk-mgr"); |
3817 |
+ clk_mgr_base_addr = of_iomap(clkmgr_np, 0); |
3818 |
++ of_node_put(clkmgr_np); |
3819 |
+ BUG_ON(!clk_mgr_base_addr); |
3820 |
+ pll_clk->hw.reg = clk_mgr_base_addr + reg; |
3821 |
+ |
3822 |
+diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-h6-r.c b/drivers/clk/sunxi-ng/ccu-sun50i-h6-r.c |
3823 |
+index 27554eaf6929..8d05d4f1f8a1 100644 |
3824 |
+--- a/drivers/clk/sunxi-ng/ccu-sun50i-h6-r.c |
3825 |
++++ b/drivers/clk/sunxi-ng/ccu-sun50i-h6-r.c |
3826 |
+@@ -104,7 +104,7 @@ static SUNXI_CCU_GATE(r_apb2_i2c_clk, "r-apb2-i2c", "r-apb2", |
3827 |
+ static SUNXI_CCU_GATE(r_apb1_ir_clk, "r-apb1-ir", "r-apb1", |
3828 |
+ 0x1cc, BIT(0), 0); |
3829 |
+ static SUNXI_CCU_GATE(r_apb1_w1_clk, "r-apb1-w1", "r-apb1", |
3830 |
+- 0x1cc, BIT(0), 0); |
3831 |
++ 0x1ec, BIT(0), 0); |
3832 |
+ |
3833 |
+ /* Information of IR(RX) mod clock is gathered from BSP source code */ |
3834 |
+ static const char * const r_mod0_default_parents[] = { "osc32k", "osc24M" }; |
3835 |
+diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-a23.c b/drivers/clk/sunxi-ng/ccu-sun8i-a23.c |
3836 |
+index a4fa2945f230..4b5f8f4e4ab8 100644 |
3837 |
+--- a/drivers/clk/sunxi-ng/ccu-sun8i-a23.c |
3838 |
++++ b/drivers/clk/sunxi-ng/ccu-sun8i-a23.c |
3839 |
+@@ -144,7 +144,7 @@ static SUNXI_CCU_NKM_WITH_GATE_LOCK(pll_mipi_clk, "pll-mipi", |
3840 |
+ 8, 4, /* N */ |
3841 |
+ 4, 2, /* K */ |
3842 |
+ 0, 4, /* M */ |
3843 |
+- BIT(31), /* gate */ |
3844 |
++ BIT(31) | BIT(23) | BIT(22), /* gate */ |
3845 |
+ BIT(28), /* lock */ |
3846 |
+ CLK_SET_RATE_UNGATE); |
3847 |
+ |
3848 |
+diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c b/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c |
3849 |
+index 9e3f4088724b..c7f9d974b10d 100644 |
3850 |
+--- a/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c |
3851 |
++++ b/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c |
3852 |
+@@ -84,7 +84,7 @@ static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll_ve_clk, "pll-ve", |
3853 |
+ BIT(28), /* lock */ |
3854 |
+ 0); |
3855 |
+ |
3856 |
+-static SUNXI_CCU_NKM_WITH_GATE_LOCK(pll_ddr_clk, "pll-ddr", |
3857 |
++static SUNXI_CCU_NKM_WITH_GATE_LOCK(pll_ddr0_clk, "pll-ddr0", |
3858 |
+ "osc24M", 0x020, |
3859 |
+ 8, 5, /* N */ |
3860 |
+ 4, 2, /* K */ |
3861 |
+@@ -123,6 +123,14 @@ static SUNXI_CCU_NK_WITH_GATE_LOCK_POSTDIV(pll_periph1_clk, "pll-periph1", |
3862 |
+ 2, /* post-div */ |
3863 |
+ 0); |
3864 |
+ |
3865 |
++static SUNXI_CCU_NM_WITH_GATE_LOCK(pll_ddr1_clk, "pll-ddr1", |
3866 |
++ "osc24M", 0x04c, |
3867 |
++ 8, 7, /* N */ |
3868 |
++ 0, 2, /* M */ |
3869 |
++ BIT(31), /* gate */ |
3870 |
++ BIT(28), /* lock */ |
3871 |
++ 0); |
3872 |
++ |
3873 |
+ static const char * const cpu_parents[] = { "osc32k", "osc24M", |
3874 |
+ "pll-cpu", "pll-cpu" }; |
3875 |
+ static SUNXI_CCU_MUX(cpu_clk, "cpu", cpu_parents, |
3876 |
+@@ -310,7 +318,8 @@ static SUNXI_CCU_GATE(usb_phy0_clk, "usb-phy0", "osc24M", |
3877 |
+ static SUNXI_CCU_GATE(usb_ohci0_clk, "usb-ohci0", "osc24M", |
3878 |
+ 0x0cc, BIT(16), 0); |
3879 |
+ |
3880 |
+-static const char * const dram_parents[] = { "pll-ddr", "pll-periph0-2x" }; |
3881 |
++static const char * const dram_parents[] = { "pll-ddr0", "pll-ddr1", |
3882 |
++ "pll-periph0-2x" }; |
3883 |
+ static SUNXI_CCU_M_WITH_MUX(dram_clk, "dram", dram_parents, |
3884 |
+ 0x0f4, 0, 4, 20, 2, CLK_IS_CRITICAL); |
3885 |
+ |
3886 |
+@@ -369,10 +378,11 @@ static struct ccu_common *sun8i_v3s_ccu_clks[] = { |
3887 |
+ &pll_audio_base_clk.common, |
3888 |
+ &pll_video_clk.common, |
3889 |
+ &pll_ve_clk.common, |
3890 |
+- &pll_ddr_clk.common, |
3891 |
++ &pll_ddr0_clk.common, |
3892 |
+ &pll_periph0_clk.common, |
3893 |
+ &pll_isp_clk.common, |
3894 |
+ &pll_periph1_clk.common, |
3895 |
++ &pll_ddr1_clk.common, |
3896 |
+ &cpu_clk.common, |
3897 |
+ &axi_clk.common, |
3898 |
+ &ahb1_clk.common, |
3899 |
+@@ -457,11 +467,12 @@ static struct clk_hw_onecell_data sun8i_v3s_hw_clks = { |
3900 |
+ [CLK_PLL_AUDIO_8X] = &pll_audio_8x_clk.hw, |
3901 |
+ [CLK_PLL_VIDEO] = &pll_video_clk.common.hw, |
3902 |
+ [CLK_PLL_VE] = &pll_ve_clk.common.hw, |
3903 |
+- [CLK_PLL_DDR] = &pll_ddr_clk.common.hw, |
3904 |
++ [CLK_PLL_DDR0] = &pll_ddr0_clk.common.hw, |
3905 |
+ [CLK_PLL_PERIPH0] = &pll_periph0_clk.common.hw, |
3906 |
+ [CLK_PLL_PERIPH0_2X] = &pll_periph0_2x_clk.hw, |
3907 |
+ [CLK_PLL_ISP] = &pll_isp_clk.common.hw, |
3908 |
+ [CLK_PLL_PERIPH1] = &pll_periph1_clk.common.hw, |
3909 |
++ [CLK_PLL_DDR1] = &pll_ddr1_clk.common.hw, |
3910 |
+ [CLK_CPU] = &cpu_clk.common.hw, |
3911 |
+ [CLK_AXI] = &axi_clk.common.hw, |
3912 |
+ [CLK_AHB1] = &ahb1_clk.common.hw, |
3913 |
+diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-v3s.h b/drivers/clk/sunxi-ng/ccu-sun8i-v3s.h |
3914 |
+index 4a4d36fdad96..a091b7217dfd 100644 |
3915 |
+--- a/drivers/clk/sunxi-ng/ccu-sun8i-v3s.h |
3916 |
++++ b/drivers/clk/sunxi-ng/ccu-sun8i-v3s.h |
3917 |
+@@ -29,7 +29,7 @@ |
3918 |
+ #define CLK_PLL_AUDIO_8X 5 |
3919 |
+ #define CLK_PLL_VIDEO 6 |
3920 |
+ #define CLK_PLL_VE 7 |
3921 |
+-#define CLK_PLL_DDR 8 |
3922 |
++#define CLK_PLL_DDR0 8 |
3923 |
+ #define CLK_PLL_PERIPH0 9 |
3924 |
+ #define CLK_PLL_PERIPH0_2X 10 |
3925 |
+ #define CLK_PLL_ISP 11 |
3926 |
+@@ -58,6 +58,8 @@ |
3927 |
+ |
3928 |
+ /* And the GPU module clock is exported */ |
3929 |
+ |
3930 |
+-#define CLK_NUMBER (CLK_MIPI_CSI + 1) |
3931 |
++#define CLK_PLL_DDR1 74 |
3932 |
++ |
3933 |
++#define CLK_NUMBER (CLK_PLL_DDR1 + 1) |
3934 |
+ |
3935 |
+ #endif /* _CCU_SUN8I_H3_H_ */ |
3936 |
+diff --git a/drivers/clk/ti/clk.c b/drivers/clk/ti/clk.c |
3937 |
+index 27e0979b3158..0cc87c6ae91c 100644 |
3938 |
+--- a/drivers/clk/ti/clk.c |
3939 |
++++ b/drivers/clk/ti/clk.c |
3940 |
+@@ -188,9 +188,13 @@ void __init ti_dt_clocks_register(struct ti_dt_clk oclks[]) |
3941 |
+ clkdev_add(&c->lk); |
3942 |
+ } else { |
3943 |
+ if (num_args && !has_clkctrl_data) { |
3944 |
+- if (of_find_compatible_node(NULL, NULL, |
3945 |
+- "ti,clkctrl")) { |
3946 |
++ struct device_node *np; |
3947 |
++ |
3948 |
++ np = of_find_compatible_node(NULL, NULL, |
3949 |
++ "ti,clkctrl"); |
3950 |
++ if (np) { |
3951 |
+ has_clkctrl_data = true; |
3952 |
++ of_node_put(np); |
3953 |
+ } else { |
3954 |
+ clkctrl_nodes_missing = true; |
3955 |
+ |
3956 |
+diff --git a/drivers/clocksource/exynos_mct.c b/drivers/clocksource/exynos_mct.c |
3957 |
+index aaf5bfa9bd9c..e3ae041ac30e 100644 |
3958 |
+--- a/drivers/clocksource/exynos_mct.c |
3959 |
++++ b/drivers/clocksource/exynos_mct.c |
3960 |
+@@ -563,7 +563,19 @@ static int __init exynos4_timer_resources(struct device_node *np, void __iomem * |
3961 |
+ return 0; |
3962 |
+ |
3963 |
+ out_irq: |
3964 |
+- free_percpu_irq(mct_irqs[MCT_L0_IRQ], &percpu_mct_tick); |
3965 |
++ if (mct_int_type == MCT_INT_PPI) { |
3966 |
++ free_percpu_irq(mct_irqs[MCT_L0_IRQ], &percpu_mct_tick); |
3967 |
++ } else { |
3968 |
++ for_each_possible_cpu(cpu) { |
3969 |
++ struct mct_clock_event_device *pcpu_mevt = |
3970 |
++ per_cpu_ptr(&percpu_mct_tick, cpu); |
3971 |
++ |
3972 |
++ if (pcpu_mevt->evt.irq != -1) { |
3973 |
++ free_irq(pcpu_mevt->evt.irq, pcpu_mevt); |
3974 |
++ pcpu_mevt->evt.irq = -1; |
3975 |
++ } |
3976 |
++ } |
3977 |
++ } |
3978 |
+ return err; |
3979 |
+ } |
3980 |
+ |
3981 |
+diff --git a/drivers/clocksource/timer-sun5i.c b/drivers/clocksource/timer-sun5i.c |
3982 |
+index 3b56ea3f52af..552c5254390c 100644 |
3983 |
+--- a/drivers/clocksource/timer-sun5i.c |
3984 |
++++ b/drivers/clocksource/timer-sun5i.c |
3985 |
+@@ -202,6 +202,11 @@ static int __init sun5i_setup_clocksource(struct device_node *node, |
3986 |
+ } |
3987 |
+ |
3988 |
+ rate = clk_get_rate(clk); |
3989 |
++ if (!rate) { |
3990 |
++ pr_err("Couldn't get parent clock rate\n"); |
3991 |
++ ret = -EINVAL; |
3992 |
++ goto err_disable_clk; |
3993 |
++ } |
3994 |
+ |
3995 |
+ cs->timer.base = base; |
3996 |
+ cs->timer.clk = clk; |
3997 |
+@@ -275,6 +280,11 @@ static int __init sun5i_setup_clockevent(struct device_node *node, void __iomem |
3998 |
+ } |
3999 |
+ |
4000 |
+ rate = clk_get_rate(clk); |
4001 |
++ if (!rate) { |
4002 |
++ pr_err("Couldn't get parent clock rate\n"); |
4003 |
++ ret = -EINVAL; |
4004 |
++ goto err_disable_clk; |
4005 |
++ } |
4006 |
+ |
4007 |
+ ce->timer.base = base; |
4008 |
+ ce->timer.ticks_per_jiffy = DIV_ROUND_UP(rate, HZ); |
4009 |
+diff --git a/drivers/clocksource/timer-ti-dm.c b/drivers/clocksource/timer-ti-dm.c |
4010 |
+index 3ecf84706640..23414dddc3ba 100644 |
4011 |
+--- a/drivers/clocksource/timer-ti-dm.c |
4012 |
++++ b/drivers/clocksource/timer-ti-dm.c |
4013 |
+@@ -868,7 +868,6 @@ static int omap_dm_timer_probe(struct platform_device *pdev) |
4014 |
+ timer->pdev = pdev; |
4015 |
+ |
4016 |
+ pm_runtime_enable(dev); |
4017 |
+- pm_runtime_irq_safe(dev); |
4018 |
+ |
4019 |
+ if (!timer->reserved) { |
4020 |
+ ret = pm_runtime_get_sync(dev); |
4021 |
+diff --git a/drivers/cpufreq/brcmstb-avs-cpufreq.c b/drivers/cpufreq/brcmstb-avs-cpufreq.c |
4022 |
+index e6f9cbe5835f..77b0e5d0fb13 100644 |
4023 |
+--- a/drivers/cpufreq/brcmstb-avs-cpufreq.c |
4024 |
++++ b/drivers/cpufreq/brcmstb-avs-cpufreq.c |
4025 |
+@@ -384,12 +384,12 @@ static int brcm_avs_set_pstate(struct private_data *priv, unsigned int pstate) |
4026 |
+ return __issue_avs_command(priv, AVS_CMD_SET_PSTATE, true, args); |
4027 |
+ } |
4028 |
+ |
4029 |
+-static unsigned long brcm_avs_get_voltage(void __iomem *base) |
4030 |
++static u32 brcm_avs_get_voltage(void __iomem *base) |
4031 |
+ { |
4032 |
+ return readl(base + AVS_MBOX_VOLTAGE1); |
4033 |
+ } |
4034 |
+ |
4035 |
+-static unsigned long brcm_avs_get_frequency(void __iomem *base) |
4036 |
++static u32 brcm_avs_get_frequency(void __iomem *base) |
4037 |
+ { |
4038 |
+ return readl(base + AVS_MBOX_FREQUENCY) * 1000; /* in kHz */ |
4039 |
+ } |
4040 |
+@@ -446,8 +446,8 @@ static bool brcm_avs_is_firmware_loaded(struct private_data *priv) |
4041 |
+ rc = brcm_avs_get_pmap(priv, NULL); |
4042 |
+ magic = readl(priv->base + AVS_MBOX_MAGIC); |
4043 |
+ |
4044 |
+- return (magic == AVS_FIRMWARE_MAGIC) && (rc != -ENOTSUPP) && |
4045 |
+- (rc != -EINVAL); |
4046 |
++ return (magic == AVS_FIRMWARE_MAGIC) && ((rc != -ENOTSUPP) || |
4047 |
++ (rc != -EINVAL)); |
4048 |
+ } |
4049 |
+ |
4050 |
+ static unsigned int brcm_avs_cpufreq_get(unsigned int cpu) |
4051 |
+@@ -653,14 +653,14 @@ static ssize_t show_brcm_avs_voltage(struct cpufreq_policy *policy, char *buf) |
4052 |
+ { |
4053 |
+ struct private_data *priv = policy->driver_data; |
4054 |
+ |
4055 |
+- return sprintf(buf, "0x%08lx\n", brcm_avs_get_voltage(priv->base)); |
4056 |
++ return sprintf(buf, "0x%08x\n", brcm_avs_get_voltage(priv->base)); |
4057 |
+ } |
4058 |
+ |
4059 |
+ static ssize_t show_brcm_avs_frequency(struct cpufreq_policy *policy, char *buf) |
4060 |
+ { |
4061 |
+ struct private_data *priv = policy->driver_data; |
4062 |
+ |
4063 |
+- return sprintf(buf, "0x%08lx\n", brcm_avs_get_frequency(priv->base)); |
4064 |
++ return sprintf(buf, "0x%08x\n", brcm_avs_get_frequency(priv->base)); |
4065 |
+ } |
4066 |
+ |
4067 |
+ cpufreq_freq_attr_ro(brcm_avs_pstate); |
4068 |
+diff --git a/drivers/crypto/amcc/crypto4xx_trng.h b/drivers/crypto/amcc/crypto4xx_trng.h |
4069 |
+index 931d22531f51..7bbda51b7337 100644 |
4070 |
+--- a/drivers/crypto/amcc/crypto4xx_trng.h |
4071 |
++++ b/drivers/crypto/amcc/crypto4xx_trng.h |
4072 |
+@@ -26,9 +26,9 @@ void ppc4xx_trng_probe(struct crypto4xx_core_device *core_dev); |
4073 |
+ void ppc4xx_trng_remove(struct crypto4xx_core_device *core_dev); |
4074 |
+ #else |
4075 |
+ static inline void ppc4xx_trng_probe( |
4076 |
+- struct crypto4xx_device *dev __maybe_unused) { } |
4077 |
++ struct crypto4xx_core_device *dev __maybe_unused) { } |
4078 |
+ static inline void ppc4xx_trng_remove( |
4079 |
+- struct crypto4xx_device *dev __maybe_unused) { } |
4080 |
++ struct crypto4xx_core_device *dev __maybe_unused) { } |
4081 |
+ #endif |
4082 |
+ |
4083 |
+ #endif |
4084 |
+diff --git a/drivers/crypto/bcm/cipher.c b/drivers/crypto/bcm/cipher.c |
4085 |
+index 49c0097fa474..0b1fc5664b1d 100644 |
4086 |
+--- a/drivers/crypto/bcm/cipher.c |
4087 |
++++ b/drivers/crypto/bcm/cipher.c |
4088 |
+@@ -717,7 +717,7 @@ static int handle_ahash_req(struct iproc_reqctx_s *rctx) |
4089 |
+ */ |
4090 |
+ unsigned int new_data_len; |
4091 |
+ |
4092 |
+- unsigned int chunk_start = 0; |
4093 |
++ unsigned int __maybe_unused chunk_start = 0; |
4094 |
+ u32 db_size; /* Length of data field, incl gcm and hash padding */ |
4095 |
+ int pad_len = 0; /* total pad len, including gcm, hash, stat padding */ |
4096 |
+ u32 data_pad_len = 0; /* length of GCM/CCM padding */ |
4097 |
+@@ -1675,8 +1675,6 @@ static void spu_rx_callback(struct mbox_client *cl, void *msg) |
4098 |
+ struct spu_hw *spu = &iproc_priv.spu; |
4099 |
+ struct brcm_message *mssg = msg; |
4100 |
+ struct iproc_reqctx_s *rctx; |
4101 |
+- struct iproc_ctx_s *ctx; |
4102 |
+- struct crypto_async_request *areq; |
4103 |
+ int err = 0; |
4104 |
+ |
4105 |
+ rctx = mssg->ctx; |
4106 |
+@@ -1686,8 +1684,6 @@ static void spu_rx_callback(struct mbox_client *cl, void *msg) |
4107 |
+ err = -EFAULT; |
4108 |
+ goto cb_finish; |
4109 |
+ } |
4110 |
+- areq = rctx->parent; |
4111 |
+- ctx = rctx->ctx; |
4112 |
+ |
4113 |
+ /* process the SPU status */ |
4114 |
+ err = spu->spu_status_process(rctx->msg_buf.rx_stat); |
4115 |
+diff --git a/drivers/crypto/caam/caamrng.c b/drivers/crypto/caam/caamrng.c |
4116 |
+index fde07d4ff019..ff6718a11e9e 100644 |
4117 |
+--- a/drivers/crypto/caam/caamrng.c |
4118 |
++++ b/drivers/crypto/caam/caamrng.c |
4119 |
+@@ -353,7 +353,10 @@ static int __init caam_rng_init(void) |
4120 |
+ goto free_rng_ctx; |
4121 |
+ |
4122 |
+ dev_info(dev, "registering rng-caam\n"); |
4123 |
+- return hwrng_register(&caam_rng); |
4124 |
++ |
4125 |
++ err = hwrng_register(&caam_rng); |
4126 |
++ if (!err) |
4127 |
++ return err; |
4128 |
+ |
4129 |
+ free_rng_ctx: |
4130 |
+ kfree(rng_ctx); |
4131 |
+diff --git a/drivers/crypto/caam/error.c b/drivers/crypto/caam/error.c |
4132 |
+index 8da88beb1abb..832ba2afdcd5 100644 |
4133 |
+--- a/drivers/crypto/caam/error.c |
4134 |
++++ b/drivers/crypto/caam/error.c |
4135 |
+@@ -22,7 +22,7 @@ void caam_dump_sg(const char *level, const char *prefix_str, int prefix_type, |
4136 |
+ size_t len; |
4137 |
+ void *buf; |
4138 |
+ |
4139 |
+- for (it = sg; it && tlen > 0 ; it = sg_next(sg)) { |
4140 |
++ for (it = sg; it && tlen > 0 ; it = sg_next(it)) { |
4141 |
+ /* |
4142 |
+ * make sure the scatterlist's page |
4143 |
+ * has a valid virtual memory mapping |
4144 |
+diff --git a/drivers/crypto/ccp/ccp-crypto-aes.c b/drivers/crypto/ccp/ccp-crypto-aes.c |
4145 |
+index 89291c15015c..3f768699332b 100644 |
4146 |
+--- a/drivers/crypto/ccp/ccp-crypto-aes.c |
4147 |
++++ b/drivers/crypto/ccp/ccp-crypto-aes.c |
4148 |
+@@ -1,7 +1,8 @@ |
4149 |
++// SPDX-License-Identifier: GPL-2.0 |
4150 |
+ /* |
4151 |
+ * AMD Cryptographic Coprocessor (CCP) AES crypto API support |
4152 |
+ * |
4153 |
+- * Copyright (C) 2013,2016 Advanced Micro Devices, Inc. |
4154 |
++ * Copyright (C) 2013-2019 Advanced Micro Devices, Inc. |
4155 |
+ * |
4156 |
+ * Author: Tom Lendacky <thomas.lendacky@×××.com> |
4157 |
+ * |
4158 |
+@@ -79,8 +80,7 @@ static int ccp_aes_crypt(struct ablkcipher_request *req, bool encrypt) |
4159 |
+ return -EINVAL; |
4160 |
+ |
4161 |
+ if (((ctx->u.aes.mode == CCP_AES_MODE_ECB) || |
4162 |
+- (ctx->u.aes.mode == CCP_AES_MODE_CBC) || |
4163 |
+- (ctx->u.aes.mode == CCP_AES_MODE_CFB)) && |
4164 |
++ (ctx->u.aes.mode == CCP_AES_MODE_CBC)) && |
4165 |
+ (req->nbytes & (AES_BLOCK_SIZE - 1))) |
4166 |
+ return -EINVAL; |
4167 |
+ |
4168 |
+@@ -291,7 +291,7 @@ static struct ccp_aes_def aes_algs[] = { |
4169 |
+ .version = CCP_VERSION(3, 0), |
4170 |
+ .name = "cfb(aes)", |
4171 |
+ .driver_name = "cfb-aes-ccp", |
4172 |
+- .blocksize = AES_BLOCK_SIZE, |
4173 |
++ .blocksize = 1, |
4174 |
+ .ivsize = AES_BLOCK_SIZE, |
4175 |
+ .alg_defaults = &ccp_aes_defaults, |
4176 |
+ }, |
4177 |
+diff --git a/drivers/crypto/ccp/ccp-ops.c b/drivers/crypto/ccp/ccp-ops.c |
4178 |
+index 1e2e42106dee..330853a2702f 100644 |
4179 |
+--- a/drivers/crypto/ccp/ccp-ops.c |
4180 |
++++ b/drivers/crypto/ccp/ccp-ops.c |
4181 |
+@@ -458,8 +458,8 @@ static int ccp_copy_from_sb(struct ccp_cmd_queue *cmd_q, |
4182 |
+ return ccp_copy_to_from_sb(cmd_q, wa, jobid, sb, byte_swap, true); |
4183 |
+ } |
4184 |
+ |
4185 |
+-static int ccp_run_aes_cmac_cmd(struct ccp_cmd_queue *cmd_q, |
4186 |
+- struct ccp_cmd *cmd) |
4187 |
++static noinline_for_stack int |
4188 |
++ccp_run_aes_cmac_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd) |
4189 |
+ { |
4190 |
+ struct ccp_aes_engine *aes = &cmd->u.aes; |
4191 |
+ struct ccp_dm_workarea key, ctx; |
4192 |
+@@ -614,8 +614,8 @@ e_key: |
4193 |
+ return ret; |
4194 |
+ } |
4195 |
+ |
4196 |
+-static int ccp_run_aes_gcm_cmd(struct ccp_cmd_queue *cmd_q, |
4197 |
+- struct ccp_cmd *cmd) |
4198 |
++static noinline_for_stack int |
4199 |
++ccp_run_aes_gcm_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd) |
4200 |
+ { |
4201 |
+ struct ccp_aes_engine *aes = &cmd->u.aes; |
4202 |
+ struct ccp_dm_workarea key, ctx, final_wa, tag; |
4203 |
+@@ -897,7 +897,8 @@ e_key: |
4204 |
+ return ret; |
4205 |
+ } |
4206 |
+ |
4207 |
+-static int ccp_run_aes_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd) |
4208 |
++static noinline_for_stack int |
4209 |
++ccp_run_aes_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd) |
4210 |
+ { |
4211 |
+ struct ccp_aes_engine *aes = &cmd->u.aes; |
4212 |
+ struct ccp_dm_workarea key, ctx; |
4213 |
+@@ -907,12 +908,6 @@ static int ccp_run_aes_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd) |
4214 |
+ bool in_place = false; |
4215 |
+ int ret; |
4216 |
+ |
4217 |
+- if (aes->mode == CCP_AES_MODE_CMAC) |
4218 |
+- return ccp_run_aes_cmac_cmd(cmd_q, cmd); |
4219 |
+- |
4220 |
+- if (aes->mode == CCP_AES_MODE_GCM) |
4221 |
+- return ccp_run_aes_gcm_cmd(cmd_q, cmd); |
4222 |
+- |
4223 |
+ if (!((aes->key_len == AES_KEYSIZE_128) || |
4224 |
+ (aes->key_len == AES_KEYSIZE_192) || |
4225 |
+ (aes->key_len == AES_KEYSIZE_256))) |
4226 |
+@@ -1080,8 +1075,8 @@ e_key: |
4227 |
+ return ret; |
4228 |
+ } |
4229 |
+ |
4230 |
+-static int ccp_run_xts_aes_cmd(struct ccp_cmd_queue *cmd_q, |
4231 |
+- struct ccp_cmd *cmd) |
4232 |
++static noinline_for_stack int |
4233 |
++ccp_run_xts_aes_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd) |
4234 |
+ { |
4235 |
+ struct ccp_xts_aes_engine *xts = &cmd->u.xts; |
4236 |
+ struct ccp_dm_workarea key, ctx; |
4237 |
+@@ -1280,7 +1275,8 @@ e_key: |
4238 |
+ return ret; |
4239 |
+ } |
4240 |
+ |
4241 |
+-static int ccp_run_des3_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd) |
4242 |
++static noinline_for_stack int |
4243 |
++ccp_run_des3_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd) |
4244 |
+ { |
4245 |
+ struct ccp_des3_engine *des3 = &cmd->u.des3; |
4246 |
+ |
4247 |
+@@ -1293,6 +1289,9 @@ static int ccp_run_des3_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd) |
4248 |
+ int ret; |
4249 |
+ |
4250 |
+ /* Error checks */ |
4251 |
++ if (cmd_q->ccp->vdata->version < CCP_VERSION(5, 0)) |
4252 |
++ return -EINVAL; |
4253 |
++ |
4254 |
+ if (!cmd_q->ccp->vdata->perform->des3) |
4255 |
+ return -EINVAL; |
4256 |
+ |
4257 |
+@@ -1375,8 +1374,6 @@ static int ccp_run_des3_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd) |
4258 |
+ * passthru option to convert from big endian to little endian. |
4259 |
+ */ |
4260 |
+ if (des3->mode != CCP_DES3_MODE_ECB) { |
4261 |
+- u32 load_mode; |
4262 |
+- |
4263 |
+ op.sb_ctx = cmd_q->sb_ctx; |
4264 |
+ |
4265 |
+ ret = ccp_init_dm_workarea(&ctx, cmd_q, |
4266 |
+@@ -1392,12 +1389,8 @@ static int ccp_run_des3_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd) |
4267 |
+ if (ret) |
4268 |
+ goto e_ctx; |
4269 |
+ |
4270 |
+- if (cmd_q->ccp->vdata->version == CCP_VERSION(3, 0)) |
4271 |
+- load_mode = CCP_PASSTHRU_BYTESWAP_NOOP; |
4272 |
+- else |
4273 |
+- load_mode = CCP_PASSTHRU_BYTESWAP_256BIT; |
4274 |
+ ret = ccp_copy_to_sb(cmd_q, &ctx, op.jobid, op.sb_ctx, |
4275 |
+- load_mode); |
4276 |
++ CCP_PASSTHRU_BYTESWAP_256BIT); |
4277 |
+ if (ret) { |
4278 |
+ cmd->engine_error = cmd_q->cmd_error; |
4279 |
+ goto e_ctx; |
4280 |
+@@ -1459,10 +1452,6 @@ static int ccp_run_des3_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd) |
4281 |
+ } |
4282 |
+ |
4283 |
+ /* ...but we only need the last DES3_EDE_BLOCK_SIZE bytes */ |
4284 |
+- if (cmd_q->ccp->vdata->version == CCP_VERSION(3, 0)) |
4285 |
+- dm_offset = CCP_SB_BYTES - des3->iv_len; |
4286 |
+- else |
4287 |
+- dm_offset = 0; |
4288 |
+ ccp_get_dm_area(&ctx, dm_offset, des3->iv, 0, |
4289 |
+ DES3_EDE_BLOCK_SIZE); |
4290 |
+ } |
4291 |
+@@ -1483,7 +1472,8 @@ e_key: |
4292 |
+ return ret; |
4293 |
+ } |
4294 |
+ |
4295 |
+-static int ccp_run_sha_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd) |
4296 |
++static noinline_for_stack int |
4297 |
++ccp_run_sha_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd) |
4298 |
+ { |
4299 |
+ struct ccp_sha_engine *sha = &cmd->u.sha; |
4300 |
+ struct ccp_dm_workarea ctx; |
4301 |
+@@ -1827,7 +1817,8 @@ e_ctx: |
4302 |
+ return ret; |
4303 |
+ } |
4304 |
+ |
4305 |
+-static int ccp_run_rsa_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd) |
4306 |
++static noinline_for_stack int |
4307 |
++ccp_run_rsa_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd) |
4308 |
+ { |
4309 |
+ struct ccp_rsa_engine *rsa = &cmd->u.rsa; |
4310 |
+ struct ccp_dm_workarea exp, src, dst; |
4311 |
+@@ -1958,8 +1949,8 @@ e_sb: |
4312 |
+ return ret; |
4313 |
+ } |
4314 |
+ |
4315 |
+-static int ccp_run_passthru_cmd(struct ccp_cmd_queue *cmd_q, |
4316 |
+- struct ccp_cmd *cmd) |
4317 |
++static noinline_for_stack int |
4318 |
++ccp_run_passthru_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd) |
4319 |
+ { |
4320 |
+ struct ccp_passthru_engine *pt = &cmd->u.passthru; |
4321 |
+ struct ccp_dm_workarea mask; |
4322 |
+@@ -2090,7 +2081,8 @@ e_mask: |
4323 |
+ return ret; |
4324 |
+ } |
4325 |
+ |
4326 |
+-static int ccp_run_passthru_nomap_cmd(struct ccp_cmd_queue *cmd_q, |
4327 |
++static noinline_for_stack int |
4328 |
++ccp_run_passthru_nomap_cmd(struct ccp_cmd_queue *cmd_q, |
4329 |
+ struct ccp_cmd *cmd) |
4330 |
+ { |
4331 |
+ struct ccp_passthru_nomap_engine *pt = &cmd->u.passthru_nomap; |
4332 |
+@@ -2431,7 +2423,8 @@ e_src: |
4333 |
+ return ret; |
4334 |
+ } |
4335 |
+ |
4336 |
+-static int ccp_run_ecc_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd) |
4337 |
++static noinline_for_stack int |
4338 |
++ccp_run_ecc_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd) |
4339 |
+ { |
4340 |
+ struct ccp_ecc_engine *ecc = &cmd->u.ecc; |
4341 |
+ |
4342 |
+@@ -2468,7 +2461,17 @@ int ccp_run_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd) |
4343 |
+ |
4344 |
+ switch (cmd->engine) { |
4345 |
+ case CCP_ENGINE_AES: |
4346 |
+- ret = ccp_run_aes_cmd(cmd_q, cmd); |
4347 |
++ switch (cmd->u.aes.mode) { |
4348 |
++ case CCP_AES_MODE_CMAC: |
4349 |
++ ret = ccp_run_aes_cmac_cmd(cmd_q, cmd); |
4350 |
++ break; |
4351 |
++ case CCP_AES_MODE_GCM: |
4352 |
++ ret = ccp_run_aes_gcm_cmd(cmd_q, cmd); |
4353 |
++ break; |
4354 |
++ default: |
4355 |
++ ret = ccp_run_aes_cmd(cmd_q, cmd); |
4356 |
++ break; |
4357 |
++ } |
4358 |
+ break; |
4359 |
+ case CCP_ENGINE_XTS_AES_128: |
4360 |
+ ret = ccp_run_xts_aes_cmd(cmd_q, cmd); |
4361 |
+diff --git a/drivers/crypto/ccree/cc_cipher.c b/drivers/crypto/ccree/cc_cipher.c |
4362 |
+index 54a39164aab8..28a5b8b38fa2 100644 |
4363 |
+--- a/drivers/crypto/ccree/cc_cipher.c |
4364 |
++++ b/drivers/crypto/ccree/cc_cipher.c |
4365 |
+@@ -306,7 +306,6 @@ static int cc_cipher_setkey(struct crypto_skcipher *sktfm, const u8 *key, |
4366 |
+ struct crypto_tfm *tfm = crypto_skcipher_tfm(sktfm); |
4367 |
+ struct cc_cipher_ctx *ctx_p = crypto_tfm_ctx(tfm); |
4368 |
+ struct device *dev = drvdata_to_dev(ctx_p->drvdata); |
4369 |
+- u32 tmp[DES3_EDE_EXPKEY_WORDS]; |
4370 |
+ struct cc_crypto_alg *cc_alg = |
4371 |
+ container_of(tfm->__crt_alg, struct cc_crypto_alg, |
4372 |
+ skcipher_alg.base); |
4373 |
+@@ -332,6 +331,7 @@ static int cc_cipher_setkey(struct crypto_skcipher *sktfm, const u8 *key, |
4374 |
+ * HW does the expansion on its own. |
4375 |
+ */ |
4376 |
+ if (ctx_p->flow_mode == S_DIN_to_DES) { |
4377 |
++ u32 tmp[DES3_EDE_EXPKEY_WORDS]; |
4378 |
+ if (keylen == DES3_EDE_KEY_SIZE && |
4379 |
+ __des3_ede_setkey(tmp, &tfm->crt_flags, key, |
4380 |
+ DES3_EDE_KEY_SIZE)) { |
4381 |
+diff --git a/drivers/crypto/hisilicon/sec/sec_algs.c b/drivers/crypto/hisilicon/sec/sec_algs.c |
4382 |
+index db2983c51f1e..bf9658800bda 100644 |
4383 |
+--- a/drivers/crypto/hisilicon/sec/sec_algs.c |
4384 |
++++ b/drivers/crypto/hisilicon/sec/sec_algs.c |
4385 |
+@@ -153,6 +153,24 @@ static void sec_alg_skcipher_init_context(struct crypto_skcipher *atfm, |
4386 |
+ ctx->cipher_alg); |
4387 |
+ } |
4388 |
+ |
4389 |
++static void sec_free_hw_sgl(struct sec_hw_sgl *hw_sgl, |
4390 |
++ dma_addr_t psec_sgl, struct sec_dev_info *info) |
4391 |
++{ |
4392 |
++ struct sec_hw_sgl *sgl_current, *sgl_next; |
4393 |
++ dma_addr_t sgl_next_dma; |
4394 |
++ |
4395 |
++ sgl_current = hw_sgl; |
4396 |
++ while (sgl_current) { |
4397 |
++ sgl_next = sgl_current->next; |
4398 |
++ sgl_next_dma = sgl_current->next_sgl; |
4399 |
++ |
4400 |
++ dma_pool_free(info->hw_sgl_pool, sgl_current, psec_sgl); |
4401 |
++ |
4402 |
++ sgl_current = sgl_next; |
4403 |
++ psec_sgl = sgl_next_dma; |
4404 |
++ } |
4405 |
++} |
4406 |
++ |
4407 |
+ static int sec_alloc_and_fill_hw_sgl(struct sec_hw_sgl **sec_sgl, |
4408 |
+ dma_addr_t *psec_sgl, |
4409 |
+ struct scatterlist *sgl, |
4410 |
+@@ -199,36 +217,12 @@ static int sec_alloc_and_fill_hw_sgl(struct sec_hw_sgl **sec_sgl, |
4411 |
+ return 0; |
4412 |
+ |
4413 |
+ err_free_hw_sgls: |
4414 |
+- sgl_current = *sec_sgl; |
4415 |
+- while (sgl_current) { |
4416 |
+- sgl_next = sgl_current->next; |
4417 |
+- dma_pool_free(info->hw_sgl_pool, sgl_current, |
4418 |
+- sgl_current->next_sgl); |
4419 |
+- sgl_current = sgl_next; |
4420 |
+- } |
4421 |
++ sec_free_hw_sgl(*sec_sgl, *psec_sgl, info); |
4422 |
+ *psec_sgl = 0; |
4423 |
+ |
4424 |
+ return ret; |
4425 |
+ } |
4426 |
+ |
4427 |
+-static void sec_free_hw_sgl(struct sec_hw_sgl *hw_sgl, |
4428 |
+- dma_addr_t psec_sgl, struct sec_dev_info *info) |
4429 |
+-{ |
4430 |
+- struct sec_hw_sgl *sgl_current, *sgl_next; |
4431 |
+- dma_addr_t sgl_next_dma; |
4432 |
+- |
4433 |
+- sgl_current = hw_sgl; |
4434 |
+- while (sgl_current) { |
4435 |
+- sgl_next = sgl_current->next; |
4436 |
+- sgl_next_dma = sgl_current->next_sgl; |
4437 |
+- |
4438 |
+- dma_pool_free(info->hw_sgl_pool, sgl_current, psec_sgl); |
4439 |
+- |
4440 |
+- sgl_current = sgl_next; |
4441 |
+- psec_sgl = sgl_next_dma; |
4442 |
+- } |
4443 |
+-} |
4444 |
+- |
4445 |
+ static int sec_alg_skcipher_setkey(struct crypto_skcipher *tfm, |
4446 |
+ const u8 *key, unsigned int keylen, |
4447 |
+ enum sec_cipher_alg alg) |
4448 |
+diff --git a/drivers/crypto/inside-secure/safexcel_hash.c b/drivers/crypto/inside-secure/safexcel_hash.c |
4449 |
+index ac9282c1a5ec..f3b02c00b784 100644 |
4450 |
+--- a/drivers/crypto/inside-secure/safexcel_hash.c |
4451 |
++++ b/drivers/crypto/inside-secure/safexcel_hash.c |
4452 |
+@@ -50,10 +50,12 @@ struct safexcel_ahash_req { |
4453 |
+ |
4454 |
+ static inline u64 safexcel_queued_len(struct safexcel_ahash_req *req) |
4455 |
+ { |
4456 |
+- if (req->len[1] > req->processed[1]) |
4457 |
+- return 0xffffffff - (req->len[0] - req->processed[0]); |
4458 |
++ u64 len, processed; |
4459 |
+ |
4460 |
+- return req->len[0] - req->processed[0]; |
4461 |
++ len = (0xffffffff * req->len[1]) + req->len[0]; |
4462 |
++ processed = (0xffffffff * req->processed[1]) + req->processed[0]; |
4463 |
++ |
4464 |
++ return len - processed; |
4465 |
+ } |
4466 |
+ |
4467 |
+ static void safexcel_hash_token(struct safexcel_command_desc *cdesc, |
4468 |
+@@ -486,7 +488,7 @@ static int safexcel_ahash_exit_inv(struct crypto_tfm *tfm) |
4469 |
+ struct safexcel_inv_result result = {}; |
4470 |
+ int ring = ctx->base.ring; |
4471 |
+ |
4472 |
+- memset(req, 0, sizeof(struct ahash_request)); |
4473 |
++ memset(req, 0, EIP197_AHASH_REQ_SIZE); |
4474 |
+ |
4475 |
+ /* create invalidation request */ |
4476 |
+ init_completion(&result.completion); |
4477 |
+diff --git a/drivers/crypto/sunxi-ss/sun4i-ss-hash.c b/drivers/crypto/sunxi-ss/sun4i-ss-hash.c |
4478 |
+index 1a724263761b..2d178e013535 100644 |
4479 |
+--- a/drivers/crypto/sunxi-ss/sun4i-ss-hash.c |
4480 |
++++ b/drivers/crypto/sunxi-ss/sun4i-ss-hash.c |
4481 |
+@@ -179,7 +179,7 @@ static int sun4i_hash(struct ahash_request *areq) |
4482 |
+ */ |
4483 |
+ unsigned int i = 0, end, fill, min_fill, nwait, nbw = 0, j = 0, todo; |
4484 |
+ unsigned int in_i = 0; |
4485 |
+- u32 spaces, rx_cnt = SS_RX_DEFAULT, bf[32] = {0}, wb = 0, v, ivmode = 0; |
4486 |
++ u32 spaces, rx_cnt = SS_RX_DEFAULT, bf[32] = {0}, v, ivmode = 0; |
4487 |
+ struct sun4i_req_ctx *op = ahash_request_ctx(areq); |
4488 |
+ struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); |
4489 |
+ struct sun4i_tfm_ctx *tfmctx = crypto_ahash_ctx(tfm); |
4490 |
+@@ -188,6 +188,7 @@ static int sun4i_hash(struct ahash_request *areq) |
4491 |
+ struct sg_mapping_iter mi; |
4492 |
+ int in_r, err = 0; |
4493 |
+ size_t copied = 0; |
4494 |
++ __le32 wb = 0; |
4495 |
+ |
4496 |
+ dev_dbg(ss->dev, "%s %s bc=%llu len=%u mode=%x wl=%u h0=%0x", |
4497 |
+ __func__, crypto_tfm_alg_name(areq->base.tfm), |
4498 |
+@@ -399,7 +400,7 @@ hash_final: |
4499 |
+ |
4500 |
+ nbw = op->len - 4 * nwait; |
4501 |
+ if (nbw) { |
4502 |
+- wb = *(u32 *)(op->buf + nwait * 4); |
4503 |
++ wb = cpu_to_le32(*(u32 *)(op->buf + nwait * 4)); |
4504 |
+ wb &= GENMASK((nbw * 8) - 1, 0); |
4505 |
+ |
4506 |
+ op->byte_count += nbw; |
4507 |
+@@ -408,7 +409,7 @@ hash_final: |
4508 |
+ |
4509 |
+ /* write the remaining bytes of the nbw buffer */ |
4510 |
+ wb |= ((1 << 7) << (nbw * 8)); |
4511 |
+- bf[j++] = wb; |
4512 |
++ bf[j++] = le32_to_cpu(wb); |
4513 |
+ |
4514 |
+ /* |
4515 |
+ * number of space to pad to obtain 64o minus 8(size) minus 4 (final 1) |
4516 |
+@@ -427,13 +428,13 @@ hash_final: |
4517 |
+ |
4518 |
+ /* write the length of data */ |
4519 |
+ if (op->mode == SS_OP_SHA1) { |
4520 |
+- __be64 bits = cpu_to_be64(op->byte_count << 3); |
4521 |
+- bf[j++] = lower_32_bits(bits); |
4522 |
+- bf[j++] = upper_32_bits(bits); |
4523 |
++ __be64 *bits = (__be64 *)&bf[j]; |
4524 |
++ *bits = cpu_to_be64(op->byte_count << 3); |
4525 |
++ j += 2; |
4526 |
+ } else { |
4527 |
+- __le64 bits = op->byte_count << 3; |
4528 |
+- bf[j++] = lower_32_bits(bits); |
4529 |
+- bf[j++] = upper_32_bits(bits); |
4530 |
++ __le64 *bits = (__le64 *)&bf[j]; |
4531 |
++ *bits = cpu_to_le64(op->byte_count << 3); |
4532 |
++ j += 2; |
4533 |
+ } |
4534 |
+ writesl(ss->base + SS_RXFIFO, bf, j); |
4535 |
+ |
4536 |
+@@ -475,7 +476,7 @@ hash_final: |
4537 |
+ } |
4538 |
+ } else { |
4539 |
+ for (i = 0; i < 4; i++) { |
4540 |
+- v = readl(ss->base + SS_MD0 + i * 4); |
4541 |
++ v = cpu_to_le32(readl(ss->base + SS_MD0 + i * 4)); |
4542 |
+ memcpy(areq->result + i * 4, &v, 4); |
4543 |
+ } |
4544 |
+ } |
4545 |
+diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c |
4546 |
+index 634ae487c372..db5f939f5aa3 100644 |
4547 |
+--- a/drivers/crypto/talitos.c |
4548 |
++++ b/drivers/crypto/talitos.c |
4549 |
+@@ -974,8 +974,8 @@ static void ipsec_esp_unmap(struct device *dev, |
4550 |
+ DMA_FROM_DEVICE); |
4551 |
+ unmap_single_talitos_ptr(dev, civ_ptr, DMA_TO_DEVICE); |
4552 |
+ |
4553 |
+- talitos_sg_unmap(dev, edesc, areq->src, areq->dst, cryptlen, |
4554 |
+- areq->assoclen); |
4555 |
++ talitos_sg_unmap(dev, edesc, areq->src, areq->dst, |
4556 |
++ cryptlen + authsize, areq->assoclen); |
4557 |
+ |
4558 |
+ if (edesc->dma_len) |
4559 |
+ dma_unmap_single(dev, edesc->dma_link_tbl, edesc->dma_len, |
4560 |
+@@ -996,30 +996,15 @@ static void ipsec_esp_encrypt_done(struct device *dev, |
4561 |
+ struct talitos_desc *desc, void *context, |
4562 |
+ int err) |
4563 |
+ { |
4564 |
+- struct talitos_private *priv = dev_get_drvdata(dev); |
4565 |
+- bool is_sec1 = has_ftr_sec1(priv); |
4566 |
+ struct aead_request *areq = context; |
4567 |
+ struct crypto_aead *authenc = crypto_aead_reqtfm(areq); |
4568 |
+- unsigned int authsize = crypto_aead_authsize(authenc); |
4569 |
+ unsigned int ivsize = crypto_aead_ivsize(authenc); |
4570 |
+ struct talitos_edesc *edesc; |
4571 |
+- void *icvdata; |
4572 |
+ |
4573 |
+ edesc = container_of(desc, struct talitos_edesc, desc); |
4574 |
+ |
4575 |
+ ipsec_esp_unmap(dev, edesc, areq, true); |
4576 |
+ |
4577 |
+- /* copy the generated ICV to dst */ |
4578 |
+- if (edesc->icv_ool) { |
4579 |
+- if (is_sec1) |
4580 |
+- icvdata = edesc->buf + areq->assoclen + areq->cryptlen; |
4581 |
+- else |
4582 |
+- icvdata = &edesc->link_tbl[edesc->src_nents + |
4583 |
+- edesc->dst_nents + 2]; |
4584 |
+- sg_pcopy_from_buffer(areq->dst, edesc->dst_nents ? : 1, icvdata, |
4585 |
+- authsize, areq->assoclen + areq->cryptlen); |
4586 |
+- } |
4587 |
+- |
4588 |
+ dma_unmap_single(dev, edesc->iv_dma, ivsize, DMA_TO_DEVICE); |
4589 |
+ |
4590 |
+ kfree(edesc); |
4591 |
+@@ -1036,39 +1021,15 @@ static void ipsec_esp_decrypt_swauth_done(struct device *dev, |
4592 |
+ unsigned int authsize = crypto_aead_authsize(authenc); |
4593 |
+ struct talitos_edesc *edesc; |
4594 |
+ char *oicv, *icv; |
4595 |
+- struct talitos_private *priv = dev_get_drvdata(dev); |
4596 |
+- bool is_sec1 = has_ftr_sec1(priv); |
4597 |
+ |
4598 |
+ edesc = container_of(desc, struct talitos_edesc, desc); |
4599 |
+ |
4600 |
+ ipsec_esp_unmap(dev, edesc, req, false); |
4601 |
+ |
4602 |
+ if (!err) { |
4603 |
+- char icvdata[SHA512_DIGEST_SIZE]; |
4604 |
+- int nents = edesc->dst_nents ? : 1; |
4605 |
+- unsigned int len = req->assoclen + req->cryptlen; |
4606 |
+- |
4607 |
+ /* auth check */ |
4608 |
+- if (nents > 1) { |
4609 |
+- sg_pcopy_to_buffer(req->dst, nents, icvdata, authsize, |
4610 |
+- len - authsize); |
4611 |
+- icv = icvdata; |
4612 |
+- } else { |
4613 |
+- icv = (char *)sg_virt(req->dst) + len - authsize; |
4614 |
+- } |
4615 |
+- |
4616 |
+- if (edesc->dma_len) { |
4617 |
+- if (is_sec1) |
4618 |
+- oicv = (char *)&edesc->dma_link_tbl + |
4619 |
+- req->assoclen + req->cryptlen; |
4620 |
+- else |
4621 |
+- oicv = (char *) |
4622 |
+- &edesc->link_tbl[edesc->src_nents + |
4623 |
+- edesc->dst_nents + 2]; |
4624 |
+- if (edesc->icv_ool) |
4625 |
+- icv = oicv + authsize; |
4626 |
+- } else |
4627 |
+- oicv = (char *)&edesc->link_tbl[0]; |
4628 |
++ oicv = edesc->buf + edesc->dma_len; |
4629 |
++ icv = oicv - authsize; |
4630 |
+ |
4631 |
+ err = crypto_memneq(oicv, icv, authsize) ? -EBADMSG : 0; |
4632 |
+ } |
4633 |
+@@ -1104,11 +1065,12 @@ static void ipsec_esp_decrypt_hwauth_done(struct device *dev, |
4634 |
+ * stop at cryptlen bytes |
4635 |
+ */ |
4636 |
+ static int sg_to_link_tbl_offset(struct scatterlist *sg, int sg_count, |
4637 |
+- unsigned int offset, int cryptlen, |
4638 |
++ unsigned int offset, int datalen, int elen, |
4639 |
+ struct talitos_ptr *link_tbl_ptr) |
4640 |
+ { |
4641 |
+- int n_sg = sg_count; |
4642 |
++ int n_sg = elen ? sg_count + 1 : sg_count; |
4643 |
+ int count = 0; |
4644 |
++ int cryptlen = datalen + elen; |
4645 |
+ |
4646 |
+ while (cryptlen && sg && n_sg--) { |
4647 |
+ unsigned int len = sg_dma_len(sg); |
4648 |
+@@ -1123,11 +1085,20 @@ static int sg_to_link_tbl_offset(struct scatterlist *sg, int sg_count, |
4649 |
+ if (len > cryptlen) |
4650 |
+ len = cryptlen; |
4651 |
+ |
4652 |
++ if (datalen > 0 && len > datalen) { |
4653 |
++ to_talitos_ptr(link_tbl_ptr + count, |
4654 |
++ sg_dma_address(sg) + offset, datalen, 0); |
4655 |
++ to_talitos_ptr_ext_set(link_tbl_ptr + count, 0, 0); |
4656 |
++ count++; |
4657 |
++ len -= datalen; |
4658 |
++ offset += datalen; |
4659 |
++ } |
4660 |
+ to_talitos_ptr(link_tbl_ptr + count, |
4661 |
+ sg_dma_address(sg) + offset, len, 0); |
4662 |
+ to_talitos_ptr_ext_set(link_tbl_ptr + count, 0, 0); |
4663 |
+ count++; |
4664 |
+ cryptlen -= len; |
4665 |
++ datalen -= len; |
4666 |
+ offset = 0; |
4667 |
+ |
4668 |
+ next: |
4669 |
+@@ -1137,7 +1108,7 @@ next: |
4670 |
+ /* tag end of link table */ |
4671 |
+ if (count > 0) |
4672 |
+ to_talitos_ptr_ext_set(link_tbl_ptr + count - 1, |
4673 |
+- DESC_PTR_LNKTBL_RETURN, 0); |
4674 |
++ DESC_PTR_LNKTBL_RET, 0); |
4675 |
+ |
4676 |
+ return count; |
4677 |
+ } |
4678 |
+@@ -1145,7 +1116,8 @@ next: |
4679 |
+ static int talitos_sg_map_ext(struct device *dev, struct scatterlist *src, |
4680 |
+ unsigned int len, struct talitos_edesc *edesc, |
4681 |
+ struct talitos_ptr *ptr, int sg_count, |
4682 |
+- unsigned int offset, int tbl_off, int elen) |
4683 |
++ unsigned int offset, int tbl_off, int elen, |
4684 |
++ bool force) |
4685 |
+ { |
4686 |
+ struct talitos_private *priv = dev_get_drvdata(dev); |
4687 |
+ bool is_sec1 = has_ftr_sec1(priv); |
4688 |
+@@ -1155,7 +1127,7 @@ static int talitos_sg_map_ext(struct device *dev, struct scatterlist *src, |
4689 |
+ return 1; |
4690 |
+ } |
4691 |
+ to_talitos_ptr_ext_set(ptr, elen, is_sec1); |
4692 |
+- if (sg_count == 1) { |
4693 |
++ if (sg_count == 1 && !force) { |
4694 |
+ to_talitos_ptr(ptr, sg_dma_address(src) + offset, len, is_sec1); |
4695 |
+ return sg_count; |
4696 |
+ } |
4697 |
+@@ -1163,9 +1135,9 @@ static int talitos_sg_map_ext(struct device *dev, struct scatterlist *src, |
4698 |
+ to_talitos_ptr(ptr, edesc->dma_link_tbl + offset, len, is_sec1); |
4699 |
+ return sg_count; |
4700 |
+ } |
4701 |
+- sg_count = sg_to_link_tbl_offset(src, sg_count, offset, len + elen, |
4702 |
++ sg_count = sg_to_link_tbl_offset(src, sg_count, offset, len, elen, |
4703 |
+ &edesc->link_tbl[tbl_off]); |
4704 |
+- if (sg_count == 1) { |
4705 |
++ if (sg_count == 1 && !force) { |
4706 |
+ /* Only one segment now, so no link tbl needed*/ |
4707 |
+ copy_talitos_ptr(ptr, &edesc->link_tbl[tbl_off], is_sec1); |
4708 |
+ return sg_count; |
4709 |
+@@ -1183,7 +1155,7 @@ static int talitos_sg_map(struct device *dev, struct scatterlist *src, |
4710 |
+ unsigned int offset, int tbl_off) |
4711 |
+ { |
4712 |
+ return talitos_sg_map_ext(dev, src, len, edesc, ptr, sg_count, offset, |
4713 |
+- tbl_off, 0); |
4714 |
++ tbl_off, 0, false); |
4715 |
+ } |
4716 |
+ |
4717 |
+ /* |
4718 |
+@@ -1211,6 +1183,7 @@ static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq, |
4719 |
+ bool is_ipsec_esp = desc->hdr & DESC_HDR_TYPE_IPSEC_ESP; |
4720 |
+ struct talitos_ptr *civ_ptr = &desc->ptr[is_ipsec_esp ? 2 : 3]; |
4721 |
+ struct talitos_ptr *ckey_ptr = &desc->ptr[is_ipsec_esp ? 3 : 2]; |
4722 |
++ dma_addr_t dma_icv = edesc->dma_link_tbl + edesc->dma_len - authsize; |
4723 |
+ |
4724 |
+ /* hmac key */ |
4725 |
+ to_talitos_ptr(&desc->ptr[0], ctx->dma_key, ctx->authkeylen, is_sec1); |
4726 |
+@@ -1250,7 +1223,8 @@ static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq, |
4727 |
+ elen = authsize; |
4728 |
+ |
4729 |
+ ret = talitos_sg_map_ext(dev, areq->src, cryptlen, edesc, &desc->ptr[4], |
4730 |
+- sg_count, areq->assoclen, tbl_off, elen); |
4731 |
++ sg_count, areq->assoclen, tbl_off, elen, |
4732 |
++ false); |
4733 |
+ |
4734 |
+ if (ret > 1) { |
4735 |
+ tbl_off += ret; |
4736 |
+@@ -1264,55 +1238,35 @@ static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq, |
4737 |
+ dma_map_sg(dev, areq->dst, sg_count, DMA_FROM_DEVICE); |
4738 |
+ } |
4739 |
+ |
4740 |
+- ret = talitos_sg_map(dev, areq->dst, cryptlen, edesc, &desc->ptr[5], |
4741 |
+- sg_count, areq->assoclen, tbl_off); |
4742 |
+- |
4743 |
+- if (is_ipsec_esp) |
4744 |
+- to_talitos_ptr_ext_or(&desc->ptr[5], authsize, is_sec1); |
4745 |
++ if (is_ipsec_esp && encrypt) |
4746 |
++ elen = authsize; |
4747 |
++ else |
4748 |
++ elen = 0; |
4749 |
++ ret = talitos_sg_map_ext(dev, areq->dst, cryptlen, edesc, &desc->ptr[5], |
4750 |
++ sg_count, areq->assoclen, tbl_off, elen, |
4751 |
++ is_ipsec_esp && !encrypt); |
4752 |
++ tbl_off += ret; |
4753 |
+ |
4754 |
+ /* ICV data */ |
4755 |
+- if (ret > 1) { |
4756 |
+- tbl_off += ret; |
4757 |
+- edesc->icv_ool = true; |
4758 |
+- sync_needed = true; |
4759 |
++ edesc->icv_ool = !encrypt; |
4760 |
+ |
4761 |
+- if (is_ipsec_esp) { |
4762 |
+- struct talitos_ptr *tbl_ptr = &edesc->link_tbl[tbl_off]; |
4763 |
+- int offset = (edesc->src_nents + edesc->dst_nents + 2) * |
4764 |
+- sizeof(struct talitos_ptr) + authsize; |
4765 |
++ if (!encrypt && is_ipsec_esp) { |
4766 |
++ struct talitos_ptr *tbl_ptr = &edesc->link_tbl[tbl_off]; |
4767 |
+ |
4768 |
+- /* Add an entry to the link table for ICV data */ |
4769 |
+- to_talitos_ptr_ext_set(tbl_ptr - 1, 0, is_sec1); |
4770 |
+- to_talitos_ptr_ext_set(tbl_ptr, DESC_PTR_LNKTBL_RETURN, |
4771 |
+- is_sec1); |
4772 |
++ /* Add an entry to the link table for ICV data */ |
4773 |
++ to_talitos_ptr_ext_set(tbl_ptr - 1, 0, is_sec1); |
4774 |
++ to_talitos_ptr_ext_set(tbl_ptr, DESC_PTR_LNKTBL_RET, is_sec1); |
4775 |
+ |
4776 |
+- /* icv data follows link tables */ |
4777 |
+- to_talitos_ptr(tbl_ptr, edesc->dma_link_tbl + offset, |
4778 |
+- authsize, is_sec1); |
4779 |
+- } else { |
4780 |
+- dma_addr_t addr = edesc->dma_link_tbl; |
4781 |
+- |
4782 |
+- if (is_sec1) |
4783 |
+- addr += areq->assoclen + cryptlen; |
4784 |
+- else |
4785 |
+- addr += sizeof(struct talitos_ptr) * tbl_off; |
4786 |
+- |
4787 |
+- to_talitos_ptr(&desc->ptr[6], addr, authsize, is_sec1); |
4788 |
+- } |
4789 |
++ /* icv data follows link tables */ |
4790 |
++ to_talitos_ptr(tbl_ptr, dma_icv, authsize, is_sec1); |
4791 |
++ to_talitos_ptr_ext_or(&desc->ptr[5], authsize, is_sec1); |
4792 |
++ sync_needed = true; |
4793 |
++ } else if (!encrypt) { |
4794 |
++ to_talitos_ptr(&desc->ptr[6], dma_icv, authsize, is_sec1); |
4795 |
++ sync_needed = true; |
4796 |
+ } else if (!is_ipsec_esp) { |
4797 |
+- ret = talitos_sg_map(dev, areq->dst, authsize, edesc, |
4798 |
+- &desc->ptr[6], sg_count, areq->assoclen + |
4799 |
+- cryptlen, |
4800 |
+- tbl_off); |
4801 |
+- if (ret > 1) { |
4802 |
+- tbl_off += ret; |
4803 |
+- edesc->icv_ool = true; |
4804 |
+- sync_needed = true; |
4805 |
+- } else { |
4806 |
+- edesc->icv_ool = false; |
4807 |
+- } |
4808 |
+- } else { |
4809 |
+- edesc->icv_ool = false; |
4810 |
++ talitos_sg_map(dev, areq->dst, authsize, edesc, &desc->ptr[6], |
4811 |
++ sg_count, areq->assoclen + cryptlen, tbl_off); |
4812 |
+ } |
4813 |
+ |
4814 |
+ /* iv out */ |
4815 |
+@@ -1395,18 +1349,18 @@ static struct talitos_edesc *talitos_edesc_alloc(struct device *dev, |
4816 |
+ * and space for two sets of ICVs (stashed and generated) |
4817 |
+ */ |
4818 |
+ alloc_len = sizeof(struct talitos_edesc); |
4819 |
+- if (src_nents || dst_nents) { |
4820 |
++ if (src_nents || dst_nents || !encrypt) { |
4821 |
+ if (is_sec1) |
4822 |
+ dma_len = (src_nents ? src_len : 0) + |
4823 |
+- (dst_nents ? dst_len : 0); |
4824 |
++ (dst_nents ? dst_len : 0) + authsize; |
4825 |
+ else |
4826 |
+ dma_len = (src_nents + dst_nents + 2) * |
4827 |
+- sizeof(struct talitos_ptr) + authsize * 2; |
4828 |
++ sizeof(struct talitos_ptr) + authsize; |
4829 |
+ alloc_len += dma_len; |
4830 |
+ } else { |
4831 |
+ dma_len = 0; |
4832 |
+- alloc_len += icv_stashing ? authsize : 0; |
4833 |
+ } |
4834 |
++ alloc_len += icv_stashing ? authsize : 0; |
4835 |
+ |
4836 |
+ /* if its a ahash, add space for a second desc next to the first one */ |
4837 |
+ if (is_sec1 && !dst) |
4838 |
+@@ -1500,11 +1454,7 @@ static int aead_decrypt(struct aead_request *req) |
4839 |
+ edesc->desc.hdr = ctx->desc_hdr_template | DESC_HDR_DIR_INBOUND; |
4840 |
+ |
4841 |
+ /* stash incoming ICV for later cmp with ICV generated by the h/w */ |
4842 |
+- if (edesc->dma_len) |
4843 |
+- icvdata = (char *)&edesc->link_tbl[edesc->src_nents + |
4844 |
+- edesc->dst_nents + 2]; |
4845 |
+- else |
4846 |
+- icvdata = &edesc->link_tbl[0]; |
4847 |
++ icvdata = edesc->buf + edesc->dma_len; |
4848 |
+ |
4849 |
+ sg_pcopy_to_buffer(req->src, edesc->src_nents ? : 1, icvdata, authsize, |
4850 |
+ req->assoclen + req->cryptlen - authsize); |
4851 |
+diff --git a/drivers/crypto/talitos.h b/drivers/crypto/talitos.h |
4852 |
+index 979f6a61e545..cb0137e131cc 100644 |
4853 |
+--- a/drivers/crypto/talitos.h |
4854 |
++++ b/drivers/crypto/talitos.h |
4855 |
+@@ -442,5 +442,5 @@ static inline bool has_ftr_sec1(struct talitos_private *priv) |
4856 |
+ |
4857 |
+ /* link table extent field bits */ |
4858 |
+ #define DESC_PTR_LNKTBL_JUMP 0x80 |
4859 |
+-#define DESC_PTR_LNKTBL_RETURN 0x02 |
4860 |
++#define DESC_PTR_LNKTBL_RET 0x02 |
4861 |
+ #define DESC_PTR_LNKTBL_NEXT 0x01 |
4862 |
+diff --git a/drivers/dma/dma-axi-dmac.c b/drivers/dma/dma-axi-dmac.c |
4863 |
+index 15b2453d2647..b2c755b74bea 100644 |
4864 |
+--- a/drivers/dma/dma-axi-dmac.c |
4865 |
++++ b/drivers/dma/dma-axi-dmac.c |
4866 |
+@@ -486,7 +486,7 @@ static struct dma_async_tx_descriptor *axi_dmac_prep_interleaved( |
4867 |
+ |
4868 |
+ if (chan->hw_2d) { |
4869 |
+ if (!axi_dmac_check_len(chan, xt->sgl[0].size) || |
4870 |
+- !axi_dmac_check_len(chan, xt->numf)) |
4871 |
++ xt->numf == 0) |
4872 |
+ return NULL; |
4873 |
+ if (xt->sgl[0].size + dst_icg > chan->max_length || |
4874 |
+ xt->sgl[0].size + src_icg > chan->max_length) |
4875 |
+diff --git a/drivers/dma/dw/platform.c b/drivers/dma/dw/platform.c |
4876 |
+index c299ff181bb6..62218ea0894c 100644 |
4877 |
+--- a/drivers/dma/dw/platform.c |
4878 |
++++ b/drivers/dma/dw/platform.c |
4879 |
+@@ -87,13 +87,20 @@ static void dw_dma_acpi_controller_register(struct dw_dma *dw) |
4880 |
+ dma_cap_set(DMA_SLAVE, info->dma_cap); |
4881 |
+ info->filter_fn = dw_dma_acpi_filter; |
4882 |
+ |
4883 |
+- ret = devm_acpi_dma_controller_register(dev, acpi_dma_simple_xlate, |
4884 |
+- info); |
4885 |
++ ret = acpi_dma_controller_register(dev, acpi_dma_simple_xlate, info); |
4886 |
+ if (ret) |
4887 |
+ dev_err(dev, "could not register acpi_dma_controller\n"); |
4888 |
+ } |
4889 |
++ |
4890 |
++static void dw_dma_acpi_controller_free(struct dw_dma *dw) |
4891 |
++{ |
4892 |
++ struct device *dev = dw->dma.dev; |
4893 |
++ |
4894 |
++ acpi_dma_controller_free(dev); |
4895 |
++} |
4896 |
+ #else /* !CONFIG_ACPI */ |
4897 |
+ static inline void dw_dma_acpi_controller_register(struct dw_dma *dw) {} |
4898 |
++static inline void dw_dma_acpi_controller_free(struct dw_dma *dw) {} |
4899 |
+ #endif /* !CONFIG_ACPI */ |
4900 |
+ |
4901 |
+ #ifdef CONFIG_OF |
4902 |
+@@ -249,6 +256,9 @@ static int dw_remove(struct platform_device *pdev) |
4903 |
+ { |
4904 |
+ struct dw_dma_chip *chip = platform_get_drvdata(pdev); |
4905 |
+ |
4906 |
++ if (ACPI_HANDLE(&pdev->dev)) |
4907 |
++ dw_dma_acpi_controller_free(chip->dw); |
4908 |
++ |
4909 |
+ if (pdev->dev.of_node) |
4910 |
+ of_dma_controller_free(pdev->dev.of_node); |
4911 |
+ |
4912 |
+diff --git a/drivers/dma/hsu/hsu.c b/drivers/dma/hsu/hsu.c |
4913 |
+index 202ffa9f7611..18f155a974db 100644 |
4914 |
+--- a/drivers/dma/hsu/hsu.c |
4915 |
++++ b/drivers/dma/hsu/hsu.c |
4916 |
+@@ -64,10 +64,10 @@ static void hsu_dma_chan_start(struct hsu_dma_chan *hsuc) |
4917 |
+ |
4918 |
+ if (hsuc->direction == DMA_MEM_TO_DEV) { |
4919 |
+ bsr = config->dst_maxburst; |
4920 |
+- mtsr = config->src_addr_width; |
4921 |
++ mtsr = config->dst_addr_width; |
4922 |
+ } else if (hsuc->direction == DMA_DEV_TO_MEM) { |
4923 |
+ bsr = config->src_maxburst; |
4924 |
+- mtsr = config->dst_addr_width; |
4925 |
++ mtsr = config->src_addr_width; |
4926 |
+ } |
4927 |
+ |
4928 |
+ hsu_chan_disable(hsuc); |
4929 |
+diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c |
4930 |
+index 3f5a01cb4ab4..ceb82e74f5b4 100644 |
4931 |
+--- a/drivers/dma/imx-sdma.c |
4932 |
++++ b/drivers/dma/imx-sdma.c |
4933 |
+@@ -1662,6 +1662,14 @@ static void sdma_add_scripts(struct sdma_engine *sdma, |
4934 |
+ if (!sdma->script_number) |
4935 |
+ sdma->script_number = SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V1; |
4936 |
+ |
4937 |
++ if (sdma->script_number > sizeof(struct sdma_script_start_addrs) |
4938 |
++ / sizeof(s32)) { |
4939 |
++ dev_err(sdma->dev, |
4940 |
++ "SDMA script number %d not match with firmware.\n", |
4941 |
++ sdma->script_number); |
4942 |
++ return; |
4943 |
++ } |
4944 |
++ |
4945 |
+ for (i = 0; i < sdma->script_number; i++) |
4946 |
+ if (addr_arr[i] > 0) |
4947 |
+ saddr_arr[i] = addr_arr[i]; |
4948 |
+diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c |
4949 |
+index 969534c1a6c6..abc8d3e0487b 100644 |
4950 |
+--- a/drivers/dma/mv_xor.c |
4951 |
++++ b/drivers/dma/mv_xor.c |
4952 |
+@@ -1059,6 +1059,7 @@ mv_xor_channel_add(struct mv_xor_device *xordev, |
4953 |
+ mv_chan->op_in_desc = XOR_MODE_IN_DESC; |
4954 |
+ |
4955 |
+ dma_dev = &mv_chan->dmadev; |
4956 |
++ dma_dev->dev = &pdev->dev; |
4957 |
+ mv_chan->xordev = xordev; |
4958 |
+ |
4959 |
+ /* |
4960 |
+@@ -1091,7 +1092,6 @@ mv_xor_channel_add(struct mv_xor_device *xordev, |
4961 |
+ dma_dev->device_free_chan_resources = mv_xor_free_chan_resources; |
4962 |
+ dma_dev->device_tx_status = mv_xor_status; |
4963 |
+ dma_dev->device_issue_pending = mv_xor_issue_pending; |
4964 |
+- dma_dev->dev = &pdev->dev; |
4965 |
+ |
4966 |
+ /* set prep routines based on capability */ |
4967 |
+ if (dma_has_cap(DMA_INTERRUPT, dma_dev->cap_mask)) |
4968 |
+diff --git a/drivers/dma/tegra210-adma.c b/drivers/dma/tegra210-adma.c |
4969 |
+index 09b6756366c3..4f4733d831a1 100644 |
4970 |
+--- a/drivers/dma/tegra210-adma.c |
4971 |
++++ b/drivers/dma/tegra210-adma.c |
4972 |
+@@ -98,6 +98,7 @@ struct tegra_adma_chan_regs { |
4973 |
+ unsigned int src_addr; |
4974 |
+ unsigned int trg_addr; |
4975 |
+ unsigned int fifo_ctrl; |
4976 |
++ unsigned int cmd; |
4977 |
+ unsigned int tc; |
4978 |
+ }; |
4979 |
+ |
4980 |
+@@ -127,6 +128,7 @@ struct tegra_adma_chan { |
4981 |
+ enum dma_transfer_direction sreq_dir; |
4982 |
+ unsigned int sreq_index; |
4983 |
+ bool sreq_reserved; |
4984 |
++ struct tegra_adma_chan_regs ch_regs; |
4985 |
+ |
4986 |
+ /* Transfer count and position info */ |
4987 |
+ unsigned int tx_buf_count; |
4988 |
+@@ -635,8 +637,30 @@ static struct dma_chan *tegra_dma_of_xlate(struct of_phandle_args *dma_spec, |
4989 |
+ static int tegra_adma_runtime_suspend(struct device *dev) |
4990 |
+ { |
4991 |
+ struct tegra_adma *tdma = dev_get_drvdata(dev); |
4992 |
++ struct tegra_adma_chan_regs *ch_reg; |
4993 |
++ struct tegra_adma_chan *tdc; |
4994 |
++ int i; |
4995 |
+ |
4996 |
+ tdma->global_cmd = tdma_read(tdma, ADMA_GLOBAL_CMD); |
4997 |
++ if (!tdma->global_cmd) |
4998 |
++ goto clk_disable; |
4999 |
++ |
5000 |
++ for (i = 0; i < tdma->nr_channels; i++) { |
5001 |
++ tdc = &tdma->channels[i]; |
5002 |
++ ch_reg = &tdc->ch_regs; |
5003 |
++ ch_reg->cmd = tdma_ch_read(tdc, ADMA_CH_CMD); |
5004 |
++ /* skip if channel is not active */ |
5005 |
++ if (!ch_reg->cmd) |
5006 |
++ continue; |
5007 |
++ ch_reg->tc = tdma_ch_read(tdc, ADMA_CH_TC); |
5008 |
++ ch_reg->src_addr = tdma_ch_read(tdc, ADMA_CH_LOWER_SRC_ADDR); |
5009 |
++ ch_reg->trg_addr = tdma_ch_read(tdc, ADMA_CH_LOWER_TRG_ADDR); |
5010 |
++ ch_reg->ctrl = tdma_ch_read(tdc, ADMA_CH_CTRL); |
5011 |
++ ch_reg->fifo_ctrl = tdma_ch_read(tdc, ADMA_CH_FIFO_CTRL); |
5012 |
++ ch_reg->config = tdma_ch_read(tdc, ADMA_CH_CONFIG); |
5013 |
++ } |
5014 |
++ |
5015 |
++clk_disable: |
5016 |
+ clk_disable_unprepare(tdma->ahub_clk); |
5017 |
+ |
5018 |
+ return 0; |
5019 |
+@@ -645,7 +669,9 @@ static int tegra_adma_runtime_suspend(struct device *dev) |
5020 |
+ static int tegra_adma_runtime_resume(struct device *dev) |
5021 |
+ { |
5022 |
+ struct tegra_adma *tdma = dev_get_drvdata(dev); |
5023 |
+- int ret; |
5024 |
++ struct tegra_adma_chan_regs *ch_reg; |
5025 |
++ struct tegra_adma_chan *tdc; |
5026 |
++ int ret, i; |
5027 |
+ |
5028 |
+ ret = clk_prepare_enable(tdma->ahub_clk); |
5029 |
+ if (ret) { |
5030 |
+@@ -654,6 +680,24 @@ static int tegra_adma_runtime_resume(struct device *dev) |
5031 |
+ } |
5032 |
+ tdma_write(tdma, ADMA_GLOBAL_CMD, tdma->global_cmd); |
5033 |
+ |
5034 |
++ if (!tdma->global_cmd) |
5035 |
++ return 0; |
5036 |
++ |
5037 |
++ for (i = 0; i < tdma->nr_channels; i++) { |
5038 |
++ tdc = &tdma->channels[i]; |
5039 |
++ ch_reg = &tdc->ch_regs; |
5040 |
++ /* skip if channel was not active earlier */ |
5041 |
++ if (!ch_reg->cmd) |
5042 |
++ continue; |
5043 |
++ tdma_ch_write(tdc, ADMA_CH_TC, ch_reg->tc); |
5044 |
++ tdma_ch_write(tdc, ADMA_CH_LOWER_SRC_ADDR, ch_reg->src_addr); |
5045 |
++ tdma_ch_write(tdc, ADMA_CH_LOWER_TRG_ADDR, ch_reg->trg_addr); |
5046 |
++ tdma_ch_write(tdc, ADMA_CH_CTRL, ch_reg->ctrl); |
5047 |
++ tdma_ch_write(tdc, ADMA_CH_FIFO_CTRL, ch_reg->fifo_ctrl); |
5048 |
++ tdma_ch_write(tdc, ADMA_CH_CONFIG, ch_reg->config); |
5049 |
++ tdma_ch_write(tdc, ADMA_CH_CMD, ch_reg->cmd); |
5050 |
++ } |
5051 |
++ |
5052 |
+ return 0; |
5053 |
+ } |
5054 |
+ |
5055 |
+@@ -700,16 +744,6 @@ static int tegra_adma_probe(struct platform_device *pdev) |
5056 |
+ return PTR_ERR(tdma->ahub_clk); |
5057 |
+ } |
5058 |
+ |
5059 |
+- pm_runtime_enable(&pdev->dev); |
5060 |
+- |
5061 |
+- ret = pm_runtime_get_sync(&pdev->dev); |
5062 |
+- if (ret < 0) |
5063 |
+- goto rpm_disable; |
5064 |
+- |
5065 |
+- ret = tegra_adma_init(tdma); |
5066 |
+- if (ret) |
5067 |
+- goto rpm_put; |
5068 |
+- |
5069 |
+ INIT_LIST_HEAD(&tdma->dma_dev.channels); |
5070 |
+ for (i = 0; i < tdma->nr_channels; i++) { |
5071 |
+ struct tegra_adma_chan *tdc = &tdma->channels[i]; |
5072 |
+@@ -727,6 +761,16 @@ static int tegra_adma_probe(struct platform_device *pdev) |
5073 |
+ tdc->tdma = tdma; |
5074 |
+ } |
5075 |
+ |
5076 |
++ pm_runtime_enable(&pdev->dev); |
5077 |
++ |
5078 |
++ ret = pm_runtime_get_sync(&pdev->dev); |
5079 |
++ if (ret < 0) |
5080 |
++ goto rpm_disable; |
5081 |
++ |
5082 |
++ ret = tegra_adma_init(tdma); |
5083 |
++ if (ret) |
5084 |
++ goto rpm_put; |
5085 |
++ |
5086 |
+ dma_cap_set(DMA_SLAVE, tdma->dma_dev.cap_mask); |
5087 |
+ dma_cap_set(DMA_PRIVATE, tdma->dma_dev.cap_mask); |
5088 |
+ dma_cap_set(DMA_CYCLIC, tdma->dma_dev.cap_mask); |
5089 |
+@@ -768,13 +812,13 @@ static int tegra_adma_probe(struct platform_device *pdev) |
5090 |
+ |
5091 |
+ dma_remove: |
5092 |
+ dma_async_device_unregister(&tdma->dma_dev); |
5093 |
+-irq_dispose: |
5094 |
+- while (--i >= 0) |
5095 |
+- irq_dispose_mapping(tdma->channels[i].irq); |
5096 |
+ rpm_put: |
5097 |
+ pm_runtime_put_sync(&pdev->dev); |
5098 |
+ rpm_disable: |
5099 |
+ pm_runtime_disable(&pdev->dev); |
5100 |
++irq_dispose: |
5101 |
++ while (--i >= 0) |
5102 |
++ irq_dispose_mapping(tdma->channels[i].irq); |
5103 |
+ |
5104 |
+ return ret; |
5105 |
+ } |
5106 |
+diff --git a/drivers/dma/ti/edma.c b/drivers/dma/ti/edma.c |
5107 |
+index 982631d4e1f8..44158fa85973 100644 |
5108 |
+--- a/drivers/dma/ti/edma.c |
5109 |
++++ b/drivers/dma/ti/edma.c |
5110 |
+@@ -2345,8 +2345,10 @@ static int edma_probe(struct platform_device *pdev) |
5111 |
+ |
5112 |
+ ecc->tc_list = devm_kcalloc(dev, ecc->num_tc, |
5113 |
+ sizeof(*ecc->tc_list), GFP_KERNEL); |
5114 |
+- if (!ecc->tc_list) |
5115 |
+- return -ENOMEM; |
5116 |
++ if (!ecc->tc_list) { |
5117 |
++ ret = -ENOMEM; |
5118 |
++ goto err_reg1; |
5119 |
++ } |
5120 |
+ |
5121 |
+ for (i = 0;; i++) { |
5122 |
+ ret = of_parse_phandle_with_fixed_args(node, "ti,tptcs", |
5123 |
+diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c |
5124 |
+index f59511bd9926..fd440b35d76e 100644 |
5125 |
+--- a/drivers/edac/edac_mc.c |
5126 |
++++ b/drivers/edac/edac_mc.c |
5127 |
+@@ -681,22 +681,18 @@ static int del_mc_from_global_list(struct mem_ctl_info *mci) |
5128 |
+ |
5129 |
+ struct mem_ctl_info *edac_mc_find(int idx) |
5130 |
+ { |
5131 |
+- struct mem_ctl_info *mci = NULL; |
5132 |
++ struct mem_ctl_info *mci; |
5133 |
+ struct list_head *item; |
5134 |
+ |
5135 |
+ mutex_lock(&mem_ctls_mutex); |
5136 |
+ |
5137 |
+ list_for_each(item, &mc_devices) { |
5138 |
+ mci = list_entry(item, struct mem_ctl_info, link); |
5139 |
+- |
5140 |
+- if (mci->mc_idx >= idx) { |
5141 |
+- if (mci->mc_idx == idx) { |
5142 |
+- goto unlock; |
5143 |
+- } |
5144 |
+- break; |
5145 |
+- } |
5146 |
++ if (mci->mc_idx == idx) |
5147 |
++ goto unlock; |
5148 |
+ } |
5149 |
+ |
5150 |
++ mci = NULL; |
5151 |
+ unlock: |
5152 |
+ mutex_unlock(&mem_ctls_mutex); |
5153 |
+ return mci; |
5154 |
+diff --git a/drivers/firmware/arm_scmi/clock.c b/drivers/firmware/arm_scmi/clock.c |
5155 |
+index 30fc04e28431..0a194af92438 100644 |
5156 |
+--- a/drivers/firmware/arm_scmi/clock.c |
5157 |
++++ b/drivers/firmware/arm_scmi/clock.c |
5158 |
+@@ -185,6 +185,8 @@ scmi_clock_describe_rates_get(const struct scmi_handle *handle, u32 clk_id, |
5159 |
+ if (rate_discrete) |
5160 |
+ clk->list.num_rates = tot_rate_cnt; |
5161 |
+ |
5162 |
++ clk->rate_discrete = rate_discrete; |
5163 |
++ |
5164 |
+ err: |
5165 |
+ scmi_xfer_put(handle, t); |
5166 |
+ return ret; |
5167 |
+diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c |
5168 |
+index 09119e3f5c01..effc4c17e0fb 100644 |
5169 |
+--- a/drivers/firmware/arm_scmi/driver.c |
5170 |
++++ b/drivers/firmware/arm_scmi/driver.c |
5171 |
+@@ -662,9 +662,7 @@ static int scmi_xfer_info_init(struct scmi_info *sinfo) |
5172 |
+ |
5173 |
+ static int scmi_mailbox_check(struct device_node *np) |
5174 |
+ { |
5175 |
+- struct of_phandle_args arg; |
5176 |
+- |
5177 |
+- return of_parse_phandle_with_args(np, "mboxes", "#mbox-cells", 0, &arg); |
5178 |
++ return of_parse_phandle_with_args(np, "mboxes", "#mbox-cells", 0, NULL); |
5179 |
+ } |
5180 |
+ |
5181 |
+ static int scmi_mbox_free_channel(int id, void *p, void *data) |
5182 |
+diff --git a/drivers/firmware/arm_scmi/sensors.c b/drivers/firmware/arm_scmi/sensors.c |
5183 |
+index b53d5cc9c9f6..c00287b5f2c2 100644 |
5184 |
+--- a/drivers/firmware/arm_scmi/sensors.c |
5185 |
++++ b/drivers/firmware/arm_scmi/sensors.c |
5186 |
+@@ -30,10 +30,10 @@ struct scmi_msg_resp_sensor_description { |
5187 |
+ __le32 id; |
5188 |
+ __le32 attributes_low; |
5189 |
+ #define SUPPORTS_ASYNC_READ(x) ((x) & BIT(31)) |
5190 |
+-#define NUM_TRIP_POINTS(x) (((x) >> 4) & 0xff) |
5191 |
++#define NUM_TRIP_POINTS(x) ((x) & 0xff) |
5192 |
+ __le32 attributes_high; |
5193 |
+ #define SENSOR_TYPE(x) ((x) & 0xff) |
5194 |
+-#define SENSOR_SCALE(x) (((x) >> 11) & 0x3f) |
5195 |
++#define SENSOR_SCALE(x) (((x) >> 11) & 0x1f) |
5196 |
+ #define SENSOR_UPDATE_SCALE(x) (((x) >> 22) & 0x1f) |
5197 |
+ #define SENSOR_UPDATE_BASE(x) (((x) >> 27) & 0x1f) |
5198 |
+ u8 name[SCMI_MAX_STR_SIZE]; |
5199 |
+diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c |
5200 |
+index f2483548cde9..0dc0c78f1fdb 100644 |
5201 |
+--- a/drivers/firmware/dmi_scan.c |
5202 |
++++ b/drivers/firmware/dmi_scan.c |
5203 |
+@@ -407,7 +407,7 @@ static void __init save_mem_devices(const struct dmi_header *dm, void *v) |
5204 |
+ bytes = ~0ull; |
5205 |
+ else if (size & 0x8000) |
5206 |
+ bytes = (u64)(size & 0x7fff) << 10; |
5207 |
+- else if (size != 0x7fff) |
5208 |
++ else if (size != 0x7fff || dm->length < 0x20) |
5209 |
+ bytes = (u64)size << 20; |
5210 |
+ else |
5211 |
+ bytes = (u64)get_unaligned((u32 *)&d[0x1C]) << 20; |
5212 |
+diff --git a/drivers/firmware/efi/runtime-wrappers.c b/drivers/firmware/efi/runtime-wrappers.c |
5213 |
+index 1606abead22c..b0aeffd4e269 100644 |
5214 |
+--- a/drivers/firmware/efi/runtime-wrappers.c |
5215 |
++++ b/drivers/firmware/efi/runtime-wrappers.c |
5216 |
+@@ -95,7 +95,7 @@ struct efi_runtime_work { |
5217 |
+ efi_rts_work.status = EFI_ABORTED; \ |
5218 |
+ \ |
5219 |
+ init_completion(&efi_rts_work.efi_rts_comp); \ |
5220 |
+- INIT_WORK(&efi_rts_work.work, efi_call_rts); \ |
5221 |
++ INIT_WORK_ONSTACK(&efi_rts_work.work, efi_call_rts); \ |
5222 |
+ efi_rts_work.arg1 = _arg1; \ |
5223 |
+ efi_rts_work.arg2 = _arg2; \ |
5224 |
+ efi_rts_work.arg3 = _arg3; \ |
5225 |
+diff --git a/drivers/firmware/google/coreboot_table-of.c b/drivers/firmware/google/coreboot_table-of.c |
5226 |
+index f15bf404c579..9b90c0fa4a0b 100644 |
5227 |
+--- a/drivers/firmware/google/coreboot_table-of.c |
5228 |
++++ b/drivers/firmware/google/coreboot_table-of.c |
5229 |
+@@ -19,7 +19,6 @@ |
5230 |
+ #include <linux/io.h> |
5231 |
+ #include <linux/module.h> |
5232 |
+ #include <linux/of_address.h> |
5233 |
+-#include <linux/of_platform.h> |
5234 |
+ #include <linux/platform_device.h> |
5235 |
+ |
5236 |
+ #include "coreboot_table.h" |
5237 |
+@@ -30,7 +29,6 @@ static int coreboot_table_of_probe(struct platform_device *pdev) |
5238 |
+ void __iomem *ptr; |
5239 |
+ |
5240 |
+ ptr = of_iomap(fw_dn, 0); |
5241 |
+- of_node_put(fw_dn); |
5242 |
+ if (!ptr) |
5243 |
+ return -ENOMEM; |
5244 |
+ |
5245 |
+@@ -44,8 +42,9 @@ static int coreboot_table_of_remove(struct platform_device *pdev) |
5246 |
+ |
5247 |
+ static const struct of_device_id coreboot_of_match[] = { |
5248 |
+ { .compatible = "coreboot" }, |
5249 |
+- {}, |
5250 |
++ {} |
5251 |
+ }; |
5252 |
++MODULE_DEVICE_TABLE(of, coreboot_of_match); |
5253 |
+ |
5254 |
+ static struct platform_driver coreboot_table_of_driver = { |
5255 |
+ .probe = coreboot_table_of_probe, |
5256 |
+@@ -55,28 +54,7 @@ static struct platform_driver coreboot_table_of_driver = { |
5257 |
+ .of_match_table = coreboot_of_match, |
5258 |
+ }, |
5259 |
+ }; |
5260 |
+- |
5261 |
+-static int __init platform_coreboot_table_of_init(void) |
5262 |
+-{ |
5263 |
+- struct platform_device *pdev; |
5264 |
+- struct device_node *of_node; |
5265 |
+- |
5266 |
+- /* Limit device creation to the presence of /firmware/coreboot node */ |
5267 |
+- of_node = of_find_node_by_path("/firmware/coreboot"); |
5268 |
+- if (!of_node) |
5269 |
+- return -ENODEV; |
5270 |
+- |
5271 |
+- if (!of_match_node(coreboot_of_match, of_node)) |
5272 |
+- return -ENODEV; |
5273 |
+- |
5274 |
+- pdev = of_platform_device_create(of_node, "coreboot_table_of", NULL); |
5275 |
+- if (!pdev) |
5276 |
+- return -ENODEV; |
5277 |
+- |
5278 |
+- return platform_driver_register(&coreboot_table_of_driver); |
5279 |
+-} |
5280 |
+- |
5281 |
+-module_init(platform_coreboot_table_of_init); |
5282 |
++module_platform_driver(coreboot_table_of_driver); |
5283 |
+ |
5284 |
+ MODULE_AUTHOR("Google, Inc."); |
5285 |
+ MODULE_LICENSE("GPL"); |
5286 |
+diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c |
5287 |
+index c6fa9b393e84..bd62236d3f97 100644 |
5288 |
+--- a/drivers/fsi/fsi-core.c |
5289 |
++++ b/drivers/fsi/fsi-core.c |
5290 |
+@@ -1060,6 +1060,14 @@ static int fsi_slave_init(struct fsi_master *master, int link, uint8_t id) |
5291 |
+ |
5292 |
+ } |
5293 |
+ |
5294 |
++ rc = fsi_slave_set_smode(slave); |
5295 |
++ if (rc) { |
5296 |
++ dev_warn(&master->dev, |
5297 |
++ "can't set smode on slave:%02x:%02x %d\n", |
5298 |
++ link, id, rc); |
5299 |
++ goto err_free; |
5300 |
++ } |
5301 |
++ |
5302 |
+ /* Allocate a minor in the FSI space */ |
5303 |
+ rc = __fsi_get_new_minor(slave, fsi_dev_cfam, &slave->dev.devt, |
5304 |
+ &slave->cdev_idx); |
5305 |
+@@ -1071,17 +1079,14 @@ static int fsi_slave_init(struct fsi_master *master, int link, uint8_t id) |
5306 |
+ rc = cdev_device_add(&slave->cdev, &slave->dev); |
5307 |
+ if (rc) { |
5308 |
+ dev_err(&slave->dev, "Error %d creating slave device\n", rc); |
5309 |
+- goto err_free; |
5310 |
++ goto err_free_ida; |
5311 |
+ } |
5312 |
+ |
5313 |
+- rc = fsi_slave_set_smode(slave); |
5314 |
+- if (rc) { |
5315 |
+- dev_warn(&master->dev, |
5316 |
+- "can't set smode on slave:%02x:%02x %d\n", |
5317 |
+- link, id, rc); |
5318 |
+- kfree(slave); |
5319 |
+- return -ENODEV; |
5320 |
+- } |
5321 |
++ /* Now that we have the cdev registered with the core, any fatal |
5322 |
++ * failures beyond this point will need to clean up through |
5323 |
++ * cdev_device_del(). Fortunately though, nothing past here is fatal. |
5324 |
++ */ |
5325 |
++ |
5326 |
+ if (master->link_config) |
5327 |
+ master->link_config(master, link, |
5328 |
+ slave->t_send_delay, |
5329 |
+@@ -1098,10 +1103,13 @@ static int fsi_slave_init(struct fsi_master *master, int link, uint8_t id) |
5330 |
+ dev_dbg(&master->dev, "failed during slave scan with: %d\n", |
5331 |
+ rc); |
5332 |
+ |
5333 |
+- return rc; |
5334 |
++ return 0; |
5335 |
+ |
5336 |
+- err_free: |
5337 |
+- put_device(&slave->dev); |
5338 |
++err_free_ida: |
5339 |
++ fsi_free_minor(slave->dev.devt); |
5340 |
++err_free: |
5341 |
++ of_node_put(slave->dev.of_node); |
5342 |
++ kfree(slave); |
5343 |
+ return rc; |
5344 |
+ } |
5345 |
+ |
5346 |
+diff --git a/drivers/fsi/fsi-sbefifo.c b/drivers/fsi/fsi-sbefifo.c |
5347 |
+index ae861342626e..9fa3959e0855 100644 |
5348 |
+--- a/drivers/fsi/fsi-sbefifo.c |
5349 |
++++ b/drivers/fsi/fsi-sbefifo.c |
5350 |
+@@ -289,11 +289,11 @@ static int sbefifo_check_sbe_state(struct sbefifo *sbefifo) |
5351 |
+ switch ((sbm & CFAM_SBM_SBE_STATE_MASK) >> CFAM_SBM_SBE_STATE_SHIFT) { |
5352 |
+ case SBE_STATE_UNKNOWN: |
5353 |
+ return -ESHUTDOWN; |
5354 |
++ case SBE_STATE_DMT: |
5355 |
++ return -EBUSY; |
5356 |
+ case SBE_STATE_IPLING: |
5357 |
+ case SBE_STATE_ISTEP: |
5358 |
+ case SBE_STATE_MPIPL: |
5359 |
+- case SBE_STATE_DMT: |
5360 |
+- return -EBUSY; |
5361 |
+ case SBE_STATE_RUNTIME: |
5362 |
+ case SBE_STATE_DUMP: /* Not sure about that one */ |
5363 |
+ break; |
5364 |
+diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c |
5365 |
+index b696ec35efb3..e627e0e9001a 100644 |
5366 |
+--- a/drivers/gpio/gpio-aspeed.c |
5367 |
++++ b/drivers/gpio/gpio-aspeed.c |
5368 |
+@@ -1199,7 +1199,7 @@ static int __init aspeed_gpio_probe(struct platform_device *pdev) |
5369 |
+ gpio->chip.irq.need_valid_mask = true; |
5370 |
+ |
5371 |
+ /* Allocate a cache of the output registers */ |
5372 |
+- banks = gpio->config->nr_gpios >> 5; |
5373 |
++ banks = DIV_ROUND_UP(gpio->config->nr_gpios, 32); |
5374 |
+ gpio->dcache = devm_kcalloc(&pdev->dev, |
5375 |
+ banks, sizeof(u32), GFP_KERNEL); |
5376 |
+ if (!gpio->dcache) |
5377 |
+diff --git a/drivers/gpu/drm/drm_context.c b/drivers/gpu/drm/drm_context.c |
5378 |
+index f973d287696a..da5abf24f59f 100644 |
5379 |
+--- a/drivers/gpu/drm/drm_context.c |
5380 |
++++ b/drivers/gpu/drm/drm_context.c |
5381 |
+@@ -361,23 +361,26 @@ int drm_legacy_addctx(struct drm_device *dev, void *data, |
5382 |
+ { |
5383 |
+ struct drm_ctx_list *ctx_entry; |
5384 |
+ struct drm_ctx *ctx = data; |
5385 |
++ int tmp_handle; |
5386 |
+ |
5387 |
+ if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) && |
5388 |
+ !drm_core_check_feature(dev, DRIVER_LEGACY)) |
5389 |
+ return -EINVAL; |
5390 |
+ |
5391 |
+- ctx->handle = drm_legacy_ctxbitmap_next(dev); |
5392 |
+- if (ctx->handle == DRM_KERNEL_CONTEXT) { |
5393 |
++ tmp_handle = drm_legacy_ctxbitmap_next(dev); |
5394 |
++ if (tmp_handle == DRM_KERNEL_CONTEXT) { |
5395 |
+ /* Skip kernel's context and get a new one. */ |
5396 |
+- ctx->handle = drm_legacy_ctxbitmap_next(dev); |
5397 |
++ tmp_handle = drm_legacy_ctxbitmap_next(dev); |
5398 |
+ } |
5399 |
+- DRM_DEBUG("%d\n", ctx->handle); |
5400 |
+- if (ctx->handle < 0) { |
5401 |
++ DRM_DEBUG("%d\n", tmp_handle); |
5402 |
++ if (tmp_handle < 0) { |
5403 |
+ DRM_DEBUG("Not enough free contexts.\n"); |
5404 |
+ /* Should this return -EBUSY instead? */ |
5405 |
+- return -ENOMEM; |
5406 |
++ return tmp_handle; |
5407 |
+ } |
5408 |
+ |
5409 |
++ ctx->handle = tmp_handle; |
5410 |
++ |
5411 |
+ ctx_entry = kmalloc(sizeof(*ctx_entry), GFP_KERNEL); |
5412 |
+ if (!ctx_entry) { |
5413 |
+ DRM_DEBUG("out of memory\n"); |
5414 |
+diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c |
5415 |
+index 4d7715845306..58fe3945494c 100644 |
5416 |
+--- a/drivers/gpu/drm/drm_dp_mst_topology.c |
5417 |
++++ b/drivers/gpu/drm/drm_dp_mst_topology.c |
5418 |
+@@ -1022,9 +1022,20 @@ static struct drm_dp_mst_port *drm_dp_mst_get_port_ref_locked(struct drm_dp_mst_ |
5419 |
+ static struct drm_dp_mst_port *drm_dp_get_validated_port_ref(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port) |
5420 |
+ { |
5421 |
+ struct drm_dp_mst_port *rport = NULL; |
5422 |
++ |
5423 |
+ mutex_lock(&mgr->lock); |
5424 |
+- if (mgr->mst_primary) |
5425 |
+- rport = drm_dp_mst_get_port_ref_locked(mgr->mst_primary, port); |
5426 |
++ /* |
5427 |
++ * Port may or may not be 'valid' but we don't care about that when |
5428 |
++ * destroying the port and we are guaranteed that the port pointer |
5429 |
++ * will be valid until we've finished |
5430 |
++ */ |
5431 |
++ if (current_work() == &mgr->destroy_connector_work) { |
5432 |
++ kref_get(&port->kref); |
5433 |
++ rport = port; |
5434 |
++ } else if (mgr->mst_primary) { |
5435 |
++ rport = drm_dp_mst_get_port_ref_locked(mgr->mst_primary, |
5436 |
++ port); |
5437 |
++ } |
5438 |
+ mutex_unlock(&mgr->lock); |
5439 |
+ return rport; |
5440 |
+ } |
5441 |
+diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c |
5442 |
+index f57fc1450b61..da9a381d6b57 100644 |
5443 |
+--- a/drivers/gpu/drm/drm_fb_helper.c |
5444 |
++++ b/drivers/gpu/drm/drm_fb_helper.c |
5445 |
+@@ -2979,18 +2979,16 @@ static int drm_fbdev_fb_release(struct fb_info *info, int user) |
5446 |
+ return 0; |
5447 |
+ } |
5448 |
+ |
5449 |
+-/* |
5450 |
+- * fb_ops.fb_destroy is called by the last put_fb_info() call at the end of |
5451 |
+- * unregister_framebuffer() or fb_release(). |
5452 |
+- */ |
5453 |
+-static void drm_fbdev_fb_destroy(struct fb_info *info) |
5454 |
++static void drm_fbdev_cleanup(struct drm_fb_helper *fb_helper) |
5455 |
+ { |
5456 |
+- struct drm_fb_helper *fb_helper = info->par; |
5457 |
+ struct fb_info *fbi = fb_helper->fbdev; |
5458 |
+ struct fb_ops *fbops = NULL; |
5459 |
+ void *shadow = NULL; |
5460 |
+ |
5461 |
+- if (fbi->fbdefio) { |
5462 |
++ if (!fb_helper->dev) |
5463 |
++ return; |
5464 |
++ |
5465 |
++ if (fbi && fbi->fbdefio) { |
5466 |
+ fb_deferred_io_cleanup(fbi); |
5467 |
+ shadow = fbi->screen_buffer; |
5468 |
+ fbops = fbi->fbops; |
5469 |
+@@ -3004,6 +3002,12 @@ static void drm_fbdev_fb_destroy(struct fb_info *info) |
5470 |
+ } |
5471 |
+ |
5472 |
+ drm_client_framebuffer_delete(fb_helper->buffer); |
5473 |
++} |
5474 |
++ |
5475 |
++static void drm_fbdev_release(struct drm_fb_helper *fb_helper) |
5476 |
++{ |
5477 |
++ drm_fbdev_cleanup(fb_helper); |
5478 |
++ |
5479 |
+ /* |
5480 |
+ * FIXME: |
5481 |
+ * Remove conditional when all CMA drivers have been moved over to using |
5482 |
+@@ -3015,6 +3019,15 @@ static void drm_fbdev_fb_destroy(struct fb_info *info) |
5483 |
+ } |
5484 |
+ } |
5485 |
+ |
5486 |
++/* |
5487 |
++ * fb_ops.fb_destroy is called by the last put_fb_info() call at the end of |
5488 |
++ * unregister_framebuffer() or fb_release(). |
5489 |
++ */ |
5490 |
++static void drm_fbdev_fb_destroy(struct fb_info *info) |
5491 |
++{ |
5492 |
++ drm_fbdev_release(info->par); |
5493 |
++} |
5494 |
++ |
5495 |
+ static int drm_fbdev_fb_mmap(struct fb_info *info, struct vm_area_struct *vma) |
5496 |
+ { |
5497 |
+ struct drm_fb_helper *fb_helper = info->par; |
5498 |
+@@ -3065,7 +3078,6 @@ int drm_fb_helper_generic_probe(struct drm_fb_helper *fb_helper, |
5499 |
+ struct drm_framebuffer *fb; |
5500 |
+ struct fb_info *fbi; |
5501 |
+ u32 format; |
5502 |
+- int ret; |
5503 |
+ |
5504 |
+ DRM_DEBUG_KMS("surface width(%d), height(%d) and bpp(%d)\n", |
5505 |
+ sizes->surface_width, sizes->surface_height, |
5506 |
+@@ -3082,10 +3094,8 @@ int drm_fb_helper_generic_probe(struct drm_fb_helper *fb_helper, |
5507 |
+ fb = buffer->fb; |
5508 |
+ |
5509 |
+ fbi = drm_fb_helper_alloc_fbi(fb_helper); |
5510 |
+- if (IS_ERR(fbi)) { |
5511 |
+- ret = PTR_ERR(fbi); |
5512 |
+- goto err_free_buffer; |
5513 |
+- } |
5514 |
++ if (IS_ERR(fbi)) |
5515 |
++ return PTR_ERR(fbi); |
5516 |
+ |
5517 |
+ fbi->par = fb_helper; |
5518 |
+ fbi->fbops = &drm_fbdev_fb_ops; |
5519 |
+@@ -3116,8 +3126,7 @@ int drm_fb_helper_generic_probe(struct drm_fb_helper *fb_helper, |
5520 |
+ if (!fbops || !shadow) { |
5521 |
+ kfree(fbops); |
5522 |
+ vfree(shadow); |
5523 |
+- ret = -ENOMEM; |
5524 |
+- goto err_fb_info_destroy; |
5525 |
++ return -ENOMEM; |
5526 |
+ } |
5527 |
+ |
5528 |
+ *fbops = *fbi->fbops; |
5529 |
+@@ -3129,13 +3138,6 @@ int drm_fb_helper_generic_probe(struct drm_fb_helper *fb_helper, |
5530 |
+ } |
5531 |
+ |
5532 |
+ return 0; |
5533 |
+- |
5534 |
+-err_fb_info_destroy: |
5535 |
+- drm_fb_helper_fini(fb_helper); |
5536 |
+-err_free_buffer: |
5537 |
+- drm_client_framebuffer_delete(buffer); |
5538 |
+- |
5539 |
+- return ret; |
5540 |
+ } |
5541 |
+ EXPORT_SYMBOL(drm_fb_helper_generic_probe); |
5542 |
+ |
5543 |
+@@ -3147,18 +3149,11 @@ static void drm_fbdev_client_unregister(struct drm_client_dev *client) |
5544 |
+ { |
5545 |
+ struct drm_fb_helper *fb_helper = drm_fb_helper_from_client(client); |
5546 |
+ |
5547 |
+- if (fb_helper->fbdev) { |
5548 |
+- drm_fb_helper_unregister_fbi(fb_helper); |
5549 |
++ if (fb_helper->fbdev) |
5550 |
+ /* drm_fbdev_fb_destroy() takes care of cleanup */ |
5551 |
+- return; |
5552 |
+- } |
5553 |
+- |
5554 |
+- /* Did drm_fb_helper_fbdev_setup() run? */ |
5555 |
+- if (fb_helper->dev) |
5556 |
+- drm_fb_helper_fini(fb_helper); |
5557 |
+- |
5558 |
+- drm_client_release(client); |
5559 |
+- kfree(fb_helper); |
5560 |
++ drm_fb_helper_unregister_fbi(fb_helper); |
5561 |
++ else |
5562 |
++ drm_fbdev_release(fb_helper); |
5563 |
+ } |
5564 |
+ |
5565 |
+ static int drm_fbdev_client_restore(struct drm_client_dev *client) |
5566 |
+@@ -3174,7 +3169,7 @@ static int drm_fbdev_client_hotplug(struct drm_client_dev *client) |
5567 |
+ struct drm_device *dev = client->dev; |
5568 |
+ int ret; |
5569 |
+ |
5570 |
+- /* If drm_fb_helper_fbdev_setup() failed, we only try once */ |
5571 |
++ /* Setup is not retried if it has failed */ |
5572 |
+ if (!fb_helper->dev && fb_helper->funcs) |
5573 |
+ return 0; |
5574 |
+ |
5575 |
+@@ -3184,15 +3179,34 @@ static int drm_fbdev_client_hotplug(struct drm_client_dev *client) |
5576 |
+ if (!dev->mode_config.num_connector) |
5577 |
+ return 0; |
5578 |
+ |
5579 |
+- ret = drm_fb_helper_fbdev_setup(dev, fb_helper, &drm_fb_helper_generic_funcs, |
5580 |
+- fb_helper->preferred_bpp, 0); |
5581 |
+- if (ret) { |
5582 |
+- fb_helper->dev = NULL; |
5583 |
+- fb_helper->fbdev = NULL; |
5584 |
+- return ret; |
5585 |
+- } |
5586 |
++ drm_fb_helper_prepare(dev, fb_helper, &drm_fb_helper_generic_funcs); |
5587 |
++ |
5588 |
++ ret = drm_fb_helper_init(dev, fb_helper, dev->mode_config.num_connector); |
5589 |
++ if (ret) |
5590 |
++ goto err; |
5591 |
++ |
5592 |
++ ret = drm_fb_helper_single_add_all_connectors(fb_helper); |
5593 |
++ if (ret) |
5594 |
++ goto err_cleanup; |
5595 |
++ |
5596 |
++ if (!drm_drv_uses_atomic_modeset(dev)) |
5597 |
++ drm_helper_disable_unused_functions(dev); |
5598 |
++ |
5599 |
++ ret = drm_fb_helper_initial_config(fb_helper, fb_helper->preferred_bpp); |
5600 |
++ if (ret) |
5601 |
++ goto err_cleanup; |
5602 |
+ |
5603 |
+ return 0; |
5604 |
++ |
5605 |
++err_cleanup: |
5606 |
++ drm_fbdev_cleanup(fb_helper); |
5607 |
++err: |
5608 |
++ fb_helper->dev = NULL; |
5609 |
++ fb_helper->fbdev = NULL; |
5610 |
++ |
5611 |
++ DRM_DEV_ERROR(dev->dev, "fbdev: Failed to setup generic emulation (ret=%d)\n", ret); |
5612 |
++ |
5613 |
++ return ret; |
5614 |
+ } |
5615 |
+ |
5616 |
+ static const struct drm_client_funcs drm_fbdev_client_funcs = { |
5617 |
+@@ -3243,12 +3257,16 @@ int drm_fbdev_generic_setup(struct drm_device *dev, unsigned int preferred_bpp) |
5618 |
+ return ret; |
5619 |
+ } |
5620 |
+ |
5621 |
+- drm_client_add(&fb_helper->client); |
5622 |
+- |
5623 |
++ if (!preferred_bpp) |
5624 |
++ preferred_bpp = dev->mode_config.preferred_depth; |
5625 |
++ if (!preferred_bpp) |
5626 |
++ preferred_bpp = 32; |
5627 |
+ fb_helper->preferred_bpp = preferred_bpp; |
5628 |
+ |
5629 |
+ drm_fbdev_client_hotplug(&fb_helper->client); |
5630 |
+ |
5631 |
++ drm_client_add(&fb_helper->client); |
5632 |
++ |
5633 |
+ return 0; |
5634 |
+ } |
5635 |
+ EXPORT_SYMBOL(drm_fbdev_generic_setup); |
5636 |
+diff --git a/drivers/gpu/drm/etnaviv/etnaviv_dump.c b/drivers/gpu/drm/etnaviv/etnaviv_dump.c |
5637 |
+index 468dff2f7904..9d839b4fd8f7 100644 |
5638 |
+--- a/drivers/gpu/drm/etnaviv/etnaviv_dump.c |
5639 |
++++ b/drivers/gpu/drm/etnaviv/etnaviv_dump.c |
5640 |
+@@ -217,7 +217,7 @@ void etnaviv_core_dump(struct etnaviv_gpu *gpu) |
5641 |
+ mutex_lock(&obj->lock); |
5642 |
+ pages = etnaviv_gem_get_pages(obj); |
5643 |
+ mutex_unlock(&obj->lock); |
5644 |
+- if (pages) { |
5645 |
++ if (!IS_ERR(pages)) { |
5646 |
+ int j; |
5647 |
+ |
5648 |
+ iter.hdr->data[0] = bomap - bomap_start; |
5649 |
+diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c |
5650 |
+index 0566171f8df2..f21529e635e3 100644 |
5651 |
+--- a/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c |
5652 |
++++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c |
5653 |
+@@ -15,7 +15,7 @@ struct sg_table *etnaviv_gem_prime_get_sg_table(struct drm_gem_object *obj) |
5654 |
+ int npages = obj->size >> PAGE_SHIFT; |
5655 |
+ |
5656 |
+ if (WARN_ON(!etnaviv_obj->pages)) /* should have already pinned! */ |
5657 |
+- return NULL; |
5658 |
++ return ERR_PTR(-EINVAL); |
5659 |
+ |
5660 |
+ return drm_prime_pages_to_sg(etnaviv_obj->pages, npages); |
5661 |
+ } |
5662 |
+diff --git a/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c b/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c |
5663 |
+index 9980d81a26e3..4227a4006c34 100644 |
5664 |
+--- a/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c |
5665 |
++++ b/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c |
5666 |
+@@ -113,7 +113,7 @@ static const struct etnaviv_pm_domain doms_3d[] = { |
5667 |
+ .name = "PE", |
5668 |
+ .profile_read = VIVS_MC_PROFILE_PE_READ, |
5669 |
+ .profile_config = VIVS_MC_PROFILE_CONFIG0, |
5670 |
+- .nr_signals = 5, |
5671 |
++ .nr_signals = 4, |
5672 |
+ .signal = (const struct etnaviv_pm_signal[]) { |
5673 |
+ { |
5674 |
+ "PIXEL_COUNT_KILLED_BY_COLOR_PIPE", |
5675 |
+@@ -435,7 +435,7 @@ int etnaviv_pm_query_sig(struct etnaviv_gpu *gpu, |
5676 |
+ |
5677 |
+ dom = meta->domains + signal->domain; |
5678 |
+ |
5679 |
+- if (signal->iter > dom->nr_signals) |
5680 |
++ if (signal->iter >= dom->nr_signals) |
5681 |
+ return -EINVAL; |
5682 |
+ |
5683 |
+ sig = &dom->signal[signal->iter]; |
5684 |
+@@ -461,7 +461,7 @@ int etnaviv_pm_req_validate(const struct drm_etnaviv_gem_submit_pmr *r, |
5685 |
+ |
5686 |
+ dom = meta->domains + r->domain; |
5687 |
+ |
5688 |
+- if (r->signal > dom->nr_signals) |
5689 |
++ if (r->signal >= dom->nr_signals) |
5690 |
+ return -EINVAL; |
5691 |
+ |
5692 |
+ return 0; |
5693 |
+diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c |
5694 |
+index 8bd29075ae4e..edcca1761500 100644 |
5695 |
+--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c |
5696 |
++++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c |
5697 |
+@@ -71,7 +71,6 @@ static int hibmc_drm_fb_create(struct drm_fb_helper *helper, |
5698 |
+ DRM_DEBUG_DRIVER("surface width(%d), height(%d) and bpp(%d)\n", |
5699 |
+ sizes->surface_width, sizes->surface_height, |
5700 |
+ sizes->surface_bpp); |
5701 |
+- sizes->surface_depth = 32; |
5702 |
+ |
5703 |
+ bytes_per_pixel = DIV_ROUND_UP(sizes->surface_bpp, 8); |
5704 |
+ |
5705 |
+diff --git a/drivers/gpu/drm/msm/adreno/a3xx_gpu.c b/drivers/gpu/drm/msm/adreno/a3xx_gpu.c |
5706 |
+index 669c2d4b070d..5c068301d817 100644 |
5707 |
+--- a/drivers/gpu/drm/msm/adreno/a3xx_gpu.c |
5708 |
++++ b/drivers/gpu/drm/msm/adreno/a3xx_gpu.c |
5709 |
+@@ -395,19 +395,17 @@ static const unsigned int a3xx_registers[] = { |
5710 |
+ 0x2200, 0x2212, 0x2214, 0x2217, 0x221a, 0x221a, 0x2240, 0x227e, |
5711 |
+ 0x2280, 0x228b, 0x22c0, 0x22c0, 0x22c4, 0x22ce, 0x22d0, 0x22d8, |
5712 |
+ 0x22df, 0x22e6, 0x22e8, 0x22e9, 0x22ec, 0x22ec, 0x22f0, 0x22f7, |
5713 |
+- 0x22ff, 0x22ff, 0x2340, 0x2343, 0x2348, 0x2349, 0x2350, 0x2356, |
5714 |
+- 0x2360, 0x2360, 0x2440, 0x2440, 0x2444, 0x2444, 0x2448, 0x244d, |
5715 |
+- 0x2468, 0x2469, 0x246c, 0x246d, 0x2470, 0x2470, 0x2472, 0x2472, |
5716 |
+- 0x2474, 0x2475, 0x2479, 0x247a, 0x24c0, 0x24d3, 0x24e4, 0x24ef, |
5717 |
+- 0x2500, 0x2509, 0x250c, 0x250c, 0x250e, 0x250e, 0x2510, 0x2511, |
5718 |
+- 0x2514, 0x2515, 0x25e4, 0x25e4, 0x25ea, 0x25ea, 0x25ec, 0x25ed, |
5719 |
+- 0x25f0, 0x25f0, 0x2600, 0x2612, 0x2614, 0x2617, 0x261a, 0x261a, |
5720 |
+- 0x2640, 0x267e, 0x2680, 0x268b, 0x26c0, 0x26c0, 0x26c4, 0x26ce, |
5721 |
+- 0x26d0, 0x26d8, 0x26df, 0x26e6, 0x26e8, 0x26e9, 0x26ec, 0x26ec, |
5722 |
+- 0x26f0, 0x26f7, 0x26ff, 0x26ff, 0x2740, 0x2743, 0x2748, 0x2749, |
5723 |
+- 0x2750, 0x2756, 0x2760, 0x2760, 0x300c, 0x300e, 0x301c, 0x301d, |
5724 |
+- 0x302a, 0x302a, 0x302c, 0x302d, 0x3030, 0x3031, 0x3034, 0x3036, |
5725 |
+- 0x303c, 0x303c, 0x305e, 0x305f, |
5726 |
++ 0x22ff, 0x22ff, 0x2340, 0x2343, 0x2440, 0x2440, 0x2444, 0x2444, |
5727 |
++ 0x2448, 0x244d, 0x2468, 0x2469, 0x246c, 0x246d, 0x2470, 0x2470, |
5728 |
++ 0x2472, 0x2472, 0x2474, 0x2475, 0x2479, 0x247a, 0x24c0, 0x24d3, |
5729 |
++ 0x24e4, 0x24ef, 0x2500, 0x2509, 0x250c, 0x250c, 0x250e, 0x250e, |
5730 |
++ 0x2510, 0x2511, 0x2514, 0x2515, 0x25e4, 0x25e4, 0x25ea, 0x25ea, |
5731 |
++ 0x25ec, 0x25ed, 0x25f0, 0x25f0, 0x2600, 0x2612, 0x2614, 0x2617, |
5732 |
++ 0x261a, 0x261a, 0x2640, 0x267e, 0x2680, 0x268b, 0x26c0, 0x26c0, |
5733 |
++ 0x26c4, 0x26ce, 0x26d0, 0x26d8, 0x26df, 0x26e6, 0x26e8, 0x26e9, |
5734 |
++ 0x26ec, 0x26ec, 0x26f0, 0x26f7, 0x26ff, 0x26ff, 0x2740, 0x2743, |
5735 |
++ 0x300c, 0x300e, 0x301c, 0x301d, 0x302a, 0x302a, 0x302c, 0x302d, |
5736 |
++ 0x3030, 0x3031, 0x3034, 0x3036, 0x303c, 0x303c, 0x305e, 0x305f, |
5737 |
+ ~0 /* sentinel */ |
5738 |
+ }; |
5739 |
+ |
5740 |
+diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c |
5741 |
+index 06be7cf7ce50..79bafea66354 100644 |
5742 |
+--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c |
5743 |
++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c |
5744 |
+@@ -310,7 +310,7 @@ static void dpu_hw_ctl_setup_blendstage(struct dpu_hw_ctl *ctx, |
5745 |
+ u32 mixercfg = 0, mixercfg_ext = 0, mix, ext; |
5746 |
+ u32 mixercfg_ext2 = 0, mixercfg_ext3 = 0; |
5747 |
+ int i, j; |
5748 |
+- u8 stages; |
5749 |
++ int stages; |
5750 |
+ int pipes_per_stage; |
5751 |
+ |
5752 |
+ stages = _mixer_stages(ctx->mixer_hw_caps, ctx->mixer_count, lm); |
5753 |
+diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_cfg.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_cfg.c |
5754 |
+index 824067d2d427..42f0ecb0cf35 100644 |
5755 |
+--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_cfg.c |
5756 |
++++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_cfg.c |
5757 |
+@@ -635,7 +635,7 @@ fail: |
5758 |
+ if (cfg_handler) |
5759 |
+ mdp5_cfg_destroy(cfg_handler); |
5760 |
+ |
5761 |
+- return NULL; |
5762 |
++ return ERR_PTR(ret); |
5763 |
+ } |
5764 |
+ |
5765 |
+ static struct mdp5_cfg_platform *mdp5_get_config(struct platform_device *dev) |
5766 |
+diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c |
5767 |
+index cc4ea5502d6c..3b78bca0bb4d 100644 |
5768 |
+--- a/drivers/gpu/drm/msm/dsi/dsi_host.c |
5769 |
++++ b/drivers/gpu/drm/msm/dsi/dsi_host.c |
5770 |
+@@ -34,6 +34,8 @@ |
5771 |
+ #include "dsi_cfg.h" |
5772 |
+ #include "msm_kms.h" |
5773 |
+ |
5774 |
++#define DSI_RESET_TOGGLE_DELAY_MS 20 |
5775 |
++ |
5776 |
+ static int dsi_get_version(const void __iomem *base, u32 *major, u32 *minor) |
5777 |
+ { |
5778 |
+ u32 ver; |
5779 |
+@@ -994,7 +996,7 @@ static void dsi_sw_reset(struct msm_dsi_host *msm_host) |
5780 |
+ wmb(); /* clocks need to be enabled before reset */ |
5781 |
+ |
5782 |
+ dsi_write(msm_host, REG_DSI_RESET, 1); |
5783 |
+- wmb(); /* make sure reset happen */ |
5784 |
++ msleep(DSI_RESET_TOGGLE_DELAY_MS); /* make sure reset happen */ |
5785 |
+ dsi_write(msm_host, REG_DSI_RESET, 0); |
5786 |
+ } |
5787 |
+ |
5788 |
+@@ -1402,7 +1404,7 @@ static void dsi_sw_reset_restore(struct msm_dsi_host *msm_host) |
5789 |
+ |
5790 |
+ /* dsi controller can only be reset while clocks are running */ |
5791 |
+ dsi_write(msm_host, REG_DSI_RESET, 1); |
5792 |
+- wmb(); /* make sure reset happen */ |
5793 |
++ msleep(DSI_RESET_TOGGLE_DELAY_MS); /* make sure reset happen */ |
5794 |
+ dsi_write(msm_host, REG_DSI_RESET, 0); |
5795 |
+ wmb(); /* controller out of reset */ |
5796 |
+ dsi_write(msm_host, REG_DSI_CTRL, data0); |
5797 |
+diff --git a/drivers/gpu/drm/nouveau/nouveau_abi16.c b/drivers/gpu/drm/nouveau/nouveau_abi16.c |
5798 |
+index e67a471331b5..6ec745873bc5 100644 |
5799 |
+--- a/drivers/gpu/drm/nouveau/nouveau_abi16.c |
5800 |
++++ b/drivers/gpu/drm/nouveau/nouveau_abi16.c |
5801 |
+@@ -214,6 +214,7 @@ nouveau_abi16_ioctl_getparam(ABI16_IOCTL_ARGS) |
5802 |
+ WARN_ON(1); |
5803 |
+ break; |
5804 |
+ } |
5805 |
++ break; |
5806 |
+ case NOUVEAU_GETPARAM_FB_SIZE: |
5807 |
+ getparam->value = drm->gem.vram_available; |
5808 |
+ break; |
5809 |
+diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gddr3.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gddr3.c |
5810 |
+index 60ece0a8a2e1..1d2d6bae73cd 100644 |
5811 |
+--- a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gddr3.c |
5812 |
++++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gddr3.c |
5813 |
+@@ -87,7 +87,7 @@ nvkm_gddr3_calc(struct nvkm_ram *ram) |
5814 |
+ WR = (ram->next->bios.timing[2] & 0x007f0000) >> 16; |
5815 |
+ /* XXX: Get these values from the VBIOS instead */ |
5816 |
+ DLL = !(ram->mr[1] & 0x1); |
5817 |
+- RON = !(ram->mr[1] & 0x300) >> 8; |
5818 |
++ RON = !((ram->mr[1] & 0x300) >> 8); |
5819 |
+ break; |
5820 |
+ default: |
5821 |
+ return -ENOSYS; |
5822 |
+diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/memx.c b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/memx.c |
5823 |
+index 11b28b086a06..7b052879af72 100644 |
5824 |
+--- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/memx.c |
5825 |
++++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/memx.c |
5826 |
+@@ -88,10 +88,10 @@ nvkm_memx_fini(struct nvkm_memx **pmemx, bool exec) |
5827 |
+ if (exec) { |
5828 |
+ nvkm_pmu_send(pmu, reply, PROC_MEMX, MEMX_MSG_EXEC, |
5829 |
+ memx->base, finish); |
5830 |
++ nvkm_debug(subdev, "Exec took %uns, PMU_IN %08x\n", |
5831 |
++ reply[0], reply[1]); |
5832 |
+ } |
5833 |
+ |
5834 |
+- nvkm_debug(subdev, "Exec took %uns, PMU_IN %08x\n", |
5835 |
+- reply[0], reply[1]); |
5836 |
+ kfree(memx); |
5837 |
+ return 0; |
5838 |
+ } |
5839 |
+diff --git a/drivers/gpu/drm/panel/panel-lvds.c b/drivers/gpu/drm/panel/panel-lvds.c |
5840 |
+index 8a1687887ae9..bd704a36c5d0 100644 |
5841 |
+--- a/drivers/gpu/drm/panel/panel-lvds.c |
5842 |
++++ b/drivers/gpu/drm/panel/panel-lvds.c |
5843 |
+@@ -199,7 +199,6 @@ static int panel_lvds_parse_dt(struct panel_lvds *lvds) |
5844 |
+ static int panel_lvds_probe(struct platform_device *pdev) |
5845 |
+ { |
5846 |
+ struct panel_lvds *lvds; |
5847 |
+- struct device_node *np; |
5848 |
+ int ret; |
5849 |
+ |
5850 |
+ lvds = devm_kzalloc(&pdev->dev, sizeof(*lvds), GFP_KERNEL); |
5851 |
+@@ -245,14 +244,9 @@ static int panel_lvds_probe(struct platform_device *pdev) |
5852 |
+ return ret; |
5853 |
+ } |
5854 |
+ |
5855 |
+- np = of_parse_phandle(lvds->dev->of_node, "backlight", 0); |
5856 |
+- if (np) { |
5857 |
+- lvds->backlight = of_find_backlight_by_node(np); |
5858 |
+- of_node_put(np); |
5859 |
+- |
5860 |
+- if (!lvds->backlight) |
5861 |
+- return -EPROBE_DEFER; |
5862 |
+- } |
5863 |
++ lvds->backlight = devm_of_find_backlight(lvds->dev); |
5864 |
++ if (IS_ERR(lvds->backlight)) |
5865 |
++ return PTR_ERR(lvds->backlight); |
5866 |
+ |
5867 |
+ /* |
5868 |
+ * TODO: Handle all power supplies specified in the DT node in a generic |
5869 |
+@@ -268,14 +262,10 @@ static int panel_lvds_probe(struct platform_device *pdev) |
5870 |
+ |
5871 |
+ ret = drm_panel_add(&lvds->panel); |
5872 |
+ if (ret < 0) |
5873 |
+- goto error; |
5874 |
++ return ret; |
5875 |
+ |
5876 |
+ dev_set_drvdata(lvds->dev, lvds); |
5877 |
+ return 0; |
5878 |
+- |
5879 |
+-error: |
5880 |
+- put_device(&lvds->backlight->dev); |
5881 |
+- return ret; |
5882 |
+ } |
5883 |
+ |
5884 |
+ static int panel_lvds_remove(struct platform_device *pdev) |
5885 |
+@@ -286,9 +276,6 @@ static int panel_lvds_remove(struct platform_device *pdev) |
5886 |
+ |
5887 |
+ panel_lvds_disable(&lvds->panel); |
5888 |
+ |
5889 |
+- if (lvds->backlight) |
5890 |
+- put_device(&lvds->backlight->dev); |
5891 |
+- |
5892 |
+ return 0; |
5893 |
+ } |
5894 |
+ |
5895 |
+diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c |
5896 |
+index ebce4601a305..827d551962d9 100644 |
5897 |
+--- a/drivers/gpu/drm/radeon/cik.c |
5898 |
++++ b/drivers/gpu/drm/radeon/cik.c |
5899 |
+@@ -6965,8 +6965,8 @@ static int cik_irq_init(struct radeon_device *rdev) |
5900 |
+ } |
5901 |
+ |
5902 |
+ /* setup interrupt control */ |
5903 |
+- /* XXX this should actually be a bus address, not an MC address. same on older asics */ |
5904 |
+- WREG32(INTERRUPT_CNTL2, rdev->ih.gpu_addr >> 8); |
5905 |
++ /* set dummy read address to dummy page address */ |
5906 |
++ WREG32(INTERRUPT_CNTL2, rdev->dummy_page.addr >> 8); |
5907 |
+ interrupt_cntl = RREG32(INTERRUPT_CNTL); |
5908 |
+ /* IH_DUMMY_RD_OVERRIDE=0 - dummy read disabled with msi, enabled without msi |
5909 |
+ * IH_DUMMY_RD_OVERRIDE=1 - dummy read controlled by IH_DUMMY_RD_EN |
5910 |
+diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c |
5911 |
+index e06e2d8feab3..a724bb87cfad 100644 |
5912 |
+--- a/drivers/gpu/drm/radeon/r600.c |
5913 |
++++ b/drivers/gpu/drm/radeon/r600.c |
5914 |
+@@ -3690,8 +3690,8 @@ int r600_irq_init(struct radeon_device *rdev) |
5915 |
+ } |
5916 |
+ |
5917 |
+ /* setup interrupt control */ |
5918 |
+- /* set dummy read address to ring address */ |
5919 |
+- WREG32(INTERRUPT_CNTL2, rdev->ih.gpu_addr >> 8); |
5920 |
++ /* set dummy read address to dummy page address */ |
5921 |
++ WREG32(INTERRUPT_CNTL2, rdev->dummy_page.addr >> 8); |
5922 |
+ interrupt_cntl = RREG32(INTERRUPT_CNTL); |
5923 |
+ /* IH_DUMMY_RD_OVERRIDE=0 - dummy read disabled with msi, enabled without msi |
5924 |
+ * IH_DUMMY_RD_OVERRIDE=1 - dummy read controlled by IH_DUMMY_RD_EN |
5925 |
+diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c |
5926 |
+index 85c604d29235..639f0698f961 100644 |
5927 |
+--- a/drivers/gpu/drm/radeon/si.c |
5928 |
++++ b/drivers/gpu/drm/radeon/si.c |
5929 |
+@@ -5993,8 +5993,8 @@ static int si_irq_init(struct radeon_device *rdev) |
5930 |
+ } |
5931 |
+ |
5932 |
+ /* setup interrupt control */ |
5933 |
+- /* set dummy read address to ring address */ |
5934 |
+- WREG32(INTERRUPT_CNTL2, rdev->ih.gpu_addr >> 8); |
5935 |
++ /* set dummy read address to dummy page address */ |
5936 |
++ WREG32(INTERRUPT_CNTL2, rdev->dummy_page.addr >> 8); |
5937 |
+ interrupt_cntl = RREG32(INTERRUPT_CNTL); |
5938 |
+ /* IH_DUMMY_RD_OVERRIDE=0 - dummy read disabled with msi, enabled without msi |
5939 |
+ * IH_DUMMY_RD_OVERRIDE=1 - dummy read controlled by IH_DUMMY_RD_EN |
5940 |
+diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c |
5941 |
+index 15dc9caa128b..212e5e11e4b7 100644 |
5942 |
+--- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c |
5943 |
++++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c |
5944 |
+@@ -837,7 +837,7 @@ unlock: |
5945 |
+ drm_modeset_drop_locks(&ctx); |
5946 |
+ drm_modeset_acquire_fini(&ctx); |
5947 |
+ |
5948 |
+- return 0; |
5949 |
++ return ret; |
5950 |
+ } |
5951 |
+ |
5952 |
+ static const struct drm_crtc_funcs crtc_funcs_gen2 = { |
5953 |
+diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c |
5954 |
+index 0386b454e221..6a9578159c2b 100644 |
5955 |
+--- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c |
5956 |
++++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c |
5957 |
+@@ -544,7 +544,7 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu) |
5958 |
+ * Initialize vertical blanking interrupts handling. Start with vblank |
5959 |
+ * disabled for all CRTCs. |
5960 |
+ */ |
5961 |
+- ret = drm_vblank_init(dev, (1 << rcdu->num_crtcs) - 1); |
5962 |
++ ret = drm_vblank_init(dev, rcdu->num_crtcs); |
5963 |
+ if (ret < 0) |
5964 |
+ return ret; |
5965 |
+ |
5966 |
+diff --git a/drivers/gpu/drm/rcar-du/rcar_lvds.c b/drivers/gpu/drm/rcar-du/rcar_lvds.c |
5967 |
+index 4c39de3f4f0f..b6dc91cdff68 100644 |
5968 |
+--- a/drivers/gpu/drm/rcar-du/rcar_lvds.c |
5969 |
++++ b/drivers/gpu/drm/rcar-du/rcar_lvds.c |
5970 |
+@@ -59,11 +59,11 @@ struct rcar_lvds { |
5971 |
+ enum rcar_lvds_mode mode; |
5972 |
+ }; |
5973 |
+ |
5974 |
+-#define bridge_to_rcar_lvds(bridge) \ |
5975 |
+- container_of(bridge, struct rcar_lvds, bridge) |
5976 |
++#define bridge_to_rcar_lvds(b) \ |
5977 |
++ container_of(b, struct rcar_lvds, bridge) |
5978 |
+ |
5979 |
+-#define connector_to_rcar_lvds(connector) \ |
5980 |
+- container_of(connector, struct rcar_lvds, connector) |
5981 |
++#define connector_to_rcar_lvds(c) \ |
5982 |
++ container_of(c, struct rcar_lvds, connector) |
5983 |
+ |
5984 |
+ static void rcar_lvds_write(struct rcar_lvds *lvds, u32 reg, u32 data) |
5985 |
+ { |
5986 |
+diff --git a/drivers/gpu/drm/shmobile/shmob_drm_drv.c b/drivers/gpu/drm/shmobile/shmob_drm_drv.c |
5987 |
+index 592572554eb0..58d8a98c749b 100644 |
5988 |
+--- a/drivers/gpu/drm/shmobile/shmob_drm_drv.c |
5989 |
++++ b/drivers/gpu/drm/shmobile/shmob_drm_drv.c |
5990 |
+@@ -233,8 +233,8 @@ static int shmob_drm_probe(struct platform_device *pdev) |
5991 |
+ |
5992 |
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
5993 |
+ sdev->mmio = devm_ioremap_resource(&pdev->dev, res); |
5994 |
+- if (sdev->mmio == NULL) |
5995 |
+- return -ENOMEM; |
5996 |
++ if (IS_ERR(sdev->mmio)) |
5997 |
++ return PTR_ERR(sdev->mmio); |
5998 |
+ |
5999 |
+ ret = shmob_drm_setup_clocks(sdev, pdata->clk_source); |
6000 |
+ if (ret < 0) |
6001 |
+diff --git a/drivers/gpu/drm/sti/sti_hda.c b/drivers/gpu/drm/sti/sti_hda.c |
6002 |
+index 49438337f70d..19b9b5ed1297 100644 |
6003 |
+--- a/drivers/gpu/drm/sti/sti_hda.c |
6004 |
++++ b/drivers/gpu/drm/sti/sti_hda.c |
6005 |
+@@ -721,7 +721,6 @@ static int sti_hda_bind(struct device *dev, struct device *master, void *data) |
6006 |
+ return 0; |
6007 |
+ |
6008 |
+ err_sysfs: |
6009 |
+- drm_bridge_remove(bridge); |
6010 |
+ return -EINVAL; |
6011 |
+ } |
6012 |
+ |
6013 |
+diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c |
6014 |
+index 34cdc4644435..ccf718404a1c 100644 |
6015 |
+--- a/drivers/gpu/drm/sti/sti_hdmi.c |
6016 |
++++ b/drivers/gpu/drm/sti/sti_hdmi.c |
6017 |
+@@ -1315,7 +1315,6 @@ static int sti_hdmi_bind(struct device *dev, struct device *master, void *data) |
6018 |
+ return 0; |
6019 |
+ |
6020 |
+ err_sysfs: |
6021 |
+- drm_bridge_remove(bridge); |
6022 |
+ hdmi->drm_connector = NULL; |
6023 |
+ return -EINVAL; |
6024 |
+ } |
6025 |
+diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c |
6026 |
+index 3ecffa52c814..a74adec6c5dc 100644 |
6027 |
+--- a/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c |
6028 |
++++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c |
6029 |
+@@ -52,7 +52,7 @@ static unsigned long sun4i_tmds_calc_divider(unsigned long rate, |
6030 |
+ (rate - tmp_rate) < (rate - best_rate)) { |
6031 |
+ best_rate = tmp_rate; |
6032 |
+ best_m = m; |
6033 |
+- is_double = d; |
6034 |
++ is_double = (d == 2) ? true : false; |
6035 |
+ } |
6036 |
+ } |
6037 |
+ } |
6038 |
+diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c b/drivers/gpu/drm/virtio/virtgpu_vq.c |
6039 |
+index c8a581b1f4c4..608906f06ced 100644 |
6040 |
+--- a/drivers/gpu/drm/virtio/virtgpu_vq.c |
6041 |
++++ b/drivers/gpu/drm/virtio/virtgpu_vq.c |
6042 |
+@@ -650,11 +650,11 @@ int virtio_gpu_cmd_get_capset(struct virtio_gpu_device *vgdev, |
6043 |
+ { |
6044 |
+ struct virtio_gpu_get_capset *cmd_p; |
6045 |
+ struct virtio_gpu_vbuffer *vbuf; |
6046 |
+- int max_size = vgdev->capsets[idx].max_size; |
6047 |
++ int max_size; |
6048 |
+ struct virtio_gpu_drv_cap_cache *cache_ent; |
6049 |
+ void *resp_buf; |
6050 |
+ |
6051 |
+- if (idx > vgdev->num_capsets) |
6052 |
++ if (idx >= vgdev->num_capsets) |
6053 |
+ return -EINVAL; |
6054 |
+ |
6055 |
+ if (version > vgdev->capsets[idx].max_version) |
6056 |
+@@ -664,6 +664,7 @@ int virtio_gpu_cmd_get_capset(struct virtio_gpu_device *vgdev, |
6057 |
+ if (!cache_ent) |
6058 |
+ return -ENOMEM; |
6059 |
+ |
6060 |
++ max_size = vgdev->capsets[idx].max_size; |
6061 |
+ cache_ent->caps_cache = kmalloc(max_size, GFP_KERNEL); |
6062 |
+ if (!cache_ent->caps_cache) { |
6063 |
+ kfree(cache_ent); |
6064 |
+diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c |
6065 |
+index e7e4655d3f36..ce1ad7cd7899 100644 |
6066 |
+--- a/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c |
6067 |
++++ b/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c |
6068 |
+@@ -511,17 +511,14 @@ static void vmw_cmdbuf_work_func(struct work_struct *work) |
6069 |
+ container_of(work, struct vmw_cmdbuf_man, work); |
6070 |
+ struct vmw_cmdbuf_header *entry, *next; |
6071 |
+ uint32_t dummy; |
6072 |
+- bool restart[SVGA_CB_CONTEXT_MAX]; |
6073 |
+ bool send_fence = false; |
6074 |
+ struct list_head restart_head[SVGA_CB_CONTEXT_MAX]; |
6075 |
+ int i; |
6076 |
+ struct vmw_cmdbuf_context *ctx; |
6077 |
+ bool global_block = false; |
6078 |
+ |
6079 |
+- for_each_cmdbuf_ctx(man, i, ctx) { |
6080 |
++ for_each_cmdbuf_ctx(man, i, ctx) |
6081 |
+ INIT_LIST_HEAD(&restart_head[i]); |
6082 |
+- restart[i] = false; |
6083 |
+- } |
6084 |
+ |
6085 |
+ mutex_lock(&man->error_mutex); |
6086 |
+ spin_lock(&man->lock); |
6087 |
+@@ -533,7 +530,6 @@ static void vmw_cmdbuf_work_func(struct work_struct *work) |
6088 |
+ const char *cmd_name; |
6089 |
+ |
6090 |
+ list_del_init(&entry->list); |
6091 |
+- restart[entry->cb_context] = true; |
6092 |
+ global_block = true; |
6093 |
+ |
6094 |
+ if (!vmw_cmd_describe(header, &error_cmd_size, &cmd_name)) { |
6095 |
+diff --git a/drivers/gpu/drm/xen/xen_drm_front_gem.c b/drivers/gpu/drm/xen/xen_drm_front_gem.c |
6096 |
+index c85bfe7571cb..802662839e7e 100644 |
6097 |
+--- a/drivers/gpu/drm/xen/xen_drm_front_gem.c |
6098 |
++++ b/drivers/gpu/drm/xen/xen_drm_front_gem.c |
6099 |
+@@ -236,8 +236,14 @@ static int gem_mmap_obj(struct xen_gem_object *xen_obj, |
6100 |
+ vma->vm_flags &= ~VM_PFNMAP; |
6101 |
+ vma->vm_flags |= VM_MIXEDMAP; |
6102 |
+ vma->vm_pgoff = 0; |
6103 |
+- vma->vm_page_prot = |
6104 |
+- pgprot_writecombine(vm_get_page_prot(vma->vm_flags)); |
6105 |
++ /* |
6106 |
++ * According to Xen on ARM ABI (xen/include/public/arch-arm.h): |
6107 |
++ * all memory which is shared with other entities in the system |
6108 |
++ * (including the hypervisor and other guests) must reside in memory |
6109 |
++ * which is mapped as Normal Inner Write-Back Outer Write-Back |
6110 |
++ * Inner-Shareable. |
6111 |
++ */ |
6112 |
++ vma->vm_page_prot = vm_get_page_prot(vma->vm_flags); |
6113 |
+ |
6114 |
+ /* |
6115 |
+ * vm_operations_struct.fault handler will be called if CPU access |
6116 |
+@@ -283,8 +289,9 @@ void *xen_drm_front_gem_prime_vmap(struct drm_gem_object *gem_obj) |
6117 |
+ if (!xen_obj->pages) |
6118 |
+ return NULL; |
6119 |
+ |
6120 |
++ /* Please see comment in gem_mmap_obj on mapping and attributes. */ |
6121 |
+ return vmap(xen_obj->pages, xen_obj->num_pages, |
6122 |
+- VM_MAP, pgprot_writecombine(PAGE_KERNEL)); |
6123 |
++ VM_MAP, PAGE_KERNEL); |
6124 |
+ } |
6125 |
+ |
6126 |
+ void xen_drm_front_gem_prime_vunmap(struct drm_gem_object *gem_obj, |
6127 |
+diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c |
6128 |
+index 49f4b33a5685..7f28912c9abc 100644 |
6129 |
+--- a/drivers/hwmon/lm75.c |
6130 |
++++ b/drivers/hwmon/lm75.c |
6131 |
+@@ -165,7 +165,7 @@ static int lm75_write(struct device *dev, enum hwmon_sensor_types type, |
6132 |
+ temp = DIV_ROUND_CLOSEST(temp << (resolution - 8), |
6133 |
+ 1000) << (16 - resolution); |
6134 |
+ |
6135 |
+- return regmap_write(data->regmap, reg, temp); |
6136 |
++ return regmap_write(data->regmap, reg, (u16)temp); |
6137 |
+ } |
6138 |
+ |
6139 |
+ static umode_t lm75_is_visible(const void *data, enum hwmon_sensor_types type, |
6140 |
+diff --git a/drivers/hwmon/pmbus/tps53679.c b/drivers/hwmon/pmbus/tps53679.c |
6141 |
+index 85b515cd9df0..2bc352c5357f 100644 |
6142 |
+--- a/drivers/hwmon/pmbus/tps53679.c |
6143 |
++++ b/drivers/hwmon/pmbus/tps53679.c |
6144 |
+@@ -80,7 +80,14 @@ static struct pmbus_driver_info tps53679_info = { |
6145 |
+ static int tps53679_probe(struct i2c_client *client, |
6146 |
+ const struct i2c_device_id *id) |
6147 |
+ { |
6148 |
+- return pmbus_do_probe(client, id, &tps53679_info); |
6149 |
++ struct pmbus_driver_info *info; |
6150 |
++ |
6151 |
++ info = devm_kmemdup(&client->dev, &tps53679_info, sizeof(*info), |
6152 |
++ GFP_KERNEL); |
6153 |
++ if (!info) |
6154 |
++ return -ENOMEM; |
6155 |
++ |
6156 |
++ return pmbus_do_probe(client, id, info); |
6157 |
+ } |
6158 |
+ |
6159 |
+ static const struct i2c_device_id tps53679_id[] = { |
6160 |
+diff --git a/drivers/hwmon/shtc1.c b/drivers/hwmon/shtc1.c |
6161 |
+index decd7df995ab..2a18539591ea 100644 |
6162 |
+--- a/drivers/hwmon/shtc1.c |
6163 |
++++ b/drivers/hwmon/shtc1.c |
6164 |
+@@ -38,7 +38,7 @@ static const unsigned char shtc1_cmd_read_id_reg[] = { 0xef, 0xc8 }; |
6165 |
+ |
6166 |
+ /* constants for reading the ID register */ |
6167 |
+ #define SHTC1_ID 0x07 |
6168 |
+-#define SHTC1_ID_REG_MASK 0x1f |
6169 |
++#define SHTC1_ID_REG_MASK 0x3f |
6170 |
+ |
6171 |
+ /* delays for non-blocking i2c commands, both in us */ |
6172 |
+ #define SHTC1_NONBLOCKING_WAIT_TIME_HPM 14400 |
6173 |
+diff --git a/drivers/hwmon/w83627hf.c b/drivers/hwmon/w83627hf.c |
6174 |
+index 8ac89d0781cc..a575e1cdb81a 100644 |
6175 |
+--- a/drivers/hwmon/w83627hf.c |
6176 |
++++ b/drivers/hwmon/w83627hf.c |
6177 |
+@@ -130,17 +130,23 @@ superio_select(struct w83627hf_sio_data *sio, int ld) |
6178 |
+ outb(ld, sio->sioaddr + 1); |
6179 |
+ } |
6180 |
+ |
6181 |
+-static inline void |
6182 |
++static inline int |
6183 |
+ superio_enter(struct w83627hf_sio_data *sio) |
6184 |
+ { |
6185 |
++ if (!request_muxed_region(sio->sioaddr, 2, DRVNAME)) |
6186 |
++ return -EBUSY; |
6187 |
++ |
6188 |
+ outb(0x87, sio->sioaddr); |
6189 |
+ outb(0x87, sio->sioaddr); |
6190 |
++ |
6191 |
++ return 0; |
6192 |
+ } |
6193 |
+ |
6194 |
+ static inline void |
6195 |
+ superio_exit(struct w83627hf_sio_data *sio) |
6196 |
+ { |
6197 |
+ outb(0xAA, sio->sioaddr); |
6198 |
++ release_region(sio->sioaddr, 2); |
6199 |
+ } |
6200 |
+ |
6201 |
+ #define W627_DEVID 0x52 |
6202 |
+@@ -1278,7 +1284,7 @@ static DEVICE_ATTR_RO(name); |
6203 |
+ static int __init w83627hf_find(int sioaddr, unsigned short *addr, |
6204 |
+ struct w83627hf_sio_data *sio_data) |
6205 |
+ { |
6206 |
+- int err = -ENODEV; |
6207 |
++ int err; |
6208 |
+ u16 val; |
6209 |
+ |
6210 |
+ static __initconst char *const names[] = { |
6211 |
+@@ -1290,7 +1296,11 @@ static int __init w83627hf_find(int sioaddr, unsigned short *addr, |
6212 |
+ }; |
6213 |
+ |
6214 |
+ sio_data->sioaddr = sioaddr; |
6215 |
+- superio_enter(sio_data); |
6216 |
++ err = superio_enter(sio_data); |
6217 |
++ if (err) |
6218 |
++ return err; |
6219 |
++ |
6220 |
++ err = -ENODEV; |
6221 |
+ val = force_id ? force_id : superio_inb(sio_data, DEVID); |
6222 |
+ switch (val) { |
6223 |
+ case W627_DEVID: |
6224 |
+@@ -1644,9 +1654,21 @@ static int w83627thf_read_gpio5(struct platform_device *pdev) |
6225 |
+ struct w83627hf_sio_data *sio_data = dev_get_platdata(&pdev->dev); |
6226 |
+ int res = 0xff, sel; |
6227 |
+ |
6228 |
+- superio_enter(sio_data); |
6229 |
++ if (superio_enter(sio_data)) { |
6230 |
++ /* |
6231 |
++ * Some other driver reserved the address space for itself. |
6232 |
++ * We don't want to fail driver instantiation because of that, |
6233 |
++ * so display a warning and keep going. |
6234 |
++ */ |
6235 |
++ dev_warn(&pdev->dev, |
6236 |
++ "Can not read VID data: Failed to enable SuperIO access\n"); |
6237 |
++ return res; |
6238 |
++ } |
6239 |
++ |
6240 |
+ superio_select(sio_data, W83627HF_LD_GPIO5); |
6241 |
+ |
6242 |
++ res = 0xff; |
6243 |
++ |
6244 |
+ /* Make sure these GPIO pins are enabled */ |
6245 |
+ if (!(superio_inb(sio_data, W83627THF_GPIO5_EN) & (1<<3))) { |
6246 |
+ dev_dbg(&pdev->dev, "GPIO5 disabled, no VID function\n"); |
6247 |
+@@ -1677,7 +1699,17 @@ static int w83687thf_read_vid(struct platform_device *pdev) |
6248 |
+ struct w83627hf_sio_data *sio_data = dev_get_platdata(&pdev->dev); |
6249 |
+ int res = 0xff; |
6250 |
+ |
6251 |
+- superio_enter(sio_data); |
6252 |
++ if (superio_enter(sio_data)) { |
6253 |
++ /* |
6254 |
++ * Some other driver reserved the address space for itself. |
6255 |
++ * We don't want to fail driver instantiation because of that, |
6256 |
++ * so display a warning and keep going. |
6257 |
++ */ |
6258 |
++ dev_warn(&pdev->dev, |
6259 |
++ "Can not read VID data: Failed to enable SuperIO access\n"); |
6260 |
++ return res; |
6261 |
++ } |
6262 |
++ |
6263 |
+ superio_select(sio_data, W83627HF_LD_HWM); |
6264 |
+ |
6265 |
+ /* Make sure these GPIO pins are enabled */ |
6266 |
+diff --git a/drivers/hwtracing/coresight/coresight-catu.h b/drivers/hwtracing/coresight/coresight-catu.h |
6267 |
+index 1b281f0dcccc..1d2ad183fd92 100644 |
6268 |
+--- a/drivers/hwtracing/coresight/coresight-catu.h |
6269 |
++++ b/drivers/hwtracing/coresight/coresight-catu.h |
6270 |
+@@ -109,11 +109,6 @@ static inline bool coresight_is_catu_device(struct coresight_device *csdev) |
6271 |
+ return true; |
6272 |
+ } |
6273 |
+ |
6274 |
+-#ifdef CONFIG_CORESIGHT_CATU |
6275 |
+ extern const struct etr_buf_operations etr_catu_buf_ops; |
6276 |
+-#else |
6277 |
+-/* Dummy declaration for the CATU ops */ |
6278 |
+-static const struct etr_buf_operations etr_catu_buf_ops; |
6279 |
+-#endif |
6280 |
+ |
6281 |
+ #endif |
6282 |
+diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwtracing/coresight/coresight-etm-perf.c |
6283 |
+index c3c645201514..567f46ca2599 100644 |
6284 |
+--- a/drivers/hwtracing/coresight/coresight-etm-perf.c |
6285 |
++++ b/drivers/hwtracing/coresight/coresight-etm-perf.c |
6286 |
+@@ -437,15 +437,16 @@ static int etm_addr_filters_validate(struct list_head *filters) |
6287 |
+ static void etm_addr_filters_sync(struct perf_event *event) |
6288 |
+ { |
6289 |
+ struct perf_addr_filters_head *head = perf_event_addr_filters(event); |
6290 |
+- unsigned long start, stop, *offs = event->addr_filters_offs; |
6291 |
++ unsigned long start, stop; |
6292 |
++ struct perf_addr_filter_range *fr = event->addr_filter_ranges; |
6293 |
+ struct etm_filters *filters = event->hw.addr_filters; |
6294 |
+ struct etm_filter *etm_filter; |
6295 |
+ struct perf_addr_filter *filter; |
6296 |
+ int i = 0; |
6297 |
+ |
6298 |
+ list_for_each_entry(filter, &head->list, entry) { |
6299 |
+- start = filter->offset + offs[i]; |
6300 |
+- stop = start + filter->size; |
6301 |
++ start = fr[i].start; |
6302 |
++ stop = start + fr[i].size; |
6303 |
+ etm_filter = &filters->etm_filter[i]; |
6304 |
+ |
6305 |
+ switch (filter->action) { |
6306 |
+diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c |
6307 |
+index 2d6f428176ff..3b684687b5a7 100644 |
6308 |
+--- a/drivers/hwtracing/coresight/coresight-tmc-etr.c |
6309 |
++++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c |
6310 |
+@@ -747,7 +747,8 @@ static inline void tmc_etr_disable_catu(struct tmc_drvdata *drvdata) |
6311 |
+ static const struct etr_buf_operations *etr_buf_ops[] = { |
6312 |
+ [ETR_MODE_FLAT] = &etr_flat_buf_ops, |
6313 |
+ [ETR_MODE_ETR_SG] = &etr_sg_buf_ops, |
6314 |
+- [ETR_MODE_CATU] = &etr_catu_buf_ops, |
6315 |
++ [ETR_MODE_CATU] = IS_ENABLED(CONFIG_CORESIGHT_CATU) |
6316 |
++ ? &etr_catu_buf_ops : NULL, |
6317 |
+ }; |
6318 |
+ |
6319 |
+ static inline int tmc_etr_mode_alloc_buf(int mode, |
6320 |
+@@ -761,7 +762,7 @@ static inline int tmc_etr_mode_alloc_buf(int mode, |
6321 |
+ case ETR_MODE_FLAT: |
6322 |
+ case ETR_MODE_ETR_SG: |
6323 |
+ case ETR_MODE_CATU: |
6324 |
+- if (etr_buf_ops[mode]->alloc) |
6325 |
++ if (etr_buf_ops[mode] && etr_buf_ops[mode]->alloc) |
6326 |
+ rc = etr_buf_ops[mode]->alloc(drvdata, etr_buf, |
6327 |
+ node, pages); |
6328 |
+ if (!rc) |
6329 |
+diff --git a/drivers/i2c/busses/i2c-stm32.c b/drivers/i2c/busses/i2c-stm32.c |
6330 |
+index d75fbcbf02ef..667f8032f8ef 100644 |
6331 |
+--- a/drivers/i2c/busses/i2c-stm32.c |
6332 |
++++ b/drivers/i2c/busses/i2c-stm32.c |
6333 |
+@@ -21,13 +21,13 @@ struct stm32_i2c_dma *stm32_i2c_dma_request(struct device *dev, |
6334 |
+ |
6335 |
+ dma = devm_kzalloc(dev, sizeof(*dma), GFP_KERNEL); |
6336 |
+ if (!dma) |
6337 |
+- return NULL; |
6338 |
++ return ERR_PTR(-ENOMEM); |
6339 |
+ |
6340 |
+ /* Request and configure I2C TX dma channel */ |
6341 |
+- dma->chan_tx = dma_request_slave_channel(dev, "tx"); |
6342 |
+- if (!dma->chan_tx) { |
6343 |
++ dma->chan_tx = dma_request_chan(dev, "tx"); |
6344 |
++ if (IS_ERR(dma->chan_tx)) { |
6345 |
+ dev_dbg(dev, "can't request DMA tx channel\n"); |
6346 |
+- ret = -EINVAL; |
6347 |
++ ret = PTR_ERR(dma->chan_tx); |
6348 |
+ goto fail_al; |
6349 |
+ } |
6350 |
+ |
6351 |
+@@ -43,10 +43,10 @@ struct stm32_i2c_dma *stm32_i2c_dma_request(struct device *dev, |
6352 |
+ } |
6353 |
+ |
6354 |
+ /* Request and configure I2C RX dma channel */ |
6355 |
+- dma->chan_rx = dma_request_slave_channel(dev, "rx"); |
6356 |
+- if (!dma->chan_rx) { |
6357 |
++ dma->chan_rx = dma_request_chan(dev, "rx"); |
6358 |
++ if (IS_ERR(dma->chan_rx)) { |
6359 |
+ dev_err(dev, "can't request DMA rx channel\n"); |
6360 |
+- ret = -EINVAL; |
6361 |
++ ret = PTR_ERR(dma->chan_rx); |
6362 |
+ goto fail_tx; |
6363 |
+ } |
6364 |
+ |
6365 |
+@@ -76,7 +76,7 @@ fail_al: |
6366 |
+ devm_kfree(dev, dma); |
6367 |
+ dev_info(dev, "can't use DMA\n"); |
6368 |
+ |
6369 |
+- return NULL; |
6370 |
++ return ERR_PTR(ret); |
6371 |
+ } |
6372 |
+ |
6373 |
+ void stm32_i2c_dma_free(struct stm32_i2c_dma *dma) |
6374 |
+diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm32f7.c |
6375 |
+index f4e3613f9361..eb7e533b0dd4 100644 |
6376 |
+--- a/drivers/i2c/busses/i2c-stm32f7.c |
6377 |
++++ b/drivers/i2c/busses/i2c-stm32f7.c |
6378 |
+@@ -1252,8 +1252,8 @@ static int stm32f7_i2c_get_free_slave_id(struct stm32f7_i2c_dev *i2c_dev, |
6379 |
+ * slave[0] supports 7-bit and 10-bit slave address |
6380 |
+ * slave[1] supports 7-bit slave address only |
6381 |
+ */ |
6382 |
+- for (i = 0; i < STM32F7_I2C_MAX_SLAVE; i++) { |
6383 |
+- if (i == 1 && (slave->flags & I2C_CLIENT_PEC)) |
6384 |
++ for (i = STM32F7_I2C_MAX_SLAVE - 1; i >= 0; i--) { |
6385 |
++ if (i == 1 && (slave->flags & I2C_CLIENT_TEN)) |
6386 |
+ continue; |
6387 |
+ if (!i2c_dev->slave[i]) { |
6388 |
+ *id = i; |
6389 |
+@@ -1914,6 +1914,15 @@ static int stm32f7_i2c_probe(struct platform_device *pdev) |
6390 |
+ i2c_dev->dma = stm32_i2c_dma_request(i2c_dev->dev, phy_addr, |
6391 |
+ STM32F7_I2C_TXDR, |
6392 |
+ STM32F7_I2C_RXDR); |
6393 |
++ if (PTR_ERR(i2c_dev->dma) == -ENODEV) |
6394 |
++ i2c_dev->dma = NULL; |
6395 |
++ else if (IS_ERR(i2c_dev->dma)) { |
6396 |
++ ret = PTR_ERR(i2c_dev->dma); |
6397 |
++ if (ret != -EPROBE_DEFER) |
6398 |
++ dev_err(&pdev->dev, |
6399 |
++ "Failed to request dma error %i\n", ret); |
6400 |
++ goto clk_free; |
6401 |
++ } |
6402 |
+ |
6403 |
+ ret = i2c_add_adapter(adap); |
6404 |
+ if (ret) |
6405 |
+diff --git a/drivers/iio/dac/ad5380.c b/drivers/iio/dac/ad5380.c |
6406 |
+index 873c2bf637c0..617c9f7fe59a 100644 |
6407 |
+--- a/drivers/iio/dac/ad5380.c |
6408 |
++++ b/drivers/iio/dac/ad5380.c |
6409 |
+@@ -221,7 +221,7 @@ static int ad5380_read_raw(struct iio_dev *indio_dev, |
6410 |
+ if (ret) |
6411 |
+ return ret; |
6412 |
+ *val >>= chan->scan_type.shift; |
6413 |
+- val -= (1 << chan->scan_type.realbits) / 2; |
6414 |
++ *val -= (1 << chan->scan_type.realbits) / 2; |
6415 |
+ return IIO_VAL_INT; |
6416 |
+ case IIO_CHAN_INFO_SCALE: |
6417 |
+ *val = 2 * st->vref; |
6418 |
+diff --git a/drivers/iio/light/tsl2772.c b/drivers/iio/light/tsl2772.c |
6419 |
+index df5b2a0da96c..f2e308c6d6d7 100644 |
6420 |
+--- a/drivers/iio/light/tsl2772.c |
6421 |
++++ b/drivers/iio/light/tsl2772.c |
6422 |
+@@ -716,6 +716,13 @@ static int tsl2772_chip_off(struct iio_dev *indio_dev) |
6423 |
+ return tsl2772_write_control_reg(chip, 0x00); |
6424 |
+ } |
6425 |
+ |
6426 |
++static void tsl2772_chip_off_action(void *data) |
6427 |
++{ |
6428 |
++ struct iio_dev *indio_dev = data; |
6429 |
++ |
6430 |
++ tsl2772_chip_off(indio_dev); |
6431 |
++} |
6432 |
++ |
6433 |
+ /** |
6434 |
+ * tsl2772_invoke_change - power cycle the device to implement the user |
6435 |
+ * parameters |
6436 |
+@@ -1711,9 +1718,14 @@ static int tsl2772_probe(struct i2c_client *clientp, |
6437 |
+ if (ret < 0) |
6438 |
+ return ret; |
6439 |
+ |
6440 |
++ ret = devm_add_action_or_reset(&clientp->dev, |
6441 |
++ tsl2772_chip_off_action, |
6442 |
++ indio_dev); |
6443 |
++ if (ret < 0) |
6444 |
++ return ret; |
6445 |
++ |
6446 |
+ ret = iio_device_register(indio_dev); |
6447 |
+ if (ret) { |
6448 |
+- tsl2772_chip_off(indio_dev); |
6449 |
+ dev_err(&clientp->dev, |
6450 |
+ "%s: iio registration failed\n", __func__); |
6451 |
+ return ret; |
6452 |
+@@ -1740,8 +1752,6 @@ static int tsl2772_remove(struct i2c_client *client) |
6453 |
+ { |
6454 |
+ struct iio_dev *indio_dev = i2c_get_clientdata(client); |
6455 |
+ |
6456 |
+- tsl2772_chip_off(indio_dev); |
6457 |
+- |
6458 |
+ iio_device_unregister(indio_dev); |
6459 |
+ |
6460 |
+ return 0; |
6461 |
+diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c |
6462 |
+index 319bfef00a4a..e16872e0724f 100644 |
6463 |
+--- a/drivers/infiniband/core/cma.c |
6464 |
++++ b/drivers/infiniband/core/cma.c |
6465 |
+@@ -2889,7 +2889,7 @@ static void addr_handler(int status, struct sockaddr *src_addr, |
6466 |
+ if (status) |
6467 |
+ pr_debug_ratelimited("RDMA CM: ADDR_ERROR: failed to acquire device. status %d\n", |
6468 |
+ status); |
6469 |
+- } else { |
6470 |
++ } else if (status) { |
6471 |
+ pr_debug_ratelimited("RDMA CM: ADDR_ERROR: failed to resolve IP. status %d\n", status); |
6472 |
+ } |
6473 |
+ |
6474 |
+diff --git a/drivers/infiniband/core/uverbs_uapi.c b/drivers/infiniband/core/uverbs_uapi.c |
6475 |
+index be854628a7c6..959a3418a192 100644 |
6476 |
+--- a/drivers/infiniband/core/uverbs_uapi.c |
6477 |
++++ b/drivers/infiniband/core/uverbs_uapi.c |
6478 |
+@@ -17,6 +17,8 @@ static void *uapi_add_elm(struct uverbs_api *uapi, u32 key, size_t alloc_size) |
6479 |
+ return ERR_PTR(-EOVERFLOW); |
6480 |
+ |
6481 |
+ elm = kzalloc(alloc_size, GFP_KERNEL); |
6482 |
++ if (!elm) |
6483 |
++ return ERR_PTR(-ENOMEM); |
6484 |
+ rc = radix_tree_insert(&uapi->radix, key, elm); |
6485 |
+ if (rc) { |
6486 |
+ kfree(elm); |
6487 |
+diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c |
6488 |
+index a69632f1fab0..c9af2d139f5c 100644 |
6489 |
+--- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c |
6490 |
++++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c |
6491 |
+@@ -2664,6 +2664,7 @@ struct ib_cq *bnxt_re_create_cq(struct ib_device *ibdev, |
6492 |
+ nq->budget++; |
6493 |
+ |
6494 |
+ atomic_inc(&rdev->cq_count); |
6495 |
++ spin_lock_init(&cq->cq_lock); |
6496 |
+ |
6497 |
+ if (context) { |
6498 |
+ struct bnxt_re_cq_resp resp; |
6499 |
+diff --git a/drivers/infiniband/hw/bnxt_re/qplib_fp.c b/drivers/infiniband/hw/bnxt_re/qplib_fp.c |
6500 |
+index c15335dc8f61..60f2fb7e7dbf 100644 |
6501 |
+--- a/drivers/infiniband/hw/bnxt_re/qplib_fp.c |
6502 |
++++ b/drivers/infiniband/hw/bnxt_re/qplib_fp.c |
6503 |
+@@ -1970,6 +1970,7 @@ int bnxt_qplib_create_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq) |
6504 |
+ INIT_LIST_HEAD(&cq->sqf_head); |
6505 |
+ INIT_LIST_HEAD(&cq->rqf_head); |
6506 |
+ spin_lock_init(&cq->compl_lock); |
6507 |
++ spin_lock_init(&cq->flush_lock); |
6508 |
+ |
6509 |
+ bnxt_qplib_arm_cq_enable(cq); |
6510 |
+ return 0; |
6511 |
+diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c |
6512 |
+index 4dcc92d11609..16145b0a1458 100644 |
6513 |
+--- a/drivers/infiniband/hw/cxgb4/cm.c |
6514 |
++++ b/drivers/infiniband/hw/cxgb4/cm.c |
6515 |
+@@ -2076,7 +2076,7 @@ static int import_ep(struct c4iw_ep *ep, int iptype, __u8 *peer_ip, |
6516 |
+ } else { |
6517 |
+ pdev = get_real_dev(n->dev); |
6518 |
+ ep->l2t = cxgb4_l2t_get(cdev->rdev.lldi.l2t, |
6519 |
+- n, pdev, 0); |
6520 |
++ n, pdev, rt_tos2priority(tos)); |
6521 |
+ if (!ep->l2t) |
6522 |
+ goto out; |
6523 |
+ ep->mtu = dst_mtu(dst); |
6524 |
+@@ -2166,7 +2166,8 @@ static int c4iw_reconnect(struct c4iw_ep *ep) |
6525 |
+ laddr6->sin6_addr.s6_addr, |
6526 |
+ raddr6->sin6_addr.s6_addr, |
6527 |
+ laddr6->sin6_port, |
6528 |
+- raddr6->sin6_port, 0, |
6529 |
++ raddr6->sin6_port, |
6530 |
++ ep->com.cm_id->tos, |
6531 |
+ raddr6->sin6_scope_id); |
6532 |
+ iptype = 6; |
6533 |
+ ra = (__u8 *)&raddr6->sin6_addr; |
6534 |
+@@ -2947,15 +2948,18 @@ static int terminate(struct c4iw_dev *dev, struct sk_buff *skb) |
6535 |
+ |
6536 |
+ ep = get_ep_from_tid(dev, tid); |
6537 |
+ |
6538 |
+- if (ep && ep->com.qp) { |
6539 |
+- pr_warn("TERM received tid %u qpid %u\n", |
6540 |
+- tid, ep->com.qp->wq.sq.qid); |
6541 |
+- attrs.next_state = C4IW_QP_STATE_TERMINATE; |
6542 |
+- c4iw_modify_qp(ep->com.qp->rhp, ep->com.qp, |
6543 |
+- C4IW_QP_ATTR_NEXT_STATE, &attrs, 1); |
6544 |
++ if (ep) { |
6545 |
++ if (ep->com.qp) { |
6546 |
++ pr_warn("TERM received tid %u qpid %u\n", tid, |
6547 |
++ ep->com.qp->wq.sq.qid); |
6548 |
++ attrs.next_state = C4IW_QP_STATE_TERMINATE; |
6549 |
++ c4iw_modify_qp(ep->com.qp->rhp, ep->com.qp, |
6550 |
++ C4IW_QP_ATTR_NEXT_STATE, &attrs, 1); |
6551 |
++ } |
6552 |
++ |
6553 |
++ c4iw_put_ep(&ep->com); |
6554 |
+ } else |
6555 |
+ pr_warn("TERM received tid %u no ep/qp\n", tid); |
6556 |
+- c4iw_put_ep(&ep->com); |
6557 |
+ |
6558 |
+ return 0; |
6559 |
+ } |
6560 |
+@@ -3323,7 +3327,7 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) |
6561 |
+ laddr6->sin6_addr.s6_addr, |
6562 |
+ raddr6->sin6_addr.s6_addr, |
6563 |
+ laddr6->sin6_port, |
6564 |
+- raddr6->sin6_port, 0, |
6565 |
++ raddr6->sin6_port, cm_id->tos, |
6566 |
+ raddr6->sin6_scope_id); |
6567 |
+ } |
6568 |
+ if (!ep->dst) { |
6569 |
+diff --git a/drivers/infiniband/hw/hfi1/chip.c b/drivers/infiniband/hw/hfi1/chip.c |
6570 |
+index 6b8935361133..b09a4b1cf397 100644 |
6571 |
+--- a/drivers/infiniband/hw/hfi1/chip.c |
6572 |
++++ b/drivers/infiniband/hw/hfi1/chip.c |
6573 |
+@@ -10580,12 +10580,29 @@ void set_link_down_reason(struct hfi1_pportdata *ppd, u8 lcl_reason, |
6574 |
+ } |
6575 |
+ } |
6576 |
+ |
6577 |
+-/* |
6578 |
+- * Verify if BCT for data VLs is non-zero. |
6579 |
++/** |
6580 |
++ * data_vls_operational() - Verify if data VL BCT credits and MTU |
6581 |
++ * are both set. |
6582 |
++ * @ppd: pointer to hfi1_pportdata structure |
6583 |
++ * |
6584 |
++ * Return: true - Ok, false -otherwise. |
6585 |
+ */ |
6586 |
+ static inline bool data_vls_operational(struct hfi1_pportdata *ppd) |
6587 |
+ { |
6588 |
+- return !!ppd->actual_vls_operational; |
6589 |
++ int i; |
6590 |
++ u64 reg; |
6591 |
++ |
6592 |
++ if (!ppd->actual_vls_operational) |
6593 |
++ return false; |
6594 |
++ |
6595 |
++ for (i = 0; i < ppd->vls_supported; i++) { |
6596 |
++ reg = read_csr(ppd->dd, SEND_CM_CREDIT_VL + (8 * i)); |
6597 |
++ if ((reg && !ppd->dd->vld[i].mtu) || |
6598 |
++ (!reg && ppd->dd->vld[i].mtu)) |
6599 |
++ return false; |
6600 |
++ } |
6601 |
++ |
6602 |
++ return true; |
6603 |
+ } |
6604 |
+ |
6605 |
+ /* |
6606 |
+@@ -10698,7 +10715,8 @@ int set_link_state(struct hfi1_pportdata *ppd, u32 state) |
6607 |
+ |
6608 |
+ if (!data_vls_operational(ppd)) { |
6609 |
+ dd_dev_err(dd, |
6610 |
+- "%s: data VLs not operational\n", __func__); |
6611 |
++ "%s: Invalid data VL credits or mtu\n", |
6612 |
++ __func__); |
6613 |
+ ret = -EINVAL; |
6614 |
+ break; |
6615 |
+ } |
6616 |
+diff --git a/drivers/infiniband/hw/hfi1/driver.c b/drivers/infiniband/hw/hfi1/driver.c |
6617 |
+index a41f85558312..d5277c23cba6 100644 |
6618 |
+--- a/drivers/infiniband/hw/hfi1/driver.c |
6619 |
++++ b/drivers/infiniband/hw/hfi1/driver.c |
6620 |
+@@ -430,40 +430,60 @@ static const hfi1_handle_cnp hfi1_handle_cnp_tbl[2] = { |
6621 |
+ [HFI1_PKT_TYPE_16B] = &return_cnp_16B |
6622 |
+ }; |
6623 |
+ |
6624 |
+-void hfi1_process_ecn_slowpath(struct rvt_qp *qp, struct hfi1_packet *pkt, |
6625 |
+- bool do_cnp) |
6626 |
++/** |
6627 |
++ * hfi1_process_ecn_slowpath - Process FECN or BECN bits |
6628 |
++ * @qp: The packet's destination QP |
6629 |
++ * @pkt: The packet itself. |
6630 |
++ * @prescan: Is the caller the RXQ prescan |
6631 |
++ * |
6632 |
++ * Process the packet's FECN or BECN bits. By now, the packet |
6633 |
++ * has already been evaluated whether processing of those bit should |
6634 |
++ * be done. |
6635 |
++ * The significance of the @prescan argument is that if the caller |
6636 |
++ * is the RXQ prescan, a CNP will be send out instead of waiting for the |
6637 |
++ * normal packet processing to send an ACK with BECN set (or a CNP). |
6638 |
++ */ |
6639 |
++bool hfi1_process_ecn_slowpath(struct rvt_qp *qp, struct hfi1_packet *pkt, |
6640 |
++ bool prescan) |
6641 |
+ { |
6642 |
+ struct hfi1_ibport *ibp = to_iport(qp->ibqp.device, qp->port_num); |
6643 |
+ struct hfi1_pportdata *ppd = ppd_from_ibp(ibp); |
6644 |
+ struct ib_other_headers *ohdr = pkt->ohdr; |
6645 |
+ struct ib_grh *grh = pkt->grh; |
6646 |
+- u32 rqpn = 0, bth1; |
6647 |
++ u32 rqpn = 0; |
6648 |
+ u16 pkey; |
6649 |
+ u32 rlid, slid, dlid = 0; |
6650 |
+- u8 hdr_type, sc, svc_type; |
6651 |
+- bool is_mcast = false; |
6652 |
++ u8 hdr_type, sc, svc_type, opcode; |
6653 |
++ bool is_mcast = false, ignore_fecn = false, do_cnp = false, |
6654 |
++ fecn, becn; |
6655 |
+ |
6656 |
+ /* can be called from prescan */ |
6657 |
+ if (pkt->etype == RHF_RCV_TYPE_BYPASS) { |
6658 |
+- is_mcast = hfi1_is_16B_mcast(dlid); |
6659 |
+ pkey = hfi1_16B_get_pkey(pkt->hdr); |
6660 |
+ sc = hfi1_16B_get_sc(pkt->hdr); |
6661 |
+ dlid = hfi1_16B_get_dlid(pkt->hdr); |
6662 |
+ slid = hfi1_16B_get_slid(pkt->hdr); |
6663 |
++ is_mcast = hfi1_is_16B_mcast(dlid); |
6664 |
++ opcode = ib_bth_get_opcode(ohdr); |
6665 |
+ hdr_type = HFI1_PKT_TYPE_16B; |
6666 |
++ fecn = hfi1_16B_get_fecn(pkt->hdr); |
6667 |
++ becn = hfi1_16B_get_becn(pkt->hdr); |
6668 |
+ } else { |
6669 |
+- is_mcast = (dlid > be16_to_cpu(IB_MULTICAST_LID_BASE)) && |
6670 |
+- (dlid != be16_to_cpu(IB_LID_PERMISSIVE)); |
6671 |
+ pkey = ib_bth_get_pkey(ohdr); |
6672 |
+ sc = hfi1_9B_get_sc5(pkt->hdr, pkt->rhf); |
6673 |
+- dlid = ib_get_dlid(pkt->hdr); |
6674 |
++ dlid = qp->ibqp.qp_type != IB_QPT_UD ? ib_get_dlid(pkt->hdr) : |
6675 |
++ ppd->lid; |
6676 |
+ slid = ib_get_slid(pkt->hdr); |
6677 |
++ is_mcast = (dlid > be16_to_cpu(IB_MULTICAST_LID_BASE)) && |
6678 |
++ (dlid != be16_to_cpu(IB_LID_PERMISSIVE)); |
6679 |
++ opcode = ib_bth_get_opcode(ohdr); |
6680 |
+ hdr_type = HFI1_PKT_TYPE_9B; |
6681 |
++ fecn = ib_bth_get_fecn(ohdr); |
6682 |
++ becn = ib_bth_get_becn(ohdr); |
6683 |
+ } |
6684 |
+ |
6685 |
+ switch (qp->ibqp.qp_type) { |
6686 |
+ case IB_QPT_UD: |
6687 |
+- dlid = ppd->lid; |
6688 |
+ rlid = slid; |
6689 |
+ rqpn = ib_get_sqpn(pkt->ohdr); |
6690 |
+ svc_type = IB_CC_SVCTYPE_UD; |
6691 |
+@@ -485,22 +505,31 @@ void hfi1_process_ecn_slowpath(struct rvt_qp *qp, struct hfi1_packet *pkt, |
6692 |
+ svc_type = IB_CC_SVCTYPE_RC; |
6693 |
+ break; |
6694 |
+ default: |
6695 |
+- return; |
6696 |
++ return false; |
6697 |
+ } |
6698 |
+ |
6699 |
+- bth1 = be32_to_cpu(ohdr->bth[1]); |
6700 |
++ ignore_fecn = is_mcast || (opcode == IB_OPCODE_CNP) || |
6701 |
++ (opcode == IB_OPCODE_RC_ACKNOWLEDGE); |
6702 |
++ /* |
6703 |
++ * ACKNOWLEDGE packets do not get a CNP but this will be |
6704 |
++ * guarded by ignore_fecn above. |
6705 |
++ */ |
6706 |
++ do_cnp = prescan || |
6707 |
++ (opcode >= IB_OPCODE_RC_RDMA_READ_RESPONSE_FIRST && |
6708 |
++ opcode <= IB_OPCODE_RC_ATOMIC_ACKNOWLEDGE); |
6709 |
++ |
6710 |
+ /* Call appropriate CNP handler */ |
6711 |
+- if (do_cnp && (bth1 & IB_FECN_SMASK)) |
6712 |
++ if (!ignore_fecn && do_cnp && fecn) |
6713 |
+ hfi1_handle_cnp_tbl[hdr_type](ibp, qp, rqpn, pkey, |
6714 |
+ dlid, rlid, sc, grh); |
6715 |
+ |
6716 |
+- if (!is_mcast && (bth1 & IB_BECN_SMASK)) { |
6717 |
+- u32 lqpn = bth1 & RVT_QPN_MASK; |
6718 |
++ if (becn) { |
6719 |
++ u32 lqpn = be32_to_cpu(ohdr->bth[1]) & RVT_QPN_MASK; |
6720 |
+ u8 sl = ibp->sc_to_sl[sc]; |
6721 |
+ |
6722 |
+ process_becn(ppd, sl, rlid, lqpn, rqpn, svc_type); |
6723 |
+ } |
6724 |
+- |
6725 |
++ return !ignore_fecn && fecn; |
6726 |
+ } |
6727 |
+ |
6728 |
+ struct ps_mdata { |
6729 |
+@@ -599,7 +628,6 @@ static void __prescan_rxq(struct hfi1_packet *packet) |
6730 |
+ struct rvt_dev_info *rdi = &rcd->dd->verbs_dev.rdi; |
6731 |
+ u64 rhf = rhf_to_cpu(rhf_addr); |
6732 |
+ u32 etype = rhf_rcv_type(rhf), qpn, bth1; |
6733 |
+- int is_ecn = 0; |
6734 |
+ u8 lnh; |
6735 |
+ |
6736 |
+ if (ps_done(&mdata, rhf, rcd)) |
6737 |
+@@ -625,12 +653,10 @@ static void __prescan_rxq(struct hfi1_packet *packet) |
6738 |
+ goto next; /* just in case */ |
6739 |
+ } |
6740 |
+ |
6741 |
+- bth1 = be32_to_cpu(packet->ohdr->bth[1]); |
6742 |
+- is_ecn = !!(bth1 & (IB_FECN_SMASK | IB_BECN_SMASK)); |
6743 |
+- |
6744 |
+- if (!is_ecn) |
6745 |
++ if (!hfi1_may_ecn(packet)) |
6746 |
+ goto next; |
6747 |
+ |
6748 |
++ bth1 = be32_to_cpu(packet->ohdr->bth[1]); |
6749 |
+ qpn = bth1 & RVT_QPN_MASK; |
6750 |
+ rcu_read_lock(); |
6751 |
+ qp = rvt_lookup_qpn(rdi, &ibp->rvp, qpn); |
6752 |
+@@ -640,7 +666,7 @@ static void __prescan_rxq(struct hfi1_packet *packet) |
6753 |
+ goto next; |
6754 |
+ } |
6755 |
+ |
6756 |
+- process_ecn(qp, packet, true); |
6757 |
++ hfi1_process_ecn_slowpath(qp, packet, true); |
6758 |
+ rcu_read_unlock(); |
6759 |
+ |
6760 |
+ /* turn off BECN, FECN */ |
6761 |
+diff --git a/drivers/infiniband/hw/hfi1/hfi.h b/drivers/infiniband/hw/hfi1/hfi.h |
6762 |
+index 2ea42c04cfd2..232fc4b59a98 100644 |
6763 |
+--- a/drivers/infiniband/hw/hfi1/hfi.h |
6764 |
++++ b/drivers/infiniband/hw/hfi1/hfi.h |
6765 |
+@@ -1797,13 +1797,20 @@ static inline struct hfi1_ibport *rcd_to_iport(struct hfi1_ctxtdata *rcd) |
6766 |
+ return &rcd->ppd->ibport_data; |
6767 |
+ } |
6768 |
+ |
6769 |
+-void hfi1_process_ecn_slowpath(struct rvt_qp *qp, struct hfi1_packet *pkt, |
6770 |
+- bool do_cnp); |
6771 |
+-static inline bool process_ecn(struct rvt_qp *qp, struct hfi1_packet *pkt, |
6772 |
+- bool do_cnp) |
6773 |
++/** |
6774 |
++ * hfi1_may_ecn - Check whether FECN or BECN processing should be done |
6775 |
++ * @pkt: the packet to be evaluated |
6776 |
++ * |
6777 |
++ * Check whether the FECN or BECN bits in the packet's header are |
6778 |
++ * enabled, depending on packet type. |
6779 |
++ * |
6780 |
++ * This function only checks for FECN and BECN bits. Additional checks |
6781 |
++ * are done in the slowpath (hfi1_process_ecn_slowpath()) in order to |
6782 |
++ * ensure correct handling. |
6783 |
++ */ |
6784 |
++static inline bool hfi1_may_ecn(struct hfi1_packet *pkt) |
6785 |
+ { |
6786 |
+- bool becn; |
6787 |
+- bool fecn; |
6788 |
++ bool fecn, becn; |
6789 |
+ |
6790 |
+ if (pkt->etype == RHF_RCV_TYPE_BYPASS) { |
6791 |
+ fecn = hfi1_16B_get_fecn(pkt->hdr); |
6792 |
+@@ -1812,10 +1819,18 @@ static inline bool process_ecn(struct rvt_qp *qp, struct hfi1_packet *pkt, |
6793 |
+ fecn = ib_bth_get_fecn(pkt->ohdr); |
6794 |
+ becn = ib_bth_get_becn(pkt->ohdr); |
6795 |
+ } |
6796 |
+- if (unlikely(fecn || becn)) { |
6797 |
+- hfi1_process_ecn_slowpath(qp, pkt, do_cnp); |
6798 |
+- return fecn; |
6799 |
+- } |
6800 |
++ return fecn || becn; |
6801 |
++} |
6802 |
++ |
6803 |
++bool hfi1_process_ecn_slowpath(struct rvt_qp *qp, struct hfi1_packet *pkt, |
6804 |
++ bool prescan); |
6805 |
++static inline bool process_ecn(struct rvt_qp *qp, struct hfi1_packet *pkt) |
6806 |
++{ |
6807 |
++ bool do_work; |
6808 |
++ |
6809 |
++ do_work = hfi1_may_ecn(pkt); |
6810 |
++ if (unlikely(do_work)) |
6811 |
++ return hfi1_process_ecn_slowpath(qp, pkt, false); |
6812 |
+ return false; |
6813 |
+ } |
6814 |
+ |
6815 |
+diff --git a/drivers/infiniband/hw/hfi1/pio.c b/drivers/infiniband/hw/hfi1/pio.c |
6816 |
+index 752057647f09..3fcbf56f8be2 100644 |
6817 |
+--- a/drivers/infiniband/hw/hfi1/pio.c |
6818 |
++++ b/drivers/infiniband/hw/hfi1/pio.c |
6819 |
+@@ -1434,7 +1434,8 @@ void sc_stop(struct send_context *sc, int flag) |
6820 |
+ * @cb: optional callback to call when the buffer is finished sending |
6821 |
+ * @arg: argument for cb |
6822 |
+ * |
6823 |
+- * Return a pointer to a PIO buffer if successful, NULL if not enough room. |
6824 |
++ * Return a pointer to a PIO buffer, NULL if not enough room, -ECOMM |
6825 |
++ * when link is down. |
6826 |
+ */ |
6827 |
+ struct pio_buf *sc_buffer_alloc(struct send_context *sc, u32 dw_len, |
6828 |
+ pio_release_cb cb, void *arg) |
6829 |
+@@ -1450,7 +1451,7 @@ struct pio_buf *sc_buffer_alloc(struct send_context *sc, u32 dw_len, |
6830 |
+ spin_lock_irqsave(&sc->alloc_lock, flags); |
6831 |
+ if (!(sc->flags & SCF_ENABLED)) { |
6832 |
+ spin_unlock_irqrestore(&sc->alloc_lock, flags); |
6833 |
+- goto done; |
6834 |
++ return ERR_PTR(-ECOMM); |
6835 |
+ } |
6836 |
+ |
6837 |
+ retry: |
6838 |
+diff --git a/drivers/infiniband/hw/hfi1/rc.c b/drivers/infiniband/hw/hfi1/rc.c |
6839 |
+index 770c78c65730..7ed6fb407a68 100644 |
6840 |
+--- a/drivers/infiniband/hw/hfi1/rc.c |
6841 |
++++ b/drivers/infiniband/hw/hfi1/rc.c |
6842 |
+@@ -914,7 +914,7 @@ void hfi1_send_rc_ack(struct hfi1_packet *packet, bool is_fecn) |
6843 |
+ pbc = create_pbc(ppd, pbc_flags, qp->srate_mbps, |
6844 |
+ sc_to_vlt(ppd->dd, sc5), plen); |
6845 |
+ pbuf = sc_buffer_alloc(rcd->sc, plen, NULL, NULL); |
6846 |
+- if (!pbuf) { |
6847 |
++ if (IS_ERR_OR_NULL(pbuf)) { |
6848 |
+ /* |
6849 |
+ * We have no room to send at the moment. Pass |
6850 |
+ * responsibility for sending the ACK to the send engine |
6851 |
+@@ -2049,8 +2049,7 @@ void hfi1_rc_rcv(struct hfi1_packet *packet) |
6852 |
+ struct ib_reth *reth; |
6853 |
+ unsigned long flags; |
6854 |
+ int ret; |
6855 |
+- bool is_fecn = false; |
6856 |
+- bool copy_last = false; |
6857 |
++ bool copy_last = false, fecn; |
6858 |
+ u32 rkey; |
6859 |
+ u8 extra_bytes = pad + packet->extra_byte + (SIZE_OF_CRC << 2); |
6860 |
+ |
6861 |
+@@ -2059,7 +2058,7 @@ void hfi1_rc_rcv(struct hfi1_packet *packet) |
6862 |
+ if (hfi1_ruc_check_hdr(ibp, packet)) |
6863 |
+ return; |
6864 |
+ |
6865 |
+- is_fecn = process_ecn(qp, packet, false); |
6866 |
++ fecn = process_ecn(qp, packet); |
6867 |
+ |
6868 |
+ /* |
6869 |
+ * Process responses (ACKs) before anything else. Note that the |
6870 |
+@@ -2070,8 +2069,6 @@ void hfi1_rc_rcv(struct hfi1_packet *packet) |
6871 |
+ if (opcode >= OP(RDMA_READ_RESPONSE_FIRST) && |
6872 |
+ opcode <= OP(ATOMIC_ACKNOWLEDGE)) { |
6873 |
+ rc_rcv_resp(packet); |
6874 |
+- if (is_fecn) |
6875 |
+- goto send_ack; |
6876 |
+ return; |
6877 |
+ } |
6878 |
+ |
6879 |
+@@ -2347,11 +2344,11 @@ send_last: |
6880 |
+ |
6881 |
+ /* Schedule the send engine. */ |
6882 |
+ qp->s_flags |= RVT_S_RESP_PENDING; |
6883 |
++ if (fecn) |
6884 |
++ qp->s_flags |= RVT_S_ECN; |
6885 |
+ hfi1_schedule_send(qp); |
6886 |
+ |
6887 |
+ spin_unlock_irqrestore(&qp->s_lock, flags); |
6888 |
+- if (is_fecn) |
6889 |
+- goto send_ack; |
6890 |
+ return; |
6891 |
+ } |
6892 |
+ |
6893 |
+@@ -2413,11 +2410,11 @@ send_last: |
6894 |
+ |
6895 |
+ /* Schedule the send engine. */ |
6896 |
+ qp->s_flags |= RVT_S_RESP_PENDING; |
6897 |
++ if (fecn) |
6898 |
++ qp->s_flags |= RVT_S_ECN; |
6899 |
+ hfi1_schedule_send(qp); |
6900 |
+ |
6901 |
+ spin_unlock_irqrestore(&qp->s_lock, flags); |
6902 |
+- if (is_fecn) |
6903 |
+- goto send_ack; |
6904 |
+ return; |
6905 |
+ } |
6906 |
+ |
6907 |
+@@ -2430,16 +2427,9 @@ send_last: |
6908 |
+ qp->r_ack_psn = psn; |
6909 |
+ qp->r_nak_state = 0; |
6910 |
+ /* Send an ACK if requested or required. */ |
6911 |
+- if (psn & IB_BTH_REQ_ACK) { |
6912 |
+- if (packet->numpkt == 0) { |
6913 |
+- rc_cancel_ack(qp); |
6914 |
+- goto send_ack; |
6915 |
+- } |
6916 |
+- if (qp->r_adefered >= HFI1_PSN_CREDIT) { |
6917 |
+- rc_cancel_ack(qp); |
6918 |
+- goto send_ack; |
6919 |
+- } |
6920 |
+- if (unlikely(is_fecn)) { |
6921 |
++ if (psn & IB_BTH_REQ_ACK || fecn) { |
6922 |
++ if (packet->numpkt == 0 || fecn || |
6923 |
++ qp->r_adefered >= HFI1_PSN_CREDIT) { |
6924 |
+ rc_cancel_ack(qp); |
6925 |
+ goto send_ack; |
6926 |
+ } |
6927 |
+@@ -2480,7 +2470,7 @@ nack_acc: |
6928 |
+ qp->r_nak_state = IB_NAK_REMOTE_ACCESS_ERROR; |
6929 |
+ qp->r_ack_psn = qp->r_psn; |
6930 |
+ send_ack: |
6931 |
+- hfi1_send_rc_ack(packet, is_fecn); |
6932 |
++ hfi1_send_rc_ack(packet, fecn); |
6933 |
+ } |
6934 |
+ |
6935 |
+ void hfi1_rc_hdrerr( |
6936 |
+diff --git a/drivers/infiniband/hw/hfi1/uc.c b/drivers/infiniband/hw/hfi1/uc.c |
6937 |
+index e254dcec6f64..4121d1a93b1b 100644 |
6938 |
+--- a/drivers/infiniband/hw/hfi1/uc.c |
6939 |
++++ b/drivers/infiniband/hw/hfi1/uc.c |
6940 |
+@@ -321,7 +321,7 @@ void hfi1_uc_rcv(struct hfi1_packet *packet) |
6941 |
+ if (hfi1_ruc_check_hdr(ibp, packet)) |
6942 |
+ return; |
6943 |
+ |
6944 |
+- process_ecn(qp, packet, true); |
6945 |
++ process_ecn(qp, packet); |
6946 |
+ |
6947 |
+ psn = ib_bth_get_psn(ohdr); |
6948 |
+ /* Compare the PSN verses the expected PSN. */ |
6949 |
+diff --git a/drivers/infiniband/hw/hfi1/ud.c b/drivers/infiniband/hw/hfi1/ud.c |
6950 |
+index 54eb69564264..839593641e3f 100644 |
6951 |
+--- a/drivers/infiniband/hw/hfi1/ud.c |
6952 |
++++ b/drivers/infiniband/hw/hfi1/ud.c |
6953 |
+@@ -51,6 +51,7 @@ |
6954 |
+ #include "hfi.h" |
6955 |
+ #include "mad.h" |
6956 |
+ #include "verbs_txreq.h" |
6957 |
++#include "trace_ibhdrs.h" |
6958 |
+ #include "qp.h" |
6959 |
+ |
6960 |
+ /* We support only two types - 9B and 16B for now */ |
6961 |
+@@ -656,18 +657,19 @@ void return_cnp_16B(struct hfi1_ibport *ibp, struct rvt_qp *qp, |
6962 |
+ u32 bth0, plen, vl, hwords = 7; |
6963 |
+ u16 len; |
6964 |
+ u8 l4; |
6965 |
+- struct hfi1_16b_header hdr; |
6966 |
++ struct hfi1_opa_header hdr; |
6967 |
+ struct ib_other_headers *ohdr; |
6968 |
+ struct pio_buf *pbuf; |
6969 |
+ struct send_context *ctxt = qp_to_send_context(qp, sc5); |
6970 |
+ struct hfi1_pportdata *ppd = ppd_from_ibp(ibp); |
6971 |
+ u32 nwords; |
6972 |
+ |
6973 |
++ hdr.hdr_type = HFI1_PKT_TYPE_16B; |
6974 |
+ /* Populate length */ |
6975 |
+ nwords = ((hfi1_get_16b_padding(hwords << 2, 0) + |
6976 |
+ SIZE_OF_LT) >> 2) + SIZE_OF_CRC; |
6977 |
+ if (old_grh) { |
6978 |
+- struct ib_grh *grh = &hdr.u.l.grh; |
6979 |
++ struct ib_grh *grh = &hdr.opah.u.l.grh; |
6980 |
+ |
6981 |
+ grh->version_tclass_flow = old_grh->version_tclass_flow; |
6982 |
+ grh->paylen = cpu_to_be16( |
6983 |
+@@ -675,11 +677,11 @@ void return_cnp_16B(struct hfi1_ibport *ibp, struct rvt_qp *qp, |
6984 |
+ grh->hop_limit = 0xff; |
6985 |
+ grh->sgid = old_grh->dgid; |
6986 |
+ grh->dgid = old_grh->sgid; |
6987 |
+- ohdr = &hdr.u.l.oth; |
6988 |
++ ohdr = &hdr.opah.u.l.oth; |
6989 |
+ l4 = OPA_16B_L4_IB_GLOBAL; |
6990 |
+ hwords += sizeof(struct ib_grh) / sizeof(u32); |
6991 |
+ } else { |
6992 |
+- ohdr = &hdr.u.oth; |
6993 |
++ ohdr = &hdr.opah.u.oth; |
6994 |
+ l4 = OPA_16B_L4_IB_LOCAL; |
6995 |
+ } |
6996 |
+ |
6997 |
+@@ -693,7 +695,7 @@ void return_cnp_16B(struct hfi1_ibport *ibp, struct rvt_qp *qp, |
6998 |
+ |
6999 |
+ /* Convert dwords to flits */ |
7000 |
+ len = (hwords + nwords) >> 1; |
7001 |
+- hfi1_make_16b_hdr(&hdr, slid, dlid, len, pkey, 1, 0, l4, sc5); |
7002 |
++ hfi1_make_16b_hdr(&hdr.opah, slid, dlid, len, pkey, 1, 0, l4, sc5); |
7003 |
+ |
7004 |
+ plen = 2 /* PBC */ + hwords + nwords; |
7005 |
+ pbc_flags |= PBC_PACKET_BYPASS | PBC_INSERT_BYPASS_ICRC; |
7006 |
+@@ -701,9 +703,11 @@ void return_cnp_16B(struct hfi1_ibport *ibp, struct rvt_qp *qp, |
7007 |
+ pbc = create_pbc(ppd, pbc_flags, qp->srate_mbps, vl, plen); |
7008 |
+ if (ctxt) { |
7009 |
+ pbuf = sc_buffer_alloc(ctxt, plen, NULL, NULL); |
7010 |
+- if (pbuf) |
7011 |
++ if (!IS_ERR_OR_NULL(pbuf)) { |
7012 |
++ trace_pio_output_ibhdr(ppd->dd, &hdr, sc5); |
7013 |
+ ppd->dd->pio_inline_send(ppd->dd, pbuf, pbc, |
7014 |
+ &hdr, hwords); |
7015 |
++ } |
7016 |
+ } |
7017 |
+ } |
7018 |
+ |
7019 |
+@@ -715,14 +719,15 @@ void return_cnp(struct hfi1_ibport *ibp, struct rvt_qp *qp, u32 remote_qpn, |
7020 |
+ u32 bth0, plen, vl, hwords = 5; |
7021 |
+ u16 lrh0; |
7022 |
+ u8 sl = ibp->sc_to_sl[sc5]; |
7023 |
+- struct ib_header hdr; |
7024 |
++ struct hfi1_opa_header hdr; |
7025 |
+ struct ib_other_headers *ohdr; |
7026 |
+ struct pio_buf *pbuf; |
7027 |
+ struct send_context *ctxt = qp_to_send_context(qp, sc5); |
7028 |
+ struct hfi1_pportdata *ppd = ppd_from_ibp(ibp); |
7029 |
+ |
7030 |
++ hdr.hdr_type = HFI1_PKT_TYPE_9B; |
7031 |
+ if (old_grh) { |
7032 |
+- struct ib_grh *grh = &hdr.u.l.grh; |
7033 |
++ struct ib_grh *grh = &hdr.ibh.u.l.grh; |
7034 |
+ |
7035 |
+ grh->version_tclass_flow = old_grh->version_tclass_flow; |
7036 |
+ grh->paylen = cpu_to_be16( |
7037 |
+@@ -730,11 +735,11 @@ void return_cnp(struct hfi1_ibport *ibp, struct rvt_qp *qp, u32 remote_qpn, |
7038 |
+ grh->hop_limit = 0xff; |
7039 |
+ grh->sgid = old_grh->dgid; |
7040 |
+ grh->dgid = old_grh->sgid; |
7041 |
+- ohdr = &hdr.u.l.oth; |
7042 |
++ ohdr = &hdr.ibh.u.l.oth; |
7043 |
+ lrh0 = HFI1_LRH_GRH; |
7044 |
+ hwords += sizeof(struct ib_grh) / sizeof(u32); |
7045 |
+ } else { |
7046 |
+- ohdr = &hdr.u.oth; |
7047 |
++ ohdr = &hdr.ibh.u.oth; |
7048 |
+ lrh0 = HFI1_LRH_BTH; |
7049 |
+ } |
7050 |
+ |
7051 |
+@@ -746,16 +751,18 @@ void return_cnp(struct hfi1_ibport *ibp, struct rvt_qp *qp, u32 remote_qpn, |
7052 |
+ ohdr->bth[1] = cpu_to_be32(remote_qpn | (1 << IB_BECN_SHIFT)); |
7053 |
+ ohdr->bth[2] = 0; /* PSN 0 */ |
7054 |
+ |
7055 |
+- hfi1_make_ib_hdr(&hdr, lrh0, hwords + SIZE_OF_CRC, dlid, slid); |
7056 |
++ hfi1_make_ib_hdr(&hdr.ibh, lrh0, hwords + SIZE_OF_CRC, dlid, slid); |
7057 |
+ plen = 2 /* PBC */ + hwords; |
7058 |
+ pbc_flags |= (ib_is_sc5(sc5) << PBC_DC_INFO_SHIFT); |
7059 |
+ vl = sc_to_vlt(ppd->dd, sc5); |
7060 |
+ pbc = create_pbc(ppd, pbc_flags, qp->srate_mbps, vl, plen); |
7061 |
+ if (ctxt) { |
7062 |
+ pbuf = sc_buffer_alloc(ctxt, plen, NULL, NULL); |
7063 |
+- if (pbuf) |
7064 |
++ if (!IS_ERR_OR_NULL(pbuf)) { |
7065 |
++ trace_pio_output_ibhdr(ppd->dd, &hdr, sc5); |
7066 |
+ ppd->dd->pio_inline_send(ppd->dd, pbuf, pbc, |
7067 |
+ &hdr, hwords); |
7068 |
++ } |
7069 |
+ } |
7070 |
+ } |
7071 |
+ |
7072 |
+@@ -912,7 +919,7 @@ void hfi1_ud_rcv(struct hfi1_packet *packet) |
7073 |
+ src_qp = hfi1_16B_get_src_qpn(packet->mgmt); |
7074 |
+ } |
7075 |
+ |
7076 |
+- process_ecn(qp, packet, (opcode != IB_OPCODE_CNP)); |
7077 |
++ process_ecn(qp, packet); |
7078 |
+ /* |
7079 |
+ * Get the number of bytes the message was padded by |
7080 |
+ * and drop incomplete packets. |
7081 |
+diff --git a/drivers/infiniband/hw/hfi1/verbs.c b/drivers/infiniband/hw/hfi1/verbs.c |
7082 |
+index 4e7b3c027901..90e12f9433a3 100644 |
7083 |
+--- a/drivers/infiniband/hw/hfi1/verbs.c |
7084 |
++++ b/drivers/infiniband/hw/hfi1/verbs.c |
7085 |
+@@ -1096,10 +1096,10 @@ int hfi1_verbs_send_pio(struct rvt_qp *qp, struct hfi1_pkt_state *ps, |
7086 |
+ if (cb) |
7087 |
+ iowait_pio_inc(&priv->s_iowait); |
7088 |
+ pbuf = sc_buffer_alloc(sc, plen, cb, qp); |
7089 |
+- if (unlikely(!pbuf)) { |
7090 |
++ if (unlikely(IS_ERR_OR_NULL(pbuf))) { |
7091 |
+ if (cb) |
7092 |
+ verbs_pio_complete(qp, 0); |
7093 |
+- if (ppd->host_link_state != HLS_UP_ACTIVE) { |
7094 |
++ if (IS_ERR(pbuf)) { |
7095 |
+ /* |
7096 |
+ * If we have filled the PIO buffers to capacity and are |
7097 |
+ * not in an active state this request is not going to |
7098 |
+diff --git a/drivers/infiniband/hw/hns/hns_roce_hem.c b/drivers/infiniband/hw/hns/hns_roce_hem.c |
7099 |
+index a73d388b7093..31b9b99f81cb 100644 |
7100 |
+--- a/drivers/infiniband/hw/hns/hns_roce_hem.c |
7101 |
++++ b/drivers/infiniband/hw/hns/hns_roce_hem.c |
7102 |
+@@ -54,12 +54,13 @@ bool hns_roce_check_whether_mhop(struct hns_roce_dev *hr_dev, u32 type) |
7103 |
+ EXPORT_SYMBOL_GPL(hns_roce_check_whether_mhop); |
7104 |
+ |
7105 |
+ static bool hns_roce_check_hem_null(struct hns_roce_hem **hem, u64 start_idx, |
7106 |
+- u32 bt_chunk_num) |
7107 |
++ u32 bt_chunk_num, u64 hem_max_num) |
7108 |
+ { |
7109 |
+- int i; |
7110 |
++ u64 check_max_num = start_idx + bt_chunk_num; |
7111 |
++ u64 i; |
7112 |
+ |
7113 |
+- for (i = 0; i < bt_chunk_num; i++) |
7114 |
+- if (hem[start_idx + i]) |
7115 |
++ for (i = start_idx; (i < check_max_num) && (i < hem_max_num); i++) |
7116 |
++ if (hem[i]) |
7117 |
+ return false; |
7118 |
+ |
7119 |
+ return true; |
7120 |
+@@ -413,6 +414,12 @@ static int hns_roce_table_mhop_get(struct hns_roce_dev *hr_dev, |
7121 |
+ return -EINVAL; |
7122 |
+ } |
7123 |
+ |
7124 |
++ if (unlikely(hem_idx >= table->num_hem)) { |
7125 |
++ dev_err(dev, "Table %d exceed hem limt idx = %llu,max = %lu!\n", |
7126 |
++ table->type, hem_idx, table->num_hem); |
7127 |
++ return -EINVAL; |
7128 |
++ } |
7129 |
++ |
7130 |
+ mutex_lock(&table->mutex); |
7131 |
+ |
7132 |
+ if (table->hem[hem_idx]) { |
7133 |
+@@ -649,7 +656,7 @@ static void hns_roce_table_mhop_put(struct hns_roce_dev *hr_dev, |
7134 |
+ if (check_whether_bt_num_2(table->type, hop_num)) { |
7135 |
+ start_idx = mhop.l0_idx * chunk_ba_num; |
7136 |
+ if (hns_roce_check_hem_null(table->hem, start_idx, |
7137 |
+- chunk_ba_num)) { |
7138 |
++ chunk_ba_num, table->num_hem)) { |
7139 |
+ if (table->type < HEM_TYPE_MTT && |
7140 |
+ hr_dev->hw->clear_hem(hr_dev, table, obj, 0)) |
7141 |
+ dev_warn(dev, "Clear HEM base address failed.\n"); |
7142 |
+@@ -663,7 +670,7 @@ static void hns_roce_table_mhop_put(struct hns_roce_dev *hr_dev, |
7143 |
+ start_idx = mhop.l0_idx * chunk_ba_num * chunk_ba_num + |
7144 |
+ mhop.l1_idx * chunk_ba_num; |
7145 |
+ if (hns_roce_check_hem_null(table->hem, start_idx, |
7146 |
+- chunk_ba_num)) { |
7147 |
++ chunk_ba_num, table->num_hem)) { |
7148 |
+ if (hr_dev->hw->clear_hem(hr_dev, table, obj, 1)) |
7149 |
+ dev_warn(dev, "Clear HEM base address failed.\n"); |
7150 |
+ |
7151 |
+diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c |
7152 |
+index 7021444f18b4..417de7ac0d5e 100644 |
7153 |
+--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c |
7154 |
++++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c |
7155 |
+@@ -4833,7 +4833,8 @@ static int hns_roce_mhop_alloc_eq(struct hns_roce_dev *hr_dev, |
7156 |
+ break; |
7157 |
+ } |
7158 |
+ eq->cur_eqe_ba = eq->buf_dma[0]; |
7159 |
+- eq->nxt_eqe_ba = eq->buf_dma[1]; |
7160 |
++ if (ba_num > 1) |
7161 |
++ eq->nxt_eqe_ba = eq->buf_dma[1]; |
7162 |
+ |
7163 |
+ } else if (mhop_num == 2) { |
7164 |
+ /* alloc L1 BT and buf */ |
7165 |
+@@ -4875,7 +4876,8 @@ static int hns_roce_mhop_alloc_eq(struct hns_roce_dev *hr_dev, |
7166 |
+ break; |
7167 |
+ } |
7168 |
+ eq->cur_eqe_ba = eq->buf_dma[0]; |
7169 |
+- eq->nxt_eqe_ba = eq->buf_dma[1]; |
7170 |
++ if (ba_num > 1) |
7171 |
++ eq->nxt_eqe_ba = eq->buf_dma[1]; |
7172 |
+ } |
7173 |
+ |
7174 |
+ eq->l0_last_num = i + 1; |
7175 |
+diff --git a/drivers/infiniband/hw/hns/hns_roce_qp.c b/drivers/infiniband/hw/hns/hns_roce_qp.c |
7176 |
+index af24698ff226..3012d7eb4ccb 100644 |
7177 |
+--- a/drivers/infiniband/hw/hns/hns_roce_qp.c |
7178 |
++++ b/drivers/infiniband/hw/hns/hns_roce_qp.c |
7179 |
+@@ -262,7 +262,6 @@ void hns_roce_qp_free(struct hns_roce_dev *hr_dev, struct hns_roce_qp *hr_qp) |
7180 |
+ hns_roce_table_put(hr_dev, &qp_table->trrl_table, |
7181 |
+ hr_qp->qpn); |
7182 |
+ hns_roce_table_put(hr_dev, &qp_table->irrl_table, hr_qp->qpn); |
7183 |
+- hns_roce_table_put(hr_dev, &qp_table->qp_table, hr_qp->qpn); |
7184 |
+ } |
7185 |
+ } |
7186 |
+ EXPORT_SYMBOL_GPL(hns_roce_qp_free); |
7187 |
+diff --git a/drivers/infiniband/hw/mlx5/ib_rep.c b/drivers/infiniband/hw/mlx5/ib_rep.c |
7188 |
+index 35a0e04c38f2..b841589c27c9 100644 |
7189 |
+--- a/drivers/infiniband/hw/mlx5/ib_rep.c |
7190 |
++++ b/drivers/infiniband/hw/mlx5/ib_rep.c |
7191 |
+@@ -69,8 +69,10 @@ mlx5_ib_vport_rep_load(struct mlx5_core_dev *dev, struct mlx5_eswitch_rep *rep) |
7192 |
+ ibdev->mdev = dev; |
7193 |
+ ibdev->num_ports = max(MLX5_CAP_GEN(dev, num_ports), |
7194 |
+ MLX5_CAP_GEN(dev, num_vhca_ports)); |
7195 |
+- if (!__mlx5_ib_add(ibdev, &rep_profile)) |
7196 |
++ if (!__mlx5_ib_add(ibdev, &rep_profile)) { |
7197 |
++ ib_dealloc_device(&ibdev->ib_dev); |
7198 |
+ return -EINVAL; |
7199 |
++ } |
7200 |
+ |
7201 |
+ rep->rep_if[REP_IB].priv = ibdev; |
7202 |
+ |
7203 |
+diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c |
7204 |
+index df5be462dd28..2db34f7b5ced 100644 |
7205 |
+--- a/drivers/infiniband/hw/mlx5/main.c |
7206 |
++++ b/drivers/infiniband/hw/mlx5/main.c |
7207 |
+@@ -2390,10 +2390,29 @@ static u8 get_match_criteria_enable(u32 *match_criteria) |
7208 |
+ return match_criteria_enable; |
7209 |
+ } |
7210 |
+ |
7211 |
+-static void set_proto(void *outer_c, void *outer_v, u8 mask, u8 val) |
7212 |
++static int set_proto(void *outer_c, void *outer_v, u8 mask, u8 val) |
7213 |
+ { |
7214 |
+- MLX5_SET(fte_match_set_lyr_2_4, outer_c, ip_protocol, mask); |
7215 |
+- MLX5_SET(fte_match_set_lyr_2_4, outer_v, ip_protocol, val); |
7216 |
++ u8 entry_mask; |
7217 |
++ u8 entry_val; |
7218 |
++ int err = 0; |
7219 |
++ |
7220 |
++ if (!mask) |
7221 |
++ goto out; |
7222 |
++ |
7223 |
++ entry_mask = MLX5_GET(fte_match_set_lyr_2_4, outer_c, |
7224 |
++ ip_protocol); |
7225 |
++ entry_val = MLX5_GET(fte_match_set_lyr_2_4, outer_v, |
7226 |
++ ip_protocol); |
7227 |
++ if (!entry_mask) { |
7228 |
++ MLX5_SET(fte_match_set_lyr_2_4, outer_c, ip_protocol, mask); |
7229 |
++ MLX5_SET(fte_match_set_lyr_2_4, outer_v, ip_protocol, val); |
7230 |
++ goto out; |
7231 |
++ } |
7232 |
++ /* Don't override existing ip protocol */ |
7233 |
++ if (mask != entry_mask || val != entry_val) |
7234 |
++ err = -EINVAL; |
7235 |
++out: |
7236 |
++ return err; |
7237 |
+ } |
7238 |
+ |
7239 |
+ static void set_flow_label(void *misc_c, void *misc_v, u32 mask, u32 val, |
7240 |
+@@ -2597,8 +2616,10 @@ static int parse_flow_attr(struct mlx5_core_dev *mdev, u32 *match_c, |
7241 |
+ set_tos(headers_c, headers_v, |
7242 |
+ ib_spec->ipv4.mask.tos, ib_spec->ipv4.val.tos); |
7243 |
+ |
7244 |
+- set_proto(headers_c, headers_v, |
7245 |
+- ib_spec->ipv4.mask.proto, ib_spec->ipv4.val.proto); |
7246 |
++ if (set_proto(headers_c, headers_v, |
7247 |
++ ib_spec->ipv4.mask.proto, |
7248 |
++ ib_spec->ipv4.val.proto)) |
7249 |
++ return -EINVAL; |
7250 |
+ break; |
7251 |
+ case IB_FLOW_SPEC_IPV6: |
7252 |
+ if (FIELDS_NOT_SUPPORTED(ib_spec->ipv6.mask, LAST_IPV6_FIELD)) |
7253 |
+@@ -2637,9 +2658,10 @@ static int parse_flow_attr(struct mlx5_core_dev *mdev, u32 *match_c, |
7254 |
+ ib_spec->ipv6.mask.traffic_class, |
7255 |
+ ib_spec->ipv6.val.traffic_class); |
7256 |
+ |
7257 |
+- set_proto(headers_c, headers_v, |
7258 |
+- ib_spec->ipv6.mask.next_hdr, |
7259 |
+- ib_spec->ipv6.val.next_hdr); |
7260 |
++ if (set_proto(headers_c, headers_v, |
7261 |
++ ib_spec->ipv6.mask.next_hdr, |
7262 |
++ ib_spec->ipv6.val.next_hdr)) |
7263 |
++ return -EINVAL; |
7264 |
+ |
7265 |
+ set_flow_label(misc_params_c, misc_params_v, |
7266 |
+ ntohl(ib_spec->ipv6.mask.flow_label), |
7267 |
+@@ -2660,10 +2682,8 @@ static int parse_flow_attr(struct mlx5_core_dev *mdev, u32 *match_c, |
7268 |
+ LAST_TCP_UDP_FIELD)) |
7269 |
+ return -EOPNOTSUPP; |
7270 |
+ |
7271 |
+- MLX5_SET(fte_match_set_lyr_2_4, headers_c, ip_protocol, |
7272 |
+- 0xff); |
7273 |
+- MLX5_SET(fte_match_set_lyr_2_4, headers_v, ip_protocol, |
7274 |
+- IPPROTO_TCP); |
7275 |
++ if (set_proto(headers_c, headers_v, 0xff, IPPROTO_TCP)) |
7276 |
++ return -EINVAL; |
7277 |
+ |
7278 |
+ MLX5_SET(fte_match_set_lyr_2_4, headers_c, tcp_sport, |
7279 |
+ ntohs(ib_spec->tcp_udp.mask.src_port)); |
7280 |
+@@ -2680,10 +2700,8 @@ static int parse_flow_attr(struct mlx5_core_dev *mdev, u32 *match_c, |
7281 |
+ LAST_TCP_UDP_FIELD)) |
7282 |
+ return -EOPNOTSUPP; |
7283 |
+ |
7284 |
+- MLX5_SET(fte_match_set_lyr_2_4, headers_c, ip_protocol, |
7285 |
+- 0xff); |
7286 |
+- MLX5_SET(fte_match_set_lyr_2_4, headers_v, ip_protocol, |
7287 |
+- IPPROTO_UDP); |
7288 |
++ if (set_proto(headers_c, headers_v, 0xff, IPPROTO_UDP)) |
7289 |
++ return -EINVAL; |
7290 |
+ |
7291 |
+ MLX5_SET(fte_match_set_lyr_2_4, headers_c, udp_sport, |
7292 |
+ ntohs(ib_spec->tcp_udp.mask.src_port)); |
7293 |
+@@ -2699,6 +2717,9 @@ static int parse_flow_attr(struct mlx5_core_dev *mdev, u32 *match_c, |
7294 |
+ if (ib_spec->gre.mask.c_ks_res0_ver) |
7295 |
+ return -EOPNOTSUPP; |
7296 |
+ |
7297 |
++ if (set_proto(headers_c, headers_v, 0xff, IPPROTO_GRE)) |
7298 |
++ return -EINVAL; |
7299 |
++ |
7300 |
+ MLX5_SET(fte_match_set_lyr_2_4, headers_c, ip_protocol, |
7301 |
+ 0xff); |
7302 |
+ MLX5_SET(fte_match_set_lyr_2_4, headers_v, ip_protocol, |
7303 |
+diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c |
7304 |
+index ef0f710587ad..4c0f0ce02d2f 100644 |
7305 |
+--- a/drivers/infiniband/hw/mlx5/qp.c |
7306 |
++++ b/drivers/infiniband/hw/mlx5/qp.c |
7307 |
+@@ -2598,6 +2598,11 @@ static enum mlx5_qp_optpar opt_mask[MLX5_QP_NUM_STATE][MLX5_QP_NUM_STATE][MLX5_Q |
7308 |
+ [MLX5_QP_ST_UD] = MLX5_QP_OPTPAR_PKEY_INDEX | |
7309 |
+ MLX5_QP_OPTPAR_Q_KEY | |
7310 |
+ MLX5_QP_OPTPAR_PRI_PORT, |
7311 |
++ [MLX5_QP_ST_XRC] = MLX5_QP_OPTPAR_RRE | |
7312 |
++ MLX5_QP_OPTPAR_RAE | |
7313 |
++ MLX5_QP_OPTPAR_RWE | |
7314 |
++ MLX5_QP_OPTPAR_PKEY_INDEX | |
7315 |
++ MLX5_QP_OPTPAR_PRI_PORT, |
7316 |
+ }, |
7317 |
+ [MLX5_QP_STATE_RTR] = { |
7318 |
+ [MLX5_QP_ST_RC] = MLX5_QP_OPTPAR_ALT_ADDR_PATH | |
7319 |
+@@ -2631,6 +2636,12 @@ static enum mlx5_qp_optpar opt_mask[MLX5_QP_NUM_STATE][MLX5_QP_NUM_STATE][MLX5_Q |
7320 |
+ MLX5_QP_OPTPAR_RWE | |
7321 |
+ MLX5_QP_OPTPAR_PM_STATE, |
7322 |
+ [MLX5_QP_ST_UD] = MLX5_QP_OPTPAR_Q_KEY, |
7323 |
++ [MLX5_QP_ST_XRC] = MLX5_QP_OPTPAR_ALT_ADDR_PATH | |
7324 |
++ MLX5_QP_OPTPAR_RRE | |
7325 |
++ MLX5_QP_OPTPAR_RAE | |
7326 |
++ MLX5_QP_OPTPAR_RWE | |
7327 |
++ MLX5_QP_OPTPAR_PM_STATE | |
7328 |
++ MLX5_QP_OPTPAR_RNR_TIMEOUT, |
7329 |
+ }, |
7330 |
+ }, |
7331 |
+ [MLX5_QP_STATE_RTS] = { |
7332 |
+@@ -2647,6 +2658,12 @@ static enum mlx5_qp_optpar opt_mask[MLX5_QP_NUM_STATE][MLX5_QP_NUM_STATE][MLX5_Q |
7333 |
+ [MLX5_QP_ST_UD] = MLX5_QP_OPTPAR_Q_KEY | |
7334 |
+ MLX5_QP_OPTPAR_SRQN | |
7335 |
+ MLX5_QP_OPTPAR_CQN_RCV, |
7336 |
++ [MLX5_QP_ST_XRC] = MLX5_QP_OPTPAR_RRE | |
7337 |
++ MLX5_QP_OPTPAR_RAE | |
7338 |
++ MLX5_QP_OPTPAR_RWE | |
7339 |
++ MLX5_QP_OPTPAR_RNR_TIMEOUT | |
7340 |
++ MLX5_QP_OPTPAR_PM_STATE | |
7341 |
++ MLX5_QP_OPTPAR_ALT_ADDR_PATH, |
7342 |
+ }, |
7343 |
+ }, |
7344 |
+ [MLX5_QP_STATE_SQER] = { |
7345 |
+@@ -2658,6 +2675,10 @@ static enum mlx5_qp_optpar opt_mask[MLX5_QP_NUM_STATE][MLX5_QP_NUM_STATE][MLX5_Q |
7346 |
+ MLX5_QP_OPTPAR_RWE | |
7347 |
+ MLX5_QP_OPTPAR_RAE | |
7348 |
+ MLX5_QP_OPTPAR_RRE, |
7349 |
++ [MLX5_QP_ST_XRC] = MLX5_QP_OPTPAR_RNR_TIMEOUT | |
7350 |
++ MLX5_QP_OPTPAR_RWE | |
7351 |
++ MLX5_QP_OPTPAR_RAE | |
7352 |
++ MLX5_QP_OPTPAR_RRE, |
7353 |
+ }, |
7354 |
+ }, |
7355 |
+ }; |
7356 |
+diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c |
7357 |
+index c158ca9fde6d..08271fce0b9e 100644 |
7358 |
+--- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c |
7359 |
++++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c |
7360 |
+@@ -55,7 +55,7 @@ |
7361 |
+ |
7362 |
+ int ocrdma_query_pkey(struct ib_device *ibdev, u8 port, u16 index, u16 *pkey) |
7363 |
+ { |
7364 |
+- if (index > 1) |
7365 |
++ if (index > 0) |
7366 |
+ return -EINVAL; |
7367 |
+ |
7368 |
+ *pkey = 0xffff; |
7369 |
+diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qedr/verbs.c |
7370 |
+index 9167a1c40bcf..38fe2f741375 100644 |
7371 |
+--- a/drivers/infiniband/hw/qedr/verbs.c |
7372 |
++++ b/drivers/infiniband/hw/qedr/verbs.c |
7373 |
+@@ -67,7 +67,7 @@ static inline int qedr_ib_copy_to_udata(struct ib_udata *udata, void *src, |
7374 |
+ |
7375 |
+ int qedr_query_pkey(struct ib_device *ibdev, u8 port, u16 index, u16 *pkey) |
7376 |
+ { |
7377 |
+- if (index > QEDR_ROCE_PKEY_TABLE_LEN) |
7378 |
++ if (index >= QEDR_ROCE_PKEY_TABLE_LEN) |
7379 |
+ return -EINVAL; |
7380 |
+ |
7381 |
+ *pkey = QEDR_ROCE_PKEY_DEFAULT; |
7382 |
+@@ -158,54 +158,47 @@ int qedr_query_device(struct ib_device *ibdev, |
7383 |
+ return 0; |
7384 |
+ } |
7385 |
+ |
7386 |
+-#define QEDR_SPEED_SDR (1) |
7387 |
+-#define QEDR_SPEED_DDR (2) |
7388 |
+-#define QEDR_SPEED_QDR (4) |
7389 |
+-#define QEDR_SPEED_FDR10 (8) |
7390 |
+-#define QEDR_SPEED_FDR (16) |
7391 |
+-#define QEDR_SPEED_EDR (32) |
7392 |
+- |
7393 |
+ static inline void get_link_speed_and_width(int speed, u8 *ib_speed, |
7394 |
+ u8 *ib_width) |
7395 |
+ { |
7396 |
+ switch (speed) { |
7397 |
+ case 1000: |
7398 |
+- *ib_speed = QEDR_SPEED_SDR; |
7399 |
++ *ib_speed = IB_SPEED_SDR; |
7400 |
+ *ib_width = IB_WIDTH_1X; |
7401 |
+ break; |
7402 |
+ case 10000: |
7403 |
+- *ib_speed = QEDR_SPEED_QDR; |
7404 |
++ *ib_speed = IB_SPEED_QDR; |
7405 |
+ *ib_width = IB_WIDTH_1X; |
7406 |
+ break; |
7407 |
+ |
7408 |
+ case 20000: |
7409 |
+- *ib_speed = QEDR_SPEED_DDR; |
7410 |
++ *ib_speed = IB_SPEED_DDR; |
7411 |
+ *ib_width = IB_WIDTH_4X; |
7412 |
+ break; |
7413 |
+ |
7414 |
+ case 25000: |
7415 |
+- *ib_speed = QEDR_SPEED_EDR; |
7416 |
++ *ib_speed = IB_SPEED_EDR; |
7417 |
+ *ib_width = IB_WIDTH_1X; |
7418 |
+ break; |
7419 |
+ |
7420 |
+ case 40000: |
7421 |
+- *ib_speed = QEDR_SPEED_QDR; |
7422 |
++ *ib_speed = IB_SPEED_QDR; |
7423 |
+ *ib_width = IB_WIDTH_4X; |
7424 |
+ break; |
7425 |
+ |
7426 |
+ case 50000: |
7427 |
+- *ib_speed = QEDR_SPEED_QDR; |
7428 |
+- *ib_width = IB_WIDTH_4X; |
7429 |
++ *ib_speed = IB_SPEED_HDR; |
7430 |
++ *ib_width = IB_WIDTH_1X; |
7431 |
+ break; |
7432 |
+ |
7433 |
+ case 100000: |
7434 |
+- *ib_speed = QEDR_SPEED_EDR; |
7435 |
++ *ib_speed = IB_SPEED_EDR; |
7436 |
+ *ib_width = IB_WIDTH_4X; |
7437 |
+ break; |
7438 |
+ |
7439 |
+ default: |
7440 |
+ /* Unsupported */ |
7441 |
+- *ib_speed = QEDR_SPEED_SDR; |
7442 |
++ *ib_speed = IB_SPEED_SDR; |
7443 |
+ *ib_width = IB_WIDTH_1X; |
7444 |
+ } |
7445 |
+ } |
7446 |
+diff --git a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c |
7447 |
+index 3db232429630..e611f133aa97 100644 |
7448 |
+--- a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c |
7449 |
++++ b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c |
7450 |
+@@ -447,7 +447,7 @@ struct net_device *usnic_get_netdev(struct ib_device *device, u8 port_num) |
7451 |
+ int usnic_ib_query_pkey(struct ib_device *ibdev, u8 port, u16 index, |
7452 |
+ u16 *pkey) |
7453 |
+ { |
7454 |
+- if (index > 1) |
7455 |
++ if (index > 0) |
7456 |
+ return -EINVAL; |
7457 |
+ |
7458 |
+ *pkey = 0xffff; |
7459 |
+diff --git a/drivers/infiniband/sw/rxe/rxe_cq.c b/drivers/infiniband/sw/rxe/rxe_cq.c |
7460 |
+index 2ee4b08b00ea..a57276f2cb84 100644 |
7461 |
+--- a/drivers/infiniband/sw/rxe/rxe_cq.c |
7462 |
++++ b/drivers/infiniband/sw/rxe/rxe_cq.c |
7463 |
+@@ -30,7 +30,7 @@ |
7464 |
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
7465 |
+ * SOFTWARE. |
7466 |
+ */ |
7467 |
+- |
7468 |
++#include <linux/vmalloc.h> |
7469 |
+ #include "rxe.h" |
7470 |
+ #include "rxe_loc.h" |
7471 |
+ #include "rxe_queue.h" |
7472 |
+@@ -97,7 +97,7 @@ int rxe_cq_from_init(struct rxe_dev *rxe, struct rxe_cq *cq, int cqe, |
7473 |
+ err = do_mmap_info(rxe, uresp ? &uresp->mi : NULL, context, |
7474 |
+ cq->queue->buf, cq->queue->buf_size, &cq->queue->ip); |
7475 |
+ if (err) { |
7476 |
+- kvfree(cq->queue->buf); |
7477 |
++ vfree(cq->queue->buf); |
7478 |
+ kfree(cq->queue); |
7479 |
+ return err; |
7480 |
+ } |
7481 |
+diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c |
7482 |
+index 8094cbaa54a9..54add70c22b5 100644 |
7483 |
+--- a/drivers/infiniband/sw/rxe/rxe_net.c |
7484 |
++++ b/drivers/infiniband/sw/rxe/rxe_net.c |
7485 |
+@@ -533,8 +533,9 @@ struct sk_buff *rxe_init_packet(struct rxe_dev *rxe, struct rxe_av *av, |
7486 |
+ if (unlikely(!skb)) |
7487 |
+ goto out; |
7488 |
+ |
7489 |
+- skb_reserve(skb, hdr_len + LL_RESERVED_SPACE(rxe->ndev)); |
7490 |
++ skb_reserve(skb, hdr_len + LL_RESERVED_SPACE(ndev)); |
7491 |
+ |
7492 |
++ /* FIXME: hold reference to this netdev until life of this skb. */ |
7493 |
+ skb->dev = ndev; |
7494 |
+ if (av->network_type == RDMA_NETWORK_IPV4) |
7495 |
+ skb->protocol = htons(ETH_P_IP); |
7496 |
+diff --git a/drivers/infiniband/sw/rxe/rxe_pool.c b/drivers/infiniband/sw/rxe/rxe_pool.c |
7497 |
+index b4a8acc7bb7d..0e2425f28233 100644 |
7498 |
+--- a/drivers/infiniband/sw/rxe/rxe_pool.c |
7499 |
++++ b/drivers/infiniband/sw/rxe/rxe_pool.c |
7500 |
+@@ -112,6 +112,18 @@ static inline struct kmem_cache *pool_cache(struct rxe_pool *pool) |
7501 |
+ return rxe_type_info[pool->type].cache; |
7502 |
+ } |
7503 |
+ |
7504 |
++static void rxe_cache_clean(size_t cnt) |
7505 |
++{ |
7506 |
++ int i; |
7507 |
++ struct rxe_type_info *type; |
7508 |
++ |
7509 |
++ for (i = 0; i < cnt; i++) { |
7510 |
++ type = &rxe_type_info[i]; |
7511 |
++ kmem_cache_destroy(type->cache); |
7512 |
++ type->cache = NULL; |
7513 |
++ } |
7514 |
++} |
7515 |
++ |
7516 |
+ int rxe_cache_init(void) |
7517 |
+ { |
7518 |
+ int err; |
7519 |
+@@ -136,24 +148,14 @@ int rxe_cache_init(void) |
7520 |
+ return 0; |
7521 |
+ |
7522 |
+ err1: |
7523 |
+- while (--i >= 0) { |
7524 |
+- kmem_cache_destroy(type->cache); |
7525 |
+- type->cache = NULL; |
7526 |
+- } |
7527 |
++ rxe_cache_clean(i); |
7528 |
+ |
7529 |
+ return err; |
7530 |
+ } |
7531 |
+ |
7532 |
+ void rxe_cache_exit(void) |
7533 |
+ { |
7534 |
+- int i; |
7535 |
+- struct rxe_type_info *type; |
7536 |
+- |
7537 |
+- for (i = 0; i < RXE_NUM_TYPES; i++) { |
7538 |
+- type = &rxe_type_info[i]; |
7539 |
+- kmem_cache_destroy(type->cache); |
7540 |
+- type->cache = NULL; |
7541 |
+- } |
7542 |
++ rxe_cache_clean(RXE_NUM_TYPES); |
7543 |
+ } |
7544 |
+ |
7545 |
+ static int rxe_pool_init_index(struct rxe_pool *pool, u32 max, u32 min) |
7546 |
+diff --git a/drivers/infiniband/sw/rxe/rxe_qp.c b/drivers/infiniband/sw/rxe/rxe_qp.c |
7547 |
+index c58452daffc7..230697fa31fe 100644 |
7548 |
+--- a/drivers/infiniband/sw/rxe/rxe_qp.c |
7549 |
++++ b/drivers/infiniband/sw/rxe/rxe_qp.c |
7550 |
+@@ -34,6 +34,7 @@ |
7551 |
+ #include <linux/skbuff.h> |
7552 |
+ #include <linux/delay.h> |
7553 |
+ #include <linux/sched.h> |
7554 |
++#include <linux/vmalloc.h> |
7555 |
+ |
7556 |
+ #include "rxe.h" |
7557 |
+ #include "rxe_loc.h" |
7558 |
+@@ -247,7 +248,7 @@ static int rxe_qp_init_req(struct rxe_dev *rxe, struct rxe_qp *qp, |
7559 |
+ &qp->sq.queue->ip); |
7560 |
+ |
7561 |
+ if (err) { |
7562 |
+- kvfree(qp->sq.queue->buf); |
7563 |
++ vfree(qp->sq.queue->buf); |
7564 |
+ kfree(qp->sq.queue); |
7565 |
+ return err; |
7566 |
+ } |
7567 |
+@@ -300,7 +301,7 @@ static int rxe_qp_init_resp(struct rxe_dev *rxe, struct rxe_qp *qp, |
7568 |
+ qp->rq.queue->buf, qp->rq.queue->buf_size, |
7569 |
+ &qp->rq.queue->ip); |
7570 |
+ if (err) { |
7571 |
+- kvfree(qp->rq.queue->buf); |
7572 |
++ vfree(qp->rq.queue->buf); |
7573 |
+ kfree(qp->rq.queue); |
7574 |
+ return err; |
7575 |
+ } |
7576 |
+diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.h b/drivers/infiniband/ulp/iser/iscsi_iser.h |
7577 |
+index 120b40829560..a7aeaa0c6fbc 100644 |
7578 |
+--- a/drivers/infiniband/ulp/iser/iscsi_iser.h |
7579 |
++++ b/drivers/infiniband/ulp/iser/iscsi_iser.h |
7580 |
+@@ -197,7 +197,7 @@ struct iser_data_buf { |
7581 |
+ struct scatterlist *sg; |
7582 |
+ int size; |
7583 |
+ unsigned long data_len; |
7584 |
+- unsigned int dma_nents; |
7585 |
++ int dma_nents; |
7586 |
+ }; |
7587 |
+ |
7588 |
+ /* fwd declarations */ |
7589 |
+diff --git a/drivers/infiniband/ulp/iser/iser_memory.c b/drivers/infiniband/ulp/iser/iser_memory.c |
7590 |
+index 009be8889d71..379bc0dfc388 100644 |
7591 |
+--- a/drivers/infiniband/ulp/iser/iser_memory.c |
7592 |
++++ b/drivers/infiniband/ulp/iser/iser_memory.c |
7593 |
+@@ -240,8 +240,8 @@ int iser_fast_reg_fmr(struct iscsi_iser_task *iser_task, |
7594 |
+ page_vec->npages = 0; |
7595 |
+ page_vec->fake_mr.page_size = SIZE_4K; |
7596 |
+ plen = ib_sg_to_pages(&page_vec->fake_mr, mem->sg, |
7597 |
+- mem->size, NULL, iser_set_page); |
7598 |
+- if (unlikely(plen < mem->size)) { |
7599 |
++ mem->dma_nents, NULL, iser_set_page); |
7600 |
++ if (unlikely(plen < mem->dma_nents)) { |
7601 |
+ iser_err("page vec too short to hold this SG\n"); |
7602 |
+ iser_data_buf_dump(mem, device->ib_device); |
7603 |
+ iser_dump_page_vec(page_vec); |
7604 |
+@@ -451,10 +451,10 @@ static int iser_fast_reg_mr(struct iscsi_iser_task *iser_task, |
7605 |
+ |
7606 |
+ ib_update_fast_reg_key(mr, ib_inc_rkey(mr->rkey)); |
7607 |
+ |
7608 |
+- n = ib_map_mr_sg(mr, mem->sg, mem->size, NULL, SIZE_4K); |
7609 |
+- if (unlikely(n != mem->size)) { |
7610 |
++ n = ib_map_mr_sg(mr, mem->sg, mem->dma_nents, NULL, SIZE_4K); |
7611 |
++ if (unlikely(n != mem->dma_nents)) { |
7612 |
+ iser_err("failed to map sg (%d/%d)\n", |
7613 |
+- n, mem->size); |
7614 |
++ n, mem->dma_nents); |
7615 |
+ return n < 0 ? n : -EINVAL; |
7616 |
+ } |
7617 |
+ |
7618 |
+diff --git a/drivers/input/keyboard/nomadik-ske-keypad.c b/drivers/input/keyboard/nomadik-ske-keypad.c |
7619 |
+index 8567ee47761e..ae3b04557074 100644 |
7620 |
+--- a/drivers/input/keyboard/nomadik-ske-keypad.c |
7621 |
++++ b/drivers/input/keyboard/nomadik-ske-keypad.c |
7622 |
+@@ -100,7 +100,7 @@ static int __init ske_keypad_chip_init(struct ske_keypad *keypad) |
7623 |
+ while ((readl(keypad->reg_base + SKE_RIS) != 0x00000000) && timeout--) |
7624 |
+ cpu_relax(); |
7625 |
+ |
7626 |
+- if (!timeout) |
7627 |
++ if (timeout == -1) |
7628 |
+ return -EINVAL; |
7629 |
+ |
7630 |
+ /* |
7631 |
+diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c |
7632 |
+index 9991386fb700..bea19aa33758 100644 |
7633 |
+--- a/drivers/iommu/amd_iommu.c |
7634 |
++++ b/drivers/iommu/amd_iommu.c |
7635 |
+@@ -2153,6 +2153,8 @@ skip_ats_check: |
7636 |
+ */ |
7637 |
+ domain_flush_tlb_pde(domain); |
7638 |
+ |
7639 |
++ domain_flush_complete(domain); |
7640 |
++ |
7641 |
+ return ret; |
7642 |
+ } |
7643 |
+ |
7644 |
+diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c |
7645 |
+index 1e9a5da562f0..465f28a7844c 100644 |
7646 |
+--- a/drivers/iommu/amd_iommu_init.c |
7647 |
++++ b/drivers/iommu/amd_iommu_init.c |
7648 |
+@@ -422,6 +422,9 @@ static void iommu_enable(struct amd_iommu *iommu) |
7649 |
+ |
7650 |
+ static void iommu_disable(struct amd_iommu *iommu) |
7651 |
+ { |
7652 |
++ if (!iommu->mmio_base) |
7653 |
++ return; |
7654 |
++ |
7655 |
+ /* Disable command buffer */ |
7656 |
+ iommu_feature_disable(iommu, CONTROL_CMDBUF_EN); |
7657 |
+ |
7658 |
+diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c |
7659 |
+index b9af2419006f..9df3b8441227 100644 |
7660 |
+--- a/drivers/iommu/intel-iommu.c |
7661 |
++++ b/drivers/iommu/intel-iommu.c |
7662 |
+@@ -387,7 +387,6 @@ struct dmar_rmrr_unit { |
7663 |
+ u64 end_address; /* reserved end address */ |
7664 |
+ struct dmar_dev_scope *devices; /* target devices */ |
7665 |
+ int devices_cnt; /* target device count */ |
7666 |
+- struct iommu_resv_region *resv; /* reserved region handle */ |
7667 |
+ }; |
7668 |
+ |
7669 |
+ struct dmar_atsr_unit { |
7670 |
+@@ -3387,9 +3386,12 @@ static int __init init_dmars(void) |
7671 |
+ iommu_identity_mapping |= IDENTMAP_ALL; |
7672 |
+ |
7673 |
+ #ifdef CONFIG_INTEL_IOMMU_BROKEN_GFX_WA |
7674 |
+- iommu_identity_mapping |= IDENTMAP_GFX; |
7675 |
++ dmar_map_gfx = 0; |
7676 |
+ #endif |
7677 |
+ |
7678 |
++ if (!dmar_map_gfx) |
7679 |
++ iommu_identity_mapping |= IDENTMAP_GFX; |
7680 |
++ |
7681 |
+ check_tylersburg_isoch(); |
7682 |
+ |
7683 |
+ if (iommu_identity_mapping) { |
7684 |
+@@ -4182,7 +4184,6 @@ static inline void init_iommu_pm_ops(void) {} |
7685 |
+ int __init dmar_parse_one_rmrr(struct acpi_dmar_header *header, void *arg) |
7686 |
+ { |
7687 |
+ struct acpi_dmar_reserved_memory *rmrr; |
7688 |
+- int prot = DMA_PTE_READ|DMA_PTE_WRITE; |
7689 |
+ struct dmar_rmrr_unit *rmrru; |
7690 |
+ size_t length; |
7691 |
+ |
7692 |
+@@ -4196,22 +4197,16 @@ int __init dmar_parse_one_rmrr(struct acpi_dmar_header *header, void *arg) |
7693 |
+ rmrru->end_address = rmrr->end_address; |
7694 |
+ |
7695 |
+ length = rmrr->end_address - rmrr->base_address + 1; |
7696 |
+- rmrru->resv = iommu_alloc_resv_region(rmrr->base_address, length, prot, |
7697 |
+- IOMMU_RESV_DIRECT); |
7698 |
+- if (!rmrru->resv) |
7699 |
+- goto free_rmrru; |
7700 |
+ |
7701 |
+ rmrru->devices = dmar_alloc_dev_scope((void *)(rmrr + 1), |
7702 |
+ ((void *)rmrr) + rmrr->header.length, |
7703 |
+ &rmrru->devices_cnt); |
7704 |
+ if (rmrru->devices_cnt && rmrru->devices == NULL) |
7705 |
+- goto free_all; |
7706 |
++ goto free_rmrru; |
7707 |
+ |
7708 |
+ list_add(&rmrru->list, &dmar_rmrr_units); |
7709 |
+ |
7710 |
+ return 0; |
7711 |
+-free_all: |
7712 |
+- kfree(rmrru->resv); |
7713 |
+ free_rmrru: |
7714 |
+ kfree(rmrru); |
7715 |
+ out: |
7716 |
+@@ -4429,7 +4424,6 @@ static void intel_iommu_free_dmars(void) |
7717 |
+ list_for_each_entry_safe(rmrru, rmrr_n, &dmar_rmrr_units, list) { |
7718 |
+ list_del(&rmrru->list); |
7719 |
+ dmar_free_dev_scope(&rmrru->devices, &rmrru->devices_cnt); |
7720 |
+- kfree(rmrru->resv); |
7721 |
+ kfree(rmrru); |
7722 |
+ } |
7723 |
+ |
7724 |
+@@ -5203,22 +5197,33 @@ static void intel_iommu_remove_device(struct device *dev) |
7725 |
+ static void intel_iommu_get_resv_regions(struct device *device, |
7726 |
+ struct list_head *head) |
7727 |
+ { |
7728 |
++ int prot = DMA_PTE_READ | DMA_PTE_WRITE; |
7729 |
+ struct iommu_resv_region *reg; |
7730 |
+ struct dmar_rmrr_unit *rmrr; |
7731 |
+ struct device *i_dev; |
7732 |
+ int i; |
7733 |
+ |
7734 |
+- rcu_read_lock(); |
7735 |
++ down_read(&dmar_global_lock); |
7736 |
+ for_each_rmrr_units(rmrr) { |
7737 |
+ for_each_active_dev_scope(rmrr->devices, rmrr->devices_cnt, |
7738 |
+ i, i_dev) { |
7739 |
++ struct iommu_resv_region *resv; |
7740 |
++ size_t length; |
7741 |
++ |
7742 |
+ if (i_dev != device) |
7743 |
+ continue; |
7744 |
+ |
7745 |
+- list_add_tail(&rmrr->resv->list, head); |
7746 |
++ length = rmrr->end_address - rmrr->base_address + 1; |
7747 |
++ resv = iommu_alloc_resv_region(rmrr->base_address, |
7748 |
++ length, prot, |
7749 |
++ IOMMU_RESV_DIRECT); |
7750 |
++ if (!resv) |
7751 |
++ break; |
7752 |
++ |
7753 |
++ list_add_tail(&resv->list, head); |
7754 |
+ } |
7755 |
+ } |
7756 |
+- rcu_read_unlock(); |
7757 |
++ up_read(&dmar_global_lock); |
7758 |
+ |
7759 |
+ reg = iommu_alloc_resv_region(IOAPIC_RANGE_START, |
7760 |
+ IOAPIC_RANGE_END - IOAPIC_RANGE_START + 1, |
7761 |
+@@ -5233,10 +5238,8 @@ static void intel_iommu_put_resv_regions(struct device *dev, |
7762 |
+ { |
7763 |
+ struct iommu_resv_region *entry, *next; |
7764 |
+ |
7765 |
+- list_for_each_entry_safe(entry, next, head, list) { |
7766 |
+- if (entry->type == IOMMU_RESV_MSI) |
7767 |
+- kfree(entry); |
7768 |
+- } |
7769 |
++ list_for_each_entry_safe(entry, next, head, list) |
7770 |
++ kfree(entry); |
7771 |
+ } |
7772 |
+ |
7773 |
+ #ifdef CONFIG_INTEL_IOMMU_SVM |
7774 |
+diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c |
7775 |
+index 188f4eaed6e5..fd8730b2cd46 100644 |
7776 |
+--- a/drivers/iommu/intel-svm.c |
7777 |
++++ b/drivers/iommu/intel-svm.c |
7778 |
+@@ -293,7 +293,7 @@ int intel_svm_bind_mm(struct device *dev, int *pasid, int flags, struct svm_dev_ |
7779 |
+ int pasid_max; |
7780 |
+ int ret; |
7781 |
+ |
7782 |
+- if (!iommu) |
7783 |
++ if (!iommu || dmar_disabled) |
7784 |
+ return -EINVAL; |
7785 |
+ |
7786 |
+ if (dev_is_pci(dev)) { |
7787 |
+diff --git a/drivers/iommu/iommu-debugfs.c b/drivers/iommu/iommu-debugfs.c |
7788 |
+index 3b1bf88fd1b0..f03548942096 100644 |
7789 |
+--- a/drivers/iommu/iommu-debugfs.c |
7790 |
++++ b/drivers/iommu/iommu-debugfs.c |
7791 |
+@@ -12,6 +12,7 @@ |
7792 |
+ #include <linux/debugfs.h> |
7793 |
+ |
7794 |
+ struct dentry *iommu_debugfs_dir; |
7795 |
++EXPORT_SYMBOL_GPL(iommu_debugfs_dir); |
7796 |
+ |
7797 |
+ /** |
7798 |
+ * iommu_debugfs_setup - create the top-level iommu directory in debugfs |
7799 |
+@@ -23,9 +24,9 @@ struct dentry *iommu_debugfs_dir; |
7800 |
+ * Emit a strong warning at boot time to indicate that this feature is |
7801 |
+ * enabled. |
7802 |
+ * |
7803 |
+- * This function is called from iommu_init; drivers may then call |
7804 |
+- * iommu_debugfs_new_driver_dir() to instantiate a vendor-specific |
7805 |
+- * directory to be used to expose internal data. |
7806 |
++ * This function is called from iommu_init; drivers may then use |
7807 |
++ * iommu_debugfs_dir to instantiate a vendor-specific directory to be used |
7808 |
++ * to expose internal data. |
7809 |
+ */ |
7810 |
+ void iommu_debugfs_setup(void) |
7811 |
+ { |
7812 |
+@@ -48,19 +49,3 @@ void iommu_debugfs_setup(void) |
7813 |
+ pr_warn("*************************************************************\n"); |
7814 |
+ } |
7815 |
+ } |
7816 |
+- |
7817 |
+-/** |
7818 |
+- * iommu_debugfs_new_driver_dir - create a vendor directory under debugfs/iommu |
7819 |
+- * @vendor: name of the vendor-specific subdirectory to create |
7820 |
+- * |
7821 |
+- * This function is called by an IOMMU driver to create the top-level debugfs |
7822 |
+- * directory for that driver. |
7823 |
+- * |
7824 |
+- * Return: upon success, a pointer to the dentry for the new directory. |
7825 |
+- * NULL in case of failure. |
7826 |
+- */ |
7827 |
+-struct dentry *iommu_debugfs_new_driver_dir(const char *vendor) |
7828 |
+-{ |
7829 |
+- return debugfs_create_dir(vendor, iommu_debugfs_dir); |
7830 |
+-} |
7831 |
+-EXPORT_SYMBOL_GPL(iommu_debugfs_new_driver_dir); |
7832 |
+diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c |
7833 |
+index ee25ec22778e..00e1c908cd8e 100644 |
7834 |
+--- a/drivers/iommu/iommu.c |
7835 |
++++ b/drivers/iommu/iommu.c |
7836 |
+@@ -317,7 +317,7 @@ static ssize_t iommu_group_show_type(struct iommu_group *group, |
7837 |
+ type = "unmanaged\n"; |
7838 |
+ break; |
7839 |
+ case IOMMU_DOMAIN_DMA: |
7840 |
+- type = "DMA"; |
7841 |
++ type = "DMA\n"; |
7842 |
+ break; |
7843 |
+ } |
7844 |
+ } |
7845 |
+@@ -1900,9 +1900,9 @@ int iommu_request_dm_for_dev(struct device *dev) |
7846 |
+ int ret; |
7847 |
+ |
7848 |
+ /* Device must already be in a group before calling this function */ |
7849 |
+- group = iommu_group_get_for_dev(dev); |
7850 |
+- if (IS_ERR(group)) |
7851 |
+- return PTR_ERR(group); |
7852 |
++ group = iommu_group_get(dev); |
7853 |
++ if (!group) |
7854 |
++ return -EINVAL; |
7855 |
+ |
7856 |
+ mutex_lock(&group->mutex); |
7857 |
+ |
7858 |
+diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c |
7859 |
+index 154cf44439cb..8e75f34ac886 100644 |
7860 |
+--- a/drivers/iommu/mtk_iommu.c |
7861 |
++++ b/drivers/iommu/mtk_iommu.c |
7862 |
+@@ -115,6 +115,30 @@ struct mtk_iommu_domain { |
7863 |
+ |
7864 |
+ static struct iommu_ops mtk_iommu_ops; |
7865 |
+ |
7866 |
++/* |
7867 |
++ * In M4U 4GB mode, the physical address is remapped as below: |
7868 |
++ * |
7869 |
++ * CPU Physical address: |
7870 |
++ * ==================== |
7871 |
++ * |
7872 |
++ * 0 1G 2G 3G 4G 5G |
7873 |
++ * |---A---|---B---|---C---|---D---|---E---| |
7874 |
++ * +--I/O--+------------Memory-------------+ |
7875 |
++ * |
7876 |
++ * IOMMU output physical address: |
7877 |
++ * ============================= |
7878 |
++ * |
7879 |
++ * 4G 5G 6G 7G 8G |
7880 |
++ * |---E---|---B---|---C---|---D---| |
7881 |
++ * +------------Memory-------------+ |
7882 |
++ * |
7883 |
++ * The Region 'A'(I/O) can NOT be mapped by M4U; For Region 'B'/'C'/'D', the |
7884 |
++ * bit32 of the CPU physical address always is needed to set, and for Region |
7885 |
++ * 'E', the CPU physical address keep as is. |
7886 |
++ * Additionally, The iommu consumers always use the CPU phyiscal address. |
7887 |
++ */ |
7888 |
++#define MTK_IOMMU_4GB_MODE_REMAP_BASE 0x40000000 |
7889 |
++ |
7890 |
+ static LIST_HEAD(m4ulist); /* List all the M4U HWs */ |
7891 |
+ |
7892 |
+ #define for_each_m4u(data) list_for_each_entry(data, &m4ulist, list) |
7893 |
+@@ -409,7 +433,7 @@ static phys_addr_t mtk_iommu_iova_to_phys(struct iommu_domain *domain, |
7894 |
+ pa = dom->iop->iova_to_phys(dom->iop, iova); |
7895 |
+ spin_unlock_irqrestore(&dom->pgtlock, flags); |
7896 |
+ |
7897 |
+- if (data->enable_4GB) |
7898 |
++ if (data->enable_4GB && pa < MTK_IOMMU_4GB_MODE_REMAP_BASE) |
7899 |
+ pa |= BIT_ULL(32); |
7900 |
+ |
7901 |
+ return pa; |
7902 |
+diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c |
7903 |
+index e4cb3811e82a..005b839f6eb9 100644 |
7904 |
+--- a/drivers/leds/led-triggers.c |
7905 |
++++ b/drivers/leds/led-triggers.c |
7906 |
+@@ -171,11 +171,11 @@ err_add_groups: |
7907 |
+ trig->deactivate(led_cdev); |
7908 |
+ err_activate: |
7909 |
+ |
7910 |
+- led_cdev->trigger = NULL; |
7911 |
+- led_cdev->trigger_data = NULL; |
7912 |
+ write_lock_irqsave(&led_cdev->trigger->leddev_list_lock, flags); |
7913 |
+ list_del(&led_cdev->trig_list); |
7914 |
+ write_unlock_irqrestore(&led_cdev->trigger->leddev_list_lock, flags); |
7915 |
++ led_cdev->trigger = NULL; |
7916 |
++ led_cdev->trigger_data = NULL; |
7917 |
+ led_set_brightness(led_cdev, LED_OFF); |
7918 |
+ kfree(event); |
7919 |
+ |
7920 |
+diff --git a/drivers/lightnvm/pblk-rb.c b/drivers/lightnvm/pblk-rb.c |
7921 |
+index f6eec0212dfc..d22c13b55622 100644 |
7922 |
+--- a/drivers/lightnvm/pblk-rb.c |
7923 |
++++ b/drivers/lightnvm/pblk-rb.c |
7924 |
+@@ -784,8 +784,8 @@ int pblk_rb_tear_down_check(struct pblk_rb *rb) |
7925 |
+ } |
7926 |
+ |
7927 |
+ out: |
7928 |
+- spin_unlock(&rb->w_lock); |
7929 |
+ spin_unlock_irq(&rb->s_lock); |
7930 |
++ spin_unlock(&rb->w_lock); |
7931 |
+ |
7932 |
+ return ret; |
7933 |
+ } |
7934 |
+diff --git a/drivers/mailbox/mtk-cmdq-mailbox.c b/drivers/mailbox/mtk-cmdq-mailbox.c |
7935 |
+index aec46d5d3506..f7cc29c00302 100644 |
7936 |
+--- a/drivers/mailbox/mtk-cmdq-mailbox.c |
7937 |
++++ b/drivers/mailbox/mtk-cmdq-mailbox.c |
7938 |
+@@ -363,6 +363,9 @@ static int cmdq_mbox_send_data(struct mbox_chan *chan, void *data) |
7939 |
+ WARN_ON(cmdq->suspended); |
7940 |
+ |
7941 |
+ task = kzalloc(sizeof(*task), GFP_ATOMIC); |
7942 |
++ if (!task) |
7943 |
++ return -ENOMEM; |
7944 |
++ |
7945 |
+ task->cmdq = cmdq; |
7946 |
+ INIT_LIST_HEAD(&task->list_entry); |
7947 |
+ task->pa_base = pkt->pa_base; |
7948 |
+diff --git a/drivers/mailbox/qcom-apcs-ipc-mailbox.c b/drivers/mailbox/qcom-apcs-ipc-mailbox.c |
7949 |
+index 5255dcb551a7..d8b4f08f613b 100644 |
7950 |
+--- a/drivers/mailbox/qcom-apcs-ipc-mailbox.c |
7951 |
++++ b/drivers/mailbox/qcom-apcs-ipc-mailbox.c |
7952 |
+@@ -36,7 +36,7 @@ static const struct regmap_config apcs_regmap_config = { |
7953 |
+ .reg_bits = 32, |
7954 |
+ .reg_stride = 4, |
7955 |
+ .val_bits = 32, |
7956 |
+- .max_register = 0x1000, |
7957 |
++ .max_register = 0xFFC, |
7958 |
+ .fast_io = true, |
7959 |
+ }; |
7960 |
+ |
7961 |
+diff --git a/drivers/mailbox/ti-msgmgr.c b/drivers/mailbox/ti-msgmgr.c |
7962 |
+index 5bceafbf6699..01e9e462512b 100644 |
7963 |
+--- a/drivers/mailbox/ti-msgmgr.c |
7964 |
++++ b/drivers/mailbox/ti-msgmgr.c |
7965 |
+@@ -547,7 +547,7 @@ static struct mbox_chan *ti_msgmgr_of_xlate(struct mbox_controller *mbox, |
7966 |
+ } |
7967 |
+ |
7968 |
+ if (d->is_sproxy) { |
7969 |
+- if (req_pid > d->num_valid_queues) |
7970 |
++ if (req_pid >= d->num_valid_queues) |
7971 |
+ goto err; |
7972 |
+ qinst = &inst->qinsts[req_pid]; |
7973 |
+ return qinst->chan; |
7974 |
+diff --git a/drivers/md/bcache/debug.c b/drivers/md/bcache/debug.c |
7975 |
+index 8c53d874ada4..f6b60d5908f7 100644 |
7976 |
+--- a/drivers/md/bcache/debug.c |
7977 |
++++ b/drivers/md/bcache/debug.c |
7978 |
+@@ -178,10 +178,9 @@ static ssize_t bch_dump_read(struct file *file, char __user *buf, |
7979 |
+ while (size) { |
7980 |
+ struct keybuf_key *w; |
7981 |
+ unsigned int bytes = min(i->bytes, size); |
7982 |
+- int err = copy_to_user(buf, i->buf, bytes); |
7983 |
+ |
7984 |
+- if (err) |
7985 |
+- return err; |
7986 |
++ if (copy_to_user(buf, i->buf, bytes)) |
7987 |
++ return -EFAULT; |
7988 |
+ |
7989 |
+ ret += bytes; |
7990 |
+ buf += bytes; |
7991 |
+diff --git a/drivers/media/i2c/ov2659.c b/drivers/media/i2c/ov2659.c |
7992 |
+index 4b6be3b0fd52..5cdda9d6ca31 100644 |
7993 |
+--- a/drivers/media/i2c/ov2659.c |
7994 |
++++ b/drivers/media/i2c/ov2659.c |
7995 |
+@@ -1136,7 +1136,7 @@ static int ov2659_set_fmt(struct v4l2_subdev *sd, |
7996 |
+ mf = v4l2_subdev_get_try_format(sd, cfg, fmt->pad); |
7997 |
+ *mf = fmt->format; |
7998 |
+ #else |
7999 |
+- return -ENOTTY; |
8000 |
++ ret = -ENOTTY; |
8001 |
+ #endif |
8002 |
+ } else { |
8003 |
+ s64 val; |
8004 |
+diff --git a/drivers/media/i2c/tw9910.c b/drivers/media/i2c/tw9910.c |
8005 |
+index a54548cc4285..c7321a70e3ed 100644 |
8006 |
+--- a/drivers/media/i2c/tw9910.c |
8007 |
++++ b/drivers/media/i2c/tw9910.c |
8008 |
+@@ -1000,7 +1000,7 @@ static int tw9910_remove(struct i2c_client *client) |
8009 |
+ if (priv->pdn_gpio) |
8010 |
+ gpiod_put(priv->pdn_gpio); |
8011 |
+ clk_put(priv->clk); |
8012 |
+- v4l2_device_unregister_subdev(&priv->subdev); |
8013 |
++ v4l2_async_unregister_subdev(&priv->subdev); |
8014 |
+ |
8015 |
+ return 0; |
8016 |
+ } |
8017 |
+diff --git a/drivers/media/pci/cx18/cx18-fileops.c b/drivers/media/pci/cx18/cx18-fileops.c |
8018 |
+index a3f44e30f821..88c2f3bea2b6 100644 |
8019 |
+--- a/drivers/media/pci/cx18/cx18-fileops.c |
8020 |
++++ b/drivers/media/pci/cx18/cx18-fileops.c |
8021 |
+@@ -484,7 +484,7 @@ static ssize_t cx18_read_pos(struct cx18_stream *s, char __user *ubuf, |
8022 |
+ |
8023 |
+ CX18_DEBUG_HI_FILE("read %zd from %s, got %zd\n", count, s->name, rc); |
8024 |
+ if (rc > 0) |
8025 |
+- pos += rc; |
8026 |
++ *pos += rc; |
8027 |
+ return rc; |
8028 |
+ } |
8029 |
+ |
8030 |
+diff --git a/drivers/media/pci/cx23885/cx23885-dvb.c b/drivers/media/pci/cx23885/cx23885-dvb.c |
8031 |
+index 7d52173073d6..bafcb3982274 100644 |
8032 |
+--- a/drivers/media/pci/cx23885/cx23885-dvb.c |
8033 |
++++ b/drivers/media/pci/cx23885/cx23885-dvb.c |
8034 |
+@@ -1474,8 +1474,9 @@ static int dvb_register(struct cx23885_tsport *port) |
8035 |
+ if (fe0->dvb.frontend != NULL) { |
8036 |
+ struct i2c_adapter *tun_i2c; |
8037 |
+ |
8038 |
+- fe0->dvb.frontend->sec_priv = kmalloc(sizeof(dib7000p_ops), GFP_KERNEL); |
8039 |
+- memcpy(fe0->dvb.frontend->sec_priv, &dib7000p_ops, sizeof(dib7000p_ops)); |
8040 |
++ fe0->dvb.frontend->sec_priv = kmemdup(&dib7000p_ops, sizeof(dib7000p_ops), GFP_KERNEL); |
8041 |
++ if (!fe0->dvb.frontend->sec_priv) |
8042 |
++ return -ENOMEM; |
8043 |
+ tun_i2c = dib7000p_ops.get_i2c_master(fe0->dvb.frontend, DIBX000_I2C_INTERFACE_TUNER, 1); |
8044 |
+ if (!dvb_attach(dib0070_attach, fe0->dvb.frontend, tun_i2c, &dib7070p_dib0070_config)) |
8045 |
+ return -ENODEV; |
8046 |
+diff --git a/drivers/media/pci/ivtv/ivtv-fileops.c b/drivers/media/pci/ivtv/ivtv-fileops.c |
8047 |
+index 6196daae4b3e..043ac0ae9ed0 100644 |
8048 |
+--- a/drivers/media/pci/ivtv/ivtv-fileops.c |
8049 |
++++ b/drivers/media/pci/ivtv/ivtv-fileops.c |
8050 |
+@@ -420,7 +420,7 @@ static ssize_t ivtv_read_pos(struct ivtv_stream *s, char __user *ubuf, size_t co |
8051 |
+ |
8052 |
+ IVTV_DEBUG_HI_FILE("read %zd from %s, got %zd\n", count, s->name, rc); |
8053 |
+ if (rc > 0) |
8054 |
+- pos += rc; |
8055 |
++ *pos += rc; |
8056 |
+ return rc; |
8057 |
+ } |
8058 |
+ |
8059 |
+diff --git a/drivers/media/pci/pt1/pt1.c b/drivers/media/pci/pt1/pt1.c |
8060 |
+index 7f878fc41b7e..93fecffb36ee 100644 |
8061 |
+--- a/drivers/media/pci/pt1/pt1.c |
8062 |
++++ b/drivers/media/pci/pt1/pt1.c |
8063 |
+@@ -200,16 +200,10 @@ static const u8 va1j5jf8007t_25mhz_configs[][2] = { |
8064 |
+ static int config_demod(struct i2c_client *cl, enum pt1_fe_clk clk) |
8065 |
+ { |
8066 |
+ int ret; |
8067 |
+- u8 buf[2] = {0x01, 0x80}; |
8068 |
+ bool is_sat; |
8069 |
+ const u8 (*cfg_data)[2]; |
8070 |
+ int i, len; |
8071 |
+ |
8072 |
+- ret = i2c_master_send(cl, buf, 2); |
8073 |
+- if (ret < 0) |
8074 |
+- return ret; |
8075 |
+- usleep_range(30000, 50000); |
8076 |
+- |
8077 |
+ is_sat = !strncmp(cl->name, TC90522_I2C_DEV_SAT, |
8078 |
+ strlen(TC90522_I2C_DEV_SAT)); |
8079 |
+ if (is_sat) { |
8080 |
+@@ -260,6 +254,46 @@ static int config_demod(struct i2c_client *cl, enum pt1_fe_clk clk) |
8081 |
+ return 0; |
8082 |
+ } |
8083 |
+ |
8084 |
++/* |
8085 |
++ * Init registers for (each pair of) terrestrial/satellite block in demod. |
8086 |
++ * Note that resetting terr. block also resets its peer sat. block as well. |
8087 |
++ * This function must be called before configuring any demod block |
8088 |
++ * (before pt1_wakeup(), fe->ops.init()). |
8089 |
++ */ |
8090 |
++static int pt1_demod_block_init(struct pt1 *pt1) |
8091 |
++{ |
8092 |
++ struct i2c_client *cl; |
8093 |
++ u8 buf[2] = {0x01, 0x80}; |
8094 |
++ int ret; |
8095 |
++ int i; |
8096 |
++ |
8097 |
++ /* reset all terr. & sat. pairs first */ |
8098 |
++ for (i = 0; i < PT1_NR_ADAPS; i++) { |
8099 |
++ cl = pt1->adaps[i]->demod_i2c_client; |
8100 |
++ if (strncmp(cl->name, TC90522_I2C_DEV_TER, |
8101 |
++ strlen(TC90522_I2C_DEV_TER))) |
8102 |
++ continue; |
8103 |
++ |
8104 |
++ ret = i2c_master_send(cl, buf, 2); |
8105 |
++ if (ret < 0) |
8106 |
++ return ret; |
8107 |
++ usleep_range(30000, 50000); |
8108 |
++ } |
8109 |
++ |
8110 |
++ for (i = 0; i < PT1_NR_ADAPS; i++) { |
8111 |
++ cl = pt1->adaps[i]->demod_i2c_client; |
8112 |
++ if (strncmp(cl->name, TC90522_I2C_DEV_SAT, |
8113 |
++ strlen(TC90522_I2C_DEV_SAT))) |
8114 |
++ continue; |
8115 |
++ |
8116 |
++ ret = i2c_master_send(cl, buf, 2); |
8117 |
++ if (ret < 0) |
8118 |
++ return ret; |
8119 |
++ usleep_range(30000, 50000); |
8120 |
++ } |
8121 |
++ return 0; |
8122 |
++} |
8123 |
++ |
8124 |
+ static void pt1_write_reg(struct pt1 *pt1, int reg, u32 data) |
8125 |
+ { |
8126 |
+ writel(data, pt1->regs + reg * 4); |
8127 |
+@@ -987,6 +1021,10 @@ static int pt1_init_frontends(struct pt1 *pt1) |
8128 |
+ goto tuner_release; |
8129 |
+ } |
8130 |
+ |
8131 |
++ ret = pt1_demod_block_init(pt1); |
8132 |
++ if (ret < 0) |
8133 |
++ goto fe_unregister; |
8134 |
++ |
8135 |
+ return 0; |
8136 |
+ |
8137 |
+ tuner_release: |
8138 |
+@@ -1245,6 +1283,10 @@ static int pt1_resume(struct device *dev) |
8139 |
+ pt1_update_power(pt1); |
8140 |
+ usleep_range(1000, 2000); |
8141 |
+ |
8142 |
++ ret = pt1_demod_block_init(pt1); |
8143 |
++ if (ret < 0) |
8144 |
++ goto resume_err; |
8145 |
++ |
8146 |
+ for (i = 0; i < PT1_NR_ADAPS; i++) |
8147 |
+ dvb_frontend_reinitialise(pt1->adaps[i]->fe); |
8148 |
+ |
8149 |
+diff --git a/drivers/media/pci/tw5864/tw5864-video.c b/drivers/media/pci/tw5864/tw5864-video.c |
8150 |
+index ff2b7da90c08..6c40e60ac993 100644 |
8151 |
+--- a/drivers/media/pci/tw5864/tw5864-video.c |
8152 |
++++ b/drivers/media/pci/tw5864/tw5864-video.c |
8153 |
+@@ -1395,13 +1395,13 @@ static void tw5864_handle_frame(struct tw5864_h264_frame *frame) |
8154 |
+ input->vb = NULL; |
8155 |
+ spin_unlock_irqrestore(&input->slock, flags); |
8156 |
+ |
8157 |
+- v4l2_buf = to_vb2_v4l2_buffer(&vb->vb.vb2_buf); |
8158 |
+- |
8159 |
+ if (!vb) { /* Gone because of disabling */ |
8160 |
+ dev_dbg(&dev->pci->dev, "vb is empty, dropping frame\n"); |
8161 |
+ return; |
8162 |
+ } |
8163 |
+ |
8164 |
++ v4l2_buf = to_vb2_v4l2_buffer(&vb->vb.vb2_buf); |
8165 |
++ |
8166 |
+ /* |
8167 |
+ * Check for space. |
8168 |
+ * Mind the overhead of startcode emulation prevention. |
8169 |
+diff --git a/drivers/media/platform/atmel/atmel-isi.c b/drivers/media/platform/atmel/atmel-isi.c |
8170 |
+index e8db4df1e7c4..1a0e5233ae28 100644 |
8171 |
+--- a/drivers/media/platform/atmel/atmel-isi.c |
8172 |
++++ b/drivers/media/platform/atmel/atmel-isi.c |
8173 |
+@@ -496,7 +496,7 @@ static void stop_streaming(struct vb2_queue *vq) |
8174 |
+ spin_unlock_irq(&isi->irqlock); |
8175 |
+ |
8176 |
+ if (!isi->enable_preview_path) { |
8177 |
+- timeout = jiffies + FRAME_INTERVAL_MILLI_SEC * HZ; |
8178 |
++ timeout = jiffies + (FRAME_INTERVAL_MILLI_SEC * HZ) / 1000; |
8179 |
+ /* Wait until the end of the current frame. */ |
8180 |
+ while ((isi_readl(isi, ISI_STATUS) & ISI_CTRL_CDC) && |
8181 |
+ time_before(jiffies, timeout)) |
8182 |
+diff --git a/drivers/media/platform/davinci/isif.c b/drivers/media/platform/davinci/isif.c |
8183 |
+index 340f8218f54d..80fa60a4c448 100644 |
8184 |
+--- a/drivers/media/platform/davinci/isif.c |
8185 |
++++ b/drivers/media/platform/davinci/isif.c |
8186 |
+@@ -884,9 +884,7 @@ static int isif_set_hw_if_params(struct vpfe_hw_if_param *params) |
8187 |
+ static int isif_config_ycbcr(void) |
8188 |
+ { |
8189 |
+ struct isif_ycbcr_config *params = &isif_cfg.ycbcr; |
8190 |
+- struct vpss_pg_frame_size frame_size; |
8191 |
+ u32 modeset = 0, ccdcfg = 0; |
8192 |
+- struct vpss_sync_pol sync; |
8193 |
+ |
8194 |
+ dev_dbg(isif_cfg.dev, "\nStarting isif_config_ycbcr..."); |
8195 |
+ |
8196 |
+@@ -974,13 +972,6 @@ static int isif_config_ycbcr(void) |
8197 |
+ /* two fields are interleaved in memory */ |
8198 |
+ regw(0x00000249, SDOFST); |
8199 |
+ |
8200 |
+- /* Setup test pattern if enabled */ |
8201 |
+- if (isif_cfg.bayer.config_params.test_pat_gen) { |
8202 |
+- sync.ccdpg_hdpol = params->hd_pol; |
8203 |
+- sync.ccdpg_vdpol = params->vd_pol; |
8204 |
+- dm365_vpss_set_sync_pol(sync); |
8205 |
+- dm365_vpss_set_pg_frame_size(frame_size); |
8206 |
+- } |
8207 |
+ return 0; |
8208 |
+ } |
8209 |
+ |
8210 |
+diff --git a/drivers/media/platform/davinci/vpbe.c b/drivers/media/platform/davinci/vpbe.c |
8211 |
+index df1ae6b5c854..e45e062f4442 100644 |
8212 |
+--- a/drivers/media/platform/davinci/vpbe.c |
8213 |
++++ b/drivers/media/platform/davinci/vpbe.c |
8214 |
+@@ -126,7 +126,7 @@ static int vpbe_enum_outputs(struct vpbe_device *vpbe_dev, |
8215 |
+ struct v4l2_output *output) |
8216 |
+ { |
8217 |
+ struct vpbe_config *cfg = vpbe_dev->cfg; |
8218 |
+- int temp_index = output->index; |
8219 |
++ unsigned int temp_index = output->index; |
8220 |
+ |
8221 |
+ if (temp_index >= cfg->num_outputs) |
8222 |
+ return -EINVAL; |
8223 |
+diff --git a/drivers/media/platform/omap/omap_vout.c b/drivers/media/platform/omap/omap_vout.c |
8224 |
+index 5700b7818621..45511d24d570 100644 |
8225 |
+--- a/drivers/media/platform/omap/omap_vout.c |
8226 |
++++ b/drivers/media/platform/omap/omap_vout.c |
8227 |
+@@ -1527,23 +1527,20 @@ static int vidioc_dqbuf(struct file *file, void *fh, struct v4l2_buffer *b) |
8228 |
+ unsigned long size; |
8229 |
+ struct videobuf_buffer *vb; |
8230 |
+ |
8231 |
+- vb = q->bufs[b->index]; |
8232 |
+- |
8233 |
+ if (!vout->streaming) |
8234 |
+ return -EINVAL; |
8235 |
+ |
8236 |
+- if (file->f_flags & O_NONBLOCK) |
8237 |
+- /* Call videobuf_dqbuf for non blocking mode */ |
8238 |
+- ret = videobuf_dqbuf(q, (struct v4l2_buffer *)b, 1); |
8239 |
+- else |
8240 |
+- /* Call videobuf_dqbuf for blocking mode */ |
8241 |
+- ret = videobuf_dqbuf(q, (struct v4l2_buffer *)b, 0); |
8242 |
++ ret = videobuf_dqbuf(q, b, !!(file->f_flags & O_NONBLOCK)); |
8243 |
++ if (ret) |
8244 |
++ return ret; |
8245 |
++ |
8246 |
++ vb = q->bufs[b->index]; |
8247 |
+ |
8248 |
+ addr = (unsigned long) vout->buf_phy_addr[vb->i]; |
8249 |
+ size = (unsigned long) vb->size; |
8250 |
+ dma_unmap_single(vout->vid_dev->v4l2_dev.dev, addr, |
8251 |
+ size, DMA_TO_DEVICE); |
8252 |
+- return ret; |
8253 |
++ return 0; |
8254 |
+ } |
8255 |
+ |
8256 |
+ static int vidioc_streamon(struct file *file, void *fh, enum v4l2_buf_type i) |
8257 |
+diff --git a/drivers/media/platform/rcar-vin/rcar-core.c b/drivers/media/platform/rcar-vin/rcar-core.c |
8258 |
+index 485fa3fa8b49..c389ba9ba74d 100644 |
8259 |
+--- a/drivers/media/platform/rcar-vin/rcar-core.c |
8260 |
++++ b/drivers/media/platform/rcar-vin/rcar-core.c |
8261 |
+@@ -631,7 +631,7 @@ static int rvin_parallel_init(struct rvin_dev *vin) |
8262 |
+ ret = v4l2_async_notifier_register(&vin->v4l2_dev, &vin->notifier); |
8263 |
+ if (ret < 0) { |
8264 |
+ vin_err(vin, "Notifier registration failed\n"); |
8265 |
+- v4l2_async_notifier_cleanup(&vin->group->notifier); |
8266 |
++ v4l2_async_notifier_cleanup(&vin->notifier); |
8267 |
+ return ret; |
8268 |
+ } |
8269 |
+ |
8270 |
+diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c |
8271 |
+index 350afaa29a62..fa7c42cf4b4e 100644 |
8272 |
+--- a/drivers/media/platform/s5p-jpeg/jpeg-core.c |
8273 |
++++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c |
8274 |
+@@ -2005,7 +2005,7 @@ static int s5p_jpeg_controls_create(struct s5p_jpeg_ctx *ctx) |
8275 |
+ |
8276 |
+ v4l2_ctrl_new_std(&ctx->ctrl_handler, &s5p_jpeg_ctrl_ops, |
8277 |
+ V4L2_CID_JPEG_RESTART_INTERVAL, |
8278 |
+- 0, 3, 0xffff, 0); |
8279 |
++ 0, 0xffff, 1, 0); |
8280 |
+ if (ctx->jpeg->variant->version == SJPEG_S5P) |
8281 |
+ mask = ~0x06; /* 422, 420 */ |
8282 |
+ } |
8283 |
+diff --git a/drivers/media/platform/vivid/vivid-osd.c b/drivers/media/platform/vivid/vivid-osd.c |
8284 |
+index bbbc1b6938a5..b24596697f57 100644 |
8285 |
+--- a/drivers/media/platform/vivid/vivid-osd.c |
8286 |
++++ b/drivers/media/platform/vivid/vivid-osd.c |
8287 |
+@@ -155,7 +155,7 @@ static int _vivid_fb_check_var(struct fb_var_screeninfo *var, struct vivid_dev * |
8288 |
+ var->nonstd = 0; |
8289 |
+ |
8290 |
+ var->vmode &= ~FB_VMODE_MASK; |
8291 |
+- var->vmode = FB_VMODE_NONINTERLACED; |
8292 |
++ var->vmode |= FB_VMODE_NONINTERLACED; |
8293 |
+ |
8294 |
+ /* Dummy values */ |
8295 |
+ var->hsync_len = 24; |
8296 |
+diff --git a/drivers/media/radio/wl128x/fmdrv_common.c b/drivers/media/radio/wl128x/fmdrv_common.c |
8297 |
+index 1cf4019689a5..cccf1a743f4e 100644 |
8298 |
+--- a/drivers/media/radio/wl128x/fmdrv_common.c |
8299 |
++++ b/drivers/media/radio/wl128x/fmdrv_common.c |
8300 |
+@@ -1271,8 +1271,9 @@ static int fm_download_firmware(struct fmdev *fmdev, const u8 *fw_name) |
8301 |
+ |
8302 |
+ switch (action->type) { |
8303 |
+ case ACTION_SEND_COMMAND: /* Send */ |
8304 |
+- if (fmc_send_cmd(fmdev, 0, 0, action->data, |
8305 |
+- action->size, NULL, NULL)) |
8306 |
++ ret = fmc_send_cmd(fmdev, 0, 0, action->data, |
8307 |
++ action->size, NULL, NULL); |
8308 |
++ if (ret) |
8309 |
+ goto rel_fw; |
8310 |
+ |
8311 |
+ cmd_cnt++; |
8312 |
+diff --git a/drivers/media/usb/em28xx/em28xx-core.c b/drivers/media/usb/em28xx/em28xx-core.c |
8313 |
+index 5657f8710ca6..69445c8e38e2 100644 |
8314 |
+--- a/drivers/media/usb/em28xx/em28xx-core.c |
8315 |
++++ b/drivers/media/usb/em28xx/em28xx-core.c |
8316 |
+@@ -930,7 +930,7 @@ int em28xx_alloc_urbs(struct em28xx *dev, enum em28xx_mode mode, int xfer_bulk, |
8317 |
+ |
8318 |
+ usb_bufs->buf = kcalloc(num_bufs, sizeof(void *), GFP_KERNEL); |
8319 |
+ if (!usb_bufs->buf) { |
8320 |
+- kfree(usb_bufs->buf); |
8321 |
++ kfree(usb_bufs->urb); |
8322 |
+ return -ENOMEM; |
8323 |
+ } |
8324 |
+ |
8325 |
+diff --git a/drivers/memory/tegra/mc.c b/drivers/memory/tegra/mc.c |
8326 |
+index c8f16666256c..346d8eadb44b 100644 |
8327 |
+--- a/drivers/memory/tegra/mc.c |
8328 |
++++ b/drivers/memory/tegra/mc.c |
8329 |
+@@ -664,12 +664,13 @@ static int tegra_mc_probe(struct platform_device *pdev) |
8330 |
+ } |
8331 |
+ |
8332 |
+ isr = tegra_mc_irq; |
8333 |
+- } |
8334 |
+ |
8335 |
+- err = tegra_mc_setup_timings(mc); |
8336 |
+- if (err < 0) { |
8337 |
+- dev_err(&pdev->dev, "failed to setup timings: %d\n", err); |
8338 |
+- return err; |
8339 |
++ err = tegra_mc_setup_timings(mc); |
8340 |
++ if (err < 0) { |
8341 |
++ dev_err(&pdev->dev, "failed to setup timings: %d\n", |
8342 |
++ err); |
8343 |
++ return err; |
8344 |
++ } |
8345 |
+ } |
8346 |
+ |
8347 |
+ mc->irq = platform_get_irq(pdev, 0); |
8348 |
+diff --git a/drivers/mfd/intel-lpss-pci.c b/drivers/mfd/intel-lpss-pci.c |
8349 |
+index c37c8bb86068..742d6c1973f4 100644 |
8350 |
+--- a/drivers/mfd/intel-lpss-pci.c |
8351 |
++++ b/drivers/mfd/intel-lpss-pci.c |
8352 |
+@@ -126,6 +126,18 @@ static const struct intel_lpss_platform_info apl_i2c_info = { |
8353 |
+ .properties = apl_i2c_properties, |
8354 |
+ }; |
8355 |
+ |
8356 |
++static struct property_entry glk_i2c_properties[] = { |
8357 |
++ PROPERTY_ENTRY_U32("i2c-sda-hold-time-ns", 313), |
8358 |
++ PROPERTY_ENTRY_U32("i2c-sda-falling-time-ns", 171), |
8359 |
++ PROPERTY_ENTRY_U32("i2c-scl-falling-time-ns", 290), |
8360 |
++ { }, |
8361 |
++}; |
8362 |
++ |
8363 |
++static const struct intel_lpss_platform_info glk_i2c_info = { |
8364 |
++ .clk_rate = 133000000, |
8365 |
++ .properties = glk_i2c_properties, |
8366 |
++}; |
8367 |
++ |
8368 |
+ static const struct intel_lpss_platform_info cnl_i2c_info = { |
8369 |
+ .clk_rate = 216000000, |
8370 |
+ .properties = spt_i2c_properties, |
8371 |
+@@ -165,14 +177,14 @@ static const struct pci_device_id intel_lpss_pci_ids[] = { |
8372 |
+ { PCI_VDEVICE(INTEL, 0x1ac6), (kernel_ulong_t)&bxt_info }, |
8373 |
+ { PCI_VDEVICE(INTEL, 0x1aee), (kernel_ulong_t)&bxt_uart_info }, |
8374 |
+ /* GLK */ |
8375 |
+- { PCI_VDEVICE(INTEL, 0x31ac), (kernel_ulong_t)&bxt_i2c_info }, |
8376 |
+- { PCI_VDEVICE(INTEL, 0x31ae), (kernel_ulong_t)&bxt_i2c_info }, |
8377 |
+- { PCI_VDEVICE(INTEL, 0x31b0), (kernel_ulong_t)&bxt_i2c_info }, |
8378 |
+- { PCI_VDEVICE(INTEL, 0x31b2), (kernel_ulong_t)&bxt_i2c_info }, |
8379 |
+- { PCI_VDEVICE(INTEL, 0x31b4), (kernel_ulong_t)&bxt_i2c_info }, |
8380 |
+- { PCI_VDEVICE(INTEL, 0x31b6), (kernel_ulong_t)&bxt_i2c_info }, |
8381 |
+- { PCI_VDEVICE(INTEL, 0x31b8), (kernel_ulong_t)&bxt_i2c_info }, |
8382 |
+- { PCI_VDEVICE(INTEL, 0x31ba), (kernel_ulong_t)&bxt_i2c_info }, |
8383 |
++ { PCI_VDEVICE(INTEL, 0x31ac), (kernel_ulong_t)&glk_i2c_info }, |
8384 |
++ { PCI_VDEVICE(INTEL, 0x31ae), (kernel_ulong_t)&glk_i2c_info }, |
8385 |
++ { PCI_VDEVICE(INTEL, 0x31b0), (kernel_ulong_t)&glk_i2c_info }, |
8386 |
++ { PCI_VDEVICE(INTEL, 0x31b2), (kernel_ulong_t)&glk_i2c_info }, |
8387 |
++ { PCI_VDEVICE(INTEL, 0x31b4), (kernel_ulong_t)&glk_i2c_info }, |
8388 |
++ { PCI_VDEVICE(INTEL, 0x31b6), (kernel_ulong_t)&glk_i2c_info }, |
8389 |
++ { PCI_VDEVICE(INTEL, 0x31b8), (kernel_ulong_t)&glk_i2c_info }, |
8390 |
++ { PCI_VDEVICE(INTEL, 0x31ba), (kernel_ulong_t)&glk_i2c_info }, |
8391 |
+ { PCI_VDEVICE(INTEL, 0x31bc), (kernel_ulong_t)&bxt_uart_info }, |
8392 |
+ { PCI_VDEVICE(INTEL, 0x31be), (kernel_ulong_t)&bxt_uart_info }, |
8393 |
+ { PCI_VDEVICE(INTEL, 0x31c0), (kernel_ulong_t)&bxt_uart_info }, |
8394 |
+diff --git a/drivers/mfd/intel-lpss.c b/drivers/mfd/intel-lpss.c |
8395 |
+index ff3fba16e735..95e217e6b6d7 100644 |
8396 |
+--- a/drivers/mfd/intel-lpss.c |
8397 |
++++ b/drivers/mfd/intel-lpss.c |
8398 |
+@@ -545,6 +545,7 @@ module_init(intel_lpss_init); |
8399 |
+ |
8400 |
+ static void __exit intel_lpss_exit(void) |
8401 |
+ { |
8402 |
++ ida_destroy(&intel_lpss_devid_ida); |
8403 |
+ debugfs_remove(intel_lpss_debugfs); |
8404 |
+ } |
8405 |
+ module_exit(intel_lpss_exit); |
8406 |
+diff --git a/drivers/misc/aspeed-lpc-snoop.c b/drivers/misc/aspeed-lpc-snoop.c |
8407 |
+index 2feb4347d67f..c10be21a1663 100644 |
8408 |
+--- a/drivers/misc/aspeed-lpc-snoop.c |
8409 |
++++ b/drivers/misc/aspeed-lpc-snoop.c |
8410 |
+@@ -101,13 +101,13 @@ static ssize_t snoop_file_read(struct file *file, char __user *buffer, |
8411 |
+ return ret ? ret : copied; |
8412 |
+ } |
8413 |
+ |
8414 |
+-static unsigned int snoop_file_poll(struct file *file, |
8415 |
++static __poll_t snoop_file_poll(struct file *file, |
8416 |
+ struct poll_table_struct *pt) |
8417 |
+ { |
8418 |
+ struct aspeed_lpc_snoop_channel *chan = snoop_file_to_chan(file); |
8419 |
+ |
8420 |
+ poll_wait(file, &chan->wq, pt); |
8421 |
+- return !kfifo_is_empty(&chan->fifo) ? POLLIN : 0; |
8422 |
++ return !kfifo_is_empty(&chan->fifo) ? EPOLLIN : 0; |
8423 |
+ } |
8424 |
+ |
8425 |
+ static const struct file_operations snoop_fops = { |
8426 |
+diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c |
8427 |
+index 4d77a6ae183a..87281b3695e6 100644 |
8428 |
+--- a/drivers/misc/mei/main.c |
8429 |
++++ b/drivers/misc/mei/main.c |
8430 |
+@@ -599,10 +599,10 @@ static __poll_t mei_poll(struct file *file, poll_table *wait) |
8431 |
+ mei_cl_read_start(cl, mei_cl_mtu(cl), file); |
8432 |
+ } |
8433 |
+ |
8434 |
+- if (req_events & (POLLOUT | POLLWRNORM)) { |
8435 |
++ if (req_events & (EPOLLOUT | EPOLLWRNORM)) { |
8436 |
+ poll_wait(file, &cl->tx_wait, wait); |
8437 |
+ if (cl->tx_cb_queued < dev->tx_queue_limit) |
8438 |
+- mask |= POLLOUT | POLLWRNORM; |
8439 |
++ mask |= EPOLLOUT | EPOLLWRNORM; |
8440 |
+ } |
8441 |
+ |
8442 |
+ out: |
8443 |
+diff --git a/drivers/misc/mic/card/mic_x100.c b/drivers/misc/mic/card/mic_x100.c |
8444 |
+index b9f0710ffa6b..4007adc666f3 100644 |
8445 |
+--- a/drivers/misc/mic/card/mic_x100.c |
8446 |
++++ b/drivers/misc/mic/card/mic_x100.c |
8447 |
+@@ -249,6 +249,9 @@ static int __init mic_probe(struct platform_device *pdev) |
8448 |
+ mdrv->dev = &pdev->dev; |
8449 |
+ snprintf(mdrv->name, sizeof(mic_driver_name), mic_driver_name); |
8450 |
+ |
8451 |
++ /* FIXME: use dma_set_mask_and_coherent() and check result */ |
8452 |
++ dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); |
8453 |
++ |
8454 |
+ mdev->mmio.pa = MIC_X100_MMIO_BASE; |
8455 |
+ mdev->mmio.len = MIC_X100_MMIO_LEN; |
8456 |
+ mdev->mmio.va = devm_ioremap(&pdev->dev, MIC_X100_MMIO_BASE, |
8457 |
+@@ -294,18 +297,6 @@ static void mic_platform_shutdown(struct platform_device *pdev) |
8458 |
+ mic_remove(pdev); |
8459 |
+ } |
8460 |
+ |
8461 |
+-static u64 mic_dma_mask = DMA_BIT_MASK(64); |
8462 |
+- |
8463 |
+-static struct platform_device mic_platform_dev = { |
8464 |
+- .name = mic_driver_name, |
8465 |
+- .id = 0, |
8466 |
+- .num_resources = 0, |
8467 |
+- .dev = { |
8468 |
+- .dma_mask = &mic_dma_mask, |
8469 |
+- .coherent_dma_mask = DMA_BIT_MASK(64), |
8470 |
+- }, |
8471 |
+-}; |
8472 |
+- |
8473 |
+ static struct platform_driver __refdata mic_platform_driver = { |
8474 |
+ .probe = mic_probe, |
8475 |
+ .remove = mic_remove, |
8476 |
+@@ -315,6 +306,8 @@ static struct platform_driver __refdata mic_platform_driver = { |
8477 |
+ }, |
8478 |
+ }; |
8479 |
+ |
8480 |
++static struct platform_device *mic_platform_dev; |
8481 |
++ |
8482 |
+ static int __init mic_init(void) |
8483 |
+ { |
8484 |
+ int ret; |
8485 |
+@@ -328,9 +321,12 @@ static int __init mic_init(void) |
8486 |
+ |
8487 |
+ request_module("mic_x100_dma"); |
8488 |
+ mic_init_card_debugfs(); |
8489 |
+- ret = platform_device_register(&mic_platform_dev); |
8490 |
++ |
8491 |
++ mic_platform_dev = platform_device_register_simple(mic_driver_name, |
8492 |
++ 0, NULL, 0); |
8493 |
++ ret = PTR_ERR_OR_ZERO(mic_platform_dev); |
8494 |
+ if (ret) { |
8495 |
+- pr_err("platform_device_register ret %d\n", ret); |
8496 |
++ pr_err("platform_device_register_full ret %d\n", ret); |
8497 |
+ goto cleanup_debugfs; |
8498 |
+ } |
8499 |
+ ret = platform_driver_register(&mic_platform_driver); |
8500 |
+@@ -341,7 +337,7 @@ static int __init mic_init(void) |
8501 |
+ return ret; |
8502 |
+ |
8503 |
+ device_unregister: |
8504 |
+- platform_device_unregister(&mic_platform_dev); |
8505 |
++ platform_device_unregister(mic_platform_dev); |
8506 |
+ cleanup_debugfs: |
8507 |
+ mic_exit_card_debugfs(); |
8508 |
+ done: |
8509 |
+@@ -351,7 +347,7 @@ done: |
8510 |
+ static void __exit mic_exit(void) |
8511 |
+ { |
8512 |
+ platform_driver_unregister(&mic_platform_driver); |
8513 |
+- platform_device_unregister(&mic_platform_dev); |
8514 |
++ platform_device_unregister(mic_platform_dev); |
8515 |
+ mic_exit_card_debugfs(); |
8516 |
+ } |
8517 |
+ |
8518 |
+diff --git a/drivers/misc/sgi-xp/xpc_partition.c b/drivers/misc/sgi-xp/xpc_partition.c |
8519 |
+index 0c3ef6f1df54..519826ba1378 100644 |
8520 |
+--- a/drivers/misc/sgi-xp/xpc_partition.c |
8521 |
++++ b/drivers/misc/sgi-xp/xpc_partition.c |
8522 |
+@@ -70,7 +70,7 @@ xpc_get_rsvd_page_pa(int nasid) |
8523 |
+ unsigned long rp_pa = nasid; /* seed with nasid */ |
8524 |
+ size_t len = 0; |
8525 |
+ size_t buf_len = 0; |
8526 |
+- void *buf = buf; |
8527 |
++ void *buf = NULL; |
8528 |
+ void *buf_base = NULL; |
8529 |
+ enum xp_retval (*get_partition_rsvd_page_pa) |
8530 |
+ (void *, u64 *, unsigned long *, size_t *) = |
8531 |
+diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c |
8532 |
+index f57f5de54206..dd1c14d8f686 100644 |
8533 |
+--- a/drivers/mmc/core/host.c |
8534 |
++++ b/drivers/mmc/core/host.c |
8535 |
+@@ -385,8 +385,6 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev) |
8536 |
+ |
8537 |
+ if (mmc_gpio_alloc(host)) { |
8538 |
+ put_device(&host->class_dev); |
8539 |
+- ida_simple_remove(&mmc_host_ida, host->index); |
8540 |
+- kfree(host); |
8541 |
+ return NULL; |
8542 |
+ } |
8543 |
+ |
8544 |
+diff --git a/drivers/mmc/core/quirks.h b/drivers/mmc/core/quirks.h |
8545 |
+index dd2f73af8f2c..d5bbe8e544de 100644 |
8546 |
+--- a/drivers/mmc/core/quirks.h |
8547 |
++++ b/drivers/mmc/core/quirks.h |
8548 |
+@@ -119,7 +119,14 @@ static const struct mmc_fixup mmc_ext_csd_fixups[] = { |
8549 |
+ END_FIXUP |
8550 |
+ }; |
8551 |
+ |
8552 |
++ |
8553 |
+ static const struct mmc_fixup sdio_fixup_methods[] = { |
8554 |
++ SDIO_FIXUP(SDIO_VENDOR_ID_TI_WL1251, SDIO_DEVICE_ID_TI_WL1251, |
8555 |
++ add_quirk, MMC_QUIRK_NONSTD_FUNC_IF), |
8556 |
++ |
8557 |
++ SDIO_FIXUP(SDIO_VENDOR_ID_TI_WL1251, SDIO_DEVICE_ID_TI_WL1251, |
8558 |
++ add_quirk, MMC_QUIRK_DISABLE_CD), |
8559 |
++ |
8560 |
+ SDIO_FIXUP(SDIO_VENDOR_ID_TI, SDIO_DEVICE_ID_TI_WL1271, |
8561 |
+ add_quirk, MMC_QUIRK_NONSTD_FUNC_IF), |
8562 |
+ |
8563 |
+diff --git a/drivers/mmc/host/sdhci-brcmstb.c b/drivers/mmc/host/sdhci-brcmstb.c |
8564 |
+index 552bddc5096c..1cd10356fc14 100644 |
8565 |
+--- a/drivers/mmc/host/sdhci-brcmstb.c |
8566 |
++++ b/drivers/mmc/host/sdhci-brcmstb.c |
8567 |
+@@ -55,7 +55,9 @@ static int sdhci_brcmstb_probe(struct platform_device *pdev) |
8568 |
+ } |
8569 |
+ |
8570 |
+ sdhci_get_of_property(pdev); |
8571 |
+- mmc_of_parse(host->mmc); |
8572 |
++ res = mmc_of_parse(host->mmc); |
8573 |
++ if (res) |
8574 |
++ goto err; |
8575 |
+ |
8576 |
+ /* |
8577 |
+ * Supply the existing CAPS, but clear the UHS modes. This |
8578 |
+diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c |
8579 |
+index 2d3a2cb026d2..9f21e710fc38 100644 |
8580 |
+--- a/drivers/net/dsa/b53/b53_common.c |
8581 |
++++ b/drivers/net/dsa/b53/b53_common.c |
8582 |
+@@ -343,7 +343,8 @@ static void b53_set_forwarding(struct b53_device *dev, int enable) |
8583 |
+ b53_write8(dev, B53_CTRL_PAGE, B53_SWITCH_CTRL, mgmt); |
8584 |
+ } |
8585 |
+ |
8586 |
+-static void b53_enable_vlan(struct b53_device *dev, bool enable) |
8587 |
++static void b53_enable_vlan(struct b53_device *dev, bool enable, |
8588 |
++ bool enable_filtering) |
8589 |
+ { |
8590 |
+ u8 mgmt, vc0, vc1, vc4 = 0, vc5; |
8591 |
+ |
8592 |
+@@ -368,8 +369,13 @@ static void b53_enable_vlan(struct b53_device *dev, bool enable) |
8593 |
+ vc0 |= VC0_VLAN_EN | VC0_VID_CHK_EN | VC0_VID_HASH_VID; |
8594 |
+ vc1 |= VC1_RX_MCST_UNTAG_EN | VC1_RX_MCST_FWD_EN; |
8595 |
+ vc4 &= ~VC4_ING_VID_CHECK_MASK; |
8596 |
+- vc4 |= VC4_ING_VID_VIO_DROP << VC4_ING_VID_CHECK_S; |
8597 |
+- vc5 |= VC5_DROP_VTABLE_MISS; |
8598 |
++ if (enable_filtering) { |
8599 |
++ vc4 |= VC4_ING_VID_VIO_DROP << VC4_ING_VID_CHECK_S; |
8600 |
++ vc5 |= VC5_DROP_VTABLE_MISS; |
8601 |
++ } else { |
8602 |
++ vc4 |= VC4_ING_VID_VIO_FWD << VC4_ING_VID_CHECK_S; |
8603 |
++ vc5 &= ~VC5_DROP_VTABLE_MISS; |
8604 |
++ } |
8605 |
+ |
8606 |
+ if (is5325(dev)) |
8607 |
+ vc0 &= ~VC0_RESERVED_1; |
8608 |
+@@ -419,6 +425,9 @@ static void b53_enable_vlan(struct b53_device *dev, bool enable) |
8609 |
+ } |
8610 |
+ |
8611 |
+ b53_write8(dev, B53_CTRL_PAGE, B53_SWITCH_MODE, mgmt); |
8612 |
++ |
8613 |
++ dev->vlan_enabled = enable; |
8614 |
++ dev->vlan_filtering_enabled = enable_filtering; |
8615 |
+ } |
8616 |
+ |
8617 |
+ static int b53_set_jumbo(struct b53_device *dev, bool enable, bool allow_10_100) |
8618 |
+@@ -622,25 +631,35 @@ static void b53_enable_mib(struct b53_device *dev) |
8619 |
+ b53_write8(dev, B53_MGMT_PAGE, B53_GLOBAL_CONFIG, gc); |
8620 |
+ } |
8621 |
+ |
8622 |
++static u16 b53_default_pvid(struct b53_device *dev) |
8623 |
++{ |
8624 |
++ if (is5325(dev) || is5365(dev)) |
8625 |
++ return 1; |
8626 |
++ else |
8627 |
++ return 0; |
8628 |
++} |
8629 |
++ |
8630 |
+ int b53_configure_vlan(struct dsa_switch *ds) |
8631 |
+ { |
8632 |
+ struct b53_device *dev = ds->priv; |
8633 |
+ struct b53_vlan vl = { 0 }; |
8634 |
+- int i; |
8635 |
++ int i, def_vid; |
8636 |
++ |
8637 |
++ def_vid = b53_default_pvid(dev); |
8638 |
+ |
8639 |
+ /* clear all vlan entries */ |
8640 |
+ if (is5325(dev) || is5365(dev)) { |
8641 |
+- for (i = 1; i < dev->num_vlans; i++) |
8642 |
++ for (i = def_vid; i < dev->num_vlans; i++) |
8643 |
+ b53_set_vlan_entry(dev, i, &vl); |
8644 |
+ } else { |
8645 |
+ b53_do_vlan_op(dev, VTA_CMD_CLEAR); |
8646 |
+ } |
8647 |
+ |
8648 |
+- b53_enable_vlan(dev, false); |
8649 |
++ b53_enable_vlan(dev, false, dev->vlan_filtering_enabled); |
8650 |
+ |
8651 |
+ b53_for_each_port(dev, i) |
8652 |
+ b53_write16(dev, B53_VLAN_PAGE, |
8653 |
+- B53_VLAN_PORT_DEF_TAG(i), 1); |
8654 |
++ B53_VLAN_PORT_DEF_TAG(i), def_vid); |
8655 |
+ |
8656 |
+ if (!is5325(dev) && !is5365(dev)) |
8657 |
+ b53_set_jumbo(dev, dev->enable_jumbo, false); |
8658 |
+@@ -1071,6 +1090,46 @@ static void b53_adjust_link(struct dsa_switch *ds, int port, |
8659 |
+ |
8660 |
+ int b53_vlan_filtering(struct dsa_switch *ds, int port, bool vlan_filtering) |
8661 |
+ { |
8662 |
++ struct b53_device *dev = ds->priv; |
8663 |
++ struct net_device *bridge_dev; |
8664 |
++ unsigned int i; |
8665 |
++ u16 pvid, new_pvid; |
8666 |
++ |
8667 |
++ /* Handle the case were multiple bridges span the same switch device |
8668 |
++ * and one of them has a different setting than what is being requested |
8669 |
++ * which would be breaking filtering semantics for any of the other |
8670 |
++ * bridge devices. |
8671 |
++ */ |
8672 |
++ b53_for_each_port(dev, i) { |
8673 |
++ bridge_dev = dsa_to_port(ds, i)->bridge_dev; |
8674 |
++ if (bridge_dev && |
8675 |
++ bridge_dev != dsa_to_port(ds, port)->bridge_dev && |
8676 |
++ br_vlan_enabled(bridge_dev) != vlan_filtering) { |
8677 |
++ netdev_err(bridge_dev, |
8678 |
++ "VLAN filtering is global to the switch!\n"); |
8679 |
++ return -EINVAL; |
8680 |
++ } |
8681 |
++ } |
8682 |
++ |
8683 |
++ b53_read16(dev, B53_VLAN_PAGE, B53_VLAN_PORT_DEF_TAG(port), &pvid); |
8684 |
++ new_pvid = pvid; |
8685 |
++ if (dev->vlan_filtering_enabled && !vlan_filtering) { |
8686 |
++ /* Filtering is currently enabled, use the default PVID since |
8687 |
++ * the bridge does not expect tagging anymore |
8688 |
++ */ |
8689 |
++ dev->ports[port].pvid = pvid; |
8690 |
++ new_pvid = b53_default_pvid(dev); |
8691 |
++ } else if (!dev->vlan_filtering_enabled && vlan_filtering) { |
8692 |
++ /* Filtering is currently disabled, restore the previous PVID */ |
8693 |
++ new_pvid = dev->ports[port].pvid; |
8694 |
++ } |
8695 |
++ |
8696 |
++ if (pvid != new_pvid) |
8697 |
++ b53_write16(dev, B53_VLAN_PAGE, B53_VLAN_PORT_DEF_TAG(port), |
8698 |
++ new_pvid); |
8699 |
++ |
8700 |
++ b53_enable_vlan(dev, dev->vlan_enabled, vlan_filtering); |
8701 |
++ |
8702 |
+ return 0; |
8703 |
+ } |
8704 |
+ EXPORT_SYMBOL(b53_vlan_filtering); |
8705 |
+@@ -1086,7 +1145,7 @@ int b53_vlan_prepare(struct dsa_switch *ds, int port, |
8706 |
+ if (vlan->vid_end > dev->num_vlans) |
8707 |
+ return -ERANGE; |
8708 |
+ |
8709 |
+- b53_enable_vlan(dev, true); |
8710 |
++ b53_enable_vlan(dev, true, dev->vlan_filtering_enabled); |
8711 |
+ |
8712 |
+ return 0; |
8713 |
+ } |
8714 |
+@@ -1116,7 +1175,7 @@ void b53_vlan_add(struct dsa_switch *ds, int port, |
8715 |
+ b53_fast_age_vlan(dev, vid); |
8716 |
+ } |
8717 |
+ |
8718 |
+- if (pvid) { |
8719 |
++ if (pvid && !dsa_is_cpu_port(ds, port)) { |
8720 |
+ b53_write16(dev, B53_VLAN_PAGE, B53_VLAN_PORT_DEF_TAG(port), |
8721 |
+ vlan->vid_end); |
8722 |
+ b53_fast_age_vlan(dev, vid); |
8723 |
+@@ -1142,12 +1201,8 @@ int b53_vlan_del(struct dsa_switch *ds, int port, |
8724 |
+ |
8725 |
+ vl->members &= ~BIT(port); |
8726 |
+ |
8727 |
+- if (pvid == vid) { |
8728 |
+- if (is5325(dev) || is5365(dev)) |
8729 |
+- pvid = 1; |
8730 |
+- else |
8731 |
+- pvid = 0; |
8732 |
+- } |
8733 |
++ if (pvid == vid) |
8734 |
++ pvid = b53_default_pvid(dev); |
8735 |
+ |
8736 |
+ if (untagged && !dsa_is_cpu_port(ds, port)) |
8737 |
+ vl->untag &= ~(BIT(port)); |
8738 |
+@@ -1460,10 +1515,7 @@ void b53_br_leave(struct dsa_switch *ds, int port, struct net_device *br) |
8739 |
+ b53_write16(dev, B53_PVLAN_PAGE, B53_PVLAN_PORT_MASK(port), pvlan); |
8740 |
+ dev->ports[port].vlan_ctl_mask = pvlan; |
8741 |
+ |
8742 |
+- if (is5325(dev) || is5365(dev)) |
8743 |
+- pvid = 1; |
8744 |
+- else |
8745 |
+- pvid = 0; |
8746 |
++ pvid = b53_default_pvid(dev); |
8747 |
+ |
8748 |
+ /* Make this port join all VLANs without VLAN entries */ |
8749 |
+ if (is58xx(dev)) { |
8750 |
+diff --git a/drivers/net/dsa/b53/b53_priv.h b/drivers/net/dsa/b53/b53_priv.h |
8751 |
+index df149756c282..e87af5db0d6d 100644 |
8752 |
+--- a/drivers/net/dsa/b53/b53_priv.h |
8753 |
++++ b/drivers/net/dsa/b53/b53_priv.h |
8754 |
+@@ -73,6 +73,7 @@ enum { |
8755 |
+ struct b53_port { |
8756 |
+ u16 vlan_ctl_mask; |
8757 |
+ struct ethtool_eee eee; |
8758 |
++ u16 pvid; |
8759 |
+ }; |
8760 |
+ |
8761 |
+ struct b53_vlan { |
8762 |
+@@ -118,6 +119,8 @@ struct b53_device { |
8763 |
+ |
8764 |
+ unsigned int num_vlans; |
8765 |
+ struct b53_vlan *vlans; |
8766 |
++ bool vlan_enabled; |
8767 |
++ bool vlan_filtering_enabled; |
8768 |
+ unsigned int num_ports; |
8769 |
+ struct b53_port *ports; |
8770 |
+ }; |
8771 |
+diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c |
8772 |
+index 33232cc9fb04..6c04f32e9641 100644 |
8773 |
+--- a/drivers/net/dsa/qca8k.c |
8774 |
++++ b/drivers/net/dsa/qca8k.c |
8775 |
+@@ -451,6 +451,18 @@ qca8k_set_pad_ctrl(struct qca8k_priv *priv, int port, int mode) |
8776 |
+ qca8k_write(priv, QCA8K_REG_PORT5_PAD_CTRL, |
8777 |
+ QCA8K_PORT_PAD_RGMII_RX_DELAY_EN); |
8778 |
+ break; |
8779 |
++ case PHY_INTERFACE_MODE_RGMII_ID: |
8780 |
++ /* RGMII_ID needs internal delay. This is enabled through |
8781 |
++ * PORT5_PAD_CTRL for all ports, rather than individual port |
8782 |
++ * registers |
8783 |
++ */ |
8784 |
++ qca8k_write(priv, reg, |
8785 |
++ QCA8K_PORT_PAD_RGMII_EN | |
8786 |
++ QCA8K_PORT_PAD_RGMII_TX_DELAY(QCA8K_MAX_DELAY) | |
8787 |
++ QCA8K_PORT_PAD_RGMII_RX_DELAY(QCA8K_MAX_DELAY)); |
8788 |
++ qca8k_write(priv, QCA8K_REG_PORT5_PAD_CTRL, |
8789 |
++ QCA8K_PORT_PAD_RGMII_RX_DELAY_EN); |
8790 |
++ break; |
8791 |
+ case PHY_INTERFACE_MODE_SGMII: |
8792 |
+ qca8k_write(priv, reg, QCA8K_PORT_PAD_SGMII_EN); |
8793 |
+ break; |
8794 |
+diff --git a/drivers/net/dsa/qca8k.h b/drivers/net/dsa/qca8k.h |
8795 |
+index 613fe5c50236..d146e54c8a6c 100644 |
8796 |
+--- a/drivers/net/dsa/qca8k.h |
8797 |
++++ b/drivers/net/dsa/qca8k.h |
8798 |
+@@ -40,6 +40,7 @@ |
8799 |
+ ((0x8 + (x & 0x3)) << 22) |
8800 |
+ #define QCA8K_PORT_PAD_RGMII_RX_DELAY(x) \ |
8801 |
+ ((0x10 + (x & 0x3)) << 20) |
8802 |
++#define QCA8K_MAX_DELAY 3 |
8803 |
+ #define QCA8K_PORT_PAD_RGMII_RX_DELAY_EN BIT(24) |
8804 |
+ #define QCA8K_PORT_PAD_SGMII_EN BIT(7) |
8805 |
+ #define QCA8K_REG_MODULE_EN 0x030 |
8806 |
+diff --git a/drivers/net/ethernet/amazon/ena/ena_com.c b/drivers/net/ethernet/amazon/ena/ena_com.c |
8807 |
+index 7635c38e77dd..92261c946e2a 100644 |
8808 |
+--- a/drivers/net/ethernet/amazon/ena/ena_com.c |
8809 |
++++ b/drivers/net/ethernet/amazon/ena/ena_com.c |
8810 |
+@@ -2008,7 +2008,7 @@ int ena_com_set_hash_function(struct ena_com_dev *ena_dev) |
8811 |
+ if (unlikely(ret)) |
8812 |
+ return ret; |
8813 |
+ |
8814 |
+- if (get_resp.u.flow_hash_func.supported_func & (1 << rss->hash_func)) { |
8815 |
++ if (!(get_resp.u.flow_hash_func.supported_func & BIT(rss->hash_func))) { |
8816 |
+ pr_err("Func hash %d isn't supported by device, abort\n", |
8817 |
+ rss->hash_func); |
8818 |
+ return -EOPNOTSUPP; |
8819 |
+@@ -2093,6 +2093,7 @@ int ena_com_fill_hash_function(struct ena_com_dev *ena_dev, |
8820 |
+ return -EINVAL; |
8821 |
+ } |
8822 |
+ |
8823 |
++ rss->hash_func = func; |
8824 |
+ rc = ena_com_set_hash_function(ena_dev); |
8825 |
+ |
8826 |
+ /* Restore the old function */ |
8827 |
+diff --git a/drivers/net/ethernet/amazon/ena/ena_ethtool.c b/drivers/net/ethernet/amazon/ena/ena_ethtool.c |
8828 |
+index 521607bc4393..eb9e07fa427e 100644 |
8829 |
+--- a/drivers/net/ethernet/amazon/ena/ena_ethtool.c |
8830 |
++++ b/drivers/net/ethernet/amazon/ena/ena_ethtool.c |
8831 |
+@@ -695,8 +695,8 @@ static int ena_set_rxfh(struct net_device *netdev, const u32 *indir, |
8832 |
+ if (indir) { |
8833 |
+ for (i = 0; i < ENA_RX_RSS_TABLE_SIZE; i++) { |
8834 |
+ rc = ena_com_indirect_table_fill_entry(ena_dev, |
8835 |
+- ENA_IO_RXQ_IDX(indir[i]), |
8836 |
+- i); |
8837 |
++ i, |
8838 |
++ ENA_IO_RXQ_IDX(indir[i])); |
8839 |
+ if (unlikely(rc)) { |
8840 |
+ netif_err(adapter, drv, netdev, |
8841 |
+ "Cannot fill indirect table (index is too large)\n"); |
8842 |
+diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c |
8843 |
+index e26c195fec83..9afb19ebba58 100644 |
8844 |
+--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c |
8845 |
++++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c |
8846 |
+@@ -1800,6 +1800,7 @@ err_setup_rx: |
8847 |
+ err_setup_tx: |
8848 |
+ ena_free_io_irq(adapter); |
8849 |
+ err_req_irq: |
8850 |
++ ena_del_napi(adapter); |
8851 |
+ |
8852 |
+ return rc; |
8853 |
+ } |
8854 |
+diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_vec.c b/drivers/net/ethernet/aquantia/atlantic/aq_vec.c |
8855 |
+index 82582fa54d5d..72aa2a4c4d66 100644 |
8856 |
+--- a/drivers/net/ethernet/aquantia/atlantic/aq_vec.c |
8857 |
++++ b/drivers/net/ethernet/aquantia/atlantic/aq_vec.c |
8858 |
+@@ -309,15 +309,13 @@ irqreturn_t aq_vec_isr_legacy(int irq, void *private) |
8859 |
+ { |
8860 |
+ struct aq_vec_s *self = private; |
8861 |
+ u64 irq_mask = 0U; |
8862 |
+- irqreturn_t err = 0; |
8863 |
++ int err; |
8864 |
+ |
8865 |
+- if (!self) { |
8866 |
+- err = -EINVAL; |
8867 |
+- goto err_exit; |
8868 |
+- } |
8869 |
++ if (!self) |
8870 |
++ return IRQ_NONE; |
8871 |
+ err = self->aq_hw_ops->hw_irq_read(self->aq_hw, &irq_mask); |
8872 |
+ if (err < 0) |
8873 |
+- goto err_exit; |
8874 |
++ return IRQ_NONE; |
8875 |
+ |
8876 |
+ if (irq_mask) { |
8877 |
+ self->aq_hw_ops->hw_irq_disable(self->aq_hw, |
8878 |
+@@ -325,11 +323,10 @@ irqreturn_t aq_vec_isr_legacy(int irq, void *private) |
8879 |
+ napi_schedule(&self->napi); |
8880 |
+ } else { |
8881 |
+ self->aq_hw_ops->hw_irq_enable(self->aq_hw, 1U); |
8882 |
+- err = IRQ_NONE; |
8883 |
++ return IRQ_NONE; |
8884 |
+ } |
8885 |
+ |
8886 |
+-err_exit: |
8887 |
+- return err >= 0 ? IRQ_HANDLED : IRQ_NONE; |
8888 |
++ return IRQ_HANDLED; |
8889 |
+ } |
8890 |
+ |
8891 |
+ cpumask_t *aq_vec_get_affinity_mask(struct aq_vec_s *self) |
8892 |
+diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c |
8893 |
+index 97addfa6f895..dab5891b9714 100644 |
8894 |
+--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c |
8895 |
++++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c |
8896 |
+@@ -207,8 +207,8 @@ static int hw_atl_a0_hw_rss_set(struct aq_hw_s *self, |
8897 |
+ u32 i = 0U; |
8898 |
+ u32 num_rss_queues = max(1U, self->aq_nic_cfg->num_rss_queues); |
8899 |
+ int err = 0; |
8900 |
+- u16 bitary[(HW_ATL_A0_RSS_REDIRECTION_MAX * |
8901 |
+- HW_ATL_A0_RSS_REDIRECTION_BITS / 16U)]; |
8902 |
++ u16 bitary[1 + (HW_ATL_A0_RSS_REDIRECTION_MAX * |
8903 |
++ HW_ATL_A0_RSS_REDIRECTION_BITS / 16U)]; |
8904 |
+ |
8905 |
+ memset(bitary, 0, sizeof(bitary)); |
8906 |
+ |
8907 |
+diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c |
8908 |
+index 51cd1f98bcf0..c4f914a29c38 100644 |
8909 |
+--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c |
8910 |
++++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c |
8911 |
+@@ -192,8 +192,8 @@ static int hw_atl_b0_hw_rss_set(struct aq_hw_s *self, |
8912 |
+ u32 i = 0U; |
8913 |
+ u32 num_rss_queues = max(1U, self->aq_nic_cfg->num_rss_queues); |
8914 |
+ int err = 0; |
8915 |
+- u16 bitary[(HW_ATL_B0_RSS_REDIRECTION_MAX * |
8916 |
+- HW_ATL_B0_RSS_REDIRECTION_BITS / 16U)]; |
8917 |
++ u16 bitary[1 + (HW_ATL_B0_RSS_REDIRECTION_MAX * |
8918 |
++ HW_ATL_B0_RSS_REDIRECTION_BITS / 16U)]; |
8919 |
+ |
8920 |
+ memset(bitary, 0, sizeof(bitary)); |
8921 |
+ |
8922 |
+diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c |
8923 |
+index 0bdbc72605e1..49aa3b5ea57c 100644 |
8924 |
+--- a/drivers/net/ethernet/broadcom/bcmsysport.c |
8925 |
++++ b/drivers/net/ethernet/broadcom/bcmsysport.c |
8926 |
+@@ -2470,7 +2470,7 @@ static int bcm_sysport_probe(struct platform_device *pdev) |
8927 |
+ |
8928 |
+ priv->phy_interface = of_get_phy_mode(dn); |
8929 |
+ /* Default to GMII interface mode */ |
8930 |
+- if (priv->phy_interface < 0) |
8931 |
++ if ((int)priv->phy_interface < 0) |
8932 |
+ priv->phy_interface = PHY_INTERFACE_MODE_GMII; |
8933 |
+ |
8934 |
+ /* In the case of a fixed PHY, the DT node associated |
8935 |
+diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h |
8936 |
+index f9e253b705ec..585f5aef0a45 100644 |
8937 |
+--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h |
8938 |
++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h |
8939 |
+@@ -527,6 +527,7 @@ struct rx_tpa_end_cmp_ext { |
8940 |
+ #define DFLT_HWRM_CMD_TIMEOUT 500 |
8941 |
+ #define HWRM_CMD_TIMEOUT (bp->hwrm_cmd_timeout) |
8942 |
+ #define HWRM_RESET_TIMEOUT ((HWRM_CMD_TIMEOUT) * 4) |
8943 |
++#define HWRM_COREDUMP_TIMEOUT ((HWRM_CMD_TIMEOUT) * 12) |
8944 |
+ #define HWRM_RESP_ERR_CODE_MASK 0xffff |
8945 |
+ #define HWRM_RESP_LEN_OFFSET 4 |
8946 |
+ #define HWRM_RESP_LEN_MASK 0xffff0000 |
8947 |
+diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c |
8948 |
+index a85d2be986af..0e4e0b47f5d8 100644 |
8949 |
+--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c |
8950 |
++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c |
8951 |
+@@ -396,7 +396,7 @@ static int bnxt_hwrm_queue_dscp_qcaps(struct bnxt *bp) |
8952 |
+ |
8953 |
+ bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_QUEUE_DSCP_QCAPS, -1, -1); |
8954 |
+ mutex_lock(&bp->hwrm_cmd_lock); |
8955 |
+- rc = _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT); |
8956 |
++ rc = _hwrm_send_message_silent(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT); |
8957 |
+ if (!rc) { |
8958 |
+ bp->max_dscp_value = (1 << resp->num_dscp_bits) - 1; |
8959 |
+ if (bp->max_dscp_value < 0x3f) |
8960 |
+diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c |
8961 |
+index 0a409ba4012a..047024717d65 100644 |
8962 |
+--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c |
8963 |
++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c |
8964 |
+@@ -1778,21 +1778,19 @@ static int bnxt_flash_package_from_file(struct net_device *dev, |
8965 |
+ mutex_lock(&bp->hwrm_cmd_lock); |
8966 |
+ hwrm_err = _hwrm_send_message(bp, &install, sizeof(install), |
8967 |
+ INSTALL_PACKAGE_TIMEOUT); |
8968 |
+- if (hwrm_err) |
8969 |
+- goto flash_pkg_exit; |
8970 |
+- |
8971 |
+- if (resp->error_code) { |
8972 |
++ if (hwrm_err) { |
8973 |
+ u8 error_code = ((struct hwrm_err_output *)resp)->cmd_err; |
8974 |
+ |
8975 |
+- if (error_code == NVM_INSTALL_UPDATE_CMD_ERR_CODE_FRAG_ERR) { |
8976 |
++ if (resp->error_code && error_code == |
8977 |
++ NVM_INSTALL_UPDATE_CMD_ERR_CODE_FRAG_ERR) { |
8978 |
+ install.flags |= cpu_to_le16( |
8979 |
+ NVM_INSTALL_UPDATE_REQ_FLAGS_ALLOWED_TO_DEFRAG); |
8980 |
+ hwrm_err = _hwrm_send_message(bp, &install, |
8981 |
+ sizeof(install), |
8982 |
+ INSTALL_PACKAGE_TIMEOUT); |
8983 |
+- if (hwrm_err) |
8984 |
+- goto flash_pkg_exit; |
8985 |
+ } |
8986 |
++ if (hwrm_err) |
8987 |
++ goto flash_pkg_exit; |
8988 |
+ } |
8989 |
+ |
8990 |
+ if (resp->result) { |
8991 |
+@@ -2600,7 +2598,7 @@ static void bnxt_self_test(struct net_device *dev, struct ethtool_test *etest, |
8992 |
+ bool offline = false; |
8993 |
+ u8 test_results = 0; |
8994 |
+ u8 test_mask = 0; |
8995 |
+- int rc, i; |
8996 |
++ int rc = 0, i; |
8997 |
+ |
8998 |
+ if (!bp->num_tests || !BNXT_SINGLE_PF(bp)) |
8999 |
+ return; |
9000 |
+@@ -2671,9 +2669,9 @@ static void bnxt_self_test(struct net_device *dev, struct ethtool_test *etest, |
9001 |
+ } |
9002 |
+ bnxt_hwrm_phy_loopback(bp, false, false); |
9003 |
+ bnxt_half_close_nic(bp); |
9004 |
+- bnxt_open_nic(bp, false, true); |
9005 |
++ rc = bnxt_open_nic(bp, false, true); |
9006 |
+ } |
9007 |
+- if (bnxt_test_irq(bp)) { |
9008 |
++ if (rc || bnxt_test_irq(bp)) { |
9009 |
+ buf[BNXT_IRQ_TEST_IDX] = 1; |
9010 |
+ etest->flags |= ETH_TEST_FL_FAILED; |
9011 |
+ } |
9012 |
+@@ -2835,7 +2833,7 @@ static int bnxt_hwrm_dbg_coredump_initiate(struct bnxt *bp, u16 component_id, |
9013 |
+ req.component_id = cpu_to_le16(component_id); |
9014 |
+ req.segment_id = cpu_to_le16(segment_id); |
9015 |
+ |
9016 |
+- return hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT); |
9017 |
++ return hwrm_send_message(bp, &req, sizeof(req), HWRM_COREDUMP_TIMEOUT); |
9018 |
+ } |
9019 |
+ |
9020 |
+ static int bnxt_hwrm_dbg_coredump_retrieve(struct bnxt *bp, u16 component_id, |
9021 |
+diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c |
9022 |
+index bb04c695ab9f..c81d6c330548 100644 |
9023 |
+--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c |
9024 |
++++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c |
9025 |
+@@ -5452,7 +5452,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
9026 |
+ whoami = t4_read_reg(adapter, PL_WHOAMI_A); |
9027 |
+ pci_read_config_word(pdev, PCI_DEVICE_ID, &device_id); |
9028 |
+ chip = t4_get_chip_type(adapter, CHELSIO_PCI_ID_VER(device_id)); |
9029 |
+- if (chip < 0) { |
9030 |
++ if ((int)chip < 0) { |
9031 |
+ dev_err(&pdev->dev, "Device %d is not supported\n", device_id); |
9032 |
+ err = chip; |
9033 |
+ goto out_free_adapter; |
9034 |
+diff --git a/drivers/net/ethernet/chelsio/cxgb4/smt.c b/drivers/net/ethernet/chelsio/cxgb4/smt.c |
9035 |
+index 7b2207a2a130..9b3f4205cb4d 100644 |
9036 |
+--- a/drivers/net/ethernet/chelsio/cxgb4/smt.c |
9037 |
++++ b/drivers/net/ethernet/chelsio/cxgb4/smt.c |
9038 |
+@@ -98,11 +98,9 @@ found_reuse: |
9039 |
+ |
9040 |
+ static void t4_smte_free(struct smt_entry *e) |
9041 |
+ { |
9042 |
+- spin_lock_bh(&e->lock); |
9043 |
+ if (atomic_read(&e->refcnt) == 0) { /* hasn't been recycled */ |
9044 |
+ e->state = SMT_STATE_UNUSED; |
9045 |
+ } |
9046 |
+- spin_unlock_bh(&e->lock); |
9047 |
+ } |
9048 |
+ |
9049 |
+ /** |
9050 |
+@@ -112,8 +110,10 @@ static void t4_smte_free(struct smt_entry *e) |
9051 |
+ */ |
9052 |
+ void cxgb4_smt_release(struct smt_entry *e) |
9053 |
+ { |
9054 |
++ spin_lock_bh(&e->lock); |
9055 |
+ if (atomic_dec_and_test(&e->refcnt)) |
9056 |
+ t4_smte_free(e); |
9057 |
++ spin_unlock_bh(&e->lock); |
9058 |
+ } |
9059 |
+ EXPORT_SYMBOL(cxgb4_smt_release); |
9060 |
+ |
9061 |
+diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c |
9062 |
+index 462bb8c4f80c..d7736c9c6339 100644 |
9063 |
+--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c |
9064 |
++++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c |
9065 |
+@@ -1600,13 +1600,15 @@ static int dpaa_eth_refill_bpools(struct dpaa_priv *priv) |
9066 |
+ * Skb freeing is not handled here. |
9067 |
+ * |
9068 |
+ * This function may be called on error paths in the Tx function, so guard |
9069 |
+- * against cases when not all fd relevant fields were filled in. |
9070 |
++ * against cases when not all fd relevant fields were filled in. To avoid |
9071 |
++ * reading the invalid transmission timestamp for the error paths set ts to |
9072 |
++ * false. |
9073 |
+ * |
9074 |
+ * Return the skb backpointer, since for S/G frames the buffer containing it |
9075 |
+ * gets freed here. |
9076 |
+ */ |
9077 |
+ static struct sk_buff *dpaa_cleanup_tx_fd(const struct dpaa_priv *priv, |
9078 |
+- const struct qm_fd *fd) |
9079 |
++ const struct qm_fd *fd, bool ts) |
9080 |
+ { |
9081 |
+ const enum dma_data_direction dma_dir = DMA_TO_DEVICE; |
9082 |
+ struct device *dev = priv->net_dev->dev.parent; |
9083 |
+@@ -1620,18 +1622,6 @@ static struct sk_buff *dpaa_cleanup_tx_fd(const struct dpaa_priv *priv, |
9084 |
+ skbh = (struct sk_buff **)phys_to_virt(addr); |
9085 |
+ skb = *skbh; |
9086 |
+ |
9087 |
+- if (priv->tx_tstamp && skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) { |
9088 |
+- memset(&shhwtstamps, 0, sizeof(shhwtstamps)); |
9089 |
+- |
9090 |
+- if (!fman_port_get_tstamp(priv->mac_dev->port[TX], (void *)skbh, |
9091 |
+- &ns)) { |
9092 |
+- shhwtstamps.hwtstamp = ns_to_ktime(ns); |
9093 |
+- skb_tstamp_tx(skb, &shhwtstamps); |
9094 |
+- } else { |
9095 |
+- dev_warn(dev, "fman_port_get_tstamp failed!\n"); |
9096 |
+- } |
9097 |
+- } |
9098 |
+- |
9099 |
+ if (unlikely(qm_fd_get_format(fd) == qm_fd_sg)) { |
9100 |
+ nr_frags = skb_shinfo(skb)->nr_frags; |
9101 |
+ dma_unmap_single(dev, addr, |
9102 |
+@@ -1654,14 +1644,29 @@ static struct sk_buff *dpaa_cleanup_tx_fd(const struct dpaa_priv *priv, |
9103 |
+ dma_unmap_page(dev, qm_sg_addr(&sgt[i]), |
9104 |
+ qm_sg_entry_get_len(&sgt[i]), dma_dir); |
9105 |
+ } |
9106 |
+- |
9107 |
+- /* Free the page frag that we allocated on Tx */ |
9108 |
+- skb_free_frag(phys_to_virt(addr)); |
9109 |
+ } else { |
9110 |
+ dma_unmap_single(dev, addr, |
9111 |
+ skb_tail_pointer(skb) - (u8 *)skbh, dma_dir); |
9112 |
+ } |
9113 |
+ |
9114 |
++ /* DMA unmapping is required before accessing the HW provided info */ |
9115 |
++ if (ts && priv->tx_tstamp && |
9116 |
++ skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) { |
9117 |
++ memset(&shhwtstamps, 0, sizeof(shhwtstamps)); |
9118 |
++ |
9119 |
++ if (!fman_port_get_tstamp(priv->mac_dev->port[TX], (void *)skbh, |
9120 |
++ &ns)) { |
9121 |
++ shhwtstamps.hwtstamp = ns_to_ktime(ns); |
9122 |
++ skb_tstamp_tx(skb, &shhwtstamps); |
9123 |
++ } else { |
9124 |
++ dev_warn(dev, "fman_port_get_tstamp failed!\n"); |
9125 |
++ } |
9126 |
++ } |
9127 |
++ |
9128 |
++ if (qm_fd_get_format(fd) == qm_fd_sg) |
9129 |
++ /* Free the page frag that we allocated on Tx */ |
9130 |
++ skb_free_frag(phys_to_virt(addr)); |
9131 |
++ |
9132 |
+ return skb; |
9133 |
+ } |
9134 |
+ |
9135 |
+@@ -2116,7 +2121,7 @@ dpaa_start_xmit(struct sk_buff *skb, struct net_device *net_dev) |
9136 |
+ if (likely(dpaa_xmit(priv, percpu_stats, queue_mapping, &fd) == 0)) |
9137 |
+ return NETDEV_TX_OK; |
9138 |
+ |
9139 |
+- dpaa_cleanup_tx_fd(priv, &fd); |
9140 |
++ dpaa_cleanup_tx_fd(priv, &fd, false); |
9141 |
+ skb_to_fd_failed: |
9142 |
+ enomem: |
9143 |
+ percpu_stats->tx_errors++; |
9144 |
+@@ -2162,7 +2167,7 @@ static void dpaa_tx_error(struct net_device *net_dev, |
9145 |
+ |
9146 |
+ percpu_priv->stats.tx_errors++; |
9147 |
+ |
9148 |
+- skb = dpaa_cleanup_tx_fd(priv, fd); |
9149 |
++ skb = dpaa_cleanup_tx_fd(priv, fd, false); |
9150 |
+ dev_kfree_skb(skb); |
9151 |
+ } |
9152 |
+ |
9153 |
+@@ -2203,7 +2208,7 @@ static void dpaa_tx_conf(struct net_device *net_dev, |
9154 |
+ |
9155 |
+ percpu_priv->tx_confirm++; |
9156 |
+ |
9157 |
+- skb = dpaa_cleanup_tx_fd(priv, fd); |
9158 |
++ skb = dpaa_cleanup_tx_fd(priv, fd, true); |
9159 |
+ |
9160 |
+ consume_skb(skb); |
9161 |
+ } |
9162 |
+@@ -2433,7 +2438,7 @@ static void egress_ern(struct qman_portal *portal, |
9163 |
+ percpu_priv->stats.tx_fifo_errors++; |
9164 |
+ count_ern(percpu_priv, msg); |
9165 |
+ |
9166 |
+- skb = dpaa_cleanup_tx_fd(priv, fd); |
9167 |
++ skb = dpaa_cleanup_tx_fd(priv, fd, false); |
9168 |
+ dev_kfree_skb_any(skb); |
9169 |
+ } |
9170 |
+ |
9171 |
+diff --git a/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c b/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c |
9172 |
+index 471805ea363b..b63871ef8a40 100644 |
9173 |
+--- a/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c |
9174 |
++++ b/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c |
9175 |
+@@ -1201,7 +1201,7 @@ static int hix5hd2_dev_probe(struct platform_device *pdev) |
9176 |
+ goto err_free_mdio; |
9177 |
+ |
9178 |
+ priv->phy_mode = of_get_phy_mode(node); |
9179 |
+- if (priv->phy_mode < 0) { |
9180 |
++ if ((int)priv->phy_mode < 0) { |
9181 |
+ netdev_err(ndev, "not find phy-mode\n"); |
9182 |
+ ret = -EINVAL; |
9183 |
+ goto err_mdiobus; |
9184 |
+diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c |
9185 |
+index 1aaf6e2a3b39..3eb8b85f6afb 100644 |
9186 |
+--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c |
9187 |
++++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c |
9188 |
+@@ -1464,7 +1464,7 @@ static bool hns3_get_tx_timeo_queue_info(struct net_device *ndev) |
9189 |
+ int i; |
9190 |
+ |
9191 |
+ /* Find the stopped queue the same way the stack does */ |
9192 |
+- for (i = 0; i < ndev->real_num_tx_queues; i++) { |
9193 |
++ for (i = 0; i < ndev->num_tx_queues; i++) { |
9194 |
+ struct netdev_queue *q; |
9195 |
+ unsigned long trans_start; |
9196 |
+ |
9197 |
+@@ -2605,9 +2605,10 @@ err_free_chain: |
9198 |
+ cur_chain = head->next; |
9199 |
+ while (cur_chain) { |
9200 |
+ chain = cur_chain->next; |
9201 |
+- devm_kfree(&pdev->dev, chain); |
9202 |
++ devm_kfree(&pdev->dev, cur_chain); |
9203 |
+ cur_chain = chain; |
9204 |
+ } |
9205 |
++ head->next = NULL; |
9206 |
+ |
9207 |
+ return -ENOMEM; |
9208 |
+ } |
9209 |
+@@ -2642,7 +2643,7 @@ static int hns3_nic_init_vector_data(struct hns3_nic_priv *priv) |
9210 |
+ struct hnae3_handle *h = priv->ae_handle; |
9211 |
+ struct hns3_enet_tqp_vector *tqp_vector; |
9212 |
+ int ret = 0; |
9213 |
+- u16 i; |
9214 |
++ int i; |
9215 |
+ |
9216 |
+ for (i = 0; i < priv->vector_num; i++) { |
9217 |
+ tqp_vector = &priv->tqp_vector[i]; |
9218 |
+@@ -2679,7 +2680,7 @@ static int hns3_nic_init_vector_data(struct hns3_nic_priv *priv) |
9219 |
+ ret = hns3_get_vector_ring_chain(tqp_vector, |
9220 |
+ &vector_ring_chain); |
9221 |
+ if (ret) |
9222 |
+- return ret; |
9223 |
++ goto map_ring_fail; |
9224 |
+ |
9225 |
+ ret = h->ae_algo->ops->map_ring_to_vector(h, |
9226 |
+ tqp_vector->vector_irq, &vector_ring_chain); |
9227 |
+@@ -2687,13 +2688,19 @@ static int hns3_nic_init_vector_data(struct hns3_nic_priv *priv) |
9228 |
+ hns3_free_vector_ring_chain(tqp_vector, &vector_ring_chain); |
9229 |
+ |
9230 |
+ if (ret) |
9231 |
+- return ret; |
9232 |
++ goto map_ring_fail; |
9233 |
+ |
9234 |
+ netif_napi_add(priv->netdev, &tqp_vector->napi, |
9235 |
+ hns3_nic_common_poll, NAPI_POLL_WEIGHT); |
9236 |
+ } |
9237 |
+ |
9238 |
+ return 0; |
9239 |
++ |
9240 |
++map_ring_fail: |
9241 |
++ while (i--) |
9242 |
++ netif_napi_del(&priv->tqp_vector[i].napi); |
9243 |
++ |
9244 |
++ return ret; |
9245 |
+ } |
9246 |
+ |
9247 |
+ static int hns3_nic_alloc_vector_data(struct hns3_nic_priv *priv) |
9248 |
+diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c |
9249 |
+index f8cc8d1f0b20..d575dd9a329d 100644 |
9250 |
+--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c |
9251 |
++++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c |
9252 |
+@@ -4833,6 +4833,7 @@ static int hclge_set_vlan_tx_offload_cfg(struct hclge_vport *vport) |
9253 |
+ struct hclge_vport_vtag_tx_cfg_cmd *req; |
9254 |
+ struct hclge_dev *hdev = vport->back; |
9255 |
+ struct hclge_desc desc; |
9256 |
++ u16 bmap_index; |
9257 |
+ int status; |
9258 |
+ |
9259 |
+ hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_VLAN_PORT_TX_CFG, false); |
9260 |
+@@ -4855,8 +4856,10 @@ static int hclge_set_vlan_tx_offload_cfg(struct hclge_vport *vport) |
9261 |
+ hnae3_set_bit(req->vport_vlan_cfg, HCLGE_CFG_NIC_ROCE_SEL_B, 0); |
9262 |
+ |
9263 |
+ req->vf_offset = vport->vport_id / HCLGE_VF_NUM_PER_CMD; |
9264 |
+- req->vf_bitmap[req->vf_offset] = |
9265 |
+- 1 << (vport->vport_id % HCLGE_VF_NUM_PER_BYTE); |
9266 |
++ bmap_index = vport->vport_id % HCLGE_VF_NUM_PER_CMD / |
9267 |
++ HCLGE_VF_NUM_PER_BYTE; |
9268 |
++ req->vf_bitmap[bmap_index] = |
9269 |
++ 1U << (vport->vport_id % HCLGE_VF_NUM_PER_BYTE); |
9270 |
+ |
9271 |
+ status = hclge_cmd_send(&hdev->hw, &desc, 1); |
9272 |
+ if (status) |
9273 |
+@@ -4873,6 +4876,7 @@ static int hclge_set_vlan_rx_offload_cfg(struct hclge_vport *vport) |
9274 |
+ struct hclge_vport_vtag_rx_cfg_cmd *req; |
9275 |
+ struct hclge_dev *hdev = vport->back; |
9276 |
+ struct hclge_desc desc; |
9277 |
++ u16 bmap_index; |
9278 |
+ int status; |
9279 |
+ |
9280 |
+ hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_VLAN_PORT_RX_CFG, false); |
9281 |
+@@ -4888,8 +4892,10 @@ static int hclge_set_vlan_rx_offload_cfg(struct hclge_vport *vport) |
9282 |
+ vcfg->vlan2_vlan_prionly ? 1 : 0); |
9283 |
+ |
9284 |
+ req->vf_offset = vport->vport_id / HCLGE_VF_NUM_PER_CMD; |
9285 |
+- req->vf_bitmap[req->vf_offset] = |
9286 |
+- 1 << (vport->vport_id % HCLGE_VF_NUM_PER_BYTE); |
9287 |
++ bmap_index = vport->vport_id % HCLGE_VF_NUM_PER_CMD / |
9288 |
++ HCLGE_VF_NUM_PER_BYTE; |
9289 |
++ req->vf_bitmap[bmap_index] = |
9290 |
++ 1U << (vport->vport_id % HCLGE_VF_NUM_PER_BYTE); |
9291 |
+ |
9292 |
+ status = hclge_cmd_send(&hdev->hw, &desc, 1); |
9293 |
+ if (status) |
9294 |
+@@ -5922,18 +5928,17 @@ static u32 hclge_get_max_channels(struct hnae3_handle *handle) |
9295 |
+ struct hclge_vport *vport = hclge_get_vport(handle); |
9296 |
+ struct hclge_dev *hdev = vport->back; |
9297 |
+ |
9298 |
+- return min_t(u32, hdev->rss_size_max * kinfo->num_tc, hdev->num_tqps); |
9299 |
++ return min_t(u32, hdev->rss_size_max, |
9300 |
++ vport->alloc_tqps / kinfo->num_tc); |
9301 |
+ } |
9302 |
+ |
9303 |
+ static void hclge_get_channels(struct hnae3_handle *handle, |
9304 |
+ struct ethtool_channels *ch) |
9305 |
+ { |
9306 |
+- struct hclge_vport *vport = hclge_get_vport(handle); |
9307 |
+- |
9308 |
+ ch->max_combined = hclge_get_max_channels(handle); |
9309 |
+ ch->other_count = 1; |
9310 |
+ ch->max_other = 1; |
9311 |
+- ch->combined_count = vport->alloc_tqps; |
9312 |
++ ch->combined_count = handle->kinfo.rss_size; |
9313 |
+ } |
9314 |
+ |
9315 |
+ static void hclge_get_tqps_and_rss_info(struct hnae3_handle *handle, |
9316 |
+diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h |
9317 |
+index 260b1e779690..d14b7018fdf3 100644 |
9318 |
+--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h |
9319 |
++++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h |
9320 |
+@@ -600,7 +600,7 @@ struct hclge_vport { |
9321 |
+ u16 alloc_rss_size; |
9322 |
+ |
9323 |
+ u16 qs_offset; |
9324 |
+- u16 bw_limit; /* VSI BW Limit (0 = disabled) */ |
9325 |
++ u32 bw_limit; /* VSI BW Limit (0 = disabled) */ |
9326 |
+ u8 dwrr; |
9327 |
+ |
9328 |
+ struct hclge_tx_vtag_cfg txvlan_cfg; |
9329 |
+diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c |
9330 |
+index e08e82020402..997ca79ed892 100644 |
9331 |
+--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c |
9332 |
++++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c |
9333 |
+@@ -181,12 +181,10 @@ static int hclge_map_unmap_ring_to_vf_vector(struct hclge_vport *vport, bool en, |
9334 |
+ return ret; |
9335 |
+ |
9336 |
+ ret = hclge_bind_ring_with_vector(vport, vector_id, en, &ring_chain); |
9337 |
+- if (ret) |
9338 |
+- return ret; |
9339 |
+ |
9340 |
+ hclge_free_vector_ring_chain(&ring_chain); |
9341 |
+ |
9342 |
+- return 0; |
9343 |
++ return ret; |
9344 |
+ } |
9345 |
+ |
9346 |
+ static int hclge_set_vf_promisc_mode(struct hclge_vport *vport, |
9347 |
+diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c |
9348 |
+index 67db19709dea..fd5375b5991b 100644 |
9349 |
+--- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c |
9350 |
++++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c |
9351 |
+@@ -1957,7 +1957,8 @@ static u32 hclgevf_get_max_channels(struct hclgevf_dev *hdev) |
9352 |
+ struct hnae3_handle *nic = &hdev->nic; |
9353 |
+ struct hnae3_knic_private_info *kinfo = &nic->kinfo; |
9354 |
+ |
9355 |
+- return min_t(u32, hdev->rss_size_max * kinfo->num_tc, hdev->num_tqps); |
9356 |
++ return min_t(u32, hdev->rss_size_max, |
9357 |
++ hdev->num_tqps / kinfo->num_tc); |
9358 |
+ } |
9359 |
+ |
9360 |
+ /** |
9361 |
+@@ -1978,7 +1979,7 @@ static void hclgevf_get_channels(struct hnae3_handle *handle, |
9362 |
+ ch->max_combined = hclgevf_get_max_channels(hdev); |
9363 |
+ ch->other_count = 0; |
9364 |
+ ch->max_other = 0; |
9365 |
+- ch->combined_count = hdev->num_tqps; |
9366 |
++ ch->combined_count = handle->kinfo.rss_size; |
9367 |
+ } |
9368 |
+ |
9369 |
+ static void hclgevf_get_tqps_and_rss_info(struct hnae3_handle *handle, |
9370 |
+diff --git a/drivers/net/ethernet/ibm/ehea/ehea_main.c b/drivers/net/ethernet/ibm/ehea/ehea_main.c |
9371 |
+index e8ee69d4e4d3..0f799e8e093c 100644 |
9372 |
+--- a/drivers/net/ethernet/ibm/ehea/ehea_main.c |
9373 |
++++ b/drivers/net/ethernet/ibm/ehea/ehea_main.c |
9374 |
+@@ -1464,7 +1464,7 @@ static int ehea_init_port_res(struct ehea_port *port, struct ehea_port_res *pr, |
9375 |
+ |
9376 |
+ memset(pr, 0, sizeof(struct ehea_port_res)); |
9377 |
+ |
9378 |
+- pr->tx_bytes = rx_bytes; |
9379 |
++ pr->tx_bytes = tx_bytes; |
9380 |
+ pr->tx_packets = tx_packets; |
9381 |
+ pr->rx_bytes = rx_bytes; |
9382 |
+ pr->rx_packets = rx_packets; |
9383 |
+diff --git a/drivers/net/ethernet/intel/i40e/i40e_common.c b/drivers/net/ethernet/intel/i40e/i40e_common.c |
9384 |
+index 85f75b5978fc..eb0ae6ab01e2 100644 |
9385 |
+--- a/drivers/net/ethernet/intel/i40e/i40e_common.c |
9386 |
++++ b/drivers/net/ethernet/intel/i40e/i40e_common.c |
9387 |
+@@ -1668,25 +1668,15 @@ enum i40e_status_code i40e_aq_set_phy_config(struct i40e_hw *hw, |
9388 |
+ return status; |
9389 |
+ } |
9390 |
+ |
9391 |
+-/** |
9392 |
+- * i40e_set_fc |
9393 |
+- * @hw: pointer to the hw struct |
9394 |
+- * @aq_failures: buffer to return AdminQ failure information |
9395 |
+- * @atomic_restart: whether to enable atomic link restart |
9396 |
+- * |
9397 |
+- * Set the requested flow control mode using set_phy_config. |
9398 |
+- **/ |
9399 |
+-enum i40e_status_code i40e_set_fc(struct i40e_hw *hw, u8 *aq_failures, |
9400 |
+- bool atomic_restart) |
9401 |
++static noinline_for_stack enum i40e_status_code |
9402 |
++i40e_set_fc_status(struct i40e_hw *hw, |
9403 |
++ struct i40e_aq_get_phy_abilities_resp *abilities, |
9404 |
++ bool atomic_restart) |
9405 |
+ { |
9406 |
+- enum i40e_fc_mode fc_mode = hw->fc.requested_mode; |
9407 |
+- struct i40e_aq_get_phy_abilities_resp abilities; |
9408 |
+ struct i40e_aq_set_phy_config config; |
9409 |
+- enum i40e_status_code status; |
9410 |
++ enum i40e_fc_mode fc_mode = hw->fc.requested_mode; |
9411 |
+ u8 pause_mask = 0x0; |
9412 |
+ |
9413 |
+- *aq_failures = 0x0; |
9414 |
+- |
9415 |
+ switch (fc_mode) { |
9416 |
+ case I40E_FC_FULL: |
9417 |
+ pause_mask |= I40E_AQ_PHY_FLAG_PAUSE_TX; |
9418 |
+@@ -1702,6 +1692,48 @@ enum i40e_status_code i40e_set_fc(struct i40e_hw *hw, u8 *aq_failures, |
9419 |
+ break; |
9420 |
+ } |
9421 |
+ |
9422 |
++ memset(&config, 0, sizeof(struct i40e_aq_set_phy_config)); |
9423 |
++ /* clear the old pause settings */ |
9424 |
++ config.abilities = abilities->abilities & ~(I40E_AQ_PHY_FLAG_PAUSE_TX) & |
9425 |
++ ~(I40E_AQ_PHY_FLAG_PAUSE_RX); |
9426 |
++ /* set the new abilities */ |
9427 |
++ config.abilities |= pause_mask; |
9428 |
++ /* If the abilities have changed, then set the new config */ |
9429 |
++ if (config.abilities == abilities->abilities) |
9430 |
++ return 0; |
9431 |
++ |
9432 |
++ /* Auto restart link so settings take effect */ |
9433 |
++ if (atomic_restart) |
9434 |
++ config.abilities |= I40E_AQ_PHY_ENABLE_ATOMIC_LINK; |
9435 |
++ /* Copy over all the old settings */ |
9436 |
++ config.phy_type = abilities->phy_type; |
9437 |
++ config.phy_type_ext = abilities->phy_type_ext; |
9438 |
++ config.link_speed = abilities->link_speed; |
9439 |
++ config.eee_capability = abilities->eee_capability; |
9440 |
++ config.eeer = abilities->eeer_val; |
9441 |
++ config.low_power_ctrl = abilities->d3_lpan; |
9442 |
++ config.fec_config = abilities->fec_cfg_curr_mod_ext_info & |
9443 |
++ I40E_AQ_PHY_FEC_CONFIG_MASK; |
9444 |
++ |
9445 |
++ return i40e_aq_set_phy_config(hw, &config, NULL); |
9446 |
++} |
9447 |
++ |
9448 |
++/** |
9449 |
++ * i40e_set_fc |
9450 |
++ * @hw: pointer to the hw struct |
9451 |
++ * @aq_failures: buffer to return AdminQ failure information |
9452 |
++ * @atomic_restart: whether to enable atomic link restart |
9453 |
++ * |
9454 |
++ * Set the requested flow control mode using set_phy_config. |
9455 |
++ **/ |
9456 |
++enum i40e_status_code i40e_set_fc(struct i40e_hw *hw, u8 *aq_failures, |
9457 |
++ bool atomic_restart) |
9458 |
++{ |
9459 |
++ struct i40e_aq_get_phy_abilities_resp abilities; |
9460 |
++ enum i40e_status_code status; |
9461 |
++ |
9462 |
++ *aq_failures = 0x0; |
9463 |
++ |
9464 |
+ /* Get the current phy config */ |
9465 |
+ status = i40e_aq_get_phy_capabilities(hw, false, false, &abilities, |
9466 |
+ NULL); |
9467 |
+@@ -1710,31 +1742,10 @@ enum i40e_status_code i40e_set_fc(struct i40e_hw *hw, u8 *aq_failures, |
9468 |
+ return status; |
9469 |
+ } |
9470 |
+ |
9471 |
+- memset(&config, 0, sizeof(struct i40e_aq_set_phy_config)); |
9472 |
+- /* clear the old pause settings */ |
9473 |
+- config.abilities = abilities.abilities & ~(I40E_AQ_PHY_FLAG_PAUSE_TX) & |
9474 |
+- ~(I40E_AQ_PHY_FLAG_PAUSE_RX); |
9475 |
+- /* set the new abilities */ |
9476 |
+- config.abilities |= pause_mask; |
9477 |
+- /* If the abilities have changed, then set the new config */ |
9478 |
+- if (config.abilities != abilities.abilities) { |
9479 |
+- /* Auto restart link so settings take effect */ |
9480 |
+- if (atomic_restart) |
9481 |
+- config.abilities |= I40E_AQ_PHY_ENABLE_ATOMIC_LINK; |
9482 |
+- /* Copy over all the old settings */ |
9483 |
+- config.phy_type = abilities.phy_type; |
9484 |
+- config.phy_type_ext = abilities.phy_type_ext; |
9485 |
+- config.link_speed = abilities.link_speed; |
9486 |
+- config.eee_capability = abilities.eee_capability; |
9487 |
+- config.eeer = abilities.eeer_val; |
9488 |
+- config.low_power_ctrl = abilities.d3_lpan; |
9489 |
+- config.fec_config = abilities.fec_cfg_curr_mod_ext_info & |
9490 |
+- I40E_AQ_PHY_FEC_CONFIG_MASK; |
9491 |
+- status = i40e_aq_set_phy_config(hw, &config, NULL); |
9492 |
++ status = i40e_set_fc_status(hw, &abilities, atomic_restart); |
9493 |
++ if (status) |
9494 |
++ *aq_failures |= I40E_SET_FC_AQ_FAIL_SET; |
9495 |
+ |
9496 |
+- if (status) |
9497 |
+- *aq_failures |= I40E_SET_FC_AQ_FAIL_SET; |
9498 |
+- } |
9499 |
+ /* Update the link info */ |
9500 |
+ status = i40e_update_link_info(hw); |
9501 |
+ if (status) { |
9502 |
+@@ -2563,7 +2574,7 @@ i40e_status i40e_get_link_status(struct i40e_hw *hw, bool *link_up) |
9503 |
+ * i40e_updatelink_status - update status of the HW network link |
9504 |
+ * @hw: pointer to the hw struct |
9505 |
+ **/ |
9506 |
+-i40e_status i40e_update_link_info(struct i40e_hw *hw) |
9507 |
++noinline_for_stack i40e_status i40e_update_link_info(struct i40e_hw *hw) |
9508 |
+ { |
9509 |
+ struct i40e_aq_get_phy_abilities_resp abilities; |
9510 |
+ i40e_status status = 0; |
9511 |
+diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c |
9512 |
+index b27f7a968820..49e6d66ccf80 100644 |
9513 |
+--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c |
9514 |
++++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c |
9515 |
+@@ -114,7 +114,6 @@ static void ixgbe_ipsec_set_rx_ip(struct ixgbe_hw *hw, u16 idx, __be32 addr[]) |
9516 |
+ **/ |
9517 |
+ static void ixgbe_ipsec_clear_hw_tables(struct ixgbe_adapter *adapter) |
9518 |
+ { |
9519 |
+- struct ixgbe_ipsec *ipsec = adapter->ipsec; |
9520 |
+ struct ixgbe_hw *hw = &adapter->hw; |
9521 |
+ u32 buf[4] = {0, 0, 0, 0}; |
9522 |
+ u16 idx; |
9523 |
+@@ -133,9 +132,6 @@ static void ixgbe_ipsec_clear_hw_tables(struct ixgbe_adapter *adapter) |
9524 |
+ ixgbe_ipsec_set_tx_sa(hw, idx, buf, 0); |
9525 |
+ ixgbe_ipsec_set_rx_sa(hw, idx, 0, buf, 0, 0, 0); |
9526 |
+ } |
9527 |
+- |
9528 |
+- ipsec->num_rx_sa = 0; |
9529 |
+- ipsec->num_tx_sa = 0; |
9530 |
+ } |
9531 |
+ |
9532 |
+ /** |
9533 |
+diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |
9534 |
+index de65ca1e6558..51cd58fbab69 100644 |
9535 |
+--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |
9536 |
++++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |
9537 |
+@@ -1822,13 +1822,7 @@ static void ixgbe_pull_tail(struct ixgbe_ring *rx_ring, |
9538 |
+ static void ixgbe_dma_sync_frag(struct ixgbe_ring *rx_ring, |
9539 |
+ struct sk_buff *skb) |
9540 |
+ { |
9541 |
+- /* if the page was released unmap it, else just sync our portion */ |
9542 |
+- if (unlikely(IXGBE_CB(skb)->page_released)) { |
9543 |
+- dma_unmap_page_attrs(rx_ring->dev, IXGBE_CB(skb)->dma, |
9544 |
+- ixgbe_rx_pg_size(rx_ring), |
9545 |
+- DMA_FROM_DEVICE, |
9546 |
+- IXGBE_RX_DMA_ATTR); |
9547 |
+- } else if (ring_uses_build_skb(rx_ring)) { |
9548 |
++ if (ring_uses_build_skb(rx_ring)) { |
9549 |
+ unsigned long offset = (unsigned long)(skb->data) & ~PAGE_MASK; |
9550 |
+ |
9551 |
+ dma_sync_single_range_for_cpu(rx_ring->dev, |
9552 |
+@@ -1845,6 +1839,14 @@ static void ixgbe_dma_sync_frag(struct ixgbe_ring *rx_ring, |
9553 |
+ skb_frag_size(frag), |
9554 |
+ DMA_FROM_DEVICE); |
9555 |
+ } |
9556 |
++ |
9557 |
++ /* If the page was released, just unmap it. */ |
9558 |
++ if (unlikely(IXGBE_CB(skb)->page_released)) { |
9559 |
++ dma_unmap_page_attrs(rx_ring->dev, IXGBE_CB(skb)->dma, |
9560 |
++ ixgbe_rx_pg_size(rx_ring), |
9561 |
++ DMA_FROM_DEVICE, |
9562 |
++ IXGBE_RX_DMA_ATTR); |
9563 |
++ } |
9564 |
+ } |
9565 |
+ |
9566 |
+ /** |
9567 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c |
9568 |
+index 9cbc4173973e..044687a1f27c 100644 |
9569 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c |
9570 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c |
9571 |
+@@ -1364,8 +1364,14 @@ static inline void mlx5i_complete_rx_cqe(struct mlx5e_rq *rq, |
9572 |
+ |
9573 |
+ skb->protocol = *((__be16 *)(skb->data)); |
9574 |
+ |
9575 |
+- skb->ip_summed = CHECKSUM_COMPLETE; |
9576 |
+- skb->csum = csum_unfold((__force __sum16)cqe->check_sum); |
9577 |
++ if (netdev->features & NETIF_F_RXCSUM) { |
9578 |
++ skb->ip_summed = CHECKSUM_COMPLETE; |
9579 |
++ skb->csum = csum_unfold((__force __sum16)cqe->check_sum); |
9580 |
++ stats->csum_complete++; |
9581 |
++ } else { |
9582 |
++ skb->ip_summed = CHECKSUM_NONE; |
9583 |
++ stats->csum_none++; |
9584 |
++ } |
9585 |
+ |
9586 |
+ if (unlikely(mlx5e_rx_hw_stamp(tstamp))) |
9587 |
+ skb_hwtstamps(skb)->hwtstamp = |
9588 |
+@@ -1384,7 +1390,6 @@ static inline void mlx5i_complete_rx_cqe(struct mlx5e_rq *rq, |
9589 |
+ |
9590 |
+ skb->dev = netdev; |
9591 |
+ |
9592 |
+- stats->csum_complete++; |
9593 |
+ stats->packets++; |
9594 |
+ stats->bytes += cqe_bcnt; |
9595 |
+ } |
9596 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fpga/core.c b/drivers/net/ethernet/mellanox/mlx5/core/fpga/core.c |
9597 |
+index 436a8136f26f..310f9e7d8320 100644 |
9598 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/fpga/core.c |
9599 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/fpga/core.c |
9600 |
+@@ -289,7 +289,6 @@ void mlx5_fpga_event(struct mlx5_core_dev *mdev, u8 event, void *data) |
9601 |
+ const char *event_name; |
9602 |
+ bool teardown = false; |
9603 |
+ unsigned long flags; |
9604 |
+- u32 fpga_qpn; |
9605 |
+ u8 syndrome; |
9606 |
+ |
9607 |
+ switch (event) { |
9608 |
+@@ -300,7 +299,6 @@ void mlx5_fpga_event(struct mlx5_core_dev *mdev, u8 event, void *data) |
9609 |
+ case MLX5_EVENT_TYPE_FPGA_QP_ERROR: |
9610 |
+ syndrome = MLX5_GET(fpga_qp_error_event, data, syndrome); |
9611 |
+ event_name = mlx5_fpga_qp_syndrome_to_string(syndrome); |
9612 |
+- fpga_qpn = MLX5_GET(fpga_qp_error_event, data, fpga_qpn); |
9613 |
+ break; |
9614 |
+ default: |
9615 |
+ mlx5_fpga_warn_ratelimited(fdev, "Unexpected event %u\n", |
9616 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c |
9617 |
+index 82a53317285d..b16e0f45d28c 100644 |
9618 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c |
9619 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c |
9620 |
+@@ -469,6 +469,7 @@ static void del_hw_fte(struct fs_node *node) |
9621 |
+ mlx5_core_warn(dev, |
9622 |
+ "flow steering can't delete fte in index %d of flow group id %d\n", |
9623 |
+ fte->index, fg->id); |
9624 |
++ node->active = 0; |
9625 |
+ } |
9626 |
+ } |
9627 |
+ |
9628 |
+@@ -1597,6 +1598,11 @@ lookup_fte_locked(struct mlx5_flow_group *g, |
9629 |
+ fte_tmp = NULL; |
9630 |
+ goto out; |
9631 |
+ } |
9632 |
++ if (!fte_tmp->node.active) { |
9633 |
++ tree_put_node(&fte_tmp->node); |
9634 |
++ fte_tmp = NULL; |
9635 |
++ goto out; |
9636 |
++ } |
9637 |
+ |
9638 |
+ nested_down_write_ref_node(&fte_tmp->node, FS_LOCK_CHILD); |
9639 |
+ out: |
9640 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/qp.c b/drivers/net/ethernet/mellanox/mlx5/core/qp.c |
9641 |
+index f33707ce8b6b..479ac21cdbc6 100644 |
9642 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/qp.c |
9643 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/qp.c |
9644 |
+@@ -44,14 +44,15 @@ static struct mlx5_core_rsc_common *mlx5_get_rsc(struct mlx5_core_dev *dev, |
9645 |
+ { |
9646 |
+ struct mlx5_qp_table *table = &dev->priv.qp_table; |
9647 |
+ struct mlx5_core_rsc_common *common; |
9648 |
++ unsigned long flags; |
9649 |
+ |
9650 |
+- spin_lock(&table->lock); |
9651 |
++ spin_lock_irqsave(&table->lock, flags); |
9652 |
+ |
9653 |
+ common = radix_tree_lookup(&table->tree, rsn); |
9654 |
+ if (common) |
9655 |
+ atomic_inc(&common->refcount); |
9656 |
+ |
9657 |
+- spin_unlock(&table->lock); |
9658 |
++ spin_unlock_irqrestore(&table->lock, flags); |
9659 |
+ |
9660 |
+ if (!common) { |
9661 |
+ mlx5_core_warn(dev, "Async event for bogus resource 0x%x\n", |
9662 |
+diff --git a/drivers/net/ethernet/mellanox/mlxsw/reg.h b/drivers/net/ethernet/mellanox/mlxsw/reg.h |
9663 |
+index aee58b3892f2..c9895876a231 100644 |
9664 |
+--- a/drivers/net/ethernet/mellanox/mlxsw/reg.h |
9665 |
++++ b/drivers/net/ethernet/mellanox/mlxsw/reg.h |
9666 |
+@@ -3215,7 +3215,7 @@ static inline void mlxsw_reg_qtct_pack(char *payload, u8 local_port, |
9667 |
+ * Configures the ETS elements. |
9668 |
+ */ |
9669 |
+ #define MLXSW_REG_QEEC_ID 0x400D |
9670 |
+-#define MLXSW_REG_QEEC_LEN 0x1C |
9671 |
++#define MLXSW_REG_QEEC_LEN 0x20 |
9672 |
+ |
9673 |
+ MLXSW_REG_DEFINE(qeec, MLXSW_REG_QEEC_ID, MLXSW_REG_QEEC_LEN); |
9674 |
+ |
9675 |
+@@ -3257,6 +3257,15 @@ MLXSW_ITEM32(reg, qeec, element_index, 0x04, 0, 8); |
9676 |
+ */ |
9677 |
+ MLXSW_ITEM32(reg, qeec, next_element_index, 0x08, 0, 8); |
9678 |
+ |
9679 |
++/* reg_qeec_mise |
9680 |
++ * Min shaper configuration enable. Enables configuration of the min |
9681 |
++ * shaper on this ETS element |
9682 |
++ * 0 - Disable |
9683 |
++ * 1 - Enable |
9684 |
++ * Access: RW |
9685 |
++ */ |
9686 |
++MLXSW_ITEM32(reg, qeec, mise, 0x0C, 31, 1); |
9687 |
++ |
9688 |
+ enum { |
9689 |
+ MLXSW_REG_QEEC_BYTES_MODE, |
9690 |
+ MLXSW_REG_QEEC_PACKETS_MODE, |
9691 |
+@@ -3273,6 +3282,17 @@ enum { |
9692 |
+ */ |
9693 |
+ MLXSW_ITEM32(reg, qeec, pb, 0x0C, 28, 1); |
9694 |
+ |
9695 |
++/* The smallest permitted min shaper rate. */ |
9696 |
++#define MLXSW_REG_QEEC_MIS_MIN 200000 /* Kbps */ |
9697 |
++ |
9698 |
++/* reg_qeec_min_shaper_rate |
9699 |
++ * Min shaper information rate. |
9700 |
++ * For CPU port, can only be configured for port hierarchy. |
9701 |
++ * When in bytes mode, value is specified in units of 1000bps. |
9702 |
++ * Access: RW |
9703 |
++ */ |
9704 |
++MLXSW_ITEM32(reg, qeec, min_shaper_rate, 0x0C, 0, 28); |
9705 |
++ |
9706 |
+ /* reg_qeec_mase |
9707 |
+ * Max shaper configuration enable. Enables configuration of the max |
9708 |
+ * shaper on this ETS element. |
9709 |
+diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c |
9710 |
+index 30ef318b3d68..5df9b25cab27 100644 |
9711 |
+--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c |
9712 |
++++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c |
9713 |
+@@ -2753,6 +2753,21 @@ int mlxsw_sp_port_ets_maxrate_set(struct mlxsw_sp_port *mlxsw_sp_port, |
9714 |
+ return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(qeec), qeec_pl); |
9715 |
+ } |
9716 |
+ |
9717 |
++static int mlxsw_sp_port_min_bw_set(struct mlxsw_sp_port *mlxsw_sp_port, |
9718 |
++ enum mlxsw_reg_qeec_hr hr, u8 index, |
9719 |
++ u8 next_index, u32 minrate) |
9720 |
++{ |
9721 |
++ struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; |
9722 |
++ char qeec_pl[MLXSW_REG_QEEC_LEN]; |
9723 |
++ |
9724 |
++ mlxsw_reg_qeec_pack(qeec_pl, mlxsw_sp_port->local_port, hr, index, |
9725 |
++ next_index); |
9726 |
++ mlxsw_reg_qeec_mise_set(qeec_pl, true); |
9727 |
++ mlxsw_reg_qeec_min_shaper_rate_set(qeec_pl, minrate); |
9728 |
++ |
9729 |
++ return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(qeec), qeec_pl); |
9730 |
++} |
9731 |
++ |
9732 |
+ int mlxsw_sp_port_prio_tc_set(struct mlxsw_sp_port *mlxsw_sp_port, |
9733 |
+ u8 switch_prio, u8 tclass) |
9734 |
+ { |
9735 |
+@@ -2830,6 +2845,16 @@ static int mlxsw_sp_port_ets_init(struct mlxsw_sp_port *mlxsw_sp_port) |
9736 |
+ return err; |
9737 |
+ } |
9738 |
+ |
9739 |
++ /* Configure the min shaper for multicast TCs. */ |
9740 |
++ for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) { |
9741 |
++ err = mlxsw_sp_port_min_bw_set(mlxsw_sp_port, |
9742 |
++ MLXSW_REG_QEEC_HIERARCY_TC, |
9743 |
++ i + 8, i, |
9744 |
++ MLXSW_REG_QEEC_MIS_MIN); |
9745 |
++ if (err) |
9746 |
++ return err; |
9747 |
++ } |
9748 |
++ |
9749 |
+ /* Map all priorities to traffic class 0. */ |
9750 |
+ for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) { |
9751 |
+ err = mlxsw_sp_port_prio_tc_set(mlxsw_sp_port, i, 0); |
9752 |
+diff --git a/drivers/net/ethernet/natsemi/sonic.c b/drivers/net/ethernet/natsemi/sonic.c |
9753 |
+index c805dcbebd02..5f1875fe47cd 100644 |
9754 |
+--- a/drivers/net/ethernet/natsemi/sonic.c |
9755 |
++++ b/drivers/net/ethernet/natsemi/sonic.c |
9756 |
+@@ -231,9 +231,9 @@ static int sonic_send_packet(struct sk_buff *skb, struct net_device *dev) |
9757 |
+ |
9758 |
+ laddr = dma_map_single(lp->device, skb->data, length, DMA_TO_DEVICE); |
9759 |
+ if (!laddr) { |
9760 |
+- printk(KERN_ERR "%s: failed to map tx DMA buffer.\n", dev->name); |
9761 |
+- dev_kfree_skb(skb); |
9762 |
+- return NETDEV_TX_BUSY; |
9763 |
++ pr_err_ratelimited("%s: failed to map tx DMA buffer.\n", dev->name); |
9764 |
++ dev_kfree_skb_any(skb); |
9765 |
++ return NETDEV_TX_OK; |
9766 |
+ } |
9767 |
+ |
9768 |
+ sonic_tda_put(dev, entry, SONIC_TD_STATUS, 0); /* clear status */ |
9769 |
+diff --git a/drivers/net/ethernet/netronome/nfp/bpf/jit.c b/drivers/net/ethernet/netronome/nfp/bpf/jit.c |
9770 |
+index 4e18d95e548f..c3ce0fb47a0f 100644 |
9771 |
+--- a/drivers/net/ethernet/netronome/nfp/bpf/jit.c |
9772 |
++++ b/drivers/net/ethernet/netronome/nfp/bpf/jit.c |
9773 |
+@@ -326,7 +326,18 @@ __emit_shf(struct nfp_prog *nfp_prog, u16 dst, enum alu_dst_ab dst_ab, |
9774 |
+ return; |
9775 |
+ } |
9776 |
+ |
9777 |
+- if (sc == SHF_SC_L_SHF) |
9778 |
++ /* NFP shift instruction has something special. If shift direction is |
9779 |
++ * left then shift amount of 1 to 31 is specified as 32 minus the amount |
9780 |
++ * to shift. |
9781 |
++ * |
9782 |
++ * But no need to do this for indirect shift which has shift amount be |
9783 |
++ * 0. Even after we do this subtraction, shift amount 0 will be turned |
9784 |
++ * into 32 which will eventually be encoded the same as 0 because only |
9785 |
++ * low 5 bits are encoded, but shift amount be 32 will fail the |
9786 |
++ * FIELD_PREP check done later on shift mask (0x1f), due to 32 is out of |
9787 |
++ * mask range. |
9788 |
++ */ |
9789 |
++ if (sc == SHF_SC_L_SHF && shift) |
9790 |
+ shift = 32 - shift; |
9791 |
+ |
9792 |
+ insn = OP_SHF_BASE | |
9793 |
+diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_ctrl.h b/drivers/net/ethernet/netronome/nfp/nfp_net_ctrl.h |
9794 |
+index 44d3ea75d043..ab602a79b084 100644 |
9795 |
+--- a/drivers/net/ethernet/netronome/nfp/nfp_net_ctrl.h |
9796 |
++++ b/drivers/net/ethernet/netronome/nfp/nfp_net_ctrl.h |
9797 |
+@@ -423,7 +423,7 @@ |
9798 |
+ #define NFP_NET_CFG_MBOX_SIMPLE_CMD 0x0 |
9799 |
+ #define NFP_NET_CFG_MBOX_SIMPLE_RET 0x4 |
9800 |
+ #define NFP_NET_CFG_MBOX_SIMPLE_VAL 0x8 |
9801 |
+-#define NFP_NET_CFG_MBOX_SIMPLE_LEN 0x12 |
9802 |
++#define NFP_NET_CFG_MBOX_SIMPLE_LEN 12 |
9803 |
+ |
9804 |
+ #define NFP_NET_CFG_MBOX_CMD_CTAG_FILTER_ADD 1 |
9805 |
+ #define NFP_NET_CFG_MBOX_CMD_CTAG_FILTER_KILL 2 |
9806 |
+diff --git a/drivers/net/ethernet/ni/nixge.c b/drivers/net/ethernet/ni/nixge.c |
9807 |
+index 76efed058f33..a791d7932b0e 100644 |
9808 |
+--- a/drivers/net/ethernet/ni/nixge.c |
9809 |
++++ b/drivers/net/ethernet/ni/nixge.c |
9810 |
+@@ -1233,7 +1233,7 @@ static int nixge_probe(struct platform_device *pdev) |
9811 |
+ } |
9812 |
+ |
9813 |
+ priv->phy_mode = of_get_phy_mode(pdev->dev.of_node); |
9814 |
+- if (priv->phy_mode < 0) { |
9815 |
++ if ((int)priv->phy_mode < 0) { |
9816 |
+ netdev_err(ndev, "not find \"phy-mode\" property\n"); |
9817 |
+ err = -EINVAL; |
9818 |
+ goto unregister_mdio; |
9819 |
+diff --git a/drivers/net/ethernet/pasemi/pasemi_mac.c b/drivers/net/ethernet/pasemi/pasemi_mac.c |
9820 |
+index 8a31a02c9f47..65f69e562618 100644 |
9821 |
+--- a/drivers/net/ethernet/pasemi/pasemi_mac.c |
9822 |
++++ b/drivers/net/ethernet/pasemi/pasemi_mac.c |
9823 |
+@@ -1053,7 +1053,6 @@ static int pasemi_mac_phy_init(struct net_device *dev) |
9824 |
+ |
9825 |
+ dn = pci_device_to_OF_node(mac->pdev); |
9826 |
+ phy_dn = of_parse_phandle(dn, "phy-handle", 0); |
9827 |
+- of_node_put(phy_dn); |
9828 |
+ |
9829 |
+ mac->link = 0; |
9830 |
+ mac->speed = 0; |
9831 |
+@@ -1062,6 +1061,7 @@ static int pasemi_mac_phy_init(struct net_device *dev) |
9832 |
+ phydev = of_phy_connect(dev, phy_dn, &pasemi_adjust_link, 0, |
9833 |
+ PHY_INTERFACE_MODE_SGMII); |
9834 |
+ |
9835 |
++ of_node_put(phy_dn); |
9836 |
+ if (!phydev) { |
9837 |
+ printk(KERN_ERR "%s: Could not attach to phy\n", dev->name); |
9838 |
+ return -ENODEV; |
9839 |
+diff --git a/drivers/net/ethernet/qlogic/qed/qed_iwarp.c b/drivers/net/ethernet/qlogic/qed/qed_iwarp.c |
9840 |
+index 7002a660b6b4..39787bb885c8 100644 |
9841 |
+--- a/drivers/net/ethernet/qlogic/qed/qed_iwarp.c |
9842 |
++++ b/drivers/net/ethernet/qlogic/qed/qed_iwarp.c |
9843 |
+@@ -532,7 +532,8 @@ int qed_iwarp_destroy_qp(struct qed_hwfn *p_hwfn, struct qed_rdma_qp *qp) |
9844 |
+ |
9845 |
+ /* Make sure ep is closed before returning and freeing memory. */ |
9846 |
+ if (ep) { |
9847 |
+- while (ep->state != QED_IWARP_EP_CLOSED && wait_count++ < 200) |
9848 |
++ while (READ_ONCE(ep->state) != QED_IWARP_EP_CLOSED && |
9849 |
++ wait_count++ < 200) |
9850 |
+ msleep(100); |
9851 |
+ |
9852 |
+ if (ep->state != QED_IWARP_EP_CLOSED) |
9853 |
+@@ -1023,8 +1024,6 @@ qed_iwarp_mpa_complete(struct qed_hwfn *p_hwfn, |
9854 |
+ |
9855 |
+ params.ep_context = ep; |
9856 |
+ |
9857 |
+- ep->state = QED_IWARP_EP_CLOSED; |
9858 |
+- |
9859 |
+ switch (fw_return_code) { |
9860 |
+ case RDMA_RETURN_OK: |
9861 |
+ ep->qp->max_rd_atomic_req = ep->cm_info.ord; |
9862 |
+@@ -1084,6 +1083,10 @@ qed_iwarp_mpa_complete(struct qed_hwfn *p_hwfn, |
9863 |
+ break; |
9864 |
+ } |
9865 |
+ |
9866 |
++ if (fw_return_code != RDMA_RETURN_OK) |
9867 |
++ /* paired with READ_ONCE in destroy_qp */ |
9868 |
++ smp_store_release(&ep->state, QED_IWARP_EP_CLOSED); |
9869 |
++ |
9870 |
+ ep->event_cb(ep->cb_context, ¶ms); |
9871 |
+ |
9872 |
+ /* on passive side, if there is no associated QP (REJECT) we need to |
9873 |
+@@ -2638,6 +2641,7 @@ qed_iwarp_ll2_start(struct qed_hwfn *p_hwfn, |
9874 |
+ cbs.rx_release_cb = qed_iwarp_ll2_rel_rx_pkt; |
9875 |
+ cbs.tx_comp_cb = qed_iwarp_ll2_comp_tx_pkt; |
9876 |
+ cbs.tx_release_cb = qed_iwarp_ll2_rel_tx_pkt; |
9877 |
++ cbs.slowpath_cb = NULL; |
9878 |
+ cbs.cookie = p_hwfn; |
9879 |
+ |
9880 |
+ memset(&data, 0, sizeof(data)); |
9881 |
+@@ -2828,7 +2832,9 @@ static void qed_iwarp_qp_in_error(struct qed_hwfn *p_hwfn, |
9882 |
+ params.status = (fw_return_code == IWARP_QP_IN_ERROR_GOOD_CLOSE) ? |
9883 |
+ 0 : -ECONNRESET; |
9884 |
+ |
9885 |
+- ep->state = QED_IWARP_EP_CLOSED; |
9886 |
++ /* paired with READ_ONCE in destroy_qp */ |
9887 |
++ smp_store_release(&ep->state, QED_IWARP_EP_CLOSED); |
9888 |
++ |
9889 |
+ spin_lock_bh(&p_hwfn->p_rdma_info->iwarp.iw_lock); |
9890 |
+ list_del(&ep->list_entry); |
9891 |
+ spin_unlock_bh(&p_hwfn->p_rdma_info->iwarp.iw_lock); |
9892 |
+@@ -2917,7 +2923,8 @@ qed_iwarp_tcp_connect_unsuccessful(struct qed_hwfn *p_hwfn, |
9893 |
+ params.event = QED_IWARP_EVENT_ACTIVE_COMPLETE; |
9894 |
+ params.ep_context = ep; |
9895 |
+ params.cm_info = &ep->cm_info; |
9896 |
+- ep->state = QED_IWARP_EP_CLOSED; |
9897 |
++ /* paired with READ_ONCE in destroy_qp */ |
9898 |
++ smp_store_release(&ep->state, QED_IWARP_EP_CLOSED); |
9899 |
+ |
9900 |
+ switch (fw_return_code) { |
9901 |
+ case IWARP_CONN_ERROR_TCP_CONNECT_INVALID_PACKET: |
9902 |
+diff --git a/drivers/net/ethernet/qlogic/qed/qed_l2.c b/drivers/net/ethernet/qlogic/qed/qed_l2.c |
9903 |
+index 64ac95ca4df2..d921b991dbdb 100644 |
9904 |
+--- a/drivers/net/ethernet/qlogic/qed/qed_l2.c |
9905 |
++++ b/drivers/net/ethernet/qlogic/qed/qed_l2.c |
9906 |
+@@ -1631,10 +1631,9 @@ static void __qed_get_vport_pstats_addrlen(struct qed_hwfn *p_hwfn, |
9907 |
+ } |
9908 |
+ } |
9909 |
+ |
9910 |
+-static void __qed_get_vport_pstats(struct qed_hwfn *p_hwfn, |
9911 |
+- struct qed_ptt *p_ptt, |
9912 |
+- struct qed_eth_stats *p_stats, |
9913 |
+- u16 statistics_bin) |
9914 |
++static noinline_for_stack void |
9915 |
++__qed_get_vport_pstats(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt, |
9916 |
++ struct qed_eth_stats *p_stats, u16 statistics_bin) |
9917 |
+ { |
9918 |
+ struct eth_pstorm_per_queue_stat pstats; |
9919 |
+ u32 pstats_addr = 0, pstats_len = 0; |
9920 |
+@@ -1661,10 +1660,9 @@ static void __qed_get_vport_pstats(struct qed_hwfn *p_hwfn, |
9921 |
+ HILO_64_REGPAIR(pstats.error_drop_pkts); |
9922 |
+ } |
9923 |
+ |
9924 |
+-static void __qed_get_vport_tstats(struct qed_hwfn *p_hwfn, |
9925 |
+- struct qed_ptt *p_ptt, |
9926 |
+- struct qed_eth_stats *p_stats, |
9927 |
+- u16 statistics_bin) |
9928 |
++static noinline_for_stack void |
9929 |
++__qed_get_vport_tstats(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt, |
9930 |
++ struct qed_eth_stats *p_stats, u16 statistics_bin) |
9931 |
+ { |
9932 |
+ struct tstorm_per_port_stat tstats; |
9933 |
+ u32 tstats_addr, tstats_len; |
9934 |
+@@ -1709,10 +1707,9 @@ static void __qed_get_vport_ustats_addrlen(struct qed_hwfn *p_hwfn, |
9935 |
+ } |
9936 |
+ } |
9937 |
+ |
9938 |
+-static void __qed_get_vport_ustats(struct qed_hwfn *p_hwfn, |
9939 |
+- struct qed_ptt *p_ptt, |
9940 |
+- struct qed_eth_stats *p_stats, |
9941 |
+- u16 statistics_bin) |
9942 |
++static noinline_for_stack |
9943 |
++void __qed_get_vport_ustats(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt, |
9944 |
++ struct qed_eth_stats *p_stats, u16 statistics_bin) |
9945 |
+ { |
9946 |
+ struct eth_ustorm_per_queue_stat ustats; |
9947 |
+ u32 ustats_addr = 0, ustats_len = 0; |
9948 |
+@@ -1751,10 +1748,9 @@ static void __qed_get_vport_mstats_addrlen(struct qed_hwfn *p_hwfn, |
9949 |
+ } |
9950 |
+ } |
9951 |
+ |
9952 |
+-static void __qed_get_vport_mstats(struct qed_hwfn *p_hwfn, |
9953 |
+- struct qed_ptt *p_ptt, |
9954 |
+- struct qed_eth_stats *p_stats, |
9955 |
+- u16 statistics_bin) |
9956 |
++static noinline_for_stack void |
9957 |
++__qed_get_vport_mstats(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt, |
9958 |
++ struct qed_eth_stats *p_stats, u16 statistics_bin) |
9959 |
+ { |
9960 |
+ struct eth_mstorm_per_queue_stat mstats; |
9961 |
+ u32 mstats_addr = 0, mstats_len = 0; |
9962 |
+@@ -1780,9 +1776,9 @@ static void __qed_get_vport_mstats(struct qed_hwfn *p_hwfn, |
9963 |
+ HILO_64_REGPAIR(mstats.tpa_coalesced_bytes); |
9964 |
+ } |
9965 |
+ |
9966 |
+-static void __qed_get_vport_port_stats(struct qed_hwfn *p_hwfn, |
9967 |
+- struct qed_ptt *p_ptt, |
9968 |
+- struct qed_eth_stats *p_stats) |
9969 |
++static noinline_for_stack void |
9970 |
++__qed_get_vport_port_stats(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt, |
9971 |
++ struct qed_eth_stats *p_stats) |
9972 |
+ { |
9973 |
+ struct qed_eth_stats_common *p_common = &p_stats->common; |
9974 |
+ struct port_stats port_stats; |
9975 |
+diff --git a/drivers/net/ethernet/qualcomm/qca_spi.c b/drivers/net/ethernet/qualcomm/qca_spi.c |
9976 |
+index 66b775d462fd..9d188931bc09 100644 |
9977 |
+--- a/drivers/net/ethernet/qualcomm/qca_spi.c |
9978 |
++++ b/drivers/net/ethernet/qualcomm/qca_spi.c |
9979 |
+@@ -475,7 +475,6 @@ qcaspi_qca7k_sync(struct qcaspi *qca, int event) |
9980 |
+ u16 signature = 0; |
9981 |
+ u16 spi_config; |
9982 |
+ u16 wrbuf_space = 0; |
9983 |
+- static u16 reset_count; |
9984 |
+ |
9985 |
+ if (event == QCASPI_EVENT_CPUON) { |
9986 |
+ /* Read signature twice, if not valid |
9987 |
+@@ -528,13 +527,13 @@ qcaspi_qca7k_sync(struct qcaspi *qca, int event) |
9988 |
+ |
9989 |
+ qca->sync = QCASPI_SYNC_RESET; |
9990 |
+ qca->stats.trig_reset++; |
9991 |
+- reset_count = 0; |
9992 |
++ qca->reset_count = 0; |
9993 |
+ break; |
9994 |
+ case QCASPI_SYNC_RESET: |
9995 |
+- reset_count++; |
9996 |
++ qca->reset_count++; |
9997 |
+ netdev_dbg(qca->net_dev, "sync: waiting for CPU on, count %u.\n", |
9998 |
+- reset_count); |
9999 |
+- if (reset_count >= QCASPI_RESET_TIMEOUT) { |
10000 |
++ qca->reset_count); |
10001 |
++ if (qca->reset_count >= QCASPI_RESET_TIMEOUT) { |
10002 |
+ /* reset did not seem to take place, try again */ |
10003 |
+ qca->sync = QCASPI_SYNC_UNKNOWN; |
10004 |
+ qca->stats.reset_timeout++; |
10005 |
+diff --git a/drivers/net/ethernet/qualcomm/qca_spi.h b/drivers/net/ethernet/qualcomm/qca_spi.h |
10006 |
+index fc0e98726b36..719c41227f22 100644 |
10007 |
+--- a/drivers/net/ethernet/qualcomm/qca_spi.h |
10008 |
++++ b/drivers/net/ethernet/qualcomm/qca_spi.h |
10009 |
+@@ -92,6 +92,7 @@ struct qcaspi { |
10010 |
+ |
10011 |
+ unsigned int intr_req; |
10012 |
+ unsigned int intr_svc; |
10013 |
++ u16 reset_count; |
10014 |
+ |
10015 |
+ #ifdef CONFIG_DEBUG_FS |
10016 |
+ struct dentry *device_root; |
10017 |
+diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c |
10018 |
+index 6068e96f5ac1..441643670ac0 100644 |
10019 |
+--- a/drivers/net/ethernet/renesas/sh_eth.c |
10020 |
++++ b/drivers/net/ethernet/renesas/sh_eth.c |
10021 |
+@@ -3133,12 +3133,16 @@ static struct sh_eth_plat_data *sh_eth_parse_dt(struct device *dev) |
10022 |
+ struct device_node *np = dev->of_node; |
10023 |
+ struct sh_eth_plat_data *pdata; |
10024 |
+ const char *mac_addr; |
10025 |
++ int ret; |
10026 |
+ |
10027 |
+ pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); |
10028 |
+ if (!pdata) |
10029 |
+ return NULL; |
10030 |
+ |
10031 |
+- pdata->phy_interface = of_get_phy_mode(np); |
10032 |
++ ret = of_get_phy_mode(np); |
10033 |
++ if (ret < 0) |
10034 |
++ return NULL; |
10035 |
++ pdata->phy_interface = ret; |
10036 |
+ |
10037 |
+ mac_addr = of_get_mac_address(np); |
10038 |
+ if (mac_addr) |
10039 |
+diff --git a/drivers/net/ethernet/socionext/netsec.c b/drivers/net/ethernet/socionext/netsec.c |
10040 |
+index 28d582c18afb..027367b9cc48 100644 |
10041 |
+--- a/drivers/net/ethernet/socionext/netsec.c |
10042 |
++++ b/drivers/net/ethernet/socionext/netsec.c |
10043 |
+@@ -432,9 +432,12 @@ static int netsec_mac_update_to_phy_state(struct netsec_priv *priv) |
10044 |
+ return 0; |
10045 |
+ } |
10046 |
+ |
10047 |
++static int netsec_phy_read(struct mii_bus *bus, int phy_addr, int reg_addr); |
10048 |
++ |
10049 |
+ static int netsec_phy_write(struct mii_bus *bus, |
10050 |
+ int phy_addr, int reg, u16 val) |
10051 |
+ { |
10052 |
++ int status; |
10053 |
+ struct netsec_priv *priv = bus->priv; |
10054 |
+ |
10055 |
+ if (netsec_mac_write(priv, GMAC_REG_GDR, val)) |
10056 |
+@@ -447,8 +450,19 @@ static int netsec_phy_write(struct mii_bus *bus, |
10057 |
+ GMAC_REG_SHIFT_CR_GAR))) |
10058 |
+ return -ETIMEDOUT; |
10059 |
+ |
10060 |
+- return netsec_mac_wait_while_busy(priv, GMAC_REG_GAR, |
10061 |
+- NETSEC_GMAC_GAR_REG_GB); |
10062 |
++ status = netsec_mac_wait_while_busy(priv, GMAC_REG_GAR, |
10063 |
++ NETSEC_GMAC_GAR_REG_GB); |
10064 |
++ |
10065 |
++ /* Developerbox implements RTL8211E PHY and there is |
10066 |
++ * a compatibility problem with F_GMAC4. |
10067 |
++ * RTL8211E expects MDC clock must be kept toggling for several |
10068 |
++ * clock cycle with MDIO high before entering the IDLE state. |
10069 |
++ * To meet this requirement, netsec driver needs to issue dummy |
10070 |
++ * read(e.g. read PHYID1(offset 0x2) register) right after write. |
10071 |
++ */ |
10072 |
++ netsec_phy_read(bus, phy_addr, MII_PHYSID1); |
10073 |
++ |
10074 |
++ return status; |
10075 |
+ } |
10076 |
+ |
10077 |
+ static int netsec_phy_read(struct mii_bus *bus, int phy_addr, int reg_addr) |
10078 |
+@@ -1590,7 +1604,7 @@ static int netsec_probe(struct platform_device *pdev) |
10079 |
+ NETIF_MSG_LINK | NETIF_MSG_PROBE; |
10080 |
+ |
10081 |
+ priv->phy_interface = device_get_phy_mode(&pdev->dev); |
10082 |
+- if (priv->phy_interface < 0) { |
10083 |
++ if ((int)priv->phy_interface < 0) { |
10084 |
+ dev_err(&pdev->dev, "missing required property 'phy-mode'\n"); |
10085 |
+ ret = -ENODEV; |
10086 |
+ goto free_ndev; |
10087 |
+diff --git a/drivers/net/ethernet/socionext/sni_ave.c b/drivers/net/ethernet/socionext/sni_ave.c |
10088 |
+index 09d25b87cf7c..c309accc6797 100644 |
10089 |
+--- a/drivers/net/ethernet/socionext/sni_ave.c |
10090 |
++++ b/drivers/net/ethernet/socionext/sni_ave.c |
10091 |
+@@ -1575,7 +1575,7 @@ static int ave_probe(struct platform_device *pdev) |
10092 |
+ |
10093 |
+ np = dev->of_node; |
10094 |
+ phy_mode = of_get_phy_mode(np); |
10095 |
+- if (phy_mode < 0) { |
10096 |
++ if ((int)phy_mode < 0) { |
10097 |
+ dev_err(dev, "phy-mode not found\n"); |
10098 |
+ return -EINVAL; |
10099 |
+ } |
10100 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c |
10101 |
+index 2c6d7c69c8f7..0d21082ceb93 100644 |
10102 |
+--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c |
10103 |
++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c |
10104 |
+@@ -191,7 +191,7 @@ static int ipq806x_gmac_of_parse(struct ipq806x_gmac *gmac) |
10105 |
+ struct device *dev = &gmac->pdev->dev; |
10106 |
+ |
10107 |
+ gmac->phy_mode = of_get_phy_mode(dev->of_node); |
10108 |
+- if (gmac->phy_mode < 0) { |
10109 |
++ if ((int)gmac->phy_mode < 0) { |
10110 |
+ dev_err(dev, "missing phy mode property\n"); |
10111 |
+ return -EINVAL; |
10112 |
+ } |
10113 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c |
10114 |
+index 94b46258e8ff..0a17535f13ae 100644 |
10115 |
+--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c |
10116 |
++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c |
10117 |
+@@ -355,7 +355,7 @@ static int meson8b_dwmac_probe(struct platform_device *pdev) |
10118 |
+ |
10119 |
+ dwmac->dev = &pdev->dev; |
10120 |
+ dwmac->phy_mode = of_get_phy_mode(pdev->dev.of_node); |
10121 |
+- if (dwmac->phy_mode < 0) { |
10122 |
++ if ((int)dwmac->phy_mode < 0) { |
10123 |
+ dev_err(&pdev->dev, "missing phy-mode property\n"); |
10124 |
+ ret = -EINVAL; |
10125 |
+ goto err_remove_config_dt; |
10126 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c |
10127 |
+index 48cf5e2b2441..bc8871e7351f 100644 |
10128 |
+--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c |
10129 |
++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c |
10130 |
+@@ -443,7 +443,7 @@ static void dwmac4_set_filter(struct mac_device_info *hw, |
10131 |
+ } |
10132 |
+ |
10133 |
+ /* Handle multiple unicast addresses */ |
10134 |
+- if (netdev_uc_count(dev) > GMAC_MAX_PERFECT_ADDRESSES) { |
10135 |
++ if (netdev_uc_count(dev) > hw->unicast_filter_entries) { |
10136 |
+ /* Switch to promiscuous mode if more than 128 addrs |
10137 |
+ * are required |
10138 |
+ */ |
10139 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac5.c b/drivers/net/ethernet/stmicro/stmmac/dwmac5.c |
10140 |
+index 3f4f3132e16b..e436fa160c7d 100644 |
10141 |
+--- a/drivers/net/ethernet/stmicro/stmmac/dwmac5.c |
10142 |
++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac5.c |
10143 |
+@@ -515,6 +515,7 @@ int dwmac5_flex_pps_config(void __iomem *ioaddr, int index, |
10144 |
+ |
10145 |
+ if (!enable) { |
10146 |
+ val |= PPSCMDx(index, 0x5); |
10147 |
++ val |= PPSEN0; |
10148 |
+ writel(val, ioaddr + MAC_PPS_CONTROL); |
10149 |
+ return 0; |
10150 |
+ } |
10151 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c |
10152 |
+index cc60b3fb0892..8f8b8f381ffd 100644 |
10153 |
+--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c |
10154 |
++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c |
10155 |
+@@ -174,7 +174,7 @@ static int stmmac_enable(struct ptp_clock_info *ptp, |
10156 |
+ /* structure describing a PTP hardware clock */ |
10157 |
+ static struct ptp_clock_info stmmac_ptp_clock_ops = { |
10158 |
+ .owner = THIS_MODULE, |
10159 |
+- .name = "stmmac_ptp_clock", |
10160 |
++ .name = "stmmac ptp", |
10161 |
+ .max_adj = 62500000, |
10162 |
+ .n_alarm = 0, |
10163 |
+ .n_ext_ts = 0, |
10164 |
+diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c |
10165 |
+index 28764268a44f..b093f14eeec3 100644 |
10166 |
+--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c |
10167 |
++++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c |
10168 |
+@@ -1573,7 +1573,7 @@ static int axienet_probe(struct platform_device *pdev) |
10169 |
+ } |
10170 |
+ } else { |
10171 |
+ lp->phy_mode = of_get_phy_mode(pdev->dev.of_node); |
10172 |
+- if (lp->phy_mode < 0) { |
10173 |
++ if ((int)lp->phy_mode < 0) { |
10174 |
+ ret = -EINVAL; |
10175 |
+ goto free_netdev; |
10176 |
+ } |
10177 |
+diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h |
10178 |
+index 50709c76b672..dfa801315da6 100644 |
10179 |
+--- a/drivers/net/hyperv/hyperv_net.h |
10180 |
++++ b/drivers/net/hyperv/hyperv_net.h |
10181 |
+@@ -616,7 +616,8 @@ struct nvsp_5_send_indirect_table { |
10182 |
+ /* The number of entries in the send indirection table */ |
10183 |
+ u32 count; |
10184 |
+ |
10185 |
+- /* The offset of the send indirection table from top of this struct. |
10186 |
++ /* The offset of the send indirection table from the beginning of |
10187 |
++ * struct nvsp_message. |
10188 |
+ * The send indirection table tells which channel to put the send |
10189 |
+ * traffic on. Each entry is a channel number. |
10190 |
+ */ |
10191 |
+diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c |
10192 |
+index 35413041dcf8..dbfd3a0c97d3 100644 |
10193 |
+--- a/drivers/net/hyperv/netvsc.c |
10194 |
++++ b/drivers/net/hyperv/netvsc.c |
10195 |
+@@ -1182,20 +1182,39 @@ static int netvsc_receive(struct net_device *ndev, |
10196 |
+ } |
10197 |
+ |
10198 |
+ static void netvsc_send_table(struct net_device *ndev, |
10199 |
+- const struct nvsp_message *nvmsg) |
10200 |
++ struct netvsc_device *nvscdev, |
10201 |
++ const struct nvsp_message *nvmsg, |
10202 |
++ u32 msglen) |
10203 |
+ { |
10204 |
+ struct net_device_context *net_device_ctx = netdev_priv(ndev); |
10205 |
+- u32 count, *tab; |
10206 |
++ u32 count, offset, *tab; |
10207 |
+ int i; |
10208 |
+ |
10209 |
+ count = nvmsg->msg.v5_msg.send_table.count; |
10210 |
++ offset = nvmsg->msg.v5_msg.send_table.offset; |
10211 |
++ |
10212 |
+ if (count != VRSS_SEND_TAB_SIZE) { |
10213 |
+ netdev_err(ndev, "Received wrong send-table size:%u\n", count); |
10214 |
+ return; |
10215 |
+ } |
10216 |
+ |
10217 |
+- tab = (u32 *)((unsigned long)&nvmsg->msg.v5_msg.send_table + |
10218 |
+- nvmsg->msg.v5_msg.send_table.offset); |
10219 |
++ /* If negotiated version <= NVSP_PROTOCOL_VERSION_6, the offset may be |
10220 |
++ * wrong due to a host bug. So fix the offset here. |
10221 |
++ */ |
10222 |
++ if (nvscdev->nvsp_version <= NVSP_PROTOCOL_VERSION_6 && |
10223 |
++ msglen >= sizeof(struct nvsp_message_header) + |
10224 |
++ sizeof(union nvsp_6_message_uber) + count * sizeof(u32)) |
10225 |
++ offset = sizeof(struct nvsp_message_header) + |
10226 |
++ sizeof(union nvsp_6_message_uber); |
10227 |
++ |
10228 |
++ /* Boundary check for all versions */ |
10229 |
++ if (offset > msglen - count * sizeof(u32)) { |
10230 |
++ netdev_err(ndev, "Received send-table offset too big:%u\n", |
10231 |
++ offset); |
10232 |
++ return; |
10233 |
++ } |
10234 |
++ |
10235 |
++ tab = (void *)nvmsg + offset; |
10236 |
+ |
10237 |
+ for (i = 0; i < count; i++) |
10238 |
+ net_device_ctx->tx_table[i] = tab[i]; |
10239 |
+@@ -1213,12 +1232,14 @@ static void netvsc_send_vf(struct net_device *ndev, |
10240 |
+ net_device_ctx->vf_alloc ? "added" : "removed"); |
10241 |
+ } |
10242 |
+ |
10243 |
+-static void netvsc_receive_inband(struct net_device *ndev, |
10244 |
+- const struct nvsp_message *nvmsg) |
10245 |
++static void netvsc_receive_inband(struct net_device *ndev, |
10246 |
++ struct netvsc_device *nvscdev, |
10247 |
++ const struct nvsp_message *nvmsg, |
10248 |
++ u32 msglen) |
10249 |
+ { |
10250 |
+ switch (nvmsg->hdr.msg_type) { |
10251 |
+ case NVSP_MSG5_TYPE_SEND_INDIRECTION_TABLE: |
10252 |
+- netvsc_send_table(ndev, nvmsg); |
10253 |
++ netvsc_send_table(ndev, nvscdev, nvmsg, msglen); |
10254 |
+ break; |
10255 |
+ |
10256 |
+ case NVSP_MSG4_TYPE_SEND_VF_ASSOCIATION: |
10257 |
+@@ -1235,6 +1256,7 @@ static int netvsc_process_raw_pkt(struct hv_device *device, |
10258 |
+ int budget) |
10259 |
+ { |
10260 |
+ const struct nvsp_message *nvmsg = hv_pkt_data(desc); |
10261 |
++ u32 msglen = hv_pkt_datalen(desc); |
10262 |
+ |
10263 |
+ trace_nvsp_recv(ndev, channel, nvmsg); |
10264 |
+ |
10265 |
+@@ -1250,7 +1272,7 @@ static int netvsc_process_raw_pkt(struct hv_device *device, |
10266 |
+ break; |
10267 |
+ |
10268 |
+ case VM_PKT_DATA_INBAND: |
10269 |
+- netvsc_receive_inband(ndev, nvmsg); |
10270 |
++ netvsc_receive_inband(ndev, net_device, nvmsg, msglen); |
10271 |
+ break; |
10272 |
+ |
10273 |
+ default: |
10274 |
+diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c |
10275 |
+index 1f9f7fcdb0eb..7ab576d8b622 100644 |
10276 |
+--- a/drivers/net/hyperv/netvsc_drv.c |
10277 |
++++ b/drivers/net/hyperv/netvsc_drv.c |
10278 |
+@@ -295,9 +295,9 @@ static inline u32 netvsc_get_hash( |
10279 |
+ else if (flow.basic.n_proto == htons(ETH_P_IPV6)) |
10280 |
+ hash = jhash2((u32 *)&flow.addrs.v6addrs, 8, hashrnd); |
10281 |
+ else |
10282 |
+- hash = 0; |
10283 |
++ return 0; |
10284 |
+ |
10285 |
+- skb_set_hash(skb, hash, PKT_HASH_TYPE_L3); |
10286 |
++ __skb_set_sw_hash(skb, hash, false); |
10287 |
+ } |
10288 |
+ |
10289 |
+ return hash; |
10290 |
+@@ -804,8 +804,7 @@ static struct sk_buff *netvsc_alloc_recv_skb(struct net_device *net, |
10291 |
+ skb->protocol == htons(ETH_P_IP)) |
10292 |
+ netvsc_comp_ipcsum(skb); |
10293 |
+ |
10294 |
+- /* Do L4 checksum offload if enabled and present. |
10295 |
+- */ |
10296 |
++ /* Do L4 checksum offload if enabled and present. */ |
10297 |
+ if (csum_info && (net->features & NETIF_F_RXCSUM)) { |
10298 |
+ if (csum_info->receive.tcp_checksum_succeeded || |
10299 |
+ csum_info->receive.udp_checksum_succeeded) |
10300 |
+@@ -2004,6 +2003,12 @@ static rx_handler_result_t netvsc_vf_handle_frame(struct sk_buff **pskb) |
10301 |
+ struct netvsc_vf_pcpu_stats *pcpu_stats |
10302 |
+ = this_cpu_ptr(ndev_ctx->vf_stats); |
10303 |
+ |
10304 |
++ skb = skb_share_check(skb, GFP_ATOMIC); |
10305 |
++ if (unlikely(!skb)) |
10306 |
++ return RX_HANDLER_CONSUMED; |
10307 |
++ |
10308 |
++ *pskb = skb; |
10309 |
++ |
10310 |
+ skb->dev = ndev; |
10311 |
+ |
10312 |
+ u64_stats_update_begin(&pcpu_stats->syncp); |
10313 |
+diff --git a/drivers/net/phy/fixed_phy.c b/drivers/net/phy/fixed_phy.c |
10314 |
+index 67b260877f30..59820164502e 100644 |
10315 |
+--- a/drivers/net/phy/fixed_phy.c |
10316 |
++++ b/drivers/net/phy/fixed_phy.c |
10317 |
+@@ -67,11 +67,11 @@ static int fixed_mdio_read(struct mii_bus *bus, int phy_addr, int reg_num) |
10318 |
+ do { |
10319 |
+ s = read_seqcount_begin(&fp->seqcount); |
10320 |
+ /* Issue callback if user registered it. */ |
10321 |
+- if (fp->link_update) { |
10322 |
++ if (fp->link_update) |
10323 |
+ fp->link_update(fp->phydev->attached_dev, |
10324 |
+ &fp->status); |
10325 |
+- fixed_phy_update(fp); |
10326 |
+- } |
10327 |
++ /* Check the GPIO for change in status */ |
10328 |
++ fixed_phy_update(fp); |
10329 |
+ state = fp->status; |
10330 |
+ } while (read_seqcount_retry(&fp->seqcount, s)); |
10331 |
+ |
10332 |
+diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c |
10333 |
+index c5588d4508f9..5c89a310359d 100644 |
10334 |
+--- a/drivers/net/phy/mdio_bus.c |
10335 |
++++ b/drivers/net/phy/mdio_bus.c |
10336 |
+@@ -56,11 +56,12 @@ static int mdiobus_register_gpiod(struct mdio_device *mdiodev) |
10337 |
+ gpiod = fwnode_get_named_gpiod(&mdiodev->dev.of_node->fwnode, |
10338 |
+ "reset-gpios", 0, GPIOD_OUT_LOW, |
10339 |
+ "PHY reset"); |
10340 |
+- if (PTR_ERR(gpiod) == -ENOENT || |
10341 |
+- PTR_ERR(gpiod) == -ENOSYS) |
10342 |
+- gpiod = NULL; |
10343 |
+- else if (IS_ERR(gpiod)) |
10344 |
+- return PTR_ERR(gpiod); |
10345 |
++ if (IS_ERR(gpiod)) { |
10346 |
++ if (PTR_ERR(gpiod) == -ENOENT || PTR_ERR(gpiod) == -ENOSYS) |
10347 |
++ gpiod = NULL; |
10348 |
++ else |
10349 |
++ return PTR_ERR(gpiod); |
10350 |
++ } |
10351 |
+ |
10352 |
+ mdiodev->reset = gpiod; |
10353 |
+ |
10354 |
+diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c |
10355 |
+index 05a6ae32ff65..b4c67c3a928b 100644 |
10356 |
+--- a/drivers/net/phy/micrel.c |
10357 |
++++ b/drivers/net/phy/micrel.c |
10358 |
+@@ -977,6 +977,7 @@ static struct phy_driver ksphy_driver[] = { |
10359 |
+ .driver_data = &ksz9021_type, |
10360 |
+ .probe = kszphy_probe, |
10361 |
+ .config_init = ksz9031_config_init, |
10362 |
++ .soft_reset = genphy_soft_reset, |
10363 |
+ .read_status = ksz9031_read_status, |
10364 |
+ .ack_interrupt = kszphy_ack_interrupt, |
10365 |
+ .config_intr = kszphy_config_intr, |
10366 |
+diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c |
10367 |
+index 43c4f358eeb8..ae40d8137fd2 100644 |
10368 |
+--- a/drivers/net/phy/phy_device.c |
10369 |
++++ b/drivers/net/phy/phy_device.c |
10370 |
+@@ -76,7 +76,7 @@ static LIST_HEAD(phy_fixup_list); |
10371 |
+ static DEFINE_MUTEX(phy_fixup_lock); |
10372 |
+ |
10373 |
+ #ifdef CONFIG_PM |
10374 |
+-static bool mdio_bus_phy_may_suspend(struct phy_device *phydev) |
10375 |
++static bool mdio_bus_phy_may_suspend(struct phy_device *phydev, bool suspend) |
10376 |
+ { |
10377 |
+ struct device_driver *drv = phydev->mdio.dev.driver; |
10378 |
+ struct phy_driver *phydrv = to_phy_driver(drv); |
10379 |
+@@ -88,10 +88,11 @@ static bool mdio_bus_phy_may_suspend(struct phy_device *phydev) |
10380 |
+ /* PHY not attached? May suspend if the PHY has not already been |
10381 |
+ * suspended as part of a prior call to phy_disconnect() -> |
10382 |
+ * phy_detach() -> phy_suspend() because the parent netdev might be the |
10383 |
+- * MDIO bus driver and clock gated at this point. |
10384 |
++ * MDIO bus driver and clock gated at this point. Also may resume if |
10385 |
++ * PHY is not attached. |
10386 |
+ */ |
10387 |
+ if (!netdev) |
10388 |
+- return !phydev->suspended; |
10389 |
++ return suspend ? !phydev->suspended : phydev->suspended; |
10390 |
+ |
10391 |
+ if (netdev->wol_enabled) |
10392 |
+ return false; |
10393 |
+@@ -126,7 +127,7 @@ static int mdio_bus_phy_suspend(struct device *dev) |
10394 |
+ if (phydev->attached_dev && phydev->adjust_link) |
10395 |
+ phy_stop_machine(phydev); |
10396 |
+ |
10397 |
+- if (!mdio_bus_phy_may_suspend(phydev)) |
10398 |
++ if (!mdio_bus_phy_may_suspend(phydev, true)) |
10399 |
+ return 0; |
10400 |
+ |
10401 |
+ return phy_suspend(phydev); |
10402 |
+@@ -137,7 +138,7 @@ static int mdio_bus_phy_resume(struct device *dev) |
10403 |
+ struct phy_device *phydev = to_phy_device(dev); |
10404 |
+ int ret; |
10405 |
+ |
10406 |
+- if (!mdio_bus_phy_may_suspend(phydev)) |
10407 |
++ if (!mdio_bus_phy_may_suspend(phydev, false)) |
10408 |
+ goto no_resume; |
10409 |
+ |
10410 |
+ ret = phy_resume(phydev); |
10411 |
+@@ -1656,7 +1657,7 @@ int genphy_soft_reset(struct phy_device *phydev) |
10412 |
+ { |
10413 |
+ int ret; |
10414 |
+ |
10415 |
+- ret = phy_write(phydev, MII_BMCR, BMCR_RESET); |
10416 |
++ ret = phy_set_bits(phydev, MII_BMCR, BMCR_RESET); |
10417 |
+ if (ret < 0) |
10418 |
+ return ret; |
10419 |
+ |
10420 |
+diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c |
10421 |
+index 613f36681853..df88981e796a 100644 |
10422 |
+--- a/drivers/net/vxlan.c |
10423 |
++++ b/drivers/net/vxlan.c |
10424 |
+@@ -3496,7 +3496,6 @@ static int vxlan_changelink(struct net_device *dev, struct nlattr *tb[], |
10425 |
+ struct vxlan_rdst *dst = &vxlan->default_dst; |
10426 |
+ struct vxlan_rdst old_dst; |
10427 |
+ struct vxlan_config conf; |
10428 |
+- struct vxlan_fdb *f = NULL; |
10429 |
+ int err; |
10430 |
+ |
10431 |
+ err = vxlan_nl2conf(tb, data, |
10432 |
+@@ -3522,19 +3521,19 @@ static int vxlan_changelink(struct net_device *dev, struct nlattr *tb[], |
10433 |
+ old_dst.remote_ifindex, 0); |
10434 |
+ |
10435 |
+ if (!vxlan_addr_any(&dst->remote_ip)) { |
10436 |
+- err = vxlan_fdb_create(vxlan, all_zeros_mac, |
10437 |
++ err = vxlan_fdb_update(vxlan, all_zeros_mac, |
10438 |
+ &dst->remote_ip, |
10439 |
+ NUD_REACHABLE | NUD_PERMANENT, |
10440 |
++ NLM_F_APPEND | NLM_F_CREATE, |
10441 |
+ vxlan->cfg.dst_port, |
10442 |
+ dst->remote_vni, |
10443 |
+ dst->remote_vni, |
10444 |
+ dst->remote_ifindex, |
10445 |
+- NTF_SELF, &f); |
10446 |
++ NTF_SELF); |
10447 |
+ if (err) { |
10448 |
+ spin_unlock_bh(&vxlan->hash_lock); |
10449 |
+ return err; |
10450 |
+ } |
10451 |
+- vxlan_fdb_notify(vxlan, f, first_remote_rtnl(f), RTM_NEWNEIGH); |
10452 |
+ } |
10453 |
+ spin_unlock_bh(&vxlan->hash_lock); |
10454 |
+ } |
10455 |
+diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c |
10456 |
+index 448e3a8c33a6..a09d7a07e90a 100644 |
10457 |
+--- a/drivers/net/wireless/ath/ath10k/mac.c |
10458 |
++++ b/drivers/net/wireless/ath/ath10k/mac.c |
10459 |
+@@ -1,7 +1,7 @@ |
10460 |
+ /* |
10461 |
+ * Copyright (c) 2005-2011 Atheros Communications Inc. |
10462 |
+ * Copyright (c) 2011-2017 Qualcomm Atheros, Inc. |
10463 |
+- * Copyright (c) 2018, The Linux Foundation. All rights reserved. |
10464 |
++ * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. |
10465 |
+ * |
10466 |
+ * Permission to use, copy, modify, and/or distribute this software for any |
10467 |
+ * purpose with or without fee is hereby granted, provided that the above |
10468 |
+@@ -3853,7 +3853,7 @@ void ath10k_mgmt_over_wmi_tx_work(struct work_struct *work) |
10469 |
+ ath10k_warn(ar, "failed to transmit management frame by ref via WMI: %d\n", |
10470 |
+ ret); |
10471 |
+ dma_unmap_single(ar->dev, paddr, skb->len, |
10472 |
+- DMA_FROM_DEVICE); |
10473 |
++ DMA_TO_DEVICE); |
10474 |
+ ieee80211_free_txskb(ar->hw, skb); |
10475 |
+ } |
10476 |
+ } else { |
10477 |
+diff --git a/drivers/net/wireless/ath/ath10k/sdio.c b/drivers/net/wireless/ath/ath10k/sdio.c |
10478 |
+index 686759b5613f..0ecaba824fb2 100644 |
10479 |
+--- a/drivers/net/wireless/ath/ath10k/sdio.c |
10480 |
++++ b/drivers/net/wireless/ath/ath10k/sdio.c |
10481 |
+@@ -392,16 +392,11 @@ static int ath10k_sdio_mbox_rx_process_packet(struct ath10k *ar, |
10482 |
+ struct ath10k_htc_hdr *htc_hdr = (struct ath10k_htc_hdr *)skb->data; |
10483 |
+ bool trailer_present = htc_hdr->flags & ATH10K_HTC_FLAG_TRAILER_PRESENT; |
10484 |
+ enum ath10k_htc_ep_id eid; |
10485 |
+- u16 payload_len; |
10486 |
+ u8 *trailer; |
10487 |
+ int ret; |
10488 |
+ |
10489 |
+- payload_len = le16_to_cpu(htc_hdr->len); |
10490 |
+- skb->len = payload_len + sizeof(struct ath10k_htc_hdr); |
10491 |
+- |
10492 |
+ if (trailer_present) { |
10493 |
+- trailer = skb->data + sizeof(*htc_hdr) + |
10494 |
+- payload_len - htc_hdr->trailer_len; |
10495 |
++ trailer = skb->data + skb->len - htc_hdr->trailer_len; |
10496 |
+ |
10497 |
+ eid = pipe_id_to_eid(htc_hdr->eid); |
10498 |
+ |
10499 |
+@@ -638,13 +633,31 @@ static int ath10k_sdio_mbox_rx_packet(struct ath10k *ar, |
10500 |
+ { |
10501 |
+ struct ath10k_sdio *ar_sdio = ath10k_sdio_priv(ar); |
10502 |
+ struct sk_buff *skb = pkt->skb; |
10503 |
++ struct ath10k_htc_hdr *htc_hdr; |
10504 |
+ int ret; |
10505 |
+ |
10506 |
+ ret = ath10k_sdio_readsb(ar, ar_sdio->mbox_info.htc_addr, |
10507 |
+ skb->data, pkt->alloc_len); |
10508 |
++ if (ret) |
10509 |
++ goto out; |
10510 |
++ |
10511 |
++ /* Update actual length. The original length may be incorrect, |
10512 |
++ * as the FW will bundle multiple packets as long as their sizes |
10513 |
++ * fit within the same aligned length (pkt->alloc_len). |
10514 |
++ */ |
10515 |
++ htc_hdr = (struct ath10k_htc_hdr *)skb->data; |
10516 |
++ pkt->act_len = le16_to_cpu(htc_hdr->len) + sizeof(*htc_hdr); |
10517 |
++ if (pkt->act_len > pkt->alloc_len) { |
10518 |
++ ath10k_warn(ar, "rx packet too large (%zu > %zu)\n", |
10519 |
++ pkt->act_len, pkt->alloc_len); |
10520 |
++ ret = -EMSGSIZE; |
10521 |
++ goto out; |
10522 |
++ } |
10523 |
++ |
10524 |
++ skb_put(skb, pkt->act_len); |
10525 |
++ |
10526 |
++out: |
10527 |
+ pkt->status = ret; |
10528 |
+- if (!ret) |
10529 |
+- skb_put(skb, pkt->act_len); |
10530 |
+ |
10531 |
+ return ret; |
10532 |
+ } |
10533 |
+diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c b/drivers/net/wireless/ath/ath10k/wmi-tlv.c |
10534 |
+index cdc1e64d52ad..248decb494c2 100644 |
10535 |
+--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c |
10536 |
++++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c |
10537 |
+@@ -2693,7 +2693,7 @@ ath10k_wmi_tlv_op_gen_mgmt_tx_send(struct ath10k *ar, struct sk_buff *msdu, |
10538 |
+ ieee80211_is_deauth(hdr->frame_control) || |
10539 |
+ ieee80211_is_disassoc(hdr->frame_control)) && |
10540 |
+ ieee80211_has_protected(hdr->frame_control)) { |
10541 |
+- len += IEEE80211_CCMP_MIC_LEN; |
10542 |
++ skb_put(msdu, IEEE80211_CCMP_MIC_LEN); |
10543 |
+ buf_len += IEEE80211_CCMP_MIC_LEN; |
10544 |
+ } |
10545 |
+ |
10546 |
+diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c |
10547 |
+index aefc92d2c09b..0f6ff7a78e49 100644 |
10548 |
+--- a/drivers/net/wireless/ath/ath10k/wmi.c |
10549 |
++++ b/drivers/net/wireless/ath/ath10k/wmi.c |
10550 |
+@@ -1,7 +1,7 @@ |
10551 |
+ /* |
10552 |
+ * Copyright (c) 2005-2011 Atheros Communications Inc. |
10553 |
+ * Copyright (c) 2011-2017 Qualcomm Atheros, Inc. |
10554 |
+- * Copyright (c) 2018, The Linux Foundation. All rights reserved. |
10555 |
++ * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. |
10556 |
+ * |
10557 |
+ * Permission to use, copy, modify, and/or distribute this software for any |
10558 |
+ * purpose with or without fee is hereby granted, provided that the above |
10559 |
+@@ -2340,7 +2340,7 @@ static int wmi_process_mgmt_tx_comp(struct ath10k *ar, u32 desc_id, |
10560 |
+ |
10561 |
+ msdu = pkt_addr->vaddr; |
10562 |
+ dma_unmap_single(ar->dev, pkt_addr->paddr, |
10563 |
+- msdu->len, DMA_FROM_DEVICE); |
10564 |
++ msdu->len, DMA_TO_DEVICE); |
10565 |
+ info = IEEE80211_SKB_CB(msdu); |
10566 |
+ |
10567 |
+ if (status) |
10568 |
+diff --git a/drivers/net/wireless/ath/ath9k/dynack.c b/drivers/net/wireless/ath/ath9k/dynack.c |
10569 |
+index 6e236a485431..71b4888b30e7 100644 |
10570 |
+--- a/drivers/net/wireless/ath/ath9k/dynack.c |
10571 |
++++ b/drivers/net/wireless/ath/ath9k/dynack.c |
10572 |
+@@ -300,9 +300,9 @@ void ath_dynack_node_init(struct ath_hw *ah, struct ath_node *an) |
10573 |
+ |
10574 |
+ an->ackto = ackto; |
10575 |
+ |
10576 |
+- spin_lock(&da->qlock); |
10577 |
++ spin_lock_bh(&da->qlock); |
10578 |
+ list_add_tail(&an->list, &da->nodes); |
10579 |
+- spin_unlock(&da->qlock); |
10580 |
++ spin_unlock_bh(&da->qlock); |
10581 |
+ } |
10582 |
+ EXPORT_SYMBOL(ath_dynack_node_init); |
10583 |
+ |
10584 |
+@@ -316,9 +316,9 @@ void ath_dynack_node_deinit(struct ath_hw *ah, struct ath_node *an) |
10585 |
+ { |
10586 |
+ struct ath_dynack *da = &ah->dynack; |
10587 |
+ |
10588 |
+- spin_lock(&da->qlock); |
10589 |
++ spin_lock_bh(&da->qlock); |
10590 |
+ list_del(&an->list); |
10591 |
+- spin_unlock(&da->qlock); |
10592 |
++ spin_unlock_bh(&da->qlock); |
10593 |
+ } |
10594 |
+ EXPORT_SYMBOL(ath_dynack_node_deinit); |
10595 |
+ |
10596 |
+diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c |
10597 |
+index 00098f24116d..6cd113b3b3e4 100644 |
10598 |
+--- a/drivers/net/wireless/ath/wcn36xx/smd.c |
10599 |
++++ b/drivers/net/wireless/ath/wcn36xx/smd.c |
10600 |
+@@ -641,52 +641,58 @@ int wcn36xx_smd_start_hw_scan(struct wcn36xx *wcn, struct ieee80211_vif *vif, |
10601 |
+ struct cfg80211_scan_request *req) |
10602 |
+ { |
10603 |
+ struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif); |
10604 |
+- struct wcn36xx_hal_start_scan_offload_req_msg msg_body; |
10605 |
++ struct wcn36xx_hal_start_scan_offload_req_msg *msg_body; |
10606 |
+ int ret, i; |
10607 |
+ |
10608 |
+ if (req->ie_len > WCN36XX_MAX_SCAN_IE_LEN) |
10609 |
+ return -EINVAL; |
10610 |
+ |
10611 |
+ mutex_lock(&wcn->hal_mutex); |
10612 |
+- INIT_HAL_MSG(msg_body, WCN36XX_HAL_START_SCAN_OFFLOAD_REQ); |
10613 |
++ msg_body = kzalloc(sizeof(*msg_body), GFP_KERNEL); |
10614 |
++ if (!msg_body) { |
10615 |
++ ret = -ENOMEM; |
10616 |
++ goto out; |
10617 |
++ } |
10618 |
+ |
10619 |
+- msg_body.scan_type = WCN36XX_HAL_SCAN_TYPE_ACTIVE; |
10620 |
+- msg_body.min_ch_time = 30; |
10621 |
+- msg_body.max_ch_time = 100; |
10622 |
+- msg_body.scan_hidden = 1; |
10623 |
+- memcpy(msg_body.mac, vif->addr, ETH_ALEN); |
10624 |
+- msg_body.bss_type = vif_priv->bss_type; |
10625 |
+- msg_body.p2p_search = vif->p2p; |
10626 |
++ INIT_HAL_MSG((*msg_body), WCN36XX_HAL_START_SCAN_OFFLOAD_REQ); |
10627 |
+ |
10628 |
+- msg_body.num_ssid = min_t(u8, req->n_ssids, ARRAY_SIZE(msg_body.ssids)); |
10629 |
+- for (i = 0; i < msg_body.num_ssid; i++) { |
10630 |
+- msg_body.ssids[i].length = min_t(u8, req->ssids[i].ssid_len, |
10631 |
+- sizeof(msg_body.ssids[i].ssid)); |
10632 |
+- memcpy(msg_body.ssids[i].ssid, req->ssids[i].ssid, |
10633 |
+- msg_body.ssids[i].length); |
10634 |
++ msg_body->scan_type = WCN36XX_HAL_SCAN_TYPE_ACTIVE; |
10635 |
++ msg_body->min_ch_time = 30; |
10636 |
++ msg_body->max_ch_time = 100; |
10637 |
++ msg_body->scan_hidden = 1; |
10638 |
++ memcpy(msg_body->mac, vif->addr, ETH_ALEN); |
10639 |
++ msg_body->bss_type = vif_priv->bss_type; |
10640 |
++ msg_body->p2p_search = vif->p2p; |
10641 |
++ |
10642 |
++ msg_body->num_ssid = min_t(u8, req->n_ssids, ARRAY_SIZE(msg_body->ssids)); |
10643 |
++ for (i = 0; i < msg_body->num_ssid; i++) { |
10644 |
++ msg_body->ssids[i].length = min_t(u8, req->ssids[i].ssid_len, |
10645 |
++ sizeof(msg_body->ssids[i].ssid)); |
10646 |
++ memcpy(msg_body->ssids[i].ssid, req->ssids[i].ssid, |
10647 |
++ msg_body->ssids[i].length); |
10648 |
+ } |
10649 |
+ |
10650 |
+- msg_body.num_channel = min_t(u8, req->n_channels, |
10651 |
+- sizeof(msg_body.channels)); |
10652 |
+- for (i = 0; i < msg_body.num_channel; i++) |
10653 |
+- msg_body.channels[i] = req->channels[i]->hw_value; |
10654 |
++ msg_body->num_channel = min_t(u8, req->n_channels, |
10655 |
++ sizeof(msg_body->channels)); |
10656 |
++ for (i = 0; i < msg_body->num_channel; i++) |
10657 |
++ msg_body->channels[i] = req->channels[i]->hw_value; |
10658 |
+ |
10659 |
+- msg_body.header.len -= WCN36XX_MAX_SCAN_IE_LEN; |
10660 |
++ msg_body->header.len -= WCN36XX_MAX_SCAN_IE_LEN; |
10661 |
+ |
10662 |
+ if (req->ie_len > 0) { |
10663 |
+- msg_body.ie_len = req->ie_len; |
10664 |
+- msg_body.header.len += req->ie_len; |
10665 |
+- memcpy(msg_body.ie, req->ie, req->ie_len); |
10666 |
++ msg_body->ie_len = req->ie_len; |
10667 |
++ msg_body->header.len += req->ie_len; |
10668 |
++ memcpy(msg_body->ie, req->ie, req->ie_len); |
10669 |
+ } |
10670 |
+ |
10671 |
+- PREPARE_HAL_BUF(wcn->hal_buf, msg_body); |
10672 |
++ PREPARE_HAL_BUF(wcn->hal_buf, (*msg_body)); |
10673 |
+ |
10674 |
+ wcn36xx_dbg(WCN36XX_DBG_HAL, |
10675 |
+ "hal start hw-scan (channels: %u; ssids: %u; p2p: %s)\n", |
10676 |
+- msg_body.num_channel, msg_body.num_ssid, |
10677 |
+- msg_body.p2p_search ? "yes" : "no"); |
10678 |
++ msg_body->num_channel, msg_body->num_ssid, |
10679 |
++ msg_body->p2p_search ? "yes" : "no"); |
10680 |
+ |
10681 |
+- ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len); |
10682 |
++ ret = wcn36xx_smd_send_and_wait(wcn, msg_body->header.len); |
10683 |
+ if (ret) { |
10684 |
+ wcn36xx_err("Sending hal_start_scan_offload failed\n"); |
10685 |
+ goto out; |
10686 |
+@@ -698,6 +704,7 @@ int wcn36xx_smd_start_hw_scan(struct wcn36xx *wcn, struct ieee80211_vif *vif, |
10687 |
+ goto out; |
10688 |
+ } |
10689 |
+ out: |
10690 |
++ kfree(msg_body); |
10691 |
+ mutex_unlock(&wcn->hal_mutex); |
10692 |
+ return ret; |
10693 |
+ } |
10694 |
+@@ -1257,96 +1264,104 @@ out: |
10695 |
+ static int wcn36xx_smd_config_bss_v1(struct wcn36xx *wcn, |
10696 |
+ const struct wcn36xx_hal_config_bss_req_msg *orig) |
10697 |
+ { |
10698 |
+- struct wcn36xx_hal_config_bss_req_msg_v1 msg_body; |
10699 |
+- struct wcn36xx_hal_config_bss_params_v1 *bss = &msg_body.bss_params; |
10700 |
+- struct wcn36xx_hal_config_sta_params_v1 *sta = &bss->sta; |
10701 |
++ struct wcn36xx_hal_config_bss_req_msg_v1 *msg_body; |
10702 |
++ struct wcn36xx_hal_config_bss_params_v1 *bss; |
10703 |
++ struct wcn36xx_hal_config_sta_params_v1 *sta; |
10704 |
++ int ret; |
10705 |
++ |
10706 |
++ msg_body = kzalloc(sizeof(*msg_body), GFP_KERNEL); |
10707 |
++ if (!msg_body) |
10708 |
++ return -ENOMEM; |
10709 |
++ |
10710 |
++ INIT_HAL_MSG((*msg_body), WCN36XX_HAL_CONFIG_BSS_REQ); |
10711 |
+ |
10712 |
+- INIT_HAL_MSG(msg_body, WCN36XX_HAL_CONFIG_BSS_REQ); |
10713 |
++ bss = &msg_body->bss_params; |
10714 |
++ sta = &bss->sta; |
10715 |
+ |
10716 |
+ /* convert orig to v1 */ |
10717 |
+- memcpy(&msg_body.bss_params.bssid, |
10718 |
++ memcpy(&msg_body->bss_params.bssid, |
10719 |
+ &orig->bss_params.bssid, ETH_ALEN); |
10720 |
+- memcpy(&msg_body.bss_params.self_mac_addr, |
10721 |
++ memcpy(&msg_body->bss_params.self_mac_addr, |
10722 |
+ &orig->bss_params.self_mac_addr, ETH_ALEN); |
10723 |
+ |
10724 |
+- msg_body.bss_params.bss_type = orig->bss_params.bss_type; |
10725 |
+- msg_body.bss_params.oper_mode = orig->bss_params.oper_mode; |
10726 |
+- msg_body.bss_params.nw_type = orig->bss_params.nw_type; |
10727 |
++ msg_body->bss_params.bss_type = orig->bss_params.bss_type; |
10728 |
++ msg_body->bss_params.oper_mode = orig->bss_params.oper_mode; |
10729 |
++ msg_body->bss_params.nw_type = orig->bss_params.nw_type; |
10730 |
+ |
10731 |
+- msg_body.bss_params.short_slot_time_supported = |
10732 |
++ msg_body->bss_params.short_slot_time_supported = |
10733 |
+ orig->bss_params.short_slot_time_supported; |
10734 |
+- msg_body.bss_params.lla_coexist = orig->bss_params.lla_coexist; |
10735 |
+- msg_body.bss_params.llb_coexist = orig->bss_params.llb_coexist; |
10736 |
+- msg_body.bss_params.llg_coexist = orig->bss_params.llg_coexist; |
10737 |
+- msg_body.bss_params.ht20_coexist = orig->bss_params.ht20_coexist; |
10738 |
+- msg_body.bss_params.lln_non_gf_coexist = |
10739 |
++ msg_body->bss_params.lla_coexist = orig->bss_params.lla_coexist; |
10740 |
++ msg_body->bss_params.llb_coexist = orig->bss_params.llb_coexist; |
10741 |
++ msg_body->bss_params.llg_coexist = orig->bss_params.llg_coexist; |
10742 |
++ msg_body->bss_params.ht20_coexist = orig->bss_params.ht20_coexist; |
10743 |
++ msg_body->bss_params.lln_non_gf_coexist = |
10744 |
+ orig->bss_params.lln_non_gf_coexist; |
10745 |
+ |
10746 |
+- msg_body.bss_params.lsig_tx_op_protection_full_support = |
10747 |
++ msg_body->bss_params.lsig_tx_op_protection_full_support = |
10748 |
+ orig->bss_params.lsig_tx_op_protection_full_support; |
10749 |
+- msg_body.bss_params.rifs_mode = orig->bss_params.rifs_mode; |
10750 |
+- msg_body.bss_params.beacon_interval = orig->bss_params.beacon_interval; |
10751 |
+- msg_body.bss_params.dtim_period = orig->bss_params.dtim_period; |
10752 |
+- msg_body.bss_params.tx_channel_width_set = |
10753 |
++ msg_body->bss_params.rifs_mode = orig->bss_params.rifs_mode; |
10754 |
++ msg_body->bss_params.beacon_interval = orig->bss_params.beacon_interval; |
10755 |
++ msg_body->bss_params.dtim_period = orig->bss_params.dtim_period; |
10756 |
++ msg_body->bss_params.tx_channel_width_set = |
10757 |
+ orig->bss_params.tx_channel_width_set; |
10758 |
+- msg_body.bss_params.oper_channel = orig->bss_params.oper_channel; |
10759 |
+- msg_body.bss_params.ext_channel = orig->bss_params.ext_channel; |
10760 |
++ msg_body->bss_params.oper_channel = orig->bss_params.oper_channel; |
10761 |
++ msg_body->bss_params.ext_channel = orig->bss_params.ext_channel; |
10762 |
+ |
10763 |
+- msg_body.bss_params.reserved = orig->bss_params.reserved; |
10764 |
++ msg_body->bss_params.reserved = orig->bss_params.reserved; |
10765 |
+ |
10766 |
+- memcpy(&msg_body.bss_params.ssid, |
10767 |
++ memcpy(&msg_body->bss_params.ssid, |
10768 |
+ &orig->bss_params.ssid, |
10769 |
+ sizeof(orig->bss_params.ssid)); |
10770 |
+ |
10771 |
+- msg_body.bss_params.action = orig->bss_params.action; |
10772 |
+- msg_body.bss_params.rateset = orig->bss_params.rateset; |
10773 |
+- msg_body.bss_params.ht = orig->bss_params.ht; |
10774 |
+- msg_body.bss_params.obss_prot_enabled = |
10775 |
++ msg_body->bss_params.action = orig->bss_params.action; |
10776 |
++ msg_body->bss_params.rateset = orig->bss_params.rateset; |
10777 |
++ msg_body->bss_params.ht = orig->bss_params.ht; |
10778 |
++ msg_body->bss_params.obss_prot_enabled = |
10779 |
+ orig->bss_params.obss_prot_enabled; |
10780 |
+- msg_body.bss_params.rmf = orig->bss_params.rmf; |
10781 |
+- msg_body.bss_params.ht_oper_mode = orig->bss_params.ht_oper_mode; |
10782 |
+- msg_body.bss_params.dual_cts_protection = |
10783 |
++ msg_body->bss_params.rmf = orig->bss_params.rmf; |
10784 |
++ msg_body->bss_params.ht_oper_mode = orig->bss_params.ht_oper_mode; |
10785 |
++ msg_body->bss_params.dual_cts_protection = |
10786 |
+ orig->bss_params.dual_cts_protection; |
10787 |
+ |
10788 |
+- msg_body.bss_params.max_probe_resp_retry_limit = |
10789 |
++ msg_body->bss_params.max_probe_resp_retry_limit = |
10790 |
+ orig->bss_params.max_probe_resp_retry_limit; |
10791 |
+- msg_body.bss_params.hidden_ssid = orig->bss_params.hidden_ssid; |
10792 |
+- msg_body.bss_params.proxy_probe_resp = |
10793 |
++ msg_body->bss_params.hidden_ssid = orig->bss_params.hidden_ssid; |
10794 |
++ msg_body->bss_params.proxy_probe_resp = |
10795 |
+ orig->bss_params.proxy_probe_resp; |
10796 |
+- msg_body.bss_params.edca_params_valid = |
10797 |
++ msg_body->bss_params.edca_params_valid = |
10798 |
+ orig->bss_params.edca_params_valid; |
10799 |
+ |
10800 |
+- memcpy(&msg_body.bss_params.acbe, |
10801 |
++ memcpy(&msg_body->bss_params.acbe, |
10802 |
+ &orig->bss_params.acbe, |
10803 |
+ sizeof(orig->bss_params.acbe)); |
10804 |
+- memcpy(&msg_body.bss_params.acbk, |
10805 |
++ memcpy(&msg_body->bss_params.acbk, |
10806 |
+ &orig->bss_params.acbk, |
10807 |
+ sizeof(orig->bss_params.acbk)); |
10808 |
+- memcpy(&msg_body.bss_params.acvi, |
10809 |
++ memcpy(&msg_body->bss_params.acvi, |
10810 |
+ &orig->bss_params.acvi, |
10811 |
+ sizeof(orig->bss_params.acvi)); |
10812 |
+- memcpy(&msg_body.bss_params.acvo, |
10813 |
++ memcpy(&msg_body->bss_params.acvo, |
10814 |
+ &orig->bss_params.acvo, |
10815 |
+ sizeof(orig->bss_params.acvo)); |
10816 |
+ |
10817 |
+- msg_body.bss_params.ext_set_sta_key_param_valid = |
10818 |
++ msg_body->bss_params.ext_set_sta_key_param_valid = |
10819 |
+ orig->bss_params.ext_set_sta_key_param_valid; |
10820 |
+ |
10821 |
+- memcpy(&msg_body.bss_params.ext_set_sta_key_param, |
10822 |
++ memcpy(&msg_body->bss_params.ext_set_sta_key_param, |
10823 |
+ &orig->bss_params.ext_set_sta_key_param, |
10824 |
+ sizeof(orig->bss_params.acvo)); |
10825 |
+ |
10826 |
+- msg_body.bss_params.wcn36xx_hal_persona = |
10827 |
++ msg_body->bss_params.wcn36xx_hal_persona = |
10828 |
+ orig->bss_params.wcn36xx_hal_persona; |
10829 |
+- msg_body.bss_params.spectrum_mgt_enable = |
10830 |
++ msg_body->bss_params.spectrum_mgt_enable = |
10831 |
+ orig->bss_params.spectrum_mgt_enable; |
10832 |
+- msg_body.bss_params.tx_mgmt_power = orig->bss_params.tx_mgmt_power; |
10833 |
+- msg_body.bss_params.max_tx_power = orig->bss_params.max_tx_power; |
10834 |
++ msg_body->bss_params.tx_mgmt_power = orig->bss_params.tx_mgmt_power; |
10835 |
++ msg_body->bss_params.max_tx_power = orig->bss_params.max_tx_power; |
10836 |
+ |
10837 |
+ wcn36xx_smd_convert_sta_to_v1(wcn, &orig->bss_params.sta, |
10838 |
+- &msg_body.bss_params.sta); |
10839 |
++ &msg_body->bss_params.sta); |
10840 |
+ |
10841 |
+- PREPARE_HAL_BUF(wcn->hal_buf, msg_body); |
10842 |
++ PREPARE_HAL_BUF(wcn->hal_buf, (*msg_body)); |
10843 |
+ |
10844 |
+ wcn36xx_dbg(WCN36XX_DBG_HAL, |
10845 |
+ "hal config bss v1 bssid %pM self_mac_addr %pM bss_type %d oper_mode %d nw_type %d\n", |
10846 |
+@@ -1358,7 +1373,10 @@ static int wcn36xx_smd_config_bss_v1(struct wcn36xx *wcn, |
10847 |
+ sta->bssid, sta->action, sta->sta_index, |
10848 |
+ sta->bssid_index, sta->aid, sta->type, sta->mac); |
10849 |
+ |
10850 |
+- return wcn36xx_smd_send_and_wait(wcn, msg_body.header.len); |
10851 |
++ ret = wcn36xx_smd_send_and_wait(wcn, msg_body->header.len); |
10852 |
++ kfree(msg_body); |
10853 |
++ |
10854 |
++ return ret; |
10855 |
+ } |
10856 |
+ |
10857 |
+ |
10858 |
+@@ -1410,16 +1428,21 @@ int wcn36xx_smd_config_bss(struct wcn36xx *wcn, struct ieee80211_vif *vif, |
10859 |
+ struct ieee80211_sta *sta, const u8 *bssid, |
10860 |
+ bool update) |
10861 |
+ { |
10862 |
+- struct wcn36xx_hal_config_bss_req_msg msg; |
10863 |
++ struct wcn36xx_hal_config_bss_req_msg *msg; |
10864 |
+ struct wcn36xx_hal_config_bss_params *bss; |
10865 |
+ struct wcn36xx_hal_config_sta_params *sta_params; |
10866 |
+ struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif); |
10867 |
+ int ret; |
10868 |
+ |
10869 |
+ mutex_lock(&wcn->hal_mutex); |
10870 |
+- INIT_HAL_MSG(msg, WCN36XX_HAL_CONFIG_BSS_REQ); |
10871 |
++ msg = kzalloc(sizeof(*msg), GFP_KERNEL); |
10872 |
++ if (!msg) { |
10873 |
++ ret = -ENOMEM; |
10874 |
++ goto out; |
10875 |
++ } |
10876 |
++ INIT_HAL_MSG((*msg), WCN36XX_HAL_CONFIG_BSS_REQ); |
10877 |
+ |
10878 |
+- bss = &msg.bss_params; |
10879 |
++ bss = &msg->bss_params; |
10880 |
+ sta_params = &bss->sta; |
10881 |
+ |
10882 |
+ WARN_ON(is_zero_ether_addr(bssid)); |
10883 |
+@@ -1514,11 +1537,11 @@ int wcn36xx_smd_config_bss(struct wcn36xx *wcn, struct ieee80211_vif *vif, |
10884 |
+ sta_params->mac); |
10885 |
+ |
10886 |
+ if (!wcn36xx_is_fw_version(wcn, 1, 2, 2, 24)) { |
10887 |
+- ret = wcn36xx_smd_config_bss_v1(wcn, &msg); |
10888 |
++ ret = wcn36xx_smd_config_bss_v1(wcn, msg); |
10889 |
+ } else { |
10890 |
+- PREPARE_HAL_BUF(wcn->hal_buf, msg); |
10891 |
++ PREPARE_HAL_BUF(wcn->hal_buf, (*msg)); |
10892 |
+ |
10893 |
+- ret = wcn36xx_smd_send_and_wait(wcn, msg.header.len); |
10894 |
++ ret = wcn36xx_smd_send_and_wait(wcn, msg->header.len); |
10895 |
+ } |
10896 |
+ if (ret) { |
10897 |
+ wcn36xx_err("Sending hal_config_bss failed\n"); |
10898 |
+@@ -1534,6 +1557,7 @@ int wcn36xx_smd_config_bss(struct wcn36xx *wcn, struct ieee80211_vif *vif, |
10899 |
+ goto out; |
10900 |
+ } |
10901 |
+ out: |
10902 |
++ kfree(msg); |
10903 |
+ mutex_unlock(&wcn->hal_mutex); |
10904 |
+ return ret; |
10905 |
+ } |
10906 |
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c |
10907 |
+index d2f788d88668..710dc59c5d34 100644 |
10908 |
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c |
10909 |
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c |
10910 |
+@@ -617,15 +617,13 @@ int brcmf_sdiod_send_buf(struct brcmf_sdio_dev *sdiodev, u8 *buf, uint nbytes) |
10911 |
+ |
10912 |
+ err = brcmf_sdiod_set_backplane_window(sdiodev, addr); |
10913 |
+ if (err) |
10914 |
+- return err; |
10915 |
++ goto out; |
10916 |
+ |
10917 |
+ addr &= SBSDIO_SB_OFT_ADDR_MASK; |
10918 |
+ addr |= SBSDIO_SB_ACCESS_2_4B_FLAG; |
10919 |
+ |
10920 |
+- if (!err) |
10921 |
+- err = brcmf_sdiod_skbuff_write(sdiodev, sdiodev->func2, addr, |
10922 |
+- mypkt); |
10923 |
+- |
10924 |
++ err = brcmf_sdiod_skbuff_write(sdiodev, sdiodev->func2, addr, mypkt); |
10925 |
++out: |
10926 |
+ brcmu_pkt_buf_free_skb(mypkt); |
10927 |
+ |
10928 |
+ return err; |
10929 |
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h |
10930 |
+index c4965184cdf3..3d441c5c745c 100644 |
10931 |
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h |
10932 |
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h |
10933 |
+@@ -90,6 +90,7 @@ struct brcmf_bus_ops { |
10934 |
+ int (*get_memdump)(struct device *dev, void *data, size_t len); |
10935 |
+ int (*get_fwname)(struct device *dev, const char *ext, |
10936 |
+ unsigned char *fw_name); |
10937 |
++ void (*debugfs_create)(struct device *dev); |
10938 |
+ }; |
10939 |
+ |
10940 |
+ |
10941 |
+@@ -235,6 +236,15 @@ int brcmf_bus_get_fwname(struct brcmf_bus *bus, const char *ext, |
10942 |
+ return bus->ops->get_fwname(bus->dev, ext, fw_name); |
10943 |
+ } |
10944 |
+ |
10945 |
++static inline |
10946 |
++void brcmf_bus_debugfs_create(struct brcmf_bus *bus) |
10947 |
++{ |
10948 |
++ if (!bus->ops->debugfs_create) |
10949 |
++ return; |
10950 |
++ |
10951 |
++ return bus->ops->debugfs_create(bus->dev); |
10952 |
++} |
10953 |
++ |
10954 |
+ /* |
10955 |
+ * interface functions from common layer |
10956 |
+ */ |
10957 |
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c |
10958 |
+index 584e05fdca6a..9d7b8834b854 100644 |
10959 |
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c |
10960 |
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c |
10961 |
+@@ -1105,6 +1105,7 @@ static int brcmf_bus_started(struct brcmf_pub *drvr, struct cfg80211_ops *ops) |
10962 |
+ brcmf_debugfs_add_entry(drvr, "revinfo", brcmf_revinfo_read); |
10963 |
+ brcmf_feat_debugfs_create(drvr); |
10964 |
+ brcmf_proto_debugfs_create(drvr); |
10965 |
++ brcmf_bus_debugfs_create(bus_if); |
10966 |
+ |
10967 |
+ return 0; |
10968 |
+ |
10969 |
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c |
10970 |
+index abaed2fa2def..5c3b62e61980 100644 |
10971 |
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c |
10972 |
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c |
10973 |
+@@ -3131,9 +3131,12 @@ static int brcmf_debugfs_sdio_count_read(struct seq_file *seq, void *data) |
10974 |
+ return 0; |
10975 |
+ } |
10976 |
+ |
10977 |
+-static void brcmf_sdio_debugfs_create(struct brcmf_sdio *bus) |
10978 |
++static void brcmf_sdio_debugfs_create(struct device *dev) |
10979 |
+ { |
10980 |
+- struct brcmf_pub *drvr = bus->sdiodev->bus_if->drvr; |
10981 |
++ struct brcmf_bus *bus_if = dev_get_drvdata(dev); |
10982 |
++ struct brcmf_pub *drvr = bus_if->drvr; |
10983 |
++ struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio; |
10984 |
++ struct brcmf_sdio *bus = sdiodev->bus; |
10985 |
+ struct dentry *dentry = brcmf_debugfs_get_devdir(drvr); |
10986 |
+ |
10987 |
+ if (IS_ERR_OR_NULL(dentry)) |
10988 |
+@@ -3153,7 +3156,7 @@ static int brcmf_sdio_checkdied(struct brcmf_sdio *bus) |
10989 |
+ return 0; |
10990 |
+ } |
10991 |
+ |
10992 |
+-static void brcmf_sdio_debugfs_create(struct brcmf_sdio *bus) |
10993 |
++static void brcmf_sdio_debugfs_create(struct device *dev) |
10994 |
+ { |
10995 |
+ } |
10996 |
+ #endif /* DEBUG */ |
10997 |
+@@ -3438,8 +3441,6 @@ static int brcmf_sdio_bus_preinit(struct device *dev) |
10998 |
+ if (bus->rxbuf) |
10999 |
+ bus->rxblen = value; |
11000 |
+ |
11001 |
+- brcmf_sdio_debugfs_create(bus); |
11002 |
+- |
11003 |
+ /* the commands below use the terms tx and rx from |
11004 |
+ * a device perspective, ie. bus:txglom affects the |
11005 |
+ * bus transfers from device to host. |
11006 |
+@@ -4050,6 +4051,7 @@ static const struct brcmf_bus_ops brcmf_sdio_bus_ops = { |
11007 |
+ .get_ramsize = brcmf_sdio_bus_get_ramsize, |
11008 |
+ .get_memdump = brcmf_sdio_bus_get_memdump, |
11009 |
+ .get_fwname = brcmf_sdio_get_fwname, |
11010 |
++ .debugfs_create = brcmf_sdio_debugfs_create |
11011 |
+ }; |
11012 |
+ |
11013 |
+ #define BRCMF_SDIO_FW_CODE 0 |
11014 |
+diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/nvm-reg.h b/drivers/net/wireless/intel/iwlwifi/fw/api/nvm-reg.h |
11015 |
+index 6c5338364794..d22c1eefba6a 100644 |
11016 |
+--- a/drivers/net/wireless/intel/iwlwifi/fw/api/nvm-reg.h |
11017 |
++++ b/drivers/net/wireless/intel/iwlwifi/fw/api/nvm-reg.h |
11018 |
+@@ -165,7 +165,7 @@ struct iwl_nvm_access_resp { |
11019 |
+ */ |
11020 |
+ struct iwl_nvm_get_info { |
11021 |
+ __le32 reserved; |
11022 |
+-} __packed; /* GRP_REGULATORY_NVM_GET_INFO_CMD_S_VER_1 */ |
11023 |
++} __packed; /* REGULATORY_NVM_GET_INFO_CMD_API_S_VER_1 */ |
11024 |
+ |
11025 |
+ /** |
11026 |
+ * enum iwl_nvm_info_general_flags - flags in NVM_GET_INFO resp |
11027 |
+@@ -180,14 +180,14 @@ enum iwl_nvm_info_general_flags { |
11028 |
+ * @flags: bit 0: 1 - empty, 0 - non-empty |
11029 |
+ * @nvm_version: nvm version |
11030 |
+ * @board_type: board type |
11031 |
+- * @reserved: reserved |
11032 |
++ * @n_hw_addrs: number of reserved MAC addresses |
11033 |
+ */ |
11034 |
+ struct iwl_nvm_get_info_general { |
11035 |
+ __le32 flags; |
11036 |
+ __le16 nvm_version; |
11037 |
+ u8 board_type; |
11038 |
+- u8 reserved; |
11039 |
+-} __packed; /* GRP_REGULATORY_NVM_GET_INFO_GENERAL_S_VER_1 */ |
11040 |
++ u8 n_hw_addrs; |
11041 |
++} __packed; /* REGULATORY_NVM_GET_INFO_GENERAL_S_VER_2 */ |
11042 |
+ |
11043 |
+ /** |
11044 |
+ * enum iwl_nvm_mac_sku_flags - flags in &iwl_nvm_get_info_sku |
11045 |
+@@ -231,7 +231,7 @@ struct iwl_nvm_get_info_sku { |
11046 |
+ struct iwl_nvm_get_info_phy { |
11047 |
+ __le32 tx_chains; |
11048 |
+ __le32 rx_chains; |
11049 |
+-} __packed; /* GRP_REGULATORY_NVM_GET_INFO_PHY_SKU_SECTION_S_VER_1 */ |
11050 |
++} __packed; /* REGULATORY_NVM_GET_INFO_PHY_SKU_SECTION_S_VER_1 */ |
11051 |
+ |
11052 |
+ #define IWL_NUM_CHANNELS (51) |
11053 |
+ |
11054 |
+@@ -245,7 +245,7 @@ struct iwl_nvm_get_info_regulatory { |
11055 |
+ __le32 lar_enabled; |
11056 |
+ __le16 channel_profile[IWL_NUM_CHANNELS]; |
11057 |
+ __le16 reserved; |
11058 |
+-} __packed; /* GRP_REGULATORY_NVM_GET_INFO_REGULATORY_S_VER_1 */ |
11059 |
++} __packed; /* REGULATORY_NVM_GET_INFO_REGULATORY_S_VER_1 */ |
11060 |
+ |
11061 |
+ /** |
11062 |
+ * struct iwl_nvm_get_info_rsp - response to get NVM data |
11063 |
+@@ -259,7 +259,7 @@ struct iwl_nvm_get_info_rsp { |
11064 |
+ struct iwl_nvm_get_info_sku mac_sku; |
11065 |
+ struct iwl_nvm_get_info_phy phy_sku; |
11066 |
+ struct iwl_nvm_get_info_regulatory regulatory; |
11067 |
+-} __packed; /* GRP_REGULATORY_NVM_GET_INFO_CMD_RSP_S_VER_2 */ |
11068 |
++} __packed; /* REGULATORY_NVM_GET_INFO_RSP_API_S_VER_3 */ |
11069 |
+ |
11070 |
+ /** |
11071 |
+ * struct iwl_nvm_access_complete_cmd - NVM_ACCESS commands are completed |
11072 |
+diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c |
11073 |
+index 73969dbeb5c5..b850cca9853c 100644 |
11074 |
+--- a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c |
11075 |
++++ b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c |
11076 |
+@@ -1315,6 +1315,7 @@ struct iwl_nvm_data *iwl_get_nvm(struct iwl_trans *trans, |
11077 |
+ bool lar_fw_supported = !iwlwifi_mod_params.lar_disable && |
11078 |
+ fw_has_capa(&fw->ucode_capa, |
11079 |
+ IWL_UCODE_TLV_CAPA_LAR_SUPPORT); |
11080 |
++ bool empty_otp; |
11081 |
+ u32 mac_flags; |
11082 |
+ u32 sbands_flags = 0; |
11083 |
+ |
11084 |
+@@ -1330,7 +1331,9 @@ struct iwl_nvm_data *iwl_get_nvm(struct iwl_trans *trans, |
11085 |
+ } |
11086 |
+ |
11087 |
+ rsp = (void *)hcmd.resp_pkt->data; |
11088 |
+- if (le32_to_cpu(rsp->general.flags) & NVM_GENERAL_FLAGS_EMPTY_OTP) |
11089 |
++ empty_otp = !!(le32_to_cpu(rsp->general.flags) & |
11090 |
++ NVM_GENERAL_FLAGS_EMPTY_OTP); |
11091 |
++ if (empty_otp) |
11092 |
+ IWL_INFO(trans, "OTP is empty\n"); |
11093 |
+ |
11094 |
+ nvm = kzalloc(sizeof(*nvm) + |
11095 |
+@@ -1354,6 +1357,11 @@ struct iwl_nvm_data *iwl_get_nvm(struct iwl_trans *trans, |
11096 |
+ |
11097 |
+ /* Initialize general data */ |
11098 |
+ nvm->nvm_version = le16_to_cpu(rsp->general.nvm_version); |
11099 |
++ nvm->n_hw_addrs = rsp->general.n_hw_addrs; |
11100 |
++ if (nvm->n_hw_addrs == 0) |
11101 |
++ IWL_WARN(trans, |
11102 |
++ "Firmware declares no reserved mac addresses. OTP is empty: %d\n", |
11103 |
++ empty_otp); |
11104 |
+ |
11105 |
+ /* Initialize MAC sku data */ |
11106 |
+ mac_flags = le32_to_cpu(rsp->mac_sku.mac_sku_flags); |
11107 |
+diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c |
11108 |
+index 9808d954dca2..c7e2b88cd5ab 100644 |
11109 |
+--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c |
11110 |
++++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c |
11111 |
+@@ -110,12 +110,12 @@ static int iwl_send_rss_cfg_cmd(struct iwl_mvm *mvm) |
11112 |
+ int i; |
11113 |
+ struct iwl_rss_config_cmd cmd = { |
11114 |
+ .flags = cpu_to_le32(IWL_RSS_ENABLE), |
11115 |
+- .hash_mask = IWL_RSS_HASH_TYPE_IPV4_TCP | |
11116 |
+- IWL_RSS_HASH_TYPE_IPV4_UDP | |
11117 |
+- IWL_RSS_HASH_TYPE_IPV4_PAYLOAD | |
11118 |
+- IWL_RSS_HASH_TYPE_IPV6_TCP | |
11119 |
+- IWL_RSS_HASH_TYPE_IPV6_UDP | |
11120 |
+- IWL_RSS_HASH_TYPE_IPV6_PAYLOAD, |
11121 |
++ .hash_mask = BIT(IWL_RSS_HASH_TYPE_IPV4_TCP) | |
11122 |
++ BIT(IWL_RSS_HASH_TYPE_IPV4_UDP) | |
11123 |
++ BIT(IWL_RSS_HASH_TYPE_IPV4_PAYLOAD) | |
11124 |
++ BIT(IWL_RSS_HASH_TYPE_IPV6_TCP) | |
11125 |
++ BIT(IWL_RSS_HASH_TYPE_IPV6_UDP) | |
11126 |
++ BIT(IWL_RSS_HASH_TYPE_IPV6_PAYLOAD), |
11127 |
+ }; |
11128 |
+ |
11129 |
+ if (mvm->trans->num_rx_queues == 1) |
11130 |
+diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c |
11131 |
+index 036d1d82d93e..77e369453642 100644 |
11132 |
+--- a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c |
11133 |
++++ b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c |
11134 |
+@@ -1077,7 +1077,6 @@ void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi, |
11135 |
+ he_phy_data = le64_to_cpu(desc->v1.he_phy_data); |
11136 |
+ |
11137 |
+ rx_status->flag |= RX_FLAG_AMPDU_DETAILS; |
11138 |
+- rx_status->ampdu_reference = mvm->ampdu_ref; |
11139 |
+ /* toggle is switched whenever new aggregation starts */ |
11140 |
+ if (toggle_bit != mvm->ampdu_toggle) { |
11141 |
+ mvm->ampdu_ref++; |
11142 |
+@@ -1092,6 +1091,7 @@ void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi, |
11143 |
+ RX_FLAG_AMPDU_EOF_BIT; |
11144 |
+ } |
11145 |
+ } |
11146 |
++ rx_status->ampdu_reference = mvm->ampdu_ref; |
11147 |
+ } |
11148 |
+ |
11149 |
+ rcu_read_lock(); |
11150 |
+diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c |
11151 |
+index e850aa504b60..69057701641e 100644 |
11152 |
+--- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c |
11153 |
++++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c |
11154 |
+@@ -2462,7 +2462,7 @@ int iwl_mvm_sta_tx_agg_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
11155 |
+ struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); |
11156 |
+ struct iwl_mvm_tid_data *tid_data; |
11157 |
+ u16 normalized_ssn; |
11158 |
+- int txq_id; |
11159 |
++ u16 txq_id; |
11160 |
+ int ret; |
11161 |
+ |
11162 |
+ if (WARN_ON_ONCE(tid >= IWL_MAX_TID_COUNT)) |
11163 |
+@@ -2506,17 +2506,24 @@ int iwl_mvm_sta_tx_agg_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
11164 |
+ */ |
11165 |
+ txq_id = mvmsta->tid_data[tid].txq_id; |
11166 |
+ if (txq_id == IWL_MVM_INVALID_QUEUE) { |
11167 |
+- txq_id = iwl_mvm_find_free_queue(mvm, mvmsta->sta_id, |
11168 |
+- IWL_MVM_DQA_MIN_DATA_QUEUE, |
11169 |
+- IWL_MVM_DQA_MAX_DATA_QUEUE); |
11170 |
+- if (txq_id < 0) { |
11171 |
+- ret = txq_id; |
11172 |
++ ret = iwl_mvm_find_free_queue(mvm, mvmsta->sta_id, |
11173 |
++ IWL_MVM_DQA_MIN_DATA_QUEUE, |
11174 |
++ IWL_MVM_DQA_MAX_DATA_QUEUE); |
11175 |
++ if (ret < 0) { |
11176 |
+ IWL_ERR(mvm, "Failed to allocate agg queue\n"); |
11177 |
+ goto release_locks; |
11178 |
+ } |
11179 |
+ |
11180 |
++ txq_id = ret; |
11181 |
++ |
11182 |
+ /* TXQ hasn't yet been enabled, so mark it only as reserved */ |
11183 |
+ mvm->queue_info[txq_id].status = IWL_MVM_QUEUE_RESERVED; |
11184 |
++ } else if (WARN_ON(txq_id >= IWL_MAX_HW_QUEUES)) { |
11185 |
++ ret = -ENXIO; |
11186 |
++ IWL_ERR(mvm, "tid_id %d out of range (0, %d)!\n", |
11187 |
++ tid, IWL_MAX_HW_QUEUES - 1); |
11188 |
++ goto out; |
11189 |
++ |
11190 |
+ } else if (unlikely(mvm->queue_info[txq_id].status == |
11191 |
+ IWL_MVM_QUEUE_SHARED)) { |
11192 |
+ ret = -ENXIO; |
11193 |
+diff --git a/drivers/net/wireless/marvell/libertas_tf/cmd.c b/drivers/net/wireless/marvell/libertas_tf/cmd.c |
11194 |
+index 909ac3685010..2b193f1257a5 100644 |
11195 |
+--- a/drivers/net/wireless/marvell/libertas_tf/cmd.c |
11196 |
++++ b/drivers/net/wireless/marvell/libertas_tf/cmd.c |
11197 |
+@@ -69,7 +69,7 @@ static void lbtf_geo_init(struct lbtf_private *priv) |
11198 |
+ break; |
11199 |
+ } |
11200 |
+ |
11201 |
+- for (ch = priv->range.start; ch < priv->range.end; ch++) |
11202 |
++ for (ch = range->start; ch < range->end; ch++) |
11203 |
+ priv->channels[CHAN_TO_IDX(ch)].flags = 0; |
11204 |
+ } |
11205 |
+ |
11206 |
+diff --git a/drivers/net/wireless/mediatek/mt76/usb.c b/drivers/net/wireless/mediatek/mt76/usb.c |
11207 |
+index 8d40e92fb6f2..dcf927de65f3 100644 |
11208 |
+--- a/drivers/net/wireless/mediatek/mt76/usb.c |
11209 |
++++ b/drivers/net/wireless/mediatek/mt76/usb.c |
11210 |
+@@ -273,10 +273,16 @@ EXPORT_SYMBOL_GPL(mt76u_buf_alloc); |
11211 |
+ void mt76u_buf_free(struct mt76u_buf *buf) |
11212 |
+ { |
11213 |
+ struct urb *urb = buf->urb; |
11214 |
++ struct scatterlist *sg; |
11215 |
+ int i; |
11216 |
+ |
11217 |
+- for (i = 0; i < urb->num_sgs; i++) |
11218 |
+- skb_free_frag(sg_virt(&urb->sg[i])); |
11219 |
++ for (i = 0; i < urb->num_sgs; i++) { |
11220 |
++ sg = &urb->sg[i]; |
11221 |
++ if (!sg) |
11222 |
++ continue; |
11223 |
++ |
11224 |
++ skb_free_frag(sg_virt(sg)); |
11225 |
++ } |
11226 |
+ usb_free_urb(buf->urb); |
11227 |
+ } |
11228 |
+ EXPORT_SYMBOL_GPL(mt76u_buf_free); |
11229 |
+@@ -478,7 +484,8 @@ static int mt76u_alloc_rx(struct mt76_dev *dev) |
11230 |
+ nsgs = 1; |
11231 |
+ } |
11232 |
+ |
11233 |
+- for (i = 0; i < MT_NUM_RX_ENTRIES; i++) { |
11234 |
++ q->ndesc = MT_NUM_RX_ENTRIES; |
11235 |
++ for (i = 0; i < q->ndesc; i++) { |
11236 |
+ err = mt76u_buf_alloc(dev, &q->entry[i].ubuf, |
11237 |
+ nsgs, q->buf_size, |
11238 |
+ SKB_WITH_OVERHEAD(q->buf_size), |
11239 |
+@@ -486,7 +493,6 @@ static int mt76u_alloc_rx(struct mt76_dev *dev) |
11240 |
+ if (err < 0) |
11241 |
+ return err; |
11242 |
+ } |
11243 |
+- q->ndesc = MT_NUM_RX_ENTRIES; |
11244 |
+ |
11245 |
+ return mt76u_submit_rx_buffers(dev); |
11246 |
+ } |
11247 |
+diff --git a/drivers/net/wireless/mediatek/mt7601u/phy.c b/drivers/net/wireless/mediatek/mt7601u/phy.c |
11248 |
+index b804abd464ae..539f78149e43 100644 |
11249 |
+--- a/drivers/net/wireless/mediatek/mt7601u/phy.c |
11250 |
++++ b/drivers/net/wireless/mediatek/mt7601u/phy.c |
11251 |
+@@ -221,7 +221,7 @@ int mt7601u_wait_bbp_ready(struct mt7601u_dev *dev) |
11252 |
+ |
11253 |
+ do { |
11254 |
+ val = mt7601u_bbp_rr(dev, MT_BBP_REG_VERSION); |
11255 |
+- if (val && ~val) |
11256 |
++ if (val && val != 0xff) |
11257 |
+ break; |
11258 |
+ } while (--i); |
11259 |
+ |
11260 |
+diff --git a/drivers/net/wireless/realtek/rtlwifi/debug.c b/drivers/net/wireless/realtek/rtlwifi/debug.c |
11261 |
+index d70385be9976..498994041bbc 100644 |
11262 |
+--- a/drivers/net/wireless/realtek/rtlwifi/debug.c |
11263 |
++++ b/drivers/net/wireless/realtek/rtlwifi/debug.c |
11264 |
+@@ -109,7 +109,7 @@ static const struct file_operations file_ops_common = { |
11265 |
+ .open = dl_debug_open_common, |
11266 |
+ .read = seq_read, |
11267 |
+ .llseek = seq_lseek, |
11268 |
+- .release = seq_release, |
11269 |
++ .release = single_release, |
11270 |
+ }; |
11271 |
+ |
11272 |
+ static int rtl_debug_get_mac_page(struct seq_file *m, void *v) |
11273 |
+diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c |
11274 |
+index 317c1b3101da..ba258318ee9f 100644 |
11275 |
+--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c |
11276 |
++++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c |
11277 |
+@@ -3404,75 +3404,6 @@ static void rtl8821ae_update_hal_rate_table(struct ieee80211_hw *hw, |
11278 |
+ "%x\n", rtl_read_dword(rtlpriv, REG_ARFR0)); |
11279 |
+ } |
11280 |
+ |
11281 |
+-static u8 _rtl8821ae_mrate_idx_to_arfr_id( |
11282 |
+- struct ieee80211_hw *hw, u8 rate_index, |
11283 |
+- enum wireless_mode wirelessmode) |
11284 |
+-{ |
11285 |
+- struct rtl_priv *rtlpriv = rtl_priv(hw); |
11286 |
+- struct rtl_phy *rtlphy = &rtlpriv->phy; |
11287 |
+- u8 ret = 0; |
11288 |
+- switch (rate_index) { |
11289 |
+- case RATR_INX_WIRELESS_NGB: |
11290 |
+- if (rtlphy->rf_type == RF_1T1R) |
11291 |
+- ret = 1; |
11292 |
+- else |
11293 |
+- ret = 0; |
11294 |
+- ; break; |
11295 |
+- case RATR_INX_WIRELESS_N: |
11296 |
+- case RATR_INX_WIRELESS_NG: |
11297 |
+- if (rtlphy->rf_type == RF_1T1R) |
11298 |
+- ret = 5; |
11299 |
+- else |
11300 |
+- ret = 4; |
11301 |
+- ; break; |
11302 |
+- case RATR_INX_WIRELESS_NB: |
11303 |
+- if (rtlphy->rf_type == RF_1T1R) |
11304 |
+- ret = 3; |
11305 |
+- else |
11306 |
+- ret = 2; |
11307 |
+- ; break; |
11308 |
+- case RATR_INX_WIRELESS_GB: |
11309 |
+- ret = 6; |
11310 |
+- break; |
11311 |
+- case RATR_INX_WIRELESS_G: |
11312 |
+- ret = 7; |
11313 |
+- break; |
11314 |
+- case RATR_INX_WIRELESS_B: |
11315 |
+- ret = 8; |
11316 |
+- break; |
11317 |
+- case RATR_INX_WIRELESS_MC: |
11318 |
+- if ((wirelessmode == WIRELESS_MODE_B) |
11319 |
+- || (wirelessmode == WIRELESS_MODE_G) |
11320 |
+- || (wirelessmode == WIRELESS_MODE_N_24G) |
11321 |
+- || (wirelessmode == WIRELESS_MODE_AC_24G)) |
11322 |
+- ret = 6; |
11323 |
+- else |
11324 |
+- ret = 7; |
11325 |
+- case RATR_INX_WIRELESS_AC_5N: |
11326 |
+- if (rtlphy->rf_type == RF_1T1R) |
11327 |
+- ret = 10; |
11328 |
+- else |
11329 |
+- ret = 9; |
11330 |
+- break; |
11331 |
+- case RATR_INX_WIRELESS_AC_24N: |
11332 |
+- if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_80) { |
11333 |
+- if (rtlphy->rf_type == RF_1T1R) |
11334 |
+- ret = 10; |
11335 |
+- else |
11336 |
+- ret = 9; |
11337 |
+- } else { |
11338 |
+- if (rtlphy->rf_type == RF_1T1R) |
11339 |
+- ret = 11; |
11340 |
+- else |
11341 |
+- ret = 12; |
11342 |
+- } |
11343 |
+- break; |
11344 |
+- default: |
11345 |
+- ret = 0; break; |
11346 |
+- } |
11347 |
+- return ret; |
11348 |
+-} |
11349 |
+- |
11350 |
+ static u32 _rtl8821ae_rate_to_bitmap_2ssvht(__le16 vht_rate) |
11351 |
+ { |
11352 |
+ u8 i, j, tmp_rate; |
11353 |
+@@ -3761,7 +3692,7 @@ static void rtl8821ae_update_hal_rate_mask(struct ieee80211_hw *hw, |
11354 |
+ break; |
11355 |
+ } |
11356 |
+ |
11357 |
+- ratr_index = _rtl8821ae_mrate_idx_to_arfr_id(hw, ratr_index, wirelessmode); |
11358 |
++ ratr_index = rtl_mrate_idx_to_arfr_id(hw, ratr_index, wirelessmode); |
11359 |
+ sta_entry->ratr_index = ratr_index; |
11360 |
+ ratr_bitmap = _rtl8821ae_set_ra_vht_ratr_bitmap(hw, wirelessmode, |
11361 |
+ ratr_bitmap); |
11362 |
+diff --git a/drivers/ntb/hw/idt/ntb_hw_idt.c b/drivers/ntb/hw/idt/ntb_hw_idt.c |
11363 |
+index dbe72f116017..a67ef23e81bc 100644 |
11364 |
+--- a/drivers/ntb/hw/idt/ntb_hw_idt.c |
11365 |
++++ b/drivers/ntb/hw/idt/ntb_hw_idt.c |
11366 |
+@@ -1105,9 +1105,9 @@ static struct idt_mw_cfg *idt_scan_mws(struct idt_ntb_dev *ndev, int port, |
11367 |
+ } |
11368 |
+ |
11369 |
+ /* Allocate memory for memory window descriptors */ |
11370 |
+- ret_mws = devm_kcalloc(&ndev->ntb.pdev->dev, *mw_cnt, |
11371 |
+- sizeof(*ret_mws), GFP_KERNEL); |
11372 |
+- if (IS_ERR_OR_NULL(ret_mws)) |
11373 |
++ ret_mws = devm_kcalloc(&ndev->ntb.pdev->dev, *mw_cnt, sizeof(*ret_mws), |
11374 |
++ GFP_KERNEL); |
11375 |
++ if (!ret_mws) |
11376 |
+ return ERR_PTR(-ENOMEM); |
11377 |
+ |
11378 |
+ /* Copy the info of detected memory windows */ |
11379 |
+@@ -2390,7 +2390,7 @@ static struct idt_ntb_dev *idt_create_dev(struct pci_dev *pdev, |
11380 |
+ |
11381 |
+ /* Allocate memory for the IDT PCIe-device descriptor */ |
11382 |
+ ndev = devm_kzalloc(&pdev->dev, sizeof(*ndev), GFP_KERNEL); |
11383 |
+- if (IS_ERR_OR_NULL(ndev)) { |
11384 |
++ if (!ndev) { |
11385 |
+ dev_err(&pdev->dev, "Memory allocation failed for descriptor"); |
11386 |
+ return ERR_PTR(-ENOMEM); |
11387 |
+ } |
11388 |
+diff --git a/drivers/ntb/hw/mscc/ntb_hw_switchtec.c b/drivers/ntb/hw/mscc/ntb_hw_switchtec.c |
11389 |
+index 5ee5f40b4dfc..313f6258c424 100644 |
11390 |
+--- a/drivers/ntb/hw/mscc/ntb_hw_switchtec.c |
11391 |
++++ b/drivers/ntb/hw/mscc/ntb_hw_switchtec.c |
11392 |
+@@ -899,7 +899,7 @@ static int switchtec_ntb_init_sndev(struct switchtec_ntb *sndev) |
11393 |
+ } |
11394 |
+ |
11395 |
+ sndev->peer_partition = ffs(tpart_vec) - 1; |
11396 |
+- if (!(part_map & (1 << sndev->peer_partition))) { |
11397 |
++ if (!(part_map & (1ULL << sndev->peer_partition))) { |
11398 |
+ dev_err(&sndev->stdev->dev, |
11399 |
+ "ntb target partition is not NT partition\n"); |
11400 |
+ return -ENODEV; |
11401 |
+@@ -1120,7 +1120,7 @@ static int crosslink_enum_partition(struct switchtec_ntb *sndev, |
11402 |
+ |
11403 |
+ dev_dbg(&sndev->stdev->dev, |
11404 |
+ "Crosslink BAR%d addr: %llx\n", |
11405 |
+- i, bar_addr); |
11406 |
++ i*2, bar_addr); |
11407 |
+ |
11408 |
+ if (bar_addr != bar_space * i) |
11409 |
+ continue; |
11410 |
+diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c |
11411 |
+index 124f41157173..3c68a5b35ec1 100644 |
11412 |
+--- a/drivers/nvme/host/pci.c |
11413 |
++++ b/drivers/nvme/host/pci.c |
11414 |
+@@ -2396,7 +2396,7 @@ static int nvme_pci_reg_write32(struct nvme_ctrl *ctrl, u32 off, u32 val) |
11415 |
+ |
11416 |
+ static int nvme_pci_reg_read64(struct nvme_ctrl *ctrl, u32 off, u64 *val) |
11417 |
+ { |
11418 |
+- *val = readq(to_nvme_dev(ctrl)->bar + off); |
11419 |
++ *val = lo_hi_readq(to_nvme_dev(ctrl)->bar + off); |
11420 |
+ return 0; |
11421 |
+ } |
11422 |
+ |
11423 |
+diff --git a/drivers/nvmem/imx-ocotp.c b/drivers/nvmem/imx-ocotp.c |
11424 |
+index 926d9cc080cf..09281aca86c2 100644 |
11425 |
+--- a/drivers/nvmem/imx-ocotp.c |
11426 |
++++ b/drivers/nvmem/imx-ocotp.c |
11427 |
+@@ -50,7 +50,9 @@ |
11428 |
+ #define IMX_OCOTP_BM_CTRL_ERROR 0x00000200 |
11429 |
+ #define IMX_OCOTP_BM_CTRL_REL_SHADOWS 0x00000400 |
11430 |
+ |
11431 |
+-#define DEF_RELAX 20 /* > 16.5ns */ |
11432 |
++#define TIMING_STROBE_PROG_US 10 /* Min time to blow a fuse */ |
11433 |
++#define TIMING_STROBE_READ_NS 37 /* Min time before read */ |
11434 |
++#define TIMING_RELAX_NS 17 |
11435 |
+ #define DEF_FSOURCE 1001 /* > 1000 ns */ |
11436 |
+ #define DEF_STROBE_PROG 10000 /* IPG clocks */ |
11437 |
+ #define IMX_OCOTP_WR_UNLOCK 0x3E770000 |
11438 |
+@@ -182,14 +184,41 @@ static void imx_ocotp_set_imx6_timing(struct ocotp_priv *priv) |
11439 |
+ * fields with timing values to match the current frequency of the |
11440 |
+ * ipg_clk. OTP writes will work at maximum bus frequencies as long |
11441 |
+ * as the HW_OCOTP_TIMING parameters are set correctly. |
11442 |
++ * |
11443 |
++ * Note: there are minimum timings required to ensure an OTP fuse burns |
11444 |
++ * correctly that are independent of the ipg_clk. Those values are not |
11445 |
++ * formally documented anywhere however, working from the minimum |
11446 |
++ * timings given in u-boot we can say: |
11447 |
++ * |
11448 |
++ * - Minimum STROBE_PROG time is 10 microseconds. Intuitively 10 |
11449 |
++ * microseconds feels about right as representative of a minimum time |
11450 |
++ * to physically burn out a fuse. |
11451 |
++ * |
11452 |
++ * - Minimum STROBE_READ i.e. the time to wait post OTP fuse burn before |
11453 |
++ * performing another read is 37 nanoseconds |
11454 |
++ * |
11455 |
++ * - Minimum RELAX timing is 17 nanoseconds. This final RELAX minimum |
11456 |
++ * timing is not entirely clear the documentation says "This |
11457 |
++ * count value specifies the time to add to all default timing |
11458 |
++ * parameters other than the Tpgm and Trd. It is given in number |
11459 |
++ * of ipg_clk periods." where Tpgm and Trd refer to STROBE_PROG |
11460 |
++ * and STROBE_READ respectively. What the other timing parameters |
11461 |
++ * are though, is not specified. Experience shows a zero RELAX |
11462 |
++ * value will mess up a re-load of the shadow registers post OTP |
11463 |
++ * burn. |
11464 |
+ */ |
11465 |
+ clk_rate = clk_get_rate(priv->clk); |
11466 |
+ |
11467 |
+- relax = clk_rate / (1000000000 / DEF_RELAX) - 1; |
11468 |
+- strobe_prog = clk_rate / (1000000000 / 10000) + 2 * (DEF_RELAX + 1) - 1; |
11469 |
+- strobe_read = clk_rate / (1000000000 / 40) + 2 * (DEF_RELAX + 1) - 1; |
11470 |
++ relax = DIV_ROUND_UP(clk_rate * TIMING_RELAX_NS, 1000000000) - 1; |
11471 |
++ strobe_read = DIV_ROUND_UP(clk_rate * TIMING_STROBE_READ_NS, |
11472 |
++ 1000000000); |
11473 |
++ strobe_read += 2 * (relax + 1) - 1; |
11474 |
++ strobe_prog = DIV_ROUND_CLOSEST(clk_rate * TIMING_STROBE_PROG_US, |
11475 |
++ 1000000); |
11476 |
++ strobe_prog += 2 * (relax + 1) - 1; |
11477 |
+ |
11478 |
+- timing = strobe_prog & 0x00000FFF; |
11479 |
++ timing = readl(priv->base + IMX_OCOTP_ADDR_TIMING) & 0x0FC00000; |
11480 |
++ timing |= strobe_prog & 0x00000FFF; |
11481 |
+ timing |= (relax << 12) & 0x0000F000; |
11482 |
+ timing |= (strobe_read << 16) & 0x003F0000; |
11483 |
+ |
11484 |
+diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c |
11485 |
+index 5ad1342f5682..7d2bc22680d9 100644 |
11486 |
+--- a/drivers/of/of_mdio.c |
11487 |
++++ b/drivers/of/of_mdio.c |
11488 |
+@@ -370,7 +370,7 @@ struct phy_device *of_phy_get_and_connect(struct net_device *dev, |
11489 |
+ int ret; |
11490 |
+ |
11491 |
+ iface = of_get_phy_mode(np); |
11492 |
+- if (iface < 0) |
11493 |
++ if ((int)iface < 0) |
11494 |
+ return NULL; |
11495 |
+ if (of_phy_is_fixed_link(np)) { |
11496 |
+ ret = of_phy_register_fixed_link(np); |
11497 |
+diff --git a/drivers/opp/core.c b/drivers/opp/core.c |
11498 |
+index 1e80f9ec1aa6..34515f432375 100644 |
11499 |
+--- a/drivers/opp/core.c |
11500 |
++++ b/drivers/opp/core.c |
11501 |
+@@ -793,6 +793,9 @@ static struct opp_table *_allocate_opp_table(struct device *dev) |
11502 |
+ |
11503 |
+ INIT_LIST_HEAD(&opp_table->dev_list); |
11504 |
+ |
11505 |
++ /* Mark regulator count uninitialized */ |
11506 |
++ opp_table->regulator_count = -1; |
11507 |
++ |
11508 |
+ opp_dev = _add_opp_dev(dev, opp_table); |
11509 |
+ if (!opp_dev) { |
11510 |
+ kfree(opp_table); |
11511 |
+@@ -955,7 +958,7 @@ struct dev_pm_opp *_opp_allocate(struct opp_table *table) |
11512 |
+ int count, supply_size; |
11513 |
+ |
11514 |
+ /* Allocate space for at least one supply */ |
11515 |
+- count = table->regulator_count ? table->regulator_count : 1; |
11516 |
++ count = table->regulator_count > 0 ? table->regulator_count : 1; |
11517 |
+ supply_size = sizeof(*opp->supplies) * count; |
11518 |
+ |
11519 |
+ /* allocate new OPP node and supplies structures */ |
11520 |
+@@ -1363,7 +1366,7 @@ free_regulators: |
11521 |
+ |
11522 |
+ kfree(opp_table->regulators); |
11523 |
+ opp_table->regulators = NULL; |
11524 |
+- opp_table->regulator_count = 0; |
11525 |
++ opp_table->regulator_count = -1; |
11526 |
+ err: |
11527 |
+ dev_pm_opp_put_opp_table(opp_table); |
11528 |
+ |
11529 |
+@@ -1392,7 +1395,7 @@ void dev_pm_opp_put_regulators(struct opp_table *opp_table) |
11530 |
+ |
11531 |
+ kfree(opp_table->regulators); |
11532 |
+ opp_table->regulators = NULL; |
11533 |
+- opp_table->regulator_count = 0; |
11534 |
++ opp_table->regulator_count = -1; |
11535 |
+ |
11536 |
+ put_opp_table: |
11537 |
+ dev_pm_opp_put_opp_table(opp_table); |
11538 |
+@@ -1545,6 +1548,9 @@ int dev_pm_opp_add(struct device *dev, unsigned long freq, unsigned long u_volt) |
11539 |
+ if (!opp_table) |
11540 |
+ return -ENOMEM; |
11541 |
+ |
11542 |
++ /* Fix regulator count for dynamic OPPs */ |
11543 |
++ opp_table->regulator_count = 1; |
11544 |
++ |
11545 |
+ ret = _opp_add_v1(opp_table, dev, freq, u_volt, true); |
11546 |
+ |
11547 |
+ dev_pm_opp_put_opp_table(opp_table); |
11548 |
+diff --git a/drivers/opp/of.c b/drivers/opp/of.c |
11549 |
+index 20988c426650..d64a13d7881b 100644 |
11550 |
+--- a/drivers/opp/of.c |
11551 |
++++ b/drivers/opp/of.c |
11552 |
+@@ -113,12 +113,10 @@ static int opp_parse_supplies(struct dev_pm_opp *opp, struct device *dev, |
11553 |
+ struct opp_table *opp_table) |
11554 |
+ { |
11555 |
+ u32 *microvolt, *microamp = NULL; |
11556 |
+- int supplies, vcount, icount, ret, i, j; |
11557 |
++ int supplies = opp_table->regulator_count, vcount, icount, ret, i, j; |
11558 |
+ struct property *prop = NULL; |
11559 |
+ char name[NAME_MAX]; |
11560 |
+ |
11561 |
+- supplies = opp_table->regulator_count ? opp_table->regulator_count : 1; |
11562 |
+- |
11563 |
+ /* Search for "opp-microvolt-<name>" */ |
11564 |
+ if (opp_table->prop_name) { |
11565 |
+ snprintf(name, sizeof(name), "opp-microvolt-%s", |
11566 |
+@@ -133,7 +131,13 @@ static int opp_parse_supplies(struct dev_pm_opp *opp, struct device *dev, |
11567 |
+ |
11568 |
+ /* Missing property isn't a problem, but an invalid entry is */ |
11569 |
+ if (!prop) { |
11570 |
+- if (!opp_table->regulator_count) |
11571 |
++ if (unlikely(supplies == -1)) { |
11572 |
++ /* Initialize regulator_count */ |
11573 |
++ opp_table->regulator_count = 0; |
11574 |
++ return 0; |
11575 |
++ } |
11576 |
++ |
11577 |
++ if (!supplies) |
11578 |
+ return 0; |
11579 |
+ |
11580 |
+ dev_err(dev, "%s: opp-microvolt missing although OPP managing regulators\n", |
11581 |
+@@ -142,6 +146,14 @@ static int opp_parse_supplies(struct dev_pm_opp *opp, struct device *dev, |
11582 |
+ } |
11583 |
+ } |
11584 |
+ |
11585 |
++ if (unlikely(supplies == -1)) { |
11586 |
++ /* Initialize regulator_count */ |
11587 |
++ supplies = opp_table->regulator_count = 1; |
11588 |
++ } else if (unlikely(!supplies)) { |
11589 |
++ dev_err(dev, "%s: opp-microvolt wasn't expected\n", __func__); |
11590 |
++ return -EINVAL; |
11591 |
++ } |
11592 |
++ |
11593 |
+ vcount = of_property_count_u32_elems(opp->np, name); |
11594 |
+ if (vcount < 0) { |
11595 |
+ dev_err(dev, "%s: Invalid %s property (%d)\n", |
11596 |
+diff --git a/drivers/opp/opp.h b/drivers/opp/opp.h |
11597 |
+index 7c540fd063b2..c9e65964ed84 100644 |
11598 |
+--- a/drivers/opp/opp.h |
11599 |
++++ b/drivers/opp/opp.h |
11600 |
+@@ -136,7 +136,9 @@ enum opp_table_access { |
11601 |
+ * @prop_name: A name to postfix to many DT properties, while parsing them. |
11602 |
+ * @clk: Device's clock handle |
11603 |
+ * @regulators: Supply regulators |
11604 |
+- * @regulator_count: Number of power supply regulators |
11605 |
++ * @regulator_count: Number of power supply regulators. Its value can be -1 |
11606 |
++ * (uninitialized), 0 (no opp-microvolt property) or > 0 (has opp-microvolt |
11607 |
++ * property). |
11608 |
+ * @genpd_performance_state: Device's power domain support performance state. |
11609 |
+ * @set_opp: Platform specific set_opp callback |
11610 |
+ * @set_opp_data: Data to be passed to set_opp callback |
11611 |
+@@ -172,7 +174,7 @@ struct opp_table { |
11612 |
+ const char *prop_name; |
11613 |
+ struct clk *clk; |
11614 |
+ struct regulator **regulators; |
11615 |
+- unsigned int regulator_count; |
11616 |
++ int regulator_count; |
11617 |
+ bool genpd_performance_state; |
11618 |
+ |
11619 |
+ int (*set_opp)(struct dev_pm_set_opp_data *data); |
11620 |
+diff --git a/drivers/pci/controller/dwc/pcie-designware-ep.c b/drivers/pci/controller/dwc/pcie-designware-ep.c |
11621 |
+index 739d97080d3b..a3d07d9c598b 100644 |
11622 |
+--- a/drivers/pci/controller/dwc/pcie-designware-ep.c |
11623 |
++++ b/drivers/pci/controller/dwc/pcie-designware-ep.c |
11624 |
+@@ -46,16 +46,19 @@ static u8 __dw_pcie_ep_find_next_cap(struct dw_pcie *pci, u8 cap_ptr, |
11625 |
+ u8 cap_id, next_cap_ptr; |
11626 |
+ u16 reg; |
11627 |
+ |
11628 |
++ if (!cap_ptr) |
11629 |
++ return 0; |
11630 |
++ |
11631 |
+ reg = dw_pcie_readw_dbi(pci, cap_ptr); |
11632 |
+- next_cap_ptr = (reg & 0xff00) >> 8; |
11633 |
+ cap_id = (reg & 0x00ff); |
11634 |
+ |
11635 |
+- if (!next_cap_ptr || cap_id > PCI_CAP_ID_MAX) |
11636 |
++ if (cap_id > PCI_CAP_ID_MAX) |
11637 |
+ return 0; |
11638 |
+ |
11639 |
+ if (cap_id == cap) |
11640 |
+ return cap_ptr; |
11641 |
+ |
11642 |
++ next_cap_ptr = (reg & 0xff00) >> 8; |
11643 |
+ return __dw_pcie_ep_find_next_cap(pci, next_cap_ptr, cap); |
11644 |
+ } |
11645 |
+ |
11646 |
+@@ -67,9 +70,6 @@ static u8 dw_pcie_ep_find_capability(struct dw_pcie *pci, u8 cap) |
11647 |
+ reg = dw_pcie_readw_dbi(pci, PCI_CAPABILITY_LIST); |
11648 |
+ next_cap_ptr = (reg & 0x00ff); |
11649 |
+ |
11650 |
+- if (!next_cap_ptr) |
11651 |
+- return 0; |
11652 |
+- |
11653 |
+ return __dw_pcie_ep_find_next_cap(pci, next_cap_ptr, cap); |
11654 |
+ } |
11655 |
+ |
11656 |
+diff --git a/drivers/pci/controller/pcie-iproc.c b/drivers/pci/controller/pcie-iproc.c |
11657 |
+index 3160e9342a2f..9d5cbc75d5ae 100644 |
11658 |
+--- a/drivers/pci/controller/pcie-iproc.c |
11659 |
++++ b/drivers/pci/controller/pcie-iproc.c |
11660 |
+@@ -630,14 +630,6 @@ static void __iomem *iproc_pcie_map_cfg_bus(struct iproc_pcie *pcie, |
11661 |
+ return (pcie->base + offset); |
11662 |
+ } |
11663 |
+ |
11664 |
+- /* |
11665 |
+- * PAXC is connected to an internally emulated EP within the SoC. It |
11666 |
+- * allows only one device. |
11667 |
+- */ |
11668 |
+- if (pcie->ep_is_internal) |
11669 |
+- if (slot > 0) |
11670 |
+- return NULL; |
11671 |
+- |
11672 |
+ return iproc_pcie_map_ep_cfg_reg(pcie, busno, slot, fn, where); |
11673 |
+ } |
11674 |
+ |
11675 |
+@@ -1355,7 +1347,6 @@ static int iproc_pcie_rev_init(struct iproc_pcie *pcie) |
11676 |
+ break; |
11677 |
+ case IPROC_PCIE_PAXB: |
11678 |
+ regs = iproc_pcie_reg_paxb; |
11679 |
+- pcie->iproc_cfg_read = true; |
11680 |
+ pcie->has_apb_err_disable = true; |
11681 |
+ if (pcie->need_ob_cfg) { |
11682 |
+ pcie->ob_map = paxb_ob_map; |
11683 |
+@@ -1364,6 +1355,7 @@ static int iproc_pcie_rev_init(struct iproc_pcie *pcie) |
11684 |
+ break; |
11685 |
+ case IPROC_PCIE_PAXB_V2: |
11686 |
+ regs = iproc_pcie_reg_paxb_v2; |
11687 |
++ pcie->iproc_cfg_read = true; |
11688 |
+ pcie->has_apb_err_disable = true; |
11689 |
+ if (pcie->need_ob_cfg) { |
11690 |
+ pcie->ob_map = paxb_v2_ob_map; |
11691 |
+diff --git a/drivers/pci/controller/pcie-mobiveil.c b/drivers/pci/controller/pcie-mobiveil.c |
11692 |
+index a2d1e89d4867..14f816591e84 100644 |
11693 |
+--- a/drivers/pci/controller/pcie-mobiveil.c |
11694 |
++++ b/drivers/pci/controller/pcie-mobiveil.c |
11695 |
+@@ -174,7 +174,7 @@ static bool mobiveil_pcie_valid_device(struct pci_bus *bus, unsigned int devfn) |
11696 |
+ * Do not read more than one device on the bus directly |
11697 |
+ * attached to RC |
11698 |
+ */ |
11699 |
+- if ((bus->primary == pcie->root_bus_nr) && (devfn > 0)) |
11700 |
++ if ((bus->primary == pcie->root_bus_nr) && (PCI_SLOT(devfn) > 0)) |
11701 |
+ return false; |
11702 |
+ |
11703 |
+ return true; |
11704 |
+@@ -395,7 +395,7 @@ static void program_ib_windows(struct mobiveil_pcie *pcie, int win_num, |
11705 |
+ int amap_ctrl_dw; |
11706 |
+ u64 size64 = ~(size - 1); |
11707 |
+ |
11708 |
+- if ((pcie->ib_wins_configured + 1) > pcie->ppio_wins) { |
11709 |
++ if (win_num >= pcie->ppio_wins) { |
11710 |
+ dev_err(&pcie->pdev->dev, |
11711 |
+ "ERROR: max inbound windows reached !\n"); |
11712 |
+ return; |
11713 |
+@@ -429,7 +429,7 @@ static void program_ob_windows(struct mobiveil_pcie *pcie, int win_num, |
11714 |
+ u32 value, type; |
11715 |
+ u64 size64 = ~(size - 1); |
11716 |
+ |
11717 |
+- if ((pcie->ob_wins_configured + 1) > pcie->apio_wins) { |
11718 |
++ if (win_num >= pcie->apio_wins) { |
11719 |
+ dev_err(&pcie->pdev->dev, |
11720 |
+ "ERROR: max outbound windows reached !\n"); |
11721 |
+ return; |
11722 |
+@@ -643,7 +643,7 @@ static struct irq_chip mobiveil_msi_irq_chip = { |
11723 |
+ |
11724 |
+ static struct msi_domain_info mobiveil_msi_domain_info = { |
11725 |
+ .flags = (MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS | |
11726 |
+- MSI_FLAG_MULTI_PCI_MSI | MSI_FLAG_PCI_MSIX), |
11727 |
++ MSI_FLAG_PCI_MSIX), |
11728 |
+ .chip = &mobiveil_msi_irq_chip, |
11729 |
+ }; |
11730 |
+ |
11731 |
+diff --git a/drivers/pci/controller/pcie-rockchip-ep.c b/drivers/pci/controller/pcie-rockchip-ep.c |
11732 |
+index b8163c56a142..caf34661d38d 100644 |
11733 |
+--- a/drivers/pci/controller/pcie-rockchip-ep.c |
11734 |
++++ b/drivers/pci/controller/pcie-rockchip-ep.c |
11735 |
+@@ -350,7 +350,7 @@ static void rockchip_pcie_ep_assert_intx(struct rockchip_pcie_ep *ep, u8 fn, |
11736 |
+ struct rockchip_pcie *rockchip = &ep->rockchip; |
11737 |
+ u32 r = ep->max_regions - 1; |
11738 |
+ u32 offset; |
11739 |
+- u16 status; |
11740 |
++ u32 status; |
11741 |
+ u8 msg_code; |
11742 |
+ |
11743 |
+ if (unlikely(ep->irq_pci_addr != ROCKCHIP_PCIE_EP_PCI_LEGACY_IRQ_ADDR || |
11744 |
+diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c |
11745 |
+index 3e86fa3c7da3..4bbd26e8a9e2 100644 |
11746 |
+--- a/drivers/pci/endpoint/functions/pci-epf-test.c |
11747 |
++++ b/drivers/pci/endpoint/functions/pci-epf-test.c |
11748 |
+@@ -175,7 +175,7 @@ static int pci_epf_test_read(struct pci_epf_test *epf_test) |
11749 |
+ goto err_map_addr; |
11750 |
+ } |
11751 |
+ |
11752 |
+- memcpy(buf, src_addr, reg->size); |
11753 |
++ memcpy_fromio(buf, src_addr, reg->size); |
11754 |
+ |
11755 |
+ crc32 = crc32_le(~0, buf, reg->size); |
11756 |
+ if (crc32 != reg->checksum) |
11757 |
+@@ -230,7 +230,7 @@ static int pci_epf_test_write(struct pci_epf_test *epf_test) |
11758 |
+ get_random_bytes(buf, reg->size); |
11759 |
+ reg->checksum = crc32_le(~0, buf, reg->size); |
11760 |
+ |
11761 |
+- memcpy(dst_addr, buf, reg->size); |
11762 |
++ memcpy_toio(dst_addr, buf, reg->size); |
11763 |
+ |
11764 |
+ /* |
11765 |
+ * wait 1ms inorder for the write to complete. Without this delay L3 |
11766 |
+diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c |
11767 |
+index bc1ff41ce3d3..78ae1cab9af7 100644 |
11768 |
+--- a/drivers/pci/pci-driver.c |
11769 |
++++ b/drivers/pci/pci-driver.c |
11770 |
+@@ -959,15 +959,15 @@ static int pci_pm_freeze(struct device *dev) |
11771 |
+ } |
11772 |
+ |
11773 |
+ /* |
11774 |
+- * This used to be done in pci_pm_prepare() for all devices and some |
11775 |
+- * drivers may depend on it, so do it here. Ideally, runtime-suspended |
11776 |
+- * devices should not be touched during freeze/thaw transitions, |
11777 |
+- * however. |
11778 |
++ * Resume all runtime-suspended devices before creating a snapshot |
11779 |
++ * image of system memory, because the restore kernel generally cannot |
11780 |
++ * be expected to always handle them consistently and they need to be |
11781 |
++ * put into the runtime-active metastate during system resume anyway, |
11782 |
++ * so it is better to ensure that the state saved in the image will be |
11783 |
++ * always consistent with that. |
11784 |
+ */ |
11785 |
+- if (!dev_pm_smart_suspend_and_suspended(dev)) { |
11786 |
+- pm_runtime_resume(dev); |
11787 |
+- pci_dev->state_saved = false; |
11788 |
+- } |
11789 |
++ pm_runtime_resume(dev); |
11790 |
++ pci_dev->state_saved = false; |
11791 |
+ |
11792 |
+ if (pm->freeze) { |
11793 |
+ int error; |
11794 |
+diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c |
11795 |
+index c9f51fc24563..57a87a001b4f 100644 |
11796 |
+--- a/drivers/pci/pci.c |
11797 |
++++ b/drivers/pci/pci.c |
11798 |
+@@ -5039,39 +5039,42 @@ unlock: |
11799 |
+ return 0; |
11800 |
+ } |
11801 |
+ |
11802 |
+-/* Save and disable devices from the top of the tree down */ |
11803 |
+-static void pci_bus_save_and_disable(struct pci_bus *bus) |
11804 |
++/* |
11805 |
++ * Save and disable devices from the top of the tree down while holding |
11806 |
++ * the @dev mutex lock for the entire tree. |
11807 |
++ */ |
11808 |
++static void pci_bus_save_and_disable_locked(struct pci_bus *bus) |
11809 |
+ { |
11810 |
+ struct pci_dev *dev; |
11811 |
+ |
11812 |
+ list_for_each_entry(dev, &bus->devices, bus_list) { |
11813 |
+- pci_dev_lock(dev); |
11814 |
+ pci_dev_save_and_disable(dev); |
11815 |
+- pci_dev_unlock(dev); |
11816 |
+ if (dev->subordinate) |
11817 |
+- pci_bus_save_and_disable(dev->subordinate); |
11818 |
++ pci_bus_save_and_disable_locked(dev->subordinate); |
11819 |
+ } |
11820 |
+ } |
11821 |
+ |
11822 |
+ /* |
11823 |
+- * Restore devices from top of the tree down - parent bridges need to be |
11824 |
+- * restored before we can get to subordinate devices. |
11825 |
++ * Restore devices from top of the tree down while holding @dev mutex lock |
11826 |
++ * for the entire tree. Parent bridges need to be restored before we can |
11827 |
++ * get to subordinate devices. |
11828 |
+ */ |
11829 |
+-static void pci_bus_restore(struct pci_bus *bus) |
11830 |
++static void pci_bus_restore_locked(struct pci_bus *bus) |
11831 |
+ { |
11832 |
+ struct pci_dev *dev; |
11833 |
+ |
11834 |
+ list_for_each_entry(dev, &bus->devices, bus_list) { |
11835 |
+- pci_dev_lock(dev); |
11836 |
+ pci_dev_restore(dev); |
11837 |
+- pci_dev_unlock(dev); |
11838 |
+ if (dev->subordinate) |
11839 |
+- pci_bus_restore(dev->subordinate); |
11840 |
++ pci_bus_restore_locked(dev->subordinate); |
11841 |
+ } |
11842 |
+ } |
11843 |
+ |
11844 |
+-/* Save and disable devices from the top of the tree down */ |
11845 |
+-static void pci_slot_save_and_disable(struct pci_slot *slot) |
11846 |
++/* |
11847 |
++ * Save and disable devices from the top of the tree down while holding |
11848 |
++ * the @dev mutex lock for the entire tree. |
11849 |
++ */ |
11850 |
++static void pci_slot_save_and_disable_locked(struct pci_slot *slot) |
11851 |
+ { |
11852 |
+ struct pci_dev *dev; |
11853 |
+ |
11854 |
+@@ -5080,26 +5083,25 @@ static void pci_slot_save_and_disable(struct pci_slot *slot) |
11855 |
+ continue; |
11856 |
+ pci_dev_save_and_disable(dev); |
11857 |
+ if (dev->subordinate) |
11858 |
+- pci_bus_save_and_disable(dev->subordinate); |
11859 |
++ pci_bus_save_and_disable_locked(dev->subordinate); |
11860 |
+ } |
11861 |
+ } |
11862 |
+ |
11863 |
+ /* |
11864 |
+- * Restore devices from top of the tree down - parent bridges need to be |
11865 |
+- * restored before we can get to subordinate devices. |
11866 |
++ * Restore devices from top of the tree down while holding @dev mutex lock |
11867 |
++ * for the entire tree. Parent bridges need to be restored before we can |
11868 |
++ * get to subordinate devices. |
11869 |
+ */ |
11870 |
+-static void pci_slot_restore(struct pci_slot *slot) |
11871 |
++static void pci_slot_restore_locked(struct pci_slot *slot) |
11872 |
+ { |
11873 |
+ struct pci_dev *dev; |
11874 |
+ |
11875 |
+ list_for_each_entry(dev, &slot->bus->devices, bus_list) { |
11876 |
+ if (!dev->slot || dev->slot != slot) |
11877 |
+ continue; |
11878 |
+- pci_dev_lock(dev); |
11879 |
+ pci_dev_restore(dev); |
11880 |
+- pci_dev_unlock(dev); |
11881 |
+ if (dev->subordinate) |
11882 |
+- pci_bus_restore(dev->subordinate); |
11883 |
++ pci_bus_restore_locked(dev->subordinate); |
11884 |
+ } |
11885 |
+ } |
11886 |
+ |
11887 |
+@@ -5158,17 +5160,15 @@ static int __pci_reset_slot(struct pci_slot *slot) |
11888 |
+ if (rc) |
11889 |
+ return rc; |
11890 |
+ |
11891 |
+- pci_slot_save_and_disable(slot); |
11892 |
+- |
11893 |
+ if (pci_slot_trylock(slot)) { |
11894 |
++ pci_slot_save_and_disable_locked(slot); |
11895 |
+ might_sleep(); |
11896 |
+ rc = pci_reset_hotplug_slot(slot->hotplug, 0); |
11897 |
++ pci_slot_restore_locked(slot); |
11898 |
+ pci_slot_unlock(slot); |
11899 |
+ } else |
11900 |
+ rc = -EAGAIN; |
11901 |
+ |
11902 |
+- pci_slot_restore(slot); |
11903 |
+- |
11904 |
+ return rc; |
11905 |
+ } |
11906 |
+ |
11907 |
+@@ -5254,17 +5254,15 @@ static int __pci_reset_bus(struct pci_bus *bus) |
11908 |
+ if (rc) |
11909 |
+ return rc; |
11910 |
+ |
11911 |
+- pci_bus_save_and_disable(bus); |
11912 |
+- |
11913 |
+ if (pci_bus_trylock(bus)) { |
11914 |
++ pci_bus_save_and_disable_locked(bus); |
11915 |
+ might_sleep(); |
11916 |
+ rc = pci_bridge_secondary_bus_reset(bus->self); |
11917 |
++ pci_bus_restore_locked(bus); |
11918 |
+ pci_bus_unlock(bus); |
11919 |
+ } else |
11920 |
+ rc = -EAGAIN; |
11921 |
+ |
11922 |
+- pci_bus_restore(bus); |
11923 |
+- |
11924 |
+ return rc; |
11925 |
+ } |
11926 |
+ |
11927 |
+diff --git a/drivers/pci/switch/switchtec.c b/drivers/pci/switch/switchtec.c |
11928 |
+index 5aaa4ce04ec3..ceb7ab3ba3d0 100644 |
11929 |
+--- a/drivers/pci/switch/switchtec.c |
11930 |
++++ b/drivers/pci/switch/switchtec.c |
11931 |
+@@ -134,10 +134,6 @@ static void mrpc_cmd_submit(struct switchtec_dev *stdev) |
11932 |
+ stuser->data, stuser->data_len); |
11933 |
+ iowrite32(stuser->cmd, &stdev->mmio_mrpc->cmd); |
11934 |
+ |
11935 |
+- stuser->status = ioread32(&stdev->mmio_mrpc->status); |
11936 |
+- if (stuser->status != SWITCHTEC_MRPC_STATUS_INPROGRESS) |
11937 |
+- mrpc_complete_cmd(stdev); |
11938 |
+- |
11939 |
+ schedule_delayed_work(&stdev->mrpc_timeout, |
11940 |
+ msecs_to_jiffies(500)); |
11941 |
+ } |
11942 |
+diff --git a/drivers/phy/broadcom/phy-brcm-usb.c b/drivers/phy/broadcom/phy-brcm-usb.c |
11943 |
+index d1dab36fa5b7..e2455ffb8597 100644 |
11944 |
+--- a/drivers/phy/broadcom/phy-brcm-usb.c |
11945 |
++++ b/drivers/phy/broadcom/phy-brcm-usb.c |
11946 |
+@@ -378,6 +378,13 @@ static int brcm_usb_phy_probe(struct platform_device *pdev) |
11947 |
+ return 0; |
11948 |
+ } |
11949 |
+ |
11950 |
++static int brcm_usb_phy_remove(struct platform_device *pdev) |
11951 |
++{ |
11952 |
++ sysfs_remove_group(&pdev->dev.kobj, &brcm_usb_phy_group); |
11953 |
++ |
11954 |
++ return 0; |
11955 |
++} |
11956 |
++ |
11957 |
+ #ifdef CONFIG_PM_SLEEP |
11958 |
+ static int brcm_usb_phy_suspend(struct device *dev) |
11959 |
+ { |
11960 |
+@@ -443,6 +450,7 @@ MODULE_DEVICE_TABLE(of, brcm_usb_dt_ids); |
11961 |
+ |
11962 |
+ static struct platform_driver brcm_usb_driver = { |
11963 |
+ .probe = brcm_usb_phy_probe, |
11964 |
++ .remove = brcm_usb_phy_remove, |
11965 |
+ .driver = { |
11966 |
+ .name = "brcmstb-usb-phy", |
11967 |
+ .owner = THIS_MODULE, |
11968 |
+diff --git a/drivers/phy/qualcomm/phy-qcom-qusb2.c b/drivers/phy/qualcomm/phy-qcom-qusb2.c |
11969 |
+index 69c92843eb3b..9b7ae93e9df1 100644 |
11970 |
+--- a/drivers/phy/qualcomm/phy-qcom-qusb2.c |
11971 |
++++ b/drivers/phy/qualcomm/phy-qcom-qusb2.c |
11972 |
+@@ -526,7 +526,7 @@ static int __maybe_unused qusb2_phy_runtime_resume(struct device *dev) |
11973 |
+ } |
11974 |
+ |
11975 |
+ if (!qphy->has_se_clk_scheme) { |
11976 |
+- clk_prepare_enable(qphy->ref_clk); |
11977 |
++ ret = clk_prepare_enable(qphy->ref_clk); |
11978 |
+ if (ret) { |
11979 |
+ dev_err(dev, "failed to enable ref clk, %d\n", ret); |
11980 |
+ goto disable_ahb_clk; |
11981 |
+diff --git a/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c b/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c |
11982 |
+index b70058caee50..20b9864adce0 100644 |
11983 |
+--- a/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c |
11984 |
++++ b/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c |
11985 |
+@@ -54,8 +54,12 @@ |
11986 |
+ /* drive strength control for ASIU GPIO */ |
11987 |
+ #define IPROC_GPIO_ASIU_DRV0_CTRL_OFFSET 0x58 |
11988 |
+ |
11989 |
+-/* drive strength control for CCM/CRMU (AON) GPIO */ |
11990 |
+-#define IPROC_GPIO_DRV0_CTRL_OFFSET 0x00 |
11991 |
++/* pinconf for CCM GPIO */ |
11992 |
++#define IPROC_GPIO_PULL_DN_OFFSET 0x10 |
11993 |
++#define IPROC_GPIO_PULL_UP_OFFSET 0x14 |
11994 |
++ |
11995 |
++/* pinconf for CRMU(aon) GPIO and CCM GPIO*/ |
11996 |
++#define IPROC_GPIO_DRV_CTRL_OFFSET 0x00 |
11997 |
+ |
11998 |
+ #define GPIO_BANK_SIZE 0x200 |
11999 |
+ #define NGPIOS_PER_BANK 32 |
12000 |
+@@ -76,6 +80,12 @@ enum iproc_pinconf_param { |
12001 |
+ IPROC_PINCON_MAX, |
12002 |
+ }; |
12003 |
+ |
12004 |
++enum iproc_pinconf_ctrl_type { |
12005 |
++ IOCTRL_TYPE_AON = 1, |
12006 |
++ IOCTRL_TYPE_CDRU, |
12007 |
++ IOCTRL_TYPE_INVALID, |
12008 |
++}; |
12009 |
++ |
12010 |
+ /* |
12011 |
+ * Iproc GPIO core |
12012 |
+ * |
12013 |
+@@ -100,6 +110,7 @@ struct iproc_gpio { |
12014 |
+ |
12015 |
+ void __iomem *base; |
12016 |
+ void __iomem *io_ctrl; |
12017 |
++ enum iproc_pinconf_ctrl_type io_ctrl_type; |
12018 |
+ |
12019 |
+ raw_spinlock_t lock; |
12020 |
+ |
12021 |
+@@ -461,20 +472,44 @@ static const struct pinctrl_ops iproc_pctrl_ops = { |
12022 |
+ static int iproc_gpio_set_pull(struct iproc_gpio *chip, unsigned gpio, |
12023 |
+ bool disable, bool pull_up) |
12024 |
+ { |
12025 |
++ void __iomem *base; |
12026 |
+ unsigned long flags; |
12027 |
++ unsigned int shift; |
12028 |
++ u32 val_1, val_2; |
12029 |
+ |
12030 |
+ raw_spin_lock_irqsave(&chip->lock, flags); |
12031 |
+- |
12032 |
+- if (disable) { |
12033 |
+- iproc_set_bit(chip, IPROC_GPIO_RES_EN_OFFSET, gpio, false); |
12034 |
++ if (chip->io_ctrl_type == IOCTRL_TYPE_CDRU) { |
12035 |
++ base = chip->io_ctrl; |
12036 |
++ shift = IPROC_GPIO_SHIFT(gpio); |
12037 |
++ |
12038 |
++ val_1 = readl(base + IPROC_GPIO_PULL_UP_OFFSET); |
12039 |
++ val_2 = readl(base + IPROC_GPIO_PULL_DN_OFFSET); |
12040 |
++ if (disable) { |
12041 |
++ /* no pull-up or pull-down */ |
12042 |
++ val_1 &= ~BIT(shift); |
12043 |
++ val_2 &= ~BIT(shift); |
12044 |
++ } else if (pull_up) { |
12045 |
++ val_1 |= BIT(shift); |
12046 |
++ val_2 &= ~BIT(shift); |
12047 |
++ } else { |
12048 |
++ val_1 &= ~BIT(shift); |
12049 |
++ val_2 |= BIT(shift); |
12050 |
++ } |
12051 |
++ writel(val_1, base + IPROC_GPIO_PULL_UP_OFFSET); |
12052 |
++ writel(val_2, base + IPROC_GPIO_PULL_DN_OFFSET); |
12053 |
+ } else { |
12054 |
+- iproc_set_bit(chip, IPROC_GPIO_PAD_RES_OFFSET, gpio, |
12055 |
+- pull_up); |
12056 |
+- iproc_set_bit(chip, IPROC_GPIO_RES_EN_OFFSET, gpio, true); |
12057 |
++ if (disable) { |
12058 |
++ iproc_set_bit(chip, IPROC_GPIO_RES_EN_OFFSET, gpio, |
12059 |
++ false); |
12060 |
++ } else { |
12061 |
++ iproc_set_bit(chip, IPROC_GPIO_PAD_RES_OFFSET, gpio, |
12062 |
++ pull_up); |
12063 |
++ iproc_set_bit(chip, IPROC_GPIO_RES_EN_OFFSET, gpio, |
12064 |
++ true); |
12065 |
++ } |
12066 |
+ } |
12067 |
+ |
12068 |
+ raw_spin_unlock_irqrestore(&chip->lock, flags); |
12069 |
+- |
12070 |
+ dev_dbg(chip->dev, "gpio:%u set pullup:%d\n", gpio, pull_up); |
12071 |
+ |
12072 |
+ return 0; |
12073 |
+@@ -483,14 +518,35 @@ static int iproc_gpio_set_pull(struct iproc_gpio *chip, unsigned gpio, |
12074 |
+ static void iproc_gpio_get_pull(struct iproc_gpio *chip, unsigned gpio, |
12075 |
+ bool *disable, bool *pull_up) |
12076 |
+ { |
12077 |
++ void __iomem *base; |
12078 |
+ unsigned long flags; |
12079 |
++ unsigned int shift; |
12080 |
++ u32 val_1, val_2; |
12081 |
+ |
12082 |
+ raw_spin_lock_irqsave(&chip->lock, flags); |
12083 |
+- *disable = !iproc_get_bit(chip, IPROC_GPIO_RES_EN_OFFSET, gpio); |
12084 |
+- *pull_up = iproc_get_bit(chip, IPROC_GPIO_PAD_RES_OFFSET, gpio); |
12085 |
++ if (chip->io_ctrl_type == IOCTRL_TYPE_CDRU) { |
12086 |
++ base = chip->io_ctrl; |
12087 |
++ shift = IPROC_GPIO_SHIFT(gpio); |
12088 |
++ |
12089 |
++ val_1 = readl(base + IPROC_GPIO_PULL_UP_OFFSET) & BIT(shift); |
12090 |
++ val_2 = readl(base + IPROC_GPIO_PULL_DN_OFFSET) & BIT(shift); |
12091 |
++ |
12092 |
++ *pull_up = val_1 ? true : false; |
12093 |
++ *disable = (val_1 | val_2) ? false : true; |
12094 |
++ |
12095 |
++ } else { |
12096 |
++ *disable = !iproc_get_bit(chip, IPROC_GPIO_RES_EN_OFFSET, gpio); |
12097 |
++ *pull_up = iproc_get_bit(chip, IPROC_GPIO_PAD_RES_OFFSET, gpio); |
12098 |
++ } |
12099 |
+ raw_spin_unlock_irqrestore(&chip->lock, flags); |
12100 |
+ } |
12101 |
+ |
12102 |
++#define DRV_STRENGTH_OFFSET(gpio, bit, type) ((type) == IOCTRL_TYPE_AON ? \ |
12103 |
++ ((2 - (bit)) * 4 + IPROC_GPIO_DRV_CTRL_OFFSET) : \ |
12104 |
++ ((type) == IOCTRL_TYPE_CDRU) ? \ |
12105 |
++ ((bit) * 4 + IPROC_GPIO_DRV_CTRL_OFFSET) : \ |
12106 |
++ ((bit) * 4 + IPROC_GPIO_REG(gpio, IPROC_GPIO_ASIU_DRV0_CTRL_OFFSET))) |
12107 |
++ |
12108 |
+ static int iproc_gpio_set_strength(struct iproc_gpio *chip, unsigned gpio, |
12109 |
+ unsigned strength) |
12110 |
+ { |
12111 |
+@@ -505,11 +561,8 @@ static int iproc_gpio_set_strength(struct iproc_gpio *chip, unsigned gpio, |
12112 |
+ |
12113 |
+ if (chip->io_ctrl) { |
12114 |
+ base = chip->io_ctrl; |
12115 |
+- offset = IPROC_GPIO_DRV0_CTRL_OFFSET; |
12116 |
+ } else { |
12117 |
+ base = chip->base; |
12118 |
+- offset = IPROC_GPIO_REG(gpio, |
12119 |
+- IPROC_GPIO_ASIU_DRV0_CTRL_OFFSET); |
12120 |
+ } |
12121 |
+ |
12122 |
+ shift = IPROC_GPIO_SHIFT(gpio); |
12123 |
+@@ -520,11 +573,11 @@ static int iproc_gpio_set_strength(struct iproc_gpio *chip, unsigned gpio, |
12124 |
+ raw_spin_lock_irqsave(&chip->lock, flags); |
12125 |
+ strength = (strength / 2) - 1; |
12126 |
+ for (i = 0; i < GPIO_DRV_STRENGTH_BITS; i++) { |
12127 |
++ offset = DRV_STRENGTH_OFFSET(gpio, i, chip->io_ctrl_type); |
12128 |
+ val = readl(base + offset); |
12129 |
+ val &= ~BIT(shift); |
12130 |
+ val |= ((strength >> i) & 0x1) << shift; |
12131 |
+ writel(val, base + offset); |
12132 |
+- offset += 4; |
12133 |
+ } |
12134 |
+ raw_spin_unlock_irqrestore(&chip->lock, flags); |
12135 |
+ |
12136 |
+@@ -541,11 +594,8 @@ static int iproc_gpio_get_strength(struct iproc_gpio *chip, unsigned gpio, |
12137 |
+ |
12138 |
+ if (chip->io_ctrl) { |
12139 |
+ base = chip->io_ctrl; |
12140 |
+- offset = IPROC_GPIO_DRV0_CTRL_OFFSET; |
12141 |
+ } else { |
12142 |
+ base = chip->base; |
12143 |
+- offset = IPROC_GPIO_REG(gpio, |
12144 |
+- IPROC_GPIO_ASIU_DRV0_CTRL_OFFSET); |
12145 |
+ } |
12146 |
+ |
12147 |
+ shift = IPROC_GPIO_SHIFT(gpio); |
12148 |
+@@ -553,10 +603,10 @@ static int iproc_gpio_get_strength(struct iproc_gpio *chip, unsigned gpio, |
12149 |
+ raw_spin_lock_irqsave(&chip->lock, flags); |
12150 |
+ *strength = 0; |
12151 |
+ for (i = 0; i < GPIO_DRV_STRENGTH_BITS; i++) { |
12152 |
++ offset = DRV_STRENGTH_OFFSET(gpio, i, chip->io_ctrl_type); |
12153 |
+ val = readl(base + offset) & BIT(shift); |
12154 |
+ val >>= shift; |
12155 |
+ *strength += (val << i); |
12156 |
+- offset += 4; |
12157 |
+ } |
12158 |
+ |
12159 |
+ /* convert to mA */ |
12160 |
+@@ -734,6 +784,7 @@ static int iproc_gpio_probe(struct platform_device *pdev) |
12161 |
+ u32 ngpios, pinconf_disable_mask = 0; |
12162 |
+ int irq, ret; |
12163 |
+ bool no_pinconf = false; |
12164 |
++ enum iproc_pinconf_ctrl_type io_ctrl_type = IOCTRL_TYPE_INVALID; |
12165 |
+ |
12166 |
+ /* NSP does not support drive strength config */ |
12167 |
+ if (of_device_is_compatible(dev->of_node, "brcm,iproc-nsp-gpio")) |
12168 |
+@@ -764,8 +815,15 @@ static int iproc_gpio_probe(struct platform_device *pdev) |
12169 |
+ dev_err(dev, "unable to map I/O memory\n"); |
12170 |
+ return PTR_ERR(chip->io_ctrl); |
12171 |
+ } |
12172 |
++ if (of_device_is_compatible(dev->of_node, |
12173 |
++ "brcm,cygnus-ccm-gpio")) |
12174 |
++ io_ctrl_type = IOCTRL_TYPE_CDRU; |
12175 |
++ else |
12176 |
++ io_ctrl_type = IOCTRL_TYPE_AON; |
12177 |
+ } |
12178 |
+ |
12179 |
++ chip->io_ctrl_type = io_ctrl_type; |
12180 |
++ |
12181 |
+ if (of_property_read_u32(dev->of_node, "ngpios", &ngpios)) { |
12182 |
+ dev_err(&pdev->dev, "missing ngpios DT property\n"); |
12183 |
+ return -ENODEV; |
12184 |
+diff --git a/drivers/pinctrl/meson/pinctrl-meson-gxl.c b/drivers/pinctrl/meson/pinctrl-meson-gxl.c |
12185 |
+index 158f618f1695..0c0a5018102b 100644 |
12186 |
+--- a/drivers/pinctrl/meson/pinctrl-meson-gxl.c |
12187 |
++++ b/drivers/pinctrl/meson/pinctrl-meson-gxl.c |
12188 |
+@@ -239,13 +239,9 @@ static const unsigned int eth_link_led_pins[] = { GPIOZ_14 }; |
12189 |
+ static const unsigned int eth_act_led_pins[] = { GPIOZ_15 }; |
12190 |
+ |
12191 |
+ static const unsigned int tsin_a_d0_pins[] = { GPIODV_0 }; |
12192 |
+-static const unsigned int tsin_a_d0_x_pins[] = { GPIOX_10 }; |
12193 |
+ static const unsigned int tsin_a_clk_pins[] = { GPIODV_8 }; |
12194 |
+-static const unsigned int tsin_a_clk_x_pins[] = { GPIOX_11 }; |
12195 |
+ static const unsigned int tsin_a_sop_pins[] = { GPIODV_9 }; |
12196 |
+-static const unsigned int tsin_a_sop_x_pins[] = { GPIOX_8 }; |
12197 |
+ static const unsigned int tsin_a_d_valid_pins[] = { GPIODV_10 }; |
12198 |
+-static const unsigned int tsin_a_d_valid_x_pins[] = { GPIOX_9 }; |
12199 |
+ static const unsigned int tsin_a_fail_pins[] = { GPIODV_11 }; |
12200 |
+ static const unsigned int tsin_a_dp_pins[] = { |
12201 |
+ GPIODV_1, GPIODV_2, GPIODV_3, GPIODV_4, GPIODV_5, GPIODV_6, GPIODV_7, |
12202 |
+@@ -432,10 +428,6 @@ static struct meson_pmx_group meson_gxl_periphs_groups[] = { |
12203 |
+ GROUP(spi_miso, 5, 2), |
12204 |
+ GROUP(spi_ss0, 5, 1), |
12205 |
+ GROUP(spi_sclk, 5, 0), |
12206 |
+- GROUP(tsin_a_sop_x, 6, 3), |
12207 |
+- GROUP(tsin_a_d_valid_x, 6, 2), |
12208 |
+- GROUP(tsin_a_d0_x, 6, 1), |
12209 |
+- GROUP(tsin_a_clk_x, 6, 0), |
12210 |
+ |
12211 |
+ /* Bank Z */ |
12212 |
+ GROUP(eth_mdio, 4, 23), |
12213 |
+@@ -698,8 +690,8 @@ static const char * const eth_led_groups[] = { |
12214 |
+ }; |
12215 |
+ |
12216 |
+ static const char * const tsin_a_groups[] = { |
12217 |
+- "tsin_a_clk", "tsin_a_clk_x", "tsin_a_sop", "tsin_a_sop_x", |
12218 |
+- "tsin_a_d_valid", "tsin_a_d_valid_x", "tsin_a_d0", "tsin_a_d0_x", |
12219 |
++ "tsin_a_clk", "tsin_a_sop", |
12220 |
++ "tsin_a_d_valid", "tsin_a_d0", |
12221 |
+ "tsin_a_dp", "tsin_a_fail", |
12222 |
+ }; |
12223 |
+ |
12224 |
+diff --git a/drivers/pinctrl/sh-pfc/pfc-emev2.c b/drivers/pinctrl/sh-pfc/pfc-emev2.c |
12225 |
+index 1cbbe04d7df6..eafd8edbcbe9 100644 |
12226 |
+--- a/drivers/pinctrl/sh-pfc/pfc-emev2.c |
12227 |
++++ b/drivers/pinctrl/sh-pfc/pfc-emev2.c |
12228 |
+@@ -1263,6 +1263,14 @@ static const char * const dtv_groups[] = { |
12229 |
+ "dtv_b", |
12230 |
+ }; |
12231 |
+ |
12232 |
++static const char * const err_rst_reqb_groups[] = { |
12233 |
++ "err_rst_reqb", |
12234 |
++}; |
12235 |
++ |
12236 |
++static const char * const ext_clki_groups[] = { |
12237 |
++ "ext_clki", |
12238 |
++}; |
12239 |
++ |
12240 |
+ static const char * const iic0_groups[] = { |
12241 |
+ "iic0", |
12242 |
+ }; |
12243 |
+@@ -1285,6 +1293,10 @@ static const char * const lcd_groups[] = { |
12244 |
+ "yuv3", |
12245 |
+ }; |
12246 |
+ |
12247 |
++static const char * const lowpwr_groups[] = { |
12248 |
++ "lowpwr", |
12249 |
++}; |
12250 |
++ |
12251 |
+ static const char * const ntsc_groups[] = { |
12252 |
+ "ntsc_clk", |
12253 |
+ "ntsc_data", |
12254 |
+@@ -1298,6 +1310,10 @@ static const char * const pwm1_groups[] = { |
12255 |
+ "pwm1", |
12256 |
+ }; |
12257 |
+ |
12258 |
++static const char * const ref_clko_groups[] = { |
12259 |
++ "ref_clko", |
12260 |
++}; |
12261 |
++ |
12262 |
+ static const char * const sd_groups[] = { |
12263 |
+ "sd_cki", |
12264 |
+ }; |
12265 |
+@@ -1391,13 +1407,17 @@ static const struct sh_pfc_function pinmux_functions[] = { |
12266 |
+ SH_PFC_FUNCTION(cam), |
12267 |
+ SH_PFC_FUNCTION(cf), |
12268 |
+ SH_PFC_FUNCTION(dtv), |
12269 |
++ SH_PFC_FUNCTION(err_rst_reqb), |
12270 |
++ SH_PFC_FUNCTION(ext_clki), |
12271 |
+ SH_PFC_FUNCTION(iic0), |
12272 |
+ SH_PFC_FUNCTION(iic1), |
12273 |
+ SH_PFC_FUNCTION(jtag), |
12274 |
+ SH_PFC_FUNCTION(lcd), |
12275 |
++ SH_PFC_FUNCTION(lowpwr), |
12276 |
+ SH_PFC_FUNCTION(ntsc), |
12277 |
+ SH_PFC_FUNCTION(pwm0), |
12278 |
+ SH_PFC_FUNCTION(pwm1), |
12279 |
++ SH_PFC_FUNCTION(ref_clko), |
12280 |
+ SH_PFC_FUNCTION(sd), |
12281 |
+ SH_PFC_FUNCTION(sdi0), |
12282 |
+ SH_PFC_FUNCTION(sdi1), |
12283 |
+diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7740.c b/drivers/pinctrl/sh-pfc/pfc-r8a7740.c |
12284 |
+index 35f436bcb849..e9739dbcb356 100644 |
12285 |
+--- a/drivers/pinctrl/sh-pfc/pfc-r8a7740.c |
12286 |
++++ b/drivers/pinctrl/sh-pfc/pfc-r8a7740.c |
12287 |
+@@ -1982,7 +1982,7 @@ static const unsigned int gether_gmii_pins[] = { |
12288 |
+ */ |
12289 |
+ 185, 186, 187, 188, 189, 190, 191, 192, 174, 161, 204, |
12290 |
+ 171, 170, 169, 168, 167, 166, 173, 172, 176, 184, 183, 203, |
12291 |
+- 205, 163, 206, 207, |
12292 |
++ 205, 163, 206, 207, 158, |
12293 |
+ }; |
12294 |
+ static const unsigned int gether_gmii_mux[] = { |
12295 |
+ ET_ERXD0_MARK, ET_ERXD1_MARK, ET_ERXD2_MARK, ET_ERXD3_MARK, |
12296 |
+@@ -2154,6 +2154,7 @@ static const unsigned int lcd0_data24_1_mux[] = { |
12297 |
+ LCD0_D0_MARK, LCD0_D1_MARK, LCD0_D2_MARK, LCD0_D3_MARK, |
12298 |
+ LCD0_D4_MARK, LCD0_D5_MARK, LCD0_D6_MARK, LCD0_D7_MARK, |
12299 |
+ LCD0_D8_MARK, LCD0_D9_MARK, LCD0_D10_MARK, LCD0_D11_MARK, |
12300 |
++ LCD0_D12_MARK, LCD0_D13_MARK, LCD0_D14_MARK, LCD0_D15_MARK, |
12301 |
+ LCD0_D16_MARK, LCD0_D17_MARK, LCD0_D18_PORT163_MARK, |
12302 |
+ LCD0_D19_PORT162_MARK, LCD0_D20_PORT161_MARK, LCD0_D21_PORT158_MARK, |
12303 |
+ LCD0_D22_PORT160_MARK, LCD0_D23_PORT159_MARK, |
12304 |
+diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c |
12305 |
+index 5811784d88cb..9eb860c8f917 100644 |
12306 |
+--- a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c |
12307 |
++++ b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c |
12308 |
+@@ -3220,8 +3220,7 @@ static const unsigned int qspi_data4_b_pins[] = { |
12309 |
+ RCAR_GP_PIN(6, 4), |
12310 |
+ }; |
12311 |
+ static const unsigned int qspi_data4_b_mux[] = { |
12312 |
+- SPCLK_B_MARK, MOSI_IO0_B_MARK, MISO_IO1_B_MARK, |
12313 |
+- IO2_B_MARK, IO3_B_MARK, SSL_B_MARK, |
12314 |
++ MOSI_IO0_B_MARK, MISO_IO1_B_MARK, IO2_B_MARK, IO3_B_MARK, |
12315 |
+ }; |
12316 |
+ /* - SCIF0 ------------------------------------------------------------------ */ |
12317 |
+ static const unsigned int scif0_data_pins[] = { |
12318 |
+@@ -4375,17 +4374,14 @@ static const unsigned int vin1_b_data18_pins[] = { |
12319 |
+ }; |
12320 |
+ static const unsigned int vin1_b_data18_mux[] = { |
12321 |
+ /* B */ |
12322 |
+- VI1_DATA0_B_MARK, VI1_DATA1_B_MARK, |
12323 |
+ VI1_DATA2_B_MARK, VI1_DATA3_B_MARK, |
12324 |
+ VI1_DATA4_B_MARK, VI1_DATA5_B_MARK, |
12325 |
+ VI1_DATA6_B_MARK, VI1_DATA7_B_MARK, |
12326 |
+ /* G */ |
12327 |
+- VI1_G0_B_MARK, VI1_G1_B_MARK, |
12328 |
+ VI1_G2_B_MARK, VI1_G3_B_MARK, |
12329 |
+ VI1_G4_B_MARK, VI1_G5_B_MARK, |
12330 |
+ VI1_G6_B_MARK, VI1_G7_B_MARK, |
12331 |
+ /* R */ |
12332 |
+- VI1_R0_B_MARK, VI1_R1_B_MARK, |
12333 |
+ VI1_R2_B_MARK, VI1_R3_B_MARK, |
12334 |
+ VI1_R4_B_MARK, VI1_R5_B_MARK, |
12335 |
+ VI1_R6_B_MARK, VI1_R7_B_MARK, |
12336 |
+@@ -5243,7 +5239,7 @@ static const char * const scifb2_groups[] = { |
12337 |
+ "scifb2_data_b", |
12338 |
+ "scifb2_clk_b", |
12339 |
+ "scifb2_ctrl_b", |
12340 |
+- "scifb0_data_c", |
12341 |
++ "scifb2_data_c", |
12342 |
+ "scifb2_clk_c", |
12343 |
+ "scifb2_data_d", |
12344 |
+ }; |
12345 |
+diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7792.c b/drivers/pinctrl/sh-pfc/pfc-r8a7792.c |
12346 |
+index cc3597f66605..46c41ca6ea38 100644 |
12347 |
+--- a/drivers/pinctrl/sh-pfc/pfc-r8a7792.c |
12348 |
++++ b/drivers/pinctrl/sh-pfc/pfc-r8a7792.c |
12349 |
+@@ -1916,6 +1916,7 @@ static const char * const vin1_groups[] = { |
12350 |
+ "vin1_data8", |
12351 |
+ "vin1_data24_b", |
12352 |
+ "vin1_data20_b", |
12353 |
++ "vin1_data18_b", |
12354 |
+ "vin1_data16_b", |
12355 |
+ "vin1_sync", |
12356 |
+ "vin1_field", |
12357 |
+diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7794.c b/drivers/pinctrl/sh-pfc/pfc-r8a7794.c |
12358 |
+index 164002437594..24b9bb1ee1fe 100644 |
12359 |
+--- a/drivers/pinctrl/sh-pfc/pfc-r8a7794.c |
12360 |
++++ b/drivers/pinctrl/sh-pfc/pfc-r8a7794.c |
12361 |
+@@ -5215,7 +5215,7 @@ static const struct pinmux_cfg_reg pinmux_config_regs[] = { |
12362 |
+ FN_AVB_MDC, FN_SSI_SDATA6_B, 0, 0, } |
12363 |
+ }, |
12364 |
+ { PINMUX_CFG_REG_VAR("IPSR9", 0xE6060044, 32, |
12365 |
+- 1, 3, 3, 3, 3, 2, 2, 3, 3, 3, 3, 3, 3) { |
12366 |
++ 1, 3, 3, 3, 3, 2, 2, 3, 3, 3, 3, 3) { |
12367 |
+ /* IP9_31 [1] */ |
12368 |
+ 0, 0, |
12369 |
+ /* IP9_30_28 [3] */ |
12370 |
+diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a77970.c b/drivers/pinctrl/sh-pfc/pfc-r8a77970.c |
12371 |
+index eeb58b3bbc9a..53fae9fd682b 100644 |
12372 |
+--- a/drivers/pinctrl/sh-pfc/pfc-r8a77970.c |
12373 |
++++ b/drivers/pinctrl/sh-pfc/pfc-r8a77970.c |
12374 |
+@@ -2354,7 +2354,7 @@ static const struct pinmux_cfg_reg pinmux_config_regs[] = { |
12375 |
+ #define F_(x, y) x, |
12376 |
+ #define FM(x) FN_##x, |
12377 |
+ { PINMUX_CFG_REG_VAR("MOD_SEL0", 0xe6060500, 32, |
12378 |
+- 4, 4, 4, 4, |
12379 |
++ 4, 4, 4, 4, 4, |
12380 |
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) { |
12381 |
+ /* RESERVED 31, 30, 29, 28 */ |
12382 |
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
12383 |
+diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a77980.c b/drivers/pinctrl/sh-pfc/pfc-r8a77980.c |
12384 |
+index 3f6967331f64..81a710bb8555 100644 |
12385 |
+--- a/drivers/pinctrl/sh-pfc/pfc-r8a77980.c |
12386 |
++++ b/drivers/pinctrl/sh-pfc/pfc-r8a77980.c |
12387 |
+@@ -2751,7 +2751,7 @@ static const struct pinmux_cfg_reg pinmux_config_regs[] = { |
12388 |
+ #define F_(x, y) x, |
12389 |
+ #define FM(x) FN_##x, |
12390 |
+ { PINMUX_CFG_REG_VAR("MOD_SEL0", 0xe6060500, 32, |
12391 |
+- 4, 4, 4, 4, |
12392 |
++ 4, 4, 4, 4, 4, |
12393 |
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) { |
12394 |
+ /* RESERVED 31, 30, 29, 28 */ |
12395 |
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
12396 |
+diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a77995.c b/drivers/pinctrl/sh-pfc/pfc-r8a77995.c |
12397 |
+index adade5b7ffbc..337c80bde8f9 100644 |
12398 |
+--- a/drivers/pinctrl/sh-pfc/pfc-r8a77995.c |
12399 |
++++ b/drivers/pinctrl/sh-pfc/pfc-r8a77995.c |
12400 |
+@@ -391,10 +391,10 @@ FM(IP12_31_28) IP12_31_28 \ |
12401 |
+ #define MOD_SEL0_27 FM(SEL_MSIOF3_0) FM(SEL_MSIOF3_1) |
12402 |
+ #define MOD_SEL0_26 FM(SEL_HSCIF3_0) FM(SEL_HSCIF3_1) |
12403 |
+ #define MOD_SEL0_25 FM(SEL_SCIF4_0) FM(SEL_SCIF4_1) |
12404 |
+-#define MOD_SEL0_24_23 FM(SEL_PWM0_0) FM(SEL_PWM0_1) FM(SEL_PWM0_2) FM(SEL_PWM0_3) |
12405 |
+-#define MOD_SEL0_22_21 FM(SEL_PWM1_0) FM(SEL_PWM1_1) FM(SEL_PWM1_2) FM(SEL_PWM1_3) |
12406 |
+-#define MOD_SEL0_20_19 FM(SEL_PWM2_0) FM(SEL_PWM2_1) FM(SEL_PWM2_2) FM(SEL_PWM2_3) |
12407 |
+-#define MOD_SEL0_18_17 FM(SEL_PWM3_0) FM(SEL_PWM3_1) FM(SEL_PWM3_2) FM(SEL_PWM3_3) |
12408 |
++#define MOD_SEL0_24_23 FM(SEL_PWM0_0) FM(SEL_PWM0_1) FM(SEL_PWM0_2) F_(0, 0) |
12409 |
++#define MOD_SEL0_22_21 FM(SEL_PWM1_0) FM(SEL_PWM1_1) FM(SEL_PWM1_2) F_(0, 0) |
12410 |
++#define MOD_SEL0_20_19 FM(SEL_PWM2_0) FM(SEL_PWM2_1) FM(SEL_PWM2_2) F_(0, 0) |
12411 |
++#define MOD_SEL0_18_17 FM(SEL_PWM3_0) FM(SEL_PWM3_1) FM(SEL_PWM3_2) F_(0, 0) |
12412 |
+ #define MOD_SEL0_15 FM(SEL_IRQ_0_0) FM(SEL_IRQ_0_1) |
12413 |
+ #define MOD_SEL0_14 FM(SEL_IRQ_1_0) FM(SEL_IRQ_1_1) |
12414 |
+ #define MOD_SEL0_13 FM(SEL_IRQ_2_0) FM(SEL_IRQ_2_1) |
12415 |
+diff --git a/drivers/pinctrl/sh-pfc/pfc-sh7269.c b/drivers/pinctrl/sh-pfc/pfc-sh7269.c |
12416 |
+index a50d22bef1f4..cfdb4fc177c3 100644 |
12417 |
+--- a/drivers/pinctrl/sh-pfc/pfc-sh7269.c |
12418 |
++++ b/drivers/pinctrl/sh-pfc/pfc-sh7269.c |
12419 |
+@@ -2119,7 +2119,7 @@ static const struct pinmux_cfg_reg pinmux_config_regs[] = { |
12420 |
+ }, |
12421 |
+ |
12422 |
+ { PINMUX_CFG_REG("PCIOR0", 0xfffe3852, 16, 1) { |
12423 |
+- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
12424 |
++ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
12425 |
+ PC8_IN, PC8_OUT, |
12426 |
+ PC7_IN, PC7_OUT, |
12427 |
+ PC6_IN, PC6_OUT, |
12428 |
+diff --git a/drivers/pinctrl/sh-pfc/pfc-sh73a0.c b/drivers/pinctrl/sh-pfc/pfc-sh73a0.c |
12429 |
+index d25e6f674d0a..6dca760f9f28 100644 |
12430 |
+--- a/drivers/pinctrl/sh-pfc/pfc-sh73a0.c |
12431 |
++++ b/drivers/pinctrl/sh-pfc/pfc-sh73a0.c |
12432 |
+@@ -3086,6 +3086,7 @@ static const unsigned int tpu4_to2_mux[] = { |
12433 |
+ }; |
12434 |
+ static const unsigned int tpu4_to3_pins[] = { |
12435 |
+ /* TO */ |
12436 |
++ PIN_NUMBER(6, 26), |
12437 |
+ }; |
12438 |
+ static const unsigned int tpu4_to3_mux[] = { |
12439 |
+ TPU4TO3_MARK, |
12440 |
+@@ -3366,7 +3367,8 @@ static const char * const fsic_groups[] = { |
12441 |
+ "fsic_sclk_out", |
12442 |
+ "fsic_data_in", |
12443 |
+ "fsic_data_out", |
12444 |
+- "fsic_spdif", |
12445 |
++ "fsic_spdif_0", |
12446 |
++ "fsic_spdif_1", |
12447 |
+ }; |
12448 |
+ |
12449 |
+ static const char * const fsid_groups[] = { |
12450 |
+diff --git a/drivers/pinctrl/sh-pfc/pfc-sh7734.c b/drivers/pinctrl/sh-pfc/pfc-sh7734.c |
12451 |
+index 3eccc9b3ca84..c691e5e9d9de 100644 |
12452 |
+--- a/drivers/pinctrl/sh-pfc/pfc-sh7734.c |
12453 |
++++ b/drivers/pinctrl/sh-pfc/pfc-sh7734.c |
12454 |
+@@ -2231,13 +2231,13 @@ static const struct pinmux_cfg_reg pinmux_config_regs[] = { |
12455 |
+ FN_LCD_CL1_B, 0, 0, |
12456 |
+ /* IP10_5_3 [3] */ |
12457 |
+ FN_SSI_WS23, FN_VI1_5_B, FN_TX1_D, FN_HSCK0_C, FN_FALE_B, |
12458 |
+- FN_LCD_DON_B, 0, 0, 0, |
12459 |
++ FN_LCD_DON_B, 0, 0, |
12460 |
+ /* IP10_2_0 [3] */ |
12461 |
+ FN_SSI_SCK23, FN_VI1_4_B, FN_RX1_D, FN_FCLE_B, |
12462 |
+ FN_LCD_DATA15_B, 0, 0, 0 } |
12463 |
+ }, |
12464 |
+ { PINMUX_CFG_REG_VAR("IPSR11", 0xFFFC0048, 32, |
12465 |
+- 3, 1, 2, 2, 2, 3, 3, 1, 2, 3, 3, 1, 1, 1, 1) { |
12466 |
++ 3, 1, 2, 3, 2, 2, 3, 3, 1, 2, 3, 3, 1, 1, 1, 1) { |
12467 |
+ /* IP11_31_29 [3] */ |
12468 |
+ 0, 0, 0, 0, 0, 0, 0, 0, |
12469 |
+ /* IP11_28 [1] */ |
12470 |
+diff --git a/drivers/platform/mips/cpu_hwmon.c b/drivers/platform/mips/cpu_hwmon.c |
12471 |
+index f66521c7f846..98128374d710 100644 |
12472 |
+--- a/drivers/platform/mips/cpu_hwmon.c |
12473 |
++++ b/drivers/platform/mips/cpu_hwmon.c |
12474 |
+@@ -159,7 +159,7 @@ static int __init loongson_hwmon_init(void) |
12475 |
+ |
12476 |
+ cpu_hwmon_dev = hwmon_device_register(NULL); |
12477 |
+ if (IS_ERR(cpu_hwmon_dev)) { |
12478 |
+- ret = -ENOMEM; |
12479 |
++ ret = PTR_ERR(cpu_hwmon_dev); |
12480 |
+ pr_err("hwmon_device_register fail!\n"); |
12481 |
+ goto fail_hwmon_device_register; |
12482 |
+ } |
12483 |
+diff --git a/drivers/platform/x86/alienware-wmi.c b/drivers/platform/x86/alienware-wmi.c |
12484 |
+index f10af5c383c5..83fd7677af24 100644 |
12485 |
+--- a/drivers/platform/x86/alienware-wmi.c |
12486 |
++++ b/drivers/platform/x86/alienware-wmi.c |
12487 |
+@@ -522,23 +522,22 @@ static acpi_status alienware_wmax_command(struct wmax_basic_args *in_args, |
12488 |
+ |
12489 |
+ input.length = (acpi_size) sizeof(*in_args); |
12490 |
+ input.pointer = in_args; |
12491 |
+- if (out_data != NULL) { |
12492 |
++ if (out_data) { |
12493 |
+ output.length = ACPI_ALLOCATE_BUFFER; |
12494 |
+ output.pointer = NULL; |
12495 |
+ status = wmi_evaluate_method(WMAX_CONTROL_GUID, 0, |
12496 |
+ command, &input, &output); |
12497 |
+- } else |
12498 |
++ if (ACPI_SUCCESS(status)) { |
12499 |
++ obj = (union acpi_object *)output.pointer; |
12500 |
++ if (obj && obj->type == ACPI_TYPE_INTEGER) |
12501 |
++ *out_data = (u32)obj->integer.value; |
12502 |
++ } |
12503 |
++ kfree(output.pointer); |
12504 |
++ } else { |
12505 |
+ status = wmi_evaluate_method(WMAX_CONTROL_GUID, 0, |
12506 |
+ command, &input, NULL); |
12507 |
+- |
12508 |
+- if (ACPI_SUCCESS(status) && out_data != NULL) { |
12509 |
+- obj = (union acpi_object *)output.pointer; |
12510 |
+- if (obj && obj->type == ACPI_TYPE_INTEGER) |
12511 |
+- *out_data = (u32) obj->integer.value; |
12512 |
+ } |
12513 |
+- kfree(output.pointer); |
12514 |
+ return status; |
12515 |
+- |
12516 |
+ } |
12517 |
+ |
12518 |
+ /* |
12519 |
+@@ -588,7 +587,7 @@ static ssize_t show_hdmi_source(struct device *dev, |
12520 |
+ return scnprintf(buf, PAGE_SIZE, |
12521 |
+ "input [gpu] unknown\n"); |
12522 |
+ } |
12523 |
+- pr_err("alienware-wmi: unknown HDMI source status: %d\n", out_data); |
12524 |
++ pr_err("alienware-wmi: unknown HDMI source status: %u\n", status); |
12525 |
+ return scnprintf(buf, PAGE_SIZE, "input gpu [unknown]\n"); |
12526 |
+ } |
12527 |
+ |
12528 |
+diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c |
12529 |
+index 04791ea5d97b..35cdc3998eb5 100644 |
12530 |
+--- a/drivers/platform/x86/wmi.c |
12531 |
++++ b/drivers/platform/x86/wmi.c |
12532 |
+@@ -768,6 +768,9 @@ static int wmi_dev_match(struct device *dev, struct device_driver *driver) |
12533 |
+ struct wmi_block *wblock = dev_to_wblock(dev); |
12534 |
+ const struct wmi_device_id *id = wmi_driver->id_table; |
12535 |
+ |
12536 |
++ if (id == NULL) |
12537 |
++ return 0; |
12538 |
++ |
12539 |
+ while (id->guid_string) { |
12540 |
+ uuid_le driver_guid; |
12541 |
+ |
12542 |
+diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c |
12543 |
+index e85361878450..e43a7b3b570c 100644 |
12544 |
+--- a/drivers/power/supply/power_supply_core.c |
12545 |
++++ b/drivers/power/supply/power_supply_core.c |
12546 |
+@@ -902,14 +902,14 @@ __power_supply_register(struct device *parent, |
12547 |
+ } |
12548 |
+ |
12549 |
+ spin_lock_init(&psy->changed_lock); |
12550 |
+- rc = device_init_wakeup(dev, ws); |
12551 |
+- if (rc) |
12552 |
+- goto wakeup_init_failed; |
12553 |
+- |
12554 |
+ rc = device_add(dev); |
12555 |
+ if (rc) |
12556 |
+ goto device_add_failed; |
12557 |
+ |
12558 |
++ rc = device_init_wakeup(dev, ws); |
12559 |
++ if (rc) |
12560 |
++ goto wakeup_init_failed; |
12561 |
++ |
12562 |
+ rc = psy_register_thermal(psy); |
12563 |
+ if (rc) |
12564 |
+ goto register_thermal_failed; |
12565 |
+@@ -946,8 +946,8 @@ register_cooler_failed: |
12566 |
+ psy_unregister_thermal(psy); |
12567 |
+ register_thermal_failed: |
12568 |
+ device_del(dev); |
12569 |
+-device_add_failed: |
12570 |
+ wakeup_init_failed: |
12571 |
++device_add_failed: |
12572 |
+ check_supplies_failed: |
12573 |
+ dev_set_name_failed: |
12574 |
+ put_device(dev); |
12575 |
+diff --git a/drivers/pwm/pwm-lpss.c b/drivers/pwm/pwm-lpss.c |
12576 |
+index 1e69c1c9ec09..7a4a6406cf69 100644 |
12577 |
+--- a/drivers/pwm/pwm-lpss.c |
12578 |
++++ b/drivers/pwm/pwm-lpss.c |
12579 |
+@@ -216,6 +216,12 @@ EXPORT_SYMBOL_GPL(pwm_lpss_probe); |
12580 |
+ |
12581 |
+ int pwm_lpss_remove(struct pwm_lpss_chip *lpwm) |
12582 |
+ { |
12583 |
++ int i; |
12584 |
++ |
12585 |
++ for (i = 0; i < lpwm->info->npwm; i++) { |
12586 |
++ if (pwm_is_enabled(&lpwm->chip.pwms[i])) |
12587 |
++ pm_runtime_put(lpwm->chip.dev); |
12588 |
++ } |
12589 |
+ return pwmchip_remove(&lpwm->chip); |
12590 |
+ } |
12591 |
+ EXPORT_SYMBOL_GPL(pwm_lpss_remove); |
12592 |
+diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c |
12593 |
+index f6e738ad7bd9..e247ab632530 100644 |
12594 |
+--- a/drivers/pwm/pwm-meson.c |
12595 |
++++ b/drivers/pwm/pwm-meson.c |
12596 |
+@@ -188,7 +188,7 @@ static int meson_pwm_calc(struct meson_pwm *meson, |
12597 |
+ do_div(fin_ps, fin_freq); |
12598 |
+ |
12599 |
+ /* Calc pre_div with the period */ |
12600 |
+- for (pre_div = 0; pre_div < MISC_CLK_DIV_MASK; pre_div++) { |
12601 |
++ for (pre_div = 0; pre_div <= MISC_CLK_DIV_MASK; pre_div++) { |
12602 |
+ cnt = DIV_ROUND_CLOSEST_ULL((u64)period * 1000, |
12603 |
+ fin_ps * (pre_div + 1)); |
12604 |
+ dev_dbg(meson->chip.dev, "fin_ps=%llu pre_div=%u cnt=%u\n", |
12605 |
+@@ -197,7 +197,7 @@ static int meson_pwm_calc(struct meson_pwm *meson, |
12606 |
+ break; |
12607 |
+ } |
12608 |
+ |
12609 |
+- if (pre_div == MISC_CLK_DIV_MASK) { |
12610 |
++ if (pre_div > MISC_CLK_DIV_MASK) { |
12611 |
+ dev_err(meson->chip.dev, "unable to get period pre_div\n"); |
12612 |
+ return -EINVAL; |
12613 |
+ } |
12614 |
+@@ -325,11 +325,6 @@ static int meson_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, |
12615 |
+ if (state->period != channel->state.period || |
12616 |
+ state->duty_cycle != channel->state.duty_cycle || |
12617 |
+ state->polarity != channel->state.polarity) { |
12618 |
+- if (channel->state.enabled) { |
12619 |
+- meson_pwm_disable(meson, pwm->hwpwm); |
12620 |
+- channel->state.enabled = false; |
12621 |
+- } |
12622 |
+- |
12623 |
+ if (state->polarity != channel->state.polarity) { |
12624 |
+ if (state->polarity == PWM_POLARITY_NORMAL) |
12625 |
+ meson->inverter_mask |= BIT(pwm->hwpwm); |
12626 |
+diff --git a/drivers/rapidio/rio_cm.c b/drivers/rapidio/rio_cm.c |
12627 |
+index ef989a15aefc..b29fc258eeba 100644 |
12628 |
+--- a/drivers/rapidio/rio_cm.c |
12629 |
++++ b/drivers/rapidio/rio_cm.c |
12630 |
+@@ -1215,7 +1215,9 @@ static int riocm_ch_listen(u16 ch_id) |
12631 |
+ riocm_debug(CHOP, "(ch_%d)", ch_id); |
12632 |
+ |
12633 |
+ ch = riocm_get_channel(ch_id); |
12634 |
+- if (!ch || !riocm_cmp_exch(ch, RIO_CM_CHAN_BOUND, RIO_CM_LISTEN)) |
12635 |
++ if (!ch) |
12636 |
++ return -EINVAL; |
12637 |
++ if (!riocm_cmp_exch(ch, RIO_CM_CHAN_BOUND, RIO_CM_LISTEN)) |
12638 |
+ ret = -EINVAL; |
12639 |
+ riocm_put_channel(ch); |
12640 |
+ return ret; |
12641 |
+diff --git a/drivers/regulator/lp87565-regulator.c b/drivers/regulator/lp87565-regulator.c |
12642 |
+index c192357d1dea..7cd6862406b7 100644 |
12643 |
+--- a/drivers/regulator/lp87565-regulator.c |
12644 |
++++ b/drivers/regulator/lp87565-regulator.c |
12645 |
+@@ -193,7 +193,7 @@ static int lp87565_regulator_probe(struct platform_device *pdev) |
12646 |
+ struct lp87565 *lp87565 = dev_get_drvdata(pdev->dev.parent); |
12647 |
+ struct regulator_config config = { }; |
12648 |
+ struct regulator_dev *rdev; |
12649 |
+- int i, min_idx = LP87565_BUCK_1, max_idx = LP87565_BUCK_3; |
12650 |
++ int i, min_idx = LP87565_BUCK_0, max_idx = LP87565_BUCK_3; |
12651 |
+ |
12652 |
+ platform_set_drvdata(pdev, lp87565); |
12653 |
+ |
12654 |
+diff --git a/drivers/regulator/pv88060-regulator.c b/drivers/regulator/pv88060-regulator.c |
12655 |
+index a9446056435f..1f2d8180506b 100644 |
12656 |
+--- a/drivers/regulator/pv88060-regulator.c |
12657 |
++++ b/drivers/regulator/pv88060-regulator.c |
12658 |
+@@ -135,7 +135,7 @@ static int pv88060_set_current_limit(struct regulator_dev *rdev, int min, |
12659 |
+ int i; |
12660 |
+ |
12661 |
+ /* search for closest to maximum */ |
12662 |
+- for (i = info->n_current_limits; i >= 0; i--) { |
12663 |
++ for (i = info->n_current_limits - 1; i >= 0; i--) { |
12664 |
+ if (min <= info->current_limits[i] |
12665 |
+ && max >= info->current_limits[i]) { |
12666 |
+ return regmap_update_bits(rdev->regmap, |
12667 |
+diff --git a/drivers/regulator/pv88080-regulator.c b/drivers/regulator/pv88080-regulator.c |
12668 |
+index 9a08cb2de501..6770e4de2097 100644 |
12669 |
+--- a/drivers/regulator/pv88080-regulator.c |
12670 |
++++ b/drivers/regulator/pv88080-regulator.c |
12671 |
+@@ -279,7 +279,7 @@ static int pv88080_set_current_limit(struct regulator_dev *rdev, int min, |
12672 |
+ int i; |
12673 |
+ |
12674 |
+ /* search for closest to maximum */ |
12675 |
+- for (i = info->n_current_limits; i >= 0; i--) { |
12676 |
++ for (i = info->n_current_limits - 1; i >= 0; i--) { |
12677 |
+ if (min <= info->current_limits[i] |
12678 |
+ && max >= info->current_limits[i]) { |
12679 |
+ return regmap_update_bits(rdev->regmap, |
12680 |
+diff --git a/drivers/regulator/pv88090-regulator.c b/drivers/regulator/pv88090-regulator.c |
12681 |
+index 7a0c15957bd0..2302b0df7630 100644 |
12682 |
+--- a/drivers/regulator/pv88090-regulator.c |
12683 |
++++ b/drivers/regulator/pv88090-regulator.c |
12684 |
+@@ -157,7 +157,7 @@ static int pv88090_set_current_limit(struct regulator_dev *rdev, int min, |
12685 |
+ int i; |
12686 |
+ |
12687 |
+ /* search for closest to maximum */ |
12688 |
+- for (i = info->n_current_limits; i >= 0; i--) { |
12689 |
++ for (i = info->n_current_limits - 1; i >= 0; i--) { |
12690 |
+ if (min <= info->current_limits[i] |
12691 |
+ && max >= info->current_limits[i]) { |
12692 |
+ return regmap_update_bits(rdev->regmap, |
12693 |
+diff --git a/drivers/regulator/tps65086-regulator.c b/drivers/regulator/tps65086-regulator.c |
12694 |
+index 45e96e154690..5a5e9b5bf4be 100644 |
12695 |
+--- a/drivers/regulator/tps65086-regulator.c |
12696 |
++++ b/drivers/regulator/tps65086-regulator.c |
12697 |
+@@ -90,8 +90,8 @@ static const struct regulator_linear_range tps65086_buck345_25mv_ranges[] = { |
12698 |
+ static const struct regulator_linear_range tps65086_ldoa1_ranges[] = { |
12699 |
+ REGULATOR_LINEAR_RANGE(1350000, 0x0, 0x0, 0), |
12700 |
+ REGULATOR_LINEAR_RANGE(1500000, 0x1, 0x7, 100000), |
12701 |
+- REGULATOR_LINEAR_RANGE(2300000, 0x8, 0xA, 100000), |
12702 |
+- REGULATOR_LINEAR_RANGE(2700000, 0xB, 0xD, 150000), |
12703 |
++ REGULATOR_LINEAR_RANGE(2300000, 0x8, 0xB, 100000), |
12704 |
++ REGULATOR_LINEAR_RANGE(2850000, 0xC, 0xD, 150000), |
12705 |
+ REGULATOR_LINEAR_RANGE(3300000, 0xE, 0xE, 0), |
12706 |
+ }; |
12707 |
+ |
12708 |
+diff --git a/drivers/regulator/wm831x-dcdc.c b/drivers/regulator/wm831x-dcdc.c |
12709 |
+index 5a5bc4bb08d2..df591435d12a 100644 |
12710 |
+--- a/drivers/regulator/wm831x-dcdc.c |
12711 |
++++ b/drivers/regulator/wm831x-dcdc.c |
12712 |
+@@ -327,8 +327,8 @@ static int wm831x_buckv_get_voltage_sel(struct regulator_dev *rdev) |
12713 |
+ } |
12714 |
+ |
12715 |
+ /* Current limit options */ |
12716 |
+-static u16 wm831x_dcdc_ilim[] = { |
12717 |
+- 125, 250, 375, 500, 625, 750, 875, 1000 |
12718 |
++static const unsigned int wm831x_dcdc_ilim[] = { |
12719 |
++ 125000, 250000, 375000, 500000, 625000, 750000, 875000, 1000000 |
12720 |
+ }; |
12721 |
+ |
12722 |
+ static int wm831x_buckv_set_current_limit(struct regulator_dev *rdev, |
12723 |
+diff --git a/drivers/remoteproc/qcom_q6v5_pil.c b/drivers/remoteproc/qcom_q6v5_pil.c |
12724 |
+index 6a84b6372897..cc475dcbf27f 100644 |
12725 |
+--- a/drivers/remoteproc/qcom_q6v5_pil.c |
12726 |
++++ b/drivers/remoteproc/qcom_q6v5_pil.c |
12727 |
+@@ -1268,16 +1268,26 @@ static const struct rproc_hexagon_res sdm845_mss = { |
12728 |
+ |
12729 |
+ static const struct rproc_hexagon_res msm8996_mss = { |
12730 |
+ .hexagon_mba_image = "mba.mbn", |
12731 |
++ .proxy_supply = (struct qcom_mss_reg_res[]) { |
12732 |
++ { |
12733 |
++ .supply = "pll", |
12734 |
++ .uA = 100000, |
12735 |
++ }, |
12736 |
++ {} |
12737 |
++ }, |
12738 |
+ .proxy_clk_names = (char*[]){ |
12739 |
+ "xo", |
12740 |
+ "pnoc", |
12741 |
++ "qdss", |
12742 |
+ NULL |
12743 |
+ }, |
12744 |
+ .active_clk_names = (char*[]){ |
12745 |
+ "iface", |
12746 |
+ "bus", |
12747 |
+ "mem", |
12748 |
+- "gpll0_mss_clk", |
12749 |
++ "gpll0_mss", |
12750 |
++ "snoc_axi", |
12751 |
++ "mnoc_axi", |
12752 |
+ NULL |
12753 |
+ }, |
12754 |
+ .need_mem_protection = true, |
12755 |
+diff --git a/drivers/rtc/rtc-88pm80x.c b/drivers/rtc/rtc-88pm80x.c |
12756 |
+index cab293cb2bf0..1fc48ebd3cd0 100644 |
12757 |
+--- a/drivers/rtc/rtc-88pm80x.c |
12758 |
++++ b/drivers/rtc/rtc-88pm80x.c |
12759 |
+@@ -114,12 +114,14 @@ static int pm80x_rtc_read_time(struct device *dev, struct rtc_time *tm) |
12760 |
+ unsigned char buf[4]; |
12761 |
+ unsigned long ticks, base, data; |
12762 |
+ regmap_raw_read(info->map, PM800_RTC_EXPIRE2_1, buf, 4); |
12763 |
+- base = (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0]; |
12764 |
++ base = ((unsigned long)buf[3] << 24) | (buf[2] << 16) | |
12765 |
++ (buf[1] << 8) | buf[0]; |
12766 |
+ dev_dbg(info->dev, "%x-%x-%x-%x\n", buf[0], buf[1], buf[2], buf[3]); |
12767 |
+ |
12768 |
+ /* load 32-bit read-only counter */ |
12769 |
+ regmap_raw_read(info->map, PM800_RTC_COUNTER1, buf, 4); |
12770 |
+- data = (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0]; |
12771 |
++ data = ((unsigned long)buf[3] << 24) | (buf[2] << 16) | |
12772 |
++ (buf[1] << 8) | buf[0]; |
12773 |
+ ticks = base + data; |
12774 |
+ dev_dbg(info->dev, "get base:0x%lx, RO count:0x%lx, ticks:0x%lx\n", |
12775 |
+ base, data, ticks); |
12776 |
+@@ -137,7 +139,8 @@ static int pm80x_rtc_set_time(struct device *dev, struct rtc_time *tm) |
12777 |
+ |
12778 |
+ /* load 32-bit read-only counter */ |
12779 |
+ regmap_raw_read(info->map, PM800_RTC_COUNTER1, buf, 4); |
12780 |
+- data = (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0]; |
12781 |
++ data = ((unsigned long)buf[3] << 24) | (buf[2] << 16) | |
12782 |
++ (buf[1] << 8) | buf[0]; |
12783 |
+ base = ticks - data; |
12784 |
+ dev_dbg(info->dev, "set base:0x%lx, RO count:0x%lx, ticks:0x%lx\n", |
12785 |
+ base, data, ticks); |
12786 |
+@@ -158,11 +161,13 @@ static int pm80x_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) |
12787 |
+ int ret; |
12788 |
+ |
12789 |
+ regmap_raw_read(info->map, PM800_RTC_EXPIRE2_1, buf, 4); |
12790 |
+- base = (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0]; |
12791 |
++ base = ((unsigned long)buf[3] << 24) | (buf[2] << 16) | |
12792 |
++ (buf[1] << 8) | buf[0]; |
12793 |
+ dev_dbg(info->dev, "%x-%x-%x-%x\n", buf[0], buf[1], buf[2], buf[3]); |
12794 |
+ |
12795 |
+ regmap_raw_read(info->map, PM800_RTC_EXPIRE1_1, buf, 4); |
12796 |
+- data = (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0]; |
12797 |
++ data = ((unsigned long)buf[3] << 24) | (buf[2] << 16) | |
12798 |
++ (buf[1] << 8) | buf[0]; |
12799 |
+ ticks = base + data; |
12800 |
+ dev_dbg(info->dev, "get base:0x%lx, RO count:0x%lx, ticks:0x%lx\n", |
12801 |
+ base, data, ticks); |
12802 |
+@@ -185,12 +190,14 @@ static int pm80x_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) |
12803 |
+ regmap_update_bits(info->map, PM800_RTC_CONTROL, PM800_ALARM1_EN, 0); |
12804 |
+ |
12805 |
+ regmap_raw_read(info->map, PM800_RTC_EXPIRE2_1, buf, 4); |
12806 |
+- base = (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0]; |
12807 |
++ base = ((unsigned long)buf[3] << 24) | (buf[2] << 16) | |
12808 |
++ (buf[1] << 8) | buf[0]; |
12809 |
+ dev_dbg(info->dev, "%x-%x-%x-%x\n", buf[0], buf[1], buf[2], buf[3]); |
12810 |
+ |
12811 |
+ /* load 32-bit read-only counter */ |
12812 |
+ regmap_raw_read(info->map, PM800_RTC_COUNTER1, buf, 4); |
12813 |
+- data = (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0]; |
12814 |
++ data = ((unsigned long)buf[3] << 24) | (buf[2] << 16) | |
12815 |
++ (buf[1] << 8) | buf[0]; |
12816 |
+ ticks = base + data; |
12817 |
+ dev_dbg(info->dev, "get base:0x%lx, RO count:0x%lx, ticks:0x%lx\n", |
12818 |
+ base, data, ticks); |
12819 |
+diff --git a/drivers/rtc/rtc-88pm860x.c b/drivers/rtc/rtc-88pm860x.c |
12820 |
+index fbcf13bbbd8d..73697e4b18a9 100644 |
12821 |
+--- a/drivers/rtc/rtc-88pm860x.c |
12822 |
++++ b/drivers/rtc/rtc-88pm860x.c |
12823 |
+@@ -115,11 +115,13 @@ static int pm860x_rtc_read_time(struct device *dev, struct rtc_time *tm) |
12824 |
+ pm860x_page_bulk_read(info->i2c, REG0_ADDR, 8, buf); |
12825 |
+ dev_dbg(info->dev, "%x-%x-%x-%x-%x-%x-%x-%x\n", buf[0], buf[1], |
12826 |
+ buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]); |
12827 |
+- base = (buf[1] << 24) | (buf[3] << 16) | (buf[5] << 8) | buf[7]; |
12828 |
++ base = ((unsigned long)buf[1] << 24) | (buf[3] << 16) | |
12829 |
++ (buf[5] << 8) | buf[7]; |
12830 |
+ |
12831 |
+ /* load 32-bit read-only counter */ |
12832 |
+ pm860x_bulk_read(info->i2c, PM8607_RTC_COUNTER1, 4, buf); |
12833 |
+- data = (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0]; |
12834 |
++ data = ((unsigned long)buf[3] << 24) | (buf[2] << 16) | |
12835 |
++ (buf[1] << 8) | buf[0]; |
12836 |
+ ticks = base + data; |
12837 |
+ dev_dbg(info->dev, "get base:0x%lx, RO count:0x%lx, ticks:0x%lx\n", |
12838 |
+ base, data, ticks); |
12839 |
+@@ -145,7 +147,8 @@ static int pm860x_rtc_set_time(struct device *dev, struct rtc_time *tm) |
12840 |
+ |
12841 |
+ /* load 32-bit read-only counter */ |
12842 |
+ pm860x_bulk_read(info->i2c, PM8607_RTC_COUNTER1, 4, buf); |
12843 |
+- data = (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0]; |
12844 |
++ data = ((unsigned long)buf[3] << 24) | (buf[2] << 16) | |
12845 |
++ (buf[1] << 8) | buf[0]; |
12846 |
+ base = ticks - data; |
12847 |
+ dev_dbg(info->dev, "set base:0x%lx, RO count:0x%lx, ticks:0x%lx\n", |
12848 |
+ base, data, ticks); |
12849 |
+@@ -170,10 +173,12 @@ static int pm860x_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) |
12850 |
+ pm860x_page_bulk_read(info->i2c, REG0_ADDR, 8, buf); |
12851 |
+ dev_dbg(info->dev, "%x-%x-%x-%x-%x-%x-%x-%x\n", buf[0], buf[1], |
12852 |
+ buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]); |
12853 |
+- base = (buf[1] << 24) | (buf[3] << 16) | (buf[5] << 8) | buf[7]; |
12854 |
++ base = ((unsigned long)buf[1] << 24) | (buf[3] << 16) | |
12855 |
++ (buf[5] << 8) | buf[7]; |
12856 |
+ |
12857 |
+ pm860x_bulk_read(info->i2c, PM8607_RTC_EXPIRE1, 4, buf); |
12858 |
+- data = (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0]; |
12859 |
++ data = ((unsigned long)buf[3] << 24) | (buf[2] << 16) | |
12860 |
++ (buf[1] << 8) | buf[0]; |
12861 |
+ ticks = base + data; |
12862 |
+ dev_dbg(info->dev, "get base:0x%lx, RO count:0x%lx, ticks:0x%lx\n", |
12863 |
+ base, data, ticks); |
12864 |
+@@ -198,11 +203,13 @@ static int pm860x_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) |
12865 |
+ pm860x_page_bulk_read(info->i2c, REG0_ADDR, 8, buf); |
12866 |
+ dev_dbg(info->dev, "%x-%x-%x-%x-%x-%x-%x-%x\n", buf[0], buf[1], |
12867 |
+ buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]); |
12868 |
+- base = (buf[1] << 24) | (buf[3] << 16) | (buf[5] << 8) | buf[7]; |
12869 |
++ base = ((unsigned long)buf[1] << 24) | (buf[3] << 16) | |
12870 |
++ (buf[5] << 8) | buf[7]; |
12871 |
+ |
12872 |
+ /* load 32-bit read-only counter */ |
12873 |
+ pm860x_bulk_read(info->i2c, PM8607_RTC_COUNTER1, 4, buf); |
12874 |
+- data = (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0]; |
12875 |
++ data = ((unsigned long)buf[3] << 24) | (buf[2] << 16) | |
12876 |
++ (buf[1] << 8) | buf[0]; |
12877 |
+ ticks = base + data; |
12878 |
+ dev_dbg(info->dev, "get base:0x%lx, RO count:0x%lx, ticks:0x%lx\n", |
12879 |
+ base, data, ticks); |
12880 |
+diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c |
12881 |
+index 71396b62dc52..ebd59e86a567 100644 |
12882 |
+--- a/drivers/rtc/rtc-ds1307.c |
12883 |
++++ b/drivers/rtc/rtc-ds1307.c |
12884 |
+@@ -749,8 +749,8 @@ static int rx8130_set_alarm(struct device *dev, struct rtc_wkalrm *t) |
12885 |
+ if (ret < 0) |
12886 |
+ return ret; |
12887 |
+ |
12888 |
+- ctl[0] &= ~RX8130_REG_EXTENSION_WADA; |
12889 |
+- ctl[1] |= RX8130_REG_FLAG_AF; |
12890 |
++ ctl[0] &= RX8130_REG_EXTENSION_WADA; |
12891 |
++ ctl[1] &= ~RX8130_REG_FLAG_AF; |
12892 |
+ ctl[2] &= ~RX8130_REG_CONTROL0_AIE; |
12893 |
+ |
12894 |
+ ret = regmap_bulk_write(ds1307->regmap, RX8130_REG_EXTENSION, ctl, |
12895 |
+@@ -773,8 +773,7 @@ static int rx8130_set_alarm(struct device *dev, struct rtc_wkalrm *t) |
12896 |
+ |
12897 |
+ ctl[2] |= RX8130_REG_CONTROL0_AIE; |
12898 |
+ |
12899 |
+- return regmap_bulk_write(ds1307->regmap, RX8130_REG_EXTENSION, ctl, |
12900 |
+- sizeof(ctl)); |
12901 |
++ return regmap_write(ds1307->regmap, RX8130_REG_CONTROL0, ctl[2]); |
12902 |
+ } |
12903 |
+ |
12904 |
+ static int rx8130_alarm_irq_enable(struct device *dev, unsigned int enabled) |
12905 |
+diff --git a/drivers/rtc/rtc-ds1672.c b/drivers/rtc/rtc-ds1672.c |
12906 |
+index 9caaccccaa57..b1ebca099b0d 100644 |
12907 |
+--- a/drivers/rtc/rtc-ds1672.c |
12908 |
++++ b/drivers/rtc/rtc-ds1672.c |
12909 |
+@@ -58,7 +58,8 @@ static int ds1672_get_datetime(struct i2c_client *client, struct rtc_time *tm) |
12910 |
+ "%s: raw read data - counters=%02x,%02x,%02x,%02x\n", |
12911 |
+ __func__, buf[0], buf[1], buf[2], buf[3]); |
12912 |
+ |
12913 |
+- time = (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0]; |
12914 |
++ time = ((unsigned long)buf[3] << 24) | (buf[2] << 16) | |
12915 |
++ (buf[1] << 8) | buf[0]; |
12916 |
+ |
12917 |
+ rtc_time_to_tm(time, tm); |
12918 |
+ |
12919 |
+diff --git a/drivers/rtc/rtc-mc146818-lib.c b/drivers/rtc/rtc-mc146818-lib.c |
12920 |
+index 2f1772a358ca..18a6f15e313d 100644 |
12921 |
+--- a/drivers/rtc/rtc-mc146818-lib.c |
12922 |
++++ b/drivers/rtc/rtc-mc146818-lib.c |
12923 |
+@@ -82,7 +82,7 @@ unsigned int mc146818_get_time(struct rtc_time *time) |
12924 |
+ time->tm_year += real_year - 72; |
12925 |
+ #endif |
12926 |
+ |
12927 |
+- if (century) |
12928 |
++ if (century > 20) |
12929 |
+ time->tm_year += (century - 19) * 100; |
12930 |
+ |
12931 |
+ /* |
12932 |
+diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c |
12933 |
+index f85f1fc29e32..964ed91416e1 100644 |
12934 |
+--- a/drivers/rtc/rtc-mt6397.c |
12935 |
++++ b/drivers/rtc/rtc-mt6397.c |
12936 |
+@@ -362,7 +362,7 @@ static int mtk_rtc_probe(struct platform_device *pdev) |
12937 |
+ if (ret) { |
12938 |
+ dev_err(&pdev->dev, "Failed to request alarm IRQ: %d: %d\n", |
12939 |
+ rtc->irq, ret); |
12940 |
+- goto out_dispose_irq; |
12941 |
++ return ret; |
12942 |
+ } |
12943 |
+ |
12944 |
+ device_init_wakeup(&pdev->dev, 1); |
12945 |
+@@ -378,9 +378,7 @@ static int mtk_rtc_probe(struct platform_device *pdev) |
12946 |
+ return 0; |
12947 |
+ |
12948 |
+ out_free_irq: |
12949 |
+- free_irq(rtc->irq, rtc->rtc_dev); |
12950 |
+-out_dispose_irq: |
12951 |
+- irq_dispose_mapping(rtc->irq); |
12952 |
++ free_irq(rtc->irq, rtc); |
12953 |
+ return ret; |
12954 |
+ } |
12955 |
+ |
12956 |
+@@ -388,8 +386,7 @@ static int mtk_rtc_remove(struct platform_device *pdev) |
12957 |
+ { |
12958 |
+ struct mt6397_rtc *rtc = platform_get_drvdata(pdev); |
12959 |
+ |
12960 |
+- free_irq(rtc->irq, rtc->rtc_dev); |
12961 |
+- irq_dispose_mapping(rtc->irq); |
12962 |
++ free_irq(rtc->irq, rtc); |
12963 |
+ |
12964 |
+ return 0; |
12965 |
+ } |
12966 |
+diff --git a/drivers/rtc/rtc-pcf2127.c b/drivers/rtc/rtc-pcf2127.c |
12967 |
+index 7cb786d76e3c..8c62406f92dd 100644 |
12968 |
+--- a/drivers/rtc/rtc-pcf2127.c |
12969 |
++++ b/drivers/rtc/rtc-pcf2127.c |
12970 |
+@@ -57,20 +57,14 @@ static int pcf2127_rtc_read_time(struct device *dev, struct rtc_time *tm) |
12971 |
+ struct pcf2127 *pcf2127 = dev_get_drvdata(dev); |
12972 |
+ unsigned char buf[10]; |
12973 |
+ int ret; |
12974 |
+- int i; |
12975 |
+ |
12976 |
+- for (i = 0; i <= PCF2127_REG_CTRL3; i++) { |
12977 |
+- ret = regmap_read(pcf2127->regmap, PCF2127_REG_CTRL1 + i, |
12978 |
+- (unsigned int *)(buf + i)); |
12979 |
+- if (ret) { |
12980 |
+- dev_err(dev, "%s: read error\n", __func__); |
12981 |
+- return ret; |
12982 |
+- } |
12983 |
+- } |
12984 |
+- |
12985 |
+- ret = regmap_bulk_read(pcf2127->regmap, PCF2127_REG_SC, |
12986 |
+- (buf + PCF2127_REG_SC), |
12987 |
+- ARRAY_SIZE(buf) - PCF2127_REG_SC); |
12988 |
++ /* |
12989 |
++ * Avoid reading CTRL2 register as it causes WD_VAL register |
12990 |
++ * value to reset to 0 which means watchdog is stopped. |
12991 |
++ */ |
12992 |
++ ret = regmap_bulk_read(pcf2127->regmap, PCF2127_REG_CTRL3, |
12993 |
++ (buf + PCF2127_REG_CTRL3), |
12994 |
++ ARRAY_SIZE(buf) - PCF2127_REG_CTRL3); |
12995 |
+ if (ret) { |
12996 |
+ dev_err(dev, "%s: read error\n", __func__); |
12997 |
+ return ret; |
12998 |
+@@ -91,14 +85,12 @@ static int pcf2127_rtc_read_time(struct device *dev, struct rtc_time *tm) |
12999 |
+ } |
13000 |
+ |
13001 |
+ dev_dbg(dev, |
13002 |
+- "%s: raw data is cr1=%02x, cr2=%02x, cr3=%02x, " |
13003 |
+- "sec=%02x, min=%02x, hr=%02x, " |
13004 |
++ "%s: raw data is cr3=%02x, sec=%02x, min=%02x, hr=%02x, " |
13005 |
+ "mday=%02x, wday=%02x, mon=%02x, year=%02x\n", |
13006 |
+- __func__, |
13007 |
+- buf[0], buf[1], buf[2], |
13008 |
+- buf[3], buf[4], buf[5], |
13009 |
+- buf[6], buf[7], buf[8], buf[9]); |
13010 |
+- |
13011 |
++ __func__, buf[PCF2127_REG_CTRL3], buf[PCF2127_REG_SC], |
13012 |
++ buf[PCF2127_REG_MN], buf[PCF2127_REG_HR], |
13013 |
++ buf[PCF2127_REG_DM], buf[PCF2127_REG_DW], |
13014 |
++ buf[PCF2127_REG_MO], buf[PCF2127_REG_YR]); |
13015 |
+ |
13016 |
+ tm->tm_sec = bcd2bin(buf[PCF2127_REG_SC] & 0x7F); |
13017 |
+ tm->tm_min = bcd2bin(buf[PCF2127_REG_MN] & 0x7F); |
13018 |
+diff --git a/drivers/rtc/rtc-pcf8563.c b/drivers/rtc/rtc-pcf8563.c |
13019 |
+index 3efc86c25d27..d8adf69b6697 100644 |
13020 |
+--- a/drivers/rtc/rtc-pcf8563.c |
13021 |
++++ b/drivers/rtc/rtc-pcf8563.c |
13022 |
+@@ -563,7 +563,6 @@ static int pcf8563_probe(struct i2c_client *client, |
13023 |
+ struct pcf8563 *pcf8563; |
13024 |
+ int err; |
13025 |
+ unsigned char buf; |
13026 |
+- unsigned char alm_pending; |
13027 |
+ |
13028 |
+ dev_dbg(&client->dev, "%s\n", __func__); |
13029 |
+ |
13030 |
+@@ -587,13 +586,13 @@ static int pcf8563_probe(struct i2c_client *client, |
13031 |
+ return err; |
13032 |
+ } |
13033 |
+ |
13034 |
+- err = pcf8563_get_alarm_mode(client, NULL, &alm_pending); |
13035 |
+- if (err) { |
13036 |
+- dev_err(&client->dev, "%s: read error\n", __func__); |
13037 |
++ /* Clear flags and disable interrupts */ |
13038 |
++ buf = 0; |
13039 |
++ err = pcf8563_write_block_data(client, PCF8563_REG_ST2, 1, &buf); |
13040 |
++ if (err < 0) { |
13041 |
++ dev_err(&client->dev, "%s: write error\n", __func__); |
13042 |
+ return err; |
13043 |
+ } |
13044 |
+- if (alm_pending) |
13045 |
+- pcf8563_set_alarm_mode(client, 0); |
13046 |
+ |
13047 |
+ pcf8563->rtc = devm_rtc_device_register(&client->dev, |
13048 |
+ pcf8563_driver.driver.name, |
13049 |
+@@ -605,7 +604,7 @@ static int pcf8563_probe(struct i2c_client *client, |
13050 |
+ if (client->irq > 0) { |
13051 |
+ err = devm_request_threaded_irq(&client->dev, client->irq, |
13052 |
+ NULL, pcf8563_irq, |
13053 |
+- IRQF_SHARED|IRQF_ONESHOT|IRQF_TRIGGER_FALLING, |
13054 |
++ IRQF_SHARED | IRQF_ONESHOT | IRQF_TRIGGER_LOW, |
13055 |
+ pcf8563_driver.driver.name, client); |
13056 |
+ if (err) { |
13057 |
+ dev_err(&client->dev, "unable to request IRQ %d\n", |
13058 |
+diff --git a/drivers/rtc/rtc-pm8xxx.c b/drivers/rtc/rtc-pm8xxx.c |
13059 |
+index 29358a045925..e03104b734fc 100644 |
13060 |
+--- a/drivers/rtc/rtc-pm8xxx.c |
13061 |
++++ b/drivers/rtc/rtc-pm8xxx.c |
13062 |
+@@ -213,7 +213,8 @@ static int pm8xxx_rtc_read_time(struct device *dev, struct rtc_time *tm) |
13063 |
+ } |
13064 |
+ } |
13065 |
+ |
13066 |
+- secs = value[0] | (value[1] << 8) | (value[2] << 16) | (value[3] << 24); |
13067 |
++ secs = value[0] | (value[1] << 8) | (value[2] << 16) | |
13068 |
++ ((unsigned long)value[3] << 24); |
13069 |
+ |
13070 |
+ rtc_time_to_tm(secs, tm); |
13071 |
+ |
13072 |
+@@ -288,7 +289,8 @@ static int pm8xxx_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alarm) |
13073 |
+ return rc; |
13074 |
+ } |
13075 |
+ |
13076 |
+- secs = value[0] | (value[1] << 8) | (value[2] << 16) | (value[3] << 24); |
13077 |
++ secs = value[0] | (value[1] << 8) | (value[2] << 16) | |
13078 |
++ ((unsigned long)value[3] << 24); |
13079 |
+ |
13080 |
+ rtc_time_to_tm(secs, &alarm->time); |
13081 |
+ |
13082 |
+diff --git a/drivers/rtc/rtc-rv3029c2.c b/drivers/rtc/rtc-rv3029c2.c |
13083 |
+index 3d6174eb32f6..cfe3aece51d1 100644 |
13084 |
+--- a/drivers/rtc/rtc-rv3029c2.c |
13085 |
++++ b/drivers/rtc/rtc-rv3029c2.c |
13086 |
+@@ -282,13 +282,13 @@ static int rv3029_eeprom_read(struct device *dev, u8 reg, |
13087 |
+ static int rv3029_eeprom_write(struct device *dev, u8 reg, |
13088 |
+ u8 const buf[], size_t len) |
13089 |
+ { |
13090 |
+- int ret; |
13091 |
++ int ret, err; |
13092 |
+ size_t i; |
13093 |
+ u8 tmp; |
13094 |
+ |
13095 |
+- ret = rv3029_eeprom_enter(dev); |
13096 |
+- if (ret < 0) |
13097 |
+- return ret; |
13098 |
++ err = rv3029_eeprom_enter(dev); |
13099 |
++ if (err < 0) |
13100 |
++ return err; |
13101 |
+ |
13102 |
+ for (i = 0; i < len; i++, reg++) { |
13103 |
+ ret = rv3029_read_regs(dev, reg, &tmp, 1); |
13104 |
+@@ -304,11 +304,11 @@ static int rv3029_eeprom_write(struct device *dev, u8 reg, |
13105 |
+ break; |
13106 |
+ } |
13107 |
+ |
13108 |
+- ret = rv3029_eeprom_exit(dev); |
13109 |
+- if (ret < 0) |
13110 |
+- return ret; |
13111 |
++ err = rv3029_eeprom_exit(dev); |
13112 |
++ if (err < 0) |
13113 |
++ return err; |
13114 |
+ |
13115 |
+- return 0; |
13116 |
++ return ret; |
13117 |
+ } |
13118 |
+ |
13119 |
+ static int rv3029_eeprom_update_bits(struct device *dev, |
13120 |
+diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c |
13121 |
+index c238b190b3c9..aa90004f49e2 100644 |
13122 |
+--- a/drivers/s390/net/qeth_l2_main.c |
13123 |
++++ b/drivers/s390/net/qeth_l2_main.c |
13124 |
+@@ -2330,10 +2330,10 @@ static bool qeth_l2_vnicc_recover_char(struct qeth_card *card, u32 vnicc, |
13125 |
+ static void qeth_l2_vnicc_init(struct qeth_card *card) |
13126 |
+ { |
13127 |
+ u32 *timeout = &card->options.vnicc.learning_timeout; |
13128 |
++ bool enable, error = false; |
13129 |
+ unsigned int chars_len, i; |
13130 |
+ unsigned long chars_tmp; |
13131 |
+ u32 sup_cmds, vnicc; |
13132 |
+- bool enable, error; |
13133 |
+ |
13134 |
+ QETH_CARD_TEXT(card, 2, "vniccini"); |
13135 |
+ /* reset rx_bcast */ |
13136 |
+@@ -2354,17 +2354,24 @@ static void qeth_l2_vnicc_init(struct qeth_card *card) |
13137 |
+ chars_len = sizeof(card->options.vnicc.sup_chars) * BITS_PER_BYTE; |
13138 |
+ for_each_set_bit(i, &chars_tmp, chars_len) { |
13139 |
+ vnicc = BIT(i); |
13140 |
+- qeth_l2_vnicc_query_cmds(card, vnicc, &sup_cmds); |
13141 |
+- if (!(sup_cmds & IPA_VNICC_SET_TIMEOUT) || |
13142 |
+- !(sup_cmds & IPA_VNICC_GET_TIMEOUT)) |
13143 |
++ if (qeth_l2_vnicc_query_cmds(card, vnicc, &sup_cmds)) { |
13144 |
++ sup_cmds = 0; |
13145 |
++ error = true; |
13146 |
++ } |
13147 |
++ if ((sup_cmds & IPA_VNICC_SET_TIMEOUT) && |
13148 |
++ (sup_cmds & IPA_VNICC_GET_TIMEOUT)) |
13149 |
++ card->options.vnicc.getset_timeout_sup |= vnicc; |
13150 |
++ else |
13151 |
+ card->options.vnicc.getset_timeout_sup &= ~vnicc; |
13152 |
+- if (!(sup_cmds & IPA_VNICC_ENABLE) || |
13153 |
+- !(sup_cmds & IPA_VNICC_DISABLE)) |
13154 |
++ if ((sup_cmds & IPA_VNICC_ENABLE) && |
13155 |
++ (sup_cmds & IPA_VNICC_DISABLE)) |
13156 |
++ card->options.vnicc.set_char_sup |= vnicc; |
13157 |
++ else |
13158 |
+ card->options.vnicc.set_char_sup &= ~vnicc; |
13159 |
+ } |
13160 |
+ /* enforce assumed default values and recover settings, if changed */ |
13161 |
+- error = qeth_l2_vnicc_recover_timeout(card, QETH_VNICC_LEARNING, |
13162 |
+- timeout); |
13163 |
++ error |= qeth_l2_vnicc_recover_timeout(card, QETH_VNICC_LEARNING, |
13164 |
++ timeout); |
13165 |
+ chars_tmp = card->options.vnicc.wanted_chars ^ QETH_VNICC_DEFAULT; |
13166 |
+ chars_len = sizeof(card->options.vnicc.wanted_chars) * BITS_PER_BYTE; |
13167 |
+ for_each_set_bit(i, &chars_tmp, chars_len) { |
13168 |
+diff --git a/drivers/scsi/fnic/fnic_isr.c b/drivers/scsi/fnic/fnic_isr.c |
13169 |
+index 4e3a50202e8c..d28088218c36 100644 |
13170 |
+--- a/drivers/scsi/fnic/fnic_isr.c |
13171 |
++++ b/drivers/scsi/fnic/fnic_isr.c |
13172 |
+@@ -254,7 +254,7 @@ int fnic_set_intr_mode(struct fnic *fnic) |
13173 |
+ int vecs = n + m + o + 1; |
13174 |
+ |
13175 |
+ if (pci_alloc_irq_vectors(fnic->pdev, vecs, vecs, |
13176 |
+- PCI_IRQ_MSIX) < 0) { |
13177 |
++ PCI_IRQ_MSIX) == vecs) { |
13178 |
+ fnic->rq_count = n; |
13179 |
+ fnic->raw_wq_count = m; |
13180 |
+ fnic->wq_copy_count = o; |
13181 |
+@@ -280,7 +280,7 @@ int fnic_set_intr_mode(struct fnic *fnic) |
13182 |
+ fnic->wq_copy_count >= 1 && |
13183 |
+ fnic->cq_count >= 3 && |
13184 |
+ fnic->intr_count >= 1 && |
13185 |
+- pci_alloc_irq_vectors(fnic->pdev, 1, 1, PCI_IRQ_MSI) < 0) { |
13186 |
++ pci_alloc_irq_vectors(fnic->pdev, 1, 1, PCI_IRQ_MSI) == 1) { |
13187 |
+ fnic->rq_count = 1; |
13188 |
+ fnic->raw_wq_count = 1; |
13189 |
+ fnic->wq_copy_count = 1; |
13190 |
+diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c |
13191 |
+index 42bcf7f3a0f9..6ba257cbc6d9 100644 |
13192 |
+--- a/drivers/scsi/libfc/fc_exch.c |
13193 |
++++ b/drivers/scsi/libfc/fc_exch.c |
13194 |
+@@ -2603,7 +2603,7 @@ void fc_exch_recv(struct fc_lport *lport, struct fc_frame *fp) |
13195 |
+ |
13196 |
+ /* lport lock ? */ |
13197 |
+ if (!lport || lport->state == LPORT_ST_DISABLED) { |
13198 |
+- FC_LPORT_DBG(lport, "Receiving frames for an lport that " |
13199 |
++ FC_LIBFC_DBG("Receiving frames for an lport that " |
13200 |
+ "has not been initialized correctly\n"); |
13201 |
+ fc_frame_free(fp); |
13202 |
+ return; |
13203 |
+diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c |
13204 |
+index 2f31d266339f..99469f9057ee 100644 |
13205 |
+--- a/drivers/scsi/megaraid/megaraid_sas_base.c |
13206 |
++++ b/drivers/scsi/megaraid/megaraid_sas_base.c |
13207 |
+@@ -3894,12 +3894,12 @@ megasas_transition_to_ready(struct megasas_instance *instance, int ocr) |
13208 |
+ /* |
13209 |
+ * The cur_state should not last for more than max_wait secs |
13210 |
+ */ |
13211 |
+- for (i = 0; i < max_wait; i++) { |
13212 |
++ for (i = 0; i < max_wait * 50; i++) { |
13213 |
+ curr_abs_state = instance->instancet-> |
13214 |
+ read_fw_status_reg(instance->reg_set); |
13215 |
+ |
13216 |
+ if (abs_state == curr_abs_state) { |
13217 |
+- msleep(1000); |
13218 |
++ msleep(20); |
13219 |
+ } else |
13220 |
+ break; |
13221 |
+ } |
13222 |
+diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c |
13223 |
+index bb20a4a228cf..fff20a370767 100644 |
13224 |
+--- a/drivers/scsi/qla2xxx/qla_os.c |
13225 |
++++ b/drivers/scsi/qla2xxx/qla_os.c |
13226 |
+@@ -6967,8 +6967,7 @@ qla2x00_module_init(void) |
13227 |
+ /* Initialize target kmem_cache and mem_pools */ |
13228 |
+ ret = qlt_init(); |
13229 |
+ if (ret < 0) { |
13230 |
+- kmem_cache_destroy(srb_cachep); |
13231 |
+- return ret; |
13232 |
++ goto destroy_cache; |
13233 |
+ } else if (ret > 0) { |
13234 |
+ /* |
13235 |
+ * If initiator mode is explictly disabled by qlt_init(), |
13236 |
+@@ -6989,11 +6988,10 @@ qla2x00_module_init(void) |
13237 |
+ qla2xxx_transport_template = |
13238 |
+ fc_attach_transport(&qla2xxx_transport_functions); |
13239 |
+ if (!qla2xxx_transport_template) { |
13240 |
+- kmem_cache_destroy(srb_cachep); |
13241 |
+ ql_log(ql_log_fatal, NULL, 0x0002, |
13242 |
+ "fc_attach_transport failed...Failing load!.\n"); |
13243 |
+- qlt_exit(); |
13244 |
+- return -ENODEV; |
13245 |
++ ret = -ENODEV; |
13246 |
++ goto qlt_exit; |
13247 |
+ } |
13248 |
+ |
13249 |
+ apidev_major = register_chrdev(0, QLA2XXX_APIDEV, &apidev_fops); |
13250 |
+@@ -7005,27 +7003,37 @@ qla2x00_module_init(void) |
13251 |
+ qla2xxx_transport_vport_template = |
13252 |
+ fc_attach_transport(&qla2xxx_transport_vport_functions); |
13253 |
+ if (!qla2xxx_transport_vport_template) { |
13254 |
+- kmem_cache_destroy(srb_cachep); |
13255 |
+- qlt_exit(); |
13256 |
+- fc_release_transport(qla2xxx_transport_template); |
13257 |
+ ql_log(ql_log_fatal, NULL, 0x0004, |
13258 |
+ "fc_attach_transport vport failed...Failing load!.\n"); |
13259 |
+- return -ENODEV; |
13260 |
++ ret = -ENODEV; |
13261 |
++ goto unreg_chrdev; |
13262 |
+ } |
13263 |
+ ql_log(ql_log_info, NULL, 0x0005, |
13264 |
+ "QLogic Fibre Channel HBA Driver: %s.\n", |
13265 |
+ qla2x00_version_str); |
13266 |
+ ret = pci_register_driver(&qla2xxx_pci_driver); |
13267 |
+ if (ret) { |
13268 |
+- kmem_cache_destroy(srb_cachep); |
13269 |
+- qlt_exit(); |
13270 |
+- fc_release_transport(qla2xxx_transport_template); |
13271 |
+- fc_release_transport(qla2xxx_transport_vport_template); |
13272 |
+ ql_log(ql_log_fatal, NULL, 0x0006, |
13273 |
+ "pci_register_driver failed...ret=%d Failing load!.\n", |
13274 |
+ ret); |
13275 |
++ goto release_vport_transport; |
13276 |
+ } |
13277 |
+ return ret; |
13278 |
++ |
13279 |
++release_vport_transport: |
13280 |
++ fc_release_transport(qla2xxx_transport_vport_template); |
13281 |
++ |
13282 |
++unreg_chrdev: |
13283 |
++ if (apidev_major >= 0) |
13284 |
++ unregister_chrdev(apidev_major, QLA2XXX_APIDEV); |
13285 |
++ fc_release_transport(qla2xxx_transport_template); |
13286 |
++ |
13287 |
++qlt_exit: |
13288 |
++ qlt_exit(); |
13289 |
++ |
13290 |
++destroy_cache: |
13291 |
++ kmem_cache_destroy(srb_cachep); |
13292 |
++ return ret; |
13293 |
+ } |
13294 |
+ |
13295 |
+ /** |
13296 |
+diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c |
13297 |
+index e9545411ec5a..95206e227730 100644 |
13298 |
+--- a/drivers/scsi/qla2xxx/qla_target.c |
13299 |
++++ b/drivers/scsi/qla2xxx/qla_target.c |
13300 |
+@@ -2233,14 +2233,14 @@ void qlt_send_resp_ctio(struct qla_qpair *qpair, struct qla_tgt_cmd *cmd, |
13301 |
+ ctio->u.status1.scsi_status |= |
13302 |
+ cpu_to_le16(SS_RESIDUAL_UNDER); |
13303 |
+ |
13304 |
+- /* Response code and sense key */ |
13305 |
+- put_unaligned_le32(((0x70 << 24) | (sense_key << 8)), |
13306 |
+- (&ctio->u.status1.sense_data)[0]); |
13307 |
++ /* Fixed format sense data. */ |
13308 |
++ ctio->u.status1.sense_data[0] = 0x70; |
13309 |
++ ctio->u.status1.sense_data[2] = sense_key; |
13310 |
+ /* Additional sense length */ |
13311 |
+- put_unaligned_le32(0x0a, (&ctio->u.status1.sense_data)[1]); |
13312 |
++ ctio->u.status1.sense_data[7] = 0xa; |
13313 |
+ /* ASC and ASCQ */ |
13314 |
+- put_unaligned_le32(((asc << 24) | (ascq << 16)), |
13315 |
+- (&ctio->u.status1.sense_data)[3]); |
13316 |
++ ctio->u.status1.sense_data[12] = asc; |
13317 |
++ ctio->u.status1.sense_data[13] = ascq; |
13318 |
+ |
13319 |
+ /* Memory Barrier */ |
13320 |
+ wmb(); |
13321 |
+@@ -2290,7 +2290,7 @@ void qlt_xmit_tm_rsp(struct qla_tgt_mgmt_cmd *mcmd) |
13322 |
+ mcmd->orig_iocb.imm_ntfy.u.isp24.status_subcode == |
13323 |
+ ELS_TPRLO) { |
13324 |
+ ql_dbg(ql_dbg_disc, vha, 0x2106, |
13325 |
+- "TM response logo %phC status %#x state %#x", |
13326 |
++ "TM response logo %8phC status %#x state %#x", |
13327 |
+ mcmd->sess->port_name, mcmd->fc_tm_rsp, |
13328 |
+ mcmd->flags); |
13329 |
+ qlt_schedule_sess_for_deletion(mcmd->sess); |
13330 |
+@@ -5334,11 +5334,7 @@ qlt_alloc_qfull_cmd(struct scsi_qla_host *vha, |
13331 |
+ se_sess = sess->se_sess; |
13332 |
+ |
13333 |
+ tag = sbitmap_queue_get(&se_sess->sess_tag_pool, &cpu); |
13334 |
+- if (tag < 0) |
13335 |
+- return; |
13336 |
+- |
13337 |
+- cmd = &((struct qla_tgt_cmd *)se_sess->sess_cmd_map)[tag]; |
13338 |
+- if (!cmd) { |
13339 |
++ if (tag < 0) { |
13340 |
+ ql_dbg(ql_dbg_io, vha, 0x3009, |
13341 |
+ "qla_target(%d): %s: Allocation of cmd failed\n", |
13342 |
+ vha->vp_idx, __func__); |
13343 |
+@@ -5353,6 +5349,7 @@ qlt_alloc_qfull_cmd(struct scsi_qla_host *vha, |
13344 |
+ return; |
13345 |
+ } |
13346 |
+ |
13347 |
++ cmd = &((struct qla_tgt_cmd *)se_sess->sess_cmd_map)[tag]; |
13348 |
+ memset(cmd, 0, sizeof(struct qla_tgt_cmd)); |
13349 |
+ |
13350 |
+ qlt_incr_num_pend_cmds(vha); |
13351 |
+diff --git a/drivers/soc/amlogic/meson-gx-pwrc-vpu.c b/drivers/soc/amlogic/meson-gx-pwrc-vpu.c |
13352 |
+index 6289965c42e9..05421d029dff 100644 |
13353 |
+--- a/drivers/soc/amlogic/meson-gx-pwrc-vpu.c |
13354 |
++++ b/drivers/soc/amlogic/meson-gx-pwrc-vpu.c |
13355 |
+@@ -54,12 +54,12 @@ static int meson_gx_pwrc_vpu_power_off(struct generic_pm_domain *genpd) |
13356 |
+ /* Power Down Memories */ |
13357 |
+ for (i = 0; i < 32; i += 2) { |
13358 |
+ regmap_update_bits(pd->regmap_hhi, HHI_VPU_MEM_PD_REG0, |
13359 |
+- 0x2 << i, 0x3 << i); |
13360 |
++ 0x3 << i, 0x3 << i); |
13361 |
+ udelay(5); |
13362 |
+ } |
13363 |
+ for (i = 0; i < 32; i += 2) { |
13364 |
+ regmap_update_bits(pd->regmap_hhi, HHI_VPU_MEM_PD_REG1, |
13365 |
+- 0x2 << i, 0x3 << i); |
13366 |
++ 0x3 << i, 0x3 << i); |
13367 |
+ udelay(5); |
13368 |
+ } |
13369 |
+ for (i = 8; i < 16; i++) { |
13370 |
+@@ -108,13 +108,13 @@ static int meson_gx_pwrc_vpu_power_on(struct generic_pm_domain *genpd) |
13371 |
+ /* Power Up Memories */ |
13372 |
+ for (i = 0; i < 32; i += 2) { |
13373 |
+ regmap_update_bits(pd->regmap_hhi, HHI_VPU_MEM_PD_REG0, |
13374 |
+- 0x2 << i, 0); |
13375 |
++ 0x3 << i, 0); |
13376 |
+ udelay(5); |
13377 |
+ } |
13378 |
+ |
13379 |
+ for (i = 0; i < 32; i += 2) { |
13380 |
+ regmap_update_bits(pd->regmap_hhi, HHI_VPU_MEM_PD_REG1, |
13381 |
+- 0x2 << i, 0); |
13382 |
++ 0x3 << i, 0); |
13383 |
+ udelay(5); |
13384 |
+ } |
13385 |
+ |
13386 |
+diff --git a/drivers/soc/amlogic/meson-gx-socinfo.c b/drivers/soc/amlogic/meson-gx-socinfo.c |
13387 |
+index 37ea0a1c24c8..1ae339f5eadb 100644 |
13388 |
+--- a/drivers/soc/amlogic/meson-gx-socinfo.c |
13389 |
++++ b/drivers/soc/amlogic/meson-gx-socinfo.c |
13390 |
+@@ -43,20 +43,21 @@ static const struct meson_gx_package_id { |
13391 |
+ const char *name; |
13392 |
+ unsigned int major_id; |
13393 |
+ unsigned int pack_id; |
13394 |
++ unsigned int pack_mask; |
13395 |
+ } soc_packages[] = { |
13396 |
+- { "S905", 0x1f, 0 }, |
13397 |
+- { "S905H", 0x1f, 0x13 }, |
13398 |
+- { "S905M", 0x1f, 0x20 }, |
13399 |
+- { "S905D", 0x21, 0 }, |
13400 |
+- { "S905X", 0x21, 0x80 }, |
13401 |
+- { "S905W", 0x21, 0xa0 }, |
13402 |
+- { "S905L", 0x21, 0xc0 }, |
13403 |
+- { "S905M2", 0x21, 0xe0 }, |
13404 |
+- { "S912", 0x22, 0 }, |
13405 |
+- { "962X", 0x24, 0x10 }, |
13406 |
+- { "962E", 0x24, 0x20 }, |
13407 |
+- { "A113X", 0x25, 0x37 }, |
13408 |
+- { "A113D", 0x25, 0x22 }, |
13409 |
++ { "S905", 0x1f, 0, 0x20 }, /* pack_id != 0x20 */ |
13410 |
++ { "S905H", 0x1f, 0x3, 0xf }, /* pack_id & 0xf == 0x3 */ |
13411 |
++ { "S905M", 0x1f, 0x20, 0xf0 }, /* pack_id == 0x20 */ |
13412 |
++ { "S905D", 0x21, 0, 0xf0 }, |
13413 |
++ { "S905X", 0x21, 0x80, 0xf0 }, |
13414 |
++ { "S905W", 0x21, 0xa0, 0xf0 }, |
13415 |
++ { "S905L", 0x21, 0xc0, 0xf0 }, |
13416 |
++ { "S905M2", 0x21, 0xe0, 0xf0 }, |
13417 |
++ { "S912", 0x22, 0, 0x0 }, /* Only S912 is known for GXM */ |
13418 |
++ { "962X", 0x24, 0x10, 0xf0 }, |
13419 |
++ { "962E", 0x24, 0x20, 0xf0 }, |
13420 |
++ { "A113X", 0x25, 0x37, 0xff }, |
13421 |
++ { "A113D", 0x25, 0x22, 0xff }, |
13422 |
+ }; |
13423 |
+ |
13424 |
+ static inline unsigned int socinfo_to_major(u32 socinfo) |
13425 |
+@@ -81,13 +82,14 @@ static inline unsigned int socinfo_to_misc(u32 socinfo) |
13426 |
+ |
13427 |
+ static const char *socinfo_to_package_id(u32 socinfo) |
13428 |
+ { |
13429 |
+- unsigned int pack = socinfo_to_pack(socinfo) & 0xf0; |
13430 |
++ unsigned int pack = socinfo_to_pack(socinfo); |
13431 |
+ unsigned int major = socinfo_to_major(socinfo); |
13432 |
+ int i; |
13433 |
+ |
13434 |
+ for (i = 0 ; i < ARRAY_SIZE(soc_packages) ; ++i) { |
13435 |
+ if (soc_packages[i].major_id == major && |
13436 |
+- soc_packages[i].pack_id == pack) |
13437 |
++ soc_packages[i].pack_id == |
13438 |
++ (pack & soc_packages[i].pack_mask)) |
13439 |
+ return soc_packages[i].name; |
13440 |
+ } |
13441 |
+ |
13442 |
+diff --git a/drivers/soc/fsl/qe/gpio.c b/drivers/soc/fsl/qe/gpio.c |
13443 |
+index 819bed0f5667..51b3a47b5a55 100644 |
13444 |
+--- a/drivers/soc/fsl/qe/gpio.c |
13445 |
++++ b/drivers/soc/fsl/qe/gpio.c |
13446 |
+@@ -179,8 +179,10 @@ struct qe_pin *qe_pin_request(struct device_node *np, int index) |
13447 |
+ if (err < 0) |
13448 |
+ goto err0; |
13449 |
+ gc = gpio_to_chip(err); |
13450 |
+- if (WARN_ON(!gc)) |
13451 |
++ if (WARN_ON(!gc)) { |
13452 |
++ err = -ENODEV; |
13453 |
+ goto err0; |
13454 |
++ } |
13455 |
+ |
13456 |
+ if (!of_device_is_compatible(gc->of_node, "fsl,mpc8323-qe-pario-bank")) { |
13457 |
+ pr_debug("%s: tried to get a non-qe pin\n", __func__); |
13458 |
+diff --git a/drivers/soc/qcom/cmd-db.c b/drivers/soc/qcom/cmd-db.c |
13459 |
+index a6f646295f06..78d73ec587e1 100644 |
13460 |
+--- a/drivers/soc/qcom/cmd-db.c |
13461 |
++++ b/drivers/soc/qcom/cmd-db.c |
13462 |
+@@ -283,8 +283,8 @@ static int cmd_db_dev_probe(struct platform_device *pdev) |
13463 |
+ } |
13464 |
+ |
13465 |
+ cmd_db_header = memremap(rmem->base, rmem->size, MEMREMAP_WB); |
13466 |
+- if (IS_ERR_OR_NULL(cmd_db_header)) { |
13467 |
+- ret = PTR_ERR(cmd_db_header); |
13468 |
++ if (!cmd_db_header) { |
13469 |
++ ret = -ENOMEM; |
13470 |
+ cmd_db_header = NULL; |
13471 |
+ return ret; |
13472 |
+ } |
13473 |
+diff --git a/drivers/spi/spi-bcm-qspi.c b/drivers/spi/spi-bcm-qspi.c |
13474 |
+index 584bcb018a62..285a6f463013 100644 |
13475 |
+--- a/drivers/spi/spi-bcm-qspi.c |
13476 |
++++ b/drivers/spi/spi-bcm-qspi.c |
13477 |
+@@ -354,7 +354,7 @@ static int bcm_qspi_bspi_set_flex_mode(struct bcm_qspi *qspi, |
13478 |
+ { |
13479 |
+ int bpc = 0, bpp = 0; |
13480 |
+ u8 command = op->cmd.opcode; |
13481 |
+- int width = op->cmd.buswidth ? op->cmd.buswidth : SPI_NBITS_SINGLE; |
13482 |
++ int width = op->data.buswidth ? op->data.buswidth : SPI_NBITS_SINGLE; |
13483 |
+ int addrlen = op->addr.nbytes; |
13484 |
+ int flex_mode = 1; |
13485 |
+ |
13486 |
+@@ -992,7 +992,7 @@ static int bcm_qspi_exec_mem_op(struct spi_mem *mem, |
13487 |
+ if (mspi_read) |
13488 |
+ return bcm_qspi_mspi_exec_mem_op(spi, op); |
13489 |
+ |
13490 |
+- ret = bcm_qspi_bspi_set_mode(qspi, op, -1); |
13491 |
++ ret = bcm_qspi_bspi_set_mode(qspi, op, 0); |
13492 |
+ |
13493 |
+ if (!ret) |
13494 |
+ ret = bcm_qspi_bspi_exec_mem_op(spi, op); |
13495 |
+diff --git a/drivers/spi/spi-bcm2835aux.c b/drivers/spi/spi-bcm2835aux.c |
13496 |
+index 12c1fa5b06c5..c63ed402cf86 100644 |
13497 |
+--- a/drivers/spi/spi-bcm2835aux.c |
13498 |
++++ b/drivers/spi/spi-bcm2835aux.c |
13499 |
+@@ -416,7 +416,18 @@ static int bcm2835aux_spi_probe(struct platform_device *pdev) |
13500 |
+ platform_set_drvdata(pdev, master); |
13501 |
+ master->mode_bits = (SPI_CPOL | SPI_CS_HIGH | SPI_NO_CS); |
13502 |
+ master->bits_per_word_mask = SPI_BPW_MASK(8); |
13503 |
+- master->num_chipselect = -1; |
13504 |
++ /* even though the driver never officially supported native CS |
13505 |
++ * allow a single native CS for legacy DT support purposes when |
13506 |
++ * no cs-gpio is configured. |
13507 |
++ * Known limitations for native cs are: |
13508 |
++ * * multiple chip-selects: cs0-cs2 are all simultaniously asserted |
13509 |
++ * whenever there is a transfer - this even includes SPI_NO_CS |
13510 |
++ * * SPI_CS_HIGH: is ignores - cs are always asserted low |
13511 |
++ * * cs_change: cs is deasserted after each spi_transfer |
13512 |
++ * * cs_delay_usec: cs is always deasserted one SCK cycle after |
13513 |
++ * a spi_transfer |
13514 |
++ */ |
13515 |
++ master->num_chipselect = 1; |
13516 |
+ master->transfer_one = bcm2835aux_spi_transfer_one; |
13517 |
+ master->handle_err = bcm2835aux_spi_handle_err; |
13518 |
+ master->prepare_message = bcm2835aux_spi_prepare_message; |
13519 |
+diff --git a/drivers/spi/spi-cadence.c b/drivers/spi/spi-cadence.c |
13520 |
+index 7c88f74f7f47..94cc0a152449 100644 |
13521 |
+--- a/drivers/spi/spi-cadence.c |
13522 |
++++ b/drivers/spi/spi-cadence.c |
13523 |
+@@ -584,11 +584,6 @@ static int cdns_spi_probe(struct platform_device *pdev) |
13524 |
+ goto clk_dis_apb; |
13525 |
+ } |
13526 |
+ |
13527 |
+- pm_runtime_use_autosuspend(&pdev->dev); |
13528 |
+- pm_runtime_set_autosuspend_delay(&pdev->dev, SPI_AUTOSUSPEND_TIMEOUT); |
13529 |
+- pm_runtime_set_active(&pdev->dev); |
13530 |
+- pm_runtime_enable(&pdev->dev); |
13531 |
+- |
13532 |
+ ret = of_property_read_u32(pdev->dev.of_node, "num-cs", &num_cs); |
13533 |
+ if (ret < 0) |
13534 |
+ master->num_chipselect = CDNS_SPI_DEFAULT_NUM_CS; |
13535 |
+@@ -603,8 +598,10 @@ static int cdns_spi_probe(struct platform_device *pdev) |
13536 |
+ /* SPI controller initializations */ |
13537 |
+ cdns_spi_init_hw(xspi); |
13538 |
+ |
13539 |
+- pm_runtime_mark_last_busy(&pdev->dev); |
13540 |
+- pm_runtime_put_autosuspend(&pdev->dev); |
13541 |
++ pm_runtime_set_active(&pdev->dev); |
13542 |
++ pm_runtime_enable(&pdev->dev); |
13543 |
++ pm_runtime_use_autosuspend(&pdev->dev); |
13544 |
++ pm_runtime_set_autosuspend_delay(&pdev->dev, SPI_AUTOSUSPEND_TIMEOUT); |
13545 |
+ |
13546 |
+ irq = platform_get_irq(pdev, 0); |
13547 |
+ if (irq <= 0) { |
13548 |
+diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c |
13549 |
+index 8b79e36fab21..cd784552de7f 100644 |
13550 |
+--- a/drivers/spi/spi-fsl-spi.c |
13551 |
++++ b/drivers/spi/spi-fsl-spi.c |
13552 |
+@@ -407,7 +407,6 @@ static int fsl_spi_do_one_msg(struct spi_master *master, |
13553 |
+ } |
13554 |
+ |
13555 |
+ m->status = status; |
13556 |
+- spi_finalize_current_message(master); |
13557 |
+ |
13558 |
+ if (status || !cs_change) { |
13559 |
+ ndelay(nsecs); |
13560 |
+@@ -415,6 +414,7 @@ static int fsl_spi_do_one_msg(struct spi_master *master, |
13561 |
+ } |
13562 |
+ |
13563 |
+ fsl_spi_setup_transfer(spi, NULL); |
13564 |
++ spi_finalize_current_message(master); |
13565 |
+ return 0; |
13566 |
+ } |
13567 |
+ |
13568 |
+diff --git a/drivers/spi/spi-tegra114.c b/drivers/spi/spi-tegra114.c |
13569 |
+index a1888dc6a938..09cfae3abce2 100644 |
13570 |
+--- a/drivers/spi/spi-tegra114.c |
13571 |
++++ b/drivers/spi/spi-tegra114.c |
13572 |
+@@ -307,10 +307,16 @@ static unsigned tegra_spi_fill_tx_fifo_from_client_txbuf( |
13573 |
+ x |= (u32)(*tx_buf++) << (i * 8); |
13574 |
+ tegra_spi_writel(tspi, x, SPI_TX_FIFO); |
13575 |
+ } |
13576 |
++ |
13577 |
++ tspi->cur_tx_pos += written_words * tspi->bytes_per_word; |
13578 |
+ } else { |
13579 |
++ unsigned int write_bytes; |
13580 |
+ max_n_32bit = min(tspi->curr_dma_words, tx_empty_count); |
13581 |
+ written_words = max_n_32bit; |
13582 |
+ nbytes = written_words * tspi->bytes_per_word; |
13583 |
++ if (nbytes > t->len - tspi->cur_pos) |
13584 |
++ nbytes = t->len - tspi->cur_pos; |
13585 |
++ write_bytes = nbytes; |
13586 |
+ for (count = 0; count < max_n_32bit; count++) { |
13587 |
+ u32 x = 0; |
13588 |
+ |
13589 |
+@@ -319,8 +325,10 @@ static unsigned tegra_spi_fill_tx_fifo_from_client_txbuf( |
13590 |
+ x |= (u32)(*tx_buf++) << (i * 8); |
13591 |
+ tegra_spi_writel(tspi, x, SPI_TX_FIFO); |
13592 |
+ } |
13593 |
++ |
13594 |
++ tspi->cur_tx_pos += write_bytes; |
13595 |
+ } |
13596 |
+- tspi->cur_tx_pos += written_words * tspi->bytes_per_word; |
13597 |
++ |
13598 |
+ return written_words; |
13599 |
+ } |
13600 |
+ |
13601 |
+@@ -344,20 +352,27 @@ static unsigned int tegra_spi_read_rx_fifo_to_client_rxbuf( |
13602 |
+ for (i = 0; len && (i < 4); i++, len--) |
13603 |
+ *rx_buf++ = (x >> i*8) & 0xFF; |
13604 |
+ } |
13605 |
+- tspi->cur_rx_pos += tspi->curr_dma_words * tspi->bytes_per_word; |
13606 |
+ read_words += tspi->curr_dma_words; |
13607 |
++ tspi->cur_rx_pos += tspi->curr_dma_words * tspi->bytes_per_word; |
13608 |
+ } else { |
13609 |
+ u32 rx_mask = ((u32)1 << t->bits_per_word) - 1; |
13610 |
++ u8 bytes_per_word = tspi->bytes_per_word; |
13611 |
++ unsigned int read_bytes; |
13612 |
+ |
13613 |
++ len = rx_full_count * bytes_per_word; |
13614 |
++ if (len > t->len - tspi->cur_pos) |
13615 |
++ len = t->len - tspi->cur_pos; |
13616 |
++ read_bytes = len; |
13617 |
+ for (count = 0; count < rx_full_count; count++) { |
13618 |
+ u32 x = tegra_spi_readl(tspi, SPI_RX_FIFO) & rx_mask; |
13619 |
+ |
13620 |
+- for (i = 0; (i < tspi->bytes_per_word); i++) |
13621 |
++ for (i = 0; len && (i < bytes_per_word); i++, len--) |
13622 |
+ *rx_buf++ = (x >> (i*8)) & 0xFF; |
13623 |
+ } |
13624 |
+- tspi->cur_rx_pos += rx_full_count * tspi->bytes_per_word; |
13625 |
+ read_words += rx_full_count; |
13626 |
++ tspi->cur_rx_pos += read_bytes; |
13627 |
+ } |
13628 |
++ |
13629 |
+ return read_words; |
13630 |
+ } |
13631 |
+ |
13632 |
+@@ -372,12 +387,17 @@ static void tegra_spi_copy_client_txbuf_to_spi_txbuf( |
13633 |
+ unsigned len = tspi->curr_dma_words * tspi->bytes_per_word; |
13634 |
+ |
13635 |
+ memcpy(tspi->tx_dma_buf, t->tx_buf + tspi->cur_pos, len); |
13636 |
++ tspi->cur_tx_pos += tspi->curr_dma_words * tspi->bytes_per_word; |
13637 |
+ } else { |
13638 |
+ unsigned int i; |
13639 |
+ unsigned int count; |
13640 |
+ u8 *tx_buf = (u8 *)t->tx_buf + tspi->cur_tx_pos; |
13641 |
+ unsigned consume = tspi->curr_dma_words * tspi->bytes_per_word; |
13642 |
++ unsigned int write_bytes; |
13643 |
+ |
13644 |
++ if (consume > t->len - tspi->cur_pos) |
13645 |
++ consume = t->len - tspi->cur_pos; |
13646 |
++ write_bytes = consume; |
13647 |
+ for (count = 0; count < tspi->curr_dma_words; count++) { |
13648 |
+ u32 x = 0; |
13649 |
+ |
13650 |
+@@ -386,8 +406,9 @@ static void tegra_spi_copy_client_txbuf_to_spi_txbuf( |
13651 |
+ x |= (u32)(*tx_buf++) << (i * 8); |
13652 |
+ tspi->tx_dma_buf[count] = x; |
13653 |
+ } |
13654 |
++ |
13655 |
++ tspi->cur_tx_pos += write_bytes; |
13656 |
+ } |
13657 |
+- tspi->cur_tx_pos += tspi->curr_dma_words * tspi->bytes_per_word; |
13658 |
+ |
13659 |
+ /* Make the dma buffer to read by dma */ |
13660 |
+ dma_sync_single_for_device(tspi->dev, tspi->tx_dma_phys, |
13661 |
+@@ -405,20 +426,28 @@ static void tegra_spi_copy_spi_rxbuf_to_client_rxbuf( |
13662 |
+ unsigned len = tspi->curr_dma_words * tspi->bytes_per_word; |
13663 |
+ |
13664 |
+ memcpy(t->rx_buf + tspi->cur_rx_pos, tspi->rx_dma_buf, len); |
13665 |
++ tspi->cur_rx_pos += tspi->curr_dma_words * tspi->bytes_per_word; |
13666 |
+ } else { |
13667 |
+ unsigned int i; |
13668 |
+ unsigned int count; |
13669 |
+ unsigned char *rx_buf = t->rx_buf + tspi->cur_rx_pos; |
13670 |
+ u32 rx_mask = ((u32)1 << t->bits_per_word) - 1; |
13671 |
++ unsigned consume = tspi->curr_dma_words * tspi->bytes_per_word; |
13672 |
++ unsigned int read_bytes; |
13673 |
+ |
13674 |
++ if (consume > t->len - tspi->cur_pos) |
13675 |
++ consume = t->len - tspi->cur_pos; |
13676 |
++ read_bytes = consume; |
13677 |
+ for (count = 0; count < tspi->curr_dma_words; count++) { |
13678 |
+ u32 x = tspi->rx_dma_buf[count] & rx_mask; |
13679 |
+ |
13680 |
+- for (i = 0; (i < tspi->bytes_per_word); i++) |
13681 |
++ for (i = 0; consume && (i < tspi->bytes_per_word); |
13682 |
++ i++, consume--) |
13683 |
+ *rx_buf++ = (x >> (i*8)) & 0xFF; |
13684 |
+ } |
13685 |
++ |
13686 |
++ tspi->cur_rx_pos += read_bytes; |
13687 |
+ } |
13688 |
+- tspi->cur_rx_pos += tspi->curr_dma_words * tspi->bytes_per_word; |
13689 |
+ |
13690 |
+ /* Make the dma buffer to read by dma */ |
13691 |
+ dma_sync_single_for_device(tspi->dev, tspi->rx_dma_phys, |
13692 |
+@@ -470,22 +499,39 @@ static int tegra_spi_start_rx_dma(struct tegra_spi_data *tspi, int len) |
13693 |
+ return 0; |
13694 |
+ } |
13695 |
+ |
13696 |
+-static int tegra_spi_start_dma_based_transfer( |
13697 |
+- struct tegra_spi_data *tspi, struct spi_transfer *t) |
13698 |
++static int tegra_spi_flush_fifos(struct tegra_spi_data *tspi) |
13699 |
+ { |
13700 |
+- u32 val; |
13701 |
+- unsigned int len; |
13702 |
+- int ret = 0; |
13703 |
++ unsigned long timeout = jiffies + HZ; |
13704 |
+ u32 status; |
13705 |
+ |
13706 |
+- /* Make sure that Rx and Tx fifo are empty */ |
13707 |
+ status = tegra_spi_readl(tspi, SPI_FIFO_STATUS); |
13708 |
+ if ((status & SPI_FIFO_EMPTY) != SPI_FIFO_EMPTY) { |
13709 |
+- dev_err(tspi->dev, "Rx/Tx fifo are not empty status 0x%08x\n", |
13710 |
+- (unsigned)status); |
13711 |
+- return -EIO; |
13712 |
++ status |= SPI_RX_FIFO_FLUSH | SPI_TX_FIFO_FLUSH; |
13713 |
++ tegra_spi_writel(tspi, status, SPI_FIFO_STATUS); |
13714 |
++ while ((status & SPI_FIFO_EMPTY) != SPI_FIFO_EMPTY) { |
13715 |
++ status = tegra_spi_readl(tspi, SPI_FIFO_STATUS); |
13716 |
++ if (time_after(jiffies, timeout)) { |
13717 |
++ dev_err(tspi->dev, |
13718 |
++ "timeout waiting for fifo flush\n"); |
13719 |
++ return -EIO; |
13720 |
++ } |
13721 |
++ |
13722 |
++ udelay(1); |
13723 |
++ } |
13724 |
+ } |
13725 |
+ |
13726 |
++ return 0; |
13727 |
++} |
13728 |
++ |
13729 |
++static int tegra_spi_start_dma_based_transfer( |
13730 |
++ struct tegra_spi_data *tspi, struct spi_transfer *t) |
13731 |
++{ |
13732 |
++ u32 val; |
13733 |
++ unsigned int len; |
13734 |
++ int ret = 0; |
13735 |
++ u8 dma_burst; |
13736 |
++ struct dma_slave_config dma_sconfig = {0}; |
13737 |
++ |
13738 |
+ val = SPI_DMA_BLK_SET(tspi->curr_dma_words - 1); |
13739 |
+ tegra_spi_writel(tspi, val, SPI_DMA_BLK); |
13740 |
+ |
13741 |
+@@ -496,12 +542,16 @@ static int tegra_spi_start_dma_based_transfer( |
13742 |
+ len = tspi->curr_dma_words * 4; |
13743 |
+ |
13744 |
+ /* Set attention level based on length of transfer */ |
13745 |
+- if (len & 0xF) |
13746 |
++ if (len & 0xF) { |
13747 |
+ val |= SPI_TX_TRIG_1 | SPI_RX_TRIG_1; |
13748 |
+- else if (((len) >> 4) & 0x1) |
13749 |
++ dma_burst = 1; |
13750 |
++ } else if (((len) >> 4) & 0x1) { |
13751 |
+ val |= SPI_TX_TRIG_4 | SPI_RX_TRIG_4; |
13752 |
+- else |
13753 |
++ dma_burst = 4; |
13754 |
++ } else { |
13755 |
+ val |= SPI_TX_TRIG_8 | SPI_RX_TRIG_8; |
13756 |
++ dma_burst = 8; |
13757 |
++ } |
13758 |
+ |
13759 |
+ if (tspi->cur_direction & DATA_DIR_TX) |
13760 |
+ val |= SPI_IE_TX; |
13761 |
+@@ -512,7 +562,18 @@ static int tegra_spi_start_dma_based_transfer( |
13762 |
+ tegra_spi_writel(tspi, val, SPI_DMA_CTL); |
13763 |
+ tspi->dma_control_reg = val; |
13764 |
+ |
13765 |
++ dma_sconfig.device_fc = true; |
13766 |
+ if (tspi->cur_direction & DATA_DIR_TX) { |
13767 |
++ dma_sconfig.dst_addr = tspi->phys + SPI_TX_FIFO; |
13768 |
++ dma_sconfig.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; |
13769 |
++ dma_sconfig.dst_maxburst = dma_burst; |
13770 |
++ ret = dmaengine_slave_config(tspi->tx_dma_chan, &dma_sconfig); |
13771 |
++ if (ret < 0) { |
13772 |
++ dev_err(tspi->dev, |
13773 |
++ "DMA slave config failed: %d\n", ret); |
13774 |
++ return ret; |
13775 |
++ } |
13776 |
++ |
13777 |
+ tegra_spi_copy_client_txbuf_to_spi_txbuf(tspi, t); |
13778 |
+ ret = tegra_spi_start_tx_dma(tspi, len); |
13779 |
+ if (ret < 0) { |
13780 |
+@@ -523,6 +584,16 @@ static int tegra_spi_start_dma_based_transfer( |
13781 |
+ } |
13782 |
+ |
13783 |
+ if (tspi->cur_direction & DATA_DIR_RX) { |
13784 |
++ dma_sconfig.src_addr = tspi->phys + SPI_RX_FIFO; |
13785 |
++ dma_sconfig.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; |
13786 |
++ dma_sconfig.src_maxburst = dma_burst; |
13787 |
++ ret = dmaengine_slave_config(tspi->rx_dma_chan, &dma_sconfig); |
13788 |
++ if (ret < 0) { |
13789 |
++ dev_err(tspi->dev, |
13790 |
++ "DMA slave config failed: %d\n", ret); |
13791 |
++ return ret; |
13792 |
++ } |
13793 |
++ |
13794 |
+ /* Make the dma buffer to read by dma */ |
13795 |
+ dma_sync_single_for_device(tspi->dev, tspi->rx_dma_phys, |
13796 |
+ tspi->dma_buf_size, DMA_FROM_DEVICE); |
13797 |
+@@ -582,7 +653,6 @@ static int tegra_spi_init_dma_param(struct tegra_spi_data *tspi, |
13798 |
+ u32 *dma_buf; |
13799 |
+ dma_addr_t dma_phys; |
13800 |
+ int ret; |
13801 |
+- struct dma_slave_config dma_sconfig; |
13802 |
+ |
13803 |
+ dma_chan = dma_request_slave_channel_reason(tspi->dev, |
13804 |
+ dma_to_memory ? "rx" : "tx"); |
13805 |
+@@ -602,19 +672,6 @@ static int tegra_spi_init_dma_param(struct tegra_spi_data *tspi, |
13806 |
+ return -ENOMEM; |
13807 |
+ } |
13808 |
+ |
13809 |
+- if (dma_to_memory) { |
13810 |
+- dma_sconfig.src_addr = tspi->phys + SPI_RX_FIFO; |
13811 |
+- dma_sconfig.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; |
13812 |
+- dma_sconfig.src_maxburst = 0; |
13813 |
+- } else { |
13814 |
+- dma_sconfig.dst_addr = tspi->phys + SPI_TX_FIFO; |
13815 |
+- dma_sconfig.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; |
13816 |
+- dma_sconfig.dst_maxburst = 0; |
13817 |
+- } |
13818 |
+- |
13819 |
+- ret = dmaengine_slave_config(dma_chan, &dma_sconfig); |
13820 |
+- if (ret) |
13821 |
+- goto scrub; |
13822 |
+ if (dma_to_memory) { |
13823 |
+ tspi->rx_dma_chan = dma_chan; |
13824 |
+ tspi->rx_dma_buf = dma_buf; |
13825 |
+@@ -625,11 +682,6 @@ static int tegra_spi_init_dma_param(struct tegra_spi_data *tspi, |
13826 |
+ tspi->tx_dma_phys = dma_phys; |
13827 |
+ } |
13828 |
+ return 0; |
13829 |
+- |
13830 |
+-scrub: |
13831 |
+- dma_free_coherent(tspi->dev, tspi->dma_buf_size, dma_buf, dma_phys); |
13832 |
+- dma_release_channel(dma_chan); |
13833 |
+- return ret; |
13834 |
+ } |
13835 |
+ |
13836 |
+ static void tegra_spi_deinit_dma_param(struct tegra_spi_data *tspi, |
13837 |
+@@ -730,6 +782,8 @@ static int tegra_spi_start_transfer_one(struct spi_device *spi, |
13838 |
+ |
13839 |
+ if (tspi->is_packed) |
13840 |
+ command1 |= SPI_PACKED; |
13841 |
++ else |
13842 |
++ command1 &= ~SPI_PACKED; |
13843 |
+ |
13844 |
+ command1 &= ~(SPI_CS_SEL_MASK | SPI_TX_EN | SPI_RX_EN); |
13845 |
+ tspi->cur_direction = 0; |
13846 |
+@@ -748,6 +802,9 @@ static int tegra_spi_start_transfer_one(struct spi_device *spi, |
13847 |
+ dev_dbg(tspi->dev, "The def 0x%x and written 0x%x\n", |
13848 |
+ tspi->def_command1_reg, (unsigned)command1); |
13849 |
+ |
13850 |
++ ret = tegra_spi_flush_fifos(tspi); |
13851 |
++ if (ret < 0) |
13852 |
++ return ret; |
13853 |
+ if (total_fifo_words > SPI_FIFO_DEPTH) |
13854 |
+ ret = tegra_spi_start_dma_based_transfer(tspi, t); |
13855 |
+ else |
13856 |
+@@ -838,7 +895,17 @@ static int tegra_spi_transfer_one_message(struct spi_master *master, |
13857 |
+ if (WARN_ON(ret == 0)) { |
13858 |
+ dev_err(tspi->dev, |
13859 |
+ "spi transfer timeout, err %d\n", ret); |
13860 |
++ if (tspi->is_curr_dma_xfer && |
13861 |
++ (tspi->cur_direction & DATA_DIR_TX)) |
13862 |
++ dmaengine_terminate_all(tspi->tx_dma_chan); |
13863 |
++ if (tspi->is_curr_dma_xfer && |
13864 |
++ (tspi->cur_direction & DATA_DIR_RX)) |
13865 |
++ dmaengine_terminate_all(tspi->rx_dma_chan); |
13866 |
+ ret = -EIO; |
13867 |
++ tegra_spi_flush_fifos(tspi); |
13868 |
++ reset_control_assert(tspi->rst); |
13869 |
++ udelay(2); |
13870 |
++ reset_control_deassert(tspi->rst); |
13871 |
+ goto complete_xfer; |
13872 |
+ } |
13873 |
+ |
13874 |
+@@ -889,6 +956,7 @@ static irqreturn_t handle_cpu_based_xfer(struct tegra_spi_data *tspi) |
13875 |
+ tspi->status_reg); |
13876 |
+ dev_err(tspi->dev, "CpuXfer 0x%08x:0x%08x\n", |
13877 |
+ tspi->command1_reg, tspi->dma_control_reg); |
13878 |
++ tegra_spi_flush_fifos(tspi); |
13879 |
+ reset_control_assert(tspi->rst); |
13880 |
+ udelay(2); |
13881 |
+ reset_control_deassert(tspi->rst); |
13882 |
+@@ -961,6 +1029,7 @@ static irqreturn_t handle_dma_based_xfer(struct tegra_spi_data *tspi) |
13883 |
+ tspi->status_reg); |
13884 |
+ dev_err(tspi->dev, "DmaXfer 0x%08x:0x%08x\n", |
13885 |
+ tspi->command1_reg, tspi->dma_control_reg); |
13886 |
++ tegra_spi_flush_fifos(tspi); |
13887 |
+ reset_control_assert(tspi->rst); |
13888 |
+ udelay(2); |
13889 |
+ reset_control_deassert(tspi->rst); |
13890 |
+diff --git a/drivers/spi/spi-topcliff-pch.c b/drivers/spi/spi-topcliff-pch.c |
13891 |
+index 4389ab80c23e..fa730a871d25 100644 |
13892 |
+--- a/drivers/spi/spi-topcliff-pch.c |
13893 |
++++ b/drivers/spi/spi-topcliff-pch.c |
13894 |
+@@ -1008,6 +1008,9 @@ static void pch_spi_handle_dma(struct pch_spi_data *data, int *bpw) |
13895 |
+ |
13896 |
+ /* RX */ |
13897 |
+ dma->sg_rx_p = kcalloc(num, sizeof(*dma->sg_rx_p), GFP_ATOMIC); |
13898 |
++ if (!dma->sg_rx_p) |
13899 |
++ return; |
13900 |
++ |
13901 |
+ sg_init_table(dma->sg_rx_p, num); /* Initialize SG table */ |
13902 |
+ /* offset, length setting */ |
13903 |
+ sg = dma->sg_rx_p; |
13904 |
+@@ -1068,6 +1071,9 @@ static void pch_spi_handle_dma(struct pch_spi_data *data, int *bpw) |
13905 |
+ } |
13906 |
+ |
13907 |
+ dma->sg_tx_p = kcalloc(num, sizeof(*dma->sg_tx_p), GFP_ATOMIC); |
13908 |
++ if (!dma->sg_tx_p) |
13909 |
++ return; |
13910 |
++ |
13911 |
+ sg_init_table(dma->sg_tx_p, num); /* Initialize SG table */ |
13912 |
+ /* offset, length setting */ |
13913 |
+ sg = dma->sg_tx_p; |
13914 |
+diff --git a/drivers/staging/android/vsoc.c b/drivers/staging/android/vsoc.c |
13915 |
+index 22571abcaa4e..034d86869772 100644 |
13916 |
+--- a/drivers/staging/android/vsoc.c |
13917 |
++++ b/drivers/staging/android/vsoc.c |
13918 |
+@@ -260,7 +260,8 @@ do_create_fd_scoped_permission(struct vsoc_device_region *region_p, |
13919 |
+ atomic_t *owner_ptr = NULL; |
13920 |
+ struct vsoc_device_region *managed_region_p; |
13921 |
+ |
13922 |
+- if (copy_from_user(&np->permission, &arg->perm, sizeof(*np)) || |
13923 |
++ if (copy_from_user(&np->permission, |
13924 |
++ &arg->perm, sizeof(np->permission)) || |
13925 |
+ copy_from_user(&managed_fd, |
13926 |
+ &arg->managed_region_fd, sizeof(managed_fd))) { |
13927 |
+ return -EFAULT; |
13928 |
+diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c |
13929 |
+index d799b1b55de3..747518c29542 100644 |
13930 |
+--- a/drivers/staging/comedi/drivers/ni_mio_common.c |
13931 |
++++ b/drivers/staging/comedi/drivers/ni_mio_common.c |
13932 |
+@@ -4984,7 +4984,10 @@ static int ni_valid_rtsi_output_source(struct comedi_device *dev, |
13933 |
+ case NI_RTSI_OUTPUT_G_SRC0: |
13934 |
+ case NI_RTSI_OUTPUT_G_GATE0: |
13935 |
+ case NI_RTSI_OUTPUT_RGOUT0: |
13936 |
+- case NI_RTSI_OUTPUT_RTSI_BRD_0: |
13937 |
++ case NI_RTSI_OUTPUT_RTSI_BRD(0): |
13938 |
++ case NI_RTSI_OUTPUT_RTSI_BRD(1): |
13939 |
++ case NI_RTSI_OUTPUT_RTSI_BRD(2): |
13940 |
++ case NI_RTSI_OUTPUT_RTSI_BRD(3): |
13941 |
+ return 1; |
13942 |
+ case NI_RTSI_OUTPUT_RTSI_OSC: |
13943 |
+ return (devpriv->is_m_series) ? 1 : 0; |
13944 |
+@@ -5005,11 +5008,18 @@ static int ni_set_rtsi_routing(struct comedi_device *dev, |
13945 |
+ devpriv->rtsi_trig_a_output_reg |= NISTC_RTSI_TRIG(chan, src); |
13946 |
+ ni_stc_writew(dev, devpriv->rtsi_trig_a_output_reg, |
13947 |
+ NISTC_RTSI_TRIGA_OUT_REG); |
13948 |
+- } else if (chan < 8) { |
13949 |
++ } else if (chan < NISTC_RTSI_TRIG_NUM_CHAN(devpriv->is_m_series)) { |
13950 |
+ devpriv->rtsi_trig_b_output_reg &= ~NISTC_RTSI_TRIG_MASK(chan); |
13951 |
+ devpriv->rtsi_trig_b_output_reg |= NISTC_RTSI_TRIG(chan, src); |
13952 |
+ ni_stc_writew(dev, devpriv->rtsi_trig_b_output_reg, |
13953 |
+ NISTC_RTSI_TRIGB_OUT_REG); |
13954 |
++ } else if (chan != NISTC_RTSI_TRIG_OLD_CLK_CHAN) { |
13955 |
++ /* probably should never reach this, since the |
13956 |
++ * ni_valid_rtsi_output_source above errors out if chan is too |
13957 |
++ * high |
13958 |
++ */ |
13959 |
++ dev_err(dev->class_dev, "%s: unknown rtsi channel\n", __func__); |
13960 |
++ return -EINVAL; |
13961 |
+ } |
13962 |
+ return 2; |
13963 |
+ } |
13964 |
+@@ -5025,12 +5035,12 @@ static unsigned int ni_get_rtsi_routing(struct comedi_device *dev, |
13965 |
+ } else if (chan < NISTC_RTSI_TRIG_NUM_CHAN(devpriv->is_m_series)) { |
13966 |
+ return NISTC_RTSI_TRIG_TO_SRC(chan, |
13967 |
+ devpriv->rtsi_trig_b_output_reg); |
13968 |
+- } else { |
13969 |
+- if (chan == NISTC_RTSI_TRIG_OLD_CLK_CHAN) |
13970 |
+- return NI_RTSI_OUTPUT_RTSI_OSC; |
13971 |
+- dev_err(dev->class_dev, "bug! should never get here?\n"); |
13972 |
+- return 0; |
13973 |
++ } else if (chan == NISTC_RTSI_TRIG_OLD_CLK_CHAN) { |
13974 |
++ return NI_RTSI_OUTPUT_RTSI_OSC; |
13975 |
+ } |
13976 |
++ |
13977 |
++ dev_err(dev->class_dev, "%s: unknown rtsi channel\n", __func__); |
13978 |
++ return -EINVAL; |
13979 |
+ } |
13980 |
+ |
13981 |
+ static int ni_rtsi_insn_config(struct comedi_device *dev, |
13982 |
+diff --git a/drivers/staging/greybus/light.c b/drivers/staging/greybus/light.c |
13983 |
+index 010ae1e9c7fb..40680eaf3974 100644 |
13984 |
+--- a/drivers/staging/greybus/light.c |
13985 |
++++ b/drivers/staging/greybus/light.c |
13986 |
+@@ -1098,21 +1098,21 @@ static void gb_lights_channel_release(struct gb_channel *channel) |
13987 |
+ static void gb_lights_light_release(struct gb_light *light) |
13988 |
+ { |
13989 |
+ int i; |
13990 |
+- int count; |
13991 |
+ |
13992 |
+ light->ready = false; |
13993 |
+ |
13994 |
+- count = light->channels_count; |
13995 |
+- |
13996 |
+ if (light->has_flash) |
13997 |
+ gb_lights_light_v4l2_unregister(light); |
13998 |
++ light->has_flash = false; |
13999 |
+ |
14000 |
+- for (i = 0; i < count; i++) { |
14001 |
++ for (i = 0; i < light->channels_count; i++) |
14002 |
+ gb_lights_channel_release(&light->channels[i]); |
14003 |
+- light->channels_count--; |
14004 |
+- } |
14005 |
++ light->channels_count = 0; |
14006 |
++ |
14007 |
+ kfree(light->channels); |
14008 |
++ light->channels = NULL; |
14009 |
+ kfree(light->name); |
14010 |
++ light->name = NULL; |
14011 |
+ } |
14012 |
+ |
14013 |
+ static void gb_lights_release(struct gb_lights *glights) |
14014 |
+diff --git a/drivers/staging/most/cdev/cdev.c b/drivers/staging/most/cdev/cdev.c |
14015 |
+index 0b48677fa958..27d58b55b810 100644 |
14016 |
+--- a/drivers/staging/most/cdev/cdev.c |
14017 |
++++ b/drivers/staging/most/cdev/cdev.c |
14018 |
+@@ -453,7 +453,9 @@ static int comp_probe(struct most_interface *iface, int channel_id, |
14019 |
+ c->devno = MKDEV(comp.major, current_minor); |
14020 |
+ cdev_init(&c->cdev, &channel_fops); |
14021 |
+ c->cdev.owner = THIS_MODULE; |
14022 |
+- cdev_add(&c->cdev, c->devno, 1); |
14023 |
++ retval = cdev_add(&c->cdev, c->devno, 1); |
14024 |
++ if (retval < 0) |
14025 |
++ goto err_free_c; |
14026 |
+ c->iface = iface; |
14027 |
+ c->cfg = cfg; |
14028 |
+ c->channel_id = channel_id; |
14029 |
+@@ -485,6 +487,7 @@ error_create_device: |
14030 |
+ list_del(&c->list); |
14031 |
+ error_alloc_kfifo: |
14032 |
+ cdev_del(&c->cdev); |
14033 |
++err_free_c: |
14034 |
+ kfree(c); |
14035 |
+ error_alloc_channel: |
14036 |
+ ida_simple_remove(&comp.minor_id, current_minor); |
14037 |
+diff --git a/drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_func_88xx.c b/drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_func_88xx.c |
14038 |
+index 53f55f129a76..ddbeff8224ab 100644 |
14039 |
+--- a/drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_func_88xx.c |
14040 |
++++ b/drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_func_88xx.c |
14041 |
+@@ -2466,8 +2466,11 @@ halmac_parse_psd_data_88xx(struct halmac_adapter *halmac_adapter, u8 *c2h_buf, |
14042 |
+ segment_size = (u8)PSD_DATA_GET_SEGMENT_SIZE(c2h_buf); |
14043 |
+ psd_set->data_size = total_size; |
14044 |
+ |
14045 |
+- if (!psd_set->data) |
14046 |
++ if (!psd_set->data) { |
14047 |
+ psd_set->data = kzalloc(psd_set->data_size, GFP_KERNEL); |
14048 |
++ if (!psd_set->data) |
14049 |
++ return HALMAC_RET_MALLOC_FAIL; |
14050 |
++ } |
14051 |
+ |
14052 |
+ if (segment_id == 0) |
14053 |
+ psd_set->segment_size = segment_size; |
14054 |
+diff --git a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c |
14055 |
+index 455082867246..edf25922b12d 100644 |
14056 |
+--- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c |
14057 |
++++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c |
14058 |
+@@ -47,6 +47,7 @@ MODULE_DESCRIPTION("Broadcom 2835 MMAL video capture"); |
14059 |
+ MODULE_AUTHOR("Vincent Sanders"); |
14060 |
+ MODULE_LICENSE("GPL"); |
14061 |
+ MODULE_VERSION(BM2835_MMAL_VERSION); |
14062 |
++MODULE_ALIAS("platform:bcm2835-camera"); |
14063 |
+ |
14064 |
+ int bcm2835_v4l2_debug; |
14065 |
+ module_param_named(debug, bcm2835_v4l2_debug, int, 0644); |
14066 |
+@@ -1854,6 +1855,12 @@ static int bcm2835_mmal_probe(struct platform_device *pdev) |
14067 |
+ num_cameras = get_num_cameras(instance, |
14068 |
+ resolutions, |
14069 |
+ MAX_BCM2835_CAMERAS); |
14070 |
++ |
14071 |
++ if (num_cameras < 1) { |
14072 |
++ ret = -ENODEV; |
14073 |
++ goto cleanup_mmal; |
14074 |
++ } |
14075 |
++ |
14076 |
+ if (num_cameras > MAX_BCM2835_CAMERAS) |
14077 |
+ num_cameras = MAX_BCM2835_CAMERAS; |
14078 |
+ |
14079 |
+@@ -1953,6 +1960,9 @@ cleanup_gdev: |
14080 |
+ pr_info("%s: error %d while loading driver\n", |
14081 |
+ BM2835_MMAL_MODULE_NAME, ret); |
14082 |
+ |
14083 |
++cleanup_mmal: |
14084 |
++ vchiq_mmal_finalise(instance); |
14085 |
++ |
14086 |
+ return ret; |
14087 |
+ } |
14088 |
+ |
14089 |
+diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c |
14090 |
+index e9ff2a7c0c0e..22e97a93728d 100644 |
14091 |
+--- a/drivers/target/target_core_device.c |
14092 |
++++ b/drivers/target/target_core_device.c |
14093 |
+@@ -85,7 +85,7 @@ transport_lookup_cmd_lun(struct se_cmd *se_cmd, u64 unpacked_lun) |
14094 |
+ goto out_unlock; |
14095 |
+ } |
14096 |
+ |
14097 |
+- se_cmd->se_lun = rcu_dereference(deve->se_lun); |
14098 |
++ se_cmd->se_lun = se_lun; |
14099 |
+ se_cmd->pr_res_key = deve->pr_res_key; |
14100 |
+ se_cmd->orig_fe_lun = unpacked_lun; |
14101 |
+ se_cmd->se_cmd_flags |= SCF_SE_LUN_CMD; |
14102 |
+@@ -176,7 +176,7 @@ int transport_lookup_tmr_lun(struct se_cmd *se_cmd, u64 unpacked_lun) |
14103 |
+ goto out_unlock; |
14104 |
+ } |
14105 |
+ |
14106 |
+- se_cmd->se_lun = rcu_dereference(deve->se_lun); |
14107 |
++ se_cmd->se_lun = se_lun; |
14108 |
+ se_cmd->pr_res_key = deve->pr_res_key; |
14109 |
+ se_cmd->orig_fe_lun = unpacked_lun; |
14110 |
+ se_cmd->se_cmd_flags |= SCF_SE_LUN_CMD; |
14111 |
+diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c |
14112 |
+index dfd23245f778..9df6b7260466 100644 |
14113 |
+--- a/drivers/thermal/cpu_cooling.c |
14114 |
++++ b/drivers/thermal/cpu_cooling.c |
14115 |
+@@ -458,7 +458,7 @@ static int cpufreq_get_requested_power(struct thermal_cooling_device *cdev, |
14116 |
+ load = 0; |
14117 |
+ |
14118 |
+ total_load += load; |
14119 |
+- if (trace_thermal_power_cpu_limit_enabled() && load_cpu) |
14120 |
++ if (load_cpu) |
14121 |
+ load_cpu[i] = load; |
14122 |
+ |
14123 |
+ i++; |
14124 |
+diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mtk_thermal.c |
14125 |
+index 0691f260f6ea..f64643629d8b 100644 |
14126 |
+--- a/drivers/thermal/mtk_thermal.c |
14127 |
++++ b/drivers/thermal/mtk_thermal.c |
14128 |
+@@ -431,7 +431,8 @@ static int mtk_thermal_bank_temperature(struct mtk_thermal_bank *bank) |
14129 |
+ u32 raw; |
14130 |
+ |
14131 |
+ for (i = 0; i < conf->bank_data[bank->id].num_sensors; i++) { |
14132 |
+- raw = readl(mt->thermal_base + conf->msr[i]); |
14133 |
++ raw = readl(mt->thermal_base + |
14134 |
++ conf->msr[conf->bank_data[bank->id].sensors[i]]); |
14135 |
+ |
14136 |
+ temp = raw_to_mcelsius(mt, |
14137 |
+ conf->bank_data[bank->id].sensors[i], |
14138 |
+@@ -568,7 +569,8 @@ static void mtk_thermal_init_bank(struct mtk_thermal *mt, int num, |
14139 |
+ |
14140 |
+ for (i = 0; i < conf->bank_data[num].num_sensors; i++) |
14141 |
+ writel(conf->sensor_mux_values[conf->bank_data[num].sensors[i]], |
14142 |
+- mt->thermal_base + conf->adcpnp[i]); |
14143 |
++ mt->thermal_base + |
14144 |
++ conf->adcpnp[conf->bank_data[num].sensors[i]]); |
14145 |
+ |
14146 |
+ writel((1 << conf->bank_data[num].num_sensors) - 1, |
14147 |
+ mt->thermal_base + TEMP_MONCTL0); |
14148 |
+diff --git a/drivers/thermal/rcar_gen3_thermal.c b/drivers/thermal/rcar_gen3_thermal.c |
14149 |
+index 704c8ad045bb..8f553453dd7f 100644 |
14150 |
+--- a/drivers/thermal/rcar_gen3_thermal.c |
14151 |
++++ b/drivers/thermal/rcar_gen3_thermal.c |
14152 |
+@@ -14,7 +14,6 @@ |
14153 |
+ #include <linux/of_device.h> |
14154 |
+ #include <linux/platform_device.h> |
14155 |
+ #include <linux/pm_runtime.h> |
14156 |
+-#include <linux/spinlock.h> |
14157 |
+ #include <linux/sys_soc.h> |
14158 |
+ #include <linux/thermal.h> |
14159 |
+ |
14160 |
+@@ -81,7 +80,6 @@ struct rcar_gen3_thermal_tsc { |
14161 |
+ struct rcar_gen3_thermal_priv { |
14162 |
+ struct rcar_gen3_thermal_tsc *tscs[TSC_MAX_NUM]; |
14163 |
+ unsigned int num_tscs; |
14164 |
+- spinlock_t lock; /* Protect interrupts on and off */ |
14165 |
+ void (*thermal_init)(struct rcar_gen3_thermal_tsc *tsc); |
14166 |
+ }; |
14167 |
+ |
14168 |
+@@ -231,38 +229,16 @@ static irqreturn_t rcar_gen3_thermal_irq(int irq, void *data) |
14169 |
+ { |
14170 |
+ struct rcar_gen3_thermal_priv *priv = data; |
14171 |
+ u32 status; |
14172 |
+- int i, ret = IRQ_HANDLED; |
14173 |
++ int i; |
14174 |
+ |
14175 |
+- spin_lock(&priv->lock); |
14176 |
+ for (i = 0; i < priv->num_tscs; i++) { |
14177 |
+ status = rcar_gen3_thermal_read(priv->tscs[i], REG_GEN3_IRQSTR); |
14178 |
+ rcar_gen3_thermal_write(priv->tscs[i], REG_GEN3_IRQSTR, 0); |
14179 |
+ if (status) |
14180 |
+- ret = IRQ_WAKE_THREAD; |
14181 |
++ thermal_zone_device_update(priv->tscs[i]->zone, |
14182 |
++ THERMAL_EVENT_UNSPECIFIED); |
14183 |
+ } |
14184 |
+ |
14185 |
+- if (ret == IRQ_WAKE_THREAD) |
14186 |
+- rcar_thermal_irq_set(priv, false); |
14187 |
+- |
14188 |
+- spin_unlock(&priv->lock); |
14189 |
+- |
14190 |
+- return ret; |
14191 |
+-} |
14192 |
+- |
14193 |
+-static irqreturn_t rcar_gen3_thermal_irq_thread(int irq, void *data) |
14194 |
+-{ |
14195 |
+- struct rcar_gen3_thermal_priv *priv = data; |
14196 |
+- unsigned long flags; |
14197 |
+- int i; |
14198 |
+- |
14199 |
+- for (i = 0; i < priv->num_tscs; i++) |
14200 |
+- thermal_zone_device_update(priv->tscs[i]->zone, |
14201 |
+- THERMAL_EVENT_UNSPECIFIED); |
14202 |
+- |
14203 |
+- spin_lock_irqsave(&priv->lock, flags); |
14204 |
+- rcar_thermal_irq_set(priv, true); |
14205 |
+- spin_unlock_irqrestore(&priv->lock, flags); |
14206 |
+- |
14207 |
+ return IRQ_HANDLED; |
14208 |
+ } |
14209 |
+ |
14210 |
+@@ -364,8 +340,6 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev) |
14211 |
+ if (soc_device_match(r8a7795es1)) |
14212 |
+ priv->thermal_init = rcar_gen3_thermal_init_r8a7795es1; |
14213 |
+ |
14214 |
+- spin_lock_init(&priv->lock); |
14215 |
+- |
14216 |
+ platform_set_drvdata(pdev, priv); |
14217 |
+ |
14218 |
+ /* |
14219 |
+@@ -383,9 +357,9 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev) |
14220 |
+ if (!irqname) |
14221 |
+ return -ENOMEM; |
14222 |
+ |
14223 |
+- ret = devm_request_threaded_irq(dev, irq, rcar_gen3_thermal_irq, |
14224 |
+- rcar_gen3_thermal_irq_thread, |
14225 |
+- IRQF_SHARED, irqname, priv); |
14226 |
++ ret = devm_request_threaded_irq(dev, irq, NULL, |
14227 |
++ rcar_gen3_thermal_irq, |
14228 |
++ IRQF_ONESHOT, irqname, priv); |
14229 |
+ if (ret) |
14230 |
+ return ret; |
14231 |
+ } |
14232 |
+diff --git a/drivers/tty/ipwireless/hardware.c b/drivers/tty/ipwireless/hardware.c |
14233 |
+index b0baa4ce10f9..6bbf35682d53 100644 |
14234 |
+--- a/drivers/tty/ipwireless/hardware.c |
14235 |
++++ b/drivers/tty/ipwireless/hardware.c |
14236 |
+@@ -1516,6 +1516,8 @@ static void ipw_send_setup_packet(struct ipw_hardware *hw) |
14237 |
+ sizeof(struct ipw_setup_get_version_query_packet), |
14238 |
+ ADDR_SETUP_PROT, TL_PROTOCOLID_SETUP, |
14239 |
+ TL_SETUP_SIGNO_GET_VERSION_QRY); |
14240 |
++ if (!ver_packet) |
14241 |
++ return; |
14242 |
+ ver_packet->header.length = sizeof(struct tl_setup_get_version_qry); |
14243 |
+ |
14244 |
+ /* |
14245 |
+diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c |
14246 |
+index ee8a5cb61a5f..2daccb10ae2f 100644 |
14247 |
+--- a/drivers/tty/serial/fsl_lpuart.c |
14248 |
++++ b/drivers/tty/serial/fsl_lpuart.c |
14249 |
+@@ -528,26 +528,26 @@ static int lpuart32_poll_init(struct uart_port *port) |
14250 |
+ spin_lock_irqsave(&sport->port.lock, flags); |
14251 |
+ |
14252 |
+ /* Disable Rx & Tx */ |
14253 |
+- writel(0, sport->port.membase + UARTCTRL); |
14254 |
++ lpuart32_write(&sport->port, UARTCTRL, 0); |
14255 |
+ |
14256 |
+- temp = readl(sport->port.membase + UARTFIFO); |
14257 |
++ temp = lpuart32_read(&sport->port, UARTFIFO); |
14258 |
+ |
14259 |
+ /* Enable Rx and Tx FIFO */ |
14260 |
+- writel(temp | UARTFIFO_RXFE | UARTFIFO_TXFE, |
14261 |
+- sport->port.membase + UARTFIFO); |
14262 |
++ lpuart32_write(&sport->port, UARTFIFO, |
14263 |
++ temp | UARTFIFO_RXFE | UARTFIFO_TXFE); |
14264 |
+ |
14265 |
+ /* flush Tx and Rx FIFO */ |
14266 |
+- writel(UARTFIFO_TXFLUSH | UARTFIFO_RXFLUSH, |
14267 |
+- sport->port.membase + UARTFIFO); |
14268 |
++ lpuart32_write(&sport->port, UARTFIFO, |
14269 |
++ UARTFIFO_TXFLUSH | UARTFIFO_RXFLUSH); |
14270 |
+ |
14271 |
+ /* explicitly clear RDRF */ |
14272 |
+- if (readl(sport->port.membase + UARTSTAT) & UARTSTAT_RDRF) { |
14273 |
+- readl(sport->port.membase + UARTDATA); |
14274 |
+- writel(UARTFIFO_RXUF, sport->port.membase + UARTFIFO); |
14275 |
++ if (lpuart32_read(&sport->port, UARTSTAT) & UARTSTAT_RDRF) { |
14276 |
++ lpuart32_read(&sport->port, UARTDATA); |
14277 |
++ lpuart32_write(&sport->port, UARTFIFO, UARTFIFO_RXUF); |
14278 |
+ } |
14279 |
+ |
14280 |
+ /* Enable Rx and Tx */ |
14281 |
+- writel(UARTCTRL_RE | UARTCTRL_TE, sport->port.membase + UARTCTRL); |
14282 |
++ lpuart32_write(&sport->port, UARTCTRL, UARTCTRL_RE | UARTCTRL_TE); |
14283 |
+ spin_unlock_irqrestore(&sport->port.lock, flags); |
14284 |
+ |
14285 |
+ return 0; |
14286 |
+@@ -555,18 +555,18 @@ static int lpuart32_poll_init(struct uart_port *port) |
14287 |
+ |
14288 |
+ static void lpuart32_poll_put_char(struct uart_port *port, unsigned char c) |
14289 |
+ { |
14290 |
+- while (!(readl(port->membase + UARTSTAT) & UARTSTAT_TDRE)) |
14291 |
++ while (!(lpuart32_read(port, UARTSTAT) & UARTSTAT_TDRE)) |
14292 |
+ barrier(); |
14293 |
+ |
14294 |
+- writel(c, port->membase + UARTDATA); |
14295 |
++ lpuart32_write(port, UARTDATA, c); |
14296 |
+ } |
14297 |
+ |
14298 |
+ static int lpuart32_poll_get_char(struct uart_port *port) |
14299 |
+ { |
14300 |
+- if (!(readl(port->membase + UARTSTAT) & UARTSTAT_RDRF)) |
14301 |
++ if (!(lpuart32_read(port, UARTSTAT) & UARTSTAT_RDRF)) |
14302 |
+ return NO_POLL_CHAR; |
14303 |
+ |
14304 |
+- return readl(port->membase + UARTDATA); |
14305 |
++ return lpuart32_read(port, UARTDATA); |
14306 |
+ } |
14307 |
+ #endif |
14308 |
+ |
14309 |
+diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c |
14310 |
+index e8d7a7bb4339..bce4ac1787ad 100644 |
14311 |
+--- a/drivers/tty/serial/stm32-usart.c |
14312 |
++++ b/drivers/tty/serial/stm32-usart.c |
14313 |
+@@ -105,9 +105,7 @@ static int stm32_config_rs485(struct uart_port *port, |
14314 |
+ struct stm32_usart_config *cfg = &stm32_port->info->cfg; |
14315 |
+ u32 usartdiv, baud, cr1, cr3; |
14316 |
+ bool over8; |
14317 |
+- unsigned long flags; |
14318 |
+ |
14319 |
+- spin_lock_irqsave(&port->lock, flags); |
14320 |
+ stm32_clr_bits(port, ofs->cr1, BIT(cfg->uart_enable_bit)); |
14321 |
+ |
14322 |
+ port->rs485 = *rs485conf; |
14323 |
+@@ -147,7 +145,6 @@ static int stm32_config_rs485(struct uart_port *port, |
14324 |
+ } |
14325 |
+ |
14326 |
+ stm32_set_bits(port, ofs->cr1, BIT(cfg->uart_enable_bit)); |
14327 |
+- spin_unlock_irqrestore(&port->lock, flags); |
14328 |
+ |
14329 |
+ return 0; |
14330 |
+ } |
14331 |
+@@ -194,8 +191,8 @@ static int stm32_pending_rx(struct uart_port *port, u32 *sr, int *last_res, |
14332 |
+ return 0; |
14333 |
+ } |
14334 |
+ |
14335 |
+-static unsigned long |
14336 |
+-stm32_get_char(struct uart_port *port, u32 *sr, int *last_res) |
14337 |
++static unsigned long stm32_get_char(struct uart_port *port, u32 *sr, |
14338 |
++ int *last_res) |
14339 |
+ { |
14340 |
+ struct stm32_port *stm32_port = to_stm32_port(port); |
14341 |
+ struct stm32_usart_offsets *ofs = &stm32_port->info->ofs; |
14342 |
+@@ -205,10 +202,13 @@ stm32_get_char(struct uart_port *port, u32 *sr, int *last_res) |
14343 |
+ c = stm32_port->rx_buf[RX_BUF_L - (*last_res)--]; |
14344 |
+ if ((*last_res) == 0) |
14345 |
+ *last_res = RX_BUF_L; |
14346 |
+- return c; |
14347 |
+ } else { |
14348 |
+- return readl_relaxed(port->membase + ofs->rdr); |
14349 |
++ c = readl_relaxed(port->membase + ofs->rdr); |
14350 |
++ /* apply RDR data mask */ |
14351 |
++ c &= stm32_port->rdr_mask; |
14352 |
+ } |
14353 |
++ |
14354 |
++ return c; |
14355 |
+ } |
14356 |
+ |
14357 |
+ static void stm32_receive_chars(struct uart_port *port, bool threaded) |
14358 |
+@@ -225,35 +225,51 @@ static void stm32_receive_chars(struct uart_port *port, bool threaded) |
14359 |
+ |
14360 |
+ while (stm32_pending_rx(port, &sr, &stm32_port->last_res, threaded)) { |
14361 |
+ sr |= USART_SR_DUMMY_RX; |
14362 |
+- c = stm32_get_char(port, &sr, &stm32_port->last_res); |
14363 |
+ flag = TTY_NORMAL; |
14364 |
+- port->icount.rx++; |
14365 |
+ |
14366 |
++ /* |
14367 |
++ * Status bits has to be cleared before reading the RDR: |
14368 |
++ * In FIFO mode, reading the RDR will pop the next data |
14369 |
++ * (if any) along with its status bits into the SR. |
14370 |
++ * Not doing so leads to misalignement between RDR and SR, |
14371 |
++ * and clear status bits of the next rx data. |
14372 |
++ * |
14373 |
++ * Clear errors flags for stm32f7 and stm32h7 compatible |
14374 |
++ * devices. On stm32f4 compatible devices, the error bit is |
14375 |
++ * cleared by the sequence [read SR - read DR]. |
14376 |
++ */ |
14377 |
++ if ((sr & USART_SR_ERR_MASK) && ofs->icr != UNDEF_REG) |
14378 |
++ writel_relaxed(sr & USART_SR_ERR_MASK, |
14379 |
++ port->membase + ofs->icr); |
14380 |
++ |
14381 |
++ c = stm32_get_char(port, &sr, &stm32_port->last_res); |
14382 |
++ port->icount.rx++; |
14383 |
+ if (sr & USART_SR_ERR_MASK) { |
14384 |
+- if (sr & USART_SR_LBD) { |
14385 |
+- port->icount.brk++; |
14386 |
+- if (uart_handle_break(port)) |
14387 |
+- continue; |
14388 |
+- } else if (sr & USART_SR_ORE) { |
14389 |
+- if (ofs->icr != UNDEF_REG) |
14390 |
+- writel_relaxed(USART_ICR_ORECF, |
14391 |
+- port->membase + |
14392 |
+- ofs->icr); |
14393 |
++ if (sr & USART_SR_ORE) { |
14394 |
+ port->icount.overrun++; |
14395 |
+ } else if (sr & USART_SR_PE) { |
14396 |
+ port->icount.parity++; |
14397 |
+ } else if (sr & USART_SR_FE) { |
14398 |
+- port->icount.frame++; |
14399 |
++ /* Break detection if character is null */ |
14400 |
++ if (!c) { |
14401 |
++ port->icount.brk++; |
14402 |
++ if (uart_handle_break(port)) |
14403 |
++ continue; |
14404 |
++ } else { |
14405 |
++ port->icount.frame++; |
14406 |
++ } |
14407 |
+ } |
14408 |
+ |
14409 |
+ sr &= port->read_status_mask; |
14410 |
+ |
14411 |
+- if (sr & USART_SR_LBD) |
14412 |
+- flag = TTY_BREAK; |
14413 |
+- else if (sr & USART_SR_PE) |
14414 |
++ if (sr & USART_SR_PE) { |
14415 |
+ flag = TTY_PARITY; |
14416 |
+- else if (sr & USART_SR_FE) |
14417 |
+- flag = TTY_FRAME; |
14418 |
++ } else if (sr & USART_SR_FE) { |
14419 |
++ if (!c) |
14420 |
++ flag = TTY_BREAK; |
14421 |
++ else |
14422 |
++ flag = TTY_FRAME; |
14423 |
++ } |
14424 |
+ } |
14425 |
+ |
14426 |
+ if (uart_handle_sysrq_char(port, c)) |
14427 |
+@@ -271,21 +287,6 @@ static void stm32_tx_dma_complete(void *arg) |
14428 |
+ struct uart_port *port = arg; |
14429 |
+ struct stm32_port *stm32port = to_stm32_port(port); |
14430 |
+ struct stm32_usart_offsets *ofs = &stm32port->info->ofs; |
14431 |
+- unsigned int isr; |
14432 |
+- int ret; |
14433 |
+- |
14434 |
+- ret = readl_relaxed_poll_timeout_atomic(port->membase + ofs->isr, |
14435 |
+- isr, |
14436 |
+- (isr & USART_SR_TC), |
14437 |
+- 10, 100000); |
14438 |
+- |
14439 |
+- if (ret) |
14440 |
+- dev_err(port->dev, "terminal count not set\n"); |
14441 |
+- |
14442 |
+- if (ofs->icr == UNDEF_REG) |
14443 |
+- stm32_clr_bits(port, ofs->isr, USART_SR_TC); |
14444 |
+- else |
14445 |
+- stm32_set_bits(port, ofs->icr, USART_CR_TC); |
14446 |
+ |
14447 |
+ stm32_clr_bits(port, ofs->cr3, USART_CR3_DMAT); |
14448 |
+ stm32port->tx_dma_busy = false; |
14449 |
+@@ -377,7 +378,6 @@ static void stm32_transmit_chars_dma(struct uart_port *port) |
14450 |
+ /* Issue pending DMA TX requests */ |
14451 |
+ dma_async_issue_pending(stm32port->tx_ch); |
14452 |
+ |
14453 |
+- stm32_clr_bits(port, ofs->isr, USART_SR_TC); |
14454 |
+ stm32_set_bits(port, ofs->cr3, USART_CR3_DMAT); |
14455 |
+ |
14456 |
+ xmit->tail = (xmit->tail + count) & (UART_XMIT_SIZE - 1); |
14457 |
+@@ -401,15 +401,15 @@ static void stm32_transmit_chars(struct uart_port *port) |
14458 |
+ return; |
14459 |
+ } |
14460 |
+ |
14461 |
+- if (uart_tx_stopped(port)) { |
14462 |
+- stm32_stop_tx(port); |
14463 |
++ if (uart_circ_empty(xmit) || uart_tx_stopped(port)) { |
14464 |
++ stm32_clr_bits(port, ofs->cr1, USART_CR1_TXEIE); |
14465 |
+ return; |
14466 |
+ } |
14467 |
+ |
14468 |
+- if (uart_circ_empty(xmit)) { |
14469 |
+- stm32_stop_tx(port); |
14470 |
+- return; |
14471 |
+- } |
14472 |
++ if (ofs->icr == UNDEF_REG) |
14473 |
++ stm32_clr_bits(port, ofs->isr, USART_SR_TC); |
14474 |
++ else |
14475 |
++ writel_relaxed(USART_ICR_TCCF, port->membase + ofs->icr); |
14476 |
+ |
14477 |
+ if (stm32_port->tx_ch) |
14478 |
+ stm32_transmit_chars_dma(port); |
14479 |
+@@ -420,7 +420,7 @@ static void stm32_transmit_chars(struct uart_port *port) |
14480 |
+ uart_write_wakeup(port); |
14481 |
+ |
14482 |
+ if (uart_circ_empty(xmit)) |
14483 |
+- stm32_stop_tx(port); |
14484 |
++ stm32_clr_bits(port, ofs->cr1, USART_CR1_TXEIE); |
14485 |
+ } |
14486 |
+ |
14487 |
+ static irqreturn_t stm32_interrupt(int irq, void *ptr) |
14488 |
+@@ -554,7 +554,6 @@ static int stm32_startup(struct uart_port *port) |
14489 |
+ { |
14490 |
+ struct stm32_port *stm32_port = to_stm32_port(port); |
14491 |
+ struct stm32_usart_offsets *ofs = &stm32_port->info->ofs; |
14492 |
+- struct stm32_usart_config *cfg = &stm32_port->info->cfg; |
14493 |
+ const char *name = to_platform_device(port->dev)->name; |
14494 |
+ u32 val; |
14495 |
+ int ret; |
14496 |
+@@ -565,15 +564,6 @@ static int stm32_startup(struct uart_port *port) |
14497 |
+ if (ret) |
14498 |
+ return ret; |
14499 |
+ |
14500 |
+- if (cfg->has_wakeup && stm32_port->wakeirq >= 0) { |
14501 |
+- ret = dev_pm_set_dedicated_wake_irq(port->dev, |
14502 |
+- stm32_port->wakeirq); |
14503 |
+- if (ret) { |
14504 |
+- free_irq(port->irq, port); |
14505 |
+- return ret; |
14506 |
+- } |
14507 |
+- } |
14508 |
+- |
14509 |
+ val = USART_CR1_RXNEIE | USART_CR1_TE | USART_CR1_RE; |
14510 |
+ if (stm32_port->fifoen) |
14511 |
+ val |= USART_CR1_FIFOEN; |
14512 |
+@@ -587,18 +577,56 @@ static void stm32_shutdown(struct uart_port *port) |
14513 |
+ struct stm32_port *stm32_port = to_stm32_port(port); |
14514 |
+ struct stm32_usart_offsets *ofs = &stm32_port->info->ofs; |
14515 |
+ struct stm32_usart_config *cfg = &stm32_port->info->cfg; |
14516 |
+- u32 val; |
14517 |
++ u32 val, isr; |
14518 |
++ int ret; |
14519 |
+ |
14520 |
+ val = USART_CR1_TXEIE | USART_CR1_RXNEIE | USART_CR1_TE | USART_CR1_RE; |
14521 |
+ val |= BIT(cfg->uart_enable_bit); |
14522 |
+ if (stm32_port->fifoen) |
14523 |
+ val |= USART_CR1_FIFOEN; |
14524 |
++ |
14525 |
++ ret = readl_relaxed_poll_timeout(port->membase + ofs->isr, |
14526 |
++ isr, (isr & USART_SR_TC), |
14527 |
++ 10, 100000); |
14528 |
++ |
14529 |
++ if (ret) |
14530 |
++ dev_err(port->dev, "transmission complete not set\n"); |
14531 |
++ |
14532 |
+ stm32_clr_bits(port, ofs->cr1, val); |
14533 |
+ |
14534 |
+- dev_pm_clear_wake_irq(port->dev); |
14535 |
+ free_irq(port->irq, port); |
14536 |
+ } |
14537 |
+ |
14538 |
++unsigned int stm32_get_databits(struct ktermios *termios) |
14539 |
++{ |
14540 |
++ unsigned int bits; |
14541 |
++ |
14542 |
++ tcflag_t cflag = termios->c_cflag; |
14543 |
++ |
14544 |
++ switch (cflag & CSIZE) { |
14545 |
++ /* |
14546 |
++ * CSIZE settings are not necessarily supported in hardware. |
14547 |
++ * CSIZE unsupported configurations are handled here to set word length |
14548 |
++ * to 8 bits word as default configuration and to print debug message. |
14549 |
++ */ |
14550 |
++ case CS5: |
14551 |
++ bits = 5; |
14552 |
++ break; |
14553 |
++ case CS6: |
14554 |
++ bits = 6; |
14555 |
++ break; |
14556 |
++ case CS7: |
14557 |
++ bits = 7; |
14558 |
++ break; |
14559 |
++ /* default including CS8 */ |
14560 |
++ default: |
14561 |
++ bits = 8; |
14562 |
++ break; |
14563 |
++ } |
14564 |
++ |
14565 |
++ return bits; |
14566 |
++} |
14567 |
++ |
14568 |
+ static void stm32_set_termios(struct uart_port *port, struct ktermios *termios, |
14569 |
+ struct ktermios *old) |
14570 |
+ { |
14571 |
+@@ -606,7 +634,7 @@ static void stm32_set_termios(struct uart_port *port, struct ktermios *termios, |
14572 |
+ struct stm32_usart_offsets *ofs = &stm32_port->info->ofs; |
14573 |
+ struct stm32_usart_config *cfg = &stm32_port->info->cfg; |
14574 |
+ struct serial_rs485 *rs485conf = &port->rs485; |
14575 |
+- unsigned int baud; |
14576 |
++ unsigned int baud, bits; |
14577 |
+ u32 usartdiv, mantissa, fraction, oversampling; |
14578 |
+ tcflag_t cflag = termios->c_cflag; |
14579 |
+ u32 cr1, cr2, cr3; |
14580 |
+@@ -632,16 +660,29 @@ static void stm32_set_termios(struct uart_port *port, struct ktermios *termios, |
14581 |
+ if (cflag & CSTOPB) |
14582 |
+ cr2 |= USART_CR2_STOP_2B; |
14583 |
+ |
14584 |
++ bits = stm32_get_databits(termios); |
14585 |
++ stm32_port->rdr_mask = (BIT(bits) - 1); |
14586 |
++ |
14587 |
+ if (cflag & PARENB) { |
14588 |
++ bits++; |
14589 |
+ cr1 |= USART_CR1_PCE; |
14590 |
+- if ((cflag & CSIZE) == CS8) { |
14591 |
+- if (cfg->has_7bits_data) |
14592 |
+- cr1 |= USART_CR1_M0; |
14593 |
+- else |
14594 |
+- cr1 |= USART_CR1_M; |
14595 |
+- } |
14596 |
+ } |
14597 |
+ |
14598 |
++ /* |
14599 |
++ * Word length configuration: |
14600 |
++ * CS8 + parity, 9 bits word aka [M1:M0] = 0b01 |
14601 |
++ * CS7 or (CS6 + parity), 7 bits word aka [M1:M0] = 0b10 |
14602 |
++ * CS8 or (CS7 + parity), 8 bits word aka [M1:M0] = 0b00 |
14603 |
++ * M0 and M1 already cleared by cr1 initialization. |
14604 |
++ */ |
14605 |
++ if (bits == 9) |
14606 |
++ cr1 |= USART_CR1_M0; |
14607 |
++ else if ((bits == 7) && cfg->has_7bits_data) |
14608 |
++ cr1 |= USART_CR1_M1; |
14609 |
++ else if (bits != 8) |
14610 |
++ dev_dbg(port->dev, "Unsupported data bits config: %u bits\n" |
14611 |
++ , bits); |
14612 |
++ |
14613 |
+ if (cflag & PARODD) |
14614 |
+ cr1 |= USART_CR1_PS; |
14615 |
+ |
14616 |
+@@ -679,14 +720,14 @@ static void stm32_set_termios(struct uart_port *port, struct ktermios *termios, |
14617 |
+ if (termios->c_iflag & INPCK) |
14618 |
+ port->read_status_mask |= USART_SR_PE | USART_SR_FE; |
14619 |
+ if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
14620 |
+- port->read_status_mask |= USART_SR_LBD; |
14621 |
++ port->read_status_mask |= USART_SR_FE; |
14622 |
+ |
14623 |
+ /* Characters to ignore */ |
14624 |
+ port->ignore_status_mask = 0; |
14625 |
+ if (termios->c_iflag & IGNPAR) |
14626 |
+ port->ignore_status_mask = USART_SR_PE | USART_SR_FE; |
14627 |
+ if (termios->c_iflag & IGNBRK) { |
14628 |
+- port->ignore_status_mask |= USART_SR_LBD; |
14629 |
++ port->ignore_status_mask |= USART_SR_FE; |
14630 |
+ /* |
14631 |
+ * If we're ignoring parity and break indicators, |
14632 |
+ * ignore overruns too (for real raw support). |
14633 |
+@@ -1024,11 +1065,18 @@ static int stm32_serial_probe(struct platform_device *pdev) |
14634 |
+ ret = device_init_wakeup(&pdev->dev, true); |
14635 |
+ if (ret) |
14636 |
+ goto err_uninit; |
14637 |
++ |
14638 |
++ ret = dev_pm_set_dedicated_wake_irq(&pdev->dev, |
14639 |
++ stm32port->wakeirq); |
14640 |
++ if (ret) |
14641 |
++ goto err_nowup; |
14642 |
++ |
14643 |
++ device_set_wakeup_enable(&pdev->dev, false); |
14644 |
+ } |
14645 |
+ |
14646 |
+ ret = uart_add_one_port(&stm32_usart_driver, &stm32port->port); |
14647 |
+ if (ret) |
14648 |
+- goto err_nowup; |
14649 |
++ goto err_wirq; |
14650 |
+ |
14651 |
+ ret = stm32_of_dma_rx_probe(stm32port, pdev); |
14652 |
+ if (ret) |
14653 |
+@@ -1042,6 +1090,10 @@ static int stm32_serial_probe(struct platform_device *pdev) |
14654 |
+ |
14655 |
+ return 0; |
14656 |
+ |
14657 |
++err_wirq: |
14658 |
++ if (stm32port->info->cfg.has_wakeup && stm32port->wakeirq >= 0) |
14659 |
++ dev_pm_clear_wake_irq(&pdev->dev); |
14660 |
++ |
14661 |
+ err_nowup: |
14662 |
+ if (stm32port->info->cfg.has_wakeup && stm32port->wakeirq >= 0) |
14663 |
+ device_init_wakeup(&pdev->dev, false); |
14664 |
+@@ -1079,8 +1131,10 @@ static int stm32_serial_remove(struct platform_device *pdev) |
14665 |
+ TX_BUF_L, stm32_port->tx_buf, |
14666 |
+ stm32_port->tx_dma_buf); |
14667 |
+ |
14668 |
+- if (cfg->has_wakeup && stm32_port->wakeirq >= 0) |
14669 |
++ if (cfg->has_wakeup && stm32_port->wakeirq >= 0) { |
14670 |
++ dev_pm_clear_wake_irq(&pdev->dev); |
14671 |
+ device_init_wakeup(&pdev->dev, false); |
14672 |
++ } |
14673 |
+ |
14674 |
+ clk_disable_unprepare(stm32_port->clk); |
14675 |
+ |
14676 |
+diff --git a/drivers/tty/serial/stm32-usart.h b/drivers/tty/serial/stm32-usart.h |
14677 |
+index 6f294e280ea3..30d2433e27c3 100644 |
14678 |
+--- a/drivers/tty/serial/stm32-usart.h |
14679 |
++++ b/drivers/tty/serial/stm32-usart.h |
14680 |
+@@ -108,7 +108,6 @@ struct stm32_usart_info stm32h7_info = { |
14681 |
+ #define USART_SR_RXNE BIT(5) |
14682 |
+ #define USART_SR_TC BIT(6) |
14683 |
+ #define USART_SR_TXE BIT(7) |
14684 |
+-#define USART_SR_LBD BIT(8) |
14685 |
+ #define USART_SR_CTSIF BIT(9) |
14686 |
+ #define USART_SR_CTS BIT(10) /* F7 */ |
14687 |
+ #define USART_SR_RTOF BIT(11) /* F7 */ |
14688 |
+@@ -120,8 +119,7 @@ struct stm32_usart_info stm32h7_info = { |
14689 |
+ #define USART_SR_SBKF BIT(18) /* F7 */ |
14690 |
+ #define USART_SR_WUF BIT(20) /* H7 */ |
14691 |
+ #define USART_SR_TEACK BIT(21) /* F7 */ |
14692 |
+-#define USART_SR_ERR_MASK (USART_SR_LBD | USART_SR_ORE | \ |
14693 |
+- USART_SR_FE | USART_SR_PE) |
14694 |
++#define USART_SR_ERR_MASK (USART_SR_ORE | USART_SR_FE | USART_SR_PE) |
14695 |
+ /* Dummy bits */ |
14696 |
+ #define USART_SR_DUMMY_RX BIT(16) |
14697 |
+ |
14698 |
+@@ -151,8 +149,7 @@ struct stm32_usart_info stm32h7_info = { |
14699 |
+ #define USART_CR1_PS BIT(9) |
14700 |
+ #define USART_CR1_PCE BIT(10) |
14701 |
+ #define USART_CR1_WAKE BIT(11) |
14702 |
+-#define USART_CR1_M BIT(12) |
14703 |
+-#define USART_CR1_M0 BIT(12) /* F7 */ |
14704 |
++#define USART_CR1_M0 BIT(12) /* F7 (CR1_M for F4) */ |
14705 |
+ #define USART_CR1_MME BIT(13) /* F7 */ |
14706 |
+ #define USART_CR1_CMIE BIT(14) /* F7 */ |
14707 |
+ #define USART_CR1_OVER8 BIT(15) |
14708 |
+@@ -169,8 +166,6 @@ struct stm32_usart_info stm32h7_info = { |
14709 |
+ /* USART_CR2 */ |
14710 |
+ #define USART_CR2_ADD_MASK GENMASK(3, 0) /* F4 */ |
14711 |
+ #define USART_CR2_ADDM7 BIT(4) /* F7 */ |
14712 |
+-#define USART_CR2_LBDL BIT(5) |
14713 |
+-#define USART_CR2_LBDIE BIT(6) |
14714 |
+ #define USART_CR2_LBCL BIT(8) |
14715 |
+ #define USART_CR2_CPHA BIT(9) |
14716 |
+ #define USART_CR2_CPOL BIT(10) |
14717 |
+@@ -227,12 +222,10 @@ struct stm32_usart_info stm32h7_info = { |
14718 |
+ |
14719 |
+ /* USART_ICR */ |
14720 |
+ #define USART_ICR_PECF BIT(0) /* F7 */ |
14721 |
+-#define USART_ICR_FFECF BIT(1) /* F7 */ |
14722 |
+-#define USART_ICR_NCF BIT(2) /* F7 */ |
14723 |
++#define USART_ICR_FECF BIT(1) /* F7 */ |
14724 |
+ #define USART_ICR_ORECF BIT(3) /* F7 */ |
14725 |
+ #define USART_ICR_IDLECF BIT(4) /* F7 */ |
14726 |
+ #define USART_ICR_TCCF BIT(6) /* F7 */ |
14727 |
+-#define USART_ICR_LBDCF BIT(8) /* F7 */ |
14728 |
+ #define USART_ICR_CTSCF BIT(9) /* F7 */ |
14729 |
+ #define USART_ICR_RTOCF BIT(11) /* F7 */ |
14730 |
+ #define USART_ICR_EOBCF BIT(12) /* F7 */ |
14731 |
+@@ -261,6 +254,7 @@ struct stm32_port { |
14732 |
+ bool hw_flow_control; |
14733 |
+ bool fifoen; |
14734 |
+ int wakeirq; |
14735 |
++ int rdr_mask; /* receive data register mask */ |
14736 |
+ }; |
14737 |
+ |
14738 |
+ static struct stm32_port stm32_ports[STM32_MAX_PORTS]; |
14739 |
+diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c |
14740 |
+index 2762148c169d..9c788748bdc6 100644 |
14741 |
+--- a/drivers/uio/uio.c |
14742 |
++++ b/drivers/uio/uio.c |
14743 |
+@@ -938,9 +938,12 @@ int __uio_register_device(struct module *owner, |
14744 |
+ atomic_set(&idev->event, 0); |
14745 |
+ |
14746 |
+ ret = uio_get_minor(idev); |
14747 |
+- if (ret) |
14748 |
++ if (ret) { |
14749 |
++ kfree(idev); |
14750 |
+ return ret; |
14751 |
++ } |
14752 |
+ |
14753 |
++ device_initialize(&idev->dev); |
14754 |
+ idev->dev.devt = MKDEV(uio_major, idev->minor); |
14755 |
+ idev->dev.class = &uio_class; |
14756 |
+ idev->dev.parent = parent; |
14757 |
+@@ -951,7 +954,7 @@ int __uio_register_device(struct module *owner, |
14758 |
+ if (ret) |
14759 |
+ goto err_device_create; |
14760 |
+ |
14761 |
+- ret = device_register(&idev->dev); |
14762 |
++ ret = device_add(&idev->dev); |
14763 |
+ if (ret) |
14764 |
+ goto err_device_create; |
14765 |
+ |
14766 |
+@@ -983,9 +986,10 @@ int __uio_register_device(struct module *owner, |
14767 |
+ err_request_irq: |
14768 |
+ uio_dev_del_attributes(idev); |
14769 |
+ err_uio_dev_add_attributes: |
14770 |
+- device_unregister(&idev->dev); |
14771 |
++ device_del(&idev->dev); |
14772 |
+ err_device_create: |
14773 |
+ uio_free_minor(idev); |
14774 |
++ put_device(&idev->dev); |
14775 |
+ return ret; |
14776 |
+ } |
14777 |
+ EXPORT_SYMBOL_GPL(__uio_register_device); |
14778 |
+diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c |
14779 |
+index b8a1fdefb515..4929c5883068 100644 |
14780 |
+--- a/drivers/usb/class/cdc-wdm.c |
14781 |
++++ b/drivers/usb/class/cdc-wdm.c |
14782 |
+@@ -1107,7 +1107,7 @@ static int wdm_post_reset(struct usb_interface *intf) |
14783 |
+ rv = recover_from_urb_loss(desc); |
14784 |
+ mutex_unlock(&desc->wlock); |
14785 |
+ mutex_unlock(&desc->rlock); |
14786 |
+- return 0; |
14787 |
++ return rv; |
14788 |
+ } |
14789 |
+ |
14790 |
+ static struct usb_driver wdm_driver = { |
14791 |
+diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c |
14792 |
+index 3f68edde0f03..f64d1cd08fb6 100644 |
14793 |
+--- a/drivers/usb/dwc2/gadget.c |
14794 |
++++ b/drivers/usb/dwc2/gadget.c |
14795 |
+@@ -2230,6 +2230,7 @@ static unsigned int dwc2_gadget_get_xfersize_ddma(struct dwc2_hsotg_ep *hs_ep) |
14796 |
+ if (status & DEV_DMA_STS_MASK) |
14797 |
+ dev_err(hsotg->dev, "descriptor %d closed with %x\n", |
14798 |
+ i, status & DEV_DMA_STS_MASK); |
14799 |
++ desc++; |
14800 |
+ } |
14801 |
+ |
14802 |
+ return bytes_rem; |
14803 |
+diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig |
14804 |
+index 518ead12458d..5d22f4bf2a9f 100644 |
14805 |
+--- a/drivers/usb/dwc3/Kconfig |
14806 |
++++ b/drivers/usb/dwc3/Kconfig |
14807 |
+@@ -52,7 +52,8 @@ comment "Platform Glue Driver Support" |
14808 |
+ |
14809 |
+ config USB_DWC3_OMAP |
14810 |
+ tristate "Texas Instruments OMAP5 and similar Platforms" |
14811 |
+- depends on EXTCON && (ARCH_OMAP2PLUS || COMPILE_TEST) |
14812 |
++ depends on ARCH_OMAP2PLUS || COMPILE_TEST |
14813 |
++ depends on EXTCON || !EXTCON |
14814 |
+ depends on OF |
14815 |
+ default USB_DWC3 |
14816 |
+ help |
14817 |
+@@ -114,6 +115,7 @@ config USB_DWC3_ST |
14818 |
+ config USB_DWC3_QCOM |
14819 |
+ tristate "Qualcomm Platform" |
14820 |
+ depends on ARCH_QCOM || COMPILE_TEST |
14821 |
++ depends on EXTCON || !EXTCON |
14822 |
+ depends on OF |
14823 |
+ default USB_DWC3 |
14824 |
+ help |
14825 |
+diff --git a/drivers/usb/gadget/udc/fsl_udc_core.c b/drivers/usb/gadget/udc/fsl_udc_core.c |
14826 |
+index d44b26d5b2a2..367697144cda 100644 |
14827 |
+--- a/drivers/usb/gadget/udc/fsl_udc_core.c |
14828 |
++++ b/drivers/usb/gadget/udc/fsl_udc_core.c |
14829 |
+@@ -2247,8 +2247,10 @@ static int struct_udc_setup(struct fsl_udc *udc, |
14830 |
+ udc->phy_mode = pdata->phy_mode; |
14831 |
+ |
14832 |
+ udc->eps = kcalloc(udc->max_ep, sizeof(struct fsl_ep), GFP_KERNEL); |
14833 |
+- if (!udc->eps) |
14834 |
+- return -1; |
14835 |
++ if (!udc->eps) { |
14836 |
++ ERR("kmalloc udc endpoint status failed\n"); |
14837 |
++ goto eps_alloc_failed; |
14838 |
++ } |
14839 |
+ |
14840 |
+ /* initialized QHs, take care of alignment */ |
14841 |
+ size = udc->max_ep * sizeof(struct ep_queue_head); |
14842 |
+@@ -2262,8 +2264,7 @@ static int struct_udc_setup(struct fsl_udc *udc, |
14843 |
+ &udc->ep_qh_dma, GFP_KERNEL); |
14844 |
+ if (!udc->ep_qh) { |
14845 |
+ ERR("malloc QHs for udc failed\n"); |
14846 |
+- kfree(udc->eps); |
14847 |
+- return -1; |
14848 |
++ goto ep_queue_alloc_failed; |
14849 |
+ } |
14850 |
+ |
14851 |
+ udc->ep_qh_size = size; |
14852 |
+@@ -2272,8 +2273,17 @@ static int struct_udc_setup(struct fsl_udc *udc, |
14853 |
+ /* FIXME: fsl_alloc_request() ignores ep argument */ |
14854 |
+ udc->status_req = container_of(fsl_alloc_request(NULL, GFP_KERNEL), |
14855 |
+ struct fsl_req, req); |
14856 |
++ if (!udc->status_req) { |
14857 |
++ ERR("kzalloc for udc status request failed\n"); |
14858 |
++ goto udc_status_alloc_failed; |
14859 |
++ } |
14860 |
++ |
14861 |
+ /* allocate a small amount of memory to get valid address */ |
14862 |
+ udc->status_req->req.buf = kmalloc(8, GFP_KERNEL); |
14863 |
++ if (!udc->status_req->req.buf) { |
14864 |
++ ERR("kzalloc for udc request buffer failed\n"); |
14865 |
++ goto udc_req_buf_alloc_failed; |
14866 |
++ } |
14867 |
+ |
14868 |
+ udc->resume_state = USB_STATE_NOTATTACHED; |
14869 |
+ udc->usb_state = USB_STATE_POWERED; |
14870 |
+@@ -2281,6 +2291,18 @@ static int struct_udc_setup(struct fsl_udc *udc, |
14871 |
+ udc->remote_wakeup = 0; /* default to 0 on reset */ |
14872 |
+ |
14873 |
+ return 0; |
14874 |
++ |
14875 |
++udc_req_buf_alloc_failed: |
14876 |
++ kfree(udc->status_req); |
14877 |
++udc_status_alloc_failed: |
14878 |
++ kfree(udc->ep_qh); |
14879 |
++ udc->ep_qh_size = 0; |
14880 |
++ep_queue_alloc_failed: |
14881 |
++ kfree(udc->eps); |
14882 |
++eps_alloc_failed: |
14883 |
++ udc->phy_mode = 0; |
14884 |
++ return -1; |
14885 |
++ |
14886 |
+ } |
14887 |
+ |
14888 |
+ /*---------------------------------------------------------------- |
14889 |
+diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c |
14890 |
+index 8f180bf7561a..9772c0de59b7 100644 |
14891 |
+--- a/drivers/usb/host/xhci-hub.c |
14892 |
++++ b/drivers/usb/host/xhci-hub.c |
14893 |
+@@ -1104,7 +1104,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, |
14894 |
+ } |
14895 |
+ port_li = readl(ports[wIndex]->addr + PORTLI); |
14896 |
+ status = xhci_get_ext_port_status(temp, port_li); |
14897 |
+- put_unaligned_le32(cpu_to_le32(status), &buf[4]); |
14898 |
++ put_unaligned_le32(status, &buf[4]); |
14899 |
+ } |
14900 |
+ break; |
14901 |
+ case SetPortFeature: |
14902 |
+diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig |
14903 |
+index 91ea3083e7ad..affb5393c4c6 100644 |
14904 |
+--- a/drivers/usb/phy/Kconfig |
14905 |
++++ b/drivers/usb/phy/Kconfig |
14906 |
+@@ -20,7 +20,7 @@ config AB8500_USB |
14907 |
+ in host mode, low speed. |
14908 |
+ |
14909 |
+ config FSL_USB2_OTG |
14910 |
+- bool "Freescale USB OTG Transceiver Driver" |
14911 |
++ tristate "Freescale USB OTG Transceiver Driver" |
14912 |
+ depends on USB_EHCI_FSL && USB_FSL_USB2 && USB_OTG_FSM=y && PM |
14913 |
+ depends on USB_GADGET || !USB_GADGET # if USB_GADGET=m, this can't be 'y' |
14914 |
+ select USB_PHY |
14915 |
+diff --git a/drivers/usb/phy/phy-twl6030-usb.c b/drivers/usb/phy/phy-twl6030-usb.c |
14916 |
+index 183550b63faa..dade34d70419 100644 |
14917 |
+--- a/drivers/usb/phy/phy-twl6030-usb.c |
14918 |
++++ b/drivers/usb/phy/phy-twl6030-usb.c |
14919 |
+@@ -400,7 +400,7 @@ static int twl6030_usb_remove(struct platform_device *pdev) |
14920 |
+ { |
14921 |
+ struct twl6030_usb *twl = platform_get_drvdata(pdev); |
14922 |
+ |
14923 |
+- cancel_delayed_work(&twl->get_status_work); |
14924 |
++ cancel_delayed_work_sync(&twl->get_status_work); |
14925 |
+ twl6030_interrupt_mask(TWL6030_USBOTG_INT_MASK, |
14926 |
+ REG_INT_MSK_LINE_C); |
14927 |
+ twl6030_interrupt_mask(TWL6030_USBOTG_INT_MASK, |
14928 |
+diff --git a/drivers/usb/typec/Kconfig b/drivers/usb/typec/Kconfig |
14929 |
+index 00878c386dd0..8445890accdf 100644 |
14930 |
+--- a/drivers/usb/typec/Kconfig |
14931 |
++++ b/drivers/usb/typec/Kconfig |
14932 |
+@@ -95,6 +95,7 @@ source "drivers/usb/typec/ucsi/Kconfig" |
14933 |
+ config TYPEC_TPS6598X |
14934 |
+ tristate "TI TPS6598x USB Power Delivery controller driver" |
14935 |
+ depends on I2C |
14936 |
++ select REGMAP_I2C |
14937 |
+ help |
14938 |
+ Say Y or M here if your system has TI TPS65982 or TPS65983 USB Power |
14939 |
+ Delivery controller. |
14940 |
+diff --git a/drivers/usb/typec/fusb302/fusb302.c b/drivers/usb/typec/fusb302/fusb302.c |
14941 |
+index 62a0060d39d8..c749ce486ec8 100644 |
14942 |
+--- a/drivers/usb/typec/fusb302/fusb302.c |
14943 |
++++ b/drivers/usb/typec/fusb302/fusb302.c |
14944 |
+@@ -990,13 +990,17 @@ done: |
14945 |
+ return ret; |
14946 |
+ } |
14947 |
+ |
14948 |
+-static int tcpm_start_drp_toggling(struct tcpc_dev *dev, |
14949 |
+- enum typec_cc_status cc) |
14950 |
++static int tcpm_start_toggling(struct tcpc_dev *dev, |
14951 |
++ enum typec_port_type port_type, |
14952 |
++ enum typec_cc_status cc) |
14953 |
+ { |
14954 |
+ struct fusb302_chip *chip = container_of(dev, struct fusb302_chip, |
14955 |
+ tcpc_dev); |
14956 |
+ int ret = 0; |
14957 |
+ |
14958 |
++ if (port_type != TYPEC_PORT_DRP) |
14959 |
++ return -EOPNOTSUPP; |
14960 |
++ |
14961 |
+ mutex_lock(&chip->lock); |
14962 |
+ ret = fusb302_set_src_current(chip, cc_src_current[cc]); |
14963 |
+ if (ret < 0) { |
14964 |
+@@ -1206,7 +1210,7 @@ static void init_tcpc_dev(struct tcpc_dev *fusb302_tcpc_dev) |
14965 |
+ fusb302_tcpc_dev->set_vbus = tcpm_set_vbus; |
14966 |
+ fusb302_tcpc_dev->set_pd_rx = tcpm_set_pd_rx; |
14967 |
+ fusb302_tcpc_dev->set_roles = tcpm_set_roles; |
14968 |
+- fusb302_tcpc_dev->start_drp_toggling = tcpm_start_drp_toggling; |
14969 |
++ fusb302_tcpc_dev->start_toggling = tcpm_start_toggling; |
14970 |
+ fusb302_tcpc_dev->pd_transmit = tcpm_pd_transmit; |
14971 |
+ } |
14972 |
+ |
14973 |
+diff --git a/drivers/usb/typec/tcpci.c b/drivers/usb/typec/tcpci.c |
14974 |
+index ac6b418b15f1..c1f7073a56de 100644 |
14975 |
+--- a/drivers/usb/typec/tcpci.c |
14976 |
++++ b/drivers/usb/typec/tcpci.c |
14977 |
+@@ -100,13 +100,17 @@ static int tcpci_set_cc(struct tcpc_dev *tcpc, enum typec_cc_status cc) |
14978 |
+ return 0; |
14979 |
+ } |
14980 |
+ |
14981 |
+-static int tcpci_start_drp_toggling(struct tcpc_dev *tcpc, |
14982 |
+- enum typec_cc_status cc) |
14983 |
++static int tcpci_start_toggling(struct tcpc_dev *tcpc, |
14984 |
++ enum typec_port_type port_type, |
14985 |
++ enum typec_cc_status cc) |
14986 |
+ { |
14987 |
+ int ret; |
14988 |
+ struct tcpci *tcpci = tcpc_to_tcpci(tcpc); |
14989 |
+ unsigned int reg = TCPC_ROLE_CTRL_DRP; |
14990 |
+ |
14991 |
++ if (port_type != TYPEC_PORT_DRP) |
14992 |
++ return -EOPNOTSUPP; |
14993 |
++ |
14994 |
+ /* Handle vendor drp toggling */ |
14995 |
+ if (tcpci->data->start_drp_toggling) { |
14996 |
+ ret = tcpci->data->start_drp_toggling(tcpci, tcpci->data, cc); |
14997 |
+@@ -511,7 +515,7 @@ struct tcpci *tcpci_register_port(struct device *dev, struct tcpci_data *data) |
14998 |
+ tcpci->tcpc.get_cc = tcpci_get_cc; |
14999 |
+ tcpci->tcpc.set_polarity = tcpci_set_polarity; |
15000 |
+ tcpci->tcpc.set_vconn = tcpci_set_vconn; |
15001 |
+- tcpci->tcpc.start_drp_toggling = tcpci_start_drp_toggling; |
15002 |
++ tcpci->tcpc.start_toggling = tcpci_start_toggling; |
15003 |
+ |
15004 |
+ tcpci->tcpc.set_pd_rx = tcpci_set_pd_rx; |
15005 |
+ tcpci->tcpc.set_roles = tcpci_set_roles; |
15006 |
+diff --git a/drivers/usb/typec/tcpm.c b/drivers/usb/typec/tcpm.c |
15007 |
+index 39cf19001239..29d72e9b0f01 100644 |
15008 |
+--- a/drivers/usb/typec/tcpm.c |
15009 |
++++ b/drivers/usb/typec/tcpm.c |
15010 |
+@@ -31,7 +31,7 @@ |
15011 |
+ |
15012 |
+ #define FOREACH_STATE(S) \ |
15013 |
+ S(INVALID_STATE), \ |
15014 |
+- S(DRP_TOGGLING), \ |
15015 |
++ S(TOGGLING), \ |
15016 |
+ S(SRC_UNATTACHED), \ |
15017 |
+ S(SRC_ATTACH_WAIT), \ |
15018 |
+ S(SRC_ATTACHED), \ |
15019 |
+@@ -473,7 +473,7 @@ static void tcpm_log(struct tcpm_port *port, const char *fmt, ...) |
15020 |
+ /* Do not log while disconnected and unattached */ |
15021 |
+ if (tcpm_port_is_disconnected(port) && |
15022 |
+ (port->state == SRC_UNATTACHED || port->state == SNK_UNATTACHED || |
15023 |
+- port->state == DRP_TOGGLING)) |
15024 |
++ port->state == TOGGLING)) |
15025 |
+ return; |
15026 |
+ |
15027 |
+ va_start(args, fmt); |
15028 |
+@@ -2561,20 +2561,16 @@ static int tcpm_set_charge(struct tcpm_port *port, bool charge) |
15029 |
+ return 0; |
15030 |
+ } |
15031 |
+ |
15032 |
+-static bool tcpm_start_drp_toggling(struct tcpm_port *port, |
15033 |
+- enum typec_cc_status cc) |
15034 |
++static bool tcpm_start_toggling(struct tcpm_port *port, enum typec_cc_status cc) |
15035 |
+ { |
15036 |
+ int ret; |
15037 |
+ |
15038 |
+- if (port->tcpc->start_drp_toggling && |
15039 |
+- port->port_type == TYPEC_PORT_DRP) { |
15040 |
+- tcpm_log_force(port, "Start DRP toggling"); |
15041 |
+- ret = port->tcpc->start_drp_toggling(port->tcpc, cc); |
15042 |
+- if (!ret) |
15043 |
+- return true; |
15044 |
+- } |
15045 |
++ if (!port->tcpc->start_toggling) |
15046 |
++ return false; |
15047 |
+ |
15048 |
+- return false; |
15049 |
++ tcpm_log_force(port, "Start toggling"); |
15050 |
++ ret = port->tcpc->start_toggling(port->tcpc, port->port_type, cc); |
15051 |
++ return ret == 0; |
15052 |
+ } |
15053 |
+ |
15054 |
+ static void tcpm_set_cc(struct tcpm_port *port, enum typec_cc_status cc) |
15055 |
+@@ -2868,15 +2864,15 @@ static void run_state_machine(struct tcpm_port *port) |
15056 |
+ |
15057 |
+ port->enter_state = port->state; |
15058 |
+ switch (port->state) { |
15059 |
+- case DRP_TOGGLING: |
15060 |
++ case TOGGLING: |
15061 |
+ break; |
15062 |
+ /* SRC states */ |
15063 |
+ case SRC_UNATTACHED: |
15064 |
+ if (!port->non_pd_role_swap) |
15065 |
+ tcpm_swap_complete(port, -ENOTCONN); |
15066 |
+ tcpm_src_detach(port); |
15067 |
+- if (tcpm_start_drp_toggling(port, tcpm_rp_cc(port))) { |
15068 |
+- tcpm_set_state(port, DRP_TOGGLING, 0); |
15069 |
++ if (tcpm_start_toggling(port, tcpm_rp_cc(port))) { |
15070 |
++ tcpm_set_state(port, TOGGLING, 0); |
15071 |
+ break; |
15072 |
+ } |
15073 |
+ tcpm_set_cc(port, tcpm_rp_cc(port)); |
15074 |
+@@ -3074,8 +3070,8 @@ static void run_state_machine(struct tcpm_port *port) |
15075 |
+ tcpm_swap_complete(port, -ENOTCONN); |
15076 |
+ tcpm_pps_complete(port, -ENOTCONN); |
15077 |
+ tcpm_snk_detach(port); |
15078 |
+- if (tcpm_start_drp_toggling(port, TYPEC_CC_RD)) { |
15079 |
+- tcpm_set_state(port, DRP_TOGGLING, 0); |
15080 |
++ if (tcpm_start_toggling(port, TYPEC_CC_RD)) { |
15081 |
++ tcpm_set_state(port, TOGGLING, 0); |
15082 |
+ break; |
15083 |
+ } |
15084 |
+ tcpm_set_cc(port, TYPEC_CC_RD); |
15085 |
+@@ -3642,7 +3638,7 @@ static void _tcpm_cc_change(struct tcpm_port *port, enum typec_cc_status cc1, |
15086 |
+ : "connected"); |
15087 |
+ |
15088 |
+ switch (port->state) { |
15089 |
+- case DRP_TOGGLING: |
15090 |
++ case TOGGLING: |
15091 |
+ if (tcpm_port_is_debug(port) || tcpm_port_is_audio(port) || |
15092 |
+ tcpm_port_is_source(port)) |
15093 |
+ tcpm_set_state(port, SRC_ATTACH_WAIT, 0); |
15094 |
+diff --git a/drivers/usb/typec/typec_wcove.c b/drivers/usb/typec/typec_wcove.c |
15095 |
+index 6770afd40765..f1f8f45e2f3d 100644 |
15096 |
+--- a/drivers/usb/typec/typec_wcove.c |
15097 |
++++ b/drivers/usb/typec/typec_wcove.c |
15098 |
+@@ -416,12 +416,16 @@ static int wcove_pd_transmit(struct tcpc_dev *tcpc, |
15099 |
+ return regmap_write(wcove->regmap, USBC_TXCMD, cmd | USBC_TXCMD_START); |
15100 |
+ } |
15101 |
+ |
15102 |
+-static int wcove_start_drp_toggling(struct tcpc_dev *tcpc, |
15103 |
+- enum typec_cc_status cc) |
15104 |
++static int wcove_start_toggling(struct tcpc_dev *tcpc, |
15105 |
++ enum typec_port_type port_type, |
15106 |
++ enum typec_cc_status cc) |
15107 |
+ { |
15108 |
+ struct wcove_typec *wcove = tcpc_to_wcove(tcpc); |
15109 |
+ unsigned int usbc_ctrl; |
15110 |
+ |
15111 |
++ if (port_type != TYPEC_PORT_DRP) |
15112 |
++ return -EOPNOTSUPP; |
15113 |
++ |
15114 |
+ usbc_ctrl = USBC_CONTROL1_MODE_DRP | USBC_CONTROL1_DRPTOGGLE_RANDOM; |
15115 |
+ |
15116 |
+ switch (cc) { |
15117 |
+@@ -642,7 +646,7 @@ static int wcove_typec_probe(struct platform_device *pdev) |
15118 |
+ wcove->tcpc.set_polarity = wcove_set_polarity; |
15119 |
+ wcove->tcpc.set_vconn = wcove_set_vconn; |
15120 |
+ wcove->tcpc.set_current_limit = wcove_set_current_limit; |
15121 |
+- wcove->tcpc.start_drp_toggling = wcove_start_drp_toggling; |
15122 |
++ wcove->tcpc.start_toggling = wcove_start_toggling; |
15123 |
+ |
15124 |
+ wcove->tcpc.set_pd_rx = wcove_set_pd_rx; |
15125 |
+ wcove->tcpc.set_roles = wcove_set_roles; |
15126 |
+diff --git a/drivers/vfio/mdev/mdev_core.c b/drivers/vfio/mdev/mdev_core.c |
15127 |
+index 0212f0ee8aea..e052f62fdea7 100644 |
15128 |
+--- a/drivers/vfio/mdev/mdev_core.c |
15129 |
++++ b/drivers/vfio/mdev/mdev_core.c |
15130 |
+@@ -150,10 +150,10 @@ static int mdev_device_remove_ops(struct mdev_device *mdev, bool force_remove) |
15131 |
+ |
15132 |
+ static int mdev_device_remove_cb(struct device *dev, void *data) |
15133 |
+ { |
15134 |
+- if (!dev_is_mdev(dev)) |
15135 |
+- return 0; |
15136 |
++ if (dev_is_mdev(dev)) |
15137 |
++ mdev_device_remove(dev, true); |
15138 |
+ |
15139 |
+- return mdev_device_remove(dev, data ? *(bool *)data : true); |
15140 |
++ return 0; |
15141 |
+ } |
15142 |
+ |
15143 |
+ /* |
15144 |
+@@ -182,6 +182,7 @@ int mdev_register_device(struct device *dev, const struct mdev_parent_ops *ops) |
15145 |
+ /* Check for duplicate */ |
15146 |
+ parent = __find_parent_device(dev); |
15147 |
+ if (parent) { |
15148 |
++ parent = NULL; |
15149 |
+ ret = -EEXIST; |
15150 |
+ goto add_dev_err; |
15151 |
+ } |
15152 |
+@@ -240,7 +241,6 @@ EXPORT_SYMBOL(mdev_register_device); |
15153 |
+ void mdev_unregister_device(struct device *dev) |
15154 |
+ { |
15155 |
+ struct mdev_parent *parent; |
15156 |
+- bool force_remove = true; |
15157 |
+ |
15158 |
+ mutex_lock(&parent_list_lock); |
15159 |
+ parent = __find_parent_device(dev); |
15160 |
+@@ -254,8 +254,7 @@ void mdev_unregister_device(struct device *dev) |
15161 |
+ list_del(&parent->next); |
15162 |
+ class_compat_remove_link(mdev_bus_compat_class, dev, NULL); |
15163 |
+ |
15164 |
+- device_for_each_child(dev, (void *)&force_remove, |
15165 |
+- mdev_device_remove_cb); |
15166 |
++ device_for_each_child(dev, NULL, mdev_device_remove_cb); |
15167 |
+ |
15168 |
+ parent_remove_sysfs_files(parent); |
15169 |
+ |
15170 |
+diff --git a/drivers/vfio/mdev/mdev_sysfs.c b/drivers/vfio/mdev/mdev_sysfs.c |
15171 |
+index 249472f05509..e7770b511d03 100644 |
15172 |
+--- a/drivers/vfio/mdev/mdev_sysfs.c |
15173 |
++++ b/drivers/vfio/mdev/mdev_sysfs.c |
15174 |
+@@ -280,7 +280,7 @@ type_link_failed: |
15175 |
+ |
15176 |
+ void mdev_remove_sysfs_files(struct device *dev, struct mdev_type *type) |
15177 |
+ { |
15178 |
++ sysfs_remove_files(&dev->kobj, mdev_device_attrs); |
15179 |
+ sysfs_remove_link(&dev->kobj, "mdev_type"); |
15180 |
+ sysfs_remove_link(type->devices_kobj, dev_name(dev)); |
15181 |
+- sysfs_remove_files(&dev->kobj, mdev_device_attrs); |
15182 |
+ } |
15183 |
+diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c |
15184 |
+index 0a6eb53e79fb..66783a37f450 100644 |
15185 |
+--- a/drivers/vfio/pci/vfio_pci.c |
15186 |
++++ b/drivers/vfio/pci/vfio_pci.c |
15187 |
+@@ -696,6 +696,7 @@ static long vfio_pci_ioctl(void *device_data, |
15188 |
+ { |
15189 |
+ void __iomem *io; |
15190 |
+ size_t size; |
15191 |
++ u16 orig_cmd; |
15192 |
+ |
15193 |
+ info.offset = VFIO_PCI_INDEX_TO_OFFSET(info.index); |
15194 |
+ info.flags = 0; |
15195 |
+@@ -711,15 +712,23 @@ static long vfio_pci_ioctl(void *device_data, |
15196 |
+ break; |
15197 |
+ } |
15198 |
+ |
15199 |
+- /* Is it really there? */ |
15200 |
++ /* |
15201 |
++ * Is it really there? Enable memory decode for |
15202 |
++ * implicit access in pci_map_rom(). |
15203 |
++ */ |
15204 |
++ pci_read_config_word(pdev, PCI_COMMAND, &orig_cmd); |
15205 |
++ pci_write_config_word(pdev, PCI_COMMAND, |
15206 |
++ orig_cmd | PCI_COMMAND_MEMORY); |
15207 |
++ |
15208 |
+ io = pci_map_rom(pdev, &size); |
15209 |
+- if (!io || !size) { |
15210 |
++ if (io) { |
15211 |
++ info.flags = VFIO_REGION_INFO_FLAG_READ; |
15212 |
++ pci_unmap_rom(pdev, io); |
15213 |
++ } else { |
15214 |
+ info.size = 0; |
15215 |
+- break; |
15216 |
+ } |
15217 |
+- pci_unmap_rom(pdev, io); |
15218 |
+ |
15219 |
+- info.flags = VFIO_REGION_INFO_FLAG_READ; |
15220 |
++ pci_write_config_word(pdev, PCI_COMMAND, orig_cmd); |
15221 |
+ break; |
15222 |
+ } |
15223 |
+ case VFIO_PCI_VGA_REGION_INDEX: |
15224 |
+diff --git a/drivers/vhost/test.c b/drivers/vhost/test.c |
15225 |
+index a9be2d8e98df..55090d9f9de0 100644 |
15226 |
+--- a/drivers/vhost/test.c |
15227 |
++++ b/drivers/vhost/test.c |
15228 |
+@@ -162,6 +162,7 @@ static int vhost_test_release(struct inode *inode, struct file *f) |
15229 |
+ |
15230 |
+ vhost_test_stop(n, &private); |
15231 |
+ vhost_test_flush(n); |
15232 |
++ vhost_dev_stop(&n->dev); |
15233 |
+ vhost_dev_cleanup(&n->dev); |
15234 |
+ /* We do an extra flush before freeing memory, |
15235 |
+ * since jobs can re-queue themselves. */ |
15236 |
+@@ -238,6 +239,7 @@ static long vhost_test_reset_owner(struct vhost_test *n) |
15237 |
+ } |
15238 |
+ vhost_test_stop(n, &priv); |
15239 |
+ vhost_test_flush(n); |
15240 |
++ vhost_dev_stop(&n->dev); |
15241 |
+ vhost_dev_reset_owner(&n->dev, umem); |
15242 |
+ done: |
15243 |
+ mutex_unlock(&n->dev.mutex); |
15244 |
+diff --git a/drivers/video/backlight/lm3630a_bl.c b/drivers/video/backlight/lm3630a_bl.c |
15245 |
+index 2030a6b77a09..ef2553f452ca 100644 |
15246 |
+--- a/drivers/video/backlight/lm3630a_bl.c |
15247 |
++++ b/drivers/video/backlight/lm3630a_bl.c |
15248 |
+@@ -201,7 +201,7 @@ static int lm3630a_bank_a_update_status(struct backlight_device *bl) |
15249 |
+ LM3630A_LEDA_ENABLE, LM3630A_LEDA_ENABLE); |
15250 |
+ if (ret < 0) |
15251 |
+ goto out_i2c_err; |
15252 |
+- return bl->props.brightness; |
15253 |
++ return 0; |
15254 |
+ |
15255 |
+ out_i2c_err: |
15256 |
+ dev_err(pchip->dev, "i2c failed to access\n"); |
15257 |
+@@ -278,7 +278,7 @@ static int lm3630a_bank_b_update_status(struct backlight_device *bl) |
15258 |
+ LM3630A_LEDB_ENABLE, LM3630A_LEDB_ENABLE); |
15259 |
+ if (ret < 0) |
15260 |
+ goto out_i2c_err; |
15261 |
+- return bl->props.brightness; |
15262 |
++ return 0; |
15263 |
+ |
15264 |
+ out_i2c_err: |
15265 |
+ dev_err(pchip->dev, "i2c failed to access REG_CTRL\n"); |
15266 |
+diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c |
15267 |
+index 7ddc0930e98c..3a3098d4873b 100644 |
15268 |
+--- a/drivers/video/backlight/pwm_bl.c |
15269 |
++++ b/drivers/video/backlight/pwm_bl.c |
15270 |
+@@ -199,29 +199,17 @@ int pwm_backlight_brightness_default(struct device *dev, |
15271 |
+ struct platform_pwm_backlight_data *data, |
15272 |
+ unsigned int period) |
15273 |
+ { |
15274 |
+- unsigned int counter = 0; |
15275 |
+- unsigned int i, n; |
15276 |
++ unsigned int i; |
15277 |
+ u64 retval; |
15278 |
+ |
15279 |
+ /* |
15280 |
+- * Count the number of bits needed to represent the period number. The |
15281 |
+- * number of bits is used to calculate the number of levels used for the |
15282 |
+- * brightness-levels table, the purpose of this calculation is have a |
15283 |
+- * pre-computed table with enough levels to get linear brightness |
15284 |
+- * perception. The period is divided by the number of bits so for a |
15285 |
+- * 8-bit PWM we have 255 / 8 = 32 brightness levels or for a 16-bit PWM |
15286 |
+- * we have 65535 / 16 = 4096 brightness levels. |
15287 |
+- * |
15288 |
+- * Note that this method is based on empirical testing on different |
15289 |
+- * devices with PWM of 8 and 16 bits of resolution. |
15290 |
++ * Once we have 4096 levels there's little point going much higher... |
15291 |
++ * neither interactive sliders nor animation benefits from having |
15292 |
++ * more values in the table. |
15293 |
+ */ |
15294 |
+- n = period; |
15295 |
+- while (n) { |
15296 |
+- counter += n % 2; |
15297 |
+- n >>= 1; |
15298 |
+- } |
15299 |
++ data->max_brightness = |
15300 |
++ min((int)DIV_ROUND_UP(period, fls(period)), 4096); |
15301 |
+ |
15302 |
+- data->max_brightness = DIV_ROUND_UP(period, counter); |
15303 |
+ data->levels = devm_kcalloc(dev, data->max_brightness, |
15304 |
+ sizeof(*data->levels), GFP_KERNEL); |
15305 |
+ if (!data->levels) |
15306 |
+diff --git a/drivers/video/fbdev/chipsfb.c b/drivers/video/fbdev/chipsfb.c |
15307 |
+index f103665cad43..f9b366d17587 100644 |
15308 |
+--- a/drivers/video/fbdev/chipsfb.c |
15309 |
++++ b/drivers/video/fbdev/chipsfb.c |
15310 |
+@@ -350,7 +350,7 @@ static void init_chips(struct fb_info *p, unsigned long addr) |
15311 |
+ static int chipsfb_pci_init(struct pci_dev *dp, const struct pci_device_id *ent) |
15312 |
+ { |
15313 |
+ struct fb_info *p; |
15314 |
+- unsigned long addr, size; |
15315 |
++ unsigned long addr; |
15316 |
+ unsigned short cmd; |
15317 |
+ int rc = -ENODEV; |
15318 |
+ |
15319 |
+@@ -362,7 +362,6 @@ static int chipsfb_pci_init(struct pci_dev *dp, const struct pci_device_id *ent) |
15320 |
+ if ((dp->resource[0].flags & IORESOURCE_MEM) == 0) |
15321 |
+ goto err_disable; |
15322 |
+ addr = pci_resource_start(dp, 0); |
15323 |
+- size = pci_resource_len(dp, 0); |
15324 |
+ if (addr == 0) |
15325 |
+ goto err_disable; |
15326 |
+ |
15327 |
+diff --git a/drivers/watchdog/rtd119x_wdt.c b/drivers/watchdog/rtd119x_wdt.c |
15328 |
+index d001c17ddfde..99caec6882d2 100644 |
15329 |
+--- a/drivers/watchdog/rtd119x_wdt.c |
15330 |
++++ b/drivers/watchdog/rtd119x_wdt.c |
15331 |
+@@ -135,7 +135,7 @@ static int rtd119x_wdt_probe(struct platform_device *pdev) |
15332 |
+ rtd119x_wdt_set_timeout(&data->wdt_dev, data->wdt_dev.timeout); |
15333 |
+ rtd119x_wdt_stop(&data->wdt_dev); |
15334 |
+ |
15335 |
+- ret = devm_watchdog_register_device(&pdev->dev, &data->wdt_dev); |
15336 |
++ ret = watchdog_register_device(&data->wdt_dev); |
15337 |
+ if (ret) { |
15338 |
+ clk_disable_unprepare(data->clk); |
15339 |
+ clk_put(data->clk); |
15340 |
+diff --git a/drivers/watchdog/sprd_wdt.c b/drivers/watchdog/sprd_wdt.c |
15341 |
+index ff9397d9638a..b6c65afd3677 100644 |
15342 |
+--- a/drivers/watchdog/sprd_wdt.c |
15343 |
++++ b/drivers/watchdog/sprd_wdt.c |
15344 |
+@@ -342,10 +342,9 @@ static int sprd_wdt_probe(struct platform_device *pdev) |
15345 |
+ |
15346 |
+ static int __maybe_unused sprd_wdt_pm_suspend(struct device *dev) |
15347 |
+ { |
15348 |
+- struct watchdog_device *wdd = dev_get_drvdata(dev); |
15349 |
+ struct sprd_wdt *wdt = dev_get_drvdata(dev); |
15350 |
+ |
15351 |
+- if (watchdog_active(wdd)) |
15352 |
++ if (watchdog_active(&wdt->wdd)) |
15353 |
+ sprd_wdt_stop(&wdt->wdd); |
15354 |
+ sprd_wdt_disable(wdt); |
15355 |
+ |
15356 |
+@@ -354,7 +353,6 @@ static int __maybe_unused sprd_wdt_pm_suspend(struct device *dev) |
15357 |
+ |
15358 |
+ static int __maybe_unused sprd_wdt_pm_resume(struct device *dev) |
15359 |
+ { |
15360 |
+- struct watchdog_device *wdd = dev_get_drvdata(dev); |
15361 |
+ struct sprd_wdt *wdt = dev_get_drvdata(dev); |
15362 |
+ int ret; |
15363 |
+ |
15364 |
+@@ -362,7 +360,7 @@ static int __maybe_unused sprd_wdt_pm_resume(struct device *dev) |
15365 |
+ if (ret) |
15366 |
+ return ret; |
15367 |
+ |
15368 |
+- if (watchdog_active(wdd)) { |
15369 |
++ if (watchdog_active(&wdt->wdd)) { |
15370 |
+ ret = sprd_wdt_start(&wdt->wdd); |
15371 |
+ if (ret) { |
15372 |
+ sprd_wdt_disable(wdt); |
15373 |
+diff --git a/drivers/xen/cpu_hotplug.c b/drivers/xen/cpu_hotplug.c |
15374 |
+index b1357aa4bc55..f192b6f42da9 100644 |
15375 |
+--- a/drivers/xen/cpu_hotplug.c |
15376 |
++++ b/drivers/xen/cpu_hotplug.c |
15377 |
+@@ -54,7 +54,7 @@ static int vcpu_online(unsigned int cpu) |
15378 |
+ } |
15379 |
+ static void vcpu_hotplug(unsigned int cpu) |
15380 |
+ { |
15381 |
+- if (!cpu_possible(cpu)) |
15382 |
++ if (cpu >= nr_cpu_ids || !cpu_possible(cpu)) |
15383 |
+ return; |
15384 |
+ |
15385 |
+ switch (vcpu_online(cpu)) { |
15386 |
+diff --git a/drivers/xen/pvcalls-back.c b/drivers/xen/pvcalls-back.c |
15387 |
+index d4ea33581ac2..b3fbfed28682 100644 |
15388 |
+--- a/drivers/xen/pvcalls-back.c |
15389 |
++++ b/drivers/xen/pvcalls-back.c |
15390 |
+@@ -784,7 +784,7 @@ static int pvcalls_back_poll(struct xenbus_device *dev, |
15391 |
+ mappass->reqcopy = *req; |
15392 |
+ icsk = inet_csk(mappass->sock->sk); |
15393 |
+ queue = &icsk->icsk_accept_queue; |
15394 |
+- data = queue->rskq_accept_head != NULL; |
15395 |
++ data = READ_ONCE(queue->rskq_accept_head) != NULL; |
15396 |
+ if (data) { |
15397 |
+ mappass->reqcopy.cmd = 0; |
15398 |
+ ret = 0; |
15399 |
+diff --git a/fs/affs/super.c b/fs/affs/super.c |
15400 |
+index d1ad11a8a4a5..b6ce0c36029b 100644 |
15401 |
+--- a/fs/affs/super.c |
15402 |
++++ b/fs/affs/super.c |
15403 |
+@@ -561,14 +561,9 @@ affs_remount(struct super_block *sb, int *flags, char *data) |
15404 |
+ int root_block; |
15405 |
+ unsigned long mount_flags; |
15406 |
+ int res = 0; |
15407 |
+- char *new_opts; |
15408 |
+ char volume[32]; |
15409 |
+ char *prefix = NULL; |
15410 |
+ |
15411 |
+- new_opts = kstrdup(data, GFP_KERNEL); |
15412 |
+- if (data && !new_opts) |
15413 |
+- return -ENOMEM; |
15414 |
+- |
15415 |
+ pr_debug("%s(flags=0x%x,opts=\"%s\")\n", __func__, *flags, data); |
15416 |
+ |
15417 |
+ sync_filesystem(sb); |
15418 |
+@@ -579,7 +574,6 @@ affs_remount(struct super_block *sb, int *flags, char *data) |
15419 |
+ &blocksize, &prefix, volume, |
15420 |
+ &mount_flags)) { |
15421 |
+ kfree(prefix); |
15422 |
+- kfree(new_opts); |
15423 |
+ return -EINVAL; |
15424 |
+ } |
15425 |
+ |
15426 |
+diff --git a/fs/afs/callback.c b/fs/afs/callback.c |
15427 |
+index 4ad701250299..97283b04fa6f 100644 |
15428 |
+--- a/fs/afs/callback.c |
15429 |
++++ b/fs/afs/callback.c |
15430 |
+@@ -221,14 +221,8 @@ void afs_break_callback(struct afs_vnode *vnode) |
15431 |
+ vnode->cb_break++; |
15432 |
+ afs_clear_permits(vnode); |
15433 |
+ |
15434 |
+- spin_lock(&vnode->lock); |
15435 |
+- |
15436 |
+- _debug("break callback"); |
15437 |
+- |
15438 |
+- if (list_empty(&vnode->granted_locks) && |
15439 |
+- !list_empty(&vnode->pending_locks)) |
15440 |
++ if (vnode->lock_state == AFS_VNODE_LOCK_WAITING_FOR_CB) |
15441 |
+ afs_lock_may_be_available(vnode); |
15442 |
+- spin_unlock(&vnode->lock); |
15443 |
+ } |
15444 |
+ |
15445 |
+ write_sequnlock(&vnode->cb_lock); |
15446 |
+diff --git a/fs/afs/dir_edit.c b/fs/afs/dir_edit.c |
15447 |
+index 8b400f5aead5..0e7162527db8 100644 |
15448 |
+--- a/fs/afs/dir_edit.c |
15449 |
++++ b/fs/afs/dir_edit.c |
15450 |
+@@ -72,13 +72,11 @@ static int afs_find_contig_bits(union afs_xdr_dir_block *block, unsigned int nr_ |
15451 |
+ static void afs_set_contig_bits(union afs_xdr_dir_block *block, |
15452 |
+ int bit, unsigned int nr_slots) |
15453 |
+ { |
15454 |
+- u64 mask, before, after; |
15455 |
++ u64 mask; |
15456 |
+ |
15457 |
+ mask = (1 << nr_slots) - 1; |
15458 |
+ mask <<= bit; |
15459 |
+ |
15460 |
+- before = *(u64 *)block->hdr.bitmap; |
15461 |
+- |
15462 |
+ block->hdr.bitmap[0] |= (u8)(mask >> 0 * 8); |
15463 |
+ block->hdr.bitmap[1] |= (u8)(mask >> 1 * 8); |
15464 |
+ block->hdr.bitmap[2] |= (u8)(mask >> 2 * 8); |
15465 |
+@@ -87,8 +85,6 @@ static void afs_set_contig_bits(union afs_xdr_dir_block *block, |
15466 |
+ block->hdr.bitmap[5] |= (u8)(mask >> 5 * 8); |
15467 |
+ block->hdr.bitmap[6] |= (u8)(mask >> 6 * 8); |
15468 |
+ block->hdr.bitmap[7] |= (u8)(mask >> 7 * 8); |
15469 |
+- |
15470 |
+- after = *(u64 *)block->hdr.bitmap; |
15471 |
+ } |
15472 |
+ |
15473 |
+ /* |
15474 |
+@@ -97,13 +93,11 @@ static void afs_set_contig_bits(union afs_xdr_dir_block *block, |
15475 |
+ static void afs_clear_contig_bits(union afs_xdr_dir_block *block, |
15476 |
+ int bit, unsigned int nr_slots) |
15477 |
+ { |
15478 |
+- u64 mask, before, after; |
15479 |
++ u64 mask; |
15480 |
+ |
15481 |
+ mask = (1 << nr_slots) - 1; |
15482 |
+ mask <<= bit; |
15483 |
+ |
15484 |
+- before = *(u64 *)block->hdr.bitmap; |
15485 |
+- |
15486 |
+ block->hdr.bitmap[0] &= ~(u8)(mask >> 0 * 8); |
15487 |
+ block->hdr.bitmap[1] &= ~(u8)(mask >> 1 * 8); |
15488 |
+ block->hdr.bitmap[2] &= ~(u8)(mask >> 2 * 8); |
15489 |
+@@ -112,8 +106,6 @@ static void afs_clear_contig_bits(union afs_xdr_dir_block *block, |
15490 |
+ block->hdr.bitmap[5] &= ~(u8)(mask >> 5 * 8); |
15491 |
+ block->hdr.bitmap[6] &= ~(u8)(mask >> 6 * 8); |
15492 |
+ block->hdr.bitmap[7] &= ~(u8)(mask >> 7 * 8); |
15493 |
+- |
15494 |
+- after = *(u64 *)block->hdr.bitmap; |
15495 |
+ } |
15496 |
+ |
15497 |
+ /* |
15498 |
+diff --git a/fs/afs/file.c b/fs/afs/file.c |
15499 |
+index 843d3b970b84..0bd78df6a64e 100644 |
15500 |
+--- a/fs/afs/file.c |
15501 |
++++ b/fs/afs/file.c |
15502 |
+@@ -169,11 +169,12 @@ int afs_release(struct inode *inode, struct file *file) |
15503 |
+ { |
15504 |
+ struct afs_vnode *vnode = AFS_FS_I(inode); |
15505 |
+ struct afs_file *af = file->private_data; |
15506 |
++ int ret = 0; |
15507 |
+ |
15508 |
+ _enter("{%x:%u},", vnode->fid.vid, vnode->fid.vnode); |
15509 |
+ |
15510 |
+ if ((file->f_mode & FMODE_WRITE)) |
15511 |
+- return vfs_fsync(file, 0); |
15512 |
++ ret = vfs_fsync(file, 0); |
15513 |
+ |
15514 |
+ file->private_data = NULL; |
15515 |
+ if (af->wb) |
15516 |
+@@ -181,8 +182,8 @@ int afs_release(struct inode *inode, struct file *file) |
15517 |
+ key_put(af->key); |
15518 |
+ kfree(af); |
15519 |
+ afs_prune_wb_keys(vnode); |
15520 |
+- _leave(" = 0"); |
15521 |
+- return 0; |
15522 |
++ _leave(" = %d", ret); |
15523 |
++ return ret; |
15524 |
+ } |
15525 |
+ |
15526 |
+ /* |
15527 |
+diff --git a/fs/afs/flock.c b/fs/afs/flock.c |
15528 |
+index 1bb300ef362b..fbf4986b1224 100644 |
15529 |
+--- a/fs/afs/flock.c |
15530 |
++++ b/fs/afs/flock.c |
15531 |
+@@ -13,9 +13,11 @@ |
15532 |
+ |
15533 |
+ #define AFS_LOCK_GRANTED 0 |
15534 |
+ #define AFS_LOCK_PENDING 1 |
15535 |
++#define AFS_LOCK_YOUR_TRY 2 |
15536 |
+ |
15537 |
+ struct workqueue_struct *afs_lock_manager; |
15538 |
+ |
15539 |
++static void afs_next_locker(struct afs_vnode *vnode, int error); |
15540 |
+ static void afs_fl_copy_lock(struct file_lock *new, struct file_lock *fl); |
15541 |
+ static void afs_fl_release_private(struct file_lock *fl); |
15542 |
+ |
15543 |
+@@ -24,6 +26,12 @@ static const struct file_lock_operations afs_lock_ops = { |
15544 |
+ .fl_release_private = afs_fl_release_private, |
15545 |
+ }; |
15546 |
+ |
15547 |
++static inline void afs_set_lock_state(struct afs_vnode *vnode, enum afs_lock_state state) |
15548 |
++{ |
15549 |
++ _debug("STATE %u -> %u", vnode->lock_state, state); |
15550 |
++ vnode->lock_state = state; |
15551 |
++} |
15552 |
++ |
15553 |
+ /* |
15554 |
+ * if the callback is broken on this vnode, then the lock may now be available |
15555 |
+ */ |
15556 |
+@@ -31,14 +39,17 @@ void afs_lock_may_be_available(struct afs_vnode *vnode) |
15557 |
+ { |
15558 |
+ _enter("{%x:%u}", vnode->fid.vid, vnode->fid.vnode); |
15559 |
+ |
15560 |
+- queue_delayed_work(afs_lock_manager, &vnode->lock_work, 0); |
15561 |
++ spin_lock(&vnode->lock); |
15562 |
++ if (vnode->lock_state == AFS_VNODE_LOCK_WAITING_FOR_CB) |
15563 |
++ afs_next_locker(vnode, 0); |
15564 |
++ spin_unlock(&vnode->lock); |
15565 |
+ } |
15566 |
+ |
15567 |
+ /* |
15568 |
+ * the lock will time out in 5 minutes unless we extend it, so schedule |
15569 |
+ * extension in a bit less than that time |
15570 |
+ */ |
15571 |
+-static void afs_schedule_lock_extension(struct afs_vnode *vnode) |
15572 |
++static void __maybe_unused afs_schedule_lock_extension(struct afs_vnode *vnode) |
15573 |
+ { |
15574 |
+ queue_delayed_work(afs_lock_manager, &vnode->lock_work, |
15575 |
+ AFS_LOCKWAIT * HZ / 2); |
15576 |
+@@ -49,22 +60,65 @@ static void afs_schedule_lock_extension(struct afs_vnode *vnode) |
15577 |
+ * first lock in the queue is itself a readlock) |
15578 |
+ * - the caller must hold the vnode lock |
15579 |
+ */ |
15580 |
+-static void afs_grant_locks(struct afs_vnode *vnode, struct file_lock *fl) |
15581 |
++static void afs_grant_locks(struct afs_vnode *vnode) |
15582 |
+ { |
15583 |
+ struct file_lock *p, *_p; |
15584 |
++ bool exclusive = (vnode->lock_type == AFS_LOCK_WRITE); |
15585 |
+ |
15586 |
+- list_move_tail(&fl->fl_u.afs.link, &vnode->granted_locks); |
15587 |
+- if (fl->fl_type == F_RDLCK) { |
15588 |
+- list_for_each_entry_safe(p, _p, &vnode->pending_locks, |
15589 |
+- fl_u.afs.link) { |
15590 |
+- if (p->fl_type == F_RDLCK) { |
15591 |
+- p->fl_u.afs.state = AFS_LOCK_GRANTED; |
15592 |
+- list_move_tail(&p->fl_u.afs.link, |
15593 |
+- &vnode->granted_locks); |
15594 |
+- wake_up(&p->fl_wait); |
15595 |
+- } |
15596 |
++ list_for_each_entry_safe(p, _p, &vnode->pending_locks, fl_u.afs.link) { |
15597 |
++ if (!exclusive && p->fl_type == F_WRLCK) |
15598 |
++ continue; |
15599 |
++ |
15600 |
++ list_move_tail(&p->fl_u.afs.link, &vnode->granted_locks); |
15601 |
++ p->fl_u.afs.state = AFS_LOCK_GRANTED; |
15602 |
++ wake_up(&p->fl_wait); |
15603 |
++ } |
15604 |
++} |
15605 |
++ |
15606 |
++/* |
15607 |
++ * If an error is specified, reject every pending lock that matches the |
15608 |
++ * authentication and type of the lock we failed to get. If there are any |
15609 |
++ * remaining lockers, try to wake up one of them to have a go. |
15610 |
++ */ |
15611 |
++static void afs_next_locker(struct afs_vnode *vnode, int error) |
15612 |
++{ |
15613 |
++ struct file_lock *p, *_p, *next = NULL; |
15614 |
++ struct key *key = vnode->lock_key; |
15615 |
++ unsigned int fl_type = F_RDLCK; |
15616 |
++ |
15617 |
++ _enter(""); |
15618 |
++ |
15619 |
++ if (vnode->lock_type == AFS_LOCK_WRITE) |
15620 |
++ fl_type = F_WRLCK; |
15621 |
++ |
15622 |
++ list_for_each_entry_safe(p, _p, &vnode->pending_locks, fl_u.afs.link) { |
15623 |
++ if (error && |
15624 |
++ p->fl_type == fl_type && |
15625 |
++ afs_file_key(p->fl_file) == key) { |
15626 |
++ list_del_init(&p->fl_u.afs.link); |
15627 |
++ p->fl_u.afs.state = error; |
15628 |
++ wake_up(&p->fl_wait); |
15629 |
+ } |
15630 |
++ |
15631 |
++ /* Select the next locker to hand off to. */ |
15632 |
++ if (next && |
15633 |
++ (next->fl_type == F_WRLCK || p->fl_type == F_RDLCK)) |
15634 |
++ continue; |
15635 |
++ next = p; |
15636 |
++ } |
15637 |
++ |
15638 |
++ vnode->lock_key = NULL; |
15639 |
++ key_put(key); |
15640 |
++ |
15641 |
++ if (next) { |
15642 |
++ afs_set_lock_state(vnode, AFS_VNODE_LOCK_SETTING); |
15643 |
++ next->fl_u.afs.state = AFS_LOCK_YOUR_TRY; |
15644 |
++ wake_up(&next->fl_wait); |
15645 |
++ } else { |
15646 |
++ afs_set_lock_state(vnode, AFS_VNODE_LOCK_NONE); |
15647 |
+ } |
15648 |
++ |
15649 |
++ _leave(""); |
15650 |
+ } |
15651 |
+ |
15652 |
+ /* |
15653 |
+@@ -170,8 +224,6 @@ void afs_lock_work(struct work_struct *work) |
15654 |
+ { |
15655 |
+ struct afs_vnode *vnode = |
15656 |
+ container_of(work, struct afs_vnode, lock_work.work); |
15657 |
+- struct file_lock *fl, *next; |
15658 |
+- afs_lock_type_t type; |
15659 |
+ struct key *key; |
15660 |
+ int ret; |
15661 |
+ |
15662 |
+@@ -184,7 +236,7 @@ again: |
15663 |
+ switch (vnode->lock_state) { |
15664 |
+ case AFS_VNODE_LOCK_NEED_UNLOCK: |
15665 |
+ _debug("unlock"); |
15666 |
+- vnode->lock_state = AFS_VNODE_LOCK_UNLOCKING; |
15667 |
++ afs_set_lock_state(vnode, AFS_VNODE_LOCK_UNLOCKING); |
15668 |
+ spin_unlock(&vnode->lock); |
15669 |
+ |
15670 |
+ /* attempt to release the server lock; if it fails, we just |
15671 |
+@@ -196,22 +248,9 @@ again: |
15672 |
+ vnode->fid.vid, vnode->fid.vnode, ret); |
15673 |
+ |
15674 |
+ spin_lock(&vnode->lock); |
15675 |
+- key_put(vnode->lock_key); |
15676 |
+- vnode->lock_key = NULL; |
15677 |
+- vnode->lock_state = AFS_VNODE_LOCK_NONE; |
15678 |
+- |
15679 |
+- if (list_empty(&vnode->pending_locks)) { |
15680 |
+- spin_unlock(&vnode->lock); |
15681 |
+- return; |
15682 |
+- } |
15683 |
+- |
15684 |
+- /* The new front of the queue now owns the state variables. */ |
15685 |
+- next = list_entry(vnode->pending_locks.next, |
15686 |
+- struct file_lock, fl_u.afs.link); |
15687 |
+- vnode->lock_key = key_get(afs_file_key(next->fl_file)); |
15688 |
+- vnode->lock_type = (next->fl_type == F_RDLCK) ? AFS_LOCK_READ : AFS_LOCK_WRITE; |
15689 |
+- vnode->lock_state = AFS_VNODE_LOCK_WAITING_FOR_CB; |
15690 |
+- goto again; |
15691 |
++ afs_next_locker(vnode, 0); |
15692 |
++ spin_unlock(&vnode->lock); |
15693 |
++ return; |
15694 |
+ |
15695 |
+ /* If we've already got a lock, then it must be time to extend that |
15696 |
+ * lock as AFS locks time out after 5 minutes. |
15697 |
+@@ -222,7 +261,7 @@ again: |
15698 |
+ ASSERT(!list_empty(&vnode->granted_locks)); |
15699 |
+ |
15700 |
+ key = key_get(vnode->lock_key); |
15701 |
+- vnode->lock_state = AFS_VNODE_LOCK_EXTENDING; |
15702 |
++ afs_set_lock_state(vnode, AFS_VNODE_LOCK_EXTENDING); |
15703 |
+ spin_unlock(&vnode->lock); |
15704 |
+ |
15705 |
+ ret = afs_extend_lock(vnode, key); /* RPC */ |
15706 |
+@@ -236,72 +275,26 @@ again: |
15707 |
+ |
15708 |
+ if (vnode->lock_state != AFS_VNODE_LOCK_EXTENDING) |
15709 |
+ goto again; |
15710 |
+- vnode->lock_state = AFS_VNODE_LOCK_GRANTED; |
15711 |
++ afs_set_lock_state(vnode, AFS_VNODE_LOCK_GRANTED); |
15712 |
+ |
15713 |
+- if (ret == 0) |
15714 |
+- afs_schedule_lock_extension(vnode); |
15715 |
+- else |
15716 |
++ if (ret != 0) |
15717 |
+ queue_delayed_work(afs_lock_manager, &vnode->lock_work, |
15718 |
+ HZ * 10); |
15719 |
+ spin_unlock(&vnode->lock); |
15720 |
+ _leave(" [ext]"); |
15721 |
+ return; |
15722 |
+ |
15723 |
+- /* If we don't have a granted lock, then we must've been called |
15724 |
+- * back by the server, and so if might be possible to get a |
15725 |
+- * lock we're currently waiting for. |
15726 |
+- */ |
15727 |
++ /* If we're waiting for a callback to indicate lock release, we can't |
15728 |
++ * actually rely on this, so need to recheck at regular intervals. The |
15729 |
++ * problem is that the server might not notify us if the lock just |
15730 |
++ * expires (say because a client died) rather than being explicitly |
15731 |
++ * released. |
15732 |
++ */ |
15733 |
+ case AFS_VNODE_LOCK_WAITING_FOR_CB: |
15734 |
+- _debug("get"); |
15735 |
+- |
15736 |
+- key = key_get(vnode->lock_key); |
15737 |
+- type = vnode->lock_type; |
15738 |
+- vnode->lock_state = AFS_VNODE_LOCK_SETTING; |
15739 |
++ _debug("retry"); |
15740 |
++ afs_next_locker(vnode, 0); |
15741 |
+ spin_unlock(&vnode->lock); |
15742 |
+- |
15743 |
+- ret = afs_set_lock(vnode, key, type); /* RPC */ |
15744 |
+- key_put(key); |
15745 |
+- |
15746 |
+- spin_lock(&vnode->lock); |
15747 |
+- switch (ret) { |
15748 |
+- case -EWOULDBLOCK: |
15749 |
+- _debug("blocked"); |
15750 |
+- break; |
15751 |
+- case 0: |
15752 |
+- _debug("acquired"); |
15753 |
+- vnode->lock_state = AFS_VNODE_LOCK_GRANTED; |
15754 |
+- /* Fall through */ |
15755 |
+- default: |
15756 |
+- /* Pass the lock or the error onto the first locker in |
15757 |
+- * the list - if they're looking for this type of lock. |
15758 |
+- * If they're not, we assume that whoever asked for it |
15759 |
+- * took a signal. |
15760 |
+- */ |
15761 |
+- if (list_empty(&vnode->pending_locks)) { |
15762 |
+- _debug("withdrawn"); |
15763 |
+- vnode->lock_state = AFS_VNODE_LOCK_NEED_UNLOCK; |
15764 |
+- goto again; |
15765 |
+- } |
15766 |
+- |
15767 |
+- fl = list_entry(vnode->pending_locks.next, |
15768 |
+- struct file_lock, fl_u.afs.link); |
15769 |
+- type = (fl->fl_type == F_RDLCK) ? AFS_LOCK_READ : AFS_LOCK_WRITE; |
15770 |
+- if (vnode->lock_type != type) { |
15771 |
+- _debug("changed"); |
15772 |
+- vnode->lock_state = AFS_VNODE_LOCK_NEED_UNLOCK; |
15773 |
+- goto again; |
15774 |
+- } |
15775 |
+- |
15776 |
+- fl->fl_u.afs.state = ret; |
15777 |
+- if (ret == 0) |
15778 |
+- afs_grant_locks(vnode, fl); |
15779 |
+- else |
15780 |
+- list_del_init(&fl->fl_u.afs.link); |
15781 |
+- wake_up(&fl->fl_wait); |
15782 |
+- spin_unlock(&vnode->lock); |
15783 |
+- _leave(" [granted]"); |
15784 |
+- return; |
15785 |
+- } |
15786 |
++ return; |
15787 |
+ |
15788 |
+ default: |
15789 |
+ /* Looks like a lock request was withdrawn. */ |
15790 |
+@@ -319,14 +312,15 @@ again: |
15791 |
+ */ |
15792 |
+ static void afs_defer_unlock(struct afs_vnode *vnode) |
15793 |
+ { |
15794 |
+- _enter(""); |
15795 |
++ _enter("%u", vnode->lock_state); |
15796 |
+ |
15797 |
+- if (vnode->lock_state == AFS_VNODE_LOCK_GRANTED || |
15798 |
+- vnode->lock_state == AFS_VNODE_LOCK_EXTENDING) { |
15799 |
++ if (list_empty(&vnode->granted_locks) && |
15800 |
++ (vnode->lock_state == AFS_VNODE_LOCK_GRANTED || |
15801 |
++ vnode->lock_state == AFS_VNODE_LOCK_EXTENDING)) { |
15802 |
+ cancel_delayed_work(&vnode->lock_work); |
15803 |
+ |
15804 |
+- vnode->lock_state = AFS_VNODE_LOCK_NEED_UNLOCK; |
15805 |
+- afs_lock_may_be_available(vnode); |
15806 |
++ afs_set_lock_state(vnode, AFS_VNODE_LOCK_NEED_UNLOCK); |
15807 |
++ queue_delayed_work(afs_lock_manager, &vnode->lock_work, 0); |
15808 |
+ } |
15809 |
+ } |
15810 |
+ |
15811 |
+@@ -375,50 +369,6 @@ static int afs_do_setlk_check(struct afs_vnode *vnode, struct key *key, |
15812 |
+ return 0; |
15813 |
+ } |
15814 |
+ |
15815 |
+-/* |
15816 |
+- * Remove the front runner from the pending queue. |
15817 |
+- * - The caller must hold vnode->lock. |
15818 |
+- */ |
15819 |
+-static void afs_dequeue_lock(struct afs_vnode *vnode, struct file_lock *fl) |
15820 |
+-{ |
15821 |
+- struct file_lock *next; |
15822 |
+- |
15823 |
+- _enter(""); |
15824 |
+- |
15825 |
+- /* ->lock_type, ->lock_key and ->lock_state only belong to this |
15826 |
+- * file_lock if we're at the front of the pending queue or if we have |
15827 |
+- * the lock granted or if the lock_state is NEED_UNLOCK or UNLOCKING. |
15828 |
+- */ |
15829 |
+- if (vnode->granted_locks.next == &fl->fl_u.afs.link && |
15830 |
+- vnode->granted_locks.prev == &fl->fl_u.afs.link) { |
15831 |
+- list_del_init(&fl->fl_u.afs.link); |
15832 |
+- afs_defer_unlock(vnode); |
15833 |
+- return; |
15834 |
+- } |
15835 |
+- |
15836 |
+- if (!list_empty(&vnode->granted_locks) || |
15837 |
+- vnode->pending_locks.next != &fl->fl_u.afs.link) { |
15838 |
+- list_del_init(&fl->fl_u.afs.link); |
15839 |
+- return; |
15840 |
+- } |
15841 |
+- |
15842 |
+- list_del_init(&fl->fl_u.afs.link); |
15843 |
+- key_put(vnode->lock_key); |
15844 |
+- vnode->lock_key = NULL; |
15845 |
+- vnode->lock_state = AFS_VNODE_LOCK_NONE; |
15846 |
+- |
15847 |
+- if (list_empty(&vnode->pending_locks)) |
15848 |
+- return; |
15849 |
+- |
15850 |
+- /* The new front of the queue now owns the state variables. */ |
15851 |
+- next = list_entry(vnode->pending_locks.next, |
15852 |
+- struct file_lock, fl_u.afs.link); |
15853 |
+- vnode->lock_key = key_get(afs_file_key(next->fl_file)); |
15854 |
+- vnode->lock_type = (next->fl_type == F_RDLCK) ? AFS_LOCK_READ : AFS_LOCK_WRITE; |
15855 |
+- vnode->lock_state = AFS_VNODE_LOCK_WAITING_FOR_CB; |
15856 |
+- afs_lock_may_be_available(vnode); |
15857 |
+-} |
15858 |
+- |
15859 |
+ /* |
15860 |
+ * request a lock on a file on the server |
15861 |
+ */ |
15862 |
+@@ -432,10 +382,6 @@ static int afs_do_setlk(struct file *file, struct file_lock *fl) |
15863 |
+ |
15864 |
+ _enter("{%x:%u},%u", vnode->fid.vid, vnode->fid.vnode, fl->fl_type); |
15865 |
+ |
15866 |
+- /* only whole-file locks are supported */ |
15867 |
+- if (fl->fl_start != 0 || fl->fl_end != OFFSET_MAX) |
15868 |
+- return -EINVAL; |
15869 |
+- |
15870 |
+ fl->fl_ops = &afs_lock_ops; |
15871 |
+ INIT_LIST_HEAD(&fl->fl_u.afs.link); |
15872 |
+ fl->fl_u.afs.state = AFS_LOCK_PENDING; |
15873 |
+@@ -447,44 +393,66 @@ static int afs_do_setlk(struct file *file, struct file_lock *fl) |
15874 |
+ return ret; |
15875 |
+ |
15876 |
+ spin_lock(&vnode->lock); |
15877 |
++ list_add_tail(&fl->fl_u.afs.link, &vnode->pending_locks); |
15878 |
+ |
15879 |
+- /* If we've already got a readlock on the server then we instantly |
15880 |
+- * grant another readlock, irrespective of whether there are any |
15881 |
+- * pending writelocks. |
15882 |
++ /* If we've already got a lock on the server then try to move to having |
15883 |
++ * the VFS grant the requested lock. Note that this means that other |
15884 |
++ * clients may get starved out. |
15885 |
+ */ |
15886 |
+- if (type == AFS_LOCK_READ && |
15887 |
+- vnode->lock_state == AFS_VNODE_LOCK_GRANTED && |
15888 |
+- vnode->lock_type == AFS_LOCK_READ) { |
15889 |
+- _debug("instant readlock"); |
15890 |
+- ASSERT(!list_empty(&vnode->granted_locks)); |
15891 |
+- goto share_existing_lock; |
15892 |
+- } |
15893 |
++ _debug("try %u", vnode->lock_state); |
15894 |
++ if (vnode->lock_state == AFS_VNODE_LOCK_GRANTED) { |
15895 |
++ if (type == AFS_LOCK_READ) { |
15896 |
++ _debug("instant readlock"); |
15897 |
++ list_move_tail(&fl->fl_u.afs.link, &vnode->granted_locks); |
15898 |
++ fl->fl_u.afs.state = AFS_LOCK_GRANTED; |
15899 |
++ goto vnode_is_locked_u; |
15900 |
++ } |
15901 |
+ |
15902 |
+- list_add_tail(&fl->fl_u.afs.link, &vnode->pending_locks); |
15903 |
++ if (vnode->lock_type == AFS_LOCK_WRITE) { |
15904 |
++ _debug("instant writelock"); |
15905 |
++ list_move_tail(&fl->fl_u.afs.link, &vnode->granted_locks); |
15906 |
++ fl->fl_u.afs.state = AFS_LOCK_GRANTED; |
15907 |
++ goto vnode_is_locked_u; |
15908 |
++ } |
15909 |
++ } |
15910 |
+ |
15911 |
+ if (vnode->lock_state != AFS_VNODE_LOCK_NONE) |
15912 |
+ goto need_to_wait; |
15913 |
+ |
15914 |
++try_to_lock: |
15915 |
+ /* We don't have a lock on this vnode and we aren't currently waiting |
15916 |
+ * for one either, so ask the server for a lock. |
15917 |
+ * |
15918 |
+ * Note that we need to be careful if we get interrupted by a signal |
15919 |
+ * after dispatching the request as we may still get the lock, even |
15920 |
+ * though we don't wait for the reply (it's not too bad a problem - the |
15921 |
+- * lock will expire in 10 mins anyway). |
15922 |
++ * lock will expire in 5 mins anyway). |
15923 |
+ */ |
15924 |
+ _debug("not locked"); |
15925 |
+ vnode->lock_key = key_get(key); |
15926 |
+ vnode->lock_type = type; |
15927 |
+- vnode->lock_state = AFS_VNODE_LOCK_SETTING; |
15928 |
++ afs_set_lock_state(vnode, AFS_VNODE_LOCK_SETTING); |
15929 |
+ spin_unlock(&vnode->lock); |
15930 |
+ |
15931 |
+ ret = afs_set_lock(vnode, key, type); /* RPC */ |
15932 |
+ |
15933 |
+ spin_lock(&vnode->lock); |
15934 |
+ switch (ret) { |
15935 |
++ case -EKEYREJECTED: |
15936 |
++ case -EKEYEXPIRED: |
15937 |
++ case -EKEYREVOKED: |
15938 |
++ case -EPERM: |
15939 |
++ case -EACCES: |
15940 |
++ fl->fl_u.afs.state = ret; |
15941 |
++ list_del_init(&fl->fl_u.afs.link); |
15942 |
++ afs_next_locker(vnode, ret); |
15943 |
++ goto error_unlock; |
15944 |
++ |
15945 |
+ default: |
15946 |
+- goto abort_attempt; |
15947 |
++ fl->fl_u.afs.state = ret; |
15948 |
++ list_del_init(&fl->fl_u.afs.link); |
15949 |
++ afs_next_locker(vnode, 0); |
15950 |
++ goto error_unlock; |
15951 |
+ |
15952 |
+ case -EWOULDBLOCK: |
15953 |
+ /* The server doesn't have a lock-waiting queue, so the client |
15954 |
+@@ -494,29 +462,23 @@ static int afs_do_setlk(struct file *file, struct file_lock *fl) |
15955 |
+ _debug("would block"); |
15956 |
+ ASSERT(list_empty(&vnode->granted_locks)); |
15957 |
+ ASSERTCMP(vnode->pending_locks.next, ==, &fl->fl_u.afs.link); |
15958 |
+- vnode->lock_state = AFS_VNODE_LOCK_WAITING_FOR_CB; |
15959 |
+- goto need_to_wait; |
15960 |
++ goto lock_is_contended; |
15961 |
+ |
15962 |
+ case 0: |
15963 |
+ _debug("acquired"); |
15964 |
+- break; |
15965 |
++ afs_set_lock_state(vnode, AFS_VNODE_LOCK_GRANTED); |
15966 |
++ afs_grant_locks(vnode); |
15967 |
++ goto vnode_is_locked_u; |
15968 |
+ } |
15969 |
+ |
15970 |
+- /* we've acquired a server lock, but it needs to be renewed after 5 |
15971 |
+- * mins */ |
15972 |
+- vnode->lock_state = AFS_VNODE_LOCK_GRANTED; |
15973 |
+- afs_schedule_lock_extension(vnode); |
15974 |
+- |
15975 |
+-share_existing_lock: |
15976 |
+- /* the lock has been granted as far as we're concerned... */ |
15977 |
+- fl->fl_u.afs.state = AFS_LOCK_GRANTED; |
15978 |
+- list_move_tail(&fl->fl_u.afs.link, &vnode->granted_locks); |
15979 |
+- |
15980 |
+-given_lock: |
15981 |
+- /* ... but we do still need to get the VFS's blessing */ |
15982 |
++vnode_is_locked_u: |
15983 |
+ spin_unlock(&vnode->lock); |
15984 |
++vnode_is_locked: |
15985 |
++ /* the lock has been granted by the server... */ |
15986 |
++ ASSERTCMP(fl->fl_u.afs.state, ==, AFS_LOCK_GRANTED); |
15987 |
+ |
15988 |
+- ret = posix_lock_file(file, fl, NULL); |
15989 |
++ /* ... but the VFS still needs to distribute access on this client. */ |
15990 |
++ ret = locks_lock_file_wait(file, fl); |
15991 |
+ if (ret < 0) |
15992 |
+ goto vfs_rejected_lock; |
15993 |
+ |
15994 |
+@@ -528,38 +490,61 @@ given_lock: |
15995 |
+ _leave(" = 0"); |
15996 |
+ return 0; |
15997 |
+ |
15998 |
++lock_is_contended: |
15999 |
++ if (!(fl->fl_flags & FL_SLEEP)) { |
16000 |
++ list_del_init(&fl->fl_u.afs.link); |
16001 |
++ afs_next_locker(vnode, 0); |
16002 |
++ ret = -EAGAIN; |
16003 |
++ goto error_unlock; |
16004 |
++ } |
16005 |
++ |
16006 |
++ afs_set_lock_state(vnode, AFS_VNODE_LOCK_WAITING_FOR_CB); |
16007 |
++ queue_delayed_work(afs_lock_manager, &vnode->lock_work, HZ * 5); |
16008 |
++ |
16009 |
+ need_to_wait: |
16010 |
+ /* We're going to have to wait. Either this client doesn't have a lock |
16011 |
+ * on the server yet and we need to wait for a callback to occur, or |
16012 |
+- * the client does have a lock on the server, but it belongs to some |
16013 |
+- * other process(es) and is incompatible with the lock we want. |
16014 |
++ * the client does have a lock on the server, but it's shared and we |
16015 |
++ * need an exclusive lock. |
16016 |
+ */ |
16017 |
+- ret = -EAGAIN; |
16018 |
+- if (fl->fl_flags & FL_SLEEP) { |
16019 |
+- spin_unlock(&vnode->lock); |
16020 |
++ spin_unlock(&vnode->lock); |
16021 |
+ |
16022 |
+- _debug("sleep"); |
16023 |
+- ret = wait_event_interruptible(fl->fl_wait, |
16024 |
+- fl->fl_u.afs.state != AFS_LOCK_PENDING); |
16025 |
++ _debug("sleep"); |
16026 |
++ ret = wait_event_interruptible(fl->fl_wait, |
16027 |
++ fl->fl_u.afs.state != AFS_LOCK_PENDING); |
16028 |
++ _debug("wait = %d", ret); |
16029 |
+ |
16030 |
++ if (fl->fl_u.afs.state >= 0 && fl->fl_u.afs.state != AFS_LOCK_GRANTED) { |
16031 |
+ spin_lock(&vnode->lock); |
16032 |
+- } |
16033 |
+ |
16034 |
+- if (fl->fl_u.afs.state == AFS_LOCK_GRANTED) |
16035 |
+- goto given_lock; |
16036 |
+- if (fl->fl_u.afs.state < 0) |
16037 |
+- ret = fl->fl_u.afs.state; |
16038 |
++ switch (fl->fl_u.afs.state) { |
16039 |
++ case AFS_LOCK_YOUR_TRY: |
16040 |
++ fl->fl_u.afs.state = AFS_LOCK_PENDING; |
16041 |
++ goto try_to_lock; |
16042 |
++ case AFS_LOCK_PENDING: |
16043 |
++ if (ret > 0) { |
16044 |
++ /* We need to retry the lock. We may not be |
16045 |
++ * notified by the server if it just expired |
16046 |
++ * rather than being released. |
16047 |
++ */ |
16048 |
++ ASSERTCMP(vnode->lock_state, ==, AFS_VNODE_LOCK_WAITING_FOR_CB); |
16049 |
++ afs_set_lock_state(vnode, AFS_VNODE_LOCK_SETTING); |
16050 |
++ fl->fl_u.afs.state = AFS_LOCK_PENDING; |
16051 |
++ goto try_to_lock; |
16052 |
++ } |
16053 |
++ goto error_unlock; |
16054 |
++ case AFS_LOCK_GRANTED: |
16055 |
++ default: |
16056 |
++ break; |
16057 |
++ } |
16058 |
+ |
16059 |
+-abort_attempt: |
16060 |
+- /* we aren't going to get the lock, either because we're unwilling to |
16061 |
+- * wait, or because some signal happened */ |
16062 |
+- _debug("abort"); |
16063 |
+- afs_dequeue_lock(vnode, fl); |
16064 |
++ spin_unlock(&vnode->lock); |
16065 |
++ } |
16066 |
+ |
16067 |
+-error_unlock: |
16068 |
+- spin_unlock(&vnode->lock); |
16069 |
+- _leave(" = %d", ret); |
16070 |
+- return ret; |
16071 |
++ if (fl->fl_u.afs.state == AFS_LOCK_GRANTED) |
16072 |
++ goto vnode_is_locked; |
16073 |
++ ret = fl->fl_u.afs.state; |
16074 |
++ goto error; |
16075 |
+ |
16076 |
+ vfs_rejected_lock: |
16077 |
+ /* The VFS rejected the lock we just obtained, so we have to discard |
16078 |
+@@ -569,9 +554,13 @@ vfs_rejected_lock: |
16079 |
+ _debug("vfs refused %d", ret); |
16080 |
+ spin_lock(&vnode->lock); |
16081 |
+ list_del_init(&fl->fl_u.afs.link); |
16082 |
+- if (list_empty(&vnode->granted_locks)) |
16083 |
+- afs_defer_unlock(vnode); |
16084 |
+- goto error_unlock; |
16085 |
++ afs_defer_unlock(vnode); |
16086 |
++ |
16087 |
++error_unlock: |
16088 |
++ spin_unlock(&vnode->lock); |
16089 |
++error: |
16090 |
++ _leave(" = %d", ret); |
16091 |
++ return ret; |
16092 |
+ } |
16093 |
+ |
16094 |
+ /* |
16095 |
+@@ -587,11 +576,7 @@ static int afs_do_unlk(struct file *file, struct file_lock *fl) |
16096 |
+ /* Flush all pending writes before doing anything with locks. */ |
16097 |
+ vfs_fsync(file, 0); |
16098 |
+ |
16099 |
+- /* only whole-file unlocks are supported */ |
16100 |
+- if (fl->fl_start != 0 || fl->fl_end != OFFSET_MAX) |
16101 |
+- return -EINVAL; |
16102 |
+- |
16103 |
+- ret = posix_lock_file(file, fl, NULL); |
16104 |
++ ret = locks_lock_file_wait(file, fl); |
16105 |
+ _leave(" = %d [%u]", ret, vnode->lock_state); |
16106 |
+ return ret; |
16107 |
+ } |
16108 |
+@@ -618,12 +603,15 @@ static int afs_do_getlk(struct file *file, struct file_lock *fl) |
16109 |
+ goto error; |
16110 |
+ |
16111 |
+ lock_count = READ_ONCE(vnode->status.lock_count); |
16112 |
+- if (lock_count > 0) |
16113 |
+- fl->fl_type = F_RDLCK; |
16114 |
+- else |
16115 |
+- fl->fl_type = F_WRLCK; |
16116 |
+- fl->fl_start = 0; |
16117 |
+- fl->fl_end = OFFSET_MAX; |
16118 |
++ if (lock_count != 0) { |
16119 |
++ if (lock_count > 0) |
16120 |
++ fl->fl_type = F_RDLCK; |
16121 |
++ else |
16122 |
++ fl->fl_type = F_WRLCK; |
16123 |
++ fl->fl_start = 0; |
16124 |
++ fl->fl_end = OFFSET_MAX; |
16125 |
++ fl->fl_pid = 0; |
16126 |
++ } |
16127 |
+ } |
16128 |
+ |
16129 |
+ ret = 0; |
16130 |
+@@ -710,7 +698,11 @@ static void afs_fl_release_private(struct file_lock *fl) |
16131 |
+ _enter(""); |
16132 |
+ |
16133 |
+ spin_lock(&vnode->lock); |
16134 |
+- afs_dequeue_lock(vnode, fl); |
16135 |
++ |
16136 |
++ list_del_init(&fl->fl_u.afs.link); |
16137 |
++ if (list_empty(&vnode->granted_locks)) |
16138 |
++ afs_defer_unlock(vnode); |
16139 |
++ |
16140 |
+ _debug("state %u for %p", vnode->lock_state, vnode); |
16141 |
+ spin_unlock(&vnode->lock); |
16142 |
+ } |
16143 |
+diff --git a/fs/afs/inode.c b/fs/afs/inode.c |
16144 |
+index 0726e40db0f8..e6f11da5461b 100644 |
16145 |
+--- a/fs/afs/inode.c |
16146 |
++++ b/fs/afs/inode.c |
16147 |
+@@ -398,12 +398,9 @@ int afs_validate(struct afs_vnode *vnode, struct key *key) |
16148 |
+ vnode->cb_s_break = vnode->cb_interest->server->cb_s_break; |
16149 |
+ vnode->cb_v_break = vnode->volume->cb_v_break; |
16150 |
+ valid = false; |
16151 |
+- } else if (vnode->status.type == AFS_FTYPE_DIR && |
16152 |
+- (!test_bit(AFS_VNODE_DIR_VALID, &vnode->flags) || |
16153 |
+- vnode->cb_expires_at - 10 <= now)) { |
16154 |
++ } else if (test_bit(AFS_VNODE_ZAP_DATA, &vnode->flags)) { |
16155 |
+ valid = false; |
16156 |
+- } else if (test_bit(AFS_VNODE_ZAP_DATA, &vnode->flags) || |
16157 |
+- vnode->cb_expires_at - 10 <= now) { |
16158 |
++ } else if (vnode->cb_expires_at - 10 <= now) { |
16159 |
+ valid = false; |
16160 |
+ } else { |
16161 |
+ valid = true; |
16162 |
+@@ -541,6 +538,7 @@ void afs_evict_inode(struct inode *inode) |
16163 |
+ } |
16164 |
+ #endif |
16165 |
+ |
16166 |
++ afs_prune_wb_keys(vnode); |
16167 |
+ afs_put_permits(rcu_access_pointer(vnode->permit_cache)); |
16168 |
+ key_put(vnode->lock_key); |
16169 |
+ vnode->lock_key = NULL; |
16170 |
+diff --git a/fs/afs/rxrpc.c b/fs/afs/rxrpc.c |
16171 |
+index 2543f24d23f8..560dd5ff5a15 100644 |
16172 |
+--- a/fs/afs/rxrpc.c |
16173 |
++++ b/fs/afs/rxrpc.c |
16174 |
+@@ -573,6 +573,7 @@ static long afs_wait_for_call_to_complete(struct afs_call *call, |
16175 |
+ call->need_attention = false; |
16176 |
+ __set_current_state(TASK_RUNNING); |
16177 |
+ afs_deliver_to_call(call); |
16178 |
++ timeout = rtt2; |
16179 |
+ continue; |
16180 |
+ } |
16181 |
+ |
16182 |
+diff --git a/fs/afs/security.c b/fs/afs/security.c |
16183 |
+index 81dfedb7879f..66042b432baa 100644 |
16184 |
+--- a/fs/afs/security.c |
16185 |
++++ b/fs/afs/security.c |
16186 |
+@@ -87,11 +87,9 @@ void afs_clear_permits(struct afs_vnode *vnode) |
16187 |
+ permits = rcu_dereference_protected(vnode->permit_cache, |
16188 |
+ lockdep_is_held(&vnode->lock)); |
16189 |
+ RCU_INIT_POINTER(vnode->permit_cache, NULL); |
16190 |
+- vnode->cb_break++; |
16191 |
+ spin_unlock(&vnode->lock); |
16192 |
+ |
16193 |
+- if (permits) |
16194 |
+- afs_put_permits(permits); |
16195 |
++ afs_put_permits(permits); |
16196 |
+ } |
16197 |
+ |
16198 |
+ /* |
16199 |
+diff --git a/fs/afs/super.c b/fs/afs/super.c |
16200 |
+index 18b9b7ca20c9..4961d32ccd1e 100644 |
16201 |
+--- a/fs/afs/super.c |
16202 |
++++ b/fs/afs/super.c |
16203 |
+@@ -393,6 +393,7 @@ static int afs_fill_super(struct super_block *sb, |
16204 |
+ /* fill in the superblock */ |
16205 |
+ sb->s_blocksize = PAGE_SIZE; |
16206 |
+ sb->s_blocksize_bits = PAGE_SHIFT; |
16207 |
++ sb->s_maxbytes = MAX_LFS_FILESIZE; |
16208 |
+ sb->s_magic = AFS_FS_MAGIC; |
16209 |
+ sb->s_op = &afs_super_ops; |
16210 |
+ if (!as->dyn_root) |
16211 |
+diff --git a/fs/afs/xattr.c b/fs/afs/xattr.c |
16212 |
+index cfcc674e64a5..411f67c79f09 100644 |
16213 |
+--- a/fs/afs/xattr.c |
16214 |
++++ b/fs/afs/xattr.c |
16215 |
+@@ -50,7 +50,7 @@ static int afs_xattr_get_cell(const struct xattr_handler *handler, |
16216 |
+ return namelen; |
16217 |
+ if (namelen > size) |
16218 |
+ return -ERANGE; |
16219 |
+- memcpy(buffer, cell->name, size); |
16220 |
++ memcpy(buffer, cell->name, namelen); |
16221 |
+ return namelen; |
16222 |
+ } |
16223 |
+ |
16224 |
+@@ -104,7 +104,7 @@ static int afs_xattr_get_volume(const struct xattr_handler *handler, |
16225 |
+ return namelen; |
16226 |
+ if (namelen > size) |
16227 |
+ return -ERANGE; |
16228 |
+- memcpy(buffer, volname, size); |
16229 |
++ memcpy(buffer, volname, namelen); |
16230 |
+ return namelen; |
16231 |
+ } |
16232 |
+ |
16233 |
+diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c |
16234 |
+index 78490e544c91..c2c93fe9d7fd 100644 |
16235 |
+--- a/fs/btrfs/file.c |
16236 |
++++ b/fs/btrfs/file.c |
16237 |
+@@ -1895,7 +1895,7 @@ static ssize_t btrfs_file_write_iter(struct kiocb *iocb, |
16238 |
+ bool sync = (file->f_flags & O_DSYNC) || IS_SYNC(file->f_mapping->host); |
16239 |
+ ssize_t err; |
16240 |
+ loff_t pos; |
16241 |
+- size_t count = iov_iter_count(from); |
16242 |
++ size_t count; |
16243 |
+ loff_t oldsize; |
16244 |
+ int clean_page = 0; |
16245 |
+ |
16246 |
+@@ -1917,6 +1917,7 @@ static ssize_t btrfs_file_write_iter(struct kiocb *iocb, |
16247 |
+ } |
16248 |
+ |
16249 |
+ pos = iocb->ki_pos; |
16250 |
++ count = iov_iter_count(from); |
16251 |
+ if (iocb->ki_flags & IOCB_NOWAIT) { |
16252 |
+ /* |
16253 |
+ * We will allocate space in case nodatacow is not set, |
16254 |
+diff --git a/fs/btrfs/inode-map.c b/fs/btrfs/inode-map.c |
16255 |
+index e1b50c62ba65..c7dcb7c52108 100644 |
16256 |
+--- a/fs/btrfs/inode-map.c |
16257 |
++++ b/fs/btrfs/inode-map.c |
16258 |
+@@ -12,6 +12,19 @@ |
16259 |
+ #include "inode-map.h" |
16260 |
+ #include "transaction.h" |
16261 |
+ |
16262 |
++static void fail_caching_thread(struct btrfs_root *root) |
16263 |
++{ |
16264 |
++ struct btrfs_fs_info *fs_info = root->fs_info; |
16265 |
++ |
16266 |
++ btrfs_warn(fs_info, "failed to start inode caching task"); |
16267 |
++ btrfs_clear_pending_and_info(fs_info, INODE_MAP_CACHE, |
16268 |
++ "disabling inode map caching"); |
16269 |
++ spin_lock(&root->ino_cache_lock); |
16270 |
++ root->ino_cache_state = BTRFS_CACHE_ERROR; |
16271 |
++ spin_unlock(&root->ino_cache_lock); |
16272 |
++ wake_up(&root->ino_cache_wait); |
16273 |
++} |
16274 |
++ |
16275 |
+ static int caching_kthread(void *data) |
16276 |
+ { |
16277 |
+ struct btrfs_root *root = data; |
16278 |
+@@ -28,8 +41,10 @@ static int caching_kthread(void *data) |
16279 |
+ return 0; |
16280 |
+ |
16281 |
+ path = btrfs_alloc_path(); |
16282 |
+- if (!path) |
16283 |
++ if (!path) { |
16284 |
++ fail_caching_thread(root); |
16285 |
+ return -ENOMEM; |
16286 |
++ } |
16287 |
+ |
16288 |
+ /* Since the commit root is read-only, we can safely skip locking. */ |
16289 |
+ path->skip_locking = 1; |
16290 |
+@@ -145,6 +160,7 @@ static void start_caching(struct btrfs_root *root) |
16291 |
+ spin_lock(&root->ino_cache_lock); |
16292 |
+ root->ino_cache_state = BTRFS_CACHE_FINISHED; |
16293 |
+ spin_unlock(&root->ino_cache_lock); |
16294 |
++ wake_up(&root->ino_cache_wait); |
16295 |
+ return; |
16296 |
+ } |
16297 |
+ |
16298 |
+@@ -163,11 +179,8 @@ static void start_caching(struct btrfs_root *root) |
16299 |
+ |
16300 |
+ tsk = kthread_run(caching_kthread, root, "btrfs-ino-cache-%llu", |
16301 |
+ root->root_key.objectid); |
16302 |
+- if (IS_ERR(tsk)) { |
16303 |
+- btrfs_warn(fs_info, "failed to start inode caching task"); |
16304 |
+- btrfs_clear_pending_and_info(fs_info, INODE_MAP_CACHE, |
16305 |
+- "disabling inode map caching"); |
16306 |
+- } |
16307 |
++ if (IS_ERR(tsk)) |
16308 |
++ fail_caching_thread(root); |
16309 |
+ } |
16310 |
+ |
16311 |
+ int btrfs_find_free_ino(struct btrfs_root *root, u64 *objectid) |
16312 |
+@@ -185,11 +198,14 @@ again: |
16313 |
+ |
16314 |
+ wait_event(root->ino_cache_wait, |
16315 |
+ root->ino_cache_state == BTRFS_CACHE_FINISHED || |
16316 |
++ root->ino_cache_state == BTRFS_CACHE_ERROR || |
16317 |
+ root->free_ino_ctl->free_space > 0); |
16318 |
+ |
16319 |
+ if (root->ino_cache_state == BTRFS_CACHE_FINISHED && |
16320 |
+ root->free_ino_ctl->free_space == 0) |
16321 |
+ return -ENOSPC; |
16322 |
++ else if (root->ino_cache_state == BTRFS_CACHE_ERROR) |
16323 |
++ return btrfs_find_free_objectid(root, objectid); |
16324 |
+ else |
16325 |
+ goto again; |
16326 |
+ } |
16327 |
+diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c |
16328 |
+index 5e4f3f833e85..a09ce27ab220 100644 |
16329 |
+--- a/fs/ceph/xattr.c |
16330 |
++++ b/fs/ceph/xattr.c |
16331 |
+@@ -221,7 +221,7 @@ static size_t ceph_vxattrcb_dir_rbytes(struct ceph_inode_info *ci, char *val, |
16332 |
+ static size_t ceph_vxattrcb_dir_rctime(struct ceph_inode_info *ci, char *val, |
16333 |
+ size_t size) |
16334 |
+ { |
16335 |
+- return snprintf(val, size, "%lld.09%ld", ci->i_rctime.tv_sec, |
16336 |
++ return snprintf(val, size, "%lld.%09ld", ci->i_rctime.tv_sec, |
16337 |
+ ci->i_rctime.tv_nsec); |
16338 |
+ } |
16339 |
+ |
16340 |
+diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c |
16341 |
+index 7e85070d010f..576cf71576da 100644 |
16342 |
+--- a/fs/cifs/connect.c |
16343 |
++++ b/fs/cifs/connect.c |
16344 |
+@@ -970,6 +970,7 @@ cifs_demultiplex_thread(void *p) |
16345 |
+ mempool_resize(cifs_req_poolp, length + cifs_min_rcv); |
16346 |
+ |
16347 |
+ set_freezable(); |
16348 |
++ allow_kernel_signal(SIGKILL); |
16349 |
+ while (server->tcpStatus != CifsExiting) { |
16350 |
+ if (try_to_freeze()) |
16351 |
+ continue; |
16352 |
+@@ -2454,7 +2455,7 @@ cifs_put_tcp_session(struct TCP_Server_Info *server, int from_reconnect) |
16353 |
+ |
16354 |
+ task = xchg(&server->tsk, NULL); |
16355 |
+ if (task) |
16356 |
+- force_sig(SIGKILL, task); |
16357 |
++ send_sig(SIGKILL, task, 1); |
16358 |
+ } |
16359 |
+ |
16360 |
+ static struct TCP_Server_Info * |
16361 |
+diff --git a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c |
16362 |
+index 808cae6d5f50..ae3248326c44 100644 |
16363 |
+--- a/fs/exportfs/expfs.c |
16364 |
++++ b/fs/exportfs/expfs.c |
16365 |
+@@ -147,6 +147,7 @@ static struct dentry *reconnect_one(struct vfsmount *mnt, |
16366 |
+ tmp = lookup_one_len_unlocked(nbuf, parent, strlen(nbuf)); |
16367 |
+ if (IS_ERR(tmp)) { |
16368 |
+ dprintk("%s: lookup failed: %d\n", __func__, PTR_ERR(tmp)); |
16369 |
++ err = PTR_ERR(tmp); |
16370 |
+ goto out_err; |
16371 |
+ } |
16372 |
+ if (tmp != dentry) { |
16373 |
+diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c |
16374 |
+index 56f6e1782d5f..4572cb057951 100644 |
16375 |
+--- a/fs/ext4/inline.c |
16376 |
++++ b/fs/ext4/inline.c |
16377 |
+@@ -1419,7 +1419,7 @@ int htree_inlinedir_to_tree(struct file *dir_file, |
16378 |
+ err = ext4_htree_store_dirent(dir_file, hinfo->hash, |
16379 |
+ hinfo->minor_hash, de, &tmp_str); |
16380 |
+ if (err) { |
16381 |
+- count = err; |
16382 |
++ ret = err; |
16383 |
+ goto out; |
16384 |
+ } |
16385 |
+ count++; |
16386 |
+diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c |
16387 |
+index 0d3d848d186b..ebe19894884b 100644 |
16388 |
+--- a/fs/f2fs/dir.c |
16389 |
++++ b/fs/f2fs/dir.c |
16390 |
+@@ -572,6 +572,11 @@ add_dentry: |
16391 |
+ |
16392 |
+ if (inode) { |
16393 |
+ f2fs_i_pino_write(inode, dir->i_ino); |
16394 |
++ |
16395 |
++ /* synchronize inode page's data from inode cache */ |
16396 |
++ if (is_inode_flag_set(inode, FI_NEW_INODE)) |
16397 |
++ f2fs_update_inode(inode, page); |
16398 |
++ |
16399 |
+ f2fs_put_page(page, 1); |
16400 |
+ } |
16401 |
+ |
16402 |
+diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h |
16403 |
+index 72d154e71bb5..6b5b685af599 100644 |
16404 |
+--- a/fs/f2fs/f2fs.h |
16405 |
++++ b/fs/f2fs/f2fs.h |
16406 |
+@@ -1701,7 +1701,7 @@ static inline int inc_valid_block_count(struct f2fs_sb_info *sbi, |
16407 |
+ if (time_to_inject(sbi, FAULT_BLOCK)) { |
16408 |
+ f2fs_show_injection_info(FAULT_BLOCK); |
16409 |
+ release = *count; |
16410 |
+- goto enospc; |
16411 |
++ goto release_quota; |
16412 |
+ } |
16413 |
+ |
16414 |
+ /* |
16415 |
+@@ -1741,6 +1741,7 @@ static inline int inc_valid_block_count(struct f2fs_sb_info *sbi, |
16416 |
+ |
16417 |
+ enospc: |
16418 |
+ percpu_counter_sub(&sbi->alloc_valid_block_count, release); |
16419 |
++release_quota: |
16420 |
+ dquot_release_reservation_block(inode, release); |
16421 |
+ return -ENOSPC; |
16422 |
+ } |
16423 |
+diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c |
16424 |
+index 6bbb5f6801e2..c1ba29d10789 100644 |
16425 |
+--- a/fs/f2fs/inline.c |
16426 |
++++ b/fs/f2fs/inline.c |
16427 |
+@@ -133,6 +133,7 @@ int f2fs_convert_inline_page(struct dnode_of_data *dn, struct page *page) |
16428 |
+ |
16429 |
+ err = f2fs_get_node_info(fio.sbi, dn->nid, &ni); |
16430 |
+ if (err) { |
16431 |
++ f2fs_truncate_data_blocks_range(dn, 1); |
16432 |
+ f2fs_put_dnode(dn); |
16433 |
+ return err; |
16434 |
+ } |
16435 |
+@@ -577,6 +578,11 @@ int f2fs_add_inline_entry(struct inode *dir, const struct qstr *new_name, |
16436 |
+ /* we don't need to mark_inode_dirty now */ |
16437 |
+ if (inode) { |
16438 |
+ f2fs_i_pino_write(inode, dir->i_ino); |
16439 |
++ |
16440 |
++ /* synchronize inode page's data from inode cache */ |
16441 |
++ if (is_inode_flag_set(inode, FI_NEW_INODE)) |
16442 |
++ f2fs_update_inode(inode, page); |
16443 |
++ |
16444 |
+ f2fs_put_page(page, 1); |
16445 |
+ } |
16446 |
+ |
16447 |
+diff --git a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c |
16448 |
+index a5663cb621d8..78789c5ed36b 100644 |
16449 |
+--- a/fs/jfs/jfs_txnmgr.c |
16450 |
++++ b/fs/jfs/jfs_txnmgr.c |
16451 |
+@@ -1928,8 +1928,7 @@ static void xtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, |
16452 |
+ * header ? |
16453 |
+ */ |
16454 |
+ if (tlck->type & tlckTRUNCATE) { |
16455 |
+- /* This odd declaration suppresses a bogus gcc warning */ |
16456 |
+- pxd_t pxd = pxd; /* truncated extent of xad */ |
16457 |
++ pxd_t pxd; /* truncated extent of xad */ |
16458 |
+ int twm; |
16459 |
+ |
16460 |
+ /* |
16461 |
+diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c |
16462 |
+index 74ff459b75ef..b0c0c2fc2fba 100644 |
16463 |
+--- a/fs/nfs/delegation.c |
16464 |
++++ b/fs/nfs/delegation.c |
16465 |
+@@ -240,6 +240,8 @@ static struct inode *nfs_delegation_grab_inode(struct nfs_delegation *delegation |
16466 |
+ spin_lock(&delegation->lock); |
16467 |
+ if (delegation->inode != NULL) |
16468 |
+ inode = igrab(delegation->inode); |
16469 |
++ if (!inode) |
16470 |
++ set_bit(NFS_DELEGATION_INODE_FREEING, &delegation->flags); |
16471 |
+ spin_unlock(&delegation->lock); |
16472 |
+ return inode; |
16473 |
+ } |
16474 |
+@@ -955,10 +957,11 @@ restart: |
16475 |
+ list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link) { |
16476 |
+ list_for_each_entry_rcu(delegation, &server->delegations, |
16477 |
+ super_list) { |
16478 |
+- if (test_bit(NFS_DELEGATION_RETURNING, |
16479 |
+- &delegation->flags)) |
16480 |
+- continue; |
16481 |
+- if (test_bit(NFS_DELEGATION_NEED_RECLAIM, |
16482 |
++ if (test_bit(NFS_DELEGATION_INODE_FREEING, |
16483 |
++ &delegation->flags) || |
16484 |
++ test_bit(NFS_DELEGATION_RETURNING, |
16485 |
++ &delegation->flags) || |
16486 |
++ test_bit(NFS_DELEGATION_NEED_RECLAIM, |
16487 |
+ &delegation->flags) == 0) |
16488 |
+ continue; |
16489 |
+ if (!nfs_sb_active(server->super)) |
16490 |
+@@ -1064,10 +1067,11 @@ restart: |
16491 |
+ list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link) { |
16492 |
+ list_for_each_entry_rcu(delegation, &server->delegations, |
16493 |
+ super_list) { |
16494 |
+- if (test_bit(NFS_DELEGATION_RETURNING, |
16495 |
+- &delegation->flags)) |
16496 |
+- continue; |
16497 |
+- if (test_bit(NFS_DELEGATION_TEST_EXPIRED, |
16498 |
++ if (test_bit(NFS_DELEGATION_INODE_FREEING, |
16499 |
++ &delegation->flags) || |
16500 |
++ test_bit(NFS_DELEGATION_RETURNING, |
16501 |
++ &delegation->flags) || |
16502 |
++ test_bit(NFS_DELEGATION_TEST_EXPIRED, |
16503 |
+ &delegation->flags) == 0) |
16504 |
+ continue; |
16505 |
+ if (!nfs_sb_active(server->super)) |
16506 |
+diff --git a/fs/nfs/delegation.h b/fs/nfs/delegation.h |
16507 |
+index dd0f3eed3890..f09b153ac82f 100644 |
16508 |
+--- a/fs/nfs/delegation.h |
16509 |
++++ b/fs/nfs/delegation.h |
16510 |
+@@ -34,6 +34,7 @@ enum { |
16511 |
+ NFS_DELEGATION_RETURNING, |
16512 |
+ NFS_DELEGATION_REVOKED, |
16513 |
+ NFS_DELEGATION_TEST_EXPIRED, |
16514 |
++ NFS_DELEGATION_INODE_FREEING, |
16515 |
+ }; |
16516 |
+ |
16517 |
+ int nfs_inode_set_delegation(struct inode *inode, struct rpc_cred *cred, |
16518 |
+diff --git a/fs/nfs/flexfilelayout/flexfilelayout.h b/fs/nfs/flexfilelayout/flexfilelayout.h |
16519 |
+index de50a342d5a5..2ac99124474c 100644 |
16520 |
+--- a/fs/nfs/flexfilelayout/flexfilelayout.h |
16521 |
++++ b/fs/nfs/flexfilelayout/flexfilelayout.h |
16522 |
+@@ -132,16 +132,6 @@ FF_LAYOUT_LSEG(struct pnfs_layout_segment *lseg) |
16523 |
+ generic_hdr); |
16524 |
+ } |
16525 |
+ |
16526 |
+-static inline struct nfs4_deviceid_node * |
16527 |
+-FF_LAYOUT_DEVID_NODE(struct pnfs_layout_segment *lseg, u32 idx) |
16528 |
+-{ |
16529 |
+- if (idx >= FF_LAYOUT_LSEG(lseg)->mirror_array_cnt || |
16530 |
+- FF_LAYOUT_LSEG(lseg)->mirror_array[idx] == NULL || |
16531 |
+- FF_LAYOUT_LSEG(lseg)->mirror_array[idx]->mirror_ds == NULL) |
16532 |
+- return NULL; |
16533 |
+- return &FF_LAYOUT_LSEG(lseg)->mirror_array[idx]->mirror_ds->id_node; |
16534 |
+-} |
16535 |
+- |
16536 |
+ static inline struct nfs4_ff_layout_ds * |
16537 |
+ FF_LAYOUT_MIRROR_DS(struct nfs4_deviceid_node *node) |
16538 |
+ { |
16539 |
+@@ -151,9 +141,25 @@ FF_LAYOUT_MIRROR_DS(struct nfs4_deviceid_node *node) |
16540 |
+ static inline struct nfs4_ff_layout_mirror * |
16541 |
+ FF_LAYOUT_COMP(struct pnfs_layout_segment *lseg, u32 idx) |
16542 |
+ { |
16543 |
+- if (idx >= FF_LAYOUT_LSEG(lseg)->mirror_array_cnt) |
16544 |
+- return NULL; |
16545 |
+- return FF_LAYOUT_LSEG(lseg)->mirror_array[idx]; |
16546 |
++ struct nfs4_ff_layout_segment *fls = FF_LAYOUT_LSEG(lseg); |
16547 |
++ |
16548 |
++ if (idx < fls->mirror_array_cnt) |
16549 |
++ return fls->mirror_array[idx]; |
16550 |
++ return NULL; |
16551 |
++} |
16552 |
++ |
16553 |
++static inline struct nfs4_deviceid_node * |
16554 |
++FF_LAYOUT_DEVID_NODE(struct pnfs_layout_segment *lseg, u32 idx) |
16555 |
++{ |
16556 |
++ struct nfs4_ff_layout_mirror *mirror = FF_LAYOUT_COMP(lseg, idx); |
16557 |
++ |
16558 |
++ if (mirror != NULL) { |
16559 |
++ struct nfs4_ff_layout_ds *mirror_ds = mirror->mirror_ds; |
16560 |
++ |
16561 |
++ if (!IS_ERR_OR_NULL(mirror_ds)) |
16562 |
++ return &mirror_ds->id_node; |
16563 |
++ } |
16564 |
++ return NULL; |
16565 |
+ } |
16566 |
+ |
16567 |
+ static inline u32 |
16568 |
+diff --git a/fs/nfs/nfs42xdr.c b/fs/nfs/nfs42xdr.c |
16569 |
+index 69f72ed2bf87..ec9803088f6b 100644 |
16570 |
+--- a/fs/nfs/nfs42xdr.c |
16571 |
++++ b/fs/nfs/nfs42xdr.c |
16572 |
+@@ -59,43 +59,53 @@ |
16573 |
+ #define decode_clone_maxsz (op_decode_hdr_maxsz) |
16574 |
+ |
16575 |
+ #define NFS4_enc_allocate_sz (compound_encode_hdr_maxsz + \ |
16576 |
++ encode_sequence_maxsz + \ |
16577 |
+ encode_putfh_maxsz + \ |
16578 |
+ encode_allocate_maxsz + \ |
16579 |
+ encode_getattr_maxsz) |
16580 |
+ #define NFS4_dec_allocate_sz (compound_decode_hdr_maxsz + \ |
16581 |
++ decode_sequence_maxsz + \ |
16582 |
+ decode_putfh_maxsz + \ |
16583 |
+ decode_allocate_maxsz + \ |
16584 |
+ decode_getattr_maxsz) |
16585 |
+ #define NFS4_enc_copy_sz (compound_encode_hdr_maxsz + \ |
16586 |
++ encode_sequence_maxsz + \ |
16587 |
+ encode_putfh_maxsz + \ |
16588 |
+ encode_savefh_maxsz + \ |
16589 |
+ encode_putfh_maxsz + \ |
16590 |
+ encode_copy_maxsz + \ |
16591 |
+ encode_commit_maxsz) |
16592 |
+ #define NFS4_dec_copy_sz (compound_decode_hdr_maxsz + \ |
16593 |
++ decode_sequence_maxsz + \ |
16594 |
+ decode_putfh_maxsz + \ |
16595 |
+ decode_savefh_maxsz + \ |
16596 |
+ decode_putfh_maxsz + \ |
16597 |
+ decode_copy_maxsz + \ |
16598 |
+ decode_commit_maxsz) |
16599 |
+ #define NFS4_enc_offload_cancel_sz (compound_encode_hdr_maxsz + \ |
16600 |
++ encode_sequence_maxsz + \ |
16601 |
+ encode_putfh_maxsz + \ |
16602 |
+ encode_offload_cancel_maxsz) |
16603 |
+ #define NFS4_dec_offload_cancel_sz (compound_decode_hdr_maxsz + \ |
16604 |
++ decode_sequence_maxsz + \ |
16605 |
+ decode_putfh_maxsz + \ |
16606 |
+ decode_offload_cancel_maxsz) |
16607 |
+ #define NFS4_enc_deallocate_sz (compound_encode_hdr_maxsz + \ |
16608 |
++ encode_sequence_maxsz + \ |
16609 |
+ encode_putfh_maxsz + \ |
16610 |
+ encode_deallocate_maxsz + \ |
16611 |
+ encode_getattr_maxsz) |
16612 |
+ #define NFS4_dec_deallocate_sz (compound_decode_hdr_maxsz + \ |
16613 |
++ decode_sequence_maxsz + \ |
16614 |
+ decode_putfh_maxsz + \ |
16615 |
+ decode_deallocate_maxsz + \ |
16616 |
+ decode_getattr_maxsz) |
16617 |
+ #define NFS4_enc_seek_sz (compound_encode_hdr_maxsz + \ |
16618 |
++ encode_sequence_maxsz + \ |
16619 |
+ encode_putfh_maxsz + \ |
16620 |
+ encode_seek_maxsz) |
16621 |
+ #define NFS4_dec_seek_sz (compound_decode_hdr_maxsz + \ |
16622 |
++ decode_sequence_maxsz + \ |
16623 |
+ decode_putfh_maxsz + \ |
16624 |
+ decode_seek_maxsz) |
16625 |
+ #define NFS4_enc_layoutstats_sz (compound_encode_hdr_maxsz + \ |
16626 |
+diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c |
16627 |
+index c818f9886f61..66f699e18755 100644 |
16628 |
+--- a/fs/nfs/pnfs.c |
16629 |
++++ b/fs/nfs/pnfs.c |
16630 |
+@@ -758,22 +758,35 @@ static int |
16631 |
+ pnfs_layout_bulk_destroy_byserver_locked(struct nfs_client *clp, |
16632 |
+ struct nfs_server *server, |
16633 |
+ struct list_head *layout_list) |
16634 |
++ __must_hold(&clp->cl_lock) |
16635 |
++ __must_hold(RCU) |
16636 |
+ { |
16637 |
+ struct pnfs_layout_hdr *lo, *next; |
16638 |
+ struct inode *inode; |
16639 |
+ |
16640 |
+ list_for_each_entry_safe(lo, next, &server->layouts, plh_layouts) { |
16641 |
+- if (test_bit(NFS_LAYOUT_INVALID_STID, &lo->plh_flags)) |
16642 |
++ if (test_bit(NFS_LAYOUT_INVALID_STID, &lo->plh_flags) || |
16643 |
++ test_bit(NFS_LAYOUT_INODE_FREEING, &lo->plh_flags) || |
16644 |
++ !list_empty(&lo->plh_bulk_destroy)) |
16645 |
+ continue; |
16646 |
++ /* If the sb is being destroyed, just bail */ |
16647 |
++ if (!nfs_sb_active(server->super)) |
16648 |
++ break; |
16649 |
+ inode = igrab(lo->plh_inode); |
16650 |
+- if (inode == NULL) |
16651 |
+- continue; |
16652 |
+- list_del_init(&lo->plh_layouts); |
16653 |
+- if (pnfs_layout_add_bulk_destroy_list(inode, layout_list)) |
16654 |
+- continue; |
16655 |
+- rcu_read_unlock(); |
16656 |
+- spin_unlock(&clp->cl_lock); |
16657 |
+- iput(inode); |
16658 |
++ if (inode != NULL) { |
16659 |
++ list_del_init(&lo->plh_layouts); |
16660 |
++ if (pnfs_layout_add_bulk_destroy_list(inode, |
16661 |
++ layout_list)) |
16662 |
++ continue; |
16663 |
++ rcu_read_unlock(); |
16664 |
++ spin_unlock(&clp->cl_lock); |
16665 |
++ iput(inode); |
16666 |
++ } else { |
16667 |
++ rcu_read_unlock(); |
16668 |
++ spin_unlock(&clp->cl_lock); |
16669 |
++ set_bit(NFS_LAYOUT_INODE_FREEING, &lo->plh_flags); |
16670 |
++ } |
16671 |
++ nfs_sb_deactive(server->super); |
16672 |
+ spin_lock(&clp->cl_lock); |
16673 |
+ rcu_read_lock(); |
16674 |
+ return -EAGAIN; |
16675 |
+@@ -811,7 +824,7 @@ pnfs_layout_free_bulk_destroy_list(struct list_head *layout_list, |
16676 |
+ /* Free all lsegs that are attached to commit buckets */ |
16677 |
+ nfs_commit_inode(inode, 0); |
16678 |
+ pnfs_put_layout_hdr(lo); |
16679 |
+- iput(inode); |
16680 |
++ nfs_iput_and_deactive(inode); |
16681 |
+ } |
16682 |
+ return ret; |
16683 |
+ } |
16684 |
+diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h |
16685 |
+index ece367ebde69..3ba44819a88a 100644 |
16686 |
+--- a/fs/nfs/pnfs.h |
16687 |
++++ b/fs/nfs/pnfs.h |
16688 |
+@@ -104,6 +104,7 @@ enum { |
16689 |
+ NFS_LAYOUT_RETURN_REQUESTED, /* Return this layout ASAP */ |
16690 |
+ NFS_LAYOUT_INVALID_STID, /* layout stateid id is invalid */ |
16691 |
+ NFS_LAYOUT_FIRST_LAYOUTGET, /* Serialize first layoutget */ |
16692 |
++ NFS_LAYOUT_INODE_FREEING, /* The inode is being freed */ |
16693 |
+ }; |
16694 |
+ |
16695 |
+ enum layoutdriver_policy_flags { |
16696 |
+diff --git a/fs/nfs/super.c b/fs/nfs/super.c |
16697 |
+index d90efdea9fbd..5db7aceb4190 100644 |
16698 |
+--- a/fs/nfs/super.c |
16699 |
++++ b/fs/nfs/super.c |
16700 |
+@@ -1930,7 +1930,7 @@ static int nfs_parse_devname(const char *dev_name, |
16701 |
+ /* kill possible hostname list: not supported */ |
16702 |
+ comma = strchr(dev_name, ','); |
16703 |
+ if (comma != NULL && comma < end) |
16704 |
+- *comma = 0; |
16705 |
++ len = comma - dev_name; |
16706 |
+ } |
16707 |
+ |
16708 |
+ if (len > maxnamlen) |
16709 |
+diff --git a/fs/nfs/write.c b/fs/nfs/write.c |
16710 |
+index 117ffd90419e..e27637fa0f79 100644 |
16711 |
+--- a/fs/nfs/write.c |
16712 |
++++ b/fs/nfs/write.c |
16713 |
+@@ -646,7 +646,7 @@ out: |
16714 |
+ return ret; |
16715 |
+ out_launder: |
16716 |
+ nfs_write_error_remove_page(req); |
16717 |
+- return ret; |
16718 |
++ return 0; |
16719 |
+ } |
16720 |
+ |
16721 |
+ static int nfs_do_writepage(struct page *page, struct writeback_control *wbc, |
16722 |
+diff --git a/fs/xfs/xfs_quotaops.c b/fs/xfs/xfs_quotaops.c |
16723 |
+index a7c0c657dfaf..13ca7c16bfc7 100644 |
16724 |
+--- a/fs/xfs/xfs_quotaops.c |
16725 |
++++ b/fs/xfs/xfs_quotaops.c |
16726 |
+@@ -202,6 +202,9 @@ xfs_fs_rm_xquota( |
16727 |
+ if (XFS_IS_QUOTA_ON(mp)) |
16728 |
+ return -EINVAL; |
16729 |
+ |
16730 |
++ if (uflags & ~(FS_USER_QUOTA | FS_GROUP_QUOTA | FS_PROJ_QUOTA)) |
16731 |
++ return -EINVAL; |
16732 |
++ |
16733 |
+ if (uflags & FS_USER_QUOTA) |
16734 |
+ flags |= XFS_DQ_USER; |
16735 |
+ if (uflags & FS_GROUP_QUOTA) |
16736 |
+diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h |
16737 |
+index 777814755fa6..675aa1e876ce 100644 |
16738 |
+--- a/include/drm/drm_panel.h |
16739 |
++++ b/include/drm/drm_panel.h |
16740 |
+@@ -24,6 +24,7 @@ |
16741 |
+ #ifndef __DRM_PANEL_H__ |
16742 |
+ #define __DRM_PANEL_H__ |
16743 |
+ |
16744 |
++#include <linux/err.h> |
16745 |
+ #include <linux/errno.h> |
16746 |
+ #include <linux/list.h> |
16747 |
+ |
16748 |
+diff --git a/include/linux/acpi.h b/include/linux/acpi.h |
16749 |
+index df1252e22dcf..cd412817654f 100644 |
16750 |
+--- a/include/linux/acpi.h |
16751 |
++++ b/include/linux/acpi.h |
16752 |
+@@ -917,26 +917,18 @@ int acpi_subsys_prepare(struct device *dev); |
16753 |
+ void acpi_subsys_complete(struct device *dev); |
16754 |
+ int acpi_subsys_suspend_late(struct device *dev); |
16755 |
+ int acpi_subsys_suspend_noirq(struct device *dev); |
16756 |
+-int acpi_subsys_resume_noirq(struct device *dev); |
16757 |
+-int acpi_subsys_resume_early(struct device *dev); |
16758 |
+ int acpi_subsys_suspend(struct device *dev); |
16759 |
+ int acpi_subsys_freeze(struct device *dev); |
16760 |
+-int acpi_subsys_freeze_late(struct device *dev); |
16761 |
+-int acpi_subsys_freeze_noirq(struct device *dev); |
16762 |
+-int acpi_subsys_thaw_noirq(struct device *dev); |
16763 |
++int acpi_subsys_poweroff(struct device *dev); |
16764 |
+ #else |
16765 |
+ static inline int acpi_dev_resume_early(struct device *dev) { return 0; } |
16766 |
+ static inline int acpi_subsys_prepare(struct device *dev) { return 0; } |
16767 |
+ static inline void acpi_subsys_complete(struct device *dev) {} |
16768 |
+ static inline int acpi_subsys_suspend_late(struct device *dev) { return 0; } |
16769 |
+ static inline int acpi_subsys_suspend_noirq(struct device *dev) { return 0; } |
16770 |
+-static inline int acpi_subsys_resume_noirq(struct device *dev) { return 0; } |
16771 |
+-static inline int acpi_subsys_resume_early(struct device *dev) { return 0; } |
16772 |
+ static inline int acpi_subsys_suspend(struct device *dev) { return 0; } |
16773 |
+ static inline int acpi_subsys_freeze(struct device *dev) { return 0; } |
16774 |
+-static inline int acpi_subsys_freeze_late(struct device *dev) { return 0; } |
16775 |
+-static inline int acpi_subsys_freeze_noirq(struct device *dev) { return 0; } |
16776 |
+-static inline int acpi_subsys_thaw_noirq(struct device *dev) { return 0; } |
16777 |
++static inline int acpi_subsys_poweroff(struct device *dev) { return 0; } |
16778 |
+ #endif |
16779 |
+ |
16780 |
+ #ifdef CONFIG_ACPI |
16781 |
+diff --git a/include/linux/device.h b/include/linux/device.h |
16782 |
+index 19dd8852602c..c74ce473589a 100644 |
16783 |
+--- a/include/linux/device.h |
16784 |
++++ b/include/linux/device.h |
16785 |
+@@ -701,7 +701,8 @@ extern unsigned long devm_get_free_pages(struct device *dev, |
16786 |
+ gfp_t gfp_mask, unsigned int order); |
16787 |
+ extern void devm_free_pages(struct device *dev, unsigned long addr); |
16788 |
+ |
16789 |
+-void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res); |
16790 |
++void __iomem *devm_ioremap_resource(struct device *dev, |
16791 |
++ const struct resource *res); |
16792 |
+ |
16793 |
+ void __iomem *devm_of_iomap(struct device *dev, |
16794 |
+ struct device_node *node, int index, |
16795 |
+@@ -849,11 +850,12 @@ struct device_link { |
16796 |
+ struct list_head c_node; |
16797 |
+ enum device_link_state status; |
16798 |
+ u32 flags; |
16799 |
+- bool rpm_active; |
16800 |
++ refcount_t rpm_active; |
16801 |
+ struct kref kref; |
16802 |
+ #ifdef CONFIG_SRCU |
16803 |
+ struct rcu_head rcu_head; |
16804 |
+ #endif |
16805 |
++ bool supplier_preactivated; /* Owned by consumer probe. */ |
16806 |
+ }; |
16807 |
+ |
16808 |
+ /** |
16809 |
+diff --git a/include/linux/irqchip/arm-gic-v3.h b/include/linux/irqchip/arm-gic-v3.h |
16810 |
+index 3188c0bef3e7..1d21e98d6854 100644 |
16811 |
+--- a/include/linux/irqchip/arm-gic-v3.h |
16812 |
++++ b/include/linux/irqchip/arm-gic-v3.h |
16813 |
+@@ -165,7 +165,7 @@ |
16814 |
+ #define GICR_PROPBASER_nCnB GIC_BASER_CACHEABILITY(GICR_PROPBASER, INNER, nCnB) |
16815 |
+ #define GICR_PROPBASER_nC GIC_BASER_CACHEABILITY(GICR_PROPBASER, INNER, nC) |
16816 |
+ #define GICR_PROPBASER_RaWt GIC_BASER_CACHEABILITY(GICR_PROPBASER, INNER, RaWt) |
16817 |
+-#define GICR_PROPBASER_RaWb GIC_BASER_CACHEABILITY(GICR_PROPBASER, INNER, RaWt) |
16818 |
++#define GICR_PROPBASER_RaWb GIC_BASER_CACHEABILITY(GICR_PROPBASER, INNER, RaWb) |
16819 |
+ #define GICR_PROPBASER_WaWt GIC_BASER_CACHEABILITY(GICR_PROPBASER, INNER, WaWt) |
16820 |
+ #define GICR_PROPBASER_WaWb GIC_BASER_CACHEABILITY(GICR_PROPBASER, INNER, WaWb) |
16821 |
+ #define GICR_PROPBASER_RaWaWt GIC_BASER_CACHEABILITY(GICR_PROPBASER, INNER, RaWaWt) |
16822 |
+@@ -192,7 +192,7 @@ |
16823 |
+ #define GICR_PENDBASER_nCnB GIC_BASER_CACHEABILITY(GICR_PENDBASER, INNER, nCnB) |
16824 |
+ #define GICR_PENDBASER_nC GIC_BASER_CACHEABILITY(GICR_PENDBASER, INNER, nC) |
16825 |
+ #define GICR_PENDBASER_RaWt GIC_BASER_CACHEABILITY(GICR_PENDBASER, INNER, RaWt) |
16826 |
+-#define GICR_PENDBASER_RaWb GIC_BASER_CACHEABILITY(GICR_PENDBASER, INNER, RaWt) |
16827 |
++#define GICR_PENDBASER_RaWb GIC_BASER_CACHEABILITY(GICR_PENDBASER, INNER, RaWb) |
16828 |
+ #define GICR_PENDBASER_WaWt GIC_BASER_CACHEABILITY(GICR_PENDBASER, INNER, WaWt) |
16829 |
+ #define GICR_PENDBASER_WaWb GIC_BASER_CACHEABILITY(GICR_PENDBASER, INNER, WaWb) |
16830 |
+ #define GICR_PENDBASER_RaWaWt GIC_BASER_CACHEABILITY(GICR_PENDBASER, INNER, RaWaWt) |
16831 |
+@@ -251,7 +251,7 @@ |
16832 |
+ #define GICR_VPROPBASER_nCnB GIC_BASER_CACHEABILITY(GICR_VPROPBASER, INNER, nCnB) |
16833 |
+ #define GICR_VPROPBASER_nC GIC_BASER_CACHEABILITY(GICR_VPROPBASER, INNER, nC) |
16834 |
+ #define GICR_VPROPBASER_RaWt GIC_BASER_CACHEABILITY(GICR_VPROPBASER, INNER, RaWt) |
16835 |
+-#define GICR_VPROPBASER_RaWb GIC_BASER_CACHEABILITY(GICR_VPROPBASER, INNER, RaWt) |
16836 |
++#define GICR_VPROPBASER_RaWb GIC_BASER_CACHEABILITY(GICR_VPROPBASER, INNER, RaWb) |
16837 |
+ #define GICR_VPROPBASER_WaWt GIC_BASER_CACHEABILITY(GICR_VPROPBASER, INNER, WaWt) |
16838 |
+ #define GICR_VPROPBASER_WaWb GIC_BASER_CACHEABILITY(GICR_VPROPBASER, INNER, WaWb) |
16839 |
+ #define GICR_VPROPBASER_RaWaWt GIC_BASER_CACHEABILITY(GICR_VPROPBASER, INNER, RaWaWt) |
16840 |
+@@ -277,7 +277,7 @@ |
16841 |
+ #define GICR_VPENDBASER_nCnB GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, nCnB) |
16842 |
+ #define GICR_VPENDBASER_nC GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, nC) |
16843 |
+ #define GICR_VPENDBASER_RaWt GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, RaWt) |
16844 |
+-#define GICR_VPENDBASER_RaWb GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, RaWt) |
16845 |
++#define GICR_VPENDBASER_RaWb GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, RaWb) |
16846 |
+ #define GICR_VPENDBASER_WaWt GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, WaWt) |
16847 |
+ #define GICR_VPENDBASER_WaWb GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, WaWb) |
16848 |
+ #define GICR_VPENDBASER_RaWaWt GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, RaWaWt) |
16849 |
+@@ -351,7 +351,7 @@ |
16850 |
+ #define GITS_CBASER_nCnB GIC_BASER_CACHEABILITY(GITS_CBASER, INNER, nCnB) |
16851 |
+ #define GITS_CBASER_nC GIC_BASER_CACHEABILITY(GITS_CBASER, INNER, nC) |
16852 |
+ #define GITS_CBASER_RaWt GIC_BASER_CACHEABILITY(GITS_CBASER, INNER, RaWt) |
16853 |
+-#define GITS_CBASER_RaWb GIC_BASER_CACHEABILITY(GITS_CBASER, INNER, RaWt) |
16854 |
++#define GITS_CBASER_RaWb GIC_BASER_CACHEABILITY(GITS_CBASER, INNER, RaWb) |
16855 |
+ #define GITS_CBASER_WaWt GIC_BASER_CACHEABILITY(GITS_CBASER, INNER, WaWt) |
16856 |
+ #define GITS_CBASER_WaWb GIC_BASER_CACHEABILITY(GITS_CBASER, INNER, WaWb) |
16857 |
+ #define GITS_CBASER_RaWaWt GIC_BASER_CACHEABILITY(GITS_CBASER, INNER, RaWaWt) |
16858 |
+@@ -375,7 +375,7 @@ |
16859 |
+ #define GITS_BASER_nCnB GIC_BASER_CACHEABILITY(GITS_BASER, INNER, nCnB) |
16860 |
+ #define GITS_BASER_nC GIC_BASER_CACHEABILITY(GITS_BASER, INNER, nC) |
16861 |
+ #define GITS_BASER_RaWt GIC_BASER_CACHEABILITY(GITS_BASER, INNER, RaWt) |
16862 |
+-#define GITS_BASER_RaWb GIC_BASER_CACHEABILITY(GITS_BASER, INNER, RaWt) |
16863 |
++#define GITS_BASER_RaWb GIC_BASER_CACHEABILITY(GITS_BASER, INNER, RaWb) |
16864 |
+ #define GITS_BASER_WaWt GIC_BASER_CACHEABILITY(GITS_BASER, INNER, WaWt) |
16865 |
+ #define GITS_BASER_WaWb GIC_BASER_CACHEABILITY(GITS_BASER, INNER, WaWb) |
16866 |
+ #define GITS_BASER_RaWaWt GIC_BASER_CACHEABILITY(GITS_BASER, INNER, RaWaWt) |
16867 |
+diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h |
16868 |
+index 177f11c96187..76b76b6aa83d 100644 |
16869 |
+--- a/include/linux/mlx5/mlx5_ifc.h |
16870 |
++++ b/include/linux/mlx5/mlx5_ifc.h |
16871 |
+@@ -9053,8 +9053,6 @@ struct mlx5_ifc_query_lag_out_bits { |
16872 |
+ |
16873 |
+ u8 syndrome[0x20]; |
16874 |
+ |
16875 |
+- u8 reserved_at_40[0x40]; |
16876 |
+- |
16877 |
+ struct mlx5_ifc_lagc_bits ctx; |
16878 |
+ }; |
16879 |
+ |
16880 |
+diff --git a/include/linux/mmc/sdio_ids.h b/include/linux/mmc/sdio_ids.h |
16881 |
+index 4224902a8e22..358d6be357ed 100644 |
16882 |
+--- a/include/linux/mmc/sdio_ids.h |
16883 |
++++ b/include/linux/mmc/sdio_ids.h |
16884 |
+@@ -68,6 +68,8 @@ |
16885 |
+ |
16886 |
+ #define SDIO_VENDOR_ID_TI 0x0097 |
16887 |
+ #define SDIO_DEVICE_ID_TI_WL1271 0x4076 |
16888 |
++#define SDIO_VENDOR_ID_TI_WL1251 0x104c |
16889 |
++#define SDIO_DEVICE_ID_TI_WL1251 0x9066 |
16890 |
+ |
16891 |
+ #define SDIO_VENDOR_ID_STE 0x0020 |
16892 |
+ #define SDIO_DEVICE_ID_STE_CW1200 0x2280 |
16893 |
+diff --git a/include/linux/of.h b/include/linux/of.h |
16894 |
+index d5a863c1ee39..d4f14b0302b6 100644 |
16895 |
+--- a/include/linux/of.h |
16896 |
++++ b/include/linux/of.h |
16897 |
+@@ -1001,7 +1001,7 @@ static inline struct device_node *of_find_matching_node( |
16898 |
+ |
16899 |
+ static inline const char *of_node_get_device_type(const struct device_node *np) |
16900 |
+ { |
16901 |
+- return of_get_property(np, "type", NULL); |
16902 |
++ return of_get_property(np, "device_type", NULL); |
16903 |
+ } |
16904 |
+ |
16905 |
+ static inline bool of_node_is_type(const struct device_node *np, const char *type) |
16906 |
+@@ -1425,7 +1425,8 @@ int of_overlay_notifier_unregister(struct notifier_block *nb); |
16907 |
+ |
16908 |
+ #else |
16909 |
+ |
16910 |
+-static inline int of_overlay_fdt_apply(void *overlay_fdt, int *ovcs_id) |
16911 |
++static inline int of_overlay_fdt_apply(void *overlay_fdt, u32 overlay_fdt_size, |
16912 |
++ int *ovcs_id) |
16913 |
+ { |
16914 |
+ return -ENOTSUPP; |
16915 |
+ } |
16916 |
+diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h |
16917 |
+index b22bc81f3669..d8b4d31acd18 100644 |
16918 |
+--- a/include/linux/perf_event.h |
16919 |
++++ b/include/linux/perf_event.h |
16920 |
+@@ -494,6 +494,11 @@ struct perf_addr_filters_head { |
16921 |
+ unsigned int nr_file_filters; |
16922 |
+ }; |
16923 |
+ |
16924 |
++struct perf_addr_filter_range { |
16925 |
++ unsigned long start; |
16926 |
++ unsigned long size; |
16927 |
++}; |
16928 |
++ |
16929 |
+ /** |
16930 |
+ * enum perf_event_state - the states of an event: |
16931 |
+ */ |
16932 |
+@@ -670,7 +675,7 @@ struct perf_event { |
16933 |
+ /* address range filters */ |
16934 |
+ struct perf_addr_filters_head addr_filters; |
16935 |
+ /* vma address array for file-based filders */ |
16936 |
+- unsigned long *addr_filters_offs; |
16937 |
++ struct perf_addr_filter_range *addr_filter_ranges; |
16938 |
+ unsigned long addr_filters_gen; |
16939 |
+ |
16940 |
+ void (*destroy)(struct perf_event *); |
16941 |
+diff --git a/include/linux/platform_data/dma-imx-sdma.h b/include/linux/platform_data/dma-imx-sdma.h |
16942 |
+index 6eaa53cef0bd..30e676b36b24 100644 |
16943 |
+--- a/include/linux/platform_data/dma-imx-sdma.h |
16944 |
++++ b/include/linux/platform_data/dma-imx-sdma.h |
16945 |
+@@ -51,7 +51,10 @@ struct sdma_script_start_addrs { |
16946 |
+ /* End of v2 array */ |
16947 |
+ s32 zcanfd_2_mcu_addr; |
16948 |
+ s32 zqspi_2_mcu_addr; |
16949 |
++ s32 mcu_2_ecspi_addr; |
16950 |
+ /* End of v3 array */ |
16951 |
++ s32 mcu_2_zqspi_addr; |
16952 |
++ /* End of v4 array */ |
16953 |
+ }; |
16954 |
+ |
16955 |
+ /** |
16956 |
+diff --git a/include/linux/rtc.h b/include/linux/rtc.h |
16957 |
+index 6aedc30003e7..5a34f59941fb 100644 |
16958 |
+--- a/include/linux/rtc.h |
16959 |
++++ b/include/linux/rtc.h |
16960 |
+@@ -163,7 +163,7 @@ struct rtc_device { |
16961 |
+ #define to_rtc_device(d) container_of(d, struct rtc_device, dev) |
16962 |
+ |
16963 |
+ /* useful timestamps */ |
16964 |
+-#define RTC_TIMESTAMP_BEGIN_1900 -2208989361LL /* 1900-01-01 00:00:00 */ |
16965 |
++#define RTC_TIMESTAMP_BEGIN_1900 -2208988800LL /* 1900-01-01 00:00:00 */ |
16966 |
+ #define RTC_TIMESTAMP_BEGIN_2000 946684800LL /* 2000-01-01 00:00:00 */ |
16967 |
+ #define RTC_TIMESTAMP_END_2099 4102444799LL /* 2099-12-31 23:59:59 */ |
16968 |
+ |
16969 |
+diff --git a/include/linux/signal.h b/include/linux/signal.h |
16970 |
+index e4d01469ed60..0be5ce2375cb 100644 |
16971 |
+--- a/include/linux/signal.h |
16972 |
++++ b/include/linux/signal.h |
16973 |
+@@ -272,6 +272,9 @@ extern void signal_setup_done(int failed, struct ksignal *ksig, int stepping); |
16974 |
+ extern void exit_signals(struct task_struct *tsk); |
16975 |
+ extern void kernel_sigaction(int, __sighandler_t); |
16976 |
+ |
16977 |
++#define SIG_KTHREAD ((__force __sighandler_t)2) |
16978 |
++#define SIG_KTHREAD_KERNEL ((__force __sighandler_t)3) |
16979 |
++ |
16980 |
+ static inline void allow_signal(int sig) |
16981 |
+ { |
16982 |
+ /* |
16983 |
+@@ -279,7 +282,17 @@ static inline void allow_signal(int sig) |
16984 |
+ * know it'll be handled, so that they don't get converted to |
16985 |
+ * SIGKILL or just silently dropped. |
16986 |
+ */ |
16987 |
+- kernel_sigaction(sig, (__force __sighandler_t)2); |
16988 |
++ kernel_sigaction(sig, SIG_KTHREAD); |
16989 |
++} |
16990 |
++ |
16991 |
++static inline void allow_kernel_signal(int sig) |
16992 |
++{ |
16993 |
++ /* |
16994 |
++ * Kernel threads handle their own signals. Let the signal code |
16995 |
++ * know signals sent by the kernel will be handled, so that they |
16996 |
++ * don't get silently dropped. |
16997 |
++ */ |
16998 |
++ kernel_sigaction(sig, SIG_KTHREAD_KERNEL); |
16999 |
+ } |
17000 |
+ |
17001 |
+ static inline void disallow_signal(int sig) |
17002 |
+diff --git a/include/linux/switchtec.h b/include/linux/switchtec.h |
17003 |
+index ab400af6f0ce..623719c91706 100644 |
17004 |
+--- a/include/linux/switchtec.h |
17005 |
++++ b/include/linux/switchtec.h |
17006 |
+@@ -244,8 +244,8 @@ struct ntb_ctrl_regs { |
17007 |
+ u64 xlate_addr; |
17008 |
+ } bar_entry[6]; |
17009 |
+ u32 reserved2[216]; |
17010 |
+- u32 req_id_table[256]; |
17011 |
+- u32 reserved3[512]; |
17012 |
++ u32 req_id_table[512]; |
17013 |
++ u32 reserved3[256]; |
17014 |
+ u64 lut_entry[512]; |
17015 |
+ } __packed; |
17016 |
+ |
17017 |
+diff --git a/include/linux/usb/tcpm.h b/include/linux/usb/tcpm.h |
17018 |
+index 50c74a77db55..8cb93aff69f1 100644 |
17019 |
+--- a/include/linux/usb/tcpm.h |
17020 |
++++ b/include/linux/usb/tcpm.h |
17021 |
+@@ -121,10 +121,10 @@ struct tcpc_config { |
17022 |
+ * with partner. |
17023 |
+ * @set_pd_rx: Called to enable or disable reception of PD messages |
17024 |
+ * @set_roles: Called to set power and data roles |
17025 |
+- * @start_drp_toggling: |
17026 |
+- * Optional; if supported by hardware, called to start DRP |
17027 |
+- * toggling. DRP toggling is stopped automatically if |
17028 |
+- * a connection is established. |
17029 |
++ * @start_toggling: |
17030 |
++ * Optional; if supported by hardware, called to start dual-role |
17031 |
++ * toggling or single-role connection detection. Toggling stops |
17032 |
++ * automatically if a connection is established. |
17033 |
+ * @try_role: Optional; called to set a preferred role |
17034 |
+ * @pd_transmit:Called to transmit PD message |
17035 |
+ * @mux: Pointer to multiplexer data |
17036 |
+@@ -147,8 +147,9 @@ struct tcpc_dev { |
17037 |
+ int (*set_pd_rx)(struct tcpc_dev *dev, bool on); |
17038 |
+ int (*set_roles)(struct tcpc_dev *dev, bool attached, |
17039 |
+ enum typec_role role, enum typec_data_role data); |
17040 |
+- int (*start_drp_toggling)(struct tcpc_dev *dev, |
17041 |
+- enum typec_cc_status cc); |
17042 |
++ int (*start_toggling)(struct tcpc_dev *dev, |
17043 |
++ enum typec_port_type port_type, |
17044 |
++ enum typec_cc_status cc); |
17045 |
+ int (*try_role)(struct tcpc_dev *dev, int role); |
17046 |
+ int (*pd_transmit)(struct tcpc_dev *dev, enum tcpm_transmit_type type, |
17047 |
+ const struct pd_message *msg); |
17048 |
+diff --git a/include/media/davinci/vpbe.h b/include/media/davinci/vpbe.h |
17049 |
+index 79a566d7defd..180a05e91497 100644 |
17050 |
+--- a/include/media/davinci/vpbe.h |
17051 |
++++ b/include/media/davinci/vpbe.h |
17052 |
+@@ -92,7 +92,7 @@ struct vpbe_config { |
17053 |
+ struct encoder_config_info *ext_encoders; |
17054 |
+ /* amplifier information goes here */ |
17055 |
+ struct amp_config_info *amp; |
17056 |
+- int num_outputs; |
17057 |
++ unsigned int num_outputs; |
17058 |
+ /* Order is venc outputs followed by LCD and then external encoders */ |
17059 |
+ struct vpbe_output *outputs; |
17060 |
+ }; |
17061 |
+diff --git a/include/net/request_sock.h b/include/net/request_sock.h |
17062 |
+index 347015515a7d..1653435f18f5 100644 |
17063 |
+--- a/include/net/request_sock.h |
17064 |
++++ b/include/net/request_sock.h |
17065 |
+@@ -183,7 +183,7 @@ void reqsk_fastopen_remove(struct sock *sk, struct request_sock *req, |
17066 |
+ |
17067 |
+ static inline bool reqsk_queue_empty(const struct request_sock_queue *queue) |
17068 |
+ { |
17069 |
+- return queue->rskq_accept_head == NULL; |
17070 |
++ return READ_ONCE(queue->rskq_accept_head) == NULL; |
17071 |
+ } |
17072 |
+ |
17073 |
+ static inline struct request_sock *reqsk_queue_remove(struct request_sock_queue *queue, |
17074 |
+@@ -195,7 +195,7 @@ static inline struct request_sock *reqsk_queue_remove(struct request_sock_queue |
17075 |
+ req = queue->rskq_accept_head; |
17076 |
+ if (req) { |
17077 |
+ sk_acceptq_removed(parent); |
17078 |
+- queue->rskq_accept_head = req->dl_next; |
17079 |
++ WRITE_ONCE(queue->rskq_accept_head, req->dl_next); |
17080 |
+ if (queue->rskq_accept_head == NULL) |
17081 |
+ queue->rskq_accept_tail = NULL; |
17082 |
+ } |
17083 |
+diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h |
17084 |
+index 2abbc15824af..2c6570e6fcfe 100644 |
17085 |
+--- a/include/net/sctp/sctp.h |
17086 |
++++ b/include/net/sctp/sctp.h |
17087 |
+@@ -625,4 +625,9 @@ static inline __u32 sctp_min_frag_point(struct sctp_sock *sp, __u16 datasize) |
17088 |
+ return sctp_mtu_payload(sp, SCTP_DEFAULT_MINSEGMENT, datasize); |
17089 |
+ } |
17090 |
+ |
17091 |
++static inline bool sctp_newsk_ready(const struct sock *sk) |
17092 |
++{ |
17093 |
++ return sock_flag(sk, SOCK_DEAD) || sk->sk_socket; |
17094 |
++} |
17095 |
++ |
17096 |
+ #endif /* __net_sctp_h__ */ |
17097 |
+diff --git a/include/net/tcp.h b/include/net/tcp.h |
17098 |
+index ac4ffe8013d8..918bfd0d7d1f 100644 |
17099 |
+--- a/include/net/tcp.h |
17100 |
++++ b/include/net/tcp.h |
17101 |
+@@ -261,7 +261,7 @@ static inline bool tcp_under_memory_pressure(const struct sock *sk) |
17102 |
+ mem_cgroup_under_socket_pressure(sk->sk_memcg)) |
17103 |
+ return true; |
17104 |
+ |
17105 |
+- return tcp_memory_pressure; |
17106 |
++ return READ_ONCE(tcp_memory_pressure); |
17107 |
+ } |
17108 |
+ /* |
17109 |
+ * The next routines deal with comparing 32 bit unsigned ints |
17110 |
+diff --git a/include/net/xfrm.h b/include/net/xfrm.h |
17111 |
+index fb9b19a3b749..48dc1ce2170d 100644 |
17112 |
+--- a/include/net/xfrm.h |
17113 |
++++ b/include/net/xfrm.h |
17114 |
+@@ -1054,7 +1054,6 @@ static inline void xfrm_dst_destroy(struct xfrm_dst *xdst) |
17115 |
+ void xfrm_dst_ifdown(struct dst_entry *dst, struct net_device *dev); |
17116 |
+ |
17117 |
+ struct xfrm_if_parms { |
17118 |
+- char name[IFNAMSIZ]; /* name of XFRM device */ |
17119 |
+ int link; /* ifindex of underlying L2 interface */ |
17120 |
+ u32 if_id; /* interface identifyer */ |
17121 |
+ }; |
17122 |
+diff --git a/include/sound/soc.h b/include/sound/soc.h |
17123 |
+index 41cec42fb456..88aa48e5485f 100644 |
17124 |
+--- a/include/sound/soc.h |
17125 |
++++ b/include/sound/soc.h |
17126 |
+@@ -548,12 +548,12 @@ static inline void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count, |
17127 |
+ } |
17128 |
+ #endif |
17129 |
+ |
17130 |
+-#ifdef CONFIG_SND_SOC_AC97_BUS |
17131 |
+ struct snd_ac97 *snd_soc_alloc_ac97_component(struct snd_soc_component *component); |
17132 |
+ struct snd_ac97 *snd_soc_new_ac97_component(struct snd_soc_component *component, |
17133 |
+ unsigned int id, unsigned int id_mask); |
17134 |
+ void snd_soc_free_ac97_component(struct snd_ac97 *ac97); |
17135 |
+ |
17136 |
++#ifdef CONFIG_SND_SOC_AC97_BUS |
17137 |
+ int snd_soc_set_ac97_ops(struct snd_ac97_bus_ops *ops); |
17138 |
+ int snd_soc_set_ac97_ops_of_reset(struct snd_ac97_bus_ops *ops, |
17139 |
+ struct platform_device *pdev); |
17140 |
+diff --git a/include/trace/events/rxrpc.h b/include/trace/events/rxrpc.h |
17141 |
+index a08916eb7615..0924119bcfa4 100644 |
17142 |
+--- a/include/trace/events/rxrpc.h |
17143 |
++++ b/include/trace/events/rxrpc.h |
17144 |
+@@ -554,10 +554,10 @@ TRACE_EVENT(rxrpc_peer, |
17145 |
+ ); |
17146 |
+ |
17147 |
+ TRACE_EVENT(rxrpc_conn, |
17148 |
+- TP_PROTO(struct rxrpc_connection *conn, enum rxrpc_conn_trace op, |
17149 |
++ TP_PROTO(unsigned int conn_debug_id, enum rxrpc_conn_trace op, |
17150 |
+ int usage, const void *where), |
17151 |
+ |
17152 |
+- TP_ARGS(conn, op, usage, where), |
17153 |
++ TP_ARGS(conn_debug_id, op, usage, where), |
17154 |
+ |
17155 |
+ TP_STRUCT__entry( |
17156 |
+ __field(unsigned int, conn ) |
17157 |
+@@ -567,7 +567,7 @@ TRACE_EVENT(rxrpc_conn, |
17158 |
+ ), |
17159 |
+ |
17160 |
+ TP_fast_assign( |
17161 |
+- __entry->conn = conn->debug_id; |
17162 |
++ __entry->conn = conn_debug_id; |
17163 |
+ __entry->op = op; |
17164 |
+ __entry->usage = usage; |
17165 |
+ __entry->where = where; |
17166 |
+diff --git a/include/uapi/linux/btf.h b/include/uapi/linux/btf.h |
17167 |
+index 972265f32871..1e2662ff0529 100644 |
17168 |
+--- a/include/uapi/linux/btf.h |
17169 |
++++ b/include/uapi/linux/btf.h |
17170 |
+@@ -22,9 +22,9 @@ struct btf_header { |
17171 |
+ }; |
17172 |
+ |
17173 |
+ /* Max # of type identifier */ |
17174 |
+-#define BTF_MAX_TYPE 0x0000ffff |
17175 |
++#define BTF_MAX_TYPE 0x000fffff |
17176 |
+ /* Max offset into the string section */ |
17177 |
+-#define BTF_MAX_NAME_OFFSET 0x0000ffff |
17178 |
++#define BTF_MAX_NAME_OFFSET 0x00ffffff |
17179 |
+ /* Max # of struct/union/enum members or func args */ |
17180 |
+ #define BTF_MAX_VLEN 0xffff |
17181 |
+ |
17182 |
+diff --git a/include/uapi/linux/netfilter/nf_tables.h b/include/uapi/linux/netfilter/nf_tables.h |
17183 |
+index 325ec6ef0a76..5eac62e1b68d 100644 |
17184 |
+--- a/include/uapi/linux/netfilter/nf_tables.h |
17185 |
++++ b/include/uapi/linux/netfilter/nf_tables.h |
17186 |
+@@ -1128,7 +1128,7 @@ enum nft_log_level { |
17187 |
+ NFT_LOGLEVEL_AUDIT, |
17188 |
+ __NFT_LOGLEVEL_MAX |
17189 |
+ }; |
17190 |
+-#define NFT_LOGLEVEL_MAX (__NFT_LOGLEVEL_MAX + 1) |
17191 |
++#define NFT_LOGLEVEL_MAX (__NFT_LOGLEVEL_MAX - 1) |
17192 |
+ |
17193 |
+ /** |
17194 |
+ * enum nft_queue_attributes - nf_tables queue expression netlink attributes |
17195 |
+diff --git a/kernel/bpf/offload.c b/kernel/bpf/offload.c |
17196 |
+index 177a52436394..86477f3894e5 100644 |
17197 |
+--- a/kernel/bpf/offload.c |
17198 |
++++ b/kernel/bpf/offload.c |
17199 |
+@@ -645,8 +645,10 @@ struct bpf_offload_dev *bpf_offload_dev_create(void) |
17200 |
+ down_write(&bpf_devs_lock); |
17201 |
+ if (!offdevs_inited) { |
17202 |
+ err = rhashtable_init(&offdevs, &offdevs_params); |
17203 |
+- if (err) |
17204 |
++ if (err) { |
17205 |
++ up_write(&bpf_devs_lock); |
17206 |
+ return ERR_PTR(err); |
17207 |
++ } |
17208 |
+ offdevs_inited = true; |
17209 |
+ } |
17210 |
+ up_write(&bpf_devs_lock); |
17211 |
+diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c |
17212 |
+index 9bbfb1ff4ac9..e85636fb81b9 100644 |
17213 |
+--- a/kernel/bpf/verifier.c |
17214 |
++++ b/kernel/bpf/verifier.c |
17215 |
+@@ -1253,7 +1253,7 @@ static int check_stack_access(struct bpf_verifier_env *env, |
17216 |
+ char tn_buf[48]; |
17217 |
+ |
17218 |
+ tnum_strn(tn_buf, sizeof(tn_buf), reg->var_off); |
17219 |
+- verbose(env, "variable stack access var_off=%s off=%d size=%d", |
17220 |
++ verbose(env, "variable stack access var_off=%s off=%d size=%d\n", |
17221 |
+ tn_buf, off, size); |
17222 |
+ return -EACCES; |
17223 |
+ } |
17224 |
+diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c |
17225 |
+index f338d23b112b..dc6bf35e7884 100644 |
17226 |
+--- a/kernel/debug/kdb/kdb_main.c |
17227 |
++++ b/kernel/debug/kdb/kdb_main.c |
17228 |
+@@ -2604,7 +2604,7 @@ static int kdb_per_cpu(int argc, const char **argv) |
17229 |
+ diag = kdbgetularg(argv[3], &whichcpu); |
17230 |
+ if (diag) |
17231 |
+ return diag; |
17232 |
+- if (!cpu_online(whichcpu)) { |
17233 |
++ if (whichcpu >= nr_cpu_ids || !cpu_online(whichcpu)) { |
17234 |
+ kdb_printf("cpu %ld is not online\n", whichcpu); |
17235 |
+ return KDB_BADCPUNUM; |
17236 |
+ } |
17237 |
+diff --git a/kernel/events/core.c b/kernel/events/core.c |
17238 |
+index 460d5fd3ec4e..16af86ab24c4 100644 |
17239 |
+--- a/kernel/events/core.c |
17240 |
++++ b/kernel/events/core.c |
17241 |
+@@ -1254,6 +1254,7 @@ static void put_ctx(struct perf_event_context *ctx) |
17242 |
+ * perf_event_context::lock |
17243 |
+ * perf_event::mmap_mutex |
17244 |
+ * mmap_sem |
17245 |
++ * perf_addr_filters_head::lock |
17246 |
+ * |
17247 |
+ * cpu_hotplug_lock |
17248 |
+ * pmus_lock |
17249 |
+@@ -2803,7 +2804,7 @@ static int perf_event_stop(struct perf_event *event, int restart) |
17250 |
+ * |
17251 |
+ * (p1) when userspace mappings change as a result of (1) or (2) or (3) below, |
17252 |
+ * we update the addresses of corresponding vmas in |
17253 |
+- * event::addr_filters_offs array and bump the event::addr_filters_gen; |
17254 |
++ * event::addr_filter_ranges array and bump the event::addr_filters_gen; |
17255 |
+ * (p2) when an event is scheduled in (pmu::add), it calls |
17256 |
+ * perf_event_addr_filters_sync() which calls pmu::addr_filters_sync() |
17257 |
+ * if the generation has changed since the previous call. |
17258 |
+@@ -4447,7 +4448,7 @@ static void _free_event(struct perf_event *event) |
17259 |
+ |
17260 |
+ perf_event_free_bpf_prog(event); |
17261 |
+ perf_addr_filters_splice(event, NULL); |
17262 |
+- kfree(event->addr_filters_offs); |
17263 |
++ kfree(event->addr_filter_ranges); |
17264 |
+ |
17265 |
+ if (event->destroy) |
17266 |
+ event->destroy(event); |
17267 |
+@@ -5011,6 +5012,9 @@ static int perf_event_period(struct perf_event *event, u64 __user *arg) |
17268 |
+ if (perf_event_check_period(event, value)) |
17269 |
+ return -EINVAL; |
17270 |
+ |
17271 |
++ if (!event->attr.freq && (value & (1ULL << 63))) |
17272 |
++ return -EINVAL; |
17273 |
++ |
17274 |
+ event_function_call(event, __perf_event_period, &value); |
17275 |
+ |
17276 |
+ return 0; |
17277 |
+@@ -6742,7 +6746,8 @@ static void perf_event_addr_filters_exec(struct perf_event *event, void *data) |
17278 |
+ raw_spin_lock_irqsave(&ifh->lock, flags); |
17279 |
+ list_for_each_entry(filter, &ifh->list, entry) { |
17280 |
+ if (filter->path.dentry) { |
17281 |
+- event->addr_filters_offs[count] = 0; |
17282 |
++ event->addr_filter_ranges[count].start = 0; |
17283 |
++ event->addr_filter_ranges[count].size = 0; |
17284 |
+ restart++; |
17285 |
+ } |
17286 |
+ |
17287 |
+@@ -7424,28 +7429,47 @@ static bool perf_addr_filter_match(struct perf_addr_filter *filter, |
17288 |
+ return true; |
17289 |
+ } |
17290 |
+ |
17291 |
++static bool perf_addr_filter_vma_adjust(struct perf_addr_filter *filter, |
17292 |
++ struct vm_area_struct *vma, |
17293 |
++ struct perf_addr_filter_range *fr) |
17294 |
++{ |
17295 |
++ unsigned long vma_size = vma->vm_end - vma->vm_start; |
17296 |
++ unsigned long off = vma->vm_pgoff << PAGE_SHIFT; |
17297 |
++ struct file *file = vma->vm_file; |
17298 |
++ |
17299 |
++ if (!perf_addr_filter_match(filter, file, off, vma_size)) |
17300 |
++ return false; |
17301 |
++ |
17302 |
++ if (filter->offset < off) { |
17303 |
++ fr->start = vma->vm_start; |
17304 |
++ fr->size = min(vma_size, filter->size - (off - filter->offset)); |
17305 |
++ } else { |
17306 |
++ fr->start = vma->vm_start + filter->offset - off; |
17307 |
++ fr->size = min(vma->vm_end - fr->start, filter->size); |
17308 |
++ } |
17309 |
++ |
17310 |
++ return true; |
17311 |
++} |
17312 |
++ |
17313 |
+ static void __perf_addr_filters_adjust(struct perf_event *event, void *data) |
17314 |
+ { |
17315 |
+ struct perf_addr_filters_head *ifh = perf_event_addr_filters(event); |
17316 |
+ struct vm_area_struct *vma = data; |
17317 |
+- unsigned long off = vma->vm_pgoff << PAGE_SHIFT, flags; |
17318 |
+- struct file *file = vma->vm_file; |
17319 |
+ struct perf_addr_filter *filter; |
17320 |
+ unsigned int restart = 0, count = 0; |
17321 |
++ unsigned long flags; |
17322 |
+ |
17323 |
+ if (!has_addr_filter(event)) |
17324 |
+ return; |
17325 |
+ |
17326 |
+- if (!file) |
17327 |
++ if (!vma->vm_file) |
17328 |
+ return; |
17329 |
+ |
17330 |
+ raw_spin_lock_irqsave(&ifh->lock, flags); |
17331 |
+ list_for_each_entry(filter, &ifh->list, entry) { |
17332 |
+- if (perf_addr_filter_match(filter, file, off, |
17333 |
+- vma->vm_end - vma->vm_start)) { |
17334 |
+- event->addr_filters_offs[count] = vma->vm_start; |
17335 |
++ if (perf_addr_filter_vma_adjust(filter, vma, |
17336 |
++ &event->addr_filter_ranges[count])) |
17337 |
+ restart++; |
17338 |
+- } |
17339 |
+ |
17340 |
+ count++; |
17341 |
+ } |
17342 |
+@@ -8805,26 +8829,19 @@ static void perf_addr_filters_splice(struct perf_event *event, |
17343 |
+ * @filter; if so, adjust filter's address range. |
17344 |
+ * Called with mm::mmap_sem down for reading. |
17345 |
+ */ |
17346 |
+-static unsigned long perf_addr_filter_apply(struct perf_addr_filter *filter, |
17347 |
+- struct mm_struct *mm) |
17348 |
++static void perf_addr_filter_apply(struct perf_addr_filter *filter, |
17349 |
++ struct mm_struct *mm, |
17350 |
++ struct perf_addr_filter_range *fr) |
17351 |
+ { |
17352 |
+ struct vm_area_struct *vma; |
17353 |
+ |
17354 |
+ for (vma = mm->mmap; vma; vma = vma->vm_next) { |
17355 |
+- struct file *file = vma->vm_file; |
17356 |
+- unsigned long off = vma->vm_pgoff << PAGE_SHIFT; |
17357 |
+- unsigned long vma_size = vma->vm_end - vma->vm_start; |
17358 |
+- |
17359 |
+- if (!file) |
17360 |
+- continue; |
17361 |
+- |
17362 |
+- if (!perf_addr_filter_match(filter, file, off, vma_size)) |
17363 |
++ if (!vma->vm_file) |
17364 |
+ continue; |
17365 |
+ |
17366 |
+- return vma->vm_start; |
17367 |
++ if (perf_addr_filter_vma_adjust(filter, vma, fr)) |
17368 |
++ return; |
17369 |
+ } |
17370 |
+- |
17371 |
+- return 0; |
17372 |
+ } |
17373 |
+ |
17374 |
+ /* |
17375 |
+@@ -8847,26 +8864,29 @@ static void perf_event_addr_filters_apply(struct perf_event *event) |
17376 |
+ if (task == TASK_TOMBSTONE) |
17377 |
+ return; |
17378 |
+ |
17379 |
+- if (!ifh->nr_file_filters) |
17380 |
+- return; |
17381 |
+- |
17382 |
+- mm = get_task_mm(event->ctx->task); |
17383 |
+- if (!mm) |
17384 |
+- goto restart; |
17385 |
++ if (ifh->nr_file_filters) { |
17386 |
++ mm = get_task_mm(event->ctx->task); |
17387 |
++ if (!mm) |
17388 |
++ goto restart; |
17389 |
+ |
17390 |
+- down_read(&mm->mmap_sem); |
17391 |
++ down_read(&mm->mmap_sem); |
17392 |
++ } |
17393 |
+ |
17394 |
+ raw_spin_lock_irqsave(&ifh->lock, flags); |
17395 |
+ list_for_each_entry(filter, &ifh->list, entry) { |
17396 |
+- event->addr_filters_offs[count] = 0; |
17397 |
++ if (filter->path.dentry) { |
17398 |
++ /* |
17399 |
++ * Adjust base offset if the filter is associated to a |
17400 |
++ * binary that needs to be mapped: |
17401 |
++ */ |
17402 |
++ event->addr_filter_ranges[count].start = 0; |
17403 |
++ event->addr_filter_ranges[count].size = 0; |
17404 |
+ |
17405 |
+- /* |
17406 |
+- * Adjust base offset if the filter is associated to a binary |
17407 |
+- * that needs to be mapped: |
17408 |
+- */ |
17409 |
+- if (filter->path.dentry) |
17410 |
+- event->addr_filters_offs[count] = |
17411 |
+- perf_addr_filter_apply(filter, mm); |
17412 |
++ perf_addr_filter_apply(filter, mm, &event->addr_filter_ranges[count]); |
17413 |
++ } else { |
17414 |
++ event->addr_filter_ranges[count].start = filter->offset; |
17415 |
++ event->addr_filter_ranges[count].size = filter->size; |
17416 |
++ } |
17417 |
+ |
17418 |
+ count++; |
17419 |
+ } |
17420 |
+@@ -8874,9 +8894,11 @@ static void perf_event_addr_filters_apply(struct perf_event *event) |
17421 |
+ event->addr_filters_gen++; |
17422 |
+ raw_spin_unlock_irqrestore(&ifh->lock, flags); |
17423 |
+ |
17424 |
+- up_read(&mm->mmap_sem); |
17425 |
++ if (ifh->nr_file_filters) { |
17426 |
++ up_read(&mm->mmap_sem); |
17427 |
+ |
17428 |
+- mmput(mm); |
17429 |
++ mmput(mm); |
17430 |
++ } |
17431 |
+ |
17432 |
+ restart: |
17433 |
+ perf_event_stop(event, 1); |
17434 |
+@@ -10128,14 +10150,28 @@ perf_event_alloc(struct perf_event_attr *attr, int cpu, |
17435 |
+ goto err_pmu; |
17436 |
+ |
17437 |
+ if (has_addr_filter(event)) { |
17438 |
+- event->addr_filters_offs = kcalloc(pmu->nr_addr_filters, |
17439 |
+- sizeof(unsigned long), |
17440 |
+- GFP_KERNEL); |
17441 |
+- if (!event->addr_filters_offs) { |
17442 |
++ event->addr_filter_ranges = kcalloc(pmu->nr_addr_filters, |
17443 |
++ sizeof(struct perf_addr_filter_range), |
17444 |
++ GFP_KERNEL); |
17445 |
++ if (!event->addr_filter_ranges) { |
17446 |
+ err = -ENOMEM; |
17447 |
+ goto err_per_task; |
17448 |
+ } |
17449 |
+ |
17450 |
++ /* |
17451 |
++ * Clone the parent's vma offsets: they are valid until exec() |
17452 |
++ * even if the mm is not shared with the parent. |
17453 |
++ */ |
17454 |
++ if (event->parent) { |
17455 |
++ struct perf_addr_filters_head *ifh = perf_event_addr_filters(event); |
17456 |
++ |
17457 |
++ raw_spin_lock_irq(&ifh->lock); |
17458 |
++ memcpy(event->addr_filter_ranges, |
17459 |
++ event->parent->addr_filter_ranges, |
17460 |
++ pmu->nr_addr_filters * sizeof(struct perf_addr_filter_range)); |
17461 |
++ raw_spin_unlock_irq(&ifh->lock); |
17462 |
++ } |
17463 |
++ |
17464 |
+ /* force hw sync on the address filters */ |
17465 |
+ event->addr_filters_gen = 1; |
17466 |
+ } |
17467 |
+@@ -10154,7 +10190,7 @@ perf_event_alloc(struct perf_event_attr *attr, int cpu, |
17468 |
+ return event; |
17469 |
+ |
17470 |
+ err_addr_filters: |
17471 |
+- kfree(event->addr_filters_offs); |
17472 |
++ kfree(event->addr_filter_ranges); |
17473 |
+ |
17474 |
+ err_per_task: |
17475 |
+ exclusive_event_destroy(event); |
17476 |
+diff --git a/kernel/fork.c b/kernel/fork.c |
17477 |
+index 8cb5cd7c97e1..1a2d18e98bf9 100644 |
17478 |
+--- a/kernel/fork.c |
17479 |
++++ b/kernel/fork.c |
17480 |
+@@ -216,6 +216,7 @@ static unsigned long *alloc_thread_stack_node(struct task_struct *tsk, int node) |
17481 |
+ memset(s->addr, 0, THREAD_SIZE); |
17482 |
+ |
17483 |
+ tsk->stack_vm_area = s; |
17484 |
++ tsk->stack = s->addr; |
17485 |
+ return s->addr; |
17486 |
+ } |
17487 |
+ |
17488 |
+@@ -230,14 +231,20 @@ static unsigned long *alloc_thread_stack_node(struct task_struct *tsk, int node) |
17489 |
+ * free_thread_stack() can be called in interrupt context, |
17490 |
+ * so cache the vm_struct. |
17491 |
+ */ |
17492 |
+- if (stack) |
17493 |
++ if (stack) { |
17494 |
+ tsk->stack_vm_area = find_vm_area(stack); |
17495 |
++ tsk->stack = stack; |
17496 |
++ } |
17497 |
+ return stack; |
17498 |
+ #else |
17499 |
+ struct page *page = alloc_pages_node(node, THREADINFO_GFP, |
17500 |
+ THREAD_SIZE_ORDER); |
17501 |
+ |
17502 |
+- return page ? page_address(page) : NULL; |
17503 |
++ if (likely(page)) { |
17504 |
++ tsk->stack = page_address(page); |
17505 |
++ return tsk->stack; |
17506 |
++ } |
17507 |
++ return NULL; |
17508 |
+ #endif |
17509 |
+ } |
17510 |
+ |
17511 |
+@@ -268,7 +275,10 @@ static struct kmem_cache *thread_stack_cache; |
17512 |
+ static unsigned long *alloc_thread_stack_node(struct task_struct *tsk, |
17513 |
+ int node) |
17514 |
+ { |
17515 |
+- return kmem_cache_alloc_node(thread_stack_cache, THREADINFO_GFP, node); |
17516 |
++ unsigned long *stack; |
17517 |
++ stack = kmem_cache_alloc_node(thread_stack_cache, THREADINFO_GFP, node); |
17518 |
++ tsk->stack = stack; |
17519 |
++ return stack; |
17520 |
+ } |
17521 |
+ |
17522 |
+ static void free_thread_stack(struct task_struct *tsk) |
17523 |
+diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c |
17524 |
+index 5d9fc01b60a6..6e8520a81dd8 100644 |
17525 |
+--- a/kernel/irq/irqdomain.c |
17526 |
++++ b/kernel/irq/irqdomain.c |
17527 |
+@@ -148,6 +148,7 @@ struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size, |
17528 |
+ switch (fwid->type) { |
17529 |
+ case IRQCHIP_FWNODE_NAMED: |
17530 |
+ case IRQCHIP_FWNODE_NAMED_ID: |
17531 |
++ domain->fwnode = fwnode; |
17532 |
+ domain->name = kstrdup(fwid->name, GFP_KERNEL); |
17533 |
+ if (!domain->name) { |
17534 |
+ kfree(domain); |
17535 |
+@@ -183,7 +184,7 @@ struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size, |
17536 |
+ * unhappy about. Replace them with ':', which does |
17537 |
+ * the trick and is not as offensive as '\'... |
17538 |
+ */ |
17539 |
+- name = kstrdup(of_node_full_name(of_node), GFP_KERNEL); |
17540 |
++ name = kasprintf(GFP_KERNEL, "%pOF", of_node); |
17541 |
+ if (!name) { |
17542 |
+ kfree(domain); |
17543 |
+ return NULL; |
17544 |
+diff --git a/kernel/signal.c b/kernel/signal.c |
17545 |
+index 7278302e3485..08911bb6fe9a 100644 |
17546 |
+--- a/kernel/signal.c |
17547 |
++++ b/kernel/signal.c |
17548 |
+@@ -86,6 +86,11 @@ static bool sig_task_ignored(struct task_struct *t, int sig, bool force) |
17549 |
+ handler == SIG_DFL && !(force && sig_kernel_only(sig))) |
17550 |
+ return true; |
17551 |
+ |
17552 |
++ /* Only allow kernel generated signals to this kthread */ |
17553 |
++ if (unlikely((t->flags & PF_KTHREAD) && |
17554 |
++ (handler == SIG_KTHREAD_KERNEL) && !force)) |
17555 |
++ return true; |
17556 |
++ |
17557 |
+ return sig_handler_ignored(handler, sig); |
17558 |
+ } |
17559 |
+ |
17560 |
+diff --git a/lib/devres.c b/lib/devres.c |
17561 |
+index faccf1a037d0..aa0f5308ac6b 100644 |
17562 |
+--- a/lib/devres.c |
17563 |
++++ b/lib/devres.c |
17564 |
+@@ -131,7 +131,8 @@ EXPORT_SYMBOL(devm_iounmap); |
17565 |
+ * if (IS_ERR(base)) |
17566 |
+ * return PTR_ERR(base); |
17567 |
+ */ |
17568 |
+-void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res) |
17569 |
++void __iomem *devm_ioremap_resource(struct device *dev, |
17570 |
++ const struct resource *res) |
17571 |
+ { |
17572 |
+ resource_size_t size; |
17573 |
+ const char *name; |
17574 |
+diff --git a/lib/kfifo.c b/lib/kfifo.c |
17575 |
+index 015656aa8182..6320ab91e343 100644 |
17576 |
+--- a/lib/kfifo.c |
17577 |
++++ b/lib/kfifo.c |
17578 |
+@@ -82,7 +82,8 @@ int __kfifo_init(struct __kfifo *fifo, void *buffer, |
17579 |
+ { |
17580 |
+ size /= esize; |
17581 |
+ |
17582 |
+- size = roundup_pow_of_two(size); |
17583 |
++ if (!is_power_of_2(size)) |
17584 |
++ size = rounddown_pow_of_two(size); |
17585 |
+ |
17586 |
+ fifo->in = 0; |
17587 |
+ fifo->out = 0; |
17588 |
+diff --git a/net/6lowpan/nhc.c b/net/6lowpan/nhc.c |
17589 |
+index 4fa2fdda174d..9e56fb98f33c 100644 |
17590 |
+--- a/net/6lowpan/nhc.c |
17591 |
++++ b/net/6lowpan/nhc.c |
17592 |
+@@ -18,7 +18,7 @@ |
17593 |
+ #include "nhc.h" |
17594 |
+ |
17595 |
+ static struct rb_root rb_root = RB_ROOT; |
17596 |
+-static struct lowpan_nhc *lowpan_nexthdr_nhcs[NEXTHDR_MAX]; |
17597 |
++static struct lowpan_nhc *lowpan_nexthdr_nhcs[NEXTHDR_MAX + 1]; |
17598 |
+ static DEFINE_SPINLOCK(lowpan_nhc_lock); |
17599 |
+ |
17600 |
+ static int lowpan_nhc_insert(struct lowpan_nhc *nhc) |
17601 |
+diff --git a/net/bpfilter/bpfilter_kern.c b/net/bpfilter/bpfilter_kern.c |
17602 |
+index 94e88f510c5b..450b257afa84 100644 |
17603 |
+--- a/net/bpfilter/bpfilter_kern.c |
17604 |
++++ b/net/bpfilter/bpfilter_kern.c |
17605 |
+@@ -25,7 +25,7 @@ static void shutdown_umh(struct umh_info *info) |
17606 |
+ return; |
17607 |
+ tsk = get_pid_task(find_vpid(info->pid), PIDTYPE_PID); |
17608 |
+ if (tsk) { |
17609 |
+- force_sig(SIGKILL, tsk); |
17610 |
++ send_sig(SIGKILL, tsk, 1); |
17611 |
+ put_task_struct(tsk); |
17612 |
+ } |
17613 |
+ fput(info->pipe_to_umh); |
17614 |
+diff --git a/net/bridge/br_arp_nd_proxy.c b/net/bridge/br_arp_nd_proxy.c |
17615 |
+index 2cf7716254be..d42e3904b498 100644 |
17616 |
+--- a/net/bridge/br_arp_nd_proxy.c |
17617 |
++++ b/net/bridge/br_arp_nd_proxy.c |
17618 |
+@@ -311,7 +311,7 @@ static void br_nd_send(struct net_bridge *br, struct net_bridge_port *p, |
17619 |
+ /* Neighbor Advertisement */ |
17620 |
+ memset(na, 0, sizeof(*na) + na_olen); |
17621 |
+ na->icmph.icmp6_type = NDISC_NEIGHBOUR_ADVERTISEMENT; |
17622 |
+- na->icmph.icmp6_router = 0; /* XXX: should be 1 ? */ |
17623 |
++ na->icmph.icmp6_router = (n->flags & NTF_ROUTER) ? 1 : 0; |
17624 |
+ na->icmph.icmp6_override = 1; |
17625 |
+ na->icmph.icmp6_solicited = 1; |
17626 |
+ na->target = ns->target; |
17627 |
+diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c |
17628 |
+index 785e19afd6aa..f59230e4fc29 100644 |
17629 |
+--- a/net/bridge/netfilter/ebtables.c |
17630 |
++++ b/net/bridge/netfilter/ebtables.c |
17631 |
+@@ -2165,7 +2165,9 @@ static int compat_copy_entries(unsigned char *data, unsigned int size_user, |
17632 |
+ if (ret < 0) |
17633 |
+ return ret; |
17634 |
+ |
17635 |
+- WARN_ON(size_remaining); |
17636 |
++ if (size_remaining) |
17637 |
++ return -EINVAL; |
17638 |
++ |
17639 |
+ return state->buf_kern_offset; |
17640 |
+ } |
17641 |
+ |
17642 |
+diff --git a/net/core/dev.c b/net/core/dev.c |
17643 |
+index a26d87073f71..73ebacabfde8 100644 |
17644 |
+--- a/net/core/dev.c |
17645 |
++++ b/net/core/dev.c |
17646 |
+@@ -4349,12 +4349,17 @@ static u32 netif_receive_generic_xdp(struct sk_buff *skb, |
17647 |
+ |
17648 |
+ act = bpf_prog_run_xdp(xdp_prog, xdp); |
17649 |
+ |
17650 |
++ /* check if bpf_xdp_adjust_head was used */ |
17651 |
+ off = xdp->data - orig_data; |
17652 |
+- if (off > 0) |
17653 |
+- __skb_pull(skb, off); |
17654 |
+- else if (off < 0) |
17655 |
+- __skb_push(skb, -off); |
17656 |
+- skb->mac_header += off; |
17657 |
++ if (off) { |
17658 |
++ if (off > 0) |
17659 |
++ __skb_pull(skb, off); |
17660 |
++ else if (off < 0) |
17661 |
++ __skb_push(skb, -off); |
17662 |
++ |
17663 |
++ skb->mac_header += off; |
17664 |
++ skb_reset_network_header(skb); |
17665 |
++ } |
17666 |
+ |
17667 |
+ /* check if bpf_xdp_adjust_tail was used. it can only "shrink" |
17668 |
+ * pckt. |
17669 |
+@@ -4465,23 +4470,6 @@ static int netif_rx_internal(struct sk_buff *skb) |
17670 |
+ |
17671 |
+ trace_netif_rx(skb); |
17672 |
+ |
17673 |
+- if (static_branch_unlikely(&generic_xdp_needed_key)) { |
17674 |
+- int ret; |
17675 |
+- |
17676 |
+- preempt_disable(); |
17677 |
+- rcu_read_lock(); |
17678 |
+- ret = do_xdp_generic(rcu_dereference(skb->dev->xdp_prog), skb); |
17679 |
+- rcu_read_unlock(); |
17680 |
+- preempt_enable(); |
17681 |
+- |
17682 |
+- /* Consider XDP consuming the packet a success from |
17683 |
+- * the netdev point of view we do not want to count |
17684 |
+- * this as an error. |
17685 |
+- */ |
17686 |
+- if (ret != XDP_PASS) |
17687 |
+- return NET_RX_SUCCESS; |
17688 |
+- } |
17689 |
+- |
17690 |
+ #ifdef CONFIG_RPS |
17691 |
+ if (static_key_false(&rps_needed)) { |
17692 |
+ struct rps_dev_flow voidflow, *rflow = &voidflow; |
17693 |
+@@ -4815,6 +4803,18 @@ another_round: |
17694 |
+ |
17695 |
+ __this_cpu_inc(softnet_data.processed); |
17696 |
+ |
17697 |
++ if (static_branch_unlikely(&generic_xdp_needed_key)) { |
17698 |
++ int ret2; |
17699 |
++ |
17700 |
++ preempt_disable(); |
17701 |
++ ret2 = do_xdp_generic(rcu_dereference(skb->dev->xdp_prog), skb); |
17702 |
++ preempt_enable(); |
17703 |
++ |
17704 |
++ if (ret2 != XDP_PASS) |
17705 |
++ return NET_RX_DROP; |
17706 |
++ skb_reset_mac_len(skb); |
17707 |
++ } |
17708 |
++ |
17709 |
+ if (skb->protocol == cpu_to_be16(ETH_P_8021Q) || |
17710 |
+ skb->protocol == cpu_to_be16(ETH_P_8021AD)) { |
17711 |
+ skb = skb_vlan_untag(skb); |
17712 |
+@@ -5133,19 +5133,6 @@ static int netif_receive_skb_internal(struct sk_buff *skb) |
17713 |
+ if (skb_defer_rx_timestamp(skb)) |
17714 |
+ return NET_RX_SUCCESS; |
17715 |
+ |
17716 |
+- if (static_branch_unlikely(&generic_xdp_needed_key)) { |
17717 |
+- int ret; |
17718 |
+- |
17719 |
+- preempt_disable(); |
17720 |
+- rcu_read_lock(); |
17721 |
+- ret = do_xdp_generic(rcu_dereference(skb->dev->xdp_prog), skb); |
17722 |
+- rcu_read_unlock(); |
17723 |
+- preempt_enable(); |
17724 |
+- |
17725 |
+- if (ret != XDP_PASS) |
17726 |
+- return NET_RX_DROP; |
17727 |
+- } |
17728 |
+- |
17729 |
+ rcu_read_lock(); |
17730 |
+ #ifdef CONFIG_RPS |
17731 |
+ if (static_key_false(&rps_needed)) { |
17732 |
+@@ -5166,7 +5153,6 @@ static int netif_receive_skb_internal(struct sk_buff *skb) |
17733 |
+ |
17734 |
+ static void netif_receive_skb_list_internal(struct list_head *head) |
17735 |
+ { |
17736 |
+- struct bpf_prog *xdp_prog = NULL; |
17737 |
+ struct sk_buff *skb, *next; |
17738 |
+ struct list_head sublist; |
17739 |
+ |
17740 |
+@@ -5179,21 +5165,6 @@ static void netif_receive_skb_list_internal(struct list_head *head) |
17741 |
+ } |
17742 |
+ list_splice_init(&sublist, head); |
17743 |
+ |
17744 |
+- if (static_branch_unlikely(&generic_xdp_needed_key)) { |
17745 |
+- preempt_disable(); |
17746 |
+- rcu_read_lock(); |
17747 |
+- list_for_each_entry_safe(skb, next, head, list) { |
17748 |
+- xdp_prog = rcu_dereference(skb->dev->xdp_prog); |
17749 |
+- skb_list_del_init(skb); |
17750 |
+- if (do_xdp_generic(xdp_prog, skb) == XDP_PASS) |
17751 |
+- list_add_tail(&skb->list, &sublist); |
17752 |
+- } |
17753 |
+- rcu_read_unlock(); |
17754 |
+- preempt_enable(); |
17755 |
+- /* Put passed packets back on main list */ |
17756 |
+- list_splice_init(&sublist, head); |
17757 |
+- } |
17758 |
+- |
17759 |
+ rcu_read_lock(); |
17760 |
+ #ifdef CONFIG_RPS |
17761 |
+ if (static_key_false(&rps_needed)) { |
17762 |
+diff --git a/net/core/filter.c b/net/core/filter.c |
17763 |
+index 91b950261975..9daf1a4118b5 100644 |
17764 |
+--- a/net/core/filter.c |
17765 |
++++ b/net/core/filter.c |
17766 |
+@@ -4367,7 +4367,7 @@ static int bpf_ipv6_fib_lookup(struct net *net, struct bpf_fib_lookup *params, |
17767 |
+ return -ENODEV; |
17768 |
+ |
17769 |
+ idev = __in6_dev_get_safely(dev); |
17770 |
+- if (unlikely(!idev || !net->ipv6.devconf_all->forwarding)) |
17771 |
++ if (unlikely(!idev || !idev->cnf.forwarding)) |
17772 |
+ return BPF_FIB_LKUP_RET_FWD_DISABLED; |
17773 |
+ |
17774 |
+ if (flags & BPF_FIB_LOOKUP_OUTPUT) { |
17775 |
+diff --git a/net/core/neighbour.c b/net/core/neighbour.c |
17776 |
+index e260d44ebdca..bf738ec68cb5 100644 |
17777 |
+--- a/net/core/neighbour.c |
17778 |
++++ b/net/core/neighbour.c |
17779 |
+@@ -1885,8 +1885,8 @@ static int neightbl_fill_info(struct sk_buff *skb, struct neigh_table *tbl, |
17780 |
+ goto nla_put_failure; |
17781 |
+ { |
17782 |
+ unsigned long now = jiffies; |
17783 |
+- unsigned int flush_delta = now - tbl->last_flush; |
17784 |
+- unsigned int rand_delta = now - tbl->last_rand; |
17785 |
++ long flush_delta = now - tbl->last_flush; |
17786 |
++ long rand_delta = now - tbl->last_rand; |
17787 |
+ struct neigh_hash_table *nht; |
17788 |
+ struct ndt_config ndc = { |
17789 |
+ .ndtc_key_len = tbl->key_len, |
17790 |
+diff --git a/net/core/sock.c b/net/core/sock.c |
17791 |
+index bbde5f6a7dc9..b9ec14f2c729 100644 |
17792 |
+--- a/net/core/sock.c |
17793 |
++++ b/net/core/sock.c |
17794 |
+@@ -2179,8 +2179,8 @@ static void sk_leave_memory_pressure(struct sock *sk) |
17795 |
+ } else { |
17796 |
+ unsigned long *memory_pressure = sk->sk_prot->memory_pressure; |
17797 |
+ |
17798 |
+- if (memory_pressure && *memory_pressure) |
17799 |
+- *memory_pressure = 0; |
17800 |
++ if (memory_pressure && READ_ONCE(*memory_pressure)) |
17801 |
++ WRITE_ONCE(*memory_pressure, 0); |
17802 |
+ } |
17803 |
+ } |
17804 |
+ |
17805 |
+diff --git a/net/dsa/port.c b/net/dsa/port.c |
17806 |
+index ed0595459df1..ea7efc86b9d7 100644 |
17807 |
+--- a/net/dsa/port.c |
17808 |
++++ b/net/dsa/port.c |
17809 |
+@@ -69,7 +69,6 @@ static void dsa_port_set_state_now(struct dsa_port *dp, u8 state) |
17810 |
+ |
17811 |
+ int dsa_port_enable(struct dsa_port *dp, struct phy_device *phy) |
17812 |
+ { |
17813 |
+- u8 stp_state = dp->bridge_dev ? BR_STATE_BLOCKING : BR_STATE_FORWARDING; |
17814 |
+ struct dsa_switch *ds = dp->ds; |
17815 |
+ int port = dp->index; |
17816 |
+ int err; |
17817 |
+@@ -80,7 +79,8 @@ int dsa_port_enable(struct dsa_port *dp, struct phy_device *phy) |
17818 |
+ return err; |
17819 |
+ } |
17820 |
+ |
17821 |
+- dsa_port_set_state_now(dp, stp_state); |
17822 |
++ if (!dp->bridge_dev) |
17823 |
++ dsa_port_set_state_now(dp, BR_STATE_FORWARDING); |
17824 |
+ |
17825 |
+ return 0; |
17826 |
+ } |
17827 |
+@@ -90,7 +90,8 @@ void dsa_port_disable(struct dsa_port *dp, struct phy_device *phy) |
17828 |
+ struct dsa_switch *ds = dp->ds; |
17829 |
+ int port = dp->index; |
17830 |
+ |
17831 |
+- dsa_port_set_state_now(dp, BR_STATE_DISABLED); |
17832 |
++ if (!dp->bridge_dev) |
17833 |
++ dsa_port_set_state_now(dp, BR_STATE_DISABLED); |
17834 |
+ |
17835 |
+ if (ds->ops->port_disable) |
17836 |
+ ds->ops->port_disable(ds, port, phy); |
17837 |
+diff --git a/net/dsa/slave.c b/net/dsa/slave.c |
17838 |
+index b39720d0995d..8ee28b6016d8 100644 |
17839 |
+--- a/net/dsa/slave.c |
17840 |
++++ b/net/dsa/slave.c |
17841 |
+@@ -1219,9 +1219,9 @@ static int dsa_slave_phy_setup(struct net_device *slave_dev) |
17842 |
+ phy_flags = ds->ops->get_phy_flags(ds, dp->index); |
17843 |
+ |
17844 |
+ ret = phylink_of_phy_connect(dp->pl, port_dn, phy_flags); |
17845 |
+- if (ret == -ENODEV) { |
17846 |
+- /* We could not connect to a designated PHY or SFP, so use the |
17847 |
+- * switch internal MDIO bus instead |
17848 |
++ if (ret == -ENODEV && ds->slave_mii_bus) { |
17849 |
++ /* We could not connect to a designated PHY or SFP, so try to |
17850 |
++ * use the switch internal MDIO bus instead |
17851 |
+ */ |
17852 |
+ ret = dsa_slave_phy_connect(slave_dev, dp->index); |
17853 |
+ if (ret) { |
17854 |
+@@ -1233,7 +1233,7 @@ static int dsa_slave_phy_setup(struct net_device *slave_dev) |
17855 |
+ } |
17856 |
+ } |
17857 |
+ |
17858 |
+- return 0; |
17859 |
++ return ret; |
17860 |
+ } |
17861 |
+ |
17862 |
+ static struct lock_class_key dsa_slave_netdev_xmit_lock_key; |
17863 |
+diff --git a/net/ieee802154/6lowpan/reassembly.c b/net/ieee802154/6lowpan/reassembly.c |
17864 |
+index e7857a8ac86d..f3074249c6fc 100644 |
17865 |
+--- a/net/ieee802154/6lowpan/reassembly.c |
17866 |
++++ b/net/ieee802154/6lowpan/reassembly.c |
17867 |
+@@ -629,7 +629,7 @@ err_sysctl: |
17868 |
+ |
17869 |
+ void lowpan_net_frag_exit(void) |
17870 |
+ { |
17871 |
+- inet_frags_fini(&lowpan_frags); |
17872 |
+ lowpan_frags_sysctl_unregister(); |
17873 |
+ unregister_pernet_subsys(&lowpan_frags_ops); |
17874 |
++ inet_frags_fini(&lowpan_frags); |
17875 |
+ } |
17876 |
+diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c |
17877 |
+index 1fbe2f815474..bbf3b3daa999 100644 |
17878 |
+--- a/net/ipv4/af_inet.c |
17879 |
++++ b/net/ipv4/af_inet.c |
17880 |
+@@ -424,8 +424,8 @@ int inet_release(struct socket *sock) |
17881 |
+ if (sock_flag(sk, SOCK_LINGER) && |
17882 |
+ !(current->flags & PF_EXITING)) |
17883 |
+ timeout = sk->sk_lingertime; |
17884 |
+- sock->sk = NULL; |
17885 |
+ sk->sk_prot->close(sk, timeout); |
17886 |
++ sock->sk = NULL; |
17887 |
+ } |
17888 |
+ return 0; |
17889 |
+ } |
17890 |
+diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c |
17891 |
+index 636a11c56cf5..79320858e719 100644 |
17892 |
+--- a/net/ipv4/inet_connection_sock.c |
17893 |
++++ b/net/ipv4/inet_connection_sock.c |
17894 |
+@@ -937,7 +937,7 @@ struct sock *inet_csk_reqsk_queue_add(struct sock *sk, |
17895 |
+ req->sk = child; |
17896 |
+ req->dl_next = NULL; |
17897 |
+ if (queue->rskq_accept_head == NULL) |
17898 |
+- queue->rskq_accept_head = req; |
17899 |
++ WRITE_ONCE(queue->rskq_accept_head, req); |
17900 |
+ else |
17901 |
+ queue->rskq_accept_tail->dl_next = req; |
17902 |
+ queue->rskq_accept_tail = req; |
17903 |
+diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c |
17904 |
+index d63091812342..fbf30122e8bf 100644 |
17905 |
+--- a/net/ipv4/ip_output.c |
17906 |
++++ b/net/ipv4/ip_output.c |
17907 |
+@@ -940,7 +940,7 @@ static int __ip_append_data(struct sock *sk, |
17908 |
+ unsigned int fraglen; |
17909 |
+ unsigned int fraggap; |
17910 |
+ unsigned int alloclen; |
17911 |
+- unsigned int pagedlen = 0; |
17912 |
++ unsigned int pagedlen; |
17913 |
+ struct sk_buff *skb_prev; |
17914 |
+ alloc_new_skb: |
17915 |
+ skb_prev = skb; |
17916 |
+@@ -957,6 +957,7 @@ alloc_new_skb: |
17917 |
+ if (datalen > mtu - fragheaderlen) |
17918 |
+ datalen = maxfraglen - fragheaderlen; |
17919 |
+ fraglen = datalen + fragheaderlen; |
17920 |
++ pagedlen = 0; |
17921 |
+ |
17922 |
+ if ((flags & MSG_MORE) && |
17923 |
+ !(rt->dst.dev->features&NETIF_F_SG)) |
17924 |
+diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c |
17925 |
+index 420e891ac59d..f03a1b68e70f 100644 |
17926 |
+--- a/net/ipv4/ip_tunnel.c |
17927 |
++++ b/net/ipv4/ip_tunnel.c |
17928 |
+@@ -574,8 +574,9 @@ void ip_md_tunnel_xmit(struct sk_buff *skb, struct net_device *dev, u8 proto) |
17929 |
+ else if (skb->protocol == htons(ETH_P_IPV6)) |
17930 |
+ tos = ipv6_get_dsfield((const struct ipv6hdr *)inner_iph); |
17931 |
+ } |
17932 |
+- ip_tunnel_init_flow(&fl4, proto, key->u.ipv4.dst, key->u.ipv4.src, 0, |
17933 |
+- RT_TOS(tos), tunnel->parms.link, tunnel->fwmark); |
17934 |
++ ip_tunnel_init_flow(&fl4, proto, key->u.ipv4.dst, key->u.ipv4.src, |
17935 |
++ tunnel_id_to_key32(key->tun_id), RT_TOS(tos), |
17936 |
++ 0, skb->mark); |
17937 |
+ if (tunnel->encap.type != TUNNEL_ENCAP_NONE) |
17938 |
+ goto tx_error; |
17939 |
+ rt = ip_route_output_key(tunnel->net, &fl4); |
17940 |
+diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c |
17941 |
+index cd8a92e7a39e..af9361eba64a 100644 |
17942 |
+--- a/net/ipv4/tcp.c |
17943 |
++++ b/net/ipv4/tcp.c |
17944 |
+@@ -325,7 +325,7 @@ void tcp_enter_memory_pressure(struct sock *sk) |
17945 |
+ { |
17946 |
+ unsigned long val; |
17947 |
+ |
17948 |
+- if (tcp_memory_pressure) |
17949 |
++ if (READ_ONCE(tcp_memory_pressure)) |
17950 |
+ return; |
17951 |
+ val = jiffies; |
17952 |
+ |
17953 |
+@@ -340,7 +340,7 @@ void tcp_leave_memory_pressure(struct sock *sk) |
17954 |
+ { |
17955 |
+ unsigned long val; |
17956 |
+ |
17957 |
+- if (!tcp_memory_pressure) |
17958 |
++ if (!READ_ONCE(tcp_memory_pressure)) |
17959 |
+ return; |
17960 |
+ val = xchg(&tcp_memory_pressure, 0); |
17961 |
+ if (val) |
17962 |
+diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c |
17963 |
+index 0c0522b79b43..aa343654abfc 100644 |
17964 |
+--- a/net/ipv4/udp_offload.c |
17965 |
++++ b/net/ipv4/udp_offload.c |
17966 |
+@@ -227,6 +227,11 @@ struct sk_buff *__udp_gso_segment(struct sk_buff *gso_skb, |
17967 |
+ seg = segs; |
17968 |
+ uh = udp_hdr(seg); |
17969 |
+ |
17970 |
++ /* preserve TX timestamp flags and TS key for first segment */ |
17971 |
++ skb_shinfo(seg)->tskey = skb_shinfo(gso_skb)->tskey; |
17972 |
++ skb_shinfo(seg)->tx_flags |= |
17973 |
++ (skb_shinfo(gso_skb)->tx_flags & SKBTX_ANY_TSTAMP); |
17974 |
++ |
17975 |
+ /* compute checksum adjustment based on old length versus new */ |
17976 |
+ newlen = htons(sizeof(*uh) + mss); |
17977 |
+ check = csum16_add(csum16_sub(uh->check, uh->len), newlen); |
17978 |
+diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c |
17979 |
+index bbb5ffb3397d..7091568b9f63 100644 |
17980 |
+--- a/net/ipv6/ip6_fib.c |
17981 |
++++ b/net/ipv6/ip6_fib.c |
17982 |
+@@ -1529,7 +1529,8 @@ static struct fib6_node *fib6_locate_1(struct fib6_node *root, |
17983 |
+ if (plen == fn->fn_bit) |
17984 |
+ return fn; |
17985 |
+ |
17986 |
+- prev = fn; |
17987 |
++ if (fn->fn_flags & RTN_RTINFO) |
17988 |
++ prev = fn; |
17989 |
+ |
17990 |
+ next: |
17991 |
+ /* |
17992 |
+diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c |
17993 |
+index b3515a4f1303..1f2d0022ba6f 100644 |
17994 |
+--- a/net/ipv6/ip6_gre.c |
17995 |
++++ b/net/ipv6/ip6_gre.c |
17996 |
+@@ -2218,6 +2218,7 @@ static void ip6erspan_tap_setup(struct net_device *dev) |
17997 |
+ { |
17998 |
+ ether_setup(dev); |
17999 |
+ |
18000 |
++ dev->max_mtu = 0; |
18001 |
+ dev->netdev_ops = &ip6erspan_netdev_ops; |
18002 |
+ dev->needs_free_netdev = true; |
18003 |
+ dev->priv_destructor = ip6gre_dev_free; |
18004 |
+diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c |
18005 |
+index eed9231c90ad..9886a84c2511 100644 |
18006 |
+--- a/net/ipv6/ip6_output.c |
18007 |
++++ b/net/ipv6/ip6_output.c |
18008 |
+@@ -1357,7 +1357,7 @@ emsgsize: |
18009 |
+ unsigned int fraglen; |
18010 |
+ unsigned int fraggap; |
18011 |
+ unsigned int alloclen; |
18012 |
+- unsigned int pagedlen = 0; |
18013 |
++ unsigned int pagedlen; |
18014 |
+ alloc_new_skb: |
18015 |
+ /* There's no room in the current skb */ |
18016 |
+ if (skb) |
18017 |
+@@ -1381,6 +1381,7 @@ alloc_new_skb: |
18018 |
+ if (datalen > (cork->length <= mtu && !(cork->flags & IPCORK_ALLFRAG) ? mtu : maxfraglen) - fragheaderlen) |
18019 |
+ datalen = maxfraglen - fragheaderlen - rt->dst.trailer_len; |
18020 |
+ fraglen = datalen + fragheaderlen; |
18021 |
++ pagedlen = 0; |
18022 |
+ |
18023 |
+ if ((flags & MSG_MORE) && |
18024 |
+ !(rt->dst.dev->features&NETIF_F_SG)) |
18025 |
+diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c |
18026 |
+index 4856d9320b28..a41156a00dd4 100644 |
18027 |
+--- a/net/ipv6/raw.c |
18028 |
++++ b/net/ipv6/raw.c |
18029 |
+@@ -660,6 +660,8 @@ static int rawv6_send_hdrinc(struct sock *sk, struct msghdr *msg, int length, |
18030 |
+ |
18031 |
+ skb->ip_summed = CHECKSUM_NONE; |
18032 |
+ |
18033 |
++ sock_tx_timestamp(sk, sockc->tsflags, &skb_shinfo(skb)->tx_flags); |
18034 |
++ |
18035 |
+ if (flags & MSG_CONFIRM) |
18036 |
+ skb_set_dst_pending_confirm(skb, 1); |
18037 |
+ |
18038 |
+diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c |
18039 |
+index 095825f964e2..c6132e39ab16 100644 |
18040 |
+--- a/net/ipv6/reassembly.c |
18041 |
++++ b/net/ipv6/reassembly.c |
18042 |
+@@ -593,8 +593,8 @@ err_protocol: |
18043 |
+ |
18044 |
+ void ipv6_frag_exit(void) |
18045 |
+ { |
18046 |
+- inet_frags_fini(&ip6_frags); |
18047 |
+ ip6_frags_sysctl_unregister(); |
18048 |
+ unregister_pernet_subsys(&ip6_frags_ops); |
18049 |
+ inet6_del_protocol(&frag_protocol, IPPROTO_FRAGMENT); |
18050 |
++ inet_frags_fini(&ip6_frags); |
18051 |
+ } |
18052 |
+diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c |
18053 |
+index f024914da1b2..23a1002ed86d 100644 |
18054 |
+--- a/net/iucv/af_iucv.c |
18055 |
++++ b/net/iucv/af_iucv.c |
18056 |
+@@ -13,6 +13,7 @@ |
18057 |
+ #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt |
18058 |
+ |
18059 |
+ #include <linux/module.h> |
18060 |
++#include <linux/netdevice.h> |
18061 |
+ #include <linux/types.h> |
18062 |
+ #include <linux/list.h> |
18063 |
+ #include <linux/errno.h> |
18064 |
+@@ -355,6 +356,9 @@ static int afiucv_hs_send(struct iucv_message *imsg, struct sock *sock, |
18065 |
+ err = -ENODEV; |
18066 |
+ goto err_free; |
18067 |
+ } |
18068 |
++ |
18069 |
++ dev_hard_header(skb, skb->dev, ETH_P_AF_IUCV, NULL, NULL, skb->len); |
18070 |
++ |
18071 |
+ if (!(skb->dev->flags & IFF_UP) || !netif_carrier_ok(skb->dev)) { |
18072 |
+ err = -ENETDOWN; |
18073 |
+ goto err_free; |
18074 |
+@@ -367,6 +371,8 @@ static int afiucv_hs_send(struct iucv_message *imsg, struct sock *sock, |
18075 |
+ skb_trim(skb, skb->dev->mtu); |
18076 |
+ } |
18077 |
+ skb->protocol = cpu_to_be16(ETH_P_AF_IUCV); |
18078 |
++ |
18079 |
++ __skb_header_release(skb); |
18080 |
+ nskb = skb_clone(skb, GFP_ATOMIC); |
18081 |
+ if (!nskb) { |
18082 |
+ err = -ENOMEM; |
18083 |
+@@ -466,12 +472,14 @@ static void iucv_sever_path(struct sock *sk, int with_user_data) |
18084 |
+ /* Send controlling flags through an IUCV socket for HIPER transport */ |
18085 |
+ static int iucv_send_ctrl(struct sock *sk, u8 flags) |
18086 |
+ { |
18087 |
++ struct iucv_sock *iucv = iucv_sk(sk); |
18088 |
+ int err = 0; |
18089 |
+ int blen; |
18090 |
+ struct sk_buff *skb; |
18091 |
+ u8 shutdown = 0; |
18092 |
+ |
18093 |
+- blen = sizeof(struct af_iucv_trans_hdr) + ETH_HLEN; |
18094 |
++ blen = sizeof(struct af_iucv_trans_hdr) + |
18095 |
++ LL_RESERVED_SPACE(iucv->hs_dev); |
18096 |
+ if (sk->sk_shutdown & SEND_SHUTDOWN) { |
18097 |
+ /* controlling flags should be sent anyway */ |
18098 |
+ shutdown = sk->sk_shutdown; |
18099 |
+@@ -1131,7 +1139,8 @@ static int iucv_sock_sendmsg(struct socket *sock, struct msghdr *msg, |
18100 |
+ * segmented records using the MSG_EOR flag), but |
18101 |
+ * for SOCK_STREAM we might want to improve it in future */ |
18102 |
+ if (iucv->transport == AF_IUCV_TRANS_HIPER) { |
18103 |
+- headroom = sizeof(struct af_iucv_trans_hdr) + ETH_HLEN; |
18104 |
++ headroom = sizeof(struct af_iucv_trans_hdr) + |
18105 |
++ LL_RESERVED_SPACE(iucv->hs_dev); |
18106 |
+ linear = len; |
18107 |
+ } else { |
18108 |
+ if (len < PAGE_SIZE) { |
18109 |
+@@ -2456,6 +2465,13 @@ out: |
18110 |
+ return err; |
18111 |
+ } |
18112 |
+ |
18113 |
++static void afiucv_iucv_exit(void) |
18114 |
++{ |
18115 |
++ device_unregister(af_iucv_dev); |
18116 |
++ driver_unregister(&af_iucv_driver); |
18117 |
++ pr_iucv->iucv_unregister(&af_iucv_handler, 0); |
18118 |
++} |
18119 |
++ |
18120 |
+ static int __init afiucv_init(void) |
18121 |
+ { |
18122 |
+ int err; |
18123 |
+@@ -2489,11 +2505,18 @@ static int __init afiucv_init(void) |
18124 |
+ err = afiucv_iucv_init(); |
18125 |
+ if (err) |
18126 |
+ goto out_sock; |
18127 |
+- } else |
18128 |
+- register_netdevice_notifier(&afiucv_netdev_notifier); |
18129 |
++ } |
18130 |
++ |
18131 |
++ err = register_netdevice_notifier(&afiucv_netdev_notifier); |
18132 |
++ if (err) |
18133 |
++ goto out_notifier; |
18134 |
++ |
18135 |
+ dev_add_pack(&iucv_packet_type); |
18136 |
+ return 0; |
18137 |
+ |
18138 |
++out_notifier: |
18139 |
++ if (pr_iucv) |
18140 |
++ afiucv_iucv_exit(); |
18141 |
+ out_sock: |
18142 |
+ sock_unregister(PF_IUCV); |
18143 |
+ out_proto: |
18144 |
+@@ -2507,12 +2530,11 @@ out: |
18145 |
+ static void __exit afiucv_exit(void) |
18146 |
+ { |
18147 |
+ if (pr_iucv) { |
18148 |
+- device_unregister(af_iucv_dev); |
18149 |
+- driver_unregister(&af_iucv_driver); |
18150 |
+- pr_iucv->iucv_unregister(&af_iucv_handler, 0); |
18151 |
++ afiucv_iucv_exit(); |
18152 |
+ symbol_put(iucv_if); |
18153 |
+- } else |
18154 |
+- unregister_netdevice_notifier(&afiucv_netdev_notifier); |
18155 |
++ } |
18156 |
++ |
18157 |
++ unregister_netdevice_notifier(&afiucv_netdev_notifier); |
18158 |
+ dev_remove_pack(&iucv_packet_type); |
18159 |
+ sock_unregister(PF_IUCV); |
18160 |
+ proto_unregister(&iucv_proto); |
18161 |
+diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c |
18162 |
+index 52b5a2797c0c..e4dec03a19fe 100644 |
18163 |
+--- a/net/l2tp/l2tp_core.c |
18164 |
++++ b/net/l2tp/l2tp_core.c |
18165 |
+@@ -1735,7 +1735,8 @@ static __net_exit void l2tp_exit_net(struct net *net) |
18166 |
+ } |
18167 |
+ rcu_read_unlock_bh(); |
18168 |
+ |
18169 |
+- flush_workqueue(l2tp_wq); |
18170 |
++ if (l2tp_wq) |
18171 |
++ flush_workqueue(l2tp_wq); |
18172 |
+ rcu_barrier(); |
18173 |
+ |
18174 |
+ for (hash = 0; hash < L2TP_HASH_SIZE_2; hash++) |
18175 |
+diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c |
18176 |
+index b99e73a7e7e0..ce841d59bc72 100644 |
18177 |
+--- a/net/llc/af_llc.c |
18178 |
++++ b/net/llc/af_llc.c |
18179 |
+@@ -113,22 +113,26 @@ static inline u8 llc_ui_header_len(struct sock *sk, struct sockaddr_llc *addr) |
18180 |
+ * |
18181 |
+ * Send data via reliable llc2 connection. |
18182 |
+ * Returns 0 upon success, non-zero if action did not succeed. |
18183 |
++ * |
18184 |
++ * This function always consumes a reference to the skb. |
18185 |
+ */ |
18186 |
+ static int llc_ui_send_data(struct sock* sk, struct sk_buff *skb, int noblock) |
18187 |
+ { |
18188 |
+ struct llc_sock* llc = llc_sk(sk); |
18189 |
+- int rc = 0; |
18190 |
+ |
18191 |
+ if (unlikely(llc_data_accept_state(llc->state) || |
18192 |
+ llc->remote_busy_flag || |
18193 |
+ llc->p_flag)) { |
18194 |
+ long timeout = sock_sndtimeo(sk, noblock); |
18195 |
++ int rc; |
18196 |
+ |
18197 |
+ rc = llc_ui_wait_for_busy_core(sk, timeout); |
18198 |
++ if (rc) { |
18199 |
++ kfree_skb(skb); |
18200 |
++ return rc; |
18201 |
++ } |
18202 |
+ } |
18203 |
+- if (unlikely(!rc)) |
18204 |
+- rc = llc_build_and_send_pkt(sk, skb); |
18205 |
+- return rc; |
18206 |
++ return llc_build_and_send_pkt(sk, skb); |
18207 |
+ } |
18208 |
+ |
18209 |
+ static void llc_ui_sk_init(struct socket *sock, struct sock *sk) |
18210 |
+@@ -900,7 +904,7 @@ static int llc_ui_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) |
18211 |
+ DECLARE_SOCKADDR(struct sockaddr_llc *, addr, msg->msg_name); |
18212 |
+ int flags = msg->msg_flags; |
18213 |
+ int noblock = flags & MSG_DONTWAIT; |
18214 |
+- struct sk_buff *skb; |
18215 |
++ struct sk_buff *skb = NULL; |
18216 |
+ size_t size = 0; |
18217 |
+ int rc = -EINVAL, copied = 0, hdrlen; |
18218 |
+ |
18219 |
+@@ -909,10 +913,10 @@ static int llc_ui_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) |
18220 |
+ lock_sock(sk); |
18221 |
+ if (addr) { |
18222 |
+ if (msg->msg_namelen < sizeof(*addr)) |
18223 |
+- goto release; |
18224 |
++ goto out; |
18225 |
+ } else { |
18226 |
+ if (llc_ui_addr_null(&llc->addr)) |
18227 |
+- goto release; |
18228 |
++ goto out; |
18229 |
+ addr = &llc->addr; |
18230 |
+ } |
18231 |
+ /* must bind connection to sap if user hasn't done it. */ |
18232 |
+@@ -920,7 +924,7 @@ static int llc_ui_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) |
18233 |
+ /* bind to sap with null dev, exclusive. */ |
18234 |
+ rc = llc_ui_autobind(sock, addr); |
18235 |
+ if (rc) |
18236 |
+- goto release; |
18237 |
++ goto out; |
18238 |
+ } |
18239 |
+ hdrlen = llc->dev->hard_header_len + llc_ui_header_len(sk, addr); |
18240 |
+ size = hdrlen + len; |
18241 |
+@@ -929,12 +933,12 @@ static int llc_ui_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) |
18242 |
+ copied = size - hdrlen; |
18243 |
+ rc = -EINVAL; |
18244 |
+ if (copied < 0) |
18245 |
+- goto release; |
18246 |
++ goto out; |
18247 |
+ release_sock(sk); |
18248 |
+ skb = sock_alloc_send_skb(sk, size, noblock, &rc); |
18249 |
+ lock_sock(sk); |
18250 |
+ if (!skb) |
18251 |
+- goto release; |
18252 |
++ goto out; |
18253 |
+ skb->dev = llc->dev; |
18254 |
+ skb->protocol = llc_proto_type(addr->sllc_arphrd); |
18255 |
+ skb_reserve(skb, hdrlen); |
18256 |
+@@ -944,29 +948,31 @@ static int llc_ui_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) |
18257 |
+ if (sk->sk_type == SOCK_DGRAM || addr->sllc_ua) { |
18258 |
+ llc_build_and_send_ui_pkt(llc->sap, skb, addr->sllc_mac, |
18259 |
+ addr->sllc_sap); |
18260 |
++ skb = NULL; |
18261 |
+ goto out; |
18262 |
+ } |
18263 |
+ if (addr->sllc_test) { |
18264 |
+ llc_build_and_send_test_pkt(llc->sap, skb, addr->sllc_mac, |
18265 |
+ addr->sllc_sap); |
18266 |
++ skb = NULL; |
18267 |
+ goto out; |
18268 |
+ } |
18269 |
+ if (addr->sllc_xid) { |
18270 |
+ llc_build_and_send_xid_pkt(llc->sap, skb, addr->sllc_mac, |
18271 |
+ addr->sllc_sap); |
18272 |
++ skb = NULL; |
18273 |
+ goto out; |
18274 |
+ } |
18275 |
+ rc = -ENOPROTOOPT; |
18276 |
+ if (!(sk->sk_type == SOCK_STREAM && !addr->sllc_ua)) |
18277 |
+ goto out; |
18278 |
+ rc = llc_ui_send_data(sk, skb, noblock); |
18279 |
++ skb = NULL; |
18280 |
+ out: |
18281 |
+- if (rc) { |
18282 |
+- kfree_skb(skb); |
18283 |
+-release: |
18284 |
++ kfree_skb(skb); |
18285 |
++ if (rc) |
18286 |
+ dprintk("%s: failed sending from %02X to %02X: %d\n", |
18287 |
+ __func__, llc->laddr.lsap, llc->daddr.lsap, rc); |
18288 |
+- } |
18289 |
+ release_sock(sk); |
18290 |
+ return rc ? : copied; |
18291 |
+ } |
18292 |
+diff --git a/net/llc/llc_conn.c b/net/llc/llc_conn.c |
18293 |
+index ed2aca12460c..a79b739eb223 100644 |
18294 |
+--- a/net/llc/llc_conn.c |
18295 |
++++ b/net/llc/llc_conn.c |
18296 |
+@@ -55,6 +55,8 @@ int sysctl_llc2_busy_timeout = LLC2_BUSY_TIME * HZ; |
18297 |
+ * (executing it's actions and changing state), upper layer will be |
18298 |
+ * indicated or confirmed, if needed. Returns 0 for success, 1 for |
18299 |
+ * failure. The socket lock has to be held before calling this function. |
18300 |
++ * |
18301 |
++ * This function always consumes a reference to the skb. |
18302 |
+ */ |
18303 |
+ int llc_conn_state_process(struct sock *sk, struct sk_buff *skb) |
18304 |
+ { |
18305 |
+@@ -62,12 +64,6 @@ int llc_conn_state_process(struct sock *sk, struct sk_buff *skb) |
18306 |
+ struct llc_sock *llc = llc_sk(skb->sk); |
18307 |
+ struct llc_conn_state_ev *ev = llc_conn_ev(skb); |
18308 |
+ |
18309 |
+- /* |
18310 |
+- * We have to hold the skb, because llc_conn_service will kfree it in |
18311 |
+- * the sending path and we need to look at the skb->cb, where we encode |
18312 |
+- * llc_conn_state_ev. |
18313 |
+- */ |
18314 |
+- skb_get(skb); |
18315 |
+ ev->ind_prim = ev->cfm_prim = 0; |
18316 |
+ /* |
18317 |
+ * Send event to state machine |
18318 |
+@@ -75,21 +71,12 @@ int llc_conn_state_process(struct sock *sk, struct sk_buff *skb) |
18319 |
+ rc = llc_conn_service(skb->sk, skb); |
18320 |
+ if (unlikely(rc != 0)) { |
18321 |
+ printk(KERN_ERR "%s: llc_conn_service failed\n", __func__); |
18322 |
+- goto out_kfree_skb; |
18323 |
+- } |
18324 |
+- |
18325 |
+- if (unlikely(!ev->ind_prim && !ev->cfm_prim)) { |
18326 |
+- /* indicate or confirm not required */ |
18327 |
+- if (!skb->next) |
18328 |
+- goto out_kfree_skb; |
18329 |
+ goto out_skb_put; |
18330 |
+ } |
18331 |
+ |
18332 |
+- if (unlikely(ev->ind_prim && ev->cfm_prim)) /* Paranoia */ |
18333 |
+- skb_get(skb); |
18334 |
+- |
18335 |
+ switch (ev->ind_prim) { |
18336 |
+ case LLC_DATA_PRIM: |
18337 |
++ skb_get(skb); |
18338 |
+ llc_save_primitive(sk, skb, LLC_DATA_PRIM); |
18339 |
+ if (unlikely(sock_queue_rcv_skb(sk, skb))) { |
18340 |
+ /* |
18341 |
+@@ -106,6 +93,7 @@ int llc_conn_state_process(struct sock *sk, struct sk_buff *skb) |
18342 |
+ * skb->sk pointing to the newly created struct sock in |
18343 |
+ * llc_conn_handler. -acme |
18344 |
+ */ |
18345 |
++ skb_get(skb); |
18346 |
+ skb_queue_tail(&sk->sk_receive_queue, skb); |
18347 |
+ sk->sk_state_change(sk); |
18348 |
+ break; |
18349 |
+@@ -121,7 +109,6 @@ int llc_conn_state_process(struct sock *sk, struct sk_buff *skb) |
18350 |
+ sk->sk_state_change(sk); |
18351 |
+ } |
18352 |
+ } |
18353 |
+- kfree_skb(skb); |
18354 |
+ sock_put(sk); |
18355 |
+ break; |
18356 |
+ case LLC_RESET_PRIM: |
18357 |
+@@ -130,14 +117,11 @@ int llc_conn_state_process(struct sock *sk, struct sk_buff *skb) |
18358 |
+ * RESET is not being notified to upper layers for now |
18359 |
+ */ |
18360 |
+ printk(KERN_INFO "%s: received a reset ind!\n", __func__); |
18361 |
+- kfree_skb(skb); |
18362 |
+ break; |
18363 |
+ default: |
18364 |
+- if (ev->ind_prim) { |
18365 |
++ if (ev->ind_prim) |
18366 |
+ printk(KERN_INFO "%s: received unknown %d prim!\n", |
18367 |
+ __func__, ev->ind_prim); |
18368 |
+- kfree_skb(skb); |
18369 |
+- } |
18370 |
+ /* No indication */ |
18371 |
+ break; |
18372 |
+ } |
18373 |
+@@ -179,15 +163,12 @@ int llc_conn_state_process(struct sock *sk, struct sk_buff *skb) |
18374 |
+ printk(KERN_INFO "%s: received a reset conf!\n", __func__); |
18375 |
+ break; |
18376 |
+ default: |
18377 |
+- if (ev->cfm_prim) { |
18378 |
++ if (ev->cfm_prim) |
18379 |
+ printk(KERN_INFO "%s: received unknown %d prim!\n", |
18380 |
+ __func__, ev->cfm_prim); |
18381 |
+- break; |
18382 |
+- } |
18383 |
+- goto out_skb_put; /* No confirmation */ |
18384 |
++ /* No confirmation */ |
18385 |
++ break; |
18386 |
+ } |
18387 |
+-out_kfree_skb: |
18388 |
+- kfree_skb(skb); |
18389 |
+ out_skb_put: |
18390 |
+ kfree_skb(skb); |
18391 |
+ return rc; |
18392 |
+diff --git a/net/llc/llc_if.c b/net/llc/llc_if.c |
18393 |
+index 8db03c2d5440..ad6547736c21 100644 |
18394 |
+--- a/net/llc/llc_if.c |
18395 |
++++ b/net/llc/llc_if.c |
18396 |
+@@ -38,6 +38,8 @@ |
18397 |
+ * closed and -EBUSY when sending data is not permitted in this state or |
18398 |
+ * LLC has send an I pdu with p bit set to 1 and is waiting for it's |
18399 |
+ * response. |
18400 |
++ * |
18401 |
++ * This function always consumes a reference to the skb. |
18402 |
+ */ |
18403 |
+ int llc_build_and_send_pkt(struct sock *sk, struct sk_buff *skb) |
18404 |
+ { |
18405 |
+@@ -46,20 +48,22 @@ int llc_build_and_send_pkt(struct sock *sk, struct sk_buff *skb) |
18406 |
+ struct llc_sock *llc = llc_sk(sk); |
18407 |
+ |
18408 |
+ if (unlikely(llc->state == LLC_CONN_STATE_ADM)) |
18409 |
+- goto out; |
18410 |
++ goto out_free; |
18411 |
+ rc = -EBUSY; |
18412 |
+ if (unlikely(llc_data_accept_state(llc->state) || /* data_conn_refuse */ |
18413 |
+ llc->p_flag)) { |
18414 |
+ llc->failed_data_req = 1; |
18415 |
+- goto out; |
18416 |
++ goto out_free; |
18417 |
+ } |
18418 |
+ ev = llc_conn_ev(skb); |
18419 |
+ ev->type = LLC_CONN_EV_TYPE_PRIM; |
18420 |
+ ev->prim = LLC_DATA_PRIM; |
18421 |
+ ev->prim_type = LLC_PRIM_TYPE_REQ; |
18422 |
+ skb->dev = llc->dev; |
18423 |
+- rc = llc_conn_state_process(sk, skb); |
18424 |
+-out: |
18425 |
++ return llc_conn_state_process(sk, skb); |
18426 |
++ |
18427 |
++out_free: |
18428 |
++ kfree_skb(skb); |
18429 |
+ return rc; |
18430 |
+ } |
18431 |
+ |
18432 |
+diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c |
18433 |
+index 3d5520776655..0b60e330c115 100644 |
18434 |
+--- a/net/mac80211/rc80211_minstrel_ht.c |
18435 |
++++ b/net/mac80211/rc80211_minstrel_ht.c |
18436 |
+@@ -529,7 +529,7 @@ minstrel_ht_update_stats(struct minstrel_priv *mp, struct minstrel_ht_sta *mi) |
18437 |
+ |
18438 |
+ /* (re)Initialize group rate indexes */ |
18439 |
+ for(j = 0; j < MAX_THR_RATES; j++) |
18440 |
+- tmp_group_tp_rate[j] = group; |
18441 |
++ tmp_group_tp_rate[j] = MCS_GROUP_RATES * group; |
18442 |
+ |
18443 |
+ for (i = 0; i < MCS_GROUP_RATES; i++) { |
18444 |
+ if (!(mi->supported[group] & BIT(i))) |
18445 |
+diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c |
18446 |
+index b12f23c996f4..02d0b22d0114 100644 |
18447 |
+--- a/net/mac80211/rx.c |
18448 |
++++ b/net/mac80211/rx.c |
18449 |
+@@ -3391,9 +3391,18 @@ ieee80211_rx_h_mgmt(struct ieee80211_rx_data *rx) |
18450 |
+ case cpu_to_le16(IEEE80211_STYPE_PROBE_RESP): |
18451 |
+ /* process for all: mesh, mlme, ibss */ |
18452 |
+ break; |
18453 |
++ case cpu_to_le16(IEEE80211_STYPE_DEAUTH): |
18454 |
++ if (is_multicast_ether_addr(mgmt->da) && |
18455 |
++ !is_broadcast_ether_addr(mgmt->da)) |
18456 |
++ return RX_DROP_MONITOR; |
18457 |
++ |
18458 |
++ /* process only for station/IBSS */ |
18459 |
++ if (sdata->vif.type != NL80211_IFTYPE_STATION && |
18460 |
++ sdata->vif.type != NL80211_IFTYPE_ADHOC) |
18461 |
++ return RX_DROP_MONITOR; |
18462 |
++ break; |
18463 |
+ case cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP): |
18464 |
+ case cpu_to_le16(IEEE80211_STYPE_REASSOC_RESP): |
18465 |
+- case cpu_to_le16(IEEE80211_STYPE_DEAUTH): |
18466 |
+ case cpu_to_le16(IEEE80211_STYPE_DISASSOC): |
18467 |
+ if (is_multicast_ether_addr(mgmt->da) && |
18468 |
+ !is_broadcast_ether_addr(mgmt->da)) |
18469 |
+diff --git a/net/mpls/mpls_iptunnel.c b/net/mpls/mpls_iptunnel.c |
18470 |
+index 94f53a9b7d1a..faf6ef1b6a45 100644 |
18471 |
+--- a/net/mpls/mpls_iptunnel.c |
18472 |
++++ b/net/mpls/mpls_iptunnel.c |
18473 |
+@@ -28,7 +28,7 @@ |
18474 |
+ #include "internal.h" |
18475 |
+ |
18476 |
+ static const struct nla_policy mpls_iptunnel_policy[MPLS_IPTUNNEL_MAX + 1] = { |
18477 |
+- [MPLS_IPTUNNEL_DST] = { .type = NLA_U32 }, |
18478 |
++ [MPLS_IPTUNNEL_DST] = { .len = sizeof(u32) }, |
18479 |
+ [MPLS_IPTUNNEL_TTL] = { .type = NLA_U8 }, |
18480 |
+ }; |
18481 |
+ |
18482 |
+diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c |
18483 |
+index 7ba9ea55816a..31fa94064a62 100644 |
18484 |
+--- a/net/netfilter/nf_conntrack_netlink.c |
18485 |
++++ b/net/netfilter/nf_conntrack_netlink.c |
18486 |
+@@ -555,10 +555,8 @@ ctnetlink_fill_info(struct sk_buff *skb, u32 portid, u32 seq, u32 type, |
18487 |
+ goto nla_put_failure; |
18488 |
+ |
18489 |
+ if (ctnetlink_dump_status(skb, ct) < 0 || |
18490 |
+- ctnetlink_dump_timeout(skb, ct) < 0 || |
18491 |
+ ctnetlink_dump_acct(skb, ct, type) < 0 || |
18492 |
+ ctnetlink_dump_timestamp(skb, ct) < 0 || |
18493 |
+- ctnetlink_dump_protoinfo(skb, ct) < 0 || |
18494 |
+ ctnetlink_dump_helpinfo(skb, ct) < 0 || |
18495 |
+ ctnetlink_dump_mark(skb, ct) < 0 || |
18496 |
+ ctnetlink_dump_secctx(skb, ct) < 0 || |
18497 |
+@@ -570,6 +568,11 @@ ctnetlink_fill_info(struct sk_buff *skb, u32 portid, u32 seq, u32 type, |
18498 |
+ ctnetlink_dump_ct_synproxy(skb, ct) < 0) |
18499 |
+ goto nla_put_failure; |
18500 |
+ |
18501 |
++ if (!test_bit(IPS_OFFLOAD_BIT, &ct->status) && |
18502 |
++ (ctnetlink_dump_timeout(skb, ct) < 0 || |
18503 |
++ ctnetlink_dump_protoinfo(skb, ct) < 0)) |
18504 |
++ goto nla_put_failure; |
18505 |
++ |
18506 |
+ nlmsg_end(skb, nlh); |
18507 |
+ return skb->len; |
18508 |
+ |
18509 |
+diff --git a/net/netfilter/nf_flow_table_core.c b/net/netfilter/nf_flow_table_core.c |
18510 |
+index 70bd730ca059..890799c16aa4 100644 |
18511 |
+--- a/net/netfilter/nf_flow_table_core.c |
18512 |
++++ b/net/netfilter/nf_flow_table_core.c |
18513 |
+@@ -491,14 +491,17 @@ EXPORT_SYMBOL_GPL(nf_flow_table_init); |
18514 |
+ static void nf_flow_table_do_cleanup(struct flow_offload *flow, void *data) |
18515 |
+ { |
18516 |
+ struct net_device *dev = data; |
18517 |
++ struct flow_offload_entry *e; |
18518 |
++ |
18519 |
++ e = container_of(flow, struct flow_offload_entry, flow); |
18520 |
+ |
18521 |
+ if (!dev) { |
18522 |
+ flow_offload_teardown(flow); |
18523 |
+ return; |
18524 |
+ } |
18525 |
+- |
18526 |
+- if (flow->tuplehash[0].tuple.iifidx == dev->ifindex || |
18527 |
+- flow->tuplehash[1].tuple.iifidx == dev->ifindex) |
18528 |
++ if (net_eq(nf_ct_net(e->ct), dev_net(dev)) && |
18529 |
++ (flow->tuplehash[0].tuple.iifidx == dev->ifindex || |
18530 |
++ flow->tuplehash[1].tuple.iifidx == dev->ifindex)) |
18531 |
+ flow_offload_dead(flow); |
18532 |
+ } |
18533 |
+ |
18534 |
+diff --git a/net/netfilter/nft_flow_offload.c b/net/netfilter/nft_flow_offload.c |
18535 |
+index 1ef8cb789c41..166edea0e452 100644 |
18536 |
+--- a/net/netfilter/nft_flow_offload.c |
18537 |
++++ b/net/netfilter/nft_flow_offload.c |
18538 |
+@@ -103,8 +103,7 @@ static void nft_flow_offload_eval(const struct nft_expr *expr, |
18539 |
+ ct->status & IPS_SEQ_ADJUST) |
18540 |
+ goto out; |
18541 |
+ |
18542 |
+- if (ctinfo == IP_CT_NEW || |
18543 |
+- ctinfo == IP_CT_RELATED) |
18544 |
++ if (!nf_ct_is_confirmed(ct)) |
18545 |
+ goto out; |
18546 |
+ |
18547 |
+ if (test_and_set_bit(IPS_OFFLOAD_BIT, &ct->status)) |
18548 |
+diff --git a/net/netfilter/nft_osf.c b/net/netfilter/nft_osf.c |
18549 |
+index a35fb59ace73..df4e3e0412ed 100644 |
18550 |
+--- a/net/netfilter/nft_osf.c |
18551 |
++++ b/net/netfilter/nft_osf.c |
18552 |
+@@ -69,6 +69,15 @@ nla_put_failure: |
18553 |
+ return -1; |
18554 |
+ } |
18555 |
+ |
18556 |
++static int nft_osf_validate(const struct nft_ctx *ctx, |
18557 |
++ const struct nft_expr *expr, |
18558 |
++ const struct nft_data **data) |
18559 |
++{ |
18560 |
++ return nft_chain_validate_hooks(ctx->chain, (1 << NF_INET_LOCAL_IN) | |
18561 |
++ (1 << NF_INET_PRE_ROUTING) | |
18562 |
++ (1 << NF_INET_FORWARD)); |
18563 |
++} |
18564 |
++ |
18565 |
+ static struct nft_expr_type nft_osf_type; |
18566 |
+ static const struct nft_expr_ops nft_osf_op = { |
18567 |
+ .eval = nft_osf_eval, |
18568 |
+@@ -76,6 +85,7 @@ static const struct nft_expr_ops nft_osf_op = { |
18569 |
+ .init = nft_osf_init, |
18570 |
+ .dump = nft_osf_dump, |
18571 |
+ .type = &nft_osf_type, |
18572 |
++ .validate = nft_osf_validate, |
18573 |
+ }; |
18574 |
+ |
18575 |
+ static struct nft_expr_type nft_osf_type __read_mostly = { |
18576 |
+diff --git a/net/netfilter/nft_set_hash.c b/net/netfilter/nft_set_hash.c |
18577 |
+index 015124e649cb..05118e03c3e4 100644 |
18578 |
+--- a/net/netfilter/nft_set_hash.c |
18579 |
++++ b/net/netfilter/nft_set_hash.c |
18580 |
+@@ -488,6 +488,23 @@ static bool nft_hash_lookup_fast(const struct net *net, |
18581 |
+ return false; |
18582 |
+ } |
18583 |
+ |
18584 |
++static u32 nft_jhash(const struct nft_set *set, const struct nft_hash *priv, |
18585 |
++ const struct nft_set_ext *ext) |
18586 |
++{ |
18587 |
++ const struct nft_data *key = nft_set_ext_key(ext); |
18588 |
++ u32 hash, k1; |
18589 |
++ |
18590 |
++ if (set->klen == 4) { |
18591 |
++ k1 = *(u32 *)key; |
18592 |
++ hash = jhash_1word(k1, priv->seed); |
18593 |
++ } else { |
18594 |
++ hash = jhash(key, set->klen, priv->seed); |
18595 |
++ } |
18596 |
++ hash = reciprocal_scale(hash, priv->buckets); |
18597 |
++ |
18598 |
++ return hash; |
18599 |
++} |
18600 |
++ |
18601 |
+ static int nft_hash_insert(const struct net *net, const struct nft_set *set, |
18602 |
+ const struct nft_set_elem *elem, |
18603 |
+ struct nft_set_ext **ext) |
18604 |
+@@ -497,8 +514,7 @@ static int nft_hash_insert(const struct net *net, const struct nft_set *set, |
18605 |
+ u8 genmask = nft_genmask_next(net); |
18606 |
+ u32 hash; |
18607 |
+ |
18608 |
+- hash = jhash(nft_set_ext_key(&this->ext), set->klen, priv->seed); |
18609 |
+- hash = reciprocal_scale(hash, priv->buckets); |
18610 |
++ hash = nft_jhash(set, priv, &this->ext); |
18611 |
+ hlist_for_each_entry(he, &priv->table[hash], node) { |
18612 |
+ if (!memcmp(nft_set_ext_key(&this->ext), |
18613 |
+ nft_set_ext_key(&he->ext), set->klen) && |
18614 |
+@@ -537,10 +553,9 @@ static void *nft_hash_deactivate(const struct net *net, |
18615 |
+ u8 genmask = nft_genmask_next(net); |
18616 |
+ u32 hash; |
18617 |
+ |
18618 |
+- hash = jhash(nft_set_ext_key(&this->ext), set->klen, priv->seed); |
18619 |
+- hash = reciprocal_scale(hash, priv->buckets); |
18620 |
++ hash = nft_jhash(set, priv, &this->ext); |
18621 |
+ hlist_for_each_entry(he, &priv->table[hash], node) { |
18622 |
+- if (!memcmp(nft_set_ext_key(&this->ext), &elem->key.val, |
18623 |
++ if (!memcmp(nft_set_ext_key(&he->ext), &elem->key.val, |
18624 |
+ set->klen) && |
18625 |
+ nft_set_elem_active(&he->ext, genmask)) { |
18626 |
+ nft_set_elem_change_active(net, set, &he->ext); |
18627 |
+diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c |
18628 |
+index ac65e66d1d72..ddf90e6fac51 100644 |
18629 |
+--- a/net/packet/af_packet.c |
18630 |
++++ b/net/packet/af_packet.c |
18631 |
+@@ -1297,15 +1297,21 @@ static void packet_sock_destruct(struct sock *sk) |
18632 |
+ |
18633 |
+ static bool fanout_flow_is_huge(struct packet_sock *po, struct sk_buff *skb) |
18634 |
+ { |
18635 |
+- u32 rxhash; |
18636 |
++ u32 *history = po->rollover->history; |
18637 |
++ u32 victim, rxhash; |
18638 |
+ int i, count = 0; |
18639 |
+ |
18640 |
+ rxhash = skb_get_hash(skb); |
18641 |
+ for (i = 0; i < ROLLOVER_HLEN; i++) |
18642 |
+- if (po->rollover->history[i] == rxhash) |
18643 |
++ if (READ_ONCE(history[i]) == rxhash) |
18644 |
+ count++; |
18645 |
+ |
18646 |
+- po->rollover->history[prandom_u32() % ROLLOVER_HLEN] = rxhash; |
18647 |
++ victim = prandom_u32() % ROLLOVER_HLEN; |
18648 |
++ |
18649 |
++ /* Avoid dirtying the cache line if possible */ |
18650 |
++ if (READ_ONCE(history[victim]) != rxhash) |
18651 |
++ WRITE_ONCE(history[victim], rxhash); |
18652 |
++ |
18653 |
+ return count > (ROLLOVER_HLEN >> 1); |
18654 |
+ } |
18655 |
+ |
18656 |
+@@ -3371,20 +3377,29 @@ static int packet_recvmsg(struct socket *sock, struct msghdr *msg, size_t len, |
18657 |
+ sock_recv_ts_and_drops(msg, sk, skb); |
18658 |
+ |
18659 |
+ if (msg->msg_name) { |
18660 |
++ int copy_len; |
18661 |
++ |
18662 |
+ /* If the address length field is there to be filled |
18663 |
+ * in, we fill it in now. |
18664 |
+ */ |
18665 |
+ if (sock->type == SOCK_PACKET) { |
18666 |
+ __sockaddr_check_size(sizeof(struct sockaddr_pkt)); |
18667 |
+ msg->msg_namelen = sizeof(struct sockaddr_pkt); |
18668 |
++ copy_len = msg->msg_namelen; |
18669 |
+ } else { |
18670 |
+ struct sockaddr_ll *sll = &PACKET_SKB_CB(skb)->sa.ll; |
18671 |
+ |
18672 |
+ msg->msg_namelen = sll->sll_halen + |
18673 |
+ offsetof(struct sockaddr_ll, sll_addr); |
18674 |
++ copy_len = msg->msg_namelen; |
18675 |
++ if (msg->msg_namelen < sizeof(struct sockaddr_ll)) { |
18676 |
++ memset(msg->msg_name + |
18677 |
++ offsetof(struct sockaddr_ll, sll_addr), |
18678 |
++ 0, sizeof(sll->sll_addr)); |
18679 |
++ msg->msg_namelen = sizeof(struct sockaddr_ll); |
18680 |
++ } |
18681 |
+ } |
18682 |
+- memcpy(msg->msg_name, &PACKET_SKB_CB(skb)->sa, |
18683 |
+- msg->msg_namelen); |
18684 |
++ memcpy(msg->msg_name, &PACKET_SKB_CB(skb)->sa, copy_len); |
18685 |
+ } |
18686 |
+ |
18687 |
+ if (pkt_sk(sk)->auxdata) { |
18688 |
+diff --git a/net/rds/ib_stats.c b/net/rds/ib_stats.c |
18689 |
+index 9252ad126335..ac46d8961b61 100644 |
18690 |
+--- a/net/rds/ib_stats.c |
18691 |
++++ b/net/rds/ib_stats.c |
18692 |
+@@ -42,7 +42,7 @@ DEFINE_PER_CPU_SHARED_ALIGNED(struct rds_ib_statistics, rds_ib_stats); |
18693 |
+ static const char *const rds_ib_stat_names[] = { |
18694 |
+ "ib_connect_raced", |
18695 |
+ "ib_listen_closed_stale", |
18696 |
+- "s_ib_evt_handler_call", |
18697 |
++ "ib_evt_handler_call", |
18698 |
+ "ib_tasklet_call", |
18699 |
+ "ib_tx_cq_event", |
18700 |
+ "ib_tx_ring_full", |
18701 |
+diff --git a/net/rds/stats.c b/net/rds/stats.c |
18702 |
+index 73be187d389e..6bbab4d74c4f 100644 |
18703 |
+--- a/net/rds/stats.c |
18704 |
++++ b/net/rds/stats.c |
18705 |
+@@ -76,6 +76,8 @@ static const char *const rds_stat_names[] = { |
18706 |
+ "cong_update_received", |
18707 |
+ "cong_send_error", |
18708 |
+ "cong_send_blocked", |
18709 |
++ "recv_bytes_added_to_sock", |
18710 |
++ "recv_bytes_freed_fromsock", |
18711 |
+ }; |
18712 |
+ |
18713 |
+ void rds_stats_info_copy(struct rds_info_iterator *iter, |
18714 |
+diff --git a/net/rxrpc/af_rxrpc.c b/net/rxrpc/af_rxrpc.c |
18715 |
+index 7319d3ca30e9..a74edb10cbfc 100644 |
18716 |
+--- a/net/rxrpc/af_rxrpc.c |
18717 |
++++ b/net/rxrpc/af_rxrpc.c |
18718 |
+@@ -869,7 +869,6 @@ static void rxrpc_sock_destructor(struct sock *sk) |
18719 |
+ static int rxrpc_release_sock(struct sock *sk) |
18720 |
+ { |
18721 |
+ struct rxrpc_sock *rx = rxrpc_sk(sk); |
18722 |
+- struct rxrpc_net *rxnet = rxrpc_net(sock_net(&rx->sk)); |
18723 |
+ |
18724 |
+ _enter("%p{%d,%d}", sk, sk->sk_state, refcount_read(&sk->sk_refcnt)); |
18725 |
+ |
18726 |
+@@ -905,8 +904,6 @@ static int rxrpc_release_sock(struct sock *sk) |
18727 |
+ rxrpc_release_calls_on_socket(rx); |
18728 |
+ flush_workqueue(rxrpc_workqueue); |
18729 |
+ rxrpc_purge_queue(&sk->sk_receive_queue); |
18730 |
+- rxrpc_queue_work(&rxnet->service_conn_reaper); |
18731 |
+- rxrpc_queue_work(&rxnet->client_conn_reaper); |
18732 |
+ |
18733 |
+ rxrpc_unuse_local(rx->local); |
18734 |
+ rx->local = NULL; |
18735 |
+diff --git a/net/rxrpc/ar-internal.h b/net/rxrpc/ar-internal.h |
18736 |
+index dfd9eab77cc8..ccef6e40e002 100644 |
18737 |
+--- a/net/rxrpc/ar-internal.h |
18738 |
++++ b/net/rxrpc/ar-internal.h |
18739 |
+@@ -644,6 +644,7 @@ struct rxrpc_call { |
18740 |
+ u8 ackr_reason; /* reason to ACK */ |
18741 |
+ u16 ackr_skew; /* skew on packet being ACK'd */ |
18742 |
+ rxrpc_serial_t ackr_serial; /* serial of packet being ACK'd */ |
18743 |
++ rxrpc_serial_t ackr_first_seq; /* first sequence number received */ |
18744 |
+ rxrpc_seq_t ackr_prev_seq; /* previous sequence number received */ |
18745 |
+ rxrpc_seq_t ackr_consumed; /* Highest packet shown consumed */ |
18746 |
+ rxrpc_seq_t ackr_seen; /* Highest packet shown seen */ |
18747 |
+@@ -902,6 +903,7 @@ void rxrpc_disconnect_client_call(struct rxrpc_call *); |
18748 |
+ void rxrpc_put_client_conn(struct rxrpc_connection *); |
18749 |
+ void rxrpc_discard_expired_client_conns(struct work_struct *); |
18750 |
+ void rxrpc_destroy_all_client_connections(struct rxrpc_net *); |
18751 |
++void rxrpc_clean_up_local_conns(struct rxrpc_local *); |
18752 |
+ |
18753 |
+ /* |
18754 |
+ * conn_event.c |
18755 |
+diff --git a/net/rxrpc/call_accept.c b/net/rxrpc/call_accept.c |
18756 |
+index 8079aacaecac..c5566bc4aaca 100644 |
18757 |
+--- a/net/rxrpc/call_accept.c |
18758 |
++++ b/net/rxrpc/call_accept.c |
18759 |
+@@ -88,7 +88,7 @@ static int rxrpc_service_prealloc_one(struct rxrpc_sock *rx, |
18760 |
+ smp_store_release(&b->conn_backlog_head, |
18761 |
+ (head + 1) & (size - 1)); |
18762 |
+ |
18763 |
+- trace_rxrpc_conn(conn, rxrpc_conn_new_service, |
18764 |
++ trace_rxrpc_conn(conn->debug_id, rxrpc_conn_new_service, |
18765 |
+ atomic_read(&conn->usage), here); |
18766 |
+ } |
18767 |
+ |
18768 |
+diff --git a/net/rxrpc/conn_client.c b/net/rxrpc/conn_client.c |
18769 |
+index c979a56faaef..38d548532024 100644 |
18770 |
+--- a/net/rxrpc/conn_client.c |
18771 |
++++ b/net/rxrpc/conn_client.c |
18772 |
+@@ -217,7 +217,8 @@ rxrpc_alloc_client_connection(struct rxrpc_conn_parameters *cp, gfp_t gfp) |
18773 |
+ rxrpc_get_local(conn->params.local); |
18774 |
+ key_get(conn->params.key); |
18775 |
+ |
18776 |
+- trace_rxrpc_conn(conn, rxrpc_conn_new_client, atomic_read(&conn->usage), |
18777 |
++ trace_rxrpc_conn(conn->debug_id, rxrpc_conn_new_client, |
18778 |
++ atomic_read(&conn->usage), |
18779 |
+ __builtin_return_address(0)); |
18780 |
+ trace_rxrpc_client(conn, -1, rxrpc_client_alloc); |
18781 |
+ _leave(" = %p", conn); |
18782 |
+@@ -989,11 +990,12 @@ rxrpc_put_one_client_conn(struct rxrpc_connection *conn) |
18783 |
+ void rxrpc_put_client_conn(struct rxrpc_connection *conn) |
18784 |
+ { |
18785 |
+ const void *here = __builtin_return_address(0); |
18786 |
++ unsigned int debug_id = conn->debug_id; |
18787 |
+ int n; |
18788 |
+ |
18789 |
+ do { |
18790 |
+ n = atomic_dec_return(&conn->usage); |
18791 |
+- trace_rxrpc_conn(conn, rxrpc_conn_put_client, n, here); |
18792 |
++ trace_rxrpc_conn(debug_id, rxrpc_conn_put_client, n, here); |
18793 |
+ if (n > 0) |
18794 |
+ return; |
18795 |
+ ASSERTCMP(n, >=, 0); |
18796 |
+@@ -1166,3 +1168,47 @@ void rxrpc_destroy_all_client_connections(struct rxrpc_net *rxnet) |
18797 |
+ |
18798 |
+ _leave(""); |
18799 |
+ } |
18800 |
++ |
18801 |
++/* |
18802 |
++ * Clean up the client connections on a local endpoint. |
18803 |
++ */ |
18804 |
++void rxrpc_clean_up_local_conns(struct rxrpc_local *local) |
18805 |
++{ |
18806 |
++ struct rxrpc_connection *conn, *tmp; |
18807 |
++ struct rxrpc_net *rxnet = local->rxnet; |
18808 |
++ unsigned int nr_active; |
18809 |
++ LIST_HEAD(graveyard); |
18810 |
++ |
18811 |
++ _enter(""); |
18812 |
++ |
18813 |
++ spin_lock(&rxnet->client_conn_cache_lock); |
18814 |
++ nr_active = rxnet->nr_active_client_conns; |
18815 |
++ |
18816 |
++ list_for_each_entry_safe(conn, tmp, &rxnet->idle_client_conns, |
18817 |
++ cache_link) { |
18818 |
++ if (conn->params.local == local) { |
18819 |
++ ASSERTCMP(conn->cache_state, ==, RXRPC_CONN_CLIENT_IDLE); |
18820 |
++ |
18821 |
++ trace_rxrpc_client(conn, -1, rxrpc_client_discard); |
18822 |
++ if (!test_and_clear_bit(RXRPC_CONN_EXPOSED, &conn->flags)) |
18823 |
++ BUG(); |
18824 |
++ conn->cache_state = RXRPC_CONN_CLIENT_INACTIVE; |
18825 |
++ list_move(&conn->cache_link, &graveyard); |
18826 |
++ nr_active--; |
18827 |
++ } |
18828 |
++ } |
18829 |
++ |
18830 |
++ rxnet->nr_active_client_conns = nr_active; |
18831 |
++ spin_unlock(&rxnet->client_conn_cache_lock); |
18832 |
++ ASSERTCMP(nr_active, >=, 0); |
18833 |
++ |
18834 |
++ while (!list_empty(&graveyard)) { |
18835 |
++ conn = list_entry(graveyard.next, |
18836 |
++ struct rxrpc_connection, cache_link); |
18837 |
++ list_del_init(&conn->cache_link); |
18838 |
++ |
18839 |
++ rxrpc_put_connection(conn); |
18840 |
++ } |
18841 |
++ |
18842 |
++ _leave(" [culled]"); |
18843 |
++} |
18844 |
+diff --git a/net/rxrpc/conn_object.c b/net/rxrpc/conn_object.c |
18845 |
+index 885dae829f4a..f338efd2880a 100644 |
18846 |
+--- a/net/rxrpc/conn_object.c |
18847 |
++++ b/net/rxrpc/conn_object.c |
18848 |
+@@ -272,7 +272,7 @@ bool rxrpc_queue_conn(struct rxrpc_connection *conn) |
18849 |
+ if (n == 0) |
18850 |
+ return false; |
18851 |
+ if (rxrpc_queue_work(&conn->processor)) |
18852 |
+- trace_rxrpc_conn(conn, rxrpc_conn_queued, n + 1, here); |
18853 |
++ trace_rxrpc_conn(conn->debug_id, rxrpc_conn_queued, n + 1, here); |
18854 |
+ else |
18855 |
+ rxrpc_put_connection(conn); |
18856 |
+ return true; |
18857 |
+@@ -287,7 +287,7 @@ void rxrpc_see_connection(struct rxrpc_connection *conn) |
18858 |
+ if (conn) { |
18859 |
+ int n = atomic_read(&conn->usage); |
18860 |
+ |
18861 |
+- trace_rxrpc_conn(conn, rxrpc_conn_seen, n, here); |
18862 |
++ trace_rxrpc_conn(conn->debug_id, rxrpc_conn_seen, n, here); |
18863 |
+ } |
18864 |
+ } |
18865 |
+ |
18866 |
+@@ -299,7 +299,7 @@ void rxrpc_get_connection(struct rxrpc_connection *conn) |
18867 |
+ const void *here = __builtin_return_address(0); |
18868 |
+ int n = atomic_inc_return(&conn->usage); |
18869 |
+ |
18870 |
+- trace_rxrpc_conn(conn, rxrpc_conn_got, n, here); |
18871 |
++ trace_rxrpc_conn(conn->debug_id, rxrpc_conn_got, n, here); |
18872 |
+ } |
18873 |
+ |
18874 |
+ /* |
18875 |
+@@ -313,7 +313,7 @@ rxrpc_get_connection_maybe(struct rxrpc_connection *conn) |
18876 |
+ if (conn) { |
18877 |
+ int n = atomic_fetch_add_unless(&conn->usage, 1, 0); |
18878 |
+ if (n > 0) |
18879 |
+- trace_rxrpc_conn(conn, rxrpc_conn_got, n + 1, here); |
18880 |
++ trace_rxrpc_conn(conn->debug_id, rxrpc_conn_got, n + 1, here); |
18881 |
+ else |
18882 |
+ conn = NULL; |
18883 |
+ } |
18884 |
+@@ -336,10 +336,11 @@ static void rxrpc_set_service_reap_timer(struct rxrpc_net *rxnet, |
18885 |
+ void rxrpc_put_service_conn(struct rxrpc_connection *conn) |
18886 |
+ { |
18887 |
+ const void *here = __builtin_return_address(0); |
18888 |
++ unsigned int debug_id = conn->debug_id; |
18889 |
+ int n; |
18890 |
+ |
18891 |
+ n = atomic_dec_return(&conn->usage); |
18892 |
+- trace_rxrpc_conn(conn, rxrpc_conn_put_service, n, here); |
18893 |
++ trace_rxrpc_conn(debug_id, rxrpc_conn_put_service, n, here); |
18894 |
+ ASSERTCMP(n, >=, 0); |
18895 |
+ if (n == 1) |
18896 |
+ rxrpc_set_service_reap_timer(conn->params.local->rxnet, |
18897 |
+@@ -401,7 +402,7 @@ void rxrpc_service_connection_reaper(struct work_struct *work) |
18898 |
+ if (conn->state == RXRPC_CONN_SERVICE_PREALLOC) |
18899 |
+ continue; |
18900 |
+ |
18901 |
+- if (rxnet->live) { |
18902 |
++ if (rxnet->live && !conn->params.local->dead) { |
18903 |
+ idle_timestamp = READ_ONCE(conn->idle_timestamp); |
18904 |
+ expire_at = idle_timestamp + rxrpc_connection_expiry * HZ; |
18905 |
+ if (conn->params.local->service_closed) |
18906 |
+@@ -423,7 +424,7 @@ void rxrpc_service_connection_reaper(struct work_struct *work) |
18907 |
+ */ |
18908 |
+ if (atomic_cmpxchg(&conn->usage, 1, 0) != 1) |
18909 |
+ continue; |
18910 |
+- trace_rxrpc_conn(conn, rxrpc_conn_reap_service, 0, NULL); |
18911 |
++ trace_rxrpc_conn(conn->debug_id, rxrpc_conn_reap_service, 0, NULL); |
18912 |
+ |
18913 |
+ if (rxrpc_conn_is_client(conn)) |
18914 |
+ BUG(); |
18915 |
+diff --git a/net/rxrpc/conn_service.c b/net/rxrpc/conn_service.c |
18916 |
+index 80773a50c755..6da7c4bf15e8 100644 |
18917 |
+--- a/net/rxrpc/conn_service.c |
18918 |
++++ b/net/rxrpc/conn_service.c |
18919 |
+@@ -138,7 +138,7 @@ struct rxrpc_connection *rxrpc_prealloc_service_connection(struct rxrpc_net *rxn |
18920 |
+ list_add_tail(&conn->proc_link, &rxnet->conn_proc_list); |
18921 |
+ write_unlock(&rxnet->conn_lock); |
18922 |
+ |
18923 |
+- trace_rxrpc_conn(conn, rxrpc_conn_new_service, |
18924 |
++ trace_rxrpc_conn(conn->debug_id, rxrpc_conn_new_service, |
18925 |
+ atomic_read(&conn->usage), |
18926 |
+ __builtin_return_address(0)); |
18927 |
+ } |
18928 |
+diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c |
18929 |
+index 7965600ee5de..2f91ab909191 100644 |
18930 |
+--- a/net/rxrpc/input.c |
18931 |
++++ b/net/rxrpc/input.c |
18932 |
+@@ -837,7 +837,7 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb, |
18933 |
+ u8 acks[RXRPC_MAXACKS]; |
18934 |
+ } buf; |
18935 |
+ rxrpc_serial_t acked_serial; |
18936 |
+- rxrpc_seq_t first_soft_ack, hard_ack; |
18937 |
++ rxrpc_seq_t first_soft_ack, hard_ack, prev_pkt; |
18938 |
+ int nr_acks, offset, ioffset; |
18939 |
+ |
18940 |
+ _enter(""); |
18941 |
+@@ -851,13 +851,14 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb, |
18942 |
+ |
18943 |
+ acked_serial = ntohl(buf.ack.serial); |
18944 |
+ first_soft_ack = ntohl(buf.ack.firstPacket); |
18945 |
++ prev_pkt = ntohl(buf.ack.previousPacket); |
18946 |
+ hard_ack = first_soft_ack - 1; |
18947 |
+ nr_acks = buf.ack.nAcks; |
18948 |
+ summary.ack_reason = (buf.ack.reason < RXRPC_ACK__INVALID ? |
18949 |
+ buf.ack.reason : RXRPC_ACK__INVALID); |
18950 |
+ |
18951 |
+ trace_rxrpc_rx_ack(call, sp->hdr.serial, acked_serial, |
18952 |
+- first_soft_ack, ntohl(buf.ack.previousPacket), |
18953 |
++ first_soft_ack, prev_pkt, |
18954 |
+ summary.ack_reason, nr_acks); |
18955 |
+ |
18956 |
+ if (buf.ack.reason == RXRPC_ACK_PING_RESPONSE) |
18957 |
+@@ -878,8 +879,9 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb, |
18958 |
+ rxrpc_propose_ack_respond_to_ack); |
18959 |
+ } |
18960 |
+ |
18961 |
+- /* Discard any out-of-order or duplicate ACKs. */ |
18962 |
+- if (before_eq(sp->hdr.serial, call->acks_latest)) |
18963 |
++ /* Discard any out-of-order or duplicate ACKs (outside lock). */ |
18964 |
++ if (before(first_soft_ack, call->ackr_first_seq) || |
18965 |
++ before(prev_pkt, call->ackr_prev_seq)) |
18966 |
+ return; |
18967 |
+ |
18968 |
+ buf.info.rxMTU = 0; |
18969 |
+@@ -890,12 +892,16 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb, |
18970 |
+ |
18971 |
+ spin_lock(&call->input_lock); |
18972 |
+ |
18973 |
+- /* Discard any out-of-order or duplicate ACKs. */ |
18974 |
+- if (before_eq(sp->hdr.serial, call->acks_latest)) |
18975 |
++ /* Discard any out-of-order or duplicate ACKs (inside lock). */ |
18976 |
++ if (before(first_soft_ack, call->ackr_first_seq) || |
18977 |
++ before(prev_pkt, call->ackr_prev_seq)) |
18978 |
+ goto out; |
18979 |
+ call->acks_latest_ts = skb->tstamp; |
18980 |
+ call->acks_latest = sp->hdr.serial; |
18981 |
+ |
18982 |
++ call->ackr_first_seq = first_soft_ack; |
18983 |
++ call->ackr_prev_seq = prev_pkt; |
18984 |
++ |
18985 |
+ /* Parse rwind and mtu sizes if provided. */ |
18986 |
+ if (buf.info.rxMTU) |
18987 |
+ rxrpc_input_ackinfo(call, skb, &buf.info); |
18988 |
+diff --git a/net/rxrpc/local_object.c b/net/rxrpc/local_object.c |
18989 |
+index c752ad487067..04f0976841a4 100644 |
18990 |
+--- a/net/rxrpc/local_object.c |
18991 |
++++ b/net/rxrpc/local_object.c |
18992 |
+@@ -430,11 +430,14 @@ static void rxrpc_local_destroyer(struct rxrpc_local *local) |
18993 |
+ |
18994 |
+ _enter("%d", local->debug_id); |
18995 |
+ |
18996 |
++ local->dead = true; |
18997 |
++ |
18998 |
+ mutex_lock(&rxnet->local_mutex); |
18999 |
+ list_del_init(&local->link); |
19000 |
+ mutex_unlock(&rxnet->local_mutex); |
19001 |
+ |
19002 |
+- ASSERT(RB_EMPTY_ROOT(&local->client_conns)); |
19003 |
++ rxrpc_clean_up_local_conns(local); |
19004 |
++ rxrpc_service_connection_reaper(&rxnet->service_conn_reaper); |
19005 |
+ ASSERT(!local->service); |
19006 |
+ |
19007 |
+ if (socket) { |
19008 |
+diff --git a/net/rxrpc/output.c b/net/rxrpc/output.c |
19009 |
+index 345dc1c5fe72..31e47cfb3e68 100644 |
19010 |
+--- a/net/rxrpc/output.c |
19011 |
++++ b/net/rxrpc/output.c |
19012 |
+@@ -524,6 +524,9 @@ send_fragmentable: |
19013 |
+ } |
19014 |
+ break; |
19015 |
+ #endif |
19016 |
++ |
19017 |
++ default: |
19018 |
++ BUG(); |
19019 |
+ } |
19020 |
+ |
19021 |
+ if (ret < 0) |
19022 |
+diff --git a/net/sched/act_csum.c b/net/sched/act_csum.c |
19023 |
+index 1e269441065a..9ecbf8edcf39 100644 |
19024 |
+--- a/net/sched/act_csum.c |
19025 |
++++ b/net/sched/act_csum.c |
19026 |
+@@ -560,8 +560,11 @@ static int tcf_csum_act(struct sk_buff *skb, const struct tc_action *a, |
19027 |
+ struct tcf_result *res) |
19028 |
+ { |
19029 |
+ struct tcf_csum *p = to_tcf_csum(a); |
19030 |
++ bool orig_vlan_tag_present = false; |
19031 |
++ unsigned int vlan_hdr_count = 0; |
19032 |
+ struct tcf_csum_params *params; |
19033 |
+ u32 update_flags; |
19034 |
++ __be16 protocol; |
19035 |
+ int action; |
19036 |
+ |
19037 |
+ params = rcu_dereference_bh(p->params); |
19038 |
+@@ -574,7 +577,9 @@ static int tcf_csum_act(struct sk_buff *skb, const struct tc_action *a, |
19039 |
+ goto drop; |
19040 |
+ |
19041 |
+ update_flags = params->update_flags; |
19042 |
+- switch (tc_skb_protocol(skb)) { |
19043 |
++ protocol = tc_skb_protocol(skb); |
19044 |
++again: |
19045 |
++ switch (protocol) { |
19046 |
+ case cpu_to_be16(ETH_P_IP): |
19047 |
+ if (!tcf_csum_ipv4(skb, update_flags)) |
19048 |
+ goto drop; |
19049 |
+@@ -583,13 +588,35 @@ static int tcf_csum_act(struct sk_buff *skb, const struct tc_action *a, |
19050 |
+ if (!tcf_csum_ipv6(skb, update_flags)) |
19051 |
+ goto drop; |
19052 |
+ break; |
19053 |
++ case cpu_to_be16(ETH_P_8021AD): /* fall through */ |
19054 |
++ case cpu_to_be16(ETH_P_8021Q): |
19055 |
++ if (skb_vlan_tag_present(skb) && !orig_vlan_tag_present) { |
19056 |
++ protocol = skb->protocol; |
19057 |
++ orig_vlan_tag_present = true; |
19058 |
++ } else { |
19059 |
++ struct vlan_hdr *vlan = (struct vlan_hdr *)skb->data; |
19060 |
++ |
19061 |
++ protocol = vlan->h_vlan_encapsulated_proto; |
19062 |
++ skb_pull(skb, VLAN_HLEN); |
19063 |
++ skb_reset_network_header(skb); |
19064 |
++ vlan_hdr_count++; |
19065 |
++ } |
19066 |
++ goto again; |
19067 |
++ } |
19068 |
++ |
19069 |
++out: |
19070 |
++ /* Restore the skb for the pulled VLAN tags */ |
19071 |
++ while (vlan_hdr_count--) { |
19072 |
++ skb_push(skb, VLAN_HLEN); |
19073 |
++ skb_reset_network_header(skb); |
19074 |
+ } |
19075 |
+ |
19076 |
+ return action; |
19077 |
+ |
19078 |
+ drop: |
19079 |
+ qstats_drop_inc(this_cpu_ptr(p->common.cpu_qstats)); |
19080 |
+- return TC_ACT_SHOT; |
19081 |
++ action = TC_ACT_SHOT; |
19082 |
++ goto out; |
19083 |
+ } |
19084 |
+ |
19085 |
+ static int tcf_csum_dump(struct sk_buff *skb, struct tc_action *a, int bind, |
19086 |
+diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c |
19087 |
+index 399e3beae6cf..a30c17a28281 100644 |
19088 |
+--- a/net/sched/act_mirred.c |
19089 |
++++ b/net/sched/act_mirred.c |
19090 |
+@@ -445,7 +445,11 @@ static int __init mirred_init_module(void) |
19091 |
+ return err; |
19092 |
+ |
19093 |
+ pr_info("Mirror/redirect action on\n"); |
19094 |
+- return tcf_register_action(&act_mirred_ops, &mirred_net_ops); |
19095 |
++ err = tcf_register_action(&act_mirred_ops, &mirred_net_ops); |
19096 |
++ if (err) |
19097 |
++ unregister_netdevice_notifier(&mirred_device_notifier); |
19098 |
++ |
19099 |
++ return err; |
19100 |
+ } |
19101 |
+ |
19102 |
+ static void __exit mirred_cleanup_module(void) |
19103 |
+diff --git a/net/sched/sch_cbs.c b/net/sched/sch_cbs.c |
19104 |
+index e26a24017faa..940e72d6db18 100644 |
19105 |
+--- a/net/sched/sch_cbs.c |
19106 |
++++ b/net/sched/sch_cbs.c |
19107 |
+@@ -61,16 +61,20 @@ |
19108 |
+ #include <linux/string.h> |
19109 |
+ #include <linux/errno.h> |
19110 |
+ #include <linux/skbuff.h> |
19111 |
++#include <net/netevent.h> |
19112 |
+ #include <net/netlink.h> |
19113 |
+ #include <net/sch_generic.h> |
19114 |
+ #include <net/pkt_sched.h> |
19115 |
+ |
19116 |
++static LIST_HEAD(cbs_list); |
19117 |
++static DEFINE_SPINLOCK(cbs_list_lock); |
19118 |
++ |
19119 |
+ #define BYTES_PER_KBIT (1000LL / 8) |
19120 |
+ |
19121 |
+ struct cbs_sched_data { |
19122 |
+ bool offload; |
19123 |
+ int queue; |
19124 |
+- s64 port_rate; /* in bytes/s */ |
19125 |
++ atomic64_t port_rate; /* in bytes/s */ |
19126 |
+ s64 last; /* timestamp in ns */ |
19127 |
+ s64 credits; /* in bytes */ |
19128 |
+ s32 locredit; /* in bytes */ |
19129 |
+@@ -82,6 +86,7 @@ struct cbs_sched_data { |
19130 |
+ struct sk_buff **to_free); |
19131 |
+ struct sk_buff *(*dequeue)(struct Qdisc *sch); |
19132 |
+ struct Qdisc *qdisc; |
19133 |
++ struct list_head cbs_list; |
19134 |
+ }; |
19135 |
+ |
19136 |
+ static int cbs_child_enqueue(struct sk_buff *skb, struct Qdisc *sch, |
19137 |
+@@ -206,7 +211,8 @@ static struct sk_buff *cbs_dequeue_soft(struct Qdisc *sch) |
19138 |
+ /* As sendslope is a negative number, this will decrease the |
19139 |
+ * amount of q->credits. |
19140 |
+ */ |
19141 |
+- credits = credits_from_len(len, q->sendslope, q->port_rate); |
19142 |
++ credits = credits_from_len(len, q->sendslope, |
19143 |
++ atomic64_read(&q->port_rate)); |
19144 |
+ credits += q->credits; |
19145 |
+ |
19146 |
+ q->credits = max_t(s64, credits, q->locredit); |
19147 |
+@@ -293,6 +299,58 @@ static int cbs_enable_offload(struct net_device *dev, struct cbs_sched_data *q, |
19148 |
+ return 0; |
19149 |
+ } |
19150 |
+ |
19151 |
++static void cbs_set_port_rate(struct net_device *dev, struct cbs_sched_data *q) |
19152 |
++{ |
19153 |
++ struct ethtool_link_ksettings ecmd; |
19154 |
++ int speed = SPEED_10; |
19155 |
++ int port_rate = -1; |
19156 |
++ int err; |
19157 |
++ |
19158 |
++ err = __ethtool_get_link_ksettings(dev, &ecmd); |
19159 |
++ if (err < 0) |
19160 |
++ goto skip; |
19161 |
++ |
19162 |
++ if (ecmd.base.speed && ecmd.base.speed != SPEED_UNKNOWN) |
19163 |
++ speed = ecmd.base.speed; |
19164 |
++ |
19165 |
++skip: |
19166 |
++ port_rate = speed * 1000 * BYTES_PER_KBIT; |
19167 |
++ |
19168 |
++ atomic64_set(&q->port_rate, port_rate); |
19169 |
++ netdev_dbg(dev, "cbs: set %s's port_rate to: %lld, linkspeed: %d\n", |
19170 |
++ dev->name, (long long)atomic64_read(&q->port_rate), |
19171 |
++ ecmd.base.speed); |
19172 |
++} |
19173 |
++ |
19174 |
++static int cbs_dev_notifier(struct notifier_block *nb, unsigned long event, |
19175 |
++ void *ptr) |
19176 |
++{ |
19177 |
++ struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
19178 |
++ struct cbs_sched_data *q; |
19179 |
++ struct net_device *qdev; |
19180 |
++ bool found = false; |
19181 |
++ |
19182 |
++ ASSERT_RTNL(); |
19183 |
++ |
19184 |
++ if (event != NETDEV_UP && event != NETDEV_CHANGE) |
19185 |
++ return NOTIFY_DONE; |
19186 |
++ |
19187 |
++ spin_lock(&cbs_list_lock); |
19188 |
++ list_for_each_entry(q, &cbs_list, cbs_list) { |
19189 |
++ qdev = qdisc_dev(q->qdisc); |
19190 |
++ if (qdev == dev) { |
19191 |
++ found = true; |
19192 |
++ break; |
19193 |
++ } |
19194 |
++ } |
19195 |
++ spin_unlock(&cbs_list_lock); |
19196 |
++ |
19197 |
++ if (found) |
19198 |
++ cbs_set_port_rate(dev, q); |
19199 |
++ |
19200 |
++ return NOTIFY_DONE; |
19201 |
++} |
19202 |
++ |
19203 |
+ static int cbs_change(struct Qdisc *sch, struct nlattr *opt, |
19204 |
+ struct netlink_ext_ack *extack) |
19205 |
+ { |
19206 |
+@@ -314,16 +372,7 @@ static int cbs_change(struct Qdisc *sch, struct nlattr *opt, |
19207 |
+ qopt = nla_data(tb[TCA_CBS_PARMS]); |
19208 |
+ |
19209 |
+ if (!qopt->offload) { |
19210 |
+- struct ethtool_link_ksettings ecmd; |
19211 |
+- s64 link_speed; |
19212 |
+- |
19213 |
+- if (!__ethtool_get_link_ksettings(dev, &ecmd)) |
19214 |
+- link_speed = ecmd.base.speed; |
19215 |
+- else |
19216 |
+- link_speed = SPEED_1000; |
19217 |
+- |
19218 |
+- q->port_rate = link_speed * 1000 * BYTES_PER_KBIT; |
19219 |
+- |
19220 |
++ cbs_set_port_rate(dev, q); |
19221 |
+ cbs_disable_offload(dev, q); |
19222 |
+ } else { |
19223 |
+ err = cbs_enable_offload(dev, q, qopt, extack); |
19224 |
+@@ -346,6 +395,7 @@ static int cbs_init(struct Qdisc *sch, struct nlattr *opt, |
19225 |
+ { |
19226 |
+ struct cbs_sched_data *q = qdisc_priv(sch); |
19227 |
+ struct net_device *dev = qdisc_dev(sch); |
19228 |
++ int err; |
19229 |
+ |
19230 |
+ if (!opt) { |
19231 |
+ NL_SET_ERR_MSG(extack, "Missing CBS qdisc options which are mandatory"); |
19232 |
+@@ -366,7 +416,17 @@ static int cbs_init(struct Qdisc *sch, struct nlattr *opt, |
19233 |
+ |
19234 |
+ qdisc_watchdog_init(&q->watchdog, sch); |
19235 |
+ |
19236 |
+- return cbs_change(sch, opt, extack); |
19237 |
++ err = cbs_change(sch, opt, extack); |
19238 |
++ if (err) |
19239 |
++ return err; |
19240 |
++ |
19241 |
++ if (!q->offload) { |
19242 |
++ spin_lock(&cbs_list_lock); |
19243 |
++ list_add(&q->cbs_list, &cbs_list); |
19244 |
++ spin_unlock(&cbs_list_lock); |
19245 |
++ } |
19246 |
++ |
19247 |
++ return 0; |
19248 |
+ } |
19249 |
+ |
19250 |
+ static void cbs_destroy(struct Qdisc *sch) |
19251 |
+@@ -374,8 +434,11 @@ static void cbs_destroy(struct Qdisc *sch) |
19252 |
+ struct cbs_sched_data *q = qdisc_priv(sch); |
19253 |
+ struct net_device *dev = qdisc_dev(sch); |
19254 |
+ |
19255 |
+- qdisc_watchdog_cancel(&q->watchdog); |
19256 |
++ spin_lock(&cbs_list_lock); |
19257 |
++ list_del(&q->cbs_list); |
19258 |
++ spin_unlock(&cbs_list_lock); |
19259 |
+ |
19260 |
++ qdisc_watchdog_cancel(&q->watchdog); |
19261 |
+ cbs_disable_offload(dev, q); |
19262 |
+ |
19263 |
+ if (q->qdisc) |
19264 |
+@@ -486,14 +549,29 @@ static struct Qdisc_ops cbs_qdisc_ops __read_mostly = { |
19265 |
+ .owner = THIS_MODULE, |
19266 |
+ }; |
19267 |
+ |
19268 |
++static struct notifier_block cbs_device_notifier = { |
19269 |
++ .notifier_call = cbs_dev_notifier, |
19270 |
++}; |
19271 |
++ |
19272 |
+ static int __init cbs_module_init(void) |
19273 |
+ { |
19274 |
+- return register_qdisc(&cbs_qdisc_ops); |
19275 |
++ int err; |
19276 |
++ |
19277 |
++ err = register_netdevice_notifier(&cbs_device_notifier); |
19278 |
++ if (err) |
19279 |
++ return err; |
19280 |
++ |
19281 |
++ err = register_qdisc(&cbs_qdisc_ops); |
19282 |
++ if (err) |
19283 |
++ unregister_netdevice_notifier(&cbs_device_notifier); |
19284 |
++ |
19285 |
++ return err; |
19286 |
+ } |
19287 |
+ |
19288 |
+ static void __exit cbs_module_exit(void) |
19289 |
+ { |
19290 |
+ unregister_qdisc(&cbs_qdisc_ops); |
19291 |
++ unregister_netdevice_notifier(&cbs_device_notifier); |
19292 |
+ } |
19293 |
+ module_init(cbs_module_init) |
19294 |
+ module_exit(cbs_module_exit) |
19295 |
+diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c |
19296 |
+index 15f8f24c190d..014a28d8dd4f 100644 |
19297 |
+--- a/net/sched/sch_netem.c |
19298 |
++++ b/net/sched/sch_netem.c |
19299 |
+@@ -436,8 +436,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch, |
19300 |
+ struct netem_skb_cb *cb; |
19301 |
+ struct sk_buff *skb2; |
19302 |
+ struct sk_buff *segs = NULL; |
19303 |
+- unsigned int len = 0, last_len, prev_len = qdisc_pkt_len(skb); |
19304 |
+- int nb = 0; |
19305 |
++ unsigned int prev_len = qdisc_pkt_len(skb); |
19306 |
+ int count = 1; |
19307 |
+ int rc = NET_XMIT_SUCCESS; |
19308 |
+ int rc_drop = NET_XMIT_DROP; |
19309 |
+@@ -494,6 +493,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch, |
19310 |
+ segs = netem_segment(skb, sch, to_free); |
19311 |
+ if (!segs) |
19312 |
+ return rc_drop; |
19313 |
++ qdisc_skb_cb(segs)->pkt_len = segs->len; |
19314 |
+ } else { |
19315 |
+ segs = skb; |
19316 |
+ } |
19317 |
+@@ -509,6 +509,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch, |
19318 |
+ if (skb->ip_summed == CHECKSUM_PARTIAL && |
19319 |
+ skb_checksum_help(skb)) { |
19320 |
+ qdisc_drop(skb, sch, to_free); |
19321 |
++ skb = NULL; |
19322 |
+ goto finish_segs; |
19323 |
+ } |
19324 |
+ |
19325 |
+@@ -583,6 +584,12 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch, |
19326 |
+ |
19327 |
+ finish_segs: |
19328 |
+ if (segs) { |
19329 |
++ unsigned int len, last_len; |
19330 |
++ int nb; |
19331 |
++ |
19332 |
++ len = skb ? skb->len : 0; |
19333 |
++ nb = skb ? 1 : 0; |
19334 |
++ |
19335 |
+ while (segs) { |
19336 |
+ skb2 = segs->next; |
19337 |
+ segs->next = NULL; |
19338 |
+@@ -598,9 +605,10 @@ finish_segs: |
19339 |
+ } |
19340 |
+ segs = skb2; |
19341 |
+ } |
19342 |
+- sch->q.qlen += nb; |
19343 |
+- if (nb > 1) |
19344 |
+- qdisc_tree_reduce_backlog(sch, 1 - nb, prev_len - len); |
19345 |
++ /* Parent qdiscs accounted for 1 skb of size @prev_len */ |
19346 |
++ qdisc_tree_reduce_backlog(sch, -(nb - 1), -(len - prev_len)); |
19347 |
++ } else if (!skb) { |
19348 |
++ return NET_XMIT_DROP; |
19349 |
+ } |
19350 |
+ return NET_XMIT_SUCCESS; |
19351 |
+ } |
19352 |
+diff --git a/net/sctp/input.c b/net/sctp/input.c |
19353 |
+index bfe29158afcc..f64d882c8698 100644 |
19354 |
+--- a/net/sctp/input.c |
19355 |
++++ b/net/sctp/input.c |
19356 |
+@@ -255,7 +255,7 @@ int sctp_rcv(struct sk_buff *skb) |
19357 |
+ bh_lock_sock(sk); |
19358 |
+ } |
19359 |
+ |
19360 |
+- if (sock_owned_by_user(sk)) { |
19361 |
++ if (sock_owned_by_user(sk) || !sctp_newsk_ready(sk)) { |
19362 |
+ if (sctp_add_backlog(sk, skb)) { |
19363 |
+ bh_unlock_sock(sk); |
19364 |
+ sctp_chunk_free(chunk); |
19365 |
+@@ -333,7 +333,7 @@ int sctp_backlog_rcv(struct sock *sk, struct sk_buff *skb) |
19366 |
+ local_bh_disable(); |
19367 |
+ bh_lock_sock(sk); |
19368 |
+ |
19369 |
+- if (sock_owned_by_user(sk)) { |
19370 |
++ if (sock_owned_by_user(sk) || !sctp_newsk_ready(sk)) { |
19371 |
+ if (sk_add_backlog(sk, skb, sk->sk_rcvbuf)) |
19372 |
+ sctp_chunk_free(chunk); |
19373 |
+ else |
19374 |
+@@ -348,7 +348,13 @@ int sctp_backlog_rcv(struct sock *sk, struct sk_buff *skb) |
19375 |
+ if (backloged) |
19376 |
+ return 0; |
19377 |
+ } else { |
19378 |
+- sctp_inq_push(inqueue, chunk); |
19379 |
++ if (!sctp_newsk_ready(sk)) { |
19380 |
++ if (!sk_add_backlog(sk, skb, sk->sk_rcvbuf)) |
19381 |
++ return 0; |
19382 |
++ sctp_chunk_free(chunk); |
19383 |
++ } else { |
19384 |
++ sctp_inq_push(inqueue, chunk); |
19385 |
++ } |
19386 |
+ } |
19387 |
+ |
19388 |
+ done: |
19389 |
+diff --git a/net/smc/smc_diag.c b/net/smc/smc_diag.c |
19390 |
+index dbf64a93d68a..371b4cf31fcd 100644 |
19391 |
+--- a/net/smc/smc_diag.c |
19392 |
++++ b/net/smc/smc_diag.c |
19393 |
+@@ -38,6 +38,7 @@ static void smc_diag_msg_common_fill(struct smc_diag_msg *r, struct sock *sk) |
19394 |
+ { |
19395 |
+ struct smc_sock *smc = smc_sk(sk); |
19396 |
+ |
19397 |
++ r->diag_family = sk->sk_family; |
19398 |
+ if (!smc->clcsock) |
19399 |
+ return; |
19400 |
+ r->id.idiag_sport = htons(smc->clcsock->sk->sk_num); |
19401 |
+@@ -45,14 +46,12 @@ static void smc_diag_msg_common_fill(struct smc_diag_msg *r, struct sock *sk) |
19402 |
+ r->id.idiag_if = smc->clcsock->sk->sk_bound_dev_if; |
19403 |
+ sock_diag_save_cookie(sk, r->id.idiag_cookie); |
19404 |
+ if (sk->sk_protocol == SMCPROTO_SMC) { |
19405 |
+- r->diag_family = PF_INET; |
19406 |
+ memset(&r->id.idiag_src, 0, sizeof(r->id.idiag_src)); |
19407 |
+ memset(&r->id.idiag_dst, 0, sizeof(r->id.idiag_dst)); |
19408 |
+ r->id.idiag_src[0] = smc->clcsock->sk->sk_rcv_saddr; |
19409 |
+ r->id.idiag_dst[0] = smc->clcsock->sk->sk_daddr; |
19410 |
+ #if IS_ENABLED(CONFIG_IPV6) |
19411 |
+ } else if (sk->sk_protocol == SMCPROTO_SMC6) { |
19412 |
+- r->diag_family = PF_INET6; |
19413 |
+ memcpy(&r->id.idiag_src, &smc->clcsock->sk->sk_v6_rcv_saddr, |
19414 |
+ sizeof(smc->clcsock->sk->sk_v6_rcv_saddr)); |
19415 |
+ memcpy(&r->id.idiag_dst, &smc->clcsock->sk->sk_v6_daddr, |
19416 |
+diff --git a/net/smc/smc_rx.c b/net/smc/smc_rx.c |
19417 |
+index bbcf0fe4ae10..36340912df48 100644 |
19418 |
+--- a/net/smc/smc_rx.c |
19419 |
++++ b/net/smc/smc_rx.c |
19420 |
+@@ -212,8 +212,7 @@ int smc_rx_wait(struct smc_sock *smc, long *timeo, |
19421 |
+ rc = sk_wait_event(sk, timeo, |
19422 |
+ sk->sk_err || |
19423 |
+ sk->sk_shutdown & RCV_SHUTDOWN || |
19424 |
+- fcrit(conn) || |
19425 |
+- smc_cdc_rxed_any_close_or_senddone(conn), |
19426 |
++ fcrit(conn), |
19427 |
+ &wait); |
19428 |
+ remove_wait_queue(sk_sleep(sk), &wait); |
19429 |
+ sk_clear_bit(SOCKWQ_ASYNC_WAITDATA, sk); |
19430 |
+@@ -263,6 +262,18 @@ static int smc_rx_recv_urg(struct smc_sock *smc, struct msghdr *msg, int len, |
19431 |
+ return -EAGAIN; |
19432 |
+ } |
19433 |
+ |
19434 |
++static bool smc_rx_recvmsg_data_available(struct smc_sock *smc) |
19435 |
++{ |
19436 |
++ struct smc_connection *conn = &smc->conn; |
19437 |
++ |
19438 |
++ if (smc_rx_data_available(conn)) |
19439 |
++ return true; |
19440 |
++ else if (conn->urg_state == SMC_URG_VALID) |
19441 |
++ /* we received a single urgent Byte - skip */ |
19442 |
++ smc_rx_update_cons(smc, 0); |
19443 |
++ return false; |
19444 |
++} |
19445 |
++ |
19446 |
+ /* smc_rx_recvmsg - receive data from RMBE |
19447 |
+ * @msg: copy data to receive buffer |
19448 |
+ * @pipe: copy data to pipe if set - indicates splice() call |
19449 |
+@@ -304,16 +315,18 @@ int smc_rx_recvmsg(struct smc_sock *smc, struct msghdr *msg, |
19450 |
+ if (read_done >= target || (pipe && read_done)) |
19451 |
+ break; |
19452 |
+ |
19453 |
+- if (atomic_read(&conn->bytes_to_rcv)) |
19454 |
++ if (smc_rx_recvmsg_data_available(smc)) |
19455 |
+ goto copy; |
19456 |
+- else if (conn->urg_state == SMC_URG_VALID) |
19457 |
+- /* we received a single urgent Byte - skip */ |
19458 |
+- smc_rx_update_cons(smc, 0); |
19459 |
+ |
19460 |
+ if (sk->sk_shutdown & RCV_SHUTDOWN || |
19461 |
+- smc_cdc_rxed_any_close_or_senddone(conn) || |
19462 |
+- conn->local_tx_ctrl.conn_state_flags.peer_conn_abort) |
19463 |
++ conn->local_tx_ctrl.conn_state_flags.peer_conn_abort) { |
19464 |
++ /* smc_cdc_msg_recv_action() could have run after |
19465 |
++ * above smc_rx_recvmsg_data_available() |
19466 |
++ */ |
19467 |
++ if (smc_rx_recvmsg_data_available(smc)) |
19468 |
++ goto copy; |
19469 |
+ break; |
19470 |
++ } |
19471 |
+ |
19472 |
+ if (read_done) { |
19473 |
+ if (sk->sk_err || |
19474 |
+diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c |
19475 |
+index 1a65f88d021a..24c7a1e2bd34 100644 |
19476 |
+--- a/net/sunrpc/auth_gss/svcauth_gss.c |
19477 |
++++ b/net/sunrpc/auth_gss/svcauth_gss.c |
19478 |
+@@ -1054,24 +1054,32 @@ gss_read_verf(struct rpc_gss_wire_cred *gc, |
19479 |
+ return 0; |
19480 |
+ } |
19481 |
+ |
19482 |
+-/* Ok this is really heavily depending on a set of semantics in |
19483 |
+- * how rqstp is set up by svc_recv and pages laid down by the |
19484 |
+- * server when reading a request. We are basically guaranteed that |
19485 |
+- * the token lays all down linearly across a set of pages, starting |
19486 |
+- * at iov_base in rq_arg.head[0] which happens to be the first of a |
19487 |
+- * set of pages stored in rq_pages[]. |
19488 |
+- * rq_arg.head[0].iov_base will provide us the page_base to pass |
19489 |
+- * to the upcall. |
19490 |
+- */ |
19491 |
+-static inline int |
19492 |
+-gss_read_proxy_verf(struct svc_rqst *rqstp, |
19493 |
+- struct rpc_gss_wire_cred *gc, __be32 *authp, |
19494 |
+- struct xdr_netobj *in_handle, |
19495 |
+- struct gssp_in_token *in_token) |
19496 |
++static void gss_free_in_token_pages(struct gssp_in_token *in_token) |
19497 |
+ { |
19498 |
+- struct kvec *argv = &rqstp->rq_arg.head[0]; |
19499 |
+ u32 inlen; |
19500 |
+- int res; |
19501 |
++ int i; |
19502 |
++ |
19503 |
++ i = 0; |
19504 |
++ inlen = in_token->page_len; |
19505 |
++ while (inlen) { |
19506 |
++ if (in_token->pages[i]) |
19507 |
++ put_page(in_token->pages[i]); |
19508 |
++ inlen -= inlen > PAGE_SIZE ? PAGE_SIZE : inlen; |
19509 |
++ } |
19510 |
++ |
19511 |
++ kfree(in_token->pages); |
19512 |
++ in_token->pages = NULL; |
19513 |
++} |
19514 |
++ |
19515 |
++static int gss_read_proxy_verf(struct svc_rqst *rqstp, |
19516 |
++ struct rpc_gss_wire_cred *gc, __be32 *authp, |
19517 |
++ struct xdr_netobj *in_handle, |
19518 |
++ struct gssp_in_token *in_token) |
19519 |
++{ |
19520 |
++ struct kvec *argv = &rqstp->rq_arg.head[0]; |
19521 |
++ unsigned int page_base, length; |
19522 |
++ int pages, i, res; |
19523 |
++ size_t inlen; |
19524 |
+ |
19525 |
+ res = gss_read_common_verf(gc, argv, authp, in_handle); |
19526 |
+ if (res) |
19527 |
+@@ -1081,10 +1089,36 @@ gss_read_proxy_verf(struct svc_rqst *rqstp, |
19528 |
+ if (inlen > (argv->iov_len + rqstp->rq_arg.page_len)) |
19529 |
+ return SVC_DENIED; |
19530 |
+ |
19531 |
+- in_token->pages = rqstp->rq_pages; |
19532 |
+- in_token->page_base = (ulong)argv->iov_base & ~PAGE_MASK; |
19533 |
++ pages = DIV_ROUND_UP(inlen, PAGE_SIZE); |
19534 |
++ in_token->pages = kcalloc(pages, sizeof(struct page *), GFP_KERNEL); |
19535 |
++ if (!in_token->pages) |
19536 |
++ return SVC_DENIED; |
19537 |
++ in_token->page_base = 0; |
19538 |
+ in_token->page_len = inlen; |
19539 |
++ for (i = 0; i < pages; i++) { |
19540 |
++ in_token->pages[i] = alloc_page(GFP_KERNEL); |
19541 |
++ if (!in_token->pages[i]) { |
19542 |
++ gss_free_in_token_pages(in_token); |
19543 |
++ return SVC_DENIED; |
19544 |
++ } |
19545 |
++ } |
19546 |
+ |
19547 |
++ length = min_t(unsigned int, inlen, argv->iov_len); |
19548 |
++ memcpy(page_address(in_token->pages[0]), argv->iov_base, length); |
19549 |
++ inlen -= length; |
19550 |
++ |
19551 |
++ i = 1; |
19552 |
++ page_base = rqstp->rq_arg.page_base; |
19553 |
++ while (inlen) { |
19554 |
++ length = min_t(unsigned int, inlen, PAGE_SIZE); |
19555 |
++ memcpy(page_address(in_token->pages[i]), |
19556 |
++ page_address(rqstp->rq_arg.pages[i]) + page_base, |
19557 |
++ length); |
19558 |
++ |
19559 |
++ inlen -= length; |
19560 |
++ page_base = 0; |
19561 |
++ i++; |
19562 |
++ } |
19563 |
+ return 0; |
19564 |
+ } |
19565 |
+ |
19566 |
+@@ -1259,8 +1293,11 @@ static int svcauth_gss_proxy_init(struct svc_rqst *rqstp, |
19567 |
+ break; |
19568 |
+ case GSS_S_COMPLETE: |
19569 |
+ status = gss_proxy_save_rsc(sn->rsc_cache, &ud, &handle); |
19570 |
+- if (status) |
19571 |
++ if (status) { |
19572 |
++ pr_info("%s: gss_proxy_save_rsc failed (%d)\n", |
19573 |
++ __func__, status); |
19574 |
+ goto out; |
19575 |
++ } |
19576 |
+ cli_handle.data = (u8 *)&handle; |
19577 |
+ cli_handle.len = sizeof(handle); |
19578 |
+ break; |
19579 |
+@@ -1271,15 +1308,20 @@ static int svcauth_gss_proxy_init(struct svc_rqst *rqstp, |
19580 |
+ |
19581 |
+ /* Got an answer to the upcall; use it: */ |
19582 |
+ if (gss_write_init_verf(sn->rsc_cache, rqstp, |
19583 |
+- &cli_handle, &ud.major_status)) |
19584 |
++ &cli_handle, &ud.major_status)) { |
19585 |
++ pr_info("%s: gss_write_init_verf failed\n", __func__); |
19586 |
+ goto out; |
19587 |
++ } |
19588 |
+ if (gss_write_resv(resv, PAGE_SIZE, |
19589 |
+ &cli_handle, &ud.out_token, |
19590 |
+- ud.major_status, ud.minor_status)) |
19591 |
++ ud.major_status, ud.minor_status)) { |
19592 |
++ pr_info("%s: gss_write_resv failed\n", __func__); |
19593 |
+ goto out; |
19594 |
++ } |
19595 |
+ |
19596 |
+ ret = SVC_COMPLETE; |
19597 |
+ out: |
19598 |
++ gss_free_in_token_pages(&ud.in_token); |
19599 |
+ gssp_free_upcall_data(&ud); |
19600 |
+ return ret; |
19601 |
+ } |
19602 |
+diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c |
19603 |
+index 90ec322dbbc0..ef1f3d076af9 100644 |
19604 |
+--- a/net/sunrpc/xprtrdma/verbs.c |
19605 |
++++ b/net/sunrpc/xprtrdma/verbs.c |
19606 |
+@@ -1558,10 +1558,11 @@ rpcrdma_post_recvs(struct rpcrdma_xprt *r_xprt, bool temp) |
19607 |
+ rc = ib_post_recv(r_xprt->rx_ia.ri_id->qp, wr, |
19608 |
+ (const struct ib_recv_wr **)&bad_wr); |
19609 |
+ if (rc) { |
19610 |
+- for (wr = bad_wr; wr; wr = wr->next) { |
19611 |
++ for (wr = bad_wr; wr;) { |
19612 |
+ struct rpcrdma_rep *rep; |
19613 |
+ |
19614 |
+ rep = container_of(wr, struct rpcrdma_rep, rr_recv_wr); |
19615 |
++ wr = wr->next; |
19616 |
+ rpcrdma_recv_buffer_put(rep); |
19617 |
+ --count; |
19618 |
+ } |
19619 |
+diff --git a/net/tipc/link.c b/net/tipc/link.c |
19620 |
+index 0fbf8ea18ce0..cc9a0485536b 100644 |
19621 |
+--- a/net/tipc/link.c |
19622 |
++++ b/net/tipc/link.c |
19623 |
+@@ -830,18 +830,31 @@ static int link_schedule_user(struct tipc_link *l, struct tipc_msg *hdr) |
19624 |
+ */ |
19625 |
+ static void link_prepare_wakeup(struct tipc_link *l) |
19626 |
+ { |
19627 |
++ struct sk_buff_head *wakeupq = &l->wakeupq; |
19628 |
++ struct sk_buff_head *inputq = l->inputq; |
19629 |
+ struct sk_buff *skb, *tmp; |
19630 |
+- int imp, i = 0; |
19631 |
++ struct sk_buff_head tmpq; |
19632 |
++ int avail[5] = {0,}; |
19633 |
++ int imp = 0; |
19634 |
++ |
19635 |
++ __skb_queue_head_init(&tmpq); |
19636 |
+ |
19637 |
+- skb_queue_walk_safe(&l->wakeupq, skb, tmp) { |
19638 |
++ for (; imp <= TIPC_SYSTEM_IMPORTANCE; imp++) |
19639 |
++ avail[imp] = l->backlog[imp].limit - l->backlog[imp].len; |
19640 |
++ |
19641 |
++ skb_queue_walk_safe(wakeupq, skb, tmp) { |
19642 |
+ imp = TIPC_SKB_CB(skb)->chain_imp; |
19643 |
+- if (l->backlog[imp].len < l->backlog[imp].limit) { |
19644 |
+- skb_unlink(skb, &l->wakeupq); |
19645 |
+- skb_queue_tail(l->inputq, skb); |
19646 |
+- } else if (i++ > 10) { |
19647 |
+- break; |
19648 |
+- } |
19649 |
++ if (avail[imp] <= 0) |
19650 |
++ continue; |
19651 |
++ avail[imp]--; |
19652 |
++ __skb_unlink(skb, wakeupq); |
19653 |
++ __skb_queue_tail(&tmpq, skb); |
19654 |
+ } |
19655 |
++ |
19656 |
++ spin_lock_bh(&inputq->lock); |
19657 |
++ skb_queue_splice_tail(&tmpq, inputq); |
19658 |
++ spin_unlock_bh(&inputq->lock); |
19659 |
++ |
19660 |
+ } |
19661 |
+ |
19662 |
+ void tipc_link_reset(struct tipc_link *l) |
19663 |
+diff --git a/net/tipc/monitor.c b/net/tipc/monitor.c |
19664 |
+index 67f69389ec17..23706ee16607 100644 |
19665 |
+--- a/net/tipc/monitor.c |
19666 |
++++ b/net/tipc/monitor.c |
19667 |
+@@ -665,6 +665,21 @@ void tipc_mon_delete(struct net *net, int bearer_id) |
19668 |
+ kfree(mon); |
19669 |
+ } |
19670 |
+ |
19671 |
++void tipc_mon_reinit_self(struct net *net) |
19672 |
++{ |
19673 |
++ struct tipc_monitor *mon; |
19674 |
++ int bearer_id; |
19675 |
++ |
19676 |
++ for (bearer_id = 0; bearer_id < MAX_BEARERS; bearer_id++) { |
19677 |
++ mon = tipc_monitor(net, bearer_id); |
19678 |
++ if (!mon) |
19679 |
++ continue; |
19680 |
++ write_lock_bh(&mon->lock); |
19681 |
++ mon->self->addr = tipc_own_addr(net); |
19682 |
++ write_unlock_bh(&mon->lock); |
19683 |
++ } |
19684 |
++} |
19685 |
++ |
19686 |
+ int tipc_nl_monitor_set_threshold(struct net *net, u32 cluster_size) |
19687 |
+ { |
19688 |
+ struct tipc_net *tn = tipc_net(net); |
19689 |
+diff --git a/net/tipc/monitor.h b/net/tipc/monitor.h |
19690 |
+index 2a21b93e0d04..ed63d2e650b0 100644 |
19691 |
+--- a/net/tipc/monitor.h |
19692 |
++++ b/net/tipc/monitor.h |
19693 |
+@@ -77,6 +77,7 @@ int __tipc_nl_add_monitor(struct net *net, struct tipc_nl_msg *msg, |
19694 |
+ u32 bearer_id); |
19695 |
+ int tipc_nl_add_monitor_peer(struct net *net, struct tipc_nl_msg *msg, |
19696 |
+ u32 bearer_id, u32 *prev_node); |
19697 |
++void tipc_mon_reinit_self(struct net *net); |
19698 |
+ |
19699 |
+ extern const int tipc_max_domain_size; |
19700 |
+ #endif |
19701 |
+diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c |
19702 |
+index e0a3dd424d8c..836e629e8f4a 100644 |
19703 |
+--- a/net/tipc/name_distr.c |
19704 |
++++ b/net/tipc/name_distr.c |
19705 |
+@@ -94,8 +94,9 @@ struct sk_buff *tipc_named_publish(struct net *net, struct publication *publ) |
19706 |
+ list_add_tail_rcu(&publ->binding_node, &nt->node_scope); |
19707 |
+ return NULL; |
19708 |
+ } |
19709 |
+- list_add_tail_rcu(&publ->binding_node, &nt->cluster_scope); |
19710 |
+- |
19711 |
++ write_lock_bh(&nt->cluster_scope_lock); |
19712 |
++ list_add_tail(&publ->binding_node, &nt->cluster_scope); |
19713 |
++ write_unlock_bh(&nt->cluster_scope_lock); |
19714 |
+ skb = named_prepare_buf(net, PUBLICATION, ITEM_SIZE, 0); |
19715 |
+ if (!skb) { |
19716 |
+ pr_warn("Publication distribution failure\n"); |
19717 |
+@@ -112,11 +113,13 @@ struct sk_buff *tipc_named_publish(struct net *net, struct publication *publ) |
19718 |
+ */ |
19719 |
+ struct sk_buff *tipc_named_withdraw(struct net *net, struct publication *publ) |
19720 |
+ { |
19721 |
++ struct name_table *nt = tipc_name_table(net); |
19722 |
+ struct sk_buff *buf; |
19723 |
+ struct distr_item *item; |
19724 |
+ |
19725 |
+- list_del_rcu(&publ->binding_node); |
19726 |
+- |
19727 |
++ write_lock_bh(&nt->cluster_scope_lock); |
19728 |
++ list_del(&publ->binding_node); |
19729 |
++ write_unlock_bh(&nt->cluster_scope_lock); |
19730 |
+ if (publ->scope == TIPC_NODE_SCOPE) |
19731 |
+ return NULL; |
19732 |
+ |
19733 |
+@@ -147,7 +150,7 @@ static void named_distribute(struct net *net, struct sk_buff_head *list, |
19734 |
+ ITEM_SIZE) * ITEM_SIZE; |
19735 |
+ u32 msg_rem = msg_dsz; |
19736 |
+ |
19737 |
+- list_for_each_entry_rcu(publ, pls, binding_node) { |
19738 |
++ list_for_each_entry(publ, pls, binding_node) { |
19739 |
+ /* Prepare next buffer: */ |
19740 |
+ if (!skb) { |
19741 |
+ skb = named_prepare_buf(net, PUBLICATION, msg_rem, |
19742 |
+@@ -189,11 +192,10 @@ void tipc_named_node_up(struct net *net, u32 dnode) |
19743 |
+ |
19744 |
+ __skb_queue_head_init(&head); |
19745 |
+ |
19746 |
+- rcu_read_lock(); |
19747 |
++ read_lock_bh(&nt->cluster_scope_lock); |
19748 |
+ named_distribute(net, &head, dnode, &nt->cluster_scope); |
19749 |
+- rcu_read_unlock(); |
19750 |
+- |
19751 |
+ tipc_node_xmit(net, &head, dnode, 0); |
19752 |
++ read_unlock_bh(&nt->cluster_scope_lock); |
19753 |
+ } |
19754 |
+ |
19755 |
+ /** |
19756 |
+diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c |
19757 |
+index d72985ca1d55..89993afe0fbd 100644 |
19758 |
+--- a/net/tipc/name_table.c |
19759 |
++++ b/net/tipc/name_table.c |
19760 |
+@@ -744,6 +744,7 @@ int tipc_nametbl_init(struct net *net) |
19761 |
+ |
19762 |
+ INIT_LIST_HEAD(&nt->node_scope); |
19763 |
+ INIT_LIST_HEAD(&nt->cluster_scope); |
19764 |
++ rwlock_init(&nt->cluster_scope_lock); |
19765 |
+ tn->nametbl = nt; |
19766 |
+ spin_lock_init(&tn->nametbl_lock); |
19767 |
+ return 0; |
19768 |
+diff --git a/net/tipc/name_table.h b/net/tipc/name_table.h |
19769 |
+index 892bd750b85f..f79066334cc8 100644 |
19770 |
+--- a/net/tipc/name_table.h |
19771 |
++++ b/net/tipc/name_table.h |
19772 |
+@@ -100,6 +100,7 @@ struct name_table { |
19773 |
+ struct hlist_head services[TIPC_NAMETBL_SIZE]; |
19774 |
+ struct list_head node_scope; |
19775 |
+ struct list_head cluster_scope; |
19776 |
++ rwlock_t cluster_scope_lock; |
19777 |
+ u32 local_publ_count; |
19778 |
+ }; |
19779 |
+ |
19780 |
+diff --git a/net/tipc/net.c b/net/tipc/net.c |
19781 |
+index 7ce1e86b024f..2e2e938fe4b7 100644 |
19782 |
+--- a/net/tipc/net.c |
19783 |
++++ b/net/tipc/net.c |
19784 |
+@@ -42,6 +42,7 @@ |
19785 |
+ #include "node.h" |
19786 |
+ #include "bcast.h" |
19787 |
+ #include "netlink.h" |
19788 |
++#include "monitor.h" |
19789 |
+ |
19790 |
+ /* |
19791 |
+ * The TIPC locking policy is designed to ensure a very fine locking |
19792 |
+@@ -136,6 +137,7 @@ static void tipc_net_finalize(struct net *net, u32 addr) |
19793 |
+ tipc_set_node_addr(net, addr); |
19794 |
+ tipc_named_reinit(net); |
19795 |
+ tipc_sk_reinit(net); |
19796 |
++ tipc_mon_reinit_self(net); |
19797 |
+ tipc_nametbl_publish(net, TIPC_CFG_SRV, addr, addr, |
19798 |
+ TIPC_CLUSTER_SCOPE, 0, addr); |
19799 |
+ } |
19800 |
+diff --git a/net/tipc/node.c b/net/tipc/node.c |
19801 |
+index 32556f480a60..e67ffd194927 100644 |
19802 |
+--- a/net/tipc/node.c |
19803 |
++++ b/net/tipc/node.c |
19804 |
+@@ -810,10 +810,10 @@ static void __tipc_node_link_down(struct tipc_node *n, int *bearer_id, |
19805 |
+ static void tipc_node_link_down(struct tipc_node *n, int bearer_id, bool delete) |
19806 |
+ { |
19807 |
+ struct tipc_link_entry *le = &n->links[bearer_id]; |
19808 |
++ struct tipc_media_addr *maddr = NULL; |
19809 |
+ struct tipc_link *l = le->link; |
19810 |
+- struct tipc_media_addr *maddr; |
19811 |
+- struct sk_buff_head xmitq; |
19812 |
+ int old_bearer_id = bearer_id; |
19813 |
++ struct sk_buff_head xmitq; |
19814 |
+ |
19815 |
+ if (!l) |
19816 |
+ return; |
19817 |
+@@ -835,7 +835,8 @@ static void tipc_node_link_down(struct tipc_node *n, int bearer_id, bool delete) |
19818 |
+ tipc_node_write_unlock(n); |
19819 |
+ if (delete) |
19820 |
+ tipc_mon_remove_peer(n->net, n->addr, old_bearer_id); |
19821 |
+- tipc_bearer_xmit(n->net, bearer_id, &xmitq, maddr); |
19822 |
++ if (!skb_queue_empty(&xmitq)) |
19823 |
++ tipc_bearer_xmit(n->net, bearer_id, &xmitq, maddr); |
19824 |
+ tipc_sk_rcv(n->net, &le->inputq); |
19825 |
+ } |
19826 |
+ |
19827 |
+diff --git a/net/tipc/socket.c b/net/tipc/socket.c |
19828 |
+index 5841d62ff580..40947ad90222 100644 |
19829 |
+--- a/net/tipc/socket.c |
19830 |
++++ b/net/tipc/socket.c |
19831 |
+@@ -501,7 +501,7 @@ static void __tipc_shutdown(struct socket *sock, int error) |
19832 |
+ struct sock *sk = sock->sk; |
19833 |
+ struct tipc_sock *tsk = tipc_sk(sk); |
19834 |
+ struct net *net = sock_net(sk); |
19835 |
+- long timeout = CONN_TIMEOUT_DEFAULT; |
19836 |
++ long timeout = msecs_to_jiffies(CONN_TIMEOUT_DEFAULT); |
19837 |
+ u32 dnode = tsk_peer_node(tsk); |
19838 |
+ struct sk_buff *skb; |
19839 |
+ |
19840 |
+diff --git a/net/tipc/sysctl.c b/net/tipc/sysctl.c |
19841 |
+index 1a779b1e8510..40f6d82083d7 100644 |
19842 |
+--- a/net/tipc/sysctl.c |
19843 |
++++ b/net/tipc/sysctl.c |
19844 |
+@@ -37,6 +37,8 @@ |
19845 |
+ |
19846 |
+ #include <linux/sysctl.h> |
19847 |
+ |
19848 |
++static int zero; |
19849 |
++static int one = 1; |
19850 |
+ static struct ctl_table_header *tipc_ctl_hdr; |
19851 |
+ |
19852 |
+ static struct ctl_table tipc_table[] = { |
19853 |
+@@ -45,14 +47,16 @@ static struct ctl_table tipc_table[] = { |
19854 |
+ .data = &sysctl_tipc_rmem, |
19855 |
+ .maxlen = sizeof(sysctl_tipc_rmem), |
19856 |
+ .mode = 0644, |
19857 |
+- .proc_handler = proc_dointvec, |
19858 |
++ .proc_handler = proc_dointvec_minmax, |
19859 |
++ .extra1 = &one, |
19860 |
+ }, |
19861 |
+ { |
19862 |
+ .procname = "named_timeout", |
19863 |
+ .data = &sysctl_tipc_named_timeout, |
19864 |
+ .maxlen = sizeof(sysctl_tipc_named_timeout), |
19865 |
+ .mode = 0644, |
19866 |
+- .proc_handler = proc_dointvec, |
19867 |
++ .proc_handler = proc_dointvec_minmax, |
19868 |
++ .extra1 = &zero, |
19869 |
+ }, |
19870 |
+ {} |
19871 |
+ }; |
19872 |
+diff --git a/net/tls/tls_device_fallback.c b/net/tls/tls_device_fallback.c |
19873 |
+index 426dd97725e4..6cf832891b53 100644 |
19874 |
+--- a/net/tls/tls_device_fallback.c |
19875 |
++++ b/net/tls/tls_device_fallback.c |
19876 |
+@@ -208,6 +208,10 @@ static void complete_skb(struct sk_buff *nskb, struct sk_buff *skb, int headln) |
19877 |
+ |
19878 |
+ update_chksum(nskb, headln); |
19879 |
+ |
19880 |
++ /* sock_efree means skb must gone through skb_orphan_partial() */ |
19881 |
++ if (nskb->destructor == sock_efree) |
19882 |
++ return; |
19883 |
++ |
19884 |
+ delta = nskb->truesize - skb->truesize; |
19885 |
+ if (likely(delta < 0)) |
19886 |
+ WARN_ON_ONCE(refcount_sub_and_test(-delta, &sk->sk_wmem_alloc)); |
19887 |
+diff --git a/net/wireless/reg.c b/net/wireless/reg.c |
19888 |
+index 64841238df85..5643bdee7198 100644 |
19889 |
+--- a/net/wireless/reg.c |
19890 |
++++ b/net/wireless/reg.c |
19891 |
+@@ -3870,6 +3870,15 @@ static int __init regulatory_init_db(void) |
19892 |
+ { |
19893 |
+ int err; |
19894 |
+ |
19895 |
++ /* |
19896 |
++ * It's possible that - due to other bugs/issues - cfg80211 |
19897 |
++ * never called regulatory_init() below, or that it failed; |
19898 |
++ * in that case, don't try to do any further work here as |
19899 |
++ * it's doomed to lead to crashes. |
19900 |
++ */ |
19901 |
++ if (IS_ERR_OR_NULL(reg_pdev)) |
19902 |
++ return -EINVAL; |
19903 |
++ |
19904 |
+ err = load_builtin_regdb_keys(); |
19905 |
+ if (err) |
19906 |
+ return err; |
19907 |
+diff --git a/net/xdp/xdp_umem.c b/net/xdp/xdp_umem.c |
19908 |
+index d9117ab035f7..556a649512b6 100644 |
19909 |
+--- a/net/xdp/xdp_umem.c |
19910 |
++++ b/net/xdp/xdp_umem.c |
19911 |
+@@ -23,6 +23,9 @@ void xdp_add_sk_umem(struct xdp_umem *umem, struct xdp_sock *xs) |
19912 |
+ { |
19913 |
+ unsigned long flags; |
19914 |
+ |
19915 |
++ if (!xs->tx) |
19916 |
++ return; |
19917 |
++ |
19918 |
+ spin_lock_irqsave(&umem->xsk_list_lock, flags); |
19919 |
+ list_add_rcu(&xs->list, &umem->xsk_list); |
19920 |
+ spin_unlock_irqrestore(&umem->xsk_list_lock, flags); |
19921 |
+@@ -32,6 +35,9 @@ void xdp_del_sk_umem(struct xdp_umem *umem, struct xdp_sock *xs) |
19922 |
+ { |
19923 |
+ unsigned long flags; |
19924 |
+ |
19925 |
++ if (!xs->tx) |
19926 |
++ return; |
19927 |
++ |
19928 |
+ spin_lock_irqsave(&umem->xsk_list_lock, flags); |
19929 |
+ list_del_rcu(&xs->list); |
19930 |
+ spin_unlock_irqrestore(&umem->xsk_list_lock, flags); |
19931 |
+diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c |
19932 |
+index ff15207036dc..72caa4fb13f4 100644 |
19933 |
+--- a/net/xdp/xsk.c |
19934 |
++++ b/net/xdp/xsk.c |
19935 |
+@@ -218,6 +218,9 @@ static int xsk_generic_xmit(struct sock *sk, struct msghdr *m, |
19936 |
+ |
19937 |
+ mutex_lock(&xs->mutex); |
19938 |
+ |
19939 |
++ if (xs->queue_id >= xs->dev->real_num_tx_queues) |
19940 |
++ goto out; |
19941 |
++ |
19942 |
+ while (xskq_peek_desc(xs->tx, &desc)) { |
19943 |
+ char *buffer; |
19944 |
+ u64 addr; |
19945 |
+@@ -228,12 +231,6 @@ static int xsk_generic_xmit(struct sock *sk, struct msghdr *m, |
19946 |
+ goto out; |
19947 |
+ } |
19948 |
+ |
19949 |
+- if (xskq_reserve_addr(xs->umem->cq)) |
19950 |
+- goto out; |
19951 |
+- |
19952 |
+- if (xs->queue_id >= xs->dev->real_num_tx_queues) |
19953 |
+- goto out; |
19954 |
+- |
19955 |
+ len = desc.len; |
19956 |
+ skb = sock_alloc_send_skb(sk, len, 1, &err); |
19957 |
+ if (unlikely(!skb)) { |
19958 |
+@@ -245,7 +242,7 @@ static int xsk_generic_xmit(struct sock *sk, struct msghdr *m, |
19959 |
+ addr = desc.addr; |
19960 |
+ buffer = xdp_umem_get_data(xs->umem, addr); |
19961 |
+ err = skb_store_bits(skb, 0, buffer, len); |
19962 |
+- if (unlikely(err)) { |
19963 |
++ if (unlikely(err) || xskq_reserve_addr(xs->umem->cq)) { |
19964 |
+ kfree_skb(skb); |
19965 |
+ goto out; |
19966 |
+ } |
19967 |
+@@ -323,7 +320,7 @@ static int xsk_init_queue(u32 entries, struct xsk_queue **queue, |
19968 |
+ |
19969 |
+ /* Make sure queue is ready before it can be seen by others */ |
19970 |
+ smp_wmb(); |
19971 |
+- *queue = q; |
19972 |
++ WRITE_ONCE(*queue, q); |
19973 |
+ return 0; |
19974 |
+ } |
19975 |
+ |
19976 |
+@@ -457,7 +454,7 @@ static int xsk_bind(struct socket *sock, struct sockaddr *addr, int addr_len) |
19977 |
+ } |
19978 |
+ |
19979 |
+ xdp_get_umem(umem_xs->umem); |
19980 |
+- xs->umem = umem_xs->umem; |
19981 |
++ WRITE_ONCE(xs->umem, umem_xs->umem); |
19982 |
+ sockfd_put(sock); |
19983 |
+ } else if (!xs->umem || !xdp_umem_validate_queues(xs->umem)) { |
19984 |
+ err = -EINVAL; |
19985 |
+@@ -537,7 +534,7 @@ static int xsk_setsockopt(struct socket *sock, int level, int optname, |
19986 |
+ |
19987 |
+ /* Make sure umem is ready before it can be seen by others */ |
19988 |
+ smp_wmb(); |
19989 |
+- xs->umem = umem; |
19990 |
++ WRITE_ONCE(xs->umem, umem); |
19991 |
+ mutex_unlock(&xs->mutex); |
19992 |
+ return 0; |
19993 |
+ } |
19994 |
+@@ -661,6 +658,8 @@ static int xsk_mmap(struct file *file, struct socket *sock, |
19995 |
+ if (!umem) |
19996 |
+ return -EINVAL; |
19997 |
+ |
19998 |
++ /* Matches the smp_wmb() in XDP_UMEM_REG */ |
19999 |
++ smp_rmb(); |
20000 |
+ if (offset == XDP_UMEM_PGOFF_FILL_RING) |
20001 |
+ q = READ_ONCE(umem->fq); |
20002 |
+ else if (offset == XDP_UMEM_PGOFF_COMPLETION_RING) |
20003 |
+@@ -670,6 +669,8 @@ static int xsk_mmap(struct file *file, struct socket *sock, |
20004 |
+ if (!q) |
20005 |
+ return -EINVAL; |
20006 |
+ |
20007 |
++ /* Matches the smp_wmb() in xsk_init_queue */ |
20008 |
++ smp_rmb(); |
20009 |
+ qpg = virt_to_head_page(q->ring); |
20010 |
+ if (size > (PAGE_SIZE << compound_order(qpg))) |
20011 |
+ return -EINVAL; |
20012 |
+diff --git a/net/xfrm/xfrm_interface.c b/net/xfrm/xfrm_interface.c |
20013 |
+index d6a3cdf7885c..4ee512622e93 100644 |
20014 |
+--- a/net/xfrm/xfrm_interface.c |
20015 |
++++ b/net/xfrm/xfrm_interface.c |
20016 |
+@@ -145,8 +145,6 @@ static int xfrmi_create(struct net_device *dev) |
20017 |
+ if (err < 0) |
20018 |
+ goto out; |
20019 |
+ |
20020 |
+- strcpy(xi->p.name, dev->name); |
20021 |
+- |
20022 |
+ dev_hold(dev); |
20023 |
+ xfrmi_link(xfrmn, xi); |
20024 |
+ |
20025 |
+@@ -293,7 +291,7 @@ xfrmi_xmit2(struct sk_buff *skb, struct net_device *dev, struct flowi *fl) |
20026 |
+ if (tdev == dev) { |
20027 |
+ stats->collisions++; |
20028 |
+ net_warn_ratelimited("%s: Local routing loop detected!\n", |
20029 |
+- xi->p.name); |
20030 |
++ dev->name); |
20031 |
+ goto tx_err_dst_release; |
20032 |
+ } |
20033 |
+ |
20034 |
+@@ -648,12 +646,6 @@ static int xfrmi_newlink(struct net *src_net, struct net_device *dev, |
20035 |
+ int err; |
20036 |
+ |
20037 |
+ xfrmi_netlink_parms(data, &p); |
20038 |
+- |
20039 |
+- if (!tb[IFLA_IFNAME]) |
20040 |
+- return -EINVAL; |
20041 |
+- |
20042 |
+- nla_strlcpy(p.name, tb[IFLA_IFNAME], IFNAMSIZ); |
20043 |
+- |
20044 |
+ xi = xfrmi_locate(net, &p); |
20045 |
+ if (xi) |
20046 |
+ return -EEXIST; |
20047 |
+diff --git a/samples/bpf/xdp_rxq_info_user.c b/samples/bpf/xdp_rxq_info_user.c |
20048 |
+index ef26f882f92f..a55c81301c1a 100644 |
20049 |
+--- a/samples/bpf/xdp_rxq_info_user.c |
20050 |
++++ b/samples/bpf/xdp_rxq_info_user.c |
20051 |
+@@ -472,9 +472,9 @@ int main(int argc, char **argv) |
20052 |
+ if (bpf_prog_load_xattr(&prog_load_attr, &obj, &prog_fd)) |
20053 |
+ return EXIT_FAIL; |
20054 |
+ |
20055 |
+- map = bpf_map__next(NULL, obj); |
20056 |
+- stats_global_map = bpf_map__next(map, obj); |
20057 |
+- rx_queue_index_map = bpf_map__next(stats_global_map, obj); |
20058 |
++ map = bpf_object__find_map_by_name(obj, "config_map"); |
20059 |
++ stats_global_map = bpf_object__find_map_by_name(obj, "stats_global_map"); |
20060 |
++ rx_queue_index_map = bpf_object__find_map_by_name(obj, "rx_queue_index_map"); |
20061 |
+ if (!map || !stats_global_map || !rx_queue_index_map) { |
20062 |
+ printf("finding a map in obj file failed\n"); |
20063 |
+ return EXIT_FAIL; |
20064 |
+diff --git a/security/apparmor/include/cred.h b/security/apparmor/include/cred.h |
20065 |
+index e287b7d0d4be..265ae6641a06 100644 |
20066 |
+--- a/security/apparmor/include/cred.h |
20067 |
++++ b/security/apparmor/include/cred.h |
20068 |
+@@ -151,6 +151,8 @@ static inline struct aa_label *begin_current_label_crit_section(void) |
20069 |
+ { |
20070 |
+ struct aa_label *label = aa_current_raw_label(); |
20071 |
+ |
20072 |
++ might_sleep(); |
20073 |
++ |
20074 |
+ if (label_is_stale(label)) { |
20075 |
+ label = aa_get_newest_label(label); |
20076 |
+ if (aa_replace_current_label(label) == 0) |
20077 |
+diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c |
20078 |
+index 590ca7d8fae5..730de4638b4e 100644 |
20079 |
+--- a/security/apparmor/lsm.c |
20080 |
++++ b/security/apparmor/lsm.c |
20081 |
+@@ -114,13 +114,13 @@ static int apparmor_ptrace_access_check(struct task_struct *child, |
20082 |
+ struct aa_label *tracer, *tracee; |
20083 |
+ int error; |
20084 |
+ |
20085 |
+- tracer = begin_current_label_crit_section(); |
20086 |
++ tracer = __begin_current_label_crit_section(); |
20087 |
+ tracee = aa_get_task_label(child); |
20088 |
+ error = aa_may_ptrace(tracer, tracee, |
20089 |
+ (mode & PTRACE_MODE_READ) ? AA_PTRACE_READ |
20090 |
+ : AA_PTRACE_TRACE); |
20091 |
+ aa_put_label(tracee); |
20092 |
+- end_current_label_crit_section(tracer); |
20093 |
++ __end_current_label_crit_section(tracer); |
20094 |
+ |
20095 |
+ return error; |
20096 |
+ } |
20097 |
+diff --git a/security/apparmor/net.c b/security/apparmor/net.c |
20098 |
+index bb24cfa0a164..d5d72dd1ca1f 100644 |
20099 |
+--- a/security/apparmor/net.c |
20100 |
++++ b/security/apparmor/net.c |
20101 |
+@@ -146,17 +146,20 @@ int aa_af_perm(struct aa_label *label, const char *op, u32 request, u16 family, |
20102 |
+ static int aa_label_sk_perm(struct aa_label *label, const char *op, u32 request, |
20103 |
+ struct sock *sk) |
20104 |
+ { |
20105 |
+- struct aa_profile *profile; |
20106 |
+- DEFINE_AUDIT_SK(sa, op, sk); |
20107 |
++ int error = 0; |
20108 |
+ |
20109 |
+ AA_BUG(!label); |
20110 |
+ AA_BUG(!sk); |
20111 |
+ |
20112 |
+- if (unconfined(label)) |
20113 |
+- return 0; |
20114 |
++ if (!unconfined(label)) { |
20115 |
++ struct aa_profile *profile; |
20116 |
++ DEFINE_AUDIT_SK(sa, op, sk); |
20117 |
+ |
20118 |
+- return fn_for_each_confined(label, profile, |
20119 |
+- aa_profile_af_sk_perm(profile, &sa, request, sk)); |
20120 |
++ error = fn_for_each_confined(label, profile, |
20121 |
++ aa_profile_af_sk_perm(profile, &sa, request, sk)); |
20122 |
++ } |
20123 |
++ |
20124 |
++ return error; |
20125 |
+ } |
20126 |
+ |
20127 |
+ int aa_sk_perm(const char *op, u32 request, struct sock *sk) |
20128 |
+diff --git a/security/keys/key.c b/security/keys/key.c |
20129 |
+index 249a6da4d277..749a5cf27a19 100644 |
20130 |
+--- a/security/keys/key.c |
20131 |
++++ b/security/keys/key.c |
20132 |
+@@ -297,6 +297,7 @@ struct key *key_alloc(struct key_type *type, const char *desc, |
20133 |
+ key->gid = gid; |
20134 |
+ key->perm = perm; |
20135 |
+ key->restrict_link = restrict_link; |
20136 |
++ key->last_used_at = ktime_get_real_seconds(); |
20137 |
+ |
20138 |
+ if (!(flags & KEY_ALLOC_NOT_IN_QUOTA)) |
20139 |
+ key->flags |= 1 << KEY_FLAG_IN_QUOTA; |
20140 |
+diff --git a/sound/aoa/codecs/onyx.c b/sound/aoa/codecs/onyx.c |
20141 |
+index d2d96ca082b7..6224fd3bbf7c 100644 |
20142 |
+--- a/sound/aoa/codecs/onyx.c |
20143 |
++++ b/sound/aoa/codecs/onyx.c |
20144 |
+@@ -74,8 +74,10 @@ static int onyx_read_register(struct onyx *onyx, u8 reg, u8 *value) |
20145 |
+ return 0; |
20146 |
+ } |
20147 |
+ v = i2c_smbus_read_byte_data(onyx->i2c, reg); |
20148 |
+- if (v < 0) |
20149 |
++ if (v < 0) { |
20150 |
++ *value = 0; |
20151 |
+ return -1; |
20152 |
++ } |
20153 |
+ *value = (u8)v; |
20154 |
+ onyx->cache[ONYX_REG_CONTROL-FIRSTREGISTER] = *value; |
20155 |
+ return 0; |
20156 |
+diff --git a/sound/pci/hda/hda_controller.h b/sound/pci/hda/hda_controller.h |
20157 |
+index 8a9dd4767b1e..63cc10604afc 100644 |
20158 |
+--- a/sound/pci/hda/hda_controller.h |
20159 |
++++ b/sound/pci/hda/hda_controller.h |
20160 |
+@@ -176,11 +176,10 @@ struct azx { |
20161 |
+ #define azx_bus(chip) (&(chip)->bus.core) |
20162 |
+ #define bus_to_azx(_bus) container_of(_bus, struct azx, bus.core) |
20163 |
+ |
20164 |
+-#ifdef CONFIG_X86 |
20165 |
+-#define azx_snoop(chip) ((chip)->snoop) |
20166 |
+-#else |
20167 |
+-#define azx_snoop(chip) true |
20168 |
+-#endif |
20169 |
++static inline bool azx_snoop(struct azx *chip) |
20170 |
++{ |
20171 |
++ return !IS_ENABLED(CONFIG_X86) || chip->snoop; |
20172 |
++} |
20173 |
+ |
20174 |
+ /* |
20175 |
+ * macros for easy use |
20176 |
+diff --git a/sound/sh/aica.c b/sound/sh/aica.c |
20177 |
+index 2b26311405a4..ad3f71358486 100644 |
20178 |
+--- a/sound/sh/aica.c |
20179 |
++++ b/sound/sh/aica.c |
20180 |
+@@ -303,7 +303,7 @@ static void aica_period_elapsed(struct timer_list *t) |
20181 |
+ { |
20182 |
+ struct snd_card_aica *dreamcastcard = from_timer(dreamcastcard, |
20183 |
+ t, timer); |
20184 |
+- struct snd_pcm_substream *substream = dreamcastcard->timer_substream; |
20185 |
++ struct snd_pcm_substream *substream = dreamcastcard->substream; |
20186 |
+ /*timer function - so cannot sleep */ |
20187 |
+ int play_period; |
20188 |
+ struct snd_pcm_runtime *runtime; |
20189 |
+@@ -335,13 +335,6 @@ static void spu_begin_dma(struct snd_pcm_substream *substream) |
20190 |
+ dreamcastcard = substream->pcm->private_data; |
20191 |
+ /*get the queue to do the work */ |
20192 |
+ schedule_work(&(dreamcastcard->spu_dma_work)); |
20193 |
+- /* Timer may already be running */ |
20194 |
+- if (unlikely(dreamcastcard->timer_substream)) { |
20195 |
+- mod_timer(&dreamcastcard->timer, jiffies + 4); |
20196 |
+- return; |
20197 |
+- } |
20198 |
+- timer_setup(&dreamcastcard->timer, aica_period_elapsed, 0); |
20199 |
+- dreamcastcard->timer_substream = substream; |
20200 |
+ mod_timer(&dreamcastcard->timer, jiffies + 4); |
20201 |
+ } |
20202 |
+ |
20203 |
+@@ -379,8 +372,8 @@ static int snd_aicapcm_pcm_close(struct snd_pcm_substream |
20204 |
+ { |
20205 |
+ struct snd_card_aica *dreamcastcard = substream->pcm->private_data; |
20206 |
+ flush_work(&(dreamcastcard->spu_dma_work)); |
20207 |
+- if (dreamcastcard->timer_substream) |
20208 |
+- del_timer(&dreamcastcard->timer); |
20209 |
++ del_timer(&dreamcastcard->timer); |
20210 |
++ dreamcastcard->substream = NULL; |
20211 |
+ kfree(dreamcastcard->channel); |
20212 |
+ spu_disable(); |
20213 |
+ return 0; |
20214 |
+@@ -615,6 +608,7 @@ static int snd_aica_probe(struct platform_device *devptr) |
20215 |
+ "Yamaha AICA Super Intelligent Sound Processor for SEGA Dreamcast"); |
20216 |
+ /* Prepare to use the queue */ |
20217 |
+ INIT_WORK(&(dreamcastcard->spu_dma_work), run_spu_dma); |
20218 |
++ timer_setup(&dreamcastcard->timer, aica_period_elapsed, 0); |
20219 |
+ /* Load the PCM 'chip' */ |
20220 |
+ err = snd_aicapcmchip(dreamcastcard, 0); |
20221 |
+ if (unlikely(err < 0)) |
20222 |
+diff --git a/sound/soc/codecs/cs4349.c b/sound/soc/codecs/cs4349.c |
20223 |
+index bee0e343723f..f08d7a296c0c 100644 |
20224 |
+--- a/sound/soc/codecs/cs4349.c |
20225 |
++++ b/sound/soc/codecs/cs4349.c |
20226 |
+@@ -381,6 +381,7 @@ static struct i2c_driver cs4349_i2c_driver = { |
20227 |
+ .driver = { |
20228 |
+ .name = "cs4349", |
20229 |
+ .of_match_table = cs4349_of_match, |
20230 |
++ .pm = &cs4349_runtime_pm, |
20231 |
+ }, |
20232 |
+ .id_table = cs4349_i2c_id, |
20233 |
+ .probe = cs4349_i2c_probe, |
20234 |
+diff --git a/sound/soc/codecs/es8328.c b/sound/soc/codecs/es8328.c |
20235 |
+index e9fc2fd97d2f..3afa163f7652 100644 |
20236 |
+--- a/sound/soc/codecs/es8328.c |
20237 |
++++ b/sound/soc/codecs/es8328.c |
20238 |
+@@ -231,7 +231,7 @@ static const struct soc_enum es8328_rline_enum = |
20239 |
+ ARRAY_SIZE(es8328_line_texts), |
20240 |
+ es8328_line_texts); |
20241 |
+ static const struct snd_kcontrol_new es8328_right_line_controls = |
20242 |
+- SOC_DAPM_ENUM("Route", es8328_lline_enum); |
20243 |
++ SOC_DAPM_ENUM("Route", es8328_rline_enum); |
20244 |
+ |
20245 |
+ /* Left Mixer */ |
20246 |
+ static const struct snd_kcontrol_new es8328_left_mixer_controls[] = { |
20247 |
+diff --git a/sound/soc/codecs/wm8737.c b/sound/soc/codecs/wm8737.c |
20248 |
+index e9ae821e7609..568b77692f5f 100644 |
20249 |
+--- a/sound/soc/codecs/wm8737.c |
20250 |
++++ b/sound/soc/codecs/wm8737.c |
20251 |
+@@ -170,7 +170,7 @@ SOC_DOUBLE("Polarity Invert Switch", WM8737_ADC_CONTROL, 5, 6, 1, 0), |
20252 |
+ SOC_SINGLE("3D Switch", WM8737_3D_ENHANCE, 0, 1, 0), |
20253 |
+ SOC_SINGLE("3D Depth", WM8737_3D_ENHANCE, 1, 15, 0), |
20254 |
+ SOC_ENUM("3D Low Cut-off", low_3d), |
20255 |
+-SOC_ENUM("3D High Cut-off", low_3d), |
20256 |
++SOC_ENUM("3D High Cut-off", high_3d), |
20257 |
+ SOC_SINGLE_TLV("3D ADC Volume", WM8737_3D_ENHANCE, 7, 1, 1, adc_tlv), |
20258 |
+ |
20259 |
+ SOC_SINGLE("Noise Gate Switch", WM8737_NOISE_GATE, 0, 1, 0), |
20260 |
+diff --git a/sound/soc/codecs/wm9705.c b/sound/soc/codecs/wm9705.c |
20261 |
+index ccdf088461b7..54c306707c02 100644 |
20262 |
+--- a/sound/soc/codecs/wm9705.c |
20263 |
++++ b/sound/soc/codecs/wm9705.c |
20264 |
+@@ -325,8 +325,7 @@ static int wm9705_soc_probe(struct snd_soc_component *component) |
20265 |
+ if (wm9705->mfd_pdata) { |
20266 |
+ wm9705->ac97 = wm9705->mfd_pdata->ac97; |
20267 |
+ regmap = wm9705->mfd_pdata->regmap; |
20268 |
+- } else { |
20269 |
+-#ifdef CONFIG_SND_SOC_AC97_BUS |
20270 |
++ } else if (IS_ENABLED(CONFIG_SND_SOC_AC97_BUS)) { |
20271 |
+ wm9705->ac97 = snd_soc_new_ac97_component(component, WM9705_VENDOR_ID, |
20272 |
+ WM9705_VENDOR_ID_MASK); |
20273 |
+ if (IS_ERR(wm9705->ac97)) { |
20274 |
+@@ -339,7 +338,8 @@ static int wm9705_soc_probe(struct snd_soc_component *component) |
20275 |
+ snd_soc_free_ac97_component(wm9705->ac97); |
20276 |
+ return PTR_ERR(regmap); |
20277 |
+ } |
20278 |
+-#endif |
20279 |
++ } else { |
20280 |
++ return -ENXIO; |
20281 |
+ } |
20282 |
+ |
20283 |
+ snd_soc_component_set_drvdata(component, wm9705->ac97); |
20284 |
+@@ -350,14 +350,12 @@ static int wm9705_soc_probe(struct snd_soc_component *component) |
20285 |
+ |
20286 |
+ static void wm9705_soc_remove(struct snd_soc_component *component) |
20287 |
+ { |
20288 |
+-#ifdef CONFIG_SND_SOC_AC97_BUS |
20289 |
+ struct wm9705_priv *wm9705 = snd_soc_component_get_drvdata(component); |
20290 |
+ |
20291 |
+- if (!wm9705->mfd_pdata) { |
20292 |
++ if (IS_ENABLED(CONFIG_SND_SOC_AC97_BUS) && !wm9705->mfd_pdata) { |
20293 |
+ snd_soc_component_exit_regmap(component); |
20294 |
+ snd_soc_free_ac97_component(wm9705->ac97); |
20295 |
+ } |
20296 |
+-#endif |
20297 |
+ } |
20298 |
+ |
20299 |
+ static const struct snd_soc_component_driver soc_component_dev_wm9705 = { |
20300 |
+diff --git a/sound/soc/codecs/wm9712.c b/sound/soc/codecs/wm9712.c |
20301 |
+index ade34c26ad2f..01949eaba4fd 100644 |
20302 |
+--- a/sound/soc/codecs/wm9712.c |
20303 |
++++ b/sound/soc/codecs/wm9712.c |
20304 |
+@@ -638,13 +638,13 @@ static int wm9712_soc_probe(struct snd_soc_component *component) |
20305 |
+ { |
20306 |
+ struct wm9712_priv *wm9712 = snd_soc_component_get_drvdata(component); |
20307 |
+ struct regmap *regmap; |
20308 |
+- int ret; |
20309 |
+ |
20310 |
+ if (wm9712->mfd_pdata) { |
20311 |
+ wm9712->ac97 = wm9712->mfd_pdata->ac97; |
20312 |
+ regmap = wm9712->mfd_pdata->regmap; |
20313 |
+- } else { |
20314 |
+-#ifdef CONFIG_SND_SOC_AC97_BUS |
20315 |
++ } else if (IS_ENABLED(CONFIG_SND_SOC_AC97_BUS)) { |
20316 |
++ int ret; |
20317 |
++ |
20318 |
+ wm9712->ac97 = snd_soc_new_ac97_component(component, WM9712_VENDOR_ID, |
20319 |
+ WM9712_VENDOR_ID_MASK); |
20320 |
+ if (IS_ERR(wm9712->ac97)) { |
20321 |
+@@ -659,7 +659,8 @@ static int wm9712_soc_probe(struct snd_soc_component *component) |
20322 |
+ snd_soc_free_ac97_component(wm9712->ac97); |
20323 |
+ return PTR_ERR(regmap); |
20324 |
+ } |
20325 |
+-#endif |
20326 |
++ } else { |
20327 |
++ return -ENXIO; |
20328 |
+ } |
20329 |
+ |
20330 |
+ snd_soc_component_init_regmap(component, regmap); |
20331 |
+@@ -672,14 +673,12 @@ static int wm9712_soc_probe(struct snd_soc_component *component) |
20332 |
+ |
20333 |
+ static void wm9712_soc_remove(struct snd_soc_component *component) |
20334 |
+ { |
20335 |
+-#ifdef CONFIG_SND_SOC_AC97_BUS |
20336 |
+ struct wm9712_priv *wm9712 = snd_soc_component_get_drvdata(component); |
20337 |
+ |
20338 |
+- if (!wm9712->mfd_pdata) { |
20339 |
++ if (IS_ENABLED(CONFIG_SND_SOC_AC97_BUS) && !wm9712->mfd_pdata) { |
20340 |
+ snd_soc_component_exit_regmap(component); |
20341 |
+ snd_soc_free_ac97_component(wm9712->ac97); |
20342 |
+ } |
20343 |
+-#endif |
20344 |
+ } |
20345 |
+ |
20346 |
+ static const struct snd_soc_component_driver soc_component_dev_wm9712 = { |
20347 |
+diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c |
20348 |
+index 643863bb32e0..5a2fdf4f69bf 100644 |
20349 |
+--- a/sound/soc/codecs/wm9713.c |
20350 |
++++ b/sound/soc/codecs/wm9713.c |
20351 |
+@@ -1214,8 +1214,7 @@ static int wm9713_soc_probe(struct snd_soc_component *component) |
20352 |
+ if (wm9713->mfd_pdata) { |
20353 |
+ wm9713->ac97 = wm9713->mfd_pdata->ac97; |
20354 |
+ regmap = wm9713->mfd_pdata->regmap; |
20355 |
+- } else { |
20356 |
+-#ifdef CONFIG_SND_SOC_AC97_BUS |
20357 |
++ } else if (IS_ENABLED(CONFIG_SND_SOC_AC97_BUS)) { |
20358 |
+ wm9713->ac97 = snd_soc_new_ac97_component(component, WM9713_VENDOR_ID, |
20359 |
+ WM9713_VENDOR_ID_MASK); |
20360 |
+ if (IS_ERR(wm9713->ac97)) |
20361 |
+@@ -1225,7 +1224,8 @@ static int wm9713_soc_probe(struct snd_soc_component *component) |
20362 |
+ snd_soc_free_ac97_component(wm9713->ac97); |
20363 |
+ return PTR_ERR(regmap); |
20364 |
+ } |
20365 |
+-#endif |
20366 |
++ } else { |
20367 |
++ return -ENXIO; |
20368 |
+ } |
20369 |
+ |
20370 |
+ snd_soc_component_init_regmap(component, regmap); |
20371 |
+@@ -1238,14 +1238,12 @@ static int wm9713_soc_probe(struct snd_soc_component *component) |
20372 |
+ |
20373 |
+ static void wm9713_soc_remove(struct snd_soc_component *component) |
20374 |
+ { |
20375 |
+-#ifdef CONFIG_SND_SOC_AC97_BUS |
20376 |
+ struct wm9713_priv *wm9713 = snd_soc_component_get_drvdata(component); |
20377 |
+ |
20378 |
+- if (!wm9713->mfd_pdata) { |
20379 |
++ if (IS_ENABLED(CONFIG_SND_SOC_AC97_BUS) && !wm9713->mfd_pdata) { |
20380 |
+ snd_soc_component_exit_regmap(component); |
20381 |
+ snd_soc_free_ac97_component(wm9713->ac97); |
20382 |
+ } |
20383 |
+-#endif |
20384 |
+ } |
20385 |
+ |
20386 |
+ static const struct snd_soc_component_driver soc_component_dev_wm9713 = { |
20387 |
+diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c |
20388 |
+index 6a8c279a4b20..14ab16e1369f 100644 |
20389 |
+--- a/sound/soc/davinci/davinci-mcasp.c |
20390 |
++++ b/sound/soc/davinci/davinci-mcasp.c |
20391 |
+@@ -874,14 +874,13 @@ static int mcasp_i2s_hw_param(struct davinci_mcasp *mcasp, int stream, |
20392 |
+ active_slots = hweight32(mcasp->tdm_mask[stream]); |
20393 |
+ active_serializers = (channels + active_slots - 1) / |
20394 |
+ active_slots; |
20395 |
+- if (active_serializers == 1) { |
20396 |
++ if (active_serializers == 1) |
20397 |
+ active_slots = channels; |
20398 |
+- for (i = 0; i < total_slots; i++) { |
20399 |
+- if ((1 << i) & mcasp->tdm_mask[stream]) { |
20400 |
+- mask |= (1 << i); |
20401 |
+- if (--active_slots <= 0) |
20402 |
+- break; |
20403 |
+- } |
20404 |
++ for (i = 0; i < total_slots; i++) { |
20405 |
++ if ((1 << i) & mcasp->tdm_mask[stream]) { |
20406 |
++ mask |= (1 << i); |
20407 |
++ if (--active_slots <= 0) |
20408 |
++ break; |
20409 |
+ } |
20410 |
+ } |
20411 |
+ } else { |
20412 |
+diff --git a/sound/soc/fsl/imx-sgtl5000.c b/sound/soc/fsl/imx-sgtl5000.c |
20413 |
+index 9b9a7ec52905..4bd8da3a5f5b 100644 |
20414 |
+--- a/sound/soc/fsl/imx-sgtl5000.c |
20415 |
++++ b/sound/soc/fsl/imx-sgtl5000.c |
20416 |
+@@ -112,7 +112,8 @@ static int imx_sgtl5000_probe(struct platform_device *pdev) |
20417 |
+ codec_dev = of_find_i2c_device_by_node(codec_np); |
20418 |
+ if (!codec_dev) { |
20419 |
+ dev_err(&pdev->dev, "failed to find codec platform device\n"); |
20420 |
+- return -EPROBE_DEFER; |
20421 |
++ ret = -EPROBE_DEFER; |
20422 |
++ goto fail; |
20423 |
+ } |
20424 |
+ |
20425 |
+ data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); |
20426 |
+diff --git a/sound/soc/meson/axg-tdmin.c b/sound/soc/meson/axg-tdmin.c |
20427 |
+index bbac44c81688..37207bbebb2a 100644 |
20428 |
+--- a/sound/soc/meson/axg-tdmin.c |
20429 |
++++ b/sound/soc/meson/axg-tdmin.c |
20430 |
+@@ -119,7 +119,6 @@ static int axg_tdmin_prepare(struct regmap *map, struct axg_tdm_stream *ts) |
20431 |
+ break; |
20432 |
+ |
20433 |
+ case SND_SOC_DAIFMT_LEFT_J: |
20434 |
+- case SND_SOC_DAIFMT_RIGHT_J: |
20435 |
+ case SND_SOC_DAIFMT_DSP_B: |
20436 |
+ val = TDMIN_CTRL_IN_BIT_SKEW(2); |
20437 |
+ break; |
20438 |
+diff --git a/sound/soc/meson/axg-tdmout.c b/sound/soc/meson/axg-tdmout.c |
20439 |
+index f73368ee1088..d11acb3cc696 100644 |
20440 |
+--- a/sound/soc/meson/axg-tdmout.c |
20441 |
++++ b/sound/soc/meson/axg-tdmout.c |
20442 |
+@@ -136,7 +136,6 @@ static int axg_tdmout_prepare(struct regmap *map, struct axg_tdm_stream *ts) |
20443 |
+ break; |
20444 |
+ |
20445 |
+ case SND_SOC_DAIFMT_LEFT_J: |
20446 |
+- case SND_SOC_DAIFMT_RIGHT_J: |
20447 |
+ case SND_SOC_DAIFMT_DSP_B: |
20448 |
+ val |= TDMOUT_CTRL0_INIT_BITNUM(2); |
20449 |
+ break; |
20450 |
+diff --git a/sound/soc/qcom/apq8016_sbc.c b/sound/soc/qcom/apq8016_sbc.c |
20451 |
+index 1dd23bba1bed..4b559932adc3 100644 |
20452 |
+--- a/sound/soc/qcom/apq8016_sbc.c |
20453 |
++++ b/sound/soc/qcom/apq8016_sbc.c |
20454 |
+@@ -164,41 +164,52 @@ static struct apq8016_sbc_data *apq8016_sbc_parse_of(struct snd_soc_card *card) |
20455 |
+ |
20456 |
+ if (!cpu || !codec) { |
20457 |
+ dev_err(dev, "Can't find cpu/codec DT node\n"); |
20458 |
+- return ERR_PTR(-EINVAL); |
20459 |
++ ret = -EINVAL; |
20460 |
++ goto error; |
20461 |
+ } |
20462 |
+ |
20463 |
+ link->cpu_of_node = of_parse_phandle(cpu, "sound-dai", 0); |
20464 |
+ if (!link->cpu_of_node) { |
20465 |
+ dev_err(card->dev, "error getting cpu phandle\n"); |
20466 |
+- return ERR_PTR(-EINVAL); |
20467 |
++ ret = -EINVAL; |
20468 |
++ goto error; |
20469 |
+ } |
20470 |
+ |
20471 |
+ ret = snd_soc_of_get_dai_name(cpu, &link->cpu_dai_name); |
20472 |
+ if (ret) { |
20473 |
+ dev_err(card->dev, "error getting cpu dai name\n"); |
20474 |
+- return ERR_PTR(ret); |
20475 |
++ goto error; |
20476 |
+ } |
20477 |
+ |
20478 |
+ ret = snd_soc_of_get_dai_link_codecs(dev, codec, link); |
20479 |
+ |
20480 |
+ if (ret < 0) { |
20481 |
+ dev_err(card->dev, "error getting codec dai name\n"); |
20482 |
+- return ERR_PTR(ret); |
20483 |
++ goto error; |
20484 |
+ } |
20485 |
+ |
20486 |
+ link->platform_of_node = link->cpu_of_node; |
20487 |
+ ret = of_property_read_string(np, "link-name", &link->name); |
20488 |
+ if (ret) { |
20489 |
+ dev_err(card->dev, "error getting codec dai_link name\n"); |
20490 |
+- return ERR_PTR(ret); |
20491 |
++ goto error; |
20492 |
+ } |
20493 |
+ |
20494 |
+ link->stream_name = link->name; |
20495 |
+ link->init = apq8016_sbc_dai_init; |
20496 |
+ link++; |
20497 |
++ |
20498 |
++ of_node_put(cpu); |
20499 |
++ of_node_put(codec); |
20500 |
+ } |
20501 |
+ |
20502 |
+ return data; |
20503 |
++ |
20504 |
++ error: |
20505 |
++ of_node_put(np); |
20506 |
++ of_node_put(cpu); |
20507 |
++ of_node_put(codec); |
20508 |
++ return ERR_PTR(ret); |
20509 |
+ } |
20510 |
+ |
20511 |
+ static const struct snd_soc_dapm_widget apq8016_sbc_dapm_widgets[] = { |
20512 |
+diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c |
20513 |
+index 551bfc581fc1..53fefa7c982f 100644 |
20514 |
+--- a/sound/soc/soc-pcm.c |
20515 |
++++ b/sound/soc/soc-pcm.c |
20516 |
+@@ -42,8 +42,8 @@ static bool snd_soc_dai_stream_valid(struct snd_soc_dai *dai, int stream) |
20517 |
+ else |
20518 |
+ codec_stream = &dai->driver->capture; |
20519 |
+ |
20520 |
+- /* If the codec specifies any rate at all, it supports the stream. */ |
20521 |
+- return codec_stream->rates; |
20522 |
++ /* If the codec specifies any channels at all, it supports the stream */ |
20523 |
++ return codec_stream->channels_min; |
20524 |
+ } |
20525 |
+ |
20526 |
+ /** |
20527 |
+diff --git a/sound/soc/sunxi/sun4i-i2s.c b/sound/soc/sunxi/sun4i-i2s.c |
20528 |
+index 18cf8404d27c..f248e563986c 100644 |
20529 |
+--- a/sound/soc/sunxi/sun4i-i2s.c |
20530 |
++++ b/sound/soc/sunxi/sun4i-i2s.c |
20531 |
+@@ -80,8 +80,8 @@ |
20532 |
+ #define SUN4I_I2S_CLK_DIV_MCLK_MASK GENMASK(3, 0) |
20533 |
+ #define SUN4I_I2S_CLK_DIV_MCLK(mclk) ((mclk) << 0) |
20534 |
+ |
20535 |
+-#define SUN4I_I2S_RX_CNT_REG 0x28 |
20536 |
+-#define SUN4I_I2S_TX_CNT_REG 0x2c |
20537 |
++#define SUN4I_I2S_TX_CNT_REG 0x28 |
20538 |
++#define SUN4I_I2S_RX_CNT_REG 0x2c |
20539 |
+ |
20540 |
+ #define SUN4I_I2S_TX_CHAN_SEL_REG 0x30 |
20541 |
+ #define SUN4I_I2S_CHAN_SEL(num_chan) (((num_chan) - 1) << 0) |
20542 |
+diff --git a/sound/soc/sunxi/sun8i-codec.c b/sound/soc/sunxi/sun8i-codec.c |
20543 |
+index bf615fa16dc8..a3db6a68dfe6 100644 |
20544 |
+--- a/sound/soc/sunxi/sun8i-codec.c |
20545 |
++++ b/sound/soc/sunxi/sun8i-codec.c |
20546 |
+@@ -465,7 +465,11 @@ static const struct snd_soc_dapm_route sun8i_codec_dapm_routes[] = { |
20547 |
+ { "Right Digital DAC Mixer", "AIF1 Slot 0 Digital DAC Playback Switch", |
20548 |
+ "AIF1 Slot 0 Right"}, |
20549 |
+ |
20550 |
+- /* ADC routes */ |
20551 |
++ /* ADC Routes */ |
20552 |
++ { "AIF1 Slot 0 Right ADC", NULL, "ADC" }, |
20553 |
++ { "AIF1 Slot 0 Left ADC", NULL, "ADC" }, |
20554 |
++ |
20555 |
++ /* ADC Mixer Routes */ |
20556 |
+ { "Left Digital ADC Mixer", "AIF1 Data Digital ADC Capture Switch", |
20557 |
+ "AIF1 Slot 0 Left ADC" }, |
20558 |
+ { "Right Digital ADC Mixer", "AIF1 Data Digital ADC Capture Switch", |
20559 |
+diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c |
20560 |
+index d7778f2bcbf8..6ac6a0980124 100644 |
20561 |
+--- a/sound/usb/mixer.c |
20562 |
++++ b/sound/usb/mixer.c |
20563 |
+@@ -3480,7 +3480,9 @@ int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif, |
20564 |
+ if (err < 0) |
20565 |
+ goto _error; |
20566 |
+ |
20567 |
+- snd_usb_mixer_apply_create_quirk(mixer); |
20568 |
++ err = snd_usb_mixer_apply_create_quirk(mixer); |
20569 |
++ if (err < 0) |
20570 |
++ goto _error; |
20571 |
+ |
20572 |
+ err = snd_device_new(chip->card, SNDRV_DEV_CODEC, mixer, &dev_ops); |
20573 |
+ if (err < 0) |
20574 |
+diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h |
20575 |
+index 65f9c4ba62ee..90d4f61cc230 100644 |
20576 |
+--- a/sound/usb/quirks-table.h |
20577 |
++++ b/sound/usb/quirks-table.h |
20578 |
+@@ -3349,19 +3349,14 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"), |
20579 |
+ .ifnum = 0, |
20580 |
+ .type = QUIRK_AUDIO_STANDARD_MIXER, |
20581 |
+ }, |
20582 |
+- /* Capture */ |
20583 |
+- { |
20584 |
+- .ifnum = 1, |
20585 |
+- .type = QUIRK_IGNORE_INTERFACE, |
20586 |
+- }, |
20587 |
+ /* Playback */ |
20588 |
+ { |
20589 |
+- .ifnum = 2, |
20590 |
++ .ifnum = 1, |
20591 |
+ .type = QUIRK_AUDIO_FIXED_ENDPOINT, |
20592 |
+ .data = &(const struct audioformat) { |
20593 |
+ .formats = SNDRV_PCM_FMTBIT_S16_LE, |
20594 |
+ .channels = 2, |
20595 |
+- .iface = 2, |
20596 |
++ .iface = 1, |
20597 |
+ .altsetting = 1, |
20598 |
+ .altset_idx = 1, |
20599 |
+ .attributes = UAC_EP_CS_ATTR_FILL_MAX | |
20600 |
+diff --git a/tools/bpf/bpftool/btf_dumper.c b/tools/bpf/bpftool/btf_dumper.c |
20601 |
+index e4e6e2b3fd84..ff0cc3c17141 100644 |
20602 |
+--- a/tools/bpf/bpftool/btf_dumper.c |
20603 |
++++ b/tools/bpf/bpftool/btf_dumper.c |
20604 |
+@@ -26,9 +26,9 @@ static void btf_dumper_ptr(const void *data, json_writer_t *jw, |
20605 |
+ bool is_plain_text) |
20606 |
+ { |
20607 |
+ if (is_plain_text) |
20608 |
+- jsonw_printf(jw, "%p", *(unsigned long *)data); |
20609 |
++ jsonw_printf(jw, "%p", data); |
20610 |
+ else |
20611 |
+- jsonw_printf(jw, "%u", *(unsigned long *)data); |
20612 |
++ jsonw_printf(jw, "%lu", *(unsigned long *)data); |
20613 |
+ } |
20614 |
+ |
20615 |
+ static int btf_dumper_modifier(const struct btf_dumper *d, __u32 type_id, |
20616 |
+@@ -129,7 +129,7 @@ static int btf_dumper_int(const struct btf_type *t, __u8 bit_offset, |
20617 |
+ switch (BTF_INT_ENCODING(*int_type)) { |
20618 |
+ case 0: |
20619 |
+ if (BTF_INT_BITS(*int_type) == 64) |
20620 |
+- jsonw_printf(jw, "%lu", *(__u64 *)data); |
20621 |
++ jsonw_printf(jw, "%llu", *(__u64 *)data); |
20622 |
+ else if (BTF_INT_BITS(*int_type) == 32) |
20623 |
+ jsonw_printf(jw, "%u", *(__u32 *)data); |
20624 |
+ else if (BTF_INT_BITS(*int_type) == 16) |
20625 |
+@@ -142,7 +142,7 @@ static int btf_dumper_int(const struct btf_type *t, __u8 bit_offset, |
20626 |
+ break; |
20627 |
+ case BTF_INT_SIGNED: |
20628 |
+ if (BTF_INT_BITS(*int_type) == 64) |
20629 |
+- jsonw_printf(jw, "%ld", *(long long *)data); |
20630 |
++ jsonw_printf(jw, "%lld", *(long long *)data); |
20631 |
+ else if (BTF_INT_BITS(*int_type) == 32) |
20632 |
+ jsonw_printf(jw, "%d", *(int *)data); |
20633 |
+ else if (BTF_INT_BITS(*int_type) == 16) |
20634 |
+diff --git a/tools/bpf/bpftool/cgroup.c b/tools/bpf/bpftool/cgroup.c |
20635 |
+index ee7a9765c6b3..adbcd84818f7 100644 |
20636 |
+--- a/tools/bpf/bpftool/cgroup.c |
20637 |
++++ b/tools/bpf/bpftool/cgroup.c |
20638 |
+@@ -164,7 +164,7 @@ static int do_show(int argc, char **argv) |
20639 |
+ |
20640 |
+ cgroup_fd = open(argv[0], O_RDONLY); |
20641 |
+ if (cgroup_fd < 0) { |
20642 |
+- p_err("can't open cgroup %s", argv[1]); |
20643 |
++ p_err("can't open cgroup %s", argv[0]); |
20644 |
+ goto exit; |
20645 |
+ } |
20646 |
+ |
20647 |
+@@ -345,7 +345,7 @@ static int do_attach(int argc, char **argv) |
20648 |
+ |
20649 |
+ cgroup_fd = open(argv[0], O_RDONLY); |
20650 |
+ if (cgroup_fd < 0) { |
20651 |
+- p_err("can't open cgroup %s", argv[1]); |
20652 |
++ p_err("can't open cgroup %s", argv[0]); |
20653 |
+ goto exit; |
20654 |
+ } |
20655 |
+ |
20656 |
+@@ -403,7 +403,7 @@ static int do_detach(int argc, char **argv) |
20657 |
+ |
20658 |
+ cgroup_fd = open(argv[0], O_RDONLY); |
20659 |
+ if (cgroup_fd < 0) { |
20660 |
+- p_err("can't open cgroup %s", argv[1]); |
20661 |
++ p_err("can't open cgroup %s", argv[0]); |
20662 |
+ goto exit; |
20663 |
+ } |
20664 |
+ |
20665 |
+diff --git a/tools/bpf/bpftool/map_perf_ring.c b/tools/bpf/bpftool/map_perf_ring.c |
20666 |
+index 6d41323be291..8ec0148d7426 100644 |
20667 |
+--- a/tools/bpf/bpftool/map_perf_ring.c |
20668 |
++++ b/tools/bpf/bpftool/map_perf_ring.c |
20669 |
+@@ -205,7 +205,7 @@ int do_event_pipe(int argc, char **argv) |
20670 |
+ NEXT_ARG(); |
20671 |
+ cpu = strtoul(*argv, &endptr, 0); |
20672 |
+ if (*endptr) { |
20673 |
+- p_err("can't parse %s as CPU ID", **argv); |
20674 |
++ p_err("can't parse %s as CPU ID", *argv); |
20675 |
+ goto err_close_map; |
20676 |
+ } |
20677 |
+ |
20678 |
+@@ -216,7 +216,7 @@ int do_event_pipe(int argc, char **argv) |
20679 |
+ NEXT_ARG(); |
20680 |
+ index = strtoul(*argv, &endptr, 0); |
20681 |
+ if (*endptr) { |
20682 |
+- p_err("can't parse %s as index", **argv); |
20683 |
++ p_err("can't parse %s as index", *argv); |
20684 |
+ goto err_close_map; |
20685 |
+ } |
20686 |
+ |
20687 |
+diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c |
20688 |
+index 21f867a543e0..ab208400ea14 100644 |
20689 |
+--- a/tools/perf/util/machine.c |
20690 |
++++ b/tools/perf/util/machine.c |
20691 |
+@@ -681,24 +681,6 @@ int machine__process_switch_event(struct machine *machine __maybe_unused, |
20692 |
+ return 0; |
20693 |
+ } |
20694 |
+ |
20695 |
+-static void dso__adjust_kmod_long_name(struct dso *dso, const char *filename) |
20696 |
+-{ |
20697 |
+- const char *dup_filename; |
20698 |
+- |
20699 |
+- if (!filename || !dso || !dso->long_name) |
20700 |
+- return; |
20701 |
+- if (dso->long_name[0] != '[') |
20702 |
+- return; |
20703 |
+- if (!strchr(filename, '/')) |
20704 |
+- return; |
20705 |
+- |
20706 |
+- dup_filename = strdup(filename); |
20707 |
+- if (!dup_filename) |
20708 |
+- return; |
20709 |
+- |
20710 |
+- dso__set_long_name(dso, dup_filename, true); |
20711 |
+-} |
20712 |
+- |
20713 |
+ struct map *machine__findnew_module_map(struct machine *machine, u64 start, |
20714 |
+ const char *filename) |
20715 |
+ { |
20716 |
+@@ -710,15 +692,8 @@ struct map *machine__findnew_module_map(struct machine *machine, u64 start, |
20717 |
+ return NULL; |
20718 |
+ |
20719 |
+ map = map_groups__find_by_name(&machine->kmaps, m.name); |
20720 |
+- if (map) { |
20721 |
+- /* |
20722 |
+- * If the map's dso is an offline module, give dso__load() |
20723 |
+- * a chance to find the file path of that module by fixing |
20724 |
+- * long_name. |
20725 |
+- */ |
20726 |
+- dso__adjust_kmod_long_name(map->dso, filename); |
20727 |
++ if (map) |
20728 |
+ goto out; |
20729 |
+- } |
20730 |
+ |
20731 |
+ dso = machine__findnew_module_dso(machine, &m, filename); |
20732 |
+ if (dso == NULL) |
20733 |
+diff --git a/tools/testing/selftests/ipc/msgque.c b/tools/testing/selftests/ipc/msgque.c |
20734 |
+index dac927e82336..4c156aeab6b8 100644 |
20735 |
+--- a/tools/testing/selftests/ipc/msgque.c |
20736 |
++++ b/tools/testing/selftests/ipc/msgque.c |
20737 |
+@@ -1,9 +1,10 @@ |
20738 |
+ // SPDX-License-Identifier: GPL-2.0 |
20739 |
++#define _GNU_SOURCE |
20740 |
+ #include <stdlib.h> |
20741 |
+ #include <stdio.h> |
20742 |
+ #include <string.h> |
20743 |
+ #include <errno.h> |
20744 |
+-#include <linux/msg.h> |
20745 |
++#include <sys/msg.h> |
20746 |
+ #include <fcntl.h> |
20747 |
+ |
20748 |
+ #include "../kselftest.h" |
20749 |
+@@ -73,7 +74,7 @@ int restore_queue(struct msgque_data *msgque) |
20750 |
+ return 0; |
20751 |
+ |
20752 |
+ destroy: |
20753 |
+- if (msgctl(id, IPC_RMID, 0)) |
20754 |
++ if (msgctl(id, IPC_RMID, NULL)) |
20755 |
+ printf("Failed to destroy queue: %d\n", -errno); |
20756 |
+ return ret; |
20757 |
+ } |
20758 |
+@@ -120,7 +121,7 @@ int check_and_destroy_queue(struct msgque_data *msgque) |
20759 |
+ |
20760 |
+ ret = 0; |
20761 |
+ err: |
20762 |
+- if (msgctl(msgque->msq_id, IPC_RMID, 0)) { |
20763 |
++ if (msgctl(msgque->msq_id, IPC_RMID, NULL)) { |
20764 |
+ printf("Failed to destroy queue: %d\n", -errno); |
20765 |
+ return -errno; |
20766 |
+ } |
20767 |
+@@ -129,7 +130,7 @@ err: |
20768 |
+ |
20769 |
+ int dump_queue(struct msgque_data *msgque) |
20770 |
+ { |
20771 |
+- struct msqid64_ds ds; |
20772 |
++ struct msqid_ds ds; |
20773 |
+ int kern_id; |
20774 |
+ int i, ret; |
20775 |
+ |
20776 |
+@@ -245,7 +246,7 @@ int main(int argc, char **argv) |
20777 |
+ return ksft_exit_pass(); |
20778 |
+ |
20779 |
+ err_destroy: |
20780 |
+- if (msgctl(msgque.msq_id, IPC_RMID, 0)) { |
20781 |
++ if (msgctl(msgque.msq_id, IPC_RMID, NULL)) { |
20782 |
+ printf("Failed to destroy queue: %d\n", -errno); |
20783 |
+ return ksft_exit_fail(); |
20784 |
+ } |